From 7ec4c7998d4ae7f29896e4d3250b125be400561e Mon Sep 17 00:00:00 2001 From: RedDragonWebDesign Date: Tue, 23 Jan 2024 00:33:07 -0800 Subject: [PATCH] fix indenting --- src/members/include/polls/createpoll.php | 426 +++++++++--------- .../include/polls/include/addoption.php | 190 ++++---- 2 files changed, 311 insertions(+), 305 deletions(-) diff --git a/src/members/include/polls/createpoll.php b/src/members/include/polls/createpoll.php index e1f1a9d7..424776e2 100644 --- a/src/members/include/polls/createpoll.php +++ b/src/members/include/polls/createpoll.php @@ -1,124 +1,124 @@ get_info(); + $consoleObj->select($_GET['cID']); + if (!$member->hasAccess($consoleObj)) { exit(); - } else { - $memberInfo = $member->get_info(); - $consoleObj->select($_GET['cID']); - if (!$member->hasAccess($consoleObj)) { - exit(); - } } +} - require_once("../classes/access.php"); - require_once("../classes/poll.php"); +require_once("../classes/access.php"); +require_once("../classes/poll.php"); - $cID = $_GET['cID']; +$cID = $_GET['cID']; - $dispError = ""; - $countErrors = 0; +$dispError = ""; +$countErrors = 0; - $pollObj = new Poll($mysqli); - $accessObj = $pollObj->objAccess; +$pollObj = new Poll($mysqli); +$accessObj = $pollObj->objAccess; - if (isset($_POST['accessCacheID'])) { - $accessObj->cacheID = $_POST['accessCacheID']; - } +if (isset($_POST['accessCacheID'])) { + $accessObj->cacheID = $_POST['accessCacheID']; +} - $_SESSION['btAccessCacheTables'][$accessObj->cacheID] = json_encode($accessObj->arrAccessTables); - $_SESSION['btAccessCacheTypes'][$accessObj->cacheID] = json_encode($accessObj->arrAccessTypes); +$_SESSION['btAccessCacheTables'][$accessObj->cacheID] = json_encode($accessObj->arrAccessTables); +$_SESSION['btAccessCacheTypes'][$accessObj->cacheID] = json_encode($accessObj->arrAccessTypes); - $arrPostSelected = array(); +$arrPostSelected = array(); - if (!empty($_POST['submit'])) { +if (!empty($_POST['submit'])) { - // Check Question - if (trim($_POST['pollquestion']) == "") { - $countErrors++; - $dispError .= "   · Your poll question may not be blank.
"; - } - - // Check Access Types - $arrCheckAccessTypes = array("members", "memberslimited", "public"); - if (!in_array($_POST['accesstype'], $arrCheckAccessTypes)) { - $countErrors++; - $dispError .= "   · You selected an invalid access type.
"; - } + // Check Question + if (trim($_POST['pollquestion']) == "") { + $countErrors++; + $dispError .= "   · Your poll question may not be blank.
"; + } + // Check Access Types + $arrCheckAccessTypes = array("members", "memberslimited", "public"); + if (!in_array($_POST['accesstype'], $arrCheckAccessTypes)) { + $countErrors++; + $dispError .= "   · You selected an invalid access type.
"; + } - // Check Result Visibility - $arrCheckVisTypes = array("open", "votedonly", "pollend", "never"); - if (!in_array($_POST['resultvisibility'], $arrCheckVisTypes)) { - $countErrors++; - $dispError .= "   · You selected an invalid result visibility type.
"; - } - // Check Max Votes + // Check Result Visibility + $arrCheckVisTypes = array("open", "votedonly", "pollend", "never"); + if (!in_array($_POST['resultvisibility'], $arrCheckVisTypes)) { + $countErrors++; + $dispError .= "   · You selected an invalid result visibility type.
"; + } - if ($_POST['maxvotes'] != "" && (!is_numeric($_POST['maxvotes']) || $_POST['maxvotes'] < 0)) { - $countErrors++; - $dispError .= "   · Max votes per user must be a value greater than zero.
"; - } + // Check Max Votes - // Check Poll End + if ($_POST['maxvotes'] != "" && (!is_numeric($_POST['maxvotes']) || $_POST['maxvotes'] < 0)) { + $countErrors++; + $dispError .= "   · Max votes per user must be a value greater than zero.
"; + } - if ($_POST['enddate'] != "forever" && $_POST['enddate'] != "choose") { - $countErrors++; - $dispError .= "   · You selected an invalid poll end date.
"; - } elseif ($_POST['enddate'] == "choose" && (!is_numeric($_POST['realenddate']) || $_POST['realenddate'] <= 0)) { - $countErrors++; - $dispError .= "   · You selected an invalid poll end date.
"; - } + // Check Poll End + if ($_POST['enddate'] != "forever" && $_POST['enddate'] != "choose") { + $countErrors++; + $dispError .= "   · You selected an invalid poll end date.
"; + } elseif ($_POST['enddate'] == "choose" && (!is_numeric($_POST['realenddate']) || $_POST['realenddate'] <= 0)) { + $countErrors++; + $dispError .= "   · You selected an invalid poll end date.
"; + } - if ($countErrors == 0) { - $setEndDate = 0; - if ($_POST['enddate'] == "choose") { - $setEndDate = $_POST['realenddate'] / 1000; - $tempYear = date("Y", $setEndDate); - $tempMonth = date("n", $setEndDate); - $tempDay = date("j", $setEndDate); - $tempHour = $_POST['endhour']; - if ($_POST['endAMPM'] == "PM") { - $tempHour += 12; - } + if ($countErrors == 0) { - $setEndDate = mktime($tempHour, $_POST['endminute'], 0, $tempMonth, $tempDay, $tempYear); + $setEndDate = 0; + if ($_POST['enddate'] == "choose") { + $setEndDate = $_POST['realenddate'] / 1000; + $tempYear = date("Y", $setEndDate); + $tempMonth = date("n", $setEndDate); + $tempDay = date("j", $setEndDate); + $tempHour = $_POST['endhour']; + if ($_POST['endAMPM'] == "PM") { + $tempHour += 12; } + $setEndDate = mktime($tempHour, $_POST['endminute'], 0, $tempMonth, $tempDay, $tempYear); + } + - $_POST['multivote'] = ($_POST['multivote'] != 1) ? 0 : 1; - $_POST['displayvoters'] = ($_POST['displayvoters'] != 1) ? 0 : 1; + $_POST['multivote'] = ($_POST['multivote'] != 1) ? 0 : 1; + $_POST['displayvoters'] = ($_POST['displayvoters'] != 1) ? 0 : 1; - $arrColumns = array("member_id", "question", "accesstype", "multivote", "displayvoters", "resultvisibility", "maxvotes", "pollend", "dateposted"); - $arrValues = array($memberInfo['member_id'], $_POST['pollquestion'], $_POST['accesstype'], $_POST['multivote'], $_POST['displayvoters'], $_POST['resultvisibility'], $_POST['maxvotes'], $setEndDate, time()); + $arrColumns = array("member_id", "question", "accesstype", "multivote", "displayvoters", "resultvisibility", "maxvotes", "pollend", "dateposted"); + $arrValues = array($memberInfo['member_id'], $_POST['pollquestion'], $_POST['accesstype'], $_POST['multivote'], $_POST['displayvoters'], $_POST['resultvisibility'], $_POST['maxvotes'], $setEndDate, time()); - if ($pollObj->addNew($arrColumns, $arrValues)) { - $pollObj->cacheID = $_POST['pollCacheID']; - $pollObj->savePollOptions(); + if ($pollObj->addNew($arrColumns, $arrValues)) { + $pollObj->cacheID = $_POST['pollCacheID']; + $pollObj->savePollOptions(); - if ($_POST['accesstype'] == "memberslimited") { - $accessObj->cacheID = $_POST['accessCacheID']; - $accessObj->arrAccessFor = array("keyName" => "poll_id", "keyValue" => $pollObj->get_info("poll_id")); - $accessObj->saveAccess(); - } + if ($_POST['accesstype'] == "memberslimited") { + $accessObj->cacheID = $_POST['accessCacheID']; + $accessObj->arrAccessFor = array("keyName" => "poll_id", "keyValue" => $pollObj->get_info("poll_id")); + $accessObj->saveAccess(); + } - echo " + echo "