Completed
Branch master (303d1b)
by Stefan
02:18
created
DBConnector.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -387,7 +387,7 @@
 block discarded – undo
387 387
     // {AFTER | BEFORE} {DELETE | INSERT | UPDATE } ON table
388 388
     //~ $db->exec("CREATE TRIGGER dbchange AFTER UPDATE ON user
389 389
                 //~ BEGIN
390
-                  //~ dbModifiedCallback();
390
+                    //~ dbModifiedCallback();
391 391
                 //~ END");
392 392
     //~ $db = new DBConnector('palma.db');
393 393
     echo "Tables=" . $db->querySingle('SELECT count(*) FROM sqlite_master WHERE type="table"') . "\n";
Please login to merge, or discard this patch.
upload.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,14 +81,14 @@
 block discarded – undo
81 81
     $targetFile = "file:///$targetFile";
82 82
 }
83 83
 
84
-  // Get information of application for uploaded file.
85
-  require_once ('FileHandler.class.php');
86
-  $handler = FileHandler::getFileHandler($targetFile);
84
+    // Get information of application for uploaded file.
85
+    require_once ('FileHandler.class.php');
86
+    $handler = FileHandler::getFileHandler($targetFile);
87 87
 
88
-  // create window object and send to nuc
88
+    // create window object and send to nuc
89 89
 
90
-  $dt = new DateTime();
91
-  $date = $dt->format('Y-m-d H:i:s');
90
+    $dt = new DateTime();
91
+    $date = $dt->format('Y-m-d H:i:s');
92 92
 
