Passed
Push — 1.10.x ( a2cc02...b21e58 )
by Yannick
608:36 queued 565:17
created
main/inc/lib/pear/Pager/Pager.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@
 block discarded – undo
148 148
             eval('$this = Pager::factory($options);');
149 149
         } else { //php5 is case sensitive
150 150
             $msg = 'Pager constructor is deprecated.'
151
-                  .' You must use the "Pager::factory($params)" method'
152
-                  .' instead of "new Pager($params)"';
151
+                    .' You must use the "Pager::factory($params)" method'
152
+                    .' instead of "new Pager($params)"';
153 153
             trigger_error($msg, E_USER_ERROR);
154 154
         }
155 155
     }
Please login to merge, or discard this patch.
main/inc/lib/pear/Image/Text/Exception.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Exception for Image_Text
4
- *
5
- * PHP version 5
6
- *
7
- * @category Image
8
- * @package  Image_Text
9
- * @author   Daniel O'Connor <[email protected]>
10
- * @license  http://www.php.net/license/3_01.txt PHP License
11
- * @link     http://pear.php.net/package/Image_Text
12
- */
3
+     * Exception for Image_Text
4
+     *
5
+     * PHP version 5
6
+     *
7
+     * @category Image
8
+     * @package  Image_Text
9
+     * @author   Daniel O'Connor <[email protected]>
10
+     * @license  http://www.php.net/license/3_01.txt PHP License
11
+     * @link     http://pear.php.net/package/Image_Text
12
+     */
13 13
 
