function update() { $timestamp = mktime(0, 0, 0, $this->params['month'], 1); $endday = expDateTime::endOfMonthDay($timestamp); if ($this->params['day'] > $endday) { expValidator::failAndReturnToForm(gt('There are only') . ' ' . $endday . ' ' . gt('days in') . ' ' . $this->motd->months[$this->params['month']], $this->params); } parent::update(); }
/** * Routine to check for installation or upgrade */ public static function checkVersion() { global $db, $user; $swversion->major = EXPONENT_VERSION_MAJOR; $swversion->minor = EXPONENT_VERSION_MINOR; $swversion->revision = EXPONENT_VERSION_REVISION; $swversion->type = EXPONENT_VERSION_TYPE; $swversion->iteration = EXPONENT_VERSION_ITERATION; $swversion->builddate = EXPONENT_VERSION_BUILDDATE; // check database version against installed software version if ($db->havedb) { if ($user->isAdmin()) { $dbversion = $db->selectObject('version', 1); if (empty($dbversion)) { $dbversion->major = 0; $dbversion->minor = 0; $dbversion->revision = 0; $dbversion->type = ''; $dbversion->iteration = ''; } // check if software version is newer than database version if (self::compareVersion($dbversion, $swversion)) { $oldvers = $dbversion->major . '.' . $dbversion->minor . '.' . $dbversion->revision . ($dbversion->type ? $dbversion->type : '') . ($dbversion->iteration ? $dbversion->iteration : ''); $newvers = $swversion->major . '.' . $swversion->minor . '.' . $swversion->revision . ($swversion->type ? $swversion->type : '') . ($swversion->iteration ? $swversion->iteration : ''); flash('message', gt('The database requires upgrading from') . ' v' . $oldvers . ' ' . gt('to') . ' v' . $newvers . '<br><a href="' . makelink(array("controller" => "administration", "action" => "install_exponent")) . '">' . gt('Click here to Upgrade your website') . '</a>'); } } } else { // database is unavailable, so show us as being offline $template = new standalonetemplate('_maintenance'); $template->assign("db_down", true); $template->output(); exit; } // check if online version is newer than installed software version, but only once per session if ($user->isAdmin()) { if (!expSession::is_set('update-check')) { $onlineVer = self::getOnlineVersion(); expSession::set('update-check', '1'); if (self::compareVersion($swversion, $onlineVer)) { $newvers = $onlineVer->major . '.' . $onlineVer->minor . '.' . $onlineVer->revision . ($onlineVer->type ? $onlineVer->type : '') . ($onlineVer->iteration ? $onlineVer->iteration : ''); flash('message', gt('A newer version of Exponent is available') . ': v' . $newvers . ' ' . gt('was released') . ' ' . expDateTime::format_date($onlineVer->builddate) . '<br><a href="https://github.com/exponentcms/exponent-cms/downloads" target="_blank">' . gt('Click here to see available Downloads') . '</a>'); } } } }
public function showall_by_date() { expHistory::set('viewable', $this->params); $start_date = mktime(0, 0, 0, $this->params['month'], 1, $this->params['year']); $end_date = mktime(0, 0, 0, $this->params['month'] + 1, 0, $this->params['year']); $where = ($this->aggregateWhereClause() ? $this->aggregateWhereClause() . " AND " : "") . 'created_at > ' . $start_date . ' AND created_at < ' . $end_date; $order = 'created_at'; $limit = empty($this->config['limit']) ? 10 : $this->config['limit']; $page = new expPaginator(array('model' => 'blog', 'where' => $where, 'limit' => $limit, 'order' => $order, 'dir' => 'desc', 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Title' => 'title'))); assign_to_template(array('page' => $page, 'moduletitle' => 'Blogs by date "' . expDateTime::format_date($start_date) . '"')); }
// } // } // //eDebug($monthly); // $template->assign("monthly",$monthly); // $template->assign("currentweek",$currentweek); // $template->assign("currentday",$currentday); // $template->assign("now",$timefirst); // $prevmonth = mktime(0, 0, 0, date("m",$timefirst)-1, date("d",$timefirst)+10, date("Y",$timefirst)); // $nextmonth = mktime(0, 0, 0, date("m",$timefirst)+1, date("d",$timefirst)+10, date("Y",$timefirst)); // $template->assign("prevmonth",$prevmonth); // $template->assign("thismonth",$timefirst); // $template->assign("nextmonth",$nextmonth); // } else if ($viewparams['type'] == "byday") { // Remember this is the code for weekly view and monthly listview // Test your fixes on both views before submitting your changes to cvs $startperiod = expDateTime::startOfDayTimestamp($time); $totaldays = $_GET['days']; if ($totaldays == "") { $totaldays = 7; // default 7 days of events } // if ($viewparams['range'] == "week") { // $startperiod = expDateTime::startOfWeekTimestamp($time); // $totaldays = 7; // } else if ($viewparams['range'] == "twoweek") { // $startperiod = expDateTime::startOfWeekTimestamp($time); // $totaldays = 14; // } else { // range = month // $startperiod = expDateTime::startOfMonthTimestamp($time); // $totaldays = date('t', $time); // }
if (isset($config->rss_limit) && $config->rss_limit > 0) { $rsslimit = " AND date <= " . ($day + $config->rss_limit * 86400); } else { $rsslimit = ""; } $cats = $db->selectObjectsIndexedArray("category"); $cats[0] = null; $cats[0]->name = 'None'; if (isset($_GET['time'])) { $time = $_GET['time']; // get current month's events $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfMonthTimestamp($time) . " AND date <= " . expDateTime::endOfMonthTimestamp($time)); } else { $time = date('U', strtotime("midnight -1 month", time())); // previous month also $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($time) . $rsslimit); } $title = $db->selectValue('container', 'title', "internal='" . serialize($loc) . "'"); $Filename = preg_replace('/\\s+/', '', $title); // without whitespace } if (!function_exists("quoted_printable_encode")) { // function added in php v5.3.0 function quoted_printable_encode($input, $line_max = 75) { $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); $lines = preg_split("/(?:\r\n|\r|\n)/", $input); $linebreak = "=0D=0A=\r\n"; /* the linebreak also counts as characters in the mime_qp_long_line * rule of spam-assassin */ $line_max = $line_max - strlen($linebreak);
static function show($view, $loc = null, $title = '') { global $user; global $db; $locsql = "(location_data='" . serialize($loc) . "'"; $config = $db->selectObject("calendarmodule_config", "location_data='" . serialize($loc) . "'"); if (!empty($config->aggregate)) { $locations = unserialize($config->aggregate); foreach ($locations as $source) { $tmploc = null; $tmploc->mod = 'calendarmodule'; $tmploc->src = $source; $tmploc->int = ''; $locsql .= " OR location_data='" . serialize($tmploc) . "'"; } } $locsql .= ')'; $template = new template('calendarmodule', $view, $loc); if ($title == '') { $title = $db->selectValue('container', 'title', "internal='" . serialize($loc) . "'"); } $template->assign('moduletitle', $title); $canviewapproval = false; $inapproval = false; global $user; if ($user) { $canviewapproval = expPermissions::check("approve", $loc) || expPermissions::check("manage_approval", $loc); } if ($db->countObjects("calendar", "location_data='" . serialize($loc) . "' AND approved!=1")) { foreach ($db->selectObjects("calendar", "location_data='" . serialize($loc) . "' AND approved!=1") as $c) { if ($c->poster == $user->id) { $canviewapproval = true; } } $inapproval = true; } $time = isset($_GET['time']) ? $_GET['time'] : time(); $template->assign("time", $time); $viewparams = $template->viewparams; if ($viewparams === null) { $viewparams = array("type" => "default"); } if ($viewparams['type'] == "minical") { $monthly = expDateTime::monthlyDaysTimestamp($time); $info = getdate($time); $timefirst = mktime(12, 0, 0, $info['mon'], 1, $info['year']); $now = getdate(time()); $currentday = $now['mday']; $endofmonth = date('t', $time); foreach ($monthly as $weekNum => $week) { foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { $monthly[$weekNum][$dayNum]['number'] = $monthly[$weekNum][$dayNum]['ts'] != -1 ? $db->countObjects("eventdate", $locsql . " AND date = " . $day['ts']) : -1; } } } //eDebug($monthly); $template->assign("monthly", $monthly); $template->assign("currentweek", $currentweek); $template->assign("currentday", $currentday); $template->assign("now", $timefirst); $prevmonth = mktime(0, 0, 0, date("m", $timefirst) - 1, date("d", $timefirst) + 10, date("Y", $timefirst)); $nextmonth = mktime(0, 0, 0, date("m", $timefirst) + 1, date("d", $timefirst) + 10, date("Y", $timefirst)); $template->assign("prevmonth", $prevmonth); $template->assign("thismonth", $timefirst); $template->assign("nextmonth", $nextmonth); } else { if ($viewparams['type'] == "byday") { // Remember this is the code for weekly view and monthly listview // Test your fixes on both views before submitting your changes to cvs $startperiod = 0; $totaldays = 0; if ($viewparams['range'] == "week") { $startperiod = expDateTime::startOfWeekTimestamp($time); $totaldays = 7; $template->assign("prev_timestamp3", strtotime('-21 days', $startperiod)); $template->assign("prev_timestamp2", strtotime('-14 days', $startperiod)); $template->assign("prev_timestamp", strtotime('-7 days', $startperiod)); $template->assign("next_timestamp", strtotime('+7 days', $startperiod)); $template->assign("next_timestamp2", strtotime('+14 days', $startperiod)); $template->assign("next_timestamp3", strtotime('+21 days', $startperiod)); } else { if ($viewparams['range'] == "twoweek") { $time = time(); $startperiod = expDateTime::startOfWeekTimestamp($time); $totaldays = 14; $template->assign("prev_timestamp3", strtotime('-42 days', $startperiod)); $template->assign("prev_timestamp2", strtotime('-28 days', $startperiod)); $template->assign("prev_timestamp", strtotime('-14 days', $startperiod)); $template->assign("next_timestamp", strtotime('+14 days', $startperiod)); $template->assign("next_timestamp2", strtotime('+28 days', $startperiod)); $template->assign("next_timestamp3", strtotime('+42 days', $startperiod)); } else { // range = month $startperiod = expDateTime::startOfMonthTimestamp($time); $totaldays = date('t', $time); $template->assign("prev_timestamp3", strtotime('-3 months', $startperiod)); $template->assign("prev_timestamp2", strtotime('-2 months', $startperiod)); $template->assign("prev_timestamp", strtotime('-1 months', $startperiod)); $template->assign("next_timestamp", strtotime('+1 months', $startperiod)); $template->assign("next_timestamp2", strtotime('+2 months', $startperiod)); $template->assign("next_timestamp3", strtotime('+3 months', $startperiod)); } } $days = array(); // added per Ignacio $endofmonth = date('t', $time); for ($i = 1; $i <= $totaldays; $i++) { $info = getdate($time); if ($viewparams['range'] == "week") { $start = mktime(12, 0, 0, $info['mon'], $i, $info['year']); } else { if ($viewparams['range'] == "twoweek") { $start = mktime(12, 0, 0, $info['mon'], $info['mday'] + ($i - 1), $info['year']); // $start = $startperiod + ($i*86400); } else { // range = month $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']); } } $edates = $db->selectObjects("eventdate", $locsql . " AND date = '" . $start . "'"); $days[$start] = calendarmodule::_getEventsForDates($edates); for ($j = 0; $j < count($days[$start]); $j++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $days[$start][$j]->id); $days[$start][$j]->permissions = array("administrate" => expPermissions::check("administrate", $thisloc) || expPermissions::check("administrate", $loc), "edit" => expPermissions::check("edit", $thisloc) || expPermissions::check("edit", $loc), "delete" => expPermissions::check("delete", $thisloc) || expPermissions::check("delete", $loc)); } $days[$start] = expSorter::sort(array('array' => $days[$start], 'sortby' => 'eventstart', 'order' => 'ASC')); } $template->assign("days", $days); } else { if ($viewparams['type'] == "monthly") { $monthly = array(); $counts = array(); $info = getdate($time); $nowinfo = getdate(time()); if ($info['mon'] != $nowinfo['mon']) { $nowinfo['mday'] = -10; } // Grab non-day numbers only (before end of month) $week = 0; $currentweek = -1; $timefirst = mktime(12, 0, 0, $info['mon'], 1, $info['year']); $infofirst = getdate($timefirst); $monthly[$week] = array(); // initialize for non days $counts[$week] = array(); if ($infofirst['wday'] == 0 && DISPLAY_START_OF_WEEK == 1) { for ($i = -6; $i < 1 - DISPLAY_START_OF_WEEK; $i++) { $monthly[$week][$i] = array(); $counts[$week][$i] = -1; } $weekday = $infofirst['wday'] + 7; // day number in grid. if 7+, switch weeks } else { for ($i = 1 - $infofirst['wday']; $i < 1 - DISPLAY_START_OF_WEEK; $i++) { $monthly[$week][$i] = array(); $counts[$week][$i] = -1; } $weekday = $infofirst['wday']; // day number in grid. if 7+, switch weeks } // Grab day counts (deprecated, handled by the date function) // $endofmonth = expDateTime::endOfMonthDay($time); $endofmonth = date('t', $time); for ($i = 1; $i <= $endofmonth; $i++) { $start = mktime(0, 0, 0, $info['mon'], $i, $info['year']); if ($i == $nowinfo['mday']) { $currentweek = $week; } #$monthly[$week][$i] = $db->selectObjects("calendar","location_data='".serialize($loc)."' AND (eventstart >= $start AND eventend <= " . ($start+86399) . ") AND approved!=0"); //$dates = $db->selectObjects("eventdate",$locsql." AND date = $start"); $dates = $db->selectObjects("eventdate", $locsql . " AND date = '" . $start . "'"); $monthly[$week][$i] = calendarmodule::_getEventsForDates($dates); $counts[$week][$i] = count($monthly[$week][$i]); if ($weekday >= 6 + DISPLAY_START_OF_WEEK) { $week++; $monthly[$week] = array(); // allocate an array for the next week $counts[$week] = array(); $weekday = DISPLAY_START_OF_WEEK; } else { $weekday++; } } // Grab non-day numbers only (after end of month) for ($i = 1; $weekday && $i < 8 + DISPLAY_START_OF_WEEK - $weekday; $i++) { $monthly[$week][$i + $endofmonth] = array(); $counts[$week][$i + $endofmonth] = -1; } //eDebug($monthly); $template->assign("currentweek", $currentweek); $template->assign("monthly", $monthly); $template->assign("counts", $counts); $template->assign("prevmonth3", strtotime('-3 months', $timefirst)); $template->assign("prevmonth2", strtotime('-2 months', $timefirst)); $template->assign("prevmonth", strtotime('-1 months', $timefirst)); $template->assign("nextmonth", strtotime('+1 months', $timefirst)); $template->assign("nextmonth2", strtotime('+2 months', $timefirst)); $template->assign("nextmonth3", strtotime('+3 months', $timefirst)); $template->assign("now", $timefirst); $template->assign("today", strtotime('today') - 43200); } else { if ($viewparams['type'] == "administration") { // Check perms and return if cant view if ($viewparams['type'] == "administration" && !$user) { return; } $continue = expPermissions::check("administrate", $loc) || expPermissions::check("post", $loc) || expPermissions::check("edit", $loc) || expPermissions::check("delete", $loc) || expPermissions::check("approve", $loc) || expPermissions::check("manage_approval", $loc) ? 1 : 0; $dates = $db->selectObjects("eventdate", $locsql . " AND date >= '" . expDateTime::startOfDayTimestamp(time()) . "'"); $items = calendarmodule::_getEventsForDates($dates); if (!$continue) { foreach ($items as $i) { $iloc = expCore::makeLocation($loc->mod, $loc->src, $i->id); if (expPermissions::check("edit", $iloc) || expPermissions::check("delete", $iloc) || expPermissions::check("administrate", $iloc)) { $continue = true; } } } if (!$continue) { return; } for ($i = 0; $i < count($items); $i++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $items[$i]->id); if ($user && $items[$i]->poster == $user->id) { $canviewapproval = 1; } $items[$i]->permissions = array("administrate" => expPermissions::check("administrate", $thisloc) || expPermissions::check("administrate", $loc), "edit" => expPermissions::check("edit", $thisloc) || expPermissions::check("edit", $loc), "delete" => expPermissions::check("delete", $thisloc) || expPermissions::check("delete", $loc)); } $items = expSorter::sort(array('array' => $items, 'sortby' => 'eventstart', 'order' => 'ASC')); $template->assign("items", $items); } else { if ($viewparams['type'] == "default") { if (!isset($viewparams['range'])) { $viewparams['range'] = "all"; } $items = null; $dates = null; $day = expDateTime::startOfDayTimestamp(time()); $sort_asc = true; // For the getEventsForDates call $moreevents = false; switch ($viewparams['range']) { case "all": $dates = $db->selectObjects("eventdate", $locsql); break; case "upcoming": if (!empty($config->rss_limit) && $config->rss_limit > 0) { $eventlimit = " AND date <= " . ($day + $config->rss_limit * 86400); } else { $eventlimit = ""; } $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . $day . $eventlimit . " ORDER BY date ASC "); // $moreevents = count($dates) < $db->countObjects("eventdate",$locsql." AND date >= $day"); break; case "past": $dates = $db->selectObjects("eventdate", $locsql . " AND date < {$day} ORDER BY date DESC "); // $moreevents = count($dates) < $db->countObjects("eventdate",$locsql." AND date < $day"); $sort_asc = false; break; case "today": $dates = $db->selectObjects("eventdate", $locsql . " AND date = {$day}"); break; case "next": $dates = array($db->selectObject("eventdate", $locsql . " AND date >= {$day}")); break; case "month": $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfMonthTimestamp(time()) . " AND date <= " . expDateTime::endOfMonthTimestamp(time())); break; } $items = calendarmodule::_getEventsForDates($dates, $sort_asc, isset($template->viewconfig['featured_only']) ? true : false); // Upcoming events can be configured to show a specific number of events. // The previous call gets all events in the future from today // If configured, cut the array to the configured number of events // if ($template->viewconfig['num_events']) { // switch ($viewparams['range']) { // case "upcoming": // case "past": // $moreevents = $template->viewconfig['num_events'] < count($items); // break; // } // $items = array_slice($items, 0, $template->viewconfig['num_events']); //eDebug($items); // } for ($i = 0; $i < count($items); $i++) { $thisloc = expCore::makeLocation($loc->mod, $loc->src, $items[$i]->id); if ($user && $items[$i]->poster == $user->id) { $canviewapproval = 1; } $items[$i]->permissions = array('administrate' => expPermissions::check('administrate', $thisloc) || expPermissions::check('administrate', $loc), 'edit' => expPermissions::check('edit', $thisloc) || expPermissions::check('edit', $loc), 'delete' => expPermissions::check('delete', $thisloc) || expPermissions::check('delete', $loc)); } //Get the image file if there is one. // for ($i = 0; $i < count($items); $i++) { // if (isset($items[$i]->file_id) && $items[$i]->file_id > 0) { // $file = $db->selectObject('file', 'id='.$items[$i]->file_id); // $items[$i]->image_path = $file->directory.'/'.$file->filename; // } // } //eDebug($items); $template->assign('items', $items); $template->assign('moreevents', $moreevents); } } } } } $template->assign('in_approval', $inapproval); $template->assign('canview_approval_link', $canviewapproval); $template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'manage_approval', 'manage_categories'), $loc); // $cats = $db->selectObjectsIndexedArray("category","location_data='".serialize($loc)."'"); // $cats = $db->selectObjectsIndexedArray("category"); // $cats[0] = null; // $cats[0]->name = '<i>'.gt('No category').'</i>'; // $cats[0]->color = "#000000"; // $template->assign("categories",$cats); if (!$config) { // $config->enable_categories = 0; $config->enable_ical = 1; } $template->assign("config", $config); if (!isset($config->enable_ical)) { $config->enable_ical = 1; } $template->assign("enable_ical", $config->enable_ical); //Get the tags that have been selected to be shown in the grouped by tag views // if (isset($config->show_tags)) { // $available_tags = unserialize($config->show_tags); // } else { // $available_tags = array(); // } // if (isset($items) && is_array($items)) { // for ($i = 0; $i < count($items); $i++) { // //Get the tags for this calendar event // $selected_tags = array(); // $tag_ids = unserialize($items[$i]->tags); // if(is_array($tag_ids)) {$selected_tags = $db->selectObjectsInArray('tags', $tag_ids, 'name');} // $items[$i]->tags = $selected_tags; // //If this module was configured to group the newsitems by tags, then we need to change the data array a bit // if (isset($config->group_by_tags) && $config->group_by_tags == true) { // $grouped_news = array(); // foreach($items[$i]->tags as $tag) { // if (in_array($tag->id, $available_tags) || count($available_tags) == 0) { // if (!isset($grouped_news[$tag->name])) { $grouped_news[$tag->name] = array();} // array_push($grouped_news[$tag->name],$items[$i]); // } // } // } // } // } $template->output(); }
public function showall() { if (!empty($this->config['consumer_key'])) { // create instance $twitter = new Twitter($this->config['consumer_key'], $this->config['consumer_secret']); // set tokens $twitter->setOAuthToken($this->config['oauth_token']); $twitter->setOAuthTokenSecret($this->config['oauth_token_secret']); $mytwitteracct = $twitter->accountVerifyCredentials(); switch ($this->config['typestatus']) { case 1: // get users timeline including retweets $tweets = $twitter->statusesUserTimeline(null, null, null, null, $this->config['twlimit'], null, null, true); break; case 2: // get friends timeline $tweets = $twitter->statusesFriendsTimeline(null, null, $this->config['twlimit']); break; case 3: // get mentions $tweets = $twitter->statusesMentions(null, null, $this->config['twlimit']); break; case 4: // get public timeline $tweets = $twitter->statusesPublicTimeline(); break; default: // get home timeline $tweets = $twitter->statusesHomeTimeline(null, null, $this->config['twlimit']); break; } if ($this->config['twlimit']) { $tweets = array_slice($tweets, 0, $this->config['twlimit'], true); } $retweets = $twitter->statusesRetweetedByMe(null, null, $this->config['twlimit']); foreach ($tweets as $key => $value) { $tweets[$key]['retweetedbyme'] = false; if (strpos($value['text'], 'RT ') === false) { $tweets[$key]['text'] = $this->twitterify($value['text']); $tweets[$key]['screen_name'] = $value['user']['screen_name']; $tweets[$key]['image'] = $value['user']['profile_image_url']; $tweets[$key]['via'] = $value['source']; $tweets[$key]['ours'] = $value['user']['id'] == $mytwitteracct['id'] ? true : false; } else { // we're a retweet $tweets[$key]['text'] = $this->twitterify(substr($value['text'], strpos($value['text'], ':') + 2)); // strip out RT text $tweets[$key]['screen_name'] = isset($value['retweeted_status']['user']['screen_name']) ? $value['retweeted_status']['user']['screen_name'] : 'Unknown'; $tweets[$key]['image'] = isset($value['retweeted_status']['user']['profile_image_url']) ? $value['retweeted_status']['user']['profile_image_url'] : ''; if ($value['user']['id'] == $mytwitteracct['id']) { $tweets[$key]['via'] = $value['source']; $tweets[$key]['retweetedbyme'] = true; } else { $tweets[$key]['via'] = $value['source'] . ' (<img src="framework/modules/twitter/assets/images/rt.png" title="retweet by" alt="RT by"/> ' . $value['user']['screen_name'] . ')'; } $tweets[$key]['ours'] = $value['user']['id'] == $mytwitteracct['id'] ? true : false; } // $tweets[$key]['created_at'] = strtotime($value['created_at']); // convert to unix time $tweets[$key]['created_at'] = expDateTime::relativeDate(strtotime($value['created_at'])); // convert to unix time if (!isset($value['retweeted_status'])) { $tweets[$key]['retweeted_status'] = false; } foreach ($retweets as $rekey => $revalue) { if ($tweets[$key]['id'] == $retweets[$rekey]['retweeted_status']['id']) { $tweets[$key]['retweetedbyme'] = true; break; } } } assign_to_template(array('items' => $tweets)); } }
public function manage_sessions() { global $db, $user; expHistory::set('manageable', $this->params); //cleans up any old sessions if (SESSION_TIMEOUT_ENABLE == true) { $db->delete('sessionticket', 'last_active < ' . (time() - SESSION_TIMEOUT)); } if (isset($_GET['id']) && $_GET['id'] == 0) { $sessions = $db->selectObjects('sessionticket', "uid<>0"); $filtered = 1; } else { $sessions = $db->selectObjects('sessionticket'); $filtered = 0; } $sessions = $db->selectObjects('sessionticket'); for ($i = 0; $i < count($sessions); $i++) { $sessions[$i]->user = new user($sessions[$i]->uid); if ($sessions[$i]->uid == 0) { $sessions[$i]->user->id = 0; } $sessions[$i]->duration = expDateTime::duration($sessions[$i]->last_active, $sessions[$i]->start_time); } assign_to_template(array('sessions' => $sessions, 'filter' => $filtered)); }
function controlToHTML($name) { if (!$this->showdate && !$this->showtime) { return ""; } if ($this->default == 0) { $this->default = time(); } $default_date = getdate($this->default); $hour = $default_date['hours']; if ($hour > 12) { $hour -= 12; } if ($hour == 0) { $hour = 12; } $minute = $default_date['minutes'] . ""; if ($minute < 10) { $minute = "0" . $minute; } $html = "<input type='hidden' id='__" . $name . "' name='__" . $name . "' value='" . ($this->showdate ? "1" : "0") . ($this->showtime ? "1" : "0") . "' />"; if ($this->showdate) { $html .= '<div class="datetime date"><label>' . gt('Date') . ': </label>'; $html .= expDateTime::monthsDropdown($name . "_month", $default_date['mon']); $html .= '<input class="text" type="text" id="' . $name . '_day" name="' . $name . '_day" size="3" maxlength="2" value="' . $default_date['mday'] . '" />'; $html .= '<input class="text" id="' . $name . '_year" name="' . $name . '_year" size="5" maxlength="4" value="' . $default_date['year'] . '" />'; $html .= '</div>'; } if ($this->showtime) { $html .= '<div class="datetime time"><label>' . gt('Time') . ': </label>'; $html .= '<input class="text" type="text" id="' . $name . '_hour" name="' . $name . '_hour" size="3" maxlength="2" value="' . $hour . '" />'; $html .= '<input class="text" type="text" id="' . $name . '_minute" name="' . $name . '_minute" size="3" maxlength="2" value="' . $minute . '" />'; $html .= '<select class="select" id="' . $name . '_ampm" name="' . $name . '_ampm" size="1">'; $html .= '<option value="am"' . ($default_date['hours'] < 12 ? " selected" : "") . '>am</option>'; $html .= '<option value="pm"' . ($default_date['hours'] < 12 ? "" : " selected") . '>pm</option>'; $html .= '</select></div>'; } return $html; }
if ($_POST['recur'] != "recur_none" && isset($_POST['recur'])) { // Do recurrence $freq = $_POST['recur_freq_' . $_POST['recur']]; ###echo $_POST['recur'] . "<br />"; switch ($_POST['recur']) { case "recur_daily": $dates = expDateTime::recurringDailyDates($start_recur, $stop_recur, $freq); break; case "recur_weekly": $dates = expDateTime::recurringWeeklyDates($start_recur, $stop_recur, $freq, isset($_POST['day']) ? array_keys($_POST['day']) : array($dateinfo['wday'])); break; case "recur_monthly": $dates = expDateTime::recurringMonthlyDates($start_recur, $stop_recur, $freq, $_POST['month_type']); break; case "recur_yearly": $dates = expDateTime::recurringYearlyDates($start_recur, $stop_recur, $freq); break; default: $dates = array(); echo "Bad type: " . $_POST['recur'] . "<br />"; return; break; } $item->is_recurring = 1; // Set the recurrence flag. } else { $dates = array($start_recur); } $item->approved = 1; // Bypass workflow. $edate = null;
# # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## /** @define "BASE" "../../../.." */ if (!defined('EXPONENT')) { exit(''); } global $router; //expHistory::flowSet(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION); expHistory::set('viewable', $router->params); $title = $db->selectValue('container', 'title', "internal='" . serialize($loc) . "'"); $template = new template("calendarmodule", "_viewweek", $loc, false); $time = isset($_GET['time']) ? $_GET['time'] : time(); $time = intval($time); $startweek = expDateTime::startOfWeekTimestamp($time); $days = array(); $counts = array(); $startinfo = getdate($startweek); $locsql = "(location_data='" . serialize($loc) . "'"; // look for possible aggregate $config = $db->selectObject("calendarmodule_config", "location_data='" . serialize($loc) . "'"); if (!empty($config->aggregate)) { $locations = unserialize($config->aggregate); foreach ($locations as $source) { $tmploc = null; $tmploc->mod = 'calendarmodule'; $tmploc->src = $source; $tmploc->int = ''; $locsql .= " OR location_data='" . serialize($tmploc) . "'"; }