当前位置: 首页>>代码示例>>PHP>>正文


PHP Sanitize::paranoid方法代码示例

本文整理汇总了PHP中Sanitize::paranoid方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::paranoid方法的具体用法?PHP Sanitize::paranoid怎么用?PHP Sanitize::paranoid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitize的用法示例。


在下文中一共展示了Sanitize::paranoid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getrss

 function getrss()
 {
     uses('Sanitize');
     Configure::write('debug', '0');
     //turn debugging off; debugging breaks ajax
     $this->layout = 'ajax';
     $mrClean = new Sanitize();
     $limit = 5;
     $start = 0;
     if (empty($this->params['form']['url'])) {
         die('Incorrect use');
     }
     $url = $this->params['form']['url'];
     if (!empty($this->params['form']['limit'])) {
         $limit = $mrClean->paranoid($this->params['form']['limit']);
     }
     if (!empty($this->params['form']['start'])) {
         $start = $mrClean->paranoid($this->params['form']['start']);
     }
     $feed = $this->Simplepie->feed_paginate($url, (int) $start, (int) $limit);
     $out['totalCount'] = $feed['quantity'];
     $out['title'] = $feed['title'];
     $out['image_url'] = $feed['image_url'];
     $out['image_width'] = $feed['image_width'];
     $out['image_height'] = $feed['image_height'];
     foreach ($feed['items'] as $item) {
         $tmp['title'] = strip_tags($item->get_title());
         $tmp['url'] = strip_tags($item->get_permalink());
         $tmp['description'] = strip_tags($item->get_description(), '<p><br><img><a><b>');
         $tmp['date'] = strip_tags($item->get_date('d/m/Y'));
         $out['items'][] = $tmp;
     }
     $this->set('json', $out);
 }
开发者ID:vad,项目名称:taolin,代码行数:34,代码来源:wrappers_controller.php

示例2: index

 function index()
 {
     $solid = $this->Session->read('sol');
     $this->Webymsg->recursive = -1;
     $filter = array('Webymsg.sol_id' => $solid);
     // host selezionato
     $host_id = $this->Session->read('host_id');
     if (!empty($host_id) && $host_id["host"] != 0) {
         $filter['Webymsg.source_id'] = $host_id["host"];
     }
     $srch = null;
     if ($this->Session->check('srch_webmsn')) {
         $srch = $this->Session->read('srch_webmsn');
     }
     if (!empty($this->data)) {
         $srch = $this->data['Search']['label'];
         $srch = Sanitize::paranoid($srch);
     }
     if (!empty($srch)) {
         $filter['Webymsg.friend LIKE'] = "%{$srch}%";
     }
     $msgs = $this->paginate('Webymsg', $filter);
     $this->Session->write('srch_webmsn', $srch);
     $this->set('chats', $msgs);
     $this->set('srchd', $srch);
     $this->set('menu_left', $this->Xplico->leftmenuarray(6));
 }
开发者ID:xplico,项目名称:xplico,代码行数:27,代码来源:webymsgs_controller.php

示例3: pass

 /**
  *@desc Funcion para poder cambiar el password del Usuario
  */
 function pass()
 {
     $this->Usuario->recursive = 0;
     if (!empty($this->data)) {
         $id_usuario = $this->Session->read('id_usuario');
         $usuario = $this->Usuario->findByIdUsuario($id_usuario);
         $save = true;
         if ($this->data['Usuario']['pass1'] != $this->data['Usuario']['pass2']) {
             $this->Usuario->validationErrors['pass1'] = 'La nueva contraseña debe coincidir con la repetición';
             $save = false;
         } elseif (!$this->revisarPass($this->data['Usuario']['pass1'])) {
             $this->Usuario->validationErrors['pass1'] = 'La contraseña debe tener por lo menos 3 letras y no usar ñ o espacios';
             $save = false;
         }
         if (md5($this->data['Usuario']['pass']) != $usuario['Usuario']['pass']) {
             $this->Usuario->validationErrors['pass'] = 'La contraseña no coincide';
             $save = false;
         }
         if ($save) {
             $this->Usuario->id = $id_usuario;
             $this->data['Usuario']['pass'] = md5(Sanitize::paranoid($this->data['Usuario']['pass1']));
             if ($this->Usuario->save($this->data['Usuario'])) {
                 $this->Session->setFlash('Su contraseña ha sido correctamente actualizada');
                 $this->redirect("/");
                 exit;
             }
             $this->data['Usuario']['pass'] = '';
             $this->data['Usuario']['pass1'] = '';
             $this->data['Usuario']['pass2'] = '';
         }
     }
 }
