<?php

global $sql_global_link, $lang;

// Удаляем функцию abs из sql запросов в напоминаниях
$result = run_query("SELECT id, cond_value FROM " . $config["table_prefix"] . "tips WHERE cond_set != '' AND cond_value != ''");
while ($row = sql_fetch_assoc($result)) {
    $value = preg_replace('/(abs)\(([\w.`]*)\)/i', '$2', $row['cond_value']);
    $value = form_sql($value);
    if ($value !== '') {
        run_query("UPDATE " . $config['table_prefix'] . "tips SET cond_value = '$value' WHERE id = " . $row['id']);
    } else {
        $file = substr(str_replace("\\", "/", __FILE__),
            strrpos(str_replace("\\", "/", __FILE__), "/") + 1);
        die("<b class='error_convert'>{$lang['error_convert']}</b><br><br><b>Error</b>: UPDATE tips!<br><b>File</b>: $file, str " . __LINE__);
    }
}

// Удаляем функцию abs из sql запросов в фильтрах
$result = run_query("SELECT id, expert FROM " . $config["table_prefix"] . "filters WHERE cond_set != '' AND expert != ''");
while ($row = sql_fetch_assoc($result)) {
    $value = preg_replace('/(abs)\(([\w.`]*)\)/i', '$2', $row['expert']);
    $value = form_sql($value);
    if ($value !== '') {
        run_query("UPDATE " . $config['table_prefix'] . "filters SET expert = '$value' WHERE id = " . $row['id']);
    } else {
        $file = substr(str_replace("\\", "/", __FILE__),
            strrpos(str_replace("\\", "/", __FILE__), "/") + 1);
        die("<b class='error_convert'>{$lang['error_convert']}</b><br><br><b>Error</b>: UPDATE filters!<br><b>File</b>: $file, str " . __LINE__);
    }
}