示例#1
0
 /**
  * as long as we have no decent dependency injection whatever,
  * we make this a singleton.
  */
 public static function get()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
     }
     return self::$_instance;
 }
 /**
  * Initialise the current user.
  * Sets language and online status.
  */
 protected function initUser()
 {
     $this->setLanguage();
     PVars::register('lang', $_SESSION['lang']);
     $roxModelBase = new RoxModelBase();
     $member = $roxModelBase->getLoggedInMember();
     // try restoring session from memory cookie
     if (!$member) {
         $member = $roxModelBase->restoreLoggedInMember();
     }
     $memberId = false;
     if ($member) {
         if ($member->isBanned()) {
             $member->logOut();
         } else {
             $memberId = $member->id;
         }
     }
     $ipAsInt = intval(ip2long($_SERVER['REMOTE_ADDR']));
     MOD_online::get()->iAmOnline($ipAsInt, $memberId);
 }
示例#3
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';
 }
示例#4
0
function EvaluateMyEvents()
{
    global $_SYSHCVOL;
    if (isset($_SESSION['IdMember'])) {
        $memberId = $_SESSION['IdMember'];
    } else {
        $memberId = false;
    }
    // REMOTE_ADDR is not set when run via CLI
    if (isset($_SERVER['REMOTE_ADDR'])) {
        $ipAsInt = intval(ip2long($_SERVER['REMOTE_ADDR']));
    } else {
        $ipAsInt = intval(ip2long('127.0.0.1'));
    }
    MOD_online::get()->iAmOnline($ipAsInt, $memberId);
    if (!IsLoggedIn()) {
        return;
        // if member not identified, no more evaluation needed
    }
    if ($_SYSHCVOL['EvaluateEventMessageReceived'] == "Yes") {
        $IdMember = $_SESSION['IdMember'];
        $str = "select count(*) as cnt from messages where IdReceiver=" . $IdMember . " and WhenFirstRead='0000-00-00 00:00:00' and (not FIND_IN_SET('receiverdeleted',DeleteRequest))  and Status='Sent'";
        //		echo "str=$str<br> /";
        $rr = LoadRow($str);
        $_SESSION['NbNotRead'] = $rr->cnt;
    } else {
        $_SESSION['NbNotRead'] = 0;
    }
}