コード例 #1
4
ファイル: Library.php プロジェクト: NadaNafti/Thalassa
 public function getDatesBetween($dStart, $dEnd)
 {
     if ($dStart > $dEnd) {
         $var = $dStart;
         $dStart = $dEnd;
         $dEnd = $var;
     }
     $iStart = strtotime($dStart);
     $iEnd = strtotime($dEnd);
     if (false === $iStart || false === $iEnd) {
         return false;
     }
     $aStart = explode('-', $dStart);
     $aEnd = explode('-', $dEnd);
     if (count($aStart) !== 3 || count($aEnd) !== 3) {
         return false;
     }
     if (false === checkdate($aStart[1], $aStart[2], $aStart[0]) || false === checkdate($aEnd[1], $aEnd[2], $aEnd[0]) || $iEnd < $iStart) {
         return false;
     }
     for ($i = $iStart; $i < $iEnd + 86400; $i = strtotime('+1 day', $i)) {
         $sDateToArr = strftime('%Y-%m-%d', $i);
         $sYear = substr($sDateToArr, 0, 4);
         $sMonth = substr($sDateToArr, 5, 2);
         //$aDates[$sYear][$sMonth][]=$sDateToArr;
         $aDates[] = $sDateToArr;
     }
     if (isset($aDates) && !empty($aDates)) {
         return $aDates;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: bgarrels/textpattern
function write_log()
{
    global $HTTP_RAW_POST_DATA;
    $fp = @fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xmlrpclog', 'a');
    if ($fp) {
        $lnsep = "\n================================\n";
        fwrite($fp, "\n{$lnsep}" . strftime("%Y-%m-%d %H:%M:%S"));
        fwrite($fp, '[USER_AGENT] ' . $_SERVER['HTTP_USER_AGENT']);
        fwrite($fp, $lnsep);
        fwrite($fp, '[ACCEPT_ENCODING] ' . $_SERVER['HTTP_ACCEPT_ENCODING']);
        if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache') !== false) {
            fwrite($fp, $lnsep);
            fwrite($fp, "Apache Request Headers:\n");
            fwrite($fp, $lnsep);
            $headers = getallheaders();
            foreach ($headers as $header => $value) {
                fwrite($fp, "{$header}: {$value} \n");
            }
        }
        fwrite($fp, $lnsep);
        fwrite($fp, "Incoming data, usually utf-8 encoded:\n");
        fwrite($fp, $lnsep);
        fwrite($fp, $HTTP_RAW_POST_DATA);
    }
    @fclose($fp);
}
コード例 #3
0
 function setup()
 {
     $oRootFolder =& Folder::get(1);
     $this->oUser = User::get(1);
     $sName = 'PermissionsTrest' . strftime('%Y%m%d%H%M%S');
     $this->oFolder =& KTFolderUtil::add($oRootFolder, $sName, $this->oUser);
 }
コード例 #4
0
ファイル: ReportGenerator.php プロジェクト: noikiy/owaspbwa
 function ageToYear($age)
 {
     $currYear = strftime('%Y');
     $currMonthDate = strftime('-%m-%d');
     $birthYear = (int) $currYear - $age;
     return $birthYear . $currMonthDate;
 }
コード例 #5
0
ファイル: data.class.php プロジェクト: nervlin4444/modx-cms
 public function getChanges(array $resourceArray)
 {
     $emptyDate = '0000-00-00 00:00:00';
     $resourceArray['pub_date'] = !empty($resourceArray['pub_date']) && $resourceArray['pub_date'] != $emptyDate ? $resourceArray['pub_date'] : $this->modx->lexicon('none');
     $resourceArray['unpub_date'] = !empty($resourceArray['unpub_date']) && $resourceArray['unpub_date'] != $emptyDate ? $resourceArray['unpub_date'] : $this->modx->lexicon('none');
     $resourceArray['status'] = $resourceArray['published'] ? $this->modx->lexicon('resource_published') : $this->modx->lexicon('resource_unpublished');
     $server_offset_time = intval($this->modx->getOption('server_offset_time', null, 0));
     $resourceArray['createdon_adjusted'] = strftime('%c', strtotime($this->resource->get('createdon')) + $server_offset_time);
     $resourceArray['createdon_by'] = $this->resource->get('creator');
     if (!empty($resourceArray['editedon']) && $resourceArray['editedon'] != $emptyDate) {
         $resourceArray['editedon_adjusted'] = strftime('%c', strtotime($this->resource->get('editedon')) + $server_offset_time);
         $resourceArray['editedon_by'] = $this->resource->get('editor');
     } else {
         $resourceArray['editedon_adjusted'] = $this->modx->lexicon('none');
         $resourceArray['editedon_by'] = $this->modx->lexicon('none');
     }
     if (!empty($resourceArray['publishedon']) && $resourceArray['publishedon'] != $emptyDate) {
         $resourceArray['publishedon_adjusted'] = strftime('%c', strtotime($this->resource->get('editedon')) + $server_offset_time);
         $resourceArray['publishedon_by'] = $this->resource->get('publisher');
     } else {
         $resourceArray['publishedon_adjusted'] = $this->modx->lexicon('none');
         $resourceArray['publishedon_by'] = $this->modx->lexicon('none');
     }
     return $resourceArray;
 }
コード例 #6
0
ファイル: TimeAgo.php プロジェクト: 9illes/timeline-php
 public static function format($time)
 {
     $out = '';
     // what we will print out
     $now = time();
     // current time
     $diff = $now - $time;
     // difference between the current and the provided dates
     if ($diff < 60) {
         // it happened now
         return TIMEBEFORE_NOW;
     } elseif ($diff < 3600) {
         // it happened X minutes ago
         return str_replace('{num}', $out = round($diff / 60), $out == 1 ? TIMEBEFORE_MINUTE : TIMEBEFORE_MINUTES);
     } elseif ($diff < 3600 * 24) {
         // it happened X hours ago
         return str_replace('{num}', $out = round($diff / 3600), $out == 1 ? TIMEBEFORE_HOUR : TIMEBEFORE_HOURS);
     } elseif ($diff < 3600 * 24 * 2) {
         // it happened yesterday
         return TIMEBEFORE_YESTERDAY;
     } else {
         // falling back on a usual date format as it happened later than yesterday
         return strftime(date('Y', $time) == date('Y') ? TIMEBEFORE_FORMAT : TIMEBEFORE_FORMAT_YEAR, $time);
     }
 }
コード例 #7
0
 function get()
 {
     global $I18N;
     // getId() ist erst hier verfügbar
     $this->addConfig('inputField', 'label_' . $this->getId(), true);
     $this->addConfig('ifFormat', $I18N->msg('dateformat'), true);
     $this->addConfig('hiddenField', $this->getId(), true);
     $this->addConfig('button', 'trigger_' . $this->getId(), true);
     $this->addConfig('onUpdate', 'rex_a22_timestamp_from_calendar');
     $value = $this->getValue();
     $formattedValue = $value != '' ? strftime($I18N->msg('dateformat'), $value) : '';
     // Textfield für die formatierte Anzeige
     $s = parent::get();
     $s = str_replace('id="', 'id="label_', $s);
     $s = preg_replace('/name="[^"]*"/', '', $s);
     $s = preg_replace('/value="[^"]*"/', 'value="' . $formattedValue . '"', $s);
     $s .= "\n";
     // hidden field für das speichern des timestamps
     $s .= '<input type="hidden" id="' . $this->getId() . '" name="' . $this->getName() . '" value="' . $value . '" />' . "\n";
     $s .= '<button id="trigger_' . $this->getId() . '" style="background-image:url(' . $this->path . 'icons/calendar_edit.png); width: 16px; height: 20px; background-position: center; background-repeat: no-repeat;" title="Datum wählen"></button>';
     // Kalender setup
     $s .= '<script type="text/javascript">' . "\n";
     $s .= 'Calendar.setup({' . "\n";
     foreach ($this->getConfig() as $name => $value) {
         $s .= sprintf('  %-20s: %s,' . "\n", $name, $value);
     }
     $s .= '});' . "\n";
     $s .= '</script>' . "\n";
     return $s;
 }
コード例 #8
0
ファイル: Svn2Rss.php プロジェクト: rcappuccio/gitsvn
 /**
  * Starts the processing of the current rss-request.
  * Acts like some kind of a main-method, so manages the further control-flow.
  */
 public function processSvn2RssRequest($strFeedParam = "")
 {
     try {
         //start by loading the config-file
         $objConfig = new ConfigReader($strFeedParam);
         //create the svn-reader and pass control
         $objSvnReader = new SvnReader($objConfig);
         $strSvnLog = $objSvnReader->getSvnLogContent();
         //create rss-nodes out of the logfile
         $objRssConverter = new Log2RssConverter($objConfig);
         $objRssRootNode = $objRssConverter->generateRssNodesFromLogContent($strSvnLog);
         $this->strOutput = $objRssRootNode->asXML();
     } catch (Svn2RssException $objException) {
         //Wrap error-message as a rss-feed element, too
         $objFeedRootNode = new SimpleXMLElement("<rss version=\"2.0\"></rss>");
         $objChannel = $objFeedRootNode->addChild("channel");
         $objChannel->addChild("title", "Error");
         $objChannel->addChild("description", "Error while loading feed");
         $objChannel->addChild("link", "n.a.");
         $objChannel->addChild("pubDate", strftime("%a, %d %b %Y %H:%M:%S GMT", time()));
         $objRssItemNode = $objChannel->addChild("item");
         $objRssItemNode->addChild("title", "Something bad happened: \n" . $objException->getMessage() . "");
         $objRssItemNode->addChild("description", "Something bad happened: \n" . $objException->getMessage() . "");
         $objRssItemNode->addChild("pubDate", strftime("%a, %d %b %Y %H:%M:%S GMT", time()));
         $this->strOutput = $objFeedRootNode->asXML();
     }
 }
コード例 #9
0
ファイル: virtuemart.php プロジェクト: ForAEdesWeb/AEW2
 public function execute($language, $start = 0, $limit = 100)
 {
     $db = JFactory::getDBO();
     $source = $this->getCode();
     $query = $db->getQuery(true);
     $query->select('c.*');
     $query->from($db->quoteName($this->tableName) . ' AS c');
     $query->select('u.username as user_username, u.name as user_name, u.email as user_email');
     $query->join('LEFT', $db->quoteName('#__users') . ' AS u ON c.userid = u.id');
     $query->order($db->escape('c.time'));
     $db->setQuery($query, $start, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $table = JTable::getInstance('Comment', 'JCommentsTable');
         $table->object_id = $row->product_id;
         $table->object_group = 'com_virtuemart';
         $table->parent = 0;
         $table->userid = $row->userid;
         $table->name = $row->name;
         $table->username = $row->username;
         $table->comment = $row->comment;
         $table->email = $row->email;
         $table->published = $row->published;
         $table->date = strftime("%Y-%m-%d %H:%M:00", $row->time);
         $table->lang = $language;
         $table->source = $source;
         $table->store();
     }
 }
コード例 #10
0
function convert_bdate($val, $month_fmt)
{
    $ret['year'] = substr($val, 0, 4);
    $ret['day'] = substr($val, 6, 2);
    $ret['month'] = strftime($month_fmt, mktime(1, 1, 1, substr($val, 4, 2), 11, 2000));
    return $ret;
}
コード例 #11
0
 protected function log($time, $message, $logLevel, $logGroup, $ip, $file, $line, $type = null)
 {
     if ($message == "") {
         return;
     }
     $timeString = strftime("Y-m-d H:i:s", $time);
     $userId = null;
     try {
         $userId = Gpf_Session::getAuthUser()->getUserId();
     } catch (Gpf_Exception $e) {
     }
     try {
         $dbLog = new Gpf_Db_Log();
         $dbLog->set('groupid', $logGroup);
         $dbLog->set('level', $logLevel);
         $dbLog->set('created', $timeString);
         $dbLog->set('filename', $file);
         $dbLog->set('message', $message);
         $dbLog->set('line', $line);
         $dbLog->set('ip', $ip);
         $dbLog->set('accountuserid', $userId);
         $dbLog->set(Gpf_Db_Table_Logs::TYPE, $type);
         $dbLog->save();
     } catch (Exception $e) {
         Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE);
         Gpf_Log::error($this->_sys("Database Logger Error. Logging on display: %s", $message));
         Gpf_Log::enableAllTypes();
     }
 }
