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


PHP SiteHelpers::globalXssClean方法代码示例

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


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

示例1: postSavetranslation

 public function postSavetranslation()
 {
     SiteHelpers::globalXssClean();
     $form = "<?php \n";
     $form .= "return array( \n";
     foreach ($_POST as $key => $val) {
         if ($key != '_token' && $key != 'lang' && $key != 'file') {
             if (!is_array($val)) {
                 $form .= '"' . $key . '"			=> "' . strip_tags($val) . '", ' . " \n ";
             } else {
                 $form .= '"' . $key . '"			=> array( ' . " \n ";
                 foreach ($val as $k => $v) {
                     $form .= '      "' . $k . '"			=> "' . strip_tags($v) . '", ' . " \n ";
                 }
                 $form .= "), \n";
             }
         }
     }
     $form .= ');';
     //echo $form; exit;
     $lang = Input::get('lang');
     $file = Input::get('file');
     $filename = './protected/app/lang/' . $lang . '/' . $file;
     //	$filename = 'lang.php';
     $fp = fopen($filename, "w+");
     fwrite($fp, $form);
     fclose($fp);
     return Redirect::to('config/translation?edit=' . $lang . '&file=' . $file)->with('messagetext', 'Translation has been saved !')->with('msgstatus', 'success');
 }
开发者ID:buguelos,项目名称:make,代码行数:29,代码来源:ConfigController.php

示例2: postSave

 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     //$rules = $this->validateForm();
     $validator = Validator::make(Input::all(), Ncategories::$rules);
     SiteHelpers::globalXssClean();
     if ($validator->passes()) {
         if (!is_null(Input::file('file'))) {
             $file = Input::file('file');
             $destinationPath = ROOT . '/uploads/categories/';
             $filename = $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             //if you need extension of the file
             $newfilename = Input::get('CategoryName') . '_' . time() . '.' . $extension;
             $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
             if ($uploadSuccess) {
                 $data['Picture'] = $newfilename;
                 $orgFile = $destinationPath . '/' . $newfilename;
                 $thumbFile = $destinationPath . '/thumb/' . $newfilename;
                 //SiteHelpers::cropImage($this->img_width , $this->img_height , $orgFile ,  $extension,	 $thumbFile);
                 SiteHelpers::resizewidth("180", $orgFile, $thumbFile);
                 if (Input::get('action') != "") {
                     $data_old = $this->model->getRow(Input::get('action'));
                     @unlink(ROOT . '/uploads/categories/' . $data_old->Picture);
                     @unlink(ROOT . '/uploads/categories/thumb/' . $data_old->Picture);
                 }
             }
         }
         $data['postion'] = Input::get('postion');
         $data['CategoryName'] = Input::get('CategoryName');
         $data['Description'] = Input::get('Description');
         $data['lang'] = $this->lang;
         $data['created'] = time();
         $data['status'] = Input::get('status');
         $data['alias'] = SiteHelpers::seoUrl(trim($data['CategoryName']));
         $data['keywords'] = Input::get('keywords');
         $data['seo_meta'] = Input::get('seo_meta');
         //$data = $this->validatePost('categories');
         $ID = $this->model->insertRow($data, Input::get('CategoryID'));
         // Input logs
         if (Input::get('CategoryID') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         //$md = str_replace(" ","+",Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'Ncategories/add/' . $id : 'Ncategories?md=';
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('Ncategories/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
开发者ID:blackorwhite1233,项目名称:fakekinhdoanh,代码行数:54,代码来源:NcategoriesController.php

示例3: validatePost

 function validatePost($table)
 {
     $str = $this->info['config']['forms'];
     $data = array();
     foreach ($str as $f) {
         $field = $f['field'];
         if ($f['view'] == 1) {
             if ($f['type'] == 'textarea_editor' || $f['type'] == 'textarea') {
                 $content = isset($_POST[$field]) ? $_POST[$field] : '';
                 /* Use this filter for html sanity
                 			$data[$field] =  Purifier::clean($content);
                 			*/
                 $data[$field] = $content;
             } else {
                 SiteHelpers::globalXssClean();
                 if (!is_null(Input::get($field))) {
                     $data[$field] = Input::get($field);
                 }
                 // if post is file or image
                 if ($f['type'] == 'file') {
                     if (!is_null(Input::file($field))) {
                         $file = Input::file($field);
                         $destinationPath = './' . str_replace('.', '', $f['option']['path_to_upload']);
                         $filename = $file->getClientOriginalName();
                         $extension = $file->getClientOriginalExtension();
                         //if you need extension of the file
                         $rand = rand(1000, 100000000);
                         $newfilename = strtotime(date('Y-m-d H:i:s')) . '-' . $rand . '.' . $extension;
                         $uploadSuccess = Input::file($field)->move($destinationPath, $newfilename);
                         if ($f['option']['resize_width'] != '0' && $f['option']['resize_width'] != '') {
                             if ($f['option']['resize_height'] == 0) {
                                 $f['option']['resize_height'] = $f['option']['resize_width'];
                             }
                             $orgFile = $destinationPath . '/' . $newfilename;
                             SiteHelpers::cropImage($f['option']['resize_width'], $f['option']['resize_height'], $orgFile, $extension, $orgFile);
                         }
                         if ($uploadSuccess) {
                             $data[$field] = $newfilename;
                         }
                     } else {
                         unset($data[$field]);
                     }
                 }
                 // if post is checkbox
                 if ($f['type'] == 'checkbox') {
                     if (!is_null(Input::get($field))) {
                         $data[$field] = implode(",", Input::get($field));
                     }
                 }
                 // if post is date
                 if ($f['type'] == 'date') {
                     $data[$field] = date("Y-m-d", strtotime(Input::get($field)));
                 }
                 // if post is seelct multiple
                 if ($f['type'] == 'select') {
                     if (isset($f['option']['is_multiple']) && $f['option']['is_multiple'] == 1) {
                         $data[$field] = implode(",", Input::get($field));
                     }
                 }
             }
         }
     }
     $global = isset($this->access['is_global']) ? $this->access['is_global'] : 0;
     if ($global == 0) {
         $data['entry_by'] = Session::get('uid');
     }
     return $data;
 }
开发者ID:buguelos,项目名称:make,代码行数:68,代码来源:BaseController.php


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