14 14
 /**
15 15
  * Exception for Image_Text
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 1 patch
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -249,282 +249,282 @@
 block discarded – undo
249 249
         return $affected_rows;
250 250
     }
251 251
 
252
-	/**
253
-	 * Get all plugins path inside dashboard directory
254
-	 * @return array name plugins directories
255
-	 */
256
-	public static function getPossibleDashboardPluginsPath()
252
+    /**
253
+     * Get all plugins path inside dashboard directory
254
+     * @return array name plugins directories
255
+     */
256
+    public static function getPossibleDashboardPluginsPath()
257 257
     {
258
-		// get all plugins path inside plugin directory
259
-		/* We scan the plugin directory. Each folder is a potential plugin. */
260
-		$possiblePlugins = array();
261
-		$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
262
-		$handle = @opendir($dashboard_pluginpath);
263
-		while (false !== ($file = readdir($handle))) {
264
-			if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
265
-				$possiblePlugins[] = $file;
266
-			}
267
-		}
268
-		@closedir($handle);
269
-
270
-		return $possiblePlugins;
271
-	}
272
-
273
-	/**
274
-	 * Get all blocks data without plugin directory
275
-	 * @return array Block data
276
-	 */
277
-	public static function get_block_data_without_plugin()
258
+        // get all plugins path inside plugin directory
259
+        /* We scan the plugin directory. Each folder is a potential plugin. */
260
+        $possiblePlugins = array();
261
+        $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
262
+        $handle = @opendir($dashboard_pluginpath);
263
+        while (false !== ($file = readdir($handle))) {
264
+            if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
265
+                $possiblePlugins[] = $file;
266
+            }
267
+        }
268
+        @closedir($handle);
269
+
270
+        return $possiblePlugins;
271
+    }
272
+
273
+    /**
274
+     * Get all blocks data without plugin directory
275
+     * @return array Block data
276
+     */
277
+    public static function get_block_data_without_plugin()
278 278
     {
279
-		$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
280
-		$possibleplugins = self::getPossibleDashboardPluginsPath();
281
-
282
-		// We check if plugin exists inside directory for updating active field
283
-		$sql = "SELECT * FROM $tbl_block";
284
-		$rs = Database::query($sql);
285
-		if (Database::num_rows($rs) > 0){
286
-			while ($row = Database::fetch_array($rs)) {
287
-				$path = $row['path'];
288
-				if (!in_array($row['path'],$possibleplugins)) {
289
-					$active = 0;
290
-				} else {
291
-					$active = 1;
292
-				}
293
-				// update active
294
-				$upd = "UPDATE $tbl_block SET active = '$active'
279
+        $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
280
+        $possibleplugins = self::getPossibleDashboardPluginsPath();
281
+
282
+        // We check if plugin exists inside directory for updating active field
283
+        $sql = "SELECT * FROM $tbl_block";
284
+        $rs = Database::query($sql);
285
+        if (Database::num_rows($rs) > 0){
286
+            while ($row = Database::fetch_array($rs)) {
287
+                $path = $row['path'];
288
+                if (!in_array($row['path'],$possibleplugins)) {
289
+                    $active = 0;
290
+                } else {
291
+                    $active = 1;
292
+                }
293
+                // update active
294
+                $upd = "UPDATE $tbl_block SET active = '$active'
295 295
 				        WHERE path = '".$row['path']."'";
296
-				Database::query($upd);
297
-			}
298
-		}
299
-
300
-		// get disabled block data
301
-		$block_data = array();
302
-		$sql = "SELECT * FROM $tbl_block WHERE active = 0";
303
-		$rs_block = Database::query($sql);
304
-		if (Database::num_rows($rs_block) > 0) {
305
-			while ($row_block = Database::fetch_array($rs_block)) {
306
-				$block_data[] = $row_block;
307
-			}
308
-		}
309
-
310
-		return $block_data;
311
-
312
-	}
313
-
314
-	/**
315
-	 * get data about enabled dashboard block (stored insise block table)
316
-	 * @param  string	plugin path
317
-	 * @return array 	data
318
-	 */
319
-	public static function get_enabled_dashboard_blocks($path = '')
296
+                Database::query($upd);
297
+            }
298
+        }
299
+
300
+        // get disabled block data
301
+        $block_data = array();
302
+        $sql = "SELECT * FROM $tbl_block WHERE active = 0";
303
+        $rs_block = Database::query($sql);
304
+        if (Database::num_rows($rs_block) > 0) {
305
+            while ($row_block = Database::fetch_array($rs_block)) {
306
+                $block_data[] = $row_block;
307
+            }
308
+        }
309
+
310
+        return $block_data;
311
+
312
+    }
313
+
314
+    /**
315
+     * get data about enabled dashboard block (stored insise block table)
316
+     * @param  string	plugin path
317
+     * @return array 	data
318
+     */
319
+    public static function get_enabled_dashboard_blocks($path = '')
320 320
     {
321
-		$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
322
-		$condition_path = '';
323
-		if (!empty($path)) {
324
-			$path = Database::escape_string($path);
325
-			$condition_path = ' AND path = "'.$path.'" ';
326
-		}
327
-
328
-		$sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
329
-		$rs  = Database::query($sql);
330
-		$block_data = array();
331
-		if (Database::num_rows($rs) > 0) {
332
-			while ($row = Database::fetch_array($rs)) {
333
-				$block_data[$row['path']] = $row;
334
-			}
335
-		}
336
-		return $block_data;
337
-	}
338
-
339
-	/**
340
-	 * display user dashboard list
341
-	 * @param int  User id
342
-	 * @return void
343
-	 */
344
-	public static function display_user_dashboard_list($user_id)
321
+        $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
322
+        $condition_path = '';
323
+        if (!empty($path)) {
324
+            $path = Database::escape_string($path);
325
+            $condition_path = ' AND path = "'.$path.'" ';
326
+        }
327
+
328
+        $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
329
+        $rs  = Database::query($sql);
330
+        $block_data = array();
331
+        if (Database::num_rows($rs) > 0) {
332
+            while ($row = Database::fetch_array($rs)) {
333
+                $block_data[$row['path']] = $row;
334
+            }
335
+        }
336
+        return $block_data;
337
+    }
338
+
339
+    /**
340
+     * display user dashboard list
341
+     * @param int  User id
342
+     * @return void
343
+     */
344
+    public static function display_user_dashboard_list($user_id)
345 345
     {
346
-		$enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
347
-		$user_block_data = self::get_user_block_data($user_id);
348
-
349
-		if (count($enabled_dashboard_plugins) > 0) {
350
-			echo '<div style="margin-top:20px">';
351
-			echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
352
-			echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
353
-			echo '<table class="data_table">';
354
-			echo '<tr>';
355
-			echo '<th width="5%">';
356
-			echo get_lang('Enabled');
357
-			echo '</th>';
358
-			echo '<th width="30%">';
359
-			echo get_lang('Name');
360
-			echo '</th>';
361
-			echo '<th width="40%">';
362
-			echo get_lang('Description');
363
-			echo '</th>';
364
-			echo '<th>';
365
-			echo get_lang('ColumnPosition');
366
-			echo '</th>';
367
-			echo '</tr>';
368
-
369
-			// We display all enabled plugins and the checkboxes
370
-			foreach ($enabled_dashboard_plugins as $block) {
371
-
372
-				$path = $block['path'];
373
-				$controller_class = $block['controller'];
374
-				$filename_controller = $path.'.class.php';
375
-				$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
376
-				require_once $dashboard_plugin_path.$filename_controller;
377
-				if (class_exists($controller_class)) {
378
-					$obj_block = new $controller_class($user_id);
379
-
380
-					// check if user is allowed to see the block
381
-					if (method_exists($obj_block, 'is_block_visible_for_user')) {
382
-						$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
-						if (!$is_block_visible_for_user) continue;
384
-					}
385
-
386
-					echo '<tr>';
387
-					// checkboxes
388
-					self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
389
-					echo '<td>'.$block['name'].'</td>';
390
-					echo '<td>'.$block['description'].'</td>';
391
-					echo '<td>
346
+        $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
347
+        $user_block_data = self::get_user_block_data($user_id);
348
+
349
+        if (count($enabled_dashboard_plugins) > 0) {
350
+            echo '<div style="margin-top:20px">';
351
+            echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
352
+            echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
353
+            echo '<table class="data_table">';
354
+            echo '<tr>';
355
+            echo '<th width="5%">';
356
+            echo get_lang('Enabled');
357
+            echo '</th>';
358
+            echo '<th width="30%">';
359
+            echo get_lang('Name');
360
+            echo '</th>';
361
+            echo '<th width="40%">';
362
+            echo get_lang('Description');
363
+            echo '</th>';
364
+            echo '<th>';
365
+            echo get_lang('ColumnPosition');
366
+            echo '</th>';
367
+            echo '</tr>';
368
+
369
+            // We display all enabled plugins and the checkboxes
370
+            foreach ($enabled_dashboard_plugins as $block) {
371
+
372
+                $path = $block['path'];
373
+                $controller_class = $block['controller'];
374
+                $filename_controller = $path.'.class.php';
375
+                $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
376
+                require_once $dashboard_plugin_path.$filename_controller;
377
+                if (class_exists($controller_class)) {
378
+                    $obj_block = new $controller_class($user_id);
379
+
380
+                    // check if user is allowed to see the block
381
+                    if (method_exists($obj_block, 'is_block_visible_for_user')) {
382
+                        $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
+                        if (!$is_block_visible_for_user) continue;
384
+                    }
385
+
386
+                    echo '<tr>';
387
+                    // checkboxes
388
+                    self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
389
+                    echo '<td>'.$block['name'].'</td>';
390
+                    echo '<td>'.$block['description'].'</td>';
391
+                    echo '<td>
392 392
                             <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
393 393
                             <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
394 394
                             <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
395 395
                             </select>
396 396
                           </td>';
397
-					echo '</tr>';
398
-				} else {
399
-					echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400
-				}
401
-			}
402
-
403
-			echo '</table>';
404
-			echo '<div class="row"><div class="col-md-12">';
405
-			echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
397
+                    echo '</tr>';
398
+                } else {
399
+                    echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400
+                }
401
+            }
402
+
403
+            echo '</table>';
404
+            echo '<div class="row"><div class="col-md-12">';
405
+            echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
406 406
                 get_lang('EnableDashboardBlock').'</button></form>';
407
-			echo '</div></div>';
408
-		} else {
409
-			echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
410
-			if (api_is_platform_admin()) {
411
-				echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
407
+            echo '</div></div>';
408
+        } else {
409
+            echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
410
+            if (api_is_platform_admin()) {
411
+                echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
412 412
                     get_lang('ConfigureDashboardPlugin').'</a>';
413
-			}
414
-		}
415
-	}
416
-
417
-	/**
418
-	 * display checkboxes for user dashboard list
419
-	 * @param int 	User id
420
-	 * @param int	Block id
421
-	 * @return void
422
-	 */
423
-	public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
424
-
425
-		$user_id = intval($user_id);
426
-		$user_block_data = self::get_user_block_data($user_id);
427
-		$enabled_blocks_id = array_keys($user_block_data);
428
-
429
-		$checked = '';
430
-		if (in_array($block_id, $enabled_blocks_id)) {
431
-			$checked = "checked";
432
-		}
433
-
434
-		echo "<td align=\"center\">";
435
-		echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
436
-		echo "</td>";
437
-	}
438
-
439
-	/**
440
-	 * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
441
-	 * @param int User id
442
-	 * @param array selected blocks
443
-	 * @param array columns position
444
-	 * @return bool
445
-	 */
446
-	public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
447
-		$selected_blocks_id  = array();
448
-		if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
449
-			$selected_blocks_id = array_keys($enabled_blocks);
450
-		}
451
-
452
-		// build data for storing inside extra user field
453
-		$fname = 'dashboard';
454
-		$fvalue = array();
455
-		foreach ($selected_blocks_id as $block_id) {
456
-			$fvalue[] = $block_id.':'.$columns[$block_id];
457
-		}
413
+            }
414
+        }
415
+    }
416
+
417
+    /**
418
+     * display checkboxes for user dashboard list
419
+     * @param int 	User id
420
+     * @param int	Block id
421
+     * @return void
422
+     */
423
+    public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
424
+
425
+        $user_id = intval($user_id);
426
+        $user_block_data = self::get_user_block_data($user_id);
427
+        $enabled_blocks_id = array_keys($user_block_data);
428
+
429
+        $checked = '';
430
+        if (in_array($block_id, $enabled_blocks_id)) {
431
+            $checked = "checked";
432
+        }
433
+
434
+        echo "<td align=\"center\">";
435
+        echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
436
+        echo "</td>";
437
+    }
438
+
439
+    /**
440
+     * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
441
+     * @param int User id
442
+     * @param array selected blocks
443
+     * @param array columns position
444
+     * @return bool
445
+     */
446
+    public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
447
+        $selected_blocks_id  = array();
448
+        if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
449
+            $selected_blocks_id = array_keys($enabled_blocks);
450
+        }
451
+
452
+        // build data for storing inside extra user field
453
+        $fname = 'dashboard';
454
+        $fvalue = array();
455
+        foreach ($selected_blocks_id as $block_id) {
456
+            $fvalue[] = $block_id.':'.$columns[$block_id];
457
+        }
458 458
         $upd_extra_field = UserManager::update_extra_field_value(
459 459
             $user_id,
460 460
             $fname,
461 461
             $fvalue
462 462
         );
