コード例 #1
0
ファイル: Sign.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Thanks.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Sign.php プロジェクト: sinfocol/gwf3
 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 = '******' . $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
0
ファイル: SiteEdit.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: GWF_LinksTagMap.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Welcome.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Show.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Ranking.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     if (false !== ($username = Common::getGet('username'))) {
         return $this->templateRankingU($username);
     }
     return $this->templateRanking(GWF_Session::getUser());
 }
コード例 #9
0
ファイル: Moderate.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: index.php プロジェクト: sinfocol/gwf3
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
0
ファイル: FolderAction.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Shout.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: Tag.php プロジェクト: sinfocol/gwf3
 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
0
ファイル: RankingCountry.php プロジェクト: sinfocol/gwf3
 private function getHighlightCountry()
 {
     if (false === ($user = GWF_Session::getUser()) || '0' === ($cid = $user->getVar('user_countryid'))) {
         return GWF_IP2Country::detectCountryID();
     } else {
         return $cid;
     }
 }
コード例 #15
0
ファイル: Search.php プロジェクト: sinfocol/gwf3
 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, '');
 }
コード例 #16
0
ファイル: GWF_Shoutbox.php プロジェクト: sinfocol/gwf3
 public static function generateUsername()
 {
     if (false !== ($user = GWF_Session::getUser())) {
         return $user->getVar('user_name');
     } else {
         return abs(crc32($_SERVER['REMOTE_ADDR']));
     }
 }
コード例 #17
0
ファイル: Edit.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     $user = GWF_Session::getUser();
     if (false === ($this->group = GWF_Group::getByID(Common::getGet('gid')))) {
         return $this->module->error('err_unk_group');
     }
     $group = $this->group;
     $groupname = $group->getVar('group_name');
     if (!$user->isInGroupName($groupname)) {
         return $this->module->error('err_unk_group');
     }
     //		$gid = $group->getID();
     //		$groups = $user->getGroups();
     //		$ugo = $groups[(string)($gid)]['ug_options'];
     $ugo = $user->getUserGroupOptions($group->getID());
     //		var_dump($ugo);
     if (($ugo & (GWF_UserGroup::LEADER | GWF_UserGroup::CO_LEADER)) === 0) {
         return $this->module->error('err_unk_group');
     }
     if (false !== ($array = Common::getPostArray('kick'))) {
         return $this->onKick($group, $array) . $this->templateEdit($group);
     }
     if (false !== ($array = Common::getPostArray('accept'))) {
         return $this->onAccept($group, $array) . $this->templateEdit($group);
     }
     if (false !== ($array = Common::getPostArray('co'))) {
         return $this->onSetPriv($group, $array, GWF_UserGroup::CO_LEADER, true);
     }
     if (false !== ($array = Common::getPostArray('unco'))) {
         return $this->onSetPriv($group, $array, GWF_UserGroup::CO_LEADER, false);
     }
     if (false !== ($array = Common::getPostArray('mod'))) {
         return $this->onSetPriv($group, $array, GWF_UserGroup::MODERATOR, true);
     }
     if (false !== ($array = Common::getPostArray('unmod'))) {
         return $this->onSetPriv($group, $array, GWF_UserGroup::MODERATOR, false);
     }
     if (false !== ($array = Common::getPostArray('hide'))) {
         return $this->onSetPriv($group, $array, GWF_UserGroup::HIDDEN, true);
     }
     if (false !== ($array = Common::getPostArray('unhide'))) {
         return $this->onSetPriv($group, $array, GWF_UserGroup::HIDDEN, false);
     }
     if (false !== Common::getPost('invite')) {
         return $this->onInvite($group);
     }
     if (false !== Common::getPost('edit')) {
         return $this->onEdit($group);
     }
     if (false !== Common::getPost('delete')) {
         return $this->onDelete($group);
     }
     if (false !== Common::getPost('del_confirm')) {
         return $this->onDeleteConfirm($group);
     }
     return $this->templateEdit($group);
 }
コード例 #18
0
ファイル: Edit.php プロジェクト: sinfocol/gwf3
 private function sanitize()
 {
     if (false === ($this->link = GWF_Links::getByID(Common::getGet('lid')))) {
         return $this->module->error('err_link');
     }
     if (false === $this->link->mayEdit(GWF_Session::getUser())) {
         return $this->module->error('err_edit_perm');
     }
     return false;
 }
コード例 #19
0
ファイル: Options.php プロジェクト: sinfocol/gwf3
 public function validate_subscr(Module_Forum $module, $arg)
 {
     if (!GWF_ForumOptions::isValidSubscr($arg)) {
         return $this->module->lang('err_subscr_mode');
     }
     if ($arg !== 'none' && !GWF_Session::getUser()->hasValidMail()) {
         return $this->module->lang('err_no_valid_mail');
     }
     return false;
 }
