Passed
Branch master (a3c0d0)
by Cody
02:54
created
lib/phpqrcode/tools/merged_config.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,4 +14,4 @@
 block discarded – undo
14 14
     define('QR_DEFAULT_MASK', 2);                                                               // when QR_FIND_BEST_MASK === false
15 15
                                                   
16 16
     define('QR_PNG_MAXIMUM_SIZE',  1024);                                                       // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
17
-                                                  
18 17
\ No newline at end of file
18
+                                                    
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
lib/phpqrcode/phpqrcode.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -74,32 +74,32 @@  discard block
 block discarded – undo
74 74
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
75 75
  */
76 76
  
77
-	// Encoding modes
77
+    // Encoding modes
78 78
 	 
79
-	define('QR_MODE_NUL', -1);
80
-	define('QR_MODE_NUM', 0);
81
-	define('QR_MODE_AN', 1);
82
-	define('QR_MODE_8', 2);
83
-	define('QR_MODE_KANJI', 3);
84
-	define('QR_MODE_STRUCTURE', 4);
85
-
86
-	// Levels of error correction.
87
-
88
-	define('QR_ECLEVEL_L', 0);
89
-	define('QR_ECLEVEL_M', 1);
90
-	define('QR_ECLEVEL_Q', 2);
91
-	define('QR_ECLEVEL_H', 3);
79
+    define('QR_MODE_NUL', -1);
80
+    define('QR_MODE_NUM', 0);
81
+    define('QR_MODE_AN', 1);
82
+    define('QR_MODE_8', 2);
83
+    define('QR_MODE_KANJI', 3);
84
+    define('QR_MODE_STRUCTURE', 4);
85
+
86
+    // Levels of error correction.
87
+
88
+    define('QR_ECLEVEL_L', 0);
89
+    define('QR_ECLEVEL_M', 1);
90
+    define('QR_ECLEVEL_Q', 2);
91
+    define('QR_ECLEVEL_H', 3);
92 92
 	
93
-	// Supported output formats
93
+    // Supported output formats
94 94
 	
95
-	define('QR_FORMAT_TEXT', 0);
96
-	define('QR_FORMAT_PNG',  1);
95
+    define('QR_FORMAT_TEXT', 0);
96
+    define('QR_FORMAT_PNG',  1);
97 97
 	
98
-	class qrstr {
99
-		public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
100
-			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
101
-		}
102
-	}	
98
+    class qrstr {
99
+        public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
100
+            $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
101
+        }
102
+    }	
103 103
 
104 104
 
105 105
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
         //----------------------------------------------------------------------
212 212
         public static function buildCache()
213 213
         {
214
-			QRtools::markTime('before_build_cache');
214
+            QRtools::markTime('before_build_cache');
215 215
 			
216
-			$mask = new QRmask();
216
+            $mask = new QRmask();
217 217
             for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
218 218
                 $frame = QRspec::newFrame($a);
219 219
                 if (QR_IMAGE) {
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
                     QRimage::png(self::binarize($frame), $fileName, 1, 0);
222 222
                 }
223 223
 				
224
-				$width = count($frame);
225
-				$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
226
-				for ($maskNo=0; $maskNo<8; $maskNo++)
227
-					$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
224
+                $width = count($frame);
225
+                $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
226
+                for ($maskNo=0; $maskNo<8; $maskNo++)
227
+                    $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
228 228
             }
229 229
 			
230
-			QRtools::markTime('after_build_cache');
230
+            QRtools::markTime('after_build_cache');
231 231
         }
232 232
 
233 233
         //----------------------------------------------------------------------
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 
648 648
         // Version information pattern -----------------------------------------
649 649
 
650
-		// Version information pattern (BCH coded).
650
+        // Version information pattern (BCH coded).
651 651
         // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
652 652
         
653
-		// size: [QRSPEC_VERSION_MAX - 6]
653
+        // size: [QRSPEC_VERSION_MAX - 6]
654 654
 		
655 655
         public static $versionPattern = array(
656 656
             0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1436 1436
             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1437 1437
             36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
1438
-             0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 44, -1, -1, -1, -1, -1,
1438
+                0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 44, -1, -1, -1, -1, -1,
1439 1439
             -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1440 1440
             25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
1441 1441
             -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -2497,17 +2497,17 @@  discard block
 block discarded – undo
2497 2497
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2498 2498
  */
2499 2499
  
2500
-	define('N1', 3);
2501
-	define('N2', 3);
2502
-	define('N3', 40);
2503
-	define('N4', 10);
2500
+    define('N1', 3);
2501
+    define('N2', 3);
2502
+    define('N3', 40);
2503
+    define('N4', 10);
2504 2504
 
2505
-	class QRmask {
2505
+    class QRmask {
2506 2506
 	
2507
-		public $runLength = array();
2507
+        public $runLength = array();
2508 2508
 		
2509
-		//----------------------------------------------------------------------
2510
-		public function __construct() 
2509
+        //----------------------------------------------------------------------
2510
+        public function __construct() 
2511 2511
         {
2512 2512
             $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
2513 2513
         }
Please login to merge, or discard this patch.
lib/phpqrcode/qrconst.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,29 +26,29 @@
 block discarded – undo
26 26
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 27
  */
28 28
  
29
-	// Encoding modes
29
+    // Encoding modes
30 30
 	 
31
-	define('QR_MODE_NUL', -1);
32
-	define('QR_MODE_NUM', 0);
33
-	define('QR_MODE_AN', 1);
34
-	define('QR_MODE_8', 2);
35
-	define('QR_MODE_KANJI', 3);
36
-	define('QR_MODE_STRUCTURE', 4);
31
+    define('QR_MODE_NUL', -1);
32
+    define('QR_MODE_NUM', 0);
33
+    define('QR_MODE_AN', 1);
34
+    define('QR_MODE_8', 2);
35
+    define('QR_MODE_KANJI', 3);
36
+    define('QR_MODE_STRUCTURE', 4);
37 37
 
38
-	// Levels of error correction.
38
+    // Levels of error correction.
39 39
 
40
-	define('QR_ECLEVEL_L', 0);
41
-	define('QR_ECLEVEL_M', 1);
42
-	define('QR_ECLEVEL_Q', 2);
43
-	define('QR_ECLEVEL_H', 3);
40
+    define('QR_ECLEVEL_L', 0);
41
+    define('QR_ECLEVEL_M', 1);
42
+    define('QR_ECLEVEL_Q', 2);
43
+    define('QR_ECLEVEL_H', 3);
44 44
 	
45
-	// Supported output formats
45
+    // Supported output formats
46 46
 	
47
-	define('QR_FORMAT_TEXT', 0);
48
-	define('QR_FORMAT_PNG',  1);
47
+    define('QR_FORMAT_TEXT', 0);
48
+    define('QR_FORMAT_PNG',  1);
49 49
 	
50
-	class qrstr {
51
-		public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
52
-			$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
53
-		}
54
-	}	
55 50
\ No newline at end of file
51
+    class qrstr {
52
+        public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
53
+            $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
54
+        }
55
+    }	
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
lib/phpqrcode/qrspec.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -335,10 +335,10 @@
 block discarded – undo
335 335
 
336 336
         // Version information pattern -----------------------------------------
337 337
 
338
-		// Version information pattern (BCH coded).
338
+        // Version information pattern (BCH coded).
339 339
         // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
340 340
         
341
-		// size: [QRSPEC_VERSION_MAX - 6]
341
+        // size: [QRSPEC_VERSION_MAX - 6]
342 342
 		
343 343
         public static $versionPattern = array(
344 344
             0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
Please login to merge, or discard this patch.
lib/phpqrcode/qrmask.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 26
  */
27 27
  
28
-	define('N1', 3);
29
-	define('N2', 3);
30
-	define('N3', 40);
31
-	define('N4', 10);
28
+    define('N1', 3);
29
+    define('N2', 3);
30
+    define('N3', 40);
31
+    define('N4', 10);
32 32
 
33
-	class QRmask {
33
+    class QRmask {
34 34
 	
35
-		public $runLength = array();
35
+        public $runLength = array();
36 36
 		
37
-		//----------------------------------------------------------------------
38
-		public function __construct() 
37
+        //----------------------------------------------------------------------
38
+        public function __construct() 
39 39
         {
40 40
             $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
41 41
         }
Please login to merge, or discard this patch.
lib/MiniTemplator.class.php 1 patch
Indentation   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 * @access public
162 162
 */
163 163
 function __construct() {
164
-   $this->templateValid = false; }
164
+    $this->templateValid = false; }
165 165
 
166 166
 //--- template string handling --------------------------------------------------------------------------------------
167 167
 
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 * @access public
173 173
 */
174 174
 function readTemplateFromFile ($fileName) {
175
-   if (!$this->readFileIntoString($fileName,$s)) {
176
-      $this->triggerError ("Error while reading template file " . $fileName . ".");
177
-      return false; }
178
-   if (!$this->setTemplateString($s)) return false;
179
-   return true; }
175
+    if (!$this->readFileIntoString($fileName,$s)) {
176
+        $this->triggerError ("Error while reading template file " . $fileName . ".");
177
+        return false; }
178
+    if (!$this->setTemplateString($s)) return false;
179
+    return true; }
180 180
 
181 181
 /**
182 182
 * Assigns a new template string.
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 * @access public
186 186
 */
187 187
 function setTemplateString ($templateString) {
188
-   $this->templateValid = false;
189
-   $this->template = $templateString;
190
-   if (!$this->parseTemplate()) return false;
191
-   $this->reset();
192
-   $this->templateValid = true;
193
-   return true; }
188
+    $this->templateValid = false;
189
+    $this->template = $templateString;
190
+    if (!$this->parseTemplate()) return false;
191
+    $this->reset();
192
+    $this->templateValid = true;
193
+    return true; }
194 194
 
195 195
 /**
196 196
 * Loads the template string for a subtemplate (used for the $Include command).
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 * @access private
199 199
 */
200 200
 function loadSubtemplate ($subtemplateName, &$s) {
201
-   $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath,$subtemplateName);
202
-   if (!$this->readFileIntoString($subtemplateFileName,$s)) {
203
-      $this->triggerError ("Error while reading subtemplate file " . $subtemplateFileName . ".");
204
-      return false; }
205
-   return true; }
201
+    $subtemplateFileName = $this->combineFileSystemPath($this->subtemplateBasePath,$subtemplateName);
202
+    if (!$this->readFileIntoString($subtemplateFileName,$s)) {
203
+        $this->triggerError ("Error while reading subtemplate file " . $subtemplateFileName . ".");
204
+        return false; }
205
+    return true; }
206 206
 
