public static function getCache($dir, $cacheName, $maxAge, $deserialize = false, $plainCache = false) { if (is_dir($dir)) { $cacheFile = $dir . $cacheName; if (is_file($cacheFile)) { // get file stats $fileInfo = stat($cacheFile); $lastModified = $fileInfo['mtime']; $now = mktime(); //echo '<p>time now = ' . $now; $diff = $now - $lastModified; //echo '<p>time elapsed = ' .$diff; if ($diff >= $maxAge) { //echo 'clearing cache'; unlink($cacheFile); return false; } //echo '<p>returning cache'; if ($deserialize == false && $plainCache == false) { include_once $cacheFile; } else { if ($deserialize == false && $plainCache) { $data = file_get_contents($cacheFile); } else { $data = unserialize(file_get_contents($cacheFile)); } } return $data; } else { return false; } } }
function getBuyDate($contents) { $matchesarray = array(); preg_match_all("/(\\d\\d [A-Z][a-z][a-z] \\d{4})/", $contents, $matchesarray); $datetimestamp = date('U'); for ($i = 0; $i < count($matchesarray[0]) / 2; $i++) { $maDate = $matchesarray[0][$i * 2]; $maDate = str_replace(' ', '-', $maDate); $maDate = str_replace('Jan', '01', $maDate); $maDate = str_replace('Feb', '02', $maDate); $maDate = str_replace('Mar', '03', $maDate); $maDate = str_replace('Apr', '04', $maDate); $maDate = str_replace('May', '05', $maDate); $maDate = str_replace('Jun', '06', $maDate); $maDate = str_replace('Jul', '07', $maDate); $maDate = str_replace('Aug', '08', $maDate); $maDate = str_replace('Sep', '09', $maDate); $maDate = str_replace('Oct', '10', $maDate); $maDate = str_replace('Nov', '11', $maDate); $maDate = str_replace('Dec', '12', $maDate); list($jour, $mois, $annee) = explode('-', $maDate); $maDate = date("U", mktime(0, 0, 0, $mois, $jour, $annee)); if ($maDate < $datetimestamp) { $datetimestamp = $maDate; } } $maDate = date("Y-m-d", $datetimestamp); return $maDate; }
function diffDate($d1, $d2, $type = '', $sep = '-') { $d1 = explode($sep, $d1); $d2 = explode($sep, $d2); switch ($type) { case 'A': $X = 31536000; break; case 'M': $X = 2592000; break; case 'D': $X = 86400; break; case 'H': $X = 3600; break; case 'MI': $X = 60; break; default: $X = 1; } echo $d2[1]; echo $d2[2]; echo $d2[0]; return floor((mktime(0, 0, 0, $d2[1], $d2[2], $d2[0]) - mktime(0, 0, 0, $d1[1], $d1[2], $d1[0])) / $X); }
public function dateToUnix($datum, $stunde = "1") { $tag = $datum[0] . $datum[1]; $monat = $datum[3] . $datum[4]; $jahr = $datum[6] . $datum[7] . $datum[8] . $datum[9]; return mktime($stunde, "0", "0", $monat, $tag, $jahr); }
/** * 时刻记录 * Enter description here ... */ public function energy_time() { $uid = I('uid', '0', 'intval'); $start_time = mktime(0, 0, 0, date("m"), 1, date("Y")); $end_time = mktime(23, 59, 59, date("m"), date("t"), date("Y")); $res = $this->_mod->where('uid =' . $uid . ' and add_time >= ' . $start_time . ' and add_time <= ' . $end_time)->order('add_time')->select(); $date_array = array(); foreach ($res as $key => $val) { $res[$key]['add_time'] = date('m.d', $val['add_time']); $res[$key]['time'] = date('H:i', $val['add_time']); if (!in_array($res[$key]['add_time'], $date_array)) { array_push($date_array, $res[$key]['add_time']); } } foreach ($date_array as $value) { foreach ($res as $k => $v) { if ($value == $v['add_time']) { $result[$v['add_time']][] = $v; //按日期分组 } } } $appjson = $result; if (C('APP_JSON_RETURN')) { $this->jsonReturn($appjson); } }
public function testWhere() { self::$db->select('account', 'user_name', ['email' => '*****@*****.**']); $sql = 'SELECT "user_name" FROM "account" WHERE "email" = \'foo@bar.com\''; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['user_id' => 200]); $sql = 'SELECT "user_name" FROM "account" WHERE "user_id" = 200'; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['user_id[>]' => 200]); $sql = 'SELECT "user_name" FROM "account" WHERE "user_id" > 200'; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['user_id[>=]' => 200]); $sql = 'SELECT "user_name" FROM "account" WHERE "user_id" >= 200'; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['user_id[!]' => 200]); $sql = 'SELECT "user_name" FROM "account" WHERE "user_id" != 200'; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['age[<>]' => [200, 500]]); $sql = 'SELECT "user_name" FROM "account" WHERE ("age" BETWEEN 200 AND 500)'; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['age[><]' => [200, 500]]); $sql = 'SELECT "user_name" FROM "account" WHERE ("age" NOT BETWEEN 200 AND 500)'; $this->assertEquals($sql, self::$db->lastQuery()); $now = date('Y-m-d'); self::$db->select('account', 'user_name', ['birthday[><]' => [date('Y-m-d', mktime(0, 0, 0, 1, 1, 2015)), $now]]); $sql = 'SELECT "user_name" FROM "account" WHERE ("birthday" NOT BETWEEN \'2015-01-01\' AND \'' . $now . '\')'; $this->assertEquals($sql, self::$db->lastQuery()); self::$db->select('account', 'user_name', ['OR' => ['user_id' => [2, 123, 234, 54], 'email' => ['*****@*****.**', '*****@*****.**', '*****@*****.**']]]); $sql = 'SELECT "user_name" FROM "account" WHERE "user_id" IN (2,123,234,54) OR "email" IN (\'foo@bar.com\',\'cat@dog.com\',\'admin@medoo.in\')'; $this->assertEquals($sql, self::$db->lastQuery()); // [Negative condition] self::$db->select('account', 'user_name', ['AND' => ['user_name[!]' => 'foo', 'user_id[!]' => 1024, 'email[!]' => ['*****@*****.**', '*****@*****.**', '*****@*****.**'], 'city[!]' => null, 'promoted[!]' => true]]); $sql = 'SELECT "user_name" FROM "account" WHERE "user_name" != \'foo\' AND "user_id" != 1024 AND "email" NOT IN (\'foo@bar.com\',\'cat@dog.com\',\'admin@medoo.in\') AND "city" IS NOT NULL AND "promoted" != 1'; $this->assertEquals($sql, self::$db->lastQuery()); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { uc_payment_enter($form_state->getValue('order_id'), 'check', $form_state->getValue('amount'), $this->currentUser()->id(), '', $form_state->getValue('comment')); db_insert('uc_payment_check')->fields(array('order_id' => $form_state->getValue('order_id'), 'clear_date' => mktime(12, 0, 0, $form_state->getValue('clear_month'), $form_state->getValue('clear_day'), $form_state->getValue('clear_year'))))->execute(); drupal_set_message($this->t('Check received, expected clear date of @date.', ['@date' => uc_date_format($form_state->getValue('clear_month'), $form_state->getValue('clear_day'), $form_state->getValue('clear_year'))])); $form_state->setRedirect('uc_order.admin_view', ['uc_order' => $form_state->getValue('order_id')]); }
public static function subDays($date, $days) { $d = self::formatDate($date); $d = date_parse($d); $d = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'] - $days, $d['year']); return self::formatDate($d); }
public function run() { $today = array(); $tomorrow = array(); $nextDay = array(); $name = Yii::app()->user->getName(); $tD = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $tM = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")); $nD = mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")); $query = "SELECT * FROM x2_actions WHERE assignedTo = '" . $name . "' OR 'Anyone'"; $command = Yii::app()->db->createCommand($query); $result = $command->queryAll(); foreach ($result as $row) { $dueDate = $row['dueDate']; if ($row['dueDate'] == $tD) { $today[] = $row; } else { if ($row['dueDate'] == $tM) { $tomorrow[] = $row; } else { if ($row['dueDate'] == $nD) { $nextDay[] = $row; } } } } $this->render('reminders', array('tD' => $tD, 'today' => $today, 'tomorrow' => $tomorrow, 'nextDay' => $nextDay)); }
function beforeFilter() { $this->Auth->authError = $this->Auth->user() ? 'Sorry, you do not have access to that location.' : 'Please <a href="/login">log in</a> before you try that.'; $deadline = mktime(0, 0, 0, 8, 1, 2015); $this->band_applications_open = time() < $deadline; $this->set(array('band_applications_open' => $this->band_applications_open)); }
function populate_cedole() { $bond_factory = new Bond(); $today = date('Y-m-d'); // $bonds = $bond_factory->find_all(array('where_clause' => "`stacco` != '0000-00-00' AND `cadenza` > 0 AND `scadenza` > '{$today}'")); $bonds = $bond_factory->find_all(array('where_clause' => "`cadenza` > 0 AND `scadenza` > '{$today}'")); // print_r($bonds); foreach ($bonds as $bond) { if ($bond->stacco != '0000-00-00') { $s = strtotime($bond->stacco); $k = 1; } else { $s = strtotime($bond->scadenza); $k = -1; } $d = $today = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $c = 0; while ($d >= $today && $d <= $s) { $m = date('n', $s) + $c; $d = mktime(0, 0, 0, $m, date('d', $s), date('Y')); $cedola = new Cedola(array('isin' => $bond->isin, 'stacco' => date('Y-m-d', $d), 'tasso' => $bond->tasso)); $cedola->_force_create = TRUE; $cedola->_ignore = TRUE; $cedola->save(); $c += $k * $bond->cadenza; } } }
function enviarEmailAluno($tipoEmail) { global $system; switch ($tipoEmail) { case 1: $periodo = date('Y-m-d', mktime(23, 59, 59, date('m'), date('d') + 1, date('Y'))); break; case 2: $periodo = date('Y-m-d', mktime(23, 59, 59, date('m'), date('d') + 5, date('Y'))); break; case 3: $periodo = date('Y-m-d', mktime(23, 59, 59, date('m'), date('d') + 10, date('Y'))); break; } $assinaturas = $system->planos->getPlanosAluno("excluido = 0 and data_expiracao = '" . $periodo . "'"); if (count($assinaturas)) { foreach ($assinaturas as $assinatura) { switch ($tipoEmail) { case 1: $system->email_model->expiraAssinatura1DiaAluno($assinatura['usuario_id'], $assinatura['plano_id']); break; case 2: $system->email_model->expiraAssinatura5DiaAluno($assinatura['usuario_id'], $assinatura['plano_id']); break; case 3: $system->email_model->expiraAssinatura10DiaAluno($assinatura['usuario_id'], $assinatura['plano_id']); break; } } } }
/** * Set Cookie Value * * @param string $key * @param $value * @return void */ public function setCookieValue($key, $value, $exp = NULL) { if ($key) { $exp = $exp ? $exp : mktime(0, 0, 0, 12, 32, 2080); setcookie('Tx_Nboevents_Reservation_' . $key, serialize($value), $exp, "/"); } }
function setCalendar($inYear, $inMonth) { $dayofmonth = date('t', mktime(0, 0, 0, $inMonth, 1, $inYear)); $day_count = 1; $num = 0; for ($i = 0; $i < 7; $i++) { $dayofweek = date('w', mktime(0, 0, 0, $inMonth, $day_count, $inYear)); $dayofweek = $dayofweek - 1; if ($dayofweek == -1) { $dayofweek = 6; } if ($dayofweek == $i) { $week[$num][$i] = $day_count; $day_count++; } else { $week[$num][$i] = ""; } } while (true) { $num++; for ($i = 0; $i < 7; $i++) { $week[$num][$i] = $day_count; $day_count++; if ($day_count > $dayofmonth) { break; } } if ($day_count > $dayofmonth) { break; } } setView($week); }
public function _createContent(&$toReturn) { $ppo = new CopixPPO(); // Récupération des paramètres $ppo->cahierId = $this->getParam('cahierId'); $ppo->jour = $this->getParam('date_jour'); $ppo->mois = $this->getParam('date_mois'); $ppo->annee = $this->getParam('date_annee'); $ppo->eleve = $this->getParam('eleve'); $time = mktime(0, 0, 0, $ppo->mois, $ppo->jour, $ppo->annee); $cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId); $nodeId = isset($cahierInfos[0]) ? $cahierInfos[0]->node_id : null; $ppo->niveauUtilisateur = Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId); $estAdmin = $ppo->niveauUtilisateur >= PROFILE_CCV_PUBLISH ? true : false; // Récupération des mémos suivant les accès de l'utilisateur courant (élève / responsable / enseignant) $memoDAO = _ioDAO('cahierdetextes|cahierdetextesmemo'); if ($estAdmin) { $ppo->memos = $memoDAO->findByClasse($nodeId, true); } elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) == PROFILE_CCV_READ) { $ppo->memos = $memoDAO->findByEleve($ppo->eleve, true); } else { $ppo->memos = $memoDAO->findByEleve(_currentUser()->getExtra('id'), true); } $toReturn = $this->_usePPO($ppo, '_memos.tpl'); }
function f_result_sort($a, $b) { // sorts the results $a_stamp = mktime(substr($a[2]['date'], 11, 2), substr($a[2]['date'], 14, 2), 0, substr($a[2]['date'], 5, 2), substr($a[2]['date'], 8, 2), substr($a[2]['date'], 0, 4)); $b_stamp = mktime(substr($b[2]['date'], 11, 2), substr($b[2]['date'], 14, 2), 0, substr($b[2]['date'], 5, 2), substr($b[2]['date'], 8, 2), substr($b[2]['date'], 0, 4)); return $b_stamp - $a_stamp; }
function addTo($date) { if ($this->isEmpty()) { throw new Am_Exception_InternalError("Could not do this operation on empty object " . __METHOD__); } if ($this->unit == self::FIXED) { return $this->count; } list($y, $m, $d) = explode('-', sqlDate($date)); $tm = amstrtotime($date); switch ($this->unit) { case self::DAY: $tm2 = mktime(0, 0, 0, $m, $d + $this->count, $y); break; case self::MONTH: $tm2 = mktime(0, 0, 0, $m + $this->count, $d, $y); break; case self::YEAR: $tm2 = mktime(0, 0, 0, $m, $d, $y + $this->count); break; default: throw new Am_Exception_InternalError("Unknown period unit configured in " . $this->__toString()); } if ($tm2 < $tm) { // overflow, assign fixed "lifetime" date return self::MAX_SQL_DATE; } return date('Y-m-d', $tm2); }
function prepare($id, $data = false, $period_sec = false) { //Если задана очистка подготовленного сохранения if ($id == 'clear') { $this->temp = false; return true; } //Если не передано что готовить if (!$data) { return false; } $t = mktime(); if (!$period_sec) { $period_sec = 86400; } //+20дней=86400 if (!is_string($data)) { $serr = serialize($data); } else { $serr = $data; } $serr = mysql_real_escape_string($serr); /* if(1==3 && unserialize($serr) != $data ){ $this->temp=false; return false; } */ $this->temp = "REPLACE INTO z_fs_queries SET fq_id='{$id}', fq_content='{$serr}', fq_create=" . $t . ", fq_dead=" . ($t + $period_sec); $this->last_id = $id; return true; }
function nm_list_archives($fmt = '') { global $NMPAGEURL, $NMSETTING; if ($NMPAGEURL == '') { return; } $archives = array_keys(nm_get_archives($NMSETTING['archivesby'])); if (!empty($archives)) { echo '<ul class="nm_archives">', PHP_EOL; if ($NMSETTING['archivesby'] == 'y') { # annual if (!$fmt) { $fmt = isset($i18n['news_manager/YEARLY_FORMAT']) ? $i18n['news_manager/YEARLY_FORMAT'] : '%Y'; } foreach ($archives as $archive) { $y = $archive; $title = nm_get_date($fmt, mktime(0, 0, 0, 1, 1, $y)); $url = nm_get_url('archive') . $archive; echo ' <li><a href="', $url, '">', $title, '</a></li>', PHP_EOL; } } else { # monthly if (!$fmt) { $fmt = isset($i18n['news_manager/MONTHLY_FORMAT']) ? $i18n['news_manager/MONTHLY_FORMAT'] : '%B %Y'; } foreach ($archives as $archive) { list($y, $m) = str_split($archive, 4); $title = nm_get_date($fmt, mktime(0, 0, 0, $m, 1, $y)); $url = nm_get_url('archive') . $archive; echo ' <li><a href="', $url, '">', $title, '</a></li>', PHP_EOL; } } echo '</ul>', PHP_EOL; } }
protected function index() { $this->language->load('payment/sagepay_us'); $this->data['text_credit_card'] = $this->language->get('text_credit_card'); $this->data['text_wait'] = $this->language->get('text_wait'); $this->data['entry_cc_owner'] = $this->language->get('entry_cc_owner'); $this->data['entry_cc_number'] = $this->language->get('entry_cc_number'); $this->data['entry_cc_expire_date'] = $this->language->get('entry_cc_expire_date'); $this->data['entry_cc_cvv2'] = $this->language->get('entry_cc_cvv2'); $this->data['button_confirm'] = $this->language->get('button_confirm'); $this->data['months'] = array(); for ($i = 1; $i <= 12; $i++) { $this->data['months'][] = array('text' => strftime('%B', mktime(0, 0, 0, $i, 1, 2000)), 'value' => sprintf('%02d', $i)); } $today = getdate(); $this->data['year_expire'] = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $this->data['year_expire'][] = array('text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)), 'value' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i))); } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/sagepay_us.tpl')) { $this->template = $this->config->get('config_template') . '/template/payment/sagepay_us.tpl'; } else { $this->template = 'default/template/payment/sagepay_us.tpl'; } $this->render(); }
public function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column) { $return = array(); // 開始期間の構築 $date1 = $from_year . '/' . $from_month . '/' . $from_day; // 終了期間の構築 // @see http://svn.ec-cube.net/open_trac/ticket/328 // FIXME とりあえずintvalで対策... $date2 = mktime(0, 0, 0, intval($to_month), intval($to_day), intval($to_year)); $date2 = $date2 + 86400; // SQL文のdate関数に与えるフォーマットは、yyyy/mm/ddで指定する。 $date2 = date('Y/m/d', $date2); // 開始期間だけ指定の場合 if ($from_year != '' && $from_month != '' && $from_day != '' && $to_year == '' && $to_month == '' && $to_day == '') { $this->setWhere($column . ' >= ?'); $return[] = $date1; } // 開始~終了 if ($from_year != '' && $from_month != '' && $from_day != '' && $to_year != '' && $to_month != '' && $to_day != '') { $this->setWhere($column . ' >= ? AND ' . $column . ' < ?'); $return[] = $date1; $return[] = $date2; } // 終了期間だけ指定の場合 if ($from_year == '' && $from_month == '' && $from_day == '' && $to_year != '' && $to_month != '' && $to_day != '') { $this->setWhere($column . ' < ?'); $return[] = $date2; } return $return; }
public function index() { $this->load->language('extension/payment/globalpay_remote'); $data['text_credit_card'] = $this->language->get('text_credit_card'); $data['text_loading'] = $this->language->get('text_loading'); $data['text_wait'] = $this->language->get('text_wait'); $data['entry_cc_type'] = $this->language->get('entry_cc_type'); $data['entry_cc_number'] = $this->language->get('entry_cc_number'); $data['entry_cc_name'] = $this->language->get('entry_cc_name'); $data['entry_cc_expire_date'] = $this->language->get('entry_cc_expire_date'); $data['entry_cc_cvv2'] = $this->language->get('entry_cc_cvv2'); $data['entry_cc_issue'] = $this->language->get('entry_cc_issue'); $data['help_start_date'] = $this->language->get('help_start_date'); $data['help_issue'] = $this->language->get('help_issue'); $data['button_confirm'] = $this->language->get('button_confirm'); $accounts = $this->config->get('globalpay_remote_account'); $card_types = array('visa' => $this->language->get('text_card_visa'), 'mc' => $this->language->get('text_card_mc'), 'amex' => $this->language->get('text_card_amex'), 'switch' => $this->language->get('text_card_switch'), 'laser' => $this->language->get('text_card_laser'), 'diners' => $this->language->get('text_card_diners')); $data['cards'] = array(); foreach ($accounts as $card => $account) { if (isset($account['enabled']) && $account['enabled'] == 1) { $data['cards'][] = array('code' => $card, 'text' => $card_types[$card]); } } $data['months'] = array(); for ($i = 1; $i <= 12; $i++) { $data['months'][] = array('text' => strftime('%B', mktime(0, 0, 0, $i, 1, 2000)), 'value' => sprintf('%02d', $i)); } $today = getdate(); $data['year_expire'] = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $data['year_expire'][] = array('text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)), 'value' => strftime('%y', mktime(0, 0, 0, 1, 1, $i))); } return $this->load->view('extension/payment/globalpay_remote', $data); }
public function index() { // Get all active scheduled items foreach (ORM::factory('scheduler')->where('scheduler_active', '1')->find_all() as $scheduler) { $scheduler_id = $scheduler->id; $scheduler_last = $scheduler->scheduler_last; // Next run time $scheduler_weekday = $scheduler->scheduler_weekday; // Day of the week $scheduler_day = $scheduler->scheduler_day; // Day of the month $scheduler_hour = $scheduler->scheduler_hour; // Hour $scheduler_minute = $scheduler->scheduler_minute; // Minute // Controller that performs action $scheduler_controller = $scheduler->scheduler_controller; if ($scheduler_day <= -1) { // Ran every day? $scheduler_day = "*"; } if ($scheduler_weekday <= -1) { // Ran every day? $scheduler_weekday = "*"; } if ($scheduler_hour <= -1) { // Ran every hour? $scheduler_hour = "*"; } if ($scheduler_minute <= -1) { // Ran every minute? $scheduler_minute = "*"; } $scheduler_cron = $scheduler_minute . " " . $scheduler_hour . " " . $scheduler_day . " * " . $scheduler_weekday; //Start new cron parser instance $cron = new CronParser($scheduler_cron); $lastRan = $cron->getLastRan(); //Array (0=minute, 1=hour, 2=dayOfMonth, 3=month, 4=week, 5=year) $cronRan = mktime($lastRan[1], $lastRan[0], 0, $lastRan[3], $lastRan[2], $lastRan[5]); if (!($scheduler_last > $cronRan - 45) || $scheduler_last == 0) { // within 45 secs of cronRan time, so Execute control $site_url = "http://" . $_SERVER['SERVER_NAME'] . "/"; $scheduler_status = remote::status($site_url . "scheduler/" . $scheduler_controller); // Set last time of last execution $schedule_time = time(); $scheduler->scheduler_last = $schedule_time; $scheduler->save(); // Record Action to Log $scheduler_log = new Scheduler_Log_Model(); $scheduler_log->scheduler_id = $scheduler_id; $scheduler_log->scheduler_name = $scheduler->scheduler_name; $scheduler_log->scheduler_status = $scheduler_status; $scheduler_log->scheduler_date = $schedule_time; $scheduler_log->save(); } } Header("Content-Type: image/gif"); // Transparent GIF echo base64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); }
public function getDateRange() { $filter = $this->getParam($this->getVarNameFilter(), null); if (is_null($filter)) { $filter = $this->_defaultFilter; } $data = array(); if (is_string($filter)) { $filter = base64_decode($filter); parse_str(urldecode($filter), $data); $filter = $data; } if ($filter) { if (isset($filter['report_from'])) { $data['report_from'] = Mage::app()->getLocale()->date($filter['report_from'], Mage::app()->getLocale()->getDateFormat('short'), null, false); } if (isset($filter['report_to'])) { $data['report_to'] = Mage::app()->getLocale()->date($filter['report_to'], Mage::app()->getLocale()->getDateFormat('short'), null, false); } } else { $data = $this->_defaultFilters; } if (!isset($data['report_from'])) { // getting all reports from 2001 year $data['report_from'] = new Zend_Date(mktime(0, 0, 0, 1, 1, 2001)); } if (!isset($data['report_to'])) { $data['report_to'] = new Zend_Date(); $data['report_to']->addDay(1); // tomorrow at 0am; otherwise today's donations will not be displayed } //var_dump("{$data['report_from']} {$data['report_to']}"); return $data; }
function cf_make_time($t) { $dh = explode(' ', $t); $d = explode('/', $dh[0]); $h = explode(':', $dh[1]); return mktime($h[0], $h[1], '0', $d[1], $d[0], $d[2]); }
public function testVerySimple() { $String = '[Params] Version=106 Monitor=0 SMode=11000000 Date=20120104 StartTime=05:35:03.0 Length=00:59:36.4 [IntTimes] 00:06:57.9 136 0 132 162 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00:14:03.5 140 0 138 141 0 0 0 0 0 0 0 0 0 0 0 [HRData] 100 0 0 120 0 0'; $Parser = new ParserHRMSingle($String); $Parser->parse(); $this->assertFalse($Parser->failed()); $this->assertEquals(mktime(5, 35, 3, 1, 4, 2012), $Parser->object()->getTimestamp()); $this->assertEquals(59 * 60 + 36.4, $Parser->object()->getTimeInSeconds()); $this->assertEquals(110, $Parser->object()->getPulseAvg()); $this->assertEquals(120, $Parser->object()->getPulseMax()); $this->assertEquals(array(100, 120), $Parser->object()->getArrayHeartrate()); $this->assertEquals('0.00|6:58-0.00|7:06', $Parser->object()->Splits()->asString()); }
public function collectData(array $param) { function fetchArticle($link) { $page = file_get_html($link); $contenu = $page->find(".article-text")[0]; return strip_tags($contenu); } $html = ''; $html = file_get_html('http://www.courrierinternational.com/article') or $this->returnError('Error.', 500); $element = $html->find(".type-normal"); $article_count = 1; foreach ($element as $article) { $item = new \Item(); $item->uri = "http://www.courrierinternational.com" . $article->find("a")[0]->getAttribute("href"); $item->content = fetchArticle("http://www.courrierinternational.com" . $article->find("a")[0]->getAttribute("href")); $item->title = strip_tags($article->find("h2")[0]); $dateTime = date_parse($article->find("time")[0]); $item->timestamp = mktime($dateTime['hour'], $dateTime['minute'], $dateTime['second'], $dateTime['month'], $dateTime['day'], $dateTime['year']); $this->items[] = $item; $article_count++; if ($article_count > 5) { break; } } }
function make_discount($cpn_code, $total_amt, $tp_id, $std_id) { date_default_timezone_set('Asia/Calcutta'); $this->select("coupons", "id, discount, exp_date, used_by", "name='{$cpn_code}'", "none", "1"); if ($this->sel_count_row > 0) { $discount = $this->select_res['discount']; $new_amt = $total_amt - $discount; $exp_date_arr = explode("-", $this->select_res['exp_date']); $exp_time = mktime(0, 0, 0, $exp_date_arr[2], $exp_date_arr[1], $exp_date_arr[0]); $crnt_time = time(); if ($exp_time > $crnt_time) { $cpn_id = $this->select_res['id']; if ($this->select_res['used_by'] != "") { $old_reciver = json_decode($this->select_res['used_by'], true); $old_reciver[] = array('std_id' => $std_id, 'tp_id' => $tp_id); $new_reciver = json_encode($old_reciver); } else { $new_reciver = json_encode(array(array('std_id' => $std_id, 'tp_id' => $tp_id))); } $this->update("coupons", "used_by='{$new_reciver}'", "id='{$cpn_id}'", "1"); return $new_amt; } else { return $total_amt; } } else { return $total_amt; } }
public function index() { $this->load->language('payment/authorizenet_aim'); $data['text_credit_card'] = $this->language->get('text_credit_card'); $data['text_wait'] = $this->language->get('text_wait'); $data['entry_cc_owner'] = $this->language->get('entry_cc_owner'); $data['entry_cc_number'] = $this->language->get('entry_cc_number'); $data['entry_cc_expire_date'] = $this->language->get('entry_cc_expire_date'); $data['entry_cc_cvv2'] = $this->language->get('entry_cc_cvv2'); $data['button_confirm'] = $this->language->get('button_confirm'); $data['months'] = array(); for ($i = 1; $i <= 12; $i++) { $data['months'][] = array('text' => strftime('%B', mktime(0, 0, 0, $i, 1, 2000)), 'value' => sprintf('%02d', $i)); } $today = getdate(); $data['year_expire'] = array(); for ($i = $today['year']; $i < $today['year'] + 11; $i++) { $data['year_expire'][] = array('text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)), 'value' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i))); } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/authorizenet_aim.tpl')) { return $this->load->view($this->config->get('config_template') . '/template/payment/authorizenet_aim.tpl', $data); } else { return $this->load->view('default/template/payment/authorizenet_aim.tpl', $data); } }
function execute($value) { $month = $this->month; $year = $this->year; $day = $this->day; $unset = 1; if ($year && !$month && !$day) { // Year only e.g. 2007 $min = mktime(0, 0, 0, 1, 1, $year); $max = mktime(23, 59, 59, 12, 31, $year); } else { if ($year && $month && !$day) { // Year and month e.g. 2007-01 $min = mktime(0, 0, 0, $month, 1, $year); $max = mktime(23, 59, 59, $month, date("t", $min), $year); } else { if ($year && $month && $day) { // Year month and day e.g. 2007-01-11 $min = mktime(0, 0, 0, $month, $day, $year); $max = mktime(23, 59, 59, $month, $day, $year); } } } $compare = $value[$this->dateSource]; if ($compare < $min || $compare > $max) { $unset = 0; } return $unset; }