Example #1
0
 function buildLogIn()
 {
     $fields = array();
     $lang = SB_reqChk('lang') ? SB_reqVal('lang') : $this->um->getParam('user', 'lang');
     SB_SetLanguage($lang);
     $fields['Language'] = array('name' => 'lang', 'type' => 'select', 'class' => 'fixed', '_options' => '_buildLangList', '_select' => $lang, 'onChange' => 'this.form.submit()');
     $fields['Username'] = array('name' => 'username');
     $fields['Password'] = array('name' => 'pass', 'type' => 'password');
     $fields['Remember Me'] = array('name' => 'expires', 'type' => 'select', '_options' => '_buildExpirationList');
     if (SB_reqChk('forward')) {
         $fields['--hidden1--'] = array('name' => 'forward', 'value' => SB_reqVal('forward'));
     }
     if ($this->showWithErrors) {
         $fields['Reset Password'] = array('type' => 'addbutton');
     }
     return $fields;
 }
Example #2
0
 function privateMessage($params)
 {
     $gid = isset($params['gid']) && $params['gid'] ? $params['gid'] : null;
     $isModerator = $gid && $this->isModerator($gid);
     $isAdmin = $this->isAdmin();
     $role = ($isModerator || $isAdmin) && isset($params['from_role']) ? $params['from_role'] : 'user';
     $db =& SB_Database::staticInstance();
     $insert = array('uid' => $this->uid, 'gid' => $gid, 'sent' => array('now' => null), 'role' => $role, 'format' => $isAdmin && $params['format'] ? $params['format'] : 'plain', 'to_label' => $params['to_label'], 'subject' => $params['subject'], 'message' => $params['message']);
     $db->insert('sitebar_message', $insert);
     $mid = $db->getLastId();
     if ($isAdmin && $params['expires']) {
         $insert['expires'] = $params['expires'];
     }
     $counter = 0;
     $safe_mode = in_array(strtolower(ini_get('safe_mode')), array("1", "on", "yes", "true"));
     if (!$safe_mode) {
         // We need more time if our database is slow
         set_time_limit(intval(count($params['to_list']) / 20) + 10);
     }
     $insert = array('mid' => $mid);
     // Insert recipients
     foreach ($params['to_list'] as $uid => $user) {
         if ($uid == SB_ANONYM) {
             continue;
         }
         $userparams = $user['params'];
         $this->explodeParams($userparams, 'tmp');
         if (($isModerator || $isAdmin) && isset($params['respect']) && !$this->getParam('tmp', 'allow_info_mails')) {
             continue;
         }
         SB_SetLanguage($this->getParam('tmp', 'lang'));
         $counter++;
         $insert['uid'] = $uid;
         $db->insert('sitebar_message_folder', $insert);
         if ($params['pm_notification'] && $user['verified'] && $this->getParam('config', 'use_mail_features') && $this->getParam('tmp', 'pm_notification')) {
             $subject = SB_T('SiteBar: Private Message Notification');
             $msg = SB_P('command::pm_notification', array($params['subject'], SB_Page::absBaseUrl()));
             $this->sendMail(array('email' => $user['email']), $subject, $msg);
         }
     }
     SB_SetLanguage($this->getParam('user', 'lang'));
     $insert['folder'] = 'outbox';
     // Insert senders
     if (($isModerator || $isAdmin) && $role != 'user') {
         $gid = $role == 'admins' ? SB_ADMIN_GROUP : $gid;
         foreach ($this->getMembers($gid) as $uid => $user) {
             $userparams = $user['params'];
             $this->explodeParams($userparams, 'tmp');
             SB_SetLanguage($this->getParam('tmp', 'lang'));
             $counter++;
             $insert['uid'] = $uid;
             $db->insert('sitebar_message_folder', $insert);
         }
     } else {
         $insert['uid'] = $this->uid;
         $db->insert('sitebar_message_folder', $insert);
     }
     SB_SetLanguage($this->getParam('user', 'lang'));
 }