207 207
 //--- template parsing ----------------------------------------------------------------------------------------------
208 208
 
@@ -212,28 +212,28 @@  discard block
 block discarded – undo
212 212
 * @access private
213 213
 */
214 214
 function parseTemplate() {
215
-   $this->initParsing();
216
-   $this->beginMainBlock();
217
-   if (!$this->parseTemplateCommands()) return false;
218
-   $this->endMainBlock();
219
-   if (!$this->checkBlockDefinitionsComplete()) return false;
220
-   if (!$this->parseTemplateVariables()) return false;
221
-   $this->associateVariablesWithBlocks();
222
-   return true; }
215
+    $this->initParsing();
216
+    $this->beginMainBlock();
217
+    if (!$this->parseTemplateCommands()) return false;
218
+    $this->endMainBlock();
219
+    if (!$this->checkBlockDefinitionsComplete()) return false;
220
+    if (!$this->parseTemplateVariables()) return false;
221
+    $this->associateVariablesWithBlocks();
222
+    return true; }
223 223
 
224 224
 /**
225 225
 * @access private
226 226
 */
227 227
 function initParsing() {
228
-   $this->varTab = array();
229
-   $this->varTabCnt = 0;
230
-   $this->varNameToNoMap = array();
231
-   $this->varRefTab = array();
232
-   $this->varRefTabCnt = 0;
233
-   $this->blockTab = array();
234
-   $this->blockTabCnt = 0;
235
-   $this->blockNameToNoMap = array();
236
-   $this->openBlocksTab = array(); }
228
+    $this->varTab = array();
229
+    $this->varTabCnt = 0;
230
+    $this->varNameToNoMap = array();
231
+    $this->varRefTab = array();
232
+    $this->varRefTabCnt = 0;
233
+    $this->blockTab = array();
234
+    $this->blockTabCnt = 0;
235
+    $this->blockNameToNoMap = array();
236
+    $this->openBlocksTab = array(); }
237 237
 
238 238
 /**
239 239
 * Registers the main block.
@@ -241,27 +241,27 @@  discard block
 block discarded – undo
241 241
 * @access private
242 242
 */
243 243
 function beginMainBlock() {
244
-   $blockNo = 0;
245
-   $this->registerBlock('@@InternalMainBlock@@', $blockNo);
246
-   $bte =& $this->blockTab[$blockNo];
247
-   $bte['tPosBegin'] = 0;
248
-   $bte['tPosContentsBegin'] = 0;
249
-   $bte['nestingLevel'] = 0;
250
-   $bte['parentBlockNo'] = -1;
251
-   $bte['definitionIsOpen'] = true;
252
-   $this->openBlocksTab[0] = $blockNo;
253
-   $this->currentNestingLevel = 1; }
244
+    $blockNo = 0;
245
+    $this->registerBlock('@@InternalMainBlock@@', $blockNo);
246
+    $bte =& $this->blockTab[$blockNo];
247
+    $bte['tPosBegin'] = 0;
248
+    $bte['tPosContentsBegin'] = 0;
249
+    $bte['nestingLevel'] = 0;
250
+    $bte['parentBlockNo'] = -1;
251
+    $bte['definitionIsOpen'] = true;
252
+    $this->openBlocksTab[0] = $blockNo;
253
+    $this->currentNestingLevel = 1; }
254 254
 
255 255
 /**
256 256
 * Completes the main block registration.
257 257
 * @access private
258 258
 */
259 259
 function endMainBlock() {
260
-   $bte =& $this->blockTab[0];
261
-   $bte['tPosContentsEnd'] = strlen($this->template);
262
-   $bte['tPosEnd'] = strlen($this->template);
263
-   $bte['definitionIsOpen'] = false;
264
-   $this->currentNestingLevel -= 1; }
260
+    $bte =& $this->blockTab[0];
261
+    $bte['tPosContentsEnd'] = strlen($this->template);
262
+    $bte['tPosEnd'] = strlen($this->template);
263
+    $bte['definitionIsOpen'] = false;
264
+    $this->currentNestingLevel -= 1; }
265 265
 
266 266
 /**
267 267
 * Parses commands within the template in the format "<!-- $command parameters -->".
@@ -269,46 +269,46 @@  discard block
 block discarded – undo
269 269
 * @access private
270 270
 */
271 271
 function parseTemplateCommands() {
272
-   $p = 0;
273
-   while (true) {
274
-      $p0 = strpos($this->template,'<!--',$p);
275
-      if ($p0 === false) break;
276
-      $p = strpos($this->template,'-->',$p0);
277
-      if ($p === false) {
278
-         $this->triggerError ("Invalid HTML comment in template at offset $p0.");
279
-         return false; }
280
-      $p += 3;
281
-      $cmdL = substr($this->template,$p0+4,$p-$p0-7);
282
-      if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart))
283
-         return false;
284
-      if ($resumeFromStart) $p = $p0; }
285
-   return true; }
272
+    $p = 0;
273
+    while (true) {
274
+        $p0 = strpos($this->template,'<!--',$p);
275
+        if ($p0 === false) break;
276
+        $p = strpos($this->template,'-->',$p0);
277
+        if ($p === false) {
278
+            $this->triggerError ("Invalid HTML comment in template at offset $p0.");
279
+            return false; }
280
+        $p += 3;
281
+        $cmdL = substr($this->template,$p0+4,$p-$p0-7);
282
+        if (!$this->processTemplateCommand($cmdL,$p0,$p,$resumeFromStart))
283
+            return false;
284
+        if ($resumeFromStart) $p = $p0; }
285
+    return true; }
286 286
 
287 287
 /**
288 288
 * @return boolean  true on success, false on error.
289 289
 * @access private
290 290
 */
