Esempio n. 1
0
 /** constructor needs to check for valid data and set the arguments.
  *
  *	@param	mixed
  * 	@param	mixed
  * 	@param	string
  **/
 public function __construct($routeInfo, $matches, $queryString = '', $anchor = '')
 {
     parent::__construct($routeInfo, $matches, $queryString = '', $anchor);
     if (!empty($matches)) {
         foreach ($matches as $key => $match) {
             //if we were passed routeInfo, skip it.
             if ($key == 'nodeid') {
                 $this->arguments['nodeid'] = $routeInfo['arguments']['nodeid'] = $match;
             } else {
                 if ($key == self::$actionKey) {
                     $action = explode('/', $match);
                     $this->arguments[self::$actionKey] = $routeInfo['arguments'][self::$actionKey] = $action[0];
                     if (count($action) > 1) {
                         $this->arguments['action2'] = $routeInfo['arguments']['action2'] = $action[1];
                     }
                 } else {
                     if ($key == 'action2') {
                         $this->arguments['action2'] = $routeInfo['arguments']['action2'] = $match;
                     }
                 }
             }
         }
     }
     //check for valid input.
     if (!self::validInput($routeInfo['arguments'])) {
         throw new vB_Exception_404('upload_invalid_url');
     }
 }
Esempio n. 2
0
 public function __construct($routeInfo = array(), $matches = array(), $queryString = '')
 {
     if (!empty($routeInfo)) {
         parent::__construct($routeInfo, $matches, $queryString);
     } else {
         // We are not parsing the route
         $this->arguments = array();
     }
 }
 protected static function validInput(array &$data)
 {
     if (!isset($data['prefix']) or !is_string($data['prefix'])) {
         return FALSE;
     }
     $data['prefix'] = $data['prefix'];
     $data['regex'] = $data['prefix'] . '/' . self::REGEXP;
     $data['class'] = __CLASS__;
     $data['controller'] = self::CONTROLLER;
     return parent::validInput($data);
 }
Esempio n. 4
0
/**
* Shows the form for inline mod authentication.
*/
function show_inline_mod_login($showerror = false)
{
    global $vbulletin, $vbphrase, $show;
    $show['inlinemod_form'] = true;
    $show['passworderror'] = $showerror;
    if (!$showerror) {
        $vbulletin->url = SCRIPTPATH;
    }
    $forumHome = vB_Library::instance('content_channel')->getForumHomeChannel();
    eval(standard_error(fetch_error('nopermission_loggedin', $vbulletin->userinfo['username'], vB_Template_Runtime::fetchStyleVar('right'), vB::getCurrentSession()->get('sessionurl'), $vbulletin->userinfo['securitytoken'], vB5_Route::buildUrl($forumHome['routeid'] . 'home|fullurl'))));
}
Esempio n. 5
0
 protected static function validInput(array &$data)
 {
     if (!parent::validInput($data) or !isset($data['nodeid']) or !is_numeric($data['nodeid'])) {
         return FALSE;
     }
     $node = vB_Library::instance('node')->getNodeBare($this->arguments['nodeid']);
     if (empty($node) or !empty($node['errors'])) {
         return FALSE;
     }
     $this->title = $node['title'];
 }
Esempio n. 6
0
 protected static function validInput(array &$data)
 {
     if (!isset($data['contentid']) or !is_numeric($data['contentid']) or !isset($data['prefix']) or !isset($data['action'])) {
         return FALSE;
     }
     $data['regex'] = $data['prefix'];
     $data['class'] = __CLASS__;
     $data['controller'] = 'search';
     $data['arguments'] = '';
     //serialize(array('pageid' => $data['contentid']));
     return parent::validInput($data);
 }
Esempio n. 7
0
 protected static function validInput(array &$data)
 {
     if (!isset($data['pageid']) or !is_numeric($data['pageid']) or !isset($data['prefix'])) {
         return FALSE;
     }
     $data['regex'] = $data['prefix'] . '/' . self::REGEXP;
     $data['class'] = __CLASS__;
     $data['controller'] = 'page';
     $data['action'] = 'index';
     $data['arguments'] = serialize(array('pageid' => $data['pageid'], 'tab' => '$tab'));
     return parent::validInput($data);
 }
 /**
  * @see vB_Notification::fetchPhraseArray()
  */
 public static function fetchPhraseArray($notificationData)
 {
     $userid = $notificationData['sender'];
     $username = $notificationData['sender_username'];
     $userInfo = array('userid' => $userid, 'username' => $username);
     try {
         $userProfileUrl = vB5_Route::buildUrl('profile|fullurl', $userInfo);
     } catch (Exception $e) {
         $userProfileUrl = "#";
     }
     $phraseTitle = "x_accepted_follow_request";
     $phraseData = array($username, $userProfileUrl);
     return array($phraseTitle, $phraseData);
 }
 protected static function validInput(array &$data)
 {
     if (!parent::validInput($data) or !isset($data['nodeid']) or !is_numeric($data['nodeid'])) {
         return FALSE;
     }
     $data['pageid'] = intval($data['pageid']);
     $data['prefix'] = $data['prefix'];
     $data['regex'] = $data['prefix'] . '/' . self::REGEXP;
     $data['arguments'] = serialize(array('nodeid' => '$nodeid', 'pageid' => $data['pageid']));
     $data['class'] = __CLASS__;
     $data['controller'] = 'page';
     $data['action'] = 'index';
     // this field will be used to delete the route when deleting the channel (contains channel id)
     unset($data['pageid']);
     return parent::validInput($data);
 }
Esempio n. 10
0
 /**
  * @see vB_Notification::fetchPhraseArray()
  */
 public static function fetchPhraseArray($notificationData)
 {
     $nodelink = vB5_Route::buildUrl('node|fullurl', array('nodeid' => $notificationData['sentbynodeid']));
     $phraseTitle = "missing phrase for " . __CLASS__;
     $phraseData = array();
     if (empty($notificationData['sender']) or is_null($notificationData['sender_username'])) {
         switch ($notificationData['otherParticipantsCount']) {
             case 0:
                 $phraseTitle = 'guest_replied_to_z';
                 // There's a 'guest_replied_to_y' phrase being used bo other templates.
                 $phraseData = array($nodelink, $notificationData['aboutstartertitle']);
                 break;
             case 1:
                 $phraseTitle = 'guest_and_one_other_replied_to_z';
                 $phraseData = array($notificationData['sentbynodeid'], $nodelink, $notificationData['aboutstartertitle']);
                 break;
             default:
                 $phraseTitle = 'guest_and_y_others_replied_to_z';
                 $phraseData = array($notificationData['sentbynodeid'], $notificationData['otherParticipantsCount'], $nodelink, $notificationData['aboutstartertitle']);
                 break;
         }
     } else {
         $userid = $notificationData['sender'];
         $username = $notificationData['sender_username'];
         $userInfo = array('userid' => $userid, 'username' => $username);
         try {
             $userProfileUrl = vB5_Route::buildUrl('profile|fullurl', $userInfo);
         } catch (Exception $e) {
             $userProfileUrl = "#";
         }
         switch ($notificationData['otherParticipantsCount']) {
             case 0:
                 $phraseTitle = 'x_replied_to_z';
                 $phraseData = array($userProfileUrl, $username, $nodelink, $notificationData['aboutstartertitle']);
                 break;
             case 1:
                 $phraseTitle = 'x_and_one_other_replied_to_z';
                 $phraseData = array($userProfileUrl, $username, $notificationData['sentbynodeid'], $nodelink, $notificationData['aboutstartertitle']);
                 break;
             default:
                 $phraseTitle = 'x_and_y_others_replied_to_z';
                 $phraseData = array($userProfileUrl, $username, $notificationData['sentbynodeid'], $notificationData['otherParticipantsCount'], $nodelink, $notificationData['aboutstartertitle']);
                 break;
         }
     }
     return array($phraseTitle, $phraseData);
 }
Esempio n. 11
0
 public function getBreadcrumbs()
 {
     $breadcrumbs = array(array('phrase' => 'inbox', 'url' => vB5_Route::buildUrl('privatemessage')));
     try {
         $folder = vB_Api::instanceInternal('content_privatemessage')->getFolderInfoFromId($this->folderid);
         if (isset($folder[$this->folderid]) and $folder[$this->folderid]['iscustom']) {
             $breadcrumbs[] = array('title' => $folder[$this->folderid]['title'], 'url' => '');
         } else {
             if (isset($folder[$this->folderid]) and !$folder[$this->folderid]['iscustom']) {
                 $breadcrumbs[] = array('phrase' => $folder[$this->folderid]['title'], 'url' => '');
             }
         }
     } catch (vB_Exception_Api $e) {
         // something went wrong... don't display that crumb
     }
     return $breadcrumbs;
 }