开发者ID:boriscy,项目名称:upsys,代码行数:35,代码来源:usuarios_controller.php

示例4: upload

 /**
  * undocumented function
  *
  * @param string $filedata
  * @param string $uploadPath
  * @param string $filename
  * @return void
  * @access public
  */
 function upload($filedata = null, $uploadPath = null, $mimeRules = array(), $isImage = true)
 {
     if ($filedata != null) {
         $this->filedata = $filedata;
     }
     if ($uploadPath != null) {
         $this->uploadPath = $uploadPath;
     }
     if (!empty($mimeRules)) {
         $passesMime = false;
         foreach ($mimeRules as $rule) {
             if ($this->filedata['type'] == $rule) {
                 $passesMime = true;
                 break;
             }
         }
     }
     if (!$passesMime) {
         return 'mime-error';
     }
     if (!$this->validate()) {
         return false;
     }
     App::import('Core', 'Sanitize');
     $this->filedata['name'] = Sanitize::paranoid($this->filedata['name'], array('.', '-', '_'));
     $this->filename = $this->makeUniqueName() . '_' . $this->filedata['name'];
     $destFile = $this->uploadPath . $this->filename;
     if ($isImage === true && method_exists($this, 'defaultImageHandler')) {
         $this->defaultImageHandler();
     }
     if (move_uploaded_file($this->filedata['tmp_name'], $destFile)) {
         return $destFile;
     }
     return false;
 }
开发者ID:stripthis,项目名称:donate,代码行数:44,代码来源:uploader.php

示例5: index

 function index($id = null)
 {
     $this->cacheAction = "10000 hours";
     //$this->layout = 'image';
     $albumData = array();
     App::import('Sanitize');
     $id = (int) Sanitize::paranoid($id);
     $albumData = $this->Image->Album->read(null, $id);
     //debug($albumData);
     if (!$id || $albumData == false || !isset($albumData['Album']['image_count']) || $albumData['Album']['image_count'] == 0) {
         $this->Session->setFlash('Вы не выбрали альбом');
         $this->redirect(array('controller' => 'albums', 'action' => 'index'), null, true);
     }
     $this->paginate['Image'] = array('conditions' => array('Image.album_id' => $id), 'contain' => array('Album.name'), 'order' => array('Image.id' => 'DESC'), 'limit' => 12);
     $images = $this->paginate();
     foreach ($images as $image) {
         $imagesId[] = $image['Image']['id'];
     }
     $imagesTotal = $this->Image->find('all', array('conditions' => array('Image.album_id' => $id), 'contain' => false));
     foreach ($imagesTotal as $imageT) {
         $imagesId2[] = $imageT['Image']['id'];
     }
     $diff = array_diff($imagesId2, $imagesId);
     $restImgs = $this->Image->find('all', array('conditions' => array('Image.album_id' => $id, 'Image.id' => $diff), 'contain' => false));
     $this->set('restImgs', $restImgs);
     $this->set('images', $images);
 }
开发者ID:kondrat,项目名称:horpol,代码行数:27,代码来源:images_controller.php

示例6: authenticate

 /**
  * Authenticates the identity contained in a request.  Will use the `settings.userModel`, and `settings.fields`
  * to find POST data that is used to find a matching record in the `settings.userModel`.  Will return false if
  * there is no post data, either username or password is missing, of if the scope conditions have not been met.
  * @author DaiNT
  * @date: 2013/05/23
  * @param CakeRequest $request The request that contains login information.
  * @param CakeResponse $response Unused response object.
  * @return mixed.  False on login failure.  An array of User data on success.
  */
 public function authenticate(CakeRequest $request, CakeResponse $response)
 {
     if (isset($request->data['type'])) {
         $type = $request->data['type'];
         if (!isset($this->settings['types'][$type])) {
             throw new Exception(__('Type %s login not setting', $type));
         }
         $types = $this->settings['types'];
         $this->settings = array_merge(array('types' => $types), $types[$type]);
     }
     // if not set model in from then reset to request
     if (AppUtility::checkIsMobile()) {
         $this->settings['fields']['password'] = 'password_mb';
     }
     $fields = $this->settings['fields'];
     $model = $this->settings['userModel'];
     $userName = Sanitize::paranoid($request->data[$model][$fields['username']]);
     $password = Sanitize::paranoid($request->data[$model][$fields['password']]);
     if (empty($request->data[$model])) {
         $request->data[$model] = array($fields['username'] => isset($userName) ? $userName : null, $fields['password'] => isset($password) ? $password : null);
     }
     $user = parent::authenticate($request, $response);
     if (!empty($user) && is_array($user) && isset($request->data[$model]['system_permission'])) {
         $user['system_permission'] = $request->data[$model]['system_permission'];
     }
     return $user;
 }
