本文整理汇总了PHP中GWF_Session类的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Session类的具体用法?PHP GWF_Session怎么用?PHP GWF_Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GWF_Session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
if (false === ($group = GWF_Group::getByID(Common::getGet('gid')))) {
return $this->module->error('err_unk_group');
}
if ($group->isOptionEnabled(GWF_Group::VISIBLE_MEMBERS)) {
} else {
switch ($group->getVisibleMode()) {
case GWF_Group::VISIBLE:
break;
case GWF_Group::COMUNITY:
if (!GWF_Session::isLoggedIn()) {
return GWF_HTML::err('ERR_NO_PERMISSION');
}
break;
case GWF_Group::HIDDEN:
case GWF_Group::SCRIPT:
if (!GWF_User::isInGroupS($group->getVar('group_name'))) {
return $this->module->error('err_not_invited');
}
break;
default:
return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
}
}
return $this->templateUsers($group);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:27,代码来源:ShowUsers.php
示例2: 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));
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:FolderAction.php
示例3: 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());
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:Thanks.php
示例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);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:SiteEdit.php
示例5: 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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:Shout.php
示例6: 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');
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:Tag.php
示例7: 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');
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:Sign.php
示例8: 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');
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:ChallVotes.php
示例9: onVote
private function onVote(GWF_VoteMulti $poll, $user)
{
$opts = Common::getPostArray('opt', array());
$taken = array();
$max = $poll->getNumChoices();
foreach ($opts as $i => $stub) {
$i = (int) $i;
if ($i < 1 || $i > $max) {
continue;
}
if (!in_array($i, $taken, true)) {
$taken[] = $i;
}
}
$count = count($taken);
// if ($count === 0) {
// return $this->module->error('err_no_options');
// }
if (!$poll->isMultipleChoice() && $count !== 1) {
return $this->module->error('err_no_multi');
}
if (false === $poll->onVote($user, $taken)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_voted', array(htmlspecialchars(GWF_Session::getLastURL())));
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:VotePoll.php
示例10: 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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:32,代码来源:Show.php
示例11: 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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:34,代码来源:GWF_LinksTagMap.php
示例12: 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);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:33,代码来源:Moderate.php
示例13: 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);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:Welcome.php
示例14: execute
public function execute()
{
if (false !== ($username = Common::getGet('username'))) {
return $this->templateRankingU($username);
}
return $this->templateRanking(GWF_Session::getUser());
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:Ranking.php
示例15: 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;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:index.php
示例16: __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());
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:SERIAL_Solution.php
示例17: 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()));
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:AddAttach.php
示例18: generateUsername
public static function generateUsername()
{
if (false !== ($user = GWF_Session::getUser())) {
return $user->getVar('user_name');
} else {
return abs(crc32($_SERVER['REMOTE_ADDR']));
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:GWF_Shoutbox.php
示例19: 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);
}
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:challenge_quirks.php
示例20: 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, '');
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:8,代码来源:Search.php
注:本文中的GWF_Session类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论