93 93
     $window = array(
94 94
         "id" => "",
Please login to merge, or discard this patch.
php-gettext/gettext.php 1 patch
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -34,75 +34,75 @@  discard block
 block discarded – undo
34 34
  * that you don't want to keep in memory)
35 35
  */
36 36
 class gettext_reader {
37
-  //public:
38
-   var $error = 0; // public variable that holds error code (0 if no error)
39
-
40
-   //private:
41
-  var $BYTEORDER = 0;        // 0: low endian, 1: big endian
42
-  var $STREAM = NULL;
43
-  var $short_circuit = false;
44
-  var $enable_cache = false;
45
-  var $originals = NULL;      // offset of original table
46
-  var $translations = NULL;    // offset of translation table
47
-  var $pluralheader = NULL;    // cache header field for plural forms
48
-  var $total = 0;          // total string count
49
-  var $table_originals = NULL;  // table for original strings (offsets)
50
-  var $table_translations = NULL;  // table for translated strings (offsets)
51
-  var $cache_translations = NULL;  // original -> translation mapping
52
-
53
-
54
-  /* Methods */
55
-
56
-
57
-  /**
58
-   * Reads a 32bit Integer from the Stream
59
-   *
60
-   * @access private
61
-   * @return Integer from the Stream
62
-   */
63
-  function readint() {
64
-      if ($this->BYTEORDER == 0) {
37
+    //public:
38
+    var $error = 0; // public variable that holds error code (0 if no error)
39
+
40
+    //private:
41
+    var $BYTEORDER = 0;        // 0: low endian, 1: big endian
42
+    var $STREAM = NULL;
43
+    var $short_circuit = false;
44
+    var $enable_cache = false;
45
+    var $originals = NULL;      // offset of original table
46
+    var $translations = NULL;    // offset of translation table
47
+    var $pluralheader = NULL;    // cache header field for plural forms
48
+    var $total = 0;          // total string count
49
+    var $table_originals = NULL;  // table for original strings (offsets)
50
+    var $table_translations = NULL;  // table for translated strings (offsets)
51
+    var $cache_translations = NULL;  // original -> translation mapping
52
+
53
+
54
+    /* Methods */
55
+
56
+
57
+    /**
58
+     * Reads a 32bit Integer from the Stream
59
+     *
60
+     * @access private
61
+     * @return Integer from the Stream
62
+     */
63
+    function readint() {
64
+        if ($this->BYTEORDER == 0) {
65 65
         // low endian
66 66
         $input=unpack('V', $this->STREAM->read(4));
67 67
         return array_shift($input);
68
-      } else {
68
+        } else {
69 69
         // big endian
70 70
         $input=unpack('N', $this->STREAM->read(4));
71 71
         return array_shift($input);
72
-      }
72
+        }
73 73
     }
74 74
 
75
-  function read($bytes) {
75
+    function read($bytes) {
76 76
     return $this->STREAM->read($bytes);
77
-  }
78
-
79
-  /**
80
-   * Reads an array of Integers from the Stream
81
-   *
82
-   * @param int count How many elements should be read
83
-   * @return Array of Integers
84
-   */
85
-  function readintarray($count) {
77
+    }
78
+
79
+    /**
80
+     * Reads an array of Integers from the Stream
81
+     *
82
+     * @param int count How many elements should be read
83
+     * @return Array of Integers
84
+     */
85
+    function readintarray($count) {
86 86
     if ($this->BYTEORDER == 0) {
87 87
         // low endian
88 88
         return unpack('V'.$count, $this->STREAM->read(4 * $count));
89
-      } else {
89
+        } else {
90 90
         // big endian
91 91
         return unpack('N'.$count, $this->STREAM->read(4 * $count));
92
-      }
93
-  }
94
-
95
-  /**
96
-   * Constructor
97
-   *
98
-   * @param object Reader the StreamReader object
99
-   * @param boolean enable_cache Enable or disable caching of strings (default on)
100
-   */
101
-  function __construct($Reader, $enable_cache = true) {
92
+        }
93
+    }
94
+
95
+    /**
96
+     * Constructor
97
+     *
98
+     * @param object Reader the StreamReader object
99
+     * @param boolean enable_cache Enable or disable caching of strings (default on)
100
+     */
101
+    function __construct($Reader, $enable_cache = true) {
102 102
     // If there isn't a StreamReader, turn on short circuit mode.
103 103
     if (! $Reader || isset($Reader->error) ) {
104
-      $this->short_circuit = true;
105
-      return;
104
+        $this->short_circuit = true;
105
+        return;
106 106
     }
107 107
 
108 108
     // Caching can be turned off
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
     $this->STREAM = $Reader;
115 115
     $magic = $this->read(4);
116 116
     if ($magic == $MAGIC1) {
117
-      $this->BYTEORDER = 1;
117
+        $this->BYTEORDER = 1;
118 118
     } elseif ($magic == $MAGIC2) {
119
-      $this->BYTEORDER = 0;
119
+        $this->BYTEORDER = 0;
120 120
     } else {
121
-      $this->error = 1; // not MO file
122
-      return false;
121
+        $this->error = 1; // not MO file
122
+        return false;
123 123
     }
124 124
 
125 125
     // FIXME: Do we care about revision? We should.
@@ -128,154 +128,154 @@  discard block
 block discarded – undo
128 128
     $this->total = $this->readint();
129 129
     $this->originals = $this->readint();
130 130
     $this->translations = $this->readint();
131
-  }
132
-
133
-  /**
134
-   * Loads the translation tables from the MO file into the cache
135
-   * If caching is enabled, also loads all strings into a cache
136
-   * to speed up translation lookups
137
-   *
138
-   * @access private
139
-   */
140
-  function load_tables() {
131
+    }
132
+
133
+    /**
134
+     * Loads the translation tables from the MO file into the cache
135
+     * If caching is enabled, also loads all strings into a cache
136
+     * to speed up translation lookups
137
+     *
138
+     * @access private
139
+     */
140
+    function load_tables() {
141 141
     if (is_array($this->cache_translations) &&
142 142
       is_array($this->table_originals) &&
143 143
       is_array($this->table_translations))
144
-      return;
144
+        return;
145 145
 
146 146
     /* get original and translations tables */
147 147
     if (!is_array($this->table_originals)) {
148
-      $this->STREAM->seekto($this->originals);
149
-      $this->table_originals = $this->readintarray($this->total * 2);
148
+        $this->STREAM->seekto($this->originals);
149
+        $this->table_originals = $this->readintarray($this->total * 2);
150 150
     }
151 151
     if (!is_array($this->table_translations)) {
152
-      $this->STREAM->seekto($this->translations);
153
-      $this->table_translations = $this->readintarray($this->total * 2);
152
+        $this->STREAM->seekto($this->translations);
153
+        $this->table_translations = $this->readintarray($this->total * 2);
154 154
     }
155 155
 
156 156
     if ($this->enable_cache) {
157
-      $this->cache_translations = array ();
158
-      /* read all strings in the cache */
159
-      for ($i = 0; $i < $this->total; $i++) {
157
+        $this->cache_translations = array ();
158
+        /* read all strings in the cache */
159
+        for ($i = 0; $i < $this->total; $i++) {
160 160
         $this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
161 161
         $original = $this->STREAM->read($this->table_originals[$i * 2 + 1]);
162 162
         $this->STREAM->seekto($this->table_translations[$i * 2 + 2]);
163 163
         $translation = $this->STREAM->read($this->table_translations[$i * 2 + 1]);
164 164
         $this->cache_translations[$original] = $translation;
165
-      }
165
+        }
166
+    }
166 167
     }
167
-  }
168
-
169
-  /**
170
-   * Returns a string from the "originals" table
171
-   *
172
-   * @access private
173
-   * @param int num Offset number of original string
174
-   * @return string Requested string if found, otherwise ''
175
-   */
176
-  function get_original_string($num) {
168
+
169
+    /**
170
+     * Returns a string from the "originals" table
171
+     *
172
+     * @access private
173
+     * @param int num Offset number of original string
174
+     * @return string Requested string if found, otherwise ''
175
+     */
176
+    function get_original_string($num) {
177 177
     $length = $this->table_originals[$num * 2 + 1];
178 178
     $offset = $this->table_originals[$num * 2 + 2];
179 179
     if (! $length)
180
-      return '';
180
+        return '';
181 181
     $this->STREAM->seekto($offset);
182 182
     $data = $this->STREAM->read($length);
183 183
     return (string)$data;
184
-  }
185
-
186
-  /**
187
-   * Returns a string from the "translations" table
188
-   *
189
-   * @access private
190
-   * @param int num Offset number of original string
191
-   * @return string Requested string if found, otherwise ''
192
-   */
193
-  function get_translation_string($num) {
184
+    }
185
+
186
+    /**
187
+     * Returns a string from the "translations" table
188
+     *
189
+     * @access private
190
+     * @param int num Offset number of original string
191
+     * @return string Requested string if found, otherwise ''
192
+     */
193
+    function get_translation_string($num) {
194 194
     $length = $this->table_translations[$num * 2 + 1];
195 195
     $offset = $this->table_translations[$num * 2 + 2];
196 196
     if (! $length)
197
-      return '';
197
+        return '';
198 198
     $this->STREAM->seekto($offset);
199 199
     $data = $this->STREAM->read($length);
200 200
     return (string)$data;
201
-  }
202
-
203
-  /**
204
-   * Binary search for string
205
-   *
206
-   * @access private
207
-   * @param string string
208
-   * @param int start (internally used in recursive function)
209
-   * @param int end (internally used in recursive function)
210
-   * @return int string number (offset in originals table)
211
-   */
212
-  function find_string($string, $start = -1, $end = -1) {
201
+    }
202
+
203
+    /**
204
+     * Binary search for string
205
+     *
206
+     * @access private
207
+     * @param string string
208
+     * @param int start (internally used in recursive function)
209
+     * @param int end (internally used in recursive function)
210
+     * @return int string number (offset in originals table)
211
+     */
212
+    function find_string($string, $start = -1, $end = -1) {
213 213
     if (($start == -1) or ($end == -1)) {
214
-      // find_string is called with only one parameter, set start end end
215
-      $start = 0;
216
-      $end = $this->total;
214
+        // find_string is called with only one parameter, set start end end
215
+        $start = 0;
216
+        $end = $this->total;
217 217
     }
218 218
     if (abs($start - $end) <= 1) {
219
-      // We're done, now we either found the string, or it doesn't exist
220
-      $txt = $this->get_original_string($start);
221
-      if ($string == $txt)
219
+        // We're done, now we either found the string, or it doesn't exist
220
+        $txt = $this->get_original_string($start);
221
+        if ($string == $txt)
222 222
         return $start;
223
-      else
223
+        else
224 224
         return -1;
225 225
     } else if ($start > $end) {
226
-      // start > end -> turn around and start over
227
-      return $this->find_string($string, $end, $start);
226
+        // start > end -> turn around and start over
227
+        return $this->find_string($string, $end, $start);
228 228
     } else {
229
-      // Divide table in two parts
230
-      $half = (int)(($start + $end) / 2);
231
-      $cmp = strcmp($string, $this->get_original_string($half));
232
-      if ($cmp == 0)
229
+        // Divide table in two parts
230
+        $half = (int)(($start + $end) / 2);
231
+        $cmp = strcmp($string, $this->get_original_string($half));
232
+        if ($cmp == 0)
233 233
         // string is exactly in the middle => return it
234 234
         return $half;
235
-      else if ($cmp < 0)
235
+        else if ($cmp < 0)
236 236
         // The string is in the upper half
237 237
         return $this->find_string($string, $start, $half);
238
-      else
238
+        else
239 239
         // The string is in the lower half
240 240
         return $this->find_string($string, $half, $end);
241 241
     }
242
-  }
243
-
244
-  /**
245
-   * Translates a string
246
-   *
247
-   * @access public
248
-   * @param string string to be translated
249
-   * @return string translated string (or original, if not found)
250
-   */
251
-  function translate($string) {
242
+    }
243
+
244
+    /**
245
+     * Translates a string
246
+     *
247
+     * @access public
248
+     * @param string string to be translated
249
+     * @return string translated string (or original, if not found)
250
+     */
251
+    function translate($string) {
252 252
     if ($this->short_circuit)
253
-      return $string;
253
+        return $string;
254 254
     $this->load_tables();
255 255
 
256 256
     if ($this->enable_cache) {
257
-      // Caching enabled, get translated string from cache
258
-      if (array_key_exists($string, $this->cache_translations))
257
+        // Caching enabled, get translated string from cache
258
+        if (array_key_exists($string, $this->cache_translations))
259 259
         return $this->cache_translations[$string];
260
-      else
260
+        else
261 261
         return $string;
262 262
     } else {
263
-      // Caching not enabled, try to find string
264
-      $num = $this->find_string($string);
265
-      if ($num == -1)
263
+        // Caching not enabled, try to find string
264
+        $num = $this->find_string($string);
265
+        if ($num == -1)
266 266
         return $string;
267
-      else
267
+        else
268 268
         return $this->get_translation_string($num);
269 269
     }
270
-  }
271
-
272
-  /**
273
-   * Sanitize plural form expression for use in PHP eval call.
274
-   *
275
-   * @access private
276
-   * @return string sanitized plural form expression
277
-   */
278
-  function sanitize_plural_expression($expr) {
270
+    }
271
+
272
+    /**
273
+     * Sanitize plural form expression for use in PHP eval call.
274
+     *
275
+     * @access private
276
+     * @return string sanitized plural form expression
277
+     */
278
+    function sanitize_plural_expression($expr) {
279 279
     // Get rid of disallowed characters.
280 280
     $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr);
281 281
 
@@ -284,72 +284,72 @@  discard block
 block discarded – undo
284 284
     $res = '';
285 285
     $p = 0;
286 286
     for ($i = 0; $i < strlen($expr); $i++) {
287
-      $ch = $expr[$i];
288
-      switch ($ch) {
289
-      case '?':
287
+        $ch = $expr[$i];
288
+        switch ($ch) {
289
+        case '?':
290 290
         $res .= ' ? (';
291 291
         $p++;
292 292
         break;
293
-      case ':':
293
+        case ':':
294 294
         $res .= ') : (';
295 295
         break;
296
-      case ';':
296
+        case ';':
297 297
         $res .= str_repeat( ')', $p) . ';';
298 298
         $p = 0;
299 299
         break;
300
-      default:
300
+        default:
301 301
         $res .= $ch;
302
-      }
302
+        }
303 303
     }
304 304
     return $res;
305
-  }
306
-
307
-  /**
308
-   * Parse full PO header and extract only plural forms line.
309
-   *
310
-   * @access private
311
-   * @return string verbatim plural form header field
312
-   */
313
-  function extract_plural_forms_header_from_po_header($header) {
305
+    }
306
+
307
+    /**
308
+     * Parse full PO header and extract only plural forms line.
309
+     *
310
+     * @access private
311
+     * @return string verbatim plural form header field
312
+     */
313
+    function extract_plural_forms_header_from_po_header($header) {
314 314
     if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs))
315
-      $expr = $regs[2];
315
+        $expr = $regs[2];
316 316
     else
317
-      $expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
317
+        $expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
318 318
     return $expr;
319
-  }
320
-
321
-  /**
322
-   * Get possible plural forms from MO header
323
-   *
324
-   * @access private
325
-   * @return string plural form header
326
-   */
327
-  function get_plural_forms() {
319
+    }
320
+
321
+    /**
322
+     * Get possible plural forms from MO header
323
+     *
324
+     * @access private
325
+     * @return string plural form header
326
+     */
327
+    function get_plural_forms() {
328 328
     // lets assume message number 0 is header
329 329
     // this is true, right?
330 330
     $this->load_tables();
331 331
 
332 332
     // cache header field for plural forms
333 333
     if (! is_string($this->pluralheader)) {
334
-      if ($this->enable_cache) {
334
+        if ($this->enable_cache) {
335 335
         $header = $this->cache_translations[""];
336
-      } else {
336
+        } else {
337 337
         $header = $this->get_translation_string(0);
338
-      }
339
-      $expr = $this->extract_plural_forms_header_from_po_header($header);
340
-      $this->pluralheader = $this->sanitize_plural_expression($expr);
338
+        }
339
+        $expr = $this->extract_plural_forms_header_from_po_header($header);
340
+        $this->pluralheader = $this->sanitize_plural_expression($expr);
341 341
     }
342 342
     return $this->pluralheader;
343
-  }
344
-
345
-  /**
346
-   * Detects which plural form to take
347
-   *
348
-   * @access private
349
-   * @param n count
350
-   * @return int array index of the right plural form
351
-   */
352
-  function select_string($n) {
343
+    }
344
+
345
+    /**
346
+     * Detects which plural form to take
347
+     *
348
+     * @access private
349
+     * @param n count
350
+     * @return int array index of the right plural form
351
+     */
352
+    function select_string($n) {
353 353
     $string = $this->get_plural_forms();
354 354
     $string = str_replace('nplurals',"\$total",$string);
355 355
     $string = str_replace("n",$n,$string);
@@ -361,22 +361,22 @@  discard block
 block discarded – undo
361 361
     eval("$string");
362 362
     if ($plural >= $total) $plural = $total - 1;
363 363
     return $plural;
364
-  }
365
-
366
-  /**
367
-   * Plural version of gettext
368
-   *
369
-   * @access public
370
-   * @param string single
371
-   * @param string plural
372
-   * @param string number
373
-   * @return translated plural form
374
-   */
375
-  function ngettext($single, $plural, $number) {
364
+    }
365
+
366
+    /**
367
+     * Plural version of gettext
368
+     *
369
+     * @access public
370
+     * @param string single
371
+     * @param string plural
372
+     * @param string number
373
+     * @return translated plural form
374
+     */
375
+    function ngettext($single, $plural, $number) {
376 376
     if ($this->short_circuit) {
377
-      if ($number != 1)
377
+        if ($number != 1)
378 378
         return $plural;
379
-      else
379
+        else
380 380
         return $single;
381 381
     }
382 382
 
@@ -388,45 +388,45 @@  discard block
 block discarded – undo
388 388
 
389 389
 
390 390
     if ($this->enable_cache) {
391
-      if (! array_key_exists($key, $this->cache_translations)) {
391
+        if (! array_key_exists($key, $this->cache_translations)) {
392 392
         return ($number != 1) ? $plural : $single;
393
-      } else {
393
+        } else {
394 394
         $result = $this->cache_translations[$key];
395 395
         $list = explode(chr(0), $result);
396 396
         return $list[$select];
397
-      }
397
+        }
398 398
     } else {
399
-      $num = $this->find_string($key);
400
-      if ($num == -1) {
399
+        $num = $this->find_string($key);
400
+        if ($num == -1) {
401 401
         return ($number != 1) ? $plural : $single;
402
-      } else {
402
+        } else {
403 403
         $result = $this->get_translation_string($num);
404 404
         $list = explode(chr(0), $result);
405 405
         return $list[$select];
406
-      }
406
+        }
407
+    }
407 408
     }
