function execute(&$request)
 {
     if ($request['user']->isMember() && $request['user']->get('perms') >= SUPERADMIN) {
         if (isset($_REQUEST['varname']) && $_REQUEST['varname'] != '') {
             reset_cache($_REQUEST['varname']);
             $name = ucwords(implode(' ', explode('_', $_REQUEST['varname'])));
             $action = new K4InformationAction(new K4LanguageElement('L_REFRESHEDCACHEITEM', $name), 'content', FALSE, 'admin.php?act=cache', 3);
         } else {
             $action = new K4InformationAction(new K4LanguageElement('L_REFRESHEDCACHE'), 'content', FALSE, 'admin.php?act=cache', 3);
             $general_cache = new K4GeneralCacheFilter();
             $cache = array();
             $methods = get_class_methods($general_cache);
             foreach ($methods as $function) {
                 if (substr($function, 0, 6) == 'cache_') {
                     $general_cache->{$function}($cache, $request);
                 }
             }
             if (USE_CACHE) {
                 DBCache::createCache($cache);
             }
         }
         return $action->execute($request);
     } else {
         no_perms_error($request);
     }
     return TRUE;
 }
 public static function get($inputData = array())
 {
     $limitQuery = "";
     $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
     $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
     $limitPage = (int) $limitPage > 0 ? $limitPage : 0;
     $limitPosition = $limitPage * (int) $limitShow;
     $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
     $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
     $field = "requestid,userid,total_request,date_added,status,comments";
     $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
     $whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
     $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by requestid desc';
     $result = array();
     $command = "select {$selectFields} from " . Database::getPrefix() . "request_payments {$whereQuery}";
     $command .= " {$orderBy}";
     $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
     $queryCMD .= $limitQuery;
     $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
     $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : 1;
     if ($cache == 'yes') {
         // Load dbcache
         $loadCache = DBCache::get($queryCMD, $cacheTime);
         if ($loadCache != false) {
             $loadCache = unserialize($loadCache);
             return $loadCache;
         }
         // end load
     }
     $query = Database::query($queryCMD);
     if (isset(Database::$error[5])) {
         return false;
     }
     $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
     if ((int) $query->num_rows > 0) {
         while ($row = Database::fetch_assoc($query)) {
             if (isset($row['comments'])) {
                 $row['comments'] = String::decode($row['comments']);
             }
             if (isset($row['date_added'])) {
                 $row['date_addedFormat'] = Render::dateFormat($row['date_added']);
             }
             if ($inputData['isHook'] == 'yes') {
                 if (isset($row['comments'])) {
                     $row['comments'] = Shortcode::load($row['comments']);
                 }
             }
             $result[] = $row;
         }
     } else {
         return false;
     }
     // Save dbcache
     DBCache::make(md5($queryCMD), $result);
     // end save
     return $result;
 }
Example #3
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;
 }
Example #4
0
 public static function update($listID, $post = array(), $whereQuery = '', $addWhere = '')
 {
     if (isset($post['content'])) {
         // $post['content']=Shortcode::toBBCode($post['content']);
         $post['content'] = String::encode(strip_tags($post['content'], '<p><br>'));
     }
     if (is_numeric($listID)) {
         $catid = $listID;
         unset($listID);
         $listID = array($catid);
     }
     $listIDs = "'" . implode("','", $listID) . "'";
     $keyNames = array_keys($post);
     $total = count($post);
     $setUpdates = '';
     for ($i = 0; $i < $total; $i++) {
         $keyName = $keyNames[$i];
         $setUpdates .= "{$keyName}='{$post[$keyName]}', ";
     }
     $setUpdates = substr($setUpdates, 0, strlen($setUpdates) - 2);
     $whereQuery = isset($whereQuery[5]) ? $whereQuery : "commentid in ({$listIDs})";
     $addWhere = isset($addWhere[5]) ? $addWhere : "";
     Database::query("update " . Database::getPrefix() . "comments set {$setUpdates} where {$whereQuery} {$addWhere}");
     // DBCache::removeDir('system/comment');
     DBCache::removeCache($listIDs, 'system/comment');
     if (!($error = Database::hasError())) {
         return true;
     }
     return false;
 }