463 463
 
464
-		return $upd_extra_field;
464
+        return $upd_extra_field;
465 465
 
466
-	}
466
+    }
467 467
 
468
-	/**
469
-	 * This function get user block data (block id with its number of column) from extra user data
470
-	 * @param int  		User id
471
-	 * @return array  	data (block_id,column)
472
-	 */
473
-	public static function get_user_block_data($user_id)
468
+    /**
469
+     * This function get user block data (block id with its number of column) from extra user data
470
+     * @param int  		User id
471
+     * @return array  	data (block_id,column)
472
+     */
473
+    public static function get_user_block_data($user_id)
474 474
     {
475
-		$user_id = intval($user_id);
476
-		$field_variable = 'dashboard';
477
-		$extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
478
-		$extra_user_data = explode(';',$extra_user_data[$field_variable]);
479
-		$data = array();
480
-		foreach ($extra_user_data as $extra) {
481
-			$split_extra = explode(':',$extra);
482
-			if (!empty($split_extra)) {
483
-				$block_id = $split_extra[0];
484
-				$column = isset($split_extra[1]) ? $split_extra[1] : null;
485
-				$data[$block_id] = array('block_id' => $block_id, 'column' => $column);
486
-			}
487
-		}
488
-
489
-		return $data;
490
-	}
491
-
492
-	/**
493
-	 * This function update extra user blocks data after closing a dashboard block
494
-	 * @param int 		User id
495
-	 * @param string	plugin path
496
-	 * @return bool
497
-	 */
498
-	public static function close_user_block($user_id, $path)
475
+        $user_id = intval($user_id);
476
+        $field_variable = 'dashboard';
477
+        $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
478
+        $extra_user_data = explode(';',$extra_user_data[$field_variable]);
479
+        $data = array();
480
+        foreach ($extra_user_data as $extra) {
481
+            $split_extra = explode(':',$extra);
482
+            if (!empty($split_extra)) {
483
+                $block_id = $split_extra[0];
484
+                $column = isset($split_extra[1]) ? $split_extra[1] : null;
485
+                $data[$block_id] = array('block_id' => $block_id, 'column' => $column);
486
+            }
487
+        }
488
+
489
+        return $data;
490
+    }
491
+
492
+    /**
493
+     * This function update extra user blocks data after closing a dashboard block
494
+     * @param int 		User id
495
+     * @param string	plugin path
496
+     * @return bool
497
+     */
498
+    public static function close_user_block($user_id, $path)
499 499
     {
500
-		$enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
501
-		$user_block_data = self::get_user_block_data($user_id);
502
-
503
-		foreach ($enabled_dashboard_blocks as $enabled_block) {
504
-			unset($user_block_data[$enabled_block['id']]);
505
-		}
506
-
507
-		// get columns and blocks id for updating extra user data
508
-		$columns = array();
509
-		$user_blocks_id = array();
510
-		foreach ($user_block_data as $data) {
511
-			$user_blocks_id[$data['block_id']] = true;
512
-			$columns[$data['block_id']] = $data['column'];
513
-		}
514
-
515
-		// update extra user blocks data
516
-		$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
517
-
518
-		return $upd_extra_field;
519
-	}
520
-
521
-	/**
522
-	 * get links for styles from dashboard plugins
523
-	 * @return string   links
524
-	 */
525
-	public static function get_links_for_styles_from_dashboard_plugins() {
526
-
527
-		return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
528
-	}
500
+        $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
501
+        $user_block_data = self::get_user_block_data($user_id);
502
+
503
+        foreach ($enabled_dashboard_blocks as $enabled_block) {
504
+            unset($user_block_data[$enabled_block['id']]);
505
+        }
506
+
507
+        // get columns and blocks id for updating extra user data
508
+        $columns = array();
509
+        $user_blocks_id = array();
510
+        foreach ($user_block_data as $data) {
511
+            $user_blocks_id[$data['block_id']] = true;
512
+            $columns[$data['block_id']] = $data['column'];
513
+        }
514
+
515
+        // update extra user blocks data
516
+        $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
517
+
518
+        return $upd_extra_field;
519
+    }
520
+
521
+    /**
522
+     * get links for styles from dashboard plugins
523
+     * @return string   links
524
+     */
525
+    public static function get_links_for_styles_from_dashboard_plugins() {
526
+
527
+        return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
528
+    }
529 529
 