Esempio n. 12
0
 protected static function validInput(array &$data)
 {
     if (!isset($data['pageid']) or !is_numeric($data['pageid']) or !isset($data['prefix'])) {
         return false;
     }
     $data['regex'] = $data['prefix'] . '/' . self::REGEXP;
     $data['class'] = __CLASS__;
     $data['controller'] = 'page';
     $data['action'] = 'index';
     $arguments = unserialize($data['arguments']);
     if (!$arguments) {
         return false;
     }
     $arguments['pageid'] = $data['pageid'];
     $data['arguments'] = serialize($arguments);
     $result = parent::validInput($data);
     return $result;
 }
Esempio n. 13
0
 /**
  * @see vB_Notification::fetchPhraseArray()
  */
 public static function fetchPhraseArray($notificationData)
 {
     $nodelink = vB5_Route::buildUrl('node|fullurl', array('nodeid' => $notificationData['sentbynodeid']));
     if (empty($notificationData['sender']) or is_null($notificationData['sender_username'])) {
         $phraseTitle = 'guest_quoted_you_in_post';
         $phraseData = array($nodelink, $notificationData['aboutstartertitle']);
     } else {
         $userid = $notificationData['sender'];
         $username = $notificationData['sender_username'];
         $userInfo = array('userid' => $userid, 'username' => $username);
         try {
             $userProfileUrl = vB5_Route::buildUrl('profile|fullurl', $userInfo);
         } catch (Exception $e) {
             $userProfileUrl = "#";
         }
         $phraseTitle = 'x_quoted_you_in_post';
         $phraseData = array($userProfileUrl, $username, $nodelink, $notificationData['aboutstartertitle']);
     }
     return array($phraseTitle, $phraseData);
 }
Esempio n. 14
0
 /**
  * Fetches the 'url' variable - usually the URL of the previous page in the history
  *
  * @return	string
  */
 function fetch_url()
 {
     $scriptpath = vB::getRequest()->getScriptPath();
     //note regarding the default url if not set or inappropriate.
     //started out as index.php then moved to options['forumhome'] . '.php' when that option was added.
     //now we've changed to to the forumhome url since there is now quite a bit of logic around that.
     //Its not clear, however, with the expansion of vb if that's the most appropriate generic landing
     //place (perhaps it *should* be index.php).
     //In any case there are several places in the code that check for the default page url and change it
     //to something more appropriate.  If the default url changes, so do those checks.
     //The solution is, most likely, to make some note when vbulletin->url is the default so it can be overridden
     //without worrying about what the exact text is.
     if (empty($_REQUEST['url'])) {
         $url = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     } else {
         $temp_url = $_REQUEST['url'];
         if (!empty($_SERVER['HTTP_REFERER']) and $temp_url == $_SERVER['HTTP_REFERER']) {
             //$url = 'index.php';
             $url = vB5_Route::buildUrl('home|fullurl');
         } else {
             $url = $temp_url;
         }
     }
     if ($url == $scriptpath or empty($url)) {
         //$url = 'index.php';
         $url = vB5_Route::buildUrl('home|fullurl');
     }
     $url = $this->registry->cleaner->xssClean($url);
     return $url;
 }
Esempio n. 15
0
    ?>
