-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 20, 2010 at 02:14 PM
-- Server version: 5.1.40
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `bmcforu_transfer`
--

-- --------------------------------------------------------

--
-- Table structure for table `plugin`
--

CREATE TABLE IF NOT EXISTS `plugin` (
  `pluginid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(250) NOT NULL DEFAULT '',
  `hookname` varchar(250) NOT NULL DEFAULT '',
  `phpcode` text,
  `product` varchar(25) NOT NULL DEFAULT '',
  `devkey` varchar(25) NOT NULL DEFAULT '',
  `active` smallint(6) NOT NULL DEFAULT '0',
  `executionorder` smallint(6) NOT NULL DEFAULT '5',
  PRIMARY KEY (`pluginid`),
  KEY `active` (`active`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=785 ;

--
-- Dumping data for table `plugin`
--

INSERT INTO `plugin` (`pluginid`, `title`, `hookname`, `phpcode`, `product`, `devkey`, `active`, `executionorder`) VALUES
(651, 'Top Posters (2)', 'cache_templates', '\r\n$globaltemplates[] = ''Top_Posters'';\r\n$globaltemplates[] = ''Top_Posters_bit'';\r\n$globaltemplates[] = ''Top_Posters_row'';\r\n$globaltemplates[] = ''Top_Posters_blank'';\r\n', 'paulm_20051029', '', 1, 5),
(652, 'Top Posters (3)', 'misc_start', '\r\nif ($_REQUEST[''do''] == ''topposters'')\r\n{\r\n	// Navigation Bar\r\n	$navbits = array();\r\n	$navbits[] = $vbphrase[''top_posters_list''];\r\n	$navbits = construct_navbits($navbits);\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n\r\n	$now = TIMENOW; \r\n	$groups = $vbulletin->options[''tpgrps'']; \r\n	$start[1] = $now - (86400 * $vbulletin->options[''tpc1'']);\r\n	$start[2] = $now - (86400 * $vbulletin->options[''tpc2'']);\r\n	$start[3] = $now - (86400 * $vbulletin->options[''tpc3'']);\r\n	$tnow = date(''YmdHis'',$now - intval($vbulletin->options[''hourdiff''])); \r\n	$start[4] = $now - (substr($tnow,6,2)*86400 + substr($tnow,8,2)*3600 + substr($tnow,10,2)*60 + substr($tnow,12,2)) + 86400; \r\n\r\n	$where = ''1'';\r\n	if ($vbulletin->options[''tpgrpx''] == 1)\r\n	{\r\n		$where = "usergroupid IN ($groups)";\r\n	}\r\n	if ($vbulletin->options[''tpgrpx''] == 2)\r\n	{\r\n		$where = "usergroupid NOT IN ($groups)";\r\n	}\r\n\r\n	// Get Data\r\n	for ($col = 1; $col <= 5; $col++) \r\n	{\r\n		if ($col==5 AND $vbulletin->options[''tpall'']) \r\n		{\r\n			$data[$col] = $vbulletin->db->query_read_slave("\r\n			SELECT posts AS postcount, userid, username\r\n			FROM " . TABLE_PREFIX . "user AS user\r\n			WHERE $where  \r\n			ORDER BY postcount DESC LIMIT ".$vbulletin->options[''tplines'']\r\n			);\r\n		}\r\n		if (($col<4) OR ($col==4 AND $vbulletin->options[''tpmonth''])) \r\n		{\r\n			$data[$col] = $vbulletin->db->query_read_slave("\r\n			SELECT COUNT(post.dateline) AS postcount, post.userid, user.username\r\n			FROM " . TABLE_PREFIX . "post AS post\r\n			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\r\n			WHERE dateline > $start[$col] AND $where \r\n			GROUP BY userid ORDER BY postcount DESC LIMIT ".$vbulletin->options[''tplines'']\r\n			);\r\n		}\r\n	}\r\n\r\n	$cspan = 3;\r\n	if ($vbulletin->options[''tpall'']) $cspan += 1;\r\n	if ($vbulletin->options[''tpmonth'']) $cspan += 1;\r\n	$cwidth = intval(100 / $cspan);\r\n\r\n	// Build Rows\r\n	unset($topposters);\r\n	for ($row = 0; $row < $vbulletin->options[''tplines'']; $row++) \r\n	{\r\n		$toppostrow = "";\r\n		for ($col = 1; $col <= $cspan; $col++) \r\n		{\r\n			$fetchcol = $col;\r\n			if (!$vbulletin->options[''tpmonth''] AND $fetchcol == 4) $fetchcol= 5;\r\n			$posts[$col] = $vbulletin->db->fetch_array($data[$fetchcol]);\r\n			if ($posts[$col][''postcount''])\r\n			{\r\n				$posts[''userid''] = $posts[$col][''userid''];\r\n				$posts[''username''] = $posts[$col][''username''];\r\n				$posts[''postcount''] = vb_number_format($posts[$col][''postcount'']);\r\n				eval(''$toppostrow .= "'' . fetch_template(''Top_Posters_bit'') . ''";'');\r\n			}\r\n			else\r\n			{\r\n				eval(''$toppostrow .= "'' . fetch_template(''Top_Posters_blank'') . ''";'');\r\n			}			\r\n		}\r\n		eval(''$topposters .= "'' . fetch_template(''Top_Posters_row'') . ''";'');\r\n	}\r\n\r\n	$pid = ''paulm_20051029'';\r\n	if ($pemdata[''set''] == true)\r\n	{\r\n		$data_tpx =& $pemdata[$pid];\r\n	}\r\n	else\r\n	{\r\n		if ($pemdata = unserialize($vbulletin->options[''pemdata'']))\r\n		{\r\n			$pemdata[''set''] = true;\r\n			$data_tpx =& $pemdata[$pid];\r\n		}\r\n		else\r\n		{\r\n			$data_tpx = array(''version'' => ''N/A'');\r\n		}\r\n 	}\r\n\r\n	// Output page\r\n	eval(''print_output("'' . fetch_template(''Top_Posters'') . ''");'');\r\n}\r\n', 'paulm_20051029', '', 1, 5),
(28, 'Member List Online Status', 'memberlist_bit', 'require_once(DIR . ''/includes/functions_bigthree.php'');\r\n	fetch_online_status($userinfo, true);', 'vbulletin', '', 1, 5),
(29, 'Member List Cache Online Status Template', 'cache_templates', '$globaltemplates[] = ''postbit_onlinestatus'';', 'vbulletin', '', 1, 5),
(271, 'Moderator Stats', 'misc_start', 'if ($_REQUEST[''do''] == ''moderator_stats'')\r\n{\r\n\r\n// Get Settings\r\n    $settings_permissions_usergroups = $vbulletin->options[''abe1_mms_permissions_usergroups''];\r\n    $settings_permissions_users = $vbulletin->options[''abe1_mms_permissions_users''];\r\n    $settings_show_usergroups = $vbulletin->options[''abe1_mms_usergroups_show''];\r\n    $settings_mod_actions = TIMENOW - (60*60*24*$vbulletin->options[''abe1_mms_time_mod_actions'']);\r\n    $time_mod_actions = $vbulletin->options[''abe1_mms_time_mod_actions''];\r\n    $settings_post = TIMENOW - (60*60*24*$vbulletin->options[''abe1_mms_time_post'']);\r\n    $time_post = $vbulletin->options[''abe1_mms_time_post''];\r\n    $settings_post_forum = TIMENOW - (60*60*24*$vbulletin->options[''abe1_mms_time_post_forum'']);\r\n    $time_post_forum = $vbulletin->options[''abe1_mms_time_post_forum''];\r\n    $settings_thread = TIMENOW - (60*60*24*$vbulletin->options[''abe1_mms_time_thread'']);\r\n    $time_thread = $vbulletin->options[''abe1_mms_time_thread''];\r\n    $settings_thread_forum = TIMENOW - (60*60*24*$vbulletin->options[''abe1_mms_time_thread_forum'']);\r\n    $time_thread_forum = $vbulletin->options[''abe1_mms_time_thread_forum''];\r\n\r\n// functions\r\n    function has_permissions_in_forum($forumid, $userid)\r\n    {\r\n        global $vbulletin;\r\n        static $moderator_permission_cache;\r\n\r\n        if (!($moderator_permission_cache))\r\n        {\r\n            $moderatorslist = $vbulletin->db->query("SELECT * FROM ".TABLE_PREFIX."moderator");\r\n            while ($moderatorlist =  $vbulletin->db->fetch_array($moderatorslist))\r\n            {\r\n                $moderator_permission_cache[$moderatorlist[''forumid'']][$moderatorlist[''userid'']] = $moderatorlist[''permissions''];\r\n            }\r\n        }\r\n\r\n        if (isset($moderator_permission_cache[$forumid][$userid]))\r\n        {\r\n            return true;\r\n        }\r\n\r\n        $parentlist = fetch_forum_parent_list($forumid);\r\n        if (empty($parentlist))\r\n        {\r\n            $parentlist = ''-1,'' . intval($forumid);\r\n        }\r\n        $forumbits = split (",",$parentlist);\r\n        foreach ($forumbits as $forumbit)\r\n        {\r\n            if (isset($moderator_permission_cache[$forumbit][$userid]))\r\n            {\r\n                return true;\r\n            }\r\n        }\r\n    return false;\r\n    }\r\n\r\n    function check_permissions($permissions_usergroups, $permissions_users, $userid, $usergroupid, $membergroupids = '''')\r\n    {\r\n        if (!empty($permissions_usergroups))\r\n        {\r\n            $check1 = explode("|",$permissions_usergroups);\r\n            $check3 = explode(",",$membergroupids);\r\n\r\n            foreach ($check1 AS $check2)\r\n            {\r\n                if ($check2 == $usergroupid)\r\n                {\r\n                    return true;\r\n                }\r\n\r\n                foreach ($check3 AS $check4)\r\n                {\r\n                    if ($check2 == $check4)\r\n                    {\r\n                    return true;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        if (!empty($permissions_users))\r\n        {\r\n            $check1 = explode("|",$permissions_users);\r\n\r\n            foreach ($check1 AS $check2)\r\n            {\r\n                if ($check2 == $userid)\r\n                {\r\n                    return true;\r\n                }\r\n            }\r\n        }\r\n        return false;\r\n    }\r\n\r\n    function sort_mods($a, $b)\r\n    {\r\n        global $sortfield, $reversesort;\r\n\r\n        if ($a[$sortfield] == $b[$sortfield])\r\n        {\r\n            return strnatcasecmp($a[username], $b[username]);\r\n        }\r\n\r\n        if ($a[$sortfield] > $b[$sortfield])\r\n        {\r\n            return $reversesort ? -1 : 1;\r\n        }\r\n        return $reversesort ? 1 : -1;\r\n    }\r\n\r\n    function get_additional_usergroups($settings_show_usergroups)\r\n    {\r\n        $c = '''';\r\n        if (!empty($settings_show_usergroups))\r\n        {\r\n            $a = explode("|",$settings_show_usergroups);\r\n\r\n            foreach ($a AS $b)\r\n            {\r\n                $c .= "OR user.usergroupid = $b OR FIND_IN_SET($b, user.membergroupids) ";\r\n            }\r\n        }\r\n        return $c;\r\n    }\r\n\r\n// Check permissions\r\n    if (!(check_permissions($settings_permissions_usergroups, $settings_permissions_users, $vbulletin->userinfo[userid], $vbulletin->userinfo[usergroupid], $vbulletin->userinfo[membergroupids])))\r\n    {\r\n        print_no_permission();\r\n    }\r\n\r\n// Start Main\r\n\r\n    $additional_usergroups = get_additional_usergroups($settings_show_usergroups);\r\n\r\n    $moderators = $db->query_read("\r\n        SELECT user.*\r\n        FROM " . TABLE_PREFIX . "user AS user\r\n        LEFT JOIN ".TABLE_PREFIX."moderator AS moderator USING (userid)\r\n        WHERE moderator.userid = user.userid $additional_usergroups\r\n        ORDER BY user.username\r\n    ");\r\n\r\n    while ($moderator = $db->fetch_array($moderators))\r\n    {\r\n        $moderatorids[] = $moderator[''userid''];\r\n        $moderatorinfo[$moderator[''userid'']][''forums''] = array();\r\n        $moderatorinfo[$moderator[''userid'']][''modlog''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''post''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''postforum''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''thread''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''threadforum''] = 0;\r\n\r\n        $moderatorinfo[$moderator[''userid'']][''1''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''2''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''3''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''4''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''5''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''6''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''7''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''8''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''9''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''10''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''11''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''12''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''13''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''14''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''15''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''16''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''17''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''18''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''19''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''20''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''21''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''22''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''23''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''24''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''25''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''26''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''27''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''28''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''29''] = 0;\r\n        $moderatorinfo[$moderator[''userid'']][''30''] = 0;\r\n\r\n        $moderatorinfo[$moderator[''userid'']][''userid''] = $moderator[''userid''];\r\n        $moderatorinfo[$moderator[''userid'']][''usergroupid''] = $moderator[''usergroupid''];  \r\n        $moderatorinfo[$moderator[''userid'']][''username_normal''] = $moderator[''username''];\r\n        $moderatorinfo[$moderator[''userid'']][''username''] = strtolower($moderator[username]);\r\n        $moderatorinfo[$moderator[''userid'']][''lastactivity''] = $moderator[''lastactivity''];\r\n        $moderatorinfo[$moderator[''userid'']][''musername''] = fetch_musername($moderator, iif($moderator[''displaygroupid''], ''displaygroupid'', ''usergroupid''));\r\n    }\r\n\r\n// check if there is a list of mods\r\n    if (empty($moderatorids))\r\n    {\r\n        eval(standard_error(fetch_error(''moderator_stats_no_mods'')));\r\n    }\r\n\r\n// remove duplicate userids\r\n    $moderatorids = array_unique($moderatorids);\r\n\r\n// load moderator forum information\r\n    $moderatorforums = $db->query_read("SELECT * FROM ".TABLE_PREFIX."forum AS forum");\r\n\r\n    while ($moderatorforum = $db->fetch_array($moderatorforums))\r\n    {\r\n        foreach ($moderatorids AS $userid)\r\n        {\r\n            if (has_permissions_in_forum($moderatorforum[''forumid''], $userid))\r\n            {\r\n                $moderatorinfo[$userid][''forums''][] = $moderatorforum[''forumid''];\r\n            }\r\n        }\r\n    }\r\n\r\n// get logs\r\n    $moderatorlogs = $db->query_read("\r\n        SELECT moderatorlogid, userid, type\r\n        FROM ".TABLE_PREFIX."moderatorlog AS moderatorlog\r\n        WHERE dateline >= $settings_mod_actions AND userid IN (".implode(",",$moderatorids).")\r\n        GROUP BY moderatorlogid\r\n    ");\r\n\r\n    while ($moderatorlog = $db->fetch_array($moderatorlogs))\r\n    {\r\n        $moderatorinfo[$moderatorlog[''userid'']][''modlog'']++;\r\n        $moderatorinfo[$moderatorlog[''userid'']][$moderatorlog[type]]++;\r\n    }\r\n\r\n// load posts information\r\n    $gobackintime = min($settings_post, $settings_post_forum);\r\n\r\n    $moderatorposts = $db->query_read("\r\n        SELECT post.userid, forumid, post.dateline\r\n        FROM ".TABLE_PREFIX."post AS post\r\n        INNER JOIN ".TABLE_PREFIX."thread AS thread\r\n        ON post.threadid = thread.threadid\r\n        WHERE post.userid IN (".implode(",",$moderatorids).")\r\n        AND post.dateline >= $gobackintime\r\n    ");\r\n\r\n    while ($moderatorpost = $db->fetch_array($moderatorposts))\r\n    {\r\n        if ($moderatorpost[''dateline''] >= $settings_post)\r\n        {\r\n            $moderatorinfo[$moderatorpost[''userid'']][''post'']++;\r\n        }\r\n\r\n        if (in_array($moderatorpost[''forumid''], $moderatorinfo[$moderatorpost[''userid'']][''forums'']) && $moderatorpost[''dateline''] >= $settings_post_forum)\r\n        {\r\n            $moderatorinfo[$moderatorpost[''userid'']][''postforum'']++;\r\n        }\r\n    }\r\n\r\n// load thread information\r\n    $gobackintime = min($settings_thread, $settings_thread_forum);\r\n\r\n    $moderatorthreads = $db->query_read("\r\n        SELECT postuserid, dateline, forumid\r\n        FROM ".TABLE_PREFIX."thread\r\n        WHERE postuserid IN (".implode(",",$moderatorids).")\r\n        AND dateline >= $gobackintime\r\n    ");\r\n\r\n    while ($moderatorthread = $db->fetch_array($moderatorthreads))\r\n    {\r\n        if ($moderatorthread[''dateline''] >= $settings_thread)\r\n        {\r\n            $moderatorinfo[$moderatorthread[''postuserid'']][''thread'']++;\r\n        }\r\n\r\n        if (in_array($moderatorthread[''forumid''], $moderatorinfo[$moderatorthread[''postuserid'']][''forums'']) && $moderatorthread[''dateline''] >= $settings_thread_forum)\r\n        {\r\n            $moderatorinfo[$moderatorthread[''postuserid'']][''threadforum'']++;\r\n        }\r\n    }\r\n\r\n//sort\r\n    $vbulletin->input->clean_array_gpc(''r'',  array(\r\n        ''sortfield'' => TYPE_STR,\r\n        ''sortorder'' => TYPE_STR\r\n    ));\r\n\r\n    $sortfield = $vbulletin->GPC[''sortfield''];\r\n\r\n    if (!($sortfield))\r\n    {\r\n        $sortfield = ''username'';\r\n    }\r\n\r\n    switch ($vbulletin->GPC[''sortorder''])\r\n    {\r\n        case ''asc'':\r\n            $sortorder = ''asc'';\r\n            $oppositesort = ''desc'';\r\n            $reversesort = false;\r\n            break;\r\n        case ''desc'':\r\n            $sortorder = ''desc'';\r\n            $oppositesort = ''asc'';\r\n            $reversesort = true;\r\n            break;\r\n        default:\r\n            $sortorder = ''asc'';\r\n            $oppositesort = ''desc'';\r\n            $reversesort = false;\r\n            break;\r\n    }\r\n\r\n    eval(''$sortarrow['' . $sortfield . ''] = "'' . fetch_template(''moderator_stats_sortarrow'') . ''";'');\r\n\r\n    usort($moderatorinfo, "sort_mods");\r\n\r\n// print bit\r\n    foreach ($moderatorinfo AS $moderatorstats)\r\n    {\r\n        //make date\r\n        $moderatorstats[''lastactivity''] = vbdate($vbulletin->options[''dateformat''], $moderatorstats[''lastactivity''], 1);\r\n        //make average\r\n        $moderatorstats[''modlog_average''] = round($moderatorstats[''modlog'']/$time_mod_actions, 2);\r\n\r\n        exec_switch_bg();\r\n        eval(''$moderator_stats_bits .= "'' . fetch_template(''moderator_stats_bit'') . ''";'');\r\n        eval(''$moderator_stats_drop_down .= "'' . fetch_template(''moderator_stats_drop_down'') . ''";'');\r\n    }\r\n\r\n\r\n    $navbits = construct_navbits(array('''' => $vbphrase[''moderator_stats'']));\r\n    eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n\r\n    eval(''print_output("'' . fetch_template(''MODERATOR_STATS'') . ''");'');\r\n}', 'abe1_moderator_stats', '', 1, 5),
(270, 'Moderator Stats', 'cache_templates', 'if ($_REQUEST[''do''] == ''moderator_stats'')\r\n{\r\n	$globaltemplates = array_merge($globaltemplates, array(\r\n		''MODERATOR_STATS'',\r\n		''moderator_stats_bit'',\r\n		''moderator_stats_drop_down'',\r\n		''moderator_stats_sortarrow''\r\n	));\r\n}', 'abe1_moderator_stats', '', 1, 5),
(645, 'Separate Sticky and Normal Threads', 'forumdisplay_start', 'if ($vbulletin->options[''gosterx3''])\r\n{\r\n   $vbphrase[''sticky_thread_prefix''] = '''';\r\n}', 'Separate', '', 1, 5),
(646, 'Mini Navbar: Cache template', 'cache_templates', '$globaltemplates[] = ''navbar_mini'';', 'navbarmini', '', 1, 5),
(647, 'Mini Navbar: Show Navbar', 'showthread_start', 'if ($vbulletin->options[''mnbon''])\r\n{\r\n	$search_text = ''<!-- / controls below postbits -->'';\r\n	$vbulletin->templatecache[''SHOWTHREAD''] = str_replace($search_text,$search_text . fetch_template(''navbar_mini''),$vbulletin->templatecache[''SHOWTHREAD'']);\r\n}', 'navbarmini', '', 1, 5),
(644, 'Separate Sticky and Normal Threads', 'forumdisplay_complete', 'if ($vbulletin->options[''gosterx1''])\r\n{\r\nswitch ($vbulletin->options[''gosterx2''])\r\n	{\r\n	case 0:	\r\n	eval(''$bolx2 = "'' . fetch_template(''FORUMDISPLAY_Separate2'') . ''";''); \r\n	$threadbits_sticky = $threadbits_sticky."$bolx2";\r\n	break;\r\n	case 1:	\r\n	eval(''$bolx1 = "'' . fetch_template(''FORUMDISPLAY_Separate_top'') . ''";''); \r\n	eval(''$bolx2 = "'' . fetch_template(''FORUMDISPLAY_Separate'') . ''";''); \r\n	$threadbits_sticky = "$bolx1".$threadbits_sticky."$bolx2";\r\n	break;\r\n  }\r\n}', 'Separate', '', 1, 5),
(643, 'Cache Separate Sticky Template', 'cache_templates', '$globaltemplates  = array_merge($globaltemplates, array(''FORUMDISPLAY_Separate''));\r\n\r\n$globaltemplates  = array_merge($globaltemplates, array(''FORUMDISPLAY_Separate2''));\r\n					$globaltemplates  = array_merge($globaltemplates, array(''FORUMDISPLAY_Separate_top''));', 'Separate', '', 1, 5),
(272, 'Moderator Stats', 'template_groups', '$only[''moderator_stats''] = $vbphrase[''moderator_stats''];', 'abe1_moderator_stats', '', 1, 5),
(361, 'Simple Random Banner', 'parse_templates', '$random_number = rand(1, 5);\r\n\r\n$random_banner[1] = ''<a href="http://www.link1.com/"><img src="path/to/banner1.gif" alt="" border="0" /></a>'';\r\n$random_banner[2] = ''<a href="http://www.link2.com/"><img src="path/to/banner2.gif" alt="" border="0" /></a>'';\r\n$random_banner[3] = ''<a href="http://www.link3.com/"><img src="path/to/banner3.gif" alt="" border="0" /></a>'';\r\n$random_banner[4] = ''<a href="http://www.link4.com/"><img src="path/to/banner4.gif" alt="" border="0" /></a>'';\r\n$random_banner[5] = ''<a href="http://www.link5.com/"><img src="path/to/banner5.gif" alt="" border="0" /></a>'';', 'vbulletin', '', 1, 5),
(650, 'Top Posters (1)', 'parse_templates', '\r\nif ($vbulletin->options[''tplink''] > 0)\r\n{\r\n    if ($vbulletin->options[''tplink''] == 1)\r\n    {\r\n        $search_text = ''$vbphrase[faq]</a></td>'';\r\n        $add_text = ''<td class=\\"vbmenu_control\\"><a href=\\"''.$vbulletin->options[''tppath''].''misc.php?$session[sessionurl]do=topposters\\">$vbphrase[top_posters_list]</a></td>'';\r\n    }\r\n    elseif ($vbulletin->options[''tplink''] == 2)\r\n    {\r\n        $search_text = ''$vbphrase[open_buddy_list]</a></td></tr>'';\r\n        $add_text = ''<tr><td class=\\"vbmenu_option\\"><a href=\\"''.$vbulletin->options[''tppath''].''misc.php?$session[sessionurl]do=topposters\\">$vbphrase[top_posters_list]</a></td></tr>'';\r\n    }\r\n    $vbulletin->templatecache[''navbar''] = str_replace($search_text,$search_text.$add_text,$vbulletin->templatecache[''navbar'']);\r\n}\r\n', 'paulm_20051029', '', 1, 5),
(530, 'e-steki Referrer Statistics WOL part 1', 'online_location_process', 'if ($filename == ''referrers.php'')\r\n{\r\n        $userinfo[''activity''] = ''referrers'';\r\n}', 'michelle_referrers', '', 1, 5),
(531, 'e-steki Referrer Statistics WOL part 2', 'online_location_unknown', 'if ($userinfo[''activity''] == ''referrers'')\r\n{\r\n        $userinfo[''action''] = $vbphrase[refstats_online];\r\n        $userinfo[''where''] = ''<a href="./referrers.php?'' . $vbulletin->session->vars[''sessionurl''] . ''">Referrer Statistics</a>''; \r\n        $handled = true;\r\n}', 'michelle_referrers', '', 1, 5),
(167, 'Users Registered Today', 'forumhome_complete', '// Users Registered Today\r\n\r\n    $now = TIMENOW - intval($vboptions[''hourdif'']); \r\n    $cutoff = mktime(0, 0, 0, date(''m'', $now), date(''d'', $now), date(''Y'', $now)); \r\n    //$cutoff = $now - 86400 ;  // Uncomment this line if you want a rolling 24 hours display \r\n    $todaysregs = $db->query("SELECT userid, joindate, options, username, opentag, closetag, posts \r\n    FROM " . TABLE_PREFIX . "user as user \r\n    LEFT JOIN " . TABLE_PREFIX . "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid) \r\n    WHERE joindate > " .$cutoff. " ORDER BY username" ); \r\n\r\n    unset ($regtoday); \r\n    $numregtoday = 0; \r\n    while ($today = $db->fetch_array($todaysregs)) \r\n    { \r\n		$today[visible] = 1 ;\r\n		$numregtoday += 1;\r\n                //$useroptions = convert_bits_to_array($today[''options''] , $vbulletin->bf_misc_useroptions);\r\n		if ($today[options] & $vbulletin->bf_misc_useroptions[''invisible'']) \r\n		{\r\n			$today[visible] = 0 ;\r\n			if (($permissions[''genericpermissions''] & $vbulletin->bf_ugp_genericpermissions[''canseehidden'']) OR $today[''userid''] == $vbulletin->userinfo[''userid'']) \r\n            { \r\n                $today[visible] = 2 ; \r\n            } \r\n        } \r\n        if ($today[visible]) \r\n        { \r\n            $regtoday .= "<a href=''member.php?u=$today[userid]''>"; \r\n            if ($today[visible] == 2) \r\n            { \r\n                $regtoday .= "$today[opentag]$today[username] ($today[posts] $vbphrase[posts])$today[closetag]</a>*, "; \r\n            } \r\n            else \r\n            { \r\n                $regtoday .= "$today[opentag]$today[username] ($today[posts] $vbphrase[posts])$today[closetag]</a>, "; \r\n            } \r\n        } \r\n    } \r\n    if ($regtoday) \r\n    { \r\n        $regtoday = substr($regtoday, 0, strlen($regtoday)-2); \r\n    } \r\n	else\r\n	{\r\n		$regtoday = "There have been no new registrations today.";\r\n	}\r\n\r\n// End Users Registered Today', '', '', 1, 5),
(357, 'postbit_display_start', 'postbit_display_start', '$jointime = (TIMENOW - $this->post[''joindate'']) / 86400;', 'vbulletin', '', 1, 5),
(653, 'Top Posters (4)', 'online_location_process', '\r\nif ($filename == ''misc.php'' AND $values[''do''] == ''topposters'')\r\n{\r\n	$userinfo[''activity''] = ''topposters'';\r\n}\r\n', 'paulm_20051029', '', 1, 5),
(654, 'Top Posters (5)', 'online_location_unknown', '\r\nif ($userinfo[''activity''] == ''topposters'')\r\n{\r\n	$handled = true;\r\n	$userinfo[''action''] = $vbphrase[''in_topposters''];\r\n	$userinfo[''where''] = ''<a href="''.$vbulletin->options[''bburl''].''misc.php?do=topposters''.''">''.$vbphrase[''top_posters_list''].''</a>'';\r\n}\r\n', 'paulm_20051029', '', 1, 5),
(349, 'custom page wrapper 0.1', 'forumhome_start', 'if ( !empty($_REQUEST[''page'']) ) {\r\n	$template_prefix = ''page_'';\r\n	$page_template = $template_prefix . $_REQUEST[''page''];\r\n	$page_title = ucwords( str_replace("_", " ", $_REQUEST[''page'']) );\r\n	$navbits = array();\r\n	$navbits[] = $page_title;\r\n	$navbits = construct_navbits($navbits);\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''$HTML = "'' . fetch_template($page_template) . ''";'');\r\n	if (empty($HTML)) {\r\n		eval(standard_error("No such page."));\r\n	}\r\n	eval(''print_output("'' . fetch_template(''GENERIC_SHELL'') . ''");'');\r\n}', '', '', 1, 5),
(688, 'vB.Sponsors: Admin Enable Sponsorship', 'forumadmin_edit_form', 'print_table_header($vbphrase[''sponsor_title'']);\r\nprint_yes_no_row($vbphrase[''sponsor_enabled''], ''forum[sponsor_enabled]'', $forum[''sponsor_enabled'']);\r\nprint_yes_no_row($vbphrase[''sponsor_banner_enabled''], ''forum[sponsor_banner_enabled]'', $forum[''sponsor_banner_enabled'']);\r\nprint_input_row($vbphrase[''sponsor_name''], ''forum[sponsor_name]'', $forum[''sponsor_name'']);\r\nprint_input_row($vbphrase[''sponsor_banner''], ''forum[sponsor_banner]'', $forum[''sponsor_banner'']);\r\nprint_input_row($vbphrase[''sponsor_banner_big''], ''forum[sponsor_banner_big]'', $forum[''sponsor_banner_big'']);\r\nprint_input_row($vbphrase[''sponsor_url''], ''forum[sponsor_url]'', $forum[''sponsor_url'']);\r\nprint_textarea_row($vbphrase[''sponsor_adsense''], ''forum[sponsor_adsense]'', $forum[''sponsor_adsense''], 6, 45);\r\nconstruct_hidden_code(''forum[sponsor_date_updated]'', time());', 'vbsponsors', '', 1, 5),
(689, 'vB.Sponsors: Forum Data', 'forumdata_start', '$this->validfields[''sponsor_enabled''] = array(TYPE_UINT, REQ_NO);\r\n$this->validfields[''sponsor_name''] = array(TYPE_STR, REQ_NO);\r\n$this->validfields[''sponsor_banner_enabled''] = array(TYPE_UINT, REQ_NO);\r\n$this->validfields[''sponsor_banner''] = array(TYPE_STR, REQ_NO);\r\n$this->validfields[''sponsor_banner_big''] = array(TYPE_STR, REQ_NO);\r\n$this->validfields[''sponsor_adsense''] = array(TYPE_STR, REQ_NO);\r\n$this->validfields[''sponsor_url''] = array(TYPE_STR, REQ_NO);\r\n$this->validfields[''sponsor_date_updated''] = array(TYPE_STR, REQ_NO);', 'vbsponsors', '', 1, 5),
(690, 'vB.Sponsors: Footer', 'global_start', '\r\n               $vbphrase[powered_by_vbulletin] = $vbphrase[powered_by_vbulletin] . $vbphrase[sponsor_powered_by];\r\n               ', 'vbsponsors', '', 1, 5),
(697, 'Automatic Profile Commenter (Register Complete)', 'register_addmember_complete', '// enable to run this script\r\nif ($vbulletin->options[''comment_enable''])\r\n{\r\n	// Globalize the variable\r\n	global $vbulletin;\r\n	$userid = intval($userid);\r\n\r\n	$find = array("{username}","{sitename}","{siteurl}");\r\n	$replace = array($vbulletin->GPC[''username''],$vbulletin->options[''bbtitle''],$vbulletin->options[''bburl'']);	\r\n	$vbulletin->options[''comment_message''] = str_replace($find, $replace, $vbulletin->options[''comment_message'']);\r\n	\r\n	if ($userid)\r\n	{\r\n		$vbulletin->db->query_write("\r\n			INSERT INTO " . TABLE_PREFIX . "visitormessage\r\n				(userid, postuserid, dateline, state, pagetext, allowsmilie)\r\n			VALUES\r\n				(''" . $userid . "'',''" . $vbulletin->options[''comment_posterid''] . "'',''" . TIMENOW . "'',''visible'',''" . $db->escape_string($vbulletin->options[''comment_message'']) . "'',''1'')\r\n		");\r\n		\r\n		list($unread) = $vbulletin->db->query_first("\r\n			SELECT COUNT(*) AS unread\r\n			FROM " . TABLE_PREFIX . "visitormessage\r\n			WHERE userid = $userid AND state = ''visible'' AND messageread = 0", DBARRAY_NUM\r\n		);\r\n		\r\n		$vbulletin->db->query_write("\r\n			UPDATE " . TABLE_PREFIX . "user\r\n			SET vmunreadcount = " . intval($unread) . "\r\n			WHERE userid = $userid\r\n		");\r\n	}\r\n}', 'auto_comment_whitemike', '', 1, 5),
(525, 'Display Thread Readers (1)', 'cache_templates', '\r\nif ($vbulletin->options[''whohasread''])\r\n{\r\n	$groups = explode('','',$vbulletin->options[''whohasreadgrps'']); \r\n	if (is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) \r\n	{\r\n		$show[''whohasread''] = true;\r\n 	}\r\n	else \r\n	{\r\n		$show[''whohasread'']= false;\r\n	}\r\n	$wripgrps = explode('','',$vbulletin->options[''whoreadipgrps'']); \r\n	if (is_member_of($vbulletin->userinfo,$wripgrps)) \r\n	{\r\n		$show[''whohasreadip''] = true;\r\n	}\r\n	else \r\n	{\r\n		$show[''whohasreadip''] = false;\r\n	}\r\n}\r\nelse\r\n{\r\n	$show[''whohasread'']= false;\r\n}\r\nif ($vbulletin->options[''whoreadauthor''] OR $show[''whohasread''])\r\n{\r\n	$globaltemplates[] = ''Display_Readers'';\r\n	$globaltemplates[] = ''Display_Readers_User'';\r\n	$globaltemplates[] = ''Display_Readers_View'';\r\n	$globaltemplates[] = ''Display_Readers_View_Bit'';\r\n}\r\n', 'paulm_20050716', '', 1, 5),
(526, 'Display Thread Readers (2)', 'cron_script_cleanup', '\r\nif (intval($vbulletin->options[''whoreadcleanup'']))\r\n{\r\n	$xdate = TIMENOW - (intval($vbulletin->options[''whoreadcleanup'']) * 86400);\r\n	$vbulletin->db->query_write("DELETE FROM ".TABLE_PREFIX."whoread WHERE dateline < $xdate");\r\n}\r\n', 'paulm_20050716', '', 1, 5),
(527, 'Display Thread Readers (3)', 'misc_start', '\r\nif ($_REQUEST[''do''] == ''resetwr'')\r\n{\r\n	// Check valid thread //\r\n	$threadinfo = verify_id(''thread'',$threadid,true,true);\r\n\r\n	$groups = explode('','',$vbulletin->options[''whoreadswitchgrps'']); \r\n	if ((is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) AND $vbulletin->options[''whoreadswitch'']) \r\n	{\r\n		// Reset Users WR Date //\r\n		$wrdates = unserialize($threadinfo[''wrdate'']);\r\n		$wrdates[$vbulletin->userinfo[''userid'']] = TIMENOW;\r\n		$threadinfo[''wrdate''] = serialize($wrdates);\r\n		$db->query_write("\r\n			UPDATE ".TABLE_PREFIX."thread\r\n			SET wrdate = ''$threadinfo[wrdate]''\r\n			WHERE threadid = $threadinfo[threadid]\r\n		");\r\n		exec_header_redirect(''showthread.php?p=''.$threadinfo[lastpostid].''#''.$threadinfo[lastpostid], true);\r\n	}\r\n	else \r\n	{\r\n		print_no_permission();\r\n	}\r\n}\r\n\r\nif ($_REQUEST[''do''] == ''clearwr'')\r\n{\r\n	// Check valid thread //\r\n	$threadinfo = verify_id(''thread'',$threadid,true,true);\r\n\r\n	$groups = explode('','',$vbulletin->options[''whoreadswitchgrps'']); \r\n	if ((is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) AND $vbulletin->options[''whoreadswitch'']) \r\n	{\r\n		// Clear Users WR Date //\r\n		$wrdates = unserialize($threadinfo[''wrdate'']);\r\n		unset($wrdates[$vbulletin->userinfo[''userid'']]);\r\n		$threadinfo[''wrdate''] = serialize($wrdates);\r\n		$db->query_write("\r\n			UPDATE ".TABLE_PREFIX."thread\r\n			SET wrdate = ''$threadinfo[wrdate]''\r\n			WHERE threadid = $threadinfo[threadid]\r\n		");\r\n		exec_header_redirect(''showthread.php?p=''.$threadinfo[lastpostid].''#''.$threadinfo[lastpostid], true);\r\n	}\r\n	else \r\n	{\r\n		print_no_permission();\r\n	}\r\n}\r\n\r\nif ($_REQUEST[''do''] == ''viewwr'')\r\n{\r\n	// Check valid thread //\r\n	$threadinfo = verify_id(''thread'',$threadid,true,true);\r\n\r\n	$groups = explode('','',$vbulletin->options[''whohasreadgrps'']); \r\n	if (!((is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) OR \r\n	(($threadinfo[''postuserid''] == $vbulletin->userinfo[''userid'']) AND $vbulletin->options[''whoreadauthor'']))) \r\n	{\r\n		print_no_permission();\r\n 	}\r\n\r\n	// Check if allowed ip view //\r\n	$show[''wrip''] = false;\r\n	$groups = explode('','',$vbulletin->options[''whoreadipgrps'']); \r\n	if (is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) \r\n	{\r\n		$show[''wrip''] = true;\r\n	}\r\n\r\n	// Set Cutoff Date //\r\n	$cutoff = 0;\r\n	if ($vbulletin->options[''whohasreadlimit'']) \r\n	{\r\n		$cutoff = TIMENOW - 86400 * $vbulletin->options[''whohasreadlimit''];\r\n	}\r\n\r\n	// Get Readers Data //\r\n	$readlist = $vbulletin->db->query_read_slave("\r\n		SELECT user.userid, user.options, user.username, \r\n		user.usergroupid, user.displaygroupid, whoread.dateline, whoread.ipaddress\r\n		FROM ".TABLE_PREFIX."whoread as whoread\r\n		LEFT JOIN ".TABLE_PREFIX."user as user USING (userid)\r\n		WHERE whoread.threadid = $threadinfo[threadid]\r\n		AND whoread.dateline > $cutoff ORDER BY whoread.dateline DESC\r\n	"); \r\n\r\n	// Build Data Rows //\r\n	$trtotal = 0;\r\n	$show[''poster''] = true;\r\n	$threadreader[''userid''] = 0;\r\n	$threadreader[''username''] = "<strong>$vbphrase[member]</strong>";\r\n	$threadreader[''wrdate''] = "<strong>$vbphrase[last_viewed]</strong>";\r\n	$threadreader[''ipaddress''] = "<strong>$vbphrase[ip_address]</strong>";\r\n	eval(''$wrdata = "'' . fetch_template(''Display_Readers_View_Bit'') . ''";'');\r\n\r\n	$threadinfo[''lastposttime''] = $threadinfo[''lastpost''];\r\n	while ($threadreader = $vbulletin->db->fetch_array($readlist))\r\n	{\r\n		if (intval($threadreader[''userid'']))\r\n		{\r\n			$trtotal += 1;\r\n			$threadreader[''markinv''] = '''';\r\n			$threadreader[''visible''] = true ;\r\n			if ($threadreader[''options''] & $vbulletin->bf_misc_useroptions[''invisible'']) \r\n			{\r\n				$threadreader[''visible''] = false ;\r\n				if (($vbulletin->userinfo[''permissions''][''genericpermissions''] \r\n				& $vbulletin->bf_ugp_genericpermissions[''canseehidden'']) \r\n				OR $threadreader[''userid''] == $vbulletin->userinfo[''userid''])\r\n				{\r\n					$threadreader[''markinv''] = ''*'';\r\n					$threadreader[''visible''] = true ;\r\n				}\r\n			}\r\n			if ($threadreader[''visible'']) \r\n			{\r\n				if ($threadreader[''dateline''] <= $threadinfo[''lastposttime''])\r\n				{\r\n					$show[''lastpost''] = true;\r\n					$threadinfo[''lastposttime''] = 0;\r\n					$threadreader[''lpdate''] = $vbphrase[''thread_lastpost''].'' : '';\r\n					$threadreader[''lpdate''] .= vbdate($vbulletin->options[''dateformat''],$threadinfo[''lastpost'']).'', '';\r\n					$threadreader[''lpdate''] .= vbdate($vbulletin->options[''timeformat''],$threadinfo[''lastpost'']);\r\n				}\r\n				else\r\n				{\r\n					$show[''lastpost''] = false;\r\n				}\r\n				$threadreader[''wrdate''] = $vbphrase[''thread_readtime''].'' '';\r\n				$threadreader[''wrdate''] .= vbdate($vbulletin->options[''dateformat''],$threadreader[''dateline'']).'', '';\r\n				$threadreader[''wrdate''] .= vbdate($vbulletin->options[''timeformat''],$threadreader[''dateline'']);\r\n				$group = ($threadreader[''displaygroupid''] > 0 ? $threadreader[''displaygroupid''] : $threadreader[''usergroupid'']);\r\n				$threadreader[''opentag''] = $vbulletin->usergroupcache[$group][''opentag''];\r\n				$threadreader[''closetag''] = $vbulletin->usergroupcache[$group][''closetag''];\r\n				eval(''$wrdata.= "'' . fetch_template(''Display_Readers_View_Bit'') . ''";'');\r\n			}\r\n		}\r\n	}\r\n\r\n	if ($threadinfo[''lastposttime'']) \r\n	{\r\n		$show[''poster''] = false;\r\n		$show[''lastpost''] = true;\r\n		$threadreader[''lpdate''] = $vbphrase[''thread_lastpost''].'' : '';\r\n		$threadreader[''lpdate''] .= vbdate($vbulletin->options[''dateformat''],$threadinfo[''lastpost'']).'', '';\r\n		$threadreader[''lpdate''] .= vbdate($vbulletin->options[''timeformat''],$threadinfo[''lastpost'']);\r\n		eval(''$wrdata.= "'' . fetch_template(''Display_Readers_View_Bit'') . ''";'');\r\n	}\r\n\r\n	$pid = ''paulm_20050716'';\r\n	if ($pemdata[''set''] == true)\r\n	{\r\n		$data_wrt =& $pemdata[$pid];\r\n	}\r\n	else\r\n	{\r\n		if ($pemdata = unserialize($vbulletin->options[''pemdata'']))\r\n		{\r\n			$pemdata[''set''] = true;\r\n			$data_wrt =& $pemdata[$pid];\r\n		}\r\n		else\r\n		{\r\n			$data_wrt = array(''version'' => ''N/A'');\r\n		}\r\n 	}\r\n\r\n	// Output Main Display Page\r\n	eval(''print_output("'' . fetch_template(''Display_Readers_View'') . ''");'');\r\n}\r\n\r\nif ($_REQUEST[''do''] == ''wrviews'')\r\n{\r\n	$userid = intval($_REQUEST[''userid'']);\r\n\r\n	$groups = explode('','',$vbulletin->options[''whohasreadgrps'']); \r\n	if (!((is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) OR \r\n	(($threadinfo[''postuserid''] == $vbulletin->userinfo[''userid'']) AND $vbulletin->options[''whoreadauthor'']))) \r\n	{\r\n		print_no_permission();\r\n 	}\r\n\r\n	// Check if allowed ip view //\r\n	$show[''wrip''] = false;\r\n	$groups = explode('','',$vbulletin->options[''whoreadipgrps'']); \r\n	if (is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) \r\n	{\r\n		$show[''wrip''] = true;\r\n	}\r\n\r\n	// Set Cutoff Date //\r\n	$cutoff = 0;\r\n	if ($vbulletin->options[''whohasreadlimit'']) \r\n	{\r\n		$cutoff = TIMENOW - 86400 * $vbulletin->options[''whohasreadlimit''];\r\n	}\r\n\r\n	// Get Readers Data //\r\n	$readlist = $vbulletin->db->query_first_slave("\r\n		SELECT * FROM ".TABLE_PREFIX."user as user WHERE userid = $userid\r\n	"); \r\n\r\n	$username = $readlist[''username''];\r\n\r\n	//Get allowed forums\r\n	$xforum_ids = array_keys($vbulletin->forumcache);\r\n	foreach ($xforum_ids AS $key => $xforum_id)\r\n	{\r\n		$xfperms = & $vbulletin->userinfo[''forumpermissions'']["$xforum_id"];\r\n		if (!($xfperms & $vbulletin->bf_ugp_forumpermissions[''canview'']))\r\n		{\r\n			unset($xforum_ids["$key"]);\r\n		}\r\n	}\r\n	$xforum_list = implode('', '', $xforum_ids);\r\n\r\n	$readlist = $vbulletin->db->query_read_slave("\r\n		SELECT whoread.*, thread.title\r\n		FROM ".TABLE_PREFIX."whoread as whoread\r\n		INNER JOIN ".TABLE_PREFIX."thread as thread USING (threadid)\r\n		WHERE whoread.userid = $userid\r\n		AND thread.forumid IN(0$xforum_list) \r\n		AND whoread.dateline > $cutoff ORDER BY whoread.dateline DESC\r\n	"); \r\n\r\n	// Build Data Rows //\r\n	$trtotal = 0;\r\n	$show[''poster''] = true;\r\n	$threadreader[''userid''] = 0;\r\n	$threadreader[''username''] = "<strong>$vbphrase[thread]</strong>";\r\n	$threadreader[''wrdate''] = "<strong>$vbphrase[last_viewed]</strong>";\r\n	$threadreader[''ipaddress''] = "<strong>$vbphrase[ip_address]</strong>";\r\n	eval(''$wrdata = "'' . fetch_template(''Display_Readers_View_Bit'') . ''";'');\r\n\r\n	$threadinfo[''lastposttime''] = $threadinfo[''lastpost''];\r\n	while ($threadreader = $vbulletin->db->fetch_array($readlist))\r\n	{\r\n		if (strlen($threadreader[''title'']) > 64) \r\n		{\r\n			$threadreader[''title''] = substr($threadreader[''title''],0,60).'' ...'';\r\n		}\r\n		$threadreader[''userid''] = -1;\r\n		$threadreader[''username''] = $threadreader[''title''] ;\r\n		$threadreader[''wrdate''] = $vbphrase[''thread_readtime''].'' '';\r\n		$threadreader[''wrdate''] .= vbdate($vbulletin->options[''dateformat''],$threadreader[''dateline'']).'', '';\r\n		$threadreader[''wrdate''] .= vbdate($vbulletin->options[''timeformat''],$threadreader[''dateline'']);\r\n		eval(''$wrdata.= "'' . fetch_template(''Display_Readers_View_Bit'') . ''";'');\r\n	}\r\n\r\n	$pid = ''paulm_20050716'';\r\n	if ($pemdata[''set''] == true)\r\n	{\r\n		$data_wrt =& $pemdata[$pid];\r\n	}\r\n	else\r\n	{\r\n		if ($pemdata = unserialize($vbulletin->options[''pemdata'']))\r\n		{\r\n			$pemdata[''set''] = true;\r\n			$data_wrt =& $pemdata[$pid];\r\n		}\r\n		else\r\n		{\r\n			$data_wrt = array(''version'' => ''N/A'');\r\n		}\r\n 	}\r\n\r\n	$vbphrase[''who_viewed''] = construct_phrase($vbphrase[''who_viewed_threads''],$username);\r\n\r\n	// Output Main Display Page\r\n	eval(''print_output("'' . fetch_template(''Display_Readers_View'') . ''");'');\r\n}\r\n', 'paulm_20050716', '', 1, 5),
(528, 'Display Thread Readers (4)', 'showthread_complete', '\r\nif ($vbulletin->userinfo[''userid''])\r\n{\r\n	$time = TIMENOW;\r\n	$ipaddress = IPADDRESS;\r\n	$threadid = $threadinfo[threadid];\r\n	$userid = $vbulletin->userinfo[''userid''];\r\n	$db->query_write("\r\n		REPLACE INTO " . TABLE_PREFIX . "whoread\r\n		(userid, threadid, dateline, ipaddress)\r\n		VALUES\r\n		($userid, $threadid, $time, ''$ipaddress'')\r\n	");\r\n}\r\n', 'paulm_20050716', '', 1, 5),
(529, 'Display Thread Readers (5)', 'showthread_getinfo', '\r\nif (($threadinfo[''postuserid''] == $vbulletin->userinfo[''userid'']) \r\n	AND $vbulletin->options[''whoreadauthor''])\r\n{\r\n	$show[''whohasread''] = true;\r\n}\r\n\r\nif ($show[''whohasread''])\r\n{\r\n	$cutoff = 0;\r\n	$show[''resetwr''] = false;\r\n	if ($vbulletin->options[''whoreadswitch'']) \r\n	{\r\n		$groups = explode('','',$vbulletin->options[''whoreadswitchgrps'']); \r\n		if (is_member_of($vbulletin->userinfo,$groups) OR $groups[0] == 0) \r\n		{\r\n			$show[''resetwr''] = true;\r\n		}\r\n	}\r\n	if ($vbulletin->options[''whohasreadlimit'']) \r\n	{\r\n		$cutoff = TIMENOW - 86400 * $vbulletin->options[''whohasreadlimit''];\r\n	}\r\n	if ($show[''resetwr'']) \r\n	{\r\n		$show[''clearwr''] = true;\r\n		$wrdates = unserialize($threadinfo[''wrdate'']);\r\n		$cutoff = intval($wrdates[$vbulletin->userinfo[''userid'']]);\r\n		if ($cutoff == 0) \r\n		{\r\n			$show[''clearwr''] = false;\r\n			$cutoff = $threadinfo[''dateline''];\r\n		}\r\n	}\r\n	$readlist = $vbulletin->db->query_read_slave("\r\n		SELECT user.userid, user.options, user.username, \r\n		user.usergroupid, user.displaygroupid, whoread.dateline, whoread.ipaddress\r\n		FROM ".TABLE_PREFIX."whoread as whoread\r\n		LEFT JOIN ".TABLE_PREFIX."user as user USING (userid)\r\n		WHERE whoread.threadid = $threadinfo[threadid]\r\n		AND whoread.dateline > $cutoff ORDER BY username\r\n	"); \r\n\r\n	$trtotal = 0;\r\n	unset ($treaders);\r\n	while ($threadreader = $vbulletin->db->fetch_array($readlist))\r\n	{\r\n		if (intval($threadreader[''userid'']))\r\n		{\r\n			$trtotal += 1;\r\n			$threadreader[''markinv''] = '''';\r\n			$threadreader[visible] = true ;\r\n			if ($threadreader[''options''] & $vbulletin->bf_misc_useroptions[''invisible'']) \r\n			{\r\n				$threadreader[''visible''] = false ;\r\n				if (($vbulletin->userinfo[''permissions''][''genericpermissions''] \r\n				& $vbulletin->bf_ugp_genericpermissions[''canseehidden'']) \r\n				OR $threadreader[''userid''] == $vbulletin->userinfo[''userid''])\r\n				{\r\n					$threadreader[''markinv''] = ''*'';\r\n					$threadreader[''visible''] = true ;\r\n				}\r\n			}\r\n			if ($threadreader[''visible'']) \r\n			{\r\n				$threadreader[''wrdate''] = $vbphrase[''thread_readtime''].'' '';\r\n				$threadreader[''wrdate''] .= vbdate($vbulletin->options[''dateformat''], $threadreader[''dateline'']).'', '';\r\n				$threadreader[''wrdate''] .= vbdate($vbulletin->options[''timeformat''], $threadreader[''dateline'']);\r\n				$group = ($threadreader[''displaygroupid''] > 0 ? $threadreader[''displaygroupid''] : $threadreader[''usergroupid'']);\r\n				$threadreader[''opentag''] = $vbulletin->usergroupcache[$group][''opentag''];\r\n				$threadreader[''closetag''] = $vbulletin->usergroupcache[$group][''closetag''];\r\n				eval(''$treaders .= "'' . fetch_template(''Display_Readers_User'') . ''" . ", ";'');\r\n			}\r\n		}\r\n	}\r\n	\r\n	if ($treaders)\r\n	{\r\n		$treaders = substr($treaders, 0, -2);\r\n	}\r\n	else\r\n	{\r\n		$treaders = $vbphrase[''no_names''];\r\n	}\r\n	\r\n	$trdays = intval($vbulletin->options[''whohasreadlimit'']);\r\n	\r\n	if ($trdays == 0) \r\n	{\r\n		$trtitle = construct_phrase($vbphrase[''read_this_thread''],$trtotal);\r\n	}\r\n	else\r\n	{\r\n		$trtitle = construct_phrase($vbphrase[''read_this_thread_days''],$trdays ,$trtotal);\r\n	}\r\n\r\n	if ($show[''clearwr'']) \r\n	{\r\n		$threadreader[''wrdate''] = vbdate($vbulletin->options[''dateformat''], $cutoff).'', '';\r\n		$threadreader[''wrdate''] .= vbdate($vbulletin->options[''timeformat''], $cutoff) ;\r\n		$trtitle = construct_phrase($vbphrase[''read_this_thread_since''],$threadreader[''wrdate'']);\r\n	}\r\n\r\n	$pid = ''paulm_20050716'';\r\n	if ($pemdata[''set''] == true)\r\n	{\r\n		$data_wrt =& $pemdata[$pid];\r\n	}\r\n	else\r\n	{\r\n		if ($pemdata = unserialize($vbulletin->options[''pemdata'']))\r\n		{\r\n			$pemdata[''set''] = true;\r\n			$data_wrt =& $pemdata[$pid];\r\n		}\r\n		else\r\n		{\r\n			$data_wrt = array(''version'' => ''N/A'');\r\n		}\r\n 	}\r\n\r\n	if ($vbulletin->options[''enable_wrt''])\r\n	{\r\n		$vbulletin->templatecache[''SHOWTHREAD''] = str_replace($vbulletin->options[''text_wrt''],\r\n		$vbulletin->options[''text_wrt''].$vbulletin->templatecache[''Display_Readers''],$vbulletin->templatecache[''SHOWTHREAD'']);\r\n	}\r\n}\r\n', 'paulm_20050716', '', 1, 5),
(702, 'Members who have Registered (2)', 'global_start', '\r\nif ($show[''wjt''])\r\n{\r\n	if ($vbulletin->options[''wjt24''])\r\n	{\r\n		$cutoff = TIMENOW - 86400;\r\n		$whodesc = $vbphrase[''wjt_registered_today_24''];\r\n	}\r\n	else\r\n	{\r\n		$whodesc = $vbphrase[''wjt_registered_today''];\r\n		$tnow = date(''YmdHis'',TIMENOW - intval($vbulletin->options[''hourdiff''])); \r\n		$cutoff = TIMENOW - (substr($tnow,8,2)*3600 + substr($tnow,10,2)*60 + substr($tnow,12,2)); \r\n	}\r\n\r\n	unset ($regtoday);\r\n	$show[''loggedinusers''] = true;\r\n\r\n	if ($vbulletin->options[''wjtnames'']) \r\n	{\r\n		$todaysreg = $vbulletin->db->query_read_slave("\r\n			SELECT * FROM ".TABLE_PREFIX."user # FORCE INDEX (joindate)\r\n			WHERE joindate > $cutoff ORDER BY username\r\n		"); \r\n		\r\n		$totalreg = 0;\r\n		while ($rtoday = $vbulletin->db->fetch_array($todaysreg))\r\n		{\r\n			$totalreg += 1;\r\n			$rtoday[''markinv''] = '''';\r\n			$rtoday[visible] = true ;\r\n			if ($rtoday[''options''] & $vbulletin->bf_misc_useroptions[''invisible'']) \r\n			{\r\n				$rtoday[''visible''] = false ;\r\n				if (($vbulletin->userinfo[''permissions''][''genericpermissions''] \r\n				& $vbulletin->bf_ugp_genericpermissions[''canseehidden'']) \r\n				OR $rtoday[''userid''] == $vbulletin->userinfo[''userid''])\r\n				{\r\n					$rtoday[''markinv''] = ''*'';\r\n					$rtoday[''visible''] = true ;\r\n				}\r\n			}\r\n			if ($rtoday[''visible'']) \r\n			{\r\n				$ugroup = ($rtoday[''displaygroupid''] > 0 ? $rtoday[''displaygroupid''] : $rtoday[''usergroupid'']);\r\n				$rtoday[''opentag''] = $vbulletin->usergroupcache[$ugroup][''opentag''];\r\n				$rtoday[''closetag''] = $vbulletin->usergroupcache[$ugroup][''closetag''];\r\n				$rtoday[''wrdate''] = vbdate($vbulletin->options[''timeformat''], $rtoday[''lastactivity'']);\r\n				eval(''$regtoday .= "'' . fetch_template(''Display_Registered_User'') . ''" . ", ";'');\r\n			}\r\n		}\r\n\r\n		if ($regtoday)\r\n		{\r\n			$regtoday = substr($regtoday, 0, -2);\r\n		}\r\n		else\r\n		{\r\n			$regtoday = $vbphrase[''wjt_no_visitors''];\r\n		}\r\n	}\r\n	else \r\n	{\r\n		$todaysreg = $vbulletin->db->query_first_slave("\r\n			SELECT COUNT(lastactivity) AS regtoday \r\n			FROM ".TABLE_PREFIX."user # FORCE INDEX (joindate)\r\n			WHERE joindate > $cutoff\r\n		"); \r\n		\r\n		$totalreg = $todaysreg[''regtoday''];\r\n		$regtoday = $vbphrase[''wjt_no_visitors_display''];\r\n	}\r\n\r\n	if ($vbulletin->options[''wjtcol''])\r\n	{\r\n		$vbcollapse[''collapseimg_forumhome_todayreg''] = ''_collapsed'';\r\n		$vbcollapse[''collapseobj_forumhome_todayreg''] = ''display:none;'';\r\n	}\r\n\r\n	$ftotalreg = vb_number_format($totalreg);\r\n	$whoregtitle = construct_phrase($whodesc,$ftotalreg);\r\n\r\n	$pid = ''paulm_wjt_37'';\r\n	if ($pemdata37[''set''] == true)\r\n	{\r\n		$data_wjt =& $pemdata37[$pid];\r\n	}\r\n	else\r\n	{\r\n		if ($pemdata37 = unserialize($vbulletin->options[''pemdata37'']))\r\n		{\r\n			$pemdata37[''set''] = true;\r\n			$data_wjt =& $pemdata37[$pid];\r\n		}\r\n		else\r\n		{\r\n			$data_wjt = array(''version'' => ''N/A'');\r\n		}\r\n 	}\r\n\r\n	if ($vbulletin->options[''enable_wjt''])\r\n	{\r\n		$vbulletin->templatecache["{$vbulletin->options[''template_wjt'']}"] = str_replace($vbulletin->options[''text_wjt''],\r\n		$vbulletin->options[''text_wjt''].$vbulletin->templatecache[''Display_Registered''],$vbulletin->templatecache["{$vbulletin->options[''template_wjt'']}"]);\r\n	}\r\n\r\n	if ($vbulletin->options[''wjtmost''])\r\n	{ \r\n		if (empty($vbulletin->maxloggedin))\r\n		{\r\n			if (method_exists($vbulletin->datastore,''do_fetch''))\r\n			{ // Datastore extension exists, use it\r\n				$vbulletin->datastore->do_fetch(''maxloggedin'',$errors);\r\n				if ($errors[0])\r\n				{ // Fetch failed, use original datastore\r\n					$vbulletin->datastore->do_db_fetch("''maxloggedin''");\r\n				}\r\n			}\r\n			else\r\n			{ // No extension, use original datastore\r\n				$vbulletin->datastore->do_db_fetch("''maxloggedin''");\r\n			}\r\n		}\r\n\r\n		if ($totalreg > intval($vbulletin->maxloggedin[''maxregistered'']))\r\n		{\r\n			$vbulletin->maxloggedin[''maxregistereddate''] = TIMENOW;\r\n			$vbulletin->maxloggedin[''maxregistered''] = $totalreg;\r\n			build_datastore(''maxloggedin'', serialize($vbulletin->maxloggedin),1);\r\n\r\n		}\r\n\r\n		if ($vbulletin->options[''wjtmost''])\r\n		{\r\n			if ($vbulletin->options[''wjt24''])\r\n			{\r\n				$description = $vbphrase[''wjt_members_24''];\r\n			}\r\n			else\r\n			{\r\n				$description = $vbphrase[''wjt_members_day''];\r\n			}\r\n\r\n			$members = construct_phrase( \r\n					$description, vb_number_format($vbulletin->maxloggedin[''maxregistered'']),\r\n					vbdate( $vbulletin->options[''dateformat''], $vbulletin->maxloggedin[''maxregistereddate''], true ),\r\n					vbdate( $vbulletin->options[''timeformat''], $vbulletin->maxloggedin[''maxregistereddate''] ) \r\n			);\r\n\r\n			$regtoday = $members . "<br />" . $regtoday;\r\n		}\r\n	}\r\n}\r\n', 'paulm_wjt_37', '', 1, 20);
INSERT INTO `plugin` (`pluginid`, `title`, `hookname`, `phpcode`, `product`, `devkey`, `active`, `executionorder`) VALUES
(701, 'Members who have Registered (1)', 'cache_templates', '\r\nif ($vbulletin->options[''wjt''] AND ($vbulletin->options[''wjtall''] OR THIS_SCRIPT == ''index''))\r\n{\r\n	if ($vbulletin->options[''wjtgrpz''])\r\n	{\r\n		$show[''wjt''] = false;\r\n		$ugroups = explode('','',$vbulletin->options[''wjtgrps'']); \r\n		if ($vbulletin->options[''wjtgrpz''] == 1)\r\n		{\r\n			if (is_member_of($vbulletin->userinfo,$ugroups)) \r\n			{\r\n				$show[''wjt''] = true;\r\n			}\r\n		}\r\n		if ($vbulletin->options[''wjtgrpz''] == 2)\r\n		{\r\n			if (!is_member_of($vbulletin->userinfo,$ugroups)) \r\n			{\r\n				$show[''wjt'']= true;\r\n			}\r\n		}\r\n	}\r\n	else\r\n	{\r\n		$show[''wjt'']= true;\r\n	}\r\n}\r\nelse\r\n{\r\n	$show[''wjt'']= false;\r\n}\r\n\r\nif ($show[''wjt'']) \r\n{\r\n	$globaltemplates[] = ''Display_Registered'' ;\r\n	$globaltemplates[] = ''Display_Registered_User'' ;\r\n}\r\n', 'paulm_wjt_37', '', 1, 5),
(699, 'Add Friend After Validation', 'register_activate_process', 'if(!empty($vbulletin->options[''kk_auto_friends'']))\r\n{\r\n	$friends = explode('','', $vbulletin->options[''kk_auto_friends'']);\r\n	foreach($friends AS $friendid)\r\n	{\r\n		$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$userid}, {$friendid}, ''buddy'', ''yes'')");\r\n		if($vbulletin->options[''kk_auto_friends_mutual''])\r\n		{\r\n			$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$friendid}, {$userid}, ''buddy'', ''yes'')");\r\n		}\r\n		$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1	WHERE userid IN ($userinfo[userid], " . $vbulletin->userinfo[''userid''] . ")");\r\n		$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1	WHERE userid={$friendid}");\r\n	}\r\n}', 'kk_auto_friend', '', 1, 5),
(700, 'Automatically Add Friend', 'register_addmember_complete', 'if(!empty($vbulletin->options[''kk_auto_friends'']) && !$vbulletin->options[''verifyemail''])\r\n{\r\n	$friends = explode('','', $vbulletin->options[''kk_auto_friends'']);\r\n	foreach($friends AS $friendid)\r\n	{\r\n		$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$userid}, {$friendid}, ''buddy'', ''yes'')");\r\n		if($vbulletin->options[''kk_auto_friends_mutual''])\r\n		{\r\n			$db->query("INSERT INTO " . TABLE_PREFIX . "userlist (userid, relationid, type, friend) VALUES ({$friendid}, {$userid}, ''buddy'', ''yes'')");\r\n		}\r\n		$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1	WHERE userid IN ($userinfo[userid], " . $vbulletin->userinfo[''userid''] . ")");\r\n		$db->query_write("UPDATE " . TABLE_PREFIX . "user SET friendcount = friendcount + 1	WHERE userid={$friendid}");\r\n	}\r\n}', 'kk_auto_friend', '', 1, 5),
(774, 'Cyb - Sub-Forum Manager 3', 'forumbit_subforumbit', '\r\n		if ($vbulletin->options[''cybsfa_enable''])\r\n		{\r\n			eval(''$cybsfa_exclfrms2 = in_array($forum[parentid], array('' . $vbulletin->options[''cybsfa_excludedforums''] . ''));'');\r\n			eval(''$cybsfa_countsexclfrms = in_array($forum[forumid], array('' . $vbulletin->options[''cybsfa_counts_exclforums''] . ''));'');\r\n			eval(''$cybsfa_blanklinesub = in_array($forum[forumid], array('' . $vbulletin->options[''cybsfa_blankline_subs''] . ''));'');\r\n\r\n			switch ($vbulletin->options[''cybsfa_tr_counts''])\r\n			{\r\n				case 1: $cybsfmp = '' (''.$forum[''threadcount''].'')''; $cybsfmt = $vbphrase[''threads'']; break;\r\n				case 2: $cybsfmp = '' (''.$forum[''replycount''].'')''; $cybsfmt = $vbphrase[''posts'']; break;\r\n				case 3: $cybsfmp = '' (''.$forum[''threadcount''].''/''.$forum[''replycount''].'')''; $cybsfmt = $vbphrase[''threads''].''/''.$vbphrase[''posts'']; break;\r\n			}\r\n		}', 'cyb_sfa', '', 1, 5),
(773, 'Cyb - Sub-Forum Manager 2', 'forumbit_display', '\r\n		if ($vbulletin->options[''cybsfa_enable''])\r\n		{\r\n			eval(''$cybsfa_exclfrms = in_array($forum[forumid], array('' . $vbulletin->options[''cybsfa_excludedforums''] . ''));'');\r\n\r\n			switch ($vbulletin->options[''cybsfa_switch''])\r\n			{\r\n				case 1: $cybsfa_colnr = 2; $cybsfa_colw = "100%"; break;\r\n				case 2: $cybsfa_colnr = 3; $cybsfa_colw = "50%"; break;\r\n				case 3: $cybsfa_colnr = 4; $cybsfa_colw = "33%"; break;\r\n				case 4: $cybsfa_colnr = 5; $cybsfa_colw = "25%"; break;\r\n				case 5: $cybsfa_colnr = 6; $cybsfa_colw = "20%"; break;\r\n				case 6: $cybsfa_colnr = 7; $cybsfa_colw = "16%"; break;\r\n				case 7: $cybsfa_colnr = 8; $cybsfa_colw = "14%"; break;\r\n				default: $cybsfa_colnr = 2; $cybsfa_colw = "100%"; break;\r\n			}\r\n\r\n			if ($vbulletin->options[''cybsfa_tableattribs'']!='''')\r\n			{\r\n				$cybsfa_tableattrib = ''style="text-transform:none;''.$vbulletin->options[cybsfa_tableattribs].''"'';\r\n			}\r\n			if ($vbulletin->options[''cybsfa_cellattribs'']!='''')\r\n			{\r\n				$cybsfa_cellattrib = ''style="text-transform:none;''.$vbulletin->options[cybsfa_cellattribs].''"'';\r\n			}\r\n\r\n			$cybsfa_getsubs = explode(''&nbsp;'',$forum[subforums]);\r\n			$cybsfa_tbattr = ''<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" ''.$cybsfa_tableattrib.''><tr valign="top">'';\r\n\r\n			$cybsfa_cols = ''0'';\r\n			foreach ($cybsfa_getsubs as $cybsfa_subf)\r\n			{\r\n				$cybsfa_cols++;\r\n				if ($cybsfa_cols == $cybsfa_colnr)\r\n				{\r\n					$cybsfa_cols = ''1'';\r\n					$cybsfa_tbattr .=  ''</tr><tr>'';\r\n				}\r\n\r\n				$cybsfa_tbattr .= ''<td ''.$cybsfa_cellattrib.'' width="''.$cybsfa_colw.''">''.$cybsfa_subf.''</td>'';\r\n			}\r\n\r\n			if ($cybsfa_cols == ''1'')\r\n			{\r\n				$cybsfa_tbattr .= ''<td ''.$cybsfa_cellattrib.''>&nbsp;</td></tr></table>'';\r\n			}\r\n			else\r\n			{\r\n				$cybsfa_tbattr .= ''</tr></table>'';\r\n			}\r\n\r\n			if (!in_array($forum[''forumid''], array($cybsfa_exclfrms)))\r\n			{\r\n				$forum[subforums] = $cybsfa_tbattr;\r\n			}\r\n			else\r\n			{\r\n				if ($vbulletin->options[''cybsfa_affectexclforums''])\r\n				{\r\n					$cybsfa_tbattr = ''<table border="0" cellpadding="0" cellspacing="0" width="100%" ''.$cybsfa_tableattrib.''><tr valign="top"><td ''.$cybsfa_cellattrib.''>''.$forum[subforums].''</td></tr></table>'';\r\n				}\r\n				else\r\n				{\r\n					$cybsfa_tbattr = $forum[subforums];\r\n				}\r\n				$forum[subforums] = $cybsfa_tbattr;\r\n			}\r\n		}', 'cyb_sfa', '', 1, 5),
(770, 'Cybernetec''s Hacks Template Group', 'template_groups', '$only[''cyb_''] = ''Cybernetec'';\r\n		', 'cyb_sfa', '', 1, 5),
(771, 'Cyb - Sub-Forum Manager - CT', 'cache_templates', '\r\n		if ($vbulletin->options[''cybsfa_enable''] AND (THIS_SCRIPT==''index'' OR THIS_SCRIPT==''forumdisplay''))\r\n		{\r\n			$globaltemplates = array_merge($globaltemplates, array(''cyb_subforummanager''));\r\n		}', 'cyb_sfa', '', 1, 5),
(772, 'Cyb - Sub-Forum Manager 1', 'parse_templates', '\r\n		if ($vbulletin->options[''cybsfa_enable''] AND (THIS_SCRIPT==''index'' OR THIS_SCRIPT==''forumdisplay''))\r\n		{\r\n			switch ($vbulletin->options[''cybsfa_subfcommas''])\r\n			{\r\n				case 0: $cybsfm_comst = ''''; break;\r\n				case 1: $cybsfm_comst = '',''; break;\r\n				case 2: $cybsfm_comst = ''<span style=\\"text-transform:none;''.$vbulletin->options[''cybsfa_countscss''].''\\">,</span>''; break;\r\n			}\r\n\r\n			$vbulletin->templatecache[''forumhome_subforumseparator_post''] = str_replace('','', $cybsfm_comst.''&nbsp;'',$vbulletin->templatecache[''forumhome_subforumseparator_nopost'']);\r\n			$vbulletin->templatecache[''forumhome_subforumseparator_nopost''] = str_replace('','', $cybsfm_comst.''&nbsp;'',$vbulletin->templatecache[''forumhome_subforumseparator_nopost'']);\r\n\r\n			if ($vbulletin->options[''cybsfa_subphrase''])\r\n			{\r\n				$cyb_sfm_subph = (''<strong>$vbphrase[subforums]</strong>:'');\r\n				$vbulletin->templatecache[''forumhome_forumbit_level1_nopost''] = str_replace($cyb_sfm_subph, '''',$vbulletin->templatecache[''forumhome_forumbit_level1_nopost'']);\r\n				$vbulletin->templatecache[''forumhome_forumbit_level1_post''] = str_replace($cyb_sfm_subph, '''',$vbulletin->templatecache[''forumhome_forumbit_level1_post'']);\r\n				$vbulletin->templatecache[''forumhome_forumbit_level2_nopost''] = str_replace($cyb_sfm_subph, '''',$vbulletin->templatecache[''forumhome_forumbit_level2_nopost'']);\r\n				$vbulletin->templatecache[''forumhome_forumbit_level2_post''] = str_replace($cyb_sfm_subph, '''',$vbulletin->templatecache[''forumhome_forumbit_level2_post'']);\r\n			}\r\n\r\n			if (($vbulletin->options[''cybsfa_tr_counts'']!=''0'') OR ($vbulletin->options[''cybsfa_blankline_subs'']!=''''))\r\n			{\r\n				$cybsfa_titlesrch = (''$forum[title]</a>'');\r\n				$vbulletin->templatecache[''forumhome_subforumbit_post''] = str_replace($cybsfa_titlesrch,$cybsfa_titlesrch.$vbulletin->templatecache[''cyb_subforummanager''],$vbulletin->templatecache[''forumhome_subforumbit_post'']);\r\n				$vbulletin->templatecache[''forumhome_subforumbit_nopost''] = str_replace($cybsfa_titlesrch,$cybsfa_titlesrch.$vbulletin->templatecache[''cyb_subforummanager''],$vbulletin->templatecache[''forumhome_subforumbit_nopost'']);\r\n			}\r\n		}', 'cyb_sfa', '', 1, 5),
(708, 'Usergroup Color Bar', 'forumhome_complete', 'if (THIS_SCRIPT == "index" and $vbulletin->options[''ugcb_onoff''])\r\n{\r\n$activeusers2 .= ''<br />'';\r\n$userbuls = split('','', $vbulletin->options[''sirala'']);\r\nforeach($userbuls AS $userbul) {\r\n\r\n$activeusers2 .= $vbulletin->usergroupcache["$userbul"][''opentag''] . ''&#8226; ''.$vbulletin->usergroupcache["$userbul"][''title''] . $vbulletin->usergroupcache["$userbul"][''closetag''].'' '';\r\n}\r\n$activeusers = ''<b>''.$activeusers2 .''</b><br /><br />''. $activeusers;\r\n}', 'ugcb', '', 1, 5),
(709, 'HelpCenter Template Cache', 'cache_templates', '$globaltemplates[] = ''hcenter_navbar'';', 'helpcenter', '', 1, 5),
(710, 'HelpCenter Get Editor', 'editor_toolbar_start', 'if ($forumid == ''helpcenter'')\r\n{\r\nglobal $setting;\r\n$setting[''allow_bbcode''] = ''1'';\r\n$show[''img_bbcode''] = $setting[''allow_imgcode''];\r\n$toolbartype = $setting[''allow_bbcode''] ? is_wysiwyg_compatible(-1, $editor_type) : 0;\r\n$show[''wysiwyg_compatible''] = (is_wysiwyg_compatible(2, $editor_type) == 2);\r\n$show[''editor_toolbar''] = ($toolbartype > 0);\r\n$editor_template_name = ($toolbartype ? ''editor_toolbar_on'' : ''editor_toolbar_off'');\r\n}', 'helpcenter', '', 1, 5),
(711, 'Automatic Template Edit', 'global_start', 'include("helpcenter/plugins/navbar.php");', 'helpcenter', '', 1, 5),
(712, 'HelpCenter Online Location Process', 'online_location_process', 'if($filename==''helpcenter.php'') {\r\n    $userinfo[''activity''] = ''helpcenter'';\r\n}', 'helpcenter', '', 1, 5),
(713, 'HelpCenter Online Location', 'online_location_unknown', 'if($userinfo[''activity'']==''helpcenter'') {\r\n    $userinfo[''where''] = ''<a href="helpcenter.php?''.$vbulletin->session->vars[sessionurl].''">''.$vbphrase[''helpcenter''].''</a>''; \r\n    $userinfo[''action''] = $vbphrase[''view_helpcenter''];\r\n    $handled = true;\r\n}', 'helpcenter', '', 1, 5),
(714, 'HelpCenter Template Groups', 'template_groups', '$only[''hcenter''] = ''HelpCenter'';', 'helpcenter', '', 1, 5),
(723, 'Latest Album Picture', 'cache_templates', 'if (THIS_SCRIPT == "index")\r\n{\r\nglobal $globaltemplates;\r\n$globaltemplates[] = ''afm_latestfm'';\r\n$globaltemplates[] = ''afm_picture'';\r\n}', 'afm', '', 1, 5),
(724, 'Latest Album Picture', 'forumhome_start', 'if (\r\n	(\r\n		$vbulletin->options[''socnet''] & $vbulletin->bf_misc_socnet[''enable_albums'']\r\n		AND\r\n		$permissions[''genericpermissions''] & $vbulletin->bf_ugp_genericpermissions[''canviewmembers'']\r\n		AND\r\n		$permissions[''albumpermissions''] & $vbulletin->bf_ugp_albumpermissions[''canviewalbum'']\r\n		AND\r\n		$vbulletin->options[''afm_onoff'']\r\n	)\r\n)\r\n{\r\n  $displayrecords = ($vbulletin->options[''afm_sayi''] ? $vbulletin->options[''afm_sayi''] : 4);\r\n    switch ($vbulletin->options[''afm_dt''])\r\n    {\r\n      case 1: $sorgu = "ORDER BY dateline DESC LIMIT 0, $displayrecords"; break;\r\n      case 2: $sorgu = "ORDER BY rand(NOW()) DESC LIMIT 0, $displayrecords"; break;\r\n    }  \r\n  $lpictures = $db->query("\r\n  SELECT albumpicture.*, album.*, user.username, user.usergroupid,\r\n  IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid \r\n  FROM " . TABLE_PREFIX . "albumpicture AS albumpicture\r\n  LEFT JOIN " . TABLE_PREFIX . "album AS album ON(album.albumid = albumpicture.albumid)\r\n  LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = album.userid)\r\n  WHERE album.state = ''public'' \r\n  $sorgu  \r\n  ");\r\n  if ($db->num_rows($lpictures))\r\n  {\r\n	while ($lpicture = $db->fetch_array($lpictures))\r\n	{\r\n	$lpicture[''musername''] = fetch_musername($lpicture);\r\n	$lpicture[''title''] = trim(strip_quotes($lpicture[''title'']));\r\n	eval(''$resimler .= "'' . fetch_template(''afm_picture'') . ''";'');\r\n	}\r\n    switch ($vbulletin->options[''afm_yer''])\r\n    {\r\n      case 1: $vbulletin->templatecache[''navbar''] .= $vbulletin->templatecache[''afm_latestfm'']; break;\r\n      case 2: $vbulletin->templatecache[''FORUMHOME''] = str_replace(''<!-- main -->'', ''<!-- what\\''s going on box -->''.$vbulletin->templatecache[''afm_latestfm''], $vbulletin->templatecache[''FORUMHOME'']); break;\r\n      case 3: $vbulletin->templatecache[''FORUMHOME''] = str_replace(''<!-- what\\''s going on box -->'', ''<!-- end what\\''s going on box -->''.$vbulletin->templatecache[''afm_latestfm''], $vbulletin->templatecache[''FORUMHOME'']); break;\r\n      case 4: $vbulletin->templatecache[''FORUMHOME''] = str_replace(''<!-- end what\\''s going on box -->'', ''<!-- end what\\''s going on box -->''.$vbulletin->templatecache[''afm_latestfm''], $vbulletin->templatecache[''FORUMHOME'']); break;\r\n    }\r\n  }\r\n  $db->free_result($lpictures);\r\n}', 'afm', '', 1, 5),
(725, 'Group Statistics cache', 'cache_templates', '$globaltemplates  = array_merge($globaltemplates, array(''forumhome_grup_stats'',''forumhome_grup_stats2''));', 'grup_istatistik_en', '', 1, 5),
(726, 'Group Statistics', 'forumhome_start', '$grup_populer_kes = $vbulletin->options[''popular_grup_showpop_set_descc''];\r\n			$grup_yeni_kes = $vbulletin->options[''popular_grup_shownew_set_descc''];\r\n			$grup_fazla_resim_kes = $vbulletin->options[''popular_grup_showmpic_set_descc''];\r\n	// En Yeni Grup\r\n	$yenigrup = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "socialgroup ORDER BY dateline DESC");\r\n	// En Populer Grup\r\n	$populargrup = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "socialgroup ORDER BY members DESC");\r\n	// En Cok Resim iceren Grup\r\n	$fazlaresim = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "socialgroup ORDER BY picturecount DESC");\r\n	if(strlen($yenigrup[description]) > $grup_yeni_kes) \r\n            { \r\n                $yenigrup[description] = substr($yenigrup[description], 0, $grup_yeni_kes) . ''...''; \r\n            } \r\n	if(strlen($populargrup[description]) > $grup_populer_kes) \r\n			{ \r\n                $populargrup[description] = substr($populargrup[description], 0, $grup_populer_kes) . ''...''; \r\n            } \r\n	if(strlen($fazlaresim[description]) > $grup_fazla_resim_kes) \r\n			{ \r\n                $fazlaresim[description] = substr($fazlaresim[description], 0, $grup_fazla_resim_kes) . ''...''; \r\n            } \r\n	$bulunacakzikkim = ''<!-- end logged-in users -->'';\r\n\r\n	    switch ($vbulletin->options[''populer_grup_stil''])\r\n    {\r\n      case 1: $vbulletin->templatecache[''FORUMHOME''] = str_replace($bulunacakzikkim,$bulunacakzikkim.fetch_template(''forumhome_grup_stats''),$vbulletin->templatecache[''FORUMHOME'']); break;\r\n      case 2: $vbulletin->templatecache[''FORUMHOME''] = str_replace($bulunacakzikkim,$bulunacakzikkim.fetch_template(''forumhome_grup_stats2''),$vbulletin->templatecache[''FORUMHOME'']); break;\r\n    }', 'grup_istatistik_en', '', 1, 5),
(760, 'Easy Forms Part 1', 'misc_start', '$navbits = construct_navbits(array(\r\n		'''' => construct_phrase(''Forms'')\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\nif ($_POST[''do''] == ''postform'')\r\n{\r\n	$canviewform = unserialize($vbulletin->options[''canviewform'']);\r\n	if (!$canviewform OR !is_member_of($vbulletin->userinfo, $canviewform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''p'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$posthash = $vbulletin->input->clean_gpc(''p'', ''posthash'', TYPE_NOHTML);\r\n	$poststarttime = $vbulletin->input->clean_gpc(''p'', ''poststarttime'', TYPE_NOHTML);\r\n	$complete = true;\r\n	$incompleteqs = array();\r\n	$iqs = array();\r\n	$form = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forms WHERE fid = ''$fid''");\r\n	if (!$form)\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	if (isset($_POST[''preview'']))\r\n	{\r\n		$complete = false;\r\n		$preview = true;\r\n	}\r\n	$form[action] = explode(",", $form[action]);\r\n	if ($form[''poll''] == 1)\r\n	{\r\n		$form[polloptions] = explode("\\r\\n", $form[polloptions]);\r\n		$counter = 1;\r\n		foreach ($form[polloptions] as $option)\r\n		{\r\n			$polloption["$counter"] = $option;\r\n			$counter++;\r\n		}\r\n	}\r\n	if ($form[top])\r\n	{\r\n		$darray = preg_replace(''/(.*?)\\{q_(\\d+)\\}(.*?)/is'', "$2,", $form[top]);\r\n		$darray = explode(",", $darray);\r\n		foreach ($darray as $hash)\r\n		{\r\n			$hash = (int)$hash;\r\n			if ($hash == 0)\r\n			{\r\n				continue;\r\n			}\r\n			$form[top] = str_replace("{q_$hash}", $qo[$hash], $form[top]);\r\n		}\r\n		$form[top] = str_replace("{username}", $vbulletin->userinfo[username], $form[top]);\r\n		$form[top] = str_replace("{userid}", $vbulletin->userinfo[userid], $form[top]);\r\n		$form[top] = str_replace("{formtitle}", $form[title], $form[top]);\r\n		$form[top] = str_replace("{threadtitle}", $form[top], $form[top]);\r\n	}\r\n	$nullvalue = "-";\r\n	$form[top] = str_replace("\\\\r\\\\n", "\\r\\n", $form[top]);\r\n	$form[pstq] = str_replace("\\\\r\\\\n", "\\r\\n", $form[pstq]);\r\n	$form[psta] = str_replace("\\\\r\\\\n", "\\r\\n", $form[psta]);\r\n	$form[psts] = str_replace("\\\\r\\\\n", "\\r\\n", $form[psts]);\r\n	$form[pstf] = str_replace("\\\\r\\\\n", "\\r\\n", $form[pstf]);\r\n	$form[preq] = str_replace("\\\\r\\\\n", "\\r\\n", $form[preq]);\r\n	$form[prea] = str_replace("\\\\r\\\\n", "\\r\\n", $form[prea]);\r\n	$form[pres] = str_replace("\\\\r\\\\n", "\\r\\n", $form[pres]);\r\n	$form[pref] = str_replace("\\\\r\\\\n", "\\r\\n", $form[pref]);\r\n	$form[prea] = $form[prea] . " ";\r\n	$form[psta] = " " . $form[psta];\r\n	$formoutput = $form[top];\r\n	$formoutput .= $form[pref];\r\n	$formbits = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");\r\n	while($formbit = $db->fetch_array($formbits))\r\n	{\r\n		if ($formbit[guestonly] && $vbulletin->userinfo[userid])\r\n		{\r\n			continue;\r\n		}\r\n		$question++;\r\n		$qn[$formbit[id]] = $formbit[''question''];\r\n		if ($formbit[''type''] == 7)\r\n		{\r\n			$formoutput .= $form[pres] . $formbit[''question''] . $form[psts];\r\n		}\r\n		elseif ($formbit[''type''] == 9)\r\n		{\r\n		}\r\n		else\r\n		{\r\n			$formoutput .= $form[preq] . $formbit[''question''] . $form[pstq];\r\n		}\r\n		if ($formbit[''type''] == 1)\r\n		{\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_STR);\r\n			if ($q[$formbit[id]] && $formbit[''ereg''] && !preg_match($formbit[''ereg''], $q[$formbit[id]]))\r\n			{\r\n				$complete = false;\r\n				$inputerror[$formbit[id]] = $vbphrase[not_required_form];\r\n			}\r\n			$formoutput .= $form[''prea''] . ($q[$formbit[id]] ? " " . $q[$formbit[id]] . " " : $nullvalue) . $form[psta];\r\n			$qo[$formbit[id]] = $q[$formbit[id]];\r\n		}\r\n		elseif ($formbit[''type''] == 2)\r\n		{\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_UINT);\r\n			if ($q[$formbit[id]] == 1) \r\n			{\r\n				$formoutput .= $form[''prea''] . $vbphrase[yes] . $form[psta];\r\n				$qo[$formbit[id]] = $vbphrase[yes];\r\n			}\r\n			elseif ($q[$formbit[id]] == 2)\r\n			{\r\n				$formoutput .= $form[''prea''] . $vbphrase[no] . $form[psta];\r\n				$qo[$formbit[id]] = $vbphrase[no];\r\n			}\r\n			else\r\n			{\r\n				$formoutput .= $form[''prea''] . $nullvalue . $form[psta];\r\n			}\r\n		}\r\n		elseif ($formbit[''type''] == 3)\r\n		{\r\n			$formbit[options] = explode("\\r\\n", $formbit[options]);\r\n			$i = 0;\r\n			unset($options);\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_UINT);\r\n			if (empty($q[$formbit[id]]))\r\n			{\r\n				$formoutput .= $form[''prea''] . $nullvalue . $form[psta];\r\n			}\r\n			else\r\n			{\r\n				foreach ($formbit[options] as $option)\r\n				{\r\n					$i++;\r\n					if ($i == $q[$formbit[id]]) \r\n					{\r\n						$option = preg_replace(''/\\{value\\=(.*?)\\}/is'', '''', $option);\r\n						$qo[$formbit[id]] = $option;\r\n						$formoutput .= $form[''prea''] . $option . $form[psta];\r\n						break;\r\n					}\r\n				}\r\n			}\r\n		}\r\n		elseif ($formbit[''type''] == 4)\r\n		{\r\n			$formbit[options] = explode("\\r\\n", $formbit[options]);\r\n			$i = 0;\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_HTML);\r\n			if (empty($q[$formbit[id]]))\r\n			{\r\n				$formoutput .= $form[''prea''] . $nullvalue . $form[psta];\r\n			}\r\n			else\r\n			{\r\n				$formoutput .= "[LIST]";\r\n				$qo[$formbit[id]] = array();\r\n				foreach ($formbit[options] as $option)\r\n				{\r\n					$i++;\r\n					$option = preg_replace(''/\\{value\\=(.*?)\\}/is'', '''', $option);\r\n					if (!empty($q[$formbit[id]]) && in_array($i, $q[$formbit[id]]))\r\n					{\r\n						$qo[$formbit[id]][] = $option;\r\n						$option = preg_replace(''/\\{value\\=(.*?)\\}/is'', '''', $option);\r\n						$formoutput .= "[*][I]" . $option . "[/I]\\r\\n";\r\n					}\r\n				}\r\n				$qo[$formbit[id]] = implode(", ", $qo[$formbit[id]]);\r\n				$formoutput .= "[/LIST]\\r\\n";\r\n			}\r\n			if ($q[$formbit[id]])\r\n			{\r\n				$q[$formbit[id]] = implode(",", $q[$formbit[id]]);\r\n			}\r\n		}\r\n		elseif ($formbit[''type''] == 5)\r\n		{\r\n			$formbit[options] = explode("\\r\\n", $formbit[options]);\r\n			$i = 0;\r\n			unset($options);\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_UINT);\r\n			if (empty($q[$formbit[id]]))\r\n			{\r\n				$formoutput .= $form[''prea''] . $nullvalue . $form[psta];\r\n			}\r\n			else\r\n			{\r\n				foreach ($formbit[options] as $option)\r\n				{\r\n					$i++;\r\n					$j = $q[$formbit[id]];\r\n					if ($i == $j) \r\n					{\r\n						$qo[$formbit[id]] = $option;\r\n						$formoutput .= $form[''prea''] . $option . $form[psta];\r\n						break;\r\n					}\r\n				}\r\n			}\r\n		}\r\n		elseif ($formbit[''type''] == 6)\r\n		{\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_STR);\r\n			$qo[$formbit[id]] = $q[$formbit[id]];\r\n			$formoutput .= $form[''prea''] . ($q[$formbit[id]] ? " " . $q[$formbit[id]] . " " : $nullvalue) . $form[psta];\r\n		}\r\n		elseif ($formbit[''type''] == 7)\r\n		{\r\n			$q[$formbit[id]] = 1;\r\n		}\r\n		elseif ($formbit[''type''] == 8)\r\n		{\r\n			require_once(DIR . ''/includes/functions_wysiwyg.php'');\r\n			$vbulletin->input->clean_array_gpc(''p'', array(\r\n				''message''      => TYPE_STR,\r\n				''wysiwyg''			 => TYPE_BOOL,\r\n			));\r\n			if ($vbulletin->GPC[''wysiwyg'']) {\r\n				$q[$formbit[id]] = convert_wysiwyg_html_to_bbcode($vbulletin->GPC[''message''], 1);\r\n			} else {\r\n				$q[$formbit[id]] = $vbulletin->GPC[''message''];\r\n			}\r\n			$qo[$formbit[id]] = $q[$formbit[id]];\r\n			$formoutput .= $form[''prea''] . ($q[$formbit[id]] ? " " . $q[$formbit[id]] . " " : $nullvalue) . $form[psta];\r\n		}\r\n		elseif ($formbit[''type''] == 9)\r\n		{\r\n			$vbulletin->input->clean_array_gpc(''p'', array(\r\n				''humanverify'' => TYPE_ARRAY,\r\n			));\r\n			$q[$formbit[id]] = $vbulletin->GPC[''humanverify''];\r\n			require_once(DIR . ''/includes/class_humanverify.php'');\r\n			$verify =& vB_HumanVerify::fetch_library($vbulletin);\r\n			if (!$verify->verify_token($vbulletin->GPC[''humanverify'']))\r\n			{\r\n				$inputerror[$formbit[id]] = $vbphrase[fail_human_verify];\r\n				$complete = false;\r\n			}\r\n		}\r\n		elseif ($formbit[''type''] == 10)\r\n		{\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_STR);\r\n			$formoutput .= $form[''prea''] . ($q[$formbit[id]] ? " " . $q[$formbit[id]] . " " : $nullvalue) . $form[psta];\r\n			$qo[$formbit[id]] = $q[$formbit[id]];\r\n		}\r\n		elseif ($formbit[''type''] == 11)\r\n		{\r\n			$q[$formbit[id]] = $vbulletin->input->clean_gpc(''p'', $formbit[id], TYPE_ARRAY);\r\n			$qo[$formbit[id]] = implode($formbit[spacer], $q[$formbit[id]]);\r\n			if ((!$q[$formbit[id]][day] OR !$q[$formbit[id]][month] OR !$q[$formbit[id]][year]) && $formbit[''compulsory''] == 1)\r\n			{\r\n				$complete = false;\r\n				$iqs[] = $formbit[''id''];\r\n				$incompleteqs[] = $formbit[''question''];\r\n			}\r\n			if ($q[$formbit[id]][year] <= 1900)\r\n			{\r\n				$inputerror[$formbit[id]] = $vbphrase[incorrect_year];\r\n				$complete = false;\r\n			}\r\n			if ($q[$formbit[id]][day] >= 32)\r\n			{\r\n				$inputerror[$formbit[id]] = $vbphrase[incorrect_day];\r\n				$complete = false;\r\n			}\r\n			$formbit[''compulsory''] == 0;\r\n			$formoutput .= $form[''prea''] . ($qo[$formbit[id]] ? " " . $qo[$formbit[id]] . " " : $nullvalue) . $form[psta];\r\n		}\r\n		if (empty($q[$formbit[id]]) AND $formbit[''compulsory''] == 1)\r\n		{\r\n			$complete = false;\r\n			$iqs[] = $formbit[''id''];\r\n			$incompleteqs[] = $formbit[''question''];\r\n		}\r\n		if ($formbit[''type''] == 4)\r\n		{\r\n			if (empty($q[$formbit[id]]))\r\n			{\r\n				$q[$formbit[id]] = NULL;\r\n			}\r\n			else\r\n			{\r\n				$q[$formbit[id]] = explode(",", $q[$formbit[id]]);\r\n			}\r\n		}\r\n		$qo[$formbit[id]] = str_replace("{", "&#123;", $qo[$formbit[id]]);\r\n	}\r\n	$formoutput .= $form[pstf];\r\n	if ($form[''threadtitle''])\r\n	{\r\n		$threadtitle = $form[''threadtitle''];\r\n		$darray = preg_replace(''/(.*?)\\{q_(\\d+)\\}(.*?)/is'', "$2,", $threadtitle);\r\n		$darray = explode(",", $darray);\r\n		foreach ($darray as $hash)\r\n		{\r\n			$hash = (int)$hash;\r\n			if ($hash == 0)\r\n			{\r\n				continue;\r\n			}\r\n			$threadtitle = str_replace("{q_$hash}", $qo[$hash], $threadtitle);\r\n		}\r\n		$threadtitle = str_replace("{username}", $vbulletin->userinfo[username], $threadtitle);\r\n		$threadtitle = str_replace("{userid}", $vbulletin->userinfo[userid], $threadtitle);\r\n		$threadtitle = str_replace("{formtitle}", $form[title], $threadtitle);\r\n		$threadtitle = str_replace("{threadtitle}", $threadtitle, $threadtitle);\r\n	}\r\n	else\r\n	{\r\n		$threadtitle = $form[''title''];\r\n	}\r\n	$form[pollquestion] = str_replace("{username}", $vbulletin->userinfo[username], $form[pollquestion]);\r\n	if ($form[''formoutput''])\r\n	{\r\n		$formoutput = $form[''formoutput''];\r\n		$thisuser = $vbulletin->userinfo;\r\n		require_once(DIR . ''/includes/adminfunctions_template.php'');\r\n		$formoutput = compile_template($formoutput);\r\n		$vbulletin->templatecache[''formoutput''] = $formoutput;\r\n		eval(''$formoutput = "'' . fetch_template(''formoutput'') . ''";'');\r\n		$darray = preg_replace(''/(.*?)\\{q_(\\d+)\\}(.*?)/is'', "$2,", $formoutput);\r\n		$darray = explode(",", $darray);\r\n		foreach ($darray as $hash)\r\n		{\r\n			$hash = (int)$hash;\r\n			if ($hash == 0)\r\n			{\r\n				continue;\r\n			}\r\n			$formoutput = str_replace("{q_$hash}", $qo[$hash], $formoutput);\r\n		}\r\n		$darray = preg_replace(''/(.*?)\\{qn_(\\d+)\\}(.*?)/is'', "$2,", $formoutput);\r\n		$darray = explode(",", $darray);\r\n		foreach ($darray as $hash)\r\n		{\r\n			$hash = (int)$hash;\r\n			if ($hash == 0)\r\n			{\r\n				continue;\r\n			}\r\n			$formoutput = str_replace("{qn_$hash}", $qn[$hash], $formoutput);\r\n		}\r\n		$formoutput = str_replace("{username}", $vbulletin->userinfo[username], $formoutput);\r\n		$formoutput = str_replace("{userid}", $vbulletin->userinfo[userid], $formoutput);\r\n		$formoutput = str_replace("{formtitle}", $form[title], $formoutput);\r\n		$formoutput = str_replace("{threadtitle}", $threadtitle, $formoutput);\r\n	}\r\n	($hook = $form[beforesubmit]) ? eval($hook) : false;\r\n	if ($form[''action''] && in_array(1, $form[''action'']) AND $complete) \r\n	{\r\n		global $vbulletin, $botpermissions;\r\n		$fromuserid = $vbulletin->userinfo[''userid''];\r\n		$fromusername = $vbulletin->userinfo[''username''];\r\n		$form[''pmrec''] = str_replace("{username}", $vbulletin->userinfo[''username''], $form[''pmrec'']);\r\n		$title = $threadtitle; \r\n		$recipients = $form[''pmrec''];\r\n		$message = $formoutput;\r\n		$pmdm =& datamanager_init(''PM'', $vbulletin, ERRTYPE_ARRAY);\r\n		$pmdm->set(''fromuserid'', $fromuserid);\r\n		$pmdm->set(''fromusername'', $fromusername);\r\n		$pmdm->set(''title'', $title);\r\n		$pmdm->set(''message'', $message);\r\n		$pmdm->set_recipients($recipients, $botpermissions);\r\n		$pmdm->set(''dateline'', TIMENOW); \r\n		$pmdm->overridequota = true;\r\n		$errors = $pmdm->errors;\r\n		if ($errors)\r\n		{\r\n			foreach ($errors as $error)\r\n			{\r\n				$errorss .= $error. "<br />";\r\n			}\r\n			$errormessage = "Form failed to submit. The following error(s) occured: <br /> ".$errorss;\r\n			eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n		$pmdm->save();\r\n		unset($pmdm);\r\n		if ($form[submitmessage])\r\n		{\r\n			$errormessage = $form[submitmessage];\r\n		}\r\n		else\r\n		{\r\n			$errormessage = "Form was submitted successfully.";\r\n		}\r\n	} \r\n	if ($form[''action''] && in_array(2, $form[''action'']) AND $complete)\r\n	{\r\n		$newpost = array();\r\n		$threadinfo = array();\r\n		if (!$vbulletin->userinfo[''userid''])\r\n		{\r\n			$vbulletin->input->clean_array_gpc(''p'', array(\r\n				''humanverify'' => TYPE_ARRAY,\r\n			));\r\n			$newpost[''humanverify''] =& $vbulletin->GPC[''humanverify''];\r\n		}\r\n		require_once(DIR . ''/includes/functions_newpost.php'');\r\n		require_once(DIR . ''/includes/functions_editor.php'');\r\n		require_once(DIR . ''/includes/functions_bigthree.php'');\r\n		$forumid = $form[''forumid''];\r\n		$foruminfo = verify_id(''forum'', $forumid, 0, 1);\r\n		$foruminfo[''moderatenewthread''] = 0;\r\n		$foruminfo[''moderatenewpost''] = 0;\r\n		$foruminfo[''moderateattach''] = 0;\r\n		$foruminfo[''allowposting''] = 1;\r\n		$forumperms = fetch_permissions($forumid);\r\n		$newpost[''parseurl''] = 1;\r\n		if (!$posthash OR !$poststarttime)\r\n		{\r\n			$poststarttime = TIMENOW;\r\n			$posthash = md5($poststarttime . $vbulletin->userinfo[''userid''] . $vbulletin->userinfo[''salt'']);\r\n		}\r\n		$newpost[''poststarttime''] = $poststarttime;\r\n		$newpost[''posthash''] = $posthash;\r\n		$newpost[''title''] =& $threadtitle;\r\n		$newpost[''prefixid''] =& $form[prefixid];\r\n		$newpost[''userid''] = $vbulletin->userinfo[''userid''];\r\n		$newpost[''username''] =& $vbulletin->userinfo[''username''];\r\n        $newpost[''message''] =& $formoutput;\r\n		$newpost[''iconid''] =& $iconid;\r\n		if (!$closed)\r\n		{\r\n			$newpost[''openclose''] = 1;\r\n		}\r\n		else\r\n		{\r\n			$newpost[''openclose''] = 0;\r\n		}\r\n        $newpost[''disablesmilies''] = ''0'';\r\n        $newpost[''visible''] = 1;\r\n		$newpost[''stickunstick''] = 0;\r\n		$newpost[''folderid''] = 0;\r\n		$threadinfo[''issubscribed''] = false;\r\n		$threadinfo[''visible''] = 1;\r\n		$newpost[''emailupdate''] = 9999;\r\n		if (!$forumperms)\r\n		{\r\n			$forumperms = 16777215;\r\n		}\r\n		if (!$vbulletin->bf_ugp_forumpermissions[''followforummoderation''])\r\n		{\r\n			$vbulletin->bf_ugp_forumpermissions[''followforummoderation''] = 131072;\r\n		}\r\n		$newpost[forcevisible] = 1;\r\n		build_new_post(''thread'', $foruminfo, $threadinfo, array(), $newpost, $errors);\r\n		if (sizeof($errors) > 0)\r\n		{\r\n			foreach ($errors as $error)\r\n			{\r\n				$errorss .= $error. "<br />";\r\n			}\r\n			$errormessage = "Form failed to submit. The following error(s) occured: <br /> ".$errorss;\r\n			eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n        $threadinfo = fetch_threadinfo($newpost[''threadid'']);\r\n		mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo[''userid''], TIMENOW);\r\n		$threadid = $newpost[''threadid''];\r\n		/*($hook = vBulletinHook::fetch_hook(''newthread_post_complete'')) ? eval($hook) : false;*/\r\n		if ($form[poll] == 1)\r\n		{\r\n			$question = $form[pollquestion];\r\n			$threadinfo = verify_id(''thread'', $threadid, 0, 1);\r\n			$polloptions = count($polloption);\r\n			$vbulletin->GPC[''options''] = $polloption;\r\n			$counter = 0;\r\n			$optioncount = 0;\r\n			$badoption = '''';\r\n			while ($counter++ < $polloptions)\r\n			{\r\n				if ($vbulletin->options[''maxpolllength''] AND vbstrlen($vbulletin->GPC[''options'']["$counter"]) > $vbulletin->options[''maxpolllength''])\r\n				{\r\n					$badoption .= iif($badoption, '', '') . $counter;\r\n				}\r\n				if (!empty($vbulletin->GPC[''options'']["$counter"]))\r\n				{\r\n					$optioncount++;\r\n				}\r\n			}\r\n			$poll =& datamanager_init(''Poll'', $vbulletin, ERRTYPE_STANDARD);\r\n			$counter = 0;\r\n			while ($counter++ < $polloptions)\r\n			{\r\n				if ($vbulletin->GPC[''options'']["$counter"] != '''')\r\n				{\r\n					$poll->set_option($vbulletin->GPC[''options'']["$counter"]);\r\n				}\r\n			}\r\n			$poll->set(''question'', $question);\r\n			$poll->set(''dateline'', TIMENOW);\r\n			$poll->set(''active'', ''1'');\r\n			$poll->set(''public'', $form[''publicpoll'']);\r\n			$poll->set(''multiple'', $form[''multiplepoll'']);\r\n			$poll->set(''timeout'', $form[''polltimeout'']);\r\n			$pollid = $poll->save();\r\n			$threadman =& datamanager_init(''Thread'', $vbulletin, ERRTYPE_STANDARD, ''threadpost'');\r\n			$threadman->set_existing($threadinfo);\r\n			$threadman->set(''pollid'', $pollid);\r\n			$threadman->save();\r\n		}\r\n		if ($form[submitmessage])\r\n		{\r\n			$errormessage = $form[submitmessage];\r\n		}\r\n		else\r\n		{\r\n			$errormessage = "Form was submitted successfully. Click <a href=\\"showthread.php?" . $vbulletin->session->vars[''sessionurl''] . "p=" . $newpost[postid] . "#post" . $newpost[postid] . "\\">here</a> to view the thread.";\r\n		}\r\n	}\r\n	if ($form[''action''] && in_array(3, $form[''action'']) AND $complete)\r\n	{\r\n		require_once(''./includes/class_dm.php'');\r\n		require_once(''./includes/class_dm_threadpost.php'');\r\n		$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);\r\n		$postthreadid = $form[''threadid''];\r\n		$postuserid = $vbulletin->userinfo[''userid''];\r\n		$postpagetext = $formoutput;\r\n		$threadinfo = fetch_threadinfo($postthreadid);\r\n		$foruminfo = fetch_foruminfo($threadinfo[''forumid'']);\r\n		$postdm->set_info(''forum'', $foruminfo);\r\n		$postdm->set_info(''thread'', $threadinfo);  \r\n		$postdm->set(''threadid'', $postthreadid);\r\n		$postdm->set(''userid'', $postuserid);\r\n		$postdm->set(''pagetext'', $postpagetext);\r\n		$postdm->set(''allowsmilie'', 1);\r\n		$postdm->set(''visible'', 1);\r\n		$postdm->set(''dateline'', TIMENOW);\r\n		$postid = $postdm->save();\r\n		unset($postdm);\r\n		if ($form[submitmessage])\r\n		{\r\n			$errormessage = $form[submitmessage];\r\n		}\r\n		else\r\n		{\r\n			$errormessage = "Form was submitted successfully. Click <a href=\\"showthread.php?p=".$postid."\\">here</a> to view the post.";\r\n		}\r\n	}\r\n	if ($form[''action''] && in_array(4, $form[''action'']) AND $complete)\r\n	{\r\n		require_once(DIR . ''/includes/class_bbcode_alt.php'');\r\n		$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());\r\n		$plainformoutput = $plaintext_parser->parse($formoutput);\r\n		unset($plaintext_parser);\r\n		$form[''email''] = explode(";", $form[''email'']);\r\n		foreach ($form[''email''] AS $email)\r\n		{\r\n			$email = trim($email);\r\n			if ($email == ''{email}'')\r\n			{\r\n				$email = $vbulletin->userinfo[''email''];\r\n			}\r\n			vbmail($email, $threadtitle, $plainformoutput, 1, $from, $uheaders, $vbulletin->userinfo[''username'']);\r\n		}\r\n		if ($form[submitmessage])\r\n		{\r\n			$errormessage = $form[submitmessage];\r\n		}\r\n		else\r\n		{\r\n			$errormessage = "Form was submitted successfully.";\r\n		}\r\n	}\r\n	if ($form[''action''] && in_array(5, $form[''action'']) AND $complete)\r\n	{\r\n		$db->query_write("INSERT INTO " . TABLE_PREFIX . "formresults\r\n		(fid, userid, username, time, title, output)\r\n		VALUES (''".$form[fid]."'', ''".$vbulletin->userinfo[''userid'']."'', ''".addslashes($vbulletin->userinfo[''username''])."'', ".TIMENOW.", ''".addslashes($threadtitle)."'', ''".addslashes($formoutput)."'')\r\n		");\r\n		if ($form[submitmessage])\r\n		{\r\n			$errormessage = $form[submitmessage];\r\n		}\r\n		else\r\n		{\r\n			$errormessage = "Form was submitted successfully.";\r\n		}\r\n	}\r\n	if ($complete)\r\n	{\r\n		if ($form[redirect] && $form[redirecturl])\r\n		{\r\n			$form[redirecturl] = str_replace(''$postid'', "$postid", $form[redirecturl]);\r\n			$form[redirecturl] = str_replace(''$newpost[postid]'', "$newpost[postid]", $form[redirecturl]);\r\n			$vbulletin->url = $form[redirecturl];\r\n			eval(print_standard_redirect($errormessage, false, true));\r\n		}\r\n		else\r\n		{\r\n			eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	}\r\n	if (!$complete) \r\n	{\r\n		$_REQUEST[''do''] = ''form'';\r\n		$_REQUEST[''fid''] = $fid;\r\n		if ($incompleteqs)\r\n		{\r\n			$unanswered_questions = true;\r\n			$incompleteqs = implode("</li><li>", $incompleteqs);\r\n			$incompleteqs = "<li>" . $incompleteqs . "</li>";\r\n			$incompleteqs = $vbulletin->input->clean($incompleteqs, TYPE_HTML);\r\n		}\r\n		if ($preview)\r\n		{\r\n			$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true);\r\n			require_once(DIR . ''/includes/functions_newpost.php'');\r\n			$formoutput = convert_url_to_bbcode($formoutput);\r\n			$formoutput = $bbcode_parser->do_parse($formoutput,false,true,true,true,true,false);\r\n		}\r\n	}\r\n}\r\nif ($_REQUEST[''do''] == ''form'')\r\n{\r\n	$canviewform = unserialize($vbulletin->options[''canviewform'']);\r\n	if (!$canviewform OR !is_member_of($vbulletin->userinfo, $canviewform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$form = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forms WHERE fid = $fid");\r\n	if (!$form)\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	if ($form[usergroups])\r\n	{\r\n		$form[usergroups] = explode(",", $form[usergroups]);\r\n		if (!is_member_of($vbulletin->userinfo, $form[usergroups]))\r\n		{\r\n			print_no_permission();\r\n		}\r\n	}\r\n	if (!$posthash OR !$poststarttime)\r\n	{\r\n		$poststarttime = TIMENOW;\r\n		$posthash = md5($poststarttime . $vbulletin->userinfo[''userid''] . $vbulletin->userinfo[''salt'']);\r\n	}\r\n	($hook = $form[formstart]) ? eval($hook) : false;\r\n	$postattach = array();\r\n	$form[''action''] = explode(",", $form[''action'']);\r\n	$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n	$form[''title''] = $bbcode_parser->do_parse($form[''title''],false,true,true,true,false,false);\r\n	$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n	$form[''description''] = $bbcode_parser->do_parse($form[''description''],false,true,true,true,true,false);\r\n	$formbits = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");\r\n	while($formbit = $db->fetch_array($formbits))\r\n	{\r\n		if ($formbit[guestonly] && $vbulletin->userinfo[userid])\r\n		{\r\n			continue;\r\n		}\r\n		$formbit[''value''] = $q[$formbit[id]];\r\n		$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n		$formbit[question] = $bbcode_parser->do_parse($formbit[question],false,true,true,true,false,false);\r\n		$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n		$formbit[description] = $bbcode_parser->do_parse($formbit[description],false,true,true,true,true,false);\r\n		$formbit[''qlc''] = trim($formbit[''question'']);\r\n		$formbit[''qlc''] = substr($formbit[''qlc''], -1);\r\n		if ($formbit[''qlc''] != "?" && $formbit[''qlc''] != ":")\r\n		{\r\n			$formbit[''question''] = $formbit[''question''] . ":";\r\n		}\r\n		if ($formbit[''compulsory''] == 1)\r\n		{\r\n			$formbit[''question''] = $formbit[''question''] . "*";\r\n		}\r\n		$question++;\r\n		$formbit[inputerror] = $inputerror[$formbit[id]];\r\n		if ($formbit[''type''] == 1)\r\n		{\r\n			$formbit[''value''] = htmlspecialchars($formbit[''value'']);\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_textfield'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 2)\r\n		{\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_yesno'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 3)\r\n		{\r\n			$formbit[options] = explode("\\r\\n", $formbit[options]);\r\n			$i = 0;\r\n			unset($options);\r\n			foreach ($formbit[options] as $option)\r\n			{\r\n				$i++;\r\n				$option = preg_replace(''/\\{value\\=(.*?)\\}/is'', '''', $option);\r\n				$n = $i % $formbit[perrow];\r\n				if ($formbit[perrow] <= 1 || $n == 0)\r\n				{\r\n					$formbit[br] = true;\r\n				}\r\n				else\r\n				{\r\n					$formbit[br] = false;\r\n				}\r\n				eval(''$options .= "'' . fetch_template(''form_formbit_radiobuttons_option'') . ''";'');\r\n			}\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_radiobuttons'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 4)\r\n		{\r\n			$formbit[options] = explode("\\r\\n", $formbit[options]);\r\n			$i = 0;\r\n			unset($options);\r\n			foreach ($formbit[options] as $option)\r\n			{\r\n				$i++;\r\n				$option = preg_replace(''/\\{value\\=(.*?)\\}/is'', '''', $option);\r\n				$n = $i % $formbit[perrow];\r\n				if ($formbit[perrow] <= 1 || $n == 0)\r\n				{\r\n					$formbit[br] = true;\r\n				}\r\n				else\r\n				{\r\n					$formbit[br] = false;\r\n				}\r\n				eval(''$options .= "'' . fetch_template(''form_formbit_checkboxes_option'') . ''";'');\r\n			}\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_checkboxes'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 5)\r\n		{\r\n			$formbit[options] = explode("\\r\\n", $formbit[options]);\r\n			$i = 0;\r\n			unset($options);\r\n			unset($option);\r\n			eval(''$options .= "'' . fetch_template(''form_formbit_dropdown_option'') . ''";'');\r\n			foreach ($formbit[options] as $option)\r\n			{\r\n				$i++;\r\n				$option = preg_replace(''/\\{value\\=(.*?)\\}/is'', '''', $option);\r\n				eval(''$options .= "'' . fetch_template(''form_formbit_dropdown_option'') . ''";'');\r\n			}\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_dropdown'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 6)\r\n		{\r\n			$formbit[''value''] = htmlspecialchars($formbit[''value'']);\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_textarea'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 7)\r\n		{\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_section'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 8)\r\n		{\r\n			require_once(DIR . ''/includes/functions_editor.php'');\r\n			$editorid = construct_edit_toolbar($formbit[''value''], 0, ''nonforum'', iif($vbulletin->options[''privallowsmilies''], 1, 0), 1, 1);\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_vbeditor'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 9)\r\n		{\r\n			require_once(DIR . ''/includes/class_humanverify.php'');\r\n			$verify =& vB_HumanVerify::fetch_library($vbulletin);\r\n			$formbit[human_verify] = $verify->output_token();\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_humanverify'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 10)\r\n		{\r\n($custom = $formbit[custom]) ? eval($custom) : false;\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_custom'') . ''";'');\r\n		}\r\n		elseif ($formbit[''type''] == 11)\r\n		{\r\n			$formbit[day] = $formbit[value][day];\r\n			$formbit[month] = $formbit[value][month];\r\n			$formbit[year] = $formbit[value][year];\r\n			eval(''$formqaas .= "'' . fetch_template(''form_formbit_date'') . ''";'');\r\n		}\r\n	}\r\n	if ($form[''action''] && in_array(2, $form[''action'']) && $form[''attach''] == 1  && $vbulletin->userinfo[''userid''] != 0)\r\n	{\r\n		require_once(DIR . ''/includes/functions_newpost.php'');\r\n		require_once(DIR . ''/includes/functions_editor.php'');\r\n		$forumid = $form[''forumid''];\r\n		require_once(DIR . ''/includes/functions_file.php'');\r\n		$inimaxattach = fetch_max_upload_size();\r\n		$maxattachsize = vb_number_format($inimaxattach, 1, true);\r\n		$attachcount = 0;\r\n		$attach_editor = array();\r\n		$attachment_js = '''';\r\n		if ($vbulletin->userinfo[''userid''] AND !empty($vbulletin->userinfo[''attachmentextensions'']))\r\n		{\r\n			if (!$posthash OR !$poststarttime)\r\n			{\r\n				$poststarttime = TIMENOW;\r\n				$posthash = md5($poststarttime . $vbulletin->userinfo[''userid''] . $vbulletin->userinfo[''salt'']);\r\n			}\r\n			else\r\n			{\r\n				if (empty($postattach))\r\n				{\r\n					$currentattaches = $db->query_read("\r\n					SELECT dateline, filename, filesize, attachmentid\r\n					FROM " . TABLE_PREFIX . "attachment\r\n					WHERE posthash = ''" . $db->escape_string($posthash) . "''\r\n					AND userid = " . $vbulletin->userinfo[''userid'']\r\n					);\r\n\r\n					while ($attach = $db->fetch_array($currentattaches))\r\n					{\r\n						$postattach["$attach[attachmentid]"] = $attach;\r\n					}\r\n				}\r\n\r\n				if (!empty($postattach))\r\n				{\r\n					foreach($postattach AS $attachmentid => $attach)\r\n					{\r\n						$attach[''extension''] = strtolower(file_extension($attach[''filename'']));\r\n						$attach[''filename''] = htmlspecialchars_uni($attach[''filename'']);\r\n						$attach[''filesize''] = vb_number_format($attach[''filesize''], 1, true);\r\n						$attach[''imgpath''] = "$stylevar[imgdir_attach]/$attach[extension].gif";\r\n						$show[''attachmentlist''] = true;\r\n						eval(''$attachments .= "'' . fetch_template(''newpost_attachmentbit'') . ''";'');\r\n\r\n						$attachment_js .= construct_attachment_add_js($attachmentid, $attach[''filename''], $attach[''filesize''], $attach[''extension'']);\r\n\r\n						$attach_editor["$attachmentid"] = $attach[''filename''];\r\n					}\r\n				}\r\n			}\r\n			$attachurl = "f=$forumid";\r\n			$newpost_attachmentbit = prepare_newpost_attachmentbit();\r\n			eval(''$attachmentoption = "'' . fetch_template(''newpost_attachment'') . ''";'');\r\n		\r\n			$attach_editor[''hash''] = $forumid;\r\n			$attach_editor[''url''] = "newattachment.php?" . $vbulletin->session->vars[''sessionurl''] . "f=$forumid&amp;poststarttime=$poststarttime&amp;posthash=$posthash";\r\n		}\r\n		else\r\n		{\r\n			$attachmentoption = '''';\r\n		}\r\n		eval(''$formqaas .= "'' . fetch_template(''form_formbit_attach'') . ''";'');\r\n	}\r\n	if (!$vbulletin->userinfo[''userid''] && $form[''action''] && in_array(2, $form[''action'']))\r\n	{\r\n		require_once(DIR . ''/includes/class_humanverify.php'');\r\n		$verification =& vB_HumanVerify::fetch_library($vbulletin);\r\n		$human_verify = $verification->output_token();\r\n	}\r\n	eval(''$html = "'' . fetch_template(''form_view'') . ''";'');\r\n	$canviewformlist = unserialize($vbulletin->options[''canviewformlist'']);\r\n	if (!$canviewformlist OR !is_member_of($vbulletin->userinfo, $canviewformlist))\r\n	{\r\n		$navbits = construct_navbits(array(\r\n			'''' => construct_phrase($vbphrase[''view_form''], $form[''title''])\r\n		));\r\n	}\r\n	else\r\n	{\r\n		$navbits = construct_navbits(array(\r\n			''misc.php?do=forms'' . $vbulletin->session->vars[''sessionurl_q''] => construct_phrase($vbphrase[''forms'']),\r\n			'''' => construct_phrase($vbphrase[''view_form''], $form[''title''])\r\n		));\r\n	}\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}', 'easyforms', '', 1, 5);
INSERT INTO `plugin` (`pluginid`, `title`, `hookname`, `phpcode`, `product`, `devkey`, `active`, `executionorder`) VALUES
(761, 'Easy Forms Part 2', 'misc_start', 'if ($_POST[''do''] == ''insertform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$title = $vbulletin->input->clean_gpc(''p'', ''title'', TYPE_STR);\r\n	$title = addslashes($title);\r\n		if (!$title) {\r\n			$errormessage = "Error, no title.";\r\n       		eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	$description = $vbulletin->input->clean_gpc(''p'', ''description'', TYPE_STR);\r\n	$description = addslashes($description);\r\n	$displayorder = $vbulletin->input->clean_gpc(''p'', ''displayorder'', TYPE_UINT);\r\n	$action = $vbulletin->input->clean_gpc(''p'', ''action'', TYPE_UINT);\r\n	$threadtitle = $vbulletin->input->clean_gpc(''p'', ''threadtitle'', TYPE_STR);\r\n	$threadtitle = addslashes($threadtitle);\r\n	$category = $vbulletin->input->clean_gpc(''p'', ''category'', TYPE_STR);\r\n	$category = addslashes($category);\r\n	$db->query_write("INSERT INTO " . TABLE_PREFIX . "forms\r\n		(title, description, displayorder, action, threadtitle, category)\r\n		VALUES (''".$title."'', ''".$description."'', ''".$displayorder."'', ''".$action."'', ''".$threadtitle."'', ''".$category."'')\r\n		");\r\n	$id = $vbulletin->db->insert_id();\r\n	$vbulletin->url = "misc.php?do=editform&fid=$id";	\r\n	eval(print_standard_redirect(''redirect_insertform''));\r\n}\r\nif ($_POST[''do''] == ''updateform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$title = $vbulletin->input->clean_gpc(''p'', ''title'', TYPE_STR);\r\n	$title = addslashes($title);\r\n		if (!$title)\r\n		{\r\n			$errormessage = "Error, no title.";\r\n       		eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	$description = $vbulletin->input->clean_gpc(''p'', ''description'', TYPE_STR);\r\n	$description = addslashes($description);\r\n	$submitmessage = $vbulletin->input->clean_gpc(''p'', ''submitmessage'', TYPE_STR);\r\n	$submitmessage = addslashes($submitmessage);\r\n	$formoutput = $vbulletin->input->clean_gpc(''p'', ''formoutput'', TYPE_STR);\r\n	$darray = preg_replace(''/(.*?)\\{q_(\\d+)\\}(.*?)/is'', "$2,", $formoutput);\r\n	$darray = explode(",", $darray);\r\n	foreach ($darray as $hash)\r\n	{\r\n		$hash = (int)$hash;\r\n		if ($hash == 0)\r\n		{\r\n			continue;\r\n		}\r\n		$formoutput = str_replace("{q_$hash}", "\\$q[$hash]", $formoutput);\r\n	}\r\n	$formoutput = addslashes($formoutput);\r\n	$displayorder = $vbulletin->input->clean_gpc(''p'', ''displayorder'', TYPE_UINT);\r\n	$fid = $vbulletin->input->clean_gpc(''p'', ''fid'', TYPE_UINT);\r\n	$poll = $vbulletin->input->clean_gpc(''p'', ''poll'', TYPE_UINT);\r\n	$attach = $vbulletin->input->clean_gpc(''p'', ''attach'', TYPE_UINT);\r\n	$publicpoll = $vbulletin->input->clean_gpc(''p'', ''publicpoll'', TYPE_UINT);\r\n	$multiplepoll = $vbulletin->input->clean_gpc(''p'', ''multiplepoll'', TYPE_UINT);\r\n	$polltimeout = $vbulletin->input->clean_gpc(''p'', ''polltimeout'', TYPE_UINT);\r\n	$preview = $vbulletin->input->clean_gpc(''p'', ''preview'', TYPE_UINT);\r\n	$prefixid = $vbulletin->input->clean_gpc(''p'', ''prefixid'', TYPE_STR);\r\n	$prefixid = addslashes($prefixid);\r\n	$showonfl = $vbulletin->input->clean_gpc(''p'', ''showonfl'', TYPE_UINT);\r\n	$redirect = $vbulletin->input->clean_gpc(''p'', ''redirect'', TYPE_UINT);\r\n	$action = $vbulletin->input->clean_gpc(''p'', ''action'', TYPE_ARRAY);\r\n	$action = implode(",", $action);\r\n	$threadtitle = $vbulletin->input->clean_gpc(''p'', ''threadtitle'', TYPE_STR);\r\n	$threadtitle = addslashes($threadtitle);\r\n	$redirecturl = $vbulletin->input->clean_gpc(''p'', ''redirecturl'', TYPE_STR);\r\n	$redirecturl = addslashes($redirecturl);\r\n	$email = $vbulletin->input->clean_gpc(''p'', ''email'', TYPE_STR);\r\n	$email = addslashes($email);\r\n	$forumid = $vbulletin->input->clean_gpc(''p'', ''forumid'', TYPE_STR);\r\n	$forumid = addslashes($forumid);\r\n	$threadid = $vbulletin->input->clean_gpc(''p'', ''threadid'', TYPE_STR);\r\n	$threadid = addslashes($threadid);\r\n	$pmrec = $vbulletin->input->clean_gpc(''p'', ''pmrec'', TYPE_STR);\r\n	$pmrec = addslashes($pmrec);\r\n	$category = $vbulletin->input->clean_gpc(''p'', ''category'', TYPE_STR);\r\n	$category = addslashes($category);\r\n	$polloptions = $vbulletin->input->clean_gpc(''p'', ''polloptions'', TYPE_STR);\r\n	$polloptions = addslashes($polloptions);\r\n	$pollquestion = $vbulletin->input->clean_gpc(''p'', ''pollquestion'', TYPE_STR);\r\n	$pollquestion = addslashes($pollquestion);\r\n	$prea = $vbulletin->input->clean_gpc(''p'', ''prea'', TYPE_STR);\r\n	$prea = addslashes($prea);\r\n	$psta = $vbulletin->input->clean_gpc(''p'', ''psta'', TYPE_STR);\r\n	$psta = addslashes($psta);\r\n	$preq = $vbulletin->input->clean_gpc(''p'', ''preq'', TYPE_STR);\r\n	$preq = addslashes($preq);\r\n	$pstq = $vbulletin->input->clean_gpc(''p'', ''pstq'', TYPE_STR);\r\n	$pstq = addslashes($pstq);\r\n	$pres = $vbulletin->input->clean_gpc(''p'', ''pres'', TYPE_STR);\r\n	$pres = addslashes($pres);\r\n	$psts = $vbulletin->input->clean_gpc(''p'', ''psts'', TYPE_STR);\r\n	$psts = addslashes($psts);\r\n	$pref = $vbulletin->input->clean_gpc(''p'', ''pref'', TYPE_STR);\r\n	$pref = addslashes($pref);\r\n	$pstf = $vbulletin->input->clean_gpc(''p'', ''pstf'', TYPE_STR);\r\n	$pstf = addslashes($pstf);\r\n	$top = $vbulletin->input->clean_gpc(''p'', ''top'', TYPE_STR);\r\n	$top = addslashes($top);\r\n	$beforesubmit = $vbulletin->input->clean_gpc(''p'', ''beforesubmit'', TYPE_STR);\r\n	$beforesubmit = addslashes($beforesubmit);\r\n	$formstart = $vbulletin->input->clean_gpc(''p'', ''formstart'', TYPE_STR);\r\n	$formstart = addslashes($formstart);\r\n	$usergroups = $vbulletin->input->clean_gpc(''p'', ''usergroups'', TYPE_ARRAY);\r\n	$usergroups = implode(",", $usergroups);\r\n	$usergroups = addslashes($usergroups);\r\n	$db->query_write("UPDATE " . TABLE_PREFIX . "forms SET title = ''".$title."'', description = ''".$description."'', displayorder = ''".$displayorder."'', action = ''".$action."'', threadtitle = ''".$threadtitle."'', category = ''".$category."'', polloptions = ''".$polloptions."'', pollquestion = ''".$pollquestion."'', poll = ''".$poll."'', publicpoll = ''".$publicpoll."'', multiplepoll = ''".$multiplepoll."'', usergroups = ''".$usergroups."'', submitmessage = ''".$submitmessage."'', formoutput = ''".$formoutput."'', attach = ''".$attach."'', prea = ''".$prea."'', psta = ''".$psta."'', preq = ''".$preq."'', pstq = ''".$pstq."'', pres = ''".$pres."'', psts = ''".$psts."'', pref = ''".$pref."'', pstf = ''".$pstf."'', beforesubmit = ''".$beforesubmit."'', formstart = ''".$formstart."'', top = ''".$top."'', showonfl = ''".$showonfl."'', redirect = ''".$redirect."'', redirecturl = ''".$redirecturl."'', email = ''".$email."'', forumid = ''".$forumid."'', threadid = ''".$threadid."'', pmrec = ''".$pmrec."'', polltimeout = ''".$polltimeout."'', prefixid = ''".$prefixid."'', preview = ''".$preview."'' WHERE fid = ''".$fid."'' ");\r\n	$vbulletin->url = "misc.php?do=editform&fid=$fid";	\r\n	eval(print_standard_redirect(''redirect_updateform''));\r\n}\r\nif ($_POST[''do''] == ''insertq'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$question = $vbulletin->input->clean_gpc(''p'', ''question'', TYPE_NOHTML);\r\n	$question = addslashes($question);\r\n		if (!$question)\r\n		{\r\n			$errormessage = "Error, no question.";\r\n       		eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	$description = $vbulletin->input->clean_gpc(''p'', ''description'', TYPE_NOHTML);\r\n	$description = addslashes($description);\r\n	$displayorder = $vbulletin->input->clean_gpc(''p'', ''displayorder'', TYPE_UINT);\r\n	$fid = $vbulletin->input->clean_gpc(''p'', ''fid'', TYPE_UINT);\r\n	$type = $vbulletin->input->clean_gpc(''p'', ''type'', TYPE_UINT);\r\n	$options = $vbulletin->input->clean_gpc(''p'', ''options'', TYPE_NOHTML);\r\n	$options = addslashes($options);\r\n		if (!$options && in_array($type, array(3,4,5)))\r\n		{\r\n			$errormessage = "Error, no options.";\r\n       		eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	$compulsory = $vbulletin->input->clean_gpc(''p'', ''compulsory'', TYPE_UINT);\r\n	$custom = $vbulletin->input->clean_gpc(''p'', ''custom'', TYPE_STR);\r\n	$custom = addslashes($custom);\r\n	$db->query_write("INSERT INTO " . TABLE_PREFIX . "formbits\r\n		(fid, displayorder, type, question, description, options, compulsory, custom)\r\n		VALUES (''".$fid."'', ''".$displayorder."'', ''".$type."'', ''".$question."'', ''".$description."'', ''".$options."'', ''".$compulsory."'', ''".$custom."'')\r\n		");\r\n	$vbulletin->url = "misc.php?do=editform&fid=$fid#qs";	\r\n	eval(print_standard_redirect(''redirect_insertq''));\r\n}\r\nif ($_POST[''do''] == ''updateq'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$question = $vbulletin->input->clean_gpc(''p'', ''question'', TYPE_STR);\r\n		if (!$question)\r\n		{\r\n			$errormessage = "Error, no question.";\r\n       		eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	$description = $vbulletin->input->clean_gpc(''p'', ''description'', TYPE_NOHTML);\r\n	$displayorder = $vbulletin->input->clean_gpc(''p'', ''displayorder'', TYPE_UINT);\r\n	$fid = $vbulletin->input->clean_gpc(''p'', ''fid'', TYPE_UINT);\r\n	$id = $vbulletin->input->clean_gpc(''p'', ''id'', TYPE_UINT);\r\n	$type = $vbulletin->input->clean_gpc(''p'', ''type'', TYPE_UINT);\r\n	$options = $vbulletin->input->clean_gpc(''p'', ''options'', TYPE_STR);\r\n		if (!$options && in_array($type, array(3,4,5)))\r\n		{\r\n			$errormessage = "Error, no options.";\r\n       		eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n		}\r\n	$compulsory = $vbulletin->input->clean_gpc(''p'', ''compulsory'', TYPE_UINT);\r\n	$perrow = $vbulletin->input->clean_gpc(''p'', ''perrow'', TYPE_UINT);\r\n	$rows = $vbulletin->input->clean_gpc(''p'', ''rows'', TYPE_UINT);\r\n	$cols = $vbulletin->input->clean_gpc(''p'', ''cols'', TYPE_UINT);\r\n	$maxlength = $vbulletin->input->clean_gpc(''p'', ''maxlength'', TYPE_UINT);\r\n	$ereg = $vbulletin->input->clean_gpc(''p'', ''ereg'', TYPE_STR);\r\n	$custom = $vbulletin->input->clean_gpc(''p'', ''custom'', TYPE_STR);\r\n	$spacer = $vbulletin->input->clean_gpc(''p'', ''spacer'', TYPE_STR);\r\n	$size = $vbulletin->input->clean_gpc(''p'', ''size'', TYPE_UINT);\r\n	$guestonly = $vbulletin->input->clean_gpc(''p'', ''guestonly'', TYPE_UINT);\r\n	$db->query_write("\r\n		UPDATE " . TABLE_PREFIX . "formbits\r\n		SET \r\n			displayorder = ''". $db->escape_string($displayorder)."'',\r\n			type = ''". $db->escape_string($type)."'', \r\n			question = ''". $db->escape_string($question)."'', \r\n			description = ''". $db->escape_string($description)."'',\r\n			options = ''". $db->escape_string($options)."'', \r\n			compulsory = ''". $db->escape_string($compulsory)."'', \r\n			perrow = ''". $db->escape_string($perrow)."'', \r\n			rows = ''". $db->escape_string($rows)."'',\r\n			cols = ''". $db->escape_string($cols)."'', \r\n			maxlength = ''".$db->escape_string($maxlength)."'', \r\n			size = ''". $db->escape_string($size)."'',\r\n			ereg = ''". $db->escape_string($ereg)."'', \r\n			custom = ''". $db->escape_string($custom)."'', \r\n			spacer = ''". $db->escape_string($spacer)."'', \r\n			guestonly = ''". $db->escape_string($guestonly)."'' \r\n			WHERE id = ''$id''\r\n	");\r\n	if (isset($_POST[''return'']))\r\n	{\r\n		$vbulletin->url = "misc.php?do=editq&id=$id";	\r\n		eval(print_standard_redirect(''redirect_updateq''));\r\n	}\r\n	else\r\n	{\r\n		$vbulletin->url = "misc.php?do=editform&fid=$fid&qs=1#qs";	\r\n		eval(print_standard_redirect(''redirect_updateq''));\r\n	}\r\n}\r\nif ($_REQUEST[''do''] == ''deleteq'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if ($caneditform && !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$id = $vbulletin->input->clean_gpc(''g'', ''id'', TYPE_UINT);\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	$db->query_write("DELETE FROM " . TABLE_PREFIX . "formbits WHERE id=$id");\r\n	$vbulletin->url = "misc.php?do=editform&fid=$fid#qs";	\r\n	eval(print_standard_redirect(''redirect_deleteq''));\r\n}\r\nif ($_REQUEST[''do''] == ''deleteformresult'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if ($caneditform && !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$id = $vbulletin->input->clean_gpc(''g'', ''id'', TYPE_UINT);\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	$db->query_write("DELETE FROM " . TABLE_PREFIX . "formresults WHERE id=$id");\r\n	$vbulletin->url = "misc.php?do=formresults&fid=$fid";	\r\n	eval(print_standard_redirect(''redirect_deleteq''));\r\n}\r\nif ($_REQUEST[''do''] == ''deleteform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	$db->query_write("DELETE FROM " . TABLE_PREFIX . "forms WHERE fid=$fid");\r\n	$db->query_write("DELETE FROM " . TABLE_PREFIX . "formbits WHERE fid=$fid");\r\n	$vbulletin->url = "misc.php?do=forms";	\r\n	eval(print_standard_redirect(''redirect_deleteform''));\r\n}', 'easyforms', '', 1, 5),
(762, 'Easy Forms Part 3', 'misc_start', 'if ($_REQUEST[''do''] == ''forms'')\r\n{\r\n	$canviewformlist = unserialize($vbulletin->options[''canviewformlist'']);\r\n	if (!$canviewformlist OR !is_member_of($vbulletin->userinfo, $canviewformlist))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	$caneditforms = false;\r\n	if (is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		$caneditforms = true;\r\n	}\r\n	eval(''$html .= "'' . fetch_template(''form_list_top'') . ''";'');\r\n	$forms = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "forms ORDER BY category ASC, displayorder ASC LIMIT 0, 500");\r\n	while($form = $db->fetch_array($forms))\r\n	{\r\n		if (!$form[showonfl] && !$caneditforms)\r\n		{\r\n			continue;\r\n		}\r\n		if (!$form[usergroups] || is_member_of($vbulletin->userinfo, explode(",", $form[usergroups])) || $caneditforms)\r\n		{\r\n			if ($form[''category''] && $form[''category''] != $prev_category)\r\n			{\r\n				eval(''$html .= "'' . fetch_template(''form_list_cat'') . ''";'');\r\n			}\r\n			if ($form[''action''])\r\n			{\r\n				$form[''action''] = explode(",", $form[''action'']);\r\n			}\r\n			$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n			$form[''title''] = $bbcode_parser->do_parse($form[''title''],false,true,true,true,false,false);\r\n			eval(''$html .= "'' . fetch_template(''form_list_bit'') . ''";'');\r\n			$prev_category = $form[''category''];\r\n			$count++;\r\n		}\r\n	}\r\n	if ($count==0)\r\n	{\r\n		eval(''$html .= "'' . fetch_template(''form_list_none'') . ''";'');\r\n	}\r\n	eval(''$html .= "'' . fetch_template(''form_list_bot'') . ''";'');\r\n	$headinclude .= <<<JAVASCRIPT\r\n<script language="javascript" type="text/javascript">\r\nfunction deleteform(id) \r\n{\r\n	if (confirm("Are you sure you want to delete this form and its questions?")) {\r\n		window.location.href = ''misc.php?do=deleteform&fid='' + id;\r\n	}\r\n}\r\nfunction copyform(id) \r\n{\r\n	var number=prompt("How many times do you want to copy this form?","1");\r\n	if (number!=null && number!="" && !isNaN(number))\r\n	{\r\n		window.location.href = ''misc.php?do=copyform&fid='' + id + ''&copies='' + number;\r\n	}\r\n}\r\n</script>\r\nJAVASCRIPT;\r\n	$navbits = construct_navbits(array(\r\n		'''' => construct_phrase($vbphrase[''forms''])\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}\r\nif ($_REQUEST[''do''] == ''formresults'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$count == 0;\r\n	$search = NULL;\r\n	$query = $vbulletin->input->clean_gpc(''p'', ''query'', TYPE_NOHTML);\r\n	if ($query)\r\n	{\r\n		$query = addslashes($query);\r\n		$query = "%".$query."%"; \r\n		$search = "AND (username LIKE ''".$query."'' || title LIKE ''".$query."'' || output LIKE ''".$query."'')";\r\n	}\r\n	$formresults = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formresults WHERE fid = ''$fid'' $search ORDER BY time DESC");\r\n	while ($formresult = $db->fetch_array($formresults))\r\n	{\r\n		$show[search] = false;\r\n		if ($count == 0)\r\n		{\r\n			$show[search] = true;\r\n			$query = trim($query, "%");\r\n		}\r\n		$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n		$formresult[''output''] = $bbcode_parser->do_parse($formresult[''output''],false,true,true,true,true,false);\r\n		eval(''$html .= "'' . fetch_template(''form_showoutput'') . ''";'');\r\n		$count++;\r\n	}\r\n	$navbits = construct_navbits(array(\r\n		'''' => construct_phrase($vbphrase[''forms''])\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	if ($count==0)\r\n	{\r\n		$errormessage = "Error, this form does not have any results stored in the database.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}\r\nif ($_REQUEST[''do''] == ''editform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$qs = $vbulletin->input->clean_gpc(''g'', ''qs'', TYPE_UINT);\r\n	$form = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forms WHERE fid = $fid");\r\n	if (!$form)\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	if ($form[''forumid''] && $vbulletin->options[simpleversion] >= 370)\r\n	{\r\n		require_once(DIR . ''/includes/functions_prefix.php'');\r\n		$prefix_options = fetch_prefix_html($form[''forumid''], $form[''prefixid''], true);\r\n	}\r\n	$form[top] = str_replace(''"'', ''&quot;'', $form[top]);\r\n	$form[preq] = str_replace(''"'', ''&quot;'', $form[preq]);\r\n	$form[pres] = str_replace(''"'', ''&quot;'', $form[pres]);\r\n	$form[prea] = str_replace(''"'', ''&quot;'', $form[prea]);\r\n	$form[pref] = str_replace(''"'', ''&quot;'', $form[pref]);\r\n	$form[action] = explode(",", $form[action]);\r\n	$canviewform = unserialize($vbulletin->options[''canviewform'']);\r\n	$form[usergroups] = explode(",", $form[usergroups]);\r\n	foreach ($vbulletin->usergroupcache AS $usergroupid => $usergroup)\r\n	{\r\n		if (!in_array($usergroupid, $canviewform))\r\n		{\r\n			continue;\r\n		}\r\n		$usergroupoptions .= "<div style=\\"float: $stylevar[left]; width: auto;\\"><label for=\\"u_$usergroupid\\"><input type=\\"checkbox\\" name=\\"usergroups[]\\" value=\\"".$usergroup[usergroupid]."\\"";\r\n		if ($form[usergroups] && in_array($usergroupid, $form[usergroups]))\r\n		{\r\n			$usergroupoptions .= " checked=\\"checked\\"";\r\n		}\r\n		$usergroupoptions .= " id=\\"u_$usergroupid\\" />".$usergroup[title]."</label> &nbsp; </div> \\n";\r\n	}\r\n	$forumoptions = ''<select name="forumid" id="forumid">'';\r\n	foreach ($vbulletin->forumcache AS $forumid => $forum)\r\n	{\r\n		$forumoptions .= ''<option value="''.$forumid.''"'';\r\n		if ($forumid == $form[forumid])\r\n		{\r\n			$forumoptions .= '' selected="selected" '';\r\n		}\r\n		$forumoptions .= ''>'' . $forum[title_clean] . ''</option>'';\r\n	}\r\n	$forumoptions .= ''</select>''; \r\n	$formbits = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");\r\n	while($formbit = $db->fetch_array($formbits))\r\n	{\r\n		if ($formbit[''type''] == 1)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[text_field]);\r\n		}\r\n		elseif ($formbit[''type''] == 2)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[yesno]);\r\n		}\r\n		elseif ($formbit[''type''] == 3)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[radio_buttons]);\r\n		}\r\n		elseif ($formbit[''type''] == 4)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[checkboxes]);\r\n		}\r\n		elseif ($formbit[''type''] == 5)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[dropdown]);\r\n		}\r\n		elseif ($formbit[''type''] == 6)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[textarea]);\r\n		}\r\n		elseif ($formbit[''type''] == 7)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[section]);\r\n		}\r\n		elseif ($formbit[''type''] == 8)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[vbeditor]);\r\n		}\r\n		elseif ($formbit[''type''] == 9)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[humanverify]);\r\n		}\r\n		elseif ($formbit[''type''] == 10)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[custom]);\r\n		}\r\n		elseif ($formbit[''type''] == 11)\r\n		{\r\n			$formbit[''type''] = construct_phrase($vbphrase[date]);\r\n		}\r\n		if ($formbit[''type''] != 7)\r\n		{\r\n			$question++;\r\n		}\r\n		eval(''$formqaas .= "'' . fetch_template(''form_formbit'') . ''";'');\r\n	}\r\n	eval(''$html = "'' . fetch_template(''form_edit'') . ''";'');\r\n	$headinclude .= <<<JAVASCRIPT\r\n<script language="javascript" type="text/javascript">\r\nfunction deleteq(id, fid) \r\n{\r\n	if (confirm("Are you sure you want to delete this question?")) {\r\n		window.location.href = ''misc.php?do=deleteq&id='' + id + ''&fid='' + fid;\r\n	}\r\n}\r\n</script>\r\nJAVASCRIPT;\r\n	$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list(), true); \r\n	$form[''title''] = $bbcode_parser->do_parse($form[''title''],false,true,true,true,false,false);\r\n	$navbits = construct_navbits(array(\r\n		''misc.php?do=forms'' . $vbulletin->session->vars[''sessionurl_q''] => construct_phrase($vbphrase[''forms'']),\r\n		''misc.php?do=form&fid='' . $form[''fid''] . $vbulletin->session->vars[''sessionurl_q''] => construct_phrase($form[''title'']),\r\n		'''' => construct_phrase($vbphrase[''edit_form''])\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}\r\nif ($_POST[''do''] == ''updateqorder'') \r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''p'', ''fid'', TYPE_UINT);\r\n	$order = $vbulletin->input->clean_gpc(''p'', ''order'', TYPE_ARRAY);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$formbits = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");\r\n	if (!$formbits)\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	if (is_array($order))\r\n	{\r\n		while($formbit = $db->fetch_array($formbits))\r\n		{\r\n			if (!isset($order["$formbit[id]"]))\r\n			{\r\n				continue;\r\n			}\r\n			$displayorder = intval($order["$formbit[id]"]);\r\n			if ($formbit[''displayorder''] != $displayorder)\r\n			{\r\n				$db->query_write("UPDATE " . TABLE_PREFIX . "formbits SET displayorder = ''".$displayorder."'' WHERE id=''" . $formbit[''id''] . "''");\r\n			}\r\n		}\r\n	}\r\n	$vbulletin->url = "misc.php?do=editform&fid=$fid#qs";	\r\n	eval(print_standard_redirect(''redirect_deleteq''));\r\n}\r\nif ($_REQUEST[''do''] == ''copyform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$copies = $vbulletin->input->clean_gpc(''g'', ''copies'', TYPE_UINT);\r\n	if (empty($copies) || $copies == 0)\r\n	{\r\n		$errormessage = "Error, number of copies not specified.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	if ($copies > 99)\r\n	{\r\n		$copies = 99;\r\n	}\r\n	$form = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forms WHERE fid = $fid");\r\n	if (!$form)\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$i = 0;\r\n	while ($i < $copies)\r\n	{\r\n		print_r("Copy $i <br />");\r\n		$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "forms\r\n		(title, description, displayorder, action, threadtitle, category, polloptions, poll, publicpoll, multiplepoll, pollquestion, usergroups, submitmessage, formoutput, attach, preq, pstq, prea, psta, pres, psts, pref, pstf, beforesubmit, formstart, email, threadid, pmrec, polltimeout, prefixid, forumid, preview, showonfl)\r\n		VALUES (''" . $db->escape_string($form[''title'']) . "'',\r\n			''" . $db->escape_string($form[''description'']) . "'',\r\n			''" . $db->escape_string($form[''displayorder'']) . "'',\r\n			''" . $db->escape_string($form[''action'']) . "'',\r\n			''" . $db->escape_string($form[''threadtitle'']) . "'', \r\n			''" . $db->escape_string($form[''category'']) . "'',\r\n			''" . $db->escape_string($form[''polloptions'']) . "'', \r\n			''" . $db->escape_string($form[''poll'']) . "'', \r\n			''" . $db->escape_string($form[''publicpoll'']) . "'',\r\n			''" . $db->escape_string($form[''multiplepoll'']) . "'', \r\n			''" . $db->escape_string($form[''pollquestion'']) . "'',\r\n			''" . $db->escape_string($form[''usergroups'']) . "'',\r\n			''" . $db->escape_string($form[''submitmessage'']) . "'',\r\n			''" . $db->escape_string($form[''formoutput'']) . "'',\r\n			''" . $db->escape_string($form[''attach'']) . "'',\r\n			''" . $db->escape_string($form[''preq'']) . "'',\r\n			''" . $db->escape_string($form[''pstq'']) . "'',\r\n			''" . $db->escape_string($form[''prea'']) . "'',\r\n			''" . $db->escape_string($form[''psta'']) . "'',\r\n			''" . $db->escape_string($form[''pres'']) . "'',\r\n			''" . $db->escape_string($form[''psts'']) . "'',\r\n			''" . $db->escape_string($form[''pref'']) . "'',\r\n			''" . $db->escape_string($form[''pstf'']) . "'',\r\n			''" . $db->escape_string($form[''beforesubmit'']) . "'',\r\n			''" . $db->escape_string($form[''formstart'']) . "'',\r\n			''" . $db->escape_string($form[''email'']) . "'',\r\n			''" . $db->escape_string($form[''threadid'']) . "'',\r\n			''" . $db->escape_string($form[''pmrec'']) . "'',\r\n			''" . $db->escape_string($form[''polltimeout'']) . "'',\r\n			''" . $db->escape_string($form[''prefixid'']) . "'',\r\n			''" . $db->escape_string($form[''forumid'']) . "'',\r\n			''" . $db->escape_string($form[''preview'']) . "'',\r\n			''" . $db->escape_string($form[''showonfl'']) . "'')\r\n		");\r\n		$newfid = $vbulletin->db->insert_id();\r\n		$formbits = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");\r\n		while ($question = $db->fetch_array($formbits))\r\n		{\r\n			$db->query_write("\r\n				INSERT INTO " . TABLE_PREFIX . "formbits\r\n					(fid, displayorder, type, question, description, options, compulsory, rows, cols, maxlength, size, perrow, ereg, custom, guestonly)\r\n				VALUES\r\n					(''" . $newfid . "'',\r\n					''" . $db->escape_string($question[''displayorder'']) . "'',\r\n					''" . $db->escape_string($question[''type'']) . "'',\r\n					''" . $db->escape_string($question[''question'']) . "'',\r\n					''" . $db->escape_string($question[''description'']) . "'',\r\n					''" . $db->escape_string($question[''options'']) . "'',\r\n					''" . $db->escape_string($question[''compulsory'']) . "'',\r\n					''" . $db->escape_string($question[''rows'']) . "'',\r\n					''" . $db->escape_string($question[''cols'']) . "'',\r\n					''" . $db->escape_string($question[''maxlength'']) . "'',\r\n					''" . $db->escape_string($question[''size'']) . "'',\r\n					''" . $db->escape_string($question[''perrow'']) . "'',\r\n					''" . $db->escape_string($question[''ereg'']) . "'',\r\n					''" . $db->escape_string($question[''custom'']) . "'',\r\n					''" . $db->escape_string($question[''guestonly'']) . "''\r\n					)\r\n			");\r\n		}\r\n		$i++;\r\n	}\r\n\r\n	$vbulletin->url = "misc.php?do=forms";	\r\n	eval(print_standard_redirect(''redirect_copyform''));\r\n}\r\nif ($_REQUEST[''do''] == ''exportform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''g'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$form = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forms WHERE fid = $fid");\r\n	if (!$form)\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	require_once(DIR . ''/includes/class_xml.php'');\r\n	$xml = new vB_XML_Builder($vbulletin);\r\n	$xml->add_group(''form'');\r\n	\r\n	$xml->add_tag(''title'', $form[''title'']);\r\n	$xml->add_tag(''description'', $form[''description'']);\r\n	$xml->add_tag(''displayorder'', $form[''displayorder'']);\r\n	$xml->add_tag(''action'', $form[''action'']);\r\n	$xml->add_tag(''threadtitle'', $form[''threadtitle'']);\r\n	$xml->add_tag(''category'', $form[''category'']);\r\n	$xml->add_tag(''polloptions'', $form[''polloptions'']);\r\n	$xml->add_tag(''poll'', $form[''poll'']);\r\n	$xml->add_tag(''publicpoll'', $form[''publicpoll'']);\r\n	$xml->add_tag(''multiplepoll'', $form[''multiplepoll'']);\r\n	$xml->add_tag(''pollquestion'', $form[''pollquestion'']);\r\n	$xml->add_tag(''usergroups'', $form[''usergroups'']);\r\n	$xml->add_tag(''submitmessage'', $form[''submitmessage'']);\r\n	$xml->add_tag(''formoutput'', $form[''formoutput'']);\r\n	$xml->add_tag(''attach'', $form[''attach'']);\r\n	$xml->add_tag(''preq'', $form[''preq'']);\r\n	$xml->add_tag(''pstq'', $form[''pstq'']);\r\n	$xml->add_tag(''prea'', $form[''prea'']);\r\n	$xml->add_tag(''psta'', $form[''psta'']);\r\n	$xml->add_tag(''pres'', $form[''pres'']);\r\n	$xml->add_tag(''psts'', $form[''psts'']);\r\n	$xml->add_tag(''pref'', $form[''pref'']);\r\n	$xml->add_tag(''pstf'', $form[''pstf'']);\r\n	$xml->add_tag(''beforesubmit'', $form[''beforesubmit'']);\r\n	$xml->add_tag(''formstart'', $form[''formstart'']);\r\n	$xml->add_tag(''email'', $form[''email'']);\r\n	$xml->add_tag(''threadid'', $form[''threadid'']);\r\n	$xml->add_tag(''pmrec'', $form[''pmrec'']);\r\n	$xml->add_tag(''polltimeout'', $form[''polltimeout'']);\r\n	$xml->add_tag(''prefixid'', $form[''prefixid'']);\r\n	$xml->add_tag(''forumid'', $form[''forumid'']);\r\n	$xml->add_tag(''preview'', $form[''preview'']);\r\n	$xml->add_tag(''showonfl'', $form[''showonfl'']);\r\n	\r\n	$xml->add_group(''questions'');\r\n	\r\n	$formbits = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE fid = $fid ORDER BY displayorder ASC");\r\n	while ($formbit = $db->fetch_array($formbits))\r\n	{\r\n		$xml->add_group(''question'', array(\r\n			''id''            => $formbit[''id''],\r\n			''fid''           => $formbit[''fid''],\r\n			''displayorder''  => $formbit[''displayorder''],\r\n			''type''          => $formbit[''type''],\r\n			''compulsory''    => $formbit[''compulsory''],\r\n			''rows''          => $formbit[''rows''],\r\n			''cols''          => $formbit[''cols''],\r\n			''maxlength''     => $formbit[''maxlength''],\r\n			''size''          => $formbit[''size''],\r\n			''perrow''        => $formbit[''perrow''],\r\n			''guestonly''     => $formbit[''guestonly''],\r\n		));\r\n				$xml->add_tag(''question'', $formbit[''question'']);\r\n				$xml->add_tag(''description'', $formbit[''description'']);\r\n				$xml->add_tag(''options'', $formbit[''options'']);\r\n				$xml->add_tag(''ereg'', $formbit[''ereg'']);\r\n				$xml->add_tag(''custom'', $formbit[''custom'']);\r\n		$xml->close_group();\r\n	}\r\n	\r\n	$xml->close_group();\r\n	\r\n	$xml->close_group();\r\n	\r\n	$doc = "<?xml version=\\"1.0\\" encoding=\\"ISO-8859-1\\"?>\\r\\n\\r\\n" . $xml->output();\r\n	\r\n	unset($xml);\r\n\r\n	require_once(DIR . ''/includes/functions_file.php'');\r\n	file_download($doc, "form-id-" . $fid . ''.xml'', ''text/xml'');\r\n	\r\n	exit;\r\n}\r\nif ($_POST[''do''] == ''importform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	require_once(DIR . ''/includes/adminfunctions.php'');\r\n	$vbulletin->input->clean_array_gpc(''f'', array(\r\n		''formfile'' => TYPE_FILE\r\n	));\r\n	if (file_exists($vbulletin->GPC[''formfile''][''tmp_name'']))\r\n	{\r\n		$xml = file_read($vbulletin->GPC[''formfile''][''tmp_name'']);\r\n	}\r\n	else\r\n	{\r\n		$errormessage = "Error, no file to import.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	require_once(DIR . ''/includes/class_xml.php'');\r\n	$xmlobj = new vB_XML_Parser($xml);\r\n	if ($xmlobj->error_no == 1)\r\n	{\r\n		$errormessage = "Error, no xml and no path.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	if(!$arr = $xmlobj->parse())\r\n	{\r\n		$errormessage = "XML Error " . $xmlobj->error_string() . " at line " . $xmlobj->error_line();\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$info = array( \r\n		''title''           => $arr[''title''],\r\n		''description''     => $arr[''description''],\r\n		''displayorder''    => $arr[''displayorder''],\r\n		''action''          => $arr[''action''],\r\n		''threadtitle''     => $arr[''threadtitle''],\r\n		''category''        => $arr[''category''],\r\n		''polloptions''     => $arr[''polloptions''],\r\n		''poll''            => $arr[''poll''],\r\n		''publicpoll''      => $arr[''publicpoll''],\r\n		''multiplepoll''    => $arr[''multiplepoll''],\r\n		''pollquestion''    => $arr[''pollquestion''],\r\n		''usergroups''      => $arr[''usergroups''],\r\n		''submitmessage''   => $arr[''submitmessage''],\r\n		''formoutput''      => $arr[''formoutput''],\r\n		''preq''            => $arr[''preq''],\r\n		''pstq''            => $arr[''pstq''],\r\n		''pres''            => $arr[''pres''],\r\n		''psts''            => $arr[''psts''],\r\n		''prea''            => $arr[''prea''],\r\n		''psta''            => $arr[''psta''],\r\n		''pref''            => $arr[''pref''],\r\n		''pstf''            => $arr[''pstf''],\r\n		''beforesubmit''    => $arr[''beforesubmit''],\r\n		''formstart''       => $arr[''formstart''],\r\n		''email''           => $arr[''email''],\r\n		''forumid''         => $arr[''forumid''],\r\n		''threadid''        => $arr[''threadid''],\r\n		''pmrec''           => $arr[''pmrec''],\r\n		''polltimeout''     => $arr[''polltimeout''],\r\n		''attach''          => $arr[''attach''],\r\n		''prefixid''        => $arr[''prefixid''],\r\n		''preview''         => $arr[''preview''],\r\n		''showonfl''        => $arr[''showonfl'']\r\n	);\r\n	$db->query_write("\r\n		INSERT INTO " . TABLE_PREFIX . "forms\r\n			(title, description, displayorder, action, threadtitle, category, polloptions, poll, publicpoll, multiplepoll, pollquestion, usergroups, submitmessage, formoutput, attach, preq, pstq, pres, psts, prea, psta, pref, pstf, beforesubmit, formstart, email, forumid, threadid, pmrec, polltimeout, prefixid, preview, showonfl)\r\n		VALUES\r\n			(''" . $db->escape_string($info[''title'']) . "'',\r\n			''" . $db->escape_string($info[''description'']) . "'',\r\n			''" . $db->escape_string($info[''displayorder'']) . "'',\r\n			''" . $db->escape_string($info[''action'']) . "'',\r\n			''" . $db->escape_string($info[''threadtitle'']) . "'', \r\n			''" . $db->escape_string($info[''category'']) . "'',\r\n			''" . $db->escape_string($info[''polloptions'']) . "'', \r\n			''" . $db->escape_string($info[''poll'']) . "'', \r\n			''" . $db->escape_string($info[''publicpoll'']) . "'',\r\n			''" . $db->escape_string($info[''multiplepoll'']) . "'', \r\n			''" . $db->escape_string($info[''pollquestion'']) . "'',\r\n			''" . $db->escape_string($info[''usergroups'']) . "'',\r\n			''" . $db->escape_string($info[''submitmessage'']) . "'',\r\n			''" . $db->escape_string($info[''formoutput'']) . "'',\r\n			''" . $db->escape_string($info[''attach'']) . "'',\r\n			''" . $db->escape_string($info[''preq'']) . "'',\r\n			''" . $db->escape_string($info[''pstq'']) . "'',\r\n			''" . $db->escape_string($info[''pres'']) . "'',\r\n			''" . $db->escape_string($info[''psts'']) . "'',\r\n			''" . $db->escape_string($info[''prea'']) . "'',\r\n			''" . $db->escape_string($info[''psta'']) . "'',\r\n			''" . $db->escape_string($info[''pref'']) . "'',\r\n			''" . $db->escape_string($info[''pstf'']) . "'',\r\n			''" . $db->escape_string($info[''beforesubmit'']) . "'',\r\n			''" . $db->escape_string($info[''formstart'']) . "'',\r\n			''" . $db->escape_string($info[''email'']) . "'',\r\n			''" . $db->escape_string($info[''forumid'']) . "'',\r\n			''" . $db->escape_string($info[''threadid'']) . "'',\r\n			''" . $db->escape_string($info[''pmrec'']) . "'',\r\n			''" . $db->escape_string($info[''polltimeout'']) . "'',\r\n			''" . $db->escape_string($info[''prefixid'']) . "'',\r\n			''" . $db->escape_string($info[''preview'']) . "'',\r\n			''" . $db->escape_string($info[''showonfl'']) . "''\r\n			)\r\n		");\r\n	$fid = $vbulletin->db->insert_id();\r\n	\r\n	if (is_array($arr[''questions''][''question'']))\r\n	{\r\n		$questions =& $arr[''questions''][''question''];\r\n		if (!isset($questions[0]))\r\n		{\r\n			$questions = array($questions);\r\n		}\r\n	}\r\n	if (is_array($questions))\r\n	{\r\n		foreach ($questions AS $question)\r\n		{\r\n			$db->query_write("\r\n				INSERT INTO " . TABLE_PREFIX . "formbits\r\n					(fid, displayorder, type, question, description, options, compulsory, rows, cols, maxlength, size, perrow, ereg, custom, guestonly)\r\n				VALUES\r\n					(''" . $fid . "'',\r\n					''" . $db->escape_string($question[''displayorder'']) . "'',\r\n					''" . $db->escape_string($question[''type'']) . "'',\r\n					''" . $db->escape_string($question[''question'']) . "'',\r\n					''" . $db->escape_string($question[''description'']) . "'',\r\n					''" . $db->escape_string($question[''options'']) . "'',\r\n					''" . $db->escape_string($question[''compulsory'']) . "'',\r\n					''" . $db->escape_string($question[''rows'']) . "'',\r\n					''" . $db->escape_string($question[''cols'']) . "'',\r\n					''" . $db->escape_string($question[''maxlength'']) . "'',\r\n					''" . $db->escape_string($question[''size'']) . "'',\r\n					''" . $db->escape_string($question[''perrow'']) . "'',\r\n					''" . $db->escape_string($question[''ereg'']) . "'',\r\n					''" . $db->escape_string($question[''custom'']) . "'',\r\n					''" . $db->escape_string($question[''guestonly'']) . "''\r\n					)\r\n			");\r\n		}\r\n	}\r\n	$vbulletin->url = "misc.php?do=editform&fid=$fid";	\r\n	eval(print_standard_redirect(''redirect_insertform'', true));\r\n}\r\nif ($_POST[''do''] == ''addq'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$fid = $vbulletin->input->clean_gpc(''p'', ''fid'', TYPE_UINT);\r\n	if (empty($fid))\r\n	{\r\n		$errormessage = "Error, this form does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$type = $vbulletin->input->clean_gpc(''p'', ''type'', TYPE_UINT);\r\n	if (empty($type))\r\n	{\r\n		$errormessage = "Error";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$typetext = $type;\r\n	if ($typetext == 1)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[text_field]);\r\n	}\r\n	elseif ($typetext == 2)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[yesno]);\r\n	}\r\n	elseif ($typetext == 3)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[radio_buttons]);\r\n	}\r\n	elseif ($typetext == 4)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[checkboxes]);\r\n	}\r\n	elseif ($typetext == 5)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[dropdown]);\r\n	}\r\n	elseif ($typetext == 6)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[textarea]);\r\n	}\r\n	elseif ($typetext == 7)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[section]);\r\n	}\r\n	elseif ($typetext == 8)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[vbeditor]);\r\n	}\r\n	elseif ($typetext == 9)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[humanverify]);\r\n	}\r\n	elseif ($typetext == 10)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[custom]);\r\n	}\r\n	elseif ($typetext == 11)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[date]);\r\n	}\r\n	$count = $vbulletin->db->query_first("SELECT COUNT(*) AS countrows FROM " . TABLE_PREFIX . "formbits WHERE fid=$fid");\r\n	$displayorder = $count[countrows] * 10 + 10;\r\n	eval(''$html .= "'' . fetch_template(''form_addq'') . ''";'');\r\n	$navbits = construct_navbits(array(\r\n		''misc.php?do=forms'' . $vbulletin->session->vars[''sessionurl_q''] => construct_phrase($vbphrase[''forms'']),\r\n		'''' => construct_phrase($vbphrase[''add_question''])\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}\r\nif ($_REQUEST[''do''] == ''editq'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	$id = $vbulletin->input->clean_gpc(''r'', ''id'', TYPE_UINT);\r\n	if (empty($id))\r\n	{\r\n		$errormessage = "Error, this question does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$q = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "formbits WHERE id = $id");\r\n	if (empty($q))\r\n	{\r\n		$errormessage = "Error, this question does not exist.";\r\n       	eval(''print_output("'' . fetch_template(''STANDARD_ERROR'') . ''");'');\r\n	}\r\n	$q[question] = htmlspecialchars($q[question]);\r\n	$typetext = $q[''type''];\r\n	if ($typetext == 1)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[text_field]);\r\n	}\r\n	elseif ($typetext == 2)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[yesno]);\r\n	}\r\n	elseif ($typetext == 3)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[radio_buttons]);\r\n	}\r\n	elseif ($typetext == 4)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[checkboxes]);\r\n	}\r\n	elseif ($typetext == 5)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[dropdown]);\r\n	}\r\n	elseif ($typetext == 6)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[textarea]);\r\n	}\r\n	elseif ($typetext == 7)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[section]);\r\n	}\r\n	elseif ($typetext == 8)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[vbeditor]);\r\n	}\r\n	elseif ($typetext == 9)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[humanverify]);\r\n	}\r\n	elseif ($typetext == 10)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[custom]);\r\n	}\r\n	elseif ($typetext == 11)\r\n	{\r\n		$typetext = construct_phrase($vbphrase[date]);\r\n	}\r\n	eval(''$html .= "'' . fetch_template(''form_editq'') . ''";'');\r\n	$navbits = construct_navbits(array(\r\n		''misc.php?do=forms'' . $vbulletin->session->vars[''sessionurl_q''] => construct_phrase($vbphrase[''forms'']),\r\n		'''' => construct_phrase($vbphrase[''edit_question''])\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}\r\nif ($_REQUEST[''do''] == ''newform'')\r\n{\r\n	$caneditform = unserialize($vbulletin->options[''caneditform'']);\r\n	if (!$caneditform OR !is_member_of($vbulletin->userinfo, $caneditform))\r\n	{\r\n		print_no_permission();\r\n	}\r\n	eval(''$html = "'' . fetch_template(''form_new'') . ''";'');\r\n	$navbits = construct_navbits(array(\r\n		''misc.php?do=forms'' . $vbulletin->session->vars[''sessionurl_q''] => construct_phrase($vbphrase[''forms'']),\r\n		'''' => construct_phrase($vbphrase[''add_new_form''])\r\n	));\r\n	eval(''$navbar = "'' . fetch_template(''navbar'') . ''";'');\r\n	eval(''print_output("'' . fetch_template(''shell_blank'') . ''");'');\r\n}', 'easyforms', '', 1, 5),
(763, 'Easy Forms Templates', 'cache_templates', 'if (THIS_SCRIPT === misc AND (in_array($_REQUEST[''do''], array(''form'', ''forms'', ''newform'', ''newq'', ''editq'', ''editform'', ''formresults'')) OR in_array($_POST[''do''], array(''addq'', ''postform''))))\r\n{\r\n	define(''GET_EDIT_TEMPLATES'', true);\r\n	$globaltemplates = array_merge($globaltemplates, array(\r\n		''form_formbit_textarea'',\r\n		''form_formbit_dropdown_option'',\r\n		''form_formbit_dropdown'',\r\n		''form_formbit_checkboxes'',\r\n		''form_formbit_checkboxes_option'',\r\n		''form_formbit_radiobuttons_option'',\r\n		''form_formbit_radiobuttons'',\r\n		''form_formbit_yesno'',\r\n		''form_formbit_attach'',\r\n		''form_formbit_textfield'',\r\n		''form_formbit_section'',\r\n		''form_formbit_vbeditor'',\r\n		''form_formbit_custom'',\r\n		''form_formbit_date'',\r\n		''form_formbit_humanverify'',\r\n		''humanverify'',\r\n		''humanverify_image'',\r\n		''form_formbit'',\r\n		''form_addq'',\r\n		''form_editq'',\r\n		''form_view'',\r\n		''form_edit'',\r\n		''form_new'',\r\n		''form_list_bit'',\r\n		''form_list_top'',\r\n		''form_list_cat'',\r\n		''form_list_bot'',\r\n		''form_list_none'',\r\n		''shell_blank'',\r\n		''form_showoutput'',\r\n		''newpost_disablesmiliesoption'',\r\n		''editor_toolbar_on'',\r\n		''editor_smiliebox_straggler'',\r\n		''editor_smiliebox_row'',\r\n		''editor_smiliebox'',\r\n		''editor_smilie'',\r\n		''editor_jsoptions_size'',\r\n		''editor_jsoptions_font'',\r\n		''editor_css'',\r\n		''editor_clientscript'',\r\n		''newpost_attachment'',\r\n		''newpost_attachmentbit'',\r\n	));\r\n	$specialtemplates = array_merge($specialtemplates, array(\r\n		''bbcodecache'',\r\n		''smiliecache'',\r\n	));\r\n	require_once(DIR . ''/includes/class_bbcode.php''); \r\n}', 'easyforms', '', 1, 4),
(764, 'Easy Forms AutoInsert Links', 'global_start', 'if ($vbulletin->options[''easy_forms_navbar''] && $vbulletin->options[''canviewformlist''] && is_member_of($vbulletin->userinfo, unserialize($vbulletin->options[''canviewformlist'']))) { $ef_navbar_link = "<td class=\\"vbmenu_control\\"><a href=\\"".$vbulletin->options[''bburl'']."/misc.php$session[sessionurl_q]?do=forms\\">$vbphrase[forms]</a></td>";\r\neval(''$template_hook[navbar_buttons_left] .= $ef_navbar_link;''); }\r\nif ($vbulletin->options[''easy_forms_quicklinks''] && $vbulletin->options[''canviewformlist''] && is_member_of($vbulletin->userinfo, unserialize($vbulletin->options[''canviewformlist'']))) { $ef_quicklinks = "<tr><td class=\\"vbmenu_option\\"><a href=\\"".$vbulletin->options[''bburl'']."/misc.php$session[sessionurl_q]?do=forms\\">$vbphrase[forms]</a></td></tr>"; \r\neval(''$template_hook[navbar_quick_links_menu_pos4] .= $ef_quicklinks;''); }', 'easyforms', '', 1, 2),
(765, 'Easy Forms Add Phrasegroups', 'init_startup', 'if (THIS_SCRIPT === misc AND (in_array($_REQUEST[''do''], array(''form'', ''forms'', ''newform'', ''newq'', ''editq'', ''editform'', ''formresults'')) OR in_array($_POST[''do''], array(''addq'', ''postform''))))\r\n{\r\n	$phrasegroups = array_merge($phrasegroups, array(''posting'', ''poll''));\r\n	if ($vbulletin->options[simpleversion] >= 370)\r\n	{\r\n		$phrasegroups[] = ''prefix'';\r\n	}\r\n}', 'easyforms', '', 1, 2),
(766, 'Force visible post', 'newpost_process', 'if ($newpost[forcevisible])\r\n{\r\n$dataman->set(''visible'', 1);\r\n$post[''visible''] = 1;\r\n}', 'easyforms', '', 1, 5);
INSERT INTO `plugin` (`pluginid`, `title`, `hookname`, `phpcode`, `product`, `devkey`, `active`, `executionorder`) VALUES
(767, 'Usergroup Permissions', 'admin_options_processing', '//Can View Selected Usergroups Today''s Top Poster(s) List.\r\n\r\nif ($oldsetting[''varname''] == todays_top_posters_visible_groups)\r\n{\r\n	$settings["$oldsetting[varname]"] = implode('','', $vbulletin->GPC[''setting''][''todays_top_posters_visible_groups'']);\r\n}', 'todays_top_poster', '', 1, 5),
(768, 'Cache Templates', 'cache_templates', 'if ($vbulletin->options[''todays_top_poster'']) \r\n{\r\n\r\n$groups = explode('','',$vbulletin->options[''todays_top_posters_visible_groups'']);  \r\nif (!(is_member_of($vbulletin->userinfo,$groups) OR $vbulletin->userinfo[''usergroupid''] == 6 OR $groups[0] == 0)) \r\n{\r\n    $show[''todays_top_poster'']= false; \r\n}\r\nelse \r\n{ \r\n    $show[''todays_top_poster'']= true; \r\n}\r\n\r\n}\r\n\r\nif ($show[''todays_top_poster''])  \r\n{ \r\n$globaltemplates[] = ''todays_top_poster'' ; \r\n$globaltemplates[] = ''todays_top_poster_bit'' ; \r\n}', 'todays_top_poster', '', 1, 5),
(769, 'Todays Top Poster(s)', 'forumhome_start', 'if ($show[''todays_top_poster'']) \r\n{ \r\n$todays_top_posters = ''''; \r\n$limit = $vbulletin->options[''todays_top_posters_limit'']; \r\n$exclude_usergroups = $vbulletin->options[''todays_top_posters_usergroups'']; \r\n$exclude_users = $vbulletin->options[''todays_top_posters_users'']; \r\n\r\nif ($vbulletin->options[''24_hours_top_posters'']) \r\n{ \r\n$top_posters_title = $vbphrase[''24_hours_top_posters'']; \r\n$dateline = TIMENOW - 86400;\r\n} \r\nelse \r\n{ \r\n$top_posters_title = $vbphrase[''todays_top_posters'']; \r\n$currenttime  = date(''YmdHis'',TIMENOW - intval($vbulletin->options[''hourdiff'']));  \r\n$dateline = TIMENOW - (substr($currenttime, 8, 2) * 3600 + substr($currenttime, 10, 2) * 60 + substr($currenttime, 12, 2));  \r\n} \r\nunset ($todays_top_posters); \r\n\r\n\r\n$top_posters = $vbulletin->db->query_read_slave(" \r\nSELECT COUNT(post.dateline) AS postcount, post.userid, user.userid, \r\nuser.username, user.lastpost, user.lastpostid, user.posts, user.usergroupid, \r\nIF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid \r\nFROM " . TABLE_PREFIX . "post AS post \r\nLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid) \r\n" . iif(!empty($exclude_usergroups), "AND user.usergroupid NOT IN ($exclude_usergroups)") . " \r\n" . iif(!empty($exclude_users), "AND user.userid NOT IN ($exclude_users)") . " \r\nWHERE dateline > $dateline AND user.posts != ''0''\r\nGROUP BY post.userid  \r\nORDER BY postcount DESC\r\nLIMIT 0, $limit"); \r\n\r\nwhile($top_poster = $db->fetch_array($top_posters)){ \r\n\r\n$top_poster[musername] = fetch_musername($top_poster); \r\n\r\n$show[''comma_leader''] = ($todays_top_posters != ''''); \r\n\r\neval(''$todays_top_posters .= "'' . fetch_template(''todays_top_poster_bit'') . ''";''); \r\n\r\n} \r\n\r\neval (''$template_hook[forumhome_wgo_pos2] .= "'' . fetch_template (''todays_top_poster'') . ''";''); \r\n\r\n$db->free_result($top_posters); \r\n\r\n}', 'todays_top_poster', '', 1, 5);