开发者ID:nguyenthanhictu,项目名称:quanlyspa,代码行数:37,代码来源:RingiAuthenticate.php

示例7: uses

 function purchase_product()
 {
     // Clean up the post
     uses('sanitize');
     $clean = new Sanitize();
     $clean->paranoid($_POST);
     // Check if we have an active cart, if there is no order_id set, then lets create one.
     if (!isset($_SESSION['Customer']['order_id'])) {
         $new_order = array();
         $new_order['Order']['order_status_id'] = 0;
         // Get default shipping & payment methods and assign them to the order
         $default_payment = $this->Order->PaymentMethod->find(array('default' => '1'));
         $new_order['Order']['payment_method_id'] = $default_payment['PaymentMethod']['id'];
         $default_shipping = $this->Order->ShippingMethod->find(array('default' => '1'));
         $new_order['Order']['shipping_method_id'] = $default_shipping['ShippingMethod']['id'];
         // Save the order
         $this->Order->save($new_order);
         $order_id = $this->Order->getLastInsertId();
         $_SESSION['Customer']['order_id'] = $order_id;
         global $order;
         $order = $new_order;
     }
     // Add the product to the order from the component
     $this->OrderBase->add_product($_POST['product_id'], $_POST['product_quantity']);
     global $config;
     $content = $this->Content->read(null, $_POST['product_id']);
     $this->redirect('/product/' . $content['Content']['alias'] . $config['URL_EXTENSION']);
 }
开发者ID:risnandar,项目名称:testing,代码行数:28,代码来源:cart_controller.php

示例8: __construct

 /**
  * Class constructor.
  *
  * @param string $method Method producing the error
  * @param array $messages Error messages
  */
 function __construct($method, $messages)
 {
     App::import('Core', 'Sanitize');
     $this->controller =& new CakeErrorController();
     $allow = array('.', '/', '_', ' ', '-', '~');
     if (substr(PHP_OS, 0, 3) == "WIN") {
         $allow = array_merge($allow, array('\\', ':'));
     }
     $messages = Sanitize::paranoid($messages, $allow);
     if (!isset($messages[0])) {
         $messages = array($messages);
     }
     if (method_exists($this->controller, 'apperror')) {
         return $this->controller->appError($method, $messages);
     }
     if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) {
         $method = 'error';
     }
     if ($method !== 'error') {
         if (Configure::read() == 0) {
             $method = 'error404';
             if (isset($code) && $code == 500) {
                 $method = 'error500';
             }
         }
     }
     $this->dispatchMethod($method, $messages);
     $this->_stop();
 }
开发者ID:BLisa90,项目名称:cakecart,代码行数:35,代码来源:error.php

