function tad_web_action_form($ActionID = "") { global $xoopsDB, $xoopsUser, $WebID, $MyWebs, $isMyWeb, $xoopsTpl, $TadUpFiles, $web_cate; if (!$isMyWeb and $MyWebs) { redirect_header($_SERVER['PHP_SELF'] . "?op=WebID={$MyWebs[0]}&tad_web_action_form", 3, _MD_TCW_AUTO_TO_HOME); } elseif (empty($MyWebs)) { redirect_header("index.php", 3, _MD_TCW_NOT_OWNER); } //抓取預設值 if (!empty($ActionID)) { $DBV = get_tad_web_action($ActionID); } else { $DBV = array(); } //預設值設定 //設定「ActionID」欄位預設值 $ActionID = !isset($DBV['ActionID']) ? $ActionID : $DBV['ActionID']; //設定「ActionName」欄位預設值 $ActionName = !isset($DBV['ActionName']) ? "" : $DBV['ActionName']; //設定「ActionDesc」欄位預設值 $ActionDesc = !isset($DBV['ActionDesc']) ? "" : $DBV['ActionDesc']; //設定「ActionDate」欄位預設值 $ActionDate = !isset($DBV['ActionDate']) ? date("Y-m-d") : $DBV['ActionDate']; //設定「ActionPlace」欄位預設值 $ActionPlace = !isset($DBV['ActionPlace']) ? "" : $DBV['ActionPlace']; //設定「uid」欄位預設值 $user_uid = $xoopsUser ? $xoopsUser->getVar('uid') : ""; $uid = !isset($DBV['uid']) ? $user_uid : $DBV['uid']; //設定「WebID」欄位預設值 $WebID = !isset($DBV['WebID']) ? $WebID : $DBV['WebID']; //設定「ActionCount」欄位預設值 $ActionCount = !isset($DBV['ActionCount']) ? "" : $DBV['ActionCount']; //設定「CateID」欄位預設值 $CateID = !isset($DBV['CateID']) ? "" : $DBV['CateID']; $cate_menu = $web_cate->cate_menu($CateID); $xoopsTpl->assign('cate_menu', $cate_menu); $op = empty($ActionID) ? "insert_tad_web_action" : "update_tad_web_action"; if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('ActionName', $ActionName); $xoopsTpl->assign('ActionDesc', $ActionDesc); $xoopsTpl->assign('ActionDate', $ActionDate); $xoopsTpl->assign('ActionPlace', $ActionPlace); //$xoopsTpl->assign('list_del_file',upfile::list_del_file("ActionID",$ActionID,true)); $xoopsTpl->assign('ActionID', $ActionID); $xoopsTpl->assign('WebID', $WebID); $xoopsTpl->assign('next_op', $op); $xoopsTpl->assign('op', 'tad_web_action_form'); $TadUpFiles->set_col('ActionID', $ActionID); //若 $show_list_del_file ==true 時一定要有 $upform = $TadUpFiles->upform(true, 'upfile'); $xoopsTpl->assign('upform', $upform); }
function tad_web_link_form($LinkID = "") { global $xoopsDB, $xoopsUser, $WebID, $MyWebs, $xoopsTpl, $isMyWeb, $web_cate; if (!$isMyWeb and $MyWebs) { redirect_header($_SERVER['PHP_SELF'] . "?WebID={$MyWebs[0]}&op=tad_web_link_form", 3, _MD_TCW_AUTO_TO_HOME); } elseif (empty($MyWebs)) { redirect_header("index.php", 3, _MD_TCW_NOT_OWNER); } //抓取預設值 if (!empty($LinkID)) { $DBV = get_tad_web_link($LinkID); } else { $DBV = array(); } //預設值設定 //設定「LinkID」欄位預設值 $LinkID = !isset($DBV['LinkID']) ? "" : $DBV['LinkID']; //設定「LinkTitle」欄位預設值 $LinkTitle = !isset($DBV['LinkTitle']) ? "" : $DBV['LinkTitle']; //設定「LinkDesc」欄位預設值 $LinkDesc = !isset($DBV['LinkDesc']) ? "" : $DBV['LinkDesc']; //設定「LinkUrl」欄位預設值 $LinkUrl = !isset($DBV['LinkUrl']) ? "" : $DBV['LinkUrl']; //設定「LinkCounter」欄位預設值 $LinkCounter = !isset($DBV['LinkCounter']) ? "" : $DBV['LinkCounter']; //設定「LinkSort」欄位預設值 $LinkSort = !isset($DBV['LinkSort']) ? tad_web_link_max_sort() : $DBV['LinkSort']; //設定「WebID」欄位預設值 $WebID = !isset($DBV['WebID']) ? $WebID : $DBV['WebID']; //設定「uid」欄位預設值 $user_uid = $xoopsUser ? $xoopsUser->getVar('uid') : ""; $uid = !isset($DBV['uid']) ? $user_uid : $DBV['uid']; //設定「CateID」欄位預設值 $CateID = !isset($DBV['CateID']) ? "" : $DBV['CateID']; $cate_menu = $web_cate->cate_menu($CateID); $xoopsTpl->assign('cate_menu', $cate_menu); $op = empty($LinkID) ? "insert_tad_web_link" : "update_tad_web_link"; //$op="replace_tad_web_link"; if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('LinkTitle', $LinkTitle); $xoopsTpl->assign('LinkUrl', $LinkUrl); $xoopsTpl->assign('LinkDesc', $LinkDesc); $xoopsTpl->assign('LinkSort', $LinkSort); $xoopsTpl->assign('WebID', $WebID); $xoopsTpl->assign('LinkID', $LinkID); $xoopsTpl->assign('next_op', $op); $xoopsTpl->assign('op', 'tad_web_link_form'); }
function tad_web_cate_form($CateID = '') { global $xoopsDB, $xoopsTpl, $isAdmin; //抓取預設值 if (!empty($CateID)) { $DBV = get_tad_web_cate($CateID); } else { $DBV = array(); } //預設值設定 //設定 CateID 欄位的預設值 $CateID = !isset($DBV['CateID']) ? $CateID : $DBV['CateID']; $xoopsTpl->assign('CateID', $CateID); //設定 WebID 欄位的預設值 $WebID = !isset($DBV['WebID']) ? '' : $DBV['WebID']; $xoopsTpl->assign('WebID', $WebID); //設定 CateName 欄位的預設值 $CateName = !isset($DBV['CateName']) ? '' : $DBV['CateName']; $xoopsTpl->assign('CateName', $CateName); //設定 ColName 欄位的預設值 $ColName = !isset($DBV['ColName']) ? 'web_cate' : $DBV['ColName']; $xoopsTpl->assign('ColName', $ColName); //設定 ColSN 欄位的預設值 $ColSN = !isset($DBV['ColSN']) ? '0' : $DBV['ColSN']; $xoopsTpl->assign('ColSN', $ColSN); //設定 CateSort 欄位的預設值 $CateSort = !isset($DBV['CateSort']) ? tad_web_cate_max_sort($WebID, $ColName, $ColSN) : $DBV['CateSort']; $xoopsTpl->assign('CateSort', $CateSort); //設定 CateEnable 欄位的預設值 $CateEnable = !isset($DBV['CateEnable']) ? '1' : $DBV['CateEnable']; $xoopsTpl->assign('CateEnable', $CateEnable); //設定 CateCounter 欄位的預設值 $CateCounter = !isset($DBV['CateCounter']) ? '0' : $DBV['CateCounter']; $xoopsTpl->assign('CateCounter', $CateCounter); $op = empty($CateID) ? "save_tad_web_cate" : "update_tad_web_cate"; //$op = "replace_tad_web_cate"; //套用formValidator驗證機制 if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _TAD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); $xoopsTpl->assign('action', $_SERVER["PHP_SELF"]); $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('now_op', 'tad_web_cate_form'); $xoopsTpl->assign('next_op', $op); }
switch ($action) { case $_L['BTN_save']: if (isset($_POST['itemcount']) && $_POST['itemcount'] > 0) { for ($i = 1; $i <= $_POST['itemcount']; $i++) { $sale = 0; if (isset($_POST['sale_' . $i])) { $sale = 1; } if (isset($_POST['idx_' . $i])) { modify_item($_POST['idx_' . $i], $_POST['item_' . $i], $_POST['description_' . $i], $sale, $_POST['expense_' . $i], $_POST['itype_' . $i]); } } } if ($_POST['newitem'] || $_POST['newdescription']) { // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('newitem', $_L['ITM_noitm_err']); $fv->validateEmpty('newdescription', $_L['ITM_noitmdesc_err']); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo "<h2>" . $_L['PR_formerr'] . "</h2>"; echo $fv->displayErrors(); echo "</div>"; } else { modify_item(0, $_POST['newitem'], $_POST['newdescription'], $_POST['newsale'], $_POST['newexpense'], $_POST['newitype']); } } break; case $_L['BTN_delete']:
/***************************************************************************** For any details please feel free to contact me at taifa@users.sourceforge.net Or for snail mail. P. O. Box 938, Kilifi-80108, East Africa-Kenya. /*****************************************************************************/ error_reporting(E_ALL & ~E_NOTICE); include_once "login_check.inc.php"; include_once "queryfunctions.php"; include_once "functions.php"; access("rooms"); //check if user is allowed to access this page if (isset($_POST['Submit'])) { $conn = db_connect(HOST, USER, PASS, DB, PORT); $action = $_POST['Submit']; switch ($action) { case 'Add Rooms Detail': $fv = new formValidator(); //from functions.php $fv->validateEmpty('roomno', 'Please enter room no.'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { //gets photo. if (isset($_REQUEST['form_submit']) && 'form_uploader' == $_REQUEST['form_submit']) { if (is_uploaded_file($_FILES['photo']['tmp_name'])) { $filename = $_FILES['photo']['name']; $filetype = $_FILES['photo']['type']; $file_temp = $_FILES['photo']['tmp_name'];
access("agents"); //check if user is allowed to access this page $logofile = Get_LogoFile(); if (isset($_GET["search"])) { $agentid = $_GET['search']; } if (isset($_GET['id'])) { $agentid = $_GET['id']; } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['AGT_addagent']: case $_L['BTN_update']: // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('iata', $_L['AGT_iata_err']); $fv->validateEmpty('name', $_L['AGT_name_err']); $fv->validateEmpty('phone', $_L['AGT_phone_err']); $fv->validateEmpty('town', $_L['AGT_town_err']); $fv->validateEmpty('billing', $_L['AGT_billing_err']); if ($fv->checkErrors()) { // display errors $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>"; } else { $agentid = !empty($_POST["agentid"]) ? $_POST["agentid"] : 0; $country = $_POST['country']; $ebridgeID = $_POST['ebridgeID']; $IM = $_POST['IM']; $name = $_POST["name"];
} else { $trans_code = !empty($_POST["trans_code"]) ? "'" . $_POST["trans_code"] . "'" : 'NULL'; $trans_type = !empty($_POST["trans_type"]) ? "'" . $_POST["trans_type"] . "'" : 'NULL'; $remarks = !empty($_POST["remarks"]) ? "'" . $_POST["remarks"] . "'" : 'NULL'; $accounts = !empty($_POST["accounts"]) ? $_POST["accounts"] : 'NULL'; $cooperative = !empty($_POST["cooperative"]) ? $_POST["cooperative"] : 'NULL'; $payroll = !empty($_POST["payroll"]) ? $_POST["payroll"] : 'NULL'; $sql = "INSERT INTO transtype (trans_code,trans_type,remarks,accounts,cooperative,payroll)\n\t\t\t\t VALUES({$trans_code},{$trans_type},{$remarks},{$accounts},{$cooperative},{$payroll})"; $results = mkr_query($sql, $conn); $msg[0] = "Sorry transaction type not added"; $msg[1] = "Transaction type successfull added"; AddSuccess($results, $conn, $msg); } break; case 'Add Payment Mode': $fv = new formValidator(); //from functions.php $fv->validateEmpty('payment_option', 'Please enter payment option.'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { $payment_option = !empty($_POST["payment_option"]) ? "'" . $_POST["payment_option"] . "'" : 'NULL'; $sql = "INSERT INTO payment_mode (payment_option) VALUES({$payment_option})"; $results = mkr_query($sql, $conn); $msg[0] = "Sorry payment mode not added"; $msg[1] = "Payment mode successfull added"; AddSuccess($results, $conn, $msg);
function tad_web_discuss_form($DiscussID = "") { global $xoopsDB, $xoopsUser, $WebID, $MyWebs, $isAdmin, $xoopsTpl, $web_cate; if (!isAdmin and !$MyWebs and empty($_SESSION['LoginMemID'])) { redirect_header("index.php", 3, _MD_TCW_LOGIN_TO_POST); } //抓取預設值 if (!empty($DiscussID)) { $DBV = get_tad_web_discuss($DiscussID); } else { $DBV = array(); } //預設值設定 if ($MyWebs) { //設定「uid」欄位預設值 $uid = !isset($DBV['uid']) ? $xoopsUser->uid() : $DBV['uid']; //設定「MemID」欄位預設值 $MemID = !isset($DBV['MemID']) ? 0 : $DBV['MemID']; //設定「LoginMemName」欄位預設值 $MemName = !isset($DBV['MemName']) ? $xoopsUser->name() : $DBV['MemName']; //設定「WebID」欄位預設值 $WebID = !isset($DBV['WebID']) ? $WebID : $DBV['WebID']; } else { //設定「uid」欄位預設值 $uid = !isset($DBV['uid']) ? 0 : $DBV['uid']; //設定「MemID」欄位預設值 $MemID = !isset($DBV['MemID']) ? $LoginMemID : $DBV['MemID']; //設定「LoginMemName」欄位預設值 $MemName = !isset($DBV['MemName']) ? $LoginMemName : $DBV['MemName']; //設定「WebID」欄位預設值 $WebID = !isset($DBV['WebID']) ? $_SESSION['LoginWebID'] : $DBV['WebID']; } //設定「DiscussID」欄位預設值 $DiscussID = !isset($DBV['DiscussID']) ? "" : $DBV['DiscussID']; //設定「ReDiscussID」欄位預設值 $ReDiscussID = !isset($DBV['ReDiscussID']) ? "" : $DBV['ReDiscussID']; //設定「DiscussTitle」欄位預設值 $DiscussTitle = !isset($DBV['DiscussTitle']) ? "" : $DBV['DiscussTitle']; //設定「DiscussContent」欄位預設值 $DiscussContent = !isset($DBV['DiscussContent']) ? "" : $DBV['DiscussContent']; //設定「DiscussDate」欄位預設值 $DiscussDate = !isset($DBV['DiscussDate']) ? date("Y-m-d H:i:s") : $DBV['DiscussDate']; //設定「LastTime」欄位預設值 $LastTime = !isset($DBV['LastTime']) ? date("Y-m-d H:i:s") : $DBV['LastTime']; //設定「DiscussCounter」欄位預設值 $DiscussCounter = !isset($DBV['DiscussCounter']) ? "" : $DBV['DiscussCounter']; //設定「CateID」欄位預設值 $CateID = !isset($DBV['CateID']) ? "" : $DBV['CateID']; $new_cate = empty($_SESSION['LoginMemID']) ? true : false; $cate_menu = $web_cate->cate_menu($CateID, $new_cate); $xoopsTpl->assign('cate_menu', $cate_menu); $op = empty($DiscussID) ? "insert_tad_web_discuss" : "update_tad_web_discuss"; //$op="replace_tad_web_discuss"; if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('DiscussTitle', $DiscussTitle); $xoopsTpl->assign('DiscussContent', $DiscussContent); $xoopsTpl->assign('WebID', $WebID); $xoopsTpl->assign('DiscussID', $DiscussID); $xoopsTpl->assign('ReDiscussID', $ReDiscussID); $xoopsTpl->assign('next_op', $op); $xoopsTpl->assign('op', 'tad_web_discuss_form'); }
function list_jill_booking_time($jbi_sn = "") { global $xoopsDB, $xoopsTpl, $isAdmin; if (empty($jbi_sn)) { return; } $item = get_jill_booking_item($jbi_sn); include_once XOOPS_ROOT_PATH . "/modules/tadtools/jeditable.php"; $jeditable = new jeditable(); $myts =& MyTextSanitizer::getInstance(); $sql = "select * from `" . $xoopsDB->prefix("jill_booking_time") . "`\n where `jbi_sn`='{$jbi_sn}' order by `jbt_sort`"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $total = $xoopsDB->getRowsNum($result); $all_content = ""; $i = 0; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $jbt_sn , $jbi_sn , $jbt_title , $jbt_sort foreach ($all as $k => $v) { ${$k} = $v; } //過濾讀出的變數值 $jbt_title = $myts->htmlSpecialChars($jbt_title); $jeditable->setTextCol("#jbt_title_{$jbt_sn}", 'time.php', '100%', '11pt', "{'jbt_sn':{$jbt_sn},'op' : 'save_jbt_title'}", _TAD_EDIT . _MA_JILLBOOKIN_JBT_TITLE); $all_content[$i]['jbi_sn'] = $jbi_sn; $all_content[$i]['jbt_sn'] = $jbt_sn; $all_content[$i]['jbt_title_link'] = "<a href='{$_SERVER['PHP_SELF']}?jbt_sn={$jbt_sn}'>{$jbt_title}</a>"; $all_content[$i]['jbt_title'] = $jbt_title; $all_content[$i]['jbt_sort'] = $jbt_sort; $all_content[$i]['jbt_week'] = strval($jbt_week); $booking_times = get_booking_times($jbt_sn); $all_content[$i]['booking_times'] = empty($booking_times) ? "" : sprintf(_MA_JILLBOOKIN_BOOKING_TIME, $booking_times); $w_arr = explode(',', $jbt_week); for ($j = 0; $j <= 7; $j++) { $name = "w{$j}"; $pic = in_array($j, $w_arr) ? "yes.gif" : "no.gif"; $all_content[$i][$name] = "<img src='../images/{$pic}' id='{$jbt_sn}_{$j}' onClick=\"change_enable({$jbt_sn},{$j});\" style='cursor: pointer;'>"; } ++$i; } //die(var_export($all_content)); //刪除確認的JS $xoopsTpl->assign('item', $item); $xoopsTpl->assign('bar', $bar); $xoopsTpl->assign('action', $_SERVER['PHP_SELF']); $xoopsTpl->assign('isAdmin', $isAdmin); $xoopsTpl->assign('all_content', $all_content); $xoopsTpl->assign('now_op', 'list_jill_booking_time'); $xoopsTpl->assign('jbi_sn', $jbi_sn); if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php")) { redirect_header("index.php", 3, _MA_NEED_TADTOOLS); } include_once XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php"; $sweet_alert = new sweet_alert(); $delete_jill_booking_time_func = $sweet_alert->render('delete_jill_booking_time_func', "{$_SERVER['PHP_SELF']}?op=delete_jill_booking_time&jbi_sn={$jbi_sn}&jbt_sn=", "jbt_sn"); $xoopsTpl->assign('delete_jill_booking_time_func', $delete_jill_booking_time_func); //套用formValidator驗證機制 if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _TAD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); $xoopsTpl->assign('formValidator_code', $formValidator_code); $jeditable_set = $jeditable->render(); $xoopsTpl->assign('jeditable_set', $jeditable_set); //找出現有場地 $i = 0; $place_time = ""; $sql = "select a.* , count(b.jbt_sn) as counter from `" . $xoopsDB->prefix("jill_booking_item") . "` as a join `" . $xoopsDB->prefix("jill_booking_time") . "` as b on a.jbi_sn=b.jbi_sn where a.jbi_enable='1' group by b.jbi_sn"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); while ($data = $xoopsDB->fetchArray($result)) { $data['jbi_link'] = sprintf(_MA_JILLBOOKIN_IMPORT_PLACE, $data['jbi_title'], $data['counter']); $place_time[$i] = $data; $i++; } $xoopsTpl->assign('place_time', $place_time); $xoopsTpl->assign('jquery', get_jquery(true)); }
switch ($action) { case $_L['BTN_save']: if (isset($_POST['roomtypecount']) && $_POST['roomtypecount'] > 0) { for ($i = 1; $i <= $_POST['roomtypecount']; $i++) { if (isset($_POST['idx_' . $i])) { modify_roomtype($_POST['idx_' . $i], $_POST['roomtype_' . $i], $_POST['description_' . $i], $_POST['rateid_' . $i], $_POST['url_' . $i]); if (is_ebridgeCustomer()) { include_once dirname(__FILE__) . "/OTA/advancedFeatures/adv_functions.php"; CustomPagesFormRead(HTL_ROOM_TYPE, $_POST['idx_' . $i]); } } } } if ($_POST['newroomtype'] || $_POST['newdescription']) { // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('newroomtype', $_L['RMT_normtyp']); $fv->validateEmpty('newdescription', $_L['RMT_noitmdes']); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo "<h2>" . $_L['PR_formerr'] . "</h2>"; echo $fv->displayErrors(); echo "</div>"; } else { modify_roomtype(0, $_POST['newroomtype'], $_POST['newdescription'], $_POST['newrateid'], $_POST['newurl']); } } break; case $_L['BTN_delete']:
protected function getView() { //https://сервер/index.php?BANK_ID=BBTYPE=1&PAY_ID=12345&PAY_DATE=2009-04-15 11:22:33&ACCOUNT=54321&PAY_AMOUNT=1100&SIGN=827CCB0EEA8A706C4C34A16891F84E7B $config = $this->toolkit->getConfig('ctBank'); $userMapper = $this->toolkit->getMapper('user', 'user'); $bankMapper = $this->toolkit->getMapper('ctData', 'ctDataBank'); $bank_title = $this->request->getString('BANK_ID', SC_GET); $bank = $bankMapper->searchOneByField('title', $bank_title); switch ($this->request->getInteger('TYPE', SC_GET)) { case 1: $action = 'payment'; break; case 4: $action = 'check'; break; default: return $this->forward404(); } $validator = new formValidator(); $validator->disableCSRF(); $validator->submit('TYPE'); // Проверка в запросе обязательного поля bank_id $validator->rule('callbackwmsg', 'BANK_ID', 0, array(array($this, 'checkBank'), $bank)); $validator->rule('required', 'SIGN', 4); $validator->rule('callback', 'SIGN', 4, array(array($this, 'checkSign'), $bank)); $validator->rule('required', 'ACCOUNT', 2); $validator->rule('callback', 'ACCOUNT', 5, array(array($this, 'checkAccount'), $bank)); $validator->rule('in', 'CHECK_BY', 'not in range', array('login', 'card_number')); // Проверит линковку аккаунта к школе if ($action == 'payment') { $validator->rule('required', 'PAY_AMOUNT', 2); $validator->rule('numeric', 'PAY_AMOUNT', 3); $validator->rule('required', 'PAY_ID', 2); $validator->rule('callbackwmsg', 'PAY_ID', 0, array(array($this, 'checkPayId'), $bank)); $validator->rule('required', 'PAY_DATE', 2); $validator->rule('regex', 'PAY_DATE', 3, '!\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}!'); // Валидатор поля типа платежа // $validator->rule('required', 'ACCOUNT_TYPE', 2); $validator->rule('callback', 'ACCOUNT_TYPE', 3, array(array($this, 'checkAccountType'))); } if ($validator->validate()) { $user = $this->getUser(); if ($action == 'payment') { // Заберем настройки модуля if (!$config->exists('comission')) { throw new mzzRuntimeException('"comission" value not found in configs/ctBank.php'); } $pay_id = $this->request->getString('PAY_ID', SC_GET); $sum = $this->request->getInteger('PAY_AMOUNT', SC_GET) / 100; //PAY_AMOUNT – сумма платежа в копейках $enrolledSum = $sum * (100 - $config->get('comission')) / 100; if (preg_match('!\\A([a-z]{2})!i', $pay_id, $match)) { $bank_name = $match[1]; } else { $bank_name = ''; } // Получим тип аккаунта на который класть деньги $ctBillLocalAccountTypeMapper = $this->toolkit->getMapper('ctBillLocal', 'ctBillLocalAccountType'); $account_type = $this->request->getInteger('ACCOUNT_TYPE', SC_GET); if (empty($account_type)) { $account_type = 1; } $ctBillLocalAccountType = $ctBillLocalAccountTypeMapper->searchByKey($account_type); // Получим аккаунт $account = $user->getAccount($ctBillLocalAccountType->getName()); $accountType = $account->getAccountType(); // Осуществляем платеж if ($account && $account->enrollPayment($sum, 'Платеж через терминал ' . $bank_name . ' (' . $pay_id . ')', $accountType->getDefaultEnrollmentSubtype())) { $status = 0; $msg = 'Платеж принят'; // Создадим запись о платеже $ctBankOnlinepayPaymentMapper = $this->toolkit->getMapper('ctBank', 'ctBankOnlinepayPayment'); $payment = $ctBankOnlinepayPaymentMapper->create(); $payment->setBankId($bank->getId()); $payment->setPayId($pay_id); $payment->setUserId($user->getId()); $payment->setDate(time()); $payment->setSum($sum); $payment->setEnrolledSum($enrolledSum); $payment->setStatus($status); $ctBankOnlinepayPaymentMapper->save($payment); } else { $status = 21; $msg = 'Ошибка биллинга'; } } else { $status = 0; $msg = 'Абонент существует'; $this->view->assign('login', $user->getLogin()); $this->view->assign('fio', $user->getFullname()); $this->view->assign('balance', $user->getAccount()->getBalance()); $ctCardServiceInfo = $user->getctCardServiceInfo(); // Проверим есть ли запись об этом учение в таблице с абонентской платой if ($ctCardServiceInfo && (double) $ctCardServiceInfo->getSum()) { $cardAccount = $user->getAccount('cardservice'); if ($cardAccount && $cardAccount->getBalance()) { $this->view->assign('cardservice_balance', $cardAccount->getBalance()); } $this->view->assign('block_status', $user->getAccount()->getBlockStatus()); } } } else { $status = reset($validator->getErrors()); } if (isset($msg)) { $this->view->assign('message', $msg); } //var_dump($validator->getErrors()); $this->view->assign('status', $status); }
$is_a_eBridgeCustomer = 1; doDataMigration_fromGuests_toAdvProfile(); $uri = ""; if ($guestid) { $uri = "?id=" . $guestid; } header("Location:advanced_profile.php" . $uri); return 1; } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['GST_addguest']: case $_L['GST_updguest']: // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('lastname', $_L['GST_ferr1']); $fv->validateEmpty('firstname', $_L['GST_ferr2']); $fv->validateEmpty('pp_id_no', $_L['GST_ferr3']); $fv->validateEmpty('countrycode', $_L['GST_ferr4']); //if (!empty($_POST["email"])) $fv->validateEmail('email','Please enter a valid email address'); if ($fv->checkErrors()) { // display errors // display errors $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>"; } else { if (!$guestid && $_POST['guestid']) { $guestid = $_POST['guestid']; } $firstname = $_POST["firstname"];
function tad_web_news_form($NewsID = "") { global $xoopsDB, $xoopsUser, $WebID, $MyWebs, $isMyWeb, $xoopsTpl, $TadUpFiles, $web_cate; if (!$isMyWeb and $MyWebs) { redirect_header($_SERVER['PHP_SELF'] . "?WebID={$MyWebs[0]}&op=tad_web_news_form", 3, _MD_TCW_AUTO_TO_HOME); } elseif (empty($MyWebs)) { redirect_header("index.php", 3, _MD_TCW_NOT_OWNER); } $Class = getWebInfo($WebID); //抓取預設值 if (!empty($NewsID)) { $DBV = get_tad_web_news($NewsID); } else { $DBV = array(); } //設定「NewsID」欄位預設值 $NewsID = !isset($DBV['NewsID']) ? "" : $DBV['NewsID']; //設定「NewsTitle」欄位預設值 if (isset($DBV['NewsTitle'])) { $NewsTitle = _NEWS_KIND == "homework" ? $Class['WebTitle'] . date(" Y-m-d ") . _MD_TCW_HOMEWORK : $DBV['NewsTitle']; } else { $NewsTitle = _NEWS_KIND == "homework" ? $Class['WebTitle'] . date(" Y-m-d ") . _MD_TCW_HOMEWORK : ""; } //設定「NewsContent」欄位預設值 if (isset($DBV['NewsContent'])) { $NewsContent = $DBV['NewsContent']; } else { $NewsContent = _NEWS_KIND == "homework" ? _MD_TCW_HOMEWORK_DEFAULT : ""; } //設定「NewsDate」欄位預設值 $NewsDate = !isset($DBV['NewsDate']) ? date("Y-m-d H:i:s") : $DBV['NewsDate']; //設定「toCal」欄位預設值 if (!isset($DBV['toCal'])) { $toCal = _NEWS_KIND == "homework" ? date("Y-m-d") : ""; } else { $toCal = $DBV['toCal'] == "0000-00-00 00:00:00" ? "" : $DBV['toCal']; } //設定「NewsPlace」欄位預設值 $NewsPlace = !isset($DBV['NewsPlace']) ? "" : $DBV['NewsPlace']; //設定「NewsMaster」欄位預設值 $NewsMaster = !isset($DBV['NewsMaster']) ? "" : $DBV['NewsMaster']; //設定「NewsUrl」欄位預設值 $NewsUrl = !isset($DBV['NewsUrl']) ? "" : $DBV['NewsUrl']; //設定「WebID」欄位預設值 $WebID = !isset($DBV['WebID']) ? $WebID : $DBV['WebID']; //設定「NewsKind」欄位預設值 $NewsKind = !isset($DBV['NewsKind']) ? "" : $DBV['NewsKind']; //設定「NewsCounter」欄位預設值 $NewsCounter = !isset($DBV['NewsCounter']) ? "" : $DBV['NewsCounter']; //設定「CateID」欄位預設值 $CateID = !isset($DBV['CateID']) ? "" : $DBV['CateID']; $cate_menu = $web_cate->cate_menu($CateID); $xoopsTpl->assign('cate_menu', $cate_menu); $op = empty($NewsID) ? "insert_tad_web_news" : "update_tad_web_news"; //$op="replace_tad_web_news"; if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); if (_USE_FCKEDITOR) { include_once XOOPS_ROOT_PATH . "/modules/tadtools/ck.php"; $ck = new CKEditor("tad_web", "NewsContent", $NewsContent); $ck->setHeight(300); $editor = $ck->render(); } else { $editor = "<textarea name='NewsContent' id='NewsContent' class='span12'>{$NewsContent}</textarea>"; } $_SHOW_NEWS_PLACE = $_SHOW_NEWS_MASTER = $_USE_NEWS_FORM_DATETIME = $_SHOW_NEWS_URL = $_SHOW_NEWS_TOCAL = $_SHOW_NEWS_UPLOAD = ""; $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('op', $op); $xoopsTpl->assign('NewsID', $NewsID); $xoopsTpl->assign('NewsContent_editor', $editor); $xoopsTpl->assign('SHOW_NEWS_UPLOAD', _SHOW_NEWS_UPLOAD); $xoopsTpl->assign('SHOW_NEWS_TOCAL', _SHOW_NEWS_TOCAL); $xoopsTpl->assign('toCal', $toCal); $xoopsTpl->assign('USE_NEWS_FORM_DATETIME', _USE_NEWS_FORM_DATETIME); $xoopsTpl->assign('NewsDate', $NewsDate); $xoopsTpl->assign('SHOW_NEWS_URL', _SHOW_NEWS_URL); $xoopsTpl->assign('NewsUrl', $NewsUrl); $xoopsTpl->assign('SHOW_NEWS_MASTER', _SHOW_NEWS_MASTER); $xoopsTpl->assign('NewsMaster', $NewsMaster); $xoopsTpl->assign('SHOW_NEWS_PLACE', _SHOW_NEWS_PLACE); $xoopsTpl->assign('NewsPlace', $NewsPlace); $xoopsTpl->assign('NewsTitle', $NewsTitle); $TadUpFiles->set_col("NewsID", $NewsID); $upform = $TadUpFiles->upform(); $xoopsTpl->assign('upform', $upform); }
$logofile = Get_LogoFile(); $hoteldesc = ""; $outfile = "hoteldescription.txt"; $validationMsgs = ""; if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['HWS_btn_updatedec']: $data = $_POST[hoteldesc]; $fh = fopen($outfile, 'w'); fwrite($fh, $data); fclose($fh); break; case $_L['HWS_addimg']: // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->EmptyCheck('imgurl', $_L['HWS_err_imgurl']); if ($fv->checkErrors()) { // display errors $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>"; } else { $hoteldesc = $_POST["hoteldesc"]; $imgtitle = $_POST["imgtitle"]; $imgurl = $_POST["imgurl"]; $imgdesc = $_POST["imgdesc"]; $imgpg = $_POST["imgpage"]; $isvideo = $_POST["isvideo"]; $picid = modify_hotelgallery($picid, $imgtitle, $imgurl, $imgdesc, $imgpg, $isvideo); } break;
$restarget = $_POST['restarget']; } $today = date("d/m/Y"); $tomorrow = date("d/m/Y", time() + 24 * 60 * 60); $validationMsgs = ""; if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['REG_register']: case $_L['BTN_update']: case $_L['REG_checkinbox']: case $_L['REG_checkoutbox']: case $_L['REG_Rcheckout']: //if guest has not been selected exit // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('no_adults', $_L['REG_noperson_err']); $fv->validateEmpty('roomid', $_L['REG_noroom_err']); if ($fv->checkErrors()) { // display errors $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>"; } else { $userid = $_SESSION["userid"]; $book_id = $_POST["book_id"]; $res_id = $_POST["reservation_id"]; $bill_id = $_POST["bill_id"]; $guestid = $_POST["guestid"]; $guestname = $_POST["guestname"]; $address = $_POST["address"]; $email = $_POST["email"];
session_start(); error_reporting(E_ALL & ~E_NOTICE); include_once "login_check.inc.php"; include_once "queryfunctions.php"; include_once "functions.php"; $conn = db_connect(HOST, USER, PASS, DB, PORT); if (isset($_GET["search"])) { find($_GET["search"]); } $guestid = $_POST['guestid']; if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case 'Update': // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('booking_type', 'Please indicate if it\'s a Direct booking or Agent booking.'); $fv->validateEmpty('meal_plan', 'Please select Meal Plan'); //$fv->validateEmpty('countrycode','Please select country'); //$fv->validateEmpty('pp_no','Agents name must be entered'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { $booking_type = $_POST["booking_type"]; $meal_plan = $_POST["meal_plan"]; $no_adults = $_POST["no_adults"];
find($billno); $search = $billno; break; case 'search': $search = $_GET["search"]; find($search); break; } } if (isset($_POST['Submit'])) { $conn = db_connect(HOST, USER, PASS, DB, PORT); $action = $_POST['Submit']; switch ($action) { case 'Update': // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('doc_no', 'Please enter document number.'); $fv->validateEmpty('doc_date', 'Please enter date'); $fv->validateEmpty('doc_date', 'Please enter details'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; //search current record } else { $billno = $_POST["billno"]; $doc_type = $_POST["doc_type"]; $doc_no = $_POST["doc_no"];
$resid = get_ReservationID_By_BillID($id); $resdetailcount = reservation_details_byResID($resid, $details); if ($resid) { foreach ($details as $dt) { $rateid = $dt['ratesid']; $roomid = $dt['roomid']; add_roomcharges($id, $roomid, $rateid, $checkin, $checkout, $userid); } } else { add_roomcharges($id, $roomid, $rateid, $checkin, $checkout, $userid); } } break; case $_L['BTN_update']: //filed validations $fv = new formValidator(); //from functions.php if (isset($_POST['modifytrans']) && $_POST['modifytrans']) { $std_itmamnt = 'std_amt_' . $_POST['modifytrans']; $itmamnt = 'amount_' . $_POST['modifytrans']; $itmqty = 'qty_' . $_POST['modifytrans']; if ($_POST['std_amount'] == "" && $_POST['itemid'] != "0" || $_POST[$std_itmamnt] == "") { $fv->addErrormsg($_L['INV_nostdamnt_err']); } if ($_POST['amount'] == "" && $_POST['itemid'] != "0" || $_POST[$itmamnt] == "") { $fv->addErrormsg($_L['INV_noamnt_err']); } if ($_POST['quantity'] == "" && $_POST['itemid'] != "0" || $_POST[$itmqty] == "") { $fv->addErrormsg($_L['INV_noqty_err']); } if ($_POST['std_amount'] != "" && $_POST['itemid'] != "0" && !preg_match("/^[0-9]*(\\.[0-9]+)?+\$/", $_POST['std_amount']) || $_POST[$std_itmamnt] != "" && !preg_match("/^[0-9]*(\\.[0-9]+)?+\$/", $_POST[$std_itmamnt])) {
find($_GET["search"]); } //consider having this as a function in the functions.php if (isset($_POST['Navigate'])) { //echo $_SESSION["strOffSet"]; $nRecords = num_rows(mkr_query("select * from guests", $conn), $conn); paginate($nRecords); free_result($results); find($_SESSION["strOffSet"]); } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case 'Add Guest': // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('lastname', 'Please enter Guests First Name'); $fv->validateEmpty('firstname', 'Please enter Guests Last Name'); $fv->validateEmpty('pp_id_no', 'Passport No. or ID. No. must be entered.'); $fv->validateEmpty('countrycode', 'Please select country'); //if (!empty($_POST["email"])) $fv->validateEmail('email','Please enter a valid email address'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { $firstname = $_POST["firstname"]; $middlename = $_POST["middlename"];
if (isset($_POST['Submit']) || isset($_POST['remove_id']) && $_POST['remove_id'] != 0 || isset($_POST['add_id']) && $_POST['add_id'] != 0) { if (isset($_POST['remove_id'])) { $action = "remove_rate"; } if (isset($_POST['add_id'])) { $action = "add_rate"; } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; } switch ($action) { case $_L['BTN_add']: case $_L['BTN_update']: case "remove_rate": case "add_rate": $fv = new formValidator(); //from functions.php if (isset($_POST['add_id']) && $_POST['add_id'] != 0) { $opnumber = $_POST['add_id']; if (isset($_POST["ratesid_" . $opnumber]) && empty($_POST["ratesid_" . $opnumber])) { $fv->addErrormsg($_L['RSV_ratecode_err']); } if (isset($_POST["roomid_" . $opnumber]) && empty($_POST["roomid_" . $opnumber])) { $fv->addErrormsg($_L['RSV_roomnum_err']); } if (isset($_POST["roomtypeid_" . $opnumber]) && empty($_POST["roomtypeid_" . $opnumber])) { $fv->addErrormsg($_L['RSV_roomtype_err']); } } if ($fv->checkErrors()) { $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>";
function jill_booking_form($jbi_sn = "") { global $xoopsDB, $xoopsTpl, $xoopsModuleConfig; //場地設定 $item_opt = get_jill_booking_time_options($jbi_sn); if (!empty($jbi_sn)) { //場地資訊 $itemArr = get_jill_booking_item($jbi_sn, 1); $xoopsTpl->assign('itemArr', $itemArr); // array ('jbi_sn' => '2','jbi_title' =>'多功能教室','jbi_desc' => '<p>多功能教室多功能教室</p>','jbi_sort' => '1','jbi_start' => '2015-01-28','jbi_end' => '0000-00-00','jbi_enable' => '1','jbi_approval' => '0',) //die(var_export($itemArr)); //預設值設定 //設定 jb_booking_content 欄位的預設值 $xoopsTpl->assign('jb_booking_content', ""); //設定 jb_start_date 欄位的預設值 $jb_start_date = strtotime($itemArr['jbi_start']) <= strtotime(date("Y-m-d")) ? date("Y-m-d") : $itemArr['jbi_start']; $xoopsTpl->assign('jb_start_date', $jb_start_date); //設定 jb_end_date 欄位的預設值 $xoopsTpl->assign('jb_end_date', $jb_start_date); //設定可預約之週數及日期 $max_bookingweek = $xoopsModuleConfig['max_bookingweek']; //$show_range = date("Y-m-d", strtotime("+$max_bookingweek week")); if (empty($max_bookingweek)) { //場地預約結束日期 $end = $itemArr['jbi_end'] == '0000-00-00' ? 0 : strtotime($itemArr['jbi_end']); $max_date = $end == 0 ? '' : $itemArr['jbi_end']; } else { $endtime = strtotime("+{$max_bookingweek} week"); if ($itemArr['jbi_end'] == '0000-00-00') { $end = $endtime; } else { $end = strtotime($itemArr['jbi_end']) >= $endtime ? $endtime : strtotime($itemArr['jbi_end']); } $max_date = date("Y-m-d", $end); } //die($max_date); $xoopsTpl->assign('max_date', $max_date); //時段資訊 $timeArr = get_bookingtime_jbisn($jbi_sn); $xoopsTpl->assign('timeArr', $timeArr); //die(var_export($timeArr)); $weektime = ""; foreach ($timeArr as $t => $time) { for ($w = 0; $w < 7; $w++) { $jbt_sn = $time['jbt_sn']; $jbt_week = strval($time['jbt_week']); $weektime[$t][$w]['jbt_week'] = strpos($jbt_week, strval($w)) !== false ? "<input type='checkbox' name='jb_week[{$jbt_sn}][]' value='{$w}' >" : "<span style='color:#D44950'><i class='fa fa-times'></i></span>"; } } //die(var_export($weektime)); //套用formValidator驗證機制 if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _TAD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); //加入Token安全機制 include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; $token = new XoopsFormHiddenToken(); $token_form = $token->render(); $xoopsTpl->assign("token_form", $token_form); $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('weektime', $weektime); $xoopsTpl->assign('next_op', "insert_jill_booking"); } $xoopsTpl->assign('item_opt', $item_opt); $xoopsTpl->assign('now_op', 'jill_booking_form'); $xoopsTpl->assign('action', $_SERVER["PHP_SELF"]); }
function jill_booking_item_form($jbi_sn = "") { global $xoopsDB, $xoopsTpl; //抓取預設值 if (!empty($jbi_sn)) { $DBV = get_jill_booking_item($jbi_sn); } else { $DBV = array(); } //預設值設定 $myts =& MyTextSanitizer::getInstance(); //設定 jbi_sn 欄位的預設值 $jbi_sn = !isset($DBV['jbi_sn']) ? $jbi_sn : $DBV['jbi_sn']; $xoopsTpl->assign('jbi_sn', $jbi_sn); //設定 jbi_start 欄位的預設值 $jbi_start = !isset($DBV['jbi_start']) ? date("Y-m-d") : $DBV['jbi_start']; $yesterday = date("Y-m-d", strtotime('-1 day')); $xoopsTpl->assign('jbi_start', $jbi_start); $xoopsTpl->assign('yesterday', $yesterday); //設定 jbi_end 欄位的預設值 $jbi_end = !isset($DBV['jbi_end']) ? "" : $DBV['jbi_end']; $xoopsTpl->assign('jbi_end', $jbi_end); //設定 jbi_title 欄位的預設值 $jbi_title = !isset($DBV['jbi_title']) ? "" : $DBV['jbi_title']; $xoopsTpl->assign('jbi_title', $jbi_title); //設定 jbi_desc 欄位的預設值 $jbi_desc = !isset($DBV['jbi_desc']) ? "" : $myts->displayTarea($DBV['jbi_desc'], $html = 1, $smiley = 1, $xcode = 1, $image = 1, $br = 0); if (!file_exists(TADTOOLS_PATH . "/ck.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/ck.php"; $Editor = new CKEditor("jill_booking", "jbi_desc", $jbi_desc); $Editor->setToolbarSet('myBasic'); $Editor_code = $Editor->render(); $xoopsTpl->assign('Editor_code', $Editor_code); //設定 jbi_approval 欄位的預設值 $jbi_approval = !isset($DBV['jbi_approval']) ? "0" : $DBV['jbi_approval']; $xoopsTpl->assign('jbi_approval', $jbi_approval); //設定 jbi_sort 欄位的預設值 $jbi_sort = !isset($DBV['jbi_sort']) ? jill_booking_item_max_sort() : $DBV['jbi_sort']; $xoopsTpl->assign('jbi_sort', $jbi_sort); //設定 jbi_enable 欄位的預設值 $jbi_enable = !isset($DBV['jbi_enable']) ? "1" : $DBV['jbi_enable']; $xoopsTpl->assign('jbi_enable', $jbi_enable); $op = empty($jbi_sn) ? "insert_jill_booking_item" : "update_jill_booking_item"; //$op="replace_jill_booking_item"; //套用formValidator驗證機制 if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _TAD_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); //加入Token安全機制 include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; $token = new XoopsFormHiddenToken(); $token_form = $token->render(); $xoopsTpl->assign("token_form", $token_form); $xoopsTpl->assign('action', $_SERVER["PHP_SELF"]); $xoopsTpl->assign('formValidator_code', $formValidator_code); $xoopsTpl->assign('now_op', 'jill_booking_item_form'); $xoopsTpl->assign('next_op', $op); }
error_reporting(E_ALL & ~E_NOTICE); include_once "queryfunctions.php"; include_once "login_check.inc.php"; include_once "functions.php"; access("admin"); //check if user is allowed to access this page if (isset($_GET["search"])) { find($_GET["search"]); } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case 'Add User': //|| 'Update User'): // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('fname', 'Enter users First name'); $fv->validateEmpty('sname', 'Enter users Second name'); $fv->validateEmpty('loginname', 'Enter users loginname'); $fv->validateEmpty('pass', 'Please enter a password'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { $fname = $_POST["fname"]; $sname = $_POST["sname"]; $loginname = $_POST["loginname"];
/*****************************************************************************/ error_reporting(E_ALL & ~E_NOTICE); include_once "queryfunctions.php"; include_once "login_check.inc.php"; include_once "functions.php"; access("agents"); //check if user is allowed to access this page if (isset($_GET["search"])) { find($_GET["search"]); } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case 'Update': // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('agents_ac_no', 'Agents A/C No. must be entered'); $fv->validateEmpty('agentname', 'Agents name must be entered'); $fv->validateEmpty('telephone', 'Agents phone is required'); $fv->validateEmpty('town', 'Town is required'); $fv->validateEmpty('billing_address', 'Agents billing address is required'); if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors(); echo "</div>"; } else { $agentname = $_POST["agentname"]; $agents_ac_no = $_POST["agents_ac_no"];
include_once dirname(__FILE__) . "/functions.php"; include_once dirname(__FILE__) . "/dailyfunc.php"; include_once dirname(__FILE__) . "/lang/lang_en.php"; access("rooms"); //check if user is allowed to access this page $logofile = Get_LogoFile(); $lang = get_language(); load_language($lang); //get the list of all the room number in the system $rmNoList = get_roomnolist(); if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['RM_addroom']: case $_L['BTN_update']: $fv = new formValidator(); //from functions.php $fv->validateEmpty('roomno', $_L['RMT_noroom']); if ($fv->checkErrors()) { // display errors $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>"; } else { /** * When the Room is to be added or updated the form data will be retrieved. * This includes the phone, room number etc which is then * submitted to the database. <br/> */ //gets photo. if (isset($_REQUEST['form_submit']) && 'form_uploader' == $_REQUEST['form_submit']) { if (is_uploaded_file($_FILES['photo']['tmp_name'])) { $filename = $_FILES['photo']['name'];
} if (isset($_GET["id"])) { $tt = 0; if ($_GET['optFind'] == "Name") { $tt = 1; } find_user($_GET["id"], $tt, $myuser); $id = $_GET['id']; } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['USR_adduser']: case $_L['BTN_update']: // instantiate form validator object $fv = new formValidator(); //from functions.php $fv->validateEmpty('fname', $_L['ADM_nameerr']); $fv->validateEmpty('sname', $_L['ADM_famerr']); $fv->validateEmpty('loginname', $_L['ADM_loginerr']); $fv->validateEmpty('pass', $_L['ADM_passerr']); if ($fv->checkErrors()) { // display errors $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>"; } else { $userid = $_POST["userid"]; $fname = $_POST["fname"]; $sname = $_POST["sname"]; $loginname = $_POST["loginname"]; $pass = md5($_POST["pass"]); $phone = !empty($_POST["phone"]) ? $_POST["phone"] : '';
if (isset($_POST['Navigate'])) { //echo $_SESSION["strOffSet"]; $nRecords = db_query('SELECT * FROM guests')->rowCount(); // @todo Refactor in a more efficient way. paginate($nRecords); find($_SESSION["strOffSet"]); } $guestid = $_POST['guestid']; //forgotten what this does if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case 'Book Guest': //if guest has not been selected exit // instantiate form validator object $fv = new formValidator(); //from functions.php if (empty($_POST["guestid"])) { //if no guest has been selected no point in displaying other errors $fv->validateEmpty('guestid', 'Sorry no guest information is available for booking'); } else { $fv->validateEmpty('no_adults', 'Please indicate number of people booking'); $fv->validateEmpty('booking_type', 'Please indicate if it\'s a Direct booking or Agent booking.'); $fv->validateEmpty('meal_plan', 'Please select Meal Plan'); $fv->validateEmpty('roomid', 'Please indicate room being booked'); } if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors();
function tad_web_form($WebID = null) { global $xoopsDB, $xoopsUser, $xoopsTpl, $TadUpFiles; $pic = ""; //抓取預設值 if (!empty($WebID)) { $DBV = get_tad_web($WebID); //圖案 $TadUpFiles->set_col("WebLogo", $WebID, "1"); $web_logo = $TadUpFiles->get_pic_file("thumb"); $pic = empty($web_logo) ? "" : "background-image:url({$web_logo});background-repeat: no-repeat; background-position: top right;"; } else { $DBV = array(); } //預設值設定 //設定「WebID」欄位預設值 $WebID = !isset($DBV['WebID']) ? $WebID : $DBV['WebID']; //設定「WebName」欄位預設值 $WebName = !isset($DBV['WebName']) ? "" : $DBV['WebName']; //設定「WebSort」欄位預設值 $WebSort = !isset($DBV['WebSort']) ? tad_web_max_sort() : $DBV['WebSort']; //設定「WebEnable」欄位預設值 $WebEnable = !isset($DBV['WebEnable']) ? "" : $DBV['WebEnable']; //設定「WebCounter」欄位預設值 $WebCounter = !isset($DBV['WebCounter']) ? "" : $DBV['WebCounter']; //設定「WebOwner」欄位預設值 $WebOwner = !isset($DBV['WebOwner']) ? "" : $DBV['WebOwner']; //設定「WebOwnerUid」欄位預設值 $WebOwnerUid = !isset($DBV['WebOwnerUid']) ? "" : $DBV['WebOwnerUid']; //設定「WebTitle」欄位預設值 $WebTitle = !isset($DBV['WebTitle']) ? "" : $DBV['WebTitle']; $op = empty($WebID) ? "insert_tad_web" : "update_tad_web"; //$op="replace_tad_web"; if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _MA_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); $sql = "select uid,uname,name from " . $xoopsDB->prefix("users") . " order by uname"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $user_menu = "<select name='WebOwnerUid'>"; while ($all = $xoopsDB->fetchArray($result)) { foreach ($all as $k => $v) { ${$k} = $v; } $name = empty($name) ? "" : "({$name})"; $selected = $uid == $WebOwnerUid ? "selected" : ""; $user_menu .= "<option value='{$uid}' {$selected}>{$uname} {$name}</option>"; } $user_menu .= "</select>"; //$jquery = get_jquery(true); $xoopsTpl->assign('pic', $pic); $xoopsTpl->assign('user_menu', $user_menu); $xoopsTpl->assign('WebName', $WebName); $xoopsTpl->assign('WebTitle', $WebTitle); $xoopsTpl->assign('WebOwner', $WebOwner); $xoopsTpl->assign('WebEnable1', chk($WebEnable, "1", "1")); $xoopsTpl->assign('WebEnable0', chk($WebEnable, "0")); $xoopsTpl->assign('WebSort', $WebSort); $xoopsTpl->assign('WebID', $WebID); $xoopsTpl->assign('next_op', $op); $xoopsTpl->assign('jquery', $jquery); }
} if (isset($_POST['Navigate'])) { //echo $_SESSION["strOffSet"]; $nRecords = num_rows(mkr_query("select * from guests", $conn), $conn); paginate($nRecords); free_result($results); find($_SESSION["strOffSet"]); } $guestid = $_POST['guestid']; if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case 'Guest Reservation': //if guest has not been selected exit // instantiate form validator object $fv = new formValidator(); //from functions.php if (empty($_POST["guestid"])) { //if no guest has been selected no point in displaying other errors $fv->validateEmpty('guestid', 'No guest has been selected for reservation.'); } else { $fv->validateEmpty('reservation_type', 'Please indicate if it\'s a Direct booking or Agent booking.'); $fv->validateEmpty('meal_plan', 'Please select Meal Plan'); $fv->validateEmpty('reserve_checkindate', 'Please enter checkin date for reservation'); $fv->validateEmpty('roomid', 'Please indicate room being booked'); } if ($fv->checkErrors()) { // display errors echo "<div align=\"center\">"; echo '<h2>Resubmit the form after correcting the following errors:</h2>'; echo $fv->displayErrors();
} if ($ratesid) { $temprateType = get_ratetype_by_rateID($ratesid); if ($temprateType == DEFAULTRATE && $_POST['ratetype'] != DEFAULTRATE) { $isDefaultRateUsed = isRateUsed($ratesid); if ($isDefaultRateUsed == 1) { $allowChangeRate = 0; } } } if (isset($_POST['Submit'])) { $action = $_POST['Submit']; switch ($action) { case $_L['BTN_update']: case $_L['RTS_addrate']: $fv = new formValidator(); //from functions.php $fv->validateEmpty('code', $_L['RTS_noratecode_err']); // $fv->validateEmpty('description','Please enter rate description.'); $fv->validateEmpty('occupancy', $_L['RTS_nooccup_err']); $fv->validateEmpty('date_started', $_L['RTS_nostrtdate_err']); $fv->validateEmpty('date_stopped', $_L['RTS_noenddate_err']); $fv->validateEmpty('currencycode', $_L['RTS_nocurcode_err']); $fv->validateEmpty('minpax', $_L['RTS_nominprson_err']); $fv->validateNumber('minpax', $_L['RTS_minprson_nmric_err']); $fv->validateEmpty('maxpax', $_L['RTS_nomaxprson_err']); $fv->validateNumber('maxpax', $_L['RTS_maxprson_nmric_err']); $fv->validateEmpty('minstay', $_L['RTS_nominnghts_err']); $fv->validateNumber('minstay', $_L['RTS_minstay_nmric_err']); $fv->validateEmpty('maxstay', $_L['RTS_nomaxstay_err']); $fv->validateNumber('maxstay', $_L['RTS_maxstay_nmric_err']);