530 530
 }
Please login to merge, or discard this patch.
main/inc/lib/event_email_template.class.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * Constructor
14 14
      */
15
-	public function __construct()
15
+    public function __construct()
16 16
     {
17 17
         $this->table =  Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
18
-	}
18
+    }
19 19
 
20 20
     public function get_all($where_conditions = array())
21 21
     {
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * Displays the title + grid
31 31
      */
32
-	public function display()
32
+    public function display()
33 33
     {
34
-		// action links
35
-		$content = Display::actions(array(
34
+        // action links
35
+        $content = Display::actions(array(
36 36
                 array(
37 37
                     'url' => 'event_type.php' ,
38 38
                     'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM)
39
-                 )
39
+                    )
40 40
             )
41 41
         );
42 42
         $content .= Display::grid_html('event_email_template');
43 43
         return $content;
44
-	}
44
+    }
45 45
 
46 46
     public function get_status_list()
47 47
     {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 'Height' => '250',
83 83
             )
84 84
         );
85
-	    $status_list = $this->get_status_list();
85
+        $status_list = $this->get_status_list();
86 86
         $form->addElement('select', 'status', get_lang('Status'), $status_list);
87 87
         if ($action == 'edit') {
88 88
             $form->addElement('text', 'created_at', get_lang('CreatedAt'));
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
         $defaults = $this->get($id);
100 100
 
101 101
         if (!empty($defaults['created_at'])) {
102
-        	$defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
102
+            $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
103 103
         }
104 104
         if (!empty($defaults['updated_at'])) {
105
-        	$defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
105
+            $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
106 106
         }
107 107
         $form->setDefaults($defaults);
108 108
 
109 109
         // Setting the rules
110 110
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
111 111
 
112
-		return $form;
112
+        return $form;
113 113
     }
114 114
 
115 115
     public function get_count()
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/dompdf_config.inc.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -1,53 +1,53 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: dompdf_config.inc.php,v $
6
- * Created on: 2004-08-04
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @contributor Helmut Tischer <[email protected]>
37
- * @package dompdf
38
- *
39
- * Changes
40
- * @contributor Helmut Tischer <[email protected]>
41
- * @version 0.5.1.htischer.20090507
42
- * - Allow overriding of configuration settings by calling php script.
43
- *   This allows replacing of dompdf by a new version in an application
44
- *   without any modification,
45
- * - Optionally separate font cache folder from font folder.
46
- *   This allows write protecting the entire installation
47
- * - Add settings to enable/disable additional debug output categories
48
- * - Change some defaults to more practical values
49
- * - Add comments about configuration parameter implications
50
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: dompdf_config.inc.php,v $
6
+     * Created on: 2004-08-04
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @contributor Helmut Tischer <[email protected]>
37
+     * @package dompdf
38
+     *
39
+     * Changes
40
+     * @contributor Helmut Tischer <[email protected]>
41
+     * @version 0.5.1.htischer.20090507
42
+     * - Allow overriding of configuration settings by calling php script.
43
+     *   This allows replacing of dompdf by a new version in an application
44
+     *   without any modification,
45
+     * - Optionally separate font cache folder from font folder.
46
+     *   This allows write protecting the entire installation
47
+     * - Add settings to enable/disable additional debug output categories
48
+     * - Change some defaults to more practical values
49
+     * - Add comments about configuration parameter implications
50
+     */
51 51
 
52 52
 /* $Id: dompdf_config.inc.php 216 2010-03-11 22:49:18Z ryan.masten $ */
53 53
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
  */
114 114
 
115 115
 if (!defined("DOMPDF_FONT_CACHE")) {
116
-  define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR);
116
+    define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR);
117 117
 }
118 118
 
119 119
 /**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
  * using the PFDLib back end.
125 125
  */
126 126
 if (!defined('DOMPDF_TEMP_DIR')) {
127
-  define("DOMPDF_TEMP_DIR", sys_get_temp_dir());
127
+    define("DOMPDF_TEMP_DIR", sys_get_temp_dir());
128 128
 }
129 129
 
130 130
 /**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * $dompdf = new DOMPDF();	$dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
141 141
  */
142 142
 if (!defined("DOMPDF_CHROOT")) {
143
-  define("DOMPDF_CHROOT", realpath(DOMPDF_DIR));
143
+    define("DOMPDF_CHROOT", realpath(DOMPDF_DIR));
144 144
 }
145 145
 
146 146
 /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  *
158 158
  */
159 159
 if (!defined("DOMPDF_UNICODE_ENABLED")) {
160
-  define("DOMPDF_UNICODE_ENABLED", false);
160
+    define("DOMPDF_UNICODE_ENABLED", false);
161 161
 }
162 162
 
