Ejemplo n.º 1
0
 /**
  * Verifies the title is valid and sets up the title for saving (wordwrap, censor, etc).
  *
  * @param	string	Title text
  *
  * @param	bool	Whether the title is valid
  */
 function verify_title(&$title)
 {
     // replace html-encoded spaces with actual spaces
     $title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);
     $title = trim($title);
     if ($this->registry->options['titlemaxchars'] and $title != $this->existing['title']) {
         if (!empty($this->info['show_title_error'])) {
             if (($titlelen = vbstrlen($title)) > $this->registry->options['titlemaxchars']) {
                 // title too long
                 $this->error('title_toolong', $titlelen, $this->registry->options['titlemaxchars']);
                 return false;
             }
         } else {
             if (empty($this->info['is_automated'])) {
                 // not showing the title length error, just chop it
                 $title = vbchop($title, $this->registry->options['titlemaxchars']);
             }
         }
     }
     require_once DIR . '/includes/functions_newpost.php';
     // censor, remove all caps subjects, and htmlspecialchars title
     $title = fetch_no_shouting_text(fetch_censored_text($title));
     // do word wrapping
     $title = fetch_word_wrapped_string($title);
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }
Ejemplo n.º 3
0
 if (empty($vbulletin->GPC['message'])) {
     eval(standard_error(fetch_error('nosubject')));
 }
 $vbulletin->GPC['title'] = fetch_censored_text($vbulletin->GPC['title']);
 if ($vbulletin->options['wordwrap'] != 0) {
     $vbulletin->GPC['title'] = fetch_word_wrapped_string($vbulletin->GPC['title']);
 }
 // remove all caps subjects
 $vbulletin->GPC['title'] = fetch_no_shouting_text($vbulletin->GPC['title']);
 $vbulletin->GPC['message'] = fetch_censored_text($vbulletin->GPC['message']);
 if ($vbulletin->GPC['parseurl'] and $vbulletin->options['unallowvbcode']) {
     $vbulletin->GPC['message'] = convert_url_to_bbcode($vbulletin->GPC['message']);
 }
 // remove sessionhash from urls:
 $vbulletin->GPC['message'] = preg_replace('/(s|sessionhash)=[a-z0-9]{32}&{0,1}/', '', $vbulletin->GPC['message']);
 $vbulletin->GPC['message'] = fetch_no_shouting_text($vbulletin->GPC['message']);
 if (vbstrlen($vbulletin->GPC['message']) > $vbulletin->options['postmaxchars'] and $vbulletin->options['postmaxchars'] != 0) {
     eval(standard_error(fetch_error('toolong', $postlength, $vbulletin->options['postmaxchars'])));
 }
 if (vbstrlen($vbulletin->GPC['message']) < $vbulletin->options['postminchars'] or $vbulletin->GPC['message'] == '') {
     eval(standard_error(fetch_error('tooshort', $vbulletin->options['postminchars'])));
 }
 ($hook = vBulletinHook::fetch_hook('usernote_donote')) ? eval($hook) : false;
 if ($vbulletin->GPC['usernoteid']) {
     // Edited note.
     $db->query_write("\r\n\t\t\tUPDATE " . TABLE_PREFIX . "usernote\r\n\t\t\tSET message = '" . $db->escape_string($vbulletin->GPC['message']) . "',\r\n\t\t\t\ttitle = '" . $db->escape_string($vbulletin->GPC['title']) . "',\r\n\t\t\t\tallowsmilies = {$allowsmilies}\r\n\t\t\tWHERE usernoteid = " . $vbulletin->GPC['usernoteid'] . "\r\n\t\t");
 } else {
     /*insert query*/
     $db->query_write("\r\n\t\t\tINSERT INTO " . TABLE_PREFIX . "usernote (message, dateline, userid, posterid, title, allowsmilies)\r\n\t\t\tVALUES ('" . $db->escape_string($vbulletin->GPC['message']) . "', " . TIMENOW . ", {$userinfo['userid']}, " . $vbulletin->userinfo['userid'] . ", '" . $db->escape_string($vbulletin->GPC['title']) . "', {$allowsmilies})\r\n\t\t");
 }
 if (!$canview) {
Ejemplo n.º 4
0
	/**
	* Verifies the description is valid and sets up the title for saving (wordwrap, censor, etc).
	*
	* @param	string	Title text
	*
	* @param	bool	Whether the title is valid
	*/
	function verify_description(&$desc)
	{
		// replace html-encoded spaces with actual spaces
		$desc = preg_replace('/&#(0*32|x0*20);/', ' ', $desc);

		require_once(DIR . '/includes/functions_newpost.php');
		// censor, remove all caps subjects, and htmlspecialchars post title
		$desc = htmlspecialchars_uni(fetch_no_shouting_text(fetch_censored_text(trim($desc))));

		// do word wrapping
		$desc = fetch_word_wrapped_string($desc, $this->registry->options['blog_wordwrap']);

		return true;
	}
Ejemplo n.º 5
0
 /**
  * Verifies that the title is valid
  *
  * @param	String	Title
  *
  * @return 	boolean	Returns true if title is valid
  */
 function verify_title(&$title)
 {
     // replace html-encoded spaces with actual spaces
     $title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);
     // do word wrapping
     if ($this->registry->options['wordwrap'] != 0) {
         $title = fetch_word_wrapped_string($title);
     }
     require_once DIR . '/includes/functions_newpost.php';
     // censor, remove all caps subjects, and htmlspecialchars post title
     $title = htmlspecialchars_uni(fetch_no_shouting_text(fetch_censored_text($title)));
     $title = trim($title);
     if (empty($title)) {
         $this->error('invalid_title_specified');
         return false;
     }
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Verify a clean (no markup) bit of text
  *
  * @param	string	Text
  */
 function verify_cleantext(&$clean_text)
 {
     $clean_text = trim(preg_replace('/&#(0*32|x0*20);/', ' ', $clean_text));
     // censor, remove all caps subjects
     require_once DIR . '/includes/functions_newpost.php';
     $clean_text = fetch_no_shouting_text(fetch_censored_text($clean_text));
     // do word wrapping
     if ($this->registry->options['wordwrap'] != 0) {
         $clean_text = fetch_word_wrapped_string($clean_text);
     }
     return true;
 }
Ejemplo n.º 7
0
	/**
	* Verifies the title is valid and sets up the title for saving (wordwrap, censor, etc).
	*
	* @param	string	Title text
	*
	* @param	bool	Whether the title is valid
	*/
	function verify_title(&$title)
	{
		// replace html-encoded spaces with actual spaces
		$title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);

		// censor, remove all caps subjects, and htmlspecialchars post title
		$title = htmlspecialchars_uni(fetch_no_shouting_text(fetch_censored_text(trim($title))));

		// do word wrapping
		$title = fetch_word_wrapped_string($title, $this->registry->options['blog_wordwrap']);

		return true;
	}