コード例 #12
0
 public function createTimeDimension()
 {
     $this->out("helo");
     $this->loadModel('OlapTimeDimension');
     $month = date("n");
     $day = date("j");
     $year = date("Y");
     $minute = 0;
     $ts = mktime(0, $minute, 0, $month, $day, $year);
     $t = explode('/', strftime('%M/%H/%w/%d/%j/%m/%Y', $ts));
     $inputarr['OlapTimeDimension'] = array('id' => $ts, 'Minute' => $t[0], 'Hour' => $t[1], 'DayOfWeek' => $t[2], 'DayOfMonth' => $t[3], 'DayOfYear' => $t[4], 'Month' => $t[5], 'Quarter' => ceil($t[5] / 4), 'Year' => $t[6], 'Holiday' => in_array($t[2], array(0, 6)), 'Weekend' => in_array($t[2], array(0, 6)));
     $count = $this->OlapTimeDimension->find('count', array('conditions' => array('OlapTimeDimension.DayOfMonth' => $inputarr['OlapTimeDimension']['DayOfMonth'], 'OlapTimeDimension.Month' => $inputarr['OlapTimeDimension']['Month'], 'OlapTimeDimension.Year' => $inputarr['OlapTimeDimension']['Year'])));
     if ($count == 0) {
         $this->out('menjalankan perulangan hari');
         $tempDayOfYear = $inputarr['OlapTimeDimension']['DayOfYear'];
         while ($tempDayOfYear == $inputarr['OlapTimeDimension']['DayOfYear']) {
             $ts = mktime(0, $minute, 0, $month, $day, $year);
             $t = explode('/', strftime('%M/%H/%w/%d/%j/%m/%Y', $ts));
             $inputarr['OlapTimeDimension'] = array('id' => $ts, 'Minute' => $t[0], 'Hour' => $t[1], 'DayOfWeek' => $t[2], 'DayOfMonth' => $t[3], 'DayOfYear' => $t[4], 'Month' => $t[5], 'Quarter' => ceil($t[5] / 4), 'Year' => $t[6], 'Holiday' => in_array($t[2], array(0, 6)), 'Weekend' => in_array($t[2], array(0, 6)));
             if ($tempDayOfYear == $inputarr['OlapTimeDimension']['DayOfYear']) {
                 $this->OlapTimeDimension->set($inputarr);
                 $this->OlapTimeDimension->create();
                 $this->OlapTimeDimension->save($inputarr);
                 $minute += 5;
                 $this->out("menyimpan id " . $inputarr['OlapTimeDimension']['id']);
             }
         }
     }
 }
