Example #1
0
 public function userOverviewSimple($statement, $userHandle, $galleries = false)
 {
     $words = new MOD_words();
     $Gallery = new GalleryController();
     $callbackId = $Gallery->updateGalleryProcess();
     $vars =& PPostHandler::getVars($callbackId);
     if (!isset($vars['errors'])) {
         $vars['errors'] = array();
     }
     $type = 'images';
     $galleries = $this->_model->getUserGalleries();
     echo '
     <form method="post" action="gallery/show/user/' . $userHandle . '/pictures" name="mod-images" class="def-form">
     <input type="hidden" name="' . $callbackId . '" value="1"/>
     ';
     if (in_array('gallery', $vars['errors'])) {
         echo '<span class="error">' . $words->get('GalleryErrorsPhotosets') . '</span>';
     }
     if (in_array('images', $vars['errors'])) {
         echo '<span class="error">' . $words->get('GalleryErrorsImages') . '</span>';
     }
     require 'templates/overview.php';
     require 'templates/user_controls.php';
     echo '</form>';
 }
Example #2
0
 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;
     }
 }
Example #3
0
 /**
  *
  */
 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';
 }
Example #4
0
 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] = '';
     }
 }
Example #5
0
 public static function get()
 {
     if (!isset(self::$_instance) || get_class(self::$_instance) != __CLASS__) {
         if (isset($_SESSION) && is_array($_SESSION) && array_key_exists('PostHandler', $_SESSION) && !empty($_SESSION['PostHandler'])) {
             self::$_instance = unserialize($_SESSION['PostHandler']);
             unset($_SESSION['PostHandler']);
         } else {
             $c = __CLASS__;
             self::$_instance = new $c();
         }
     }
     if (self::$_instance->_postHandling) {
         return false;
     }
     if (is_array($_POST) && count($_POST) > 0) {
         self::$_instance->_postHandling = true;
         self::$_instance->save();
         $_SESSION['PostHandler'] = serialize(self::$_instance);
         $req = $_SERVER['REQUEST_URI'];
         if (!PVars::get()->cookiesAccepted) {
             $req = parse_url($req);
             $query = array();
             if (isset($request['query'])) {
                 parse_str($request['query'], $query);
             }
             if (is_array($query) && !array_key_exists(session_name(), $query)) {
                 $query[session_name()] = session_id();
                 $queries = array();
                 foreach ($query as $k => $q) {
                     $queries[] = $k . '=' . $q;
                 }
                 $req['query'] = implode('&', $queries);
             }
             $req = PFunctions::glueParsedUrl($req);
         }
         session_write_close();
         header('Location: ' . $req);
         PPHP::PExit();
     } else {
         $_SESSION['PostHandler'] = serialize(self::$_instance);
         self::$_instance->_postHandling = false;
     }
     return self::$_instance;
 }
