Esempio n. 1
0
					{
						$arAnswer["FIELD_WIDTH"] = (!!$arAnswer["FIELD_WIDTH"] ? intval($arAnswer["FIELD_WIDTH"]) : $defaultWidth);
						if ($arAnswer["FIELD_TYPE"] == 5)
							$arAnswer["FIELD_HEIGHT"] = (!!$arAnswer["FIELD_HEIGHT"] ? intval($arAnswer["FIELD_HEIGHT"]) : $defaultHeight);
					}
					$arQs[$keya] = $arAnswer;
				}
			}
			$arQuestion["ANSWERS"] = $arQs;
			$arResult["QUESTIONS"][$key] = $arQuestion;
		}

		$obCache->StartDataCache();
		CVoteCacheManager::SetTag($cache_path, "C", $arChannel["ID"]);
		CVoteCacheManager::SetTag($cache_path, "V", $arVote["ID"]);
		CVoteCacheManager::SetTag($cache_path, "Q", array_keys($arResult["QUESTIONS"]));
		$obCache->EndDataCache(
			array(
				"arResult" => array(
					"VOTE" => $arResult["VOTE"],
					"CHANNEL" => $arResult["CHANNEL"],
					"QUESTIONS" => $arResult["QUESTIONS"]
				)
			)
		);
	}
}

if ($arResult["CHANNEL"]["USE_CAPTCHA"] == "Y" && !$GLOBALS["USER"]->IsAuthorized())
{
	include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/captcha.php");
Esempio n. 2
0
            while ($res = $db_res->Fetch()) {
                $data = array("ID" => $res["ID"]);
                if (array_key_exists("PERSONAL_PHOTO", $res)) {
                    $arFileTmp = CFile::ResizeImageGet($res["PERSONAL_PHOTO"], array("width" => 21, "height" => 21), BX_RESIZE_IMAGE_EXACT, false);
                    $data["PHOTO"] = CFile::ShowImage($arFileTmp["src"], 21, 21, "border=0");
                }
                $data["FULL_NAME"] = CUser::FormatName($_REQUEST["NAME_TEMPLATE"], $res);
                $data["URL"] = CUtil::JSEscape(CComponentEngine::MakePathFromTemplate($_REQUEST["URL_TEMPLATE"], array("UID" => $res["ID"], "user_id" => $res["ID"], "USER_ID" => $res["ID"])));
                $arUsers[$res["ID"]] = $data;
            }
            $arVoteList["items"] = array();
            foreach ($_REQUEST["ID"] as $id) {
                $arVoteList["items"][] = $arUsers[$id];
            }
            if ($arParams["CACHE_TIME"] > 0) {
                $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
                if (!!$arEventsInfo) {
                    $db_res = CVoteQuestion::GetByID($arEventsInfo["QUESTION_ID"]);
                    if ($db_res && ($res = $db_res->Fetch())) {
                        CVoteCacheManager::SetTag($cache_path, "V", $res["VOTE_ID"]);
                    }
                }
                $cache->EndDataCache($arVoteList);
            }
        }
    }
}
$APPLICATION->RestartBuffer();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arVoteList);
die;
Esempio n. 3
0
        }
        $arResult["QUESTIONS"][$qID]["COUNTER_SUM"] = $counterSum;
        $arResult["QUESTIONS"][$qID]["COUNTER_MAX"] = $counterMax;
        //Images
        $arResult["QUESTIONS"][$qID]["IMAGE"] = CFile::GetFileArray($arResult["QUESTIONS"][$qID]["IMAGE_ID"]);
        //Diagram type
        if (!empty($arParams["QUESTION_DIAGRAM_" . $qID]) && $arParams["QUESTION_DIAGRAM_" . $qID] != "-") {
            $arResult["QUESTIONS"][$qID]["DIAGRAM_TYPE"] = trim($arParams["QUESTION_DIAGRAM_" . $qID]);
        }
        //Answers
        $arResult["QUESTIONS"][$qID]["ANSWERS"] = $arQuestion["ANSWERS"];
    }
    //Vote Image
    $arResult["VOTE"]["IMAGE"] = CFile::GetFileArray($arResult["VOTE"]["IMAGE_ID"]);
    $obCache->StartDataCache();
    CVoteCacheManager::SetTag($cache_path, array("C" => $arResult["VOTE"]["CHANNEL_ID"], "V" => $arResult["VOTE"]["ID"], "Q" => array_keys($arResult["QUESTIONS"])));
    $obCache->EndDataCache(array("arResult" => $arResult));
}
$arParams["PERMISSION"] = $arParams["PERMISSION"] === false && CModule::IncludeModule("vote") ? CVoteChannel::GetGroupPermission($arResult["CHANNEL"]["ID"]) : $arParams["PERMISSION"];
if ($arParams["PERMISSION"] < 1) {
    ShowError(GetMessage("VOTE_ACCESS_DENIED"));
    return false;
}
if ($_REQUEST["VOTE_ID"] == $arParams["VOTE_ID"]) {
    $arError = array();
    $arNote = array();
    if ($GLOBALS["VOTING_OK"] == "Y" || $_REQUEST["VOTE_SUCCESSFULL"] == "Y") {
        $arNote[] = array("id" => "ok", "text" => GetMessage("VOTE_OK"));
    }
    if ($GLOBALS["USER_ALREADY_VOTE"] == "Y") {
        $arError[] = array("id" => "already vote", "text" => GetMessage("VOTE_ALREADY_VOTE"));
Esempio n. 4
0
 function onAfterVoting($VOTE_ID, $EVENT_ID)
 {
     unset($GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID]);
     unset($GLOBALS["VOTE_CACHE"]["VOTE"][$VOTE_ID]);
     CVoteCacheManager::ClearTag("V", $VOTE_ID);
 }
Esempio n. 5
0
    $db_res = false;
    if (!!$arParams["VOTE_ID"]) {
        $db_res = CVote::GetByIDEx($arParams["VOTE_ID"]);
    } else {
        $obChannel = CVoteChannel::GetList($by, $order, array("SID" => $arParams["CHANNEL_SID"], "SID_EXACT_MATCH" => "Y", "SITE" => SITE_ID, "ACTIVE" => "Y", "HIDDEN" => "N"), $is_filtered);
        if ($obChannel && ($arChannel = $obChannel->Fetch())) {
            $db_res = CVote::GetList($by, $order, array("CHANNEL_ID" => $arChannel["ID"], "LAMP" => "green"), $is_filtered);
        }
    }
    $arVote = $db_res ? $db_res->Fetch() : array();
    if (empty($arVote) || $arVote["CHANNEL_ACTIVE"] != "Y" || $arVote["ACTIVE"] != "Y") {
        return false;
    }
    $arResult = array("VOTE" => $arVote, "VOTE_ID" => $arVote["ID"], "VOTE_RESULT_TEMPLATE" => $APPLICATION->GetCurPageParam("", array("VOTE_SUCCESSFULL", "VOTE_ID", "view_form")), "ADDITIONAL_CACHE_ID" => "current_vote");
    $obCache->StartDataCache();
    CVoteCacheManager::SetTag($cache_path, array("C" => $arVote["CHANNEL_ID"], "V" => $arVote["ID"]));
    $obCache->EndDataCache(array("arResult" => $arResult));
} else {
    $arVars = $obCache->GetVars();
    $arResult = $arVars["arResult"];
    $this->SetTemplateCachedData($arVars["templateCachedData"]);
}
$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)) {