@@ -70,7 +70,9 @@ discard block |
||
70 | 70 | if (is_array($options)) |
71 | 71 | { |
72 | 72 | // set table prefix if given |
73 | - if (array_key_exists('tbl', $options)) self::$_prefix = $options['tbl']; |
|
73 | + if (array_key_exists('tbl', $options)) { |
|
74 | + self::$_prefix = $options['tbl']; |
|
75 | + } |
|
74 | 76 | |
75 | 77 | // initialize the db connection with new options |
76 | 78 | if ( |
@@ -121,9 +123,10 @@ discard block |
||
121 | 123 | { |
122 | 124 | self::_createConfigTable(); |
123 | 125 | // if we only needed to create the config table, the DB is older then 0.22 |
124 | - if ($db_tables_exist) $db_version = '0.21'; |
|
125 | - } |
|
126 | - else |
|
126 | + if ($db_tables_exist) { |
|
127 | + $db_version = '0.21'; |
|
128 | + } |
|
129 | + } else |
|
127 | 130 | { |
128 | 131 | $db_version = self::_getConfig('VERSION'); |
129 | 132 | } |
@@ -133,8 +136,7 @@ discard block |
||
133 | 136 | { |
134 | 137 | self::_upgradeDatabase($db_version); |
135 | 138 | } |
136 | - } |
|
137 | - else |
|
139 | + } else |
|
138 | 140 | { |
139 | 141 | throw new Exception( |
140 | 142 | 'Missing configuration for key dsn, usr, pwd or opt in the section model_options, please check your configuration file', 6 |
@@ -236,7 +238,9 @@ discard block |
||
236 | 238 | self::$_cache[$pasteid]->data = $paste['data']; |
237 | 239 | |
238 | 240 | $meta = json_decode($paste['meta']); |
239 | - if (!is_object($meta)) $meta = new stdClass; |
|
241 | + if (!is_object($meta)) { |
|
242 | + $meta = new stdClass; |
|
243 | + } |
|
240 | 244 | |
241 | 245 | // support older attachments |
242 | 246 | if (property_exists($meta, 'attachment')) |
@@ -263,13 +267,19 @@ discard block |
||
263 | 267 | $expire_date = (int) $paste['expiredate']; |
264 | 268 | if ( |
265 | 269 | $expire_date > 0 |
266 | - ) self::$_cache[$pasteid]->meta->expire_date = $expire_date; |
|
270 | + ) { |
|
271 | + self::$_cache[$pasteid]->meta->expire_date = $expire_date; |
|
272 | + } |
|
267 | 273 | if ( |
268 | 274 | $paste['opendiscussion'] |
269 | - ) self::$_cache[$pasteid]->meta->opendiscussion = true; |
|
275 | + ) { |
|
276 | + self::$_cache[$pasteid]->meta->opendiscussion = true; |
|
277 | + } |
|
270 | 278 | if ( |
271 | 279 | $paste['burnafterreading'] |
272 | - ) self::$_cache[$pasteid]->meta->burnafterreading = true; |
|
280 | + ) { |
|
281 | + self::$_cache[$pasteid]->meta->burnafterreading = true; |
|
282 | + } |
|
273 | 283 | } |
274 | 284 | } |
275 | 285 | |
@@ -295,7 +305,9 @@ discard block |
||
295 | 305 | ); |
296 | 306 | if ( |
297 | 307 | array_key_exists($pasteid, self::$_cache) |
298 | - ) unset(self::$_cache[$pasteid]); |
|
308 | + ) { |
|
309 | + unset(self::$_cache[$pasteid]); |
|
310 | + } |
|
299 | 311 | } |
300 | 312 | |
301 | 313 | /** |
@@ -309,7 +321,9 @@ discard block |
||
309 | 321 | { |
310 | 322 | if ( |
311 | 323 | !array_key_exists($pasteid, self::$_cache) |
312 | - ) self::$_cache[$pasteid] = $this->read($pasteid); |
|
324 | + ) { |
|
325 | + self::$_cache[$pasteid] = $this->read($pasteid); |
|
326 | + } |
|
313 | 327 | return (bool) self::$_cache[$pasteid]; |
314 | 328 | } |
315 | 329 | |
@@ -367,10 +381,12 @@ discard block |
||
367 | 381 | $comments[$i]->data = $row['data']; |
368 | 382 | $comments[$i]->meta = new stdClass; |
369 | 383 | $comments[$i]->meta->postdate = (int) $row['postdate']; |
370 | - if (array_key_exists('nickname', $row)) |
|
371 | - $comments[$i]->meta->nickname = $row['nickname']; |
|
372 | - if (array_key_exists('vizhash', $row)) |
|
373 | - $comments[$i]->meta->vizhash = $row['vizhash']; |
|
384 | + if (array_key_exists('nickname', $row)) { |
|
385 | + $comments[$i]->meta->nickname = $row['nickname']; |
|
386 | + } |
|
387 | + if (array_key_exists('vizhash', $row)) { |
|
388 | + $comments[$i]->meta->vizhash = $row['vizhash']; |
|
389 | + } |
|
374 | 390 | } |
375 | 391 | ksort($comments); |
376 | 392 | } |
@@ -523,8 +539,7 @@ discard block |
||
523 | 539 | if (self::$_type === 'mysql') |
524 | 540 | { |
525 | 541 | $after_key = ", PRIMARY KEY ($key)"; |
526 | - } |
|
527 | - else |
|
542 | + } else |
|
528 | 543 | { |
529 | 544 | $main_key = ' PRIMARY KEY'; |
530 | 545 | } |
@@ -654,8 +669,7 @@ discard block |
||
654 | 669 | ' ADD PRIMARY KEY (dataid), MODIFY COLUMN data BLOB, ' . |
655 | 670 | 'MODIFY COLUMN nickname BLOB, MODIFY COLUMN vizhash BLOB;' |
656 | 671 | ); |
657 | - } |
|
658 | - else |
|
672 | + } else |
|
659 | 673 | { |
660 | 674 | self::$_db->exec( |
661 | 675 | 'CREATE UNIQUE INDEX primary ON ' . self::_sanitizeIdentifier('paste') . '(dataid);' |