Esempio n. 1
0
';
				</script><?php 
            }
        }
    } elseif ($photo_list_action == 'delete' && $arParams["PERMISSION"] >= "U") {
        CUtil::JSPostUnEscape();
        CModule::IncludeModule("iblock");
        @set_time_limit(0);
        $APPLICATION->ResetException();
        $res = CIBlockElement::Delete($arParams["ELEMENT_ID"]);
        if ($res) {
            $arEventFields = array("ID" => $arParams["ELEMENT_ID"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => $arParams["SECTION_ID"]);
            foreach (GetModuleEvents("photogallery", "OnAfterPhotoDrop", true) as $arEvent) {
                ExecuteModuleEventEx($arEvent, array($arEventFields, $arParams));
            }
            PClearComponentCacheEx($arParams["IBLOCK_ID"], array(0, $arParams["SECTION_ID"]));
        } else {
            ?>
			<script>
				window.bxph_error = '<?php 
            echo GetMessage("DEL_ITEM_ERROR") . ($ex = $APPLICATION->GetException() ? ': ' . $ex->GetString() : '');
            ?>
';
			</script>
			<?php 
        }
    } elseif ($photo_list_action == 'edit' && $arParams["PERMISSION"] >= "U") {
        CUtil::JSPostUnEscape();
        CModule::IncludeModule("iblock");
        if (intVal($_REQUEST["SECTION_ID"]) > 0) {
            $arParams["SECTION_ID"] = intVal($_REQUEST["SECTION_ID"]);
Esempio n. 2
0
                    $arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["GALLERIES_URL"], array("USER_ID" => $arParams["USER_ID"]));
                } else {
                    $arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["GALLERY_URL"], array("USER_ALIAS" => $_REQUEST["CODE"]));
                }
            }
        }
    }
    if (!empty($arError)) {
        $arResult["ERROR_MESSAGE"] = PhotoShowError($arError);
        $arResult["FORM"]["ID"] = $_REQUEST["ID"];
        $arResult["FORM"]["CODE"] = $_REQUEST["CODE"];
        $arResult["FORM"]["NAME"] = $_REQUEST["NAME"];
        $arResult["FORM"]["DESCRIPTION"] = $_REQUEST["DESCRIPTION"];
        $arResult["FORM"]["UF_DEFAULT"] = $_REQUEST["ACTIVE"];
    } else {
        PClearComponentCacheEx($arParams["IBLOCK_ID"], array($ID > 0 ? $ID : 0), array($_REQUEST["CODE"]), array($arResult["GALLERY"]["CREATED_BY"]));
        if (!empty($_REQUEST["back_url"])) {
            LocalRedirect($_REQUEST["back_url"]);
        } else {
            LocalRedirect($arResult["URL"]);
        }
    }
} elseif ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (!empty($_REQUEST["back_url"])) {
        LocalRedirect($_REQUEST["back_url"]);
    }
    if ($arParams["ABS_PERMISSION"] >= "W" || count($arResult["GALLERIES"]) > 1) {
        $url = CComponentEngine::MakePathFromTemplate($arParams["GALLERIES_URL"], array("USER_ID" => $arParams["USER_ID"]));
    } elseif (!empty($arResult["GALLERY"]["CODE"])) {
        $url = CComponentEngine::MakePathFromTemplate($arParams["GALLERY_URL"], array("USER_ALIAS" => $arResult["GALLERY"]["CODE"]));
    } else {
Esempio n. 3
0
 function onAfterUpload($data, $post, $files)
 {
     $arParams = $this->arParams;
     $arResult = $this->arResult;
     $sectionsIds = array(0, $arParams['SECTION_ID']);
     $arGalleriesIds = array(0);
     $arUsers = array();
     if ($arResult['SECTION'] && $arResult['SECTION']['IBLOCK_SECTION_ID']) {
         $sectionsIds[] = $arResult['SECTION']['IBLOCK_SECTION_ID'];
     }
     if ($arParams["BEHAVIOUR"] == "USER") {
         $sectionsIds[] = $arResult["GALLERY"]["ID"];
     }
     if (isset($arResult["GALLERY"]["CODE"])) {
         $arGalleriesIds[] = $arResult["GALLERY"]["CODE"];
         if ($arResult["GALLERY"]["CREATED_BY"]) {
             $arUsers[] = $arResult["GALLERY"]["CREATED_BY"];
         }
     }
     PClearComponentCacheEx($arParams["IBLOCK_ID"], $sectionsIds, $arGalleriesIds, $arUsers);
     return true;
 }
Esempio n. 4
0
            $bs = new CIBlockSection();
            if ($bs->CheckFields($arFields)) {
                if (!empty($arFiles)) {
                    $arFields["DETAIL_PICTURE"] = $arFiles["DETAIL_PICTURE"];
                }
                $GLOBALS["UF_DEFAULT"] = $arFields["UF_DEFAULT"];
                $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
                $res = $bs->Add($arFields);
                $db_res = $bs->GetByID($res);
                if ($db_res && ($res = $db_res->Fetch())) {
                    $arResult["VARIABLES"]["GALLERY"] = $res;
                    $arUserIds = array();
                    if ($object == "user") {
                        $arUserIds[] = $USER->GetId();
                    }
                    PClearComponentCacheEx($arParams["IBLOCK_ID"], array(0, $res['ID']), array(0, $res['CODE']), $arUserIds);
                }
                if (!empty($arFiles)) {
                    @unlink($arFiles["PICTURE"]["tmp_name"]);
                    @unlink($arFiles["DETAIL_PICTURE"]["tmp_name"]);
                }
            }
        }
    }
    "";
} elseif ($user_alias != "NEW_ALIAS") {
    $cache_id = serialize(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "USER_ALIAS" => $user_alias, "SECTION_ID" => 0));
    $cache_path = "/" . SITE_ID . "/photogallery/" . $arParams["IBLOCK_ID"] . "/gallery" . $user_alias;
    if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
        $res = $cache->GetVars();
        $arResult["VARIABLES"]["GALLERY"] = $res["GALLERY"];
