<?php
// удаляем код несуществующих доп.действий
$result = run_query("SELECT * FROM " . $config["table_prefix"] . "calc_cond WHERE type=24");
while ($row = sql_fetch_assoc($result)) {
    $result2 = run_query("SELECT * FROM " . $config["table_prefix"] . "buttons WHERE id=" . $row['param']);
    if (!sql_fetch_assoc($result2)) {
        run_query("DELETE FROM " . $config["table_prefix"] . "calc WHERE id=" . $row['calc_id']);
        run_query("DELETE FROM " . $config["table_prefix"] . "calc_cond WHERE calc_id=" . $row['calc_id']);
    }
}
?>