Example #5
0
}
/**
 * Should we reqrite our topic deletion cache file?
 */
if (rewrite_file(CACHE_TOPIC_FILE, CACHE_INTERVAL)) {
    /**
     * Get all of the lazy loads that need to be executed
     */
    $cache[TOPICQUEUE] = array();
    $result =& $_DBA->executeQuery("SELECT * FROM " . TOPICQUEUE . " WHERE finished = 0 LIMIT 1");
    while ($result->next()) {
        $temp = $result->current();
        $cache[TOPICQUEUE][] = $temp;
    }
    $result->freeResult();
    DBCache::createCache(array(TOPICQUEUE => $cache[TOPICQUEUE]), CACHE_TOPIC_FILE);
} else {
    /* Include the cache file */
    include_once CACHE_TOPIC_FILE;
    if (!isset($cache) || !is_array($cache) || empty($cache)) {
        compile_error('The cached topic queue array does not exist or it is empty.', __FILE__, __LINE__);
    }
}
/**
 * Set the super-globals 
 */
$GLOBALS['_URL'] =& new Url('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
$GLOBALS['_SETTINGS'] = $cache[SETTINGS];
$GLOBALS['_DATASTORE'] = $cache[DATASTORE];
$GLOBALS['_QUERYPARAMS'] =& $query_params;
$GLOBALS['_MAPITEMS'] =& $map_items;
Example #6
0
 public static function update($listID, $post = array(), $whereQuery = '', $addWhere = '')
 {
     if (is_numeric($listID)) {
         $userid = $listID;
         unset($listID);
         $listID = array($userid);
     }
     $listIDs = "'" . implode("','", $listID) . "'";
     $keyNames = array_keys($post);
     $total = count($post);
     $setUpdates = '';
     for ($i = 0; $i < $total; $i++) {
         $keyName = $keyNames[$i];
         $setUpdates .= "{$keyName}='{$post[$keyName]}', ";
     }
     $setUpdates = substr($setUpdates, 0, strlen($setUpdates) - 2);
     $whereQuery = isset($whereQuery[5]) ? $whereQuery : "userid in ({$listIDs})";
     $addWhere = isset($addWhere[5]) ? $addWhere : "";
     Database::query("update " . Database::getPrefix() . "address set {$setUpdates} where {$whereQuery} {$addWhere}");
     // DBCache::removeDir('system/address');
     DBCache::removeCache($listIDs, 'system/address');
     if (!($error = Database::hasError())) {
         return true;
     }
     return false;
 }
 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;
 }
