Beispiel #1
0
 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;
 }
    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';
    }
Beispiel #3
0
function Login($username, $password, $forward)
{
    APP_User::get()->login($username, $password);
    if (APP_User::loggedIn()) {
        if (!empty($forward)) {
            header("Location: {$forward}");
        }
    }
}
Beispiel #4
0
 public function render($fromID, $toID, $cssID)
 {
     $this->_init();
     $this->_model = new LinkModel();
     $logged = APP_User::isBWLoggedIn('NeedMore,Pending');
     if ($fromID != $toID && $logged) {
         $linkpath = $this->_model->getLinksFull($fromID, $toID, 1);
         if ($linkpath) {
             require 'templates/link.widget.singlepicturelinkpath.php';
         }
     }
 }
Beispiel #5
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] = '';
     }
 }
 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;
 }
Beispiel #7
0
 /**
  * Callback function for InviteAFriend page
  *
  * @param Object $args
  * @param Object $action 
  * @param Object $mem_redirect memory for the page after redirect
  * @param Object $mem_resend memory for resending the form
  * @return string relative request for redirect
  */
 public function InviteCallback($args, $action, $mem_redirect, $mem_resend)
 {
     $count = $action->count;
     $redirect_req = $action->redirect_req;
     $mem_redirect->post = $args->post;
     if (!APP_User::loggedIn()) {
         // not logged in.
         // the login form will be shown after the automatic redirect
         // after successful login, the message is recovered.
     } else {
         if ($count < 0) {
             // session has expired while user was typing.
             $mem_redirect->expired = true;
         } else {
             if ($mem_resend->already_sent_as) {
                 // form has already been processed, with the message sent!
                 // for a new message, the user needs a new form.
                 // tell the redirected page which message has been already sent!
                 $mem_redirect->already_sent_as = $mem_resend->already_sent_as;
             } else {
                 if ($count > 0) {
                     // form has been already processed $count times,
                     // but the last time it was not successful.
                     // so, we can send again
                     // but tell the page how many times it had failed before
                     $mem_redirect->fail_count = $count;
                 } else {
                     // first time to try sending the form
                 }
                 // now finally try to send it.
                 $result = new ReadOnlyObject($this->model->sendOrComplain($args->post));
                 if (count($result->problems) > 0) {
                     $mem_redirect->problems = $result->problems;
                 } elseif (!$result->status) {
                     $mem_redirect->problems = array('email', 'Unknown error - Invitation not sent.');
                 } else {
                     // sending message was successful
                     $mem_resend->already_sent_as = $result->message_id;
                     return "invite/sent";
                 }
             }
         }
     }
     return implode('/', $args->request);
 }
Beispiel #8
0
    /**
     * retrieves value(s) for one setting
     * 
     * may be called statically
     * 
     * @param int $userId
     * @param string $setting
     * @return stdClass
     */
    public static function getSetting($userId, $setting)
    {
        $c = self::get();
        if (self::loggedIn() && $userId == $c->getId() && isset($c->_settings)) {
            if (isset($c->_settings[$setting])) {
                return $c->_settings[$setting];
            }
        }
        $query = '
SELECT `value`, `valueint`, `valuedate` FROM `user_settings`
WHERE `user_id` = ' . (int) $userId . ' AND `setting` = \'' . $c->dao->escape($setting) . '\'
        ';
        $s = $c->dao->query($query);
        if ($s->numRows() == 0) {
            return false;
        }
        $d = $s->fetch(PDB::FETCH_OBJ);
        if (self::loggedIn() && $userId == self::$_instance->getId()) {
            $c->_settings->{$setting} = $d;
        }
        return $d;
    }
