2#############################################
3# Bitrix Site Manager Forum #
4# Copyright (c) 2002-2009 Bitrix #
6# mailto:admin@bitrixsoft.com #
7#############################################
18 foreach(
array(
"TITLE",
"SYMBOLIC_NAME") as
$key)
49 "id" =>
"SYMBOLIC_NAME",
50 "text" =>
GetMessage(
"VOTE_INCORRECT_SYMBOLIC_NAME"));
59 "SID_EXACT_MATCH" =>
"Y");
64 "id" =>
"SYMBOLIC_NAME",
65 "text" => str_replace(
67 GetMessage(
"VOTE_SYMBOLIC_NAME_ALREADY_IN_USE")));
83 foreach(
array(
"ACTIVE",
"HIDDEN",
"VOTE_SINGLE",
"USE_CAPTCHA") as
$key)
102 foreach (
GetModuleEvents(
"vote",
"onBeforeVoteChannelAdd",
true) as $arEvent)
106 if (
$DB->type ==
"ORACLE")
109 $arInsert =
$DB->PrepareInsert(
"b_vote_channel",
$arFields);
111 $strSql =
"INSERT INTO b_vote_channel (".$arInsert[0].
", TIMESTAMP_X) ".
112 "VALUES(".$arInsert[1].
", ".
$DB->GetNowFunction().
")";
122 $strSql =
"INSERT INTO b_vote_channel_2_site (CHANNEL_ID, SITE_ID) ".
123 "VALUES ($ID, '".$DB->ForSql($sid, 2).
"')";
130 foreach (
GetModuleEvents(
"vote",
"onAfterVoteChannelAdd",
true) as $arEvent)
144 foreach (
GetModuleEvents(
"vote",
"onBeforeVoteChannelUpdate",
true) as $arEvent)
149 $strUpdate =
$DB->PrepareUpdate(
"b_vote_channel",
$arFields);
151 $strSql =
"UPDATE b_vote_channel SET ".$strUpdate.
" WHERE ID=".
$ID;
156 $DB->Query(
"DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=".
$ID);
159 $strSql =
"INSERT INTO b_vote_channel_2_site (CHANNEL_ID, SITE_ID) ".
160 "VALUES ($ID, '".$DB->ForSql($sid, 2).
"')";
167 foreach (
GetModuleEvents(
"vote",
"onAfterVoteChannelUpdate",
true) as $arEvent)
179 $arMainGroups =
array();
188 $arMainGroups[
$res[
"ID"]] =
$res[
"ID"];
193 "DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID=".
$ID);
198 if (
$key <= 1 || !in_array(
$val,
$GLOBALS[
"aVotePermissions"][
"reference_id"]))
203 "PERMISSION" =>
"'".
$val.
"'");
204 $DB->Insert(
"b_vote_channel_2_group",
$arFields,
"File: ".__FILE__.
"<br>Line: ".__LINE__);
214 $arSqlSearch = Array();
227 if( ((
string)
$val ==
'') || (
$val ===
"NOT_REF") )
230 $match_value_set = array_key_exists(
$key.
"_EXACT_MATCH",
$arFilter);
235 $match = (
$arFilter[
$key.
"_EXACT_MATCH"]==
"N" && $match_value_set) ?
"Y" :
"N";
243 $left_join =
"LEFT JOIN b_vote_channel_2_site CS ON (C.ID = CS.CHANNEL_ID)";
246 $match = (
$arFilter[
$key.
"_EXACT_MATCH"]==
"Y" && $match_value_set) ?
"N" :
"Y";
250 case "SYMBOLIC_NAME":
251 $match = (
$arFilter[
$key.
"_EXACT_MATCH"]==
"Y" && $match_value_set) ?
"N" :
"Y";
256 $arSqlSearch[] = (
$val==
"Y") ?
"C.".
$key.
"='Y'" :
"C.".$key.
"='N'";
258 case "FIRST_SITE_ID":
260 $match = (
$arFilter[
$key.
"_EXACT_MATCH"]==
"N" && $match_value_set) ?
"Y" :
"N";
267 if ($by ==
"s_id") $strSqlOrder =
"ORDER BY C.ID";
268 elseif ($by ==
"s_timestamp") $strSqlOrder =
"ORDER BY C.TIMESTAMP_X";
269 elseif ($by ==
"s_c_sort") $strSqlOrder =
"ORDER BY C.C_SORT";
270 elseif ($by ==
"s_active") $strSqlOrder =
"ORDER BY C.ACTIVE";
271 elseif ($by ==
"s_hidden") $strSqlOrder =
"ORDER BY C.HIDDEN";
272 elseif ($by ==
"s_symbolic_name") $strSqlOrder =
"ORDER BY C.SYMBOLIC_NAME";
273 elseif ($by ==
"s_title") $strSqlOrder =
"ORDER BY C.TITLE ";
274 elseif ($by ==
"s_votes") $strSqlOrder =
"ORDER BY VOTES";
277 $strSqlOrder =
"ORDER BY C.ID";
282 $strSqlOrder .=
" desc ";
287 SELECT CC.*, C.*, C.FIRST_SITE_ID LID, C.SYMBOLIC_NAME SID,
288 ".$DB->DateToCharFunction(
"C.TIMESTAMP_X").
" TIMESTAMP_X
290 SELECT C.ID, count(V.ID) VOTES
291 FROM b_vote_channel C
292 LEFT JOIN b_vote V ON (V.CHANNEL_ID = C.ID)
294 WHERE ".$strSqlSearch.
"
296 INNER JOIN b_vote_channel C ON (C.ID = CC.ID)
299 if (VOTE_CACHE_TIME===
false || mb_strpos(
$_SERVER[
'REQUEST_URI'],
'/bitrix/admin/') !==
false)
309 if(
$CACHE_MANAGER->Read(VOTE_CACHE_TIME,
"b_vote_channel_".$md5,
"b_vote_channel"))
322 $r =
new CDBResult();
323 $r->InitFromArray($arCache);
333 $CHANNEL_ID = intval($CHANNEL_ID);
334 if ($CHANNEL_ID<=0)
return false;
338 if (VOTE_CACHE_TIME===
false)
341 $rs =
$DB->Query(
"SELECT CS.SITE_ID FROM b_vote_channel_2_site CS WHERE CS.CHANNEL_ID = ".$CHANNEL_ID);
342 while (
$ar =
$rs->Fetch()) $arrRes[] =
$ar[
"SITE_ID"];
348 if(
$CACHE_MANAGER->Read(VOTE_CACHE_TIME,
"b_vote_channel_2_site",
"b_vote_channel_2_site"))
354 $rs =
$DB->Query(
'SELECT * '.
'FROM b_vote_channel_2_site');
355 while (
$ar =
$rs->Fetch())
356 $arCache[
$ar[
"CHANNEL_ID"]][] =
$ar[
"SITE_ID"];
360 if (array_key_exists($CHANNEL_ID, $arCache))
361 return $arCache[$CHANNEL_ID];
377 foreach (
GetModuleEvents(
"vote",
"onBeforeVoteChannelDelete",
true) as $arEvent)
383 $z =
$DB->Query(
"SELECT ID FROM b_vote WHERE CHANNEL_ID='$ID'");
386 $DB->Query(
"DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID=".
$ID);
387 $DB->Query(
"DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=".
$ID);
388 $res =
$DB->Query(
"DELETE FROM b_vote_channel WHERE ID=".
$ID);
390 foreach (
GetModuleEvents(
"vote",
"onAfterVoteChannelDelete",
true) as $arEvent)
411 "FROM b_vote_channel_2_group ".
412 "WHERE CHANNEL_ID = '".intval($channel_id).
"'";
414 $dbres =
$DB->Query($strSql);
416 while(
$res = $dbres->Fetch())
427 $channel_id = trim($channel_id);
434 "channel_id" => $channel_id,
436 "get_from_database" =>
$params[
"get_from_database"] ??
null);
437 $cache_id =
"b_vote_perm_".md5(serialize($cache));
440 if (VOTE_CACHE_TIME !==
false &&
$CACHE_MANAGER->Read(VOTE_CACHE_TIME, $cache_id,
"b_vote_perm"))
446 if (
$params[
"get_from_database"] ??
null !=
"Y")
447 $permission = ((in_array(1,
$USER->GetUserGroupArray()) ||
$APPLICATION->GetGroupRight(
"vote") >=
"W") ? 4 : $permission);
449 if ($permission <= 0 && !empty(
$groups))
452 "SELECT BVC2G.CHANNEL_ID, BVC.SYMBOLIC_NAME CHANNEL_SID, MAX(BVC2G.PERMISSION) as PERMISSION
453 FROM b_vote_channel_2_group BVC2G
454 INNER JOIN b_vote_channel BVC ON (BVC2G.CHANNEL_ID = BVC.ID)
455 WHERE ".((!isset(
$params[
"CHANNEL_SID"]) ||
$params[
"CHANNEL_SID"] !==
"Y") ?
"BVC2G.CHANNEL_ID" :
"BVC.SYMBOLIC_NAME").
456 "='".
$DB->ForSql($channel_id).
"' and GROUP_ID in ($groups)
457 GROUP BY BVC2G.CHANNEL_ID, BVC.SYMBOLIC_NAME";
461 $permission = intval(
$res[
"PERMISSION"]);
462 if (VOTE_CACHE_TIME !==
false)
464 $cache[
"channel_id"] =
$res[
"CHANNEL_SID"];
465 $cache_id =
"b_vote_perm_".md5(serialize($cache));
467 $cache[
"channel_id"] = trim(
$res[
"CHANNEL_ID"]);
471 if (VOTE_CACHE_TIME !==
false)
473 $cache_id =
"b_vote_perm_".md5(serialize($cache));
487 $this->arType = Array(
489 "circle" =>
GetMessage(
"VOTE_DIAGRAM_TYPE_CIRCLE")
507 if (mb_substr(
$key, 0, 1) ==
"!")
513 if (mb_substr(
$key, 0, 2) ==
">=")
516 $strOperation =
">=";
526 $strOperation =
"<=";
536 $strOperation =
"IN";
541 $strOperation =
"LIKE";
548 return array(
"FIELD"=>
$key,
"NEGATIVE"=>$strNegative,
"OPERATION"=>$strOperation);
static GetList($by='c_sort', $order='asc', $arFilter=[], $SHOW_USERS_AMOUNT="N")
static GetArrayGroupPermission($channel_id)
static SetAccessPermissions($ID, $arGroups)
static GetSiteArray($CHANNEL_ID)
static CheckFields($ACTION, &$arFields, $ID=0)
static GetGroupPermission($channel_id, $arGroups=false, $params=array())
static Update($ID, $arFields)
static GetList($by='s_id', $order='desc', $arFilter=[])
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
ExecuteModuleEventEx($arEvent, $arParams=[])
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</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."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
$GLOBALS['_____370096793']
VoteGetFilterOperation($key)
const VOTE_DEFAULT_DIAGRAM_TYPE