";
		}
		else
		{
			window.location = "mailto:" + value;
		}
	}
	</script>
	<?php 
    print_form_header('usertools', '');
    print_table_header(construct_phrase($vbphrase['users_with_x_private_messages_stored'], $vbulletin->GPC['pms']), 3);
    print_cells_row(array($vbphrase['username'], $vbphrase['last_activity'], $vbphrase['options']), 1);
    foreach ($users as $user) {
        $cell = array();
        $cell[] = "<a href=\"" . vB5_Route::buildUrl('profile|bburl', $user) . "\" target=\"_blank\">{$user['username']}</a>";
        $cell[] = vbdate($vbulletin->options['dateformat'] . ', ' . $vbulletin->options['timeformat'], $user['lastactivity']);
        $cell[] = "\n\t\t<select name=\"u{$user['userid']}\" onchange=\"js_pm_jump({$user['userid']}, '{$user['username']}');\" tabindex=\"1\" class=\"bginput\">\n\t\t\t<option value=\"pmstats\">" . $vbphrase['view_private_message_statistics'] . "</option>\n\t\t\t<option value=\"profile\">" . $vbphrase['edit_user'] . "</option>\n\t\t\t" . (!empty($user['email']) ? "<option value=\"{$user['email']}\">" . $vbphrase['send_email_to_user'] . "</option>" : "") . "\n\t\t\t<option value=\"pmuser\">" . $vbphrase['send_private_message_to_user'] . "</option>\n\t\t\t<option value=\"delete\">" . construct_phrase($vbphrase['delete_all_users_private_messages']) . "</option>\n\t\t</select><input type=\"button\" class=\"button\" value=\"{$vbphrase['go']}\" onclick=\"js_pm_jump({$user['userid']}, '{$user['username']}');\" tabindex=\"1\" />\n\t";
        print_cells_row($cell);
    }
    print_table_footer();
}
// ############################# start do ips #########################
if ($_REQUEST['do'] == 'doips') {
    if (function_exists('set_time_limit') and !SAFEMODE) {
        @set_time_limit(0);
    }
    $vbulletin->input->clean_array_gpc('r', array('depth' => vB_Cleaner::TYPE_INT, 'username' => vB_Cleaner::TYPE_STR, 'ipaddress' => vB_Cleaner::TYPE_NOHTML));
    if (($vbulletin->GPC['username'] or $vbulletin->GPC['userid'] or $vbulletin->GPC['ipaddress']) and $_POST['do'] != 'doips') {
        // we're doing a search of some type, that's not submitted via post,
        // so we need to verify the CP sessionhash
Esempio n. 16
0
 /**
  * Ban users
  *
  * @param array $userids Userids to ban
  * @param int $banusergroupid Which banned usergroup to move the users to
  * @param string $period Ban period
  * @param string $reason Ban reason
  */
 public function banUsers($userids, $banusergroupid, $period, $reason = '')
 {
     $loginuser =& vB::getCurrentSession()->fetch_userinfo();
     $usercontext =& vB::getUserContext($loginuser['userid']);
     if (!$usercontext->hasAdminPermission('cancontrolpanel') and !$usercontext->hasPermission('moderatorpermissions', 'canbanusers')) {
         $forumHome = vB_Library::instance('content_channel')->getForumHomeChannel();
         throw new vB_Exception_Api('nopermission_loggedin', array($loginuser['username'], vB_Template_Runtime::fetchStyleVar('right'), vB::getCurrentSession()->get('sessionurl'), $loginuser['securitytoken'], vB5_Route::buildUrl($forumHome['routeid'] . '|fullurl')));
     }
     foreach ($userids as &$userid) {
         $userid = intval($userid);
     }
     $bannedusergroups = vB_Api::instanceInternal('usergroup')->fetchBannedUsergroups();
     if (!in_array($banusergroupid, array_keys($bannedusergroups))) {
         throw new vB_Exception_Api('invalid_usergroup_specified');
     }
     // check that the number of days is valid
     if ($period != 'PERMANENT' and !preg_match('#^(D|M|Y)_[1-9][0-9]?$#', $period)) {
         throw new vB_Exception_Api('invalid_ban_period_specified');
     }
     if ($period == 'PERMANENT') {
         // make this ban permanent
         $liftdate = 0;
     } else {
         // get the unixtime for when this ban will be lifted
         require_once DIR . '/includes/functions_banning.php';
         $liftdate = convert_date_to_timestamp($period);
     }
     $user_dms = array();
     $current_bans = vB::getDbAssertor()->getRows('user_fetchcurrentbans', array('userids' => $userids));
     foreach ($current_bans as $current_ban) {
         $userinfo = vB_User::fetchUserinfo($current_ban['userid']);
         $userid = $userinfo['userid'];
         if ($current_ban['bandate']) {
             // they already have a ban, check if the current one is being made permanent, continue if its not
             if ($liftdate and $liftdate < $current_ban['liftdate']) {
                 continue;
             }
             // there is already a record - just update this record
             vB::getDbAssertor()->update('userban', array('bandate' => vB::getRequest()->getTimeNow(), 'liftdate' => $liftdate, 'adminid' => $loginuser['userid'], 'reason' => $reason), array('userid' => $userinfo['userid']));
         } else {
             // insert a record into the userban table
             /*insert query*/
             vB::getDbAssertor()->insert('userban', array('userid' => $userinfo['userid'], 'usergroupid' => $userinfo['usergroupid'], 'displaygroupid' => $userinfo['displaygroupid'], 'customtitle' => $userinfo['customtitle'], 'usertitle' => $userinfo['usertitle'], 'adminid' => $loginuser['userid'], 'bandate' => vB::getRequest()->getTimeNow(), 'liftdate' => $liftdate, 'reason' => $reason));
         }
         // update the user record
         $user_dms[$userid] = new vB_Datamanager_User(vB_DataManager_Constants::ERRTYPE_SILENT);
         $user_dms[$userid]->set_existing($userinfo);
         $user_dms[$userid]->set('usergroupid', $banusergroupid);
         $user_dms[$userid]->set('displaygroupid', 0);
         // update the user's title if they've specified a special user title for the banned group
         if ($bannedusergroups[$banusergroupid]['usertitle'] != '') {
             $user_dms[$userid]->set('usertitle', $bannedusergroups[$banusergroupid]['usertitle']);
             $user_dms[$userid]->set('customtitle', 0);
         }
         $user_dms[$userid]->pre_save();
     }
     foreach ($user_dms as $userdm) {
         $userdm->save();
     }
     // and clear perms
     foreach ($userids as $uid) {
         vB::getUserContext($uid)->clearChannelPermissions();
     }
     return true;
 }
Esempio n. 17
0
 /**
  * Initializes an API client
  *
  * @param  int              $api_c API Client ID
  * @param  array            $apiclientdata 'clientname', 'clientversion', 'platformname', 'platformversion', 'uniqueid'
  *
  * @throws vB_Exception_Api Throws 'apiclientinfomissing' if any of clientname, clientversion, platformname, platformversion, or uniqueid are missing.
  *
  * @return array            Api information, format:
  *                          array(
  *                              apiversion => string
  *                              apiaccesstoken => string
  *                              bbtitle => string
  *                              bburl => string
  *                              bbactive => int
  *                              bbclosedreason => string (only set if bbactive = 0)
  *                              forumhome => string
  *                              vbulletinversion => string
  *                              contenttypes => array(
  *                                  content type class => content type id
  *                                  [...]
  *                              )
  *                              features => array(
  *                                  blogenabled => 1
  *                                  cmsenabled => 0
  *                                  pmsenabled => int
  *                                  searchesenabled => tin
  *                                  groupsenabled => 1
  *                                  albumsenabled => 0
  *                                  multitypesearch => 1
  *                                  visitor_messagingenabled => 1
  *                                  taggingenabled => int
  *                                  visitor_trackingenabled => 0
  *                                  paidsubs => int
  *                                  friendsenabled => 0
  *                                  activitystream => 1
  *                              )
  *                              permissions => empty array
  *                              show => array(
  *                                  registerbutton => 1
  *                              )
  *                              apiclientid => int
  *                              secret => string (only if API Client ID was specified in the call)
  *                          )
  */
 public function init($clientname, $clientversion, $platformname, $platformversion, $uniqueid, $api_c = 0)
 {
     $clientname = strip_tags($clientname);
     $clientversion = strip_tags($clientversion);
     $platformname = strip_tags($platformname);
     $platformversion = strip_tags($platformversion);
     $uniqueid = strip_tags($uniqueid);
     $api_c = intval($api_c);
     $oldclientid = $api_c;
     if (!$api_c) {
         // The client doesn't have an ID yet. So we need to generate a new one.
         // All params are required.
         // uniqueid is the best to be a permanent unique id such as hardware ID (CPU ID,
         // Harddisk ID or Mobile IMIE). Some client can not get a such a uniqueid,
         // so it needs to generate an unique ID and save it in its local storage. If it
         // requires the client ID and Secret again, pass the same unique ID.
         if (!$clientname or !$clientversion or !$platformname or !$platformversion or !$uniqueid) {
             throw new vB_Exception_Api('apiclientinfomissing');
         }
         // Gererate clienthash.
         $clienthash = md5($clientname . $platformname . $uniqueid);
         // Generate a new secret
         $secret = fetch_random_password(32);
         // If the same clienthash exists, return secret back to the client.
         $client = $this->dbassertor->getRow('apiclient', array('clienthash' => $clienthash));
         $api_c = $client['apiclientid'];
         if ($api_c) {
             // Update secret
             // Also remove userid so it will logout previous loggedin and remembered user. (VBM-553)
             $this->dbassertor->update('apiclient', array('secret' => $secret, 'apiaccesstoken' => vB::getCurrentSession()->get('apiaccesstoken'), 'lastactivity' => vB::getRequest()->getTimeNow(), 'clientversion' => $clientversion, 'platformversion' => $platformversion, 'userid' => 0), array('apiclientid' => $api_c));
         } else {
             $api_c = $this->dbassertor->insert('apiclient', array('secret' => $secret, 'clienthash' => $clienthash, 'clientname' => $clientname, 'clientversion' => $clientversion, 'platformname' => $platformname, 'platformversion' => $platformversion, 'initialipaddress' => vB::getRequest()->getAltIp(), 'apiaccesstoken' => vB::getCurrentSession()->get('apiaccesstoken'), 'dateline' => vB::getRequest()->getTimeNow(), 'lastactivity' => vB::getRequest()->getTimeNow()));
             if (is_array($api_c)) {
                 $api_c = array_pop($api_c);
             }
             $api_c = (int) $api_c;
         }
         // Set session client ID
         vB::getCurrentSession()->set('apiclientid', $api_c);
     } else {
         // api_c and api_sig are verified in init.php so we don't need to verify here again.
         $api_c = intval($api_c);
         // Update lastactivity
         $this->dbassertor->update('apiclient', array('lastactivity' => vB::getRequest()->getTimeNow()), array('apiclientid' => $api_c));
     }
     $contenttypescache = vB_Types::instance()->getContentTypes();
     $contenttypes = array();
     foreach ($contenttypescache as $contenttype) {
         $contenttypes[$contenttype['class']] = $contenttype['id'];
     }
     $products = vB::getDatastore()->getValue('products');
     $vboptions = vB::getDatastore()->getValue('options');
     $userinfo = vB::getCurrentSession()->fetch_userinfo();
     // Check the status of CMS and Blog
     $blogenabled = true;
     $cmsenabled = false;
     try {
         vB_Api::instanceInternal('paidsubscription')->checkStatus();
         $paidsubs = 1;
     } catch (Exception $e) {
         $paidsubs = 0;
     }
     $forumHome = vB_Library::instance('content_channel')->getForumHomeChannel();
     $forumhomeUrl = vB5_Route::buildUrl($forumHome['routeid'] . '|fullurl');
     $data = array('apiversion' => VB_API_VERSION, 'apiaccesstoken' => vB::getCurrentSession()->get('apiaccesstoken'), 'bbtitle' => $vboptions['bbtitle'], 'bburl' => $vboptions['bburl'], 'bbactive' => $vboptions['bbactive'], 'forumhome' => $forumhomeUrl, 'vbulletinversion' => $vboptions['templateversion'], 'contenttypes' => $contenttypes, 'features' => array('blogenabled' => 1, 'cmsenabled' => 0, 'pmsenabled' => $vboptions['enablepms'] ? 1 : 0, 'searchesenabled' => $vboptions['enablesearches'] ? 1 : 0, 'groupsenabled' => 1, 'albumsenabled' => 0, 'multitypesearch' => 1, 'visitor_messagingenabled' => 1, 'taggingenabled' => $vboptions['threadtagging'] ? 1 : 0, 'visitor_trackingenabled' => 0, 'paidsubs' => $paidsubs, 'friendsenabled' => 0, 'activitystream' => 1), 'permissions' => array(), 'show' => array('registerbutton' => 1));
     if (!$vboptions['bbactive']) {
         $data['bbclosedreason'] = $vboptions['bbclosedreason'];
     }
     $data['apiclientid'] = $api_c;
     if (!$oldclientid) {
         $data['secret'] = $secret;
     }
     return $data;
 }
                }
            }
        } else {
            // something went horribly wrong, get $apiobj->error
            if ($apiobj->type == 3) {
                // type = 3 means we received a valid response but we need to ignore it .. thanks Google, obtuse!
                if ($apiobj->display_feedback) {
                    $vbulletin->url = $vbulletin->options['bburl'] . '/payments.php';
                    eval(print_standard_redirect('payment_complete', true, true));
                }
            } else {
                $trans = array('state' => 0, 'dateline' => TIMENOW, 'paymentapiid' => $api['paymentapiid'], 'request' => serialize(array('vb_error_code' => $apiobj->error_code, 'GET' => serialize($_GET), 'POST' => serialize($_POST))));
                vB::getDbAssertor()->insert('vBForum:paymenttransaction', $trans);
                if ($apiobj->display_feedback and !empty($apiobj->error)) {
                    //die("<p>{$apiobj->error}</p>");
                    // we dont load header / footer, so just show the LITE template
                    define('VB_ERROR_LITE', true);
                    standard_error($apiobj->error);
                }
            }
        }
    }
} else {
    exec_header_redirect(vB5_Route::buildUrl('home|fullurl'));
}
/*=========================================================================*\
|| #######################################################################
|| # Downloaded: 15:45, Tue Sep 8th 2015
|| # CVS: $RCSfile$ - $Revision: 83432 $
|| #######################################################################
\*=========================================================================*/
Esempio n. 19
0
 /**
  * @see vB_Notification::fetchPhraseArray()
  */
 public static function fetchPhraseArray($notificationData)
 {
     try {
         $vmlink = vB5_Route::buildUrl('visitormessage|fullurl', array('nodeid' => $notificationData['sentbynodeid']));
     } catch (Exception $e) {
         $vmlink = '#';
     }
     $phraseTitle = "missing phrase for " . __CLASS__;
     $phraseData = array();
     if (empty($notificationData['sender']) or is_null($notificationData['sender_username'])) {
         $phraseTitle = 'guest_posted_visitormessage_url';
         $phraseData = array($vmlink);
     } else {
         $userid = $notificationData['sender'];
         $username = $notificationData['sender_username'];
         $userInfo = array('userid' => $userid, 'username' => $username);
         try {
             $userProfileUrl = vB5_Route::buildUrl('profile|fullurl', $userInfo);
         } catch (Exception $e) {
             $userProfileUrl = "#";
         }
         $phraseTitle = 'x_posted_visitormessage_url';
         $phraseData = array($username, $userProfileUrl, $vmlink);
     }
     return array($phraseTitle, $phraseData);
 }
