@@ -157,7 +157,9 @@ class tpl{
157157 */
158158 public function newTemplate ($ tmplfile )
159159 {
160- if (!$ tfile = $ this ->_fileSearch ($ tmplfile )) vlibTemplateError::raiseError ('VT_ERROR_NOFILE ' ,KILL ,$ tmplfile );
160+ if (!$ tfile = $ this ->_fileSearch ($ tmplfile )){
161+ vlibTemplateError::raiseError ('VT_ERROR_NOFILE ' , KILL , $ tmplfile );
162+ }
161163
162164 //* make sure that any parsing vars are cleared for the new template
163165 $ this ->_tmplfile = null ;
@@ -169,8 +171,9 @@ public function newTemplate($tmplfile)
169171 $ this ->_totalparsetime = null ;
170172
171173 //* reset debug module
172- if ($ this ->_debug ) $ this ->_debugReset ();
173-
174+ if ($ this ->_debug ){
175+ $ this ->_debugReset ();
176+ }
174177 $ this ->_tmplfilename = $ tfile ;
175178 return true ;
176179 }
@@ -253,8 +256,7 @@ public function unsetVar()
253256 */
254257 public function getVars ()
255258 {
256- if (empty ($ this ->_vars )) return false ;
257- return $ this ->_vars ;
259+ return empty ($ this ->_vars ) ? false : $ this ->_vars ;
258260 }
259261
260262 /**
@@ -265,8 +267,7 @@ public function getVars()
265267 public function getVar ($ var )
266268 {
267269 if ($ this ->OPTIONS ['CASELESS ' ]) $ var = strtolower ($ var );
268- if (empty ($ var ) || !isset ($ this ->_vars [$ var ])) return false ;
269- return $ this ->_vars [$ var ];
270+ return (empty ($ var ) || !isset ($ this ->_vars [$ var ])) ? false : $ this ->_vars [$ var ];
270271 }
271272
272273 /**
@@ -304,7 +305,7 @@ public function setLoop($k, $v)
304305 $ this ->_arrvars [$ k ] = array ();
305306 if ($ this ->OPTIONS ['SET_LOOP_VAR ' ] && !empty ($ v )) $ this ->setvar ($ k , 1 );
306307 if (($ this ->_arrvars [$ k ] = $ this ->_arrayBuild ($ v )) == false ) {
307- vlibTemplateError::raiseError ('VT_WARNING_INVALID_ARR ' ,WARNING ,$ k );
308+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_ARR ' , WARNING , $ k );
308309 }
309310 }
310311 return true ;
@@ -323,16 +324,17 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
323324 {
324325 $ db_type = strtoupper ($ db_type );
325326 if (!in_array ($ db_type , $ this ->allowed_loop_dbs )) {
326- vlibTemplateError::raiseError ('VT_WARNING_INVALID_LOOP_DB ' ,WARNING , $ db_type );
327+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_LOOP_DB ' , WARNING , $ db_type );
327328 return false ;
328329 }
329330
330331 $ loop_arr = array ();
332+ // TODO: Are all these necessary as were onyl using mysql and possible postgres ? - pedro
331333 switch ($ db_type ) {
332334
333335 case 'MYSQL ' :
334336 if (get_resource_type ($ result ) != 'mysql result ' ) {
335- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
337+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
336338 return false ;
337339 }
338340 while ($ r = mysql_fetch_assoc ($ result )) {
@@ -342,7 +344,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
342344
343345 case 'POSTGRESQL ' :
344346 if (get_resource_type ($ result ) != 'pgsql result ' ) {
345- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
347+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
346348 return false ;
347349 }
348350
@@ -355,7 +357,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
355357
356358 case 'INFORMIX ' :
357359 if (!$ result ) {
358- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
360+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
359361 return false ;
360362 }
361363 while ($ r = ifx_fetch_row ($ result , 'NEXT ' )) {
@@ -365,7 +367,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
365367
366368 case 'INTERBASE ' :
367369 if (get_resource_type ($ result ) != 'interbase result ' ) {
368- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
370+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
369371 return false ;
370372 }
371373 while ($ r = ibase_fetch_row ($ result )) {
@@ -375,7 +377,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
375377
376378 case 'INGRES ' :
377379 if (!$ result ) {
378- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
380+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
379381 return false ;
380382 }
381383 while ($ r = ingres_fetch_array (INGRES_ASSOC , $ result )) {
@@ -385,7 +387,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
385387
386388 case 'MSSQL ' :
387389 if (get_resource_type ($ result ) != 'mssql result ' ) {
388- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
390+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
389391 return false ;
390392 }
391393 while ($ r = mssql_fetch_array ($ result )) {
@@ -395,7 +397,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
395397
396398 case 'MSQL ' :
397399 if (get_resource_type ($ result ) != 'msql result ' ) {
398- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
400+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
399401 return false ;
400402 }
401403 while ($ r = msql_fetch_array ($ result , MSQL_ASSOC )) {
@@ -405,7 +407,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
405407
406408 case 'OCI8 ' :
407409 if (get_resource_type ($ result ) != 'oci8 statement ' ) {
408- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
410+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
409411 return false ;
410412 }
411413 while (OCIFetchInto ($ result , &$ r , OCI_ASSOC +OCI_RETURN_LOBS )) {
@@ -415,7 +417,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
415417
416418 case 'ORACLE ' :
417419 if (get_resource_type ($ result ) != 'oracle Cursor ' ) {
418- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
420+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
419421 return false ;
420422 }
421423 while (ora_fetch_into ($ result , &$ r , ORA_FETCHINTO_ASSOC )) {
@@ -425,7 +427,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
425427
426428 case 'OVRIMOS ' :
427429 if (!$ result ) {
428- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
430+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
429431 return false ;
430432 }
431433 while (ovrimos_fetch_into ($ result , &$ r , 'NEXT ' )) {
@@ -435,7 +437,7 @@ public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
435437
436438 case 'SYBASE ' :
437439 if (get_resource_type ($ result ) != 'sybase-db result ' ) {
438- vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' ,WARNING , $ db_type );
440+ vlibTemplateError::raiseError ('VT_WARNING_INVALID_RESOURCE ' , WARNING , $ db_type );
439441 return false ;
440442 }
441443
@@ -477,7 +479,7 @@ public function addRow($row, $loopname = null)
477479 if (!$ loopname ) $ loopname = $ this ->_currloopname [(count ($ this ->_currloopname )-1 )];
478480
479481 if (!isset ($ this ->_currloop [$ loopname ]) || empty ($ this ->_currloopname )) {
480- vlibTemplateError::raiseError ('VT_WARNING_LOOP_NOT_SET ' ,WARNING );
482+ vlibTemplateError::raiseError ('VT_WARNING_LOOP_NOT_SET ' , WARNING );
481483 return false ;
482484 }
483485 if (is_array ($ row )) {
@@ -795,7 +797,9 @@ private function _getData ($tmplfile, $do_eval=false)
795797 if ($ this ->_includedepth > $ this ->OPTIONS ['MAX_INCLUDES ' ] || $ tmplfile == false ) {
796798 return ;
797799 } else {
798- if ($ this ->_debug ) array_push ($ this ->_debugIncludedfiles , $ tmplfile );
800+ if ($ this ->_debug ){
801+ array_push ($ this ->_debugIncludedfiles , $ tmplfile );
802+ }
799803 if ($ do_eval ) {
800804 array_push ($ this ->_currentincludedir , dirname ($ tmplfile ));
801805 $ this ->_includedepth ++;
0 commit comments