本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例6: calcTimeTaken
public function calcTimeTaken($now)
{
return GWF_Time::getTimestamp($now) - GWF_Time::getTimestamp($this->getVar('csolve_1st_look'));
}
示例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());
}
示例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();
}
示例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;
//.........这里部分代码省略.........
示例10: getLastPostTime
private function getLastPostTime($user)
{
if (false === ($result = GDO::table('GWF_ForumPost')->selectVar('MAX(post_date)'))) {
return 0;
}
return GWF_Time::getTimestamp($result);
}
示例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);
//.........这里部分代码省略.........