function displayDatetimeSpan($begin = null, $end = null) { $status = false; if (!$begin) { $begin = "now"; } if (!$end) { $end = "now"; } $begin = date("U", strToTime($begin)); $end = date("U", strToTime($end)); $span = $end - $begin; $days = floor($span / 86400); // seconds in a day $span = $span % 86400; $hours = floor($span / 1440); // minutes in a day $span = $span % 1440; $minutes = floor($span / 24); // hours in a day $span = $span % 24; $seconds = floor($span / 1); // days in a day. HA! $hours = str_pad($hours, 2, "0", str_pad_left); $minutes = str_pad($minutes, 2, "0", str_pad_left); $seconds = str_pad($seconds, 2, "0", str_pad_left); // $status = "$days days, $hours:$minutes:$seconds"; $status = "{$days} days, {$hours} hours, {$minutes} minutes, {$seconds} seconds"; return $status; }
public function InSeconds() { $before = date_default_timezone_get(); date_default_timezone_set('UTC'); $seconds = strToTime($this->format('Y-m-d', 'H:i:s')); date_default_timezone_set($before); return $seconds; }
/** * Parses time string into time format used by plugin view * @param string $timeStr * @return string */ public static function getTime($timeStr) { if ($timeStr != "" && substr($timeStr, 0, strlen("0000-00-00")) != "0000-00-00") { return date("d.m.Y / H:i", strToTime($timeStr)); } else { return ""; } }
public function InSeconds() { $before = date_default_timezone_get(); date_default_timezone_set('UTC'); $seconds = strToTime($this . ' 00:00:00'); date_default_timezone_set($before); return $seconds; }
/** * Shorten date * * @param date $date (optional) * @return supplied (or current) date in format 2012-04-02 converted to string */ public static function outputShortDate($date = null) { if ($date == null) { $date = Zend_Date::now(); } $date = strToTime($date); $date = new Zend_Date($date); return $date->toString('y-MM-dd'); }
public static function createDays($schId) { $db = Database::getInstance(); $weekId = Week::getLastId(); $schedule = Schedule::getSchedule($schId); $sql = "INSERT INTO day (weekId, startTime, shiftDate) VALUES (:weekId, :startTime, :shiftDate)"; for ($i = 0; $i < 7; $i++) { $shift = date('Y-m-d', strToTime("+" . $i . " days", strToTime($schedule['startDate']))); $result = $db->prepare($sql); $result->execute(array(":weekId" => $weekId, ":startTime" => null, ":shiftDate" => $shift)); } }
public static function update($iter) { $db = Database::getInstance(); $sql = "Update day SET startTime = :start WHERE id = :id"; $result = $db->prepare($sql); if ($_POST['start_time_arr'][$iter] == "X") { $start = null; } else { $start = date('H:i:s', strToTime($_POST['start_time_arr'][$iter])); } $result->execute(array(":start" => $start, ":id" => $_POST['day_id_arr'][$iter])); }
/** * Calculate period between two dates * If the ending date is not supplied current datetime is taken * * @param string $start * @param string $end (optional) * @param bool $formatSeconds If set to false will not format seconds to string (optional) * @return string time period */ public static function period($start, $end = null, $formatSeconds = true) { if ($end == null) { $end = Zend_Date::now(); } $start = new Zend_Date(strToTime($start)); $end = new Zend_Date(strToTime($end)); $difference = $start->sub($end); if ($formatSeconds) { return Game_View_Helper_Date::formatSeconds($difference->toValue()); } else { return $difference->toValue(); } }
function smarty_modifier_newmark($time, $format = '') { static $now, $period, $count; $time = is_numeric($time) ? (int) $time : strToTime($time); $retval = $format == '' ? '' : smarty_modifier_date_format($time, $format); if ($now == null) { $now = time(); $day = 60 * 60 * 24; $period = array($day, $day * 7); $count = count($period); } for ($i = 0; $i < $count; ++$i) { if ($now < $time + $period[$i]) { $retval .= sprintf('<em class="new%d">new!</em>', $i + 1); break; } } return $retval; }
public function mailRemainderAction() { $xDay = 3; $countPerPeriod = 3; $select = $this->getDb()->select()->from('User', 'id')->from('UserSettings')->where('User.createdAt > ?', date(DATE_ISO8601, strtotime(' - ' . $xDay . ' day')))->where('User.id = UserSettings.userId')->where('UserSettings.name = ?', Model_Verificator_Mail::SETTINGS_MAIL); foreach ($select->query()->fetchAll(PDO::FETCH_COLUMN) as $userId) { $user = $this->getTable('User')->find($userId)->current(); $sTime = $this->getTable('UserSettings')->getSettings(Model_Verificator_Mail::SETTINGS_CHANGET_AT, $user); $this->getLog()->info($user->username . ' LastSend at: ' . $sTime->value); $lastSendInPeriodPart = (time() - strToTime($sTime->value)) / (3600 * 24 * $xDay / $countPerPeriod); if ($lastSendInPeriodPart >= 1) { //no send to often if ($this->getHelper('EmailVerification')->send($user)) { $this->getLog()->info("Sent"); } } else { $this->getLog()->info("No sent: part " . number_format($lastSendInPeriodPart, 2)); } } }
/** * Given a starting date and a number of periods, return an array of dates * where the first date is the last day of the month of the first period * and every subsequent date is the last day of the following month * * @param String $date starting date * @param int $count number of periods to compute * * @return array */ public static function getRangeOfDates($date, $count) { // the first date is the first of the following month $month = date("m", strToTime($date)) + 1; $year = date("Y", strToTime($date)); if ($month == 13) { $month = 1; $year++; } $dateTime = new DateTime($year . "-" . $month . "-01"); $dateTime->modify("-1 day"); $dates = array($dateTime->format("Y-m-d")); // now, iterate $count - 1 times adding one month to each for ($x = 1; $x < $count; $x++) { $dateTime->modify("+1 day"); $dateTime->modify("+1 month"); $dateTime->modify("-1 day"); array_push($dates, $dateTime->format("Y-m-d")); } return $dates; }
public function getBucket($bucket, $prefix = null, $marker = null, $maxKeys = null) { $get = new S3Object('GET', $bucket, ''); if ($prefix !== null) { $get->setParameter('prefix', $prefix); } if ($marker !== null) { $get->setParameter('marker', $marker); } if ($maxKeys !== null) { $get->setParameter('max-keys', $maxKeys); } $get = $get->getResponse($this); $contents = array(); if (isset($get->body->Contents)) { foreach ($get->body->Contents as $c) { $contents[(string) $c->Key] = array('size' => (int) $c->Size, 'time' => strToTime((string) $c->LastModified), 'hash' => substr((string) $c->ETag, 1, -1)); } } return $get->code == 200 ? $contents : false; }
<script src="js/jquery.js"></script> <style type="text/css"></style> <script src="js/jquery-ui.js"></script> <script src="js/inputs.js"></script> <script src="js/flot.js"></script> <script src="js/functions.js"></script> </head> <body> <div id="wrapper"> <!--USER PANEL--> <?php $login_query = mysql_query("SELECT * FROM {$server_adb}.account WHERE username = '******'"); $login2 = mysql_fetch_assoc($login_query); $joindate = date("d.m.Y ", strToTime($login2['joindate'])); $uI = mysql_query("SELECT avatar FROM {$server_db}.users WHERE id = '" . $login2['id'] . "'"); $userInfo = mysql_fetch_assoc($uI); ?> <div id="usr-panel"> <div class="av-overlay"></div> <img src="<?php echo $website['root']; ?> images/avatars/2d/<?php echo $account_extra['avatar']; ?> " id="usr-av"> <div id="usr-info"> <span id="usr-name"><?php echo $account_extra['firstName'];
<input type="submit" value="<?php echo __('Report'); ?> " /> </form> <hr /> <?php if ($action == '') { return; } ##################################################################### $t = (int) strToTime("{$month_d} months", $t); $num_days = (int) date('t', $t); $y = (int) date('Y', $t); $m = (int) date('n', $t); $today_day = (int) date('j', $t); ?> <?php /* <div id="chart" style="position:absolute; left:189px; right:12px; top:14em; bottom:10px; overflow:scroll; border:1px solid #ccc; background:#fff;"> */ ?> <script type="text/javascript"> function chart_fullscreen_toggle()
function setCharts() { global $SUBS, $PARAM, $MSG; global $tbl_1d_charts, $tbl_1d_kino_charts, $tbl_1d_videodvd_charts, $tbl_1d_films, $tbl_1d_videodvd; global $MONTHS, $MONTHS2; // check chart length $query = "SELECT Length, Type\n\t\tFROM {$tbl_1d_charts}\n\t\tORDER BY ID = " . dbQuote($PARAM['PLACES']) . " DESC "; $result = runQuery($query, 'setCharts()', 'GET_CHART_LENGTH_AND_TYPE'); if ($row = db_fetch_row($result)) { $max = $row[0]; $type = $row[1]; } else { adminMenu(); return; } //iztriwane if ($PARAM['Delete'] == 1) { reset($PARAM); $Films = '0'; while (list($k, $v) = each($PARAM)) { if (ereg('^c_([0-9]+)$', $k, $R)) { $Films .= ",{$R['1']}"; } } //get chart type $query = "SELECT Type\n\t\t\tFROM {$tbl_1d_charts}\n\t\t\tWHERE ID = " . dbQuote($PARAM['PLACES']); $result = runQuery($query, 'setCharts()', 'GET_CHART_TYPE2'); if ($row = db_fetch_row($result)) { $type = $row[0]; } else { $SUBS['ERROR'] = $MSG[20008]; } switch ($type) { case 'videodvd': $query = "DELETE FROM {$tbl_1d_videodvd_charts} WHERE ID IN ({$Films})"; break; case 'kino': $query = "DELETE FROM {$tbl_1d_kino_charts} WHERE ID IN ({$Films})"; break; } if ($Films == '0') { $SUBS['ERROR'] = $MSG[20008]; } if ($SUBS['ERROR']) { $SUBS['ERROR'] = fileParse('_admin_error.htmlt'); } else { runQuery($query, 'setCharts()', 'DEL_CHART_RECORDS'); $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20030&WHEN=" . $PARAM['WEEK'] . "&WEEK=" . $PARAM['WEEK'] . "&WHERE=" . $PARAM['WHERE'] . "&PLACES=" . $PARAM['PLACES']; printPage('_admin_done.htmlt'); return; } } //add chart record if ($PARAM['Add'] == 1) { $SUBS['ERROR'] = ''; if ($PARAM['NO'] == '') { //poziciya w klasaciyata $SUBS['ERROR'] = $MSG[20097]; } if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['NO'])) { $SUBS['ERROR'] = $MSG[20099]; } //poziciyata dali e cefira if ($SUBS['ERROR'] == '' && $PARAM['NO'] > $max) { $SUBS['ERROR'] = $MSG[20099]; } //poziciyata dali e po-golyama ot poziciite w klasaciyata if ($SUBS['ERROR'] == '' && $PARAM['NO'] < 0) { $SUBS['ERROR'] = $MSG[20099]; } //poziciyata dali e po-malka ot nula //tipa na filma switch ($PARAM['TYPE']) { case 'list': //list if ($SUBS['ERROR'] == '' && $PARAM['FILMS'] == 0) { $SUBS['ERROR'] = $MSG[20026]; } $film = $PARAM['FILMS']; break; case 'raw': //raw if ($SUBS['ERROR'] == '' && $PARAM['FILM'] == '') { $SUBS['ERROR'] = $MSG[20027]; } $film = $PARAM['FILM']; break; default: if ($SUBS['ERROR'] == '') { $SUBS['ERROR'] = $MSG[20028]; } } switch ($type) { case 'kino': if ($SUBS['ERROR'] == '' && $PARAM['WEEKS'] == '') { $SUBS['ERROR'] = $MSG[20098]; } //sedmici w klasaciyata if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['WEEKS'])) { $SUBS['ERROR'] = $MSG[20100]; } //sedmicite dali sa cefira if ($SUBS['ERROR'] == '' && $PARAM['SCREENS'] == '') { $SUBS['ERROR'] = $MSG[20101]; } //ekrani na klasaciyata if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['SCREENS'])) { $SUBS['ERROR'] = $MSG[20102]; } //ekranite dali sa cefira if ($SUBS['ERROR'] == '' && $PARAM['BO'] == '') { $SUBS['ERROR'] = $MSG[20103]; } //sedmichen prihod na klasaciyata /*if (($SUBS['ERROR'] =='' ) && (!is_numeric($PARAM['BO']))) $SUBS['ERROR'] = $MSG[20104]; //sedmichen prihod dali sa cefira*/ if ($SUBS['ERROR'] == '' && $PARAM['CBO'] == '') { $SUBS['ERROR'] = $MSG[20105]; } //obscht prihod na klasaciyata /*if (($SUBS['ERROR'] =='' ) && (!is_numeric($PARAM['CBO']))) $SUBS['ERROR'] = $MSG[20106]; //obscht prihod dali sa cefira*/ break; case 'videodvd': if ($SUBS['ERROR'] == '' && $PARAM['WEEKS'] == '') { $SUBS['ERROR'] = $MSG[20098]; } //sedmici w klasaciyata if ($SUBS['ERROR'] == '' && !is_numeric($PARAM['WEEKS'])) { $SUBS['ERROR'] = $MSG[20100]; } //sedmicite dali sa cefira break; } if ($SUBS['ERROR'] == '') { if ($PARAM['id'] == '') { switch ($type) { case 'videodvd': $query = "INSERT INTO {$tbl_1d_videodvd_charts} (\n\t\t\t\t\t\t\t\tChartID,\n\t\t\t\t\t\t\t\tNo,\n\t\t\t\t\t\t\t\tType,\n\t\t\t\t\t\t\t\tFilm,\n\t\t\t\t\t\t\t\tWeeks,\n\t\t\t\t\t\t\t\ttsWhen\n\t\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($film) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEK']) . " )"; break; case 'kino': $query = "INSERT INTO {$tbl_1d_kino_charts} (\n\t\t\t\t\t\t\t\tChartID,\n\t\t\t\t\t\t\t\tNo,\n\t\t\t\t\t\t\t\tType,\n\t\t\t\t\t\t\t\tFilm,\n\t\t\t\t\t\t\t\tBoxOffice,\n\t\t\t\t\t\t\t\tcumBoxOffice,\n\t\t\t\t\t\t\t\tWeeks,\n\t\t\t\t\t\t\t\tScreens,\n\t\t\t\t\t\t\t\ttsWhen\n\t\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($film) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['BO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['CBO']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['SCREENS']) . ",\n\t\t\t\t\t\t\t\t" . dbQuote($PARAM['WEEK']) . " )"; break; } } else { switch ($type) { case 'videodvd': $query = "UPDATE {$tbl_1d_videodvd_charts} SET\n\t\t\t\t\t\t\t\tChartID = " . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\tNo = " . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\tType = " . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\tFilm = " . dbQuote($film) . ",\n\t\t\t\t\t\t\t\tWeeks = " . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\ttsWhen = " . dbQuote($PARAM['WEEK']) . " \n\t\t\t\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']); break; case 'kino': $query = "UPDATE {$tbl_1d_kino_charts} SET\n\t\t\t\t\t\t\t\tChartID = " . dbQuote($PARAM['PLACES']) . ",\n\t\t\t\t\t\t\t\tNo = " . dbQuote($PARAM['NO']) . ",\n\t\t\t\t\t\t\t\tType = " . dbQuote($PARAM['TYPE']) . ",\n\t\t\t\t\t\t\t\tFilm = " . dbQuote($film) . ",\n\t\t\t\t\t\t\t\tBoxOffice = " . dbQuote($PARAM['BO']) . ",\n\t\t\t\t\t\t\t\tcumBoxOffice = " . dbQuote($PARAM['CBO']) . ",\n\t\t\t\t\t\t\t\tWeeks = " . dbQuote($PARAM['WEEKS']) . ",\n\t\t\t\t\t\t\t\tScreens = " . dbQuote($PARAM['SCREENS']) . ",\n\t\t\t\t\t\t\t\ttsWhen = " . dbQuote($PARAM['WEEK']) . " \n\t\t\t\t\t\t\tWHERE ID = " . dbQuote($PARAM['id']); break; } } $result = runQuery($query, 'setCharts()', 'SAVE_CHART'); $SUBS['COMMAND'] = $PARAM['cmd'] . "&err=20107&PLACES=" . $PARAM['PLACES'] . "&WHEN=" . $PARAM['WEEK'] . "&WEEK=" . $PARAM['WEEK']; printPage('_admin_done.htmlt'); return; } else { $SUBS['ERROR'] = fileParse('_admin_error.htmlt'); } } ////----[Mrasnika's] Edition 12.10.2002 if ($PARAM['WHEN']) { $PARAM['Year1'] = date('Y', $PARAM['WHEN']); $PARAM['Month1'] = date('m', $PARAM['WHEN']); $PARAM['Day1'] = date('d', $PARAM['WHEN']); } else { if ($PARAM['Day1'] && $PARAM['Month1'] && $PARAM['Year1']) { $PARAM['WHEN'] = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']); } else { $PARAM['WHEN'] = getNextWeek(); } } $SUBS['PREV'] = week($PARAM['WHEN']) - 518400; $SUBS['NEXT'] = week($PARAM['WHEN']) + 1026800; //show charts records switch ($type) { case 'kino': $query = "SELECT\t{$tbl_1d_kino_charts}.ID,\n\t\t\t\tChartID,\n\t\t\t\tNo,\n\t\t\t\tType,\n\t\t\t\tFilm,\n\t\t\t\tBoxOffice,\n\t\t\t\tcumBoxOffice,\n\t\t\t\tWeeks,\n\t\t\t\tScreens,\n\t\t\t\ttsWhen,\n\t\t\t\t\n\t\t\t\t{$tbl_1d_films}.Title,\n\t\t\t\t{$tbl_1d_films}.OriginalTitle\n\n\t\t\t\tFROM {$tbl_1d_kino_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_kino_charts}.Type = 'list'\n\t\t\t\t\t\tAND {$tbl_1d_films}.ID = {$tbl_1d_kino_charts}.Film\n\t\t\t\tWHERE {$tbl_1d_kino_charts}.ChartID = " . dbQuote($PARAM['PLACES']) . "\n\t\t\t\t\tAND {$tbl_1d_kino_charts}.tsWhen >= " . week($PARAM['WHEN']) . "\n\t\t\t\t\tAND {$tbl_1d_kino_charts}.tsWhen <= (" . week($PARAM['WHEN']) . "+604799)\n\t\t\t\tORDER BY {$tbl_1d_kino_charts}.No,\n\t\t\t\t\t{$tbl_1d_kino_charts}.BoxOffice"; break; case 'videodvd': $query = "SELECT\t{$tbl_1d_videodvd_charts}.ID,\n\t\t\t\tChartID,\n\t\t\t\tNo,\n\t\t\t\tType,\n\t\t\t\tFilm,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\tWeeks,\n\t\t\t\ttsWhen,\n\t\t\t\t\n\t\t\t\t{$tbl_1d_films}.Title,\n\t\t\t\t{$tbl_1d_films}.OriginalTitle\n\n\t\t\t\tFROM {$tbl_1d_videodvd_charts}\n\t\t\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\t\t\tON {$tbl_1d_videodvd_charts}.Type = 'list'\n\t\t\t\t\t\tAND {$tbl_1d_films}.ID = {$tbl_1d_videodvd_charts}.Film\n\t\t\t\tWHERE {$tbl_1d_videodvd_charts}.ChartID = " . dbQuote($PARAM['PLACES']) . "\n\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.tsWhen >= " . week($PARAM['WHEN']) . "\n\t\t\t\t\tAND {$tbl_1d_videodvd_charts}.tsWhen <= (" . week($PARAM['WHEN']) . "+604799)\n\t\t\t\tORDER BY {$tbl_1d_videodvd_charts}.No "; break; } $result = runQuery($query, 'setCharts()', 'GET_CHART_RECORDS'); while ($row = db_fetch_row($result)) { $SUBS['CHECK'] = $row[0]; $SUBS['CHARTID'] = $row[1]; $SUBS['NO2'] = sprintf("%02d", $row[2]); if ($row[3] == 'list') { if ($row[10]) { $SUBS['TITLE'] = htmlEncode($row[10]); } else { $SUBS['TITLE'] = htmlEncode($row[11]); } $SUBS['MOVIE'] = $SUBS['ACTION'] . "?cmd=insertfilm&ID={$row['4']}"; } else { $SUBS['TITLE'] = htmlEncode($row[4]); $SUBS['MOVIE'] = "javascript:alert('{$MSG['20031']}')"; } $SUBS['PRATI'] = $row[9]; switch ($type) { case 'kino': $SUBS['BO2'] = $row[5]; $SUBS['CBO2'] = $row[6]; $SUBS['SCREENS2'] = $row[8]; $SUBS['WEEKS2'] = $row[7]; $SUBS['SHOWCHARTS'] .= fileParse('_admin_charts_row.htmlt'); break; case 'videodvd': $SUBS['WEEKS2'] = $row[7]; $SUBS['SHOWCHARTS'] .= fileParse('_admin_charts_row2.htmlt'); break; } if ($PARAM['Add'] != 1 && $PARAM['id'] == $row[0]) { //load form $PARAM['PLACES'] = $row[1]; $PARAM['TYPE'] = $row[3]; if ($row[3] != 'list') { $PARAM['FILM'] = $row[4]; } else { $PARAM['FILMS'] = htmlEncode($row[4]); } $PARAM['WEEK'] = $row[9]; $PARAM['NO'] = $row[2]; switch ($type) { default: //kino $PARAM['BO'] = $row[5]; $PARAM['CBO'] = $row[6]; $PARAM['WEEKS'] = $row[7]; $PARAM['SCREENS'] = $row[8]; } } } //get charts $SUBS['CHARTS'] = $PARAM['PLACES']; $query = "SELECT ID, Title\n \t\tFROM {$tbl_1d_charts}"; $result = runQuery($query, 'setCharts()', 'GET_CHARTS'); while ($row = db_fetch_row($result)) { ////----[Mrasnika's] Edition 12.10.2002 // if ($row[0] == $PARAM['chartid']) // $SUBS['CHARTS'] .= "<OPTION value=\"$row[0]\" SELECTED>".htmlEncode($row[1]); // else $SUBS['CHARTS'] .= "<OPTION value=\"$row[0]\">".htmlEncode($row[1]); if (!$s1) { //store default chart $s1 = $row[0]; $s2 = $row[1]; } if ($row[0] == $PARAM['PLACES']) { $SUBS['CHARTTITLE'] = htmlEncode($row[1]); } if ($row[0] == $PARAM['PLACES']) { $SUBS['PLACES'] .= "<OPTION value=\"{$row['0']}\" SELECTED>" . htmlEncode($row[1]); } else { $SUBS['PLACES'] .= "<OPTION value=\"{$row['0']}\">" . htmlEncode($row[1]); } } if (!$SUBS['CHARTTITLE']) { //no default chart $SUBS['CHARTS'] = $s1; $SUBS['CHARTTITLE'] = htmlEncode($s2); } //get oldest week switch ($type) { default: //kino $query = "SELECT\tmin({$tbl_1d_kino_charts}.tsWhen)\n\t\t\t\tFROM\t{$tbl_1d_kino_charts}\n\t\t\t\tGROUP BY {$tbl_1d_kino_charts}.ChartID\n\t\t\t\tORDER BY {$tbl_1d_kino_charts}.ChartID=" . dbQuote($PARAM['PLACES']) . " DESC"; $result = runQuery($query, 'setCharts()', 'GET_OLDEST_WEEK_KINO'); if ($row = db_fetch_row($result)) { $span = $row[0]; } break; case 'videodvd': //videodvd $query = "SELECT\tmin({$tbl_1d_videodvd_charts}.tsWhen)\n\t\t\t\tFROM\t{$tbl_1d_videodvd_charts}"; $result = runQuery($query, 'setCharts()', 'GET_OLDEST_WEEK_VIDEO'); if ($row = db_fetch_row($result)) { $span = $row[0]; } break; } if (!$span) { $span = getNextWeek(); } ////----[Mrasnika's] Edition 12.10.2002 // $SUBS['WEEK'] = getWeeks($PARAM['WEEK']); // $SUBS['WHEN'] = getWeeks($PARAM['WHEN']); //compatibility if (!$PARAM['WHEN']) { //no date applied if (!$PARAM['Day1'] || !$PARAM['Month1'] || !$PARAM['Year1']) { $PARAM['WHEN'] = getNextWeek(); $PARAM['Year1'] = date('Y', $PARAM['WHEN']); $PARAM['Month1'] = date('m', $PARAM['WHEN']); $PARAM['Day1'] = date('d', $PARAM['WHEN']); } else { $PARAM['WHEN'] = 1 + strToTime($PARAM['Day1'] . ' ' . $MONTHS2[$PARAM['Month1']] . ' ' . $PARAM['Year1']); } } else { //load date form $PARAM['Year1'] = date('Y', $PARAM['WHEN']); $PARAM['Month1'] = date('m', $PARAM['WHEN']); $PARAM['Day1'] = date('d', $PARAM['WHEN']); } if ($span > $PARAM['WHEN']) { //ima data, no e po-malka ot naj-starata klasaciya $SUBS['COMMAND'] = $PARAM['cmd'] . "&WHEN={$span}&PLACES=" . $PARAM['PLACES']; printPage('_admin_done.htmlt'); return; } $Year2 = 1 + date('Y', max($PARAM['WHEN'], time())); $Year1 = date('Y', $span); for ($i = $Year1; $i <= $Year2; $i++) { if ($i == $PARAM['Year1']) { $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\" selected>{$i}"; } else { $SUBS['YEAR1'] .= "<OPTION value=\"{$i}\">{$i}"; } } for ($i = 1; $i <= 12; $i++) { if ($i == $PARAM['Month1']) { $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\" selected>" . $MONTHS[$i]; } else { $SUBS['MONTH1'] .= "<OPTION value=\"{$i}\">" . $MONTHS[$i]; } } for ($i = 1; $i <= 31; $i++) { if ($i == $PARAM['Day1']) { $SUBS['DAY1'] .= "<OPTION value=\"{$i}\" selected>" . sprintf('%02d', $i); } else { $SUBS['DAY1'] .= "<OPTION value=\"{$i}\">" . sprintf('%02d', $i); } } $SUBS['WEEK'] = $PARAM['WHEN']; $SUBS['DISPLAYWEEK'] = displayWeek($SUBS['WEEK']); //get films switch ($type) { case 'kino': $query = "SELECT\t{$tbl_1d_films}.ID,\n\t\t\t\tTitle,\n\t\t\t\tOriginalTitle\n\t\t\tFROM {$tbl_1d_films}\n\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\tWHERE\t{$tbl_1d_videodvd}.ID IS NULL\n\t\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\tORDER BY OriginalTitle !='' DESC, Title='' DESC"; break; case 'videodvd': $query = "SELECT\t{$tbl_1d_films}.ID, Title\n\t\t\tFROM {$tbl_1d_films}\n\t\t\tLEFT JOIN {$tbl_1d_videodvd}\n\t\t\t\tON {$tbl_1d_videodvd}.FilmID = {$tbl_1d_films}.ID\n\t\t\tWHERE\t{$tbl_1d_videodvd}.ID IS NOT NULL\n\t\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\tORDER BY Title DESC"; break; } $result = runQuery($query, 'setCharts()', 'GET_FILMS'); while ($row = db_fetch_row($result)) { //fix titles if (!$row[1]) { $row[1] = $row[2]; } if ($PARAM['FILMS'] == $row[0]) { ////----[Mrasnika's] Edition 12.10.2002 // $SUBS['FILM'] .= "\n<option value=\"$row[0]\" selected>".htmlEncode("$row[1] $row[2] "); // else $SUBS['FILM'] .= "\n<option value=\"$row[0]\">".htmlEncode("$row[1] $row[2] "); $SUBS['FILM'] .= "\n<option value=\"{$row['0']}\" selected>" . htmlEncode($row[1]); } else { $SUBS['FILM'] .= "\n<option value=\"{$row['0']}\">" . htmlEncode($row[1]); } } // display $SUBS['TYPE' . strToUpper($PARAM['TYPE'])] = ' checked '; $SUBS['FILM2'] = htmlEncode($PARAM['FILM']); $SUBS['NO'] = htmlEncode($PARAM['NO']); switch ($type) { default: //kino $SUBS['WEEKS'] = htmlEncode($PARAM['WEEKS']); $SUBS['SCREENS'] = htmlEncode($PARAM['SCREENS']); $SUBS['BO'] = htmlEncode($PARAM['BO']); $SUBS['CBO'] = htmlEncode($PARAM['CBO']); $SUBS['DISPLAYCHART'] = fileParse("_admin_charts_kino.htmlt"); break; case 'videodvd': //video & dvd $SUBS['WEEKS'] = htmlEncode($PARAM['WEEKS']); $SUBS['DISPLAYCHART'] = fileParse("_admin_charts_videodvd.htmlt"); break; } $SUBS['ID'] = htmlEncode($PARAM['id']); if ($PARAM['err'] != '' && $SUBS['ERROR'] == '') { $SUBS['ERROR'] = $MSG[$PARAM['err']]; $SUBS['ERROR'] = fileParse('_admin_error.htmlt'); } printPage('_admin_charts.htmlt'); }
function affiche_abs($potache) { global $dtajadebut, $dtajafin; //$potache=$_POST["eleve"]; $horaire = array("M1", "M2", "M3", "M4", "M5", "S1", "S2", "S3", "S4", "S5"); $nbabs = 0; $nbrtd = 0; foreach ($horaire as $cle => $val) { $rq4 = "SELECT count(*) FROM absences WHERE uidprof='{$_SESSION['login']}' AND {$val}='A' AND uideleve='{$potache}' AND date >='{$dtajadebut}' AND date<='{$dtajafin}' "; $result4 = mysqli_query($dbc, $rq4) or die(is_object($dbc) ? mysqli_error($dbc) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); while ($nb = mysqli_fetch_array($result4, MYSQLI_NUM)) { $nbabs += $nb[0]; } $rq5 = "SELECT count(*) FROM absences WHERE uidprof='{$_SESSION['login']}' AND {$val}='R' AND uideleve='{$potache}' AND date >='{$dtajadebut}' AND date<='{$dtajafin}' "; $result5 = @mysqli_query($GLOBALS["___mysqli_ston"], $rq5) or die(is_object($dbc) ? mysqli_error($dbc) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); while ($nb = mysqli_fetch_array($result5, MYSQLI_NUM)) { $nbrtd += $nb[0]; } } //fin foreach $horaire if ($nbabs > 0) { echo "<h3 class='perso'><i>" . $nbabs . "h d'absence - "; } else { echo "<h3 class='perso'><i>Aucune absence - "; } if ($nbrtd > 0) { if ($nbrtd > 1) { echo $nbrtd . " retards <br /></i>"; } else { echo $nbrtd . " retard <br /></i>"; } } else { echo "Aucun retard <br /></i>"; } $rq = "SELECT DATE_FORMAT(date,'%d/%m/%Y'),M1,motifM1,M2,motifM2,M3,motifM3,M4,motifM4,M5,motifM5,\n S1,motifS1,S2,motifS2,S3,motifS3,S4,motifS4,S5,motifS5,date FROM absences WHERE uidprof='{$_SESSION['login']}' \n AND uideleve='{$potache}' AND date >='{$dtajadebut}' AND date<='{$dtajafin}' ORDER BY date ASC"; // lancer la requete $result = mysqli_query($GLOBALS["___mysqli_ston"], $rq) or die(is_object($dbc) ? mysqli_error($dbc) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); // Combien y a-t-il d'enregistrements ? $nb2 = mysqli_num_rows($result); while ($ligne = mysqli_fetch_array($result, MYSQLI_NUM)) { $typmat = ""; foreach ($horaire as $cle => $val) { if ($ligne[2 * $cle + 1] == A) { $typmat .= " : absence en {$val} ( " . utf8_encode($ligne[2 * $cle + 2]) . " )"; } elseif ($ligne[2 * $cle + 1] == R) { $typmat .= " : retard en {$val} ( " . utf8_encode($ligne[2 * $cle + 2]) . " )"; } else { $typmat .= ""; } } echo " - Le " . LeJour(strToTime($ligne[21])) . " " . $ligne[0] . " " . $typmat . "<br />"; } echo '</h3>'; }
$address1 = addslashes($address1); $city = addslashes($city); $state = addslashes($state); $zip = addslashes($zip); $country = addslashes($country); $phone = addslashes($phone); $email = addslashes($email); $begin = addslashes($begin); $end = addslashes($end); $body = addslashes($body); $notes = addslashes($notes); } // Process variables if (!$name1) { $name1 = "Untitled"; } $begin = $begin ? date("Y-m-d H:i:s", strToTime($begin)) : NULL; $end = $end ? date("Y-m-d H:i:s", strToTime($end)) : NULL; // Add object to database $sql = "INSERT INTO objects (\n\t\t\tcreated, modified, \n\t\t\tname1, name2, \n\t\t\taddress1, city, state, zip, country, \n\t\t\tphone, email, \n\t\t\tbegin, end, \n\t\t\tbody, notes) \n\t\tVALUES ('" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', \n\t\t\t'{$name1}', '{$name2}', \n\t\t\t'{$address1}', '{$city}', '{$state}', '{$zip}', '{$country}', \n\t\t\t'{$phone}', '{$email}', \n\t\t\t'{$begin}', '{$end}', \n\t\t\t'{$body}', '{$notes}'\n\t\t)"; $result = MYSQL_QUERY($sql); $insertId = MYSQL_INSERT_ID(); ///////////// // WIRES // ///////////// $sql = "INSERT INTO wires (\n\t\t\tcreated, modified, \n\t\t\tfromid, toid\n\t\t) \n\t\tVALUES('" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "', \n\t\t\t'{$object}', '{$insertId}'\n\t\t)"; $result = MYSQL_QUERY($sql); echo "Object added successfully.<br /><br />"; echo "<a href='" . $dbAdmin . "browse.php" . urlData() . "'>CONTINUE...</a>"; } require_once "GLOBAL/foot.php";
protected function _normalizeDatesToISO8601($data) { $date_fields = array('created_at', 'updated_at'); foreach ($date_fields as $key) { if (!array_key_exists($key, $data)) { continue; } $data[$key] = date(DATE_ISO8601, strToTime($data[$key])); } return $data; }
// Display table format $html = "<table cellpadding='10' border='1' width='900px'>"; // Column headers $html .= "<tr style='background-color:#CCCCCC;'>"; $html .= "<td width='200px'>NAME</td>"; $html .= "<td width='300px'>ADDRESS</td>"; $html .= "<td width='300px'>EMAIL</td>"; $html .= "<td width='100px'>BEGIN / END</td>"; $html .= "</tr>"; // Data while ($myrow = MYSQL_FETCH_ARRAY($result)) { $html .= "<tr style='background-color:#" . ($rowcolor % 2 ? "E9E9E9" : "EFEFEF") . ";'>"; $html .= "<td>" . $myrow['name1'] . " " . $myrow['name2'] . "</td>"; $html .= "<td>" . $myrow['address1'] . "<br />" . $myrow['city'] . " " . $myrow['state'] . " " . $myrow['zip'] . "<br />" . $myrow['country'] . "</td>"; $html .= "<td>" . $myrow['email'] . "</td>"; $html .= "<td>" . date("Y M j", strToTime($myrow['begin'])) . "<br />" . date("Y M j", strToTime($myrow['end'])) . "</td>"; $html .= "</tr>"; $rowcolor++; $rownumber++; } $html .= "</table>"; $html .= "<br />{$rownumber} total results found."; echo $html; } echo "<br /><br />"; if ($report) { echo "<a href='report.php?object={$object}&csv=1' target='_new'>EXPORT CSV . . .</a> "; } if ($report) { echo "<a href='report.php?object={$object}&emails=1' target='_new'>EXPORT EMAILS . . .</a> "; }
function week($ts = 0) { if ($ts == 0) { $ts = time(); } $friday = getDate($ts); if ($friday['wday'] < 5) { $friday = -2 - $friday['wday']; } else { $friday = 5 - $friday['wday']; } //$today = $ts - date('s', $ts) - date('i')*60 - date('H')*3600+2; //$today = $ts; $today = $ts - date('s', $ts) - date('i', $ts) * 60 - date('H', $ts) * 3600 + 1; ////----[Mrasnika's] Edition 31.10.2002 //return $friday = $today + $friday*86400 ; $friday = $today + $friday * 86400; $ret = 1 + strToTime(date('d F Y', $friday)); return $ret; }
/** * Convert a number on the Experience tab into a link to the Explore page for the underlying records. */ private static function records_link($row, $value, $node) { if (!empty($node->params['view_records_report_path']) && !empty($_GET['user_id'])) { $tokens = explode('_', $value); $params = array('dynamic-ownGroups' => 0, 'dynamic-recent' => 0, 'dynamic-user_filter' => $_GET['user_id']); switch ($tokens[0]) { case 'r': $params['dynamic-record_status'] = 'R'; break; case 'v': $params['dynamic-record_status'] = 'V'; break; } switch ($tokens[1]) { case '3months': $params['dynamic-input_date_from'] = date('Y-m-d', strToTime('3 months ago')); break; case '1year': $params['dynamic-input_date_from'] = date('Y-m-d', strToTime('1 year ago')); break; } if ($row['type'] === 'species') { $params['dynamic-taxon_meaning_id'] = $row['what_id']; } else { $params['dynamic-taxon_group_id'] = $row['what_id']; } return l($row[$value], $node->params['view_records_report_path'], array('attributes' => array('target' => '_blank'), 'query' => $params)); } else { return $row[$value]; } }
exec('locale -a | grep -i ' . qsa('^' . $lang . '_') . ' 2>>/dev/null', $out, $err); if ($err != 0) { gs_log(GS_LOG_NOTICE, 'Failed to find locales on your system'); } else { $lfound = setLocale(LC_TIME, $out); if ($lfound === false) { gs_log(GS_LOG_NOTICE, 'Your system does not have any locales like "' . $lang . '_*"'); } else { gs_log(GS_LOG_NOTICE, 'Using locale "' . $lfound . '" as a fallback'); } } } $wdays = array('mo' => 'Mon', 'tu' => 'Tue', 'we' => 'Wed', 'th' => 'Thu', 'fr' => 'Fri', 'sa' => 'Sat', 'su' => 'Sun'); $wdaysl = array(); foreach ($wdays as $col => $wdca) { $wdaysl[$col] = mb_subStr(strFTime('%a', strToTime('last ' . $wdca)), 0, 1); } unset($wdays); setLocale(LC_TIME, array($oldLocale, 'C')); $i = 0; $rs = $DB->execute('SELECT * from `queue_cf_timerules` WHERE `_queue_id`=' . $queue_id . ' ORDER BY `ord`'); while ($route = $rs->fetchRow()) { echo '<input type="hidden" name="tr_' . $route['id'] . '" value="' . $route['id'] . '" />'; echo '<tr><td>'; echo $route['ord']; echo '</td><td>'; foreach ($wdaysl as $col => $v) { echo '<span class="nobr"><input type="checkbox" name="' . $route['id'] . '-d_', $col, '" id="ipt-' . $route['id'] . '-r_d_', $col, '" value="1" ', $route['d_' . $col] ? 'checked="checked" ' : '', '/>'; echo '<label for="ipt-r_d_', $col, '">', $v, '</label></span>'; } echo '</td>', "\n";
function parseXML($data) { $thisFeed = array(); try { $xml = $this->createParserFromString(utf8_encode($data)); if ($xml != false) { $root = $xml->getName(); switch ($root) { case 'user': $thisFeed[] = array('user_id' => $xml->id, 'user_name' => $xml->screen_name, 'full_name' => $xml->name, 'avatar' => $xml->profile_image_url, 'location' => $xml->location, 'description' => $xml->description, 'url' => $xml->url, 'is_protected' => $xml->protected, 'follower_count' => $xml->followers_count, 'friend_count' => $xml->friends_count, 'post_count' => $xml->statuses_count, 'favorites_count' => $xml->favourites_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($xml->created_at))); break; case 'ids': foreach ($xml->children() as $item) { $thisFeed[] = array('id' => $item); } break; case 'id_list': $this->next_cursor = $xml->next_cursor; foreach ($xml->ids->children() as $item) { $thisFeed[] = array('id' => $item); } break; case 'status': $namespaces = $xml->getNameSpaces(true); if (isset($namespaces['georss'])) { $georss = $xml->geo->children($namespaces['georss']); $thisFeed[] = array('post_id' => $xml->id, 'user_id' => $xml->user->id, 'user_name' => $xml->user->screen_name, 'full_name' => $xml->user->name, 'avatar' => $xml->user->profile_image_url, 'location' => $xml->user->location, 'description' => $xml->user->description, 'url' => $xml->user->url, 'is_protected' => $xml->user->protected, 'followers' => $xml->user->followers_count, 'following' => $xml->user->friends_count, 'tweets' => $xml->user->statuses_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($xml->user->created_at)), 'post_text' => $xml->text, 'pub_date' => gmdate("Y-m-d H:i:s", strToTime($xml->created_at)), 'in_reply_to_post_id' => $xml->in_reply_to_status_id, 'in_reply_to_user_id' => $xml->in_reply_to_user_id, 'source' => $xml->source, 'geo' => $georss->point, 'place' => $xml->place->full_name, 'network' => 'twitter'); } else { $thisFeed[] = array('post_id' => $xml->id, 'user_id' => $xml->user->id, 'user_name' => $xml->user->screen_name, 'full_name' => $xml->user->name, 'avatar' => $xml->user->profile_image_url, 'location' => $xml->user->location, 'description' => $xml->user->description, 'url' => $xml->user->url, 'is_protected' => $xml->user->protected, 'followers' => $xml->user->followers_count, 'following' => $xml->user->friends_count, 'tweets' => $xml->user->statuses_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($xml->user->created_at)), 'post_text' => $xml->text, 'pub_date' => gmdate("Y-m-d H:i:s", strToTime($xml->created_at)), 'in_reply_to_post_id' => $xml->in_reply_to_status_id, 'in_reply_to_user_id' => $xml->in_reply_to_user_id, 'geo' => '', 'source' => $xml->source, 'place' => $xml->place->full_name, 'network' => 'twitter'); } break; case 'users_list': $this->next_cursor = $xml->next_cursor; foreach ($xml->users->children() as $item) { $thisFeed[] = array('post_id' => $item->status->id, 'user_id' => $item->id, 'user_name' => $item->screen_name, 'full_name' => $item->name, 'avatar' => $item->profile_image_url, 'location' => $item->location, 'description' => $item->description, 'url' => $item->url, 'is_protected' => $item->protected, 'friend_count' => $item->friends_count, 'follower_count' => $item->followers_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($item->created_at)), 'post_text' => $item->status->text, 'last_post' => gmdate("Y-m-d H:i:s", strToTime($item->status->created_at)), 'pub_date' => gmdate("Y-m-d H:i:s", strToTime($item->status->created_at)), 'favorites_count' => $item->favourites_count, 'post_count' => $item->statuses_count); } break; case 'users': foreach ($xml->children() as $item) { $thisFeed[] = array('post_id' => $item->status->id, 'user_id' => $item->id, 'user_name' => $item->screen_name, 'full_name' => $item->name, 'avatar' => $item->profile_image_url, 'location' => $item->location, 'description' => $item->description, 'url' => $item->url, 'is_protected' => $item->protected, 'friend_count' => $item->friends_count, 'follower_count' => $item->followers_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($item->created_at)), 'post_text' => $item->status->text, 'last_post' => gmdate("Y-m-d H:i:s", strToTime($item->status->created_at)), 'pub_date' => gmdate("Y-m-d H:i:s", strToTime($item->status->created_at)), 'favorites_count' => $item->favourites_count, 'post_count' => $item->statuses_count, 'source' => $item->status->source, 'in_reply_to_post_id' => $item->status->in_reply_to_status_id); } break; case 'statuses': foreach ($xml->children() as $item) { $namespaces = $item->getNameSpaces(true); if (isset($namespaces['georss'])) { $georss = $item->geo->children($namespaces['georss']); $thisFeed[] = array('post_id' => $item->id, 'user_id' => $item->user->id, 'user_name' => $item->user->screen_name, 'full_name' => $item->user->name, 'avatar' => $item->user->profile_image_url, 'location' => $item->user->location, 'description' => $item->user->description, 'url' => $item->user->url, 'is_protected' => $item->user->protected, 'follower_count' => $item->user->followers_count, 'friend_count' => $item->user->friends_count, 'post_count' => $item->user->statuses_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($item->user->created_at)), 'post_text' => $item->text, 'pub_date' => gmdate("Y-m-d H:i:s", strToTime($item->created_at)), 'favorites_count' => $item->user->favourites_count, 'in_reply_to_post_id' => $item->in_reply_to_status_id, 'in_reply_to_user_id' => $item->in_reply_to_user_id, 'source' => $item->source, 'geo' => $georss->point, 'place' => $item->place->full_name, 'network' => 'twitter'); } else { $thisFeed[] = array('post_id' => $item->id, 'user_id' => $item->user->id, 'user_name' => $item->user->screen_name, 'full_name' => $item->user->name, 'avatar' => $item->user->profile_image_url, 'location' => $item->user->location, 'description' => $item->user->description, 'url' => $item->user->url, 'is_protected' => $item->user->protected, 'follower_count' => $item->user->followers_count, 'friend_count' => $item->user->friends_count, 'post_count' => $item->user->statuses_count, 'joined' => gmdate("Y-m-d H:i:s", strToTime($item->user->created_at)), 'post_text' => $item->text, 'pub_date' => gmdate("Y-m-d H:i:s", strToTime($item->created_at)), 'favorites_count' => $item->user->favourites_count, 'in_reply_to_post_id' => $item->in_reply_to_status_id, 'in_reply_to_user_id' => $item->in_reply_to_user_id, 'source' => $item->source, 'geo' => '', 'place' => $item->place->full_name, 'network' => 'twitter'); } } break; case 'hash': $thisFeed = array('remaining-hits' => $xml->{'remaining-hits'}, 'hourly-limit' => $xml->{'hourly-limit'}, 'reset-time' => $xml->{'reset-time-in-seconds'}); break; case 'relationship': $thisFeed = array('source_follows_target' => $xml->source->following, 'target_follows_source' => $xml->target->following); break; default: break; } } } catch (Exception $e) { $form_error = 15; } return $thisFeed; }
public static function getBucket($bucket, $prefix = null, $marker = null, $maxKeys = null) { $rest = new S3Request('GET', $bucket, ''); if ($prefix !== null && $prefix !== '') { $rest->setParameter('prefix', $prefix); } if ($marker !== null && $prefix !== '') { $rest->setParameter('marker', $marker); } if ($maxKeys !== null && $prefix !== '') { $rest->setParameter('max-keys', $maxKeys); } $response = $rest->getResponse(); if ($response->error === false && $response->code !== 200) { $response->error = array('code' => $response->code, 'message' => 'Unexpected HTTP status'); } if ($response->error !== false) { trigger_error(sprintf("S3::getBucket(): [%s] %s", $response->error['code'], $response->error['message']), E_USER_WARNING); return false; } $results = array(); $lastMarker = null; if (isset($response->body, $response->body->Contents)) { foreach ($response->body->Contents as $c) { $results[(string) $c->Key] = array('name' => (string) $c->Key, 'time' => strToTime((string) $c->LastModified), 'size' => (int) $c->Size, 'hash' => substr((string) $c->ETag, 1, -1)); $lastMarker = (string) $c->Key; //$response->body->IsTruncated = 'true'; break; } } if (isset($response->body->IsTruncated) && (string) $response->body->IsTruncated == 'false') { return $results; } // Loop through truncated results if maxKeys isn't specified if ($maxKeys == null && $lastMarker !== null && (string) $response->body->IsTruncated == 'true') { do { $rest = new S3Request('GET', $bucket, ''); if ($prefix !== null) { $rest->setParameter('prefix', $prefix); } $rest->setParameter('marker', $lastMarker); if (($response = $rest->getResponse(true)) == false || $response->code !== 200) { break; } if (isset($response->body, $response->body->Contents)) { foreach ($response->body->Contents as $c) { $results[(string) $c->Key] = array('name' => (string) $c->Key, 'time' => strToTime((string) $c->LastModified), 'size' => (int) $c->Size, 'hash' => substr((string) $c->ETag, 1, -1)); $lastMarker = (string) $c->Key; } } } while ($response !== false && (string) $response->body->IsTruncated == 'true'); } return $results; }
function getPlaylistEntry(&$currentVideoName, &$nextVideoName, &$nextVideoStartTime, $time = 0) { if ($time == 0) { $time = strtotime("now"); } else { $time = round($time / 1000); } // $fh = fopen('./tmp/test.log',w); // fwrite($fh,strtotime("now").': '.$time); // fclose($fh); //aktuellen titel finden $currentTrack = count($this->playlist) - 1; while ($time < strToTime($this->playlist[$currentTrack]['starttime']) && $currentTrack > 0) { $currentTrack--; } $currentVideoName = $this->playlist[$currentTrack]['filename']; if ($currentTrack < count($this->playlist) - 1) { $nextVideoName = $this->playlist[$currentTrack + 1]['filename']; $nextVideoStartTime = strToTime($this->playlist[$currentTrack + 1]['starttime']) * 1000; } else { $nextVideoName = ''; $nextVideoStartTime = 0; } }
/** * Date to Timestamp * * Converts dates like * Mon, 31 Mar 2003 15:26:34 GMT * Tue, 15 Nov 1994 12:45:26 GMT * into a timestamp, strtotime() didn't do it in older versions. * * @deprecated Use PHPs strtotime() instead. * @access public * @return mixed Returns int unix timestamp or false if the date doesn't * seem to be a valid GMT date. * @param string $date The GMT date. */ function dateToTimestamp($date) { static $months = array(null => 0, 'Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4, 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dec' => 12); if (-1 < ($timestamp = strToTime($date))) { return $timestamp; } if (!preg_match('~[^,]*,\\s(\\d+)\\s(\\w+)\\s(\\d+)\\s(\\d+):(\\d+):(\\d+).*~', $date, $m)) { return false; } // [0] => Mon, 31 Mar 2003 15:42:55 GMT // [1] => 31 [2] => Mar [3] => 2003 [4] => 15 [5] => 42 [6] => 55 return mktime($m[4], $m[5], $m[6], $months[$m[2]], $m[1], $m[3]); }
private function parsePostXML($post) { $logger = Logger::getInstance(); // $logger->logInfo("In parsePostXML for post " . $post->id . ", " . $post->text, __METHOD__.','.__LINE__); $georss = null; $namespaces = $post->getNameSpaces(true); if (isset($namespaces['georss'])) { $georss = $post->geo->children($namespaces['georss']); } $parsed_data = array('post_id' => (string) $post->id, 'author_user_id' => (string) $post->user->id, 'user_id' => (string) $post->user->id, 'author_username' => (string) $post->user->screen_name, 'user_name' => (string) $post->user->screen_name, 'author_fullname' => (string) $post->user->name, 'full_name' => (string) $post->user->name, 'author_avatar' => (string) $post->user->profile_image_url, 'avatar' => (string) $post->user->profile_image_url, 'location' => (string) $post->user->location, 'description' => (string) $post->user->description, 'url' => (string) $post->user->url, 'is_protected' => (int) self::boolXMLToInt($post->user->protected), 'follower_count' => (int) $post->user->followers_count, 'friend_count' => (int) $post->user->friends_count, 'post_count' => (int) $post->user->statuses_count, 'joined' => (string) gmdate("Y-m-d H:i:s", strToTime($post->user->created_at)), 'post_text' => (string) $post->text, 'pub_date' => (string) gmdate("Y-m-d H:i:s", strToTime($post->created_at)), 'favorites_count' => (int) $post->user->favourites_count, 'in_reply_to_post_id' => (string) $post->in_reply_to_status_id, 'in_reply_to_user_id' => (string) $post->in_reply_to_user_id, 'source' => (string) $post->source, 'geo' => (string) (isset($georss) ? $georss->point : ''), 'place' => (string) $post->place->full_name, 'network' => 'twitter'); if (isset($post->retweet_count) && !isset($post->retweeted_status)) { // do this only for the original post (rt will have rt count too) $retweet_count_api = $post->retweet_count; $pos = strrpos($post->retweet_count, '+'); if ($pos !== false) { // remove '+', e.g. '100+' -- currently 100 is the max count that will be reported $retweet_count_api = substr($post->retweet_count, 0, $pos); } // this field holds the reported native rt count from twitter $parsed_data['retweet_count_api'] = (int) $retweet_count_api; } if (isset($post->retweeted_status)) { // then this is a retweet. // Process its original too. // $logger->logInfo("this is a retweet, will process original post " . $post->retweeted_status->id . // "from user " . $post->retweeted_status->user->id, __METHOD__.','.__LINE__); $rtp = array(); $rtp['content'] = $this->parsePostXML($post->retweeted_status); $parsed_data['retweeted_post'] = $rtp; $parsed_data['in_retweet_of_post_id'] = (string) $post->retweeted_status->id; $parsed_data['in_rt_of_user_id'] = (string) $post->retweeted_status->user->id; } return $parsed_data; }
" method="POST"> <input type="hidden" name="update" value="true"> <div>Band:</div><div><select name="bandId"> <?php $query = "SELECT * FROM Band ORDER BY name ASC"; $result = mysqli_query($db, $query); while ($row = mysqli_fetch_array($result)) { echo '<option ' . ($row['bandId'] == $event['bandId'] ? 'SELECTED' : '') . ' value="' . $row['bandId'] . '">' . htmlentities($row['name']) . '</option>'; } ?> </select></div> <div>Venue:</div><div><select name="venueId"> <?php $query = "SELECT * FROM Venue ORDER BY name ASC"; $result = mysqli_query($db, $query); while ($row = mysqli_fetch_array($result)) { echo '<option ' . ($row['venueId'] == $event['venueId'] ? 'SELECTED' : '') . ' value="' . $row['venueId'] . '">' . htmlentities($row['name']) . '</option>'; } ?> </select></div> <div>Date of Performance:</div><div><input type="text" name="performanceDate" value="<?php echo date("m/d/Y g:i", strToTime($event['performanceDate'])); ?> "></div> <div><input type="submit" value="<?php echo htmlentities(isset($_GET['eventId']) ? 'Update' : 'Add'); ?> "></div> </form> <?php include "footer.php";
</th> <th style="font-weight:normal;" onmouseover="mytip(event,'missed');"><?php echo __('verp.'); ?> </th> </tr> </thead> <tbody> <?php //$t = time() + (3600 * 24 * 7 * $day_d );; $t = time() + $day_d; $dow = (int) date('w', $t); $t = (int) strToTime("{$day_d} week", $t); $t = (int) strToTime($dow - 1 . " days ago", $t); $t_year = (int) date('Y', $t); $t_month = (int) date('n', $t); $t_day = (int) date('j', $t); $day_w_start = (int) mkTime(0, 0, 0, $t_month, $t_day, $t_year); $day_w_end = $day_w_start + (3600 * 24 * 5 - 1); $user_name = @$_SESSION['sudo_user']['name']; $table = 'cdr_tmp_' . $user_name; $ok = $CDR_DB->execute('DROP TABLE IF EXISTS `' . $table . '`'); $sql_query = 'CREATE TABLE `' . $table . '` TYPE=heap SELECT * FROM `ast_cdr` WHERE ( `calldate`>=\'' . date('Y-m-d H:i:s', $day_w_start) . '\' AND `calldate`<=\'' . date('Y-m-d H:i:s', $day_w_end) . '\' ) AND `dst` IN (' . $exts_sql . ') AND `channel` NOT LIKE \'Local/%\' AND `dstchannel` NOT LIKE \'SIP/gs-0%\' AND `dst`<>\'s\' AND
public function getLastUpdateCheck() { $last_time = $this->getShim()->getModel('commercebug/jsonbroker')->jsonDecode(Mage::getStoreConfig('commercebug/options/update_last_check')); return date(DATE_RFC822, strToTime($last_time->date)); }