Exemplo n.º 1
0
 function execute(&$action, &$request, $do_overwrite = FALSE)
 {
     $cache = array();
     /**
      * Fileserver caching
      */
     if (!CACHE_IN_DB && USE_CACHE) {
         /* Include the cache file */
         include_dir(CACHE_DIR);
         //			if(!isset($cache) || !is_array($cache) || empty($cache)) {
         //				trigger_error('FILE: The cache array does not exist or it is empty.', E_USER_ERROR);
         //			}
     }
     /**
      * Database caching
      */
     if (CACHE_IN_DB && USE_CACHE) {
         $result = $request['dba']->executeQuery("SELECT * FROM " . K4CACHE);
         if (!$result->hasNext()) {
             trigger_error('DB: The cache array does not exist or it is empty.', E_USER_ERROR);
         }
         while ($result->next()) {
             $temp = $result->current();
             $cache[$temp['varname']] = force_unserialize($temp['data']);
             unset($temp);
             // memory saving
         }
         /* Set the Global variables */
         $GLOBALS['_SETTINGS'] =& $cache['settings'];
         $GLOBALS['_MAPS'] =& $cache['maps'];
         $GLOBALS['_USERGROUPS'] =& $cache['usergroups'];
         $GLOBALS['_ACRONYMS'] =& $cache['acronyms'];
         $GLOBALS['_CENSORS'] =& $cache['censors'];
         $GLOBALS['_SPIDERS'] =& $cache['spiders'];
         $GLOBALS['_SPIDERAGENTS'] =& $cache['spider_agents'];
         $GLOBALS['_PROFILEFIELDS'] =& $cache['profile_fields'];
         $GLOBALS['_ALLFORUMS'] =& $cache['all_forums'];
         $GLOBALS['_FLAGGEDUSERS'] =& $cache['flagged_users'];
         $GLOBALS['_BANNEDUSERIDS'] =& $cache['banned_user_ids'];
         $GLOBALS['_BANNEDUSERIPS'] =& $cache['banned_user_ips'];
         $GLOBALS['_STYLESETS'] =& $cache['styles'];
         $GLOBALS['_FAQCATEGORIES'] =& $cache['faq_categories'];
         $GLOBALS['_MAILQUEUE'] = isset($cache['mail_queue']) ? $cache['mail_queue'] : array();
         $GLOBALS['_DATASTORE'] = isset($cache['datastore']) ? $cache['datastore'] : array();
         $GLOBALS['_USERTITLES'] =& $cache['user_titles'];
         $GLOBALS['_FILTERS'] =& $cache['filters'];
         $GLOBALS['_FORUMFILTERS'] =& $cache['forum_filters'];
     }
     /**
      * Make sure the cache files exist
      */
     if (!CACHE_IN_DB && USE_CACHE) {
         if (!isset($GLOBALS['_SETTINGS']) || !isset($GLOBALS['_MAPS']) || !isset($GLOBALS['_ALLFORUMS'])) {
             /* Create the cache file using the class functions */
             $methods = get_class_methods($this);
             foreach ($methods as $function) {
                 if (substr($function, 0, 6) == 'cache_') {
                     $this->{$function}($cache, $request);
                 }
             }
             /* Create the cache file */
             DBCache::createCache($cache);
         }
     }
     /* Add the extra values onto the end of the userinfo query params variable */
     global $_QUERYPARAMS;
     if (is_array($GLOBALS['_PROFILEFIELDS']) && !empty($GLOBALS['_PROFILEFIELDS'])) {
         foreach ($GLOBALS['_PROFILEFIELDS'] as $temp) {
             $_QUERYPARAMS['userinfo'] .= ', ui.' . $temp['name'] . ' AS ' . $temp['name'];
         }
     }
     $GLOBALS['_QUERYPARAMS'] = $_QUERYPARAMS;
     /* Execute the queue after we get/check the cached file(s) */
     //execute_mail_queue($request['dba'], $cache['mail_queue']);
     /* Add all of the forums to the template */
     global $_ALLFORUMS;
     $all_forums = new AllForumsIterator($_ALLFORUMS);
     $request['template']->setList('all_forums', $all_forums);
     return FALSE;
 }