408
-  }
409 409
 
410
-  function pgettext($context, $msgid) {
410
+    function pgettext($context, $msgid) {
411 411
     $key = $context . chr(4) . $msgid;
412 412
     $ret = $this->translate($key);
413 413
     if (strpos($ret, "\004") !== FALSE) {
414
-      return $msgid;
414
+        return $msgid;
415 415
     } else {
416
-      return $ret;
416
+        return $ret;
417
+    }
417 418
     }
418
-  }
419 419
 
420
-  function npgettext($context, $singular, $plural, $number) {
420
+    function npgettext($context, $singular, $plural, $number) {
421 421
     $key = $context . chr(4) . $singular;
422 422
     $ret = $this->ngettext($key, $plural, $number);
423 423
     if (strpos($ret, "\004") !== FALSE) {
424
-      return $singular;
424
+        return $singular;
425 425
     } else {
426
-      return $ret;
426
+        return $ret;
427 427
     }
428 428
 
429
-  }
429
+    }
430 430
 }
431 431
 
432 432
 ?>
Please login to merge, or discard this patch.
php-gettext/streams.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -21,146 +21,146 @@
 block discarded – undo
21 21
 */
22 22
 
23 23
 
24
-  // Simple class to wrap file streams, string streams, etc.
25
-  // seek is essential, and it should be byte stream
24
+    // Simple class to wrap file streams, string streams, etc.
25
+    // seek is essential, and it should be byte stream
26 26
 class StreamReader {
27
-  // should return a string [FIXME: perhaps return array of bytes?]
28
-  function read($bytes) {
27
+    // should return a string [FIXME: perhaps return array of bytes?]
28
+    function read($bytes) {
29 29
     return false;
30
-  }
30
+    }
31 31
 
32
-  // should return new position
33
-  function seekto($position) {
32
+    // should return new position
33
+    function seekto($position) {
34 34
     return false;
35
-  }
35
+    }
36 36
 
37
-  // returns current position
38
-  function currentpos() {
37
+    // returns current position
38
+    function currentpos() {
39 39
     return false;
40
-  }
40
+    }
41 41
 
42
-  // returns length of entire stream (limit for seekto()s)
43
-  function length() {
42
+    // returns length of entire stream (limit for seekto()s)
43
+    function length() {
44 44
     return false;
45
-  }
45
+    }
46 46
 };