163 163
 /**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
  * @link http://ttf2pt1.sourceforge.net/
173 173
  */
174 174
 if (!defined("TTF2AFM")) {
175
-  define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1");
176
-  //define("TTF2AFM", "/usr/bin/ttf2pt1");
175
+    define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1");
176
+    //define("TTF2AFM", "/usr/bin/ttf2pt1");
177 177
 }
178 178
 
179 179
 /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
  * @link http://www.php.net/image
206 206
  */
207 207
 if (!defined("DOMPDF_PDF_BACKEND")) {
208
-  define("DOMPDF_PDF_BACKEND", "CPDF");
208
+    define("DOMPDF_PDF_BACKEND", "CPDF");
209 209
 }
210 210
 
211 211
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * a real license code must exist!
222 222
  */
223 223
 if (!defined("DOMPDF_PDFLIB_LICENSE")) {
224
-  #define("DOMPDF_PDFLIB_LICENSE", "your license key here");
224
+    #define("DOMPDF_PDFLIB_LICENSE", "your license key here");
225 225
 }
226 226
 
227 227
 /**
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
  * Therefore allow specification of content here.
236 236
  */
237 237
 if (!defined("DOMPDF_DEFAULT_MEDIA_TYPE")) {
238
-  define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen");
238
+    define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen");
239 239
 }
240 240
 
241 241
 /**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  * @see CPDF_Adapter::PAPER_SIZES for valid sizes
247 247
  */
248 248
 if (!defined("DOMPDF_DEFAULT_PAPER_SIZE")) {
249
-  define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
249
+    define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
250 250
 }
251 251
 
252 252
 
@@ -257,43 +257,43 @@  discard block
 block discarded – undo
257 257
  * @var string
258 258
  */
259 259
 if (!defined("DOMPDF_DEFAULT_FONT")) {
260
-  define("DOMPDF_DEFAULT_FONT", "serif");
260
+    define("DOMPDF_DEFAULT_FONT", "serif");
261 261
 }
262 262
 /**
263
- * Image DPI setting
264
- *
265
- * This setting determines the default DPI setting for images and fonts.  The
266
- * DPI may be overridden for inline images by explictly setting the
267
- * image's width & height style attributes (i.e. if the image's native
268
- * width is 600 pixels and you specify the image's width as 72 points,
269
- * the image will have a DPI of 600 in the rendered PDF.  The DPI of
270
- * background images can not be overridden and is controlled entirely
271
- * via this parameter.
272
- *
273
- * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
274
- * If a size in html is given as px (or without unit as image size),
275
- * this tells the corresponding size in pt.
276
- * This adjusts the relative sizes to be similar to the rendering of the
277
- * html page in a reference browser.
278
- *
279
- * In pdf, always 1 pt = 1/72 inch
280
- *
281
- * Rendering resolution of various browsers in px per inch:
282
- * Windows Firefox and Internet Explorer:
283
- *   SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
284
- * Linux Firefox:
285
- *   about:config *resolution: Default:96
286
- *   (xorg screen dimension in mm and Desktop font dpi settings are ignored)
287
- *
288
- * Take care about extra font/image zoom factor of browser.
289
- *
290
- * In images, <img> size in pixel attribute, img css style, are overriding
291
- * the real image dimension in px for rendering.
292
- *
293
- * @var int
294
- */
263
+     * Image DPI setting
264
+     *
265
+     * This setting determines the default DPI setting for images and fonts.  The
266
+     * DPI may be overridden for inline images by explictly setting the
267
+     * image's width & height style attributes (i.e. if the image's native
268
+     * width is 600 pixels and you specify the image's width as 72 points,
269
+     * the image will have a DPI of 600 in the rendered PDF.  The DPI of
270
+     * background images can not be overridden and is controlled entirely
271
+     * via this parameter.
272
+     *
273
+     * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
274
+     * If a size in html is given as px (or without unit as image size),
275
+     * this tells the corresponding size in pt.
276
+     * This adjusts the relative sizes to be similar to the rendering of the
277
+     * html page in a reference browser.
278
+     *
279
+     * In pdf, always 1 pt = 1/72 inch
280
+     *
281
+     * Rendering resolution of various browsers in px per inch:
282
+     * Windows Firefox and Internet Explorer:
283
+     *   SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
284
+     * Linux Firefox:
285
+     *   about:config *resolution: Default:96
286
+     *   (xorg screen dimension in mm and Desktop font dpi settings are ignored)
287
+     *
288
+     * Take care about extra font/image zoom factor of browser.
289
+     *
290
+     * In images, <img> size in pixel attribute, img css style, are overriding
291
+     * the real image dimension in px for rendering.
292
+     *
293
+     * @var int
294
+     */
295 295
 if (!defined("DOMPDF_DPI")) {
296
-  define("DOMPDF_DPI", "96");
296
+    define("DOMPDF_DPI", "96");
297 297
 }
298 298
 
299 299
 /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
  * @var bool
310 310
  */
311 311
 if (!defined("DOMPDF_ENABLE_PHP")) {
312
-  define("DOMPDF_ENABLE_PHP", true);
312
+    define("DOMPDF_ENABLE_PHP", true);
313 313
 }
314 314
 
315 315
 /**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
  * @var bool
331 331
  */
332 332
 if (!defined("DOMPDF_ENABLE_REMOTE")) {
333
-  define("DOMPDF_ENABLE_REMOTE", false);
333
+    define("DOMPDF_ENABLE_REMOTE", false);
334 334
 }
335 335
  
336 336
 /**
@@ -344,25 +344,25 @@  discard block
 block discarded – undo
344 344
  * @param string $class
345 345
  */
346 346
 function DOMPDF_autoload($class) {
347
-  $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
347
+    $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
348 348
   
349
-  if ( is_file($filename) )
349
+    if ( is_file($filename) )
350 350
     require_once($filename);
351 351
 }
352 352
 