Exemplo n.º 2
0
 function execute(&$request)
 {
     global $_QUERYPARAMS, $_DATASTORE, $_USERGROUPS, $_PROFILEFIELDS;
     /* unset any search queries if we are about to go look at this users posts */
     unset($_SESSION['search_queries']);
     if ($request['user']->get('perms') < get_map('member_profile', 'can_view', array())) {
         k4_bread_crumbs($request['template'], $request['dba'], 'L_INFORMATION');
         $request['template']->setFile('content', '../login_form.html');
         $request['template']->setVisibility('no_perms', TRUE);
         return TRUE;
     }
     $member = $request['user_info'];
     $member['num_topics'] = $request['dba']->getValue("SELECT COUNT(*) FROM " . K4POSTS . " WHERE row_type=" . TOPIC . " AND poster_id = " . intval($member['id']) . " AND moved_new_post_id=0 AND is_draft=0 AND queue=0 AND display=1");
     $member['num_replies'] = $member['num_posts'] - $member['num_topics'];
     //$member['num_replies']		= $request['dba']->getValue("SELECT COUNT(*) FROM ". K4POSTS ." WHERE row_type=". REPLY ." AND poster_id = ". intval($member['id']));
     /**
      * Get and set some user/forum statistics
      */
     $num_reg_days = ceil((time() - $member['created']) / 86400);
     $postsperday = ceil($member['num_posts'] / $num_reg_days);
     $member['posts_per_day'] = sprintf($request['template']->getVar('L_POSTSPERDAY'), $postsperday);
     $num_posts = $_DATASTORE['forumstats']['num_topics'] + $_DATASTORE['forumstats']['num_replies'];
     $member['posts_percent'] = $num_posts != 0 && $member['num_posts'] != 0 ? sprintf($request['template']->getVar('L_OFTOTALPOSTS'), round($member['num_posts'] / $num_posts * 100, 3) . '%') : sprintf($request['template']->getVar('L_OFTOTALPOSTS'), '0%');
     $group = get_user_max_group($member, $_USERGROUPS);
     $member['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color'];
     $member['group_nicename'] = $group['nicename'];
     $member['group_avatar'] = $group['avatar'];
     $member['online'] = time() - ini_get('session.gc_maxlifetime') > $member['seen'] ? 'offline' : 'online';
     $result = explode('|', $member['usergroups']);
     $groups = $member['usergroups'] != '' ? !$result ? force_usergroups($member) : $result : array();
     /**
      * Get and set the user groups for this member
      */
     $usergroups = array();
     foreach ($groups as $id) {
         if (isset($_USERGROUPS[$id]) && is_array($_USERGROUPS[$id]) && !empty($_USERGROUPS[$id])) {
             $usergroups[] = $_USERGROUPS[$id];
         }
     }
     $it =& new FAArrayIterator($usergroups);
     $request['template']->setList('member_usergroups', $it);
     foreach ($member as $key => $val) {
         $request['template']->setVar('member_' . $key, $val);
     }
     /**
      * Get the custom user fields for this member
      */
     $fields = array();
     foreach ($_PROFILEFIELDS as $field) {
         if ($field['display_profile'] == 1) {
             if (isset($member[$field['name']])) {
                 //  && $member[$field['name']] != ''
                 switch ($field['inputtype']) {
                     default:
                     case 'text':
                     case 'textarea':
                     case 'select':
                         $field['value'] = $member[$field['name']] != '' ? $member[$field['name']] : $request['template']->getVar('L_NOINFORMATION');
                         break;
                     case 'multiselect':
                     case 'radio':
                     case 'check':
                         $unserialize = @unserialize($member[$field['name']]);
                         $field['value'] = $member[$field['name']] != '' ? implode(", ", !$unserialize ? force_unserialize($member[$field['name']]) : $unserialize) : $request['template']->getVar('L_NOINFORMATION');
                         break;
                 }
                 $field['value'] = preg_replace_callback('~((https?\\:\\/\\/|ftps?\\:\\/\\/)?(?:(?:[\\w\\d\\-_\\+\\.]+\\:)?(?:[\\w\\d\\-_\\+\\.]+)?\\@)?(?:[\\w\\d][\\d_\\-\\w\\.]+\\w){2,}?\\.[\\dA-Za-z]{2,7})([\\:\\/]\\S*)?~', array(&$this, 'handleUrl'), $field['value']);
                 $fields[] = $field;
             }
         }
     }
     if (count($fields) > 0) {
         if ($fields % 2 == 1) {
             $fields[count($fields) - 1]['colspan'] = 2;
         }
         $it =& new FAArrayIterator($fields);
         $request['template']->setList('member_profilefields', $it);
     }
     /**
      * Set the info we need
      */
     $request['template']->setFile('content', 'member_profile.html');
     k4_bread_crumbs($request['template'], $dba, 'L_USERPROFILE');
     return TRUE;
 }