47 47
 
48 48
 class StringReader {
49
-  var $_pos;
50
-  var $_str;
49
+    var $_pos;
50
+    var $_str;
51 51
 
52
-  function __construct($str='') {
52
+    function __construct($str='') {
53 53
     $this->_str = $str;
54 54
     $this->_pos = 0;
55
-  }
55
+    }
56 56
 
57
-  function read($bytes) {
57
+    function read($bytes) {
58 58
     $data = substr($this->_str, $this->_pos, $bytes);
59 59
     $this->_pos += $bytes;
60 60
     if (strlen($this->_str)<$this->_pos)
61
-      $this->_pos = strlen($this->_str);
61
+        $this->_pos = strlen($this->_str);
62 62
 
63 63
     return $data;
64
-  }
64
+    }
65 65
 
66
-  function seekto($pos) {
66
+    function seekto($pos) {
67 67
     $this->_pos = $pos;
68 68
     if (strlen($this->_str)<$this->_pos)
69
-      $this->_pos = strlen($this->_str);
69
+        $this->_pos = strlen($this->_str);
70 70
     return $this->_pos;
71
-  }
71
+    }
72 72
 
73
-  function currentpos() {
73
+    function currentpos() {
74 74
     return $this->_pos;
75
-  }
75
+    }
76 76
 
77
-  function length() {
77
+    function length() {
78 78
     return strlen($this->_str);
79
-  }
79
+    }
80 80
 
81 81
 };
