function JB_init_category_tables($cat) { global $AVAILABLE_LANGS; // loop for each language foreach ($AVAILABLE_LANGS as $key => $val) { // get the category_name from the categories table, which also has a translation in the // cat_name_translations table $sql = "SELECT categories.category_id, categories.category_name, lang FROM cat_name_translations, categories WHERE categories.category_id=cat_name_translations.category_id AND categories.category_id='" . jb_escape_sql($cat) . "' AND lang='" . jb_escape_sql($key) . "' "; $result = JB_mysql_query($sql) or die(mysql_error()); // if the above query return no rows then it means that the row does not exist in // the cat_name_translations table. // So we create a new row for the translation if (mysql_num_rows($result) == 0) { $cat_row = JB_get_category($cat); $sql = "REPLACE INTO `cat_name_translations` (`category_id`, `lang`, `category_name`) VALUES ('" . jb_escape_sql($cat) . "', '" . jb_escape_sql($key) . "', '" . addslashes($cat_row['category_name']) . "')"; //echo "<b>$sql</b>"; JB_mysql_query($sql) or die(mysql_error() . $sql); } } // Update the search set for the category $search_set = JB_get_search_set($cat); $sql = "UPDATE categories set search_set='" . jb_escape_sql($search_set) . "' WHERE category_id='" . jb_escape_sql($cat) . "'"; JB_mysql_query($sql) or die(mysql_error() . $sql); // This is a recursive function, so here we get the children categories // and call this function on the children. $query = "SELECT * FROM categories WHERE parent_category_id='" . jb_escape_sql($cat) . "' "; $result = JB_mysql_query($query) or die(mysql_error() . $query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { JB_init_category_tables($row['category_id']); } }
} //do_upgarde (true); if (isset($_REQUEST['do_upgrade']) && $_REQUEST['do_upgrade'] == 'Y') { JB_do_upgrade(true); JB_cache_flush(); } if (JB_do_upgrade(false)) { echo "<p><input style='font-size: 24px;' type='button' value='Upgrade Database' onclick=\"window.location='" . htmlentities($_SERVER['PHP_SELF']) . "?do_upgrade=Y'\" ></p>"; } } JBPLUG_do_callback('admin_main', $A = false); if ($_REQUEST['clear_cache']) { if (!function_exists('jb_search_category_tree_for_posts')) { require_once jb_basedirpath() . 'include/posts.inc.php'; } JB_init_category_tables(0); JB_update_post_count(); // update the total, eg. number of approved posts, number of expired posts, premium approved, expired & waiting JB_build_post_count(); JB_cache_flush(); $JBMarkup->ok_msg('Cache refreshed.'); } echo "<p> </p><div>"; JB_theme_check_compatibility(); if (JB_DEMO_MODE != 'YES') { if (JB_CRON_EMULATION_ENABLED == 'YES') { echo '<p><font color="maroon">- Attention: Cron Emulation - The system has detected that you have Cron Emulation enabled. Cron Emulation is intended for testing purposes and not recommended for live sites. Please go to <A href="edit_config.php#cron">Admin->Main Config</a> and see the Cron options</p></font>'; } if (is_writable(jb_get_config_dir() . 'config.php')) { //echo "- config.php is writeable.<br>"; } else {