/** * 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; }
case 'group': echo "<li>Group Message {$result['gmid']}: "; break; case 'sig': echo "<li>Signature for userid {$result['userid']}: "; break; default: echo "<li>post {$result['postid']}: "; } if ($verbose) { $text = $result['pagetext']; } //change all nomedia and ame tags into URL tags $result['pagetext'] = preg_replace('%(\\[(ame|nomedia)([^\\]]*)\\](.*?)\\[/(\\2)\\])%sim', '[url\\3]\\4[/url]', $result['pagetext']); //parse URL tags $returnvalue = parse_video_bbcode($result['pagetext']); if ($returnvalue != $text && !$test) { switch ($zone) { case 'vm': $sql = "UPDATE " . TABLE_PREFIX . "visitormessage SET pagetext = '" . $db->escape_string($returnvalue) . "' WHERE vmid={$result['vmid']}"; $db->query_write($sql); break; case 'blog': $sql = "UPDATE " . TABLE_PREFIX . "blog_text SET pagetext = '" . $db->escape_string($returnvalue) . "' WHERE blogtextid={$result['blogtextid']}"; $db->query_write($sql); $db->query_write("DELETE FROM " . TABLE_PREFIX . "blog_textparsed WHERE blogtextid={$result['blogtextid']}"); break; case 'group': $sql = "UPDATE " . TABLE_PREFIX . "groupmessage SET pagetext = '" . $db->escape_string($returnvalue) . "' WHERE gmid={$result['gmid']}"; $db->query_write($sql); break;
/** * Converts text from an editor into text ready to be saved with bbcode converted * * @param string Text to convert * @param array Options * - autoparselinks * * @return string Converted Text */ public function convertWysiwygTextToBbcode($text, $options) { $text = $this->parseWysiwygHtmlToBbcode($text); require_once DIR . '/includes/functions_video.php'; $text = parse_video_bbcode($text); if (!empty($options['autoparselinks'])) { $text = $this->convertUrlToBbcode($text); } return $text; }
/** * Verifies that the message field is valid * * @param string Message text * * @return boolean */ function verify_message(&$message) { if ($message == '') { $this->error('nosubject'); return false; } // check message length if (empty($this->info['is_automated']) and $this->registry->options['pmmaxchars'] > 0) { $messagelength = vbstrlen($message); if ($messagelength > $this->registry->options['pmmaxchars']) { $this->error('toolong', $messagelength, $this->registry->options['pmmaxchars']); return false; } } $message = fetch_censored_text($message); require_once DIR . '/includes/functions_video.php'; $message = parse_video_bbcode($message); return true; }
$userinfo_sigpic = fetch_userinfo($vbulletin->userinfo['userid'], FETCH_USERINFO_SIGPIC); // Censored Words $censor_signature = fetch_censored_text($signature); if ($signature != $censor_signature) { $signature = $censor_signature; $errors[] = fetch_error('censoredword'); unset($censor_signature); } // Max number of images in the sig if imgs are allowed. if ($vbulletin->userinfo['permissions']['sigmaximages'] or $vbulletin->userinfo['permissions']['sigmaxvideos']) { // Parsing the signature into BB code. require_once DIR . '/includes/class_bbcode_alt.php'; require_once DIR . '/includes/functions_video.php'; $bbcode_parser = new vB_BbCodeParser_ImgCheck($vbulletin, fetch_tag_list()); $bbcode_parser->set_parse_userinfo($userinfo_sigpic, $vbulletin->userinfo['permissions']); $signature = parse_video_bbcode($signature); $parsedsig = $bbcode_parser->parse($signature, 'signature'); // Count the images if ($vbulletin->userinfo['permissions']['sigmaximages']) { $imagecount = fetch_character_count($parsedsig, '<img'); if ($imagecount > $vbulletin->userinfo['permissions']['sigmaximages']) { $vbulletin->GPC['preview'] = true; $errors[] = fetch_error('toomanyimages', $imagecount, $vbulletin->userinfo['permissions']['sigmaximages']); } } if ($vbulletin->userinfo['permissions']['sigmaxvideos']) { $videocount = fetch_character_count($parsedsig, '<video />'); if ($videocount > $vbulletin->userinfo['permissions']['sigmaxvideos']) { $vbulletin->GPC['preview'] = true; $errors[] = fetch_error('toomanyvideos', $videocount, $vbulletin->userinfo['permissions']['sigmaxvideos']); }