Example #8
0
 function execute(&$request)
 {
     $config =& new FATemplate(FA_FORCE | FA_NOCACHE);
     $config->setVar('db_driver', $request['db_info']['driver']);
     $config->setVar('db_database', $request['db_info']['database']);
     $config->setVar('db_directory', $request['db_info']['directory']);
     $config->setVar('db_server', $request['db_info']['server']);
     $config->setVar('db_user', $request['db_info']['user']);
     $config->setVar('db_pass', $request['db_info']['pass']);
     // ftp settings
     $config->setVar('use_ftp', $request['ftp_info']['use']);
     $config->setVar('ftp_user', $request['ftp_info']['user']);
     $config->setVar('ftp_pass', $request['ftp_info']['pass']);
     $config->setVar('cache_in_db', $_POST['store_cache'] == 'db' ? 'TRUE' : 'FALSE');
     $_CONFIG = array();
     $_CONFIG['ftp']['use_ftp'] = $request['ftp_info']['use'] == 'TRUE' ? TRUE : FALSE;
     $_CONFIG['ftp']['username'] = $request['ftp_info']['user'];
     $_CONFIG['ftp']['password'] = $request['ftp_info']['pass'];
     $GLOBALS['_CONFIG'] = $_CONFIG;
     $GLOBALS['_DBA'] = $request['dba'];
     $buffer = $config->run(dirname(__FILE__) . '/templates/config.php');
     $config->writeBuffer(INCLUDE_BASE_DIR . '/k4bb/config.php', '<?php' . FA_NL . $buffer . FA_NL . '?>');
     $sqldata =& new FATemplate(FA_FORCE | FA_NOCACHE);
     $_POST['admin_created'] = time();
     foreach ($_POST as $key => $val) {
         $sqldata->setVar($key, k4_htmlentities($val, ENT_QUOTES));
     }
     $sqldata->setVar('IMG_DIR', '{$IMG_DIR}');
     $buffer = file_get_contents($request['schema']);
     $queries = explode(';', $buffer);
     foreach ($queries as $query) {
         if (trim($query)) {
             $request['dba']->executeUpdate(trim($query));
         }
     }
     $buffer = $sqldata->run(dirname(__FILE__) . '/schema/k4.data.schema');
     $queries = explode(FA_NL, $buffer);
     foreach ($queries as $query) {
         if ($query) {
             $request['dba']->executeUpdate($query);
         }
     }
     // create the cache
     $general_cache = new K4GeneralCacheFilter();
     $cache = array();
     $methods = get_class_methods($general_cache);
     foreach ($methods as $function) {
         if (substr($function, 0, 6) == 'cache_') {
             $general_cache->{$function}($cache, $request);
         }
     }
     define('CACHE_IN_DB', $_POST['store_cache'] == 'db' ? TRUE : FALSE);
     DBCache::createCache($cache);
     // all done :D
     $request['template']->render(INSTALLER_BASE_DIR . '/templates/success.html');
 }
Example #9
0
 public function dbQD($id, $table, $field = "id", $signe = "=", $limit = ' LIMIT 1 ')
 {
     $d = "DELETE FROM " . $table . " WHERE " . $field . " " . $signe . " '" . $id . "' {$limit} ";
     //echo $d;
     $this->dbpdo->query($d);
     $fieldToCache = array('id');
     $noCacheTables = array('_users', '_users_groupes', '_dg_firewall', '_users_info');
     if (!in_array($table, $noCacheTables) && in_array($table, $noCacheTables)) {
         // supression du cache
         $fileName = $table . '-' . $fieldId . '-' . $id . '.php';
         $cache = new DBCache($table, $fileName);
         $cache->clear();
     }
 }
Example #10
0
 function newArray($array)
 {
     if (is_array($array)) {
         $contents = "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray(";
         foreach ($array as $column => $val) {
             if (is_array($val)) {
                 $contents .= "'" . $column . "' => " . DBCache::newArray($val) . ", ";
             } else {
                 $contents .= "'" . $column . "' => '" . htmlentities($val, ENT_QUOTES) . "', ";
             }
         }
         $contents .= ")";
     } else {
         $contents = "'" . htmlentities($array, ENT_QUOTES) . "', ";
     }
     return $contents;
 }
 public static function update($listID, $post = array(), $whereQuery = '', $addWhere = '')
 {
     if (is_numeric($listID)) {
         $catid = $listID;
         unset($listID);
         $listID = array($catid);
     }
     if (isset($post['title'])) {
         $post['title'] = String::encode(strip_tags($post['title']));
         $post['friendly_url'] = String::makeFriendlyUrl(strip_tags($post['title']));
         $loadPost = self::get(array('where' => "where friendly_url='" . $post['friendly_url'] . "'"));
         if (isset($loadPost[0]['catid']) && (int) $loadPost[0]['catid'] != (int) $listID[0]) {
             return false;
         }
     }
     $listIDs = "'" . implode("','", $listID) . "'";
     $keyNames = array_keys($post);
     $total = count($post);
     $setUpdates = '';
     for ($i = 0; $i < $total; $i++) {
         $keyName = $keyNames[$i];
         $setUpdates .= "{$keyName}='{$post[$keyName]}', ";
     }
     $setUpdates = substr($setUpdates, 0, strlen($setUpdates) - 2);
     $whereQuery = isset($whereQuery[5]) ? $whereQuery : "catid in ({$listIDs})";
     $addWhere = isset($addWhere[5]) ? $addWhere : "";
     Database::query("update " . Database::getPrefix() . "categories set {$setUpdates} where {$whereQuery} {$addWhere}");
     // DBCache::removeDir('system/category');
     DBCache::removeCache($listIDs, 'system/category');
     if (!($error = Database::hasError())) {
         return true;
     }
     return false;
 }