コード例 #20
0
ファイル: Warbox.php プロジェクト: sinfocol/gwf3
 private function templateToken()
 {
     $user = GWF_Session::getUser();
     $token = WC_WarToken::genWarToken($user->getID());
     $host = Module_WeChall::instance()->cfgWarboxURL();
     $ip = gethostbyname(Common::getHostname($host));
     $port = Module_WeChall::instance()->cfgWarboxPort();
     $tVars = array('epoch' => $this->getEpochUser(), 'warboxes' => $this->getWarboxes(true), 'token' => $token, 'port' => $port, 'host' => $host, 'netcat_cmd' => sprintf('(echo -e "%s\\n%s"; cat) | nc %s %s', $user->displayUsername(), $token, $ip, $port));
     return $this->module->templatePHP('wartoken.php', $tVars);
 }
コード例 #21
0
ファイル: EditGB.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     if (false === ($gb = GWF_Guestbook::getByID(Common::getGet('gb')))) {
         return $this->module->error('err_gb');
     }
     if (false === $gb->canModerate(GWF_Session::getUser())) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     return $this->templateModerate();
 }
コード例 #22
0
ファイル: Subscribe.php プロジェクト: sinfocol/gwf3
 private function sanitize()
 {
     if (false === ($this->thread = $this->module->getCurrentThread())) {
         return $this->module->error('err_thread');
     }
     if (false === $this->thread->hasPermission(GWF_Session::getUser())) {
         return $this->module->error('err_thread_perm');
     }
     return false;
 }
コード例 #23
0
ファイル: Vote.php プロジェクト: sinfocol/gwf3
 private function onVote()
 {
     if (false === ($user = GWF_Session::getUser())) {
         return $this->onGuestVote();
     } elseif ($user->isWebspider()) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     } else {
         return $this->onUserVote($user);
     }
 }
コード例 #24
0
ファイル: Form.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     GWF_Website::setPageTitle($this->module->lang('pt_login'));
     if (false !== GWF_Session::getUser()) {
         return $this->module->error('err_already_logged_in');
     }
     if (false !== Common::getPost('login')) {
         return $this->onLogin();
     }
     return $this->form();
 }
コード例 #25
0
ファイル: Stats.php プロジェクト: sinfocol/gwf3
 private function validate()
 {
     if (false !== ($this->user1 = GWF_User::getByName(Common::getPost('wc_stat_user1')))) {
         #nice
     } elseif (false === Common::getGet('user1')) {
         $this->user1 = false;
         $score1 = 0;
     } elseif (false === ($this->user1 = GWF_User::getByName(Common::getGet('user1', 0)))) {
         if (false === ($this->user1 = GWF_Session::getUser())) {
             GWF_HTML::err('ERR_UNKNOWN_USER', NULL, true, true);
         }
     }
     if (false === ($this->user2 = GWF_User::getByName(Common::getGet('user2', 0)))) {
         if (false === ($this->user2 = GWF_User::getByName(Common::getPost('wc_stat_user2', 0)))) {
             $score2 = 0;
         }
     }
     if ($this->user2 !== false) {
         $score2 = $this->user2->getLevel();
     }
     if ($this->user1 !== false) {
         $score1 = $this->user1->getLevel();
     }
     //		if ($score1 <= 0 && $score2 <= 0) {
     //			return $this->module->error('err_graph_empty');
     //		}
     $sel = Common::getRequest('site', false);
     if (is_array($sel) && count($sel) === 0) {
         $sel = false;
     }
     //		var_dump($sel);
     if ($sel === false) {
         $sel = $this->getSelDefault(false);
     } elseif ($sel === 'all') {
         $sel = $this->getSelDefault(true);
     }
     if (!is_array($sel)) {
         $sel = trim($sel);
         if ($sel !== '') {
             $sel = array(intval($sel) => 'yes');
         } else {
             $sel = array();
         }
     } else {
         $sel2 = array();
         foreach ($sel as $sid => $on) {
             $sel2[intval($sid)] = 'on';
         }
         $sel = $sel2;
     }
     $this->sel = $sel;
     //		var_dump($sel);
     return false;
 }
