本文整理汇总了PHP中GWF_User::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_User::getVar方法的具体用法?PHP GWF_User::getVar怎么用?PHP GWF_User::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_User
的用法示例。
在下文中一共展示了GWF_User::getVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertFirstLink
public static function insertFirstLink(GWF_User $user, WC_Site $site, $onsitename, $onsitescore)
{
$table = self::table(__CLASS__);
$siteid = $site->getVar('site_id');
if (false !== $table->getRow($onsitename, $siteid)) {
return true;
}
$entry = new self(array('fili_onsitename' => $onsitename, 'fili_sid' => $siteid, 'fili_date' => GWF_Time::getDate(GWF_Date::LEN_DAY), 'fili_uid' => $user->getVar('user_id'), 'fili_username' => $user->getVar('user_name'), 'fili_sitename' => $site->getVar('site_name'), 'fili_percent' => $site->getPercent($onsitescore)));
// echo GWF_HTML::message('DEBUG', 'Insert First Link...');
return $entry->insert();
}
示例2: 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;
}
示例3: langUser
/**
* Get the translation for a user.
* A user can have two languages set, and there is browser lang as third fallback;
* Enter description here ...
* @param GWF_User $user
* @param unknown_type $key
* @param unknown_type $args
*/
public function langUser(GWF_User $user, $key, $args)
{
// Primary
$iso1 = $user->getVar('user_langid');
if (false !== $this->loadLanguage($iso1)) {
return $this->translate($iso1, $key, $args);
}
// Secondary
$iso2 = $user->getVar('user_langid2');
if (false !== $this->loadLanguage($iso2)) {
return $this->translate($iso2, $key, $args);
}
// Browser
return $this->translate(self::getBrowserISO(), $key, $args);
}
示例4: getGraphTitle
private function getGraphTitle()
{
if ($this->user2 === false) {
return $this->module->lang('pt_stats', array($this->user1->getVar('user_name')));
} else {
return $this->module->lang('pt_stats2', array($this->user1->getVar('user_name'), $this->user2->getVar('user_name')));
}
}
示例5: createPMOptions
private static function createPMOptions(GWF_User $user)
{
$row = new self(array('pmo_uid' => $user->getVar('user_id'), 'pmo_options' => 0, 'pmo_auto_folder' => 0, 'pmo_signature' => '', 'pmo_level' => 0));
if (false === $row->replace()) {
return false;
}
// $row->setVar('pmo_uid', $user);
return $row;
}
示例6: sendMail
private static function sendMail(Module_Account $module, GWF_User $user, array $data)
{
$token = GWF_AccountChange::createToken($user->getID(), 'demo', serialize($data));
$mail = new GWF_Mail();
$mail->setSender($module->cfgMailSender());
$mail->setReceiver($user->getVar('user_email'));
$mail->setSubject($module->lang('chdemo_subj'));
$username = $user->display('user_name');
$timeout = GWF_Time::humanDuration($module->cfgChangeTime());
$gender = GWF_HTML::display($user->getVar('user_gender'));
$country = GWF_Country::getByIDOrUnknown($data['user_countryid'])->display('country_name');
$lang1 = GWF_Language::getByIDOrUnknown($data['user_langid'])->display('lang_nativename');
$lang2 = GWF_Language::getByIDOrUnknown($data['user_langid2'])->display('lang_nativename');
$gender = GWF_HTML::lang('gender_' . $data['user_gender']);
$birthdate = $data['user_birthdate'] > 0 ? GWF_Time::displayDate($data['user_birthdate'], true, 1) : GWF_HTML::lang('unknown');
$link = self::getChangeLink($user->getID(), $token);
$mail->setBody($module->lang('chdemo_body', array($username, $timeout, $gender, $country, $lang1, $lang2, $birthdate, $link)));
return $mail->sendToUser($user) ? $module->message('msg_mail_sent') : GWF_HTML::err('ERR_MAIL_SENT');
}
示例7: insertNote
public static function insertNote(GWF_User $user, $note)
{
# no empty notes
if ($note === '') {
return false;
}
# insert it
$entry = new self(array('accrm_uid' => $user->getVar('user_id'), 'accrm_note' => $note));
if (false === $entry->replace()) {
return false;
}
return $note;
}
示例8: sendEmail
private static function sendEmail(Module_Account $module, GWF_User $user, $newMail)
{
$mail = new GWF_Mail();
$mail->setReceiver($user->getVar('user_email'));
$mail->setSender($module->cfgMailSender());
$mail->setSubject($module->lang('chmaila_subj'));
$newmail = trim(Common::getPost('email'));
$link = self::createLink($module, $user, $newMail);
$mail->setBody($module->lang('chmaila_body', array($user->display('user_name'), $link)));
if ($mail->sendToUser($user)) {
return $module->message('msg_mail_sent');
} else {
return GWF_HTML::err('ERR_MAIL_SENT');
}
}
示例9: calcRank
private function calcRank(GWF_User $user, $bit)
{
$db = gdo_db();
$bit = (int) $bit;
$uid = $user->getVar('user_id');
$score = $this->calcScore($user, $bit);
$regat = GWF_TABLE_PREFIX . 'wc_regat';
$query = "SELECT regat_uid, SUM(regat_score) AS sum " . "FROM {$regat} " . "WHERE regat_tagbits&{$bit} AND regat_options&4=0 " . "GROUP BY regat_uid " . "HAVING sum>{$score} OR (sum={$score} AND regat_uid<{$uid})";
if (false === ($result = $db->queryRead($query, false))) {
return -1;
}
$back = (int) $db->numRows($result);
$db->free($result);
return $back + 1;
}
示例10: templateChalls
public function templateChalls(GWF_User $user)
{
$whitelist = array('chall_score', 'chall_title', 'chall_creator_name', 'chall_solvecount', 'chall_date', 'chall_dif', 'chall_edu', 'chall_fun', 'csolve_date', 'csolve_time_taken');
require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
$challs = GDO::table('WC_Challenge');
$db = gdo_db();
$uid = $user->getVar('user_id');
$challs = GWF_TABLE_PREFIX . 'wc_chall';
$solved = GWF_TABLE_PREFIX . 'wc_chall_solved';
$by = GDO::getWhitelistedByS(Common::getGet('pcby'), $whitelist, self::DEFAULT_BY);
$dir = GDO::getWhitelistedDirS(Common::getGet('pcdir'), self::DEFAULT_DIR);
$orderby = "ORDER BY {$by} {$dir}";
$query = "SELECT c.*, s.* FROM {$challs} c LEFT JOIN {$solved} s ON c.chall_id=s.csolve_cid AND s.csolve_uid={$uid} {$orderby}";
$tVars = array('data' => $db->queryAll($query), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Profile&me=Profile&username=' . $user->urlencode('user_name') . '&pcby=%BY%&pcdir=%DIR%#wc_profile_challenges', 'table_title' => $this->module->lang('tt_challs_for', array('', $user->display('user_name'))));
return $this->module->templatePHP('challs_profile.php', $tVars);
}
示例11: onViewed
public static function onViewed(GWF_User $user)
{
$userid = $user->getID();
$av = $user->getVar('user_avatar_v');
if (false === ($row = self::getByID($userid))) {
$row = new self(array('ag_uid' => $userid, 'ag_hits' => 1, 'ag_version' => $av));
if (false === $row->insert()) {
return false;
}
$row->setVar('ag_uid', $user);
return true;
}
if ($row->getVar('ag_version') !== $av) {
return $row->saveVars(array('ag_hits' => 1, 'ag_version' => $av));
}
return $row->increase('ag_hits', 1);
}
示例12: getUnreadForum
/**
* Get Forum Unread Counter - Quickhook for topmenu.
* @param array(GWF_User $user)
* @return string the counter enclosed in [counter]
* @todo create countUnread()
*/
public static function getUnreadForum(GWF_User $user, $pattern = '[%s]', $default = '[0]')
{
if (false === self::loadModuleClass('Forum', 'GWF_ForumThread.php')) {
return '';
}
if (true === $user->isGuest() || true === $user->isWebspider()) {
return '';
}
$uid = $user->getID();
$data = $user->getUserData();
$grp = GWF_TABLE_PREFIX . 'usergroup';
$permquery = "(thread_gid=0 OR (SELECT 1 FROM {$grp} WHERE ug_userid={$uid} AND ug_groupid=thread_gid))";
$stamp = isset($data['GWF_FORUM_STAMP']) ? $data['GWF_FORUM_STAMP'] : $user->getVar('user_regdate');
$regtimequery = sprintf('thread_lastdate>=\'%s\'', $stamp);
$conditions = "( (thread_postcount>0) AND ({$permquery}) AND ({$regtimequery} OR thread_force_unread LIKE '%:{$uid}:%') AND (thread_unread NOT LIKE '%:{$uid}:%') AND (thread_options&4=0) )";
if (false === ($count = GDO::table('GWF_ForumThread')->selectVar('COUNT(*)', $conditions))) {
return '';
# DB Error
}
return $count === '0' ? $default : sprintf($pattern, $count);
}
示例13: hookDeleteUser
public static function hookDeleteUser(GWF_User $user)
{
$uid = $user->getVar('user_id');
$pms = self::table(__CLASS__);
$del = self::OWNER_DELETED;
if (false === $pms->update("pm_options=pm_options|{$del}", "pm_owner={$uid}")) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$del = self::OTHER_DELETED;
if (false === $pms->update("pm_options=pm_options|{$del}", "pm_from={$uid}")) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
示例14: wcProfileUsergroup
function wcProfileUsergroup(GWF_User $user, $is_logged_in)
{
$ug = GWF_TABLE_PREFIX . 'usergroup';
$userid = $user->getVar('user_id');
if (false === gdo_db()->queryFirst("SELECT 1 FROM {$ug} WHERE ug_userid={$userid}")) {
return '';
}
if (false === ($mod_ug = GWF_Module::loadModuleDB('Usergroups'))) {
return '';
}
$mod_ug instanceof Module_Usergroups;
$groups = $mod_ug->getGroups($user);
foreach ($groups as $group) {
if ($group->isAskToJoin()) {
echo sprintf('<h2>%s</h2>', WC_HTML::lang('pi_ug_info', array($user->displayUsername(), $group->display('group_name'), $group->getVar('group_memberc'))));
if ($is_logged_in) {
echo sprintf('<h3>%s</h3>', WC_HTML::lang('pi_ug_join', array(GWF_WEB_ROOT . 'index.php?mo=Usergroups&me=Join&gid=' . $group->getID())));
} else {
echo sprintf('<h3>%s</h3>', WC_HTML::lang('pi_ug_register', array(GWF_WEB_ROOT . 'register')));
}
} else {
}
}
return '';
}
示例15: onThanks
public function onThanks(Module_Forum $module, GWF_User $user)
{
$data = array('post_thanks_by' => $this->getVar('post_thanks_by') . $user->getVar('user_id') . ':', 'post_thanks_txt' => $this->getVar('post_thanks_txt') . $user->getVar('user_name') . ':', 'post_thanks' => $this->getThanksCount() + 1);
if (false === $this->saveVars($data)) {
return false;
# DB error
}
if (false === $this->getThread()->increase('thread_thanks', 1)) {
return false;
}
# Increase Users total thanks counter
if (false !== ($user = $this->getUser(false))) {
if (false !== ($options = GWF_ForumOptions::getUserOptions($this->getUser(false)))) {
$options->increase('fopt_thanks', 1);
}
}
return true;
}