public function setEPG($startTime) { $out = []; $i = 0; $data = json_decode(file_get_contents(Conf::SAVEPATH . '/' . $this->id . '-playlist.json'), true); $start = $startTime - strtotime("00:00:00"); foreach ($data as $key => $value) { $tmp = $key === 0 ? 0 : $data[$key - 1]['duration']; $startTime = $startTime + $tmp; if ($data[$key]['duration'] > Conf::EPG_MIN_DURATION and strpos($data[$key]['name'], Conf::EPG_HIDE_PREFIX) !== 0) { $out[$i]["program"] = cleanNames($data[$key]['name']); $out[$i]["start"] = date("c", $startTime); $i = $i + 1; } } echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); file_put_contents(Conf::EPGDIR . '/' . $this->id . '-epg.json', json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); }
$data = json_decode(file_get_contents('data.json'), true); $peopleIndex = $data[0]; $messages = $data[1]; /* * Messages sorted and ordered */ foreach ($messages as $message) { if (count($message[0]) == 2) { $person1 = cleanNames($message[0][0]); $person2 = cleanNames($message[0][1]); echo $person1 . "\t" . $person2 . "\r\n"; //export for ($i = 1; $i < count($message); $i += 1) { //sprehod foreach ($message[$i] as $sporocilo) { $from = cleanNames($sporocilo[0]); $date = convertDate($sporocilo[1]); $to = ''; if ($from == $person1) { $to = $person2; } else { $to = $person1; } //echo $from.' '.$to.' '.$date; //echo "\r\n"; $sql = "INSERT INTO `traffic` VALUES('" . $from . "', '" . $to . "', '" . $date . "')"; $PDO->query($sql); } } //*/ }