function update_new($stId) { $data = array('title' => $this->input->post('news_title'), 'an_text' => stripcslashes($this->input->post('news_content')), 'type' => $this->input->post('typeA')); $this->db->where('news_id', $stId); $this->db->update('announcement', $data); redirect('stadium/announcement/' . $this->input->post('st_id')); }
public function getGeocode($lon, $lat) { $result = ""; $result = json_decode(stripcslashes(file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lon . '&sensor=false&language=ru'))); sleep(4); return $result; }
/** * Tokenizes a string. * * @param string $input The input to tokenise * @throws \InvalidArgumentException When unable to parse input (should never happen) */ private function tokenize($input) { $input = preg_replace('/(\r\n|\r|\n|\t)/', ' ', $input); $tokens = array(); $length = strlen($input); $cursor = 0; while ($cursor < $length) { if (preg_match('/\s+/A', $input, $match, null, $cursor)) { } elseif (preg_match('/([^="\' ]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)); } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { $tokens[] = stripcslashes($match[1]); } else { // should never happen // @codeCoverageIgnoreStart throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10))); // @codeCoverageIgnoreEnd } $cursor += strlen($match[0]); } return $tokens; }
public function command_calc($user, $channel, $args) { $calc = implode(" ", $args); $data = file_get_contents("http://www.google.com/ig/calculator?hl=en&q=" . urlencode($calc)); $this->bot->privmsg($channel, "0|" . $data); $data = mb_convert_encoding($data, 'UTF-8', mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true)); //print("1|".$data . "\n"); $this->bot->privmsg($channel, "1|" . $data); $data = preg_replace("/([,{])(.*?):/", '$1"$2":', $data); //hack, convert js to json. //print("2|".$data . "\n"); $this->bot->privmsg($channel, "2|" . $data); $data = stripcslashes($data); //print("3|".$data . "\n"); $this->bot->privmsg($channel, "3|" . $data); $data = preg_replace("/<sup>(.*?)<\\/sup>/", '^$1', $data); //print("4|".$data . "\n"); $this->bot->privmsg($channel, "4|" . $data); $data = preg_replace("/×/", '\\u00d7', $data); //print("5|".$data . "\n"); $this->bot->privmsg($channel, "5|" . $data); $data = json_decode($data, 1); //foreach ($data as &$node) { $node = html_entity_decode($node); } //print_r($data); $this->bot->privmsg($channel, "6|" . json_encode($data)); $this->bot->privmsg($channel, $data["lhs"] . " = " . $data["rhs"]); //$this->bot->privmsg($channel, json_encode(array($data[error], $data[icc], $calc))); //DEBUG }
function upload($dir, $insert = true) { $dir = $dir ? $dir : date("Ym"); if (!$this->isdir($dir)) { if ($this->mkdir($dir) == false) { return array('status' => 'error', 'msg' => '目录创建失败.' . $d->getErrorMsg()); } } $dir = trim($dir, '/'); $response = $imgService->uzUpload("/" . $dir . "/" . md5(TIMESTAMP) . '.jpg', NULL); $json = array(); if ($response->isSuccess()) { $img = $response->getResult(); $json['img_name'] = $img->name; $json['img_id'] = $img->id; $json['dir_id'] = $img->dirId; $json['img_size'] = $img->size; $json['img_url'] = stripcslashes($img->url); $json['dir_name'] = $dir; $json['dateline'] = TIMESTAMP; if ($insert) { // $json['id'] = $this->insert($json); } $json['status'] = 'success'; $json['msg'] = '上传成功'; } else { $json['status'] = 'error'; $json['msg'] = '上传失败.' . $response->getErrorMsg(); } return $json; }
public function indexAction() { //validate if ajax request if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { //redirect request if not login, this will not work if the ajax is requested if (!Mage::getSingleton('customer/session')->isLoggedIn()) { $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("PLEASE LOGIN!"))); } //declare the store_id and customer_id $customer_id = Mage::getSingleton('customer/session')->getId(); $store_id = Mage::app()->getStore()->getStoreId(); //popup content $model = Mage::getModel("singpost_login/profile"); $data = $model->getNotification(); //check if close forever $notif_logs = $model->getNotificationLogs($customer_id); //check login count $login_count = $model->getUserLogCount($customer_id, $store_id); //insert to array and response as json $array = array('content' => stripcslashes($data[0]['content']), 'event' => $notif_logs, 'login_count' => $login_count['count']); $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($array)); } else { //url request send back to the redirect Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login')); } }
function send_email_exchange($user, $pw, $supporter_KEY, $contact_array) { global $db; $sql = 'select Email,First_Name, Last_Name from supporter where supporter_KEY =' . $supporter_KEY; $S = $db->Execute($sql) or die($db->errorMsg()); $s = $S->FetchRow(); $contact_array['supporter_KEY'] = $supporter_KEY; #replace the merge fields $contact_array['Notes'] = str_replace('[[First_Name]]', $s['First_Name'], $contact_array['Notes']); $contact_array['Notes'] = str_replace('[[Last_Name]]', $s['Last_Name'], $contact_array['Notes']); $contact_array['Notes'] = stripcslashes($contact_array['Notes']); #testing send #echo '<pre>'; #echo $s['Email'].'<br>'; #echo $contact_array['Codes'].'<br>'; #echo $contact_array['Notes'].'<br>'; #print_r($contact_array); #echo '</pre>'; #send to exchange $exchangeclient = new ExchangeClient(); #$exchangeclient->init($user,$pw , NULL, EXCHANGE_SERVER); #$send = $exchangeclient->send_message($s['Email'], $contact_array['Codes'],$contact_array['Notes'], 'HTML',true, false); $exchangeclient->init($user, $pw); $send = $exchangeclient->send_message($s['Email'], $contact_array['Codes'], $contact_array['Notes'], 'HTML', true, false); $contact = new ContactHistory($contact_array); $contact->data['supporter_KEY'] = $supporter_KEY; $contact->save(); #save_contact($supporter_KEY, $contact_array); echo $x . 'emails sent'; }
static function loginUser($input) { $input = trim($input); $input = stripcslashes($input); $input = htmlspecialchars($input); return $input; }
/** * Method for validation Admin * data from entrance * * @var $username * @var $password */ public function actionLogin() { include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php'; $db = Storage::getInstance(); $mysqli = $db->getConnection(); if (isset($_POST['username'])) { $username = $_POST['username']; $username = stripslashes($username); if ($username !== '*****@*****.**') { header('Location: /admin/login?error=1'); } else { if (isset($_POST['password'])) { $password = $_POST['password']; $password = stripcslashes($password); } $sql_query = "SELECT * FROM users WHERE email='{$username}' AND password='******'"; $result = $mysqli->query($sql_query); session_start(); if ($result->num_rows == 1) { $_SESSION['admin'] = $username; header("Location: /admin/"); } else { header("Location: /admin/login?error=1"); } session_write_close(); } } }
protected function getArgumentsAsString(array $arguments) { foreach ($arguments as $key => $argument) { $arguments[$key] = is_string($argument) ? trim($argument, "''") : $this->parseArgumentAsString($argument); } return stripcslashes(trim(json_encode($arguments, JSON_UNESCAPED_UNICODE), '[]')); }
public function editInput($table, $field, $attrs, $value) { if ($field["type"] == "enum") { $options = array("" => array()); $selected = $value; if (isset($_GET["select"])) { $options[""][-1] = lang('original'); } if ($field["null"]) { $options[""][""] = "NULL"; if ($value === null && !isset($_GET["select"])) { $selected = ""; } } $options[""][0] = lang('empty'); preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $options[$i + 1] = $val; if ($value === $val) { $selected = $i + 1; } } return "<select{$attrs}>" . optionlist($options, (string) $selected, 1) . "</select>"; // 1 - use keys } }
function readINIfile($filename, $commentchar) { $array1 = file($filename); $section = ''; foreach ($array1 as $filedata) { $dataline = trim($filedata); $firstchar = substr($dataline, 0, 1); if ($firstchar != $commentchar && $dataline != '') { //It's an entry (not a comment and not a blank line) if ($firstchar == '[' && substr($dataline, -1, 1) == ']') { //It's a section $section = strtolower(substr($dataline, 1, -1)); } else { //It's a key... $delimiter = strpos($dataline, '='); if ($delimiter > 0) { //...with a value $key = trim(substr($dataline, 0, $delimiter)); $value = trim(substr($dataline, $delimiter + 1)); if (substr($value, 0, 1) == '"' && substr($value, -1, 1) == '"') { $value = substr($value, 1, -1); } $array2[$section][$key] = stripcslashes($value); } else { //...without a value $array2[$section][strtolower(trim($dataline))] = ''; } } } else { //It's a comment or blank line. Ignore. } } return $array2; }
/** * Display Poll * Gives the HTML for the poll to display on the front-end * * @param array $args * @return string */ public function displayPoll(array $args) { $limit = get_option('sp_limit'); if (isset($args['id'])) { $pollid = $args['id']; $poll = $this->grabPoll($pollid); if (isset($poll['question'])) { $question = stripcslashes($poll['question']); $answers = $poll['answers']; $answersother = $poll['answersother']; $totalvotes = $poll['totalvotes']; foreach ($answers as $key => $answer) { $answers[$key]['answer'] = stripcslashes($answer['answer']); } ob_start(); $postFile = plugins_url(SP_SUBMIT, dirname(__FILE__)); $thisPage = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $userCannotTakePoll = false; if ($limit == 'yes' && isset($_COOKIE['sptaken']) && in_array($args['id'], unserialize($_COOKIE['sptaken'])) || isset($_GET['simply-poll-return'])) { $userCannotTakePoll = true; } include SP_DIR . SP_DISPLAY; $content = ob_get_clean(); return $content; } } }
public static function css_get_font_family($css_array) { if (!empty($css_array['font_family'])) { $explode_font_family = explode('_', $css_array['font_family']); $font_id = $explode_font_family[1]; switch ($explode_font_family[0]) { //fonts from files (links to files) case 'file': $css_array['font_family'] = stripcslashes(td_global::$td_options['td_fonts_user_inserted']['font_family_' . $font_id]); break; //fonts from type kit //fonts from type kit case 'tk': $css_array['font_family'] = stripcslashes(td_global::$td_options['td_fonts_user_inserted']['type_kit_font_family_' . $font_id]); break; //fonts from font stacks //fonts from font stacks case 'fs': $css_array['font_family'] = self::$font_stack_list['fs_' . $font_id]; break; //fonts from google //fonts from google case 'g': $google_font_name = trim(self::$font_names_google_list[$font_id]); //search for space in google font names if (preg_match('/\\s/', $google_font_name)) { $google_font_name = '"' . $google_font_name . '"'; } $css_array['font_family'] = $google_font_name; break; } } return $css_array; }
public function ReadThemePack($theme, &$recArr = array()) { $theme_dir = OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme; $theme_metafile = $theme_dir . DIRECTORY_SEPARATOR . "theme.xml"; if (is_file($theme_metafile)) { $metadata = file_get_contents($theme_metafile); $xmldata = new SimpleXMLElement($metadata); foreach ($xmldata as $key => $value) { if (substr($key, 0, 1) != "@") { $str = (string) $value; $str = str_replace('\\n', "\n", $str); $str = stripcslashes($str); $recArr[$key] = $str; } } } if (is_file(OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . $recArr['icon'])) { $recArr['icon_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/" . $recArr['icon']; } else { $recArr['icon_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/spacer.gif"; } if (is_file(OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . $recArr['preview'])) { $recArr['preview_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/" . $recArr['preview']; return $recArr; } else { $recArr['preview_url'] = OPENBIZ_THEME_URL . "/{$theme}/images/spacer.gif"; } }
function new_employee_form($employer = null) { $redirect = isset($_POST['hrm_dataAttr']['redirect']) && !empty($_POST['hrm_dataAttr']['redirect']) ? $_POST['hrm_dataAttr']['redirect'] : ''; $job_title = json_decode(stripcslashes($_POST['hrm_dataAttr']['job_title'])); $job_category = json_decode(stripcslashes($_POST['hrm_dataAttr']['job_category'])); $location = json_decode(stripcslashes($_POST['hrm_dataAttr']['location'])); $employer_id = isset($employer->ID) ? $employer->ID : ''; if ($employer === null) { $hidden_form['user_name'] = array('label' => __('User Name', 'hrm'), 'type' => 'text', 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'))); $hidden_form['email'] = array('label' => __('E-mail', 'hrm'), 'type' => 'text', 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_email' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'), 'data-hrm_email_error_msg' => __('Please enter a valid email', 'hrm'))); } else { $hidden_form['employer_id'] = array('value' => $employer_id, 'type' => 'hidden'); } $hidden_form['first_name'] = array('label' => __('First Name', 'hrm'), 'type' => 'text', 'value' => get_user_meta($employer_id, 'first_name', true), 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'))); $hidden_form['last_name'] = array('label' => __('Last Name', 'hrm'), 'type' => 'text', 'value' => get_user_meta($employer_id, 'last_name', true), 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'))); $hidden_form['job_title'] = array('label' => __('Job Title', 'hrm'), 'type' => 'select', 'option' => $job_title, 'selected' => get_user_meta($employer_id, '_job_title', true), 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'))); $hidden_form['job_category'] = array('label' => __('Job Category', 'hrm'), 'type' => 'select', 'option' => $job_category, 'selected' => get_user_meta($employer_id, '_job_category', true), 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'))); $hidden_form['location'] = array('label' => __('Location', 'hrm'), 'type' => 'select', 'option' => $location, 'selected' => get_user_meta($employer_id, '_location', true), 'extra' => array('data-hrm_validation' => true, 'data-hrm_required' => true, 'data-hrm_required_error_msg' => __('This field is required', 'hrm'))); $hidden_form['status'] = array('label' => __('status', 'hrm'), 'type' => 'select', 'option' => array('yes' => 'Enable', 'no' => 'Disable'), 'selected' => get_user_meta($employer_id, '_status', true)); $hidden_form['mobile'] = array('label' => __('Mobile Number', 'hrm'), 'type' => 'text', 'value' => get_user_meta($employer_id, '_mob_number', true)); $hidden_form['joined_date'] = array('label' => __('Joined Date', 'hrm'), 'type' => 'text', 'class' => 'hrm-datepicker', 'value' => get_user_meta($employer_id, '_joined_date', true)); $hidden_form['job_desc'] = array('label' => __('Description', 'hrm'), 'type' => 'textarea', 'value' => get_user_meta($employer_id, '_job_desc', true)); $hidden_form['action'] = 'new_employer'; $hidden_form['header'] = 'Employee Information'; $hidden_form['url'] = $redirect; ob_start(); echo hrm_Settings::getInstance()->hidden_form_generator($hidden_form); $return_value = array('append_data' => ob_get_clean()); return $return_value; }
/** * Enter description here... * * @param unknown_type $text * @return unknown */ function Unescape($text) { if ($GLOBALS['configuration']['db_encoding'] && !is_numeric($text)) { return base64_decode($text); } return stripcslashes($text); }
public function content() { if (isset($_GET['user_id'])) { $user_id = $_GET['user_id']; } else { $user_id = Oedipus_LogInHelper::get_current_user_id(); } $user = Oedipus_UsersHelper::get_user($user_id); if (Oedipus_LogInHelper::compare_user_id_to_currently_logged_in_id($user_id)) { echo '<h2>Your Account</h2>'; $other_teams_heading = 'Your teams'; echo '<p>Welcome to <em>Oedipus: Decision Maker</em>, '; echo stripcslashes($user['first_name'] . ' ' . $user['last_name']); echo "!</p>\n"; } else { echo '<h2>' . stripcslashes($user['first_name'] . ' ' . $user['last_name']) . "'s Page</h2>\n"; $other_teams_heading = 'Teams'; } DBPages_PageRenderer::render_page_section('users', 'welcome'); /* * Show the teams that this user already a user of. */ #$team_root_url = $this->get_current_url_just_file(); # #$team_root_url->set_get_variable('oo-page'); #$team_root_url->set_get_variable('page-class', 'Oedipus_TeamPage'); }
private function parameterize($text) { $text = trim($text, "[["); $text = trim($text, "]]"); //Stolen from WordPress with love and gratitude. $atts = array(); $pattern = '/(\\w+)\\s*=\\s*"([^"]*)"(?:\\s|$)|(\\w+)\\s*=\\s*\'([^\']*)\'(?:\\s|$)|(\\w+)\\s*=\\s*([^\\s\'"]+)(?:\\s|$)|"([^"]*)"(?:\\s|$)|(\\S+)(?:\\s|$)/'; $text = preg_replace("/[\\x{00a0}\\x{200b}]+/u", " ", $text); if (preg_match_all($pattern, $text, $match, PREG_SET_ORDER)) { foreach ($match as $m) { if (!empty($m[1])) { $atts[strtolower($m[1])] = stripcslashes($m[2]); } elseif (!empty($m[3])) { $atts[strtolower($m[3])] = stripcslashes($m[4]); } elseif (!empty($m[5])) { $atts[strtolower($m[5])] = stripcslashes($m[6]); } elseif (isset($m[7]) && strlen($m[7])) { $atts[] = stripcslashes($m[7]); } elseif (isset($m[8])) { $atts[] = stripcslashes($m[8]); } } } else { $atts = ltrim($text); } return $atts; }
function formatMessage($mess) { $mess = stripcslashes($mess); $mess = html_entity_decode($mess, ENT_NOQUOTES, 'UTF-8'); $mess = utf8_encode($mess); return $mess; }
function sanitizeString($var) { $var = strip_tags($var); $var = htmlentities($var); $var = stripcslashes($var); return mysql_real_escape_string($var); }
/** * Разэкранирование символов * * @param string $str * @return string * * @uses Text::stsl($str); */ static function stsl($str) { // Проверка автоматического экранирования $flag = get_magic_quotes_gpc() == 0 ? true : false; if (is_array($str)) { // Обход массива. $array = array(); foreach ($str as $key => $value) { $array[$key] = Text::stsl($value); /* // Приведение html тегов к безопасному виду. $array[$key] = htmlspecialchars($value); if ($flag === true) // Автоматическое экранирование отключено. Удаление экранирования. $array[$key] = stripcslashes($value); // Удаление пробелов. $array[$key] = trim($array[$key]);*/ } // Присвоение переменной новых данных. $str = $array; } else { /*$str = htmlspecialchars($str);*/ $str = trim(stripcslashes($str)); } return $str; }
public function GetSafeString($str) { $result = stripcslashes($str); $result = strip_tags($result); $result = htmlspecialchars($result, ENT_QUOTES); return $result; }
function mysql_fix_string($conn, $string) { if (get_magic_quotes_gpc()) { $string = stripcslashes($string); } return $conn->real_escape_string($string); }
function test_input($data) { $data = trim($data); $data = stripcslashes($data); $data = htmlspecialchars($data); return $data; }
protected function writeReal( MessageCollection $collection ) { if ( isset( $this->extra['header'] ) ) { $output = $this->extra['header']; } else { $output = "<?php\n"; } $output .= $this->doHeader( $collection ); $mangler = $this->group->getMangler(); foreach ( $collection as $item ) { $key = $mangler->unmangle( $item->key() ); $key = stripcslashes( $key ); $value = $item->translation(); if ( $value === null ) { continue; } $value = str_replace( TRANSLATE_FUZZY, '', $value ); $value = addcslashes( $value, "'" ); $output .= "\$$key = '$value';\n"; } return $output; }
public function indexAction() { $slug = $this->params()->fromRoute('slug'); $redirectUrl = array('controller' => 'index', 'action' => 'index'); $page = ""; if (!empty($slug) && $slug != null) { $api = new Api(); $api_url = $this->getServiceLocator()->get('Config')['api_url']['value']; $url = $api_url . "/api/pages/"; $data = array('slug' => $slug); $res = $api->curl($url, $data, "GET"); if ($res->getStatusCode() == 200) { $content = json_decode($res->getBody(), true); if (!(isset($content[0]['content']) && !empty($content[0]['content']))) { return $this->redirect()->toRoute(null, $redirectUrl); } $page = stripcslashes($content[0]['content']); //var_dump($content); die; $this->getServiceLocator()->get('ViewHelperManager')->get('HeadTitle')->set($content[0]['title']); $this->getServiceLocator()->get('ViewHelperManager')->get('headMeta')->setName('keywords', $content[0]['meta_tags']); $this->getServiceLocator()->get('ViewHelperManager')->get('headMeta')->setName('description', $content[0]['title']); } return new ViewModel(array('page' => $page)); } else { return $this->redirect()->toUrl('/'); } }
public function getArguments($asString = FALSE) { if (!$asString) { return $this->arguments; } else { $arguments = $this->arguments; foreach ($arguments as $k => $argument) { if (!is_string($argument) and is_callable($argument, true)) { $arguments[$k] = 'lambda function'; continue; } if (is_object($argument)) { if (method_exists($argument, '__toString')) { $arguments[$k] = $argument->__toString(); } elseif (isset($argument->__mocked)) { $arguments[$k] = $this->formatClassName($argument->__mocked); } else { $arguments[$k] = $this->formatClassName(get_class($argument)); } continue; } } if (defined('JSON_UNESCAPED_UNICODE')) { return stripcslashes(trim(json_encode($arguments, JSON_UNESCAPED_UNICODE), '[]')); } return stripcslashes(trim(json_encode($arguments), '[]')); } }
function callMethod() { $resultMethod = $this->createJSON(); $apiName = stripcslashes($this->apiFunctionName[0]) . 'Api'; $status = ApiConstants::$STATUS; if (file_exists(SERVER_DIR . 'app/Controller/Api/method/' . $apiName . '.php')) { $apiClass = ApiCore::getApiEngineByName($apiName); $apiReflection = new ReflectionClass($apiName); try { $functionName = $this->apiFunctionName[1]; $apiReflection->getMethod($functionName); $response = ApiConstants::$RESPONSE; $res = $apiClass->{$functionName}($this->apiFunctionParams); if ($res == null) { $resultMethod->{$status} = ApiConstants::$ERROR_NOT_FOUND_RECORD; } else { if ($res->err == ApiConstants::$ERROR_PARAMS) { $resultMethod->{$status} = ApiConstants::$ERROR_PARAMS; $resultMethod->params = json_encode($apiFunctionParams); } else { $resultMethod->{$response} = $res; $resultMethod->{$status} = ApiConstants::$ERROR_NO; } } } catch (Exception $ex) { $resultMethod->errStr = $ex->getMessage(); } } else { $resultMethod->errStr = 'Not found method'; $resultMethod->{$status} = ApiConstants::$ERROR_NOT_FOUND_METHOD; $resultMethod->params = $this->apiFunctionParams; } return json_encode($resultMethod, JSON_UNESCAPED_UNICODE); }
/** * This Funtion to generate url searching or filtering * @param $_POST array * @retun reridrect to new query string url */ function search() { $post = $_POST; $tSearch = isset($post) ? $post : false; if ($tSearch) { $post['findTitle'] = strip_tags($post['findTitle']); $post['findTitle'] = stripcslashes($post['findTitle']); $post['findTitle'] = stripslashes($post['findTitle']); $post['findTitle'] = trim($post['findTitle']); if ($post['submit'] == 'getNews') { $url = $this->config['base_url'] . $this->ctrler . "/index/&tTitle=" . $post['findTitle'] . "&cField=" . $post['newsColumn']; } elseif ($post['submit'] == 'getPeriod') { $url = $this->config['base_url'] . $this->ctrler . "/index/&filter=date&dStart=" . $post['startPeriod'] . "&dEnd=" . $post['endPeriod']; } elseif ($post['submit'] == "getRep") { $url = $this->config['base_url'] . $this->ctrler . "/index/&rep=" . $post['rep']; } elseif ($post['submit'] == "getLevel") { $url = $this->config['base_url'] . $this->ctrler . "/index/&level=" . $post['level']; } } else { $url = $this->config['base_url'] . $this->ctrler . "/"; } //$this->redirect($url); @header('Location: ' . $url); exit; }