本文整理汇总了PHP中GWF_Time类的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Time类的具体用法?PHP GWF_Time怎么用?PHP GWF_Time使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GWF_Time类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public static function execute(SR_Player $player, array $args)
{
$bot = Shadowrap::instance($player);
if (!$player->getParty()->isIdle()) {
$player->msg('1033');
return false;
// return $player->message('Your party needs to be idle to request a new leader.');
}
if ($player->isLeader()) {
$player->msg('1095');
return false;
// return $bot->reply('You are already leader of your party.');
}
$party = $player->getParty();
$leader = $party->getLeader();
$user = $leader->getUser();
$last = $user->getVar('lusr_timestamp');
$wait = $last + self::RL_TIME - time();
if ($leader->isOptionEnabled(SR_Player::NO_RL)) {
self::rply($player, '1096');
return false;
// return $bot->reply('Your leader does not allow to takeover the leadership.');
}
if ($wait > 0) {
self::rply($player, '1097', array(GWF_Time::humanDuration($wait)));
return false;
// return $bot->reply(sprintf('Please wait %s and try again.', GWF_Time::humanDuration($wait)));
}
if (false === $party->setLeader($player)) {
return $bot->reply('Database Error.');
}
return $party->ntice('5138', array($player->getName()));
// return $party->notice(sprintf('%s is the new party leader.', $player->getName()));
}
示例2: 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;
}
示例3: onAdd
private function onAdd()
{
$form = $this->formAdd();
if (false !== ($error = $form->validate($this->module))) {
return $error . $this->templateAdd();
}
$file = $form->getVar('file');
$tmp = $file['tmp_name'];
$postid = $this->post->getID();
$userid = GWF_Session::getUserID();
$options = 0;
$options |= isset($_POST['guest_view']) ? GWF_ForumAttachment::GUEST_VISIBLE : 0;
$options |= isset($_POST['guest_down']) ? GWF_ForumAttachment::GUEST_DOWNLOAD : 0;
# Put in db
$attach = new GWF_ForumAttachment(array('fatt_aid' => 0, 'fatt_uid' => $userid, 'fatt_pid' => $postid, 'fatt_mime' => GWF_Upload::getMimeType($tmp), 'fatt_size' => filesize($tmp), 'fatt_downloads' => 0, 'fatt_filename' => $file['name'], 'fatt_options' => $options, 'fatt_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND)));
if (false === $attach->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$aid = $attach->getID();
# Copy file
$path = $attach->dbimgPath();
if (false === GWF_Upload::moveTo($file, $path)) {
@unlink($tmp);
return GWF_HTML::err('ERR_WRITE_FILE', $path);
}
@unlink($tmp);
$this->post->increase('post_attachments', 1);
return $this->module->message('msg_attach_added', array($this->post->getShowHREF()));
}
示例4: onAddBan
private function onAddBan()
{
$form = $this->getFormBan();
if (false !== ($errors = $form->validate($this->module))) {
return $errors;
}
$perm = $form->getVar('perm');
$ban = $form->getVar('type');
$ends = $form->getVar('ends');
$msg = $form->getVar('msg');
$userid = $this->user->getID();
if ($ban) {
if ($perm) {
$ends = '';
} elseif ($ends === '') {
return $this->module->error('err_perm_or_date');
} elseif ($ends < date('YmdHis')) {
return $this->module->error('err_future_is_past');
}
GWF_Ban::insertBan($userid, $ends, $msg);
if ($ends === '') {
return $this->module->message('msg_permbanned', array($this->user->displayUsername()));
} else {
return $this->module->message('msg_tempbanned', array($this->user->displayUsername(), GWF_Time::displayDate($ends)));
}
} else {
GWF_Ban::insertWarning($userid, $msg);
return $this->module->message('msg_warned', array($this->user->displayUsername()));
}
}
示例5: onAddSite
public function onAddSite()
{
$form = $this->getForm();
if (false !== ($error = $form->validate($this->module))) {
return $error . $this->templateSiteAdd();
}
$site = new WC_Site(array('site_status' => 'wanted', 'site_name' => $form->getVar('site_name'), 'site_classname' => $form->getVar('site_classname'), 'site_country' => 0, 'site_language' => 0, 'site_joindate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'site_launchdate' => '', 'site_authkey' => GWF_Random::randomKey(32), 'site_xauthkey' => GWF_Random::randomKey(32), 'site_irc' => '', 'site_url' => '', 'site_url_mail' => '', 'site_url_score' => '', 'site_url_profile' => '', 'site_score' => 0, 'site_basescore' => 0, 'site_avg' => 0, 'site_vote_dif' => 0, 'site_vote_fun' => 0, 'site_challcount' => 0, 'site_usercount' => 0, 'site_visit_in' => 0, 'site_visit_out' => 0, 'site_options' => 0, 'site_boardid' => 0, 'site_threadid' => 0, 'site_tags' => ''));
if (false === $site->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
Module_WeChall::includeVotes();
if (false === $site->onCreateVotes()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
Module_WeChall::includeForums();
if (false === $site->onCreateBoard()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $site->onCreateThread($this->module)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteDescr.php';
if (false === WC_SiteDescr::insertDescr($site->getID(), 1, 'Please edit me :)')) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_site_added');
}
示例6: onCleanupUntagged
private function onCleanupUntagged()
{
$songs = GDO::table('Slay_Song');
$cut = GWF_Time::getDate(14, time() - 3600);
$songs->deleteWhere("ss_taggers=0 AND ss_last_played<'{$cut}'");
return $this->module->message('msg_cleanup');
}
示例7: markSolved
public static function markSolved(GWF_User $user, WC_Warchall $chall)
{
if (!self::table(__CLASS__)->insertAssoc(array('wc_wcid' => $chall->getID(), 'wc_uid' => $user->getID(), 'wc_solved_at' => GWF_Time::getDate(14)))) {
return false;
}
return true;
}
示例8: getArchiveName
private function getArchiveName()
{
if ($this->archiveName === false) {
return sprintf('www/protected/zipped/%s_%s.zip', GWF_Time::getDate(GWF_Date::LEN_SECOND), implode(',', $this->style));
} else {
return $this->archiveName;
}
}
示例9: createPeak
public static function createPeak($cid, $count = 0, $options = 0)
{
$peak = new self(array('lcpeak_cid' => $cid, 'lcpeak_peak' => $count, 'lcpeak_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'lcpeak_options' => 0));
if (false === $peak->replace()) {
return false;
}
return $peak;
}
示例10: insertQuote
/**
* Insert a new quote.
* @param string $username
* @param string $text
* @return Dog_Quote
*/
public static function insertQuote($username, $text)
{
$quote = new self(array('quot_id' => 0, 'quot_text' => $text, 'quot_username' => $username, 'quot_rating' => 0, 'quot_date' => GWF_Time::getDate(14)));
if (false === $quote->insert()) {
return false;
}
return $quote;
}
示例11: resetTimer
public function resetTimer(SR_Player $player)
{
$time = Seattle::TIME_TO_DELAWARE + 60;
$player->setConst('__AURIS_TIMEOUT', Shadowrun4::getTime() + $time);
$player->message($this->lang('fluid', array(GWF_Time::humanDuration($time))));
// $player->message(sprintf("Your pot of Auris is fluid for %s.", GWF_Time::humanDuration($time)));
return true;
}
示例12: insert_bot
private static function insert_bot($botname)
{
$user = new GWF_User(array('user_id' => 0, 'user_options' => GWF_User::BOT | GWF_User::WEBSPIDER, 'user_name' => $botname, 'user_password' => GWF_Password::hashPasswordS('webspider'), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT, '127.0.0.1'), 'user_email' => '', 'user_gender' => 'no_gender', 'user_lastlogin' => 0, 'user_lastactivity' => 0, 'user_birthdate' => '00000000', 'user_avatar_v' => 0, 'user_countryid' => 0, 'user_langid' => 0, 'user_langid2' => 0, 'user_level' => 0, 'user_title' => '', 'user_settings' => NULL, 'user_data' => NULL, 'user_credits' => 0.0));
if (false === $user->insert()) {
return false;
}
echo "Inserted new Bot: {$botname}<br/>";
return $user;
}
示例13: cast
public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
{
$dur = $this->getSpellDuration($potion_player, $target, $level, $hits);
$by = $this->getSpellIncrement($potion_player, $target, $level, $hits);
$by = $this->lowerSpellIncrement($target, $by, 'min_dmg');
$mod = array('min_dmg' => $by, 'max_dmg' => $by * 2);
$target->addEffects(new SR_Effect($dur, $mod));
$this->announceADV($player, $target, $level, '10010', $by, $by * 2, GWF_Time::humanDuration($dur));
return true;
}
示例14: checkUser
public static function checkUser(Module_Download $module, GWF_Download $dl, $user)
{
if ($user === false) {
return false;
}
$id = $dl->getID();
$uid = $user->getID();
$now = GWF_Time::getDate(GWF_Date::LEN_SECOND);
return self::table(__CLASS__)->selectVar('1', "dlt_dlid={$id} AND dlt_uid={$uid} AND (dlt_expires='' OR dlt_expires>'{$now}')") === '1';
}
示例15: deleteOldActivations
private static function deleteOldActivations(Module_Register $module)
{
$cut = time() - $module->getActivationThreshold();
self::log('Deleting user activations older than ' . GWF_Time::displayTimestamp($cut));
$table = new GWF_UserActivation(false);
$result = $table->deleteWhere("timestamp<{$cut}");
if (0 < ($nDeleted = $table->affectedRows($result))) {
self::log(sprintf('Deleted %d old user activations.', $nDeleted));
}
}