本文整理汇总了PHP中GWF_Session::getUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Session::getUserID方法的具体用法?PHP GWF_Session::getUserID怎么用?PHP GWF_Session::getUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_Session
的用法示例。
在下文中一共展示了GWF_Session::getUserID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: sanitize
private function sanitize()
{
$this->quoted = Common::getGet('quote') !== false;
if (false === ($pid = Common::getGet('pid'))) {
if (false === ($this->thread = $this->module->getCurrentThread())) {
return $this->module->error('err_post');
}
if (false === ($this->post = $this->thread->getLastPost())) {
// return $this->module->error('err_post');
}
$this->replyThread = true;
} elseif (false === ($this->post = $this->module->getCurrentPost())) {
return $this->module->error('err_post');
} else {
if (false === ($this->thread = $this->post->getThread())) {
return $this->module->error('err_post');
}
}
# Check Permission
$user = GWF_Session::getUser();
if (!$this->thread->hasReplyPermission($user, $this->module)) {
$a = GWF_HTML::display($this->post->getShowHREF());
return $this->module->error('err_reply_perm', array($a));
}
if (false !== ($last_post = $this->thread->getLastPost())) {
if ($last_post->getPosterID() === GWF_Session::getUserID()) {
if (!$this->module->cfgDoublePost()) {
$a = GWF_HTML::display($this->post->getShowHREF());
return $this->module->error('err_better_edit', array($a));
}
}
}
return false;
}
示例3: onVote
public function onVote(WC_Challenge $chall)
{
if ('0' === ($userid = GWF_Session::getUserID())) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
if (!WC_ChallSolved::hasSolved($userid, $chall->getID())) {
return $this->module->error('err_chall_vote');
}
$form = $this->getFormVote($chall, false, $userid);
if (false !== ($error = $form->validate($this->module))) {
return $error;
}
if (false !== ($vs = $chall->getVotesDif())) {
$vs->onUserVoteSafe($_POST['dif'], $userid);
}
if (false !== ($vs = $chall->getVotesEdu())) {
$vs->onUserVoteSafe($_POST['edu'], $userid);
}
if (false !== ($vs = $chall->getVotesFun())) {
$vs->onUserVoteSafe($_POST['fun'], $userid);
}
if (false === WC_ChallSolved::setVoted($userid, $chall->getID(), true)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $chall->onRecalcVotes()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_chall_voted');
}
示例4: 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()));
}
示例5: __wakeup
public function __wakeup()
{
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
$chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 2, 'challenge/are_you_serial/index.php');
}
$chall->onChallengeSolved(GWF_Session::getUserID());
}
示例6: dldc_cleanup
function dldc_cleanup()
{
$table = GDO::table('DLDC_User');
$table->deleteWhere("wechall_userid=" . GWF_Session::getUserID());
if ($table->affectedRows() > 0) {
echo GWF_HTML::message('Disclosures', 'We have deleted your old account for this challenge!', false);
}
}
示例7: getTicketCountStaff
private function getTicketCountStaff()
{
$uid = GWF_Session::getUserID();
$read = GWF_HelpdeskTicket::STAFF_READ;
if (0 == ($c = GDO::table('GWF_HelpdeskTicket')->countRows("hdt_worker={$uid} AND hdt_options&{$read}=0"))) {
return '';
}
return "[{$c}]";
}
示例8: www_basic_go
function www_basic_go(WC_Challenge $chall, $url, $content)
{
if (false === ($response = GWF_HTTP::getFromURL($url))) {
echo GWF_HTML::error('WWW Basics', $chall->lang('err_file_not_found'));
} elseif ($response !== $content) {
echo GWF_HTML::error('WWW Basics', $chall->lang('err_wrong', array(htmlspecialchars($response), htmlspecialchars($content), strlen($response), strlen($content))));
} else {
$chall->onChallengeSolved(GWF_Session::getUserID());
}
}
示例9: execute
public function execute()
{
GWF_Website::plaintext();
GWF3::setConfig('store_last_url', false);
$id = Common::getGetInt('pp_id');
if (!GWF_ProfilePOI::changeAllowed($id, GWF_Session::getUserID())) {
$this->module->ajaxError('Permission error!');
}
GDO::table('GWF_ProfilePOI')->deleteWhere("pp_id = {$id}");
die("{$id}");
}
示例10: sanitize
private function sanitize()
{
if (false === ($this->site = WC_Site::getByID(Common::getGetInt('siteid', 0)))) {
return array($this->module->lang('err_site'));
}
require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php';
if (!WC_SiteAdmin::isSiteAdmin(GWF_Session::getUserID(), $this->site->getID()) && !GWF_User::isAdminS()) {
return array(GWF_HTML::lang('ERR_NO_PERMISSION'));
}
return false;
}
示例11: onUnSubscribe
private function onUnSubscribe()
{
$back = $this->thread->getLastPageHREF();
if (!$this->thread->canUnSubscribe()) {
return $this->module->error('err_no_unsubscr', array($back));
}
if (false === GWF_ForumSubscription::unsubscribe(GWF_Session::getUserID(), $this->thread->getID())) {
return $this->module->error('err_unsubscr', array($back));
}
return $this->module->message('msg_unsubscribed', array($back));
}
示例12: wcc_ip6_check_answer
function wcc_ip6_check_answer(WC_Challenge $chall, $answer, $level)
{
require_once 'solutions.php';
if ($level === count($solutions)) {
$ip = $_SERVER['REMOTE_ADDR'];
if (GWF_IP6::isV6($ip)) {
$chall->onChallengeSolved(GWF_Session::getUserID());
}
return false;
}
return in_array(strtolower($answer), $solutions[$level], true);
}
示例13: templateShow
private function templateShow($translate)
{
$pm = $this->pm;
$pm->markRead(GWF_Session::getUser());
$sender = $this->module->lang('th_pm_from') . ' ' . $pm->getSender()->displayProfileLink();
$receiver = $this->module->lang('th_pm_to') . ' ' . $pm->getReceiver()->displayProfileLink();
if ('' === ($translated = $this->getTranslated($translate))) {
$translated = $pm->displayMessage();
}
$tVars = array('pm' => $this->pm, 'actions' => true, 'title' => $this->pm->display('pm_title'), 'unread' => GWF_PM::getUnreadPMs($this->module, GWF_Session::getUserID()), 'translated' => $translated, 'sender' => $sender, 'receiver' => $receiver, 'sendrec' => $pm->isRecipient() ? $sender : $receiver, 'transid' => 'pm_trans_' . $pm->getID(), 'buttons' => $this->getButtons($this->pm));
return $this->module->template('show.tpl', $tVars);
}
示例14: onUnSubscribe
private function onUnSubscribe($boardid)
{
if (false !== ($error = $this->sanitize($boardid))) {
return $error;
}
$userid = GWF_Session::getUserID();
if (false === GWF_ForumSubscrBoard::unsubscribe($userid, $boardid)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$href = htmlspecialchars($this->module->getMethodURL('Subscriptions'));
return $this->module->message('msg_unsubscrboard', array($href));
}
示例15: getCart
public static function getCart()
{
$sessid = GWF_Session::getSessID();
if (false !== ($cart = self::table(__CLASS__)->selectFirst("orderc_sessid='{$sessid}'"))) {
return $cart;
} else {
$cart = new self(array('orderc_uid' => GWF_Session::getUserID(), 'orderc_sessid' => $sessid));
if (false === $cart->insert()) {
return false;
}
return $cart;
}
}