353 353
 if ( function_exists("spl_autoload_register") ) {
354 354
 
355
-   spl_autoload_register("DOMPDF_autoload");
355
+    spl_autoload_register("DOMPDF_autoload");
356 356
 
357 357
 } else if ( !function_exists("__autoload") ) {
358
-  /**
359
-   * Default __autoload() function
360
-   *
361
-   * @param string $class
362
-   */
363
-  function __autoload($class) {
358
+    /**
359
+     * Default __autoload() function
360
+     *
361
+     * @param string $class
362
+     */
363
+    function __autoload($class) {
364 364
     DOMPDF_autoload($class);
365
-  }
365
+    }
366 366
 }
367 367
 
368 368
 // ### End of user-configurable options ###
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
  * the browser cache and the premature output prevents setting of the mime type.
417 417
  */
418 418
 if (!defined('DEBUGPNG')) {
419
-  define('DEBUGPNG',0);
419
+    define('DEBUGPNG',0);
420 420
 }
421 421
 if (!defined('DEBUGKEEPTEMP')) {
422
-  define('DEBUGKEEPTEMP',0);
422
+    define('DEBUGKEEPTEMP',0);
423 423
 }
424 424
 if (!defined('DEBUGCSS')) {
425
-  define('DEBUGCSS',0);
425
+    define('DEBUGCSS',0);
426 426
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/www/examples.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 require_once("../dompdf_config.inc.php");
4 4
 if ( isset( $_POST["html"] ) ) {
5 5
 
6
-  if ( get_magic_quotes_gpc() )
6
+    if ( get_magic_quotes_gpc() )
7 7
     $_POST["html"] = stripslashes($_POST["html"]);
8 8
   
9
-  $dompdf = new DOMPDF();
10
-  $dompdf->load_html($_POST["html"]);
11
-  $dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
12
-  $dompdf->render();
9
+    $dompdf = new DOMPDF();
10
+    $dompdf->load_html($_POST["html"]);
11
+    $dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
12
+    $dompdf->render();
13 13
 
14
-  $dompdf->stream("dompdf_out.pdf");
14
+    $dompdf->stream("dompdf_out.pdf");
15 15
 
16
-  exit(0);
16
+    exit(0);
17 17
 }
18 18
 
19 19
 ?>
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 $dompdf = dirname(dirname($_SERVER["PHP_SELF"]));
43 43
 //echo '<li>['.$dompdf.']</li>';
44 44
 if ( $dompdf == '/' || $dompdf == '\\') {
45
-  $dompdf = '';
45
+    $dompdf = '';
46 46
 }
47 47
 //echo '<li>['.$dompdf.']</li>';
48 48
 $dompdf .= "/dompdf.php?base_path=" . rawurlencode("www/test/");
49 49
 //echo '<li>['.$dompdf.']</li>';
50 50
 foreach ( $test_files as $file ) {
51
-  $file = basename($file);
52
-  $arrow = "images/arrow_0" . rand(1, 6) . ".gif";  
53
-  echo "<li style=\"list-style-image: url('$arrow');\">\n";
54
-  echo $file;
55
-  echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") .  "\">PDF</a>]\n";
56
-  echo "</li>\n";
51
+    $file = basename($file);
52
+    $arrow = "images/arrow_0" . rand(1, 6) . ".gif";  
53
+    echo "<li style=\"list-style-image: url('$arrow');\">\n";
54
+    echo $file;
55
+    echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") .  "\">PDF</a>]\n";
56
+    echo "</li>\n";
57 57
 }
58 58
 ?>
59 59
 </ul>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 <select name="paper">
70 70
 <?php
71 71
 foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size )
72
-  echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
72
+    echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
73 73
 ?>
74 74
 </select>
75 75
 <select name="orientation">
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/www/head.inc 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 function li_arrow() {
3
-  return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
3
+    return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
4 4
 }
5 5
 function li_star() {
6
-  return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
6
+    return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
7 7
 }
8 8
 ?>
9 9
 <?php echo '<?' . 'xml version="1.0" encoding="iso-8859-1"?' . '>'; ?>
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/page_cache.cls.php 1 patch
Indentation   +70 added lines, -71 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: page_cache.cls.php,v $
6
- * Created on: 2004-07-23
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: page_cache.cls.php,v $
6
+     * Created on: 2004-07-23
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: page_cache.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -50,59 +49,59 @@  discard block
 block discarded – undo
50 49
  */
51 50
 class Page_Cache {
52 51
 
53
-  const DB_USER = "dompdf_page_cache";
54
-  const DB_PASS = "some meaningful password";
55
-  const DB_NAME = "dompdf_page_cache";
52
+    const DB_USER = "dompdf_page_cache";
53
+    const DB_PASS = "some meaningful password";
54
+    const DB_NAME = "dompdf_page_cache";
56 55
   
57
-  static private $__connection = null;
56
+    static private $__connection = null;
58 57
   
59
-  function init() {
58
+    function init() {
60 59
     if ( is_null(self::$__connection) ) {
61
-      $con_str = "host=" . DB_HOST .
60
+        $con_str = "host=" . DB_HOST .
62 61
         " dbname=" . self::DB_NAME .
63 62
         " user=" . self::DB_USER .
64 63
         " password=" . self::DB_PASS;
65 64
       
66
-      if ( !self::$__connection = pg_connect($con_str) )
65
+        if ( !self::$__connection = pg_connect($con_str) )
67 66
         throw new Exception("Database connection failed.");
68 67
     }
69
-  }
68
+    }
70 69
   
71
-  function __construct() { throw new Exception("Can not create instance of Page_Class.  Class is static."); }
70
+    function __construct() { throw new Exception("Can not create instance of Page_Class.  Class is static."); }
72 71
 
73
-  private static function __query($sql) {
72
+    private static function __query($sql) {
74 73
     if ( !($res = pg_query(self::$__connection, $sql)) )
75
-      throw new Exception(pg_last_error(self::$__connection));
74
+        throw new Exception(pg_last_error(self::$__connection));
76 75
     return $res;
77
-  }
76
+    }
78 77
   
79
-  static function store_page($id, $page_num, $data) {
78
+    static function store_page($id, $page_num, $data) {
80 79
     $where = "WHERE id='" . pg_escape_string($id) . "' AND ".
81
-      "page_num=". pg_escape_string($page_num);
80
+        "page_num=". pg_escape_string($page_num);
82 81
 
83 82
     $res = self::__query("SELECT timestamp FROM page_cache ". $where);
84 83
 
85 84
     $row = pg_fetch_assoc($res);
86 85
     
87 86
     if ( $row ) 
88
-      self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
87
+        self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
89 88
     else 
90
-      self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
91
-                     pg_escape_string($page_num) . ", ".
92
-                     "'". pg_escape_string($data) . "')");
89
+        self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
90
+                        pg_escape_string($page_num) . ", ".
91
+                        "'". pg_escape_string($data) . "')");
93 92
 
94
-  }
93
+    }
95 94
 
