當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GWF_User::getByName方法代碼示例

本文整理匯總了PHP中GWF_User::getByName方法的典型用法代碼示例。如果您正苦於以下問題:PHP GWF_User::getByName方法的具體用法?PHP GWF_User::getByName怎麽用?PHP GWF_User::getByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GWF_User的用法示例。


在下文中一共展示了GWF_User::getByName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 public function execute()
 {
     if (false === ($user = GWF_User::getByName(Common::getGetString('username')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false !== ($error = $this->module->isExcludedFromAPI($user, false))) {
         return $error;
     }
     $this->module->includeClass('WC_RegAt');
     $format = Common::getGetString('format', self::FORMAT);
     $bg = Common::getGetString('bg', self::BGCOLOR);
     $fg = Common::getGetString('fg', self::FGCOLOR);
     $size = Common::clamp(Common::getGetInt('s', self::SIZE), 6, 30);
     $spacingx = Common::clamp(Common::getGetInt('sx', 1), 0, 30);
     $spacingy = Common::clamp(Common::getGetInt('sy', 1), 0, 30);
     $marginx = Common::clamp(Common::getGetInt('mx', 1), 0, 30);
     $marginy = Common::clamp(Common::getGetInt('my', 1), 0, 30);
     $divider = Common::getGetString('div', '  ');
     $font = Common::getGetString('font', self::FONT);
     $_GET['font'] = $font;
     if (!preg_match('/^[a-z_0-9]+$/iD', $font) || !Common::isFile(GWF_EXTRA_PATH . 'font/' . $font . '.ttf')) {
         return "Font not found. Available fonts: " . $this->listFonts();
     }
     die($this->displayBanner($user, $format, $bg, $fg, $size, $spacingx, $spacingy, $marginx, $marginy, $divider));
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:25,代碼來源:API_UserBanner.php

示例2: execute

 public function execute()
 {
     if (false === ($user = GWF_User::getByName(Common::getGet('username')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     return $this->templateHistory($user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:7,代碼來源:HistoryText.php

示例3: templateSingleU

 private function templateSingleU($username)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     return $this->templateSingle($user->getCountryID(), $user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:7,代碼來源:RankingCountry.php

示例4: onRequest

 private function onRequest()
 {
     $form = $this->getForm();
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors . $this->form();
     }
     $email = Common::getPost('email', '');
     $user1 = GWF_User::getByName(Common::getPost('username'));
     $user2 = GWF_Validator::isValidEmail($email) ? GWF_User::getByEmail($email) : false;
     # nothing found
     if ($user1 === false && $user2 === false) {
         return $this->module->error('err_not_found') . $this->form();
     }
     # Two different users
     if ($user1 !== false && $user2 !== false && $user1->getID() !== $user2->getID()) {
         return $this->module->error('err_not_same_user') . $this->form();
     }
     # pick the user and send him mail
     if ($user1 !== false && $user2 !== false) {
         $user = $user1;
     } elseif ($user1 !== false) {
         $user = $user1;
     } elseif ($user2 !== false) {
         $user = $user2;
     }
     return $this->sendMail($user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:27,代碼來源:Form.php

示例5: templateRankingU

 private function templateRankingU($username)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     return $this->templateRanking($user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:7,代碼來源:Ranking.php

示例6: validate_username

 public function validate_username(Module_WeChall $m, $arg)
 {
     if (false === ($this->user = GWF_User::getByName($arg))) {
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     return false;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:7,代碼來源:Freeze.php

示例7: validate_username

 public function validate_username(Module_Ban $m, $arg)
 {
     if (false === ($this->user = GWF_User::getByName($arg))) {
         $_POST['username'] = '';
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     return false;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:8,代碼來源:Admin.php

示例8: onCrossLogin

 private function onCrossLogin($username)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         if (false === ($user = $this->onCrossRegister($username))) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     return $this->onCrossLoginB($user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:9,代碼來源:CrossLogin.php

示例9: outputLink

 private function outputLink($username, $email)
 {
     if (false === ($user = GWF_User::getByName($username))) {
         die('0');
     }
     if ($user->getValidMail() !== $email) {
         die('0');
     }
     die('1');
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:10,代碼來源:CrossSite.php

示例10: validate_user_name

 public function validate_user_name(Module_Profile $m, $arg)
 {
     if (!($this->user_to_add = GWF_User::getByName($arg))) {
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     if ($this->user_to_add->getID() == GWF_Session::getUserID()) {
         return $m->lang('err_self_whitelist');
     }
     return false;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:10,代碼來源:POISWhitelist.php

示例11: warscore_function

function warscore_function($socket, $pid)
{
    # Init GWF
    $gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'start_debug' => true, 'get_user' => false, 'log_request' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false));
    gdo_db();
    GWF_Debug::setDieOnError(false);
    GWF_HTML::init();
    if (false === ($wechall = GWF_Module::loadModuleDB('WeChall', true, true, true))) {
        warscore_error($socket, 'Cannot load WeChall!');
    }
    $wechall->includeClass('WC_Warbox');
    $wechall->includeClass('WC_WarToken');
    $wechall->includeClass('WC_Warflag');
    $wechall->includeClass('WC_Warflags');
    $wechall->includeClass('sites/warbox/WCSite_WARBOX');
    if (false === ($input = socket_read($socket, 2048))) {
        warscore_error($socket, 'Read Error 1!');
    }
    warscore_debug("GOT INPUT: {$input}");
    if (false === ($username = Common::substrUntil($input, "\n", false))) {
        warscore_error($socket, 'No username sent!');
    }
    if (false === ($user = GWF_User::getByName($username))) {
        warscore_error($socket, 'Unknown user!');
    }
    warscore_debug("GOT USER: {$username}");
    if ('' === ($token = Common::substrFrom($input, "\n", ''))) {
        warscore_error($socket, 'No token sent!');
    }
    $token = trim(Common::substrUntil($token, "\n", $token));
    if (!WC_WarToken::isValidWarToken($user, $token)) {
        warscore_error($socket, 'Invalid Token!');
    }
    if (!socket_getpeername($socket, $client_ip, $client_port)) {
        warscore_error($socket, 'Socket Error 2!');
    }
    echo "{$client_ip}\n";
    $boxes = WC_Warbox::getByIP($client_ip);
    if (count($boxes) === 0) {
        warscore_error($socket, 'Unknown Warbox!');
    }
    warscore_debug("GOT N BOXES: " . count($boxes));
    $curr_port = 0;
    foreach ($boxes as $box) {
        $box instanceof WC_Warbox;
        if ($curr_port !== $box->getVar('wb_port')) {
            $curr_port = $box->getVar('wb_port');
            warscore_identd($socket, $box, $user, $client_ip, $client_port);
        }
    }
    socket_write($socket, 'Bailing out! You should not see me.');
    socket_close($socket);
    die(0);
}
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:54,代碼來源:warserver.php

示例12: onLoginAs

 public function onLoginAs()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateLoginAs();
     }
     if (false === ($user = GWF_User::getByName($form->getVar('username')))) {
         return GWF_HTML::lang('ERR_UNKNOWN_USER');
     }
     GWF_Session::onLogin($user);
     return $this->module->message('msg_login_as', array($user->displayUsername()));
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:12,代碼來源:LoginAs.php

示例13: execute

 public function execute()
 {
     if (false === ($user = GWF_User::getByName(Common::getGet('username')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if ('' === ($email = $user->getValidMail()) || !$user->isOptionEnabled(GWF_User::ALLOW_EMAIL)) {
         return $this->module->error('err_no_mail');
     }
     if (false !== Common::getPost('send')) {
         return $this->send($user);
     }
     return $this->template($user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:13,代碼來源:SendMail.php

示例14: validate_username

 public function validate_username(Module_Admin $module, $arg)
 {
     $_POST['username'] = $arg = trim($arg);
     if ($this->user->getVar('user_name') === $arg) {
         return false;
     }
     if (GWF_User::getByName($arg) !== false) {
         return $this->module->lang('err_username_taken');
     }
     if (!GWF_Validator::isValidUsername($arg)) {
         return $this->module->lang('err_username');
     }
     return false;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:14,代碼來源:UserEdit.php

示例15: execute

 public function execute()
 {
     if (false === ($user = GWF_User::getByName(Common::getGet('username')))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if ($user->isDeleted()) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $uname = $user->displayUsername();
     GWF_Website::setPageTitle($this->module->lang('pt_profile', array($uname, $uname)));
     GWF_Website::setMetaTags($this->module->lang('mt_profile', array($uname, $uname)));
     GWF_Website::setMetaDescr($this->module->lang('md_profile', array($uname, $uname)));
     return $this->profile($user);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:14,代碼來源:Profile.php


注:本文中的GWF_User::getByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。