function exec_digest($type = 2)
{
    // type = 2 : daily
    // type = 3 : weekly
    $lastdate = mktime(0, 0);
    // midnight today
    if ($type == 2) {
        // daily
        // yesterday midnight
        $lastdate -= 24 * 60 * 60;
    } else {
        // weekly
        // last week midnight
        $lastdate -= 7 * 24 * 60 * 60;
    }
    if (trim(vB::getDatastore()->getOption('globalignore')) != '') {
        $coventry = preg_split('#\\s+#s', vB::getDatastore()->getOption('globalignore'), -1, PREG_SPLIT_NO_EMPTY);
    } else {
        $coventry = array();
    }
    require_once DIR . '/includes/class_bbcode_alt.php';
    $vbulletin =& vB::get_registry();
    $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
    vB_Mail::vbmailStart();
    $bf_misc_useroptions = vB::get_datastore()->get_value('bf_misc_useroptions');
    $bf_ugp_genericoptions = vB::get_datastore()->get_value('bf_ugp_genericoptions');
    $bf_ugp_forumpermissions = vB::get_datastore()->get_value('bf_ugp_forumpermissions');
    // we want to fetch all language records at once and using cache if possible
    $defaultLanguage = false;
    $languageIds = array();
    // get new threads (Topic Subscription)
    $threads = vB::getDbAssertor()->getRows('getNewThreads', array('dstonoff' => $bf_misc_useroptions['dstonoff'], 'hasaccessmask' => $bf_misc_useroptions['hasaccessmask'], 'isnotbannedgroup' => $bf_ugp_genericoptions['isnotbannedgroup'], 'lastdate' => intval($lastdate)));
    // grab all forums / subforums for given subscription (Channel Subscription)
    $forums = vB::getDbAssertor()->assertQuery('getNewForums', array('dstonoff' => $bf_misc_useroptions['dstonoff'], 'hasaccessmask' => $bf_misc_useroptions['hasaccessmask'], 'type' => intval($type), 'lastdate' => intval($lastdate), 'channelcontenttype' => vB_Api::instanceInternal('contenttype')->fetchContentTypeIdFromClass('Channel'), 'isnotbannedgroup' => $bf_ugp_genericoptions['isnotbannedgroup']));
    // Let's see which languageids we wanna fetch
    foreach ($threads as $thread) {
        if ($thread['languageid'] == 0) {
            if (!$defaultLanguage) {
                $defaultLanguage = intval(vB::getDatastore()->getOption('languageid'));
                $languageIds[] = $defaultLanguage;
            }
        } else {
            $languageIds[] = $thread['languageid'];
        }
    }
    foreach ($forums as $forum) {
        if ($forum['languageid'] == 0) {
            if (!$defaultLanguage) {
                $defaultLanguage = intval(vB::getDatastore()->getOption('languageid'));
                $languageIds[] = $defaultLanguage;
            }
        } else {
            $languageIds[] = $forum['languageid'];
        }
    }
    // fetch languages
    $languages = vB_Library::instance('language')->fetchLanguages($languageIds);
    // process threads
    foreach ($threads as $thread) {
        $postbits = '';
        // Make sure user have correct email notification settings.
        if ($thread['emailnotification'] != $type) {
            continue;
        }
        if ($thread['lastauthorid'] != $thread['userid'] and in_array($thread['lastauthorid'], $coventry)) {
            continue;
        }
        $usercontext = vB::getUserContext($thread['userid']);
        if (!$usercontext->getChannelPermission('forumpermissions', 'canview', $thread['nodeid']) or !$usercontext->getChannelPermission('forumpermissions', 'canviewthreads', $thread['nodeid']) or $thread['lastauthorid'] != $thread['userid'] and !$usercontext->getChannelPermission('forumpermissions', 'canviewothers', $thread['nodeid'])) {
            continue;
        }
        $langInfo =& $languages[$thread['languageid']];
        $userinfo = array('lang_locale' => $langInfo['locale'], 'dstonoff' => $thread['dstonoff'], 'timezoneoffset' => $thread['timezoneoffset']);
        $thread['lastreplydate'] = vbdate($langInfo['dateoverride'] ? $langInfo['dateoverride'] : vB::getDatastore()->getOption('dateformat'), $thread['lastcontent'], false, true, true, false, $userinfo);
        $thread['lastreplytime'] = vbdate($langInfo['timeoverride'] ? $langInfo['timeoverride'] : vB::getDatastore()->getOption('timeformat'), $thread['lastcontent'], false, true, true, false, $userinfo);
        $thread['htmltitle'] = unhtmlspecialchars($thread['htmltitle']);
        $thread['username'] = unhtmlspecialchars($thread['username']);
        $thread['postusername'] = unhtmlspecialchars($thread['authorname']);
        $thread['lastposter'] = unhtmlspecialchars($thread['lastcontentauthor']);
        $thread['newposts'] = 0;
        //not currently used and probably needs rethinking, but don't want to remove until this code gets rewritten
        //$thread['auth'] = md5($thread['userid'] . $thread['subscribediscussionid'] . $thread['secret'] . vB_Request_Web::$COOKIE_SALT);
        if ($thread['prefixid']) {
            // need prefix in correct language
            $phraseAux = vB_Api::instanceInternal('phrase')->fetch(array("prefix_{$thread['prefixid']}_title_plain"));
            $thread['prefix_plain'] = $phraseAux["prefix_{$thread['prefixid']}_title_plain"] . ' ';
        } else {
            $thread['prefix_plain'] = '';
        }
        // Note: closure.depth = 1  on the where clause means getNewPosts only grabs replies, not comments.
        // get posts
        $posts = vB::getDbAssertor()->getRows('getNewPosts', array('threadid' => intval($thread['nodeid']), 'lastdate' => intval($lastdate)));
        // compile
        $haveothers = false;
        foreach ($posts as $post) {
            if ($post['userid'] != $thread['userid'] and in_array($post['userid'], $coventry)) {
                continue;
            }
            if ($post['userid'] != $thread['userid']) {
                $haveothers = true;
            }
            $thread['newposts']++;
            $post['htmltitle'] = unhtmlspecialchars($post['htmltitle']);
            $post['postdate'] = vbdate($langInfo['dateoverride'] ? $langInfo['dateoverride'] : vB::getDatastore()->getOption('dateformat'), $post['publishdate'], false, true, true, false, $userinfo);
            $post['posttime'] = vbdate($langInfo['timeoverride'] ? $langInfo['timeoverride'] : vB::getDatastore()->getOption('timeformat'), $post['publishdate'], false, true, true, false, $userinfo);
            $post['postusername'] = unhtmlspecialchars($post['authorname']);
            $plaintext_parser->set_parsing_language($thread['languageid']);
            $contentAPI = vB_Library_Content::getContentApi($post['contenttypeid']);
            $contents = $contentAPI->getContent($post['nodeid']);
            $post['pagetext'] = $plaintext_parser->parse($contents[$post['nodeid']]['rawtext'], $thread['parentid']);
            $postlink = vB5_Route::buildUrl($post['routeid'] . '|bburl', array('nodeid' => $post['nodeid']));
            /*$postlink = fetch_seo_url('thread|nosession|bburl',
            		array('threadid' => $thread['nodeid'], 'title' => htmlspecialchars_uni($thread['title']))) .
            		"#post$post[nodeid]";*/
            // Legacy Hook 'digest_thread_post' Removed //
            $phrases = vB_Api::instanceInternal('phrase')->fetch('digestpostbit', $thread['languageid']);
            $postbits .= sprintf($phrases['digestpostbit'], $post['htmltitle'], $postlink, $post['postusername'], $post['postdate'], $post['posttime'], $post['pagetext']);
        }
        // Legacy Hook 'digest_thread_process' Removed //
        // Don't send an update if the subscriber is the only one who posted in the thread.
        if ($haveothers) {
            // make email
            // magic vars used by the phrase eval
            $threadlink = vB5_Route::buildUrl($thread['routeid'] . '|fullurl', array('nodeid' => $thread['nodeid']));
            //$threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $thread['threadid'], 'title' => htmlspecialchars_uni($thread['title'])));
            //this link probably doesn't do what the author thinks it does, need to validate.
            $unsubscribelink = vB5_Route::buildUrl('subscription|fullurl', array('tab' => 'subscriptions', 'userid' => $thread['userid']));
            $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('digestthread', array($thread['username'], $thread['prefix_plain'], $thread['htmltitle'], $thread['postusername'], $thread['newposts'], $thread['lastposter'], $threadlink, $postbits, vB::getDatastore()->getOption('bbtitle'), $unsubscribelink), array($thread['prefix_plain'], $thread['htmltitle']), $thread['languageid']);
            vB_Mail::vbmail($thread['email'], $maildata['subject'], $maildata['message']);
        }
    }
    unset($plaintext_parser);
    // process forums
    foreach ($forums as $forum) {
        $langInfo =& $languages[$forum['languageid']];
        $userinfo = array('lang_locale' => $langInfo['locale'], 'dstonoff' => $forum['dstonoff'], 'timezoneoffset' => $forum['timezoneoffset']);
        $newthreadbits = '';
        $newthreads = 0;
        $updatedthreadbits = '';
        $updatedthreads = 0;
        $forum['username'] = unhtmlspecialchars($forum['username']);
        $forum['title_clean'] = unhtmlspecialchars($forum['title_clean']);
        //not currently used and probably needs rethinking, but don't want to remove until this code gets rewritten
        //$forum['auth'] = md5($forum['userid'] . $forum['subscribeforumid'] . $forum['secret'] . vB_Request_Web::$COOKIE_SALT);
        $threads = vB::getDbAssertor()->assertQuery('fetchForumThreads', array('forumid' => intval($forum['forumid']), 'lastdate' => intval($lastdate)));
        foreach ($threads as $thread) {
            if ($thread['postuserid'] != $forum['userid'] and in_array($thread['postuserid'], $coventry)) {
                continue;
            }
            // allow those without canviewthreads to subscribe/receive forum updates as they contain not post content
            $usercontext = vB::getUserContext($thread['userid']);
            if (!$usercontext->getChannelPermission('forumpermissions', 'canview', $thread['nodeid']) or $thread['lastauthorid'] != $thread['userid'] and !$usercontext->getChannelPermission('forumpermissions', 'canviewothers', $thread['nodeid'])) {
                continue;
            }
            $thread['forumhtmltitle'] = unhtmlspecialchars($thread['forumhtmltitle']);
            $thread['lastreplydate'] = vbdate($langInfo['dateoverride'] ? $langInfo['dateoverride'] : vB::getDatastore()->getOption('dateformat'), $thread['lastpost'], false, true, true, false, $userinfo);
            $thread['lastreplytime'] = vbdate($langInfo['timeoverride'] ? $langInfo['timeoverride'] : vB::getDatastore()->getOption('timeformat'), $thread['lastpost'], false, true, true, false, $userinfo);
            $thread['htmltitle'] = unhtmlspecialchars($thread['htmltitle']);
            $thread['postusername'] = unhtmlspecialchars($thread['postusername']);
            $thread['lastposter'] = unhtmlspecialchars($thread['lastposter']);
            if ($thread['prefixid']) {
                // need prefix in correct language
                $phraseAux = vB_Api::instanceInternal('phrase')->fetch(array("prefix_{$thread['prefixid']}_title_plain"));
                $thread['prefix_plain'] = $phraseAux["prefix_{$thread['prefixid']}_title_plain"] . ' ';
            } else {
                $thread['prefix_plain'] = '';
            }
            $threadlink = vB5_Route::buildUrl($thread['routeid'] . '|fullurl', array('nodeid' => $thread['threadid']));
            // Legacy Hook 'digest_forum_thread' Removed //
            $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('digestthreadbit', array($thread['prefix_plain'], $thread['htmltitle'], $threadlink, $thread['forumhtmltitle'], $thread['postusername'], $thread['lastreplydate'], $thread['lastreplytime']), array(), $forum['languageid']);
            if ($thread['dateline'] > $lastdate) {
                // new thread
                $newthreads++;
                $newthreadbits .= $maildata['message'];
            } else {
                $updatedthreads++;
                $updatedthreadbits .= $maildata['message'];
            }
        }
        // Legacy Hook 'digest_forum_process' Removed //
        if (!empty($newthreads) or !empty($updatedthreadbits)) {
            // make email
            // magic vars used by the phrase eval
            //$forumlink = fetch_seo_url('forum|nosession|bburl', $forum);
            $forumlink = vB5_Route::buildUrl($forum['routeid'] . '|fullurl', array('nodeid' => $forum['forumid']));
            //this link probably doesn't do what the author thinks it does.  Need to validate.
            $unsubscribelink = vB5_Route::buildUrl('subscription|fullurl', array('tab' => 'subscriptions', 'userid' => $forum['userid']));
            $maildata = vB_Api::instanceInternal('phrase')->fetchEmailPhrases('digestforum', array($forum['username'], $forum['title_clean'], $newthreads, $updatedthreads, $forumlink, $newthreadbits, $updatedthreadbits, vB::getDatastore()->getOption('bbtitle'), $unsubscribelink), array($forum['title_clean']), $forum['languageid']);
            vB_Mail::vbmail($forum['email'], $maildata['subject'], $maildata['message'], true);
        }
    }
    // ******* Social Group Digests **********
    $bf_misc_socnet = vB::get_datastore()->get_value('bf_misc_socnet');
    if (vB::getDatastore()->getOption('socnet') & $bf_misc_socnet['enable_groups']) {
        require_once DIR . '/includes/functions_socialgroup.php';
        /** @todo review this part*/
        /** @todo if we reenable this code, we need to prefetch language records as for threads and forums */
        /*
        $groups = vB::getDbAssertor()->assertQuery('fetchSocialGroupDigests', array(
        	'dstonoff' => $bf_misc_useroptions['dstonoff'],
        	'hasaccessmask' => $bf_misc_useroptions['hasaccessmask'],
        	'languageid' => intval(vB::getDatastore()->getOption('languageid')),
        	'type' => $type == 2 ? 'daily' : 'weekly',
        	'lastdate' => intval($lastdate),
        	'isnotbannedgroup' => $bf_ugp_genericoptions['isnotbannedgroup']
        ));
        
        
        foreach ($groups as $group)
        {
        	$userperms = cache_permissions($group, false);
        	if (!($userperms['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview'])
        		OR !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'])
        	)
        	{
        		continue;
        	}
        
        	if ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view'] AND $vbulletin->options['sg_allow_join_to_view'])
        	{
        		if ($group['membertype'] != 'member'
        			AND !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwayspostmessage'])
        			AND !($userperms['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canalwascreatediscussion'])
        		)
        		{
        			continue;
        		}
        	}
        
        	$userinfo = array(
        		'lang_locale'       => $group['lang_locale'],
        		'dstonoff'          => $group['dstonoff'],
        		'timezoneoffset'    => $group['timezoneoffset'],
        	);
        
        	$new_discussion_bits = '';
        	$new_discussions = 0;
        	$updated_discussion_bits = '';
        	$updated_discussions = 0;
        
        	$group['username'] = unhtmlspecialchars($group['username']);
        	$group['name'] = unhtmlspecialchars($group['name']);
        	$discussions = vB::getDbAssertor()->assertQuery('fetchGroupDiscussions', array(
        			'groupid' => $group['groupid'],
        			'lastdate' => intval($lastdate)
        	));
        	foreach ($discussions as $discussion)
        	{
        		$discussion['lastreplydate'] = vbdate($group['lang_dateoverride'] ? $group['lang_dateoverride'] : $vbulletin->options['default_dateformat'], $discussion['lastpost'], false, true, true, false, $userinfo);
        		$discussion['lastreplytime'] = vbdate($group['lang_timeoverride'] ? $group['lang_timeoverride'] : $vbulletin->options['default_timeformat'], $discussion['lastpost'], false, true, true, false, $userinfo);
        
        		$discussion['title'] = unhtmlspecialchars($discussion['title']);
        		$discussion['postusername'] = unhtmlspecialchars($discussion['postusername']);
        		$discussion['lastposter'] = unhtmlspecialchars($discussion['lastposter']);
        
        		// Legacy Hook 'digest_group_discussion' Removed //
        
        		//magic variables that will be picked up by the phrase eval
        		$discussionlink = fetch_seo_url('groupdiscussion', $discussion);
        
        		$maildata = vB_Api::instanceInternal('phrase')
        			->fetchEmailPhrases('digestgroupbit', array($discussion['htmltitle'], $discussionlink, $group['name'], $discussion['postusername'], $discussion['lastreplydate'], $discussion['lastreplytime']), array(), $group['languageid']);
        		if ($discussion['dateline'] > $lastdate)
        		{ // new discussion
        			$new_discussions++;
        			$new_discussion_bits .= $maildata['message'];
        		}
        		else
        		{
        			$updated_discussions++;
        			$updated_discussion_bits .= $maildata['message'];
        		}
        
        	}
        
        	// Legacy Hook 'digest_group_process' Removed //
        
        	if (!empty($new_discussion_bits) OR !empty($updated_discussion_bits))
        	{
        		//magic variables that will be picked up by the phrase eval
        		$grouplink = fetch_seo_url('group|nosession|bburl', $group);
        
        		// make email
        		$maildata = vB_Api::instanceInternal('phrase')
        			->fetchEmailPhrases('digestgroup', array($group['username'], $group['name'], $new_discussions, $updated_discussions, $grouplink, $new_discussion_bits, $updated_discussion_bits, $vbulletin->options['bbtitle']), array($group['name']), $group['languageid']);
        		vB_Mail::vbmail($group['email'], $maildata['subject'], $maildata['message']);
        	}
        }
        */
    }
    vB_Mail::vbmailEnd();
}
Esempio n. 21
0
             $action .= ', \'' . $log['threadtitle'] . '\'';
         }
     } else {
         // vB5 logs
         $temp = array();
         $logdata = @unserialize($log['action']);
         $action = construct_phrase($vbphrase[$phrase], $log['username']);
         if ($logdata['userid'] and $logdata['username']) {
             $name = '<a href="user.php?' . vB::getCurrentSession()->get('sessionurl') . 'do=edit&u=' . $logdata['userid'] . '">' . $logdata['username'] . '</a>';
             $temp[] = $vbphrase['author'] . ' = ' . $name;
             unset($logdata['userid'], $logdata['username']);
         }
         $logdata['nodeid'] = $log['nodeid'];
         $title = $log['nodetitle'] ? $log['nodetitle'] : $vbphrase['untitled'];
         if ($log['routeid']) {
             $titleurl = vB5_Route::buildUrl($log['routeid'] . '|fullurl', array('nodeid' => $log['nodeid'], 'title' => $title, 'innerPost' => $log['nodeid']), array(), '#post' . $log['nodeid']);
             $logdata['title'] = '<a href="' . $titleurl . '">' . $title . '</a>';
         } else {
             $logdata['title'] = $title;
         }
         if (!empty($logdata)) {
             foreach ($logdata as $key => $data) {
                 $temp[] = "{$key} = {$data}";
             }
             $action .= '<br />' . implode('; ', $temp);
         }
     }
 } else {
     $action = '-';
 }
 $cell[] = $action;