コード例 #26
0
ファイル: ShowThread.php プロジェクト: sinfocol/gwf3
 private function templateThread()
 {
     $this->thread->increase('thread_viewcount', 1);
     if (false !== ($user = GWF_Session::getUser())) {
         if (false === $this->thread->markRead($user)) {
             echo GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
         }
     }
     $tVars = array('thread' => $this->thread, 'posts' => $this->thread->getPostPage($this->ppt, $this->page), 'pagemenu' => $this->getPageMenu(), 'actions' => true, 'title' => true, 'reply' => $this->thread->hasReplyPermission(GWF_Session::getUser(), $this->module), 'nav' => true, 'can_vote' => $user === false ? false : $this->module->cfgVotesEnabled(), 'can_thank' => $user === false ? false : $this->module->cfgThanksEnabled(), 'term' => GWF_QuickSearch::getQuickSearchHighlights(Common::getRequest('term', '')), 'page' => $this->page, 'href_add_poll' => $this->thread->hrefAddPoll(), 'href_edit' => $this->thread->getEditHREF());
     return $this->module->templatePHP('show_thread.php', $tVars);
 }
コード例 #27
0
ファイル: Form.php プロジェクト: sinfocol/gwf3
 private function getForm()
 {
     $user = GWF_Session::getUser();
     $default_email = $user === false ? '' : $user->getVar('user_email');
     $data = array('email' => array(GWF_Form::STRING, $default_email, $this->module->lang('th_email')), 'message' => array(GWF_Form::MESSAGE, '', $this->module->lang('th_message')));
     if ($this->module->isCaptchaEnabled()) {
         $data['captcha'] = array(GWF_Form::CAPTCHA);
     }
     $data['contact'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_contact'), '');
     return new GWF_Form($this, $data);
 }
コード例 #28
0
ファイル: Form.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     GWF_Website::setPageTitle($this->module->lang('pt_register'));
     if (false !== GWF_Session::getUser()) {
         return $this->module->error('ERR_ALREADY_REDISTERED');
     }
     if (false !== Common::getPost('register')) {
         return $this->onRegister();
     }
     return $this->templateForm();
 }
コード例 #29
0
ファイル: Logout.php プロジェクト: sinfocol/gwf3
 public function execute()
 {
     if (false === GWF_Session::getUser()) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     if (false === GWF_Session::onLogout()) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     $tVars = array('title' => $this->module->lang('Logout'), 'info' => $this->module->lang('logout_info'));
     return $this->module->template('logout.tpl', $tVars);
 }
コード例 #30
0
ファイル: Forum.php プロジェクト: sinfocol/gwf3
 public function templateForum()
 {
     $by = urlencode(Common::getGetString('tby', 'thread_lastdate'));
     $dir = urlencode(Common::getGetString('tdir', 'DESC'));
     $bby = urlencode(Common::getGetString('bby', 'board_pos'));
     $bdir = urlencode(Common::getGetString('bdir', 'ASC'));
     $orderby = GDO::table('GWF_ForumThread')->getMultiOrderby($by, $dir);
     $bid = $this->board->getVar('board_bid');
     $bt = $this->board->urlencodeSEO('board_title');
     $tVars = array('boards' => $this->board->getBoardPage($this->bPage, $this->tpp), 'board' => $this->board, 'pagemenu_boards' => GWF_PageMenu::display($this->bPage, $this->nBPages, sprintf(GWF_WEB_ROOT . 'forum-b%s/bby/%s/%s/%s-p%%PAGE%%.html', $bid, $bby, $bdir, $bt)), 'threads' => $this->board->getThreads($this->tpp, $this->page, $orderby), 'pagemenu_threads' => GWF_PageMenu::display($this->page, $this->nPages, sprintf(GWF_WEB_ROOT . 'forum-b%s/tby/%s/%s/%s-p%%PAGE%%.html', $bid, $by, $dir, $bt)), 'new_thread_allowed' => $this->board->isNewThreadAllowed(), 'unread_threads' => GWF_ForumThread::getUnreadThreadCount(GWF_Session::getUser()), 'latest_threads' => GWF_ForumThread::getLatestThreads($this->module->getNumLatestThreads()), 'href_options' => GWF_WEB_ROOT . 'forum/options', 'href_unread' => $this->module->getMethodURL('Unread'), 'href_search' => GWF_WEB_ROOT . 'forum/search', 'board_sort_url' => GWF_WEB_ROOT . sprintf('forum-b%s/bby/%%BY%%/%%DIR%%/%s-p1.html', $bid, $bt), 'thread_sort_url' => GWF_WEB_ROOT . sprintf('forum-b%s/bby/%s/%s/bp-%d/tby/%%BY%%/%%DIR%%/%s-p1.html', $bid, $bby, $bdir, $this->bPage, $bt), 'href_polls' => GWF_WEB_ROOT . 'poll_overview');
     return $this->module->templatePHP('forum.php', $tVars);
 }