Ejemplo n.º 1
0
 }
 foreach ($arID as $ID) {
     if (IntVal($ID) <= 0) {
         continue;
     }
     $ID = IntVal($ID);
     $ifrsBanner = CAdvBanner::GetByID($ID);
     if ($ifarBanner = $ifrsBanner->Fetch()) {
         $ifCONTRACT_ID = $ifarBanner["CONTRACT_ID"];
     }
     if (is_array($arrPERM[$ifCONTRACT_ID]) && in_array("ADD", $arrPERM[$ifCONTRACT_ID])) {
         switch ($_REQUEST['action']) {
             case "delete":
                 @set_time_limit(0);
                 $DB->StartTransaction();
                 if (!CAdvBanner::Delete($ID)) {
                     $DB->Rollback();
                     $lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
                 }
                 $DB->Commit();
                 break;
             case "activate":
             case "deactivate":
                 $cData = new CAdvBanner();
                 $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
                 if (!$cData->Set($arFields, $ID)) {
                     $lAdmin->AddGroupError(GetMessage("MAIN_EDIT_ERROR") . $cData->LAST_ERROR, $ID);
                 }
                 break;
             case "copy":
                 $cData = new CAdvBanner();
Ejemplo n.º 2
0
 function Delete($TYPE_SID, $CHECK_RIGHTS = "Y")
 {
     $err_mess = CAdvType_all::err_mess() . "<br>Function: Delete<br>Line: ";
     global $DB, $strError;
     if (strlen($TYPE_SID) <= 0) {
         return false;
     }
     if ($CHECK_RIGHTS == "Y") {
         $isAdmin = CAdvContract::IsAdmin();
     } else {
         $isAdmin = true;
     }
     if ($isAdmin) {
         $strSql = "SELECT ID FROM b_adv_banner WHERE TYPE_SID = '" . $DB->ForSql($TYPE_SID, 255) . "'";
         $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
         while ($ar = $rs->Fetch()) {
             CAdvBanner::Delete($ar["ID"], "N");
         }
         CAdvType::DeleteContractLink($TYPE_SID);
         $strSql = "DELETE FROM b_adv_type WHERE SID = '" . $DB->ForSql($TYPE_SID, 255) . "'";
         $DB->Query($strSql, false, $err_mess . __LINE__);
         return true;
     } else {
         $strError .= GetMessage("AD_ERROR_NOT_ENOUGH_PERMISSIONS_TYPE") . "<br>";
     }
     return false;
 }