コード例 #13
0
ファイル: TcaInformation.php プロジェクト: mkalus/calendarize
 /**
  * Get event list
  *
  * @param $events
  *
  * @return string
  */
 protected function getEventList($events)
 {
     $items = [];
     foreach ($events as $event) {
         $startDateStamp = $event['start_date'] instanceof \DateTime ? $event['start_date']->getTimestamp() : $event['start_date'];
         $startDate = strftime('%a %d.%m.%G', $startDateStamp);
         $endDateStamp = $event['end_date'] instanceof \DateTime ? $event['end_date']->getTimestamp() : $event['end_date'];
         $endDate = strftime('%a %d.%m.%G', $endDateStamp);
         $entry = $startDate . ' - ' . $endDate;
         if (!$event['all_day']) {
             $start = BackendUtility::time($event['start_time'], false);
             if ((int) $event['end_time'] === AbstractTimeTable::DAY_END) {
                 $end = '"' . TranslateUtility::get('openEndTime') . '"';
             } else {
                 $end = BackendUtility::time($event['end_time'], false);
             }
             $entry .= ' (' . $start . ' - ' . $end . ')';
         }
         $items[] = $entry;
     }
     if (!sizeof($items)) {
         $items[] = TranslateUtility::get('noEvents');
     }
     return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
 }
