function parsePreferenceNumber($param, $k) { $value = html_entity_decode($_POST[$param . $k]); if (0 == strcmp(PARAM_UNAVAILABLE, $value)) { $value = NULL; } else { $value = swwat_parse_number($value, FALSE); } return $value; }
// $Id: ExpoEditAction.php 751 2012-06-26 19:31:30Z ecgero $ Copyright (c) ConSked, LLC. All Rights Reserved. include 'util/authenticate.php'; require_once 'properties/constants.php'; require_once 'db/Expo.php'; require_once 'db/ShiftStatus.php'; require_once 'util/log.php'; require_once 'util/session.php'; require_once 'swwat/gizmos/parse.php'; $expo = getExpoCurrent(); $expoid = NULL; if ($expo != NULL) { $expoid = $expo->expoid; } $stationid = NULL; if (isset($_REQUEST[PARAM_LIST_INDEX])) { $stationid = swwat_parse_number(html_entity_decode($_REQUEST[PARAM_LIST_INDEX]), FALSE); } $workerid = NULL; $statusType = NULL; if (isset($_POST) && $_POST != NULL) { $keys = array_keys($_POST); $workerid = $keys[0]; $values = array_values($_POST); if (!strcmp($values[0], 'Check In')) { $statusType = 'CHECK_IN'; } else { if (!strcmp($values[0], 'Check Out')) { $statusType = 'CHECK_OUT'; } } }
function swwat_parse_integer($str, $len, $blankOk = true) { $str = swwat_parse_string($str, $blankOk); if (is_null($str)) { return NULL; } // note blankOk = false exception already thrown if (strlen($str) > $len) { throw new LengthSWWATException('parse_integer:' . $str . " size:" . $len); } return swwat_parse_number($str, $blankOk); }
$type = swwat_parse_string(html_entity_decode($_POST[PARAM_TYPE_MESSAGE]), true); $typeFlag = 0 != strcmp($type, PARAM_SMS_SERVICE); // email TRUE (default), sms FALsE $subject = swwat_parse_string(html_entity_decode($_POST[PARAM_SUBJECT_MESSAGE])); $message = swwat_parse_string(html_entity_decode($_POST[PARAM_MESSAGE])); $list = $_POST[PARAM_LIST_INDEX]; if (!is_null($list) && ($typeFlag && (!is_null($subject) || !is_null($message)) || !$typeFlag && !is_null($message))) { if (!$typeFlag) { $subject = ""; // ensure blank $message = substr($message, 0, 160); } $workerList = $_SESSION[PARAM_LIST]; for ($k = 0; $k < count($list); $k++) { try { $listIndex = swwat_parse_number(html_entity_decode($list[$k]), FALSE); $worker = $workerList[$listIndex]; $to = $typeFlag ? $worker->email : $worker->smsemail; if (!is_null($to) && strlen($to) > 0) { FormMail::send($to, $subject, $message); } else { /* continue to process list */ logMessage("SendMessageAction", "failure with to field:" . $to . " index:" . $k . " value:" . $list[$k]); } } catch (ParseSWWATException $pe) { /* continue to process list */ logMessage("SendMessageAction", "failure with index:" . $k . " value:" . $list[$k]); } } // $k }
/** * This function is used for <SELECT> elements with multiple options. */ function getSelectList() { $paramList = $_SESSION[PARAM_LIST]; // note MULTIPLE used in HTML generation if (!isset($_REQUEST[PARAM_LIST_INDEX]) || is_null($_REQUEST[PARAM_LIST_INDEX])) { $indexArray = array(); } else { if (!is_array($_REQUEST[PARAM_LIST_INDEX])) { $indexArray = array($_REQUEST[PARAM_LIST_INDEX]); } else { $indexArray = $_REQUEST[PARAM_LIST_INDEX]; } } $newParamList = array(); foreach ($indexArray as $k) { $k = swwat_parse_number(html_entity_decode($k), FALSE); $newParamList[] = $paramList[$k]; } // $k return $newParamList; }
// $Id: WorkerRegistrationAction.php 1498 2012-08-27 01:28:30Z preston $ Copyright (c) ConSked, LLC. All Rights Reserved. include 'util/authenticate.php'; require_once 'properties/constants.php'; require_once 'db/Expo.php'; require_once 'db/Worker.php'; require_once 'util/log.php'; require_once 'util/session.php'; require_once 'swwat/gizmos/parse.php'; $author = getWorkerAuthenticated(); $indexArray = $_POST[PARAM_LIST_INDEX]; $expoList = $_SESSION[PARAM_LIST]; unset($_SESSION[PARAM_LIST]); // not needed anymore foreach ($indexArray as $index) { try { $index = swwat_parse_number(html_entity_decode($index), FALSE); $expo = $expoList[$index]; if (is_null($expo)) { continue; } // try next $author->assignToExpo($expo->expoid); } catch (ParseSWWATException $ex) { // ignore; but means they aren't using the client header('Location: WorkerLoginPage.php'); include 'WorkerLoginPage.php'; return; } } $expoList = NULL; // gc hint