291 291
 function processTemplateCommand ($cmdL, $cmdTPosBegin, $cmdTPosEnd, &$resumeFromStart) {
292
-   $resumeFromStart = false;
293
-   $p = 0;
294
-   $cmd = '';
295
-   if (!$this->parseWord($cmdL,$p,$cmd)) return true;
296
-   $parms = substr($cmdL,$p);
297
-   switch (strtoupper($cmd)) {
298
-      case '$BEGINBLOCK':
292
+    $resumeFromStart = false;
293
+    $p = 0;
294
+    $cmd = '';
295
+    if (!$this->parseWord($cmdL,$p,$cmd)) return true;
296
+    $parms = substr($cmdL,$p);
297
+    switch (strtoupper($cmd)) {
298
+        case '$BEGINBLOCK':
299 299
          if (!$this->processBeginBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
300 300
             return false;
301
-         break;
302
-      case '$ENDBLOCK':
301
+            break;
302
+        case '$ENDBLOCK':
303 303
          if (!$this->processEndBlockCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
304 304
             return false;
305
-         break;
306
-      case '$INCLUDE':
305
+            break;
306
+        case '$INCLUDE':
307 307
          if (!$this->processincludeCmd($parms,$cmdTPosBegin,$cmdTPosEnd))
308 308
             return false;
309
-         $resumeFromStart = true;
310
-         break;
311
-      default:
309
+            $resumeFromStart = true;
310
+            break;
311
+        default:
312 312
          if ($cmd{0} == '$' && !(strlen($cmd) >= 2 && $cmd{1} == '{')) {
313 313
             $this->triggerError ("Unknown command \"$cmd\" in template at offset $cmdTPosBegin.");
314 314
             return false; }}
@@ -320,25 +320,25 @@  discard block
 block discarded – undo
320 320
 * @access private
321 321
 */
322 322
 function processBeginBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
323
-   $p = 0;
324
-   if (!$this->parseWord($parms,$p,$blockName)) {
325
-      $this->triggerError ("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
326
-      return false; }
327
-   if (trim(substr($parms,$p)) != '') {
328
-      $this->triggerError ("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
329
-      return false; }
330
-   $this->registerBlock ($blockName, $blockNo);
331
-   $btr =& $this->blockTab[$blockNo];
332
-   $btr['tPosBegin'] = $cmdTPosBegin;
333
-   $btr['tPosContentsBegin'] = $cmdTPosEnd;
334
-   $btr['nestingLevel'] = $this->currentNestingLevel;
335
-   $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel-1];
336
-   $this->openBlocksTab[$this->currentNestingLevel] = $blockNo;
337
-   $this->currentNestingLevel += 1;
338
-   if ($this->currentNestingLevel > $this->maxNestingLevel) {
339
-      $this->triggerError ("Block nesting overflow in template at offset $cmdTPosBegin.");
340
-      return false; }
341
-   return true; }
323
+    $p = 0;
324
+    if (!$this->parseWord($parms,$p,$blockName)) {
325
+        $this->triggerError ("Missing block name in \$BeginBlock command in template at offset $cmdTPosBegin.");
326
+        return false; }
327
+    if (trim(substr($parms,$p)) != '') {
328
+        $this->triggerError ("Extra parameter in \$BeginBlock command in template at offset $cmdTPosBegin.");
329
+        return false; }
330
+    $this->registerBlock ($blockName, $blockNo);
331
+    $btr =& $this->blockTab[$blockNo];
332
+    $btr['tPosBegin'] = $cmdTPosBegin;
333
+    $btr['tPosContentsBegin'] = $cmdTPosEnd;
334
+    $btr['nestingLevel'] = $this->currentNestingLevel;
335
+    $btr['parentBlockNo'] = $this->openBlocksTab[$this->currentNestingLevel-1];
336
+    $this->openBlocksTab[$this->currentNestingLevel] = $blockNo;
337
+    $this->currentNestingLevel += 1;
338
+    if ($this->currentNestingLevel > $this->maxNestingLevel) {
339
+        $this->triggerError ("Block nesting overflow in template at offset $cmdTPosBegin.");
340
+        return false; }
341
+    return true; }
342 342
 
343 343
 /**
344 344
 * Processes the $EndBlock command.
@@ -346,47 +346,47 @@  discard block
 block discarded – undo
346 346
 * @access private
347 347
 */
348 348
 function processEndBlockCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
349
-   $p = 0;
350
-   if (!$this->parseWord($parms,$p,$blockName)) {
351
-      $this->triggerError ("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
352
-      return false; }
353
-   if (trim(substr($parms,$p)) != '') {
354
-      $this->triggerError ("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
355
-      return false; }
356
-   if (!$this->lookupBlockName($blockName,$blockNo)) {
357
-      $this->triggerError ("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
358
-      return false; }
359
-   $this->currentNestingLevel -= 1;
360
-   $btr =& $this->blockTab[$blockNo];
361
-   if (!$btr['definitionIsOpen']) {
362
-      $this->triggerError ("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
363
-      return false; }
364
-   if ($btr['nestingLevel'] != $this->currentNestingLevel) {
365
-      $this->triggerError ("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
366
-      return false; }
367
-   $btr['tPosContentsEnd'] = $cmdTPosBegin;
368
-   $btr['tPosEnd'] = $cmdTPosEnd;
369
-   $btr['definitionIsOpen'] = false;
370
-   return true; }
349
+    $p = 0;
350
+    if (!$this->parseWord($parms,$p,$blockName)) {
351
+        $this->triggerError ("Missing block name in \$EndBlock command in template at offset $cmdTPosBegin.");
352
+        return false; }
353
+    if (trim(substr($parms,$p)) != '') {
354
+        $this->triggerError ("Extra parameter in \$EndBlock command in template at offset $cmdTPosBegin.");
355
+        return false; }
356
+    if (!$this->lookupBlockName($blockName,$blockNo)) {
357
+        $this->triggerError ("Undefined block name \"$blockName\" in \$EndBlock command in template at offset $cmdTPosBegin.");
358
+        return false; }
359
+    $this->currentNestingLevel -= 1;
360
+    $btr =& $this->blockTab[$blockNo];
361
+    if (!$btr['definitionIsOpen']) {
362
+        $this->triggerError ("Multiple \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
363
+        return false; }
364
+    if ($btr['nestingLevel'] != $this->currentNestingLevel) {
365
+        $this->triggerError ("Block nesting level mismatch at \$EndBlock command for block \"$blockName\" in template at offset $cmdTPosBegin.");
366
+        return false; }
367
+    $btr['tPosContentsEnd'] = $cmdTPosBegin;
368
+    $btr['tPosEnd'] = $cmdTPosEnd;
369
+    $btr['definitionIsOpen'] = false;
370
+    return true; }
371 371
 
372 372
 /**
373 373
 * @access private
374 374
 */
375 375
 function registerBlock($blockName, &$blockNo) {
376
-   $blockNo = $this->blockTabCnt++;
377
-   $btr =& $this->blockTab[$blockNo];
378
-   $btr = array();
379
-   $btr['blockName'] = $blockName;
380
-   if (!$this->lookupBlockName($blockName,$btr['nextWithSameName']))
381
-      $btr['nextWithSameName'] = -1;
382
-   $btr['definitionIsOpen'] = true;
383
-   $btr['instances'] = 0;
384
-   $btr['firstBlockInstNo'] = -1;
385
-   $btr['lastBlockInstNo'] = -1;
386
-   $btr['blockVarCnt'] = 0;
387
-   $btr['firstVarRefNo'] = -1;
388
-   $btr['blockVarNoToVarNoMap'] = array();
389
-   $this->blockNameToNoMap[strtoupper($blockName)] = $blockNo; }
376
+    $blockNo = $this->blockTabCnt++;
377
+    $btr =& $this->blockTab[$blockNo];
378
+    $btr = array();
379
+    $btr['blockName'] = $blockName;
380
+    if (!$this->lookupBlockName($blockName,$btr['nextWithSameName']))
381
+        $btr['nextWithSameName'] = -1;
382
+    $btr['definitionIsOpen'] = true;
383
+    $btr['instances'] = 0;
384
+    $btr['firstBlockInstNo'] = -1;
385
+    $btr['lastBlockInstNo'] = -1;
386
+    $btr['blockVarCnt'] = 0;
387
+    $btr['firstVarRefNo'] = -1;
388
+    $btr['blockVarNoToVarNoMap'] = array();
389
+    $this->blockNameToNoMap[strtoupper($blockName)] = $blockNo; }
390 390
 
391 391
 /**
392 392
 * Checks that all block definitions are closed.
@@ -394,15 +394,15 @@  discard block
 block discarded – undo
394 394
 * @access private
395 395
 */
396 396
 function checkBlockDefinitionsComplete() {
397
-   for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
398
-      $btr =& $this->blockTab[$blockNo];
399
-      if ($btr['definitionIsOpen']) {
400
-         $this->triggerError ("Missing \$EndBlock command in template for block " . $btr['blockName'] . ".");
401
-         return false; }}
402
-   if ($this->currentNestingLevel != 0) {
403
-      $this->triggerError ("Block nesting level error at end of template.");
404
-      return false; }
405
-   return true; }
397
+    for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
398
+        $btr =& $this->blockTab[$blockNo];
399
+        if ($btr['definitionIsOpen']) {
400
+            $this->triggerError ("Missing \$EndBlock command in template for block " . $btr['blockName'] . ".");
401
+            return false; }}
402
+    if ($this->currentNestingLevel != 0) {
403
+        $this->triggerError ("Block nesting level error at end of template.");
404
+        return false; }
405
+    return true; }
406 406
 
407 407
 /**
408 408
 * Processes the $Include command.
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
 * @access private
411 411
 */
412 412
 function processIncludeCmd ($parms, $cmdTPosBegin, $cmdTPosEnd) {
413
-   $p = 0;
414
-   if (!$this->parseWordOrQuotedString($parms,$p,$subtemplateName)) {
415
-      $this->triggerError ("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
416
-      return false; }
417
-   if (trim(substr($parms,$p)) != '') {
418
-      $this->triggerError ("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
419
-      return false; }
420
-   return $this->insertSubtemplate($subtemplateName,$cmdTPosBegin,$cmdTPosEnd); }
413
+    $p = 0;
414
+    if (!$this->parseWordOrQuotedString($parms,$p,$subtemplateName)) {
415
+        $this->triggerError ("Missing or invalid subtemplate name in \$Include command in template at offset $cmdTPosBegin.");
416
+        return false; }
417
+    if (trim(substr($parms,$p)) != '') {
418
+        $this->triggerError ("Extra parameter in \$include command in template at offset $cmdTPosBegin.");
419
+        return false; }
420
+    return $this->insertSubtemplate($subtemplateName,$cmdTPosBegin,$cmdTPosEnd); }
421 421
 
422 422
 /**
423 423
 * Processes the $Include command.
@@ -425,14 +425,14 @@  discard block
 block discarded – undo
425 425
 * @access private
426 426
 */
427 427
 function insertSubtemplate ($subtemplateName, $tPos1, $tPos2) {
428
-   if (strlen($this->template) > $this->maxInclTemplateSize) {
429
-      $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
430
-      return false; }
431
-   if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false;
432
-   // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator,
433
-   // a table could be used that contains references to the string fragments.)
434
-   $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2);
435
-   return true; }
428
+    if (strlen($this->template) > $this->maxInclTemplateSize) {
429
+        $this->triggerError ("Subtemplate include aborted because the internal template string is longer than $this->maxInclTemplateSize characters.");
430
+        return false; }
431
+    if (!$this->loadSubtemplate($subtemplateName,$subtemplate)) return false;
432
+    // (Copying the template to insert a subtemplate is a bit slow. In a future implementation of MiniTemplator,
433
+    // a table could be used that contains references to the string fragments.)
434
+    $this->template = substr($this->template,0,$tPos1) . $subtemplate . substr($this->template,$tPos2);
435
+    return true; }
436 436
 
437 437
 /**
438 438
 * Parses variable references within the template in the format "${VarName}".
@@ -440,77 +440,77 @@  discard block
 block discarded – undo
440 440
 * @access private
441 441
 */
442 442
 function parseTemplateVariables() {
443
-   $p = 0;
444
-   while (true) {
445
-      $p = strpos($this->template, '${', $p);
446
-      if ($p === false) break;
447
-      $p0 = $p;
448
-      $p = strpos($this->template, '}', $p);
449
-      if ($p === false) {
450
-         $this->triggerError ("Invalid variable reference in template at offset $p0.");
451
-         return false; }
452
-      $p += 1;
453
-      $varName = trim(substr($this->template, $p0+2, $p-$p0-3));
454
-      if (strlen($varName) == 0) {
455
-         $this->triggerError ("Empty variable name in template at offset $p0.");
456
-         return false; }
457
-      $this->registerVariableReference ($varName, $p0, $p); }
458
-   return true; }
443
+    $p = 0;
444
+    while (true) {
445
+        $p = strpos($this->template, '${', $p);
446
+        if ($p === false) break;
447
+        $p0 = $p;
448
+        $p = strpos($this->template, '}', $p);
449
+        if ($p === false) {
450
+            $this->triggerError ("Invalid variable reference in template at offset $p0.");
451
+            return false; }
452
+        $p += 1;
453
+        $varName = trim(substr($this->template, $p0+2, $p-$p0-3));
454
+        if (strlen($varName) == 0) {
455
+            $this->triggerError ("Empty variable name in template at offset $p0.");
456
+            return false; }
457
+        $this->registerVariableReference ($varName, $p0, $p); }
458
+    return true; }
459 459
 
460 460
 /**
461 461
 * @access private
462 462
 */
463 463
 function registerVariableReference ($varName, $tPosBegin, $tPosEnd) {
464
-   if (!$this->lookupVariableName($varName,$varNo))
465
-      $this->registerVariable($varName,$varNo);
466
-   $varRefNo = $this->varRefTabCnt++;
467
-   $vrtr =& $this->varRefTab[$varRefNo];
468
-   $vrtr = array();
469
-   $vrtr['tPosBegin'] = $tPosBegin;
470
-   $vrtr['tPosEnd'] = $tPosEnd;
471
-   $vrtr['varNo'] = $varNo; }
464
+    if (!$this->lookupVariableName($varName,$varNo))
465
+        $this->registerVariable($varName,$varNo);
466
+    $varRefNo = $this->varRefTabCnt++;
467
+    $vrtr =& $this->varRefTab[$varRefNo];
468
+    $vrtr = array();
469
+    $vrtr['tPosBegin'] = $tPosBegin;
470
+    $vrtr['tPosEnd'] = $tPosEnd;
471
+    $vrtr['varNo'] = $varNo; }
472 472
 