82 82
 
83 83
 
84 84
 class FileReader {
85
-  var $_pos;
86
-  var $_fd;
87
-  var $_length;
85
+    var $_pos;
86
+    var $_fd;
87
+    var $_length;
88 88
 
89
-  function __construct($filename) {
89
+    function __construct($filename) {
90 90
     if (file_exists($filename)) {
91 91
 
92
-      $this->_length=filesize($filename);
93
-      $this->_pos = 0;
94
-      $this->_fd = fopen($filename,'rb');
95
-      if (!$this->_fd) {
92
+        $this->_length=filesize($filename);
93
+        $this->_pos = 0;
94
+        $this->_fd = fopen($filename,'rb');
95
+        if (!$this->_fd) {
96 96
         $this->error = 3; // Cannot read file, probably permissions
97 97
         return false;
98
-      }
98
+        }
99 99
     } else {
100
-      $this->error = 2; // File doesn't exist
101
-      return false;
100
+        $this->error = 2; // File doesn't exist
101
+        return false;
102
+    }
102 103
     }
103
-  }
104 104
 
105
-  function read($bytes) {
105
+    function read($bytes) {
106 106
     if ($bytes) {
107
-      fseek($this->_fd, $this->_pos);
107
+        fseek($this->_fd, $this->_pos);
108 108
 
109
-      // PHP 5.1.1 does not read more than 8192 bytes in one fread()
110
-      // the discussions at PHP Bugs suggest it's the intended behaviour
111
-      $data = '';
112
-      while ($bytes > 0) {
109
+        // PHP 5.1.1 does not read more than 8192 bytes in one fread()
110
+        // the discussions at PHP Bugs suggest it's the intended behaviour
111
+        $data = '';
112
+        while ($bytes > 0) {
113 113
         $chunk  = fread($this->_fd, $bytes);
114 114
         $data  .= $chunk;
115 115
         $bytes -= strlen($chunk);
116
-      }
117
-      $this->_pos = ftell($this->_fd);
116
+        }
117
+        $this->_pos = ftell($this->_fd);
118 118
 
119
-      return $data;
119
+        return $data;
120 120
     } else return '';
121
-  }
121
+    }
122 122
 
123
-  function seekto($pos) {
123
+    function seekto($pos) {
124 124
     fseek($this->_fd, $pos);
125 125
     $this->_pos = ftell($this->_fd);
126 126
     return $this->_pos;
127
-  }
127
+    }
128 128
 
129
-  function currentpos() {
129
+    function currentpos() {
130 130
     return $this->_pos;
131
-  }
131
+    }
132 132
 
133
-  function length() {
133
+    function length() {
134 134
     return $this->_length;
135
-  }
135
+    }
136 136
 
137
-  function close() {
137
+    function close() {
138 138
     fclose($this->_fd);
139
-  }
139
+    }
140 140
 
141 141
 };
142 142
 
143 143
 // Preloads entire file in memory first, then creates a StringReader
144 144
 // over it (it assumes knowledge of StringReader internals)
145 145
 class CachedFileReader extends StringReader {
146
-  function __construct($filename) {
146
+    function __construct($filename) {
147 147
     if (file_exists($filename)) {
148 148
 
149
-      $length=filesize($filename);
150
-      $fd = fopen($filename,'rb');
149
+        $length=filesize($filename);
150
+        $fd = fopen($filename,'rb');
151 151
 
152
-      if (!$fd) {
152
+        if (!$fd) {
153 153
         $this->error = 3; // Cannot read file, probably permissions
154 154
         return false;
155
-      }
156
-      $this->_str = fread($fd, $length);
157
-      fclose($fd);
155
+        }
156
+        $this->_str = fread($fd, $length);
157
+        fclose($fd);
158 158
 
159 159
     } else {
160
-      $this->error = 2; // File doesn't exist
161
-      return false;
160
+        $this->error = 2; // File doesn't exist
161
+        return false;
162
+    }
162 163
     }
163
-  }
164 164
 };
