本文整理汇总了PHP中CVote类的典型用法代码示例。如果您正苦于以下问题:PHP CVote类的具体用法?PHP CVote怎么用?PHP CVote使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CVote类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: GetPublicList
function GetPublicList($arFilter = array(), $strSqlOrder = "ORDER BY C.C_SORT, C.ID, V.DATE_START desc")
{
global $DB, $USER;
$err_mess = CVote::err_mess() . "<br>Function: GetPublicList<br>Line: ";
$arSqlSearch = array();
$strSqlSearch = "";
$arFilter = is_array($arFilter) ? $arFilter : array();
foreach ($arFilter as $key => $val) {
if (empty($val) || is_string($val) && $val === "NOT_REF") {
continue;
}
$key = strtoupper($key);
switch ($key) {
case "SITE":
$val = is_array($val) ? implode(" | ", $val) : $val;
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("CS.SITE_ID", $val, $match);
$left_join = "LEFT JOIN b_vote_channel_2_site CS ON (C.ID = CS.CHANNEL_ID)";
break;
case "CHANNEL":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" ? "Y" : "N";
if (is_array($val)) {
$arr = array();
foreach ($val as $v) {
$v = trim($v);
if (strLen($v) > 0) {
$arr[] = GetFilterQuery("C.SYMBOLIC_NAME", $v, $match);
}
}
if (!empty($arr)) {
$arSqlSearch[] = "((" . implode(") OR (", $arr) . "))";
}
} else {
$arSqlSearch[] = GetFilterQuery("C.SYMBOLIC_NAME", $val, $match);
}
break;
case "FIRST_SITE_ID":
case "LID":
$match = $arFilter[$key . "_EXACT_MATCH"] == "N" ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("C.FIRST_SITE_ID", $val, $match);
break;
}
}
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$is_admin = $USER->IsAdmin();
$groups = $USER->GetGroups();
$strSql = "\n\t\t\tSELECT C.TITLE CHANNEL_TITLE, V.*,\n\t\t\t\t" . $DB->DateToCharFunction("V.DATE_START") . "\tDATE_START,\n\t\t\t\t" . $DB->DateToCharFunction("V.DATE_END") . "\tDATE_END, \n\t\t\t\tV4.MAX_PERMISSION, V4.LAMP\n\t\t\tFROM (\n\t\t\t\tSELECT V.CHANNEL_ID, V.ID,\n\t\t\t\t\t" . ($is_admin ? "2" : "max(G.PERMISSION)") . " as MAX_PERMISSION, \n\t\t\t\t\tIF((C.VOTE_SINGLE = 'Y'), \n\t\t\t\t\t\t(IF(V.ID = VV.ACTIVE_VOTE_ID, 'green', 'red')), \n\t\t\t\t\t\t(IF(V.ACTIVE = 'Y' AND V.DATE_START <= NOW() AND NOW() <= V.DATE_END, 'green', 'red'))) LAMP \n\t\t\t\tFROM b_vote V\n\t\t\t\tINNER JOIN b_vote_channel C ON (C.ACTIVE = 'Y' AND C.HIDDEN = 'N' AND V.CHANNEL_ID = C.ID)\n\t\t\t\tLEFT JOIN (\n\t\t\t\t\tSELECT VVV.CHANNEL_ID, MAX(VVV.ID) AS ACTIVE_VOTE_ID\n\t\t\t\t\tFROM b_vote VVV, b_vote_channel CCC\n\t\t\t\t\tWHERE VVV.CHANNEL_ID = CCC.ID AND CCC.VOTE_SINGLE='Y' AND VVV.ACTIVE = 'Y' \n\t\t\t\t\t\tAND NOW() >= VVV.DATE_START AND VVV.DATE_END >= NOW()\n\t\t\t\t\tGROUP BY VVV.CHANNEL_ID) VV ON (VV.CHANNEL_ID = V.CHANNEL_ID)\n\t\t\t\tLEFT JOIN b_vote_channel_2_group G ON (G.CHANNEL_ID = C.ID and G.GROUP_ID in ({$groups}))\n\t\t\t\t{$left_join}\n\t\t\t\tWHERE\n\t\t\t\t\t{$strSqlSearch}\n\t\t\t\t\tAND V.ACTIVE = 'Y' AND V.DATE_START <= NOW()\n\t\t\t\tGROUP BY V.CHANNEL_ID, V.ID\n\t\t\t\t" . ($is_admin ? "" : "\n\t\t\t\tHAVING MAX_PERMISSION > 0") . "\n\t\t\t) V4\n\t\t\tINNER JOIN b_vote V ON (V4.ID = V.ID)\n\t\t\tINNER JOIN b_vote_channel C ON (V4.CHANNEL_ID = C.ID) \n\t\t\t" . $DB->ForSql($strSqlOrder);
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
return $res;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:50,代码来源:vote.php
示例2: strToUpper
$arParams["~" . strToUpper($URL) . "_TEMPLATE"] = $arParams[strToUpper($URL) . "_TEMPLATE"];
$arParams[strToUpper($URL) . "_TEMPLATE"] = htmlspecialcharsbx($arParams["~" . strToUpper($URL) . "_TEMPLATE"]);
}
/********************************************************************
/Input params
********************************************************************/
/********************************************************************
Data
********************************************************************/
$arResult["VOTES"] = array();
$arResult["NAV_STRING"] = "";
$db_res = GetVoteList($arParams["CHANNEL_SID"], array("bDescPageNumbering" => false, "nPageSize" => 10, "bShowAll" => false));
if ($db_res) {
$arResult["NAV_STRING"] = $db_res->GetPageNavString(GetMessage("VOTE_PAGES"));
while ($res = $db_res->Fetch()) {
$res["USER_ALREADY_VOTE"] = CVote::UserAlreadyVote($res["ID"], $_SESSION["VOTE_USER_ID"], $res["UNIQUE_TYPE"], $res["KEEP_IP_SEC"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
$res["URL"] = array("~VOTE_RESULT" => CComponentEngine::MakePathFromTemplate($arParams["~VOTE_RESULT_TEMPLATE"], array("VOTE_ID" => $res["ID"])), "~VOTE_FORM" => CComponentEngine::MakePathFromTemplate($arParams["~VOTE_FORM_TEMPLATE"], array("VOTE_ID" => $res["ID"])), "VOTE_RESULT" => CComponentEngine::MakePathFromTemplate($arParams["VOTE_RESULT_TEMPLATE"], array("VOTE_ID" => $res["ID"])), "VOTE_FORM" => CComponentEngine::MakePathFromTemplate($arParams["VOTE_FORM_TEMPLATE"], array("VOTE_ID" => $res["ID"])));
$res["IMAGE"] = CFile::GetFileArray($res["IMAGE_ID"]);
// For custom
foreach ($res["URL"] as $key => $val) {
$res[$key . "_URL"] = $val;
}
$res["TITLE"] = htmlspecialcharsEx($res["TITLE"]);
if ($res['DESCRIPTION_TYPE'] == 'text') {
$res['DESCRIPTION'] = htmlspecialcharsbx($res['DESCRIPTION']);
}
$arResult["VOTES"][$res["ID"]] = $res;
}
}
/********************************************************************
/Data
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php
示例3: array_intersect_key
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLog::Update($arRes["ID"], $arSonetFields);
CSocNetLogRights::SetForSonet($arRes["ID"], $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
} else {
$dbRes = CSocNetLogComments::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// message/comment
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLogComments::Update($arRes["ID"], $arSonetFields);
}
}
}
$url = ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"], "MID" => intVal($arParams["MID"]), "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"])), array("result" => $arNote["code"]));
LocalRedirect($url);
} elseif (intVal($arFieldsG["PARAM2"]) > 0 && $arFieldsG["PARAM1"] == "VT") {
CVote::Delete($arFieldsG["PARAM2"]);
}
}
if (!empty($strErrorMessage)) {
$arError[] = array("id" => $arParams["MESSAGE_TYPE"], "text" => $strErrorMessage);
}
} elseif ($arResult["VIEW"] == "Y") {
$bVarsFromForm = true;
$arFields = array("FORUM_ID" => intVal($arParams["FID"]), "TOPIC_ID" => intVal($arParams["TID"]), "MESSAGE_ID" => intVal($arParams["MID"]), "USER_ID" => intVal($GLOBALS["USER"]->GetID()));
$arFiles = array();
$arFilesExists = array();
$res = array();
foreach ($_FILES as $key => $val) {
if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
$arFiles[] = $_FILES[$key];
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php
示例4: Fetch
public static function Fetch()
{
if ($res = parent::Fetch()) {
if ($res["LAMP"] == "yellow" && !empty($res["CHANNEL_ID"])) {
$res["LAMP"] = $res["ID"] == CVote::GetActiveVoteId($res["CHANNEL_ID"]) ? "green" : "red";
}
}
return $res;
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:9,代码来源:vote.php
示例5: Delete
public static function Delete($ID)
{
global $DB;
$err_mess = CAllVoteChannel::err_mess() . "<br>Function: Delete<br>Line: ";
$ID = intval($ID);
if ($ID <= 0) {
return true;
}
/***************** Event onBeforeVoteChannelDelete ******************/
foreach (GetModuleEvents("vote", "onBeforeVoteChannelDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false) {
return false;
}
}
/***************** /Event ******************************************/
// drop votes
$z = $DB->Query("SELECT ID FROM b_vote WHERE CHANNEL_ID='{$ID}'", false, $err_mess . __LINE__);
while ($zr = $z->Fetch()) {
CVote::Delete($zr["ID"]);
}
$DB->Query("DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID=" . $ID, false, $err_mess . __LINE__);
$DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=" . $ID, false, $err_mess . __LINE__);
$res = $DB->Query("DELETE FROM b_vote_channel WHERE ID=" . $ID, false, $err_mess . __LINE__);
/***************** Event onAfterVoteChannelDelete ******************/
foreach (GetModuleEvents("vote", "onAfterVoteChannelDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
/***************** /Event ******************************************/
return $res;
}
开发者ID:rasuldev,项目名称:torino,代码行数:30,代码来源:channel.php
示例6: Delete
function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$arMessage = array();
if ($ID > 0) {
$arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
}
if (empty($arMessage)) {
return false;
}
/***************** Event onBeforeMessageAdd ************************/
foreach (GetModuleEvents("forum", "onBeforeMessageDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage)) === false) {
return false;
}
}
/***************** /Event ******************************************/
$AUTHOR_ID = intVal($arMessage["AUTHOR_ID"]);
$TOPIC_ID = intVal($arMessage["TOPIC_ID"]);
$FORUM_ID = intVal($arMessage["FORUM_ID"]);
$DB->StartTransaction();
// delete votes
if ($arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0 && IsModuleInstalled("vote")) {
CModule::IncludeModule("vote");
CVote::Delete($arMessage["PARAM2"]);
}
// delete files
CForumFiles::Delete(array("MESSAGE_ID" => $ID), array("DELETE_MESSAGE_FILE" => "Y"));
// delete message
$DB->Query("DELETE FROM b_forum_message WHERE ID=" . $ID);
// after delete
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID), false, 1);
$res = false;
if (!($db_res && ($res = $db_res->Fetch()))) {
CForumTopic::Delete($TOPIC_ID);
} else {
// if deleted message was first
if ($arMessage["NEW_TOPIC"] == "Y") {
$DB->Update('b_forum_message', array('NEW_TOPIC' => '"Y"'), "WHERE ID=" . $res["ID"]);
}
CForumTopic::SetStat($TOPIC_ID);
}
$DB->Commit();
$GLOBALS["USER_FIELD_MANAGER"]->Delete("FORUM_MESSAGE", $ID);
if ($AUTHOR_ID > 0) {
CForumUser::SetStat($AUTHOR_ID);
}
CForumNew::SetStat($FORUM_ID);
/***************** Event onBeforeMessageAdd ************************/
foreach (GetModuleEvents("forum", "onAfterMessageDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arMessage));
}
/***************** /Event ******************************************/
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("forum", $ID);
if (is_array($res) && !empty($res)) {
CForumMessage::Reindex($res["ID"], $res);
}
}
return true;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:62,代码来源:message.php
示例7: GetMessage
?>
" size="10"></td>
</tr>
<tr>
<td nowrap><?php
echo GetMessage("VOTE_F_VOTE");
?>
</td>
<td nowrap><input type="text" name="find_vote" size="47" value="<?php
echo htmlspecialcharsbx($find_vote);
?>
"><?php
echo InputType("checkbox", "find_vote_exact_match", "Y", $find_vote_exact_match, false, "", "title='" . GetMessage("VOTE_EXACT_MATCH") . "'");
?>
<?php
echo ShowFilterLogicHelp();
?>
<br><?php
echo SelectBox("find_vote_id", CVote::GetDropDownList(), GetMessage("VOTE_ALL"), htmlspecialcharsbx($find_vote_id));
?>
</td>
</tr>
<?php
$oFilter->Buttons(array("table_id" => $sTableID, "url" => $APPLICATION->GetCurPage(), "form" => "form1"));
$oFilter->End();
#############################################################
?>
</form>
<?php
$lAdmin->DisplayList();
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:vote_user_list.php
示例8: intVal
$VOTE_ID = intVal($arQuestion["VOTE_ID"]);
$db_res = CVoteAnswer::GetList($ID);
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arAnswers[$ii] = $res;
$ii++;
} while ($res = $db_res->Fetch());
}
}
}
if ($ID <= 0) {
$arQuestion = array("ACTIVE" => "Y", "VOTE_ID" => $VOTE_ID, "C_SORT" => CVoteQuestion::GetNextSort($VOTE_ID), "QUESTION" => "", "QUESTION_TYPE" => "html", "IMAGE_ID" => "", "DIAGRAM" => "Y", "REQUIRED" => "N", "DIAGRAM_TYPE" => VOTE_DEFAULT_DIAGRAM_TYPE, "TEMPLATE" => "default.php", "TEMPLATE_NEW" => "default.php");
}
$VOTE_ID = intVal($VOTE_ID);
$arVote = array();
$db_res = CVote::GetByID($VOTE_ID);
if (!($db_res && ($arVote = $db_res->Fetch()))) {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
echo "<a href='vote_list.php?lang=" . LANGUAGE_ID . "' class='navchain'>" . GetMessage("VOTE_VOTE_LIST") . "</a>";
echo ShowError(GetMessage("VOTE_NOT_FOUND"));
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
$arVote["TITLE"] = strlen($arVote["TITLE"]) > 0 ? $arVote["TITLE"] : TruncateText($arVote["DESCRIPTION_TYPE"] == "html" ? strip_tags($arVote["DESCRIPTION"]) : $arVote["DESCRIPTION"], 200);
$db_res = CVoteChannel::GetByID($arVote["CHANNEL_ID"]);
$arChannel = $db_res->Fetch();
$adminChain->AddItem(array("TEXT" => htmlspecialcharsbx($arChannel["TITLE"]), "LINK" => "vote_channel_edit.php?ID={$arChannel['ID']}&lang=" . LANGUAGE_ID));
$adminChain->AddItem(array("TEXT" => htmlspecialcharsbx($arVote["TITLE"]), "LINK" => "vote_edit.php?ID={$arVote['ID']}&lang=" . LANGUAGE_ID));
$sDocTitle = $ID > 0 ? str_replace("#ID#", $ID, GetMessage("VOTE_EDIT_RECORD")) : GetMessage("VOTE_NEW_RECORD");
$APPLICATION->SetTitle($sDocTitle);
/********************************************************************
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:vote_question_edit.php
示例9: ShowVoteResults
function ShowVoteResults($VOTE_ID, $template1="")
{
global $APPLICATION;
$VOTE_ID = GetVoteDataByID($VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "Y");
if (intval($VOTE_ID)>0)
{
/***** for old pre-component templates **********/
global $VOTE_PERMISSION;
$VOTE_PERMISSION = CVote::UserGroupPermission($arChannel["ID"]);
/***** /old *************************************/
$perm = CVoteChannel::GetGroupPermission($arChannel["ID"]);
if (intval($perm)>=1)
{
$template = (strlen($arVote["RESULT_TEMPLATE"])<=0) ? "default.php" : $arVote["RESULT_TEMPLATE"];
require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/vote/include.php");
IncludeModuleLangFile(__FILE__);
$path = COption::GetOptionString("vote", "VOTE_TEMPLATE_PATH_VOTE");
if (strlen($template1)>0) $template = $template1;
if ($APPLICATION->GetShowIncludeAreas())
{
$arIcons = Array();
if (CModule::IncludeModule("fileman"))
{
$arIcons[] =
Array(
"URL" => "/bitrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($path.$template),
"SRC" => "/bitrix/images/vote/panel/edit_template.gif",
"ALT" => GetMessage("VOTE_PUBLIC_ICON_TEMPLATE")
);
$arrUrl = parse_url($_SERVER["REQUEST_URI"]);
$arIcons[] =
Array(
"URL" => "/bitrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($arrUrl["path"]),
"SRC" => "/bitrix/images/vote/panel/edit_file.gif",
"ALT" => GetMessage("VOTE_PUBLIC_ICON_HANDLER")
);
}
$arIcons[] =
Array(
"URL" => "/bitrix/admin/vote_edit.php?lang=".LANGUAGE_ID."&ID=".$VOTE_ID,
"SRC" => "/bitrix/images/vote/panel/edit_vote.gif",
"ALT" => GetMessage("VOTE_PUBLIC_ICON_SETTINGS")
);
echo $APPLICATION->IncludeStringBefore($arIcons);
}
$template = Rel2Abs('/', $template);
include($_SERVER["DOCUMENT_ROOT"].$path.$template);
if ($APPLICATION->GetShowIncludeAreas())
{
echo $APPLICATION->IncludeStringAfter();
}
}
}
}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:55,代码来源:vote_tools.php
示例10: Delete
/**
* <p>Удаляет сообщение с кодом <i>ID</i>.</p> <p><b>Примечание</b>. Метод использует внутреннюю транзакцию. Если у вас используется <b>MySQL</b> и <b>InnoDB</b>, и ранее была открыта транзакция, то ее необходимо закрыть до подключения метода.</p>
*
*
*
*
* @param int $ID Код сообщения, которое необходимо удалить.
*
*
*
* @return bool
*
*
* <h4>See Also</h4>
* <ul><li>Перед удалением сообщения следует проверить возможность
* удаления методом <a
* href="http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/canuserdeletemessage.php">CForumMessage::CanUserDeleteMessage</a>
* </li></ul>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$arMessage = array();
if ($ID > 0)
$arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
if (empty($arMessage))
return false;
/***************** Event onBeforeMessageAdd ************************/
$events = GetModuleEvents("forum", "onBeforeMessageDelete");
while ($arEvent = $events->Fetch())
{
if (ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage)) === false)
return false;
}
/***************** /Event ******************************************/
$AUTHOR_ID = intVal($arMessage["AUTHOR_ID"]);
$TOPIC_ID = intVal($arMessage["TOPIC_ID"]);
$FORUM_ID = intVal($arMessage["FORUM_ID"]);
$DB->StartTransaction();
// delete votes
if ($arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0 && IsModuleInstalled("vote")):
CModule::IncludeModule("vote");
CVote::Delete($arMessage["PARAM2"]);
endif;
// delete files
CForumFiles::Delete(array("MESSAGE_ID" => $ID), array("DELETE_MESSAGE_FILE" => "Y"));
// delete message
$DB->Query("DELETE FROM b_forum_message WHERE ID=".$ID);
// after delete
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID), false, 1);
$res = false;
if (!($db_res && $res = $db_res->Fetch())):
CForumTopic::Delete($TOPIC_ID);
else:
// if deleted message was first
if ($arMessage["NEW_TOPIC"] == "Y"):
$DB->Query("UPDATE b_forum_message SET NEW_TOPIC='Y' WHERE ID=".$res["ID"]);
endif;
CForumTopic::SetStat($TOPIC_ID);
endif;
$DB->Commit();
$GLOBALS["USER_FIELD_MANAGER"]->Delete("FORUM_MESSAGE", $ID);
if ($AUTHOR_ID > 0):
CForumUser::SetStat($AUTHOR_ID);
endif;
CForumNew::SetStat($FORUM_ID);
/***************** Event onBeforeMessageAdd ************************/
$events = GetModuleEvents("forum", "onAfterMessageDelete");
while ($arEvent = $events->Fetch())
ExecuteModuleEventEx($arEvent, array($ID, $arMessage));
/***************** /Event ******************************************/
if (CModule::IncludeModule("search"))
{
CSearch::DeleteIndex("forum", $ID);
}
return true;
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:86,代码来源:message.php
示例11:
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && array_key_exists("PUBLIC_VOTE_ID", $_REQUEST) && intval($_REQUEST["PUBLIC_VOTE_ID"]) > 0 && array_key_exists("vote", $_REQUEST) && strlen($_REQUEST["vote"]) > 0) {
if (CModule::IncludeModule("vote")) {
CVote::KeepVoting();
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:keepvoting.php
示例12: Delete
public static function Delete($ID)
{
global $DB, $CACHE_MANAGER;
$err_mess = (CAllVoteChannel::err_mess())."<br>Function: Delete<br>Line: ";
$ID = intval($ID);
if ($ID <= 0):
return true;
endif;
/***************** Event onBeforeVoteChannelDelete ******************/
$events = GetModuleEvents("vote", "onBeforeVoteChannelDelete");
while ($arEvent = $events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false)
return false; }
/***************** /Event ******************************************/
// drop votes
$strSql = "SELECT ID FROM b_vote WHERE CHANNEL_ID='$ID'";
$z = $DB->Query($strSql, false, $err_mess.__LINE__);
while ($zr = $z->Fetch()) CVote::Delete($zr["ID"]);
$DB->Query("DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID=".$ID, false, $err_mess.__LINE__);
$DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=".$ID, false, $err_mess.__LINE__);
$res = $DB->Query("DELETE FROM b_vote_channel WHERE ID=".$ID, false, $err_mess.__LINE__);
/***************** Event onAfterVoteChannelDelete ******************/
$events = GetModuleEvents("vote", "onAfterVoteChannelDelete");
while ($arEvent = $events->Fetch())
ExecuteModuleEventEx($arEvent, array($ID));
/***************** /Event ******************************************/
return $res;
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:30,代码来源:channel.php
示例13: elseif
$arParams["PERMISSION"] = $arParams["PERMISSION"] === false ? CVoteChannel::GetGroupPermission($arResult["VOTE"]["CHANNEL_ID"]) : $arParams["PERMISSION"];
if ($arParams["PERMISSION"] <= 0) {
return false;
} elseif ($GLOBALS["VOTING_OK"] == "Y" && $GLOBALS["VOTING_ID"] == $arParams["VOTE_ID"] && !empty($arParams["VOTE_RESULT_TEMPLATE"])) {
$var = array("VOTE_ID", "VOTING_OK", "VOTE_SUCCESSFULL", "view_result", "view_form");
$url = CComponentEngine::MakePathFromTemplate($arParams["VOTE_RESULT_TEMPLATE"], array("VOTE_ID" => $arVote["ID"]));
if (strpos($url, "?") === false) {
$url .= "?";
} elseif (($token = substr($url, strpos($url, "?") + 1)) && !empty($token) && preg_match_all("/(?<=^|\\&)\\w+(?=\$|\\=)/is", $token, $matches)) {
$var = array_merge($var, $matches);
}
$strNavQueryString = DeleteParam($var);
LocalRedirect($url . "&VOTE_SUCCESSFULL=Y&VOTE_ID=" . intval($_REQUEST["VOTE_ID"]) . ($strNavQueryString != "" ? "&" : "") . $strNavQueryString);
}
$voteUserID = $_SESSION["VOTE_USER_ID"] ? $_SESSION["VOTE_USER_ID"] : intval($GLOBALS["APPLICATION"]->get_cookie("VOTE_USER_ID"));
$arParams["VOTED"] = CVote::UserAlreadyVote($arResult["VOTE_ID"], $voteUserID, $arResult["VOTE"]["UNIQUE_TYPE"], $arResult["VOTE"]["KEEP_IP_SEC"], $GLOBALS["USER"]->GetID());
$isUserCanVote = $arParams["VOTED"] == false;
$arParams["CAN_VOTE"] = $arResult["CAN_VOTE"] = $isUserCanVote && $arParams["PERMISSION"] > 1 ? "Y" : "N";
$arParams["CAN_REVOTE"] = $arParams["VOTED"] == 8 && $arParams["PERMISSION"] > 1 ? "Y" : "N";
$bShowResult = $arResult["VOTE"]["LAMP"] != "green" || $arParams["CAN_VOTE"] != "Y" && $arParams["CAN_REVOTE"] != "Y";
if (!$bShowResult) {
$bShowResult = $_REQUEST["view_result"] == "Y" || $GLOBALS["VOTING_OK"] == "Y" && $GLOBALS["VOTING_ID"] == $arResult["VOTE_ID"] || $GLOBALS["USER_ALREADY_VOTE"] == "Y" && $arParams["CAN_REVOTE"] != "Y" || $_REQUEST["VOTE_SUCCESSFULL"] == "Y" && $_REQUEST["VOTE_ID"] == $arResult["VOTE_ID"];
if ($_REQUEST["view_form"] == "Y") {
$bShowResult = false;
} else {
if (!$bShowResult) {
$bShowResult = $arParams["CAN_REVOTE"] == "Y";
if ($bShowResult && $GLOBALS["VOTING_ID"] == $arResult["VOTE"]["ID"] && $GLOBALS["VOTING_OK"] != "Y") {
$bShowResult = false;
}
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例14: Delete
function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$bCanDelete = true;
/***************** Event OnBeforeForumDelete ***********************/
foreach (GetModuleEvents("forum", "OnBeforeForumDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false) {
$bCanDelete = false;
break;
}
}
/***************** /Event ******************************************/
if (!$bCanDelete) {
return false;
}
/***************** Event OnForumDelete *****************************/
foreach (GetModuleEvents("forum", "OnForumDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$ID));
}
/***************** /Event ******************************************/
/***************** Cleaning cache **********************************/
unset($GLOBALS["FORUM_CACHE"]["FORUM"][$ID]);
if (CACHED_b_forum !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum");
}
if (CACHED_b_forum_perms !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_perms");
}
if (CACHED_b_forum2site !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum2site");
}
/***************** Cleaning cache/**********************************/
/***************** Search module ***********************************/
set_time_limit(0);
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("forum", false, $ID);
}
CForumFiles::Delete(array("FORUM_ID" => $ID), array("DELETE_FORUM_FILE" => "Y"));
$DB->StartTransaction();
// Update USER statistic
$arProcAuth = array();
$db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "!AUTHOR_ID" => 0));
while ($res = $db_res->Fetch()) {
$res["AUTHOR_ID"] = intVal($res["AUTHOR_ID"]);
if (!in_array($res["AUTHOR_ID"], $arProcAuth)) {
$arProcAuth[] = intVal($res["AUTHOR_ID"]);
}
}
if (IsModuleInstalled("vote")) {
$db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "PARAM1" => "VT", "!PARAM2" => 0));
if ($db_res && ($res = $db_res->Fetch())) {
CModule::IncludeModule("vote");
do {
CVote::Delete($res["PARAM2"]);
} while ($res = $db_res->Fetch());
}
}
if (!$DB->Query("DELETE FROM b_forum_subscribe WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum_message WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum_topic WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum_perms WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum2site WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum WHERE ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
// Update USER statistic
foreach ($arProcAuth as $i => $procAuth) {
CForumUser::SetStat($procAuth);
}
$DB->Commit();
/***************** Event OnAfterForumDelete ************************/
foreach (GetModuleEvents("forum", "OnAfterForumDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
/***************** /Event ******************************************/
return true;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:94,代码来源:forum_new.php
示例15: array
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/include.php";
$old_module_version = CVote::IsOldVersion();
IncludeModuleLangFile(__FILE__);
$module_id = "vote";
$VOTE_RIGHT = $APPLICATION->GetGroupRight($module_id);
if ($VOTE_RIGHT >= "R") {
$arAllOptions = $arDisplayOptions = array(array("USE_HTML_EDIT", GetMessage("VOTE_USE_HTML_EDIT"), array("checkbox", "Y")), array("VOTE_COMPATIBLE_OLD_TEMPLATE", GetMessage("VOTE_COMPATIBLE"), array("checkbox", "Y")), array("VOTE_DIR", GetMessage("VOTE_PUBLIC_DIR"), array("text", 45)), array("VOTE_TEMPLATE_PATH", GetMessage("VOTE_TEMPLATE_VOTES"), array("text", 45)), array("VOTE_TEMPLATE_PATH_VOTE", GetMessage("VOTE_TEMPLATE_RESULTS_VOTE"), array("text", 45)), array("VOTE_TEMPLATE_PATH_QUESTION", GetMessage("VOTE_TEMPLATE_RESULTS_QUESTION"), array("text", 45)), array("VOTE_TEMPLATE_PATH_QUESTION_NEW", GetMessage("VOTE_TEMPLATE_RESULTS_QUESTION_NEW"), array("text", 45)));
if ($REQUEST_METHOD == "GET" && $VOTE_RIGHT == "W" && strlen($RestoreDefaults) > 0 && check_bitrix_sessid()) {
COption::RemoveOption("vote");
$z = CGroup::GetList($v1 = "id", $v2 = "asc", array("ACTIVE" => "Y", "ADMIN" => "N"));
while ($zr = $z->Fetch()) {
$APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
}
}
if ($REQUEST_METHOD == "POST" && strlen($Update) > 0 && $VOTE_RIGHT == "W" && check_bitrix_sessid()) {
while (list($key, $name) = each($arAllOptions)) {
$val = ${$name}[0];
if ($name[2][0] == "checkbox" && $val != "Y") {
$val = "N";
} elseif (!array_key_exists($name[0], $_POST)) {
continue;
}
COption::SetOptionString($module_id, $name[0], $val);
}
}
if (COption::GetOptionString("vote", "VOTE_COMPATIBLE_OLD_TEMPLATE", "Y") == "N") {
unset($arDisplayOptions[2]);
unset($arDisplayOptions[3]);
unset($arDisplayOptions[4]);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:options.php
示例16: current
/********************************************************************
/ACTIONS
********************************************************************/
if ($ID > 0) {
$db_res = CVote::GetByID($ID);
if ($db_res && ($res = $db_res->Fetch())) {
$arVote = $res;
$arChannel = $arChannels[$arVote["CHANNEL_ID"]];
} else {
$ID = 0;
}
}
if ($ID <= 0) {
$arChannel = current($arChannels);
reset($arChannels);
$arVote = array("CHANNEL_ID" => isset($_REQUEST['CHANNEL_ID']) && intval($_REQUEST['CHANNEL_ID']) > 0 ? intval($_REQUEST['CHANNEL_ID']) : $arChannel["ID"], "C_SORT" => CVote::GetNextSort($arChannel["ID"]), "ACTIVE" => "Y", "DATE_START" => $arChannel["VOTE_SINGLE"] != "N" ? CVote::GetNextStartDate($arChannel["ID"]) : "", "UNIQUE_TYPE" => 12, "DELAY" => 10, "DELAY_TYPE" => "M", "DESCRIPTION_TYPE" => "html", "IMAGE_ID" => 0, "EVENT1" => "vote", "EVENT2" => strtolower($arChannel["SYMBOLIC_NAME"]), "TEMPLATE" => "default.php");
}
if ($bVarsFromForm) {
if (!empty($arVote["IMAGE_ID"])) {
unset($arFields["IMAGE_ID"]);
}
$arVote = $arFields;
}
foreach ($arVote as $key => $val) {
$arVote["~" . $key] = $val;
$arVote[$key] = htmlspecialcharsEx($val);
}
$sDocTitle = $ID > 0 ? str_replace("#ID#", $ID, GetMessage("VOTE_EDIT_RECORD")) : GetMessage("VOTE_NEW_RECORD");
if (isset($_REQUEST['docopy']) || isset($_REQUEST['COPYID'])) {
$sDocTitle = GetMessage("VOTE_NEW_RECORD");
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:vote_edit.php
示例17: array
$arFields["LANG"][] = array("LID" => $lang, "NAME" => $name, "DESCRIPTION" => $description);
}
$arGroup[$key] = CForumGroup::Add($arFields);
}
}
$arFieldsParams = array("SHOW_VOTE" => "N", "VOTE_CHANNEL_ID" => 0, "VOTE_GROUP_ID" => 0, "VOTE_ID" => 0, "FORUMS_ID" => "");
if (CModule::IncludeModule("vote")) {
$db_res = CVoteChannel::GetList($by, $order, array('SYMBOLIC_NAME' => 'FORUM', 'SYMBOLIC_NAME_EXACT_MATCH' => 'Y'), $is_filtered);
if ($db_res && ($res = $db_res->Fetch())) {
$arFieldsParams = array("SHOW_VOTE" => "Y", "VOTE_CHANNEL_ID" => $res["ID"], "VOTE_GROUP_ID" => 0);
//Registered users group
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($dbResult && ($res = $dbResult->Fetch())) {
$arFieldsParams["VOTE_GROUP_ID"] = $res["ID"];
}
$db_res = CVote::GetList($by, $order, array("CHANNEL_ID" => $arFieldsParams["VOTE_CHANNEL_ID"]), $is_filtered);
if ($db_res && ($res = $db_res->Fetch())) {
$arFieldsParams["VOTE_ID"] = intVal($res["ID"]);
}
}
}
// Forums
$arForums = array();
$arReplaceForums = array();
$db_res = CForumNew::GetList(array(), array("SITE_ID" => $SITE_ID));
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arForums[$res["ID"]] = $res["NAME"];
} while ($res = $db_res->Fetch());
}
// Forum № 1
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:index.php
|
请发表评论