Example #6
0
 /**
  * Processing edit of a blog.
  *
  * This is a POST callback function.
  *
  * Sets following errors in POST vars:
  * title        - invalid(empty) title.
  * startdate    - wrongly formatted start date.
  * enddate      - wrongly formatted end date.
  * duration     - empty enddate and invalid duration.
  * category     - category is not belonging to user.
  * trip         - trip is not belonging to user.
  * upderror     - error performing db update.
  * tagerror     - error while updating tags.
  */
 public function editProcess($args, $action, $mem_redirect, $mem_resend)
 {
     if (!($member = $this->_model->getLoggedInMember())) {
         return false;
     }
     $userId = $member->id;
     $vars = $args->post;
     if (!isset($vars['id']) || !$this->_model->isUserPost($userId, $vars['id'])) {
         return false;
     }
     if (isset($vars['txt'])) {
         $vars['txt'] = $this->_cleanupText($vars['txt']);
     }
     if (!$this->_validateVars($vars)) {
         return false;
     }
     $post = $this->_model->getPost($vars['id']);
     if (!$post) {
         return false;
     }
     $flags = $post->flags;
     // cannot write sticky blogs currently
     $flags = $flags & ~(int) Blog::FLAG_STICKY;
     if (!isset($vars['vis'])) {
         $vars['vis'] = 'pri';
     }
     switch ($vars['vis']) {
         case 'pub':
             $flags = $flags & ~(int) Blog::FLAG_VIEW_PROTECTED & ~(int) Blog::FLAG_VIEW_PRIVATE;
             break;
         case 'prt':
             $flags = $flags & ~(int) Blog::FLAG_VIEW_PRIVATE | (int) Blog::FLAG_VIEW_PROTECTED;
             break;
         default:
             $flags = $flags & ~(int) Blog::FLAG_VIEW_PROTECTED | (int) Blog::FLAG_VIEW_PRIVATE;
             break;
     }
     $tripId = isset($vars['tr']) && strcmp($vars['tr'], '') != 0 ? (int) $vars['tr'] : false;
     $this->_model->updatePost($post->blog_id, $flags, $tripId);
     // 'Touch' the corresponding trip!
     if ($tripId) {
         $TripModel = new Trip();
         $TripModel->touchTrip($tripId);
     }
     /*// to sql datetime format.
       if ((isset($vars['sty']) && (int)$vars['sty'] != 0) || (isset($vars['stm']) && (int)$vars['stm'] != 0) || (isset($vars['std']) && (int)$vars['std'] != 0)) {
           $start = mktime(0, 0, 0, (int)$vars['stm'], (int)$vars['std'], (int)$vars['sty']);
           $start = date('YmdHis', $start);
       } else {
           $start = false;
       } */
     // to sql datetime format.
     if (isset($vars['date']) && (strlen($vars['date']) <= 10 && strlen($vars['date']) > 8)) {
         list($day, $month, $year) = preg_split('/[\\/.-]/', $vars['date']);
         if (substr($month, 0, 1) == '0') {
             $month = substr($month, 1, 2);
         }
         if (substr($day, 0, 1) == '0') {
             $day = substr($day, 1, 2);
         }
         $start = mktime(0, 0, 0, (int) $month, (int) $day, (int) $year);
         $start = date('YmdHis', $start);
     } else {
         $start = false;
     }
     // Check if the location already exists in our DB and add it if necessary
     if ($vars['geonameid'] && $vars['latitude'] && $vars['longitude'] && $vars['geonamename'] && $vars['geonamecountrycode'] && $vars['admincode']) {
         $geoname_ok = $this->_model->checkGeonamesCache($vars['geonameid']);
     } else {
         $geoname_ok = false;
     }
     $geonameId = $geoname_ok ? $vars['geonameid'] : false;
     $this->_model->updatePostData($post->blog_id, $vars['t'], $vars['txt'], $start, $geonameId);
     if (!$this->_model->updateTags($post->blog_id, explode(',', $vars['tags']))) {
         $vars['errors'] = array('tagerror');
         return false;
     }
     $this->_model->updateBlogToCategory($post->blog_id, $vars['cat']);
     PPostHandler::clearVars();
     return 'blog/edit/' . $post->blog_id . '/finish';
 }
Example #7
0
 public function editProcess()
 {
     $callbackId = PFunctions::hex2base64(sha1(__METHOD__));
     if (PPostHandler::isHandling()) {
         return $this->_model->editProcess($callbackId);
     } else {
         PPostHandler::setCallback($callbackId, __CLASS__, __METHOD__);
         return $callbackId;
     }
 }
Example #8
0
 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;
     }
 }
Example #9
0
along with this program; if not, see <http://www.gnu.org/licenses/> or
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA  02111-1307, USA.

