/** * Parses special unmatched HTML tags like <img> and <br>. * * @param string Text pre-parsed * * @return string Parsed text */ protected function parse_unmatched_tags($text) { $text = parent::parse_unmatched_tags($text); return preg_replace( array( '#(?:<p>\s*)?<hr\s*class=(\'|"|)previewbreak\s*(\\1)[^>]*>#si', '#(?:<p>\s*)?<hr.*>#siU' ), array( '[PRBREAK][/PRBREAK]', '[HR][/HR]', ), $text ); }
} else { if (!($vbulletin->userinfo['calendarpermissions']["{$calendarinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['caneditevent'])) { print_no_permission(); } } } } } else { if (!($vbulletin->userinfo['calendarpermissions']["{$calendarinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['canpostevent'])) { print_no_permission(); } } // unwysiwygify the incoming data if ($vbulletin->GPC['wysiwyg']) { require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $message = $html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $calendarinfo['allowhtml']); } else { $message = $vbulletin->GPC['message']; } // init event datamanager class $eventdata =& datamanager_init('Event', $vbulletin, ERRTYPE_STANDARD); ($hook = vBulletinHook::fetch_hook('calendar_update_process')) ? eval($hook) : false; $eventdata->set_info('parseurl', $vbulletin->GPC['parseurl'] and $calendarinfo['allowbbcode']); $eventdata->setr_info('fromtime', $fromtime); $eventdata->setr_info('totime', $totime); $eventdata->setr_info('fromdate', $fromdate); $eventdata->setr_info('todate', $todate); $eventdata->setr_info('type', $vbulletin->GPC['type']); $eventdata->setr_info('recur', $vbulletin->GPC['recur']); $eventdata->set('title', $vbulletin->GPC['title']);
$rsslogs_result = $vbulletin->db->query_read("\n\t\t\tSELECT * FROM " . TABLE_PREFIX . "rsslog\n\t\t\tWHERE uniquehash IN ('" . implode("', '", array_map(array(&$vbulletin->db, 'escape_string'), array_keys($itemstemp))) . "')\n\t\t"); while ($rsslog = $vbulletin->db->fetch_array($rsslogs_result)) { // remove any items with this unique id from the list of potential inserts unset($items["{$rsslog['uniquehash']}"]); } $vbulletin->db->free_result($rsslogs_result); } if (!empty($items)) { $vbulletin->options['postminchars'] = 1; // try to avoid minimum character errors $error_type = defined('IN_CONTROL_PANEL') ? ERRTYPE_CP : ERRTYPE_SILENT; $rss_logs_inserted = false; if (defined('IN_CONTROL_PANEL')) { echo "<ol>"; } $html_parser = new vB_WysiwygHtmlParser($vbulletin); // process the remaining list of items to be inserted foreach ($items as $uniquehash => $item) { $feed =& $feeds["{$item['rssfeedid']}"]; $feed['rssoptions'] = intval($feed['rssoptions']); if ($feed['rssoptions'] & $vbulletin->bf_misc_feedoptions['html2bbcode']) { $body_template = nl2br($feed['bodytemplate']); } else { $body_template = $feed['bodytemplate']; } $pagetext = $feed['xml']->parse_template($body_template, $item); if ($feed['rssoptions'] & $vbulletin->bf_misc_feedoptions['html2bbcode']) { $pagetext = $html_parser->parse_wysiwyg_html_to_bbcode($pagetext, false, true); // disable for announcements $feed['rssoptions'] = $feed['rssoptions'] & ~$vbulletin->bf_misc_feedoptions['allowhtml']; }
if ($permissions['pmquota'] < 1) { print_no_permission(); } else { if (!$vbulletin->userinfo['receivepm']) { eval(standard_error(fetch_error('pm_turnedoff'))); } } if (fetch_privatemessage_throttle_reached($vbulletin->userinfo['userid'])) { eval(standard_error(fetch_error('pm_throttle_reached', $vbulletin->userinfo['permissions']['pmthrottlequantity'], $vbulletin->options['pmthrottleperiod']))); } // include useful functions require_once DIR . '/includes/functions_newpost.php'; // unwysiwygify the incoming data if ($vbulletin->GPC['wysiwyg']) { require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $vbulletin->GPC['message'] = $html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $vbulletin->options['privallowhtml']); } // parse URLs in message text if ($vbulletin->options['privallowbbcode'] and $vbulletin->GPC['parseurl']) { $vbulletin->GPC['message'] = convert_url_to_bbcode($vbulletin->GPC['message']); } $pm['message'] =& $vbulletin->GPC['message']; $pm['title'] =& $vbulletin->GPC['title']; $pm['parseurl'] =& $vbulletin->GPC['parseurl']; $pm['savecopy'] =& $vbulletin->GPC['savecopy']; $pm['signature'] =& $vbulletin->GPC['signature']; $pm['disablesmilies'] =& $vbulletin->GPC['disablesmilies']; $pm['sendanyway'] =& $vbulletin->GPC['sendanyway']; $pm['receipt'] =& $vbulletin->GPC['receipt']; $pm['recipients'] =& $vbulletin->GPC['recipients'];
/** * Parses HTML produced by a WYSIWYG editor and produces the corresponding BBCode formatted text * * @param string HTML text * * @return string BBCode text */ public function parseWysiwygHtmlToBbcode($text) { $wysiwyg = new vB_WysiwygHtmlParser(); return $wysiwyg->parseWysiwygHtmlToBbcode($text); }
define('FEED_SAVE_ERROR', true); $_REQUEST['do'] = 'edit'; } else { $feeddata->save(); define('CP_REDIRECT', 'rssposter.php'); print_stop_message('saved_rssfeed_x_successfully', $feeddata->fetch_field('title')); } } else { $_POST['do'] = 'preview'; } } // ############################################################################# if ($_POST['do'] == 'preview') { require_once DIR . '/includes/class_rss_poster.php'; require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $xml = new vB_RSS_Poster($vbulletin); $xml->fetch_xml($vbulletin->GPC['url']); if (empty($xml->xml_string)) { print_stop_message('unable_to_open_url'); } else { if ($xml->parse_xml() === false) { print_stop_message('xml_error_x_at_line_y', $xml->feedtype == 'unknown' ? 'Unknown Feed Type' : $xml->xml_object->error_string(), $xml->xml_object->error_line()); } } require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $output = ''; $count = 0; foreach ($xml->fetch_items() as $item) { if ($vbulletin->GPC['maxresults'] and $count++ >= $vbulletin->GPC['maxresults']) {
// ############################### start post thread ############################### if ($_POST['do'] == 'postthread') { // Variables reused in templates $posthash = $vbulletin->input->clean_gpc('p', 'posthash', TYPE_NOHTML); $poststarttime = $vbulletin->input->clean_gpc('p', 'poststarttime', TYPE_UINT); $vbulletin->input->clean_array_gpc('p', array('wysiwyg' => TYPE_BOOL, 'preview' => TYPE_STR, 'message' => TYPE_STR, 'subject' => TYPE_STR, 'iconid' => TYPE_UINT, 'rating' => TYPE_UINT, 'prefixid' => TYPE_NOHTML, 'taglist' => TYPE_NOHTML, 'postpoll' => TYPE_BOOL, 'polloptions' => TYPE_UINT, 'signature' => TYPE_BOOL, 'disablesmilies' => TYPE_BOOL, 'parseurl' => TYPE_BOOL, 'folderid' => TYPE_UINT, 'subscribe' => TYPE_BOOL, 'emailupdate' => TYPE_UINT, 'stickunstick' => TYPE_BOOL, 'openclose' => TYPE_BOOL, 'htmlstate' => TYPE_STR, 'username' => TYPE_STR, 'loggedinuser' => TYPE_INT, 'humanverify' => TYPE_ARRAY, 'podcasturl' => TYPE_STR, 'podcastsize' => TYPE_UINT, 'podcastexplicit' => TYPE_BOOL, 'podcastkeywords' => TYPE_STR, 'podcastsubtitle' => TYPE_STR, 'podcastauthor' => TYPE_STR)); if ($vbulletin->GPC['loggedinuser'] != 0 and $vbulletin->userinfo['userid'] == 0) { // User was logged in when writing post but isn't now. If we got this // far, guest posts are allowed, but they didn't enter a username so // they'll get an error. Force them to log back in. standard_error(fetch_error('session_timed_out_login'), '', false, 'STANDARD_ERROR_LOGIN'); } ($hook = vBulletinHook::fetch_hook('newthread_post_start')) ? eval($hook) : false; if ($vbulletin->GPC['wysiwyg']) { require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $newpost['message'] = $html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $foruminfo['allowhtml']); } else { $newpost['message'] =& $vbulletin->GPC['message']; } if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostpoll'])) { $vbulletin->GPC['postpoll'] = false; } $newpost['title'] =& $vbulletin->GPC['subject']; $newpost['iconid'] =& $vbulletin->GPC['iconid']; require_once DIR . '/includes/functions_prefix.php'; if (can_use_prefix($vbulletin->GPC['prefixid'])) { $newpost['prefixid'] =& $vbulletin->GPC['prefixid']; } if ($show['tag_option']) { $newpost['taglist'] =& $vbulletin->GPC['taglist'];
break; case 'signature': $dohtml = $vbulletin->userinfo['permissions']['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['allowhtml']; break; default: if (intval($vbulletin->GPC['parsetype'])) { $parsetype = intval($vbulletin->GPC['parsetype']); $foruminfo = fetch_foruminfo($parsetype); $dohtml = $foruminfo['allowhtml']; break; } else { $dohtml = false; } //($hook = vBulletinHook::fetch_hook('editor_switch_wysiwyg_to_standard')) ? eval($hook) : false; } $html_parser = new vB_WysiwygHtmlParser($vbulletin); $vbulletin->GPC['pagetext'] = process_replacement_vars($html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['pagetext'], $dohtml)); } // If we have a posthash then only save it if it is valid // this can be used to grab attachments that are attached to this draft if ($vbulletin->GPC['posthash'] and $vbulletin->GPC['posthash'] != md5($vbulletin->GPC['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt'])) { $vbulletin->GPC['posthash'] = ''; } $db->query_write("\n\t\tREPLACE INTO " . TABLE_PREFIX . "autosave\n\t\t\t(contenttypeid, contentid, parentcontentid, userid, pagetext, title, posthash, dateline)\n\t\tVALUES\n\t\t(\n\t\t\t'" . $db->escape_string($vbulletin->GPC['contenttypeid']) . "',\n\t\t\t{$vbulletin->GPC['contentid']},\n\t\t\t{$vbulletin->GPC['parentcontentid']},\n\t\t\t{$vbulletin->userinfo['userid']},\n\t\t\t'" . $db->escape_string($vbulletin->GPC['pagetext']) . "',\n\t\t\t'" . $db->escape_string($vbulletin->GPC['title']) . "',\n\t\t\t'" . $db->escape_string($vbulletin->GPC['posthash']) . "',\n\t\t\t" . TIMENOW . "\n\t\t)\n\t"); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('ok', 1); $xml->print_xml(); } ($hook = vBulletinHook::fetch_hook('ajax_complete')) ? eval($hook) : false; /*======================================================================*\ || ####################################################################
if ($_POST['do'] == 'updatesignature') { $vbulletin->input->clean_array_gpc('p', array('wysiwyg' => TYPE_BOOL, 'message' => TYPE_STR, 'preview' => TYPE_STR, 'deletesigpic' => TYPE_BOOL, 'sigpicurl' => TYPE_STR)); if (!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature'])) { eval(standard_error(fetch_error('nosignaturepermission'))); } if ($permissions['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['cansigpic']) { $vbulletin->input->clean_gpc('f', 'upload', TYPE_FILE); } require_once DIR . '/includes/class_bbcode.php'; require_once DIR . '/includes/class_sigparser.php'; require_once DIR . '/includes/functions_misc.php'; $errors = array(); // DO WYSIWYG processing to get to BB code. if ($vbulletin->GPC['wysiwyg']) { require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $signature = $html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $permissions['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['allowhtml']); } else { $signature = $vbulletin->GPC['message']; } ($hook = vBulletinHook::fetch_hook('profile_updatesignature_start')) ? eval($hook) : false; // handle image uploads if ($vbulletin->GPC['deletesigpic']) { if (preg_match('#\\[sigpic\\](.*)\\[/sigpic\\]#siU', $signature)) { $errors[] = fetch_error('sigpic_in_use'); } else { $userpic =& datamanager_init('Userpic_Sigpic', $vbulletin, ERRTYPE_STANDARD, 'userpic'); $userpic->condition = "userid = " . $vbulletin->userinfo['userid']; $userpic->delete(); } $redirectsig = true;
/** * Returns process pagetext * * @param string Text to process * * @return array text and bbcode, bbcode is used by VB_API */ function process_toolbar_text($text, $toolbartype, $ishtml, $forumid, $allowsmilie, $parsesmilie) { global $vbulletin; $result = array('message' => '', 'bbcode' => ''); if (!$text) { return $result; } if ($toolbartype == 2 or defined('VB_API') and VB_API === true) { // got to parse the message to be displayed from bbcode into HTML if ($text !== '') { require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $result['message'] = $html_parser->parse_wysiwyg_html($text, $ishtml, $forumid, ($allowsmilie and $parsesmilie) ? 1 : 0); } else { $result['message'] = ''; } $result['message'] = htmlspecialchars_uni($result['message']); if (defined('VB_API') and VB_API === true) { if ($ishtml) { require_once DIR . '/includes/class_wysiwygparser.php'; $html_parser = new vB_WysiwygHtmlParser($vbulletin); $result['bbcode'] = $html_parser->parse_wysiwyg_html_to_bbcode($result['message']); } else { $result['bbcode'] = $result['message']; } } } else { $result['message'] = $text; } return $result; }