Exemplo n.º 3
0
 function execute(&$request)
 {
     /**
      * Create two new tables
      */
     @$request['dba']->executeUpdate("DROP TABLE IF EXISTS k4_usertitles");
     @$request['dba']->executeUpdate("DROP TABLE IF EXISTS k4_cache");
     $request['dba']->executeUpdate("CREATE TABLE k4_usertitles (title_id INT UNSIGNED NOT NULL AUTO_INCREMENT,num_posts INT UNSIGNED NOT NULL DEFAULT 0,title_text VARCHAR(50) NOT NULL DEFAULT '',num_pips INT UNSIGNED NOT NULL DEFAULT 0,image VARCHAR(100) NOT NULL DEFAULT '',PRIMARY KEY(title_id));");
     $request['dba']->executeUpdate("CREATE TABLE k4_cache (varname CHAR(30) NOT NULL DEFAULT '',data LONGTEXT,modified INT UNSIGNED NOT NULL DEFAULT 0,PRIMARY KEY(varname));");
     /**
      * Insert the default user titles
      */
     $request['dba']->executeUpdate("INSERT INTO k4_usertitles (title_id,num_posts,title_text,num_pips,image) VALUES (1,0,'New',1,'');");
     $request['dba']->executeUpdate("INSERT INTO k4_usertitles (title_id,num_posts,title_text,num_pips,image) VALUES (2,10,'Still New',2,'');");
     $request['dba']->executeUpdate("INSERT INTO k4_usertitles (title_id,num_posts,title_text,num_pips,image) VALUES (3,100,'Well Known',3,'');");
     /**
      * Insert the default cache items
      */
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('acronyms', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('banned_user_ids', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('banned_user_ips', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('censors', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('datastore', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('faq_categories', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('flagged_users', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('all_forums', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('mail_queue', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('maps', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('profile_fields', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('settings', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('spiders', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('spider_agents', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('styles', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('usergroups', '', 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_cache (varname, data, modified) VALUES ('user_titles', '', 0);");
     /**
      * Insert the master forum permissions
      */
     $max_map_id = intval($request['dba']->getValue("SELECT MAX(id) FROM k4_maps") + 1);
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . $max_map_id . ", 1, 'Master Forum Permissions', 'forum0', '', 0, 0, 0, 0, 0, 0, 28, 1, 10, 10, 10);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 1) . ", 2, 'Topics', 'topics', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 5, 5, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 2) . ", 2, 'Other People''s Topics', 'other_topics', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 0, 6, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 3) . ", 2, 'Polls', 'polls', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 5, 5, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 4) . ", 2, 'Other People''s Polls', 'other_polls', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 0, 6, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 5) . ", 2, 'Replies', 'replies', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 5, 5, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 6) . ", 2, 'Other People''s Replies', 'other_replies', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 0, 6, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 7) . ", 2, 'Attachments', 'attachments', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 5, 5, 7);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 8) . ", 2, 'Vote on Polls', 'vote_on_poll', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 9) . ", 2, 'Rate Topics', 'rate_topic', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 7);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 10) . ", 2, 'Sticky Topics', 'sticky', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 7, 7, 7);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 11) . ", 2, 'Announcement Topics', 'announce', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 9, 9, 9);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 12) . ", 2, 'Featured Topics', 'feature', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 9, 9, 9);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 13) . ", 2, 'Moved Topics', 'move', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 7, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 14) . ", 2, 'Queue Topics', 'queue', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 7, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 15) . ", 2, 'Normalize Topics', 'normalize', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 7, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 16) . ", 2, 'Delete', 'delete', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 7, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 17) . ", 2, 'Closed Topics', 'closed', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 6, 6, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 18) . ", 2, 'User Avatars', 'avatars', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 0, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 19) . ", 2, 'User Signatures', 'signatures', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 0, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 20) . ", 2, 'HTML Code', 'html', 'br,a,pre,ul,li,ol,p', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 9, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 21) . ", 2, 'BB Code', 'bbcode', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 22) . ", 2, 'BB IMG Code', 'bbimgcode', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 23) . ", 2, 'BB Flash Code', 'bbflashcode', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 24) . ", 2, 'Emoticons', 'emoticons', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 25) . ", 2, 'Post Icons', 'posticons', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 26) . ", 2, 'Post Saving', 'post_save', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 27) . ", 2, 'Post Previewing', 'post_preview', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 0, 5, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 28) . ", 2, 'RSS Feeds', 'rss_feed', '', 0, 0, 0, 0, 0, " . $max_map_id . ", 0, 1, 0, 0, 0);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 29) . ", 2, 'Global Announcements', 'forum1', '', 0, 0, 1, 0, 0, 15, 0, 7, 10, 10, 10);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 30) . ", 2, 'Garbage Bin', 'forum2', '', 0, 0, 2, 0, 0, 15, 0, 7, 10, 10, 10);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 31) . ", 3, 'Topics', 'topics', '', 0, 0, 2, 0, 0, 68, 0, 1, 7, 7, 7);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 32) . ", 3, 'Other People''s Topics', 'other_topics', '', 0, 0, 2, 0, 0, 68, 0, 0, 0, 7, 7);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 33) . ", 3, 'Other People''s Replies', 'other_replies', '', 0, 0, 2, 0, 0, 68, 0, 0, 0, 6, 6);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 34) . ", 2, 'Test Category', 'category1', '', 0, 1, 0, 0, 0, 14, 0, 1, 10, 10, 10);");
     $request['dba']->executeUpdate("INSERT INTO k4_maps (id, row_level, name, varname, value, is_global, category_id, forum_id, user_id, group_id, parent_id, num_children, can_view, can_add, can_edit, can_del) VALUES (" . intval($max_map_id + 35) . ", 2, 'Test Forum', 'forum3', '', 0, 1, 3, 0, 0, 15, 0, 1, 10, 10, 10);");
     /**
      * Free up space in the MAPS table by removing all forum map perms except for the top ones
      */
     $request['dba']->executeUpdate("DELETE FROM k4_maps WHERE forum_id > 0 AND varname NOT LIKE 'forum%'");
     /**
      * Alter some tables
      */
     $request['dba']->alterTable(K4MAPS, "DROP can_view_condition");
     $request['dba']->alterTable(K4MAPS, "DROP can_edit_condition");
     $request['dba']->alterTable(K4MAPS, "DROP can_add_condition");
     $request['dba']->alterTable(K4MAPS, "DROP can_del_condition");
     $request['dba']->alterTable(K4USERINFO, "ADD user_title VARCHAR(50) NOT NULL DEFAULT ''");
     /**
      * Loop through the forums and change the way usergroups are stored
      */
     $forums = $request['dba']->executeQuery("SELECT moderating_groups,forum_id FROM k4_forums");
     while ($forums->next()) {
         $forum = $forums->current();
         $usergroups = $forum['usergroups'] != '' ? force_unserialize($forum['moderating_groups']) : array();
         $usergroups = !is_array($usergroups) ? array() : $usergroups;
         $usergroups = implode('|', $usergroups);
         $request['dba']->executeUpdate("UPDATE k4_forums SET moderating_groups = '" . $usergroups . "' WHERE forum_id=" . intval($forum['forum_id']));
     }
     $forums->free();
     /**
      * Loop through the users and change the way their usergroups are stored.. LONG
      */
     $users = $request['dba']->executeQuery("SELECT usergroups,id FROM k4_users");
     while ($users->next()) {
         $user = $users->current();
         $usergroups = $user['usergroups'] != '' ? force_unserialize($user['usergroups']) : array();
         $usergroups = !is_array($usergroups) ? array() : $usergroups;
         $usergroups = implode('|', $usergroups);
         $request['dba']->executeUpdate("UPDATE k4_users SET usergroups = '" . $usergroups . "' WHERE id=" . intval($user['id']));
     }
     $users->free();
     /**
      * Update the 'Descent' styleset
      */
     $request['dba']->executeUpdate("DELETE FROM k4_css");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('*', 'font-family: verdana, geneva, lucida, arial, helvetica, sans-serif;', 1, 'This applies to every tag.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('body', 'background-color: #EEEEEE;padding: 0px;margin: 0px;font-size: 12px;', 1, 'Everything basically :D');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.alt1', 'padding: 4px;background-color: #FAFAFA;color: #000000;', 1, 'This goes for some of the lighter background colored things.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.alt2', 'padding: 4px;background-color: #F4F4F4;color: #000000;', 1, 'This goes for some of the darker background colored things.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.alt3', 'padding: 4px;background-color: #FAFAFA;color: #000000;', 1, 'This goes for some of the darkest background colored things.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.alt4', 'padding: 4px;border: 0px;background-color: #FAFBC7;color: #000000;', 1, 'This goes for notable background colored things.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.answer', 'border: 1px solid #999999;list-style-type: none;background-color: #FFFFFF;padding: 5px;top:-2px;position: relative;width: 90%;text-align: left;', 1, 'What an answer looks like in the FAQ section.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.button', 'background: url(Images/{\$IMG_DIR}/background_button.gif) left top repeat-x;font-size: 11px;font-family: verdana, geneva, lucida, arial, helvetica, sans-serif;border-right: 1px solid #B3B3B3;border-left: 1px solid #B3B3B3;border-top: 1px solid #F6F6F7;border-bottom: 1px solid #919194;', 1, 'This applies to all form buttons with this class.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.forum_base', 'width: 98%;', 1, 'This is what surounds the entire forum.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_borderwrap', 'background: url(Images/{\$IMG_DIR}/background_left_curve.gif) left top no-repeat;', 1, 'This goes around primary tables within forum_base.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_table', 'background-color: #FAFAFA;', 1, 'This applies to all primary tables within forum_base.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.forum_footer', 'padding-left: 10px;padding-right: 10px;padding-bottom: 10px;background-color: #FFFFFF;', 1, 'The footer stuff in the forum, not including contact info, etc.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.forum_header', 'padding-left: 10px;padding-right: 10px;background-color: #FFFFFF;', 1, 'The header, not including logo image');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.forum_main', 'padding: 20px 20px 20px 20px;background-color: #FFFFFF;border: 1px solid #C2C2C2;', 1, 'The main body part of the forum.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.inputbox', ' border : 1px solid #999999;font-size:11px;', 1, 'This applies to all of the inputfields.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.inputbox:focus', 'border : 1px solid #666666;font-size:11px;', 1, 'This only works in Mozilla browsers. It makes all input fields wit hthis class, when clicked, have a highlighted border.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.inputfailed', 'border: 1px solid #FF0000;font-size:11px;background-color:#FFEEFF;', 1, 'This is for failed input fields. It is only toggled by JavaScript.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.inputnone', 'background-color: #E4E7F5;font-size:11px;text-decoration: underline;border: 0px;color: #003366;', 1, 'This is for listing the attachments.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.logo_header td', 'background-color: #E1E1E2;margin:0px 0px 0px 0px;padding: 0px 0px 0px 0px;', 1, 'This applies to the area which contains the k4 (or yours if set) logo.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.minitext, .minitext *, *.minitext', 'color: #666666; font-size:10px; padding:0px;font-style: italic;', 1, 'This is the smallest text, and this applies to all elements within the smalltext.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.outset_box', 'background-color: #f7f7f7;padding: 10px;', 1, 'This goes for the white box with outset borders.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.outset_box_small', 'padding: 5px;background-color: #F7F5F1;border-top: 1px solid #B2B2B2;border-left: 1px solid #B2B2B2;border-bottom: 1px solid #000000;border-right: 1px solid #000000;', 1, 'This goes for anything with 1px outset borders.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.inset_box_small', 'padding: 5px;background-color: #f7f7f7;border-bottom: 1px solid #B2B2B2;border-right: 1px solid #B2B2B2;border-top: 1px solid #000000;border-left: 1px solid #000000;', 1, 'This goes for anything with 1px inset borders.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.inset_box', 'border: 1px inset;padding: 10px;background-color: #f7f7f7;border-bottom: 2px solid #B2B2B2;border-right: 2px solid #B2B2B2;border-top: 2px solid #000000;border-left: 2px solid #000000;', 1, 'This goes for the white box with inset borders.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.pagination td', 'border: 1px solid #CCCCCC;', 1, 'Table columns within the pagination boxes.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.panel', 'border: 0px;background-color: #E4E7F5;color: #000000;', 1, 'This is the main light background colored region.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.panelsurround', 'background-color: #D5D8E5;color: #000000;', 1, 'Some sort of surrounding panel.. not used often.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.question', 'list-style-type: none;margin: 0px 0px 1px 0px;background-color: #fcfcfc;padding: 5px;border: 1px solid #999999;color: #000000;font-size: 11px;width: 90%;', 1, 'What a question looks like in the FAQ section.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.quote', 'border: 1px solid #999999;', 1, 'This is for the bbcode quote elements.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.quote *', 'font-size: 11px;color: #666666;', 1, 'This applies to all quote elemenets, and all elements inside quotes.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.quote legend', 'font-weight: bold;color: #333333;', 1, 'This applies to the quotes legend.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.smalltext, .smalltext *, *.smalltext', 'font-size:11px; padding:0px;', 1, 'This is the second smallest text, and this applies to all elements within the minitext.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.special_panel', 'background-color: #B7CEE1;color: #000000;padding: 10px;border: outset 2px;', 1, 'Shows on suspended forums/categories.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_subtitle a:hover', 'color: #4F5821;font-family: arial, helvetica, sans-serif;font-size: 12px;font-weight: bold;text-decoration: underline;', 1, 'This applies to all links in the secondary header regions when you hover your mouse over them.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_subtitle a:link, .k4_subtitle a:visited, .k4_subtitle a:active', 'color: #4F5821;font-family: arial, helvetica, sans-serif;font-size: 12px;font-weight: bold;text-decoration: none;', 1, 'This applies to all links within the secondary header regions, on the default template.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_subtitle', 'color: #4F5821;background-color: #C3D950;font-family: arial, helvetica, sans-serif;font-size: 12px;font-weight: bold;padding: 5px;cursor: default;', 1, 'This is the secondary header region.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_maintitle', 'color: #FFFFFF;padding: 5px 10px 5px 5px;background: url(Images/{\$IMG_DIR}/background_right_curve.gif) right top no-repeat;font-weight: bold;font-family: tahoma, verdana, geneva, lucida, arial, helvetica, sans-serif;', 1, 'This is the primary header region.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_maintitle a', 'font-size: 12px;color: #FFFFFF;', 1, 'This applies to all links within the primary header regions.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_maintitle a:hover', 'font-size: 12px;color: #FFFFFF;', 1, 'This applies to all links when hovered within the primary header regions.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_modmaintitle', 'background-color: #F0F0F0;color: #333333;font-weight: bold;font-family: tahoma, verdana, geneva, lucida, arial, helvetica, sans-serif;', 1, 'This is the primary mod header region.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_modmaintitle a, .k4_maintitle div', 'font-size: 12px;color: #333333;', 1, 'This applies to all links within the primary mod header regions.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_shadow', 'background-color: #34436C;', 1, 'This is the shadow that you can see at the bottom of central boxes.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.topiced_off td', 'background-color: #FEFEFE;padding: 0px;margin:0px;color: #000000;', 1, 'This goes for the table rows in the topiced and hybrid topic views when they are not selected.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.topiced_on, .topiced_on td', 'background-color: #CCCCCC;padding: 0px;margin:0px;height: 20px;', 1, 'This goes for the table rows in the topiced and hybrid topic views when you select one of them.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.visible', 'display: block;border: 1px solid #BDD786;padding: 3px;width: 95%;', 1, 'A category in the Advanced CSS editor which is visible.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('a', 'color: #000000;text-decoration: none;', 1, 'This applies to every link.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('a:hover', 'text-decoration: underline; color: #C83636;', 1, 'This applies to every link when you hover your mouse over them.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('a.bbcode_url', 'border-bottom: 1px dashed #CCCCCC;', 1, 'This applies to every bbcode link.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('fieldset', 'border: 1px solid #003366;padding: 5px;margin: 0px;', 1, 'This applies to every fieldset. (those cool table like things with a name which intersects the top border.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('form', 'margin:0px 0px 0px 0px;padding: 0px 0px 0px 0px;', 1, 'This applies to every form.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('h1', 'margin: 0px;padding: 0px;font-size: 20px;', 1, 'This applies to every h1 element.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('legend', 'color: #22229C;font: 11px tahoma, verdana, geneva, lucida, arial, helvetica, sans-serif;', 1, 'This applies to the names within the top border of all fieldsets.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('td', 'padding: 3px;', 1, 'This applies to every table column.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('td, th, p, li', 'font-size: 10pt;font-family: verdana, geneva, lucida, arial, helvetica, sans-serif;', 1, 'This applies to all table headers, table columns, paragraphs and list items simultaneously.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.bbcode_button', 'border: 2px outset; background-color: #F3F3F3;', 1, 'All of the buttons on the BB Code editor.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.date_color', 'color: #999999;', 1, 'The different colored text in dates');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.quotetitle', 'text-align:left;width: 90%;font-weight: bold;font-size: 11px;color: #000000;background-color: #A9B8C2; border: 1px solid #A9B8C2;padding: 3px;', 1, 'The title part of a Quote field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.quotecontent', 'text-align:left;width: 90%;font-size: 11px;color: #000000;background-color: #FFFFFF; border: 1px solid #A9B8C2;padding: 3px;', 1, 'The content part of a Quote field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.codetitle', 'text-align:left;width: 90%;font-weight: bold;font-size: 11px;color: #000000;background-color: #A9B8C2; border: 1px solid #A9B8C2;padding: 3px;', 1, 'The title part of a Code field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.codecontent', 'font-family: Courier, sans-serif;text-align:left;width: 90%;font-size: 11px;color: #000000;background-color: #FFFFFF; border: 1px solid #A9B8C2;padding: 3px;', 1, 'The content part of a Code field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.phptitle', 'text-align:left;width: 90%;font-weight: bold;font-size: 11px;color: #000000;background-color: #A9B8C2; border: 1px solid #A9B8C2;padding: 3px;', 1, 'The title part of a PHP field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.phpcontent', 'font-family: Courier, sans-serif;text-align:left;width: 90%;font-size: 11px;color: #000000;background-color: #FFFFFF; border: 1px solid #A9B8C2;padding: 3px;', 1, 'The content part of a PHP field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.phpcontent *', 'font-family: Courier, sans-serif;', 1, 'Everything inside a PHP field.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.forumrules', 'text-align:left;padding: 5px;font-size: 11px;background-color: #E4E7F5; border: 1px solid #045975;', 1, 'Forum rules box.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.forummessage', 'padding: 5px;font-size: 11px;background-color: #E4E7F5; border: 1px solid #045975;', 1, 'Forum special message box.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.header_text', 'padding: 5px;border-bottom: 1px dashed #CCCCCC;margin-bottom: 10px;width: 95%;', 1, 'Used in the member profile area.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('acronym', 'cursor:default;color: #336699;border-bottom: 1px dashed #336699;', 1, 'Acronyms.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('div.menu_global', 'padding: 5px; text-align: center;', 1, 'The box around main navigation menus');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('ul.menu_global', 'color: #333333;margin-left: 0;padding-left: 0;display: inline;', 1, 'The unordered list in main navigation menus');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.menu_global li', 'margin: 0;padding: 0px 5px 0px 7px;list-style: none;display: inline;', 1, 'Main Navigation Menu list items');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.menu_global li.first', 'margin: 0;border-left: none;list-style: none;display: inline;', 1, 'The first list item in the menu navigation.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.menu_global a, .menu_global a:hover, .header_breadcrumbs a, .header_breadrumbs a:hover', 'font-size: 11px;color: #000000; text-decoration: none;', 1, 'A hovered link in the menu navigation.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.Checkbox, .CheckboxChecked', 'display: block;width: 100%;height: 20px;', 1, 'Checkbox style.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.Checkbox', 'background:url(Images/{\$IMG_DIR}/Icons/topic_unselected.gif) center center no-repeat;', 1, 'Checkbox unchecked style.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.CheckboxChecked', 'background:url(Images/{\$IMG_DIR}/Icons/topic_selected.gif) center center no-repeat;', 1, 'Checkbox checked style.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.InputHidden', 'display: none;', 1, 'Hidden form style inputs');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.editor_button', 'margin: 1px 1px 1px 1px;border: 0px;', 1, 'Style for bbcode/wysiwyg editor buttons.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.editor_button_over', 'margin: 0px;border: 1px solid #0000FF;background-color: #A8C7DE;', 1, 'Style for bbcode/wysiwyg editor buttons when hovered.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.header_breadcrumbs', 'border: 1px solid #CCCCCC;padding: 5px; background-color: #FAFAFA;', 1, 'The breadcrumb bit box at the top and the menu bit at the bottom');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.header_breadcrumbs a:hover', 'background-color: #F4F4F4; text-decoration: none;', 1, 'Hovered links in the breadcrumb bit box at the top and the menu bit at the bottom');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.title_link', 'padding-left: 5px;color: #363636; font-size: 20px; font-weight: normal;', 1, 'The class for big text that shows category/forum/topic names.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('a.title_link:hover', 'text-decoration: none;', 1, 'The class for big text that shows category/forum/topic names when it is a link and when hovered.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_ddmenutable', '', 1, 'A table that holds drop down menus inside of a k4_maintitle element');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('div.ddmenu_button', 'padding: 3px;font-weight:bold;width: auto;', 1, 'Drop-Down menu button openers.');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('.k4_ddmenutable td', 'padding: 2px;', 1, 'Table cells in drop down menu link openers inside of a k4_maintitle element');");
     $request['dba']->executeUpdate("INSERT INTO k4_css (name, properties, style_id, description) VALUES ('div.k4_maintitle, .k4_maintitle div, .k4_maintitle span, .k4_maintitle strong', 'color: #FFFFFF;', 1, 'Applies to divs, strongs and spans in the main title elements.');");
     /**
      * Recreate the cache
      */
     $cache = array();
     $cache_class = new K4GeneralCacheFilter();
     $methods = get_class_methods($cache_class);
     foreach ($methods as $function) {
         if (substr($function, 0, 6) == 'cache_') {
             $cache_class->{$function}($cache, $request);
         }
     }
     DBCache::createCache($cache);
     /**
      * DONE!!
      */
     echo 'Successfully updated your k4 Bulletin Board version from BETA 7 to BETA 7.1. <strong>Please remove this file immediately</strong>. If you wish to change your version number, go into /includes/k4bb/common.php and switch it on line 37.';
     exit;
 }