Esempio n. 22
0
 /**
  * Fetch notices to be displayed
  *
  * @param int $channelid Current Channel ID
  * @param array $ignore_np_notices Ignored non-persistent notice ids
  * @param boolean Whether or not to do the phrase replacement, if false, the client is responsible
  * @return array Notices
  *
  * @see fetch_relevant_notice_ids()
  */
 public function fetch($channelid = 0, $ignore_np_notices = array(), $replace_phrases = false)
 {
     if ($channelid) {
         $channelapi = vB_Api::instanceInternal('content_channel');
         // This is to verify $channelid
         $channelapi->fetchChannelById($channelid);
     }
     $noticecache = vB::getDatastore()->getValue('noticecache');
     $userinfo = vB::getCurrentSession()->fetch_userinfo();
     $vboptions = vB::getDatastore()->getValue('options');
     $display_notices = array();
     foreach ($noticecache as $noticeid => $notice) {
         foreach ($notice as $criteriaid => $conditions) {
             switch ($criteriaid) {
                 case 'persistent':
                     if ($conditions == 0 and is_array($ignore_np_notices) and in_array($noticeid, $ignore_np_notices)) {
                         continue 3;
                     }
                     break;
                 case 'dismissible':
                     if ($conditions == 1 and in_array($noticeid, $this->fetchDismissedNotices())) {
                         continue 3;
                     }
                     break;
                     /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below
                     		{
                     			if (in_array(intval($conditions[0]), $display_notices))
                     			{
                     				continue 3;
                     			}
                     			break;
                     		}*/
                 /*case 'notice_x_not_displayed': // this is now handled differently - see $remove_display_notices below
                 		{
                 			if (in_array(intval($conditions[0]), $display_notices))
                 			{
                 				continue 3;
                 			}
                 			break;
                 		}*/
                 case 'in_usergroup_x':
                     if (!is_member_of($userinfo, intval($conditions[0]))) {
                         continue 3;
                     }
                     break;
                 case 'not_in_usergroup_x':
                     if (is_member_of($userinfo, intval($conditions[0]))) {
                         continue 3;
                     }
                     break;
                 case 'browsing_forum_x':
                     if (!$channelid or $channelid != intval($conditions[0])) {
                         continue 3;
                     }
                     break;
                 case 'browsing_forum_x_and_children':
                     if (!$channelid) {
                         continue 3;
                     }
                     $parents = vB_Library::instance('node')->getParents($channelid);
                     $parentids = array();
                     foreach ($parents as $parent) {
                         if ($parent['nodeid'] != 1) {
                             $parentids[] = $parent['nodeid'];
                         }
                     }
                     if (!in_array(intval($conditions[0]), $parentids)) {
                         continue 3;
                     }
                     break;
                 case 'no_visit_in_x_days':
                     if ($userinfo['lastvisit'] > vB::getRequest()->getTimeNow() - $conditions[0] * 86400) {
                         continue 3;
                     }
                     break;
                 case 'has_never_posted':
                     if ($userinfo['posts'] > 0) {
                         continue 3;
                     }
                     break;
                 case 'no_posts_in_x_days':
                     if ($userinfo['lastpost'] == 0 or $userinfo['lastpost'] > vB::getRequest()->getTimeNow() - $conditions[0] * 86400) {
                         continue 3;
                     }
                     break;
                 case 'has_x_postcount':
                     if (!$this->checkNoticeCriteriaBetween($userinfo['posts'], $conditions[0], $conditions[1])) {
                         continue 3;
                     }
                     break;
                 case 'has_x_reputation':
                     if (!$this->checkNoticeCriteriaBetween($userinfo['reputation'], $conditions[0], $conditions[1])) {
                         continue 3;
                     }
                     break;
                 case 'has_x_infraction_points':
                     if (!$this->checkNoticeCriteriaBetween($userinfo['ipoints'], $conditions[0], $conditions[1])) {
                         continue 3;
                     }
                     break;
                 case 'pm_storage_x_percent_full':
                     if ($userinfo['permissions']['pmquota']) {
                         $pmboxpercentage = $userinfo['pmtotal'] / $userinfo['permissions']['pmquota'] * 100;
                         if (!$this->checkNoticeCriteriaBetween($pmboxpercentage, $conditions[0], $conditions[1])) {
                             continue 3;
                         }
                     } else {
                         continue 3;
                     }
                     break;
                 case 'username_is':
                     if (strtolower($userinfo['username']) != strtolower(trim($conditions[0]))) {
                         continue 3;
                     }
                     break;
                 case 'is_birthday':
                     if (substr($userinfo['birthday'], 0, 5) != vbdate('m-d', vB::getRequest()->getTimeNow(), false, false)) {
                         continue 3;
                     }
                     break;
                 case 'came_from_search_engine':
                     if (!is_came_from_search_engine()) {
                         continue 3;
                     }
                     break;
                 case 'style_is_x':
                     if (STYLEID != intval($conditions[0])) {
                         continue 3;
                     }
                     break;
                 case 'in_coventry':
                     if (!in_array($userinfo['userid'], preg_split('#\\s+#', $vboptions['globalignore'], -1, PREG_SPLIT_NO_EMPTY))) {
                         continue 3;
                     }
                     break;
                 case 'is_date':
                     if (empty($conditions[1]) and vbdate('d-m-Y', vB::getRequest()->getTimeNow(), false, false) != $conditions[0]) {
                         continue 3;
                     } else {
                         if ($conditions[1] and gmdate('d-m-Y', vB::getRequest()->getTimeNow()) != $conditions[0]) {
                             continue 3;
                         }
                     }
                     break;
                 case 'is_time':
                     if (preg_match('#^(\\d{1,2}):(\\d{2})$#', $conditions[0], $start_time) and preg_match('#^(\\d{1,2}):(\\d{2})$#', $conditions[1], $end_time)) {
                         if (empty($conditions[2])) {
                             $start = mktime($start_time[1], $start_time[2]) + $vboptions['hourdiff'];
                             $end = mktime($end_time[1], $end_time[2]) + $vboptions['hourdiff'];
                             $now = mktime() + $vboptions['hourdiff'];
                         } else {
                             $start = gmmktime($start_time[1], $start_time[2]);
                             $end = gmmktime($end_time[1], $end_time[2]);
                             $now = gmmktime();
                         }
                         if ($now < $start or $now > $end) {
                             continue 3;
                         }
                     } else {
                         continue 3;
                     }
                     break;
                 default:
                     $abort = false;
                     if ($abort) {
                         continue 3;
                     }
             }
         }
         $display_notices["{$noticeid}"] = $noticeid;
     }
     // now go through removing notices using the 'notice_x_not_displayed' criteria
     $remove_display_notices = array();
     foreach ($noticecache as $noticeid => $notice) {
         if (isset($notice['notice_x_not_displayed']) and isset($display_notices[intval($notice['notice_x_not_displayed'][0])])) {
             $remove_display_notices["{$noticeid}"] = $noticeid;
         }
     }
     foreach ($remove_display_notices as $noticeid) {
         unset($display_notices["{$noticeid}"]);
     }
     $return = array();
     if ($display_notices) {
         if ($replace_phrases) {
             // Prefech phrases
             $phrases = array();
             foreach ($display_notices as $display_notice) {
                 $phrases[] = "notice_{$display_notice}_html";
             }
             $vbphrase = vB_Api::instanceInternal('phrase')->fetch($phrases);
             foreach ($display_notices as $display_notice) {
                 $notice_html = str_replace(array('{musername}', '{username}', '{userid}', '{sessionurl}', '{sessionurl_q}', '{register_page}', '{help_page}'), array($userinfo['musername'], $userinfo['username'], $userinfo['userid'], vB::getCurrentSession()->get('sessionurl'), vB::getCurrentSession()->get('sessionurl_q'), vB5_Route::buildUrl('register|fullurl'), vB5_Route::buildUrl('help|fullurl')), $vbphrase["notice_{$display_notice}_html"]);
                 $return[$display_notice] = $noticecache[$display_notice];
                 $return[$display_notice]['notice_html'] = $notice_html;
             }
         } else {
             foreach ($display_notices as $display_notice) {
                 $return[$display_notice] = $noticecache[$display_notice];
                 $return[$display_notice]['notice_phrase_varname'] = "notice_{$display_notice}_html";
             }
         }
     }
     return $return;
 }
