当前位置: 首页>>代码示例>>PHP>>正文


PHP GWF_Time::getTimestamp方法代码示例

本文整理汇总了PHP中GWF_Time::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Time::getTimestamp方法的具体用法?PHP GWF_Time::getTimestamp怎么用?PHP GWF_Time::getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GWF_Time的用法示例。


在下文中一共展示了GWF_Time::getTimestamp方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isFlooding

 public function isFlooding()
 {
     $uid = GWF_Session::getUserID();
     $uname = GWF_Shoutbox::generateUsername();
     $euname = GDO::escape($uname);
     $table = GDO::table('GWF_Shoutbox');
     $max = $uid === 0 ? $this->module->cfgMaxPerDayGuest() : $this->module->cfgMaxPerDayUser();
     //		$cut = GWF_Time::getDate(GWF_Time::LEN_SECOND, time()-$this->module->cfgTimeout());
     //		$cnt = $table->countRows("shout_uname='$euname' AND shout_date>'$cut'");
     # Check captcha
     if ($this->module->cfgCaptcha()) {
         require_once GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
         if (!PhpCaptcha::Validate(Common::getPostString('captcha'), true)) {
             return GWF_HTML::err('ERR_WRONG_CAPTCHA');
         }
     }
     # Check date
     $timeout = $this->module->cfgTimeout();
     $last_date = $table->selectVar('MAX(shout_date)', "shout_uid={$uid} AND shout_uname='{$euname}'");
     $last_time = $last_date === NULL ? 0 : GWF_Time::getTimestamp($last_date);
     $next_time = $last_time + $timeout;
     if ($last_time + $timeout > time()) {
         return $this->module->error('err_flood_time', array(GWF_Time::humanDuration($next_time - time())));
     }
     # Check amount
     $today = GWF_Time::getDate(GWF_Date::LEN_SECOND, time() - $timeout);
     $count = $table->countRows("shout_uid={$uid} AND shout_date>='{$today}'");
     if ($count >= $max) {
         return $this->module->error('err_flood_limit', array($max));
     }
     # All fine
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:Shout.php

示例2: displayNextChange

 public function displayNextChange()
 {
     if (NULL === ($last_change = $this->getVar('bmc_date'))) {
         return 'ERR 08815b';
     }
     $time = GWF_Time::getTimestamp($last_change);
     $wait = $time + self::CHANGE_TIMEOUT - time();
     return GWF_Time::humanDuration($wait);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:BAIM_MC.php

示例3: displayTrackTime

 public function displayTrackTime()
 {
     $date1 = $this->getVar('sitemas_firstdate');
     $date2 = $this->getVar('sitemas_date');
     $timestamp1 = GWF_Time::getTimestamp($date1);
     $timestamp2 = GWF_Time::getTimestamp($date2);
     $diff = $timestamp2 - $timestamp1;
     return GWF_Time::humanDuration($diff, 2);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:WC_SiteMaster.php

示例4: maySlap

 public static function maySlap($slapper_id, $target_id, $timeout)
 {
     $slapper_id = (int) $slapper_id;
     $target_id = (int) $target_id;
     # No row yet
     if (false === ($row = self::table(__CLASS__)->selectFirstObject('*', "lsh_slapper={$slapper_id} AND lsh_target={$target_id}", 'lsh_date DESC'))) {
         return true;
     }
     $last_date = $row->getVar('lsh_date');
     $time = GWF_Time::getTimestamp($last_date);
     $remain = $time + $timeout - time();
     if ($remain > 0) {
         return $remain;
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:16,代码来源:Dog_SlapHistory.php

示例5: sanitize

 private function sanitize()
 {
     if (false === Common::getGet('no_session')) {
         return 'The mandatory parameter \'no_session\' is not set. Try \'&no_session=1\'.';
     }
     # Validate Date
     if (false !== ($date = Common::getGet('datestamp'))) {
         if (GWF_Time::isValidDate($date, false, GWF_Date::LEN_SECOND)) {
             $this->time = GWF_Time::getTimestamp($date);
         }
     }
     # Validate username
     if (false !== ($username = Common::getGet('username'))) {
         if (false === ($this->user = GWF_User::getByName($username))) {
             return GWF_HTML::err('ERR_UNKNOWN_USER');
         }
         if (false !== ($error = $this->module->isExcludedFromAPI($this->user, Common::getGet('password')))) {
             return $error;
         }
     }
     # Validate sitename
     if (false !== ($sitename = Common::getGet('sitename'))) {
         if (false === ($this->site = WC_Site::getByName($sitename)) && false === ($this->site = WC_Site::getByClassName($sitename))) {
             return $this->module->error('err_site');
         }
     }
     # Validate Limit
     if (in_array(Common::getGet('masterkey'), self::$masterKeys)) {
         $max_limit = PHP_INT_MAX;
     } elseif ($this->user === false && $this->site === false) {
         $max_limit = self::MAX_LIMIT_ALL;
     } else {
         $max_limit = self::MAX_LIMIT_SINGLE;
     }
     $this->limit = Common::clamp(Common::getGet('limit', self::DEFAULT_LIMIT), 1, $max_limit);
     //		if (!isset($no_block))
     //		{
     //			require_once 'core/module/WeChall/WC_API_Block.php';
     //			if (WC_API_Block::isBlocked())
     //			{
     //				return $this->module->error('err_api_block');
     //			}
     //		}
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:45,代码来源:API_History.php

示例6: calcTimeTaken

 public function calcTimeTaken($now)
 {
     return GWF_Time::getTimestamp($now) - GWF_Time::getTimestamp($this->getVar('csolve_1st_look'));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:4,代码来源:WC_ChallSolved.php

示例7: resetVotesSameSettings

 public function resetVotesSameSettings()
 {
     if ('' === ($expire_time = $this->getVar('vs_expire_date'))) {
         $expire_time = 0;
     } else {
         $expire_time = GWF_Time::getTimestamp($expire_time);
     }
     return $this->resetVotes($this->getMin(), $this->getMax(), $expire_time, $this->getOptions());
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:9,代码来源:GWF_VoteScore.php

示例8: array

<?php

$lang = array('en' => array('help' => 'Usage: %CMD% [<gwf_date>|<countrycode_iso1>]. Print the current bot-time, a gwf_date as uniox timestamp, or the current time in a country.', 'bot' => 'The bot\'s time is %s %s. Unix timestamp: %s', 'err_tz_stub' => 'I cannot parse timezones yet. I blame Hirsch.', 'err_date' => 'Invalid gwf_date!', 'out' => 'The date %s will have the unix timestamp of %d.'));
$plugin = Dog::getPlugin();
$message = $plugin->msg();
if ($message === '') {
    $timezone = date('T');
    $gdo_date = GWF_Time::getDate(GWF_Date::LEN_SECOND);
    $plugin->rply('bot', array(GWF_Time::displayDate($gdo_date), $timezone, time()));
} elseif (preg_match('/^[a-z]{2}$/i', $message)) {
    $plugin->rply('err_tz_stub');
} elseif (preg_match('/^[0-9]{2,21}$/', $message)) {
    if (!GWF_Time::isValidDate($message, false, strlen($message), 100000)) {
        $plugin->rply('err_date');
    } else {
        $plugin->rply('out', array(GWF_Time::displayDate($message), GWF_Time::getTimestamp($message)));
    }
} else {
    $plugin->showHelp();
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:time_Pb.php

示例9: templateGraph

 private function templateGraph()
 {
     $sites2 = $this->getSites2();
     //		echo 'User1';
     //		var_dump($this->user1->displayUsername());
     //		if ($this->user2 !== false) {
     //			echo 'User2';
     //			var_dump($this->user2->displayUsername());
     //		}
     //		echo 'Sites';
     //		var_dump($sites2);
     //		var_dump(sprintf('%d_%d_%d', Common::getGet('y'), Common::getGet('m'), Common::getGet('d')));
     //		echo 'Start';
     //		var_dump($this->start);
     //		echo 'End';
     //		var_dump($this->end);
     //		echo 'Icons';
     //		var_dump($this->withIcons);
     //		echo 'Numbers';
     //		var_dump($this->withNumbers);
     $dir = dirname(GWF_JPGRAPH_PATH) . '/';
     require_once $dir . 'jpgraph.php';
     require_once $dir . 'jpgraph_date.php';
     require_once $dir . 'jpgraph_line.php';
     require_once $dir . 'jpgraph_plotline.php';
     $xdata = array();
     $ydata = array();
     $ylast = array();
     $maxperc = 0;
     $db = gdo_db();
     $uid1 = $this->user1->getVar('user_id');
     $uid2 = $this->user2 === false ? 0 : $this->user2->getVar('user_id');
     //		$history = GWF_TABLE_PREFIX.'wc_user_history2';
     $start = GWF_Time::getTimestamp($this->start);
     $end = GWF_Time::getTimestamp($this->end) + GWF_Time::ONE_DAY;
     $no_data = true;
     $xdata[$uid1] = array();
     $ydata[$uid1] = array();
     $ylast[$uid1] = array();
     if ($uid2 === 0) {
         $where2 = '';
     } else {
         $where2 = " OR userhist_uid={$uid2}";
         $xdata[$uid2] = array();
         $ydata[$uid2] = array();
         $ylast[$uid2] = array();
     }
     require_once GWF_CORE_PATH . 'module/WeChall/WC_HistoryUser2.php';
     $history = GDO::table('WC_HistoryUser2');
     $where = "(userhist_uid={$uid1}{$where2}) AND userhist_date BETWEEN {$start} AND {$end}";
     $orderby = 'userhist_date ASC';
     if (false === ($result = $history->select('userhist_uid, userhist_sid, userhist_percent, userhist_date', $where, $orderby))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     //		$query = "SELECT userhist_uid, userhist_sid, userhist_percent, userhist_date FROM $history WHERE (userhist_uid=$uid1$where2) AND userhist_date BETWEEN $start AND $end ORDER BY userhist_date ASC";
     //		if (false === ($result = $db->queryRead($query))) {
     //			return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     //		}
     //		while (false !== ($row = $db->fetchRow($result)))
     while (false !== ($row = $history->fetch($result, GDO::ARRAY_N))) {
         $siteid = $row[1];
         if (!in_array($siteid, $sites2, true)) {
             continue;
             // site not wanted in graph...
         }
         $userid = $row[0];
         $percent = $row[2] / 100;
         $time = $row[3];
         if ($percent > $maxperc) {
             $maxperc = $percent;
         }
         if (!isset($xdata[$userid][$siteid])) {
             $xdata[$userid][$siteid] = array();
             $ydata[$userid][$siteid] = array();
             $ylast[$userid][$siteid] = 0;
             //				$first[$siteid] = $percent;
             if (!$this->withZoom) {
                 $xdata[$userid][$siteid][] = $start;
                 $ydata[$userid][$siteid][] = $percent;
             }
         }
         $xdata[$userid][$siteid][] = $time;
         $ydata[$userid][$siteid][] = $percent;
         $ylast[$userid][$siteid] = $percent;
         $no_data = false;
     }
     if (!$this->withZoom) {
         foreach (array_keys($ydata[$uid1]) as $siteid) {
             $xdata[$uid1][$siteid][] = $end;
             $ydata[$uid1][$siteid][] = $ylast[$uid1][$siteid];
         }
         if (isset($ydata[$uid2])) {
             foreach (array_keys($ydata[$uid2]) as $siteid) {
                 $xdata[$uid2][$siteid][] = $end;
                 $ydata[$uid2][$siteid][] = $ylast[$uid2][$siteid];
             }
         }
     }
     //		$xdata[$siteid][] = $end;
     //		$ydata[$siteid][] = $percent;
//.........这里部分代码省略.........
开发者ID:sinfocol,项目名称:gwf3,代码行数:101,代码来源:GraphStats.php

示例10: getLastPostTime

 private function getLastPostTime($user)
 {
     if (false === ($result = GDO::table('GWF_ForumPost')->selectVar('MAX(post_date)'))) {
         return 0;
     }
     return GWF_Time::getTimestamp($result);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:Module_Forum.php

示例11: graphUserLevel

 private function graphUserLevel($type)
 {
     $dir = dirname(GWF_JPGRAPH_PATH) . '/';
     require_once $dir . 'jpgraph.php';
     require_once $dir . 'jpgraph_date.php';
     require_once $dir . 'jpgraph_line.php';
     require_once $dir . 'jpgraph_plotline.php';
     if (false === ($user = GWF_User::getByName(Common::getGet('username', '')))) {
         return $this->graphError(GWF_HTML::lang('ERR_UNKNOWN_USER'));
     }
     if (false !== ($vs = Common::getGet('vs'))) {
         $vs = GWF_User::getByName($vs);
     }
     $uh = GWF_TABLE_PREFIX . 'wc_user_history2';
     switch ($type) {
         case 'userhist_rank':
             $type2 = 'rank';
             break;
         case 'userhist_totalscore':
             $type2 = 'totalscore';
             break;
         default:
             die('Unknown Type');
     }
     if ($vs === false) {
         $graphtitle = $this->module->lang('alt_graph_' . $type2, array($user->displayUsername()));
     } else {
         $graphtitle = $this->module->lang('alt_graph_' . $type2 . '_vs', array($user->displayUsername(), $vs->displayUsername()));
     }
     $db = gdo_db();
     $uid = $user->getID();
     $query = "SELECT userhist_date,{$type} FROM {$uh} WHERE userhist_uid={$uid} ORDER BY userhist_date ASC";
     if (false === ($result = $db->queryRead($query))) {
         die(GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__)));
     }
     $invert = $type2 === 'rank';
     $highestValue = 0;
     //		$lowestValue = 2111222333;
     $xdata = array();
     $ydata = array();
     if ($type2 === 'totalscore') {
         $xdata[] = GWF_Time::getTimestamp($user->getVar('user_regdate'));
         $ydata[] = 0;
         //			$highestValue = 20;
     } elseif ($type2 === 'rank') {
         $xdata[] = GWF_Time::getTimestamp($user->getVar('user_regdate'));
         $ydata[] = 0;
         //			$del = GWF_User::DELETED;
         //			$ydata[] = -GDO::table('GWF_User')->countRows("user_options&$del=0");
         //			$highestValue = -$ydata[0];
     }
     while (false !== ($row = $db->fetchRow($result))) {
         $time = intval($row[0]);
         $xdata[] = $time;
         $value = intval($row[1]);
         $ydata[] = $invert ? -$value : $value;
         $highestValue = $value > $highestValue ? $value : $highestValue;
         //			$lowestValue = $value < $lowestValue ? $value : $lowestValue;
     }
     $db->free($result);
     // Now the Opponent
     if ($vs !== false) {
         $uid2 = $vs->getID();
         $query = "SELECT userhist_date,{$type} FROM {$uh} WHERE userhist_uid={$uid2} ORDER BY userhist_date ASC";
         if (false === ($result = $db->queryRead($query))) {
             die(GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__)));
         }
         $xdata2 = array();
         $ydata2 = array();
         if ($type2 === 'totalscore') {
             $xdata2[] = GWF_Time::getTimestamp($vs->getVar('user_regdate'));
             $ydata2[] = 0;
         } elseif ($type2 === 'rank') {
             $xdata2[] = GWF_Time::getTimestamp($vs->getVar('user_regdate'));
             $ydata2[] = 0;
             //				$del = GWF_User::DELETED;
             //				$ydata2[] = GDO::table('GWF_User')->countRows("user_options&$del=0");
             //				$highestValue = -$ydata2[0];
         }
         while (false !== ($row = $db->fetchRow($result))) {
             $time = intval($row[0]);
             $xdata2[] = $time;
             $value = intval($row[1]);
             $highestValue = $value > $highestValue ? $value : $highestValue;
             //				$lowestValue = $value < $lowestValue ? $value : $lowestValue;
             $ydata2[] = $invert ? -$value : $value;
         }
         $db->free($result);
     }
     if ($type2 === 'rank') {
         $ydata[0] = -$highestValue;
         $ydata2[0] = -$highestValue;
     }
     //		$this->max_rank = $highestValue;
     $dateformat = "M.y";
     $datemargin = strlen(date($dateformat)) * 11;
     //define the graph
     $graph = new Graph($this->module->cfgGraphWidth(), $this->module->cfgGraphHeight());
     if ($invert) {
         $graph->SetScale('datlin', -$highestValue, -1);
//.........这里部分代码省略.........
开发者ID:sinfocol,项目名称:gwf3,代码行数:101,代码来源:GraphUser.php


注:本文中的GWF_Time::getTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。