<?php
// Таблицы без категории перемещаем в категории
// Есть таблицы без категории
$without_cat_id = -1;
$result = run_query("SELECT id FROM " . $config["table_prefix"] . "tables WHERE cat_id='0'");
if ($row = mysqli_fetch_array($result)) {
    if ($without_cat_id == -1) {
        run_query("INSERT INTO " . $config["table_prefix"] . "cats VALUES ('', '0', 'Без категории', '')");
        $without_cat_id = mysqli_insert_id($sql_global_link);
    }
    $result = run_query("UPDATE " . $config["table_prefix"] . "tables SET cat_id='$without_cat_id' WHERE cat_id='0'");
};
$result = run_query("SELECT id FROM " . $config["table_prefix"] . "reports WHERE cat_id='0'");
if ($row = mysqli_fetch_array($result)) {
    if ($without_cat_id == -1) {
        run_query("INSERT INTO " . $config["table_prefix"] . "cats VALUES ('', '0', 'Без категории', '')");
        $without_cat_id = mysqli_insert_id($sql_global_link);
    }
    $result = run_query("UPDATE " . $config["table_prefix"] . "reports SET cat_id='$without_cat_id' WHERE cat_id='0'");
};
run_query("UPDATE " . $config["table_prefix"] . "config SET `value` = '010803' WHERE `key` = 'version'");
?>