コード例 #1
0
ファイル: backend.php プロジェクト: Acsac/CMS-RuDi
}

if ($opt == 'submit_discount' || $opt == 'update_discount') {
    if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

    $item['title']    = cmsCore::request('title', 'str');
    $item['cat_id']   = cmsCore::request('cat_id', 'int');
    $item['sign']     = cmsCore::request('sign', 'str');
    $item['value']    = cmsCore::request('value', 'str');
    $item['unit']     = cmsCore::request('unit', 'str');
    $item['if_limit'] = cmsCore::request('if_limit', 'int', 0);

    if ($opt == 'update_discount') {
        $model->updateDiscount(cmsCore::request('item_id', 'int', 0), $item);
    } else {
        $model->addDiscount($item);
    }
    cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
    cmsCore::redirect('?view=components&do=config&opt=list_discount&id='.$id);
}

if($opt == 'delete_discount') {
    $model->deleteDiscount(cmsCore::request('item_id', 'int', 0));
    cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
    cmsCore::redirect('?view=components&do=config&id='.$id.'&opt=list_discount');
}

if ($opt == 'show_cat') {
    $item_id = cmsCore::request('item_id', 'int');
    $sql = "UPDATE cms_uc_cats SET published = 1 WHERE id = '$item_id'";
    cmsCore::c('db')->query($sql) ;