function fetch_replaced_session_url($url)
{
    // replace the sessionhash in $url with the current one
    global $vbulletin;
    $url = addslashes($url);
    $url = fetch_removed_sessionhash($url);
    if ($vbulletin->session->vars['sessionurl'] != '') {
        if (strpos($url, '?') !== false) {
            $url .= '&' . $vbulletin->session->vars['sessionurl'];
        } else {
            $url .= '?' . $vbulletin->session->vars['sessionurl'];
        }
    }
    return $url;
}
function fetch_replaced_session_url($url)
{
    // replace the sessionhash in $url with the current one
    global $vbulletin;
    $url = addslashes($url);
    $url = fetch_removed_sessionhash($url);
    if (vB::getCurrentSession()->get('sessionurl') != '') {
        if (strpos($url, '?') !== false) {
            $url .= '&' . vB::getCurrentSession()->get('sessionurl');
        } else {
            $url .= '?' . vB::getCurrentSession()->get('sessionurl');
        }
    }
    return $url;
}
 /**
  * Basic options to perform on all pagetext type fields
  *
  * @param	string	Page text
  *
  * @param	bool	Whether the text is valid
  * @param	bool	Whether to run the case stripper
  */
 function verify_pagetext(&$pagetext, $noshouting = true)
 {
     require_once DIR . '/includes/functions_newpost.php';
     $pagetext = preg_replace('/&#(0*32|x0*20);/', ' ', $pagetext);
     $pagetext = trim($pagetext);
     // remove empty bbcodes
     //$pagetext = $this->strip_empty_bbcode($pagetext);
     // add # to color tags using hex if it's not there
     $pagetext = preg_replace('#\\[color=("|"|\'|)([a-f0-9]{6})\\1]#i', '[color=\\1#\\2\\1]', $pagetext);
     // strip alignment codes that are closed and then immediately reopened
     $pagetext = preg_replace('#\\[/(left|center|right)\\]([\\r\\n]*)\\[\\1\\]#i', '\\2', $pagetext);
     // remove [/list=x remnants
     if (stristr($pagetext, '[/list=') != false) {
         $pagetext = preg_replace('#\\[/list=[a-z0-9]+\\]#siU', '[/list]', $pagetext);
     }
     // remove extra whitespace between [list] and first element
     // -- unnecessary now, bbcode parser handles leading spaces after a list tag
     //$pagetext = preg_replace('#(\[list(=("|"|\'|)([^\]]*)\\3)?\])\s+#i', "\\1\n", $pagetext);
     // censor main message text
     $pagetext = fetch_censored_text($pagetext);
     // parse URLs in message text
     if ($this->info['parseurl']) {
         $pagetext = convert_url_to_bbcode($pagetext);
     }
     // remove sessionhash from urls:
     require_once DIR . '/includes/functions_login.php';
     $pagetext = fetch_removed_sessionhash($pagetext);
     if ($noshouting) {
         $pagetext = fetch_no_shouting_text($pagetext);
     }
     require_once DIR . '/includes/functions_video.php';
     $pagetext = parse_video_bbcode($pagetext);
     return true;
 }