473 473
 /**
474 474
 * @access private
475 475
 */
476 476
 function registerVariable ($varName, &$varNo) {
477
-   $varNo = $this->varTabCnt++;
478
-   $vtr =& $this->varTab[$varNo];
479
-   $vtr = array();
480
-   $vtr['varName'] = $varName;
481
-   $vtr['varValue'] = '';
482
-   $this->varNameToNoMap[strtoupper($varName)] = $varNo; }
477
+    $varNo = $this->varTabCnt++;
478
+    $vtr =& $this->varTab[$varNo];
479
+    $vtr = array();
480
+    $vtr['varName'] = $varName;
481
+    $vtr['varValue'] = '';
482
+    $this->varNameToNoMap[strtoupper($varName)] = $varNo; }
483 483
 
484 484
 /**
485 485
 * Associates variable references with blocks.
486 486
 * @access private
487 487
 */
488 488
 function associateVariablesWithBlocks() {
489
-   $varRefNo = 0;
490
-   $activeBlockNo = 0;
491
-   $nextBlockNo = 1;
492
-   while ($varRefNo < $this->varRefTabCnt) {
493
-      $vrtr =& $this->varRefTab[$varRefNo];
494
-      $varRefTPos = $vrtr['tPosBegin'];
495
-      $varNo = $vrtr['varNo'];
496
-      if ($varRefTPos >= $this->blockTab[$activeBlockNo]['tPosEnd']) {
497
-         $activeBlockNo = $this->blockTab[$activeBlockNo]['parentBlockNo'];
498
-         continue; }
499
-      if ($nextBlockNo < $this->blockTabCnt) {
500
-         if ($varRefTPos >= $this->blockTab[$nextBlockNo]['tPosBegin']) {
489
+    $varRefNo = 0;
490
+    $activeBlockNo = 0;
491
+    $nextBlockNo = 1;
492
+    while ($varRefNo < $this->varRefTabCnt) {
493
+        $vrtr =& $this->varRefTab[$varRefNo];
494
+        $varRefTPos = $vrtr['tPosBegin'];
495
+        $varNo = $vrtr['varNo'];
496
+        if ($varRefTPos >= $this->blockTab[$activeBlockNo]['tPosEnd']) {
497
+            $activeBlockNo = $this->blockTab[$activeBlockNo]['parentBlockNo'];
498
+            continue; }
499
+        if ($nextBlockNo < $this->blockTabCnt) {
500
+            if ($varRefTPos >= $this->blockTab[$nextBlockNo]['tPosBegin']) {
501 501
             $activeBlockNo = $nextBlockNo;
502 502
             $nextBlockNo += 1;
503 503
             continue; }}
504
-      $btr =& $this->blockTab[$activeBlockNo];
505
-      if ($varRefTPos < $btr['tPosBegin'])
506
-         $this->programLogicError(1);
507
-      $blockVarNo = $btr['blockVarCnt']++;
508
-      $btr['blockVarNoToVarNoMap'][$blockVarNo] = $varNo;
509
-      if ($btr['firstVarRefNo'] == -1)
510
-         $btr['firstVarRefNo'] = $varRefNo;
511
-      $vrtr['blockNo'] = $activeBlockNo;
512
-      $vrtr['blockVarNo'] = $blockVarNo;
513
-      $varRefNo += 1; }}
504
+        $btr =& $this->blockTab[$activeBlockNo];
505
+        if ($varRefTPos < $btr['tPosBegin'])
506
+            $this->programLogicError(1);
507
+        $blockVarNo = $btr['blockVarCnt']++;
508
+        $btr['blockVarNoToVarNoMap'][$blockVarNo] = $varNo;
509
+        if ($btr['firstVarRefNo'] == -1)
510
+            $btr['firstVarRefNo'] = $varRefNo;
511
+        $vrtr['blockNo'] = $activeBlockNo;
512
+        $vrtr['blockVarNo'] = $blockVarNo;
513
+        $varRefNo += 1; }}
514 514
 
515 515
 //--- build up (template variables and blocks) ----------------------------------------------------------------------
516 516
 
@@ -523,15 +523,15 @@  discard block
 block discarded – undo
523 523
 * @access public
524 524
 */
525 525
 function reset() {
526
-   for ($varNo=0; $varNo<$this->varTabCnt; $varNo++)
527
-      $this->varTab[$varNo]['varValue'] = '';
528
-   for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) {
529
-      $btr =& $this->blockTab[$blockNo];
530
-      $btr['instances'] = 0;
531
-      $btr['firstBlockInstNo'] = -1;
532
-      $btr['lastBlockInstNo'] = -1; }
533
-   $this->blockInstTab = array();
534
-   $this->blockInstTabCnt = 0; }
526
+    for ($varNo=0; $varNo<$this->varTabCnt; $varNo++)
527
+        $this->varTab[$varNo]['varValue'] = '';
528
+    for ($blockNo=0; $blockNo<$this->blockTabCnt; $blockNo++) {
529
+        $btr =& $this->blockTab[$blockNo];
530
+        $btr['instances'] = 0;
531
+        $btr['firstBlockInstNo'] = -1;
532
+        $btr['lastBlockInstNo'] = -1; }
533
+    $this->blockInstTab = array();
534
+    $this->blockInstTabCnt = 0; }
535 535
 
536 536
 /**
537 537
 * Sets a template variable.
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 * @access public
550 550
 */
551 551
 function setVariable ($variableName, $variableValue, $isOptional=false) {
552
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
553
-   if (!$this->lookupVariableName($variableName,$varNo)) {
554
-      if ($isOptional) return true;
555
-      $this->triggerError ("Variable \"$variableName\" not defined in template.");
556
-      return false; }
557
-   $this->varTab[$varNo]['varValue'] = $variableValue;
558
-   return true; }
552
+    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
553
+    if (!$this->lookupVariableName($variableName,$varNo)) {
554
+        if ($isOptional) return true;
555
+        $this->triggerError ("Variable \"$variableName\" not defined in template.");
556
+        return false; }
557
+    $this->varTab[$varNo]['varValue'] = $variableValue;
558
+    return true; }
559 559
 
560 560
 /**
561 561
 * Sets a template variable to an escaped string.
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 * @access public
577 577
 */
578 578
 function setVariableEsc ($variableName, $variableValue, $isOptional=false) {
579
-   return $this->setVariable($variableName,htmlspecialchars($variableValue,ENT_QUOTES),$isOptional); }
579
+    return $this->setVariable($variableName,htmlspecialchars($variableValue,ENT_QUOTES),$isOptional); }
580 580
 
581 581
 /**
582 582
 * Checks whether a variable with the specified name exists within the template.
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 * @access public
587 587
 */
588 588
 function variableExists ($variableName) {
589
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
590
-   return $this->lookupVariableName($variableName,$varNo); }
589
+    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
590
+    return $this->lookupVariableName($variableName,$varNo); }
591 591
 
592 592
 /**
593 593
 * Adds an instance of a template block.
@@ -603,48 +603,48 @@  discard block
 block discarded – undo
603 603
 * @access public
604 604
 */
605 605
 function addBlock($blockName) {
606
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
607
-   if (!$this->lookupBlockName($blockName,$blockNo)) {
608
-      $this->triggerError ("Block \"$blockName\" not defined in template.");
609
-      return false; }
610
-   while ($blockNo != -1) {
611
-      $this->addBlockByNo($blockNo);
612
-      $blockNo = $this->blockTab[$blockNo]['nextWithSameName']; }
613
-   return true; }
606
+    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
607
+    if (!$this->lookupBlockName($blockName,$blockNo)) {
608
+        $this->triggerError ("Block \"$blockName\" not defined in template.");
609
+        return false; }
610
+    while ($blockNo != -1) {
611
+        $this->addBlockByNo($blockNo);
612
+        $blockNo = $this->blockTab[$blockNo]['nextWithSameName']; }
613
+    return true; }
614 614
 