Esempio n. 5
0
    $arParams = array_merge($_REQUEST["checkParams"], $_REQUEST["reqParams"]);
    $elementId = intVal($_REQUEST["ELEMENT_ID"]);
    if ($_REQUEST['getRaiting'] == 'Y' && $arParams["USE_RATING"] == "Y" && $arParams["PERMISSION"] >= "R") {
        if ($arParams["DISPLAY_AS_RATING"] == "rating_main") {
            // Don't delete <!--BX_PHOTO_RATING-->, <!--BX_PHOTO_RATING_END--> comments - they are used in js to catch html content
            ?>
<!--BX_PHOTO_RATING--><?php 
            $arParams["RATING_MAIN_TYPE"] = COption::GetOptionString("main", "rating_vote_template", COption::GetOptionString("main", "rating_vote_type", "standart") == "like" ? "like" : "standart");
            if ($arParams["RATING_MAIN_TYPE"] == "like_graphic") {
                $arParams["RATING_MAIN_TYPE"] = "like";
            } else {
                if ($arParams["RATING_MAIN_TYPE"] == "standart") {
                    $arParams["RATING_MAIN_TYPE"] = "standart_text";
                }
            }
            $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", $arParams["RATING_MAIN_TYPE"], array("ENTITY_TYPE_ID" => "IBLOCK_ELEMENT", "ENTITY_ID" => $elementId, "OWNER_ID" => intval($_REQUEST["AUTHOR_ID"]), "PATH_TO_USER_PROFILE" => $arParams["PATH_TO_USER"], "AJAX_MODE" => "Y"), $this, array("HIDE_ICONS" => "Y"));
            ?>
<!--BX_PHOTO_RATING_END--><?php 
        } else {
            // It's important for correct functionality of iblock.vote component
            $_REQUEST["AJAX_CALL"] = "N";
            $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:iblock.vote", "ajax_photo", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "ELEMENT_ID" => $elementId, "READ_ONLY" => $arParams["READ_ONLY"], "MAX_VOTE" => $arParams["MAX_VOTE"], "VOTE_NAMES" => $arParams["VOTE_NAMES"], "DISPLAY_AS_RATING" => $arParams["DISPLAY_AS_RATING"], "INCLUDE_JS_FILE" => "N", "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"]), $this, array("HIDE_ICONS" => "Y"));
        }
    }
    if ($_REQUEST['increaseCounter'] == 'Y' && $arParams["PERMISSION"] >= "R") {
        CModule::IncludeModule("iblock");
        CIBlockElement::CounterInc($elementId);
        PClearComponentCacheEx($arParams["IBLOCK_ID"], array($arParams["SECTION_ID"]), false, false, false);
    }
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
Esempio n. 6
0
function onAfterUpload($Params)
{
    $savedData = CImageUploader::GetSavedData();
    $arParams = $Params['arParams'];
    $arResult = $Params['~arResult'];
    $savedData['UPLOADING_SUCCESS'] = "Y";
    CImageUploader::SetSavedData($savedData);
    $sectionsIds = array(0, $arParams['SECTION_ID']);
    $arGalleriesIds = array(0);
    $arUsers = array();
    if ($arResult['SECTION'] && $arResult['SECTION']['IBLOCK_SECTION_ID']) {
        $sectionsIds[] = $arResult['SECTION']['IBLOCK_SECTION_ID'];
    }
    if ($arParams["BEHAVIOUR"] == "USER") {
        $sectionsIds[] = $arResult["GALLERY"]["ID"];
    }
    if (isset($arResult["GALLERY"]["CODE"])) {
        $arGalleriesIds[] = $arResult["GALLERY"]["CODE"];
        if ($arResult["GALLERY"]["CREATED_BY"]) {
            $arUsers[] = $arResult["GALLERY"]["CREATED_BY"];
        }
    }
    PClearComponentCacheEx($arParams["IBLOCK_ID"], $sectionsIds, $arGalleriesIds, $arUsers);
}
Esempio n. 7
0
                            $res["GALLERY"] = $res_g;
                            $arSections[$res["ID"]] = $res;
                        }
                    }
                }
                if (!empty($res["GALLERY"]) && $iFileSize > 0) {
                    $gallery = $res["GALLERY"];
                    $gallery["UF_GALLERY_SIZE"] = doubleval($gallery["UF_GALLERY_SIZE"]) - $iFileSize;
                    $gallery["UF_GALLERY_SIZE"] = $gallery["UF_GALLERY_SIZE"] <= 0 ? 0 : $gallery["UF_GALLERY_SIZE"];
                    $arFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "UF_GALLERY_SIZE" => $gallery["UF_GALLERY_SIZE"]);
                    $GLOBALS["UF_GALLERY_SIZE"] = $arFields["UF_GALLERY_SIZE"];
                    $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
                    $bs = new CIBlockSection();
                    $bs->Update($gallery["ID"], $arFields, false, false);
                }
                PClearComponentCacheEx($arParams["IBLOCK_ID"], array($res["ID"], $res["IBLOCK_SECTION_ID"]));
            }
        }
        LocalRedirect($_REQUEST["from_detail_list"]);
    }
}
$file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/result_modifier.php"));
__IncludeLang($file);
$arParams["SHOW_BEST_ELEMENT"] = $arParams["SHOW_BEST_ELEMENT"] == "N" ? "N" : "Y";
$arResult["MENU_VARIABLES"] = array();
if ($this->__page !== "menu") {
    $sTempatePage = $this->__page;
    $sTempateFile = $this->__file;
    $this->__component->IncludeComponentTemplate("menu");
    $arResult["MENU_VARIABLES"] = $this->__component->__photogallery_values;
    $this->__page = $sTempatePage;
Esempio n. 8
0
                        CModule::IncludeModule("forum");
                        ForumDeleteTopic($arRes["FORUM_TOPIC_ID"]);
                    }
                    $events = GetModuleEvents("photogallery", "OnAfterPhotoDrop");
                    $arEventFields = array("ID" => $arRes["ID"], "SECTION_ID" => $arRes["IBLOCK_SECTION_ID"]);
                    $sectionsIds[] = $arRes["IBLOCK_SECTION_ID"];
                    while ($arEvent = $events->Fetch()) {
                        ExecuteModuleEventEx($arEvent, array($arEventFields, $arParams));
                    }
                    break;
                case "move":
                    $bs = new CIBlockElement();
                    $itemID = $bs->Update($itemID, array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_SECTION" => $_REQUEST["TO_SECTION_ID"]));
                    if ($itemID <= 0) {
                        $arError[] = array("id" => "move error", "text" => PhotoShowError(array("ID" => $itemID, "code" => "NOT_UPDATED", "title" => $bs->LAST_ERROR, "DATA" => $arRes)));
                    } else {
                        $sectionsIds[] = $arRes["TO_SECTION_ID"];
                    }
                    break;
            }
        }
        PClearComponentCacheEx($arParams["IBLOCK_ID"], $sectionsIds, $arGalleriesIds);
    }
    if (!empty($arError)) {
        $e = new CAdminException($arError);
        $arResult["ERROR_MESSAGE"] = $e->GetString();
    } elseif (!empty($_REQUEST["REDIRECT_URL"])) {
        LocalRedirect($_REQUEST["REDIRECT_URL"]);
    }
    $arResult["bVarsFromForm"] = $bVarsFromForm ? "Y" : "N";
}
Esempio n. 9
0
    }
}
/********************************************************************
				/Input params
********************************************************************/
$arResult = array("~URL_TEMPLATES" => $arUrlTemplates, "URL_TEMPLATES" => $arResult["URL_TEMPLATES"], "VARIABLES" => $arVariables, "ALIASES" => is_array($arVariableAliases) ? $arVariableAliases : array(), "PAGE_NAME" => strToUpper($componentPage), "backurl_encode" => urlencode($GLOBALS['APPLICATION']->GetCurPageParam()));
/********************************************************************
				Actions
********************************************************************/
if ($_REQUEST["ACTION"] == "public" && $arParams["PERMISSION"] >= "W" && check_bitrix_sessid() && is_array($_REQUEST["items"])) {
    CModule::IncludeModule("iblock");
    foreach ($_REQUEST["items"] as $res) {
        CIBlockElement::SetPropertyValues($res, $arParams["IBLOCK_ID"], "Y", "APPROVE_ELEMENT");
        CIBlockElement::SetPropertyValues($res, $arParams["IBLOCK_ID"], "Y", "PUBLIC_ELEMENT");
    }
    PClearComponentCacheEx($arParams["IBLOCK_ID"], array(0));
    $url = $arParams["DETAIL_LIST_URL"];
    if (empty($url)) {
        $url = $APPLICATION->GetCurPageParam("PAGE_NAME=detail_list", array("PAGE_NAME", "SECTION_ID", "ELEMENT_ID", "ACTION", "sessid", "edit", "AJAX_CALL"));
    }
    $url = CComponentEngine::MakePathFromTemplate($url, array());
    if (strpos($url, "?") === false) {
        $url .= "?";
    }
    $url .= "&moderate=Y";
    LocalRedirect($url);
}
if ($arParams["PERMISSION"] >= "W" && $_REQUEST["galleries_recalc"] == "Y") {
    $componentPage = "galleries_recalc";
}
/********************************************************************
Esempio n. 10
0
            $sectionsIds[] = $arParams['SECTION_ID'];
        }
        if ($arFields && $arFields['IBLOCK_SECTION_ID']) {
            $sectionsIds[] = $arFields['IBLOCK_SECTION_ID'];
        }
        if (isset($arResult) && isset($arResult['SECTION']['IBLOCK_SECTION_ID'])) {
            $sectionsIds[] = $arResult['SECTION']['IBLOCK_SECTION_ID'];
        }
        if (isset($arResult['GALLERY']['CODE'])) {
            $sectionsIds[] = $arResult['GALLERY']['ID'];
            $arGalleriesIds[] = $arResult["GALLERY"]["CODE"];
            if ($arResult["GALLERY"]["CREATED_BY"]) {
                $arUsers[] = $arResult["GALLERY"]["CREATED_BY"];
            }
        }
        PClearComponentCacheEx($iblockId, $sectionsIds, $arGalleriesIds, $arUsers);
        if ($arParams["AJAX_CALL"] == "Y") {
            $APPLICATION->RestartBuffer();
            echo CUtil::PhpToJSObject($arResultFields);
            die;
        } else {
            LocalRedirect(CHTTP::urlDeleteParams($arResult["URL"], array("sessid", "edit"), true));
        }
    }
    $arResult["ERROR_MESSAGE"] = $strWarning;
}
/********************************************************************
				/Actions
********************************************************************/
if ($arParams["AJAX_CALL"] == "Y" || $arParams["BX_PHOTO_AJAX"]) {
    $GLOBALS['APPLICATION']->RestartBuffer();