require_once dirname(__FILE__) . "/SMPHPToolkit/SMAjax.php";
CADBiSNew::instance()->script_src('js/ajax/buffer.js');
CADBiSNew::instance()->link_href('skins/smadbis/css/grid.css');
$BILL = new CBilling($GV["dbhost"], $GV["dbname"], $GV["dblogin"], $GV["dbpassword"]);
$cats = $BILL->GetUrlCategoriesAssoc();
// any action on selected keywords
if (isset($_POST['selected_kwds'])) {
    $selkwds = $_POST['selected_kwds'];
    foreach ($selkwds as $word => $on) {
        if (isset($_POST['btnLeave'])) {
            $BILL->ResolveUrlCategoryConflict($word);
        } elseif (isset($_POST['btnDelete'])) {
            $BILL->DeleteUrlCategoryKeyword($word);
            $BILL->ResolveUrlCategoryConflict($word);
        } elseif (isset($_POST['btnReplace'])) {
            $keyword = $BILL->GetUrlCategoryConflictKeyword($word);
            $BILL->ReplaceUrlCategoryKeyword($word, $keyword['forcid']);
            $BILL->ResolveUrlCategoryConflict($word);
        } elseif (isset($_POST['btnUnsense'])) {
            $BILL->AddUrlCategoryUnsenseword($word);
            $BILL->DeleteUrlCategoryKeyword($word);
            $BILL->ResolveUrlCategoryConflict($word);
        }
    }
}
class conflicts_act_formatter extends grid_formatter
{
    public function format($data, $type, $number = 0, $columns = null)
    {
        return '<input type="checkbox" name="selected_kwds[' . $data['keyword'] . '][]" />';
    }