165 165
 
166 166
 
Please login to merge, or discard this patch.
php-gettext/gettext.inc 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 // LC_MESSAGES is not available if php-gettext is not loaded
36 36
 // while the other constants are already available from session extension.
37 37
 if (!defined('LC_MESSAGES')) {
38
-  define('LC_MESSAGES',	5);
38
+    define('LC_MESSAGES',	5);
39 39
 }
40 40
 
41 41
 require('streams.php');
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 /* Class to hold a single domain included in $text_domains. */
55 55
 class domain {
56
-  var $l10n;
57
-  var $path;
58
-  var $codeset;
56
+    var $l10n;
57
+    var $path;
58
+    var $codeset;
59 59
 }
60 60
 
61 61
 // Utility functions
@@ -64,50 +64,50 @@  discard block
 block discarded – undo
64 64
  * Return a list of locales to try for any POSIX-style locale specification.
65 65
  */
66 66
 function get_list_of_locales($locale) {
67
-  /* Figure out all possible locale names and start with the most
67
+    /* Figure out all possible locale names and start with the most
68 68
    * specific ones.  I.e. for sr_CS.UTF-8@latin, look through all of
69 69
    * sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.
70 70
    */
71
-  $locale_names = array();
72
-  $lang = NULL;
73
-  $country = NULL;
74
-  $charset = NULL;
75
-  $modifier = NULL;
76
-  if ($locale) {
71
+    $locale_names = array();
72
+    $lang = NULL;
73
+    $country = NULL;
74
+    $charset = NULL;
75
+    $modifier = NULL;
76
+    if ($locale) {
77 77
     if (preg_match("/^(?P<lang>[a-z]{2,3})"              // language code
78
-                   ."(?:_(?P<country>[A-Z]{2}))?"           // country code
79
-                   ."(?:\.(?P<charset>[-A-Za-z0-9_]+))?"    // charset
80
-                   ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/",  // @ modifier
81
-                   $locale, $matches)) {
78
+                    ."(?:_(?P<country>[A-Z]{2}))?"           // country code
79
+                    ."(?:\.(?P<charset>[-A-Za-z0-9_]+))?"    // charset
80
+                    ."(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/",  // @ modifier
81
+                    $locale, $matches)) {
82 82
 
83
-      if (isset($matches["lang"])) $lang = $matches["lang"];
84
-      if (isset($matches["country"])) $country = $matches["country"];
85
-      if (isset($matches["charset"])) $charset = $matches["charset"];
86
-      if (isset($matches["modifier"])) $modifier = $matches["modifier"];
83
+        if (isset($matches["lang"])) $lang = $matches["lang"];
84
+        if (isset($matches["country"])) $country = $matches["country"];
85
+        if (isset($matches["charset"])) $charset = $matches["charset"];
86
+        if (isset($matches["modifier"])) $modifier = $matches["modifier"];
87 87
 
88
-      if ($modifier) {
88
+        if ($modifier) {
89 89
         if ($country) {
90
-          if ($charset)
90
+            if ($charset)
91 91
             array_push($locale_names, "${lang}_$country.$charset@$modifier");
92
-          array_push($locale_names, "${lang}_$country@$modifier");
92
+            array_push($locale_names, "${lang}_$country@$modifier");
93 93
         } elseif ($charset)
94 94
             array_push($locale_names, "${lang}.$charset@$modifier");
95 95
         array_push($locale_names, "$lang@$modifier");
96
-      }
97
-      if ($country) {
96
+        }
97
+        if ($country) {
98 98
         if ($charset)
99
-          array_push($locale_names, "${lang}_$country.$charset");
99
+            array_push($locale_names, "${lang}_$country.$charset");
100 100
         array_push($locale_names, "${lang}_$country");
101
-      } elseif ($charset)
102
-          array_push($locale_names, "${lang}.$charset");
103
-      array_push($locale_names, $lang);
101
+        } elseif ($charset)
102
+            array_push($locale_names, "${lang}.$charset");
103
+        array_push($locale_names, $lang);
104 104
     }
105 105
 
106 106
     // If the locale name doesn't match POSIX style, just include it as-is.
107 107
     if (!in_array($locale, $locale_names))
108
-      array_push($locale_names, $locale);
109
-  }
110
-  return $locale_names;
108
+        array_push($locale_names, $locale);
109
+    }
110
+    return $locale_names;
111 111
 }
112 112
 
113 113
 /**
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
         $locale_names = get_list_of_locales($locale);
127 127
         $input = null;
128 128
         foreach ($locale_names as $locale) {
129
-          $full_path = $bound_path . $locale . "/" . $subpath;
130
-          if (file_exists($full_path)) {
129
+            $full_path = $bound_path . $locale . "/" . $subpath;
130
+            if (file_exists($full_path)) {
131 131
             $input = new FileReader($full_path);
132 132
             break;
133
-          }
133
+            }
134 134
         }
135 135
 
136 136
         if (!array_key_exists($domain, $text_domains)) {
137
-          // Initialize an empty domain object.
138
-          $text_domains[$domain] = new domain();
137
+            // Initialize an empty domain object.
138
+            $text_domains[$domain] = new domain();
139 139
         }
140 140
         $text_domains[$domain]->l10n = new gettext_reader($input,
141
-                                                          $enable_cache);
141
+                                                            $enable_cache);
142 142
     }
143 143
     return $text_domains[$domain]->l10n;
144 144
 }
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
  * Returns passed in $locale, or environment variable $LANG if $locale == ''.
192 192
  */