コード例 #14
0
ファイル: comment.php プロジェクト: Keav/btbsandbox
    public function comment_mail_notification()
    {
        $mail = new PHPMailer();
        $mail->isSMTP();
        $mail->Host = SMTP_HOST;
        $mail->SMTPAuth = SMTP_AUTH;
        $mail->Username = SMTP_USER;
        $mail->Password = SMTP_PASS;
        $mail->SMTPSecure = SMTP_SECURE;
        $mail->Port = SMTP_PORT;
        $mail->From = SMTP_FROM;
        $mail->FromName = SMTP_FROM_NAME;
        $mail->addReplyTo(SMTP_REPLY_TO, SMTP_REPLY_TO_NAME);
        $mail->addAddress(SMTP_TO, SMTP_TO_NAME);
        $mail->isHTML(SMTP_ISHTML);
        $mail->Subject = SMTP_SUBJECT . strftime("%T", time());
        $created = datetime_to_text($this->created);
        $mail_body = nl2br($this->body);
        $photo = Photograph::find_by_id($_GET['id']);
        $mail->Body = <<<EMAILBODY

A new comment has been received in the Photo Gallery.<br>
<br>
Photograph: {$photo->filename}<br>
<br>
On {$created}, {$this->author} wrote:<br>
<br>
{$mail_body}<br>

EMAILBODY;
        $result = $mail->send();
        return $result;
    }