615 615
 /**
616 616
 * @access private
617 617
 */
618 618
 function addBlockByNo ($blockNo) {
619
-   $btr =& $this->blockTab[$blockNo];
620
-   $this->registerBlockInstance ($blockInstNo);
621
-   $bitr =& $this->blockInstTab[$blockInstNo];
622
-   if ($btr['firstBlockInstNo'] == -1)
623
-      $btr['firstBlockInstNo'] = $blockInstNo;
624
-   if ($btr['lastBlockInstNo'] != -1)
625
-      $this->blockInstTab[$btr['lastBlockInstNo']]['nextBlockInstNo'] = $blockInstNo;
626
-         // set forward pointer of chain
627
-   $btr['lastBlockInstNo'] = $blockInstNo;
628
-   $parentBlockNo = $btr['parentBlockNo'];
629
-   $blockVarCnt = $btr['blockVarCnt'];
630
-   $bitr['blockNo'] = $blockNo;
631
-   $bitr['instanceLevel'] = $btr['instances']++;
632
-   if ($parentBlockNo == -1)
633
-      $bitr['parentInstLevel'] = -1;
619
+    $btr =& $this->blockTab[$blockNo];
620
+    $this->registerBlockInstance ($blockInstNo);
621
+    $bitr =& $this->blockInstTab[$blockInstNo];
622
+    if ($btr['firstBlockInstNo'] == -1)
623
+        $btr['firstBlockInstNo'] = $blockInstNo;
624
+    if ($btr['lastBlockInstNo'] != -1)
625
+        $this->blockInstTab[$btr['lastBlockInstNo']]['nextBlockInstNo'] = $blockInstNo;
626
+            // set forward pointer of chain
627
+    $btr['lastBlockInstNo'] = $blockInstNo;
628
+    $parentBlockNo = $btr['parentBlockNo'];
629
+    $blockVarCnt = $btr['blockVarCnt'];
630
+    $bitr['blockNo'] = $blockNo;
631
+    $bitr['instanceLevel'] = $btr['instances']++;
632
+    if ($parentBlockNo == -1)
633
+        $bitr['parentInstLevel'] = -1;
634 634
     else
635
-      $bitr['parentInstLevel'] = $this->blockTab[$parentBlockNo]['instances'];
636
-   $bitr['nextBlockInstNo'] = -1;
637
-   $bitr['blockVarTab'] = array();
638
-   // copy instance variables for this block
639
-   for ($blockVarNo=0; $blockVarNo<$blockVarCnt; $blockVarNo++) {
640
-      $varNo = $btr['blockVarNoToVarNoMap'][$blockVarNo];
641
-      $bitr['blockVarTab'][$blockVarNo] = $this->varTab[$varNo]['varValue']; }}
635
+        $bitr['parentInstLevel'] = $this->blockTab[$parentBlockNo]['instances'];
636
+    $bitr['nextBlockInstNo'] = -1;
637
+    $bitr['blockVarTab'] = array();
638
+    // copy instance variables for this block
639
+    for ($blockVarNo=0; $blockVarNo<$blockVarCnt; $blockVarNo++) {
640
+        $varNo = $btr['blockVarNoToVarNoMap'][$blockVarNo];
641
+        $bitr['blockVarTab'][$blockVarNo] = $this->varTab[$varNo]['varValue']; }}
642 642
 
643 643
 /**
644 644
 * @access private
645 645
 */
646 646
 function registerBlockInstance (&$blockInstNo) {
647
-   $blockInstNo = $this->blockInstTabCnt++; }
647
+    $blockInstNo = $this->blockInstTabCnt++; }
648 648
 
649 649
 /**
650 650
 * Checks whether a block with the specified name exists within the template.
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
 * @access public
655 655
 */
656 656
 function blockExists ($blockName) {
657
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
658
-   return $this->lookupBlockName($blockName,$blockNo); }
657
+    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
658
+    return $this->lookupBlockName($blockName,$blockNo); }
659 659
 
660 660
 //--- output generation ---------------------------------------------------------------------------------------------
661 661
 
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 * @access public
666 666
 */
667 667
 function generateOutput () {
668
-   $this->outputMode = 0;
669
-   if (!$this->generateOutputPage()) return false;
670
-   return true; }
668
+    $this->outputMode = 0;
669
+    if (!$this->generateOutputPage()) return false;
670
+    return true; }
671 671
 
672 672
 /**
673 673
 * Generates the HTML page and writes it to a file.
@@ -676,13 +676,13 @@  discard block
 block discarded – undo
676 676
 * @access public
677 677
 */
678 678
 function generateOutputToFile ($fileName) {
679
-   $fh = fopen($fileName,"wb");
680
-   if ($fh === false) return false;
681
-   $this->outputMode = 1;
682
-   $this->outputFileHandle = $fh;
683
-   $ok = $this->generateOutputPage();
684
-   fclose ($fh);
685
-   return $ok; }
679
+    $fh = fopen($fileName,"wb");
680
+    if ($fh === false) return false;
681
+    $this->outputMode = 1;
682
+    $this->outputFileHandle = $fh;
683
+    $ok = $this->generateOutputPage();
684
+    fclose ($fh);
685
+    return $ok; }
686 686
 
687 687
 /**
688 688
 * Generates the HTML page and writes it to a string.
@@ -692,28 +692,28 @@  discard block
 block discarded – undo
692 692
 * @access public
693 693
 */
694 694
 function generateOutputToString (&$outputString) {
695
-   $outputString = "Error";
696
-   $this->outputMode = 2;
697
-   $this->outputString = "";
698
-   if (!$this->generateOutputPage()) return false;
699
-   $outputString = $this->outputString;
700
-   return true; }
695
+    $outputString = "Error";
696
+    $this->outputMode = 2;
697
+    $this->outputString = "";
698
+    if (!$this->generateOutputPage()) return false;
699
+    $outputString = $this->outputString;
700
+    return true; }
701 701
 
702 702
 /**
703 703
 * @access private
704 704
 * @return boolean  true on success, false on error.
705 705
 */
706 706
 function generateOutputPage() {
707
-   if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
708
-   if ($this->blockTab[0]['instances'] == 0)
709
-      $this->addBlockByNo (0);        // add main block
710
-   for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
711
-       $btr =& $this->blockTab[$blockNo];
712
-       $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; }
713
-   $this->outputError = false;
714
-   $this->writeBlockInstances (0, -1);
715
-   if ($this->outputError) return false;
716
-   return true; }
707
+    if (!$this->templateValid) {$this->triggerError ("Template not valid."); return false; }
708
+    if ($this->blockTab[0]['instances'] == 0)
709
+        $this->addBlockByNo (0);        // add main block
710
+    for ($blockNo=0; $blockNo < $this->blockTabCnt; $blockNo++) {
711
+        $btr =& $this->blockTab[$blockNo];
712
+        $btr['currBlockInstNo'] = $btr['firstBlockInstNo']; }
713
+    $this->outputError = false;
714
+    $this->writeBlockInstances (0, -1);
715
+    if ($this->outputError) return false;
716
+    return true; }
717 717
 
718 718
 /**
719 719
 * Writes all instances of a block that are contained within a specific
@@ -722,64 +722,64 @@  discard block
 block discarded – undo
722 722
 * @access private
723 723
 */
724 724
 function writeBlockInstances ($blockNo, $parentInstLevel) {
725
-   $btr =& $this->blockTab[$blockNo];
726
-   while (!$this->outputError) {
727
-      $blockInstNo = $btr['currBlockInstNo'];
728
-      if ($blockInstNo == -1) break;
729
-      $bitr =& $this->blockInstTab[$blockInstNo];
730
-      if ($bitr['parentInstLevel'] < $parentInstLevel)
731
-         $this->programLogicError (2);
732
-      if ($bitr['parentInstLevel'] > $parentInstLevel) break;
733
-      $this->writeBlockInstance ($blockInstNo);
734
-      $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }}
725
+    $btr =& $this->blockTab[$blockNo];
726
+    while (!$this->outputError) {
727
+        $blockInstNo = $btr['currBlockInstNo'];
728
+        if ($blockInstNo == -1) break;
729
+        $bitr =& $this->blockInstTab[$blockInstNo];
730
+        if ($bitr['parentInstLevel'] < $parentInstLevel)
731
+            $this->programLogicError (2);
732
+        if ($bitr['parentInstLevel'] > $parentInstLevel) break;
733
+        $this->writeBlockInstance ($blockInstNo);
734
+        $btr['currBlockInstNo'] = $bitr['nextBlockInstNo']; }}
735 735
 
736 736
 /**
737 737
 * @access private
738 738
 */