Example #3
0
 function _commandSendEmail($to, $subject, $group = null)
 {
     // Prefetch to have it in our language
     $okStr = SB_T('%s - ok.');
     $errorStr = SB_T('%s - error!');
     $message = stripslashes(SB_reqVal('message'));
     foreach ($to as $uid => $user) {
         $userparams = $user['params'];
         $this->um->explodeParams($userparams, 'tmp');
         if (SB_reqVal('checkrcpt')) {
             if (SB_reqChk('respect') && !$this->um->getParam('tmp', 'allow_info_mails')) {
                 continue;
             }
             if (SB_reqChk('verified') && !$user['verified']) {
                 continue;
             }
         }
         SB_SetLanguage($this->um->getParam('tmp', 'lang'));
         $body = '';
         if ($group) {
             $body = SB_P('command::contact_group', array($group, $message, SB_Page::absBaseUrl()));
         } else {
             $body = SB_P('command::contact', array($message, SB_Page::absBaseUrl()));
         }
         if (!$this->um->email || !$this->checkEmailCorrectness($this->um->email)) {
             continue;
         }
         $ret = $this->um->sendMail($user, SB_T($subject), $body, $this->um->name, $this->um->email);
         // No translation here
         if ($ret) {
             $this->warn('%s', sprintf($okStr, $user['completenamehtml']));
         } else {
             $this->error('%s', sprintf($errorStr, $user['completenamehtml']));
         }
     }
     SB_SetLanguage($this->um->getParam('user', 'lang'));
 }
Example #4
0
    header('Location: ' . $url);
    exit;
}
// Now we have the information, we are on the right page and we will use cookies
// We will redirect using META tag later on to support all browsers
if (isset($_GET['url'])) {
    foreach (array('skin', 'version', 'url', 'popup_params') as $key) {
        $cookieName = 'sbi_' . $key;
        $_COOKIE[$cookieName] = $_REQUEST[$key];
        setcookie($cookieName, $_REQUEST[$key]);
    }
}
SB_Page::absBaseUrl($_COOKIE['sbi_url']);
SB_Skin::set($_COOKIE['sbi_skin']);
if (preg_match('/^\\w+/', $_GET['lang'])) {
    SB_SetLanguage($_GET['lang']);
}
$um->setParam('user', $_COOKIE['popup_params']);
if (isset($_REQUEST['install'])) {
    IEInstall();
    exit;
}
if (isset($_REQUEST['search_engine'])) {
    SearchEngine();
    exit;
}
// Redirect and keep cookies
$meta = null;
if (isset($_GET['url'])) {
    $meta = '<meta http-equiv="refresh" content="0;url=integrator.php?lang=' . SB_GetLanguage() . '">';
}
Example #5
0
 function _buildDeleteInactiveUsers($all)
 {
     $members = array();
     $members = $this->um->getUsersUsingVisited(SB_reqVal('aperiod', true), '<=', 'visits DESC');
     foreach ($members as $uid => $rec) {
         if (!$all && !SB_reqChk($uid)) {
             continue;
         }
         $subject = '';
         $body = '';
         $user = $this->um->getUser($uid);
         $this->um->explodeParams($user['params'], 'tmp');
         SB_SetLanguage($this->um->getParam('tmp', 'lang'));
         $subject = 'SiteBar: Inactive Account Deleted';
         $body = 'command::account_deleted';
         $this->um->removeUser($uid);
         if ($this->um->getParam('config', 'use_mail_features')) {
             $sentEmail = true;
             if (SB_reqVal('inform')) {
                 if (SB_reqChk('respect') && !$this->um->getParam('tmp', 'allow_info_mails')) {
                     $sentEmail = false;
                 }
                 if (SB_reqChk('verified') && !$user['verified']) {
                     $sentEmail = false;
                 }
             }
             // No email on unverified users
             if ($sentEmail) {
                 $this->um->sendMail($user, SB_T($subject), SB_P($body, array($user['email'], SB_Page::absBaseUrl())));
             }
         }
         $this->warn('Account %s deleted.', array($user['completenamehtml']));
     }
     SB_SetLanguage($this->um->getParam('user', 'lang'));
     if (!$this->hasErrors()) {
         $this->error('No action taken!');
     }
     $this->skipBuild = true;
     return array();
 }