Changeset 454
- Timestamp:
- 06/08/07 14:57:38 (2 years ago)
- Files:
-
- trunk/lib/jelix-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_EN/errors.UTF-8.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_EN/errors.UTF-8.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_US/errors.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_US/errors.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_US/errors.UTF-8.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/en_US/errors.UTF-8.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.UTF-8.properties (modified) (2 diffs)
- trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.UTF-8.properties (modified) (2 diffs)
- trunk/lib/jelix/core/jResponse.class.php (modified) (1 diff)
- trunk/lib/jelix/core/jResponse.class.php (modified) (1 diff)
- trunk/lib/jelix/core/response/jResponseAtom10.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseAtom10.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseBinary.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/response/jResponseBinary.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/response/jResponseCss.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/response/jResponseCss.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/response/jResponseHtml.class.php (modified) (1 diff)
- trunk/lib/jelix/core/response/jResponseHtml.class.php (modified) (1 diff)
- trunk/lib/jelix/core/response/jResponseJson.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/response/jResponseJson.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/response/jResponseJsonrpc.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseJsonrpc.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseLatexToPdf.class.php (modified) (1 diff)
- trunk/lib/jelix/core/response/jResponseLatexToPdf.class.php (modified) (1 diff)
- trunk/lib/jelix/core/response/jResponseRdf.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/response/jResponseRdf.class.php (modified) (2 diffs)
- trunk/lib/jelix/core/response/jResponseRss20.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseRss20.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseText.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseText.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseXml.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/response/jResponseXml.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/response/jResponseXmlrpc.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseXmlrpc.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseXul.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/response/jResponseXul.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/response/jResponseZip.class.php (modified) (3 diffs)
- trunk/lib/jelix/core/response/jResponseZip.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_EN/errors.ISO-8859-1.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_EN/errors.UTF-8.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_EN/errors.UTF-8.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_US/errors.ISO-8859-1.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_US/errors.ISO-8859-1.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_US/errors.UTF-8.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/en_US/errors.UTF-8.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : the selector "%s" doesn't point to a source file 26 27 #---- responses 28 repxml.no.content=(150) Undefined content for xml response 29 repxml.invalid.content=(151) Invalid xml content for xml response 30 repbin.unknow.file=(152) unknow file for binary response (%s) 26 31 27 32 #---- locales trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties
r415 r454 22 22 #---- includer 23 23 includer.source.missing=(140)Includer : le s�cteur %s n'indique pas de fichier source 24 25 #---- R�nses 26 repxml.no.content=(150) Aucun contenu d�ni pour la r�nse XML 27 repxml.invalid.content=(151) Contenu xml invalid pour la r�nse XML 28 repbin.unknow.file=(152) Fichier inconnu pour la r�nse Binary (%s) 24 29 25 30 #---- locales trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.ISO-8859-1.properties
r415 r454 22 22 #---- includer 23 23 includer.source.missing=(140)Includer : le s�cteur %s n'indique pas de fichier source 24 25 #---- R�nses 26 repxml.no.content=(150) Aucun contenu d�ni pour la r�nse XML 27 repxml.invalid.content=(151) Contenu xml invalid pour la r�nse XML 28 repbin.unknow.file=(152) Fichier inconnu pour la r�nse Binary (%s) 24 29 25 30 #---- locales trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.UTF-8.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : le sélecteur %s n'indique pas de fichier source 26 27 #---- Réponses 28 repxml.no.content=(150) Aucun contenu défini pour la réponse XML 29 repxml.invalid.content=(151) Contenu xml invalid pour la réponse XML 30 repbin.unknow.file=(152) Fichier inconnu pour la réponse Binary (%s) 26 31 27 32 #---- locales … … 77 82 file.notexists = (23)Le fichier %s n'existe pas 78 83 inifile.write.error = (24)Un problème est survenu lors de l'écriture du fichier ini %s 84 trunk/lib/jelix-modules/jelix/locales/fr_FR/errors.UTF-8.properties
r415 r454 24 24 #---- includer 25 25 includer.source.missing=(140)Includer : le sélecteur %s n'indique pas de fichier source 26 27 #---- Réponses 28 repxml.no.content=(150) Aucun contenu défini pour la réponse XML 29 repxml.invalid.content=(151) Contenu xml invalid pour la réponse XML 30 repbin.unknow.file=(152) Fichier inconnu pour la réponse Binary (%s) 26 31 27 32 #---- locales … … 77 82 file.notexists = (23)Le fichier %s n'existe pas 78 83 inifile.write.error = (24)Un problème est survenu lors de l'écriture du fichier ini %s 84 trunk/lib/jelix/core/jResponse.class.php
r334 r454 88 88 * @param string $htype the header type ("Content-Type", "Date-modified"...) 89 89 * @param string $hcontent value of the header type 90 * @param boolean $overwrite false if the value should be set only if it doesn't still exist 90 91 */ 91 public function addHttpHeader($htype, $hcontent){ $this->_httpHeaders[$htype]=$hcontent;} 92 public function addHttpHeader($htype, $hcontent, $overwrite=true){ 93 if(!$overwrite && isset($this->_httpHeaders[$htype])) 94 return; 95 $this->_httpHeaders[$htype]=$hcontent; 96 } 97 98 /** 99 * delete all http headers 100 */ 101 public function clearHttpHeaders(){ 102 $this->_httpHeaders = array(); 103 $this->_httpStatusCode ='200'; 104 $this->_httpStatusMsg ='OK'; 105 } 92 106 93 107 /** trunk/lib/jelix/core/jResponse.class.php
r334 r454 88 88 * @param string $htype the header type ("Content-Type", "Date-modified"...) 89 89 * @param string $hcontent value of the header type 90 * @param boolean $overwrite false if the value should be set only if it doesn't still exist 90 91 */ 91 public function addHttpHeader($htype, $hcontent){ $this->_httpHeaders[$htype]=$hcontent;} 92 public function addHttpHeader($htype, $hcontent, $overwrite=true){ 93 if(!$overwrite && isset($this->_httpHeaders[$htype])) 94 return; 95 $this->_httpHeaders[$htype]=$hcontent; 96 } 97 98 /** 99 * delete all http headers 100 */ 101 public function clearHttpHeaders(){ 102 $this->_httpHeaders = array(); 103 $this->_httpStatusCode ='200'; 104 $this->_httpStatusMsg ='OK'; 105 } 92 106 93 107 /** trunk/lib/jelix/core/response/jResponseAtom10.class.php
r386 r454 6 6 * @contributor Laurent Jouanneau 7 7 * @copyright 2006 Yannick Le Guédart 8 * @copyright 2006 Laurent Jouanneau8 * @copyright 2006-2007 Laurent Jouanneau 9 9 * @link http://www.jelix.org 10 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 83 83 final public function outputErrors() { 84 84 if (!$this->_headSent) { 85 if ($this->_sendHttpHeader) { 85 if (!$this->_httpHeadersSent) { 86 header("HTTP/1.0 500 Internal Server Error"); 86 87 header('Content-Type: text/xml;charset='.$this->charset); 87 88 } … … 106 107 foreach ($GLOBALS['gJCoord']->errorMessages as $e) { 107 108 // FIXME : Pourquoi utiliser htmlentities() ? 108 $errors .= '<error type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n";109 $errors .= '<error xmlns="http://jelix.org/ns/xmlerror/1.0" type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n"; 109 110 } 110 111 return $errors; trunk/lib/jelix/core/response/jResponseAtom10.class.php
r386 r454 6 6 * @contributor Laurent Jouanneau 7 7 * @copyright 2006 Yannick Le Guédart 8 * @copyright 2006 Laurent Jouanneau8 * @copyright 2006-2007 Laurent Jouanneau 9 9 * @link http://www.jelix.org 10 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 83 83 final public function outputErrors() { 84 84 if (!$this->_headSent) { 85 if ($this->_sendHttpHeader) { 85 if (!$this->_httpHeadersSent) { 86 header("HTTP/1.0 500 Internal Server Error"); 86 87 header('Content-Type: text/xml;charset='.$this->charset); 87 88 } … … 106 107 foreach ($GLOBALS['gJCoord']->errorMessages as $e) { 107 108 // FIXME : Pourquoi utiliser htmlentities() ? 108 $errors .= '<error type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n";109 $errors .= '<error xmlns="http://jelix.org/ns/xmlerror/1.0" type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n"; 109 110 } 110 111 return $errors; trunk/lib/jelix/core/response/jResponseBinary.class.php
r443 r454 5 5 * @author Laurent Jouanneau 6 6 * @contributor Nicolas Lassalle <nicolas@beroot.org> (ticket #188) 7 * @copyright 2005-200 6Laurent Jouanneau7 * @copyright 2005-2007 Laurent Jouanneau 8 8 * @copyright 2007 Nicolas Lassalle 9 9 * @link http://www.jelix.org … … 60 60 */ 61 61 public function output(){ 62 62 63 if($this->doDownload){ 63 64 $this->mimeType = 'application/forcedownload'; … … 67 68 } 68 69 } 70 69 71 if($this->hasErrors()) return false; 72 73 $this->addHttpHeader("Content-Type",$this->mimeType, $this->doDownload); 74 75 if($this->doDownload) 76 $this->_downloadHeader(); 70 77 71 78 if($this->content === null){ 72 79 if (is_readable ($this->fileName) && is_file ($this->fileName)){ 73 header("Content-Type: ".$this->mimeType); 74 if($this->doDownload) $this->_downloadHeader(); 75 header("Content-Length: ".filesize ($this->fileName)); 80 $this->_httpHeaders['Content-Length']=filesize ($this->fileName); 81 $this->sendHttpHeaders(); 76 82 readfile ($this->fileName); 77 83 flush(); 78 84 return true; 79 }else 85 }else{ 86 throw new jException('jelix~errors.repbin.unknow.file' , $this->fileName); 80 87 return false; 88 } 81 89 }else{ 82 header("Content-Type: ".$this->mimeType); 83 if($this->doDownload) $this->_downloadHeader(); 84 header("Content-Length: ".strlen ($this->content)); 90 $this->_httpHeaders['Content-Length']=strlen ($this->content); 91 $this->sendHttpHeaders(); 85 92 echo $this->content; 86 93 flush(); … … 88 95 } 89 96 } 90 91 private function _downloadHeader(){ 92 header("Content-Disposition: attachment; filename=".$this->outputFileName); 93 header("Content-Description: File Transfert"); 94 header("Content-Transfer-Encoding: binary"); 95 header("Pragma: no-cache"); 96 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 97 header("Expires: 0"); 97 98 /** 99 * set all headers to force download 100 */ 101 protected function _downloadHeader(){ 102 $this->addHttpHeader('Content-Disposition','attachment; filename='.$this->outputFileName, false); 103 $this->addHttpHeader('Content-Description','File Transfert', false); 104 $this->addHttpHeader('Content-Transfer-Encoding','binary', false); 105 $this->addHttpHeader('Pragma','no-cache', false); 106 $this->addHttpHeader('Cache-Control','no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false); 107 $this->addHttpHeader('Expires','0', false); 98 108 } 99 109 100 110 /** 101 * @todo do this method111 * 102 112 */ 103 113 public function outputErrors(){ 104 114 $this->clearHttpHeaders(); 115 $this->_httpStatusCode ='500'; 116 $this->_httpStatusMsg ='Internal Server Error'; 117 $this->_httpHeaders["Content-Type"]='text/plain'; 118 $this->sendHttpHeaders(); 119 if($this->hasErrors()){ 120 foreach( $GLOBALS['gJCoord']->errorMessages as $e){ 121 echo '['.$e[0].' '.$e[1].'] '.$e[2]." \t".$e[3]." \t".$e[4]."\n"; 122 } 123 }else{ 124 echo "[unknow error]\n"; 125 } 105 126 } 106 127 } trunk/lib/jelix/core/response/jResponseBinary.class.php
r443 r454 5 5 * @author Laurent Jouanneau 6 6 * @contributor Nicolas Lassalle <nicolas@beroot.org> (ticket #188) 7 * @copyright 2005-200 6Laurent Jouanneau7 * @copyright 2005-2007 Laurent Jouanneau 8 8 * @copyright 2007 Nicolas Lassalle 9 9 * @link http://www.jelix.org … … 60 60 */ 61 61 public function output(){ 62 62 63 if($this->doDownload){ 63 64 $this->mimeType = 'application/forcedownload'; … … 67 68 } 68 69 } 70 69 71 if($this->hasErrors()) return false; 72 73 $this->addHttpHeader("Content-Type",$this->mimeType, $this->doDownload); 74 75 if($this->doDownload) 76 $this->_downloadHeader(); 70 77 71 78 if($this->content === null){ 72 79 if (is_readable ($this->fileName) && is_file ($this->fileName)){ 73 header("Content-Type: ".$this->mimeType); 74 if($this->doDownload) $this->_downloadHeader(); 75 header("Content-Length: ".filesize ($this->fileName)); 80 $this->_httpHeaders['Content-Length']=filesize ($this->fileName); 81 $this->sendHttpHeaders(); 76 82 readfile ($this->fileName); 77 83 flush(); 78 84 return true; 79 }else 85 }else{ 86 throw new jException('jelix~errors.repbin.unknow.file' , $this->fileName); 80 87 return false; 88 } 81 89 }else{ 82 header("Content-Type: ".$this->mimeType); 83 if($this->doDownload) $this->_downloadHeader(); 84 header("Content-Length: ".strlen ($this->content)); 90 $this->_httpHeaders['Content-Length']=strlen ($this->content); 91 $this->sendHttpHeaders(); 85 92 echo $this->content; 86 93 flush(); … … 88 95 } 89 96 } 90 91 private function _downloadHeader(){ 92 header("Content-Disposition: attachment; filename=".$this->outputFileName); 93 header("Content-Description: File Transfert"); 94 header("Content-Transfer-Encoding: binary"); 95 header("Pragma: no-cache"); 96 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 97 header("Expires: 0"); 97 98 /** 99 * set all headers to force download 100 */ 101 protected function _downloadHeader(){ 102 $this->addHttpHeader('Content-Disposition','attachment; filename='.$this->outputFileName, false); 103 $this->addHttpHeader('Content-Description','File Transfert', false); 104 $this->addHttpHeader('Content-Transfer-Encoding','binary', false); 105 $this->addHttpHeader('Pragma','no-cache', false); 106 $this->addHttpHeader('Cache-Control','no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false); 107 $this->addHttpHeader('Expires','0', false); 98 108 } 99 109 100 110 /** 101 * @todo do this method111 * 102 112 */ 103 113 public function outputErrors(){ 104 114 $this->clearHttpHeaders(); 115 $this->_httpStatusCode ='500'; 116 $this->_httpStatusMsg ='Internal Server Error'; 117 $this->_httpHeaders["Content-Type"]='text/plain'; 118 $this->sendHttpHeaders(); 119 if($this->hasErrors()){ 120 foreach( $GLOBALS['gJCoord']->errorMessages as $e){ 121 echo '['.$e[0].' '.$e[1].'] '.$e[2]." \t".$e[3]." \t".$e[4]."\n"; 122 } 123 }else{ 124 echo "[unknow error]\n"; 125 } 105 126 } 106 127 } trunk/lib/jelix/core/response/jResponseCss.class.php
r338 r454 4 4 * @subpackage core_response 5 5 * @author Nicolas Jeudy 6 * @contributor 6 * @contributor Laurent Jouanneau 7 7 * @copyright 2006 Nicolas Jeudy 8 * @copyright 2007 Laurent Jouanneau 8 9 * @link http://www.jelix.org 9 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 45 46 public function outputErrors(){ 46 47 global $gJConfig; 48 header("HTTP/1.0 500 Internal Server Error"); 47 49 header('Content-Type: text/css;charset='.$gJConfig->defaultCharset); 48 50 echo "/*\n"; trunk/lib/jelix/core/response/jResponseCss.class.php
r338 r454 4 4 * @subpackage core_response 5 5 * @author Nicolas Jeudy 6 * @contributor 6 * @contributor Laurent Jouanneau 7 7 * @copyright 2006 Nicolas Jeudy 8 * @copyright 2007 Laurent Jouanneau 8 9 * @link http://www.jelix.org 9 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 45 46 public function outputErrors(){ 46 47 global $gJConfig; 48 header("HTTP/1.0 500 Internal Server Error"); 47 49 header('Content-Type: text/css;charset='.$gJConfig->defaultCharset); 48 50 echo "/*\n"; trunk/lib/jelix/core/response/jResponseHtml.class.php
r433 r454 199 199 final public function outputErrors(){ 200 200 if($this->_headSent < 1){ 201 if(!$this->_httpHeadersSent) header('Content-Type: text/html;charset='.$this->_charset); 201 if(!$this->_httpHeadersSent){ 202 header("HTTP/1.0 500 Internal Server Error"); 203 header('Content-Type: text/html;charset='.$this->_charset); 204 } 202 205 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n<html>"; 203 206 } trunk/lib/jelix/core/response/jResponseHtml.class.php
r433 r454 199 199 final public function outputErrors(){ 200 200 if($this->_headSent < 1){ 201 if(!$this->_httpHeadersSent) header('Content-Type: text/html;charset='.$this->_charset); 201 if(!$this->_httpHeadersSent){ 202 header("HTTP/1.0 500 Internal Server Error"); 203 header('Content-Type: text/html;charset='.$this->_charset); 204 } 202 205 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n<html>"; 203 206 } trunk/lib/jelix/core/response/jResponseJson.class.php
r446 r454 46 46 $content = $json->encode($this->datas); 47 47 #endif 48 if($this->hasErrors()) return false; 49 48 50 $this->_httpHeaders['Content-length'] = strlen($content); 49 51 $this->sendHttpHeaders(); … … 63 65 $message['errorCode'] = -1; 64 66 } 67 $this->clearHttpHeaders(); 68 $this->_httpStatusCode ='500'; 69 $this->_httpStatusMsg ='Internal Server Error'; 65 70 $this->_httpHeaders['Content-Type'] = "text/plain"; 66 71 #if ENABLE_PHP_JSON trunk/lib/jelix/core/response/jResponseJson.class.php
r446 r454 46 46 $content = $json->encode($this->datas); 47 47 #endif 48 if($this->hasErrors()) return false; 49 48 50 $this->_httpHeaders['Content-length'] = strlen($content); 49 51 $this->sendHttpHeaders(); … … 63 65 $message['errorCode'] = -1; 64 66 } 67 $this->clearHttpHeaders(); 68 $this->_httpStatusCode ='500'; 69 $this->_httpStatusMsg ='Internal Server Error'; 65 70 $this->_httpHeaders['Content-Type'] = "text/plain"; 66 71 #if ENABLE_PHP_JSON trunk/lib/jelix/core/response/jResponseJsonrpc.class.php
r446 r454 5 5 * @author Laurent Jouanneau 6 6 * @contributor Loic Mathaud 7 * @copyright 2005-200 6Laurent Jouanneau7 * @copyright 2005-2007 Laurent Jouanneau 8 8 * @copyright 2007 Loic Mathaud 9 9 * @link http://www.jelix.org … … 35 35 public function output(){ 36 36 global $gJCoord; 37 if($this->hasErrors()) return false;37 38 38 $this->_httpHeaders['Content-Type'] = "text/plain"; 39 39 if($gJCoord->request->jsonRequestId !== null){ 40 40 $content = jJsonRpc::encodeResponse($this->response, $gJCoord->request->jsonRequestId); 41 if($this->hasErrors()) return false; 41 42 $this->_httpHeaders['Content-length'] = strlen($content); 42 43 $this->sendHttpHeaders(); 43 44 echo $content; 44 45 }else{ 46 if($this->hasErrors()) return false; 45 47 $this->_httpHeaders['Content-length'] = '0'; 46 48 $this->sendHttpHeaders(); … … 59 61 $errorCode = -1; 60 62 } 63 $this->clearHttpHeaders(); 64 $this->_httpStatusCode ='500'; 65 $this->_httpStatusMsg ='Internal Server Error'; 61 66 $this->_httpHeaders['Content-Type'] = "text/plain"; 62 67 $content = jJsonRpc::encodeFaultResponse($errorCode,$errorMessage, $gJCoord->request->jsonRequestId); trunk/lib/jelix/core/response/jResponseJsonrpc.class.php
r446 r454 5 5 * @author Laurent Jouanneau 6 6 * @contributor Loic Mathaud 7 * @copyright 2005-200 6Laurent Jouanneau7 * @copyright 2005-2007 Laurent Jouanneau 8 8 * @copyright 2007 Loic Mathaud 9 9 * @link http://www.jelix.org … … 35 35 public function output(){ 36 36 global $gJCoord; 37 if($this->hasErrors()) return false;37 38 38 $this->_httpHeaders['Content-Type'] = "text/plain"; 39 39 if($gJCoord->request->jsonRequestId !== null){ 40 40 $content = jJsonRpc::encodeResponse($this->response, $gJCoord->request->jsonRequestId); 41 if($this->hasErrors()) return false; 41 42 $this->_httpHeaders['Content-length'] = strlen($content); 42 43 $this->sendHttpHeaders(); 43 44 echo $content; 44 45 }else{ 46 if($this->hasErrors()) return false; 45 47 $this->_httpHeaders['Content-length'] = '0'; 46 48 $this->sendHttpHeaders(); … … 59 61 $errorCode = -1; 60 62 } 63 $this->clearHttpHeaders(); 64 $this->_httpStatusCode ='500'; 65 $this->_httpStatusMsg ='Internal Server Error'; 61 66 $this->_httpHeaders['Content-Type'] = "text/plain"; 62 67 $content = jJsonRpc::encodeFaultResponse($errorCode,$errorMessage, $gJCoord->request->jsonRequestId); trunk/lib/jelix/core/response/jResponseLatexToPdf.class.php
r411 r454 167 167 public function outputErrors(){ 168 168 global $gJConfig; 169 header("HTTP/1.0 500 Internal Server Error"); 169 170 header('Content-Type: text/plain;charset='.$gJConfig->defaultCharset); 170 171 if($this->hasErrors()){ trunk/lib/jelix/core/response/jResponseLatexToPdf.class.php
r411 r454 167 167 public function outputErrors(){ 168 168 global $gJConfig; 169 header("HTTP/1.0 500 Internal Server Error"); 169 170 header('Content-Type: text/plain;charset='.$gJConfig->defaultCharset); 170 171 if($this->hasErrors()){ trunk/lib/jelix/core/response/jResponseRdf.class.php
r338 r454 5 5 * @author Laurent Jouanneau 6 6 * @contributor 7 * @copyright 2006 Laurent Jouanneau7 * @copyright 2006-2007 Laurent Jouanneau 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 139 139 $EOL="\n"; 140 140 if(!$this->_httpHeadersSent){ 141 header("HTTP/1.0 500 Internal Server Error"); 141 142 header("Content-Type: text/xml;charset=".$GLOBALS['gJConfig']->defaultCharset); 142 143 } trunk/lib/jelix/core/response/jResponseRdf.class.php
r338 r454 5 5 * @author Laurent Jouanneau 6 6 * @contributor 7 * @copyright 2006 Laurent Jouanneau7 * @copyright 2006-2007 Laurent Jouanneau 8 8 * @link http://www.jelix.org 9 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 139 139 $EOL="\n"; 140 140 if(!$this->_httpHeadersSent){ 141 header("HTTP/1.0 500 Internal Server Error"); 141 142 header("Content-Type: text/xml;charset=".$GLOBALS['gJConfig']->defaultCharset); 142 143 } trunk/lib/jelix/core/response/jResponseRss20.class.php
r386 r454 8 8 * @copyright 2005-2006 Loic Mathaud 9 9 * @copyright 2006 Yannick Le Guédart 10 * @copyright 2006 Laurent Jouanneau10 * @copyright 2006-2007 Laurent Jouanneau 11 11 * @link http://www.jelix.org 12 12 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 79 79 final public function outputErrors() { 80 80 if (!$this->_headSent) { 81 if ($this->_sendHttpHeader) { 81 if (!$this->_httpHeadersSent) { 82 header("HTTP/1.0 500 Internal Server Error"); 82 83 header('Content-Type: text/xml;charset='.$this->charset); 83 84 } … … 102 103 foreach ($GLOBALS['gJCoord']->errorMessages as $e) { 103 104 // FIXME : Pourquoi utiliser htmlentities() ? 104 $errors .= '<error type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n";105 $errors .= '<error xmlns="http://jelix.org/ns/xmlerror/1.0" type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n"; 105 106 } 106 107 return $errors; trunk/lib/jelix/core/response/jResponseRss20.class.php
r386 r454 8 8 * @copyright 2005-2006 Loic Mathaud 9 9 * @copyright 2006 Yannick Le Guédart 10 * @copyright 2006 Laurent Jouanneau10 * @copyright 2006-2007 Laurent Jouanneau 11 11 * @link http://www.jelix.org 12 12 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 79 79 final public function outputErrors() { 80 80 if (!$this->_headSent) { 81 if ($this->_sendHttpHeader) { 81 if (!$this->_httpHeadersSent) { 82 header("HTTP/1.0 500 Internal Server Error"); 82 83 header('Content-Type: text/xml;charset='.$this->charset); 83 84 } … … 102 103 foreach ($GLOBALS['gJCoord']->errorMessages as $e) { 103 104 // FIXME : Pourquoi utiliser htmlentities() ? 104 $errors .= '<error type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n";105 $errors .= '<error xmlns="http://jelix.org/ns/xmlerror/1.0" type="'. $e[0] .'" code="'. $e[1] .'" file="'. $e[3] .'" line="'. $e[4] .'">'.htmlentities($e[2], ENT_NOQUOTES, $this->charset). '</error>'. "\n"; 105 106 } 106