This form is for editing or translating a post
it is call by the Edit/Translate link
and by the edit post
*/
$words = new MOD_words();
$request = PRequest::get()->request;
$uri = implode('/', $request);
$groupsforum = $request[0] == 'groups' && is_numeric($request[1]) ? $request[1] : false;
if (isset($this->suggestionsGroupId)) {
    $groupsforum = $this->suggestionsGroupId;
}
$vars =& PPostHandler::getVars($callbackId);
if (isset($vars['tags']) && $vars['tags']) {
    $tags_with_commas = implode(', ', $vars['tags']);
} else {
    if (isset($tags) && $tags) {
        $tags_with_commas = implode(', ', $tags);
    } else {
        $tags_with_commas = false;
    }
}
?>
<script type="text/javascript" src="script/blog_suggest.js"></script>
<script type="text/javascript" src="script/forums_suggest.js"></script>
<?php 
if (!isset($disableTinyMCE) || $disableTinyMCE == 'No') {
    $textarea = 'topic_text';
 protected function traditionalPostHandling()
 {
     if (!isset($_SESSION['PostHandler'])) {
         // do nothing
     } else {
         if (!is_a($this->try_unserialize($_SESSION['PostHandler']), 'PPostHandler')) {
             // the $_SESSION['PostHandler'] got damaged.
             // a reset can repair it.
             unset($_SESSION['PostHandler']);
         }
     }
     // traditional posthandler
     PPostHandler::get();
 }
Example #11
0
 public function editGalleryProcess($vars)
 {
     $this->dao->exec("UPDATE `gallery` SET `title` = '" . $vars['t'] . "' , `description` = '" . $vars['txt'] . "' WHERE `id`= " . $vars['id']);
     PPostHandler::clearVars($callbackId);
     return false;
 }
Example #12
0
 public function delProcess($callbackId)
 {
     $vars =& PPostHandler::getVars($callbackId);
     if ($this->checkTripOwnership($vars['trip_id'])) {
         $this->dao->query('START TRANSACTION');
         // Update all blog entries and remove the trip-foreign key
         $query = sprintf("UPDATE `blog` SET `trip_id_foreign` = NULL WHERE `trip_id_foreign` = '%d'", $vars['trip_id']);
         $this->dao->query($query);
         // Delete the trip data
         $query = sprintf("DELETE FROM `trip_data` WHERE `trip_id` = '%d' LIMIT 1", $vars['trip_id']);
         $this->dao->query($query);
         // Delete the trip
         $query = sprintf("DELETE FROM `trip` WHERE `trip_id` = '%d' LIMIT 1", $vars['trip_id']);
         $this->dao->query($query);
         $this->dao->query('COMMIT');
         return PVars::getObj('env')->baseuri . 'trip';
     }
 }
Example #13
0
 /**
  * Loading register form template
  *
  * @param void
  */
 public function registerForm()
 {
     // instantiate signup model
     $Signup = new Signup();
     // retrieve the callback ID
     $callbackId = $Signup->registerProcess();
     // get the saved post vars
     $vars =& PPostHandler::getVars($callbackId);
     $javascript = false;
     if (isset($vars['javascriptactive'])) {
     }
     if (isset($vars['javascriptactive']) && $vars['javascriptactive'] === 'true') {
         $javascript = true;
     }
     $selYear = 0;
     if (isset($vars['birthyear'])) {
         $selYear = $vars['birthyear'];
     }
     $birthYearOptions = $this->buildBirthYearOptions($selYear);
     require 'templates/registerform.php';
     PPostHandler::clearVars($callbackId);
 }
Example #14
0
    /**
     * 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;
        }
    }
Example #15
0
 public function editForm($blogId, $callbackId)
 {
     $member = $this->_model->getLoggedInMember();
     // get the saved post vars
     $vars =& PPostHandler::getVars($callbackId);
     $errors = array();
     $lang = array();
     $i18n = new MOD_i18n('apps/blog/editcreate.php');
     $words = new MOD_words();
     $errors = $i18n->getText('errors');
     $lang = $i18n->getText('lang');
     $monthNames = array();
     $i18n = new MOD_i18n('date.php');
     $monthNames = $i18n->getText('monthNames');
     $catIt = $this->_model->getCategoryFromUserIt($member->id);
     $tripIt = $this->_model->getTripFromUserIt($member->id);
     $google_conf = PVars::getObj('config_google');
     $defaultVis->valueint = 2;
     // hack: TB settings are disabled as they reference app_user - default visibility is public
     //$defaultVis = A PP_User::getSetting($member->id, 'APP_blog_defaultVis');
     if (!isset($request[3]) || $request[3] != 'finish') {
         echo '<h2>' . $words->get('BlogEditTitle') . '</h2>';
     } else {
         // $request[2] == 'finish'
         echo '<h2>' . $words->get('BlogEditFinishTitle') . "</h2>\n";
         echo $words->get('BlogEditFinishText') ? '<p>' . $words->get('BlogEditFinishText') . "</p>\n" : '';
         echo $words->get('BlogEditFinishInfo') ? '<p>' . $words->get('BlogEditFinishInfo') . "</p>\n" : '';
     }
     $actionUrl = 'blog/edit/' . $blogId;
     $submitName = 'submit_blog_edit';
     $submitValue = $words->getSilent('BlogEditSubmit');
     $disableTinyMCE = $this->_model->getTinyMCEPreference();
     require 'templates/editcreateform.php';
 }
<?php

$words = new MOD_words();
$request = PRequest::get()->request;
$layoutbits = new MOD_layoutbits();
$d = $image = $this->image;
$Gallery = new GalleryModel();
$gallery_ctrl = new GalleryController();
if ($this->model->getLoggedInMember()) {
    $callbackId = $gallery_ctrl->editProcess($image);
    $vars =& PPostHandler::getVars($callbackId);
    $callbackIdCom = $gallery_ctrl->commentProcess($image);
    $varsCom =& PPostHandler::getVars($callbackIdCom);
    $R = MOD_right::get();
    $GalleryRight = $R->hasRight('Gallery');
}
if (!isset($vars['errors'])) {
    $vars['errors'] = array();
}
$Previous = $this->previous;
$Next = $this->next;
$userpic = MOD_layoutbits::PIC_30_30($d->user_handle, '', $style = 'float_left');
echo <<<HTML
    <div class="floatbox" style="padding-top: 30px;">
        {$userpic}
        {$words->flushBuffer()}
        <h3><a href="gallery/show/user/{$image->user_handle}">{$words->getFormatted('galleryUserOthers', $image->user_handle)}</a></h3>
    </div>
HTML;
$UserId = 1;
$SetId = false;
Example #17
0
 /**
  * A tiny wee quicksearch box
  */
 protected function quicksearch()
 {
     $words = $this->getWords();
     $logged_in = APP_User::isBWLoggedIn('NeedMore,Pending');
     if (!$logged_in) {
         $request = PRequest::get()->request;
         if (!isset($request[0])) {
             $login_url = 'login';
         } else {
             switch ($request[0]) {
                 case 'login':
                 case 'main':
                 case 'start':
                     $login_url = 'login';
                     break;
                 default:
                     $login_url = 'login/' . htmlspecialchars(implode('/', $request), ENT_QUOTES);
             }
         }
     } else {
         $username = isset($_SESSION['Username']) ? $_SESSION['Username'] : '';
     }
     if (class_exists('MOD_online')) {
         $who_is_online_count = MOD_online::get()->howManyMembersOnline();
     } else {
         // echo 'MOD_online not active';
         if (isset($_SESSION['WhoIsOnlineCount'])) {
             $who_is_online_count = $_SESSION['WhoIsOnlineCount'];
             // MOD_whoisonline::get()->whoIsOnlineCount();
         } else {
             $who_is_online_count = 0;
         }
     }
     PPostHandler::setCallback('quicksearch_callbackId', 'SearchmembersController', 'index');
     require TEMPLATE_DIR . 'shared/roxpage/quicksearch.php';
 }
Example #18
0
 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;
 }
