]> git.sur5r.net Git - bacula/bacula/blob - gui/bacula-web/test.php
bacula-web: Renamed GetPoolsStatistics() function to CountVolumesByPool() in includes...
[bacula/bacula] / gui / bacula-web / test.php
1 <?php
2         require_once ("config.inc.php");
3         $bw = new Bweb();
4         
5         // Check result icon
6     $check_result = array( true => 's_ok.png', false => 's_error.gif' );
7         
8         // Checks list
9         $check_list = array( array( 'check_cmd'                 => 'php-gettext', 
10                                                                 'check_label'           => 'PHP - Gettext support', 
11                                                                 'check_descr'           => 'If you want Bacula-web in your language, please compile PHP with Gettext support' ),
12                                                  array( 'check_cmd'             => 'pear-db', 
13                                                                 'check_label'           => 'PEAR DB module', 
14                                                                 'check_descr'           => 'PEAR DB support not found, please read the Bacula-web installation document'),
15                                                  array( 'check_cmd'             => 'php-gd',
16                                                                 'check_label'           => 'PHP - GD support',
17                                                                 'check_descr'           => 'This is required by phplot, please compile php with GD support'),
18                                                  array( 'check_cmd'             => 'php-mysql',
19                                                                 'check_label'           => 'PHP - MySQL support',
20                                                                 'check_descr'           => 'PHP MySQL support must be installed in order to run bacula-web with MySQL bacula catalog'),
21                                                  array( 'check_cmd'             => 'php-postgres',
22                                                                 'check_label'           => 'PHP - PostgreSQL support',
23                                                                 'check_descr'           => 'PHP PostgreSQL support must be installed in order to run bacula-web with PostgreSQL bacula catalog'),                                                               
24                                                  array( 'check_cmd'             => 'smarty-cache',
25                                                                 'check_label'           => 'Smarty cache folder write permission',
26                                                                 'check_descr'           => 'Smarty template engine need write permissions to templates_c folder')
27                                   );
28         
29         // Doing all checks
30         foreach( $check_list as &$check ) {
31                 switch( $check['check_cmd'] )
32                 {
33                         case 'php-gettext':
34                                 $check['check_result'] = $check_result[ function_exists( 'gettext' ) ];                                 
35                         break;
36                         case 'php-gd':
37                                 $check['check_result'] = $check_result[ function_exists( 'gd_info') ];
38                         break;
39                         case 'pear-db':
40                                 $check['check_result'] = $check_result[ class_exists('DB') ];
41                         break;
42                         case 'php-mysql':
43                                 $check['check_result'] = $check_result[ function_exists('mysql_connect') ];
44                         break;
45                         case 'php-postgres':
46                                 $check['check_result'] = $check_result[ function_exists('pg_connect') ];
47                         break;
48                         case 'smarty-cache':
49                                 $check['check_result'] = $check_result[ is_writable( "./templates_c" ) ];
50                         break;
51                 }
52                 
53         }
54
55         // Generate test graph
56         $data = array( array('test', 100, 100, 200, 100), array('test1', 150, 100, 150, 100 ) );        
57         $graph = new BGraph( "graph3.png" );
58         $graph->SetColors( array('green', 'red' ) );
59
60         $graph->SetData( $data, 'pie', 'text-data-single' );
61         $graph->SetGraphSize( 400, 230 );
62         
63         $graph->Render();
64
65         // Parse to template
66         $bw->tpl->assign( 'checks', $check_list );
67         $bw->tpl->assign('graph_test', $graph->Get_Image_file() );
68         $bw->tpl->display('test.tpl');
69 ?>