739 739
 function writeBlockInstance($blockInstNo) {
740
-   $bitr =& $this->blockInstTab[$blockInstNo];
741
-   $blockNo = $bitr['blockNo'];
742
-   $btr =& $this->blockTab[$blockNo];
743
-   $tPos = $btr['tPosContentsBegin'];
744
-   $subBlockNo = $blockNo + 1;
745
-   $varRefNo = $btr['firstVarRefNo'];
746
-   while (!$this->outputError) {
747
-      $tPos2 = $btr['tPosContentsEnd'];
748
-      $kind = 0;                                // assume end-of-block
749
-      if ($varRefNo != -1 && $varRefNo < $this->varRefTabCnt) {  // check for variable reference
750
-         $vrtr =& $this->varRefTab[$varRefNo];
751
-         if ($vrtr['tPosBegin'] < $tPos) {
740
+    $bitr =& $this->blockInstTab[$blockInstNo];
741
+    $blockNo = $bitr['blockNo'];
742
+    $btr =& $this->blockTab[$blockNo];
743
+    $tPos = $btr['tPosContentsBegin'];
744
+    $subBlockNo = $blockNo + 1;
745
+    $varRefNo = $btr['firstVarRefNo'];
746
+    while (!$this->outputError) {
747
+        $tPos2 = $btr['tPosContentsEnd'];
748
+        $kind = 0;                                // assume end-of-block
749
+        if ($varRefNo != -1 && $varRefNo < $this->varRefTabCnt) {  // check for variable reference
750
+            $vrtr =& $this->varRefTab[$varRefNo];
751
+            if ($vrtr['tPosBegin'] < $tPos) {
752 752
             $varRefNo += 1;
753 753
             continue; }
754
-         if ($vrtr['tPosBegin'] < $tPos2) {
754
+            if ($vrtr['tPosBegin'] < $tPos2) {
755 755
             $tPos2 = $vrtr['tPosBegin'];
756 756
             $kind = 1; }}
757
-      if ($subBlockNo < $this->blockTabCnt) {   // check for subblock
758
-         $subBtr =& $this->blockTab[$subBlockNo];
759
-         if ($subBtr['tPosBegin'] < $tPos) {
757
+        if ($subBlockNo < $this->blockTabCnt) {   // check for subblock
758
+            $subBtr =& $this->blockTab[$subBlockNo];
759
+            if ($subBtr['tPosBegin'] < $tPos) {
760 760
             $subBlockNo += 1;
761 761
             continue; }
762
-         if ($subBtr['tPosBegin'] < $tPos2) {
762
+            if ($subBtr['tPosBegin'] < $tPos2) {
763 763
             $tPos2 = $subBtr['tPosBegin'];
764 764
             $kind = 2; }}
765
-      if ($tPos2 > $tPos)
766
-         $this->writeString (substr($this->template,$tPos,$tPos2-$tPos));
767
-      switch ($kind) {
768
-         case 0:         // end of block
765
+        if ($tPos2 > $tPos)
766
+            $this->writeString (substr($this->template,$tPos,$tPos2-$tPos));
767
+        switch ($kind) {
768
+            case 0:         // end of block
769 769
             return;
770
-         case 1:         // variable
770
+            case 1:         // variable
771 771
             $vrtr =& $this->varRefTab[$varRefNo];
772 772
             if ($vrtr['blockNo'] != $blockNo)
773
-               $this->programLogicError (4);
773
+                $this->programLogicError (4);
774 774
             $variableValue = $bitr['blockVarTab'][$vrtr['blockVarNo']];
775 775
             $this->writeString ($variableValue);
776 776
             $tPos = $vrtr['tPosEnd'];
777 777
             $varRefNo += 1;
778 778
             break;
779
-         case 2:         // sub block
779
+            case 2:         // sub block
780 780
             $subBtr =& $this->blockTab[$subBlockNo];
781 781
             if ($subBtr['parentBlockNo'] != $blockNo)
782
-               $this->programLogicError (3);
782
+                $this->programLogicError (3);
783 783
             $this->writeBlockInstances ($subBlockNo, $bitr['instanceLevel']);  // recursive call
784 784
             $tPos = $subBtr['tPosEnd'];
785 785
             $subBlockNo += 1;
@@ -789,19 +789,19 @@  discard block
 block discarded – undo
789 789
 * @access private
790 790
 */
791 791
 function writeString ($s) {
792
-   if ($this->outputError) return;
793
-   switch ($this->outputMode) {
794
-      case 0:            // output to PHP output stream
792
+    if ($this->outputError) return;
793
+    switch ($this->outputMode) {
794
+        case 0:            // output to PHP output stream
795 795
          if (!print($s))
796 796
             $this->outputError = true;
797
-         break;
798
-      case 1:            // output to file
797
+            break;
798
+        case 1:            // output to file
799 799
          $rc = fwrite($this->outputFileHandle, $s);
800
-         if ($rc === false) $this->outputError = true;
801
-         break;
802
-      case 2:            // output to string
800
+            if ($rc === false) $this->outputError = true;
801
+            break;
802
+        case 2:            // output to string
803 803
          $this->outputString .= $s;
804
-         break; }}
804
+            break; }}
805 805
 
806 806
 //--- name lookup routines ------------------------------------------------------------------------------------------
807 807
 
@@ -811,10 +811,10 @@  discard block
 block discarded – undo
811 811
 * @access private
812 812
 */
813 813
 function lookupVariableName ($varName, &$varNo) {
814
-   $x =& $this->varNameToNoMap[strtoupper($varName)];
815
-   if (!isset($x)) return false;
816
-   $varNo = $x;
817
-   return true; }
814
+    $x =& $this->varNameToNoMap[strtoupper($varName)];
815
+    if (!isset($x)) return false;
816
+    $varNo = $x;
817
+    return true; }
818 818
 
819 819
 /**
820 820
 * Maps block name to block number.
@@ -824,10 +824,10 @@  discard block
 block discarded – undo
824 824
 * @access private
825 825
 */
826 826
 function lookupBlockName ($blockName, &$blockNo) {
827
-   $x =& $this->blockNameToNoMap[strtoupper($blockName)];
828
-   if (!isset($x)) return false;
829
-   $blockNo = $x;
830
-   return true; }
827
+    $x =& $this->blockNameToNoMap[strtoupper($blockName)];
828
+    if (!isset($x)) return false;
829
+    $blockNo = $x;
830
+    return true; }
831 831
 
832 832
 //--- general utility routines -----------------------------------------------------------------------------------------
833 833
 
@@ -837,86 +837,86 @@  discard block
 block discarded – undo
837 837
 * @access private
838 838
 */
839 839
 function readFileIntoString ($fileName, &$s) {
840
-   if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) {
841
-      $s = file_get_contents($fileName);
842
-      if ($s === false) return false;
843
-      return true; }
844
-   $fh = fopen($fileName,"rb");
845
-   if ($fh === false) return false;
846
-   $fileSize = filesize($fileName);
847
-   if ($fileSize === false) {fclose ($fh); return false; }
848
-   $s = fread($fh,$fileSize);
849
-   fclose ($fh);
850
-   if (strlen($s) != $fileSize) return false;
851
-   return true; }
840
+    if (function_exists('version_compare') && version_compare(phpversion(),"4.3.0",">=")) {
841
+        $s = file_get_contents($fileName);
842
+        if ($s === false) return false;
843
+        return true; }
844
+    $fh = fopen($fileName,"rb");
845
+    if ($fh === false) return false;
846
+    $fileSize = filesize($fileName);
847
+    if ($fileSize === false) {fclose ($fh); return false; }
848
+    $s = fread($fh,$fileSize);
849
+    fclose ($fh);
850
+    if (strlen($s) != $fileSize) return false;
851
+    return true; }
852 852
 
853 853
 /**
854 854
 * @access private
855 855
 * @return boolean  true on success, false when the end of the string is reached.
856 856
 */
857 857
 function parseWord ($s, &$p, &$w) {
858
-   $sLen = strlen($s);
859
-   while ($p < $sLen && ord($s{$p}) <= 32) $p++;
860
-   if ($p >= $sLen) return false;
861
-   $p0 = $p;
862
-   while ($p < $sLen && ord($s{$p}) > 32) $p++;
863
-   $w = substr($s, $p0, $p - $p0);
864
-   return true; }
858
+    $sLen = strlen($s);
859
+    while ($p < $sLen && ord($s{$p}) <= 32) $p++;
860
+    if ($p >= $sLen) return false;
861
+    $p0 = $p;
862
+    while ($p < $sLen && ord($s{$p}) > 32) $p++;
863
+    $w = substr($s, $p0, $p - $p0);
864
+    return true; }
865 865
 
866 866
 /**
867 867
 * @access private
868 868
 * @return boolean  true on success, false on error.
869 869
 */
870 870
 function parseQuotedString ($s, &$p, &$w) {
871
-   $sLen = strlen($s);
872
-   while ($p < $sLen && ord($s{$p}) <= 32) $p++;
873
-   if ($p >= $sLen) return false;
874
-   if (substr($s,$p,1) != '"') return false;
875
-   $p++; $p0 = $p;
876
-   while ($p < $sLen && $s{$p} != '"') $p++;
877
-   if ($p >= $sLen) return false;
878
-   $w = substr($s, $p0, $p - $p0);
879
-   $p++;
880
-   return true; }
871
+    $sLen = strlen($s);
872
+    while ($p < $sLen && ord($s{$p}) <= 32) $p++;
873
+    if ($p >= $sLen) return false;
874
+    if (substr($s,$p,1) != '"') return false;
875
+    $p++; $p0 = $p;
876
+    while ($p < $sLen && $s{$p} != '"') $p++;
877
+    if ($p >= $sLen) return false;
878
+    $w = substr($s, $p0, $p - $p0);
879
+    $p++;
880
+    return true; }
881 881
 
882 882
 /**
883 883
 * @access private
884 884
 * @return boolean  true on success, false on error.
885 885
 */
886 886
 function parseWordOrQuotedString ($s, &$p, &$w) {
887
-   $sLen = strlen($s);
888
-   while ($p < $sLen && ord($s{$p}) <= 32) $p++;
889
-   if ($p >= $sLen) return false;
890
-   if (substr($s,$p,1) == '"')
891
-      return $this->parseQuotedString($s,$p,$w);
887
+    $sLen = strlen($s);
888
+    while ($p < $sLen && ord($s{$p}) <= 32) $p++;
889
+    if ($p >= $sLen) return false;
890
+    if (substr($s,$p,1) == '"')
891
+        return $this->parseQuotedString($s,$p,$w);
892 892
     else
893
-      return $this->parseWord($s,$p,$w); }
893
+        return $this->parseWord($s,$p,$w); }
894 894
 
895 895
 /**
896 896
 * Combine two file system paths.
897 897
 * @access private
898 898
 */
899 899
 function combineFileSystemPath ($path1, $path2) {
900
-   if ($path1 == '' || $path2 == '') return $path2;
901
-   $s = $path1;
902
-   if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/";
903
-   if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/')
904
-      $s = $s . substr($path2,1);
900
+    if ($path1 == '' || $path2 == '') return $path2;
901
+    $s = $path1;
902
+    if (substr($s,-1) != '\\' && substr($s,-1) != '/') $s = $s . "/";
903
+    if (substr($path2,0,1) == '\\' || substr($path2,0,1) == '/')
904
+        $s = $s . substr($path2,1);
905 905
     else
906
-      $s = $s . $path2;
907
-   return $s; }
906
+        $s = $s . $path2;
907
+    return $s; }
908 908
 
909 909
 /**
910 910
 * @access private
911 911
 */
912 912
 function triggerError ($msg) {
913
-   trigger_error ("MiniTemplator error: $msg", E_USER_ERROR); }
913
+    trigger_error ("MiniTemplator error: $msg", E_USER_ERROR); }
914 914
 
915 915
 /**
916 916
 * @access private
917 917
 */
918 918
 function programLogicError ($errorId) {
919
-   die ("MiniTemplator: Program logic error $errorId.\n"); }
919
+    die ("MiniTemplator: Program logic error $errorId.\n"); }
920 920
 