コード例 #15
0
ファイル: Date.php プロジェクト: arslbbt/mangentovies
 public function getEscapedValue($index = null)
 {
     if ($this->getFormat() && $this->getValue()) {
         return strftime($this->getFormat(), strtotime($this->getValue()));
     }
     return htmlspecialchars($this->getValue());
 }
コード例 #16
0
ファイル: genserie.php プロジェクト: bontiv/intrateb
 public function init($serie, $proprio)
 {
     $this->date = strftime('%e %B %G, %H:%M:%S');
     $this->serie = $serie;
     $this->proprio = $proprio;
     $this->reload_conf(0);
 }
コード例 #17
0
ファイル: Events.php プロジェクト: sonvq/2015_freelance6
 public function getTill($format = null)
 {
     if ($format) {
         return strftime($format, strtotime($this->_till));
     }
     return $this->_till;
 }
コード例 #18
0
 function format_datetime($date = 'now')
 {
     if ($date == NULL) {
         return '';
     }
     return strftime("%A %e %B %Y, om %R uur", strtotime($date));
 }
コード例 #19
0
ファイル: TextHandler.php プロジェクト: nuffer/bolt
 /**
  * Returns the date time in a particular format. Takes the locale into
  * account.
  *
  * @param string|\DateTime $dateTime
  * @param string           $format
  *
  * @return string Formatted date and time
  */
 public function localeDateTime($dateTime, $format = '%B %e, %Y %H:%M')
 {
     if (!$dateTime instanceof \DateTime) {
         $dateTime = new \DateTime($dateTime);
     }
     // Check for Windows to find and replace the %e modifier correctly
     // @see: http://php.net/strftime
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\\1%#d', $format);
     }
     // According to http://php.net/manual/en/function.setlocale.php manual
     // if the second parameter is "0", the locale setting is not affected,
     // only the current setting is returned.
     $result = setlocale(LC_ALL, 0);
     if ($result === false) {
         // This shouldn't occur, but.. Dude!
         // You ain't even got locale or English on your platform??
         // Various things we could do. We could fail miserably, but a more
         // graceful approach is to use the datetime to display a default
         // format
         $this->app['logger.system']->error('No valid locale detected. Fallback on DateTime active.', ['event' => 'system']);
         return $dateTime->format('Y-m-d H:i:s');
     } else {
         $timestamp = $dateTime->getTimestamp();
         return strftime($format, $timestamp);
     }
 }
コード例 #20
0
 /**
  * Adds class phpdoc comment and openning of class.
  * @param      string &$script The script will be modified in this method.
  */
 protected function addClassOpen(&$script)
 {
     $table = $this->getTable();
     $this->declareClassFromBuilder($this->getPeerBuilder());
     $tableName = $table->getName();
     $tableDesc = $table->getDescription();
     switch ($table->treeMode()) {
         case 'NestedSet':
             $baseClassname = $this->getNestedSetPeerBuilder()->getClassname();
             break;
         case 'MaterializedPath':
         case 'AdjacencyList':
         default:
             $baseClassname = $this->getPeerBuilder()->getClassname();
             break;
     }
     if ($this->getBuildProperty('addClassLevelComment')) {
         $script .= "\r\n\r\n/**\r\n * Skeleton subclass for performing query and update operations on the '{$tableName}' table.\r\n *\r\n * {$tableDesc}\r\n *";
         if ($this->getBuildProperty('addTimeStamp')) {
             $now = strftime('%c');
             $script .= "\r\n * This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:\r\n *\r\n * {$now}\r\n *";
         }
         $script .= "\r\n * You should add additional methods to this class to meet the\r\n * application requirements.  This class will only be generated as\r\n * long as it does not already exist in the output directory.\r\n *\r\n * @package    propel.generator." . $this->getPackage() . "\r\n */";
     }
     $script .= "\r\nclass " . $this->getClassname() . " extends {$baseClassname}\r\n{";
 }