Esempio n. 23
0
 public function parseArticleSearch($node, $parent)
 {
     $content = $node['content'];
     $article = array('title' => vB_String::unHtmlSpecialChars($content['title']), 'html_title' => $content['title'], 'username' => $content['authorname'], 'description' => $content['description'], 'parenttitle' => vB_String::unHtmlSpecialChars($parent['title']), 'parentid' => $content['parentid'], 'previewtext' => $content['previewtext'], 'publishtime' => $content['publishdate'], 'replycount' => $content['textcount'], 'page_url' => vB5_Route::buildUrl($node['routeid'] . '|fullurl', $node), 'parent_url' => vB5_Route::buildUrl($parent['routeid'] . '|fullurl', $parent), 'lastposterinfo' => array('userid' => $content['lastauthorid'], 'username' => $content['lastcontentauthor']), 'avatar' => array('hascustom' => $content['avatar']['hascustom'], '0' => $content['avatar']['avatarpath'], '1' => ''), 'article' => array('contentid' => $content['nodeid'], 'nodeid' => $content['nodeid'], 'username' => $content['authorname'], 'userid' => $content['userid'], 'publishtime' => $content['publishdate'], 'title' => vB_String::unHtmlSpecialChars($content['title'])), 'categories' => array(), 'show' => array());
     return $article;
 }
