Ejemplo n.º 1
0
        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();
                    if (!$cData->Copy($ID)) {
                        $lAdmin->AddGroupError(GetMessage("MAIN_EDIT_ERROR") . $cData->LAST_ERROR, $ID);
                    }
                    break;
            }
        } else {
            $lAdmin->AddUpdateError(GetMessage("ADV_NO_RIGHTS_EDIT"), $ID);
        }
    }
}
Ejemplo n.º 2
0
                $arFields["arrCOUNTRY"][] = array("COUNTRY_ID" => $ar[0], "REGION" => $ar[1], "CITY_ID" => false);
            }
        } else {
            $arFields["STAT_TYPE"] = "COUNTRY";
            $arFields["arrCOUNTRY"] = explode(",", $_POST["ALL_STAT_TYPE_VALUES"]);
        }
        if (!$arBanner and $ID > 0) {
            $rsBanner = CAdvBanner::GetByID($ID);
            if ($arBanner = $rsBanner->Fetch()) {
                if ($DATE_SHOW_FROM != $arBanner["DATE_SHOW_FROM"] or $DATE_SHOW_TO != $arBanner["DATE_SHOW_TO"] or $RESET_SHOW_COUNT == "Y") {
                    $arFields["DATE_SHOW_FIRST"] = "null";
                }
            }
        }
    }
    if ($ID = CAdvBanner::Set($arFields, $ID)) {
        // test if Set finished secsesfully.
        if (strlen($strError) <= 0) {
            if ($_POST["save"] != '') {
                LocalRedirect("/bitrix/admin/adv_banner_list.php?lang=" . LANGUAGE_ID);
            } else {
                LocalRedirect("/bitrix/admin/adv_banner_edit.php?ID=" . $ID . "&CONTRACT_ID=" . $CONTRACT_ID . "&lang=" . LANGUAGE_ID . "&action=" . $action . "&" . $tabControl->ActiveTabParam());
            }
        }
    }
    $TEMPLATE_FILES = serialize($templateFilesErr);
    $DB->PrepareFields("b_adv_banner");
}
$arrSites = array();
$rs = CSite::GetList($by = "sort", $order = "asc");
while ($ar = $rs->Fetch()) {
Ejemplo n.º 3
0
 function Copy($BANNER_ID, $CHECK_RIGHTS = "Y")
 {
     $ID = 0;
     $rsBanner = CAdvBanner::GetByID($BANNER_ID, $CHECK_RIGHTS);
     if ($arBanner = $rsBanner->Fetch()) {
         $arFields = array("CONTRACT_ID" => $arBanner["CONTRACT_ID"], "TYPE_SID" => $arBanner["TYPE_SID"], "STATUS_SID" => $arBanner["STATUS_SID"], "STATUS_COMMENTS" => $arBanner["STATUS_COMMENTS"], "NAME" => $arBanner["NAME"], "GROUP_SID" => $arBanner["GROUP_SID"], "ACTIVE" => $arBanner["ACTIVE"], "WEIGHT" => $arBanner["WEIGHT"], "MAX_VISITOR_COUNT" => $arBanner["MAX_VISITOR_COUNT"], "RESET_VISITOR_COUNT" => "Y", "SHOWS_FOR_VISITOR" => $arBanner["SHOWS_FOR_VISITOR"], "MAX_SHOW_COUNT" => $arBanner["MAX_SHOW_COUNT"], "RESET_SHOW_COUNT" => "Y", "FIX_CLICK" => $arBanner["FIX_CLICK"], "MAX_CLICK_COUNT" => $arBanner["MAX_CLICK_COUNT"], "RESET_CLICK_COUNT" => $arBanner["RESET_CLICK_COUNT"], "DATE_SHOW_FROM" => $arBanner["DATE_SHOW_FROM"], "DATE_SHOW_TO" => $arBanner["DATE_SHOW_TO"], "IMAGE_ALT" => $arBanner["IMAGE_ALT"], "URL" => $arBanner["URL"], "URL_TARGET" => $arBanner["URL_TARGET"], "NO_URL_IN_FLASH" => $arBanner["NO_URL_IN_FLASH"], "CODE" => $arBanner["CODE"], "CODE_TYPE" => $arBanner["CODE_TYPE"], "STAT_EVENT_1" => $arBanner["STAT_EVENT_1"], "STAT_EVENT_2" => $arBanner["STAT_EVENT_2"], "STAT_EVENT_3" => $arBanner["STAT_EVENT_3"], "FOR_NEW_GUEST" => $arBanner["FOR_NEW_GUEST"], "COMMENTS" => $arBanner["COMMENTS"], "SHOW_USER_GROUP" => $arBanner["SHOW_USER_GROUP"], "arrSHOW_PAGE" => CAdvBanner::GetPageArray($BANNER_ID, "SHOW"), "arrNOT_SHOW_PAGE" => CAdvBanner::GetPageArray($BANNER_ID, "NOT_SHOW"), "STAT_TYPE" => $arBanner["STAT_TYPE"], "arrCOUNTRY" => CAdvBanner::GetCountryArray($BANNER_ID, array("COUNTRY_ID", "REGION", "CITY_ID")), "arrSTAT_ADV" => CAdvBanner::GetStatAdvArray($BANNER_ID), "arrWEEKDAY" => CAdvBanner::GetWeekdayArray($BANNER_ID), "arrSITE" => CAdvBanner::GetSiteArray($BANNER_ID), "arrUSERGROUP" => CAdvBanner::GetGroupArray($BANNER_ID), "KEYWORDS" => $arBanner["KEYWORDS"], "SEND_EMAIL" => "Y", "AD_TYPE" => $arBanner["AD_TYPE"], "FLASH_TRANSPARENT" => $arBanner["FLASH_TRANSPARENT"], "arrFlashIMAGE_ID" => $arBanner["arrFlashIMAGE_ID"], "FLASH_JS" => $arBanner["FLASH_JS"], "FLASH_VER" => $arBanner["FLASH_VER"]);
         if (intval($arBanner["IMAGE_ID"]) > 0) {
             $arrIMAGE = CFile::MakeFileArray($arBanner["IMAGE_ID"]);
             $arrIMAGE["MODULE_ID"] = "advertising";
             $arFields["arrIMAGE_ID"] = $arrIMAGE;
         }
         $ID = CAdvBanner::Set($arFields, 0);
     }
     return $ID;
 }
Ejemplo n.º 4
0
}
if (!CModule::IncludeModule('advertising')) {
    return;
}
$dbResult = CAdvContract::GetByID(1);
if (!$dbResult->Fetch()) {
    return;
}
//Types
$arTypes = array(array("SID" => "100x100_ONE", "ACTIVE" => "Y", "SORT" => 1, "NAME" => GetMessage("PORTAL_ADV_100_100_ONE"), "DESCRIPTION" => ""), array("SID" => "100x100_TWO", "ACTIVE" => "Y", "SORT" => 2, "NAME" => GetMessage("PORTAL_ADV_100_100_TWO"), "DESCRIPTION" => ""), array("SID" => "468x60_TOP", "ACTIVE" => "Y", "SORT" => 3, "NAME" => GetMessage("PORTAL_ADV_468_60_TOP"), "DESCRIPTION" => ""), array("SID" => "468x60_BOTTOM", "ACTIVE" => "Y", "SORT" => 4, "NAME" => GetMessage("PORTAL_ADV_468_60_BOTTOM"), "DESCRIPTION" => ""), array("SID" => "INFO", "ACTIVE" => "Y", "NAME" => GetMessage("PORTAL_ADV_INFO"), "SORT" => "5", "DESCRIPTION" => ""));
foreach ($arTypes as $arFields) {
    $dbResult = CAdvType::GetByID($arTypes["SID"], $CHECK_RIGHTS = "N");
    if ($dbResult && $dbResult->Fetch()) {
        continue;
    }
    CAdvType::Set($arFields, "", $CHECK_RIGHTS = "N");
}
//Matrix
$arWeekday = array("SUNDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "MONDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "TUESDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "WEDNESDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "THURSDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "FRIDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "SATURDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23));
$pathToBanner = WIZARD_SERVICE_ABSOLUTE_PATH . "/banners/" . LANGUAGE_ID;
$arBanners = array(array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_468_60_BOTTOM_NAME"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "banner_468x60.gif", "type" => "image/gif", "tmp_name" => $pathToBanner . "/banner_468x60.gif", "error" => "0", "size" => @filesize($pathToBanner . "/banner_468x60.gif"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_468_60_BOTTOM_NAME"), "URL" => "/company/novice.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "banner_468x60.gif"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "ACTIVE" => "Y", "FIX_SHOW" => "N", "FIX_CLICK" => "N", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "banner_100x100.gif", "type" => "image/gif", "tmp_name" => $pathToBanner . "/banner_100x100.gif", "error" => "0", "size" => @filesize($pathToBanner . "/banner_100x100.gif"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "URL" => "/company/novice.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "banner_100x100.gif"), array("CONTRACT_ID" => 1, "TYPE_SID" => "INFO", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "ACTIVE" => "Y", "FIX_SHOW" => "Y", "FIX_CLICK" => "N", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "new.jpg", "type" => "image/jpeg", "tmp_name" => $_SERVER["DOCUMENT_ROOT"] . "/images/" . LANGUAGE_ID . "/company/about/new.jpg", "error" => "0", "size" => @filesize($_SERVER["DOCUMENT_ROOT"] . "/images/" . LANGUAGE_ID . "/company/about/new.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "URL" => "/company/novice.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "new.jpg", "SHOWS_FOR_VISITOR" => 10), array("CONTRACT_ID" => 1, "TYPE_SID" => "INFO", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_dashboard"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "dashboard.gif", "type" => "image/gif", "tmp_name" => $pathToBanner . "/dashboard.gif", "error" => "0", "size" => @filesize($pathToBanner . "/dashboard.gif"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_dashboard"), "URL" => "/desktop.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "dashboard.gif"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_01_absence"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "01_absence_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/01_absence_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/01_absence_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_01_absence"), "URL" => GetMessage("PORTAL_ADV_01_absence_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "01_absence_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_01_absence"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "01_absence_01.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/01_absence_01.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/01_absence_01.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_01_absence"), "URL" => GetMessage("PORTAL_ADV_01_absence_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "01_absence_01.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_03_outlook"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "02_outlook_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/02_outlook_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/02_outlook_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_03_outlook"), "URL" => GetMessage("PORTAL_ADV_03_outlook_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "02_outlook_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_03_outlook"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "02_outlook_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/02_outlook_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/02_outlook_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_03_outlook"), "URL" => GetMessage("PORTAL_ADV_03_outlook_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "02_outlook_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "Y", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_01.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_01.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_01.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_01.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_02_01.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_02_01.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_02_01.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_02_01.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_02_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_02_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_02_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_02_02.jpg"));
foreach ($arBanners as $arFields) {
    $dbResult = CAdvBanner::GetList($by, $order, array("COMMENTS" => $arFields["COMMENTS"], "COMMENTS_EXACT_MATCH" => "Y"), $is_filtered, "N");
    if ($dbResult && $dbResult->Fetch()) {
        continue;
    }
    CAdvBanner::Set($arFields, "", $CHECK_RIGHTS = "N");
}
if (!WIZARD_IS_RERUN) {
    $APPLICATION->SetGroupRight("advertising", WIZARD_PORTAL_ADMINISTRATION_GROUP, "W");
}