Exemplo n.º 4
0
/**
 * Execute our mail queue by sending out an appropriate amount of emails at once
 */
function execute_mail_queue(&$dba, $mailqueue)
{
    global $_SETTINGS, $_URL;
    if (is_array($mailqueue) && !empty($mailqueue)) {
        array_values($mailqueue);
        if (isset($mailqueue[0])) {
            $queue = $mailqueue[0];
            $users = force_unserialize($mailqueue[0]['userinfo']);
            if (is_array($users) && !empty($users)) {
                /* Reset the starting point of this array */
                $users = array_values($users);
                $count = count($users);
                $user_query = '';
                /* Loop through the users */
                for ($i = 0; $i < EMAIL_INTERVAL; $i++) {
                    if (isset($users[$i]) && is_array($users[$i]) && intval($users[$i]['id']) != 0) {
                        $temp_i = $i;
                        if ($users[$i]['name'] != $users[$i]['poster_name']) {
                            $message = sprintf($mailqueue[0]['message'], $users[$i]['name'], $users[$i]['poster_name']);
                            $page =& new FAUrl(forum_url());
                            $page->args = array();
                            $page->file = FALSE;
                            $page->path = FALSE;
                            $page->anchor = FALSE;
                            $page->scheme = FALSE;
                            /* Email our user */
                            mail($users[$i]['email'], $mailqueue[0]['subject'], $message, "From: \"" . $_SETTINGS['bbtitle'] . " Forums\" <noreply@" . $page->__toString() . ">");
                            $user_query .= $i == 0 ? 'user_id = ' . intval($users[$i]['id']) : ' OR user_id = ' . intval($users[$i]['id']);
                            unset($users[$i]);
                        }
                    }
                }
                /* Update the subscriptions 'requires revisit' field */
                $dba->executeUpdate("UPDATE " . K4SUBSCRIPTIONS . " SET requires_revisit = 1 WHERE post_id = " . $queue['row_id'] . " " . ($user_query != '' ? "AND (" . $user_query . ")" : ''));
                /* If we have finished with this queue item */
                if ($count <= EMAIL_INTERVAL) {
                    $dba->executeUpdate("DELETE FROM " . K4MAILQUEUE . " WHERE id = " . intval($mailqueue[0]['id']));
                } else {
                    $users = array_values($users);
                    $update = $dba->prepareStatement("UPDATE " . K4MAILQUEUE . " SET userinfo=? WHERE id=?");
                    $update->setString(1, serialize($users));
                    $update->setInt(2, $mailqueue[0]['id']);
                    $update->executeUpdate();
                }
            } else {
                $dba->executeUpdate("DELETE FROM " . K4MAILQUEUE . " WHERE id = " . intval($mailqueue[0]['id']));
            }
            reset_cache('email_queue');
        }
    }
}
Exemplo n.º 5
0
 function current()
 {
     $temp = parent::current();
     /* Cache this forum in the session */
     cache_forum($temp);
     /**
      * Do the icon
      */
     switch ($temp['row_type']) {
         case FORUM:
             $temp['forum_icon'] = 'forum_off';
             forum_icon($temp, $temp['forum_icon']);
             break;
         case GALLERY:
             $temp['forum_icon'] = 'forum_gallery';
             break;
         case METAFORUM:
             $temp['forum_icon'] = 'forum_meta';
             break;
         case ARCHIVEFORUM:
             $temp['forum_icon'] = 'forum_archive';
             break;
     }
     /* Set a nice representation of what level we're on */
     $temp['level'] = @str_repeat('&nbsp;&nbsp;&nbsp;', $this->level);
     /* Should we query down to the next level of forums? */
     if ($temp['row_type'] & CATEGORY) {
         $temp['forums'] =& new K4ForumsIterator($this->dba, "SELECT * FROM " . K4FORUMS . " WHERE parent_id = " . $temp['forum_id'] . " ORDER BY row_order ASC", TRUE, $this->level + 1);
     }
     if ($this->do_recurse) {
         if ($temp['subforums'] > 0 && $this->settings['showsubforums'] == 1) {
             $it = new K4ForumsIterator($this->dba, "SELECT * FROM " . K4FORUMS . " WHERE parent_id = " . intval($temp['forum_id']) . " ORDER BY row_order ASC", FALSE, $this->level + 1);
             if ($it->hasNext()) {
                 // add the iterator
                 $temp['subforums_list'] = $it;
             } else {
                 // if this forum doesn't actually have subforums, fix it
                 $this->dba->executeUpdate("UPDATE " . K4FORUMS . " SET subforums=0 WHERE forum_id = " . intval($temp['forum_id']));
             }
         }
     }
     /**
      * Get the moderators
      */
     $temp['moderators'] = array();
     $temp['are_moderators'] = 0;
     if ($temp['moderating_groups'] != '') {
         $groups = explode('|', $temp['moderating_groups']);
         if (is_array($groups)) {
             foreach ($groups as $g) {
                 if (isset($this->usergroups[$g])) {
                     $temp['U_USERGROUPURL'] = K4Url::getUserGroupUrl($g);
                     $temp['moderators'][] = $this->usergroups[$g];
                 }
             }
             $temp['are_moderators'] = 1;
         }
     }
     if ($temp['moderating_users'] != '') {
         $users = force_unserialize($temp['moderating_users']);
         if (is_array($users) && !empty($users)) {
             foreach ($users as $user_id => $username) {
                 $temp['U_GMEMBERURL'] = K4Url::getMemberUrl($user_id);
                 $temp['moderators'][] = array('user_id' => $user_id, 'name' => $username);
             }
             $temp['are_moderators'] = 1;
         }
     }
     $temp['moderators'] =& new FAArrayIterator($temp['moderators']);
     /* Replace topic/post names with censors */
     replace_censors($temp['topic_name']);
     replace_censors($temp['post_name']);
     $temp['topics'] = number_format($temp['topics']);
     $temp['replies'] = number_format($temp['replies']);
     $temp['posts'] = number_format($temp['posts']);
     //		/* Set cookies for all of the topics */
     //		bb_settopic_cache_item('forums', serialize($this->forums), time() + 3600 * 25 * 5);
     $temp['safe_description'] = strip_tags($temp['description']);
     $temp['forum'] = $temp['row_type'] == CATEGORY ? 0 : 1;
     // custom url's
     $temp['U_FORUMURL'] = K4Url::getForumUrl($temp['forum_id']);
     $temp['U_TOPICURL'] = K4Url::getTopicUrl($temp['post_id']);
     $temp['U_POSTURL'] = K4Url::getPostUrl($temp['post_id']);
     $temp['U_FINDPOSTURL'] = K4Url::getPostUrl($temp['post_id']);
     $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['post_uid']);
     $temp['U_REDIRECTURL'] = K4Url::getRedirectUrl($temp['forum_id']);
     /* Return the formatted forum info */
     return $temp;
 }