Esempio n. 24
0
    $admindm->set('notes', $vbulletin->GPC['notes']);
    $admindm->save();
    unset($admindm);
    $vbulletin->userinfo['notes'] = htmlspecialchars_uni($vbulletin->GPC['notes']);
    $_REQUEST['do'] = 'home';
}
// #############################################################################
// ################################# HEADER FRAME ##############################
// #############################################################################
$versionhost = vB::getRequest()->getVbUrlScheme() . '://version.vbulletin.com';
if ($_REQUEST['do'] == 'head') {
    ignore_user_abort(true);
    define('IS_NAV_PANEL', true);
    print_cp_header('', '');
    $forumHome = vB_Library::instance('content_channel')->getForumHomeChannel();
    $forumhomelink = vB5_Route::buildUrl($forumHome['routeid'] . '|fullurl');
    ?>
	<div id="acp-head-wrapper">
		<ul id="acp-top-links">
			<li id="acp-top-link-acp" class="left"><div><span class="icon"></span><?php 
    echo $vbphrase['admin_cp'];
    ?>
</div></li>
			<li id="acp-top-link-site" class="left"><a href="../" target="_blank"><?php 
    echo $vbphrase['site_home_page'];
    ?>
</a></li>
			<li class="left divider"></li>
			<li id="acp-top-link-logout" class="right rightmost"><a href="index.php?<?php 
    echo vB::getCurrentSession()->get('sessionurl');
    ?>
Esempio n. 25
0
 /**
  * Handles a [node] tag. Creates a link to a node.
  *
  * @param	string	If tag has option, the displayable name. Else, the threadid.
  * @param	string	If tag has option, the threadid.
  *
  * @return	string	HTML representation of the tag.
  */
 protected function handle_bbcode_node($text, $nodeId)
 {
     $nodeId = intval($nodeId);
     if (empty($nodeId)) {
         // no option -- use param
         $nodeId = intval($text);
         unset($text);
     }
     // fetch URL
     $nodeInfo = array('nodeid' => $nodeId);
     $url = vB5_Route::buildUrl('node|fullurl', $nodeInfo);
     if (!isset($text)) {
         $text = $url;
     }
     // standard URL hyperlink
     $value = "<a href=\"{$url}\" target=\"_blank\">{$text}</a>";
     return $value;
 }
                            $cell[] = '<span class="smallfont">' . vbdate($vbulletin->options['logdateformat'], $infraction['expires']) . '</span>';
                        }
                        break;
                    case 1:
                        $cell[] = $vbphrase['expired_ginfraction'];
                        break;
                    case 2:
                        $cell[] = $vbphrase['reversed_ginfraction'];
                        break;
                }
            }
            $postlink = '';
            if (!empty($infraction['infractednodeid']) and !$infraction['postdeleted']) {
                $infractedNode = vB_Api::instanceInternal('node')->getNodeFullContent($infraction['infractednodeid']);
                $infractedNode = $infractedNode[$infraction['infractednodeid']];
                $postlink = vB5_Route::buildUrl($infractedNode['routeid'] . '|fullurl', array('nodeid' => $infractedNode['nodeid'], 'title' => $infractedNode['title']), array('p' => $infractedNode['nodeid'])) . '#post' . $infractedNode['nodeid'];
            }
            $cell[] = $postlink ? construct_link_code(htmlspecialchars_uni($vbphrase['post']), $postlink, true, '', true) : '&nbsp;';
            $cell[] = ($infraction['action'] != 2 ? construct_link_code($vbphrase['reverse_ginfraction'], "admininfraction.php?" . vB::getCurrentSession()->get('sessionurl') . "do=reverse&nodeid={$infraction['nodeid']}" . $args . $vbulletin->GPC['orderby'], false, '', true) : '') . ' ' . construct_link_code($vbphrase['infraction_view'], "admininfraction.php?" . vB::getCurrentSession()->get('sessionurl') . "do=details&nodeid={$infraction['nodeid']}", false, '', true) . ' ' . construct_link_code($vbphrase['delete'], "admininfraction.php?" . vB::getCurrentSession()->get('sessionurl') . "do=deleteinfraction&nodeid={$infraction['nodeid']}" . $args . $vbulletin->GPC['orderby'], false, '', true);
            print_cells_row($cell);
        }
        print_table_footer(8, "{$firstpage} {$prevpage} &nbsp; {$nextpage} {$lastpage}");
    } else {
        print_stop_message2('no_matches_found_gcpuser', NULL, array(), '');
    }
}
// ###################### Start add #######################
if ($_REQUEST['do'] == 'editgroup') {
    print_form_header('admininfraction', 'updategroup');
    if (!empty($vbulletin->GPC['infractiongroupid'])) {
        $infraction = vB::getDbAssertor()->getRow('infractiongroup', array('infractiongroupid' => $vbulletin->GPC['infractiongroupid']));
Esempio n. 27
0
 /**
  * Resets the route ident cache. This is only intended to be used for unit tests,
  * where mulitple tests run during the same request, causing invalid routes (from
  * a previous test to be in $routeidentcache. This doesn't happen on a normal
  * page request, because $routeidentcache is in memory only for the duration of
  * the request. VBV-12736
  */
 public static function resetRouteIdentCache()
 {
     self::$routeidentcache = array();
 }
 /**
  * Builds the applicable notification HTML and count
  *
  * @return	array	[bits] => HTML, [total] => formatted count
  */
 protected function build_notifications()
 {
     global $vbulletin, $vbphrase, $show;
     if (!$vbulletin->userinfo['userid']) {
         return false;
     }
     $notifications = array();
     if ($vbulletin->options['enablepms'] and $vbulletin->userinfo['userid'] and ($vbulletin->userinfo['pmunread'] or $vbulletin->userinfo['receivepm'] and $vbulletin->userinfo['permissions']['pmquota'])) {
         $notifications['pmunread'] = array('phrase' => $vbphrase['unread_private_messages'], 'link' => 'private.php' . vB::getCurrentSession()->get('sessionurl_q'), 'order' => 10);
     }
     if ($vbulletin->userinfo['vm_enable'] and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging'] and $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']) {
         $notifications['vmunreadcount'] = array('phrase' => $vbphrase['unread_profile_visitor_messages'], 'link' => vB5_Route::buildUrl('profile', $vbulletin->userinfo), 'order' => 20);
         if ($vbulletin->userinfo['permissions']['visitormessagepermissions'] & $vbulletin->bf_ugp_visitormessagepermissions['canmanageownprofile']) {
             $notifications['vmmoderatedcount'] = array('phrase' => $vbphrase['profile_visitor_messages_awaiting_approval'], 'link' => vB5_Route::buildUrl('profile', $vbulletin->userinfo), 'order' => 30);
         }
     }
     // check for incoming friend requests if user has permission to use the friends system
     if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_friends'] and $vbulletin->userinfo['permissions']['genericpermissions2'] & $vbulletin->bf_ugp_genericpermissions2['canusefriends']) {
         $notifications['friendreqcount'] = array('phrase' => $vbphrase['incoming_friend_requests'], 'link' => 'profile.php?' . vB::getCurrentSession()->get('sessionurl') . 'do=buddylist#irc', 'order' => 40);
     }
     // social group invitations and join requests
     if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups']) {
         // check for requests to join your own social groups, if user has permission to create groups
         if ($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['cancreategroups']) {
             $notifications['socgroupreqcount'] = array('phrase' => $vbphrase['requests_to_join_your_social_groups'], 'link' => fetch_seo_url('grouphome', array(), array('do' => 'requests')), 'order' => 50);
         }
         // check for invitations to join social groups, if user has permission to join groups
         if ($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups']) {
             $notifications['socgroupinvitecount'] = array('phrase' => $vbphrase['invitations_to_join_social_groups'], 'link' => fetch_seo_url('grouphome', array(), array('do' => 'invitations')), 'order' => 60);
         }
     }
     // picture comment notifications
     if ($vbulletin->options['pc_enabled'] and ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] and $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'] and $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'] and $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum'] or $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'])) {
         $notifications['pcunreadcount'] = array('phrase' => $vbphrase['unread_picture_comments'], 'link' => 'album.php?' . vB::getCurrentSession()->get('sessionurl') . 'do=unread', 'order' => 70);
         if ($vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canmanagepiccomment']) {
             $notifications['pcmoderatedcount'] = array('phrase' => $vbphrase['picture_comments_awaiting_approval'], 'link' => 'album.php?' . vB::getCurrentSession()->get('sessionurl') . 'do=moderated', 'order' => 80);
         }
     }
     if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->options['socnet_groups_msg_enabled'] and $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canmanageowngroups']) {
         $notifications['gmmoderatedcount'] = array('phrase' => $vbphrase['group_messages_awaiting_approval'], 'link' => fetch_seo_url('grouphome', array(), array('do' => 'moderatedgms')), 'order' => 90);
     }
     // Legacy Hook 'notifications_list' Removed //
     $notifications_order = array();
     foreach ($notifications as $userfield => $notification) {
         $notifications_order["{$notification['order']}"]["{$userfield}"] = $userfield;
     }
     ksort($notifications_order);
     $notifications_total = 0;
     $notifications_menubits = '';
     foreach ($notifications_order as $notification_order => $userfields) {
         ksort($notifications_order["{$notification_order}"]);
         foreach ($userfields as $userfield) {
             $notification = $notifications["{$userfield}"];
             if (defined("VB_API") and VB_API === true) {
                 $notification['name'] = $userfield;
             }
             if ($vbulletin->userinfo["{$userfield}"] > 0) {
                 $show['notifications'] = true;
                 $notifications_total += $vbulletin->userinfo["{$userfield}"];
                 $notification['total'] = vb_number_format($vbulletin->userinfo["{$userfield}"]);
                 $templater = vB_Template::create('navbar_notifications_menubit');
                 $templater->register('notification', $notification);
                 $templater->register('notificationid', $userfield);
                 $notifications_menubits .= $templater->render();
             }
         }
     }
     if (!$notifications_total) {
         return false;
     }
     return array('bits' => $notifications_menubits, 'total' => vb_number_format($notifications_total));
 }
 public function getBreadcrumbs()
 {
     $breadcrumbs = array(array('phrase' => 'inbox', 'url' => vB5_Route::buildUrl('privatemessage')), array('phrase' => 'subscriptions_channels', 'url' => ''));
     return $breadcrumbs;
 }
