public function index() { $myID = getUserID(); $query = $this->mdb->get_active($myID); $priorities = $this->config->item('priorities'); $priorityColors = array('bg-light', 'bg-warning dker', 'bg-danger'); $items = array(); foreach ($query->result() as $row) { $start = 'TBA'; $startOrig = ''; $end = 'TBA'; $endOrig = ''; $dateCompleted = 'TBA'; $isOverdue = 0; if (strtotime($row->date_start)) { $start = convert_datetime($row->date_start); $start = date("M d, Y", strtotime($row->date_start)); $startOrig = date("m/d/Y", strtotime($row->date_start)); } if (strtotime($row->date_end)) { $end = convert_datetime($row->date_end); $end = date("M d, Y", strtotime($row->date_end)); $endOrig = date("m/d/Y", strtotime($row->date_end)); $endDateOnly = date("Y-m-d", strtotime($row->date_end)); $endDateOnlyStr = strtotime($endDateOnly); $isOverdue = strtotime(date("Y-m-d")) >= $endDateOnlyStr ? 1 : 0; } if (strtotime($row->date_completed)) { $dateCompleted = convert_datetime($row->date_completed); $dateCompleted = date("M d, Y", strtotime($row->date_completed)); } $items[] = array('id' => $row->id, 'name' => $row->title, 'safe_name' => htmlentities($row->title), 'project_id' => $row->project_id, 'project_name' => $row->project_name, 'description' => htmlentities($row->description), 'priority' => $row->priority, 'priority_name' => $priorities[$row->priority], 'priority_class' => isset($priorityColors[$row->priority]) ? $priorityColors[$row->priority] : $priorityColors[0], 'date_start' => $start, 'date_start_orig' => $startOrig, 'date_end' => $end, 'date_end_orig' => $endOrig, 'is_overdue' => $isOverdue, 'date_completed' => $dateCompleted, 'task_master' => array('id' => $row->creator_id, 'name' => $row->task_master)); } generate_json(array('status' => 1, 'items' => $items)); }
private function processItems($query) { $items = array(); foreach ($query->result() as $row) { $dateAdded = convert_datetime($row->date_added); $icon = 'file'; /* file configs */ $music = array('.mp3', '.mid', '.ogg', '.wav', '.amr', '.ac3', '.wma'); $images = array('.jpg', '.jpeg', '.gif', '.png'); $videos = array('.mp4', '.flv', '.mkv', '.avi', '.wmv', '.3gp', '.mov'); $txt = array('.txt', '.rtf'); $excel = array('.xls', '.xlsx'); $word = array('.doc', '.docx'); $powerpoint = array('.ppt', '.pptx'); $archives = array('.zip', '.rar', '.gz', '.7z', '.gzip'); if ($row->attachment_type == 'file') { $ext = strtolower($row->extension); if (in_array($ext, $music)) { $icon = 'file-music'; } if (in_array($ext, $videos)) { $icon = 'file-video'; } if (in_array($ext, $images)) { $icon = 'file-php'; } if (in_array($ext, $txt)) { $icon = 'text'; } if (in_array($ext, $word)) { $icon = 'file-word'; } if (in_array($ext, $excel)) { $icon = 'file-excel'; } if (in_array($ext, $powerpoint)) { $icon = 'file-power-point'; } if (in_array($ext, $archives)) { $icon = 'zip'; } if ($ext == '.pdf') { $icon = 'file-pdf'; } } else { $icon = 'folder'; } $items[] = array('id' => $row->id, 'attachment_type' => strtolower($row->attachment_type), 'uploader_id' => $row->uploader, 'uploader_name' => $row->uploader_name, 'filename' => $row->filename, 'filesize' => format_filesize($row->filesize), 'uploaded' => relativedate(strtotime($dateAdded), false), 'icon' => $icon); } return $items; }
public function index() { requireadmin(); $from = strtotime($this->input->get("from")); $dateFrom = $from ? date("Y-m-d H:i:s", $from) : ''; $to = strtotime($this->input->get("to")); $dateTo = $to ? date("Y-m-d H:i:s", $to) : ''; $query = $this->mdb->get_auditTrail($dateFrom, $dateTo); $items = array(); foreach ($query->result() as $row) { $date = convert_datetime($row->date, "M d, Y - h:i a"); $items[] = array('action' => $row->action, 'date' => $date); } generate_json(array('status' => 1, 'items' => $items)); }
public function get_accepted($pid = 0) { $myID = getUserID(); $query = $this->mmdb->get_members($pid, $myID); $members = array(); foreach ($query->result() as $row) { $dateJoined = convert_datetime($row->date_joined); $data = array('id' => $row->id, 'display_name' => $row->display_name, 'joined_by' => (int) $row->joined_by, 'date_joined' => $row->is_accepted == 1 ? relativedate(strtotime($dateJoined), false) : 'n/a', 'is_accepted' => (int) $row->is_accepted, 'role_id' => (int) $row->project_role, 'role' => $row->is_accepted == 1 ? $row->project_role_name : 'None', 'tasks' => number_format($row->tasks), 'files' => number_format($row->files), 'is_contact' => $row->is_friend == 1 ? 1 : 0, 'is_me' => $myID == $row->id ? 1 : 0); //Filter for members if ($row->is_accepted == 1) { $members[] = $data; } } generate_json(array('status' => 1, 'members' => $members)); }
public function index() { $myID = getUserID(); $items = array(); $categories = array(); $query = $this->mdb->get_notes($myID); foreach ($query->result() as $row) { $date = convert_datetime($row->date_created); $items[] = array('id' => $row->id, 'title' => $row->title, 'category' => empty($row->category) ? 'Uncategorized' : $row->category, 'content' => empty($row->content) ? 'No description' : $row->content, 'date' => relativedate(strtotime($date), false)); } $query = $this->mdb->get_categories($myID); foreach ($query->result() as $row) { $categories[] = $row->category; } generate_json(array('status' => 1, 'items' => $items, 'categories' => $categories)); }
public function index() { $myID = getUserID(); $query = $this->mdb->get_contacts($myID); $items = array(); $initials = array(); $initial = ''; foreach ($query->result() as $row) { $lastname = trim($row->lastname); $middlename = trim($row->middlename); $firstname = trim($row->firstname); $displayname = $row->display_name; $nameToDisplay = $displayname; $date = convert_datetime($row->date_added); if (!empty($lastname)) { $nameToDisplay = ucfirst($lastname); if (!empty($firstname)) { $nameToDisplay .= ", " . ucfirst($firstname); } if (!empty($middlename)) { $nameToDisplay .= ' ' . ucfirst(substr($middlename, 0, 1)) . '.'; } } if ($initial !== strtoupper(substr($nameToDisplay, 0, 1))) { $initial = strtoupper(substr($nameToDisplay, 0, 1)); } $contactNo = array(); $contactNoQ = unserialize($row->contact_number); $addressQ = unserialize($row->location); if ($contactNoQ) { foreach ($contactNoQ as $rContact) { if ($rContact['privacy'] == 0) { $contactNo[] = $rContact['contact']; } } } $address = ''; if ($addressQ) { $address = $addressQ['privacy'] == 0 ? $addressQ['location'] : 'Private'; } $items[] = array('id' => $row->id, 'group' => in_array($initial, $initials) ? "" : $initial, 'display_name' => $nameToDisplay, 'nickname' => $displayname, 'email_address' => $row->email_privacy == 0 ? $row->email_address : 'Private', 'company' => empty($row->company) ? '-' : $row->company, 'address' => empty($address) ? '-' : $address, 'gender' => ucfirst($row->gender), 'date_added' => relativedate(strtotime($date), false), 'contact_no' => count($contactNo) ? implode(", ", $contactNo) : '-'); $initials[] = $initial; } generate_json(array('status' => 1, 'items' => $items)); }
public function load() { $db = db::getInstance(); $session = Session::getInstance(); $addsql = ''; if ($this->date) { $addsql .= ' AND N.firstdate >= "' . date('Y-m-d 00:00:00', $this->date) . '" AND N.firstdate <= "' . date('Y-m-d 23:59:59', $this->date) . '" '; } $addsql .= ' ORDER BY firstdate DESC '; if ($this->last) { $addsql .= ' LIMIT 0,20 '; } $query = ' SELECT N.title, N.text, U.login, N.firstdate, U.id as userId FROM news N LEFT JOIN user U ON U.id = N.firstauthor WHERE N.module_id="' . $this->module . '" ' . $addsql; $result = $db->select($query); if ($result) { foreach ($result as $obj) { $obj['edit'] = false; if ($session->isLogged()) { $user = $session->getUser('id'); if ($user == $obj['userId']) { $obj['edit'] = true; } } $this->event[convert_datetime($obj['firstdate'])] = $obj; $day = substr($obj['firstdate'], 0, strpos($obj['firstdate'], ' ')) . ' 00:00:00'; if (!$this->day[convert_datetime($day)]) { $this->day[convert_datetime($day)] = array(); } $this->day[convert_datetime($day)][] = $obj; } } }
public function data($pid = 0) { requirelogin(); updateLastActive(); $page = (int) $this->input->get('page'); $page = $page > 1 ? $page : 1; $pageOrig = $page > 1 ? $page - 1 : 0; $itemsPerPage = 10; $sqStart = $pageOrig * $itemsPerPage; $sql = $this->ldb->get_data($pid, $sqStart, $itemsPerPage); $items = array(); foreach ($sql->result() as $row) { $timestamp = convert_datetime($row->date_added); $items[] = array('activity' => projectlogs_read($row->type, $row->tag_data), 'actor_id' => $row->actor_id, 'actor_name' => $row->display_name, 'timestamp' => relativedate(strtotime($timestamp)), 'redirect' => $row->redirect); } $qAllItems = $this->ldb->get_data($pid, 0, 0); $allItems = (int) $qAllItems->num_rows(); $total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1; generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems))); }
public function generate() { $content = ''; $days = $this->event->getDays(); foreach ($days as $date => $day) { $events = ''; $alt = 0; foreach ($day as $event) { $data = array('__ID__' => convert_datetime($event['firstdate']), '__TITLE__' => $event['title'], '__DATE__' => $this->time($event['firstdate']), '__AUTHOR__' => $event['login'], '__CONTENT__' => $event['text'], '__ALT__' => $alt, '__ACTION__' => $event['edit'] ? '<img src="module/news/theme/default/edit.png" onclick="newsEdit(\'' . convert_datetime($event['firstdate']) . '\')" height=28/>' : ''); $alt = !$alt; if ($event['text']) { $events .= Template::getInstance()->get('long', $data, 'org.sygil.news'); } else { $events .= Template::getInstance()->get('short', $data, 'org.sygil.news'); } } $data = array('__TITLE__' => $this->date($date), '__CONTENT__' => $events); $content .= Template::getInstance()->get('day', $data, 'org.sygil.news'); } return $content; }
public function get_notif() { $myID = getUserID(); $page = (int) $this->input->get('page'); $page = $page > 1 ? $page : 1; $pageOrig = $page > 1 ? $page - 1 : 0; $itemsPerPage = 20; $sqStart = $pageOrig * $itemsPerPage; $query = $this->mdb->get_all_notif($myID, $sqStart, $itemsPerPage); $items = array(); foreach ($query->result() as $row) { $tagData = explode("|", $row->tag_data); $description = display_notif($row->type, $tagData, $row->counter); $description = convert_tag($description, 'span', array('class' => 'tag')); $dateNotify = convert_datetime($row->date_notify); $items[] = array('id' => $row->id, 'description' => $description, 'actor_id' => $row->actor_id, 'redirect_uri' => $row->redirect, 'timestamp' => relativedate(strtotime($dateNotify), true), 'is_read' => $row->is_read, 'is_new' => $row->is_new); } $qAllItems = $this->mdb->get_all_notif($myID, 0, 0); $allItems = (int) $qAllItems->num_rows(); $total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1; $this->mdb->update_notif(array('notify_to' => $myID, 'is_new' => 1), array('is_new' => 0)); generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems))); }
function __construct() { global $config; global $db; $baseaddress = $config->getValue('baseaddress'); $query = $db->SQL('SELECT timestamp FROM matches ORDER BY timestamp DESC LIMIT 1'); $row = $db->fetchRow($query); $db->free($query); $numRows = 0; if (!$row) { header('Content-Type: text/plain'); echo 'No matches played yet.'; return; } $pubDate = date("Y-m-d\\TH:i:s+00:00", $this->convert_datetime($row['timestamp'])); $query = 'SELECT timestamp,team1_points,team2_points,t1.name team1_name,t2.name team2_name '; $query .= 'FROM matches LEFT JOIN teams t1 ON matches.team1ID = t1.id LEFT JOIN teams t2 ON matches.team2ID = t2.id '; $query .= 'ORDER BY timestamp DESC LIMIT 5'; $numRowsQuery = $db->SQL(str_replace('SELECT ', 'SELECT COUNT(*) AS `numRows`, ', $query)); $numRowsQuery = $db->fetchRow($numRowsQuery); $numRows = $numRowsQuery['numRows']; $query = $db->SQL($query); if ($numRows >= 1) { header('Content-Type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8"?>' . '<rss version="2.0"' . 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . 'xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"' . 'xmlns:bzl="' . $baseaddress . '">' . '<channel>' . '<title>GU League - Last 5 Match Results</title>' . '<link>' . $baseaddress . 'Matches/</link>' . '<description>Herein lies the last 5 match results entered on the BZFlag GU League site.</description>' . '<language>en</language>' . '<copyright>GPL</copyright>' . '<lastBuildDate>' . $pubDate . '</lastBuildDate>' . '<generator>' . $baseaddress . 'rss/</generator>' . '<webMaster>' . $baseaddress . 'Contact/</webMaster>' . '<ttl>60</ttl>' . '<dc:language>en</dc:language>' . '<dc:creator>' . $baseaddress . '</dc:creator>' . '<dc:rights>GPL</dc:rights>' . '<dc:date>' . $pubDate . '</dc:date>' . '<sy:updatePeriod>hourly</sy:updatePeriod>' . '<sy:updateFrequency>60</sy:updateFrequency>' . '<sy:updateBase>2003-09-01T12:00+00:00</sy:updateBase>'; while ($row = $db->fetchRow($query)) { $ts = convert_datetime($row['timestamp']); $date1 = date('M d H:i', $ts); $date2 = date('Y-m-d\\TH:i:s+00:00', $ts); echo "<item>\n\t\t\t\t\t<title>{$date1} => {$row['team1_name']}:{$row['team1_points']}, {$row['team2_name']}:{$row['team2_points']}</title>\n\t\t\t\t\t<link>{$baseaddressMatches}/</link>\n\t\t\t\t\t<description>{$date1} => {$row['team1_name']}:{$row['team1_points']}, {$row['team2_name']}:{$row['team2_points']}</description>\n\t\t\t\t\t<pubDate>{$date2}</pubDate>\n\t\t\t\t\t</item>"; } echo '</channel></rss>'; } else { header('Content-Type: text/plain'); echo 'Error: No matches found.'; } }
function check_post($content) { $custom_fields = get_post_custom($post->ID); if (is_single()) { if (isset($custom_fields['date'])) { $my_custom_field = $custom_fields['date']; foreach ($my_custom_field as $key => $value) { $expired_timestamp = convert_datetime($value) . "<br />"; $current_timestamp = convert_datetime(date("Y-m-d H:i:s")) - timezone_offset($timezone); } if ($expired_timestamp > $current_timestamp) { if (date("H", $expired_timestamp) < 12) { $content = $content . $activeMessage . "<br />"; } } else { $content = $expiredMessage . "<br />" . $content; } } else { $content = $content . "<br />Date not set" . "<br />"; } } else { } return $content; }
public static function from_response(\stdClass $response) { $obj = new static(); if (property_exists($response, 'user_id')) { $obj->user_id = absint($response->user_id); } if (property_exists($response, 'domain') && $response->domain instanceof \stdClass) { $obj->domain = Domain::from_response($response->domain); } if (property_exists($response, 'created')) { $obj->created = convert_datetime($response->created, FALSE); } if (property_exists($response, 'customer_id')) { $obj->customer_id = absint($response->customer_id); } if (property_exists($response, 'product_id')) { $obj->product_id = absint($response->product_id); } if (property_exists($response, 'variation_id')) { $obj->variation_id = absint($response->variation_id); } if (property_exists($response, 'quantity')) { $obj->quantity = absint($response->quantity); } if (property_exists($response, 'price')) { $obj->price = sanitize_text_field($response->price); } if (property_exists($response, 'product_name')) { $obj->product_name = sanitize_text_field($response->product_name); } if (property_exists($response, 'product_version')) { $obj->product_version = sanitize_text_field($response->product_version); } if (property_exists($response, 'term_name')) { $obj->term_name = sanitize_text_field($response->term_name); } if (property_exists($response, 'log_type')) { $obj->log_type = sanitize_text_field($response->log_type); } return $obj; }
$upcomingList = new SimpleXMLElement($upcomingSvc, NULL, TRUE); $conflictList = new SimpleXMLElement($conflictSvc, NULL, TRUE); $items = array(); foreach($recordingList->xpath('//Program') as $value) { $statusEl = $value->xpath('.//Status'); $programFlagsEl = $value->xpath('.//ProgramFlags'); $chanidEl = $value->xpath('.//ChanId'); $startTimeEl = $value->xpath('.//StartTs'); $flags = (int)$programFlagsEl[0]; $status = (int)$statusEl[0]; $chanid = (string)$chanidEl[0]; $startTS = (string)$startTimeEl[0]; $timestamp = convert_datetime($startTS); if(useUTC()) $starttime = gmdate('Y-m-d H:i:s', $timestamp ); else $starttime = date('Y-m-d H:i:s', $timestamp ); $parms = array('chanid'=>$chanid, 'starttime'=>$starttime); $jobs = new SimpleXMLElement("$jobqueueSvc?".http_build_query($parms), NULL, TRUE); $hasJob = (bool)$jobs[0]; $program = new Program($value); $program->hasJob = $hasJob; $program->isRecording = ($status == -2); if($program->hasJob || $program->isRecording) { $items[] = new item($program);
private function processFeedData($data) { $items = array(); $myID = getUserID(); $temp_item = end($data); $is_moderator = false; if (isset($temp_item->project_id) && is_numeric($temp_item->project_id)) { $is_moderator = validate_access('is_moderator', array('project_id' => $temp_item->project_id, 'user_id' => $myID)); } foreach ($data as $row) { //comment snippet $commentItems = array(); if ($row->comments) { $query = $this->mdb->get_comment_snippet($row->id, 0, 2); foreach ($query->result() as $cRow) { //reply snippet $replyItems = array(); if ($cRow->comments) { $rQuery = $this->mdb->get_comment_snippet($row->id, $cRow->id, 1); foreach ($rQuery->result() as $rRow) { $dateCommented = convert_datetime($rRow->date_posted); $replyItems[] = array('id' => $rRow->id, 'actor_id' => $rRow->user_id, 'actor_name' => $rRow->actor_name, 'replies' => $rRow->comments, 'agrees' => $rRow->agrees, 'disagrees' => $rRow->disagrees, 'is_agree' => $rRow->is_agree, 'is_disagree' => $rRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $rRow->comment, 'update_buttons' => $rRow->user_id == $myID || $is_moderator ? 1 : 0); } } $rQuery = $this->mdb->get_comment_snippet($row->id, $cRow->id, 2); $dateCommented = convert_datetime($cRow->date_posted); $commentItems[] = array('id' => $cRow->id, 'actor_id' => $cRow->user_id, 'actor_name' => $cRow->actor_name, 'replies' => $cRow->comments, 'reply_snippet' => $replyItems, 'shownextcommentslink' => $rQuery->num_rows() > 1 ? 1 : 0, 'agrees' => $cRow->agrees, 'disagrees' => $cRow->disagrees, 'is_agree' => $cRow->is_agree, 'is_disagree' => $cRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $cRow->comment, 'update_buttons' => $cRow->user_id == $myID || $is_moderator ? 1 : 0); } } $query = $this->mdb->get_comment_snippet($row->id, 0, 3); $datePosted = convert_datetime($row->date_posted); /* Attachments Start */ $attachments = array(); $aQuery = $this->mdb->get_attachments($temp_item->project_id, $row->id); $hx = 0; foreach ($aQuery->result() as $aRow) { $imgs = array('.gif', '.jpg', '.jpeg', '.png'); if (in_array(strtolower($aRow->extension), $imgs) && $aRow->deleted_by == 0) { $hx++; $imgW = ''; $imgH = ''; $fullpath = 'uploads/files/' . $aRow->uploader . '/thumbs/' . $aRow->filepath; if (is_file($fullpath)) { $imgSize = getimagesize($fullpath); $imgW = $imgSize[0]; $imgH = $imgSize[1]; } $attachments['images'][] = array('id' => $aRow->id, 'filename' => $aRow->filename, 'filesize' => format_filesize($aRow->filesize), 'width' => $imgW, 'height' => $imgH, 'hidden' => $hx > 3 ? 1 : 0); } else { $attachments['files'][] = array('id' => $aRow->id, 'filename' => $aRow->filename, 'filesize' => format_filesize($aRow->filesize), 'deleted_by' => $aRow->deleted_by); } } /* Attachments End */ /* Params */ $qParam = unserialize($row->params); $params = array(); if ($qParam && is_array($qParam)) { foreach ($qParam as $param) { $paramNameQuery = $this->db->get_where("users", array('id' => $param)); if ($paramNameQuery->num_rows()) { $paramRow = $paramNameQuery->row(); $params[] = array('id' => $paramRow->id, 'name' => $paramRow->display_name); } } } /* Params End */ $items[] = array('id' => $row->id, 'poster_id' => $row->poster_id, 'poster_picture' => 'pictures/avatar/' . $row->id . '/thumb', 'poster_name' => $row->poster_name, 'post' => sprintf(htmlentities($row->post_message), $row->params), 'agrees' => $row->agrees, 'disagrees' => $row->disagrees, 'comments' => $row->comments, 'comment_snippet' => $commentItems, 'shownextcommentslink' => $query->num_rows() > 2 ? 1 : 0, 'is_agree' => $row->is_agree, 'is_disagree' => $row->is_disagree, 'date_posted' => relativedate(strtotime($datePosted), false), 'timestamp' => strtotime($row->date_modified), 'update_buttons' => $row->poster_id == $myID || $is_moderator ? 1 : 0, 'edit_button' => $row->poster_id == $myID ? 1 : 0, 'attachments' => $attachments, 'params' => $params, 'post_type' => $row->post_type); } return $items; }
function bbtnn_print_sites_list_detailed() { $blogs = get_last_updated(); if (is_array($blogs)) { ?> <ul> <?php foreach ($blogs as $details) { if (1 != $details['blog_id']) { ?> <li><a href="http://<?php echo $details['domain'] . $details['path']; ?> "> <?php $blog_details = get_blog_details($details['blog_id']); echo $blog_details->blogname; ?> </a> - <em><?php echo date("F j, Y", convert_datetime($blog_details->last_updated)); ?> </em></li> <?php } } ?> </ul> <?php } }
function relativedate($seconds, $displaytime = true) { $today = convert_datetime(date("Y-m-d H:i:s")); $secs = strtotime($today) - $seconds; $time_string = 'n/a'; $minute = 60; $hour = 60 * 60; $day = 60 * 60 * 24; $week = 60 * 60 * 24 * 7; if (is_numeric($seconds) && $seconds > 0) { if ($secs < $minute) { $time_string = "Just now"; } elseif ($secs < $hour) { $ts = floor($secs / $minute); if ($ts == 1) { $time_string = $ts . " min ago"; } else { $time_string = $ts . " mins ago"; } } elseif ($secs < $day) { $ts = floor($secs / $hour); if ($ts == 1) { $time_string = $ts . " hr ago"; } else { $time_string = $ts . " hrs ago"; } } elseif ($secs < $week) { $ts = floor($secs / $day); if ($ts == 1) { $time_string = "Yesterday at " . date("h:i a", strtotime('now') - $secs); } else { $time_string = $ts . " days ago"; } } else { if ($displaytime) { $time_string = date("M d, Y h:i a", $seconds); } else { $time_string = date("M d, Y", $seconds); } } } return $time_string; }
private function loopComments($postID, $query) { $myID = getUserID(); $items = array(); $is_moderator = false; //Get project id $qp = $this->db->query("select project_id from posts where id = ?", array($postID)); if ($qp->num_rows()) { $qpRow = $qp->row(); if (is_numeric($qpRow->project_id)) { $is_moderator = validate_access('is_moderator', array('project_id' => $qpRow->project_id, 'user_id' => $myID)); } } foreach ($query->result() as $cRow) { //reply snippet $replyItems = array(); if ($cRow->comments) { $rQuery = $this->mdb->get_comment_snippet($postID, $cRow->id, 1); foreach ($rQuery->result() as $rRow) { $dateCommented = convert_datetime($rRow->date_posted); $replyItems[] = array('id' => $rRow->id, 'actor_id' => $rRow->user_id, 'actor_name' => $rRow->actor_name, 'replies' => $rRow->comments, 'agrees' => $rRow->agrees, 'disagrees' => $rRow->disagrees, 'is_agree' => $rRow->is_agree, 'is_disagree' => $rRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $rRow->comment, 'update_buttons' => $rRow->user_id == $myID || $is_moderator ? 1 : 0); } } $rQuery = $this->mdb->get_comment_snippet($postID, $cRow->id, 2); $dateCommented = convert_datetime($cRow->date_posted); $items[] = array('id' => $cRow->id, 'actor_id' => $cRow->user_id, 'actor_name' => $cRow->actor_name, 'replies' => $cRow->comments, 'reply_snippet' => $replyItems, 'shownextcommentslink' => $rQuery->num_rows() > 1 ? 1 : 0, 'agrees' => $cRow->agrees, 'disagrees' => $cRow->disagrees, 'is_agree' => $cRow->is_agree, 'is_disagree' => $cRow->is_disagree, 'date_commented' => relativedate(strtotime($dateCommented), false), 'comment' => $cRow->comment, 'update_buttons' => $cRow->user_id == $myID || $is_moderator ? 1 : 0); } return $items; }
public function __construct($show){ $WebServer = $GLOBALS['WebServer']; $MythRokuDir = $GLOBALS['MythRokuDir']; $RokuDisplayType = $GLOBALS['RokuDisplayType']; $BitRate = $GLOBALS['BitRate']; $this->media = new media( array( 'streamFormat'=>new streamFormat(array('content'=>'mp4')) , 'streamQuality'=>new streamQuality(array('content'=>$RokuDisplayType)) , 'streamBitrate'=>new streamBitrate(array('content'=>$BitRate)) , 'streamUrl'=>new streamUrl() ) ); if(1==0){ //dummy to make editing easier - RSH }elseif(is_a($show,'Weather')){ //handles Weather current conditions, forecast items, and alerts schemae $ShowLength = $show->Delay; $title = "$show->Location"; $title .= empty($show->Temperature) ? "" : ", $show->Temperature"; $title .= empty($show->Description) ? "" : ", $show->Description"; $subtitle = empty($show->Message) ? $show->Conditions : $show->Message; $subtitle .= empty($show->WindDirection) ? "" : ", $show->WindDirection"; $subtitle .= empty($show->WindSpeed) ? "" : "@$show->WindSpeed"; $subtitle .= empty($show->WindGust) ? "" : ", G$show->WindGust"; $subtitle .= empty($show->Humidity) ? "" : ", hum $show->Humidity"; $subtitle .= empty($show->Clouds) ? "" : ", vis $show->Clouds mi."; $genre = empty($show->Until) ? $show->Temperature : $show->Until; $synopsis = "$subtitle $show->Source"; $this->title = new title(array('content'=>$title)); $this->contentQuality = new contentQuality(array('content'=>$RokuDisplayType)); $this->subtitle = new subtitle(array('content'=>$subtitle)); $this->addToAttributes('sdImg', "$show->Icon"); $this->addToAttributes('hdImg', "$show->Icon"); $this->contentId = new contentId(array('content'=>$show->Location)); //$this->contentType = new contentType(array('content'=>'TV')); //$this->media->streamUrl->setContent("$streamUrl "); //yes the space is required $this->synopsis = new synopsis(array('content'=>$synopsis)); $this->genres = new genres(array('content'=>$genre)); $this->runtime = new runtime(array('content'=>$ShowLength)); $this->date = new date(array('content'=>$show->AsOf)); $this->tvormov = new tvormov(array('content'=>'weather')); }elseif(is_a($show,'Program')){ /// MythTV Program schema $ShowLength = convert_datetime($show->EndTime) - convert_datetime($show->StartTime); if($show->isScheduled){ $imgUrl = "$WebServer/$MythRokuDir/images/oval_green.png"; } elseif($show->isRecording){ $imgUrl = "$WebServer/$MythRokuDir/images/oval_blue.png"; $show->Category = 'NOW RECORDING!'; } elseif($show->hasJob) { $imgUrl = "$WebServer/$MythRokuDir/images/oval_orange.png"; $show->Category = 'NOW PROCESSING A JOB!'; } elseif($show->isConflict) { $imgUrl = "$WebServer/$MythRokuDir/images/oval_red.png"; $show->Category = 'SCHEDULE CONFLICT!'; } else { $imgUrl = "$WebServer/$MythRokuDir/images/oval_grey.png"; } $this->title = new title(array('content'=>normalizeHtml($show->Title))); $this->contentQuality = new contentQuality(array('content'=>$RokuDisplayType)); $this->subtitle = new subtitle(array('content'=>normalizeHtml($show->SubTitle))); $this->addToAttributes('sdImg', $imgUrl); $this->addToAttributes('hdImg', $imgUrl); $this->contentId = new contentId(array('content'=>$show->ProgramId)); //$this->contentType = new contentType(array('content'=>'TV')); //$this->media->streamUrl->setContent("$streamUrl "); //yes the space is required $this->synopsis = new synopsis(array('content'=>normalizeHtml($show->Description))); $this->genres = new genres(array('content'=>normalizeHtml($show->Category))); $this->runtime = new runtime(array('content'=>$ShowLength)); if(!is_a($show, 'ProgramTpl)')) $this->date = new date(array('content'=>date("F j, Y, g:i a", convert_datetime($show->StartTime)))); else $this->date = new date(array('content'=>$show->StartTime)); $this->tvormov = new tvormov(array('content'=>'upcoming')); }elseif(is_a($show,'Guide')){ //handles Pilots/Premieres schema $ShowLength = convert_datetime($show->endtime) - convert_datetime($show->starttime); $ImgType = ($show->subtitle == 'Pilot' ? "rectangle" : "oval"); if($show->recstatus == -1){ $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_blue.png"; $show->category .= ' (WILL RECORD)'; } elseif($show->recstatus == 10 || $show->recstatus == 7){ //inactive or conflict $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_purple.png"; $show->category .= ' (' . $show->getStatusName( $show->recstatus ) . ')'; } elseif($show->last && $show->first){ $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_red.png"; if(!empty($show->recstatus) && $show->recstatus != 10 && $show->recstatus != 7) { $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_grey.png"; $show->category .= ' (' . $show->getStatusName( $show->recstatus ) . ')'; } else { $show->category .= ' (ONLY CHANCE)'; } } elseif($show->last) { $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_orange.png"; if(!empty($show->recstatus) && $show->recstatus != 10 && $show->recstatus != 7) { $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_grey.png"; $show->category .= ' (' . $show->getStatusName( $show->recstatus ) . ')'; } else { $show->category .= ' (LAST CHANCE)'; } } else { if(!empty($show->recstatus)) { $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_grey.png"; $show->category .= ' (' . $show->getStatusName( $show->recstatus ) . ')'; } else { $imgUrl = "$WebServer/$MythRokuDir/images/". $ImgType . "_green.png"; } } $this->title = new title(array('content'=>normalizeHtml($show->station.' '.$show->title))); $this->contentQuality = new contentQuality(array('content'=>$RokuDisplayType)); $this->subtitle = new subtitle(array('content'=>normalizeHtml($show->subtitle))); $this->addToAttributes('sdImg', $imgUrl); $this->addToAttributes('hdImg', $imgUrl); $this->contentId = new contentId(array('content'=>$show->programid)); //$this->contentType = new contentType(array('content'=>'TV')); //$this->media->streamUrl->setContent("$streamUrl "); //yes the space is required $this->synopsis = new synopsis(array('content'=>normalizeHtml($show->description))); $this->genres = new genres(array('content'=>normalizeHtml($show->category))); $this->runtime = new runtime(array('content'=>$ShowLength)); $this->date = new date(array('content'=>date("F j, Y, g:i a", convert_datetime($show->starttime)))); $this->tvormov = new tvormov(array('content'=>'new')); }elseif(is_a($show,'Recorded')){ /// TV from Recorded table $ShowLength = convert_datetime($show->endtime) - convert_datetime($show->starttime); $streamfile = $show->storagegroups->dirname . $show->basename; $parms = array('image'=>$streamfile); $streamUrl = "$WebServer/$MythRokuDir/imageSvc.php?" .http_build_query($parms); $parms = array('preview'=>str_pad($show->chanid, 6, "_", STR_PAD_LEFT).rawurlencode($show->starttime)); $imgUrl = "$WebServer/$MythRokuDir/imageSvc.php?" .http_build_query($parms); $this->title = new title(array('content'=>normalizeHtml($show->title))); $this->contentQuality = new contentQuality(array('content'=>$RokuDisplayType)); $this->subtitle = new subtitle(array('content'=>normalizeHtml($show->subtitle))); $this->addToAttributes('sdImg', $imgUrl); $this->addToAttributes('hdImg', $imgUrl); $this->contentId = new contentId(array('content'=>$show->basename)); $this->contentType = new contentType(array('content'=>'TV')); $this->media->streamUrl->setContent("$streamUrl "); //yes the space is required $this->synopsis = new synopsis(array('content'=>normalizeHtml($show->description))); $this->genres = new genres(array('content'=>normalizeHtml($show->category.' ('.$show->programid.' '.$show->airdate.')'))); $this->runtime = new runtime(array('content'=>$ShowLength)); $this->date = new date(array('content'=>date("F j, Y, g:i a", convert_datetime($show->starttime)))); $this->programid = new programid(array('content'=>$show->programid)); $this->airdate = new airdate(array('content'=>$show->airdate)); $this->tvormov = new tvormov(array('content'=>'tv')); $this->delcommand = new delcommand(array('content'=>"$WebServer/mythroku/mythtv_tv_del.php?basename=$show->basename")); }elseif(is_a($show,'VideoMetadata')){ /// Video from VideoMetadata table $videos = StorageGroup::first( array('conditions' => array('groupname = ?', 'Videos')) ); $streamfile = $videos->dirname . $show->filename; $parms = array('image'=>$streamfile); $streamUrl = "$WebServer/$MythRokuDir/imageSvc.php?" .http_build_query($parms); // http://www.mythtv.org/wiki/Video_Library#Metadata_Grabber_Troubleshooting // http://www.mythtv.org/wiki/MythVideo_File_Parsing#Filenames // if(!empty($show->screenshot)){ $screenart = StorageGroup::first( array('conditions' => array('groupname = ?', 'Screenshots')) ); $imgfile = !empty($screenart) && !empty($show->screenshot) ? $screenart->dirname . $show->screenshot : "images/oval_grey.png"; // }elseif(!empty($show->fanart)){ // $fanart = StorageGroup::first( array('conditions' => array('groupname = ?', 'Fanart')) ); // $imgfile = $fanart->dirname . $show->fanart; // }else{ // $coverart = StorageGroup::first( array('conditions' => array('groupname = ?', 'Coverart')) ); // $imgfile = $coverart->dirname . $show->coverfile; // } //TODO coverart and fanart are 5-10X sizeof screenshots. videometadata doesn't contain screenshots for movies. create screenshots and update db $parms = array('image'=>$imgfile); $imgUrl = "$WebServer/$MythRokuDir/imageSvc.php?" .http_build_query($parms); //TODO lookup genres for item::genres. can be an array? $category = VideoCategory::first( array('conditions' => array('intid = ?', $show->category)) ); $this->title = new title(array('content'=>normalizeHtml($show->title))); $this->contentQuality = new contentQuality(array('content'=>$RokuDisplayType)); $this->subtitle = new subtitle(array('content'=>normalizeHtml($show->subtitle))); $this->addToAttributes('sdImg', $imgUrl); $this->addToAttributes('hdImg', $imgUrl); $this->contentId = new contentId(array('content'=>$show->filename)); $this->contentType = new contentType(array('content'=>'Movie')); $this->media->streamUrl->setContent("$streamUrl "); //yes the space is required $this->synopsis = new synopsis(array('content'=>normalizeHtml($show->plot))); $season = '(S'.$show->season.'E'.$show->episode.' '.(new DateTime($show->starttime))->format('Y-m-d').')'; $this->genres = new genres(array('content'=>normalizeHtml(empty($category->category) ? '':$category->category).' '.$season)); $this->runtime = new runtime(array('content'=>$show->length * 60)); $this->date = new date(array('content'=>date("Y-m-d", convert_datetime($show->starttime)))); $this->programid = new programid( array('content'=> sprintf("%02d", $show->season) .'.' .sprintf("%03d",$show->episode) ) ); $this->tvormov = new tvormov(array('content'=>'movie')); $this->starrating = new starrating(array('content'=>$show->userrating * 10)); }else{ parent::__construct($show); } }
// // // //$paramcon = array( // array("seqId" => $return->return, "noCont" => "$conti", "ukCont" => "$contuk", "jnsCont" => "$contjenis", "bruto" => $contbruto),); // // } // ?> <?php /* * Function to turn a mysql datetime (YYYY-MM-DD HH:MM:SS) into a unix timestamp * @param str * The string to be formatted */ function convert_datetime($str) { list($date, $time) = explode('', $str); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $timestamp = mktime($hour, $minute, $second, $month, $day, $year); return $timestamp; } $time = time(); echo $time . "<hr/>"; $timezone = new DateTimeZone("asia/Kolkata"); $date = new DateTime(); $date->setTimezone($timezone); echo convert_datetime($date->format('Y-m-j H:i:s'));
public function download() { requirelogin(true); $this->load->helper('dompdf'); $data = $this->session->userdata('project_report'); $type = isset($data['type']) ? $data['type'] : ''; $pID = isset($data['project_id']) ? $data['project_id'] : 0; if ($pID > 0) { $qProjectDetails = $this->rdb->project($pID); if ($qProjectDetails->num_rows()) { $row = $qProjectDetails->row(); $dateCreated = convert_datetime($row->date_created); switch ($type) { case 'project': //Leaders $qPL = $this->rdb->get_proj_leaders($pID); $qCL = $this->rdb->get_proj_coleaders($pID); $vData = array('project_id' => $row->id, 'project_title' => htmlentities($row->project_name), 'project_description' => empty($row->description) ? 'None' : htmlentities($row->description), 'project_creator' => empty($row->display_name) ? 'User not available' : $row->display_name, 'date_created' => date("M d, Y", strtotime($dateCreated)), 'project_status' => 'asasdasd' == 1 ? 'Archived' : 'On Going', 'project_leaders' => $qPL->result(), 'project_coleaders' => $qCL->result(), 'members_count' => number_format($row->count_members), 'files_count' => number_format($row->count_files), 'completed_tasks' => number_format($row->count_tasks_completed), 'all_tasks' => number_format($row->count_tasks), 'feeds_count' => number_format($row->count_feeds), 'storage_used' => format_filesize($row->disk_usage)); $content = $this->load->view('reports/header', null, true); $content .= $this->load->view('reports/project', $vData, true); $content .= $this->load->view('reports/footer', null, true); $pdfName = $this->siteinfo->config('site_name') . '-' . strtotime('now') . '.pdf'; pdf_create($content, $pdfName); break; case 'member': $dateFrom = strtotime($data['date_from']) ? $data['date_from'] : '0000-00-00 00:00:00'; $dateFrom = date("Y-m-d 00:00:00", strtotime($dateFrom)); $dateTo = strtotime($data['date_to']) ? $data['date_to'] : date("Y-m-d 23:59:59"); $dateTo = date("Y-m-d 23:59:59", strtotime($dateTo)); $query = $this->rdb->get_proj_members($row->id, $dateFrom, $dateTo); $vData = array('project_id' => $row->id, 'members_query' => $query, 'project_title' => htmlentities($row->project_name), 'date_from' => empty($data['date_from']) ? 'old' : $data['date_from'], 'date_to' => empty($data['date_to']) ? 'latest' : $data['date_to']); $content = $this->load->view('reports/header', null, true); $content .= $this->load->view('reports/members', $vData, true); $content .= $this->load->view('reports/footer', null, true); $pdfName = $this->siteinfo->config('site_name') . '-' . strtotime('now') . '.pdf'; pdf_create($content, $pdfName); break; case 'task': $dateFrom = strtotime($data['date_from']) ? $data['date_from'] : '0000-00-00 00:00:00'; $dateFrom = date("Y-m-d 00:00:00", strtotime($dateFrom)); $dateTo = strtotime($data['date_to']) ? $data['date_to'] : date("Y-m-d 23:59:59"); $dateTo = date("Y-m-d 23:59:59", strtotime($dateTo)); switch ($data['status']) { case "active": $query = $this->rdb->get_tasks($row->id, 0, 1, $dateFrom, $dateTo); break; case "completed": $query = $this->rdb->get_tasks($row->id, 1, 1, $dateFrom, $dateTo); break; case "pending": $query = $this->rdb->get_tasks($row->id, "", 0, $dateFrom, $dateTo); break; case "active_complete": $query = $this->rdb->get_tasks($row->id, "", 1, $dateFrom, $dateTo); break; default: $query = $this->rdb->get_tasks($row->id, "", "", $dateFrom, $dateTo); break; } $vData = array('project_id' => $row->id, 'project_title' => htmlentities($row->project_name), 'query' => $query, 'date_from' => empty($data['date_from']) ? 'old' : $data['date_from'], 'date_to' => empty($data['date_to']) ? 'latest' : $data['date_to']); $content = $this->load->view('reports/header', null, true); $content .= $this->load->view('reports/tasks', $vData, true); $content .= $this->load->view('reports/footer', null, true); $pdfName = $this->siteinfo->config('site_name') . '-' . strtotime('now') . '.pdf'; pdf_create($content, $pdfName); break; case 'personel': $query = $this->rdb->member_info($row->id, $data['member']); if ($query->num_rows()) { $member = $query->row(); $ownedtasks_query = $this->rdb->get_owned_tasks($row->id, $member->id); $task_query = $this->rdb->get_usertasks2($row->id, $member->id); $vData = array('project_id' => $row->id, 'project_title' => htmlentities($row->project_name), 'member_name' => $member->display_name, 'active_tasks' => number_format($member->active_tasks), 'completed_tasks' => number_format($member->completed_tasks), 'owned_tasks' => number_format($member->owned_tasks), 'posts' => number_format($member->posts), 'files' => number_format($member->files), 'storage_used' => format_filesize($member->files_size), 'ownedtasks_query' => $ownedtasks_query, 'task_query' => $task_query); $content = $this->load->view('reports/header', null, true); $content .= $this->load->view('reports/personel', $vData, true); $content .= $this->load->view('reports/footer', null, true); $pdfName = $this->siteinfo->config('site_name') . '-' . strtotime('now') . '.pdf'; pdf_create($content, $pdfName); } else { echo 'Cannot find member.'; } break; default: echo 'Error! No report type selected.'; } } else { echo 'Project not found.'; } } else { echo 'No project selected.'; } }
} } $waka['posts'][$p]['dateCommentsTouched'] = date("Y-m-d H:i:s"); //print_r($comment); } } } } } //notify!! foreach ($waka['users'] as $key => $user) { if ($key != $_REQUEST['u'] && $notify && $user['notificationCooldown'] != '0') { if (!isset($user['lastNotification'])) { $tlastntf = 0; } else { $tlastntf = convert_datetime($user['lastNotification']); } echo time() - $tlastntf; if (time() - $tlastntf > $user['notificationCooldown']) { $mail = new PHPMailer(); $mail->From = "*****@*****.**"; $mail->Sender = "*****@*****.**"; $mail->FromName = "Waka"; $mail->AddAddress($user['email']); $mail->WordWrap = 50; // set word wrap to 50 characters //$mail->AddAttachment($file, "Aushang.pdf"); // optional name $mail->IsHTML(false); // set email format to HTML $mail->Subject = 'Activity on waka: ' . $waka['starter']['title']; $mail->Body = "There has been an activity on the waka you are subscribed to. Use the following link to read the latest version:\n\t\n\t\t\t\t\t\t\t\n\t\t\t\n\t\t\t\t\t\t\thttp://dasunwahrscheinliche.de/waka/?w=" . $_REQUEST['w'] . "&u=" . $key . "\n\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\tDo not share this link!";
$SQL = "SELECT * FROM recorded WHERE basename LIKE '%.mp4' ORDER BY title ASC"; } elseif (isset($_GET['sort']) && $_GET['sort'] == 'genre') { $SQL = "SELECT * FROM recorded WHERE basename LIKE '%.mp4' ORDER BY category ASC"; } elseif (isset($_GET['sort']) && $_GET['sort'] == 'channel') { $SQL = "SELECT * FROM recorded WHERE basename LIKE '%.mp4' ORDER BY channel ASC"; } else { # $SQL = "SELECT * FROM recorded WHERE basename LIKE '%.mp4'"; $SQL = "SELECT * FROM recorded "; } $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); print "\n<html> \n\n<head> \n<title> MythRoku Test Page</title>\n</head>\n\n<body bgcolor=\"white\" text=\"blue\">\n<img src=\"" . $WebServer . "/" . $MythRokuDir . "/images/mythtv_logo_SD.png\">\n<br>\n<h1>MythRoku Test Page: Recordings</h1>\n<br>\nUse this page to help diagnose any problems there may be with settings and configuration. If all data displays ok here then it should work with Roku!<br><br>"; while ($db_field = mysql_fetch_assoc($result)) { //need some error checking here if file could not be found or art work missing etc..... $ShowLength = convert_datetime($db_field['endtime']) - convert_datetime($db_field['starttime']); print "<br><b>" . $db_field['title'] . "</b><br>\n\tSubtitle: " . htmlspecialchars(preg_replace('/[^(\\x20-\\x7F)]*/', '', $db_field['subtitle'])) . "<br><br>\n <a href=\"" . $WebServer . "/pl/stream/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . ".mp4\"> <img src=\"" . $WebServer . "/tv/get_pixmap/" . $db_field['hostname'] . "/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . "/100/75/-1/" . $db_field['basename'] . ".100x75x-1.png\"></a><br>\n\tStream ID: " . $counter++ . "<br>\n\tType: TV<br>\n Quality: " . $RokuDisplayType . "<br>\n Stream Format: mp4<br>\n Stream Bitrate: " . $BitRate . "<br>\n Stream Url: <a href=\"" . $WebServer . "/pl/stream/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . ".mp4\">" . $WebServer . "/pl/stream/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . ".mp4</a><br>\n Synopsis: " . htmlspecialchars(preg_replace('/[^(\\x20-\\x7F)]*/', '', $db_field['description'])) . "<br>\n Genre: " . $db_field['category'] . "<br>\n Runtime: " . $ShowLength . " min<br>\n Date: " . date("F j, Y, g:i a", convert_datetime($db_field['starttime'])) . "<br>\n <br>"; } print "</body></html>"; mysql_close($db_handle); } else { print "Database NOT Found "; mysql_close($db_handle); } function convert_datetime($str) { list($date, $time) = explode(' ', $str); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $timestamp = mktime($hour, $minute, $second, $month, $day, $year); return $timestamp; }
while ($db_field = mysql_fetch_assoc($result)) { if (!file_exists($mythtvdata_ . RemoveExtension($db_field['basename']) . ".mp4")) { $num_rows = $num_rows - 1; } } //print the xml header print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> \n\t<feed>\n\t<!-- resultLength indicates the total number of results for this feed -->\n\t<resultLength>" . $num_rows . "</resultLength>\n\t<!-- endIndix indicates the number of results for this *paged* section of the feed -->\n\t<endIndex>" . $num_rows . "</endIndex>"; //reset pointer mysql_data_seek($result, 0); while ($db_field = mysql_fetch_assoc($result)) { //only show mp4 recordings if (file_exists($mythtvdata_ . RemoveExtension($db_field['basename']) . ".mp4")) { //compute the length of the show $ShowLength = convert_datetime($db_field['endtime']) - convert_datetime($db_field['starttime']); //print out all the records in xml format for roku to read print "\t\n\t\t<item sdImg=\"" . $WebServer . "/tv/get_pixmap/" . $db_field['hostname'] . "/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . "/100/75/-1/" . $db_field['basename'] . ".100x75x-1.png\" hdImg=\"" . $WebServer . "/tv/get_pixmap/" . $db_field['hostname'] . "/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . "/100/75/-1/" . $db_field['basename'] . ".100x75x-1.png\">\n\t\t\t<title>" . htmlspecialchars(preg_replace('/[^(\\x20-\\x7F)]*/', '', $db_field['title'])) . "</title>\n\t\t\t<contentId>" . $counter++ . "</contentId>\n\t\t\t<contentType>TV</contentType>\n\t\t\t<contentQuality>" . $RokuDisplayType . "</contentQuality>\n\t\t\t<media>\n\t\t\t\t<streamFormat>mp4</streamFormat>\n\t\t\t\t<streamQuality>" . $RokuDisplayType . "</streamQuality>\n\t\t\t\t<streamBitrate>" . $BitRate . "</streamBitrate>\n\t\t\t\t<streamUrl>" . $WebServer . "/pl/stream/" . $db_field['chanid'] . "/" . convert_datetime($db_field['starttime']) . ".mp4</streamUrl>\n\t\t\t</media>\n\t\t\t<synopsis>" . htmlspecialchars(preg_replace('/[^(\\x20-\\x7F)]*/', '', $db_field['description'])) . "</synopsis>\n\t\t \t<genres>" . htmlspecialchars(preg_replace('/[^(\\x20-\\x7F)]*/', '', $db_field['category'])) . "</genres>\n\t\t\t<subtitle>" . htmlspecialchars(preg_replace('/[^(\\x20-\\x7F)]*/', '', $db_field['subtitle'])) . "</subtitle>\n\t\t\t<runtime>" . $ShowLength . "</runtime>\n\t\t\t<date>" . date("F j, Y, g:i a", convert_datetime($db_field['starttime'])) . "</date>\n\t\t\t<tvormov>tv</tvormov>\n\t\t\t<delcommand>" . $WebServer . "/mythroku/mythtv_tv_del.php?basename=" . $db_field['basename'] . "</delcommand>\n\t\t</item>"; } } print "</feed>"; } else { print "Database NOT Found "; } //close mysql pointer mysql_close($db_handle); //function to convert mysql timestamp to unix time function convert_datetime($str) { list($date, $time) = explode(' ', $str); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
$query2 = mysqli_query($conn, $sql) or die('something wrong'); $numStars = mysqli_num_rows($query2); $width = floor(100 / $numStars); $starSize = round(14 / $numStars, 1); if ($starSize > 4) { $starSize = 4; } print "\n<div id=\"stars\">"; $tests = array(); while (list($testid, $testdesc, $testRetain, $start, $end, $score) = mysqli_fetch_row($query2)) { $test = array(); array_push($test, $testid); array_push($test, $testdesc); array_push($test, $score); array_push($test, convert_datetime($start)); array_push($test, convert_datetime($end)); array_push($test, $testRetain); array_push($tests, $test); if ($score == 100) { print "\n<div class=\"stardiv\" style=\"width: {$width}%;font-size: " . $starSize . "em;\">★<div style=\"font-size: 1rem;\">{$testdesc}</div></div>"; } else { print "\n<div class=\"stardiv\" style=\"width: {$width}%;font-size: " . $starSize . "em;\">☆<div style=\"font-size: 1rem;\">{$testdesc}</div></div>"; } } print "\n<div style=\"clear: both\"></div>\n</div>"; foreach ($tests as $val) { // echo $val[3]."<br>"; // echo time(); if ($val[3] > time() or $val[4] < time()) { continue; }
public function init($id = 0) { requirelogin(); updateLastActive(); $myID = getUserID(); $pid = (int) $this->input->get('pid'); $tid = (int) $this->input->get('tid'); $query = $this->tdb->getTaskInfo($pid, $tid); if ($query->num_rows()) { $row = $query->row(); $priorities = $this->config->item('priorities'); $status = $row->status == 1 ? 'completed' : 'active'; $status = $row->is_accepted == 1 ? $status : 'pending'; $priorityColors = array('bg-light', 'bg-warning dker', 'bg-danger'); $start = 'TBA'; $startOrig = ''; $end = 'TBA'; $endOrig = ''; $dateCompleted = 'TBA'; $isOverdue = 0; if (strtotime($row->date_start)) { $start = convert_datetime($row->date_start); $start = date("M d, Y", strtotime($row->date_start)); $startOrig = date("m/d/Y", strtotime($row->date_start)); } if (strtotime($row->date_end)) { $end = convert_datetime($row->date_end); $end = date("M d, Y", strtotime($row->date_end)); $endOrig = date("m/d/Y", strtotime($row->date_end)); $endDateOnly = date("Y-m-d", strtotime($row->date_end)); $endDateOnlyStr = strtotime($endDateOnly); $isOverdue = strtotime(date("Y-m-d")) >= $endDateOnlyStr ? 1 : 0; } if (strtotime($row->date_completed)) { $dateCompleted = convert_datetime($row->date_completed); $dateCompleted = date("M d, Y", strtotime($row->date_completed)); } $isModerator = validate_access('is_moderator', array('project_id' => $pid, 'user_id' => $myID)); $qMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $myID)); $qIsMember = 0; $qIsInvited = 0; $qIsRequesting = 0; if ($qMember->num_rows()) { $qMemberRow = $qMember->row(); $qIsMember = $qMemberRow->is_accepted == 1 ? 1 : 0; $qIsInvited = $qMemberRow->is_accepted == 0 && $qMemberRow->assigned_by > 0 ? 1 : 0; $qIsRequesting = $qMemberRow->is_accepted == 0 && $qMemberRow->assigned_by == 0 ? 1 : 0; } $members = array(); $qMembers = $this->mdb->taskMembers_get2(array('task_id' => $row->id)); foreach ($qMembers->result() as $member) { $description = 'Pending'; if ($member->is_accepted == 1) { $description = $member->id == $row->creator_id ? 'Task Master' : 'Member'; } $members[] = array('id' => $member->id, 'display_name' => $member->display_name, 'description' => $description); } $item = array('id' => $row->id, 'name' => $row->title, 'safe_name' => htmlentities($row->title), 'project_id' => $row->project_id, 'description' => htmlentities($row->description), 'priority' => $row->priority, 'priority_name' => $priorities[$row->priority], 'priority_class' => isset($priorityColors[$row->priority]) ? $priorityColors[$row->priority] : $priorityColors[0], 'status' => $row->status, 'status_name' => ucfirst($status), 'date_start' => $start, 'date_start_orig' => $startOrig, 'date_end' => $end, 'date_end_orig' => $endOrig, 'is_overdue' => $isOverdue, 'date_completed' => $dateCompleted, 'remarks' => $row->remarks, 'is_moderator' => $isModerator ? 1 : 0, 'is_creator' => $myID == $row->creator_id, 'is_accepted' => $row->is_accepted, 'is_member' => $qIsMember, 'visitor_type' => visitor_type($pid, $myID), 'is_invited' => $qIsInvited, 'members' => $members, 'parent_task' => $row->parent_task, 'task_master' => array('id' => $row->creator_id, 'name' => $row->task_master)); generate_json(array('status' => 1, 'item' => $item)); } else { generate_json(array('status' => 0, 'message' => 'Failed to load data.')); } }
if ($file == '') { $errormessage = 'Für die Verstaltung am ' . $feeditems[$i]['date'] . ' mit der ID ' . $feeditems[$i]['ID'] . ' fehlt das Pdf. Email wurde nicht versandt.'; $erroraddress = '*****@*****.**'; $errorsubject = 'Fehler beim versandt des Kolloquiums-Newsletter!'; mail($erroraddress, $errorsubject, $errormessage); } else { sendmail($subject, $message, $file); echo '<br><br>' . $message; echo '<br><br>mail sent'; } } } // check for the three days anouncements for ($i = 0; $i < count($feeditems); $i++) { $time_inthreedays = $time_now + 24 * 60 * 60; $time_feeditem = convert_datetime($feeditems[$i]['date']); if (abs($time_inthreedays - $time_feeditem) < 12 * 60 * 60) { list($date, $time) = explode(' ', $feeditems[$i]['date']); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $subject = 'Erinnerung an CBI-Kolloquiumstermin morgen ' . $day . '.' . $month . '.' . $year . ' ' . $hour . ':' . $minute; $message = nl2br(htmlentities(utf8_decode("\n\t\t\n\t\tLiebe Kollegen,\n\n\t\t\n\n\t\tWir möchten Sie an das morgige CBI-Kolloquium erinnern.\n\n\t\t" . $feeditems[$i]['lecturer'] . " - \"" . $feeditems[$i]['title'] . "\".\n\n\t\t\n\n\t\tMit freundlichen Grüßen\n \n\t\tJoanna Smiglak"))); sendmail($subject, $message, ''); echo '<br><br>' . $subject; echo '<br><br>' . $message; echo '<br><br>mail sent'; } } ?>
function renderItemComments($item, $user, $location) { $email = $user['email']; $str = ''; $ccount = count($item['comments']); $item['comments'] = sortItemsAsc($item['comments'], 'dateCreated'); for ($c = 0; $c < $ccount; $c++) { $str .= '<div class="post_comment"><img src="http://www.gravatar.com/avatar/' . hash('md5', $item['comments'][$c]['user']) . '.gif?s=32&default=identicon&r=PG" class="commentavatar">'; if ($email == $item['comments'][$c]['user']) { $str .= '<a href="javascript:queryDeleteComment(\'' . $_REQUEST['w'] . '\',\'' . $_REQUEST['u'] . '\',\'' . $item['id'] . '\',\'' . $item['comments'][$c]['id'] . '\')">'; $str .= '<img src="img/Actions-edit-delete-icon.png" style="float:right;">'; $str .= '</a>'; } $str .= '<div class="post_comment_content"><small><span class="time" utctime="' . convert_datetime($item['comments'][$c]['dateCreated']) . '">' . $item['comments'][$c]['dateCreated'] . ' (UTC)</span> ' . $item['comments'][$c]['user'] . ': </small><p>' . parseBBCode2HTML(parseLatexBBCode(htmlspecialchars(stripslashes($item['comments'][$c]['content'])))) . '</div></div>'; $str .= '<div style="clear: both;"></div>'; } $str .= '<div class="post_comment_adder"><img src="http://www.gravatar.com/avatar/' . hash('md5', $email) . '.gif?s=32&default=identicon&r=PG" class="commentavatar">'; $str .= '<div class="post_comment_form"><form action="query.php" method="post" name="editpost" class="comment_add_form" autocomplete="off"> <input type="hidden" name="w" value="' . $_REQUEST['w'] . '"> <input type="hidden" name="u" value="' . $_REQUEST['u'] . '"> <input type="hidden" name="id" value="' . $item['id'] . '"> <input type="hidden" name="action" value="comment_add">'; $str .= '<small>' . $email . ': </small>'; $str .= '<p><textarea name="content" style="width:500px; height:40px;"></textarea></p>'; $str .= '<p><input type="submit" value="comment"></p>'; $str .= '</form></div></div>'; return $str; }