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


PHP GWF_User::getByID方法代码示例

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


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

示例1: sanitize

 private function sanitize()
 {
     if (false === ($this->user = GWF_User::getByID(Common::getGet('uid')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:UserEdit.php

示例2: execute

 public function execute()
 {
     if (false === ($user = GWF_User::getByID(Common::getGet('userid')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $tmpfile = GWF_PATH . 'extra/temp/gpg/' . $user->getVar('user_id');
     if (!is_file($tmpfile) || !is_readable($tmpfile)) {
         return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($tmpfile));
     }
     if (false === ($file_content = file_get_contents($tmpfile))) {
         return GWF_HTML::err('ERR_FILE_NOT_FOUND', array($tmpfile));
     }
     if (false === unlink($tmpfile)) {
         return GWF_HTML::err('ERR_WRITE_FILE', array($tmpfile));
     }
     if (false === ($fingerprint = GWF_PublicKey::grabFingerprint($file_content))) {
         return $this->module->error('err_gpg_key');
     }
     if (Common::getGet('token') !== $fingerprint) {
         return $this->module->error('err_gpg_token');
     }
     if (false === GWF_PublicKey::updateKey($user->getID(), $file_content)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $user->saveOption(GWF_User::EMAIL_GPG, true)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_setup_gpg');
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:SetupGPGKey.php

示例3: insertEntry

 public static function insertEntry(GWF_User $user, WC_Site $site, $onsitescore, $comment)
 {
     $user = GWF_User::getByID($user->getID());
     $max = $site->getOnsiteScore();
     $perc = $max <= 0 ? 0 : round($onsitescore / $max * 10000);
     $entry = new self(array('userhist_uid' => $user->getVar('user_id'), 'userhist_date' => time(), 'userhist_sid' => $site->getVar('site_id'), 'userhist_percent' => $perc, 'userhist_onsitescore' => $onsitescore, 'userhist_rank' => WC_RegAt::calcRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_comment' => $comment));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:WC_HistoryUser.php

示例4: onShowAvatar

 private function onShowAvatar($userid)
 {
     if (false === ($user = GWF_User::getByID($userid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === GWF_AvatarGallery::onViewed($user)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     GWF_Website::redirect(GWF_WEB_ROOT . 'profile/' . $user->urlencode('user_name'));
     return "Redirecting...";
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:AvatarGallery.php

示例5: onMailTicket

 private function onMailTicket(GWF_HelpdeskTicket $ticket, GWF_HelpdeskMsg $message)
 {
     $admin = GWF_Group::ADMIN;
     $staff = GWF_Group::STAFF;
     $staff = GDO::table('GWF_UserGroup')->selectColumn('DISTINCT(ug_userid)', "group_name='{$admin}' OR group_name='{$staff}'", '', array('group'));
     foreach ($staff as $userid) {
         if (false !== ($user = GWF_User::getByID($userid))) {
             $this->onMailTicketB($ticket, $message, $user);
         }
     }
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:CreateTicket.php

示例6: execute

 public function execute()
 {
     if (false === ($user = GWF_User::getByID(intval(Common::getGet('uid', '0'))))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $user->loadGroups();
     if (false !== Common::getPost('add_to_group')) {
         return $this->onAddToGroup($user) . $this->showGroups($user);
     }
     return $this->showGroups($user);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:UserGroup.php

示例7: onDelete

 private function onDelete($id, $token, $uid)
 {
     if (false === ($pm = GWF_PM::getByID($id))) {
         return $this->module->error('err_pm');
     }
     if ($token != $pm->getHashcode()) {
         echo $pm->getHashcode();
         return $this->module->error('err_pm');
     }
     if (false === ($user = GWF_User::getByID($uid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === $pm->markDeleted($user)) {
         return $this->module->error('err_del_twice');
     }
     return $this->module->message('msg_deleted', array('1'));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:17,代码来源:Delete.php

示例8: execute

 public function execute()
 {
     if (false === ($ticket = GWF_HelpdeskTicket::getByID(Common::getGetString('ticket')))) {
         return $this->module->error('err_ticket');
     }
     if (false === ($user = GWF_User::getByID(Common::getGetString('worker')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $user->loadGroups();
     if (!$user->isAdmin() && !$user->isStaff()) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (!$ticket->isOpen()) {
         return $this->module->error('err_not_open');
     }
     if ($ticket->getHashcode() !== Common::getGetString('token')) {
         return $this->module->error('err_token');
     }
     return $this->onAssign($ticket, $user);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:AssignWork.php

示例9: acceptByToken

 private function acceptByToken($token)
 {
     $uid = (int) Common::getGet('uid');
     $gid = (int) Common::getGet('gid');
     if (false === ($group = GWF_Group::getByID($gid))) {
         return GWF_HTML::err('ERR_UNKNOWN_GROUP');
     }
     if (false === ($request = GWF_UsergroupsInvite::getRequestRow($uid, $gid))) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (false === ($user = GWF_User::getByID($uid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if ($token !== $request->getHashcode()) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if (false === GWF_UserGroup::addToGroup($uid, $gid)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_joined', array($group->getName()));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:21,代码来源:Accept.php

示例10: onChange

 private function onChange($token)
 {
     $userid = (int) Common::getGet('userid');
     if (false === ($ac = GWF_AccountChange::checkToken($userid, $token, 'demo'))) {
         return $this->module->error('err_token');
     }
     if (false === ($user = GWF_User::getByID($userid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === ($data = @unserialize($ac->getVar('data')))) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if (false === $user->saveVars($data)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $ac->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     GWF_AccountChange::createToken($userid, 'demo_lock');
     return $this->module->message('msg_demo_changed');
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:21,代码来源:ChangeDemo.php

示例11: onSendB

 private function onSendB($email, $message)
 {
     $admin = GWF_Group::ADMIN;
     if (false === ($adminids = GDO::table('GWF_UserGroup')->selectColumn('ug_userid', "group_name='{$admin}'", '', array('group')))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $send_to = array();
     foreach ($adminids as $userid) {
         if (false === ($user = GWF_User::getByID($userid))) {
             continue;
         }
         if (false === $user->hasValidMail()) {
             continue;
         }
         if (false === $this->onSendC($email, $message, $user)) {
             continue;
         }
         $send_to[] = $user->displayUsername();
     }
     return $send_to === '' ? GWF_HTML::err('ERR_MAIL_SENT') : $this->module->message('msg_mailed', array(GWF_Array::implodeHuman($send_to)));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:21,代码来源:Form.php

示例12: templateOutput

 public function templateOutput($date, $amt)
 {
     require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
     $table = GDO::table('WC_ChallSolved');
     if (false === ($result = $table->selectAll('*', "csolve_date>='{$date}'", 'csolve_date DESC', NULL, $amt))) {
         return '';
     }
     $back = '';
     foreach ($result as $row) {
         if (false === ($user = GWF_User::getByID($row['csolve_uid']))) {
             continue;
         }
         if (false === ($chall = WC_Challenge::getByID($row['csolve_cid']))) {
             continue;
         }
         $row['username'] = $user->getVar('user_name');
         $row['challname'] = $chall->getVar('chall_title');
         $row['solvecount'] = $chall->getVar('chall_solvecount');
         $row['curl'] = $chall->getVar('chall_url');
         $row = array_map(array(__CLASS__, 'escapeCSV'), $row);
         $back .= implode('::', $row) . PHP_EOL;
     }
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:24,代码来源:API_ChallSolved.php

示例13: newNews

 public static function newNews($date, $catid, $userid, $langid, $title, $message, $fake = false, $options = 0)
 {
     $news = new GWF_News(array('news_date' => $date, 'news_catid' => $catid, 'news_userid' => $userid, 'news_readby' => ':', 'news_options' => $options));
     if ($fake === false) {
         if (false === $news->insert()) {
             return false;
         }
     } else {
         $news->setVar('news_id', '0');
     }
     $transdata = array('newst_langid' => $langid, 'newst_newsid' => $news->getID(), 'newst_title' => $title, 'newst_message' => $message, 'newst_options' => '0', 'newst_threadid' => '0');
     if ($fake === false) {
         $trans = new GWF_NewsTranslation($transdata);
         if (false === $trans->insert()) {
             return false;
         }
     } else {
         // 			$news->setVar('news_trans', array($langid=>$transdata));
         $news->setVar('news_userid', GWF_User::getByID($userid));
         $news->translations = array($transdata);
     }
     return $news;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:23,代码来源:GWF_News.php

示例14: onRemFromGroup

 public function onRemFromGroup($uid)
 {
     $uid = (int) $uid;
     $gid = $this->group->getID();
     if (false === GDO::table('GWF_UserGroup')->deleteWhere("ug_userid={$uid} AND ug_groupid={$gid}")) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === GWF_UserGroup::fixGroupMC()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_removed_from_grp', array(GWF_User::getByID($uid)->displayUsername(), $this->group->display('group_name')));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:GroupEdit.php

示例15: onUnFreeze

 private function onUnFreeze($data)
 {
     if (false !== ($err = GWF_Form::validateCSRF_WeakS())) {
         return GWF_HTML::error('WeChall', $err);
     }
     if (!is_array($data)) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     foreach ($data as $key => $value) {
         break;
     }
     $data = explode(',', $key);
     if (count($data) !== 2) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     $userid = intval($data[0]);
     $siteid = intval($data[1]);
     if (false === ($user = GWF_User::getByID($userid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === ($site = WC_Site::getByID($siteid))) {
         return $this->module->error('err_site');
     }
     if (WC_Freeze::isUserFrozenOnSite($userid, $siteid)) {
         # Unfreeze
         if (false === WC_Freeze::unfreezeUser($userid, $siteid)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         # Insert event.
         $rank = WC_RegAt::calcExactRank($user);
         WC_HistoryUser2::insertEntry($user, $site, 'unban');
     }
     # Done
     return $this->module->message('msg_unfrozen', array($user->displayUsername(), $site->displayName()));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:35,代码来源:Freeze.php


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