Esempio n. 1
0
            LocalRedirect(strlen($save) > 0 ? "smile_gallery.php?lang=" . LANG . "&" . GetFilterParams("filter_", false) : "smile_gallery_edit.php?lang=" . LANG . "&ID=" . $ID . "&" . GetFilterParams("filter_", false));
        }
    }
    $e = new CAdminException($arError);
    $message = new CAdminMessage($ID > 0 ? GetMessage("ERROR_EDIT_SMILE") : GetMessage("ERROR_ADD_SMILE"), $e);
    $bInitVars = true;
}
if ($bInitVars && !empty($arFields)) {
    if (isset($arFields['NAME'])) {
        foreach ($arFields['NAME'] as $key => $value) {
            $arFields['NAME'][htmlspecialcharsbx($key)] = htmlspecialcharsbx($value);
        }
    }
    $arSmileSet = array("SORT" => isset($arFields['SORT']) ? intval($arFields['SORT']) : 300, "STRING_ID" => isset($arFields['STRING_ID']) ? htmlspecialcharsbx($arFields['STRING_ID']) : "", "NAME" => isset($arFields['NAME']) ? $arFields['NAME'] : array());
} elseif ($ID > 0) {
    $arSmileSet = CSmileGallery::getById($ID, CSmileSet::GET_ALL_LANGUAGE);
} else {
    if (isset($_REQUEST['NAME'])) {
        foreach ($_REQUEST['NAME'] as $key => $value) {
            $_REQUEST['NAME'][htmlspecialcharsbx($key)] = htmlspecialcharsbx($value);
        }
    }
    $arSmileSet = array("SORT" => isset($_REQUEST['SORT']) ? intval($_REQUEST['SORT']) : 300, "STRING_ID" => isset($_REQUEST['STRING_ID']) ? htmlspecialcharsbx($_REQUEST['STRING_ID']) : "", "NAME" => isset($_REQUEST['NAME']) ? $_REQUEST['NAME'] : array());
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aMenu = array(array("TEXT" => GetMessage("SMILE_BTN_BACK"), "LINK" => "/bitrix/admin/smile_gallery.php?lang=" . LANG . "&" . GetFilterParams("filter_", false), "ICON" => "btn_list"));
if ($ID > 0) {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("TEXT" => GetMessage("SMILE_BTN_NEW"), "LINK" => "/bitrix/admin/smile_gallery_edit.php?lang=" . LANG . "&" . GetFilterParams("filter_", false), "ICON" => "btn_new");
    if ($arSmileSet["STRING_ID"] != 'bitrix') {
        $aMenu[] = array("TEXT" => GetMessage("SMILE_BTN_DELETE"), "LINK" => "javascript:if(confirm('" . GetMessage("SMILE_BTN_DELETE_CONFIRM") . "')) window.location='/bitrix/admin/smile_gallery.php?action=delete&ID[]=" . $ID . "&lang=" . LANG . "&" . bitrix_sessid_get() . "#tb';", "ICON" => "btn_delete");
Esempio n. 2
0
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
$sTableID = "tbl_smile_gallery";
$oSort = new CAdminSorting($sTableID, "ID", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array();
$lAdmin->InitFilter($arFilterFields);
$arFilter = array();
if ($arID = $lAdmin->GroupAction()) {
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
        }
        if ($_REQUEST['action'] == 'delete') {
            $arSmileSet = CSmileGallery::getById($ID);
            if ($arSmileSet["STRING_ID"] != 'bitrix') {
                CSmileGallery::delete($ID);
            }
        }
    }
}
if ($lAdmin->EditAction()) {
    foreach ($FIELDS as $ID => $arFields) {
        $ID = IntVal($ID);
        if ($ID <= 0) {
            continue;
        }
        CSmileGallery::update($ID, array('LANG' => array(LANGUAGE_ID => $arFields['NAME']), 'STRING_ID' => $arFields['STRING_ID'], 'SORT' => $arFields['SORT']));
    }
}