Changeset 297
- Timestamp:
- 11/07/06 23:49:22 (2 years ago)
- Files:
-
- trunk/build/buildjelix.php (modified) (1 diff)
- trunk/build/lib/jManifest.class.php (modified) (4 diffs)
- trunk/build/lib/preprocessor.lib.php (modified) (6 diffs)
- trunk/build/manifests/demoxul.mn (modified) (1 diff)
- trunk/build/manifests/jelix-lib.mn (modified) (12 diffs)
- trunk/build/manifests/jelix-no-opt.mn (added)
- trunk/build/manifests/lib-json.mn (added)
- trunk/build/tests/ppdatas/result_include1.txt (modified) (1 diff)
- trunk/build/tests/testpreprocess.php (modified) (4 diffs)
- trunk/lib/jelix/init.php (modified) (3 diffs)
- trunk/lib/jelix/utils/jFilter.class.php (modified) (8 diffs)
- trunk/lib/jelix/utils/jJsonRpc.class.php (modified) (5 diffs)
- trunk/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/buildjelix.php
r293 r297 100 100 101 101 //... execution des manifests 102 jManifest::process('build/manifests/jelix-lib.mn', '.', $BUILD_TARGET_PATH, $GLOBALS); 102 jManifest::process('build/manifests/jelix-lib.mn', '.', $BUILD_TARGET_PATH, $GLOBALS, $STRIP_COMMENT); 103 if(!$ENABLE_OPTIMIZE){ 104 jManifest::process('build/manifests/jelix-no-opt.mn', '.', $BUILD_TARGET_PATH , $GLOBALS, $STRIP_COMMENT); 105 } 103 106 if($ENABLE_DEVELOPER){ 104 107 jManifest::process('build/manifests/jelix-dev.mn', '.', $BUILD_TARGET_PATH , $GLOBALS); 108 } 109 if($ENABLE_PHP_JSON){ 110 jManifest::process('build/manifests/lib-json.mn', '.', $BUILD_TARGET_PATH , $GLOBALS); 105 111 } 106 112 jManifest::process('build/manifests/jelix-others.mn','.', $BUILD_TARGET_PATH , $GLOBALS); trunk/build/lib/jManifest.class.php
r292 r297 19 19 * @param string $distpath directory were files are copied 20 20 */ 21 static public function process($ficlist, $sourcepath, $distpath, $preprocvars, $ verbose=false){21 static public function process($ficlist, $sourcepath, $distpath, $preprocvars, $stripcomment=false, $verbose=false){ 22 22 23 23 $sourcedir = jBuildUtils::normalizeDir($sourcepath); … … 32 32 foreach($script as $nbline=>$line){ 33 33 $nbline++; 34 if(preg_match(' !^(cd|sd|dd|\*)?\s+([a-zA-Z0-9\/.\-_]+)\s*(?:\(([a-zA-Z0-9\/.\-_]*)\))?\s*$!m', $line, $m)){34 if(preg_match(';^(cd|sd|dd|\*|!|\*!)?\s+([a-zA-Z0-9\/.\-_]+)\s*(?:\(([a-zA-Z0-9\/.\-_]*)\))?\s*$;m', $line, $m)){ 35 35 if($m[1] == 'dd'){ 36 36 $currentdestdir = jBuildUtils::normalizeDir($m[2]); … … 50 50 51 51 $destfile = $distdir.$currentdestdir.$m[3]; 52 $sourcefile = $sourcedir.$currentsrcdir.$m[2]; 52 53 53 if($m[1]=='*' ){54 if($m[1]=='*' || $m[1]=='*!'){ 54 55 if($verbose){ 55 echo "process ".$sourcedir.$currentsrcdir.$m[2]."\tto\t".$destfile."\n";56 echo "process $sourcefile \tto\t$destfile \n"; 56 57 } 57 58 $preproc->setVars($preprocvars); 58 59 try{ 59 $contents = $preproc->parseFile($source dir.$currentsrcdir.$m[2]);60 $contents = $preproc->parseFile($sourcefile); 60 61 }catch(Exception $e){ 61 62 throw new Exception ( "$ficlist : line $nbline, cannot process file ".$m[2]." (", $e ,")\n"); 62 63 } 64 if($m[1]=='*' && $stripcomment && preg_match("/\.php$/",$destfile)){ 65 $contents = self::stripPhpComments($contents); 66 } 63 67 file_put_contents($destfile,$contents); 68 69 }elseif($m[1]!='!'&& $stripcomment && preg_match("/\.php$/",$destfile)){ 70 if($verbose) 71 echo "strip comment in $sourcefile\tto\t".$destfile."\n"; 72 $src = file_get_contents($sourcefile); 73 file_put_contents($destfile,self::stripPhpComments($src)); 74 64 75 }else{ 65 if($ options['verbose'])76 if($verbose) 66 77 echo "copy ".$sourcedir.$currentsrcdir.$m[2]."\tto\t".$destfile."\n"; 67 78 68 if(!copy($source dir.$currentsrcdir.$m[2], $destfile)){79 if(!copy($sourcefile, $destfile)){ 69 80 throw new Exception ( "$ficlist : cannot copy file ".$m[2].", line $nbline \n"); 70 81 } … … 78 89 } 79 90 } 91 92 static protected function stripPhpComments($content){ 93 94 $tokens = token_get_all($content); 95 $result = ''; 96 $firstcomment= true; 97 foreach ($tokens as $token) { 98 if (is_string($token)) { 99 $result.=$token; 100 } else { 101 switch ($token[0]) { 102 case T_COMMENT: 103 break; 104 case T_DOC_COMMENT: 105 // on garde le premier commentaire documentaire 106 if($firstcomment){ 107 $result.=$token[1]; 108 $firstcomment = false; 109 } 110 break; 111 default: 112 $result.=$token[1]; 113 break; 114 } 115 } 116 } 117 return $result; 118 119 } 80 120 } 81 121 ?> trunk/build/lib/preprocessor.lib.php
r292 r297 103 103 array_push($this->_blockstack, self::BLOCK_IF_NO); 104 104 }else{ 105 if(isset($this->_variables[$m[2]]) ){105 if(isset($this->_variables[$m[2]]) && $this->_variables[$m[2]] !==''){ 106 106 array_push($this->_blockstack, self::BLOCK_IF_YES); 107 107 }else{ … … 113 113 case 'define': // define avec un seul argument. 114 114 if($isOpen ){ 115 $this->_variables[$m[2]] = '';115 $this->_variables[$m[2]] = true; 116 116 } 117 117 $source[$nb]=false; … … 127 127 array_push($this->_blockstack, self::BLOCK_IF_NO); 128 128 }else{ 129 if(isset($this->_variables[$m[2]]) ){129 if(isset($this->_variables[$m[2]]) && $this->_variables[$m[2]] !==''){ 130 130 array_push($this->_blockstack, self::BLOCK_IF_NO); 131 131 }else{ … … 145 145 array_push($this->_blockstack, (self::BLOCK_IF_NO + self::BLOCK_YES_PREVIOUS)); 146 146 }else{ 147 if(isset($this->_variables[$m[2]]) ){147 if(isset($this->_variables[$m[2]]) && $this->_variables[$m[2]] !==''){ 148 148 array_push($this->_blockstack, self::BLOCK_IF_YES); 149 149 }else{ … … 167 167 }elseif(preg_match('/^\#(expand)\s(.*)$/m',$line,$m)){ 168 168 if($isOpen){ 169 $source[$nb]=preg_replace('/\_\_(\w*)\_\_/e', '(isset($this->_variables["\\1"]) ?$this->_variables["\\1"]:"__\\1__")',$m[2]);169 $source[$nb]=preg_replace('/\_\_(\w*)\_\_/e', '(isset($this->_variables["\\1"])&&$this->_variables["\\1"]!==\'\'?$this->_variables["\\1"]:"__\\1__")',$m[2]); 170 170 }else{ 171 171 $source[$nb]=false; … … 217 217 } 218 218 if($m[1] == 'php'){ 219 if(preg_match('/^\s*\<\?(?:php)?( (?:.|\n)*)\?\>\s*$/m',$source[$nb],$ms)){219 if(preg_match('/^\s*\<\?(?:php)?(.*)\?\>\s*$/sm',$source[$nb],$ms)){ 220 220 $source[$nb] = $ms[1]; 221 221 } trunk/build/manifests/demoxul.mn
r271 r297 14 14 dbprofils.ini.php.dist 15 15 cd demoxul/var/config/index 16 auth.plugin.ini.php16 ! auth.plugin.ini.php 17 17 config.ini.php 18 18 cd demoxul/var/config/jsonrpc 19 config.ini.php20 auth.plugin.ini.php19 ! config.ini.php 20 ! auth.plugin.ini.php 21 21 cd demoxul/var/config/rdf 22 config.ini.php23 auth.plugin.ini.php22 ! config.ini.php 23 ! auth.plugin.ini.php 24 24 cd demoxul/var/config/xmlrpc 25 auth.plugin.ini.php26 config.ini.php25 ! auth.plugin.ini.php 26 ! config.ini.php 27 27 28 28 cd temp/demoxul trunk/build/manifests/jelix-lib.mn
r296 r297 29 29 30 30 cd lib/jelix/core 31 defaultconfig.ini.php 32 jConfig.class.php 31 ! defaultconfig.ini.php 33 32 jConfigCompiler.class.php 34 jContext.class.php35 jController.class.php36 jCoordinator.class.php37 jErrorHandler.lib.php38 jException.lib.php39 jIncluder.class.php40 jIPlugin.iface.php41 jLocale.class.php42 jRequest.class.php43 jResponse.class.php44 jSelector.class.php45 33 46 34 cd lib/jelix/core/request … … 70 58 71 59 cd lib/jelix/core/url 72 jUrl.class.php73 60 jUrlCompiler.significant.class.php 74 61 jUrlEngine.significant.class.php … … 113 100 114 101 cd lib/jelix/forms 115 jForms.class.php116 jFormsBase.class.php117 jFormsCompiler.class.php118 jFormsControl.class.php119 jFormsDataContainer.class.php120 jFormsDatasource.class.php102 jForms.class.php 103 jFormsBase.class.php 104 jFormsCompiler.class.php 105 jFormsControl.class.php 106 jFormsDataContainer.class.php 107 jFormsDatasource.class.php 121 108 122 109 cd lib/jelix/tpl/ … … 177 164 jFile.class.php 178 165 jIniFile.class.php 179 jJsonRpc.class.php166 * jJsonRpc.class.php 180 167 jLog.class.php 181 168 jWiki.class.php … … 188 175 jSmtp.class.php 189 176 * jFilter.class.php 190 191 cd lib/json192 JSON.php193 LICENSE194 177 195 178 cd lib/jelix-modules … … 229 212 auth.UTF-8.properties 230 213 cd lib/jelix-modules/jelix/controllers 231 help.cmdline.php232 error.classic.php233 error.xul.php234 error.jsonrpc.php235 error.xmlrpc.php236 error.rdf.php214 ! help.cmdline.php 215 ! error.classic.php 216 ! error.xul.php 217 ! error.jsonrpc.php 218 ! error.xmlrpc.php 219 ! error.rdf.php 237 220 cd lib/jelix-modules/jelix/templates 238 221 404.xul.tpl … … 244 227 events.xml 245 228 cd lib/jelix-modules/jxauth/plugins/auth 246 auth.plugin.php229 ! auth.plugin.php 247 230 plugin.xml 248 231 auth.plugin.ini.php.dist … … 263 246 install.datas.mysql.sql 264 247 cd lib/jelix-modules/jxauth/classes 265 auth.listener.php248 ! auth.listener.php 266 249 cd lib/jelix-modules/jxauth/controllers 267 login.classic.php268 loginsw.classic.php269 login.jsonrpc.php270 xuladmin.classic.php271 admin.jsonrpc.php272 admin.rdf.php250 ! login.classic.php 251 ! loginsw.classic.php 252 ! login.jsonrpc.php 253 ! xuladmin.classic.php 254 ! admin.jsonrpc.php 255 ! admin.rdf.php 273 256 cd lib/jelix-modules/jxauth/zones 274 loginform.zone.php257 ! loginform.zone.php 275 258 cd lib/jelix-modules/jxauth/templates 276 259 login.form.tpl … … 285 268 events.xml 286 269 cd lib/jelix-modules/jxacl/classes 287 acl.listener.php288 aclservice.class.php270 ! acl.listener.php 271 ! aclservice.class.php 289 272 cd lib/jelix-modules/jxacl/controllers 290 xuladmin.classic.php291 admin.rdf.php292 admin.jsonrpc.php293 admin.classic.php273 ! xuladmin.classic.php 274 ! admin.rdf.php 275 ! admin.jsonrpc.php 276 ! admin.classic.php 294 277 cd lib/jelix-modules/jxacl/daos 295 278 jaclgroup.dao.xml … … 318 301 CREDITS 319 302 cd lib/jelix-plugins/magicquotes 320 magicquotes.plugin.php303 ! magicquotes.plugin.php 321 304 plugin.xml 322 305 cd lib/jelix-plugins/autolocale 323 306 autolocale.plugin.ini.php.dist 324 autolocale.plugin.php307 ! autolocale.plugin.php 325 308 plugin.xml 326 309 … … 344 327 345 328 cd lib/diff 346 difflib.php347 diffhtml.php329 ! difflib.php 330 ! diffhtml.php 348 331 README 349 332 … … 352 335 CREDITS 353 336 LICENCE 354 WikiRenderer.lib.php337 ! WikiRenderer.lib.php 355 338 356 339 cd lib/wikirenderer/rules 357 wr3_to_xhtml.php358 classicwr_to_text.php359 classicwr_to_xhtml.php360 classicwr_to_wr3.php361 wr3_to_text.php340 ! wr3_to_xhtml.php 341 ! classicwr_to_text.php 342 ! classicwr_to_xhtml.php 343 ! classicwr_to_wr3.php 344 ! wr3_to_text.php trunk/build/tests/ppdatas/result_include1.txt
r233 r297 17 17 18 18 19 19 20 ggggg 20 21 trunk/build/tests/testpreprocess.php
r292 r297 15 15 require_once(dirname(__FILE__).'/../../lib/simpletest/unit_tester.php'); 16 16 require_once(dirname(__FILE__).'/../../lib/simpletest/reporter.php'); 17 require_once(dirname(__FILE__).'/../../lib/diff/difflib.php'); 17 18 18 19 define('PP_DATA_DIR','ppdatas/'); … … 72 73 73 74 75 protected $testcase2 = array( 76 'source2.txt'=>array( 77 'result2_1.txt'=>array('FOO'=>''), 78 'result2_2.txt'=>array('FOO'=>true), 79 ), 80 'source3.txt'=>array( 81 'result3_1.txt'=>array('FOO'=>''), 82 'result3_2.txt'=>array('FOO'=>true), 83 ), 84 'source4.txt'=>array( 85 'result4_1.txt'=>array('FOO'=>'', 'BAR'=>''), 86 'result4_2.txt'=>array('FOO'=>true, 'BAR'=>''), 87 'result4_3.txt'=>array('BAR'=>true, 'FOO'=>''), 88 'result4_4.txt'=>array('FOO'=>true, 'BAR'=>true), 89 ), 90 'source5.txt' =>array( 91 'result5_1.txt'=>array('FOO'=>'', 'BAR'=>''), 92 'result5_2.txt'=>array('FOO'=>"une variable foo", "BAR"=>"le bar est ouvert"), 93 ), 94 'source6.txt'=>array( 95 'result6_1.txt'=>array('FOO'=>'', 'BAR'=>''), 96 'result6_2.txt'=>array('FOO'=>true), 97 'result6_3.txt'=>array('BAR'=>true), 98 'result6_4.txt'=>array('FOO'=>true, 'BAR'=>true), 99 ), 100 'source7.txt'=>array( 101 'result7_1.txt'=>array('FOO'=>'', 'BAR'=>'', 'BAZ'=>''), 102 'result7_2.txt'=>array('FOO'=>true, 'BAR'=>'', 'BAZ'=>''), 103 'result7_3.txt'=>array('BAR'=>true, 'FOO'=>''), 104 'result7_4.txt'=>array('BAZ'=>true), 105 'result7_5.txt'=>array('BAZ'=>true, 'BAR'=>true), 106 ), 107 ); 108 109 110 74 111 function __construct() { 75 112 $this->UnitTestCase(); … … 89 126 $proc->setVars($vars); 90 127 $res = $proc->parseFile(PP_DATA_DIR.$source); 91 $this->assertEqual($res, file_get_contents(PP_DATA_DIR.$result)); 128 if(!$this->assertEqual($res, file_get_contents(PP_DATA_DIR.$result), "test $source / $result ")){ 129 $this->showDiff(file_get_contents(PP_DATA_DIR.$result), $res); 130 } 131 } 132 } 133 } 134 135 function testSimple2(){ 136 $proc = new jPreProcessor(); 137 foreach($this->testcase2 as $source=>$datas){ 138 foreach($datas as $result=>$vars){ 139 $proc->setVars($vars); 140 $res = $proc->parseFile(PP_DATA_DIR.$source); 141 if(!$this->assertEqual($res, file_get_contents(PP_DATA_DIR.$result), "test $source / $result ")){ 142 $this->showDiff(file_get_contents(PP_DATA_DIR.$result), $res); 143 } 92 144 } 93 145 } … … 142 194 } 143 195 144 196 protected function showDiff($str1, $str2){ 197 $diff = new Diff(explode("\n",$str1),explode("\n",$str2)); 198 199 if($diff->isEmpty()) { 200 $this->fail("No difference ???"); 201 }else{ 202 $fmt = new UnifiedDiffFormatter(); 203 $this->fail($fmt->format($diff)); 204 } 205 } 145 206 146 207 } trunk/lib/jelix/init.php
r248 r297 47 47 error_reporting (E_ALL); 48 48 49 #ifdef ENABLE_OPTIMIZE 50 51 #includephp core/jErrorHandler.lib.php 52 #includephp core/jException.lib.php 53 #includephp core/jContext.class.php 54 #includephp core/jConfig.class.php 55 #includephp core/jSelector.class.php 56 #includephp core/url/jUrl.class.php 57 #includephp core/jCoordinator.class.php 58 #includephp core/jController.class.php 59 #includephp core/jRequest.class.php 60 #includephp core/jResponse.class.php 61 #includephp core/jLocale.class.php 62 #includephp core/jIncluder.class.php 63 #includephp core/jIPlugin.iface.php 64 65 #else 66 49 67 // chargement du coeur 50 68 require_once (JELIX_LIB_CORE_PATH . 'jErrorHandler.lib.php'); … … 61 79 require_once (JELIX_LIB_CORE_PATH . 'jIncluder.class.php'); 62 80 require_once (JELIX_LIB_CORE_PATH . 'jIPlugin.iface.php'); 81 82 #endif 83 63 84 64 85 /** … … 112 133 } 113 134 114 //if(file_exists($f)){ 115 require_once($f); 116 //} 135 #ifdef ENABLE_OPTIMIZE 136 require_once($f); 137 #else 138 if(file_exists($f)){ 139 require_once($f); 140 }else{ 141 throw new Exception("Jelix fatal error : Unknow class $class"); 142 } 143 #endif 117 144 118 145 } trunk/lib/jelix/utils/jFilter.class.php
r290 r297 20 20 21 21 static public function usePhpFilter(){ 22 #ifdef PHP5222 #ifdef ENABLE_PHP_FILTER 23 23 return true; 24 24 #else … … 35 35 */ 36 36 static public function isInt ($val, $min=null, $max=null){ 37 #ifdef PHP5237 #ifdef ENABLE_PHP_FILTER 38 38 // @FIXME pas de doc sur la fa� d'utiliser les min/max sur les filters 39 39 if(!filter_var($var, FILTER_VALIDATE_INT)) return false; … … 55 55 */ 56 56 static public function isHexInt ($val, $min=null, $max=null){ 57 #ifdef PHP5257 #ifdef ENABLE_PHP_FILTER 58 58 // @FIXME pas de doc sur la fa� d'utiliser les min/max sur les filters 59 59 if(!filter_var($var, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)) return false; … … 74 74 */ 75 75 static public function isBool ($val){ 76 #ifdef PHP5276 #ifdef ENABLE_PHP_FILTER 77 77 return filter_var($var, FILTER_VALIDATE_BOOLEAN); 78 78 #else … … 90 90 */ 91 91 static public function isFloat ($val, $min=null, $max=null){ 92 #ifdef PHP5292 #ifdef ENABLE_PHP_FILTER 93 93 // @FIXME pas de doc sur la fa� d'utiliser les min/max sur les filters 94 94 if(!filter_var($var, FILTER_VALIDATE_FLOAT)) return false; … … 110 110 $hostRequired=false, $pathRequired=false, 111 111 $queryRequired=false ){ 112 #ifdef PHP52112 #ifdef ENABLE_PHP_FILTER 113 113 $flag=0; 114 114 if($schemeRequired) $flag |= FILTER_FLAG_SCHEME_REQUIRED; … … 138 138 */ 139 139 static public function isIPv4 ($val){ 140 #ifdef PHP52140 #ifdef ENABLE_PHP_FILTER 141 141 return filter_var($var, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); 142 142 #else … … 156 156 */ 157 157 static public function isIPv6 ($val){ 158 #ifdef PHP52158 #ifdef ENABLE_PHP_FILTER 159 159 return filter_var($var, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); 160 160 #else trunk/lib/jelix/utils/jJsonRpc.class.php
r248 r297 3 3 * @package jelix 4 4 * @subpackage utils 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 6 * @contributor … … 11 10 */ 12 11 12 #ifndef ENABLE_PHP_JSON 13 13 /** 14 14 * 15 15 */ 16 16 require_once (LIB_PATH.'json/JSON.php'); 17 17 #endif 18 18 /** 19 * objet permettant d'encoder/d�der des request/responses Json-RPC 20 * pour les specs, voir http://json-rpc.org/index.xhtml 19 * object which encode and decode a jsonrpc request and response 21 20 * @package jelix 22 21 * @subpackage utils 22 * @link http://json-rpc.org/index.xhtml 23 23 */ 24 24 class jJsonRpc { … … 27 27 28 28 /** 29 * 29 * decode a request of json xmlrpc 30 30 * @param string $content 31 31 * @return mixed … … 33 33 public static function decodeRequest($content){ 34 34 // {method:.. , params:.. , id:.. } 35 #ifdef ENABLE_PHP_JSON 36 $obj = json_decode($content); 37 #else 35 38 $json = new JSON(JSON_LOOSE_TYPE); 36 37 39 $obj = $json->decode($content); 38 40 /* … … 40 42 $obj->params 41 43 $obj->id*/ 42 return $obj; //array($methodname, $params); 44 #endif 45 return $obj; 43 46 } 44 47 45 48 /** 46 * 47 * @param string $methodname 48 * @param array $params 49 * @return string 49 * create a request content for a jsonrpc call 50 * @param string $methodname method of the jsonrcp web service 51 * @param array $params parameters for the methods 52 * @return string jsonrcp request content 50 53 */ 51 54 public static function encodeRequest($methodname, $params, $id=1){ 55 56 #ifdef ENABLE_PHP_JSON 57 return '{"method":"'.$methodname.'","params":'.json_encode($params).',"id":'.json_encode($id).'}'; 58 #else 52 59 $json = new JSON(); 53 $request = '{"method":"'.$methodname.'","params":'.$json->encode($params).',"id":'.$json->encode($id).'}'; 54 return $request; 60 return '{"method":"'.$methodname.'","params":'.$json->encode($params).',"id":'.$json->encode($id).'}'; 61 #endif 62 55 63 } 56 64 57 65 /** 58 * 59 * @param 60 * @return 66 * decode a jsonrpc response 67 * @param string $content 68 * @return mixed decoded content 61 69 */ 62 70 public static function decodeResponse($content){ 63 71 // {result:.. , error:.. , id:.. } 72 #ifdef ENABLE_PHP_JSON 73 return json_decode($content); 74 #else 64 75 $json = new JSON(JSON_LOOSE_TYPE); 76 return $json->decode($content); 77 #endif 65 78 66 $response = $json->decode($content);67 return $response;68 79 } 69 80 70 81 /** 71 * 72 * @param 73 * @return 82 * encode a jsonrpc response 83 * @param array $params returned value 84 * @return string encoded response 74 85 */ 75 86 public static function encodeResponse($params, $id=1){ 87 #ifdef ENABLE_PHP_JSON 88 return '{"result":'.json_encode($params).',"error":null,"id":'.json_encode($id).'}'; 89 #else 76 90 $json = new JSON(); 77 $request ='{"result":'.$json->encode($params).',"error":null,"id":'.$json->encode($id).'}';78 return $request; 91 return '{"result":'.$json->encode($params).',"error":null,"id":'.$json->encode($id).'}'; 92 #endif 79 93 } 80 94 81 95 /** 82 * 83 * @param 84 * @return 96 * encode a jsonrpc error response 97 * @param int $code code error 98 * @param string $message error message 99 * @return string encoded response 85 100 */ 86 101 public static function encodeFaultResponse($code, $message, $id=1){ 102 #ifdef ENABLE_PHP_JSON 103 return '{"result":null,"error":{"code": '.json_encode($code).', "string":'.json_encode($message).' },"id":'.json_encode($id).'}'; 104 #else 87 105 $json = new JSON(); 88 $request ='{"result":null,"error":{"code": '.$json->encode($code).', "string":'.$json->encode($message).' },"id":'.$json->encode($id).'}';89 return $request; 106 return '{"result":null,"error":{"code": '.$json->encode($code).', "string":'.$json->encode($message).' },"id":'.$json->encode($id).'}'; 107 #endif 90 108 } 91 109 } trunk/Makefile
r294 r297 83 83 nightlies: 84 84 $(PHP) build/buildjelix.php -D $(DISTPATHSWITCH) -D NIGHTLY_NAME=1 build/config/jelix-dist-dev.ini 85 $(PHP) build/buildjelix.php -D $(DISTPATHSWITCH) -D NIGHTLY_NAME=1 build/config/jelix-dist-opt.ini 85 86 $(PHP) build/buildapp.php -D $(DISTPATHSWITCH) -D NIGHTLY_NAME=1 build/config/testapp-dist.ini 86 87 $(PHP) build/buildjbt.php -D $(DISTPATHSWITCH) -D NIGHTLY_NAME=1 build/config/jbt-dist.ini