コード例 #21
0
ファイル: date_format.php プロジェクト: nan0desu/xyntach
/**
 * Formats a date
 * <pre>
 * * value : the date, as a unix timestamp, mysql datetime or whatever strtotime() can parse
 * * format : output format, see {@link http://php.net/strftime} for details
 * * default : a default timestamp value, if the first one is empty
 * </pre>
 * This software is provided 'as-is', without any express or implied warranty.
 * In no event will the authors be held liable for any damages arising from the use of this software.
 *
 * @author	Jordi Boggiano <*****@*****.**>
 * @copyright Copyright (c) 2008, Jordi Boggiano
 * @license	http://dwoo.org/LICENSE Modified BSD License
 * @link	http://dwoo.org/
 * @version	1.0.1
 * @date	2008-12-24
 * @package	Dwoo
 */
function Dwoo_Plugin_date_format(Dwoo $dwoo, $value, $format = '%b %e, %Y', $default = null)
{
    if (!empty($value)) {
        // convert if it's not a valid unix timestamp
        if (preg_match('#^-?\\d{1,10}$#', $value) === 0) {
            $value = strtotime($value);
        }
    } elseif (!empty($default)) {
        // convert if it's not a valid unix timestamp
        if (preg_match('#^-?\\d{1,10}$#', $default) === 0) {
            $value = strtotime($default);
        } else {
            $value = $default;
        }
    } else {
        return '';
    }
    // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
    if (DIRECTORY_SEPARATOR == '\\') {
        $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
        $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
        if (strpos($format, '%e') !== false) {
            $_win_from[] = '%e';
            $_win_to[] = sprintf('%\' 2d', date('j', $value));
        }
        if (strpos($format, '%l') !== false) {
            $_win_from[] = '%l';
            $_win_to[] = sprintf('%\' 2d', date('h', $value));
        }
        $format = str_replace($_win_from, $_win_to, $format);
    }
    return strftime($format, $value);
}
コード例 #22
0
ファイル: DateShower.php プロジェクト: nangong92t/go_src
 /**
  * timestamp转换成显示时间格式
  * @param $timestamp
  * @return unknown_type
  */
 public static function tTimeFormat($timestamp)
 {
     $curTime = time();
     $space = $curTime - $timestamp;
     //1分钟
     if ($space < 60) {
         $string = "刚刚";
         return $string;
     } elseif ($space < 3600) {
         //一小时前
         $string = floor($space / 60) . "分钟前";
         return $string;
     }
     $curtimeArray = getdate($curTime);
     $timeArray = getDate($timestamp);
     if ($curtimeArray['year'] == $timeArray['year']) {
         if ($curtimeArray['yday'] == $timeArray['yday']) {
             $format = "%H:%M";
             $string = strftime($format, $timestamp);
             return "今天 {$string}";
         } elseif ($curtimeArray['yday'] - 1 == $timeArray['yday']) {
             $format = "%H:%M";
             $string = strftime($format, $timestamp);
             return "昨天 {$string}";
         } else {
             $string = sprintf("%d月%d日 %02d:%02d", $timeArray['mon'], $timeArray['mday'], $timeArray['hours'], $timeArray['minutes']);
             return $string;
         }
     }
     $string = sprintf("%d年%d月%d日 %02d:%02d", $timeArray['year'], $timeArray['mon'], $timeArray['mday'], $timeArray['hours'], $timeArray['minutes']);
     return $string;
 }
コード例 #23
0
	/**
	 * Adds class phpdoc comment and openning of class.
	 * @param      string &$script The script will be modified in this method.
	 */
	protected function addClassOpen(&$script)
	{

		$table = $this->getTable();
		$tableName = $table->getName();
		$tableDesc = $table->getDescription();

		$script .= "
/**
 * Base  static class for performing query operations on the tree contained by the '$tableName' table.
 *
 * $tableDesc
 *";
		if ($this->getBuildProperty('addTimeStamp')) {
			$now = strftime('%c');
			$script .= "
 * This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
 *
 * $now
 *";
		}
		$script .= "
 * @package    ".$this->getPackage()."
 */
abstract class ".$this->getClassname()." {
";
	}
コード例 #24
0
ファイル: sagepay_us.php プロジェクト: xprocessorx/ocStore
 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();
 }
