本文整理汇总了PHP中GWF_Session::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Session::getUser方法的具体用法?PHP GWF_Session::getUser怎么用?PHP GWF_Session::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_Session
的用法示例。
在下文中一共展示了GWF_Session::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSign
private function onSign()
{
if (!$this->module->isNewsletterForGuests() && !GWF_Session::isLoggedIn()) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
$user = GWF_Session::getUser();
$row = GWF_Newsletter::getRowForUser($user);
$form = $this->getForm($row);
if (false !== ($error = $form->validate($this->module))) {
return $error . $this->templateSign();
}
$email = $form->getVar('email');
$type = (int) $form->getVar('type');
$langid = $form->getVar('langid');
$newsletter = new GWF_Newsletter(false);
if (false === ($row = $newsletter->getRow($email))) {
return $this->onNewSign($email, $type, $langid) . $this->templateSign();
}
$back = '';
if ($langid !== $row->getVar('nl_langid')) {
$back .= $this->module->message('msg_changed_lang');
$row->saveVar('nl_langid', $langid);
}
if ($row->getType() !== $type) {
$back .= $this->module->message('msg_changed_type');
$row->saveType($type);
}
return $back . $this->templateSign();
}
示例2: onThanks
private function onThanks()
{
if (false === ($post = $this->module->getCurrentPost())) {
return $this->module->error('err_post');
}
if (false === $this->module->cfgThanksEnabled()) {
return $this->module->error('err_thanks_off');
}
if (false === ($user = GWF_Session::getUser())) {
return GWF_HTML::err('ERR_GENERAL', __FILE__, __LINE__);
}
if ($post->hasThanked($user)) {
return $this->module->error('err_thank_twice');
}
if ($post->getUserID() === $user->getID()) {
return $this->module->error('err_thank_self');
}
if (false === $post->onThanks($this->module, $user)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
if ($this->module->isAjax()) {
return '1:' . $post->getThanksCount();
} else {
return $this->module->message('msg_thanked', $post->getShowHREF());
}
}
示例3: onSign
private function onSign(GWF_Guestbook $gb, $gbe = false)
{
$form = $this->getForm($gb);
if (false !== ($errors = $form->validate($this->module))) {
return $errors . $this->templateSign($gb);
}
if ($gb->isLocked()) {
return $this->module->error('err_locked');
}
if (false === ($user = GWF_Session::getUser())) {
$userid = 0;
$username = 'G#' . $form->getVar('username');
} else {
$userid = $user->getVar('user_id');
$username = $user->getVar('user_name');
}
$options = 0;
$options |= isset($_POST['showmail']) ? GWF_GuestbookMSG::SHOW_EMAIL : 0;
$options |= isset($_POST['public']) ? GWF_GuestbookMSG::SHOW_PUBLIC : 0;
$options |= isset($_POST['toggle']) ? GWF_GuestbookMSG::ALLOW_PUBLIC_TOGGLE : 0;
$options |= $gb->isModerated() ? GWF_GuestbookMSG::IN_MODERATION : 0;
$gbm = new GWF_GuestbookMSG(array('gbm_gbid' => $gb->getID(), 'gbm_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'gbm_username' => $username, 'gbm_uid' => $userid, 'gbm_url' => Common::getPost('url', ''), 'gbm_email' => Common::getPost('email', ''), 'gbm_options' => $options, 'gbm_message' => Common::getPost('message', ''), 'gbm_replyto' => $gbe === false ? 0 : $gbe->getID()));
if (false === $gbm->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateSign($gb);
}
$mod_append = $gb->isModerated() ? '_mod' : '';
if ($gb->isModerated()) {
$this->sendEmailModerate($gb, $gbm);
} elseif ($gb->isEMailOnSign()) {
$this->sendEmailSign($gb, $gbm);
}
return $this->module->message('msg_signed' . $mod_append) . $this->module->requestMethodB('Show');
}
示例4: execute
public function execute()
{
require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php';
if (false === ($site = WC_Site::getByID(Common::getGet('siteid')))) {
return $this->module->error('err_site');
}
$this->site = $site;
if (false === ($is_admin = GWF_User::isInGroupS(GWF_Group::STAFF))) {
if (false === $site->isSiteAdmin(GWF_Session::getUser())) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
}
if (false !== Common::getPost('add_sitemin')) {
return $this->onAddSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin);
}
if (false !== Common::getPost('rem_sitemin')) {
return $this->onRemSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin);
}
if (false !== Common::getPost('rem_logo')) {
return $this->onRemLogo($site, $is_admin) . $this->templateEdit($site, $is_admin);
}
if (false !== Common::getPost('set_logo')) {
return $this->onSetLogo($site, $is_admin) . $this->templateEdit($site, $is_admin);
}
if (false !== Common::getPost('edit')) {
return $this->onEdit($site, $is_admin) . $this->templateEdit($site, $is_admin);
}
return $this->templateEdit($site, $is_admin);
}
示例5: getCloud
public static function getCloud(Module_Links $module)
{
// $db = gdo_db();
$back = array();
if ($module->cfgShowPermitted()) {
$conditions = '';
} else {
$conditions = $module->getPermQuery(GWF_Session::getUser());
}
$table = self::table('GWF_LinksTagMap');
if (false === ($result = $table->select('lt_name, COUNT(*) lt_count, link_score', $conditions, 'lt_name ASC', array('ltm_lid', 'ltm_ltid'), -1, -1, 'lt_name'))) {
return $back;
}
while (false !== ($row = $table->fetch($result, self::ARRAY_A))) {
if ($row['lt_name'] !== NULL) {
$back[] = new GWF_LinksTag($row);
}
}
$table->free($result);
// $map = self::table(__CLASS__);#->getTableName();
// $tags = self::table('GWF_LinksTag')->getTableName();
// $links = self::table('GWF_Links')->getTableName();
// return $map
//
// if (false !== ($result = $db->queryAll("SELECT lt_name, COUNT(*) lt_count, link_score FROM $map LEFT JOIN $tags ON lt_id=ltm_ltid LEFT JOIN $links ON link_id=ltm_lid WHERE $conditions GROUP BY ltm_ltid ORDER BY lt_name ASC ")))
// {
// foreach ($result as $row)
// {
// $back[] = new GWF_LinksTag($row);
// }
// }
// var_dump($back);
return $back;
}
示例6: welcome
private function welcome($first_time)
{
if (false === ($user = GWF_Session::getUser())) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php';
GWF_Hook::call(GWF_Hook::LOGIN_AFTER, $user, array(GWF_Session::getOrDefault('GWF_LOGIN_BACK', GWF_WEB_ROOT)));
$fails = GWF_Session::getOrDefault('GWF_LOGIN_FAILS', 0);
GWF_Session::remove('GWF_LOGIN_FAILS');
if ($fails > 0) {
$fails = $this->module->lang('err_failures', array($fails));
} else {
$fails = '';
}
$href_hist = $this->module->getMethodURL('History');
$username = $user->display('user_name');
if (false !== ($ll = GWF_LoginHistory::getLastLogin($user->getID()))) {
$last_login = $this->module->lang('msg_last_login', array($ll->displayDate(), $ll->displayIP(), $ll->displayHostname(), $href_hist));
$welcome = $this->module->lang('welcome_back', array($username, $ll->displayDate(), $ll->displayIP()));
} else {
$last_login = '';
$welcome = $this->module->lang('welcome', array($username));
}
$tVars = array('welcome' => $welcome, 'fails' => $fails, 'last_login' => $last_login, 'href_history' => $href_hist);
return $this->module->template('welcome.tpl', $tVars);
}
示例7: getButtons
private function getButtons(GWF_PM $pm)
{
$transid = 'pm_trans_' . $pm->getID();
$u = GWF_Session::getUser();
$buttons = '';
if (false !== ($prevs = $pm->getReplyToPrev())) {
foreach ($prevs as $prev) {
$buttons .= GWF_Button::prev($prev->getDisplayHREF(), $this->module->lang('btn_prev'));
}
}
if (!$pm->hasDeleted($u)) {
$buttons .= GWF_Button::delete($pm->getDeleteHREF($u->getID()), $this->module->lang('btn_delete'));
} else {
$buttons .= GWF_Button::restore($pm->getRestoreHREF(), $this->module->lang('btn_restore'));
}
if ($pm->canEdit($u)) {
$buttons .= GWF_Button::edit($pm->getEditHREF(), $this->module->lang('btn_edit'));
}
$buttons .= GWF_Button::options($pm->getAutoFolderHREF(), $this->module->lang('btn_autofolder'));
if (!$pm->isGuestPM()) {
$buttons .= GWF_Button::reply($pm->getReplyHREF(), $this->module->lang('btn_reply')) . PHP_EOL . GWF_Button::quote($pm->getQuoteHREF(), $this->module->lang('btn_quote'));
}
$u2 = $pm->getOtherUser($u);
$buttons .= GWF_Button::ignore($pm->getIgnoreHREF($pm->getOtherUser($u)), $this->module->lang('btn_ignore', array($u2->display('user_name'))));
$buttons .= GWF_Button::translate($pm->getTranslateHREF(), $this->module->lang('btn_translate'), '', 'gwfGoogleTrans(\'' . $transid . '\'); return false;');
if (false !== ($nexts = $pm->getReplyToNext())) {
foreach ($nexts as $next) {
$buttons .= GWF_Button::next($next->getDisplayHREF(), $this->module->lang('btn_next'));
}
}
return $buttons;
}
示例8: execute
public function execute()
{
if (false !== ($username = Common::getGet('username'))) {
return $this->templateRankingU($username);
}
return $this->templateRanking(GWF_Session::getUser());
}
示例9: execute
public function execute()
{
# Permissions
if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gbid')))) {
return $this->module->error('err_gb');
}
if (false === $gb->canModerate(GWF_Session::getUser())) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
# Toggle Moderation Flag
if (false !== ($state = Common::getGet('set_moderation'))) {
return $this->onSetModeration($gb, Common::getGet('gbmid', 0), $state > 0);
}
# Toggle Public Flag
if (false !== ($state = Common::getGet('set_public'))) {
return $this->onSetPublic($gb, Common::getGet('gbmid', 0), $state > 0);
}
# Edit Guestbook
if (false !== Common::getPost('edit')) {
return $this->onEdit($gb) . $this->templateEditGB($gb);
}
# Edit Single Entry
if (false !== Common::getPost('edit_entry')) {
return $this->onEditEntry($gb, Common::getGet('gbmid', 0), false);
}
if (false !== Common::getPost('del_entry')) {
return $this->onEditEntry($gb, Common::getGet('gbmid', 0), true);
}
if (false !== Common::getGet('edit_entry')) {
return $this->templateEditEntry($gb, Common::getGet('gbmid', 0));
}
return $this->templateEditGB($gb);
}
示例10: prog2CheckResult
function prog2CheckResult(WC_Challenge $chall)
{
if (false === ($user = GWF_Session::getUser())) {
die($chall->lang('err_login'));
}
if (false === ($answer = Common::getGet('answer'))) {
die($chall->lang('err_no_answer'));
}
$solution = GWF_Session::getOrDefault('prog2_solution', false);
$startTime = GWF_Session::getOrDefault('prog2_timeout', false);
if ($solution === false || $startTime === false) {
die($chall->lang('err_no_request'));
}
$back = "";
if (trim($answer) !== $solution) {
$back .= $chall->lang('err_wrong', array(htmlspecialchars($answer, ENT_QUOTES), $solution));
} else {
$back .= $chall->lang('msg_correct');
}
$timeNeeded = microtime(true) - $startTime;
if ($timeNeeded > TIMELIMIT) {
return $back . $chall->lang('err_timeout', array(sprintf('%.02f', $timeNeeded), TIMELIMIT));
}
return trim($answer) === $solution ? true : $back;
}
示例11: onDeleteFolder
public function onDeleteFolder($folderid)
{
# Permission
$folderid = (int) $folderid;
$user = GWF_Session::getUser();
if (false === ($folder = GWF_PMFolder::getByID($folderid)) || $folder->getVar('pmf_uid') !== $user->getID()) {
return $this->module->error('err_folder_perm');
}
# Delete PMs$result
$count = 0;
$pms = GDO::table('GWF_PM');
$uid = $user->getVar('user_id');
$fid = "{$folderid}";
$del = GWF_PM::OWNER_DELETED;
if (false === ($result = $pms->update("pm_options=pm_options|{$del}", "pm_owner={$uid} AND pm_folder={$fid}"))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$count += $pms->affectedRows($result);
// $del = GWF_PM::FROM_DELETED;
// if (false === $pms->update("pm_options=pm_options|$del", "pm_from=$uid AND pm_from_folder=$fid")) {
// return GWF_HTML::err('ERR_DATABASE', array( __FILE__, __LINE__));
// }
// $count += $pms->affectedRows();
if ($folderid > 2) {
# Delete Folder
if (false === $folder->delete()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
}
# Done
return $this->module->message('msg_folder_deleted', array($folder->display('pmf_name'), $count));
}
示例12: execute
public function execute()
{
if (false === ($user = GWF_Session::getUser()) && !$this->module->cfgGuestShouts()) {
return GWF_HTML::err('ERR_LOGIN_REQUIRED');
}
if ($user !== false && $user->isWebspider()) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
if (false !== ($error = $this->isFlooding())) {
return $error;
}
$message = Common::getPost('message', '');
if (false !== ($error = $this->validate_message($message))) {
return GWF_HTML::error('Shoutbox', $error);
}
$entry = new GWF_Shoutbox(array('shout_id' => '0', 'shout_uid' => GWF_Session::getUserID(), 'shout_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'shout_uname' => GWF_Shoutbox::generateUsername(), 'shout_message' => $message));
if (false === $entry->insert()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if ($this->module->cfgEMailModeration()) {
$this->onEMailModeration($user, $entry);
}
$url = htmlspecialchars(GWF_Session::getLastURL());
return $this->module->message('msg_shouted', array($url, $url));
}
示例13: onTag
private function onTag(Slay_Song $song)
{
$form = $this->formTag($song);
if (false !== ($error = $form->validateCSRF_WeakS())) {
return $error;
}
$tags = array();
$errors = array();
foreach ($_POST as $k => $v) {
if (Common::startsWith($k, 'tag_')) {
$k = substr($k, 4);
if (Slay_Tag::getByName($k) === false) {
$errors[] = $this->module->lang('err_tag_uk');
} else {
$tags[] = $k;
}
}
}
if (count($errors) > 0) {
return GWF_HTML::error('Slaytags', $errors);
}
$user = GWF_Session::getUser();
if (false === Slay_TagVote::clearVotes($song, $user)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === Slay_TagVote::addVotes($song, $user, $tags)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $song->computeTags()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_tagged');
}
示例14: getHighlightCountry
private function getHighlightCountry()
{
if (false === ($user = GWF_Session::getUser()) || '0' === ($cid = $user->getVar('user_countryid'))) {
return GWF_IP2Country::detectCountryID();
} else {
return $cid;
}
}
示例15: onAdvSearch
private function onAdvSearch(GWF_Form $form)
{
$table = GDO::table('GWF_Links');
if (false === ($matches = $table->searchAdv(GWF_Session::getUser(), $form->getVars()))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateSearch(array(), '');
}
return $this->templateSearch($matches, '');
}