193 193
 function _get_default_locale($locale) {
194
-  if ($locale == '') // emulate variable support
194
+    if ($locale == '') // emulate variable support
195 195
     return getenv('LANG');
196
-  else
196
+    else
197 197
     return $locale;
198 198
 }
199 199
 
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
             return _setlocale($category, $CURRENTLOCALE);
212 212
     } else {
213 213
         if (function_exists('setlocale')) {
214
-          $ret = setlocale($category, $locale);
215
-          if (($locale == '' and !$ret) or // failed setting it by env
214
+            $ret = setlocale($category, $locale);
215
+            if (($locale == '' and !$ret) or // failed setting it by env
216 216
               ($locale != '' and $ret != $locale)) { // failed setting it
217 217
             // Failed setting it according to environment.
218 218
             $CURRENTLOCALE = _get_default_locale($locale);
219 219
             $EMULATEGETTEXT = 1;
220
-          } else {
220
+            } else {
221 221
             $CURRENTLOCALE = $ret;
222 222
             $EMULATEGETTEXT = 0;
223
-          }
223
+            }
224 224
         } else {
225
-          // No function setlocale(), emulate it all.
226
-          $CURRENTLOCALE = _get_default_locale($locale);
227
-          $EMULATEGETTEXT = 1;
225
+            // No function setlocale(), emulate it all.
226
+            $CURRENTLOCALE = _get_default_locale($locale);
227
+            $EMULATEGETTEXT = 1;
228 228
         }
229 229
         // Allow locale to be changed on the go for one translation domain.
230 230
         global $text_domains, $default_domain;
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
     global $text_domains;
243 243
     // ensure $path ends with a slash ('/' should work for both, but lets still play nice)
244 244
     if (substr(php_uname(), 0, 7) == "Windows") {
245
-      if ($path[strlen($path)-1] != '\\' and $path[strlen($path)-1] != '/')
245
+        if ($path[strlen($path)-1] != '\\' and $path[strlen($path)-1] != '/')
246 246
         $path .= '\\';
247 247
     } else {
248
-      if ($path[strlen($path)-1] != '/')
248
+        if ($path[strlen($path)-1] != '/')
249 249
         $path .= '/';
250 250
     }
251 251
     if (!array_key_exists($domain, $text_domains)) {
252
-      // Initialize an empty domain object.
253
-      $text_domains[$domain] = new domain();
252
+        // Initialize an empty domain object.
253
+        $text_domains[$domain] = new domain();
254 254
     }
255 255
     $text_domains[$domain]->path = $path;
256 256
 }
@@ -427,29 +427,29 @@  discard block
 block discarded – undo
427 427
 }
428 428
 function T_dcngettext($domain, $singular, $plural, $number, $category) {
429 429
     if (_check_locale_and_function())
430
-      return dcngettext($domain, $singular, $plural, $number, $category);
430
+        return dcngettext($domain, $singular, $plural, $number, $category);
431 431
     else return _dcngettext($domain, $singular, $plural, $number, $category);
432 432
 }
433 433
 
434 434
 function T_pgettext($context, $msgid) {
435
-  if (_check_locale_and_function('pgettext'))
436
-      return pgettext($context, $msgid);
437
-  else
438
-      return _pgettext($context, $msgid);
435
+    if (_check_locale_and_function('pgettext'))
436
+        return pgettext($context, $msgid);
437
+    else
438
+        return _pgettext($context, $msgid);
439 439
 }
440 440
 
441 441
 function T_dpgettext($domain, $context, $msgid) {
442
-  if (_check_locale_and_function('dpgettext'))
443
-      return dpgettext($domain, $context, $msgid);
444
-  else
445
-      return _dpgettext($domain, $context, $msgid);
442
+    if (_check_locale_and_function('dpgettext'))
443
+        return dpgettext($domain, $context, $msgid);
444
+    else
445
+        return _dpgettext($domain, $context, $msgid);
446 446
 }
447 447
 
448 448
 function T_dcpgettext($domain, $context, $msgid, $category) {
449
-  if (_check_locale_and_function('dcpgettext'))
450
-      return dcpgettext($domain, $context, $msgid, $category);
451
-  else
452
-      return _dcpgettext($domain, $context, $msgid, $category);
449
+    if (_check_locale_and_function('dcpgettext'))
450
+        return dcpgettext($domain, $context, $msgid, $category);
451
+    else
452
+        return _dcpgettext($domain, $context, $msgid, $category);
453 453
 }
454 454
 
455 455
 function T_npgettext($context, $singular, $plural, $number) {
@@ -460,17 +460,17 @@  discard block
 block discarded – undo
460 460
 }
461 461
 
462 462
 function T_dnpgettext($domain, $context, $singular, $plural, $number) {
463
-  if (_check_locale_and_function('dnpgettext'))
464
-      return dnpgettext($domain, $context, $singular, $plural, $number);
465
-  else
466
-      return _dnpgettext($domain, $context, $singular, $plural, $number);
463
+    if (_check_locale_and_function('dnpgettext'))
464
+        return dnpgettext($domain, $context, $singular, $plural, $number);
465
+    else
466
+        return _dnpgettext($domain, $context, $singular, $plural, $number);
467 467
 }
468 468
 
469 469
 function T_dcnpgettext($domain, $context, $singular, $plural,
470
-                       $number, $category) {
470
+                        $number, $category) {
471 471
     if (_check_locale_and_function('dcnpgettext'))
472 472
         return dcnpgettext($domain, $context, $singular,
473
-                           $plural, $number, $category);
473
+                            $plural, $number, $category);
474 474
     else