コード例 #25
0
ファイル: iic.php プロジェクト: 4ln6lambn/christmas
function isItChristmas($time = null)
{
    // May as well uncomment this from 12/27 through 12/23
    // return "NO";
    // set Christmas
    $christmas = "12/25";
    $ip = getIp();
    // debug:
    // $ip = "193.51.208.14"; // French IP
    // $christmas = "12/24";
    $location = null;
    if ($ip) {
        // db credentials, see db.php.example
        require 'db.php';
        DBconnect($server, $username, $password, $database);
        $location = ipRoughLocate($ip);
        // if we don't know the country, let's assume eastern time (mediocre)
        if ($location["countryName"] == "(Unknown Country?)") {
            $local_time = easternTime($time);
        } else {
            $local_time = trueLocalTime($time, $location["lng"]);
        }
    } else {
        $local_time = easternTime($time);
    }
    $isit = strftime("%m/%d", $local_time) == $christmas;
    return $isit ? yes($location) : "NO";
}
コード例 #26
0
ファイル: xp.php プロジェクト: BackupTheBerlios/babylon
function zeichne_beitrag($param)
{
    $Erster = $param['Erster'];
    $ForumId = $param['ForumId'];
    $BeitragId = $param['BeitragId'];
    $Autor = $param['Autor'];
    $AutorURL = rawurlencode($Autor);
    $StempelLetzter = $param['StempelLetzter'];
    $Thema = $param['Thema'];
    $Inhalt = $param['Inhalt'];
    $Egl = $param['Egl'];
    $Atavar = $param['Atavar'];
    setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
    $datum = strftime("%d.%b.%Y", $StempelLetzter);
    $zeit = date("H.i:s", $StempelLetzter);
    if ($Erster) {
        echo "      <tr>\n        <th class=\"ueber\" align=\"center\" width=\"100%\" colspan=\"2\">{$Thema}</th>\n      </tr>\n";
    }
    echo "      <tr>\n        <td colspan=\"2\">\n          <table class=\"beitrag\">\n            <tr>\n              <th class=\"ueber\" align=\"left\" colspan=\"2\"><a href=\"mitglieder-profil.php?alias={$AutorURL}\">{$Autor}</a></th>\n              <th class=\"ueber\" align=\"right\">{$datum} {$zeit}</th>\n            </tr>\n            <tr>\n";
    if ($Atavar > -1) {
        echo "              <td class=\"col-dunkel\" valign=\"top\">\n                <div class=\"atavar\">\n                  <img src=\"atavar-ausgeben.php?atavar={$Atavar}\">\n                </div>\n              </td>\n              <td class=\"col-hell\" valign=\"top\" colspan=\"2\" width=\"100%\">{$Inhalt}</td>\n";
    } else {
        echo "              <td class=\"col-hell\" valign=\"top\" colspan=\"3\" width=\"100%\">{$Inhalt}</td>\n";
    }
    echo "            </tr>\n          </table>\n        </td>\n      </tr>\n";
    // Die Antwort Zeile
    if ($Egl) {
        echo "      <tr>\n        <td><font size=\"-1\"><input type=\"radio\" name=\"eltern\" value=\"{$BeitragId}\"";
        if ($Erster) {
            echo ' checked';
        }
        echo ">Antworten auf diesen Beitrag</font></td>\n        <td align=\"right\"><font size=\"-1\"><button type=\"submit\" name=\"zid\" value=\"{$BeitragId}\">zitieren</button></font></td>\n      </tr>\n";
    }
}
コード例 #27
0
ファイル: NameSchema.php プロジェクト: appleboy/LazyRecord
 function schema()
 {
     $this->column('id')->integer()->primary()->autoIncrement();
     $this->column('name')->typeConstraint()->required()->varchar(128);
     $this->column('description')->varchar(128);
     $this->column('category_id')->integer();
     $this->column('address')->varchar(64)->validator(function ($val, $args, $record) {
         if (preg_match('/f**k/', $val)) {
             return array(false, "Please don't");
         }
         return array(true, "Good");
     })->filter(function ($val, $args, $record) {
         return str_replace('John', 'XXXX', $val);
     })->default(function () {
         return 'Default Address';
     })->varchar(256);
     $this->column('country')->varchar(12)->required()->index()->validValues(array('Taiwan', 'Taipei', 'Tokyo'));
     $this->column('type')->varchar(24)->validValues(function () {
         return array('Type Name A' => 'type-a', 'Type Name B' => 'type-b', 'Type Name C' => 'type-c');
     });
     $this->column('confirmed')->boolean();
     $this->column('date')->date()->isa('DateTime')->deflator(function ($val) {
         if ($val instanceof \DateTime) {
             return $val->format('Y-m-d');
         } elseif (is_integer($val)) {
             return strftime('%Y-%m-%d', $val);
         }
         return $val;
     })->inflator(function ($val) {
         return new \DateTime($val);
     });
     $this->seeds('TestSeed');
 }
