if (toTimestamp($prg['starttime']) < $top_time) { $height = (toTimestamp($prg['endtime']) - $top_time) * $settings->height_per_hour / 3600; } // $last_time より遅く終わる番組 if (toTimestamp($prg['endtime']) > $last_time) { $height = ($last_time - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600; } // プログラムを埋める $cat = new DBRecord(CATEGORY_TBL, "id", $prg['category_id']); $programs[$st]['list'][$num]['category_name'] = $cat->name_en; $programs[$st]['list'][$num]['height'] = $height; $programs[$st]['list'][$num]['title'] = $prg['title']; $programs[$st]['list'][$num]['starttime'] = date("H:i", $start) . ""; $programs[$st]['list'][$num]['description'] = $prg['description']; $programs[$st]['list'][$num]['prg_start'] = str_replace("-", "/", $prg['starttime']); $programs[$st]['list'][$num]['duration'] = "" . (toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])); $programs[$st]['list'][$num]['channel'] = ($prg['type'] == "GR" ? "地上D" : "BS") . ":" . $prg['channel'] . "ch"; $programs[$st]['list'][$num]['id'] = "" . $prg['id']; $programs[$st]['list'][$num]['rec'] = DBRecord::countRecords(RESERVE_TBL, "WHERE complete = '0' AND program_id = '" . $prg['id'] . "'"); $num++; } } catch (exception $e) { // exit( $e->getMessage() ); // 何もしない } // 空きを埋める if ($last_time - $prev_end > 0) { $height = ($last_time - $prev_end) * $settings->height_per_hour / 3600; $height = $height; $programs[$st]['list'][$num]['category_name'] = "none"; $programs[$st]['list'][$num]['height'] = $height;
public static function cancel($reserve_id = 0, $program_id = 0) { $settings = Settings::factory(); $rec = null; try { if ($reserve_id) { $rec = new DBRecord(RESERVE_TBL, "id", $reserve_id); } else { if ($program_id) { $rec = new DBRecord(RESERVE_TBL, "program_id", $program_id); } } if ($rec == null) { throw new Exception("IDの指定が無効です"); } if (!$rec->complete) { // 未実行の予約である if (toTimestamp($rec->starttime) < time() + PADDING_TIME + $settings->former_time) { throw new Exception("過去の録画予約です"); } exec($settings->atrm . " " . $rec->job); } $rec->delete(); } catch (Exception $e) { throw $e; } }
/** * @param AtomEntryAdapter $item * @return array */ public function readCommentEntry(AtomEntryAdapter $entry) { // Get the activity entry $activityEntry = $entry->getExtension(ActivityNS::NS); $data = array(); $published = $entry->getPublished(); if (isset($published)) { // The published value of the data is only obtained from the atom:published, otherwise it is not exists $data['timestamp'] = toTimestamp($published->value); } else { $data['timestamp'] = ''; } // process the entry if (isset($activityEntry->object[0])) { $object = $activityEntry->object[0]; if (isset($activityEntry->object[0]->id)) { // Get the Object IRI $data['iri'] = $activityEntry->object[0]->id->value; } else { $data['iri'] = ''; } $data['comment'] = $object->content->value; $author = $object->author[0]; $data['name'] = @$author->name; $data['email'] = @$author->email; $data['website'] = @$author->uri; } return $data; }
header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); include_once "config.php"; include_once INSTALL_PATH . "/DBRecord.class.php"; include_once INSTALL_PATH . "/reclib.php"; include_once INSTALL_PATH . "/Settings.class.php"; $settings = Settings::factory(); if (!isset($_GET['reserve_id'])) { jdialog("予約番号が指定されていません", "recordedTable.php"); } $reserve_id = $_GET['reserve_id']; try { $rrec = new DBRecord(RESERVE_TBL, "id", $reserve_id); $start_time = toTimestamp($rrec->starttime); $end_time = toTimestamp($rrec->endtime); $duration = $end_time - $start_time; $size = 3 * 1024 * 1024 * $duration; // 1秒あたり3MBと仮定 header('Content-type: video/mpeg'); header('Content-Disposition: inline; filename="' . $rrec->path . '"'); header('Content-Length: ' . $size); ob_clean(); flush(); $fp = @fopen(INSTALL_PATH . $settings->spool . "/" . $rrec->path, "r"); if ($fp !== false) { do { $start = microtime(true); if (feof($fp)) { break; }
} } } ?> </tr> <?php if (!empty($entities)) { foreach ($entities as $entity) { if (!$entity['enabled']) { continue; } echo "<tr class='data-node'>"; echo "<td class='status'><div class='status-div'></div></td>"; echo "<td class='time' data-time=" . (empty($entity['lastInsertDate']) ? "" : toTimestamp($entity['lastInsertDate'])) . ">" . (empty($entity['lastInsertDate']) ? "" : prepareDate($entity['lastInsertDate'])) . "</td>"; echo "<td class='diff' sorttable_customkey='" . (empty($entity['lastInsertDate']) ? "0" : toTimestamp($entity['lastInsertDate'])) . "'>" . (empty($entity['lastInsertDate']) ? "" : getDiff($date, toTimestamp($entity['lastInsertDate']))) . "</td>"; echo '<td><a href=javascript:redirect("' . rawurlencode($entity['name']) . '")>' . $entity['name'] . '</a></td>'; foreach ($orderedTags as $tagName) { if (!empty($entity['tags'][$tagName])) { echo "<td>" . $entity['tags'][$tagName] . "</td>"; } else { echo "<td></td>"; } } echo "</tr>"; } } ?> </table> <!-- Start of StatCounter Code --> <script type="text/javascript">
if ($settings->mediatomb_update == 1) { $dbh = @mysql_connect($settings->db_host, $settings->db_user, $settings->db_pass); if ($dbh !== false) { $sqlstr = "use " . $settings->db_name; @mysql_query($sqlstr); $sqlstr = "set NAME utf8"; @mysql_query($sqlstr); } } try { $rec = new DBRecord(RESERVE_TBL, "id", $reserve_id); if (isset($_POST['title'])) { $rec->title = trim($_POST['title']); if ($dbh !== false && $rec->complete == 1) { $title = trim(mysql_real_escape_string($_POST['title'])); $title .= "(" . date("Y/m/d", toTimestamp($rec->starttime)) . ")"; $sqlstr = "update mt_cds_object set dc_title='" . $title . "' where metadata regexp 'epgrec:id=" . $reserve_id . "\$'"; @mysql_query($sqlstr); } } if (isset($_POST['description'])) { $rec->description = trim($_POST['description']); if ($dbh !== false && $rec->complete == 1) { $desc = "dc:description=" . trim(mysql_real_escape_string($_POST['description'])); $desc .= "&epgrec:id=" . $reserve_id; $sqlstr = "update mt_cds_object set metadata='" . $desc . "' where metadata regexp 'epgrec:id=" . $reserve_id . "\$'"; @mysql_query($sqlstr); } } } catch (Exception $e) { exit("Error: " . $e->getMessage());
static function updateEvent(&$newEvent, $bean, $user) { $client = self::getClient($user); if ($client != false) { $gdataCal = new Zend_Gdata_Calendar($client); global $timedate; $date_time_start = $bean->date_start . ' ' . $bean->time_start; if (toTimestamp($date_time_start) < mktime(0, 0, 0, 1, 1, 2001)) { //$date_time_start = DateTime::get_time_start($timedate->to_db_date($bean->date_start,false),$bean->time_start.":00"); //$date_time_start = $date_time_start->get_mysql_date().' '.$date_time_start->get_mysql_time(); $date_time_start = date($timedate->get_db_date_time_format(), strtotime($bean->date_start)); } //$date_time_start = $timedate->handle_offset($date_time_start, $timedate->get_db_date_time_format(), true); $time = toTimestamp($date_time_start); $duration = $bean->duration_hours * 60 * 60 + $bean->duration_minutes * 60; $when = $gdataCal->newWhen(); $when->startTime = strftime("%Y-%m-%dT%H:%M:%S.000+00:00", $time); $when->endTime = strftime("%Y-%m-%dT%H:%M:%S.000+00:00", $time + $duration); // Tasks if (isset($bean->date_due) === true) { $date_time_end = $bean->date_due . ' ' . $bean->time_due; if (toTimestamp($date_time_start) < mktime(0, 0, 0, 1, 1, 2001)) { $date_time_end = date($timedate->get_db_date_time_format(), strtotime($bean->date_due)); } $time = toTimestamp($date_time_end); $when->endTime = strftime("%Y-%m-%dT%H:%M:%S.000+00:00", $time); } // Tasks if ($bean->reminder_time < 0) { $when->reminders = array(); } else { $mins = (int) ($bean->reminder_time / 60); // reminder_time are seconds if ($mins < 5) { $mins = 5; } $reminder = $gdataCal->newReminder(); //$reminder->method = "sms"; $reminder->minutes = $mins; $when->reminders = array($reminder); } $newEvent->when = array($when); /** Conditionals **/ if ($bean->module_dir == "Meetings") { $newEvent->where = array($gdataCal->newWhere($bean->location)); $newEvent->title = $gdataCal->newTitle("Встреча: " . $bean->name); } elseif ($bean->module_dir == "Calls") { $newEvent->title = $gdataCal->newTitle("Звонок: " . $bean->name); } elseif ($bean->module_dir == "Tasks") { $newEvent->title = $gdataCal->newTitle("Задача: " . $bean->name); } $newEvent->content = $gdataCal->newContent($bean->description); } }
#!/usr/bin/php <?php include_once 'config.php'; include_once INSTALL_PATH . '/DBRecord.class.php'; include_once INSTALL_PATH . '/reclib.php'; include_once INSTALL_PATH . '/Settings.class.php'; $settings = Settings::factory(); try { $recs = DBRecord::createRecords(RESERVE_TBL); // DB接続 $dbh = mysql_connect($settings->db_host, $settings->db_user, $settings->db_pass); if ($dbh === false) { exit("mysql connection fail"); } $sqlstr = "use " . $settings->db_name; mysql_query($sqlstr); $sqlstr = "set NAME utf8"; mysql_query($sqlstr); foreach ($recs as $rec) { $title = mysql_real_escape_string($rec->title) . "(" . date("Y/m/d", toTimestamp($rec->starttime)) . ")"; $sqlstr = "update mt_cds_object set metadata='dc:description=" . mysql_real_escape_string($rec->description) . "&epgrec:id=" . $rec->id . "' where dc_title='" . $rec->path . "'"; mysql_query($sqlstr); $sqlstr = "update mt_cds_object set dc_title='" . $title . "' where dc_title='" . $rec->path . "'"; mysql_query($sqlstr); } } catch (Exception $e) { exit($e->getMessage()); }