function savingToEvent($field, $calendar) { global $saving, $savingLog, $savingEdit, $edit; //convert string to timestamp if (is_Numeric($calendar)) { $calendar == 0 ? $timestamp = 0 : ($timestamp = $calendar); } else { list($year, $month, $day, $hour, $minute) = preg_split('/[ \\:\\/]/', $calendar); $timestamp = mktime($hour + 1, $minute, 0, $month, $day, $year); } $saving->set($field, $timestamp); $savingLog->set($field, $timestamp); if ($edit) { $savingEdit[0]->set($field, $timestamp); } }
function admin_listarale($acao = 1) { $this->set('title', 'Listar'); //$tarefas = $this->Tarefa->find('all'); $this->layout = 'admin'; $offset = false; $offsetNumber = 0; $curPage = 0; $registrosPorPagina = 20; if (is_Numeric($acao)) { $offsetNumber = ($acao - 1) * $registrosPorPagina; $offset = true; $curPage = $acao; } $all = $this->Tarefasale->find('all'); $numeroDePaginas = ceil(count($all) / $registrosPorPagina); $paginacao = $this->paginacao($curPage, $numeroDePaginas, 'admin/tarefas', 'listar'); $this->set('tarefas', $this->Tarefasale->find('all', array('offset' => $offsetNumber, 'limit' => $registrosPorPagina))); $this->set(compact('tarefas', 'showAll', 'numeroDePaginas', 'curPage', 'paginacao')); }
protected function isInt($value, $num, $auto_correct) { if (is_Numeric($value)) { $value = $value; } else { $value = false; } return $value; }
/** * Execute SQL INSERT query for one record * * Record is defined by assosiated array * * @param string $table table for new record * @param string $data record to insert * @return execution result (0 - if failed, INSERT ID - if succeed) * @access public */ function Insert($table, &$data) { $fields = ""; $values = ""; foreach ($data as $field => $value) { if (!is_Numeric($field)) { $fields .= "`{$field}`, "; $values .= "'" . $this->DBSafe1($value) . "', "; } } $fields = substr($fields, 0, strlen($fields) - 2); $values = substr($values, 0, strlen($values) - 2); $qry = "INSERT INTO `{$table}`({$fields}) VALUES({$values})"; if (!mysql_query($qry, $this->dbh)) { $this->error($qry); return 0; } return mysql_insert_id($this->dbh); }
<?php // @sniffs MyCakePHP.PHP.FunctionName if (is_Numeric($foo)) { } function someThing() { $is = sTrTolower($was); } function some_thing() { $is = strtolower($was); } class Foo { public function bar() { $x = Is_array($array); $y = some_thing($x); } }
/** * Execute SQL UPDATE query for one record * * Record is defined by assosiated array * * @param string $table Table to update * @param array $data Record to update * @param string $ndx Index field (used in WHERE part of SQL request) * @return int * @access public */ public function Update($table, $data, $ndx = "ID") { $qry = "UPDATE `{$table}` SET "; foreach ($data as $field => $value) { if (!is_Numeric($field)) { $qry .= "`{$field}`='" . $this->DBSafe1($value) . "', "; } } $qry = substr($qry, 0, strlen($qry) - 2); if (!isset($data[$ndx])) { $data[$ndx] = ''; } $qry .= " WHERE {$ndx} = '" . $data[$ndx] . "'"; if (!$this->Exec($qry)) { $this->Error($qry); return 0; } return 1; }
exit; } if (isset($_SESSION['LAST_ACTIVITY']) && time() - $_SESSION['LAST_ACTIVITY'] > Config::sessionTimeout()) { // last request was more than session timeout period $param = '?' . POST_PARAM_SE . '=' . $_SESSION['SYSTEM_ENTRY']; endSession(); header('Location: index.php' . $param); exit; } $sesid = session_id(); $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp if (isset($_GET[POST_PARAM_SE]) != '' && is_Numeric($_GET[POST_PARAM_SE])) { $_SESSION['SYSTEM_ENTRY'] = $_GET[POST_PARAM_SE]; } if (isset($_POST[POST_PARAM_SE]) != '' && is_Numeric($_POST[POST_PARAM_SE])) { $_SESSION['SYSTEM_ENTRY'] = $_POST[POST_PARAM_SE]; } if (!isset($_SESSION['SYSTEM_ENTRY'])) { $_SESSION['SYSTEM_ENTRY'] = Config::defaultStartup(); //default startup } if (!isset($_SESSION['COMMSERVER'])) { $_SESSION['COMMSERVER'] = 0; } /* session level survey locking (ignore ajax calls) */ if (loadvar(POST_PARAM_SMS_AJAX) != SMS_AJAX_CALL) { // not sms ajax call if ($_SESSION['SYSTEM_ENTRY'] != USCIC_SMS) { if (isset($_SESSION['REQUEST_IN_PROGRESS']) && $_SESSION['REQUEST_IN_PROGRESS'] == 1) { $_SESSION['PREVIOUS_REQUEST_IN_PROGRESS'] = 1;
public function findPointFromTime($time, $mins = 1) { if (!is_Numeric($mins) or $mins < 1) { $mins = 3; } $intspec = $this->mintointerval($mins); $sql = "with t as (SELECT to_timestamp(?) as t)," . "be as (SELECT t.t - interval {$intspec} as b, t.t + interval {$intspec} as e" . " from t)" . "SELECT p.* FROM *PREFIX*gpx_points p, *PREFIX*gpx_tracks tr, be" . " WHERE p.time BETWEEN be.b AND be.e" . " AND tr.user_id = ?" . " AND tr.id = p.track_id" . " ORDER by p.time asc"; $prep = $this->db->prepare($sql); $prep->bindValue(1, $time, \PDO::PARAM_INT); $prep->bindValue(2, $this->userId); $prep->execute(); $r = $prep->fetchAll(\PDO::FETCH_OBJ); return $this->pointsToGeoJSON($r); }
function m_eventHandler() { if (!isset($this->request['action'])) { $this->request['action'] = ""; } $action = explode(".", $this->request['action']); if (isset($this->request['owner']) && !is_Numeric($this->request['owner'])) { $this->request['owner'] = 0; } $obShopInterface = new c_shopInterface(); $obShopInterface->obTpl = $this->obTpl; $obShopInterface->obDb = $this->obDb; $obShopInterface->request = $this->request; $obShopInterface->imageUrl = SITE_URL . "images/"; $obShopInterface->imagePath = SITE_PATH . "images/"; switch ($action[0]) { #HANDLING VIEW(FRONTEND-SHOP BUILDER) case "ec_show": switch ($action[1]) { case "home": $obShopInterface->departmentTemplate = $this->templatePath . "dspShopBuilder.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDepartments()); break; case "deptFrm": $obShopInterface->departmentTemplate = $this->templatePath . "dspDeptForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspDepartmentForm()); break; case "contentFrm": $obShopInterface->contentTemplate = $this->templatePath . "dspContentForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspContentForm()); break; case "dspMsg": $obShopInterface->msgTemplate = $this->templatePath . "dspMessage.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspMessage()); break; case "dspUploadFrm": $obShopInterface->uploadTemplate = $this->templatePath . "uploadImages.tpl.htm"; $obShopInterface->m_uploadForm(); break; case "dspProFrm": $obShopInterface->productTemplate = $this->templatePath . "dspProdForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspProductForm()); break; case "reorder": $obShopInterface->reorderTemplate = $this->templatePath . "dspOrderList.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_reorder()); break; case "associate": $obShopInterface->associateTemplate = $this->templatePath . "dspAssociateItems.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_associateItems()); break; case "vdiscount": $obShopInterface->discountTemplate = $this->templatePath . "volDiscount.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_volDiscount()); break; case "attachOpt": $obShopInterface->optionTemplate = $this->templatePath . "attachOption.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_attachOptions()); break; case "deleteimage": $this->libfunc->check_token(); $obShopInterface->m_deleteImage(); break; default: $obShopInterface->departmentTemplate = $this->templatePath . "dspShopBuilder.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_showDepartments()); break; } break; #HANDLING MODEL(DATABASE TRANSANCTION-SHOP BUILDER) #HANDLING MODEL(DATABASE TRANSANCTION-SHOP BUILDER) case "ec_db": $obUpdateDb = new c_shopDb(); $optionDb = new c_optionDb(); $obUpdateDb->obDb = $this->obDb; $obUpdateDb->request = $this->request; $obUpdateDb->imagePath = SITE_PATH . "images/"; //die($this->request['type']); switch ($action[1]) { case "updateHome": $this->libfunc->check_token(); if ($this->request['type'] == "product") { $obUpdateDb->m_updateHomeProduct(); } elseif ($this->request['type'] == "content") { $obUpdateDb->m_updateHomeContent(); } else { $obUpdateDb->m_updateHomeDept(); } break; case "Dept": $this->libfunc->check_token(); if ($this->request['mode'] == "edit") { if (!$obShopInterface->verifyEditDept()) { $obUpdateDb->m_updateDept(); } else { $obShopInterface->request['msg'] = 1; $obShopInterface->request['id'] = $this->request['deptId']; $obShopInterface->request['type'] = $this->request['type']; $obShopInterface->departmentTemplate = $this->templatePath . "dspDeptForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspDepartmentForm()); } } else { if (!$obShopInterface->verifyInsertDept()) { $obUpdateDb->m_insertDept(); } else { if (empty($this->request['deptId'])) { $obShopInterface->request['dupeid'] = $this->request['deptId']; $obShopInterface->request['type'] = $this->request['type']; } $obShopInterface->request['msg'] = 1; $obShopInterface->departmentTemplate = $this->templatePath . "dspDeptForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspDepartmentForm()); } } break; case "updateAssociate": $this->libfunc->check_token(); $obUpdateDb->m_updateAssociate(); break; case "addDiscount": $this->libfunc->check_token(); $obUpdateDb->m_addDiscount(); break; case "attach": $this->libfunc->check_token(); $obUpdateDb->m_attach(); break; case "delRelation": $this->libfunc->check_token(); $obUpdateDb->m_delRelation(); break; case "updateSort": $obUpdateDb->m_updateSort(); break; case "uploadDeptImages": $this->libfunc->check_token(); if (!$obShopInterface->verifyImageUpload()) { $obUpdateDb->m_uploadImage(); } else { $obShopInterface->request['image'] = $this->request['current_image']; $obShopInterface->uploadTemplate = $this->templatePath . "uploadImages.tpl.htm"; $obShopInterface->m_uploadForm(); } break; case "insertProduct": $this->libfunc->check_token(); if ($this->request['mode'] == "edit") { if (!$obShopInterface->verifyEditProduct()) { $obUpdateDb->m_updateProduct(); } else { $obShopInterface->request['msg'] = 1; $obShopInterface->request['id'] = $this->request['prodId']; $obShopInterface->productTemplate = $this->templatePath . "dspProdForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspProductForm()); } } else { if (!$obShopInterface->verifyInsertProduct()) { $obUpdateDb->m_insertProduct(); } else { if (empty($this->request['prodId'])) { $obShopInterface->request['dupeid'] = $this->request['prodId']; $obShopInterface->request['type'] = $this->request['type']; } $obShopInterface->request['msg'] = 1; $obShopInterface->productTemplate = $this->templatePath . "dspProdForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspProductForm()); } } break; case "content": $this->libfunc->check_token(); if ($this->request['mode'] == "edit") { if (!$obShopInterface->verifyEditContent()) { $obUpdateDb->m_updateContent(); } else { $obShopInterface->request['msg'] = 1; $obShopInterface->request['id'] = $this->request['contentId']; $obShopInterface->contentTemplate = $this->templatePath . "dspContentForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspContentForm()); } } else { if (!$obShopInterface->verifyInsertContent()) { $obUpdateDb->m_insertContent(); } else { if (empty($this->request['contentId'])) { $obShopInterface->request['dupeid'] = $this->request['contentId']; $obShopInterface->request['type'] = $this->request['type']; } $obShopInterface->request['msg'] = 1; $obShopInterface->contentTemplate = $this->templatePath . "dspContentForm.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obShopInterface->m_dspContentForm()); } } break; case "delDept": case "delProduct": case "delContent": $this->libfunc->check_token(); $obUpdateDb->m_delete(); break; break; break; case "delCInstance": case "delPInstance": $this->libfunc->check_token(); $obUpdateDb->m_deleteInstance(); break; break; } break; #HANDLING HELP PAGES #HANDLING HELP PAGES case "help": $this->Template = MODULES_PATH . "default/templates/admin/helpOuter.htm"; $this->obTpl->set_file("mainContent", $this->Template); switch ($action[1]) { case "dept": $this->Template = MODULES_PATH . "default/templates/help/department.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Department Help"); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "product": $this->Template = MODULES_PATH . "default/templates/help/products.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Department Help"); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "content": $this->Template = MODULES_PATH . "default/templates/help/content.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Department Help"); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "orderlist": $this->Template = MODULES_PATH . "default/templates/help/order_list.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_PAGETITLE", "Order List Help"); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "associate": $this->Template = MODULES_PATH . "default/templates/help/associate.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "menuhelp": $this->Template = MODULES_PATH . "default/templates/help/menu.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "stdoption": $this->Template = MODULES_PATH . "default/templates/help/options.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "ctmoption": $this->Template = MODULES_PATH . "default/templates/help/choices.tpl.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "package": $this->Template = MODULES_PATH . "default/templates/help/product_packages.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "vdiscount": $this->Template = MODULES_PATH . "default/templates/help/volume_discounts.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; case "attach": $this->Template = MODULES_PATH . "default/templates/help/choices.tpl.htm"; $this->obTpl->set_file("innerContent", $this->Template); $this->obTpl->set_var("TPL_VAR_HELPBODY", $this->obTpl->parse("return", "innerContent")); break; } $this->obTpl->pparse("return", "mainContent"); exit; break; #HANDLING MENU_FRONT END (VIEW) #HANDLING MENU_FRONT END (VIEW) case "ec_menu": $obMenuInterface = new c_menuInterface(); $obMenuInterface->obTpl = $this->obTpl; $obMenuInterface->obDb = $this->obDb; $obMenuInterface->request = $this->request; $obMenuInterface->imageUrl = SITE_URL . "images/"; $obMenuInterface->imagePath = SITE_PATH . "images/"; $obUpdateMenuDb = new c_menuDb(); $obUpdateMenuDb->obDb = $this->obDb; $obUpdateMenuDb->request = $this->request; $obUpdateMenuDb->imagePath = SITE_PATH . "images/"; switch ($action[1]) { case "dspForm": $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuHeader.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuHeaders()); break; case "show": $obMenuInterface->menuHeadTemplate = $this->templatePath . "dspMenuHeader.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_showMenuHeaders()); break; case "menuadd": $this->libfunc->check_token(); if ($this->request['mode'] == "edit") { if (!$obMenuInterface->m_verifyEditMenuHeader()) { $obUpdateMenuDb->m_updateMenuHeader(); } else { $obMenuInterface->request['msg'] = 1; $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuHeader.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuHeaders()); } } else { if (!$obMenuInterface->m_verifyInsertMenuHeader()) { $obUpdateMenuDb->m_insertMenuHeader(); } else { $obMenuInterface->request['msg'] = 1; $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuHeader.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuHeaders()); } } break; case "uploadForm": $obMenuInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_uploadForm()); break; case "upload": $this->libfunc->check_token(); if (!$obMenuInterface->m_verifyImageUpload()) { $obUpdateMenuDb->m_uploadImage(); } else { $obMenuInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_uploadForm()); } break; case "updatehome": $this->libfunc->check_token(); $obUpdateMenuDb->m_updateHomeMenuHeader(); break; case "deleteMenu": $this->libfunc->check_token(); $obUpdateMenuDb->m_deleteMenu(); break; case "itemForm": $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuItems.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuItem()); break; case "viewItems": $obMenuInterface->menuItemTemplate = $this->templatePath . "dspMenuItems.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_showMenuItem()); break; case "itemadd": $this->libfunc->check_token(); if ($this->request['mode'] == "edit") { if (!$obMenuInterface->m_verifyEditMenuItem()) { $obUpdateMenuDb->m_updateMenuItem(); } else { $obMenuInterface->request['msg'] = 1; $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuItems.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuItem()); } } else { if (!$obMenuInterface->m_verifyInsertMenuItem()) { $obUpdateMenuDb->m_insertMenuItem(); } else { $obMenuInterface->request['msg'] = 1; $obMenuInterface->menuFormTemplate = $this->templatePath . "formMenuItems.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_formMenuItem()); } } break; case "itemhome": $obUpdateMenuDb->m_updateHomeMenuItem(); break; case "deleteItem": $this->libfunc->check_token(); $obUpdateMenuDb->m_deleteItem(); break; default: $obMenuInterface->menuHeadTemplate = $this->templatePath . "dspMenuHeader.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obMenuInterface->m_showMenuHeaders()); break; } break; case "ec_option": $obOptionInterface = new c_optionInterface(); $obOptionInterface->obTpl = $this->obTpl; $obOptionInterface->obDb = $this->obDb; $obOptionInterface->request = $this->request; $obOptionInterface->imageUrl = SITE_URL . "images/"; $obOptionInterface->imagePath = SITE_PATH . "images/"; $obUpdateOptionDb = new c_optionDb(); $obUpdateOptionDb->obDb = $this->obDb; $obUpdateOptionDb->request = $this->request; $obUpdateOptionDb->imagePath = SITE_PATH . "images/"; #INTIALIZING ACTION if (!isset($action[1])) { $action[1] = ""; } switch ($action[1]) { case "home": $obOptionInterface->optionsTemplate = $this->templatePath . "optionHome.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptions()); break; case "dspStandardOpt": $obOptionInterface->optionsTemplate = $this->templatePath . "optionStandard.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showStandardOpt()); break; case "dspCustomOpt": $obOptionInterface->optionsTemplate = $this->templatePath . "optionCustom.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showCustomOpt()); break; case "dspAttributes": $obOptionInterface->attributeTemplate = $this->templatePath . "attributes.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showAttribute()); break; case "dspAddattribute": $obOptionInterface->addattributeTemplate = $this->templatePath . "addattributes.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showAddAttribute()); break; case "dspNumForm": $obOptionInterface->optionNumTemplate = $this->templatePath . "formNumOption.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_formNumOptions()); break; case "stdOptForm": $obOptionInterface->optionTemplate = $this->templatePath . "formOptions.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptionForm()); break; case "ajaxAttribute": $obUpdateOptionDb->m_ajaxgetAtrribute(); break; case "optionadd": $this->libfunc->check_token(); if ($obOptionInterface->m_verifyInsertOption()) { $images = $obUpdateOptionDb->m_uploadImages(); $obUpdateOptionDb->m_insertOption($images); } else { $obOptionInterface->request['msg'] = 1; $obOptionInterface->optionTemplate = $this->templatePath . "formOptions.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptionForm()); } break; case "optionedit": $this->libfunc->check_token(); if ($obOptionInterface->m_verifyEditOption()) { $obUpdateOptionDb->m_updateOption(); } else { $obOptionInterface->request['msg'] = 1; $obOptionInterface->optionTemplate = $this->templatePath . "formOptions.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptionForm()); } break; case "editForm": $obOptionInterface->optionTemplate = $this->templatePath . "formEditOptions.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_formEditOption()); break; case "uploadForm": $this->libfunc->check_token(); $obOptionInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_uploadForm()); break; case "upload": $this->libfunc->check_token(); if (!$obOptionInterface->m_verifyImageUpload()) { $obUpdateOptionDb->m_uploadImage(); } else { $obOptionInterface->uploadTemplate = MODULES_PATH . "default/templates/admin/upload.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_uploadForm()); } break; case "addattribute": $this->libfunc->check_token(); $obUpdateOptionDb->m_insertAttribute(); break; case "editattribute": $this->libfunc->check_token(); $obUpdateOptionDb->m_editAttribute(); break; case "deleteattribute": $this->libfunc->check_token(); $obUpdateOptionDb->m_delAttribute(); break; case "delete": $this->libfunc->check_token(); $obUpdateOptionDb->m_deleteOption(); break; case "deleteChoice": $this->libfunc->check_token(); $obUpdateOptionDb->m_deleteChoice(); break; case "editChoice": case "ctmOptForm": $obOptionInterface->optionTemplate = $this->templatePath . "formCustomOption.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_customOptionForm()); break; break; case "choiceadd": $this->libfunc->check_token(); if ($this->request['mode'] == "edit") { if (!$obOptionInterface->m_verifyEditChoice()) { $obUpdateOptionDb->m_updateChoice(); } else { $obOptionInterface->request['msg'] = 1; $obOptionInterface->optionTemplate = $this->templatePath . "formCustomOption.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_customOptionForm()); } } else { if (!$obOptionInterface->m_verifyInsertChoice()) { $obUpdateOptionDb->m_insertChoice(); } else { $obOptionInterface->request['msg'] = 1; $obOptionInterface->optionTemplate = $this->templatePath . "formCustomOption.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_customOptionForm()); } } break; default: $obOptionInterface->optionsTemplate = $this->templatePath . "optionHome.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obOptionInterface->m_showOptions()); break; } break; case "ec_package": $obPackInterface = new c_packageInterface(); $obPackInterface->obTpl = $this->obTpl; $obPackInterface->obDb = $this->obDb; $obPackInterface->request = $this->request; $obPackInterface->imageUrl = SITE_URL . "images/"; $obPackInterface->imagePath = SITE_PATH . "images/"; $obUpdatePackDb = new c_packageDb(); $obUpdatePackDb->obDb = $this->obDb; $obUpdatePackDb->request = $this->request; $obUpdatePackDb->imagePath = SITE_PATH . "images/"; #INTIALIZING ACTION if (!isset($action[1])) { $action[1] = ""; } switch ($action[1]) { case "home": $obPackInterface->packageTemplate = $this->templatePath . "packageHome.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageHome()); break; case "build": $obPackInterface->packageTemplate = $this->templatePath . "buildPackage.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageBuild()); break; case "disamble": $obPackInterface->packageTemplate = $this->templatePath . "disamblePackage.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageDisamble()); break; case "disambleit": $this->libfunc->check_token(); $obUpdatePackDb->m_disamblePack(); break; case "delete": $this->libfunc->check_token(); $obUpdatePackDb->m_deletePackItem(); break; case "update": $this->libfunc->check_token(); $obUpdatePackDb->m_updatePackage(); break; case "updateHome": $obUpdatePackDb->m_updateHome(); break; case "updatePackHome": $obUpdatePackDb->m_updatePackHome(); break; default: $obPackInterface->packageTemplate = $this->templatePath . "packageHome.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obPackInterface->m_packageHome()); break; } break; default: header("Location:" . SITE_URL . "ecom/adminindex.php?action=ec_show.home"); exit; break; } }
function category_listing() { include 'dbconnect.php'; $category = $_GET['category']; $query = "select * from properties where property_type='{$category}' "; $result = mysqli_query($dbc, $query); $rows = mysqli_num_rows($result); if ($rows == 0) { echo '<div class="col-md-12 property-single"> <p class="text-center lead"> Bummer!!! Nothing listed in this category. </p> </div>'; } elseif ($rows > 0) { $query = "select count(*) from properties where property_type='{$category}' "; $result = mysqli_query($dbc, $query); $roww = mysqli_fetch_row($result); $numrows = $roww[0]; //number of rows to show $rowsperpage = 5; //find out total pages $totalpages = ceil($numrows / $rowsperpage); //get the current page or set a default if (isset($_GET['currentpage']) && is_Numeric($_GET['currentpage'])) { //cast var is int $currentpage = (int) $_GET['currentpage']; } else { //default page num $currentpage = 1; } //if current page is greater than total pages if ($currentpage > $totalpages) { $currentpage = $totalpages; } //end if //if current page is less than first page if ($currentpage < 1) { $currentpage = 1; } //the offset based on current page $offset = ($currentpage - 1) * $rowsperpage; //get info from database $query = "select * from properties where property_type='{$category}' LIMIT {$offset}, {$rowsperpage} "; $result = mysqli_query($dbc, $query); while ($row = mysqli_fetch_array($result)) { echo ' <div class="col-md-12 property-single"> <div class="col-md-4 thumbnail clear-fix" id="image-gallery""> <a href="' . $row['images'] . '"><img class="img-responsive" src="' . $row['images'] . '" /></a> </div> <div class="col-sm-4 col-md-8 user-listing"> <ul class="col-md-12"> <li><h3><a href="view-listing?listing=' . $row['property_id'] . '">' . $row['title'] . '</a></h3></li> <ul class="list-inline"><li> <i class="fa fa-location-arrow"></i> ' . $row['location'] . '</li> <li > <i class="fa fa-tags"></i> ' . $row['property_type'] . '</li> <li> <span class="fa fa-tags "></span> ' . ucfirst($row['status']) . ' </li></ul> <ul class="list-inline"> <li> <i class="fa fa-usd"></i> ' . $row['price'] . '</li> <li> <i class="fa fa-phone"></i> ' . $row['contact'] . '</li> <li ><i class="fa fa-envelope"></i> <a href="mailto:' . $row['email'] . '"> ' . $row['email'] . '</a></li> </ul> <li> <ul class="list-inline"> <li class=""><i class="fa fa-home"></i><a href="#"> Size</a></li> <li class=""><i class="fa fa-automobile"></i><a href="#">' . $row['gsize'] . ' Cars</a></li> <li class=""><i class="fa fa-bed"></i><a href="#"> ' . $row['bedrooms'] . ' Bedroom(s)</a></li> </ul> <ul class="list-inline"> <li class="">Open from 6am - 8pm for viewing</li> </ul> <ul class="list-inline"> <li style="font-weight:bolder" > <a href="view-listing?listing=' . $row['property_id'] . '" class=""> <span class="fa fa-folder-open-o"> </span> View Listing </a> </li> </ul> </li> </ul> </div> </div> '; } //end while // building the pagination echo '<div class="col-md-12">'; //range of num links $range = 3; //if not on page 1 , don't show bak links for ($x = $currentpage - $range; $x < $currentpage + $range + 1; $x++) { //if it's a valid page number if ($x > 0 && $x <= $totalpages) { // if we're on current page if ($x == $currentpage) { //highlight it echo "<ul class='pagination'><li class='active' ><a href='#'>{$x}</a><li></ul>"; } else { //make it a link echo "<ul class='pagination'><li><a href='{$_SERVER['PHP_SELF']}?currentpage={$x}'>{$x}</a><li></ul>"; } } } echo '</div>'; } }
public function post_ajaxsearch() { $data = Input::get('data'); parse_str($data, $post); $query = $post['searchInput']; $like = '%' . $query . '%'; if (is_Numeric($query)) { //Since it is numeric we are probably sorting by a CID. Let's try to find VAs by CID with this number $vas = User::where('cid', 'like', $like)->orderBy('cid', 'ASC')->get(); } else { //Hmm maybe they are trying to find a VA by name or by the name of the owner or URL $vas = User::where('name', 'like', $like)->orWhere('url', 'like', $like)->orWhere('email', 'like', $like)->orWhere('vaname', 'like', $like)->orWhere('url', 'like', $like)->orderBy('vaname', 'ASC')->get(); } if (count($vas) > 0) { //Format our output $send = ''; foreach ($vas as $va) { $status = User::formatUserStatus($va->status); $flags = ""; if ($va->awaiting_response == 1) { $flags = '<span class="label label-warning"><i class="fa fa-info fa-fw"></i> Awaiting Response</span>'; } $send .= "<tr><td>{$va->vaname}</td><td>{$status}</td><td>{$flags}</td><td>{$va->url}</td><td>{$va->cid}</td><td>{$va->name}</td><td>{$va->created_at}</td><td><a class=\"searchEditVABtn\" href=\"" . URL::route('console') . "/va/" . $va->cid . "\"><i class=\"fa fa-edit fa-fw\"</a></td></tr>"; } } else { $send = '0'; } echo $send; }