Esempio n. 30
0
 /**
  * Fetch a list of banned usergroups
  */
 public function fetchBannedUsergroups()
 {
     $loginuser =& vB::getCurrentSession()->fetch_userinfo();
     $usercontext =& vB::getUserContext($loginuser['userid']);
     if (!$usercontext->hasAdminPermission('cancontrolpanel') and !$usercontext->getChannelPermission('moderatorpermissions', 'canbanusers', 1)) {
         $forumHome = vB_Library::instance('content_channel')->getForumHomeChannel();
         $args = array($loginuser['username']);
         $args[] = vB_Template_Runtime::fetchStyleVar('right');
         $args[] = vB::getCurrentSession()->get('sessionurl');
         $args[] = $loginuser['securitytoken'];
         $args[] = vB5_Route::buildUrl($forumHome['routeid'] . '|fullurl');
         throw new vB_Exception_Api('nopermission_loggedin', $args);
     }
     $bf_ugp_genericoptions = vB::getDatastore()->getValue('bf_ugp_genericoptions');
     $usergroups = $this->fetchUsergroupList();
     $bannedusergroups = array();
     foreach ($usergroups as $usergroup) {
         if (!($usergroup['genericoptions'] & $bf_ugp_genericoptions['isnotbannedgroup'])) {
             $bannedusergroups[$usergroup['usergroupid']] = $usergroup;
         }
     }
     return $bannedusergroups;
 }