Changeset 257
- Timestamp:
- 09/14/06 14:35:35 (2 years ago)
- Files:
-
- trunk/lib/jelix-plugins/magicquotes/magicquotes.plugin.php (modified) (3 diffs)
- trunk/lib/jelix/core/jCoordinator.class.php (modified) (1 diff)
- trunk/lib/jelix/core/jErrorHandler.lib.php (modified) (3 diffs)
- trunk/lib/jelix/core/jException.lib.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix-plugins/magicquotes/magicquotes.plugin.php
r150 r257 16 16 */ 17 17 18 /** 19 * This is a plugin which cancel magic quotes effect. Magic quotes should be off 20 * with jelix. 21 * @package jelix 22 * @subpackage plugins 23 */ 18 24 class MagicQuotesPlugin implements jIPlugin { 19 25 20 /**26 /** 21 27 * 22 28 */ 23 function __construct($config){ 24 if(get_magic_quotes_gpc()){ 25 $req = $GLOBALS['gJCoord']->request; 26 foreach ($req->params as $key=>$elem){ 27 $req->params[$key] = $this->_stripSlashes ($elem); 29 function __construct($config){ 30 if(get_magic_quotes_gpc()){ 31 foreach ($_GET as $key=>$elem){ 32 $_GET[$key] = $this->_stripSlashes ($elem); 33 } 34 foreach ($_POST as $key=>$elem){ 35 $_POST[$key] = $this->_stripSlashes ($elem); 36 } 37 foreach ($_COOKIE as $key=>$elem){ 38 $_COOKIE[$key] = $this->_stripSlashes ($elem); 39 } 40 foreach ($_REQUEST as $key=>$elem){ 41 $_REQUEST[$key] = $this->_stripSlashes ($elem); 42 } 28 43 } 29 } 30 set_magic_quotes_runtime(0); 31 } 44 set_magic_quotes_runtime(0); 45 } 32 46 33 /**34 * enleve tout les slashes d'une chaine ou d'un tableau de chaine35 * @param string/array $string36 * @return string/array l'objet transform�*/37 function _stripSlashes ($string){47 /** 48 * enleve tout les slashes d'une chaine ou d'un tableau de chaine 49 * @param string/array $string 50 * @return string/array l'objet transform� */ 51 protected function _stripSlashes ($string){ 38 52 if (is_array ($string)){ 39 53 $toReturn = array (); … … 46 60 return stripslashes ($string); 47 61 } 48 } 62 } 63 49 64 /** 50 65 * @param array $params plugin parameters for the current action … … 52 67 */ 53 68 public function beforeAction($params){ return null;} 69 70 /** 71 * 72 */ 54 73 public function beforeOutput() {} 55 74 75 /** 76 * 77 */ 56 78 public function afterProcess (){} 57 79 } trunk/lib/jelix/core/jCoordinator.class.php
r256 r257 130 130 $this->errorMessages[] = array($type, $code, $message, $file, $line); 131 131 if(!$this->response){ 132 if($this->initDefaultResponseOfRequest()) 133 return true; 132 return $this->initDefaultResponseOfRequest(); 134 133 } 135 134 return !$this->response->acceptSeveralErrors(); trunk/lib/jelix/core/jErrorHandler.lib.php
r248 r257 56 56 } 57 57 58 $doecho=true; 59 if($gJCoord->request == null){ 60 $errmsg = 'JELIX PANIC ! Error during initialization !! '.$errmsg; 61 $doecho = false; 62 $action.= ' EXIT'; 63 }elseif($gJCoord->response == null){ 64 $ret = $gJCoord->initDefaultResponseOfRequest(); 65 if(is_string($ret)){ 66 $errmsg = 'Double error ! 1)'. $ret.'; 2)'.$errmsg; 67 } 68 } 69 58 70 // formatage du message 59 71 $messageLog = strtr($conf['messageLogFormat'], array( … … 80 92 // traitement du message 81 93 if(strpos($action , 'ECHOQUIET') !== false){ 82 if($gJCoord->addErrorMsg($codeString[$errno], $code, $conf['quietMessage'], '', '')) 94 if(!$doecho){ 95 header('Content-type: text/plain'); 96 echo 'JELIX PANIC ! Error during initialization !! '; 97 }elseif($gJCoord->addErrorMsg($codeString[$errno], $code, $conf['quietMessage'], '', '')) 83 98 $action.=' EXIT'; 84 99 }elseif(strpos($action , 'ECHO') !== false){ 85 if($gJCoord->addErrorMsg($codeString[$errno], $code, $errmsg, $filename, $linenum)) 100 if(!$doecho){ 101 header('Content-type: text/plain'); 102 echo $messageLog; 103 }elseif($gJCoord->addErrorMsg($codeString[$errno], $code, $errmsg, $filename, $linenum)){ 86 104 $action.=' EXIT'; 105 } 87 106 } 88 107 if(strpos($action , 'LOGFILE') !== false){ … … 97 116 98 117 if(strpos($action , 'EXIT') !== false){ 99 if($gJCoord->response) $gJCoord->response->outputErrors(); 118 if($doecho && $gJCoord->response) 119 $gJCoord->response->outputErrors(); 100 120 exit; 101 121 } trunk/lib/jelix/core/jException.lib.php
r248 r257 28 28 $action = $conf['exception']; 29 29 30 $doecho=true; 31 if($gJCoord->request == null){ 32 $msg = 'JELIX PANIC ! Error during initialization !! '.$msg; 33 $doecho = false; 34 }elseif($gJCoord->response == null){ 35 $ret = $gJCoord->initDefaultResponseOfRequest(); 36 if(is_string($ret)){ 37 $errmsg = 'Double error ! 1)'. $ret.'; 2)'.$errmsg; 38 } 39 40 } 41 30 42 // formatage du message de log 31 43 $messageLog = strtr($conf['messageLogFormat'], array( … … 39 51 '\n' => "\n" 40 52 )); 41 if($gJCoord->response == null){42 $gJCoord->initDefaultResponseOfRequest();43 }44 53 45 54 if(strpos($action , 'TRACE') !== false){ … … 56 65 // traitement du message 57 66 if(strpos($action , 'ECHOQUIET') !== false){ 58 if($gJCoord->addErrorMsg('error', $exception->getCode(), $conf['quietMessage'], '', '')) 59 $action.=' EXIT'; 67 if(!$doecho){ 68 header('Content-type: text/plain'); 69 echo 'JELIX PANIC ! Error during initialization !! '; 70 }else 71 $gJCoord->addErrorMsg('error', $exception->getCode(), $conf['quietMessage'], '', ''); 60 72 }elseif(strpos($action , 'ECHO') !== false){ 61 $gJCoord->addErrorMsg('error', $exception->getCode(), $msg, $exception->getFile(), $exception->getLine()); 73 if($doecho) 74 $gJCoord->addErrorMsg('error', $exception->getCode(), $msg, $exception->getFile(), $exception->getLine()); 75 else{ 76 header('Content-type: text/plain'); 77 echo $messageLog; 78 } 62 79 } 63 80 if(strpos($action , 'LOGFILE') !== false){ … … 71 88 } 72 89 73 $gJCoord->response->outputErrors(); 90 if($doecho) 91 $gJCoord->response->outputErrors(); 92 exit; 74 93 } 75 94