示例9: voting

 /**
  * Vote
  * @author vovich
  * @param unknown_type $model
  * @param unknown_type $modelId
  * @param unknown_type $point
  * @return JSON
  */
 function voting($model, $modelId, $delta)
 {
     Configure::write('debug', 0);
     $this->layout = false;
     $result = array("error" => "", "sum" => 0, "votes_plus" => 0, "votes_minus" => 0);
     $userId = $this->Access->getLoggedUserID();
     if (!$this->RequestHandler->isAjax()) {
         $this->redirect($_SERVER['HTTP_REFERER']);
     }
     if ($userId == VISITOR_USER || !$userId) {
         $result['error'] = "Access error, please login.";
     } elseif (!$this->Access->getAccess('Vote_' . $model, 'c')) {
         $result['error'] = "You can not vote for this " . $model . "<BR> please logg in ";
     } else {
         $result['error'] = $this->Vote->canVote($model, $modelId, $userId);
     }
     $data['model'] = Sanitize::paranoid($model);
     $data['model_id'] = Sanitize::paranoid($modelId);
     $data['user_id'] = $userId;
     $data['delta'] = $delta;
     if (Sanitize::paranoid($model) == 'Image') {
         Cache::delete('last_images');
     } elseif (Sanitize::paranoid($model) == 'Video') {
         Cache::delete('last_images');
     }
     if (empty($result['error'])) {
         $points = $this->Vote->add($data);
         $result['votes_plus'] = $points['votes_plus'];
         $result['votes_minus'] = $points['votes_minus'];
         $result['sum'] = $points['votes_plus'] - $points['votes_minus'];
     }
     exit($this->Json->encode($result));
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:41,代码来源:VotesController.php

示例10: paranoid

 function paranoid($vars)
 {
     foreach ($vars as &$var) {
         $var = Sanitize::paranoid($var, array('.', '-', '='));
     }
     return $vars;
 }
开发者ID:rasmusbergpalm,项目名称:AESpad,代码行数:7,代码来源:app_controller.php

示例11: view

 public function view()
 {
     parent::view();
     $id = Sanitize::paranoid($this->params->id);
     $id = (int) $id;
     $content = file_get_contents('http://resources.sejmometr.pl/sejm_komunikaty/content/' . $id . '.html');
     $this->set('content', $content);
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:8,代码来源:SejmKomunikatyController.php

示例12: search

 function search()
 {
     $this->pageTitle = __('USERS_SEARCH_TITLE', true);
     // objekt pre escapovanie
     //
     uses('sanitize');
     $sanit = new Sanitize();
     //
     // nastav condition na zaklade zaslaneho hladania
     //
     $condition = array('"User"."username" LIKE \'%' . $sanit->paranoid(@$_POST['name']) . '%\' OR ' . '"User"."first_name" LIKE \'%' . $sanit->paranoid(@$_POST['name']) . '%\' OR ' . '"User"."middle_name" LIKE \'%' . $sanit->paranoid(@$_POST['name']) . '%\' OR ' . '"User"."last_name" LIKE \'%' . $sanit->paranoid(@$_POST['name']) . '%\'');
     //
     // find	& paginate it
     $this->set('name', $sanit->paranoid(@$_POST['name']));
     $this->paginate['User']['limit'] = 20;
     $this->set('users', $this->paginate('User', $condition));
     $this->render('index');
 }
开发者ID:googlecode-mirror,项目名称:timovy2007,代码行数:18,代码来源:users_controller.php

示例13: index

 function index()
 {
     $this->cacheAction = "10000 hours";
     App::import('Sanitize');
     /**
      *In this module we setting the path to the current Brand logo.
      */
     $brand = array();
     if (isset($this->params['named']['brand']) && (int) Sanitize::paranoid($this->params['named']['brand']) != null) {
         $brand = $this->SubCategory->BrandsCategory->Brand->find('first', array('conditions' => array('Brand.id' => $this->params['named']['brand']), 'fields' => array('Brand.id', 'Brand.logo', 'Brand.body', 'Brand.name'), 'contain' => false));
         if ($brand != array()) {
             $this->set('brand', $brand);
         } else {
             $this->Session->setFlash('Brand wasn\'t found in database');
             $this->redirect('/', null, true);
         }
     } else {
         $this->Session->setFlash('Brand wasn\'t found in database');
         $this->redirect('/', null, true);
     }
     /**
      *In this module we setting the set of the subcategories.
      */
     $category = array();
     if (isset($this->params['named']['category']) && (int) Sanitize::paranoid($this->params['named']['category']) != null) {
         $subCats = $this->SubCategory->BrandsCategory->find('first', array('conditions' => array('category_id' => $this->params['named']['category'], 'brand_id' => $this->params['named']['brand']), 'fields' => array(), 'contain' => array('Banner' => array('fields' => array('Banner.id', 'Banner.logo', 'Banner.url'), 'order' => array('BannersBrandsCategory.id' => 'DESC')), 'SubCategory' => array('fields' => array('name', 'id', 'product_count'), 'conditions' => array('SubCategory.product_count <>' => null)), 'Category' => array('fields' => array('Category.id', 'Category.type', 'Category.name')))));
         if ($subCats != array()) {
             $this->set('subCats', $subCats);
         } else {
             $this->Session->setFlash('SubCat wasn\'t found in database');
             $this->redirect('/', null, true);
         }
     } else {
         $this->Session->setFlash('SubCat wasn\'t found in database');
         $this->redirect('/', null, true);
     }
     /**
      *In this module we setting the set of the products.
      */
     $products = array();
     if (isset($this->params['named']['subcat']) && (int) Sanitize::paranoid($this->params['named']['subcat']) != null) {
         $products = $this->SubCategory->find('first', array('conditions' => array('SubCategory.id' => $this->params['named']['subcat']), 'fields' => array('name'), 'contain' => array('Product' => array('fields' => array('Product.name', 'Product.logo', 'Product.logo1', 'Product.content1'), 'order' => array('Product.id' => 'DESC')))));
         $this->set('products', $products);
         if ($subCats['Category']['type'] == 3) {
             $this->render('indexType3');
         }
     } elseif (!isset($this->params['named']['subcat'])) {
         //$brandInfo= $this->SubCategory->Brand->find('first', array('conditions' => array('SubCategory.id' => $subCat['0']['SubCategory']['id']), 'contain' => array('Product') ) );
     }
     if (isset($products['Product']) && $products['Product'] == array()) {
         $this->Session->setFlash('В данном разделе отсутствуют товары', 'default', array('class' => "error"));
     }
 }
开发者ID:kondrat,项目名称:horpol,代码行数:53,代码来源:sub_categories_controller.php

示例14: reset_password

 function reset_password($userId, $data)
 {
     $user_id = Sanitize::paranoid($user_id);
     if ($this->comparePassword($data['User']['password'], $data['User']['password_confirm'])) {
         pr('password comparison passed!');
         $password = $this->hashPasswords($data['User']['password'], true);
         $sql = "UPDATE users SET users.password = '{$password}' WHERE users.id = {$userId}";
         $this->query($sql);
         return true;
     } else {
         pr('password comparison failed!');
         return false;
     }
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:14,代码来源:user.php

示例15: index

 function index()
 {
     global $Itemid;
     $cat_id = null;
     $conditions = array();
     $joins = array();
     $order = array();
     $menu_id = '';
     // Read module params
     $dir_id = Sanitize::getString($this->params['module'], 'dir');
     $section_id = Sanitize::getString($this->params, 'section');
     $cat_id = Sanitize::getString($this->params['module'], 'cat');
     $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     $itemid_options = Sanitize::getString($this->params['module'], 'itemid_options');
     $itemid_hc = Sanitize::getInt($this->params['module'], 'hc_itemid');
     $field = Sanitize::paranoid(Sanitize::getString($this->params['module'], 'field'), array('_'));
     $option_length = Sanitize::getInt($this->params['module'], 'fieldoption_length');
     $custom_params = Sanitize::getString($this->params['module'], 'custom_params');
     $sort = Sanitize::paranoid(Sanitize::getString($this->params['module'], 'fieldoption_order'));
     # Set menu id
     switch ($itemid_options) {
         case 'none':
             $menu_id = '';
             break;
         case 'current':
             break;
         case 'hardcode':
             $menu_id = $itemid_hc;
             break;
     }
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'catauto')) {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     $this->FieldOption->modelUnbind(array('FieldOption.value AS `FieldOption.value`', 'FieldOption.fieldid AS `FieldOption.fieldid`', 'FieldOption.image AS `FieldOption.image`', 'FieldOption.ordering AS `FieldOption.ordering`', 'FieldOption.optionid AS `FieldOption.optionid`', 'FieldOption.text AS `FieldOption.text`'));
     $fields[] = 'FieldOption.optionid AS `FieldOption.optionid`';
     $fields[] = 'FieldOption.value AS `FieldOption.value`';
     if ($option_length) {
         $fields[] = 'IF(CHAR_LENGTH(FieldOption.text)>' . $option_length . ',CONCAT(SUBSTR(FieldOption.text,1,' . $option_length . '),"..."),FieldOption.text) AS `FieldOption.text`';
     } else {
         $fields[] = 'FieldOption.text AS `FieldOption.text`';
     }
     $joins[] = 'INNER JOIN #__jreviews_fields AS Field ON Field.fieldid = FieldOption.fieldid';
     $order[] = 'FieldOption.' . $sort;
     $field_options = $this->FieldOption->findAll(array('fields' => $fields, 'conditions' => 'Field.name = ' . $this->quote($field), 'joins' => $joins, 'order' => $order));
     # Send variables to view template
     $this->set(array('field' => $field, 'field_options' => $field_options, 'section_ids' => $section_id, 'category_ids' => $cat_id, 'criteria_id' => $criteria_id, 'menu_id' => $menu_id, 'custom_params' => $custom_params));
     return $this->render('modules', 'fields');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:50,代码来源:module_fields_controller.php


注:本文中的Sanitize::paranoid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。