921 921
 }
922 922
 ?>
Please login to merge, or discard this patch.
lib/accept-to-gettext.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -72,43 +72,43 @@  discard block
 block discarded – undo
72 72
 function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval,
73 73
                     $gtlang)
74 74
 {
75
-  if($curlscore < $langval) {
75
+    if($curlscore < $langval) {
76 76
     $curlscore=$langval;
77 77
     $curcscore=$charval;
78 78
     $curgtlang=$gtlang;
79
-  } else if ($curlscore == $langval) {
79
+    } else if ($curlscore == $langval) {
80 80
     if($curcscore < $charval) {
81
-      $curcscore=$charval;
82
-      $curgtlang=$gtlang;
81
+        $curcscore=$charval;
82
+        $curgtlang=$gtlang;
83 83
     }
84
-  }
85
-  return array($curlscore, $curcscore, $curgtlang);
84
+    }
85
+    return array($curlscore, $curcscore, $curgtlang);
86 86
 }
87 87
 
88 88
 function al2gt($gettextlangs, $mime) {
89
-  /* default to "everything is acceptable", as RFC2616 specifies */
90
-  $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
89
+    /* default to "everything is acceptable", as RFC2616 specifies */
90
+    $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
91 91
       $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
92
-  $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
92
+    $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
93 93
       $_SERVER["HTTP_ACCEPT_CHARSET"]);
94
-  $alparts=@preg_split("/,/",$acceptLang);
95
-  $acparts=@preg_split("/,/",$acceptChar);
94
+    $alparts=@preg_split("/,/",$acceptLang);
95
+    $acparts=@preg_split("/,/",$acceptChar);
96 96
   
97
-  /* Parse the contents of the Accept-Language header.*/
98
-  foreach($alparts as $part) {
97
+    /* Parse the contents of the Accept-Language header.*/
98
+    foreach($alparts as $part) {
99 99
     $part=trim($part);
100 100
     if(preg_match("/;/", $part)) {
101
-      $lang=@preg_split("/;/",$part);
102
-      $score=@preg_split("/=/",$lang[1]);
103
-      $alscores[$lang[0]]=$score[1];
101
+        $lang=@preg_split("/;/",$part);
102
+        $score=@preg_split("/=/",$lang[1]);
103
+        $alscores[$lang[0]]=$score[1];
104 104
     } else {
105
-      $alscores[$part]=1;
105
+        $alscores[$part]=1;
106
+    }
106 107
     }
107
-  }
108 108
 
109
-  /* Do the same for the Accept-Charset header. */
109
+    /* Do the same for the Accept-Charset header. */
110 110
 
111
-  /* RFC2616: ``If no "*" is present in an Accept-Charset field, then
111
+    /* RFC2616: ``If no "*" is present in an Accept-Charset field, then
112 112
    * all character sets not explicitly mentioned get a quality value of
113 113
    * 0, except for ISO-8859-1, which gets a quality value of 1 if not
114 114
    * explicitly mentioned.''
@@ -116,31 +116,31 @@  discard block
 block discarded – undo
116 116
    * Making it 2 for the time being, so that we
117 117
    * can distinguish between "not specified" and "specified as 1" later
118 118
    * on. */
119
-  $acscores["ISO-8859-1"]=2;
119
+    $acscores["ISO-8859-1"]=2;
120 120
 
121
-  foreach($acparts as $part) {
121
+    foreach($acparts as $part) {
122 122
     $part=trim($part);
123 123
     if(preg_match("/;/", $part)) {
124
-      $cs=@preg_split("/;/",$part);
125
-      $score=@preg_split("/=/",$cs[1]);
126
-      $acscores[strtoupper($cs[0])]=$score[1];
124
+        $cs=@preg_split("/;/",$part);
125
+        $score=@preg_split("/=/",$cs[1]);
126
+        $acscores[strtoupper($cs[0])]=$score[1];
127 127
     } else {
128
-      $acscores[strtoupper($part)]=1;
128
+        $acscores[strtoupper($part)]=1;
129
+    }
129 130
     }
130
-  }
131
-  if($acscores["ISO-8859-1"]==2) {
131
+    if($acscores["ISO-8859-1"]==2) {
132 132
     $acscores["ISO-8859-1"]=(isset($acscores["*"])?$acscores["*"]:1);
133
-  }
133
+    }
134 134
 
135
-  /* 
135
+    /* 
136 136
    * Loop through the available languages/encodings, and pick the one
137 137
    * with the highest score, excluding the ones with a charset the user
138 138
    * did not include.
139 139
    */
140
-  $curlscore=0;
141
-  $curcscore=0;
142
-  $curgtlang=NULL;
143
-  foreach($gettextlangs as $gtlang) {
140
+    $curlscore=0;
141
+    $curcscore=0;
142
+    $curgtlang=NULL;
143
+    foreach($gettextlangs as $gtlang) {
144 144
 
145 145
     $tmp1=preg_replace("/\_/","-",$gtlang);
146 146
     $tmp2=@preg_split("/\./",$tmp1);
@@ -149,38 +149,38 @@  discard block
 block discarded – undo
149 149
     $noct=@preg_split("/-/",$allang);
150 150
 
151 151
     $testvals=array(
152
-         array(@$alscores[$allang], @$acscores[$gtcs]),
153
-     array(@$alscores[$noct[0]], @$acscores[$gtcs]),
154
-     array(@$alscores[$allang], @$acscores["*"]),
155
-     array(@$alscores[$noct[0]], @$acscores["*"]),
156
-     array(@$alscores["*"], @$acscores[$gtcs]),
157
-     array(@$alscores["*"], @$acscores["*"]));
152
+            array(@$alscores[$allang], @$acscores[$gtcs]),
153
+        array(@$alscores[$noct[0]], @$acscores[$gtcs]),
154
+        array(@$alscores[$allang], @$acscores["*"]),
155
+        array(@$alscores[$noct[0]], @$acscores["*"]),
156
+        array(@$alscores["*"], @$acscores[$gtcs]),
157
+        array(@$alscores["*"], @$acscores["*"]));
158 158
 
159 159
     $found=FALSE;
160 160
     foreach($testvals as $tval) {
161
-      if(!$found && isset($tval[0]) && isset($tval[1])) {
161
+        if(!$found && isset($tval[0]) && isset($tval[1])) {
162 162
         $arr=find_match($curlscore, $curcscore, $curgtlang, $tval[0],
163
-              $tval[1], $gtlang);
163
+                $tval[1], $gtlang);
164 164
         $curlscore=$arr[0];
165 165
         $curcscore=$arr[1];
166 166
         $curgtlang=$arr[2];
167 167
     $found=TRUE;
168
-      }
168
+        }
169
+    }
169 170
     }
170
-  }
171 171
 
172
-  /* We must re-parse the gettext-string now, since we may have found it
172
+    /* We must re-parse the gettext-string now, since we may have found it
173 173
    * through a "*" qualifier.*/
174 174
   
175
-  $gtparts=@preg_split("/\./",$curgtlang);
176
-  $tmp=strtolower($gtparts[0]);
177
-  $lang=preg_replace("/\_/", "-", $tmp);
178
-  $charset=$gtparts[1];
175
+    $gtparts=@preg_split("/\./",$curgtlang);
176
+    $tmp=strtolower($gtparts[0]);
177
+    $lang=preg_replace("/\_/", "-", $tmp);
178
+    $charset=$gtparts[1];
179 179
 
180
-  header("Content-Language: $lang");
181
-  header("Content-Type: $mime; charset=$charset");
180
+    header("Content-Language: $lang");
181
+    header("Content-Type: $mime; charset=$charset");
182 182
 
183
-  return $curgtlang;
183
+    return $curgtlang;
184 184
 }
185 185
 
186 186
 ?>
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	if (file_exists("install") && !file_exists("config.php")) {
3
-		header("Location: install/");
4
-	}
2
+    if (file_exists("install") && !file_exists("config.php")) {
3
+        header("Location: install/");
4
+    }
5 5
 
6
-	if (!file_exists("config.php")) {
7
-		print "<b>Fatal Error</b>: You forgot to copy
6
+    if (!file_exists("config.php")) {
7
+        print "<b>Fatal Error</b>: You forgot to copy
8 8
 		<b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
9
-		exit;
10
-	}
9
+        exit;
10
+    }
11 11
 