Example #19
0
    echo htmlentities($vars['d'], ENT_COMPAT, 'utf-8');
}
?>
</textarea>
            <p class="desc"><?php 
echo $words->get('TripDesc_desc2');
?>
</p>
        </div>
    </fieldset>
    <p>
<?php 
if (isset($vars['trip_id']) && $vars['trip_id']) {
    echo '<input type="hidden" name="trip_id" value="' . $vars['trip_id'] . '" />';
}
?>
        <input type="hidden" name="<?php 
echo $callbackId;
?>
" value="1"/>
        <input type="submit" value="<?php 
echo $editing ? $words->getSilent('TripSubmit_edit') : $words->getSilent('TripSubmit_create');
?>
"/><?php 
echo $words->flushBuffer();
?>
    </p>
</form>
<?php 
PPostHandler::clearVars($callbackId);
Example #20
0
 /**
  * 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;
     }
 }
Example #21
0
 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;
     }
 }
Example #22
0
 /**
  */
 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;
     }
 }
Example #23
0
 /**
  * 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;
 }
Example #24
0
<div id="teaser" class="clearfix">
    <h1><?php 
echo $words->getFormatted('quicksearchTitle');
?>
</h1>
    <div>
        <div id="searchteaser" style="width: 40%"  class="float_left">
            <fieldset id="searchtop" name="searchtop">
            <strong class="small"><?php 
echo $words->getFormatted('FindPeopleEnterSomething');
?>
</strong><br />
            <form action="searchmembers/quicksearch" method="get">
            <input type="text" name="searchtext" size="25" maxlength="30" id="text-field" value="Search...." onfocus="this.value='';"/>
            <?php 
PPostHandler::setCallback('quicksearch_callbackId', 'SearchmembersController', 'index');
?>
            <input type="hidden" name="quicksearch_callbackId" value="1"/>
            <input type="submit" value="<?php 
echo $words->getBuffered('FindPeopleSubmitSearch');
?>
" id="submit-button" class="button" />
            </form>
            &nbsp; &nbsp; &nbsp; 
            </fieldset>
        </div>   
        <div id="searchteaser2" style="width: 40%" class="float_left">
            <p><a href="searchmembers/mapon"><?php 
echo $words->getFormatted('TryMapSearch');
?>
!</a></p>
Example #25
0
 /**
  * Display the form for a Moderator edit
  */
 public function showModeratorEditTag(&$callbackId, $DataTag)
 {
     //        PVars::getObj('page')->title = "Moderator Edit Tag";
     $this->SetPageTitle("Moderator Edit Page");
     $vars =& PPostHandler::getVars($callbackId);
     require 'templates/modtagform.php';
 }