Beispiel #9
0
 /**
  * Actually run the bot
  *
  * @return nothing
  */
 public function run()
 {
     $qry = $this->_getMessageList();
     while ($msg = $qry->fetch(PDB::FETCH_OBJ)) {
         $receiver = new Member($msg->IdReceiver);
         $email = $this->getEmailAddress($receiver);
         $language = $receiver->getLanguagePreferenceId();
         $link = false;
         if ($msg->broadcast_type == 'MailToConfirmReminder') {
             $userId = APP_User::userId($receiver->Username);
             if (!$userId) {
                 continue;
             }
             $keyDB = APP_User::getSetting($userId, 'regkey');
             if (!$keyDB) {
                 continue;
             }
             $link = $this->baseuri . 'signup/confirm/' . $receiver->Username . '/' . $keyDB->value;
         }
         $subj = $this->_getBroadCastElement("BroadCast_Title_" . $msg->word, $language, $msg->Username);
         $text = $this->_getBroadCastElement("BroadCast_Body_" . $msg->word, $language, $msg->Username, $email, $link);
         if (empty($msg->EmailFrom)) {
             switch ($msg->broadcast_type) {
                 case "RemindToLog":
                 case "MailToConfirmReminder":
                     $sender_mail = "*****@*****.**";
                     break;
                 case "SuggestionReminder":
                     $sender_mail = "*****@*****.**";
                     break;
                 default:
                     $sender_mail = "*****@*****.**";
             }
         } else {
             $sender_mail = $msg->EmailFrom;
         }
         $memberPrefersHtml = true;
         if ($receiver->getPreference('PreferenceHtmlMails', 'Yes') == 'No') {
             $memberPrefersHtml = false;
         }
         if (!$this->sendEmail($subj, $sender_mail, $email, $subj, $text, $language, $memberPrefersHtml)) {
             $this->_updateMessageStatus($msg->IdBroadcast, 'Failed', $msg->IdReceiver);
             $this->log("Cannot send broadcastmessages.id=#" . $msg->IdBroadcast . " to <b>" . $msg->Username . "</b>\n                \$Email=[" . $email . "] Type=[" . $msg->broadcast_type . "]");
         } else {
             if ($msg->broadcast_type == "RemindToLog") {
                 $this->queryDB("update members set NbRemindWithoutLogingIn=NbRemindWithoutLogingIn+1 where members.id=" . $msg->IdReceiver);
             }
             $this->_updateMessageStatus($msg->IdBroadcast, 'Sent', $msg->IdReceiver);
         }
     }
     $this->reportStats();
 }