Ejemplo n.º 8
0
function photoplog_process_text($text, $catid, $is_title = false, $add_dots = false)
{
    global $vbulletin, $vbphrase, $photoplog_categoryoptions, $photoplog_ds_catopts;
    static $photoplog_parser = false;
    $do_html = false;
    $do_smilies = false;
    $do_bbcode = false;
    $do_imgcode = false;
    $do_parseurl = false;
    $catid = intval($catid);
    if (!is_array($photoplog_ds_catopts)) {
        $photoplog_ds_catopts = array();
    }
    if (in_array($catid, array_keys($photoplog_ds_catopts))) {
        $photoplog_categorybit = $photoplog_ds_catopts[$catid]['options'];
        $photoplog_catoptions = convert_bits_to_array($photoplog_categorybit, $photoplog_categoryoptions);
        $do_html = $photoplog_catoptions['allowhtml'] ? true : false;
        $do_smilies = $photoplog_catoptions['allowsmilies'] ? true : false;
        $do_bbcode = $photoplog_catoptions['allowbbcode'] ? true : false;
        $do_imgcode = $photoplog_catoptions['allowimgcode'] ? true : false;
        $do_parseurl = $photoplog_catoptions['allowparseurl'] ? true : false;
    }
    $text = fetch_censored_text($text);
    $text = fetch_word_wrapped_string($text);
    require_once DIR . '/includes/functions_newpost.php';
    if ($is_title) {
        $text = fetch_no_shouting_text($text);
        $max_len = 255;
        if (vbstrlen($text) > $max_len) {
            $text = fetch_trimmed_title($text, $max_len);
            $text = photoplog_regexp_text($text);
        }
        if (empty($text)) {
            $text = $vbphrase['photoplog_untitled'];
        }
        $text = htmlspecialchars_uni($text);
        return $text;
    }
    if ($add_dots) {
        $max_len = 100;
        if ($vbulletin->options['lastthreadchars'] != 0) {
            $max_len = $vbulletin->options['lastthreadchars'] * 2;
        }
    } else {
        $max_len = min(vbstrlen($text), 15360000);
        if ($vbulletin->options['postmaxchars'] != 0) {
            $max_len = $vbulletin->options['postmaxchars'];
        }
    }
    if (vbstrlen($text) > $max_len) {
        $text = fetch_trimmed_title($text, $max_len);
        $text = photoplog_regexp_text($text);
    }
    if ($do_parseurl) {
        $text = convert_url_to_bbcode($text);
    }
    if (empty($text)) {
        $text = $vbphrase['photoplog_not_available'];
    }
    $text = fetch_no_shouting_text($text);
    if (!$photoplog_parser) {
        require_once DIR . '/includes/class_bbcode.php';
        $photoplog_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    }
    $text = $photoplog_parser->do_parse($text, $do_html, $do_smilies, $do_bbcode, $do_imgcode, true, false);
    return $text;
}