Example #26
0
 /**
  * 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;
     }
 }
Example #27
0
<input type="hidden" name="mapsearch" id="mapsearch" value="0" />
<input type="hidden" name="bounds_zoom" id="bounds_zoom" />
<input type="hidden" name="bounds_center_lat" id="bounds_center_lat" />
<input type="hidden" name="bounds_center_lng" id="bounds_center_lng" />
<input type="hidden" name="bounds_sw_lat" id="bounds_sw_lat" />
<input type="hidden" name="bounds_ne_lat" id="bounds_ne_lat" />
<input type="hidden" name="bounds_sw_lng" id="bounds_sw_lng" />
<input type="hidden" name="bounds_ne_lng" id="bounds_ne_lng" />
<input type="hidden" name="CityName" id="CityName" />
<input type="hidden" name="CityNameOrg" id="CityNameOrg" />
<input type="hidden" name="accuracy_level" id="accuracy_level" />
<input type="hidden" name="place_coordinates" id="place_coordinates" />
<input type="hidden" name="IdCountry" id="IdCountry" />
<input type="hidden" name="start_rec" id="start_rec" />
<?php 
PPostHandler::setCallback("searchmembers_callbackId", "SearchmembersController", "index");
?>
<input type="hidden" name="searchmembers_callbackId" value="1" />
<div id="FindPeopleFilter">
<table class="float_left"><tr><td>
<strong class="small"><?php 
echo $words->getFormatted('Username');
?>
</strong><br />
<input type="text" name="Username" id="UsernameField" size="30" maxlength="30" value="" onfocus="getFieldHelp(this.name);" onkeypress="if(chkEnt(this, event)) if(CheckEmpty(getElementById('Address'))) {searchGlobal(0)} else {searchByText(get_val('Address'), 0)};" />
</td><td>
<strong class="small"><?php 
echo $words->getFormatted('TextToFind');
?>
</strong><br />
<input type="text" name="TextToFind" id="TextToFindField" size="30" maxlength="30" value="" onfocus="getFieldHelp(this.name);" onkeypress="if(chkEnt(this, event)) if(CheckEmpty(getElementById('Address'))) {searchGlobal(0)} else {searchByText(get_val('Address'), 0)};" />