Example #12
0
 public static function disable()
 {
     self::$enable = 'no';
 }
Example #13
0
 /**
  * Controller层的调用入口函数,在scripts中调用
  */
 public function execute($action = NULL)
 {
     $startTime = getMicrotime();
     try {
         $error_handler = set_error_handler("ErrorHandler");
         $objRequest = new HttpRequest();
         $objResponse = new HttpResponse();
         // 指定action
         if ($action != NULL) {
             $objRequest->setAction($action);
         }
         // 入力检查
         $this->check($objRequest, $objResponse);
         $isCacheValid = false;
         if ($this->_cache) {
             $objDBCache = new DBCache();
             $objDBCache->cache_dir = $this->_cache_dir;
             $isCacheValid = $objDBCache->isValid($this->_cache_id, $this->_cache_time, $this->_renew_cachedir);
         }
         // if(!ob_start("ob_gzhandler"))
         ob_start();
         if (!$isCacheValid) {
             // 执行方法
             $this->service($objRequest, $objResponse);
             if ($this->displayDisabled == false) {
                 $this->display($objResponse, $this->compiler);
                 if ($this->_cache) {
                     $objDBCache->cachePage($this->_cache_id, json_encode(ob_get_contents()), $this->_renew_cachedir);
                 }
                 if ($this->_create_html) {
                     File::creatFile($this->_html_name, ob_get_contents(), $this->_html_dir);
                 }
             }
         } else {
             echo json_decode($objDBCache->fetch($this->_cache_id, false, $this->_renew_cachedir));
         }
         ob_implicit_flush(1);
         ob_end_flush();
         // 资源回收
         $this->release($objRequest, $objResponse);
         // 数据库事务提交(由DBQuery判断是否需要做)
         // DBQuery::instance()->commit();
     } catch (Exception $e) {
         if (__Debug) {
             echo 'error: ' . $e->getMessage() . "<br>";
             echo str_replace("\n", "\n<br>", $e->getTraceAsString());
         }
         try {
             // 错误处理
             $this->tryexecute($objRequest, $objResponse);
             // 数据库事务回滚(由DBQuery判断是否需要做)
             // DBQuery::instance()->rollback();
         } catch (Exception $e) {
             logError($e->getMessage(), __MODEL_EXCEPTION);
             if (__Debug) {
                 print_r($e->getMessage());
                 print_r($e->getTraceAsString());
             }
         }
         // 错误日志
         logError($e->getMessage(), __MODEL_EXCEPTION);
         logError($e->getTraceAsString(), __MODEL_EMPTY);
         // 重定向到错误页面
         // redirect("errorpage.htm");
         // 最终处理
         $this->finalexecute($objRequest, $objResponse);
         // set_exception_handler('exception_handler');
         if ($this->showErrorPage && __Debug == false) {
             redirect(__WEB . "404.htm");
         }
     }
     // debug...
     if (__Debug) {
         $endTime = getMicrotime();
         $useTime = $endTime - $startTime;
         logDebug("excute time {$useTime} s");
     }
 }
Example #14
0
 public static function remove($post = array(), $whereQuery = '', $addWhere = '')
 {
     if (is_numeric($post)) {
         $id = $post;
         unset($post);
         $post = array($id);
     }
     $total = count($post);
     $listID = "'" . implode("','", $post) . "'";
     $whereQuery = isset($whereQuery[5]) ? $whereQuery : "tagid in ({$listID})";
     $addWhere = isset($addWhere[5]) ? $addWhere : "";
     $command = "delete from " . Database::getPrefix() . "post_tags where {$whereQuery} {$addWhere}";
     Database::query($command);
     // DBCache::removeDir('system/posttag');
     DBCache::removeCache($listID, 'system/posttag');
     return true;
 }