1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
include.php
См. документацию.
1<?
2##############################################
3# Bitrix Site Manager IBlock #
4# Copyright (c) 2002-2007 Bitrix #
5# https://www.bitrixsoft.com #
6# mailto:admin@bitrixsoft.com #
7##############################################
9 "photogallery",
10 array(
11 "CPGalleryInterface" => "tools/components_lib.php",
12 "CPhotogalleryElement" => "classes/general/element.php",
13 "CRatingsComponentsPhotogallery" => "classes/general/ratings_components.php",
14 "CPhotogalleryNotifySchema" => "classes/general/photo_notify_schema.php",
15 )
16);
17if (!isset($GLOBALS["PHOTOGALLERY_VARS"]) || !is_array($GLOBALS["PHOTOGALLERY_VARS"]))
18{
19 $GLOBALS["PHOTOGALLERY_VARS"] = array(
20 "arSections" => array(),
21 "arGalleries" => array(),
22 "arIBlock" => array());
23}
24
25IncludeModuleLangFile(__FILE__);
26
27// Spisok oshibok
28// fatal'nye oshibki
29// 100 - oshibka pri proverke sessii
30// ne najdeny elementy
31// 101 - ne najden infoblok
32// 102 - ne najdena sekciya
33// 103 - ne najden element infobloka
34// 104 - ne najdena fotogalereya
35// 105 - ne najden pol'zovatel'
36
37
38// net prav
39// 110 - dlya dostupa neobhodimo avtorizovat'sya
40// 111 - net dostupa k infobloku
41// 112 - net prav dlya sozdaniya galerei
42// 113 - net prav dlya sozdaniya ewe odnoj galerei (single)
43
44
45// Oshibki dannyh
46// 200 - pustoj zapros
47// 201 - ne ukazany obyazatel'nye parametry
48
49// Pol'zovatel'skie oshibki (500-600)
50
51function PhotoShowError($arError, $arShowFields = array("ID", "NAME"), $bShowErrorCode = false)
52{
53 $bShowErrorCode = ($bShowErrorCode === true ? true : false);
54 $sReturn = "";
55 $tmp = false;
56 $arRes = array();
57 if (empty($arError))
58 return $sReturn;
59
60 if (!is_array($arError))
61 {
62 $sReturn = $arError;
63 }
64 else
65 {
66 if (isset($arError["title"]))
67 $sReturn = $arError["title"];
68
69 if (isset($arError["code"]))
70 {
71 if (empty($sReturn))
72 {
73 $str = GetMessage("P_ERROR_".$arError["code"]);
74 if (!empty($str))
75 $sReturn = $str;
76 }
77 $sReturn .= ($bShowErrorCode ? " [CODE: ".$arError["code"]."]" : "");
78 }
79
80 if (isset($arError["DATA"]) || isset($arError["data"]))
81 {
82 $tmp = (isset($arError["DATA"]) ? $arError["DATA"] : $arError["data"]);
83
84 if (!empty($arShowFields) && is_array($arShowFields))
85 {
86 if (in_array("ID", $arShowFields) && !empty($tmp["ID"]))
87 {
88 $arRes[] = "ID: ".$tmp["ID"];
89 $tmp["ID"] = false;
90 }
91
92 foreach ($arShowFields as $key)
93 {
94 if (empty($tmp["~".$key]) && empty($tmp[$key]))
95 continue;
96 $arRes[] = $key.": ".(!empty($tmp["~".$key]) ? htmlspecialcharsbx($tmp["~".$key]) : $tmp[$key]);
97 }
98 }
99 else
100 {
101 $arRes[] = $tmp;
102 }
103 if (!empty($arRes))
104 $sReturn .= " (".implode(", ", $arRes).")";
105 }
106 }
107 return $sReturn;
108}
109
111{
112 $Browser = "";
113 $str = mb_strtolower($_SERVER['HTTP_USER_AGENT']);
114 if (mb_strpos($str, "opera") !== false)
115 $Browser = "opera";
116 elseif (mb_strpos($str, "msie") !== false)
117 {
118 $Browser = "ie";
119 if (mb_strpos($str, "win") !== false)
120 $Browser = "win_ie";
121 }
122 return $Browser;
123}
124
125function PhotoDateFormat($format="", $timestamp="")
126{
127 if (empty($timestamp))
128 return "";
129 if(LANG=="en")
130 {
131 return date($format, $timestamp);
132 }
133 elseif(preg_match_all("/[FMlD]/", $format, $matches))
134 {
135 $ar = preg_split("/[FMlD]/", $format);
136 $result = "";
137 foreach($matches[0] as $i=>$match)
138 {
139 switch($match)
140 {
141 case "F":$match=GetMessage("P_MONTH_".date("n", $timestamp));break;
142 case "M":$match=GetMessage("P_MON_".date("n", $timestamp));break;
143 case "l":$match=GetMessage("P_DAY_OF_WEEK_".date("w", $timestamp));break;
144 case "D":$match=GetMessage("P_DOW_".date("w", $timestamp));break;
145 }
146 $result .= date($ar[$i], $timestamp).$match;
147 }
148 $result .= date($ar[count($ar)-1], $timestamp);
149 return $result;
150 }
151 else
152 return date($format, $timestamp);
153}
154
155function PhotoFormatDate($strDate, $format="DD.MM.YYYY HH:MI:SS", $new_format="DD.MM.YYYY HH:MI:SS")
156{
157 global $DB;
158
159 $strDate = trim($strDate);
160
161 $new_format = str_replace("MI","I", $new_format);
162 $new_format = preg_replace("/([DMYIHS])\\1+/isu", "\\1", $new_format);
163 $new_format_len = mb_strlen($new_format);
164 $arFormat = preg_split('/[^0-9A-Za-z]/', mb_strtoupper($format));
165 $arDate = preg_split('/[^0-9]/', $strDate);
166 $arParsedDate=Array();
167 $bound = min(count($arFormat), count($arDate));
168
169 for($i=0; $i<$bound; $i++)
170 {
171 if(preg_match("/[^0-9]/", $arDate[$i], $matches))
172 $r = $DB->ForSql($arDate[$i], 4);
173 else
174 $r = intval($arDate[$i]);
175
176 $arParsedDate[mb_substr($arFormat[$i], 0, 2)] = $r;
177 }
178 if (intval($arParsedDate["DD"])<=0 || intval($arParsedDate["MM"])<=0 || intval($arParsedDate["YY"])<=0)
179 return false;
180
181 $strResult = "";
182
183 if(intval($arParsedDate["YY"])>1970 && intval($arParsedDate["YY"])<2038)
184 {
185 $ux_time = mktime(
186 intval($arParsedDate["HH"]),
187 intval($arParsedDate["MI"]),
188 intval($arParsedDate["SS"]),
189 intval($arParsedDate["MM"]),
190 intval($arParsedDate["DD"]),
191 intval($arParsedDate["YY"])
192 );
193
194 for ($i = 0; $i < $new_format_len; $i++)
195 {
196 switch(mb_substr($new_format, $i, 1))
197 {
198 case "F":
199 $match = GetMessage("P_MONTH_".date("n", $ux_time));
200 break;
201 case "M":
202 $match = GetMessage("P_MON_".date("n", $ux_time));
203 break;
204 case "l":
205 $match = GetMessage("P_DAY_OF_WEEK_".date("w", $ux_time));
206 break;
207 case "D":
208 $match = GetMessage("P_DOW_".date("w", $ux_time));
209 break;
210 default:
211 $match = date(mb_substr($new_format, $i, 1), $ux_time);
212 break;
213 }
214 $strResult .= $match;
215 }
216 }
217 else
218 {
219 if($arParsedDate["MM"]<1 || $arParsedDate["MM"]>12)
220 $arParsedDate["MM"] = 1;
221 for ($i = 0; $i < $new_format_len; $i++)
222 {
223 switch(mb_substr($new_format, $i, 1))
224 {
225 case "F":
226 $match = str_pad($arParsedDate["MM"], 2, "0", STR_PAD_LEFT);
227 if(intval($arParsedDate["MM"]) > 0)
228 {
229 $match = GetMessage("P_MONTH_".intval($arParsedDate["MM"]));
230 }
231 break;
232 case "M":
233 $match = str_pad($arParsedDate["MM"], 2, "0", STR_PAD_LEFT);
234 if(intval($arParsedDate["MM"]) > 0)
235 {
236 $match = GetMessage("P_MON_".intval($arParsedDate["MM"]));
237 }
238 break;
239 case "l":
240 $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT);
241 if(intval($arParsedDate["DD"]) > 0)
242 {
243 $match = GetMessage("P_DAY_OF_WEEK_".intval($arParsedDate["DD"]));
244 }
245 break;
246 case "D":
247 $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT);
248 if(intval($arParsedDate["DD"]) > 0)
249 {
250 $match = GetMessage("P_DOW_".intval($arParsedDate["DD"]));
251 }
252 break;
253 case "d":
254 $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT);
255 break;
256 case "m":
257 $match = str_pad($arParsedDate["MM"], 2, "0", STR_PAD_LEFT);
258 break;
259 case "j":
260 $match = intval($arParsedDate["MM"]);
261 break;
262 case "Y":
263 $match = str_pad($arParsedDate["YY"], 4, "0", STR_PAD_LEFT);
264 break;
265 case "y":
266 $match = mb_substr($arParsedDate["YY"], 2);
267 break;
268 case "H":
269 $match = str_pad($arParsedDate["HH"], 2, "0", STR_PAD_LEFT);
270 break;
271 case "i":
272 $match = str_pad($arParsedDate["MI"], 2, "0", STR_PAD_LEFT);
273 break;
274 case "S":
275 $match = str_pad($arParsedDate["SS"], 2, "0", STR_PAD_LEFT);
276 break;
277 case "g":
278 $match = intval($arParsedDate["HH"]);
279 if($match > 12)
280 {
281 $match = $match - 12;
282 }
283 case "a":
284 case "A":
285 $match = intval($arParsedDate["HH"]);
286 if($match > 12)
287 {
288 $match = ($match - 12)." PM";
289 }
290 else
291 {
292 $match .= " AM";
293 }
294
295 if(mb_substr($new_format,$i,1) == "a")
296 {
297 $match = mb_strtolower($match);
298 }
299
300 default:
301 $match = mb_substr($new_format,$i,1);
302 break;
303 }
304 $strResult .= $match;
305 }
306 }
307 return $strResult;
308}
309
310function PClearComponentCache($components, $arSite = array())
311{
312 if (empty($components))
313 return false;
314
315 if (
316 !is_array($arSite)
317 && !empty($arSite)
318 )
319 {
320 $arSite = array($arSite);
321 }
322
323 if (empty($arSite))
324 {
325 $arSite = array(SITE_ID);
326 }
327
328 if (is_array($components))
329 $aComponents = $components;
330 else
331 $aComponents = explode(",", $components);
332
333 foreach($aComponents as $component_name)
334 {
335 $add_path = "";
336 if (mb_strpos($component_name, "/") !== false)
337 {
338 $add_path = mb_substr($component_name,mb_strpos($component_name, "/"));
339 $component_name = mb_substr($component_name,0,mb_strpos($component_name, "/"));
340 }
341 $componentRelativePath = CComponentEngine::MakeComponentPath($component_name);
342
343 if ($componentRelativePath <> '')
344 {
345 BXClearCache(true, "/".$componentRelativePath.$add_path);
346 foreach ($arSite as $siteId)
347 {
348 BXClearCache(true, "/".$siteId.$componentRelativePath.$add_path);
349 }
350 }
351 }
352 BXClearCache(true, "/photogallery");
353 foreach ($arSite as $siteId)
354 {
355 BXClearCache(true, "/".$siteId."/photogallery");
356 }
357}
358
359function PClearComponentCacheEx($iblockId = false, $arSections = array(), $arGalleries = array(), $arUsers = array(), $clearCommon = true)
360{
361 if (!$iblockId)
362 return;
363
364 $arCache = array();
365 $arCache[] = "photogallery";
366 if ($clearCommon)
367 {
368 $arCache[] = "search.page";
369 $arCache[] = "search.tags.cloud";
370 $arCache[] = "photogallery/".$iblockId;
371 $arCache[] = "photogallery/".$iblockId."/pemission";
372 $arCache[] = "photogallery.detail.comment/".$iblockId;
373 $arCache[] = "photogallery.gallery.list/".$iblockId;
374 }
375
376 if (is_array($arSections))
377 {
378 $arSections = array_unique($arSections);
379 foreach($arSections as $sectionId)
380 $arCache[] = "photogallery/".$iblockId."/section".intval($sectionId);
381 }
382 $arCache[] = "photogallery/".$iblockId."/section".intval($sectionId);
383
384 if(is_array($arGalleries))
385 {
386 $arGalleries = array_unique($arGalleries);
387 foreach($arGalleries as $galleryCode)
388 $arCache[] = "photogallery/".$iblockId."/gallery".$galleryCode; // todo: secure galleryCode!!!!
389 }
390
391 if (is_array($arUsers))
392 {
393 $arUsers = array_unique($arUsers);
394 foreach($arUsers as $userId)
395 $arCache[] = "photogallery/".$iblockId."/user".intval($userId);
396 }
397
398 $arSite = array();
399
400 $rsIblockSite = CIBlock::GetSite($iblockId);
401 while($arIblockSite = $rsIblockSite->Fetch())
402 {
403 $arSite[] = $arIblockSite["SITE_ID"];
404 }
405
406 PClearComponentCache($arCache, $arSite);
407}
408?>
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static AddAutoloadClasses($module, $arParams=[])
Определения module.php:27
$aComponents
Определения clear_component_cache.php:19
$str
Определения commerceml2.php:63
if(!is_array($prop["VALUES"])) $tmp
Определения component_props.php:203
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$iblockId
Определения iblock_catalog_edit.php:30
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DB
Определения cron_frame.php:29
$siteId
Определения ajax.php:8
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
BXClearCache($full=false, $initdir='')
Определения tools.php:5150
PhotoShowError($arError, $arShowFields=array("ID", "NAME"), $bShowErrorCode=false)
Определения include.php:51
PhotoFormatDate($strDate, $format="DD.MM.YYYY HH:MI:SS", $new_format="DD.MM.YYYY HH:MI:SS")
Определения include.php:155
PhotoDateFormat($format="", $timestamp="")
Определения include.php:125
PClearComponentCache($components, $arSite=array())
Определения include.php:310
PClearComponentCacheEx($iblockId=false, $arSections=array(), $arGalleries=array(), $arUsers=array(), $clearCommon=true)
Определения include.php:359
PhotoGetBrowser()
Определения include.php:110
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$ar
Определения options.php:199
if(empty($signedUserToken)) $key
Определения quickway.php:257
$i
Определения factura.php:643
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$matches
Определения index.php:22
$arRes
Определения options.php:104
const SITE_ID
Определения sonet_set_content_view.php:12
$GLOBALS['_____370096793']
Определения update_client.php:1
$arSections
Определения yandex_run.php:805