12
-	// we need a separate check here because functions.php might get parsed
13
-	// incorrectly before 5.3 because of :: syntax.
14
-	if (version_compare(PHP_VERSION, '5.6.0', '<')) {
15
-		print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".\n";
16
-		exit;
17
-	}
12
+    // we need a separate check here because functions.php might get parsed
13
+    // incorrectly before 5.3 because of :: syntax.
14
+    if (version_compare(PHP_VERSION, '5.6.0', '<')) {
15
+        print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".\n";
16
+        exit;
17
+    }
18 18
 
19
-	set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
20
-		get_include_path());
19
+    set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
20
+        get_include_path());
21 21
 
22
-	require_once "autoload.php";
23
-	require_once "sessions.php";
24
-	require_once "functions.php";
25
-	require_once "sanity_check.php";
26
-	require_once "config.php";
27
-	require_once "db-prefs.php";
22
+    require_once "autoload.php";
23
+    require_once "sessions.php";
24
+    require_once "functions.php";
25
+    require_once "sanity_check.php";
26
+    require_once "config.php";
27
+    require_once "db-prefs.php";
28 28
 
29
-	if (!init_plugins()) return;
29
+    if (!init_plugins()) return;
30 30
 
31
-	login_sequence();
31
+    login_sequence();
32 32
 
33
-	header('Content-Type: text/html; charset=utf-8');
33
+    header('Content-Type: text/html; charset=utf-8');
34 34
 
35 35
 ?>
36 36
 <!DOCTYPE html>
@@ -40,23 +40,23 @@  discard block
 block discarded – undo
40 40
     <meta name="viewport" content="initial-scale=1,width=device-width" />
41 41
 
42 42
 	<?php if ($_SESSION["uid"]) {
43
-		$theme = get_pref("USER_CSS_THEME", false, false);
44
-		if ($theme && theme_exists("$theme")) {
45
-			echo stylesheet_tag(get_theme_path($theme), 'theme_css');
46
-		}
47
-	}
43
+        $theme = get_pref("USER_CSS_THEME", false, false);
44
+        if ($theme && theme_exists("$theme")) {
45
+            echo stylesheet_tag(get_theme_path($theme), 'theme_css');
46
+        }
47
+    }
48 48
 
49
-	print_user_stylesheet()
49
+    print_user_stylesheet()
50 50
 
51
-	?>
51
+    ?>
52 52
 	<style type="text/css">
53 53
 	<?php
54
-		foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
55
-			if (method_exists($p, "get_css")) {
56
-				echo $p->get_css();
57
-			}
58
-		}
59
-	?>
54
+        foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
55
+            if (method_exists($p, "get_css")) {
56
+                echo $p->get_css();
57
+            }
58
+        }
59
+    ?>
60 60
 	</style>
61 61
 
62 62
 	<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 	</script>
74 74
 
75 75
 	<?php
76
-	foreach (array("lib/prototype.js",
77
-				"lib/scriptaculous/scriptaculous.js?load=effects,controls",
78
-				"lib/dojo/dojo.js",
79
-				"lib/dojo/tt-rss-layer.js",
80
-				"js/tt-rss.js",
81
-				"js/common.js",
82
-				"errors.php?mode=js") as $jsfile) {
76
+    foreach (array("lib/prototype.js",
77
+                "lib/scriptaculous/scriptaculous.js?load=effects,controls",
78
+                "lib/dojo/dojo.js",
79
+                "lib/dojo/tt-rss-layer.js",
80
+                "js/tt-rss.js",
81
+                "js/common.js",
82
+                "errors.php?mode=js") as $jsfile) {
83 83
 
84
-		echo javascript_tag($jsfile);
84
+        echo javascript_tag($jsfile);
85 85
 
86
-	} ?>
86
+    } ?>
87 87
 
88 88
 	<script type="text/javascript">
89 89
 		require({cache:{}});
@@ -91,22 +91,22 @@  discard block
 block discarded – undo
91 91
 
92 92
 	<script type="text/javascript">
93 93
 	<?php
94
-		foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
95
-			if (method_exists($p, "get_js")) {
96
-			    $script = $p->get_js();
94
+        foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
95
+            if (method_exists($p, "get_js")) {
96
+                $script = $p->get_js();
97 97
 
98
-			    if ($script) {
99
-					echo "try {
98
+                if ($script) {
99
+                    echo "try {
100 100
 					    $script
101 101
 					} catch (e) {
102 102
                         console.warn('failed to initialize plugin JS: $n', e);
103 103
                     }";
104
-				}
105
-			}
106
-		}
104
+                }
105
+            }
106
+        }
107 107
 
108
-		init_js_translations();
109
-	?>
108
+        init_js_translations();
109
+    ?>
110 110
 	</script>
111 111
 
112 112
 	<style type="text/css">
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
             <img src='images/indicator_tiny.gif'/>
147 147
             <?php echo  __("Loading, please wait..."); ?></div>
148 148
         <?php
149
-          foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_TREE) as $p) {
149
+            foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_TREE) as $p) {
150 150
             echo $p->hook_feed_tree();
151
-          }
151
+            }
152 152
         ?>
153 153
         <div id="feedTree"></div>
154 154
     </div>
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
                 <?php
223 223
                     foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
224
-                         echo $p->hook_toolbar_button();
224
+                            echo $p->hook_toolbar_button();
225 225
                     }
226 226
                 ?>
227 227
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
                         <?php
245 245
                             foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
246
-                             echo $p->hook_action_item();
246
+                                echo $p->hook_action_item();
247 247
                             }
248 248
                         ?>
249 249
 
Please login to merge, or discard this patch.
prefs.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	if (file_exists("install") && !file_exists("config.php")) {
3
-		header("Location: install/");
4
-	}
2
+    if (file_exists("install") && !file_exists("config.php")) {
3
+        header("Location: install/");
4
+    }
5 5
 
6
-	set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
7
-		get_include_path());
6
+    set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
7
+        get_include_path());
8 8
 
9
-	if (!file_exists("config.php")) {
10
-		print "<b>Fatal Error</b>: You forgot to copy
9
+    if (!file_exists("config.php")) {
10
+        print "<b>Fatal Error</b>: You forgot to copy
11 11
 		<b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
12
-		exit;
13
-	}
12
+        exit;
13
+    }
14 14
 
15
-	require_once "autoload.php";
16
-	require_once "sessions.php";
17
-	require_once "functions.php";
18
-	require_once "sanity_check.php";
19
-	require_once "config.php";
20
-	require_once "db-prefs.php";
15
+    require_once "autoload.php";
16
+    require_once "sessions.php";
17
+    require_once "functions.php";
18
+    require_once "sanity_check.php";
19
+    require_once "config.php";
20
+    require_once "db-prefs.php";
21 21
 
22
-	if (!init_plugins()) return;
22
+    if (!init_plugins()) return;
23 23
 
24
-	login_sequence();
24
+    login_sequence();
25 25
 
26
-	header('Content-Type: text/html; charset=utf-8');
26
+    header('Content-Type: text/html; charset=utf-8');
27 27
 ?>
28 28
 <!DOCTYPE html>
29 29
 <html>
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
     <meta name="viewport" content="initial-scale=1,width=device-width" />
33 33
 
34 34
 	<?php if ($_SESSION["uid"]) {
35
-		$theme = get_pref("USER_CSS_THEME", false, false);
36
-		if ($theme && theme_exists("$theme")) {
37
-			echo stylesheet_tag(get_theme_path($theme), 'theme_css');
38
-		}
39
-	}
40
-	?>
35
+        $theme = get_pref("USER_CSS_THEME", false, false);
36
+        if ($theme && theme_exists("$theme")) {
37
+            echo stylesheet_tag(get_theme_path($theme), 'theme_css');
38
+        }
39
+    }
40
+    ?>
41 41
 
42 42
 	<?php print_user_stylesheet() ?>
43 43
 
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 	</script>
57 57
 
58 58
 	<?php
59
-	foreach (array("lib/prototype.js",
60
-				"lib/scriptaculous/scriptaculous.js?load=effects,controls",
61
-				"lib/dojo/dojo.js",
62
-				"lib/dojo/tt-rss-layer.js",
63
-				"js/common.js",
64
-				"js/prefs.js",
65
-				"errors.php?mode=js") as $jsfile) {
59
+    foreach (array("lib/prototype.js",
60
+                "lib/scriptaculous/scriptaculous.js?load=effects,controls",
61
+                "lib/dojo/dojo.js",
62
+                "lib/dojo/tt-rss-layer.js",
63
+                "js/common.js",
64
+                "js/prefs.js",
65
+                "errors.php?mode=js") as $jsfile) {
66 66
 
67
-		echo javascript_tag($jsfile);
67
+        echo javascript_tag($jsfile);
68 68
 
69
-	} ?>
69
+    } ?>
70 70
 
71 71
     <script type="text/javascript">
72 72
 		require({cache:{}});
@@ -74,22 +74,22 @@  discard block
 block discarded – undo
74 74
 
75 75
 	<script type="text/javascript">
76 76
 	<?php
77
-		foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
78
-			if (method_exists($p, "get_prefs_js")) {
79
-				$script = $p->get_prefs_js();
77
+        foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
78
+            if (method_exists($p, "get_prefs_js")) {
79
+                $script = $p->get_prefs_js();
80 80
 
81
-				if ($script) {
82
-					echo "try {
81
+                if ($script) {
82
+                    echo "try {
83 83
 					    $script
84 84
 					} catch (e) {
85 85
                         console.warn('failed to initialize plugin JS: $n', e);
86 86
                     }";
87
-				}
88
-			}
89
-		}
87
+                }
88
+            }
89
+        }
90 90
 
91
-		init_js_translations();
92
-	?>
91
+        init_js_translations();
92
+    ?>
93 93
 	</script>
94 94
 
95 95
 	<style type="text/css">
Please login to merge, or discard this patch.