475 475
         return _dcnpgettext($domain, $context, $singular,
476 476
                             $plural, $number, $category);
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
         return _dcpgettext($domain, $context, $msgid, $category);
528 528
     }
529 529
     function dcnpgettext($domain, $context, $singular, $plural,
530
-                         $number, $category) {
531
-      return _dcnpgettext($domain, $context, $singular, $plural,
532
-                          $number, $category);
530
+                            $number, $category) {
531
+        return _dcnpgettext($domain, $context, $singular, $plural,
532
+                            $number, $category);
533 533
     }
534 534
 }
535 535
 
Please login to merge, or discard this patch.
FileHandler.class.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@
 block discarded – undo
62 62
     function getControls()
63 63
     {
64 64
         return FileHandler::CURSOR | FileHandler::ZOOM |
65
-               FileHandler::HOME | FileHandler::END |
66
-               FileHandler::PRIOR | FileHandler::NEXT |
67
-               FileHandler::DOWNLOAD;
65
+                FileHandler::HOME | FileHandler::END |
66
+                FileHandler::PRIOR | FileHandler::NEXT |
67
+                FileHandler::DOWNLOAD;
68 68
     }
69 69
     function show($path)
70 70
     {
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1038,12 +1038,12 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 <div id="workbench_right">
1040 1040
     <?php
1041
-      # Show authorized user name (and address) and allow logout.
1042
-      if ($user) {
1041
+        # Show authorized user name (and address) and allow logout.
1042
+        if ($user) {
1043 1043
         echo("<p><a href=\"logout.php\" title=\"" .
1044 1044
             __('Disconnect the current user') .
1045 1045
             "\">$user<i class=\"fa fa-sign-out\"></i></a></p>");
1046
-      }
1046
+        }
1047 1047
     ?>
1048 1048
 
1049 1049
     <table class="userlist" summary="<?=__('User list')?>" title="<?=__('List of connected users')?>">
@@ -1087,9 +1087,9 @@  discard block
 block discarded – undo
1087 1087
                  src="theme/<?=CONFIG_THEME?>/palma-logo-49x18.png"
1088 1088
                  alt="PalMA"> <?=__('Team display')?>
1089 1089
         <?php
1090
-              if (isset($_SESSION['monitor'])) {
1091
-                  echo('(' . $_SESSION['monitor'] . ')');
1092
-              }
1090
+                if (isset($_SESSION['monitor'])) {
1091
+                    echo('(' . $_SESSION['monitor'] . ')');
1092
+                }
1093 1093
         ?>
1094 1094
         </caption>
1095 1095
         <tbody id='maindisplay'>
Please login to merge, or discard this patch.
selectplace/learningcenter.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,25 +60,25 @@
 block discarded – undo
60 60
 </div>
61 61
 
62 62
 <?php
63
-     session_start();
64
-     session_destroy();
63
+        session_start();
64
+        session_destroy();
65 65
 
66
-  # TODO: User sessions should be authorized to one display only.
67
-  # If they select this page, they must not be allowed to select
68
-  # a new display without being logged out.
66
+    # TODO: User sessions should be authorized to one display only.
67
+    # If they select this page, they must not be allowed to select
68
+    # a new display without being logged out.
69 69
 
70
-  # Show authorized user name and allow logout.
71
-  $username = false;
72
-  if (isset($_SESSION['username'])) {
70
+    # Show authorized user name and allow logout.
71
+    $username = false;
72
+    if (isset($_SESSION['username'])) {
73 73
     # PHP session based authorization.
74 74
     $username = $_SESSION['username'];
75
-  } elseif (isset($_SERVER["PHP_AUTH_USER"])) {
75
+    } elseif (isset($_SERVER["PHP_AUTH_USER"])) {
76 76
     # .htaccess basic authorization.
77 77
     $username = $_SERVER["PHP_AUTH_USER"];
78
-  }
79
-  if ($username) {
78
+    }
79
+    if ($username) {
80 80
     echo("<p>$username <a href=\"logout.php\">abmelden</a></p>");
81
-  }
81
+    }
82 82
 ?>
83 83
 
84 84
 </body>
Please login to merge, or discard this patch.
login.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         return $device;
48 48
     }
49 49
 
50
-  function checkCredentials($username, $password) {
50
+    function checkCredentials($username, $password) {
51 51
     // Check username + password against fixed internal value and
52 52
     // external proxy with authentisation.
53 53
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $errtext = __('Invalid credentials!');
105 105
     }
106 106
     return false;
107
-  }
107
+    }
108 108
 
109 109
     $username = '';
110 110
     $pin = '';
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $posted_pin = $_REQUEST['pin'];
114 114
     }
115 115
 
116
-  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
116
+    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
117 117
     session_start();
118 118
     $username = escapeshellcmd($_POST['username']);
119 119
     $password = '';
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
         $_SESSION['monitor'] = CONFIG_STATIONNAME;
142 142
         $dbcon->addUser($username, $dbcon->ipAddress(), getDevice());
143 143
 
144
-       // Weiterleitung zur geschützten Startseite
145
-       if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
144
+        // Weiterleitung zur geschützten Startseite
145
+        if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
146 146
         if (php_sapi_name() == 'cgi') {
147
-         header('Status: 303 See Other');
148
-         }
147
+            header('Status: 303 See Other');
148
+            }
149 149
         else {
150
-         header('HTTP/1.1 303 See Other');
151
-         }
150
+            header('HTTP/1.1 303 See Other');
151
+            }
152 152
         }
153 153
 
154 154
         header('Location: ' . CONFIG_START_URL);
155 155
         exit;
156 156
     }
157
-  }
157
+    }
158 158
 ?>
159 159
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
160 160
        "http://www.w3.org/TR/html4/strict.dtd">
Please login to merge, or discard this patch.