Exemplo n.º 6
0
/**
 * Format a custom profile field
 */
function format_profilefield($data)
{
    global $lang;
    switch ($data['inputtype']) {
        case 'text':
            $input = '<input type="text" class="inputbox" name="' . $data['name'] . '" id="' . $data['name'] . '" value="' . $data['default_value'] . '" size="' . $data['display_size'] . '" maxlength="' . $data['user_maxlength'] . '" />';
            if ($data['is_required'] == 1) {
                $input .= '<script type="text/javascript">addVerification(\'' . $data['name'] . '\', \'.+\', \'' . $data['name'] . '_error\', \'inputfailed\');</script><div id="' . $data['name'] . '_error" style="display: none;">' . sprintf($lang['L_FILLINTHISFIELD'], $data['title']) . '</div>';
            }
            break;
        case 'textarea':
            $input = '<textarea name="' . $data['name'] . '" id="' . $data['name'] . '" cols="' . $data['display_size'] . '" rows="' . $data['display_rows'] . '" class="inputbox">' . $data['default_value'] . '</textarea>';
            if ($data['is_required'] == 1) {
                $input .= '<script type="text/javascript">addVerification(\'' . $data['name'] . '\', \'(\\n|\\r\\n|\\r|.)+\', \'' . $data['name'] . '_error\', \'inputfailed\');</script><div id="' . $data['name'] . '_error" style="display: none;">' . sprintf($lang['L_FILLINTHISFIELD'], $data['title']) . '</div>';
            }
            break;
        case 'select':
            $input = '<select name="' . $data['name'] . '" id="' . $data['name'] . '">';
            $options = $data['inputoptions'] != '' ? force_unserialize($data['inputoptions']) : array();
            if (is_array($options) && !empty($empty)) {
                foreach ($options as $option) {
                    $input .= '<option value="' . $option . '">' . $option . '</option>';
                }
            }
            $input .= '</select>';
            break;
        case 'multiselect':
            $input = '<select name="' . $data['name'] . '[]" id="' . $data['name'] . '" multiple="multiple" ' . iif(intval($data['display_rows']) > 0, 'size="' . intval($data['display_rows']) . '"', '') . '>';
            $options = $data['inputoptions'] != '' ? force_unserialize($data['inputoptions']) : array();
            if (is_array($options) && !empty($empty)) {
                foreach ($options as $option) {
                    $input .= '<option value="' . $option . '">' . $option . '</option>';
                }
            }
            $input .= '</select>';
            break;
        case 'radio':
            $options = $data['inputoptions'] != '' ? force_unserialize($data['inputoptions']) : array();
            $input = '';
            if (is_array($options) && !empty($empty)) {
                $i = 0;
                foreach ($options as $option) {
                    $input .= '<label for="' . $data['name'] . $i . '"><input type="radio" name="' . $data['name'] . '" id="' . $data['name'] . $i . '" value="' . $option . '" />&nbsp;&nbsp;' . $option . '</label>';
                    $i++;
                }
            }
            break;
        case 'check':
            $options = $data['inputoptions'] != '' ? iif(!force_unserialize($data['inputoptions']), array(), force_unserialize($data['inputoptions'])) : array();
            $input = '';
            if (is_array($options) && !empty($empty)) {
                $i = 0;
                foreach ($options as $option) {
                    $input .= '<label for="' . $data['name'] . $i . '"><input type="checkbox" name="' . $data['name'] . '[]" id="' . $data['name'] . $i . '" value="' . $option . '" />&nbsp;&nbsp;' . $option . '</label>';
                    $i++;
                }
            }
            break;
    }
    if (isset($input)) {
        return $input;
    }
}
Exemplo n.º 7
0
/**
 * Function to check if a user is a moderator of a forum
 */