Beispiel #10
0
    public function render($small = false)
    {
        $layoutkit = $this->layoutkit;
        $words = $this->words;
        $ww = $this->ww;
        $formkit = $layoutkit->formkit;
        $callback_tag = $formkit->setPostCallback('LoginController', 'loginCallback');
        $mem_recovery_tag = $formkit->setMemForRecovery();
        $mem_redirect = $formkit->mem_from_redirect;
        $err = is_object($mem_redirect) ? $mem_redirect->errmsg : '';
        $baseuri = PVars::getObj('env')->baseuri;
        if (PVars::getObj('env')->force_ssl_sensitive) {
            $baseuri = PVars::getObj('env')->baseuri_https;
        }
        $url = $baseuri . htmlspecialchars(implode('/', PRequest::get()->request), ENT_QUOTES);
        $memoryExpiry = PVars::getObj('env')->rememberme_expiry;
        if (!empty($_SERVER['QUERY_STRING'])) {
            $url .= '?' . $_SERVER['QUERY_STRING'];
        }
        $logged_in = APP_User::IsBWLoggedIn("NeedMore,Pending");
        if ($logged_in) {
            // already logged in
            // why show this form?
            if ($small != true) {
                ?>
            <div>
              <p><?php 
                echo $ww->LoginformAlreadyLogged($_SESSION['Username']);
                ?>
</p>
              <p><a href="user/logout"><?php 
                echo $ww->Logout;
                ?>
</a></p>
            </div>
            <?php 
            } else {
                ?>
                <span id="logout"><a href="user/logout" ><?php 
                echo $words->get('Logout');
                ?>
</a></span>
            <?php 
            }
            // for translators, we want links for all the translations,
            // because otherwise they will never see the login form words.
            // we make this happen with a little trick :)
            ob_start();
            $ww = $this->wwsilent;
        }
        // Adds for subdomain to forward login (not definitive, under discussions), jy 5/7/2009
        $ItIsNotASubDomain = true;
        $url_login = $url;
        // Test if it is a knowm subdomain, and if so change prepare forwarding to a login widget on www
        if (strrpos($url_login, 'fr.') !== false or strrpos($url_login, 'de.') !== false) {
            $ItIsNotASubDomain = false;
            $url_login = "******";
        }
        // end of adds for subdomains
        ?>
        <?php 
        if ($small == true) {
            ?>
        <div class="login-widget-small" >
        <form id="main-login-form" method="post" action="<?php 
            echo $url_login;
            ?>
">
          <?php 
            echo $callback_tag;
            ?>
          <?php 
            echo $mem_recovery_tag;
            ?>
            <?php 
            if ($ItIsNotASubDomain) {
                // Added because this is hidden for subdomain
                ?>
                <table>
                    <tr>
                        <td>
                            <label for="login-u"><?php 
                echo $ww->Username;
                ?>
</label><br />
                            <input type="text" id="login-u" name="u" />
                        </td>
                        <td>
                            <label for="login-p"><?php 
                echo $ww->Password;
                ?>
</label><br />
                            <input type="password" id="login-p" name="p" />
                        </td>
						<td title="<?php 
                echo $ww->StayLoggedIn_SecurityHint($memoryExpiry);
                ?>
">
							<input type="checkbox" id="login-r" name="r" /><label for="login-r"><?php 
                echo $ww->StayLoggedIn;
                ?>
</label>
						</td>
                        <td>
                            <br /><input type="submit" value="<?php 
                echo $ww->IndexPageLoginSubmit;
                ?>
" id="smallbutton" class="button"/>
                        </td>
                    </tr>
                </table>
        <?php 
            }
            // Added because this is hidden for subdomain
            ?>
        </form>

        <script type="text/javascript">
            document.getElementById("login-u").focus();
        </script>

        </div>
        <?php 
        } else {
            ?>
        <div class="info" id="login-widget">
        <h3><?php 
            echo $ww->Login;
            ?>
</h3>
        <?php 
            if ($err) {
                ?>
        <p class="note warning"><?php 
                echo $err;
                ?>
</p>
        <?php 
            }
            ?>
        <script type="text/javascript">
        	if(!navigator.cookieEnabled)
            	document.write("<p class=\"note warning\">Please enable cookies in your browser.</p>");
        </script>
        <form method="post" action="<?php 
            echo $url_login;
            ?>
">
          <?php 
            echo $callback_tag;
            ?>
          <?php 
            echo $mem_recovery_tag;
            ?>

            <?php 
            if ($ItIsNotASubDomain) {
                // Added because this is hidden for subdomain
                ?>
                <table>
                    <tr>
                        <td align="right" class="login_widget">
                            <label for="login-u"><?php 
                echo $ww->Username;
                ?>
</label>
                        </td>
                        <td>
                            <input type="text" id="login-u" name="u" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <label for="login-p"><?php 
                echo $ww->Password;
                ?>
</label>
                        </td>
                        <td>
                            <input type="password" id="login-p" name="p" />
                        </td>
                    </tr>
					<tr>
						<td></td>
						<td title="<?php 
                echo $ww->StayLoggedIn_SecurityHint($memoryExpiry);
                ?>
">
							<input type="checkbox" id="login-r" name="r" />&nbsp;<label for="login-r"><?php 
                echo $ww->StayLoggedIn;
                ?>
</label>
						</td>
					</tr>
                <tr><td>&nbsp;</td><td>
            <?php 
            }
            // Added because this is hidden for subdomain
            ?>
            <input type="submit" value="<?php 
            echo $ww->IndexPageLoginSubmit;
            ?>
" class="button"/>
          </td></tr></table>
          <br />
          <p><?php 
            echo $ww->LoginformForgetPassword('<a href="resetpassword/">', '</a>');
            ?>
<br /><br /></p>
          <h3><?php 
            echo $ww->SignupNow;
            ?>
</h3>
          <p><?php 
            echo $ww->IndexPageWord17('<a class="button" href="signup">', '</a>');
            ?>
</p>
        </form>
        <script type="text/javascript">document.getElementById("login-u").focus();</script>
        </div>
        <?php 
        }
        ?>
        <?php 
        if ($logged_in) {
            ob_end_clean();
            echo $words->flushBuffer();
        }
    }
Beispiel #11
0
 protected function statusMessage()
 {
     $words = new MOD_words();
     // messages about the member's status preceed the info messages
     $logged_in = APP_User::IsBWLoggedIn("NeedMore,Pending");
     if ($logged_in && $_SESSION['Status'] != 'Active') {
         echo '<p class="status note big">' . $words->get('StatusMessage_' . $_SESSION['Status']) . '</p>';
     }
     // infoMessage should be used by other Pages to show post-form-messages and other status-messages to the member
     $class = isset($this->infoMessageClass) && $this->infoMessageClass != '' ? $this->infoMessageClass : '';
     if (isset($this->infoMessage) && $this->infoMessage != '') {
         echo '<p class="note big ' . $class . '">' . $this->infoMessage . '</p>';
     }
 }
