本文整理汇总了PHP中GWF_Time::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Time::getDate方法的具体用法?PHP GWF_Time::getDate怎么用?PHP GWF_Time::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_Time
的用法示例。
在下文中一共展示了GWF_Time::getDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()));
}
示例2: 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;
}
示例3: 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;
}
示例4: 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');
}
示例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: 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;
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: insertCrackord
public static function insertCrackord(WC_Challenge $chall, $uid, $start, $time, $solved, $count)
{
if ($count === 0) {
return true;
}
$failed = $count - $solved;
$rate = $count > 0 ? $solved / $count * 100 : 0;
$entry = new self(array('wccc_id' => 0, 'wccc_uid' => $uid, 'wccc_start' => GWF_Time::getDate(GWF_DATE::LEN_SECOND, intval($start)), 'wccc_time' => intval(round($time)), 'wccc_rate' => round($rate, 2), 'wccc_count' => $count, 'wccc_solved' => $solved, 'wccc_failed' => $failed));
return $entry->insert();
}
示例11: onCrossRegister
private function onCrossRegister($username)
{
$options = 0;
$password = GWF_Random::randomKey();
$user = new GWF_User(array('user_id' => 0, 'user_options' => $options, 'user_name' => $username, 'user_password' => GWF_Password::hashPasswordS($password), 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT), 'user_email' => '', 'user_gender' => 'no_gender', 'user_lastlogin' => time(), 'user_lastactivity' => time(), 'user_birthdate' => '00000000', 'user_avatar_v' => 0, 'user_countryid' => 0, 'user_langid' => 1, 'user_langid2' => 0, 'user_level' => 0, 'user_title' => '', 'user_settings' => '', 'user_data' => '', 'user_credits' => '0.00'));
if (false === $user->insert()) {
return false;
}
return true;
}
示例12: 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';
}
示例13: insertPlayed
/**
* Insert a song into the play history.
* @param Slay_Song $song
* @param int $time_end
*/
public static function insertPlayed(Slay_Song $song, $time_end)
{
if (self::getLastID() === $song->getID()) {
return true;
}
$date = GWF_Time::getDate(GWF_Date::LEN_SECOND, $time_end - $song->getVar('ss_duration'));
if (false === $song->saveVar('ss_last_played', $date)) {
return false;
}
return self::table(__CLASS__)->insertAssoc(array('sph_id' => 0, 'sph_sid' => $song->getID(), 'sph_date' => $date), false);
}
示例14: installPMBot
private static function installPMBot(Module_PM $module)
{
$user = new GWF_User(array('user_name' => '_GWF_PM_BOT_', 'user_password' => 'x', 'user_regdate' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'user_regip' => GWF_IP6::getIP(GWF_IP_EXACT, '127.0.0.1'), 'user_email' => GWF_BOT_EMAIL, 'user_birthdate' => GWF_Time::getDate(GWF_Time::LEN_DAY), 'user_countryid' => 0, 'user_langid' => 0, 'user_options' => GWF_User::BOT, 'user_lastactivity' => time()));
if (false === $user->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === GWF_ModuleLoader::saveModuleVar($module, 'pm_bot_uid', $user->getID())) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
示例15: insertSuccess
public static function insertSuccess(WC_Warflag $flag, GWF_User $user)
{
if (false !== ($entry = self::getByFlagUser($flag, $user))) {
if (!$entry->getVar('wf_solved_at')) {
return $entry->saveVars(array('wf_attempts' => $entry->getVar('wf_attempts') + 1, 'wf_last_attempt' => NULL, 'wf_solved_at' => GWF_Time::getDate()));
} else {
return true;
}
}
return self::table(__CLASS__)->insertAssoc(array('wf_wfid' => $flag->getID(), 'wf_uid' => $user->getID(), 'wf_solved_at' => GWF_Time::getDate(), 'wf_attempts' => '1', 'wf_last_attempt' => NULL));
}