96
-  static function store_fonts($id, $fonts) {
95
+    static function store_fonts($id, $fonts) {
97 96
     self::__query("BEGIN");
98 97
     // Update the font information
99 98
     self::__query("DELETE FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
100 99
 
101 100
     foreach (array_keys($fonts) as $font)
102
-      self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
101
+        self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
103 102
                     pg_escape_string($id) . "', '" . pg_escape_string($font) . "')");
104 103
     self::__query("COMMIT");
105
-  }
104
+    }
106 105
   
107 106
 //   static function retrieve_page($id, $page_num) {
108 107
 
@@ -115,45 +114,45 @@  discard block
 block discarded – undo
115 114
     
116 115
 //   }
117 116
 
118
-  static function get_page_timestamp($id, $page_num) {
117
+    static function get_page_timestamp($id, $page_num) {
119 118
     $res = self::__query("SELECT timestamp FROM page_cache WHERE id='" . pg_escape_string($id) . "' AND ".
120
-                          "page_num=". pg_escape_string($page_num));
119
+                            "page_num=". pg_escape_string($page_num));
121 120
 
122 121
     $row = pg_fetch_assoc($res);
123 122
 
124 123
     return $row["timestamp"];
125 124
     
126
-  }
125
+    }
127 126
 
128
-  // Adds the cached document referenced by $id to the provided pdf
129
-  static function insert_cached_document(CPDF_Adapter $pdf, $id, $new_page = true) {
127
+    // Adds the cached document referenced by $id to the provided pdf
128
+    static function insert_cached_document(CPDF_Adapter $pdf, $id, $new_page = true) {
130 129
     $res = self::__query("SELECT font_name FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
131 130
 
132 131
     // Ensure that the fonts needed by the cached document are loaded into
133 132
     // the pdf
134 133
     while ($row = pg_fetch_assoc($res)) 
135
-      $pdf->get_cpdf()->selectFont($row["font_name"]);
134
+        $pdf->get_cpdf()->selectFont($row["font_name"]);
136 135
     
137 136
     $res = self::__query("SELECT data FROM page_cache WHERE id='" . pg_escape_string($id) . "'");
138 137
 
139 138
     if ( $new_page )
140
-      $pdf->new_page();
139
+        $pdf->new_page();
141 140
 
142 141
     $first = true;
143 142
     while ($row = pg_fetch_assoc($res)) {
144 143
 
145
-      if ( !$first ) 
144
+        if ( !$first ) 
146 145
         $pdf->new_page();
147
-      else 
146
+        else 
148 147
         $first = false;        
149 148
       
150
-      $page = $pdf->reopen_serialized_object($row["data"]);
151
-      //$pdf->close_object();
152
-      $pdf->add_object($page, "add");
149
+        $page = $pdf->reopen_serialized_object($row["data"]);
150
+        //$pdf->close_object();
151
+        $pdf->add_object($page, "add");
153 152
 
154 153
     }
155 154
       
156
-  }
155
+    }
157 156
 }
158 157
 
159 158
 Page_Cache::init();
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_reflower.cls.php 1 patch
Indentation   +67 added lines, -68 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -50,30 +49,30 @@  discard block
 block discarded – undo
50 49
  */
51 50
 abstract class Frame_Reflower {
52 51
 
53
-  /**
54
-   * Frame for this reflower
55
-   *
56
-   * @var Frame
57
-   */
58
-  protected $_frame;
59
-
60
-  /**
61
-   * Cached min/max size
62
-   *
63
-   * @var array
64
-   */
65
-  protected $_min_max_cache;
52
+    /**
53
+     * Frame for this reflower
54
+     *
55
+     * @var Frame
56
+     */
57
+    protected $_frame;
58
+
59
+    /**
60
+     * Cached min/max size
61
+     *
62
+     * @var array
63
+     */
64
+    protected $_min_max_cache;
66 65
   
67
-  function __construct(Frame $frame) {
66
+    function __construct(Frame $frame) {
68 67
     $this->_frame = $frame;
69 68
     $this->_min_max_cache = null;
70
-  }
69
+    }
71 70
 
72
-  function dispose() {
71
+    function dispose() {
73 72
     unset($this->_frame);
74
-  }
73
+    }
75 74
 
76
-  protected function _collapse_margins() {
75
+    protected function _collapse_margins() {
77 76
     $cb = $this->_frame->get_containing_block();
78 77
     $style = $this->_frame->get_style();
79 78
 
@@ -82,121 +81,121 @@  discard block
 block discarded – undo
82 81
 
83 82
     // Handle 'auto' values
84 83
     if ( $t === "auto" ) {
85
-      $style->margin_top = "0pt";
86
-      $t = 0;
84
+        $style->margin_top = "0pt";
85
+        $t = 0;
87 86
     }
88 87
 
89 88
     if ( $b === "auto" ) {
90
-      $style->margin_bottom = "0pt";
91
-      $b = 0;
89
+        $style->margin_bottom = "0pt";
90
+        $b = 0;
92 91
     }
93 92
 
94 93
     // Collapse vertical margins:
95 94
     $n = $this->_frame->get_next_sibling();
96 95
     while ( $n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES) )
97
-      $n = $n->get_next_sibling();
96
+        $n = $n->get_next_sibling();
98 97
 
99 98
     if ( $n ) { // && !$n instanceof Page_Frame_Decorator ) {
100 99
 
101
-      $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"]));
100
+        $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"]));
102 101
 
103
-      $n->get_style()->margin_top = "$b pt";
104
-      $style->margin_bottom = "0 pt";
102
+        $n->get_style()->margin_top = "$b pt";
103
+        $style->margin_bottom = "0 pt";
105 104
 
106 105
     }
107 106
 
108 107
     // Collapse our first child's margin
109 108
     $f = $this->_frame->get_first_child();
110 109
     while ( $f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES) )
111
-      $f = $f->get_next_sibling();
110
+        $f = $f->get_next_sibling();
112 111
 
113 112
     if ( $f ) {
114
-      $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"]));
115
-      $style->margin_top = "$t pt";
116
-      $f->get_style()->margin_top = "0 pt";
113
+        $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"]));
114
+        $style->margin_top = "$t pt";
115
+        $f->get_style()->margin_top = "0 pt";
117 116
     }
118 117
 
119
-  }
118
+    }
120 119
 
