public function editProcess($actionurl = false) { global $callbackId; if (PPostHandler::isHandling()) { $vars =& PPostHandler::getVars(); if ($vars) { // Populate the _REQUEST array with the Post-Vars, so the wiki can use them :-/ foreach ($vars as $key => $value) { $_REQUEST[$key] = $value; } } $url = $this->parseRequest(); $this->no_output = true; ob_start(); $this->getWiki($url); ob_end_clean(); PPostHandler::clearVars(); $url = str_replace('edit/', '', $url); if ($actionurl) { header('Location: ' . PVars::getObj('env')->baseuri . $actionurl); PPHP::PExit(); } header('Location: ' . PVars::getObj('env')->baseuri . 'wiki/' . $url); PPHP::PExit(); //return PVars::getObj('env')->baseuri.'wiki'; } else { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); PPostHandler::setCallback($callbackId, __CLASS__, __FUNCTION__); return $callbackId; } }
/** * */ public function activitylogs($level) { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { $vars =& PPostHandler::getVars(); } else { $vars = $this->_gainGetParams(); } $result = $this->_model->procActivitylogs($vars, $level); $tData = current($result); $totalNumber = key($result); PPostHandler::setCallback($callbackId, __CLASS__, __FUNCTION__); require 'templates/activitylogs.php'; }
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] = ''; } }
/** * Processing creation of a comment * * This is a POST callback function. * * Sets following errors in POST vars: * title - invalid(empty) title. * textlen - too short or long text. * inserror - db error while inserting. */ public function shoutProcess($table = false, $table_id = false) { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { if (!$_SESSION['IdMember']) { return false; } $vars =& PPostHandler::getVars(); $request = PRequest::get()->request; if (!$table) { $table = $vars['table']; } if (!$table_id) { $table_id = $vars['table_id']; } // validate if (!isset($vars['ctxt']) || strlen($vars['ctxt']) == 0 || strlen($vars['ctxt']) > 5000) { $vars['errors'] = array('textlen'); return false; } $shoutId = $this->dao->nextId('shouts'); $query = ' INSERT INTO `shouts` SET `id`=' . $shoutId . ', `table`=\'' . $table . '\', `table_id`=\'' . $table_id . '\', `member_id_foreign`=' . $_SESSION['IdMember'] . ', `title`=\'' . (isset($vars['ctit']) ? $this->dao->escape($vars['ctit']) : '') . '\', `text`=\'' . $this->dao->escape($vars['ctxt']) . '\', `created`=NOW()'; $s = $this->dao->query($query); if (!$s) { $vars['errors'] = array('inserror'); return false; } PPostHandler::clearVars(); return PVars::getObj('env')->baseuri . implode('/', $request) . '#c' . $shoutId; } else { PPostHandler::setCallback($callbackId, __CLASS__, __FUNCTION__); return $callbackId; } }
/** * Processing registration * * This is a POST callback function * * @see /htdocs/bw/signup.php * @param void */ public function registerProcess() { $c = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { $vars =& PPostHandler::getVars(); $errors = $this->checkRegistrationForm($vars); if (count($errors) > 0) { $vars['errors'] = $errors; return false; } $this->polishFormValues($vars); $idTB = $this->registerTBMember($vars); if (!$idTB) { MOD_log::get()->write("TB registration failed", "Signup"); return false; } $id = $this->registerBWMember($vars); $_SESSION['IdMember'] = $id; $vars['feedback'] .= $this->takeCareForNonUniqueEmailAddress($vars['email']); $vars['feedback'] .= $this->takeCareForComputerUsedByBWMember(); $this->writeFeedback($vars['feedback']); if (!empty($vars['feedback'])) { MOD_log::get()->write("feedback[<b>" . stripslashes($vars['feedback']) . "</b>] IdMember=#" . $_SESSION['IdMember'] . " (With New Signup !)", "Signup"); } $View = new SignupView($this); // TODO: BW 2007-08-19: $_SYSHCVOL['EmailDomainName'] define('DOMAIN_MESSAGE_ID', 'bewelcome.org'); // TODO: config $View->registerMail($vars, $id, $idTB); $View->signupTeamMail($vars); // PPostHandler::clearVars(); return PVars::getObj('env')->baseuri . 'signup/register/finish'; } else { PPostHandler::setCallback($c, __CLASS__, __FUNCTION__); return $c; } }
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; } }
/** */ public function index() { $vw = new ViewWrap($this->_view); $P = PVars::getObj('page'); // First check if the feature is closed if ($_SESSION["Param"]->FeatureSearchPageIsClosed != 'No') { $P->content = $this->_view->showFeatureIsClosed(); return; } // end of test "if feature is closed" if (PPostHandler::isHandling()) { return; } $request = PRequest::get()->request; if (!isset($request[1])) { $request[1] = ''; } // Route quicksearch if ($request[0] == 'quicksearch') { $error = false; // static pages switch ($request[1]) { case '': $searchtext = isset($_GET["vars"]) ? $_GET['vars'] : ''; // Because of old way to use the QuickSearch with a get break; default: $searchtext = $request[1]; break; } $TReturn = $this->_model->quicksearch($searchtext); if (count($TReturn->TMembers) == 1 and count($TReturn->TPlaces) == 0 and count($TReturn->TForumTags) == 0) { $loc = "members/" . $TReturn->TMembers[0]->Username; header('Location: ' . $loc); PPHP::PExit(); } else { if (count($TReturn->TMembers) == 0 and count($TReturn->TPlaces) == 1 and count($TReturn->TForumTags) == 0) { $loc = $TReturn->TPlaces[0]->link; header('Location: ' . $loc); PPHP::PExit(); } else { if (count($TReturn->TMembers) == 0 and count($TReturn->TPlaces) == 0 and count($TReturn->TForumTags) == 1) { $loc = "forums/t" . $TReturn->TForumTags[0]->IdTag; header('Location: ' . $loc); PPHP::PExit(); } } } $P->content .= $vw->quicksearch_results($TReturn); return $P; } if ($request[0] != 'searchmembers') { header('Location: searchmembers'); PPHP::PExit(); } // fix a problem with Opera javascript, which sends a 'searchmembers/searchmembers/ajax' request if ($request[1] === 'searchmembers') { $request = array_slice($request, 1); } // default mapstyle: $mapstyle = 'mapon'; $queries = ''; $varsOnLoad = ''; $varsGet = ''; if (isset($request[1])) { switch ($request[1]) { case 'mapoff': $mapstyle = "mapoff"; $_SESSION['SearchMembersTList'] = array(); break; case 'mapon': $mapstyle = "mapon"; $_SESSION['SearchMembersTList'] = array(); break; case 'queries': if (PVars::get()->debug) { $R = MOD_right::get(); if ($R->HasRight("Debug", "DB_QUERY")) { $queries = true; $mapstyle = "mapoff"; } } break; default: if (isset($_SESSION['SearchMapStyle']) and $_SESSION['SearchMapStyle']) { $mapstyle = $_SESSION['SearchMapStyle']; } break; } } // Store the MapStyle in session $_SESSION['SearchMapStyle'] = $mapstyle; // Check wether there are latest search results and variables from the session if (!$queries && isset($_SESSION['SearchMembersTList'])) { if ($_SESSION['SearchMembersTList'] && $_SESSION['SearchMembersVars']) { $varsOnLoad = $_SESSION['SearchMembersVars']; } } switch ($request[1]) { case 'ajax': if (isset($request[2]) and $request[2] == "varsonload") { $vars['varsOnLoad'] = true; // Read the latest search results and variables from the session if (!empty($_SESSION['SearchMembersTList'])) { $TList = $_SESSION['SearchMembersTList']; } if (!empty($_SESSION['SearchMembersVars'])) { $vars = $_SESSION['SearchMembersVars']; } if (isset($request[3])) { $vars['OrderBy'] = $request[3]; $TList = $this->_model->search($vars); } } else { $vars = isset($_GET) ? $_GET : array(); if (isset($request[2]) && $request[2] == "queries") { $vars['queries'] = true; } if (!isset($TList)) { $TList = $this->_model->search($vars); } } $this->_view->searchmembers_ajax($TList, $vars, $mapstyle); // Store latest search results and variables in session $_SESSION['SearchMembersTList'] = $TList; $_SESSION['SearchMembersVars'] = $vars; PPHP::PExit(); break; /* quicksearch shouldn't go through this route case 'quicksearch': $mapstyle = "mapoff"; // First check if the QuickSearch feature is closed if ($_SESSION["Param"]->FeatureQuickSearchIsClosed!='No') { $this->_view->showFeatureIsClosed(); PPHP::PExit(); break ; } // end of test "if QuickSearch feature is closed" if (isset($request[2])) { // The parameter to search for can be for the form searchmember/quicksearch/ value $searchtext=$request[2] ; } if (isset($_GET['searchtext'])) { // The parameter can come from the main menu $searchtext = $_GET['searchtext']; } if (isset($_POST['searchtext'])) { // The parameter can come from the quicksearch form $searchtext = $_POST['searchtext']; } // die('here searchtext={'.$searchtext.'}') ; if (!empty($searchtext)) { $TReturn=$this->_model->quicksearch($searchtext) ; if ((count($TReturn->TMembers)==1) and (count($TReturn->TPlaces)==0) and (count($TReturn->TForumTags)==0)) { $loc="members/".$TReturn->TMembers[0]->Username ; header('Location: '.$loc); PPHP::PExit(); } else if ((count($TReturn->TMembers)==0) and (count($TReturn->TPlaces)==1) and (count($TReturn->TForumTags)==0)) { $loc=$TReturn->TPlaces[0]->link ; header('Location: '.$loc); PPHP::PExit(); } else if ((count($TReturn->TMembers)==0) and (count($TReturn->TPlaces)==0) and (count($TReturn->TForumTags)==1)) { $loc="forums/t".$TReturn->TForumTags[0]->IdTag ; header('Location: '.$loc); PPHP::PExit(); } $P->content .= $vw->quicksearch_results($TReturn); } else { $vars = PPostHandler::getVars('quicksearch_callbackId'); PPostHandler::clearVars('quicksearch_callbackId'); // first include the col2-stylesheet $P->addStyles .= $this->_view->customStyles($mapstyle,$quicksearch=1); // now the teaser content $P->teaserBar .= $vw->teaserquicksearch($mapstyle); $P->content .= $vw->quicksearch_form(); } break; // Backwards compatibility case 'index': $loc = PVars::getObj('env')->baseuri; $loc .= 'searchmembers'; if(isset($request[2])) {$loc .= '/'.$request[2];} elseif(isset($request[3])) {$loc .= '/'.$request[3];} header('Location: '.$loc); PPHP::PExit(); break; */ /* quicksearch shouldn't go through this route case 'quicksearch': $mapstyle = "mapoff"; // First check if the QuickSearch feature is closed if ($_SESSION["Param"]->FeatureQuickSearchIsClosed!='No') { $this->_view->showFeatureIsClosed(); PPHP::PExit(); break ; } // end of test "if QuickSearch feature is closed" if (isset($request[2])) { // The parameter to search for can be for the form searchmember/quicksearch/ value $searchtext=$request[2] ; } if (isset($_GET['searchtext'])) { // The parameter can come from the main menu $searchtext = $_GET['searchtext']; } if (isset($_POST['searchtext'])) { // The parameter can come from the quicksearch form $searchtext = $_POST['searchtext']; } // die('here searchtext={'.$searchtext.'}') ; if (!empty($searchtext)) { $TReturn=$this->_model->quicksearch($searchtext) ; if ((count($TReturn->TMembers)==1) and (count($TReturn->TPlaces)==0) and (count($TReturn->TForumTags)==0)) { $loc="members/".$TReturn->TMembers[0]->Username ; header('Location: '.$loc); PPHP::PExit(); } else if ((count($TReturn->TMembers)==0) and (count($TReturn->TPlaces)==1) and (count($TReturn->TForumTags)==0)) { $loc=$TReturn->TPlaces[0]->link ; header('Location: '.$loc); PPHP::PExit(); } else if ((count($TReturn->TMembers)==0) and (count($TReturn->TPlaces)==0) and (count($TReturn->TForumTags)==1)) { $loc="forums/t".$TReturn->TForumTags[0]->IdTag ; header('Location: '.$loc); PPHP::PExit(); } $P->content .= $vw->quicksearch_results($TReturn); } else { $vars = PPostHandler::getVars('quicksearch_callbackId'); PPostHandler::clearVars('quicksearch_callbackId'); // first include the col2-stylesheet $P->addStyles .= $this->_view->customStyles($mapstyle,$quicksearch=1); // now the teaser content $P->teaserBar .= $vw->teaserquicksearch($mapstyle); $P->content .= $vw->quicksearch_form(); } break; // Backwards compatibility case 'index': $loc = PVars::getObj('env')->baseuri; $loc .= 'searchmembers'; if(isset($request[2])) {$loc .= '/'.$request[2];} elseif(isset($request[3])) {$loc .= '/'.$request[3];} header('Location: '.$loc); PPHP::PExit(); break; */ default: $words = new MOD_words(); $P->addStyles = $this->_view->customStyles($mapstyle); $google_conf = PVars::getObj('config_google'); $P->title = $words->getBuffered('searchmembersTitle') . " - BeWelcome"; $P->currentTab = 'searchmembers'; $P->currentSubTab = 'searchmembers'; $subTab = 'index'; // prepare sort order for both the filters and the userbar $sortorder = $this->_model->get_sort_order(); $P->teaserBar = $vw->teaser($mapstyle, $sortorder, $varsOnLoad); $P->teaserBar .= $vw->searchmembersFilters($this->_model->sql_get_groups(), $this->_model->sql_get_set("members", "Accomodation"), $this->_model->sql_get_set("members", "TypicOffer"), $sortorder); $P->content = $vw->search_column_col3($sortorder, $queries, $mapstyle, $varsOnLoad, $varsGet, $this->_model->sql_get_set("members", "Accomodation")); /*$P->content = $vw->memberlist($mapstyle,$sortorder); $P->content .= $vw->searchmembers( $queries, $mapstyle, $varsOnLoad, $varsGet, $this->_model->sql_get_set("members", "Accomodation") ); */ $P->show_volunteerbar = false; break; } }
/** * Handles the post request of the forums search box */ public function searchProcess() { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { $this->parseRequest(); return $this->_model->searchProcess(); } else { PPostHandler::setCallback($callbackId, __CLASS__, __METHOD__); return $callbackId; } }
public function index($args = false) { if (PPostHandler::isHandling()) { return; } $request = $args->request; if (isset($request[0]) && 'rox' == $request[0]) { // bw.org/rox/in/lang or bw.org/rox/start // should be the same as just // bw.org/in/lang, or bw.org/start array_shift($request); } switch (isset($request[0]) ? $request[0] : false) { case 'in': // language switching if (!isset($request[1])) { $this->redirectHome(); } else { $this->_switchLang($request[1]); $this->redirect(array_slice($request, 2), $args->get); } PPHP::PExit(); case 'trmode': // an alias.. // an alias.. case 'tr_mode': // translation mode switching if (!isset($request[1])) { $this->redirectHome(); } else { $this->_switchTrMode($request[1]); $this->redirect(array_slice($request, 2), $args->get); } PPHP::PExit(); case 'start': $page = new PublicStartpage(); break; case 'trac': case 'mediawiki': case 'mailman': $this->redirectAbsolute('http://www.bevolunteer.org/' . $request[0]); PPHP::PExit(); case 'www.bewelcome.org': // some emails sent by mailbot contain a link to // http://www.bewelcome.org/www.bewelcome.org/something // we need to redirect them to // https://www.bewelcome.org/something $this->redirect(array_slice($request, 1), $args->get); PPHP::PExit(); case 'main': case 'home': case 'index': case '': default: if (APP_User::isBWLoggedIn("NeedMore,Pending")) { $page = new PersonalStartpage(); // This is the Main Start page for logged in members } else { $page = new PublicStartpage(); // This is the Default Start page for not logged in members } } $page->setModel($this->_model); $page->model = $this->_model; // some want it like this return $page; }
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; $member = $this->_model->getLoggedInMember(); //$User = A PP_User::login(); if (!isset($request[1])) { $request[1] = ''; } // user bar // show the userbar always for now: /*if ($User && $request[1] != 'tags') { */ // $P->newBar .= $vw->userbar(); /*} */ $bloguser = 0; $RSS = false; switch ($request[1]) { case 'ajax': if (!isset($request[2])) { PPHP::PExit(); } switch ($request[2]) { case 'post': $this->ajaxPost(); break; } break; case 'suggestTags': // 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(); break; case 'suggestLocation': // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($request[2])) { PPHP::PExit(); } $locations = $this->_model->suggestLocation($request[2]); echo $this->_view->generateLocationOverview($locations); PPHP::PExit(); break; case 'create': if (!$member) { PRequest::home(); } if (isset($request[2]) && $request[2] == 'finish' && isset($request[3]) && $this->_model->isPostId($request[3])) { $page = new BlogSinglePostPage($this->_model); $page->member = $member; $page->post = $this->_model->getPost($request[3]); } else { $page = new BlogCreatePage($this->_model); } return $page; case 'del': if (!$member || !isset($request[2]) || !$this->_model->isUserPost($member->id, $request[2])) { PRequest::home(); } $post = $this->_model->getPost($request[2]); $p = new BlogDeletePage($this->_model); $p->member = $member; $p->post = $post; return $p; case 'edit': if (!$member || !isset($request[2]) || !$this->_model->isUserPost($member->id, $request[2])) { PRequest::home(); } if (isset($request[3]) && $request[3] == 'finish') { $p = new BlogSinglePostPage($this->_model); $p->member = $member; $p->post = $this->_model->getPost($request[2]); return $p; } else { //$callbackId = $this->editProcess((int)$request[2]); //$vars =& PPostHandler::getVars($callbackId); if (!isset($vars['errors']) || !is_array($vars['errors'])) { $vars['errors'] = array(); } $this->_editFill($request[2], $vars); $p = new BlogEditPage($this->_model); $p->post = $this->_model->getPost($request[2]); $p->member = $member; $p->vars = $vars; return $p; $P->content .= $vw->editForm((int) $request[2], $callbackId); } break; case 'search': if (!empty($this->args_vars->get['s']) && strlen($this->args_vars->get['s']) >= 3) { $search = $this->args_vars->get['s']; $tagsposts = $this->_model->getTaggedPostsIt($search); $posts = $this->_model->searchPosts($search); } else { $error = 'To few arguments'; $posts = false; $tagsposts = false; $search = ''; } $p = new BlogSearchPage($this->_model); $p->posts = $posts; $p->tagged_posts = $tagsposts; $p->search = $search; return $p; $P->content .= $vw->searchPage($posts, $tagsposts); break; /* removed - references user app case 'settings': $p = new BlogSettingsPage($this->_model); return $p; $P->content .= $vw->settingsForm(); break; */ /* removed - references user app case 'settings': $p = new BlogSettingsPage($this->_model); return $p; $P->content .= $vw->settingsForm(); break; */ case 'tags': $p = new BlogTagsPage($this->_model); $p->tag = isset($request[2]) ? $request[2] : false; return $p; $P->content .= $vw->tags(isset($request[2]) ? $request[2] : false); break; case 'cat': $p = new BlogCategoriesPage($this->_model); return $p; break; default: $page = isset($this->args_vars->get['page']) && intval($this->args_vars->get['page']) ? intval($this->args_vars->get['page']) : 1; // display blogs of user $request[1] $memberBlog = $this->_model->getMemberByUsername($request[1]); if ($memberBlog) { if (!isset($request[2])) { $request[2] = ''; } switch ($request[2]) { case 'cat': if (isset($request[3])) { $p = new BlogPage($this->_model); $p->page = $page; $p->category = $request[3]; $p->member = $memberBlog; $p->initPager($this->_model->countRecentPosts($memberBlog->id, $request[3]), $page); $p->posts = $this->_model->getRecentPostsArray($memberBlog->id, $request[3], $page); break; } // if we're not dealing with a category, fall through and hit the default // if we're not dealing with a category, fall through and hit the default case '': default: // show different blog layout for public visitors if ($post = $this->_model->getPost($request[2])) { $p = new BlogSinglePostPage($this->_model); $p->member = $memberBlog; $p->post = $post; } else { $p = new BlogPage($this->_model); $p->page = $page; $p->member = $memberBlog; $p->initPager($this->_model->countRecentPosts($memberBlog->id, false), $page); $p->posts = $this->_model->getRecentPostsArray($memberBlog->id, false, $page); } break; } } else { $p = new BlogPage($this->_model); $p->page = $page; $p->initPager($this->_model->countRecentPosts(false, false), $page); $p->posts = $this->_model->getRecentPostsArray(false, false, $page); } return $p; } }
public function editProcess() { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); if (PPostHandler::isHandling()) { return $this->_model->editProcess($callbackId); } else { PPostHandler::setCallback($callbackId, __CLASS__, __METHOD__); return $callbackId; } }
public function uploadProcess() { $callbackId = PFunctions::hex2base64(sha1(__METHOD__)); $vars =& PPostHandler::getVars($callbackId); if (PPostHandler::isHandling()) { $this->_model->uploadProcess($vars); } else { PPostHandler::setCallback($callbackId, __CLASS__, __FUNCTION__); return $callbackId; } }