コード例 #28
0
/**
 * Smarty date_format modifier plugin.
 *
 * Type:     modifier<br>
 * Name:     date_format<br>
 * Purpose:  format datestamps via strftime<br>
 * Input:<br>
 *          - string: input date string
 *          - format: strftime format for output
 *          - default_date: default date if $string is empty
 *
 * @param string $string       input
 * @param string $format       type of the format
 * @param string $default_date default date value
 *
 * @link http://smarty.php.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
 * @uses   smarty_make_timestamp()
 *
 * @return string|void
 */
function smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FORMAT, $default_date = '', $formatter = 'auto')
{
    /**
     * Include the {@link shared.make_timestamp.php} plugin
     */
    require_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php';
    if ($string != '') {
        $timestamp = smarty_make_timestamp($string);
    } elseif ($default_date != '') {
        $timestamp = smarty_make_timestamp($default_date);
    } else {
        return '';
    }
    if ($formatter == 'strftime' || $formatter == 'auto' && strpos($format, '%') !== false) {
        if (DS == '\\') {
            $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
            $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
            if (strpos($format, '%e') !== false) {
                $_win_from[] = '%e';
                $_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
            }
            if (strpos($format, '%l') !== false) {
                $_win_from[] = '%l';
                $_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
            }
            $format = str_replace($_win_from, $_win_to, $format);
        }
        return strftime($format, $timestamp);
    } else {
        return date($format, $timestamp);
    }
}
コード例 #29
0
 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);
     }
 }
コード例 #30
0
function get_live_list_html($LIVE_LIST, $lang = 'zh-tw')
{
    $l10n = array('en' => array('Live' => 'Live Broadcast', 'Online' => 'On air', 'Over' => 'Over'), 'zh-tw' => array('Live' => '線上直播', 'Online' => '放送中', 'Over' => '已經結束'), 'zh-cn' => array('Live' => '在线观看', 'Online' => '播放中', 'Over' => '放映结束'));
    rsort($LIVE_LIST);
    $html = '';
    $html .= sprintf("<h1 id=\"Live\">%s</h1>\n", htmlspecialchars($l10n[$lang]['Live']));
    $html .= "<div class=\"live\">\n";
    foreach ($LIVE_LIST as $idx => &$live) {
        $html .= "    <div class=\"list\">\n";
        $html .= "<div>\n";
        $formated_from = strftime("%m/%d %R", $live['from']);
        $formated_to = strftime("%R", $live['to']);
        $html .= sprintf("  <span>%s - %s</span>\n", htmlspecialchars($formated_from), htmlspecialchars($formated_to));
        if ($live['isOnline']) {
            $html .= sprintf("  <span class=\"online\">%s</span>\n", htmlspecialchars($l10n[$lang]['Online']));
        } else {
            $html .= sprintf("  <span class=\"online end\">%s</span>\n", htmlspecialchars($l10n[$lang]['Over']));
        }
        $html .= "</div>\n";
        $html .= sprintf("  <div class=\"title\">%s</div>\n", htmlspecialchars($live['title']));
        $html .= sprintf("  <div class=\"speaker\">%s</div>\n", htmlspecialchars($live['speaker']));
        if ($live['isOnline']) {
            $html .= sprintf("  <div class=\"link\"><a href=\"%s\" target=\"_blank\">%s</a></div>\n", htmlspecialchars($live['url']), htmlspecialchars($live['url']));
            $html .= sprintf("  <iframe src=\"%s\" frameborder=\"0\" allowfullscreen></iframe>\n", htmlspecialchars($live['url']));
        }
        $html .= "    </div>\n";
    }
    $html .= "</div>\n";
    // <div class="live">
    return $html;
}