function is_moderator($user, $forum)
{
    global $_USERGROUPS;
    if (is_a($user, 'FAUser')) {
        $user = $user->getInfoArray();
    }
    if (!is_array($user)) {
        trigger_error('Invalid $user call for is_moderator.', E_USER_ERROR);
    }
    if ($user['perms'] >= ADMIN) {
        return TRUE;
    }
    $result = explode('|', trim($forum['moderating_groups'], '|'));
    $moderators = !$result ? force_usergroups($forum['moderating_groups']) : $result;
    $groups = array();
    foreach ($moderators as $g) {
        if (isset($_USERGROUPS[$g])) {
            $groups[] = $g;
        }
    }
    if (isset($user['usergroups'])) {
        $unserialize = explode('|', trim($user['usergroups'], '|'));
        $my_groups = !$unserialize ? force_usergroups($user['usergroups']) : $unserialize;
        /* Do we toggle our moderator's panel? */
        if (is_in_group($my_groups, $groups, $user['perms'])) {
            return TRUE;
        }
    }
    if ($forum['moderating_users'] != '') {
        $users = force_unserialize($forum['moderating_users']);
        if (is_array($users)) {
            foreach ($users as $user_id => $username) {
                if ($user['name'] == $username && $user['id'] == $user_id) {
                    return TRUE;
                }
            }
        }
    }
    return FALSE;
}
 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= ADMIN) {
         if (!isset($_REQUEST['field']) || $_REQUEST['field'] == '') {
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDUSERFIELD'), 'content', TRUE);
             return $action->execute($request);
         }
         $field = $request['dba']->getRow("SELECT * FROM " . K4PROFILEFIELDS . " WHERE name = '" . $request['dba']->quote($_REQUEST['field']) . "'");
         if (!$field || !is_array($field) || empty($field)) {
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDUSERFIELD'), 'content', TRUE);
             return $action->execute($request);
         }
         push_error_handler(create_function('', 'return TRUE;'));
         $ret = $request['dba']->executeQuery("SELECT " . $field['name'] . " FROM " . K4USERINFO . " LIMIT 1");
         pop_error_handler();
         if ($ret === FALSE) {
             /* Delete the profile field version of this because obviously it shouldn't exist */
             $request['dba']->executeUpdate("DELETE FROM " . K4PROFILEFIELDS . " WHERE name = '" . $request['dba']->quote($field['name']) . "'");
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDUSERFIELD'), 'content', TRUE);
             return $action->execute($request);
         }
         foreach ($field as $key => $val) {
             /* If these are options, format them */
             if ($key == 'inputoptions') {
                 $val = $val != '' ? iif(!force_unserialize($val), array(), force_unserialize($val)) : array();
                 if (is_array($val) && !empty($val)) {
                     $val = str_replace("\n\n", "\n", implode("\n", $val));
                 } else {
                     $val = "";
                 }
             }
             $request['template']->setVar('field_' . $key, $val);
         }
         $request['template']->setVisibility($field['inputtype'], TRUE);
         $request['template']->setFile('content', 'profilefields_edit.html');
         k4_bread_crumbs($request['template'], $request['dba'], 'L_USERPROFILEFIELDS');
         $request['template']->setVar('users_on', '_on');
         $request['template']->setFile('sidebar_menu', 'menus/users.html');
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
Exemplo n.º 9
0
 function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         global $_QUERYPARAMS, $_USERGROUPS;
         if (!isset($_REQUEST['forum_id']) || intval($_REQUEST['forum_id']) == 0) {
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDFORUM'), 'content', FALSE);
             return $action->execute($request);
         }
         $forum = $request['dba']->getRow("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($_REQUEST['forum_id']));
         if (!is_array($forum) || empty($forum)) {
             $action = new K4InformationAction(new K4LanguageElement('L_INVALIDFORUM'), 'content', FALSE);
             return $action->execute($request);
         }
         $parser =& new BBParser();
         $forum['forum_rules'] = $parser->revert($forum['forum_rules']);
         $forum['description'] = $parser->revert($forum['description']);
         $languages = get_files(K4_BASE_DIR . '/lang', TRUE, FALSE, array('.svn', '.htaccess', '.', '..'));
         // set the forum info to the template
         foreach ($forum as $key => $val) {
             $request['template']->setVar('forum_' . $key, $val);
         }
         $groups = $forum['moderating_groups'] != '' ? explode('|', $forum['moderating_groups']) : array();
         $groups_str = '';
         if (is_array($groups)) {
             foreach ($groups as $g) {
                 if (isset($_USERGROUPS[$g])) {
                     $groups_str .= $g . '|';
                 }
             }
             $request['template']->setVar('forum_moderating_groups', strlen($groups_str) > 0 ? substr($groups_str, 0, -1) : '');
         }
         $moderating_users = '';
         if ($forum['moderating_users'] != '') {
             $users = force_unserialize($forum['moderating_users']);
             if (is_array($users)) {
                 $users = array_values($users);
                 $moderating_users = implode("\n", $users);
             }
         }
         // set the direct parent
         if ($forum['parent_id'] > 0) {
             $forum['parent_id'] = intval($forum['parent_id']);
         }
         $request['template']->setVar('forum_parent', $forum['parent_id']);
         $request['template']->setVar('forum_moderating_users', $moderating_users);
         $request['template']->setVar('can_change_type', $forum['row_type'] & ARCHIVEFORUM ? 0 : 1);
         // forum languages
         $languages =& new FAArrayIterator($languages);
         k4_bread_crumbs($request['template'], $request['dba'], 'L_FORUMS');
         $request['template']->setVar('forums_on', '_on');
         $request['template']->setVar('is_edit', 1);
         $request['template']->setVar('forum_action', 'admin.php?act=forums_update');
         $request['template']->setFile('sidebar_menu', 'menus/forums.html');
         $request['template']->setList('languages', $languages);
         $request['template']->setFile('content', 'forums_add.html');
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }