protected function column_col3() { $email = '(hidden e-mail address)'; if (isset($_SESSION['SignupBWVars'])) { // we have vars still stored, delete them $email = $_SESSION['SignupBWVars']['email']; unset($_SESSION['SignupBWVars']); } $words = $this->layoutkit->words; if ($User = APP_User::login()) { // show the page anyway. // redirect should happen in the controller. // but for translators show the page. echo ' <div style="background:yellow; border:1px solid black; padding:10px; width: 44em; margin-bottom: 2em;"> <div style="font-size:160%;"> You can see the signup page because you are a translator.<br /> Normally you cannot see it when logged in.<br /> Please only use the page for translations! </div> <br />Related page: <a href="signup">Signup form</a> </div> '; } require 'templates/finish.php'; }
public function GetMembers() { // TODO: Replace by config values global $_SYSHCVOL; $delay = $_SYSHCVOL['WhoIsOnlineDelayInMinutes']; // Test if member is logged in if ($User = APP_User::login("Pending,NeedMore")) { // All profiles // TODO: JY: I am not sure it is useful to look in membersphotos table here $query = "\r\n SELECT\r\n NOW() - online.updated AS NbSec,\r\n members.*,\r\n geonames_cache.name AS cityname,\r\n geonames_cache.parentAdm1Id AS IdRegion,\r\n geonames_countries.name AS countryname,\r\n members.Status AS MemberStatus,\r\n membersphotos.FilePath AS photo,\r\n membersphotos.Comment,\r\n online.updated AS lastdateaction,\r\n lastactivity\r\n FROM\r\n geonames_cache,\r\n geonames_countries,\r\n online,\r\n members\r\n LEFT JOIN\r\n membersphotos\r\n ON\r\n membersphotos.IdMember = members.id\r\n WHERE\r\n geonames_countries.iso_alpha2 = geonames_cache.fk_countrycode\r\n AND\r\n geonames_cache.geonameid = members.IdCity\r\n AND\r\n members.Status IN ( " . Member::ACTIVE_ALL . ")\r\n AND\r\n online.IdMember = members.id\r\n AND\r\n online.updated > DATE_SUB(NOW(), INTERVAL {$delay} MINUTE)\r\n GROUP BY\r\n members.id\r\n ORDER BY\r\n members.LastLogin DESC\r\n "; } else { // Public profiles only // TODO: combine with query above $query = "\r\n SELECT\r\n NOW() - online.updated AS NbSec,\r\n members.*,\r\n geonames_cache.name AS cityname,\r\n geonames_cache.parentAdm1Id AS IdRegion,\r\n geonames_countries.name AS countryname,\r\n members.Status AS MemberStatus,\r\n membersphotos.FilePath AS photo,\r\n membersphotos.Comment,\r\n online.updated AS lastdateaction,\r\n lastactivity\r\n FROM\r\n geonames_cache,\r\n geonames_countries,\r\n online,\r\n memberspublicprofiles,\r\n members\r\n LEFT JOIN\r\n membersphotos\r\n ON\r\n membersphotos.IdMember = members.id\r\n WHERE\r\n geonames_countries.iso_alpha2 = geonames_cache.fk_countrycode\r\n AND\r\n geonames_cache.geonameid = members.IdCity\r\n AND\r\n members.Status IN ( " . Member::ACTIVE_ALL . ")\r\n AND\r\n online.IdMember = members.id\r\n AND\r\n online.updated > DATE_SUB(NOW(), INTERVAL {$delay} MINUTE)\r\n AND\r\n online.IdMember = members.id\r\n AND\r\n memberspublicprofiles.IdMember = members.id\r\n GROUP BY\r\n members.id\r\n ORDER BY\r\n members.LastLogin DESC\r\n "; } $s = $this->dao->query($query); if (!$s) { throw new PException('Failed to get online members!'); } $TMembers = array(); while ($row = $s->fetch(PDB::FETCH_OBJ)) { $TMembers[] = $row; } return $TMembers; }
public function index() { $P = PVars::getObj('page'); $vw = new ViewWrap($this->_view); $cw = new ViewWrap($this); // index is called when http request = ./blog if (PPostHandler::isHandling()) { return; } $request = PRequest::get()->request; $User = APP_User::login(); if (!isset($request[1])) { $request[1] = ''; } }
public function index() { $request = PRequest::get()->request; if (!isset($request[1])) { if ($User = APP_User::login()) { $page = new LastcommentsPage($this->_model->GetLastComments()); $page->model = $this->_model; } else { $page = new MembersMustloginPage(); } // $page->member = $this->_model->getLoggedInMember(); return $page; } $page->member = $this->_model->getLoggedInMember(); $page->model = $this->_model; return $page; }
/** * decide which page to show. * This method is called automatically */ public function index($args = false) { $User = APP_User::login(); // The user must be logged in $request = $args->request; $model = new PollsModel(); if (!isset($_SESSION['IdMember'])) { $page = new MessagesMustloginPage(); $page->setRedirectURL(implode('/', $request)); return $page; } // print_r($args->post); // look at the request. switch (isset($request[1]) ? $request[1] : false) { case 'listall': $page = new PollsPage("", "listall", $model->LoadList("")); break; case 'create': $page = new PollsPage("", "create"); break; case 'listClose': $page = new PollsPage("", "listClose", $model->LoadList("Close")); break; case 'listOpen': $page = new PollsPage("", "listOpen", $model->LoadList("Open")); break; case 'listProject': $page = new PollsPage("", "listProject", $model->LoadList("Project")); break; case 'cancelvote': $IdPoll = isset($request[2]) ? $request[2] : false; MOD_log::get()->write("Prepare to contribute cancel vote #" . $IdPoll, "polls"); if ($model->CancelVote($IdPoll, "", $_SESSION["IdMember"])) { $page = new PollsPage("", "cancelvote"); } else { $page = new PollsPage("", "votenotcancelable"); } break; case 'seeresults': $IdPoll = isset($request[2]) ? $request[2] : false; if ($Data = $model->GetPollResults($IdPoll)) { $page = new PollsPage("", "seeresults", $Data); } else { $page = new PollsPage("", "resultsnotyetavailable"); } break; case 'contribute': $IdPoll = isset($request[2]) ? $request[2] : false; MOD_log::get()->write("Prepare to contribute to poll #" . $IdPoll, "polls"); if ($model->CanUserContribute($IdPoll)) { $Data = $model->PrepareContribute($IdPoll); $page = new PollsPage("", "contribute", $Data); } else { $page = new PollsPage("", "sorryyoucannotcontribute"); } break; case 'vote': // a nice trick to get all the post args as local variables... // they will all be prefixed by 'post_' extract($args->post, EXTR_PREFIX_ALL, 'post'); $IdPoll = $post_IdPoll; if ($model->CanUserContribute($IdPoll)) { MOD_log::get()->write("Tryin to vote for poll #" . $IdPoll, "polls"); $Data = $model->AddVote($args->post, "", $_SESSION["IdMember"]); $page = new PollsPage("", "votedone", $Data); } else { MOD_log::get()->write("Refusing vote for poll #" . $IdPoll, "polls"); $page = new PollsPage("", "probablyallreadyvote"); } break; case 'update': $IdPoll = isset($request[2]) ? $request[2] : false; $page = new PollsPage("", "showpoll", $model->LoadPoll($IdPoll)); break; case 'doupdatepoll': $IdPoll = $args->post["IdPoll"]; $model->UpdatePoll($args->post); $page = new PollsPage("", "showpoll", $model->LoadPoll($IdPoll)); break; case 'addchoice': $IdPoll = $args->post["IdPoll"]; $model->AddChoice($args->post); $page = new PollsPage("", "showpoll", $model->LoadPoll($IdPoll)); break; case 'updatechoice': $IdPoll = $args->post["IdPoll"]; $model->UpdateChoice($args->post); $page = new PollsPage("", "showpoll", $model->LoadPoll($IdPoll)); break; case 'createpoll': MOD_log::get()->write("Creating a poll ", "polls"); $model->UpdatePoll($args->post); $page = new PollsPage("", "listall", $model->LoadList("Project")); break; case false: default: case '': // no request[1] was specified $page = new PollsPage("", "", $model->LoadList("Open")); // Without error break; } // return the $page object, // so the framework can call the "$page->render()" function. return $page; }
public function groupChangeProcess() { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { if (!($User = APP_User::login())) { throw new PException('Access should not have been possible'); } if ($User->hasRight('groupchange@user')) { $vars =& PPostHandler::getVars(); $query = sprintf("UPDATE `user` SET `auth_id` = '%d' WHERE `id` = '%d'", $vars['newgroup'], $vars['userid']); $this->dao->query($query); } else { throw new PException('Access should not have been possible'); } } else { PPostHandler::setCallback($callbackId, __CLASS__, __FUNCTION__); return $callbackId; } }
/** * index is called when http request = ./forums * or during a new topic/edit of a group */ public function index($subforum = false) { if (PPostHandler::isHandling()) { return; } // Determine the search callback and tell the view about it $searchCallbackId = $this->searchProcess(); $view = $this->_view; $view->searchCallbackId = $searchCallbackId; $page = $view->page = new RoxGenericPage(); $request = $this->request; if (isset($request[0]) && $request[0] != 'forums') { // if this is a ./groups url get the group number if any if ($request[0] == "groups" && isset($request[1])) { $IdGroup = intval($request[1]); } $new_request = array(); $push = false; foreach ($request as $r) { if ($r == 'forums' or $r == 'forum') { $push = true; } if ($push == true) { array_push($new_request, $r); } } $request = $new_request; $page = $view->page = new PageWithHTMLpart(); } // First check if the feature is closed if ($_SESSION["Param"]->FeatureForumClosed != 'No' and !$this->BW_Right->HasRight("Admin")) { $this->_view->showFeatureIsClosed(); PPHP::PExit(); } // end of test "if feature is closed" if (APP_User::isBWLoggedIn()) { $User = APP_User::login(); } else { $User = false; } $showSticky = true; $this->parseRequest(); // set uri for correct links in group pages etc. $view->uri = $this->uri; $page->uri = $this->uri; $view->BW_Right = $this->BW_Right; $page->BW_Right = $this->BW_Right; $this->_model->prepareForum($showSticky); // first include the col2-stylesheet $page->addStyles .= $view->customStyles(); $page->currentTab = 'forums'; // then the userBar $page->newBar .= $view->getAsString('userBar'); // we can't replace this ob_start() if ($this->action == self::ACTION_NOT_LOGGED_IN) { $this->_redirectNotLoggedIn(); } ob_start(); if ($this->action == self::ACTION_VOTE_POST) { if (!isset($request[2])) { die("Need to have a IdPost"); } $IdPost = $request[2]; if (!isset($request[3])) { die("Need to have a vote value"); } $Value = $request[3]; $this->_model->VoteForPost($IdPost, $Value); $this->_model->setThreadId($this->_model->GetIdThread($IdPost)); $this->isTopLevel = false; $this->_model->prepareTopic(true); $this->_view->showTopic(); } elseif ($this->action == self::ACTION_DELETEVOTE_POST) { if (!isset($request[2])) { die("Need to have a IdPost"); } $IdPost = $request[2]; $this->_model->DeleteVoteForPost($IdPost); $this->_model->setThreadId($this->_model->GetIdThread($IdPost)); $this->isTopLevel = false; $this->_model->prepareTopic(true); $this->_view->showTopic(); } elseif ($this->action == self::ACTION_MODERATOR_FULLEDITPOST) { if (!isset($request[2])) { die("Need to have a IdPost"); } $IdPost = $request[2]; if (!$this->BW_Right->HasRight("ForumModerator", "Edit")) { MOD_log::get()->write("Trying to edit post #" . $IdPost . " without proper right", "ForumModerator"); die("You miss right ForumModerator"); } $callbackId = $this->ModeratorEditPostProcess(); $DataPost = $this->_model->prepareModeratorEditPost($IdPost); $this->_view->showModeratorEditPost($callbackId, $DataPost); PPostHandler::clearVars($callbackId); } elseif ($this->action == self::ACTION_MODERATOR_EDITTAG) { if (!isset($request[2])) { die("Need to have a IdTag"); } $IdTag = $request[2]; if (!$this->BW_Right->HasRight("ForumModerator", "Edit")) { MOD_log::get()->write("Trying to edit Tag #" . $IdTag . " without proper right", "ForumModerator"); die("You miss right ForumModerator"); } $callbackId = $this->ModeratorEditTagProcess(); $DataTag = $this->_model->prepareModeratorEditTag($IdTag); $this->_view->showModeratorEditTag($callbackId, $DataTag); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_VIEW) { if ($this->_model->isTopic()) { $this->_model->prepareTopic(true); $this->_view->showTopic(); } else { if ($this->isTopLevel) { $this->_model->setTopMode(Forums::CV_TOPMODE_LANDING); $this->_model->prepareForum(); $onlymygroupscallbackId = $this->mygroupsonlyProcess(); $morelessthreadscallbackid = $this->morelessthreadsProcess(); $this->_view->showTopLevelLandingPage($onlymygroupscallbackId, $morelessthreadscallbackid); PPostHandler::clearVars($onlymygroupscallbackId); PPostHandler::clearVars($morelessthreadscallbackid); } else { $this->_model->prepareForum(); $this->_view->showForum(); } } } else { if ($this->action == self::ACTION_VIEW_CATEGORY) { $this->_view->showTopLevelCategories(); } else { if ($this->action == self::ACTION_VIEW_LASTPOSTS) { $callbackId = $this->mygroupsonlyProcess(); $this->_view->showTopLevelRecentPosts($callbackId); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_VIEW_LANDING) { $callbackId = $this->mygroupsonlyProcess(); $this->_view->showTopLevelLandingPage($callbackId); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_VIEW_FORUM) { $groupsCallback = false; $member = $this->_model->getLoggedInMember(); if ($member && $member->Status != 'ChoiceInactive') { $noForumNewTopicButton = false; } else { // Don't offer the new topic button to 'silent' members $noForumNewTopicButton = true; } $this->_view->showTopLevelRecentPosts($groupsCallback, $noForumNewTopicButton); } else { if ($this->action == self::ACTION_VIEW_GROUPS) { $callbackId = $this->mygroupsonlyProcess(); $this->_view->showTopLevelRecentPosts($callbackId, true); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_RULES) { $this->_view->rules(); } else { if ($this->action == self::ACTION_NEW) { if ($this->BW_Flag->hasFlag("NotAllowedToPostInForum")) { // Test if the user has right for this, if not rough exit MOD_log::get()->write("Forums.ctrl : Forbid to do action [" . $this->action . "] because of Flag " . "NotAllowedToPostInForum", "FlagEvent"); $words = new MOD_Words(); die($words->get('NotAllowedToPostInForum')); } if (!$User) { PRequest::home(); } if (isset($request[2]) and $request[2][0] == 'u') { $IdGroup = substr($request[2], 1); } else { if (!isset($IdGroup)) { $IdGroup = 0; } } $this->_model->prepareForum(); $callbackId = $this->createProcess(); $this->_view->createTopic($callbackId, $IdGroup); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_REPORT_TO_MOD) { if ($this->BW_Flag->hasFlag("NotAllowedToPostInForum")) { // Test if the user has right for this, if not rough exit MOD_log::get()->write("Forums.ctrl : Forbid to do action [" . $this->action . "] because of Flag " . "NotAllowedToPostInForum", "FlagEvent"); $words = new MOD_Words(); die($words->get('NotAllowedToPostInForum')); } if (!$User) { PRequest::home(); } $callbackId = $this->reportpostProcess(); if (isset($request[2])) { if ($request[2] == 'AllMyReport') { $DataPost = $this->_model->prepareReportList($_SESSION["IdMember"], ""); // This retrieve all the reports for the current member $this->_view->showReportList($callbackId, $DataPost); } elseif ($request[2] == 'MyReportActive') { $DataPost = $this->_model->prepareReportList($_SESSION["IdMember"], "('Open','OnDiscussion')"); // This retrieve the Active current pending report for the current member $this->_view->showReportList($callbackId, $DataPost); } elseif ($request[2] == 'AllActiveReports') { if (!$this->BW_Right->HasRight("ForumModerator")) { // if a non forum moderator tries to access this just pull the brakes PPHP::PExit(); } $DataPost = $this->_model->prepareReportList(0, "('Open','OnDiscussion')"); // This retrieve all the current Active pending report $this->_view->showReportList($callbackId, $DataPost); } else { $IdPost = $request[2]; $IdWriter = $_SESSION["IdMember"]; if (!empty($request[3]) and $this->BW_Right->HasRight("ForumModerator")) { $IdWriter = $request[3]; } $DataPost = $this->_model->prepareModeratorEditPost($IdPost, $this->BW_Right->HasRight('ForumModerator')); // We will use the same data as the one used for Moderator edit if ($DataPost->Error == 'NoGroupMember') { // if someone who isn't a member of the associated group // tries to access this just pull the brakes PPHP::PExit(); } $DataPost->Report = $this->_model->prepareReportPost($IdPost, $IdWriter); $this->_view->showReportPost($callbackId, $DataPost); } PPostHandler::clearVars($callbackId); } } else { if ($this->action == self::ACTION_REPLY) { if ($this->BW_Flag->hasFlag("NotAllowedToPostInForum")) { // Test if teh user has right for this, if not rough exit MOD_log::get()->write("Forums.ctrl : Forbid to do action [" . $this->action . "] because of Flag " . "NotAllowedToPostInForum", "FlagEvent"); $words = new MOD_Words(); die($words->get('NotAllowedToPostInForum')); } if (!$User) { PRequest::home(); } $this->_model->prepareForum(); $this->_model->prepareTopic(); $this->_model->initLastPosts(); $callbackId = $this->replyProcess(); $this->_view->replyTopic($callbackId); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_SUGGEST) { // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($request[2])) { PPHP::PExit(); } $new_tags = $this->_model->suggestTags($request[2]); echo $this->_view->generateClickableTagSuggestions($new_tags); PPHP::PExit(); } else { if ($this->action == self::ACTION_LOCATIONDROPDOWNS) { // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($request[2])) { PPHP::PExit(); } echo $this->_view->getLocationDropdowns(); PPHP::PExit(); } else { if ($this->action == self::ACTION_DELETE) { if ($this->BW_Flag->hasFlag("NotAllowedToPostInForum")) { // Test if the user has right for this, if not rough exit MOD_log::get()->write("Forums.ctrl : Forbid to do action [" . $this->action . "] because of Flag " . "NotAllowedToPostInForum", "FlagEvent"); $words = new MOD_Words(); die($words->get('NotAllowedToPostInForum')); } if (!$User || !$this->BW_Right->HasRight("ForumModerator", "Delete")) { PRequest::home(); } $this->delProcess(); } else { if ($this->action == self::ACTION_EDIT) { if ($this->BW_Flag->hasFlag("NotAllowedToPostInForum")) { // Test if the user has right for this, if not rough exit MOD_log::get()->write("Forums.ctrl : Forbid to do action [" . $this->action . "] because of Flag " . "NotAllowedToPostInForum", "FlagEvent"); $words = new MOD_Words(); die($words->get('NotAllowedToPostInForum')); } if (!$User) { PRequest::home(); } $callbackId = $this->editProcess(); $this->_model->prepareForum(); $this->_model->getEditData($callbackId); $this->_view->editPost($callbackId, false); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_TRANSLATE) { if ($this->BW_Flag->hasFlag("NotAllowedToPostInForum")) { // Test if the user has right for this, if not rough exit MOD_log::get()->write("Forums.ctrl : Forbid to do action [" . $this->action . "] because of Flag " . "NotAllowedToPostInForum", "FlagEvent"); $words = new MOD_Words(); die($words->get('NotAllowedToPostInForum')); } if (!$User) { PRequest::home(); } $callbackId = $this->editProcess(); $this->_model->prepareForum(); $this->_model->getEditData($callbackId); $this->_view->editPost($callbackId, true); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_MODEDIT) { if (!$User) { PRequest::home(); } $callbackId = $this->editProcess(); $this->_model->prepareForum(); $this->_model->getEditData($callbackId); $this->_view->ModeditPost($callbackId); PPostHandler::clearVars($callbackId); } else { if ($this->action == self::ACTION_SEARCH_FORUMS) { $this->_view->keyword = $request[2]; $this->_view->showSearchResultPage($request[2]); PPostHandler::clearVars($searchCallbackId); } else { if ($this->action == self::ACTION_SEARCH_USERPOSTS) { if (!isset($request[2])) { PPHP::PExit(); } $this->searchUserposts($request[2]); } else { if ($this->action == self::ACTION_SUBSCRIBE) { if (!isset($request[2])) { PPHP::PExit(); } if ($request[2] == "thread") { $this->SubscribeThread($request[3]); } if ($request[2] == "tag") { $this->SubscribeTag($request[3]); } } else { if ($this->action == self::ACTION_SEARCH_SUBSCRIPTION) { /* * Here the following syntax can be used : * forums/subscriptions : allow current user to see his subscribtions * forums/subscriptions/unsubscribe/thread/xxx/yyy : allow current user to unsubscribe from members_threads_subscribed.id xxx with key yyy * forums/subscriptions/member/xxx : allow a forum moderator to see all subscribtions of member xxx * forums/subscriptions/thread/xxx : allow a forum moderator to see all subscribers and subscribtions for thread xxx * forums/subscribe/thread/xxx : subscribe to thread xxx */ $operation = ""; if (isset($request[2])) { $operation = $request[2]; } switch ($operation) { case "enable": if (isset($request[3])) { switch ($request[3]) { case 'thread': $this->EnableThread($request[4]); break; case 'tag': $this->EnableTag($request[4]); break; case 'group': $this->EnableGroup($request[4]); break; } } else { $this->enableSubscriptions(); } break; case "disable": if (isset($request[3])) { switch ($request[3]) { case 'tag': $this->DisableTag($request[4]); break; case 'thread': $this->DisableThread($request[4]); break; case 'group': $this->DisableGroup($request[4]); break; } } else { $this->disableSubscriptions(); } break; case "subscribe": if (isset($request[3]) and $request[3] == 'group') { $this->SubscribeGroup($request[4]); } break; case "unsubscribe": switch ($request[3]) { case 'thread': $this->UnsubscribeThread($request[4], $request[5]); break; case 'tag': $this->UnsubscribeTag($request[4], $request[5]); break; case 'group': $this->UnsubscribeGroup($request[4]); break; } break; default: $this->searchSubscriptions(); } } else { if (PVars::get()->debug) { throw new PException('unexpected forum action!'); } else { PRequest::home(); } } } } } } } } } } } } } } } } } } } } } } $page->content .= ob_get_contents(); ob_end_clean(); $page->newBar .= $view->getAsString('showCategoriesContinentsTagcloud'); $page->teaserBar .= $view->getAsString('teaser'); $page->render(); }
} ?> </table> <?php // Deactivated on our servers. Only used for testing locally. /* if (IsAdmin()) { $iiMax = count($TGuests); ?> <table class="full"> <tr><th colspan=2>Guest activity in last <?php echo $_SYSHCVOL['WhoIsOnlineDelayInMinutes']; ?> minutes </th></tr> <?php for ($ii = 0; $ii < $iiMax; $ii++) { $m = $TGuests[$ii]; ?> <tr> <td><?php echo $m->NbSec; ?> sec</td> <td><a href="/admin/adminlogs.php?ip=<?php echo $m->appearance; ?>"><?php echo $m->appearance; ?></a></td> <td><?php echo $m->lastactivity; ?></td> </tr> <?php } // end of for ii ?> </table> <?php } */ if (!APP_User::login()) { echo "<p>", $words->getFormatted("OnlinePrivateProfilesAreNotDisplayed"), "</p>\n"; }
/** * decide which page to show. * This method is called automatically */ public function index($args = false) { $request = PRequest::get()->request; if (!($User = APP_User::login())) { // First ensure that the user is logged in $page = new MessagesMustloginPage(); $page->setRedirectURL(implode('/', $request)); return $page; } $model = new LinkModel(); // look at the request. if (!isset($request[0])) { $page = new LinkShowPage('showlink'); } else { switch ($request[0]) { case 'link': default: if (!isset($request[1])) { $page = new LinkShowPage('showlink'); } else { switch ($request[1]) { case 'myself': $result->strerror = ""; $result->from = $_SESSION['Username']; $result->to = $request[2]; $IdGuy = $this->_model->getMemberID($result->to); if ($IdGuy <= 0) { if ($result->to == "") { $result->strerror .= "<br />You must give a second Username "; } else { $result->strerror .= "<br />No such member " . $result->to; } } if (isset($request[3])) { $result->limit = $request[3]; } else { $result->limit = 10; } $result->linksFull = $this->_model->getLinksFull($result->from, $result->to, $result->limit); $result->links = $this->_model->getLinks($result->from, $result->to, $result->limit); $page = new LinkShowPage($request[1], $result); break; case 'display': // Nota : display must not be a user name ! // fully decorated page $page = new LinkDisplayPage($request[1]); break; case 'update': // fully decorated page set_time_limit(0); $page = new LinkUpdatePage($request[1]); break; case 'rebuild': case 'rebuildmissing': // fully decorated page set_time_limit(0); $page = new LinkRebuildPage($request[1]); break; case 'showlink': // page with submenu $page = new LinkShowPage($request[1]); break; case 'showfriends': // page with submenu $page = new LinkShowFriendsPage($request[1]); break; default: $result->strerror = ""; $result->from = $request[1]; $IdGuy = $this->_model->getMemberID($result->from); if ($IdGuy <= 0) { if ($result->from == "") { $result->strerror .= "<br />You must give a first Username "; } else { $result->strerror .= "<br />No such member " . $result->from; } } $result->to = $request[2]; $IdGuy = $this->_model->getMemberID($result->to); if ($IdGuy <= 0) { if ($result->to == "") { $result->strerror .= "<br />You must give a second Username "; } else { $result->strerror .= "<br />No such member " . $result->to; } } if (isset($request[3])) { $result->limit = $request[3]; } else { $result->limit = 10; } $result->linksFull = $this->_model->getLinksFull($result->from, $result->to, $result->limit); $result->links = $this->_model->getLinks($result->from, $result->to, $result->limit); $page = new LinkShowPage($request[1], $result); break; } } } } // return the $page object, so the "$page->render()" function can be called somewhere else. return $page; }
$Blog = false; } $User = new User(); $callbackId = $User->settingsProcess(); $avCallbackId = $User->avatarProcess(); $vars =& PPostHandler::getVars($callbackId); $errors = isset($vars['errors']) ? $vars['errors'] : array(); $messages = isset($vars['messages']) ? $vars['messages'] : array(); $settingsText = array(); $errorText = array(); $messageText = array(); $i18n = new MOD_i18n('apps/user/settings.php'); $settingsText = $i18n->getText('settingsText'); $errorText = $i18n->getText('errorText'); $messageText = $i18n->getText('messageText'); if (!($User = APP_User::login())) { echo '<span class="error">' . $errorText['not_logged_in'] . '</span>'; return; } ?> <h2><?php echo $settingsText['title']; ?> </h2> <?php foreach ($messages as $msg) { if (array_key_exists($msg, $messageText)) { echo '<p class="notify">' . $messageText[$msg] . '</p>'; } } if (in_array('password_not_updated', $errors)) {
public function myPreferencesCallback($args, $action, $mem_redirect) { $vars = $args->post; $request = $args->request; $errors = $this->model->checkMyPreferences($vars); if (count($errors) > 0) { // show form again $mem_redirect->problems = $errors; $mem_redirect->post = $vars; return false; } if (!($User = APP_User::login())) { return false; } $this->model->editPreferences($vars); if (isset($vars['PreferenceLanguage']) && $_SESSION['IdLanguage'] != $vars['PreferenceLanguage']) { $this->model->setSessionLanguage($vars['PreferenceLanguage']); } // set profile as public if (isset($vars['PreferencePublicProfile']) && $vars['PreferencePublicProfile'] != '') { $this->model->set_public_profile($vars['memberid'], $vars['PreferencePublicProfile'] == 'Yes' ? true : false); } // set new password if (isset($vars['passwordnew']) && strlen($vars['passwordnew']) > 0) { $m = $this->model->getMemberWithId($vars['memberid']); if (!$m->setPassword($vars['passwordnew'])) { $mem_redirect->problems = array(0 => 'ChangePasswordNotUpdated'); } $this->setFlashNotice($this->getWords()->get('PasswordSetFlashNotice')); } return false; }
private function getGroupChangeForm($userHandle, $userId) { if (!($User = APP_User::login())) { return ''; } if ($User->hasRight('groupchange@user')) { $current_user = $this->_model->getUser($userId); $groups = $this->_model->getUserAuth(); $callbackid = $this->_model->groupChangeProcess(); $out = '<form method="post"> <input type="hidden" name="' . $callbackid . '" value="1" /> <input type="hidden" name="userid" value="' . $userId . '" /> Group of ' . $userHandle . ': <select name="newgroup">'; foreach ($groups as $groupid => $group) { $out .= '<option value="' . $groupid . '"' . ($groupid == $current_user->auth_id ? ' selected="selected"' : '') . '>' . $group . '</option>'; } $out .= '</select><input type="submit" value="Change" /></form>'; return $out; } return ''; }
/** * Index function * * Currently the index consists of following possible requests: * checkemail - prints either "0" or "1" depending on e-mail validity * checkhandle - like "checkemail" with user handle * register - registration form to page content * * @param void */ public function index() { // index is called when http request = ./user $request = PRequest::get()->request; if (!isset($request[1])) { $request[1] = ''; } switch ($request[1]) { case 'avatar': PRequest::ignoreCurrentRequest(); if (!isset($request[2]) || !preg_match(User::HANDLE_PREGEXP, $request[2]) || !($userId = $this->_model->handleInUse($request[2]))) { PPHP::PExit(); } $this->_view->avatar($userId); break; // checks e-mail address for validity and availability // checks e-mail address for validity and availability case 'checkemail': // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($_GET['e'])) { echo '0'; PPHP::PExit(); } if (!PFunctions::isEmailAddress($_GET['e'])) { echo '0'; PPHP::PExit(); } echo (bool) (!$this->_model->emailInUse($_GET['e'])); PPHP::PExit(); break; // checks handle for validity and availability // checks handle for validity and availability case 'checkhandle': // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($request[2])) { echo '0'; PPHP::PExit(); } if (!preg_match(User::HANDLE_PREGEXP, $request[2])) { echo '0'; PPHP::PExit(); } if (strpos($request[2], 'xn--') !== false) { // Don't allow IDN-Prefixes echo '0'; PPHP::PExit(); } echo (bool) (!$this->_model->handleInUse($request[2])); PPHP::PExit(); break; // confirms a registration // confirms a registration case 'confirm': if (!isset($request[2]) || !isset($request[3]) || !preg_match(User::HANDLE_PREGEXP, $request[2]) || !$this->_model->handleInUse($request[2]) || !preg_match('/^[a-f0-9]{16}$/', $request[3])) { $error = true; } else { if ($this->_model->confirmRegister($request[2], $request[3])) { $error = false; } else { $error = true; } } ob_start(); $this->_view->registerConfirm($error); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; break; case 'find': $res = $this->_model->find($_GET['q']); ob_start(); $this->_view->searchResult($res); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; break; case 'friends': if (!($User = APP_User::login())) { return false; } $friends = $this->_model->getFriends($User->getId()); ob_start(); $this->_view->friends($friends); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; break; case 'logout': $this->_model->logout(); header("Location: " . PVars::getObj('env')->baseuri); break; // waiting approval message // waiting approval message case 'waitingapproval': // now the teaser content ob_start(); $this->_view->ShowInfoMessage('', ''); $str = ob_get_contents(); $Page = PVars::getObj('page'); $Page->teaserBar .= $str; ob_end_clean(); // now the message content ob_start(); $this->_view->ShowInfoMessage('WaitingForApprovalText', 'WaitingForApprovalTitle'); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; break; case 'settings': ob_start(); $this->_view->settingsForm(); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; break; case 'password': ob_start(); $this->_view->customStyles(); $str = ob_get_contents(); $Page = PVars::getObj('page'); $Page->addStyles .= $str; ob_end_clean(); // now the teaser content ob_start(); $this->_view->teaser(); $str = ob_get_contents(); $Page = PVars::getObj('page'); $Page->teaserBar .= $str; ob_end_clean(); // now the content on the right ob_start(); $this->_view->rightContent(); $str = ob_get_contents(); $Page = PVars::getObj('page'); $Page->rContent .= $str; ob_end_clean(); // main content ob_start(); $this->_view->passwordForm(); $str = ob_get_contents(); $P = PVars::getObj('page'); $P->content .= $str; ob_end_clean(); break; default: if (preg_match(User::HANDLE_PREGEXP, $request[1])) { if (!isset($request[2])) { $request[2] = ''; } switch ($request[2]) { case 'pic': if (!($User = APP_User::login())) { return false; } ob_start(); $picture = $this->_model->getPicture($request[1]); $this->_view->picture($picture); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; break; default: // redirects to the old bw-based profile header("Location: " . PVars::getObj('env')->baseuri . "bw/member.php?cid=" . $request[1]); // disabled TB-based userpage for now /* ob_start(); $this->_view->userPage($request[1]); $str = ob_get_contents(); ob_end_clean(); $P = PVars::getObj('page'); $P->content .= $str; */ break; } } } }
/** * Fetches matching threads/posts from the Sphinx index * * @return mixed Either false if there was a problem with the search box content or a list of matches. */ public function searchProcess() { if (!($User = APP_User::login())) { return false; } $vars =& PPostHandler::getVars(); $vars_ok = $this->_checkVarsSearch($vars); if ($vars_ok) { $keyword = htmlspecialchars($vars['fs-keyword']); PPostHandler::clearVars(); return PVars::getObj('env')->baseuri . $this->forums_uri . 'search/' . $keyword; } return false; }
public function find($str) { if (!preg_match(self::HANDLE_PREGEXP, $str)) { return 'format'; } $query = ' SELECT u.`id`, u.`handle`, COUNT(f.`user_id_foreign`) AS `is_friend` FROM `user` AS u LEFT JOIN `user_friends` AS f ON f.`user_id_foreign` = ' . (APP_User::login() ? (int) APP_User::login()->getId() : 'null') . ' AND f.`user_id_foreign_friend` = u.`id` WHERE u.`handle` LIKE \'%' . $this->dao->escape($str) . '%\' GROUP BY u.`id` ORDER BY u.`handle` '; $q = $this->dao->query($query); if (!$q->numRows()) { return false; } return $q; }
This File display a topic and the messages which are inside it * @author Original author unknown * @author Michael Dettbarn (lupochen) <*****@*****.**> * @updated JeanYves */ // This means no thread was fetch or that it was outside visibility if (!isset($topic->topicinfo->IdTitle) and !isset($topic->topicinfo->ThreadDeleted)) { echo "<h2 class=\"forumstopic\">", $topic->topicinfo->title, "</h2>"; } else { //$i18n = new MOD_i18n('apps/forums/board.php'); //$boardText = $i18n->getText('boardText'); $words = new MOD_words(); $User = APP_User::login(); $can_del = $User && $User->hasRight('delete@forums'); // Not to use anymore (JeanYves) $can_edit_own = $User; // $can_edit_own = $User && $User->hasRight('edit_own@forums'); $can_edit_foreign = $User && $User->hasRight('edit_foreign@forums'); if (!isset($topic->topicinfo->IsClosed)) { $topic->topicinfo->IsClosed = false; } echo "<h2 class=\"forumstopic\">"; if ($topic->topicinfo->ThreadDeleted == 'Deleted') { echo "[Deleted]"; } if ($topic->topicinfo->ThreadVisibility == 'ModeratorOnly') { echo "[ModOnly]"; }
protected function column_col3() { // default values $selCountry = 0; $javascript = false; $selCity = null; $selYear = 0; //get baseuri $baseuri = PVars::getObj('env')->baseuri; if (PVars::getObj('env')->force_ssl_sensitive) { $baseuri = PVars::getObj('env')->baseuri_https; } // Overwrite Signup-Geo-Info with GeoVars-Session (used for non-js users), afterwards unset it again. if (isset($_SESSION['GeoVars'])) { foreach ($_SESSION['GeoVars'] as $key => $value) { $_SESSION['SignupBWVars'][$key] = $value; } unset($_SESSION['GeoVars']); } // values from previous form submit if (!($mem_redirect = $this->layoutkit->formkit->getMemFromRedirect()) && !isset($_SESSION['SignupBWVars'])) { // this is a fresh form } else { if (isset($_SESSION['SignupBWVars'])) { // we have vars stored already $vars = $_SESSION['SignupBWVars']; } else { $vars = $mem_redirect->post; } // last time something went wrong. // recover old form input. if (isset($vars['country'])) { $selCountry = $vars['country']; } if (isset($vars['city'])) { $selCity = $vars['city']; } if (isset($vars['admincode'])) { $selCity = $vars['admincode']; } if (isset($vars['javascriptactive'])) { // nothing? } if (isset($vars['javascriptactive']) && $vars['javascriptactive'] === 'true') { $javascript = true; } if (isset($vars['birthyear'])) { $selYear = $vars['birthyear']; } } $birthYearOptions = $this->buildBirthYearOptions($selYear); // get current request $request = PRequest::get()->request; if (!isset($vars['errors']) || !is_array($vars['errors'])) { $vars['errors'] = array(); } $words = $this->layoutkit->words; $callback_tag = $this->layoutkit->formkit->setPostCallback('SignupController', 'signupFormCallback'); if ($User = APP_User::login()) { // show the page anyway. // redirect should happen in the controller. // but for translators show the page. echo ' <div style="background:yellow; border:1px solid black; padding:10px; width: 44em; margin-bottom: 2em;"> <div style="font-size:160%;"> You can see the signup page because you are a translator.<br> Normally you cannot see it when logged in.<br> Please only use the page for translations! </div> <br> Related page: <a href="signup/finish">Signup confirmation</a> </div> '; } require 'templates/registerform' . $this->step . '.php'; echo '<p class="small">* ' . $words->get('SignupMandatoryFields') . '</p>'; }