Example #1
0
/********************************************************************
				/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");
}