/** * Verifies the number of images in the post text. Call it from pre_save() after pagetext/allowsmilie has been set * * @return bool Whether the post passes the image count check */ function verify_image_count($pagetext = 'pagetext', $allowsmilie = 'allowsmilie', $parsetype = 'nonforum', $table = null) { global $vbulletin; $_allowsmilie =& $this->fetch_field($allowsmilie, $table); $_pagetext =& $this->fetch_field($pagetext, $table); if ($_allowsmilie !== null and $_pagetext !== null) { // check max images require_once DIR . '/includes/functions_misc.php'; require_once DIR . '/includes/class_bbcode_alt.php'; $bbcode_parser = new vB_BbCodeParser_ImgCheck($this->registry, fetch_tag_list()); $bbcode_parser->set_parse_userinfo($vbulletin->userinfo); if ($this->registry->options['maximages'] and !$this->info['is_automated']) { $imagecount = fetch_character_count($bbcode_parser->parse($_pagetext, $parsetype, $_allowsmilie, true), '<img'); if ($imagecount > $this->registry->options['maximages']) { $this->error('toomanyimages', $imagecount, $this->registry->options['maximages']); return false; } } } return true; }
if ($question == '' or $optioncount < 2) { eval(standard_error(fetch_error('noquestionoption'))); } if (TIMENOW + $vbulletin->GPC['timeout'] * 86400 >= 2147483647) { // maximuim size of a 32 bit integer eval(standard_error(fetch_error('maxpolltimeout'))); } // check max images if ($vbulletin->options['maximages']) { $counter = 0; while ($counter++ < $polloptions) { // 0..Pollnum-1 we want, as arrays start with 0 $maximgtest .= $vbulletin->GPC['options']["{$counter}"]; } $img_parser = new vB_BbCodeParser_ImgCheck($vbulletin, fetch_tag_list()); $parsedmessage = $img_parser->parse($maximgtest . $question, $foruminfo['forumid'], $foruminfo['allowsmilies'], true); require_once DIR . '/includes/functions_misc.php'; $imagecount = fetch_character_count($parsedmessage, '<img'); if ($imagecount > $vbulletin->options['maximages']) { eval(standard_error(fetch_error('toomanyimages', $imagecount, $vbulletin->options['maximages']))); } } $question = fetch_censored_text($question); $counter = 0; while ($counter++ < $polloptions) { // 0..Pollnum-1 we want, as arrays start with 0 $vbulletin->GPC['options']["{$counter}"] = fetch_censored_text($vbulletin->GPC['options']["{$counter}"]); } // Add the poll $poll =& datamanager_init('Poll', $vbulletin, ERRTYPE_STANDARD); $counter = 0;
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']) { // Parsing the signature into BB code. require_once(DIR . '/includes/class_bbcode_alt.php'); $bbcode_parser = new vB_BbCodeParser_ImgCheck($vbulletin, fetch_tag_list()); $bbcode_parser->set_parse_userinfo($userinfo_sigpic, $vbulletin->userinfo['permissions']); $parsedsig = $bbcode_parser->parse($signature, 'signature'); $imagecount = fetch_character_count($parsedsig, '<img'); // Count the images if ($imagecount > $vbulletin->userinfo['permissions']['sigmaximages']) { $vbulletin->GPC['preview'] = true; $errors[] = fetch_error('toomanyimages', $imagecount, $vbulletin->userinfo['permissions']['sigmaximages']); } } // Count the raw characters in the signature if ($vbulletin->userinfo['permissions']['sigmaxrawchars'] AND vbstrlen($signature) > $vbulletin->userinfo['permissions']['sigmaxrawchars']) { $vbulletin->GPC['preview'] = true;
$optioncount++; } else { $poll->set_option('', $counter - 1); } } if ($vbulletin->GPC['pollquestion'] == '' or $optioncount < 2) { eval(standard_error(fetch_error('noquestionoption'))); } if (TIMENOW + $vbulletin->GPC['timeout'] * 86400 >= 2147483647) { // maximuim size of a 32 bit integer eval(standard_error(fetch_error('maxpolltimeout'))); } // check max images|videos if ($vbulletin->options['maximages'] or $vbulletin->options['maxvideos']) { $img_parser = new vB_BbCodeParser_ImgCheck($vbulletin, fetch_tag_list()); $parsedmessage = $img_parser->parse($maximgtest . $vbulletin->GPC['pollquestion'], $foruminfo['forumid'], $foruminfo['allowsmilies'], true); require_once DIR . '/includes/functions_misc.php'; if ($vbulletin->options['maximages']) { $imagecount = fetch_character_count($parsedmessage, '<img'); if ($imagecount > $vbulletin->options['maximages']) { eval(standard_error(fetch_error('toomanyimages', $imagecount, $vbulletin->options['maximages']))); } } if ($vbulletin->options['maxvideos']) { $videocount = fetch_character_count($parsedmessage, '<video />'); if ($videocount > $vbulletin->options['maxvideos']) { eval(standard_error(fetch_error('toomanyvideos', $videocount, $vbulletin->options['maxvideos']))); } } } $poll->set('question', $vbulletin->GPC['pollquestion']);