121
-  // Returns true if a new page is required
122
-  protected function _check_new_page() {
120
+    // Returns true if a new page is required
121
+    protected function _check_new_page() {
123 122
     $y = $this->_frame->get_position("y");
124 123
     $h = $style->length_in_pt($style->height);
125 124
     // Check if we need to move to a new page
126 125
     if ( $y + $h >= $this->_frame->get_root()->get_page_height() )
127
-      return true;
126
+        return true;
128 127
 
129
-  }
128
+    }
130 129
 
131
-  //........................................................................
130
+    //........................................................................
132 131
 
133
-  abstract function reflow();
132
+    abstract function reflow();
134 133
 
135
-  //........................................................................
134
+    //........................................................................
136 135
 
137
-  // Required for table layout: Returns an array(0 => min, 1 => max, "min"
138
-  // => min, "max" => max) of the minimum and maximum widths of this frame.
139
-  // This provides a basic implementation.  Child classes should override
140
-  // this if necessary.
141
-  function get_min_max_width() {
136
+    // Required for table layout: Returns an array(0 => min, 1 => max, "min"
137
+    // => min, "max" => max) of the minimum and maximum widths of this frame.
138
+    // This provides a basic implementation.  Child classes should override
139
+    // this if necessary.
140
+    function get_min_max_width() {
142 141
     if ( !is_null($this->_min_max_cache) ) {
143
-      return $this->_min_max_cache;
142
+        return $this->_min_max_cache;
144 143
     }
145 144
     
146 145
     $style = $this->_frame->get_style();
147 146
 
148 147
     // Account for margins & padding
149 148
     $dims = array($style->padding_left,
150
-                  $style->padding_right,
151
-                  $style->border_left_width,
152
-                  $style->border_right_width,
153
-                  $style->margin_left,
154
-                  $style->margin_right);
149
+                    $style->padding_right,
150
+                    $style->border_left_width,
151
+                    $style->border_right_width,
152
+                    $style->margin_left,
153
+                    $style->margin_right);
155 154
 
156 155
     $cb_w = $this->_frame->get_containing_block("w");
157 156
     $delta = $style->length_in_pt($dims, $cb_w);
158 157
 
159 158
     // Handle degenerate case
160 159
     if ( !$this->_frame->get_first_child() )
161
-      return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta);
160
+        return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta);
162 161
 
163 162
     $low = array();
164 163
     $high = array();
165 164
 
166 165
     for ( $iter = $this->_frame->get_children()->getIterator();
167
-          $iter->valid();
168
-          $iter->next() ) {
166
+            $iter->valid();
167
+            $iter->next() ) {
169 168
 
170
-      $inline_min = 0;
171
-      $inline_max = 0;
169
+        $inline_min = 0;
170
+        $inline_max = 0;
172 171
 
173
-      // Add all adjacent inline widths together to calculate max width
174
-      while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) {
172
+        // Add all adjacent inline widths together to calculate max width
173
+        while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) {
175 174
 
176 175
         $child = $iter->current();
177 176
 
178 177
         $minmax = $child->get_min_max_width();
179 178
 
180 179
         if ( in_array( $iter->current()->get_style()->white_space, array("pre", "nowrap") ) )
181
-          $inline_min += $minmax["min"];
180
+            $inline_min += $minmax["min"];
182 181
         else
183
-          $low[] = $minmax["min"];
182
+            $low[] = $minmax["min"];
184 183
 
185 184
         $inline_max += $minmax["max"];
186 185
         $iter->next();
187 186
 
188
-      }
187
+        }
189 188
 
190
-      if ( $inline_max > 0 )
189
+        if ( $inline_max > 0 )
191 190
         $high[] = $inline_max;
192 191
 
193
-      if ( $inline_min > 0 )
192
+        if ( $inline_min > 0 )
194 193
         $low[] = $inline_min;
195 194
 
196
-      if ( $iter->valid() ) {
195
+        if ( $iter->valid() ) {
197 196
         list($low[], $high[]) = $iter->current()->get_min_max_width();
198 197
         continue;
199
-      }
198
+        }
200 199
 
201 200
     }
202 201
     $min = count($low) ? max($low) : 0;
@@ -206,16 +205,16 @@  discard block
 block discarded – undo
206 205
     // content.  If the width is a percentage ignore it for now.
207 206
     $width = $style->width;
208 207
     if ( $width !== "auto" && !is_percent($width) ) {
209
-      $width = $style->length_in_pt($width, $cb_w);
210
-      if ( $min < $width )
208
+        $width = $style->length_in_pt($width, $cb_w);
209
+        if ( $min < $width )
211 210
         $min = $width;
212
-      if ( $max < $width )
211
+        if ( $max < $width )
213 212
         $max = $width;
214 213
     }
215 214
 
216 215
     $min += $delta;
217 216
     $max += $delta;
218 217
     return $this->_min_max_cache = array($min, $max, "min"=>$min, "max"=>$max);
219
-  }
218
+    }
220 219
 
221 220
 }
Please login to merge, or discard this patch.