Beispiel #12
0
 /**
  * Parses a request
  * Extracts the current action, geoname-id, country-code, admin-code, all tags and the threadid from the request uri
  */
 private function parseRequest()
 {
     $request = $this->request;
     //    die ("\$request[1]=".$request[1]) ;
     // If this is a subforum within a group
     if (isset($request[0]) && !isset($request[1]) && $request[0] == 'forums') {
         $this->_model->setTopMode(Forums::CV_TOPMODE_LANDING);
         $this->action = self::ACTION_VIEW;
     }
     if (isset($request[0]) && $request[0] == 'groups') {
         if (isset($request[1])) {
             if ($request[1] == 'forums') {
                 $this->_model->setTopMode(Forums::CV_TOPMODE_GROUPS);
                 $this->action = self::ACTION_VIEW_GROUPS;
                 $this->uri = 'forums/';
             } else {
                 if (isset($request[2]) && $request[2] == 'forum') {
                     $this->_model->setGroupId((int) $request[1]);
                     $this->isTopLevel = false;
                     $this->isTopCategories = false;
                     $this->uri = 'groups/' . $request[1] . '/forum/';
                 }
             }
         }
     }
     if (!APP_User::isBWLoggedIn()) {
         $this->action = self::ACTION_NOT_LOGGED_IN;
     } else {
         if (!isset($request[1])) {
             $this->_model->setTopMode(Forums::CV_TOPMODE_LANDING);
             $this->action = self::ACTION_VIEW;
         } else {
             if (isset($request[1]) && $request[1] == 'suggestTags') {
                 $this->action = self::ACTION_SUGGEST;
             } else {
                 if (isset($request[1]) && $request[1] == 'search') {
                     $this->action = self::ACTION_SEARCH_FORUMS;
                     if (isset($request[3]) && preg_match_all('/page([0-9]+)/i', $request[3], $regs)) {
                         $this->_model->setPage($regs[1][0]);
                         $this->_model->pushToPageArray($regs[1][0]);
                     }
                 } else {
                     if (isset($request[1]) && $request[1] == 'member') {
                         $this->action = self::ACTION_SEARCH_USERPOSTS;
                     } else {
                         if (isset($request[1]) && $request[1] == 'modfulleditpost') {
                             $this->action = self::ACTION_MODERATOR_FULLEDITPOST;
                         } else {
                             if (isset($request[1]) && $request[1] == 'votepost') {
                                 $this->action = self::ACTION_VOTE_POST;
                             } else {
                                 if (isset($request[1]) && $request[1] == 'deltevotepost') {
                                     $this->action = self::ACTION_DELETEVOTE_POST;
                                 } else {
                                     if (isset($request[1]) && $request[1] == 'modedittag') {
                                         $this->action = self::ACTION_MODERATOR_EDITTAG;
                                     } else {
                                         if (isset($request[1]) && $request[1] == 'subscriptions') {
                                             $this->action = self::ACTION_SEARCH_SUBSCRIPTION;
                                         } else {
                                             if (isset($request[1]) && $request[1] == 'subscribe') {
                                                 $this->action = self::ACTION_SUBSCRIBE;
                                             } else {
                                                 if (isset($request[1]) && $request[1] == 'rules') {
                                                     $this->action = self::ACTION_RULES;
                                                 } else {
                                                     foreach ($request as $r) {
                                                         if ($r == 'new') {
                                                             $this->action = self::ACTION_NEW;
                                                         } else {
                                                             if ($r == 'edit') {
                                                                 $this->action = self::ACTION_EDIT;
                                                             } else {
                                                                 if ($r == 'landing') {
                                                                     $this->_model->setTopMode(Forums::CV_TOPMODE_LANDING);
                                                                     $this->action = self::ACTION_VIEW_LANDING;
                                                                     $showSticky = false;
                                                                 } else {
                                                                     if ($r == 'bwforum') {
                                                                         $this->_model->setTopMode(Forums::CV_TOPMODE_FORUM);
                                                                         $this->action = self::ACTION_VIEW_FORUM;
                                                                     } else {
                                                                         if ($r == 'lastposts') {
                                                                             $this->_model->setTopMode(Forums::CV_TOPMODE_LASTPOSTS);
                                                                             $this->action = self::ACTION_VIEW_LASTPOSTS;
                                                                         } else {
                                                                             if ($r == 'category') {
                                                                                 $this->_model->setTopMode(Forums::CV_TOPMODE_CATEGORY);
                                                                                 $this->action = self::ACTION_VIEW_CATEGORY;
                                                                             } else {
                                                                                 if ($r == 'translate') {
                                                                                     $this->action = self::ACTION_TRANSLATE;
                                                                                 } else {
                                                                                     if ($r == 'modedit') {
                                                                                         $this->action = self::ACTION_MODEDIT;
                                                                                     } else {
                                                                                         if ($r == 'reply') {
                                                                                             $this->action = self::ACTION_REPLY;
                                                                                         } else {
                                                                                             if ($r == 'reporttomod') {
                                                                                                 $this->action = self::ACTION_REPORT_TO_MOD;
                                                                                             } else {
                                                                                                 if ($r == 'modefullditpost') {
                                                                                                     $this->action = self::ACTION_MODERATOR_FULLEDITPOST;
                                                                                                 } else {
                                                                                                     if ($r == 'votepost') {
                                                                                                         $this->action = self::ACTION_VOTE_POST;
                                                                                                     } else {
                                                                                                         if ($r == 'deletevotepost') {
                                                                                                             $this->action = self::ACTION_DELETEVOTE_POST;
                                                                                                         } else {
                                                                                                             if ($r == 'modedittag') {
                                                                                                                 $this->action = self::ACTION_MODERATOR_EDITTAG;
                                                                                                             } else {
                                                                                                                 if ($r == 'reverse') {
                                                                                                                     // This mean user has click on the reverse order box
                                                                                                                     $this->_model->switchForumOrderList();
                                                                                                                 } else {
                                                                                                                     if ($r == 'delete') {
                                                                                                                         $this->action = self::ACTION_DELETE;
                                                                                                                     } else {
                                                                                                                         if (preg_match_all('/page([0-9]+)/i', $r, $regs)) {
                                                                                                                             $this->_model->setPage($regs[1][0]);
                                                                                                                             $this->_model->pushToPageArray($regs[1][0]);
                                                                                                                         } else {
                                                                                                                             if ($r == 'locationDropdowns') {
                                                                                                                                 $this->action = self::ACTION_LOCATIONDROPDOWNS;
                                                                                                                             } else {
                                                                                                                                 $char = $r[0];
                                                                                                                                 $dashpos = strpos($r, '-');
                                                                                                                                 if ($dashpos === false) {
                                                                                                                                     $dashpos = strlen($r) - 1;
                                                                                                                                 } else {
                                                                                                                                     $dashpos--;
                                                                                                                                 }
                                                                                                                                 if ($char == 'g') {
                                                                                                                                     // Geoname-ID
                                                                                                                                     $this->_model->setGeonameid((int) substr($r, 1, $dashpos));
                                                                                                                                     $this->isTopLevel = false;
                                                                                                                                 } else {
                                                                                                                                     if ($char == 'c') {
                                                                                                                                         // Countrycode
                                                                                                                                         $this->_model->setCountryCode(substr($r, 1, $dashpos));
                                                                                                                                         $this->isTopLevel = false;
                                                                                                                                     } else {
                                                                                                                                         if ($char == 'a') {
                                                                                                                                             // Admincode
                                                                                                                                             $this->_model->setAdminCode(substr($r, 1, $dashpos));
                                                                                                                                             $this->isTopLevel = false;
                                                                                                                                         } else {
                                                                                                                                             if ($char == 't') {
                                                                                                                                                 // Tagid
                                                                                                                                                 $this->_model->addTag((int) substr($r, 1, $dashpos));
                                                                                                                                                 $this->isTopLevel = false;
                                                                                                                                             } else {
                                                                                                                                                 if ($char == 's') {
                                                                                                                                                     // Subject-ID (Thread-ID)
                                                                                                                                                     $this->_model->setThreadId((int) substr($r, 1, $dashpos));
                                                                                                                                                     $this->isTopLevel = false;
                                                                                                                                                 } else {
                                                                                                                                                     if ($char == 'u') {
                                                                                                                                                         // Group ID (This is a dedicated group)
                                                                                                                                                         $this->_model->setGroupId((int) substr($r, 1, $dashpos));
                                                                                                                                                         $this->isTopLevel = false;
                                                                                                                                                     } else {
                                                                                                                                                         if ($char == 'k' && $r != "kickmember") {
                                                                                                                                                             // Continent-ID
                                                                                                                                                             $this->_model->setContinent(substr($r, 1, $dashpos));
                                                                                                                                                             $this->isTopLevel = false;
                                                                                                                                                         } else {
                                                                                                                                                             if ($char == 'm' && $r != "mygroupsonly") {
                                                                                                                                                                 // Message-ID (Single Post)
                                                                                                                                                                 $this->_model->setMessageId(substr($r, 1, $dashpos));
                                                                                                                                                                 $this->isTopLevel = false;
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #13
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;
 }
Beispiel #14
0
}
?>
</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";
}
Beispiel #15
0
 /**
  * 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;
                 }
             }
     }
 }
Beispiel #16
0
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]";
    }
Beispiel #17
0
 /**
  * Resend the confirmation mail in case the user clicked on the link in the
  * login error message
  *
  * @param string $username
  */
 public function resendConfirmationMail($username)
 {
     // fetch ID for member $username
     $vars = array();
     $MembersModel = new MembersModel();
     $member = $MembersModel->getMemberWithUsername($username);
     if ($member) {
         if ($member->Status == 'MailToConfirm') {
             $vars['firstname'] = MOD_crypt::AdminReadCrypted($member->Firstname);
             $vars['secondname'] = MOD_crypt::AdminReadCrypted($member->Secondname);
             $vars['lastname'] = MOD_crypt::AdminReadCrypted($member->Lastname);
             $vars['email'] = MOD_crypt::AdminReadCrypted($member->Email);
             $userId = APP_User::userId($username);
             if (!$userId) {
                 return 'NoSuchMember';
             } else {
                 $View = new SignupView($this);
                 define('DOMAIN_MESSAGE_ID', 'bewelcome.org');
                 // TODO: config
                 $View->registerMail($vars, $member->id, $userId);
             }
         } else {
             return 'NoMailToConfirm';
         }
     } else {
         return 'NoSuchMember';
     }
     return true;
 }
Beispiel #18
0
 /**
  * get members and count based on privacy setting
  *
  */
 private function getMembersFiltered($query)
 {
     // this condition makes sure that unlogged people won't see non-public profiles
     if (!APP_User::isBWLoggedIn('NeedMore,Pending')) {
         $query = str_ireplace("FROM", "FROM memberspublicprofiles mpp,", $query);
         $query = str_ireplace("WHERE", "WHERE m.id = mpp.IdMember AND", $query);
     }
     $result = $this->dao->query($query);
     if (!$result) {
         throw new PException('Could not retrieve members list.');
     }
     $countQuery = $this->dao->query("SELECT FOUND_ROWS() as cnt");
     $count = $countQuery->fetch(PDB::FETCH_OBJ)->cnt;
     $members = array();
     $cities = array();
     while ($row = $result->fetch(PDB::FETCH_OBJ)) {
         if (!isset($cities[$row->idCity])) {
             $cities[$row->idCity] = $this->getCityName($row->idCity);
         }
         $row->city = $cities[$row->idCity];
         $members[] = $row;
     }
     return array($count, $members);
 }
Beispiel #19
0
    $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)) {
Beispiel #20
0
 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;
 }
Beispiel #21
0
    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 '';
    }
Beispiel #22
0
    
</form>
<script type="text/javascript">document.getElementById("login-u").focus();</script>
</div>
<!-- END -->
<?php 
    // and remove unused vars
    PPostHandler::clearVars($callbackId);
} else {
    /*
     * STATUS AND LOGOUT FORM
     */
    $c = $User->logoutProcess();
    $currUser = APP_User::get();
    $navText = $i18n->getText('navText');
    $countrycode = APP_User::countryCode($currUser->getHandle());
    $words = new MOD_words();
    ?>
<div class="floatbox">
<p><?php 
    echo $words->getFormatted('UserLoggedInAs');
    ?>
 <br />
    <a href="user/<?php 
    echo $currUser->getHandle();
    ?>
">
    <?php 
    echo $currUser->getHandle();
    ?>
</a>
Beispiel #23
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;
     }
 }
Beispiel #24
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;
 }
Beispiel #25
0
 /**
  * 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;
 }
Beispiel #26
0
    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>';
    }
Beispiel #27
0
 /**
  * logs a member out and deletes the session for the member
  *
  * @access public
  * @return bool
  */
 public function logOut()
 {
     if (!isset($_SESSION) || !$this->isLoaded()) {
         return false;
     }
     // if "stay logged in active, clear memory cookie
     $this->removeSessionMemory();
     $keys_to_delete = array('IdMember', 'MemberStatus', 'Status', 'lang', 'IdLang', 'IsVol', 'UserName', 'stylesheet', 'Param', 'TimeOffset', 'PreferenceDayLight', 'MemberCryptKey', 'LogCheck', 'RightLevel', 'RightScope', 'FlagLevel');
     foreach ($keys_to_delete as $key) {
         if (isset($_SESSION[$key])) {
             unset($_SESSION[$key]);
         }
     }
     /**
      old stuff from TB - we don't rely on this
     if (!isset($this->sessionName))
         return false;
     if (!isset($_SESSION[$this->sessionName]))
         return false;
     $this->loggedIn = false;
     unset($_SESSION[$this->sessionName]);
     */
     $query = "delete from online where IdMember={$this->getPKValue()}";
     $this->dao->query($query);
     if (isset($_COOKIE) && is_array($_COOKIE)) {
         $env = PVars::getObj('env');
         if (isset($_COOKIE[$env->cookie_prefix . 'userid'])) {
             self::addSetting($_COOKIE[$env->cookie_prefix . 'userid'], 'skey');
             setcookie($env->cookie_prefix . 'userid', '', time() - 3600, '/');
         }
         if (isset($_COOKIE[$env->cookie_prefix . 'userkey'])) {
             setcookie($env->cookie_prefix . 'userkey', '', time() - 3600, '/');
         }
         if (isset($_COOKIE[$env->cookie_prefix . 'ep'])) {
             setcookie($env->cookie_prefix . 'ep', '', time() - 3600, '/');
         }
     }
     // todo: remove this when app_user is finally removed
     APP_User::get()->setLogout();
     session_unset();
     session_destroy();
     $this->wipeEntity();
     session_regenerate_id();
     return true;
 }
Beispiel #28
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';
 }
Beispiel #29
0
 /**
  * callback for deleting/updating messages
  *
  * @param object $args
  * @param object $action
  * @param object $mem_redirect
  * @param object $mem_resend
  * @access public
  * @return string
  */
 public function mailBoxCallback($args, $action, $mem_redirect, $mem_resend)
 {
     $BW_Rights = new MOD_right();
     $layoutkit = $count = $action->count;
     $return = $args->req;
     if (!APP_User::loggedIn()) {
         return $return;
     }
     if ($count < 0) {
         $mem_redirect->expired = true;
         return $return;
     }
     if ($mem_resend->already_sent_as) {
         $mem_redirect->already_sent_as = $mem_resend->already_sent_as;
         return $return;
     }
     // now finally try to send it.
     $words = new MOD_words();
     $model = new MessagesModel();
     $post = $args->post;
     if (isset($post['message-mark']) && count($post['message-mark']) > 0 && isset($post['submit_multi'])) {
         foreach ($post['message-mark'] as $message) {
             if (!($m = $model->getMessage($message))) {
                 $mem_redirect->problems = true;
                 return $return;
             } elseif ($post['submit_multi'] == 'delete') {
                 $result = $model->deleteMessage($m->id);
             } elseif ($post['submit_multi'] == 'markasread') {
                 $result = $model->markMessage($m->id);
             } elseif ($post['submit_multi'] == 'markasspam') {
                 $result = $model->moveMessage($m->id, 'Spam');
                 $model->updateSpamInfo($m->id, 'SpamSayMember', 'NotSpam', $m->SpamInfo);
             } elseif ($post['submit_multi'] == 'nospam') {
                 $result = $model->moveMessage($m->id, 'Normal');
                 $model->updateSpamInfo($m->id, 'NotSpam', array('SpamSayMember', 'SpamSayChecker'), $m->SpamInfo);
             } else {
                 $mem_redirect->problems = true;
                 return $return;
             }
         }
     } else {
         $result = false;
     }
     $mem_redirect->result = $result;
     return $return;
 }
Beispiel #30
0
 /**
  * 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;
 }