@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | <meta name="description" content="A simple PHP framework using HMVC architecture"> |
9 | 9 | <meta name="author" content="Tony NGUEREZA"> |
10 | 10 | <title>TNH Framework</title> |
11 | - <link href="<?php echo Assets::css('bootstrap.min');?>" rel="stylesheet" type = "text/css" > |
|
12 | - <link href="<?php echo Assets::css('font-awesome.min');?>" rel="stylesheet" type = "text/css" > |
|
13 | - <link href="<?php echo Assets::css('responsive');?>" rel="stylesheet" type = "text/css" > |
|
14 | - <link rel="icon" href="<?php echo Assets::img('favicon.ico');?>"> |
|
11 | + <link href="<?php echo Assets::css('bootstrap.min'); ?>" rel="stylesheet" type = "text/css" > |
|
12 | + <link href="<?php echo Assets::css('font-awesome.min'); ?>" rel="stylesheet" type = "text/css" > |
|
13 | + <link href="<?php echo Assets::css('responsive'); ?>" rel="stylesheet" type = "text/css" > |
|
14 | + <link rel="icon" href="<?php echo Assets::img('favicon.ico'); ?>"> |
|
15 | 15 | <!--[if lt IE 9]> |
16 | - <script src="<?php echo Assets::js('html5shiv');?>"></script> |
|
17 | - <script src="<?php echo Assets::js('respond.min');?>"></script> |
|
16 | + <script src="<?php echo Assets::js('html5shiv'); ?>"></script> |
|
17 | + <script src="<?php echo Assets::js('respond.min'); ?>"></script> |
|
18 | 18 | <![endif]--> |
19 | 19 | <style type = "text/css"> |
20 | 20 | |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | <div class = "col-md-offset-2 col-md-8 col-md-offset-2"> |
29 | 29 | <div class = "panel panel-primary"> |
30 | 30 | <div class = "panel-heading"> |
31 | - <h2>Welcome on <?php echo TNH_NAME;?> v<?php echo TNH_VERSION;?></h2> |
|
31 | + <h2>Welcome on <?php echo TNH_NAME; ?> v<?php echo TNH_VERSION; ?></h2> |
|
32 | 32 | </div> |
33 | 33 | <div class = "panel-body"> |
34 | - <img src = "<?php echo Assets::img('logo.png');?>" class = "img-responsive" style = "float:left;" /> |
|
34 | + <img src = "<?php echo Assets::img('logo.png'); ?>" class = "img-responsive" style = "float:left;" /> |
|
35 | 35 | <h3> |
36 | 36 | A simple PHP framework using HMVC architecture |
37 | 37 | </h3> |
38 | 38 | <br /> |
39 | - <p><?php echo Html::a('https://github.com/tnhfw/tnh-fw', 'Framework on Github', array('class' => 'btn btn-default', 'target' => '_blank'));?></p> |
|
39 | + <p><?php echo Html::a('https://github.com/tnhfw/tnh-fw', 'Framework on Github', array('class' => 'btn btn-default', 'target' => '_blank')); ?></p> |
|
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | <div class = "panel panel-primary"> |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | <h2>Server information</h2> |
45 | 45 | </div> |
46 | 46 | <div class = "panel-body"> |
47 | - <h4>Running on : <b><?php echo php_uname();?></b></h4> |
|
48 | - <h4>PHP server SAPI : <b><?php echo php_sapi_name();?></b></h4> |
|
49 | - <h4>PHP Version : <b><?php echo phpversion();?></b></h4> |
|
50 | - <h4>PHP Loaded extensions : (<?php echo count(get_loaded_extensions());?> extensions)</h4> |
|
47 | + <h4>Running on : <b><?php echo php_uname(); ?></b></h4> |
|
48 | + <h4>PHP server SAPI : <b><?php echo php_sapi_name(); ?></b></h4> |
|
49 | + <h4>PHP Version : <b><?php echo phpversion(); ?></b></h4> |
|
50 | + <h4>PHP Loaded extensions : (<?php echo count(get_loaded_extensions()); ?> extensions)</h4> |
|
51 | 51 | <table class = "table table-striped table-condensed table-bordered table-responsive"> |
52 | 52 | <tr> |
53 | 53 | <th>Name</th> |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | </tr> |
56 | 56 | <?php foreach (get_loaded_extensions() as $e):?> |
57 | 57 | <tr> |
58 | - <td><?php echo $e;?></td> |
|
59 | - <td><?php echo phpversion($e);?></td> |
|
58 | + <td><?php echo $e; ?></td> |
|
59 | + <td><?php echo phpversion($e); ?></td> |
|
60 | 60 | </tr> |
61 | - <?php endforeach;?> |
|
61 | + <?php endforeach; ?> |
|
62 | 62 | </table> |
63 | 63 | </div> |
64 | 64 | </div> |
@@ -67,30 +67,30 @@ discard block |
||
67 | 67 | <h2>Framework information</h2> |
68 | 68 | </div> |
69 | 69 | <div class = "panel-body"> |
70 | - <h4>Version : <b><?php echo TNH_VERSION;?></b></h4> |
|
71 | - <h4>Required PHP version : <b>PHP >= <?php echo TNH_REQUIRED_PHP_MIN_VERSION;?>, PHP <= <?php echo TNH_REQUIRED_PHP_MAX_VERSION;?></b></h4> |
|
72 | - <h4>Build date : <b><?php echo TNH_RELEASE_DATE;?></b></h4> |
|
73 | - <h4>Author : <b><?php echo TNH_AUTHOR;?></b></h4> |
|
74 | - <h4>Author E-mail : <b><?php echo TNH_AUTHOR_EMAIL;?></b></h4> |
|
75 | - <h4>Loaded files : (<?php echo count(get_included_files());?> files)</h4> |
|
70 | + <h4>Version : <b><?php echo TNH_VERSION; ?></b></h4> |
|
71 | + <h4>Required PHP version : <b>PHP >= <?php echo TNH_REQUIRED_PHP_MIN_VERSION; ?>, PHP <= <?php echo TNH_REQUIRED_PHP_MAX_VERSION; ?></b></h4> |
|
72 | + <h4>Build date : <b><?php echo TNH_RELEASE_DATE; ?></b></h4> |
|
73 | + <h4>Author : <b><?php echo TNH_AUTHOR; ?></b></h4> |
|
74 | + <h4>Author E-mail : <b><?php echo TNH_AUTHOR_EMAIL; ?></b></h4> |
|
75 | + <h4>Loaded files : (<?php echo count(get_included_files()); ?> files)</h4> |
|
76 | 76 | <table class = "table table-striped table-condensed table-bordered table-responsive"> |
77 | 77 | <tr> |
78 | 78 | <th>Path</th> |
79 | 79 | <th>File</th> |
80 | 80 | </tr> |
81 | - <?php foreach(get_included_files() as $file):?> |
|
81 | + <?php foreach (get_included_files() as $file):?> |
|
82 | 82 | <tr> |
83 | - <td><?php echo $file;?></td> |
|
84 | - <td><?php echo basename($file);?></td> |
|
83 | + <td><?php echo $file; ?></td> |
|
84 | + <td><?php echo basename($file); ?></td> |
|
85 | 85 | </tr> |
86 | - <?php endforeach;?> |
|
86 | + <?php endforeach; ?> |
|
87 | 87 | </table> |
88 | 88 | </div> |
89 | 89 | </div> |
90 | 90 | </div> |
91 | 91 | </div> |
92 | 92 | </div> |
93 | - <script src="<?php echo Assets::js('jquery');?>"></script> |
|
94 | - <script src="<?php echo Assets::js('bootstrap.min');?>"></script> |
|
93 | + <script src="<?php echo Assets::js('jquery'); ?>"></script> |
|
94 | + <script src="<?php echo Assets::js('bootstrap.min'); ?>"></script> |
|
95 | 95 | </body> |
96 | 96 | </html> |
@@ -22,65 +22,65 @@ |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | - * This file contains the configuration of your routes that is to say that links to your URLs. |
|
29 | - * The index of the $route array contains the url address to capture and the value contains |
|
30 | - * the name of the module, controller and the method to call. |
|
31 | - * For example : |
|
32 | - * |
|
33 | - * $route['/users/login'] = 'moduleUsers#UsersController@login_action'; |
|
34 | - * |
|
35 | - * it means, if the user type in the address bar an URL like http://yoursite.com/users/login, |
|
36 | - * that will call the module "moduleUsers", the controller "UsersController" and the method "login_action". |
|
37 | - * Note 1: it is recommended that each index in the $route array start with a slash "/" |
|
38 | - * otherwise on some system this will not work. |
|
39 | - * Note 2: to define the default controller route (homepage) of your application you use only the index "/" |
|
40 | - * for example the following route represents the homepage: |
|
41 | - * |
|
42 | - * $route['/'] = 'Home'; //only the controller or module name |
|
43 | - * |
|
44 | - * $route['/'] = 'Home@index'; //only the controller or module name with the method |
|
45 | - * |
|
46 | - * $route['/'] = 'module#Home@index'; //with module name, controller and method |
|
47 | - * |
|
48 | - * Note 3: If the method is not specified then the "index" method will be used as |
|
49 | - * default method. For example in the case of our homepage, this will be able to make: |
|
50 | - * |
|
51 | - * $route['/'] = 'Home'; |
|
52 | - * |
|
53 | - * Note 4: All methods called must have "public" visibility if you know the principle of |
|
54 | - * Object Oriented Programming, you know what visibility means (public, protected, private). |
|
55 | - * |
|
56 | - * In the index of your route, you can use the markers (:num), (:alpha), (:alnum) and (:any) which correspond |
|
57 | - * respectively to the regular expression [0-9], [a-zA-Z], [a-zA-Z0-9] and. *. |
|
58 | - * For example : |
|
59 | - * |
|
60 | - * - $route['/profile/(:num)'] = 'UsersController@profile'; => http://yoursite.com/profile/4 will be captured but |
|
61 | - * http://yoursite.com/profile/a will not captured. |
|
62 | - * |
|
63 | - * - $route['/profile/(:alpha)'] = 'UsersController@profile'; => http://yoursite.com/profile/a will be captured |
|
64 | - * but http://yoursite.com/profile/1457 will not captured. |
|
65 | - * |
|
66 | - * - $route['/profile/(:alnum)'] = 'UsersController@profile'; => http://yoursite.com/profile/4a, |
|
67 | - * http://yoursite.com/profile/7 will be captured but http://yoursite.com/profile/7-dangerous will not captured. |
|
68 | - * |
|
69 | - * - $route['/(:any)'] = 'ArticleController@read'; => http://yoursite.com/1-my-super-article, |
|
70 | - * http://yoursite.com/7, will be captured. |
|
71 | - * |
|
72 | - * Note 5: The order of definition of each route is important. |
|
73 | - * For example, the following definitions work: |
|
74 | - * |
|
75 | - * $route['/article/add'] = 'Article@add'; |
|
76 | - * $route['article/(:any)'] = 'Article@read'; |
|
77 | - * |
|
78 | - * however, the following definitions does not work as intended |
|
79 | - * |
|
80 | - * $route['article/(:any)'] = 'Article@read'; |
|
81 | - * $route['/article/add'] = 'Article@add'; |
|
82 | - * |
|
83 | - */ |
|
28 | + * This file contains the configuration of your routes that is to say that links to your URLs. |
|
29 | + * The index of the $route array contains the url address to capture and the value contains |
|
30 | + * the name of the module, controller and the method to call. |
|
31 | + * For example : |
|
32 | + * |
|
33 | + * $route['/users/login'] = 'moduleUsers#UsersController@login_action'; |
|
34 | + * |
|
35 | + * it means, if the user type in the address bar an URL like http://yoursite.com/users/login, |
|
36 | + * that will call the module "moduleUsers", the controller "UsersController" and the method "login_action". |
|
37 | + * Note 1: it is recommended that each index in the $route array start with a slash "/" |
|
38 | + * otherwise on some system this will not work. |
|
39 | + * Note 2: to define the default controller route (homepage) of your application you use only the index "/" |
|
40 | + * for example the following route represents the homepage: |
|
41 | + * |
|
42 | + * $route['/'] = 'Home'; //only the controller or module name |
|
43 | + * |
|
44 | + * $route['/'] = 'Home@index'; //only the controller or module name with the method |
|
45 | + * |
|
46 | + * $route['/'] = 'module#Home@index'; //with module name, controller and method |
|
47 | + * |
|
48 | + * Note 3: If the method is not specified then the "index" method will be used as |
|
49 | + * default method. For example in the case of our homepage, this will be able to make: |
|
50 | + * |
|
51 | + * $route['/'] = 'Home'; |
|
52 | + * |
|
53 | + * Note 4: All methods called must have "public" visibility if you know the principle of |
|
54 | + * Object Oriented Programming, you know what visibility means (public, protected, private). |
|
55 | + * |
|
56 | + * In the index of your route, you can use the markers (:num), (:alpha), (:alnum) and (:any) which correspond |
|
57 | + * respectively to the regular expression [0-9], [a-zA-Z], [a-zA-Z0-9] and. *. |
|
58 | + * For example : |
|
59 | + * |
|
60 | + * - $route['/profile/(:num)'] = 'UsersController@profile'; => http://yoursite.com/profile/4 will be captured but |
|
61 | + * http://yoursite.com/profile/a will not captured. |
|
62 | + * |
|
63 | + * - $route['/profile/(:alpha)'] = 'UsersController@profile'; => http://yoursite.com/profile/a will be captured |
|
64 | + * but http://yoursite.com/profile/1457 will not captured. |
|
65 | + * |
|
66 | + * - $route['/profile/(:alnum)'] = 'UsersController@profile'; => http://yoursite.com/profile/4a, |
|
67 | + * http://yoursite.com/profile/7 will be captured but http://yoursite.com/profile/7-dangerous will not captured. |
|
68 | + * |
|
69 | + * - $route['/(:any)'] = 'ArticleController@read'; => http://yoursite.com/1-my-super-article, |
|
70 | + * http://yoursite.com/7, will be captured. |
|
71 | + * |
|
72 | + * Note 5: The order of definition of each route is important. |
|
73 | + * For example, the following definitions work: |
|
74 | + * |
|
75 | + * $route['/article/add'] = 'Article@add'; |
|
76 | + * $route['article/(:any)'] = 'Article@read'; |
|
77 | + * |
|
78 | + * however, the following definitions does not work as intended |
|
79 | + * |
|
80 | + * $route['article/(:any)'] = 'Article@read'; |
|
81 | + * $route['/article/add'] = 'Article@add'; |
|
82 | + * |
|
83 | + */ |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * The default route like your home page |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | - * This file contains the pagination library configuration of your application |
|
29 | - */ |
|
28 | + * This file contains the pagination library configuration of your application |
|
29 | + */ |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Number of pagination digit |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | $config['nb_link'] = 10; |
35 | 35 | |
36 | 36 | /** |
37 | - * The pagination. |
|
38 | - * |
|
39 | - * Represents the number of data to display per page. |
|
40 | - * Note: this value must be strictly greater than zero (0) |
|
41 | - */ |
|
37 | + * The pagination. |
|
38 | + * |
|
39 | + * Represents the number of data to display per page. |
|
40 | + * Note: this value must be strictly greater than zero (0) |
|
41 | + */ |
|
42 | 42 | $config['pagination_per_page'] = 10; |
43 | 43 | |
44 | 44 |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | - * This file contains the main configuration of your application |
|
29 | - * web address, front controller, error logging, session parameters, CSRF, Cache, |
|
30 | - * Whitelist IP access, etc. |
|
31 | - */ |
|
28 | + * This file contains the main configuration of your application |
|
29 | + * web address, front controller, error logging, session parameters, CSRF, Cache, |
|
30 | + * Whitelist IP access, etc. |
|
31 | + */ |
|
32 | 32 | |
33 | 33 | /*+---------------------------------------------------------------+ |
34 | 34 | * Basic configuration section |
@@ -36,39 +36,39 @@ discard block |
||
36 | 36 | */ |
37 | 37 | |
38 | 38 | /** |
39 | - * The web address of your application. |
|
40 | - * |
|
41 | - * The address of your application or website terminated by a slash. |
|
42 | - * You can use a domain name or IP address, for example: |
|
43 | - * |
|
44 | - * $config['base_url'] = 'http://www.mysite.com'; |
|
45 | - * or |
|
46 | - * $config['base_url'] = 'http://198.15.25.12'; |
|
47 | - * |
|
48 | - * If this value is empty, we try to determine it automatically by using |
|
49 | - * the server variables "SERVER_ADDR" or "SCRIPT_NAME", |
|
50 | - * we recommend that you specify this value for a server in production this may reduce the performance of your application. |
|
51 | - */ |
|
39 | + * The web address of your application. |
|
40 | + * |
|
41 | + * The address of your application or website terminated by a slash. |
|
42 | + * You can use a domain name or IP address, for example: |
|
43 | + * |
|
44 | + * $config['base_url'] = 'http://www.mysite.com'; |
|
45 | + * or |
|
46 | + * $config['base_url'] = 'http://198.15.25.12'; |
|
47 | + * |
|
48 | + * If this value is empty, we try to determine it automatically by using |
|
49 | + * the server variables "SERVER_ADDR" or "SCRIPT_NAME", |
|
50 | + * we recommend that you specify this value for a server in production this may reduce the performance of your application. |
|
51 | + */ |
|
52 | 52 | $config['base_url'] = ''; |
53 | 53 | |
54 | 54 | /** |
55 | - * The front controller |
|
56 | - * |
|
57 | - * This represents the name of the file called by the application during the loading |
|
58 | - * process generally the file "index.php". |
|
59 | - * If your webserver supports the url rewrite module, then you can leave this value empty. |
|
60 | - * You will find a sample file to hide this file in the url inside the root folder of your |
|
61 | - * application "htaccess.txt" for the apache web server just rename it to ".htaccess" |
|
62 | - * |
|
63 | - * Without the rewrite module url enabled, leave this value to "index.php", in this case your urls look like: |
|
64 | - * |
|
65 | - * http://www.yoursite.com/index.php/controller/method |
|
66 | - * |
|
67 | - * otherwise if the module is available and activated you can put this value empty and your urls look like: |
|
68 | - * |
|
69 | - * http://www.yoursite.com/controller/method |
|
70 | - * |
|
71 | - */ |
|
55 | + * The front controller |
|
56 | + * |
|
57 | + * This represents the name of the file called by the application during the loading |
|
58 | + * process generally the file "index.php". |
|
59 | + * If your webserver supports the url rewrite module, then you can leave this value empty. |
|
60 | + * You will find a sample file to hide this file in the url inside the root folder of your |
|
61 | + * application "htaccess.txt" for the apache web server just rename it to ".htaccess" |
|
62 | + * |
|
63 | + * Without the rewrite module url enabled, leave this value to "index.php", in this case your urls look like: |
|
64 | + * |
|
65 | + * http://www.yoursite.com/index.php/controller/method |
|
66 | + * |
|
67 | + * otherwise if the module is available and activated you can put this value empty and your urls look like: |
|
68 | + * |
|
69 | + * http://www.yoursite.com/controller/method |
|
70 | + * |
|
71 | + */ |
|
72 | 72 | $config['front_controller'] = 'index.php'; |
73 | 73 | |
74 | 74 | /** |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | $config['charset'] = 'UTF-8'; |
83 | 83 | |
84 | 84 | /** |
85 | - * Compress the output before send to browser |
|
86 | - * |
|
87 | - * Enables Gzip output compression for faster page loads. When enabled, |
|
88 | - * the Response class will test whether your server supports Gzip. |
|
89 | - * Even if it does, however, not all browsers support compression |
|
90 | - * so enable only if you are reasonably sure your visitors can handle it. |
|
91 | - * |
|
92 | - * This is only used if "zlib.output_compression" is turned off in your php configuration. |
|
93 | - * Please do not use it together with httpd-level output compression. |
|
94 | - * |
|
95 | - * IMPORTANT NOTE: If you are getting a blank page when compression is enabled it |
|
96 | - * means you are prematurely outputting something to your browser. It could |
|
97 | - * even be a line of whitespace at the end of one of your scripts. For |
|
98 | - * compression to work, nothing can be sent before the output buffer is called |
|
99 | - * by the Response class. Do not 'echo' any values with compression enabled. |
|
100 | - */ |
|
85 | + * Compress the output before send to browser |
|
86 | + * |
|
87 | + * Enables Gzip output compression for faster page loads. When enabled, |
|
88 | + * the Response class will test whether your server supports Gzip. |
|
89 | + * Even if it does, however, not all browsers support compression |
|
90 | + * so enable only if you are reasonably sure your visitors can handle it. |
|
91 | + * |
|
92 | + * This is only used if "zlib.output_compression" is turned off in your php configuration. |
|
93 | + * Please do not use it together with httpd-level output compression. |
|
94 | + * |
|
95 | + * IMPORTANT NOTE: If you are getting a blank page when compression is enabled it |
|
96 | + * means you are prematurely outputting something to your browser. It could |
|
97 | + * even be a line of whitespace at the end of one of your scripts. For |
|
98 | + * compression to work, nothing can be sent before the output buffer is called |
|
99 | + * by the Response class. Do not 'echo' any values with compression enabled. |
|
100 | + */ |
|
101 | 101 | $config['compress_output'] = false; |
102 | 102 | |
103 | 103 | /*+---------------------------------------------------------------+ |
@@ -130,51 +130,51 @@ discard block |
||
130 | 130 | */ |
131 | 131 | |
132 | 132 | /** |
133 | - * The log level |
|
134 | - * |
|
135 | - * The valid level are: OFF, NONE, FATAL, ERROR, WARNING, WARN, INFO, DEBUG, ALL |
|
136 | - * |
|
137 | - * 'OFF' or 'NONE' = do not save log |
|
138 | - * 'FATAL' = enable log for fatal level and above (FATAL) |
|
139 | - * 'ERROR' = enable log for error level and above (ERROR, FATAL) |
|
140 | - * 'WARNING' or WARN = enable log for warning level and above (WARNING, ERROR, FATAL) |
|
141 | - * 'INFO' = enable log for info level and above (INFO, WARNING, ERROR, FATAL) |
|
142 | - * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, WARNING, ERROR, FATAL) |
|
143 | - * 'ALL' = enable log for all level |
|
144 | - * |
|
145 | - * The default value is NONE if the config value is: null, '', 0, false |
|
146 | - * |
|
147 | - * Note: in production environment it's recommand to set the log level to 'WARNING' if not in small |
|
148 | - * of time the log file size will increase very fast and will cost the application performance |
|
149 | - * and also the filesystem usage of your server. |
|
150 | - */ |
|
133 | + * The log level |
|
134 | + * |
|
135 | + * The valid level are: OFF, NONE, FATAL, ERROR, WARNING, WARN, INFO, DEBUG, ALL |
|
136 | + * |
|
137 | + * 'OFF' or 'NONE' = do not save log |
|
138 | + * 'FATAL' = enable log for fatal level and above (FATAL) |
|
139 | + * 'ERROR' = enable log for error level and above (ERROR, FATAL) |
|
140 | + * 'WARNING' or WARN = enable log for warning level and above (WARNING, ERROR, FATAL) |
|
141 | + * 'INFO' = enable log for info level and above (INFO, WARNING, ERROR, FATAL) |
|
142 | + * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, WARNING, ERROR, FATAL) |
|
143 | + * 'ALL' = enable log for all level |
|
144 | + * |
|
145 | + * The default value is NONE if the config value is: null, '', 0, false |
|
146 | + * |
|
147 | + * Note: in production environment it's recommand to set the log level to 'WARNING' if not in small |
|
148 | + * of time the log file size will increase very fast and will cost the application performance |
|
149 | + * and also the filesystem usage of your server. |
|
150 | + */ |
|
151 | 151 | $config['log_level'] = 'NONE'; |
152 | 152 | |
153 | 153 | |
154 | 154 | /** |
155 | - * The path to log directory |
|
156 | - * |
|
157 | - * The path that the log data will be saved ending with de "/" or "\", leave empty if you |
|
158 | - * want use the default configuration |
|
159 | - * warning : if set, this directory must exist and will be writable and owned by the web server |
|
160 | - * else the default value will be used i.e the constant LOG_PATH |
|
161 | - * for security raison this directory must be outside of the document root of your |
|
162 | - * website. |
|
163 | - */ |
|
155 | + * The path to log directory |
|
156 | + * |
|
157 | + * The path that the log data will be saved ending with de "/" or "\", leave empty if you |
|
158 | + * want use the default configuration |
|
159 | + * warning : if set, this directory must exist and will be writable and owned by the web server |
|
160 | + * else the default value will be used i.e the constant LOG_PATH |
|
161 | + * for security raison this directory must be outside of the document root of your |
|
162 | + * website. |
|
163 | + */ |
|
164 | 164 | $config['log_save_path'] = ''; |
165 | 165 | |
166 | 166 | /** |
167 | - * The logger name to use for the log |
|
168 | - * |
|
169 | - * You can use an string or array of logger. If this config is set so means only log message with this or these logger(s) will be accepted |
|
170 | - * |
|
171 | - * Example: |
|
172 | - * //using string for only one logger name |
|
173 | - * $config['log_logger_name'] = 'MY_LOGGER'; //only log message with MY_LOGGER will be saved in file. |
|
174 | - * |
|
175 | - * //using array for muliple logger names |
|
176 | - * $config['log_logger_name'] = array('MY_LOGGER1', 'MY_LOGGER2'); //only log message with MY_LOGGER1 or MY_LOGGER2 will be saved in file. |
|
177 | - */ |
|
167 | + * The logger name to use for the log |
|
168 | + * |
|
169 | + * You can use an string or array of logger. If this config is set so means only log message with this or these logger(s) will be accepted |
|
170 | + * |
|
171 | + * Example: |
|
172 | + * //using string for only one logger name |
|
173 | + * $config['log_logger_name'] = 'MY_LOGGER'; //only log message with MY_LOGGER will be saved in file. |
|
174 | + * |
|
175 | + * //using array for muliple logger names |
|
176 | + * $config['log_logger_name'] = array('MY_LOGGER1', 'MY_LOGGER2'); //only log message with MY_LOGGER1 or MY_LOGGER2 will be saved in file. |
|
177 | + */ |
|
178 | 178 | $config['log_logger_name'] = ''; |
179 | 179 | |
180 | 180 | |
@@ -184,41 +184,41 @@ discard block |
||
184 | 184 | */ |
185 | 185 | |
186 | 186 | /** |
187 | - * The session name |
|
188 | - * |
|
189 | - * By default is PHPSESSID. this must be alpha-numerical characters |
|
190 | - */ |
|
187 | + * The session name |
|
188 | + * |
|
189 | + * By default is PHPSESSID. this must be alpha-numerical characters |
|
190 | + */ |
|
191 | 191 | $config['session_name'] = 'PHPSESSID'; |
192 | 192 | |
193 | 193 | /** |
194 | - * Session save path |
|
195 | - * |
|
196 | - * The path that the session data will be saved, leave empty if you |
|
197 | - * want use the default configuration in the php.ini |
|
198 | - * warning : if set, this directory must exist and will be writable and owned by the web server |
|
199 | - * for security raison this directory must be outside of the document root of your |
|
200 | - * website. |
|
201 | - * Note: if the session handler is "database" the session_save_path is the model name to use |
|
202 | - */ |
|
194 | + * Session save path |
|
195 | + * |
|
196 | + * The path that the session data will be saved, leave empty if you |
|
197 | + * want use the default configuration in the php.ini |
|
198 | + * warning : if set, this directory must exist and will be writable and owned by the web server |
|
199 | + * for security raison this directory must be outside of the document root of your |
|
200 | + * website. |
|
201 | + * Note: if the session handler is "database" the session_save_path is the model name to use |
|
202 | + */ |
|
203 | 203 | $config['session_save_path'] = ''; |
204 | 204 | |
205 | 205 | /** |
206 | - * Session handler |
|
207 | - * |
|
208 | - * The session handler that we will use to manage the session. |
|
209 | - * currently the possible values are "files", "database". |
|
210 | - */ |
|
206 | + * Session handler |
|
207 | + * |
|
208 | + * The session handler that we will use to manage the session. |
|
209 | + * currently the possible values are "files", "database". |
|
210 | + */ |
|
211 | 211 | $config['session_handler'] = 'files'; |
212 | 212 | |
213 | 213 | /** |
214 | - * Session secret |
|
215 | - * |
|
216 | - * This is used to hash the session data if the config "session_handler" is set to "database" |
|
217 | - * warning : do not change this value until you already set |
|
218 | - * for security raison use the very complicated value include $%)@^&^\''\'\' |
|
219 | - * NOTE: this value is an base64 so you need use the tool that generate it, like |
|
220 | - * PHP function base64_encode() |
|
221 | - */ |
|
214 | + * Session secret |
|
215 | + * |
|
216 | + * This is used to hash the session data if the config "session_handler" is set to "database" |
|
217 | + * warning : do not change this value until you already set |
|
218 | + * for security raison use the very complicated value include $%)@^&^\''\'\' |
|
219 | + * NOTE: this value is an base64 so you need use the tool that generate it, like |
|
220 | + * PHP function base64_encode() |
|
221 | + */ |
|
222 | 222 | $config['session_secret'] = ''; |
223 | 223 | |
224 | 224 | /** |
@@ -227,36 +227,36 @@ discard block |
||
227 | 227 | $config['session_inactivity_time'] = 600; //in second |
228 | 228 | |
229 | 229 | /** |
230 | - * Session cookie lifetime |
|
231 | - * |
|
232 | - * The cookie lifetime that the session will be dropped in seconds, leave 0 if you want |
|
233 | - * the cookie expire after the browser is closed |
|
234 | - */ |
|
230 | + * Session cookie lifetime |
|
231 | + * |
|
232 | + * The cookie lifetime that the session will be dropped in seconds, leave 0 if you want |
|
233 | + * the cookie expire after the browser is closed |
|
234 | + */ |
|
235 | 235 | $config['session_cookie_lifetime'] = 0; |
236 | 236 | |
237 | 237 | /** |
238 | - * Session cookie path |
|
239 | - * |
|
240 | - * The path to your website that the cookie is available "/" means all path is available |
|
241 | - * example : /mysubdirectory => available in http://www.mysite.com/mysubdirectory |
|
242 | - */ |
|
238 | + * Session cookie path |
|
239 | + * |
|
240 | + * The path to your website that the cookie is available "/" means all path is available |
|
241 | + * example : /mysubdirectory => available in http://www.mysite.com/mysubdirectory |
|
242 | + */ |
|
243 | 243 | $config['session_cookie_path'] = '/'; |
244 | 244 | |
245 | 245 | /** |
246 | - * Session cookie domain |
|
247 | - * |
|
248 | - * The domain of your website that the cookie is available if you want the cookie is available |
|
249 | - * in all your subdomain use this dot before the domain name for example ".mysite.com". |
|
250 | - * leave empty if you want use the default configuration |
|
251 | - */ |
|
246 | + * Session cookie domain |
|
247 | + * |
|
248 | + * The domain of your website that the cookie is available if you want the cookie is available |
|
249 | + * in all your subdomain use this dot before the domain name for example ".mysite.com". |
|
250 | + * leave empty if you want use the default configuration |
|
251 | + */ |
|
252 | 252 | $config['session_cookie_domain'] = ''; |
253 | 253 | |
254 | 254 | /** |
255 | - * Session cookie secure |
|
256 | - * |
|
257 | - * If your website use SSL i.e https, you set "true" for this configuration, so the cookie |
|
258 | - * is available only if the website use the secure connection else set this value to "false" |
|
259 | - */ |
|
255 | + * Session cookie secure |
|
256 | + * |
|
257 | + * If your website use SSL i.e https, you set "true" for this configuration, so the cookie |
|
258 | + * is available only if the website use the secure connection else set this value to "false" |
|
259 | + */ |
|
260 | 260 | $config['session_cookie_secure'] = false; |
261 | 261 | |
262 | 262 | |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | $config['cache_ttl'] = 120; //in second |
308 | 308 | |
309 | 309 | /** |
310 | - * Cache handler class |
|
311 | - * |
|
312 | - * The cache handler class inside (CORE_CLASSES_CACHE_PATH, LIBRARY_PATH) directories that implements |
|
313 | - * the interface "CacheInterface" that we will use to manage the cache. |
|
314 | - * currently the possible values are "FileCache", "ApcCache". |
|
315 | - */ |
|
310 | + * Cache handler class |
|
311 | + * |
|
312 | + * The cache handler class inside (CORE_CLASSES_CACHE_PATH, LIBRARY_PATH) directories that implements |
|
313 | + * the interface "CacheInterface" that we will use to manage the cache. |
|
314 | + * currently the possible values are "FileCache", "ApcCache". |
|
315 | + */ |
|
316 | 316 | $config['cache_handler'] = 'FileCache'; |
317 | 317 | |
318 | 318 |
@@ -22,29 +22,29 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | - * This file contains the connection information to your database, this file is read when you load the "Database" library. |
|
29 | - * You will find all its configuration parameters at your web hosting. |
|
30 | - */ |
|
28 | + * This file contains the connection information to your database, this file is read when you load the "Database" library. |
|
29 | + * You will find all its configuration parameters at your web hosting. |
|
30 | + */ |
|
31 | 31 | |
32 | 32 | /** |
33 | - * The type or driver of your database. |
|
34 | - * |
|
35 | - * Note: the "Database" library uses the PHP PDO extension to interact with your database, |
|
36 | - * so most of the PDO supported drivers namely: mysql, pgsql, sqlite, oracle are accepted. |
|
37 | - * For example : |
|
38 | - * |
|
39 | - * $db['driver'] = 'mysql'; // for MySQL Database |
|
40 | - * or |
|
41 | - * $db['driver'] = 'pgsql'; // for PostgreSQL Database |
|
42 | - * or |
|
43 | - * $db['driver'] = 'sqlite'; // for SQLite Database |
|
44 | - * or |
|
45 | - * $db['driver'] = 'oracle'; // for Oracle Database |
|
46 | - * |
|
47 | - */ |
|
33 | + * The type or driver of your database. |
|
34 | + * |
|
35 | + * Note: the "Database" library uses the PHP PDO extension to interact with your database, |
|
36 | + * so most of the PDO supported drivers namely: mysql, pgsql, sqlite, oracle are accepted. |
|
37 | + * For example : |
|
38 | + * |
|
39 | + * $db['driver'] = 'mysql'; // for MySQL Database |
|
40 | + * or |
|
41 | + * $db['driver'] = 'pgsql'; // for PostgreSQL Database |
|
42 | + * or |
|
43 | + * $db['driver'] = 'sqlite'; // for SQLite Database |
|
44 | + * or |
|
45 | + * $db['driver'] = 'oracle'; // for Oracle Database |
|
46 | + * |
|
47 | + */ |
|
48 | 48 | $db['driver'] = 'mysql'; |
49 | 49 | |
50 | 50 | /** |
@@ -62,66 +62,66 @@ discard block |
||
62 | 62 | $db['hostname'] = 'localhost'; |
63 | 63 | |
64 | 64 | /** |
65 | - * The username of your database server |
|
66 | - * for example : |
|
67 | - * |
|
68 | - * $db['username'] = 'root'; |
|
69 | - * or |
|
70 | - * $db['username'] = 'myusername'; |
|
71 | - */ |
|
65 | + * The username of your database server |
|
66 | + * for example : |
|
67 | + * |
|
68 | + * $db['username'] = 'root'; |
|
69 | + * or |
|
70 | + * $db['username'] = 'myusername'; |
|
71 | + */ |
|
72 | 72 | $db['username'] = 'root'; |
73 | 73 | |
74 | 74 | |
75 | 75 | /** |
76 | - * The password of your database server. |
|
77 | - * |
|
78 | - * Note: Some configuration settings on some database management systems do not allow |
|
79 | - * connection with a user without password, so it is recommended to set a password for this user for a security measure. |
|
80 | - * for example : |
|
81 | - * |
|
82 | - * $db['password'] = ''; //for an empty password, this is the case most often, if you are in local, ie for the user "root". |
|
83 | - * or |
|
84 | - * $db['password'] = 'M@5CUR3P@$$W0rd'; |
|
85 | - */ |
|
76 | + * The password of your database server. |
|
77 | + * |
|
78 | + * Note: Some configuration settings on some database management systems do not allow |
|
79 | + * connection with a user without password, so it is recommended to set a password for this user for a security measure. |
|
80 | + * for example : |
|
81 | + * |
|
82 | + * $db['password'] = ''; //for an empty password, this is the case most often, if you are in local, ie for the user "root". |
|
83 | + * or |
|
84 | + * $db['password'] = 'M@5CUR3P@$$W0rd'; |
|
85 | + */ |
|
86 | 86 | $db['password'] = ''; |
87 | 87 | |
88 | 88 | /** |
89 | - * The name of your database |
|
90 | - * |
|
91 | - * for example : |
|
92 | - * |
|
93 | - * $db['database'] = 'database_name'; |
|
94 | - */ |
|
89 | + * The name of your database |
|
90 | + * |
|
91 | + * for example : |
|
92 | + * |
|
93 | + * $db['database'] = 'database_name'; |
|
94 | + */ |
|
95 | 95 | $db['database'] = ''; |
96 | 96 | |
97 | 97 | |
98 | 98 | /** |
99 | - * The character set that will be used by the database server. |
|
100 | - * for example : |
|
101 | - * |
|
102 | - * $db['charset'] = 'utf8'; |
|
103 | - */ |
|
99 | + * The character set that will be used by the database server. |
|
100 | + * for example : |
|
101 | + * |
|
102 | + * $db['charset'] = 'utf8'; |
|
103 | + */ |
|
104 | 104 | $db['charset'] = 'utf8'; |
105 | 105 | |
106 | 106 | /** |
107 | - * In addition to the character set, a certain database management system allows you to |
|
108 | - * choose how the data will be classified (ORDER BY) by what is called a "COLLATE". |
|
109 | - * This makes it possible, for example, to answer the classic problem of case sensitivity. |
|
110 | - * for example : |
|
111 | - * $db['collation'] = 'utf8_general_ci'; |
|
112 | - */ |
|
107 | + * In addition to the character set, a certain database management system allows you to |
|
108 | + * choose how the data will be classified (ORDER BY) by what is called a "COLLATE". |
|
109 | + * This makes it possible, for example, to answer the classic problem of case sensitivity. |
|
110 | + * for example : |
|
111 | + * $db['collation'] = 'utf8_general_ci'; |
|
112 | + */ |
|
113 | 113 | $db['collation'] = 'utf8_general_ci'; |
114 | 114 | |
115 | 115 | |
116 | 116 | /** |
117 | - * If your tables in your database contain prefixes, this is the case most on some application, |
|
118 | - * to avoid the conflict of name of the tables between different database, |
|
119 | - * it is possible to define prefixes for the tables. |
|
120 | - * for example : |
|
121 | - * |
|
122 | - * $db['prefix'] = 'pf_'; |
|
123 | - * or |
|
124 | - * |
|
125 | - * $db['prefix'] = 'my_db_'; |
|
126 | - */ |
|
117 | + * If your tables in your database contain prefixes, this is the case most on some application, |
|
118 | + * to avoid the conflict of name of the tables between different database, |
|
119 | + * it is possible to define prefixes for the tables. |
|
120 | + * for example : |
|
121 | + * |
|
122 | + * $db['prefix'] = 'pf_'; |
|
123 | + * or |
|
124 | + * |
|
125 | + * $db['prefix'] = 'my_db_'; |
|
126 | + */ |
|
127 | 127 | $db['prefix'] = ''; |
128 | 128 | \ No newline at end of file |
@@ -22,73 +22,73 @@ |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | - * This file contains the configuration of resources that you want to load automatically: |
|
29 | - * personal or system libraries, configuration files, models, |
|
30 | - * personal functions or systems that are used most often in your application |
|
31 | - * instead of loading them every time you want to use it. |
|
32 | - * Note: loading a lot of resources can decrease the performance of your application. |
|
33 | - */ |
|
28 | + * This file contains the configuration of resources that you want to load automatically: |
|
29 | + * personal or system libraries, configuration files, models, |
|
30 | + * personal functions or systems that are used most often in your application |
|
31 | + * instead of loading them every time you want to use it. |
|
32 | + * Note: loading a lot of resources can decrease the performance of your application. |
|
33 | + */ |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
37 | - * If you have personal libraries or systems to load automatically, then list them in the following array. |
|
38 | - * For example : |
|
39 | - * |
|
40 | - * $autoload['libraries'] = array('library1', 'library1'); |
|
41 | - * |
|
42 | - * Note: Personal libraries have priority over system libraries, |
|
43 | - * ie the loading order is as follows: it looks in the folder of the personal libraries, |
|
44 | - * if it is found, it is loaded, if not , we search in the system libraries folder, |
|
45 | - * before returning an error in case it does not find it. |
|
46 | - */ |
|
37 | + * If you have personal libraries or systems to load automatically, then list them in the following array. |
|
38 | + * For example : |
|
39 | + * |
|
40 | + * $autoload['libraries'] = array('library1', 'library1'); |
|
41 | + * |
|
42 | + * Note: Personal libraries have priority over system libraries, |
|
43 | + * ie the loading order is as follows: it looks in the folder of the personal libraries, |
|
44 | + * if it is found, it is loaded, if not , we search in the system libraries folder, |
|
45 | + * before returning an error in case it does not find it. |
|
46 | + */ |
|
47 | 47 | $autoload['libraries'] = array(); |
48 | 48 | |
49 | 49 | /** |
50 | - * If you have configuration files to load automatically, then list them in the following array. |
|
51 | - * For example : |
|
52 | - * |
|
53 | - * $autoload['config'] = array('config1', 'config2'); |
|
54 | - * |
|
55 | - * Note 1: the file name must have as prefix "config_" |
|
56 | - * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config, |
|
57 | - * otherwise the system can not find this configuration file. |
|
58 | - * For example : |
|
59 | - * |
|
60 | - * $config['key1'] = value1; |
|
61 | - * $config['key2'] = value2; |
|
62 | - * |
|
63 | - * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php". |
|
64 | - */ |
|
50 | + * If you have configuration files to load automatically, then list them in the following array. |
|
51 | + * For example : |
|
52 | + * |
|
53 | + * $autoload['config'] = array('config1', 'config2'); |
|
54 | + * |
|
55 | + * Note 1: the file name must have as prefix "config_" |
|
56 | + * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config, |
|
57 | + * otherwise the system can not find this configuration file. |
|
58 | + * For example : |
|
59 | + * |
|
60 | + * $config['key1'] = value1; |
|
61 | + * $config['key2'] = value2; |
|
62 | + * |
|
63 | + * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php". |
|
64 | + */ |
|
65 | 65 | $autoload['config'] = array(); |
66 | 66 | |
67 | 67 | /** |
68 | - * If you have models to load automatically, then list them in the following table. |
|
69 | - * For example : |
|
70 | - * |
|
71 | - * $autoload['models'] = array('model1', 'model2'); |
|
72 | - */ |
|
68 | + * If you have models to load automatically, then list them in the following table. |
|
69 | + * For example : |
|
70 | + * |
|
71 | + * $autoload['models'] = array('model1', 'model2'); |
|
72 | + */ |
|
73 | 73 | $autoload['models'] = array(); |
74 | 74 | |
75 | 75 | /** |
76 | - * If you have system or personal functions to load automatically, specify them in the following array. |
|
77 | - * For example : |
|
78 | - * |
|
79 | - * $autoload['functions'] = array('function1', 'function2'); |
|
80 | - * |
|
81 | - * Note: Personal functions have priority over system functions, |
|
82 | - * that is to say that the order of loading is the following : it looks in the directory of the personal functions, |
|
83 | - * if it is found, it is loaded, otherwise, it looks in the directory of the system functions, |
|
84 | - * before returning an error in case he does not find it. |
|
85 | - */ |
|
76 | + * If you have system or personal functions to load automatically, specify them in the following array. |
|
77 | + * For example : |
|
78 | + * |
|
79 | + * $autoload['functions'] = array('function1', 'function2'); |
|
80 | + * |
|
81 | + * Note: Personal functions have priority over system functions, |
|
82 | + * that is to say that the order of loading is the following : it looks in the directory of the personal functions, |
|
83 | + * if it is found, it is loaded, otherwise, it looks in the directory of the system functions, |
|
84 | + * before returning an error in case he does not find it. |
|
85 | + */ |
|
86 | 86 | $autoload['functions'] = array(); |
87 | 87 | |
88 | 88 | /** |
89 | - * If you have system or personal language to load automatically, specify them in the following array. |
|
90 | - * For example : |
|
91 | - * |
|
92 | - * $autoload['languages'] = array('lang1', 'lang2'); |
|
93 | - */ |
|
89 | + * If you have system or personal language to load automatically, specify them in the following array. |
|
90 | + * For example : |
|
91 | + * |
|
92 | + * $autoload['languages'] = array('lang1', 'lang2'); |
|
93 | + */ |
|
94 | 94 | $autoload['languages'] = array(); |
@@ -21,194 +21,194 @@ discard block |
||
21 | 21 | * You should have received a copy of the GNU General Public License |
22 | 22 | * along with this program; if not, write to the Free Software |
23 | 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
24 | - */ |
|
24 | + */ |
|
25 | 25 | |
26 | 26 | /** |
27 | - * the directory separator, under windows it is \ and unix, linux / |
|
28 | - */ |
|
27 | + * the directory separator, under windows it is \ and unix, linux / |
|
28 | + */ |
|
29 | 29 | define('DS', DIRECTORY_SEPARATOR); |
30 | 30 | |
31 | 31 | /** |
32 | - * The root directory of the application. |
|
33 | - * |
|
34 | - * you can place this directory outside of your web directory, for example "/home/your_app", etc. |
|
35 | - */ |
|
32 | + * The root directory of the application. |
|
33 | + * |
|
34 | + * you can place this directory outside of your web directory, for example "/home/your_app", etc. |
|
35 | + */ |
|
36 | 36 | define('ROOT_PATH', dirname(realpath(__FILE__)) . DS); |
37 | 37 | |
38 | 38 | /** |
39 | - * The path to the directory. |
|
40 | - * |
|
41 | - * That contains your static files (javascript, css, images, etc.) |
|
42 | - * Note: the path must be relative to the file index.php (the front-end controller). |
|
43 | - */ |
|
39 | + * The path to the directory. |
|
40 | + * |
|
41 | + * That contains your static files (javascript, css, images, etc.) |
|
42 | + * Note: the path must be relative to the file index.php (the front-end controller). |
|
43 | + */ |
|
44 | 44 | define('ASSETS_PATH', 'assets/'); |
45 | 45 | |
46 | 46 | /** |
47 | - * The path to the directory of your cache files. |
|
48 | - * |
|
49 | - * This feature is available currently for database and views. |
|
50 | - */ |
|
47 | + * The path to the directory of your cache files. |
|
48 | + * |
|
49 | + * This feature is available currently for database and views. |
|
50 | + */ |
|
51 | 51 | define('CACHE_PATH', ROOT_PATH . 'cache' . DS); |
52 | 52 | |
53 | 53 | /** |
54 | - * The path to the application directory. |
|
55 | - * |
|
56 | - * It contains your most often used files that is to say which contains your files of the application, |
|
57 | - * in MVC architecture (controllers, models, views). |
|
58 | - */ |
|
54 | + * The path to the application directory. |
|
55 | + * |
|
56 | + * It contains your most often used files that is to say which contains your files of the application, |
|
57 | + * in MVC architecture (controllers, models, views). |
|
58 | + */ |
|
59 | 59 | define('APPS_PATH', ROOT_PATH . 'classes' . DS); |
60 | 60 | |
61 | 61 | /** |
62 | - * The path to the controller directory of your application. |
|
63 | - * |
|
64 | - * If you already know the MVC architecture you know what a controller means; |
|
65 | - * it is he who makes the business logic of your application in general. |
|
66 | - */ |
|
62 | + * The path to the controller directory of your application. |
|
63 | + * |
|
64 | + * If you already know the MVC architecture you know what a controller means; |
|
65 | + * it is he who makes the business logic of your application in general. |
|
66 | + */ |
|
67 | 67 | define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS); |
68 | 68 | |
69 | 69 | /** |
70 | - * The path to the directory of your model classes of your application. |
|
71 | - * |
|
72 | - * If you already know the MVC architecture you know what a model means; |
|
73 | - * it's the one who interacts with the database, in one word persistent data from your application. |
|
74 | - */ |
|
70 | + * The path to the directory of your model classes of your application. |
|
71 | + * |
|
72 | + * If you already know the MVC architecture you know what a model means; |
|
73 | + * it's the one who interacts with the database, in one word persistent data from your application. |
|
74 | + */ |
|
75 | 75 | define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS); |
76 | 76 | |
77 | 77 | /** |
78 | - * The path to the directory of your views. |
|
79 | - * |
|
80 | - * If you already know the MVC architecture you know what a view means, |
|
81 | - * a view is just a user interface (html page, form, etc.) that is to say |
|
82 | - * everything displayed in the browser interface, etc. |
|
83 | - */ |
|
78 | + * The path to the directory of your views. |
|
79 | + * |
|
80 | + * If you already know the MVC architecture you know what a view means, |
|
81 | + * a view is just a user interface (html page, form, etc.) that is to say |
|
82 | + * everything displayed in the browser interface, etc. |
|
83 | + */ |
|
84 | 84 | define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS); |
85 | 85 | |
86 | 86 | /** |
87 | - * The path to the configuration directory. |
|
88 | - * |
|
89 | - * That contains most of the configuration files for your |
|
90 | - * application (database, class loading file, functions, etc.) |
|
91 | - */ |
|
87 | + * The path to the configuration directory. |
|
88 | + * |
|
89 | + * That contains most of the configuration files for your |
|
90 | + * application (database, class loading file, functions, etc.) |
|
91 | + */ |
|
92 | 92 | define('CONFIG_PATH', ROOT_PATH . 'config' . DS); |
93 | 93 | |
94 | 94 | /** |
95 | - * The core directory |
|
96 | - * |
|
97 | - * It is recommended to put this folder out of the web directory of your server and |
|
98 | - * you should not change its content because in case of update you could lose the modified files. |
|
99 | - */ |
|
95 | + * The core directory |
|
96 | + * |
|
97 | + * It is recommended to put this folder out of the web directory of your server and |
|
98 | + * you should not change its content because in case of update you could lose the modified files. |
|
99 | + */ |
|
100 | 100 | define('CORE_PATH', ROOT_PATH . 'core' . DS); |
101 | 101 | |
102 | 102 | /** |
103 | - * The path to the directory of core classes that used by the system. |
|
104 | - * |
|
105 | - * It contains PHP classes that are used by the framework internally. |
|
106 | - */ |
|
103 | + * The path to the directory of core classes that used by the system. |
|
104 | + * |
|
105 | + * It contains PHP classes that are used by the framework internally. |
|
106 | + */ |
|
107 | 107 | define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS); |
108 | 108 | |
109 | 109 | /** |
110 | - * The path to the directory of core classes for the cache used by the system. |
|
111 | - * |
|
112 | - * It contains PHP classes for the cache drivers. |
|
113 | - */ |
|
110 | + * The path to the directory of core classes for the cache used by the system. |
|
111 | + * |
|
112 | + * It contains PHP classes for the cache drivers. |
|
113 | + */ |
|
114 | 114 | define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS); |
115 | 115 | |
116 | 116 | /** |
117 | - * The path to the directory of core classes for the model used by the system. |
|
118 | - * |
|
119 | - * It contains PHP classes for the models. |
|
120 | - */ |
|
117 | + * The path to the directory of core classes for the model used by the system. |
|
118 | + * |
|
119 | + * It contains PHP classes for the models. |
|
120 | + */ |
|
121 | 121 | define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS); |
122 | 122 | |
123 | 123 | /** |
124 | - * The path to the directory of functions or helper systems. |
|
125 | - * |
|
126 | - * It contains PHP functions that perform a particular task: character string processing, URL, etc. |
|
127 | - */ |
|
124 | + * The path to the directory of functions or helper systems. |
|
125 | + * |
|
126 | + * It contains PHP functions that perform a particular task: character string processing, URL, etc. |
|
127 | + */ |
|
128 | 128 | define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS); |
129 | 129 | |
130 | 130 | /** |
131 | - * The path to the core directory of languages files. |
|
132 | - * |
|
133 | - */ |
|
131 | + * The path to the core directory of languages files. |
|
132 | + * |
|
133 | + */ |
|
134 | 134 | define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS); |
135 | 135 | |
136 | 136 | /** |
137 | - * The path to the system library directory. |
|
138 | - * |
|
139 | - * Which contains the libraries most often used in your web application, as for the |
|
140 | - * core directory it is advisable to put it out of the root directory of your application. |
|
141 | - */ |
|
137 | + * The path to the system library directory. |
|
138 | + * |
|
139 | + * Which contains the libraries most often used in your web application, as for the |
|
140 | + * core directory it is advisable to put it out of the root directory of your application. |
|
141 | + */ |
|
142 | 142 | define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS); |
143 | 143 | |
144 | 144 | /** |
145 | - * The path to the system view directory. |
|
146 | - * |
|
147 | - * That contains the views used for the system, such as error messages, and so on. |
|
148 | - */ |
|
145 | + * The path to the system view directory. |
|
146 | + * |
|
147 | + * That contains the views used for the system, such as error messages, and so on. |
|
148 | + */ |
|
149 | 149 | define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS); |
150 | 150 | |
151 | 151 | /** |
152 | - * The path to the directory of your PHP personal functions or helper. |
|
153 | - * |
|
154 | - * It contains your PHP functions that perform a particular task: utilities, etc. |
|
155 | - * Note: Do not put your personal functions or helpers in the system functions directory, |
|
156 | - * because if you update the system you may lose them. |
|
157 | - */ |
|
152 | + * The path to the directory of your PHP personal functions or helper. |
|
153 | + * |
|
154 | + * It contains your PHP functions that perform a particular task: utilities, etc. |
|
155 | + * Note: Do not put your personal functions or helpers in the system functions directory, |
|
156 | + * because if you update the system you may lose them. |
|
157 | + */ |
|
158 | 158 | define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS); |
159 | 159 | |
160 | 160 | /** |
161 | - * The path to the app directory of personal language. |
|
162 | - * |
|
163 | - * This feature is not yet available. |
|
164 | - * You can help us do this if you are nice or wish to see the developed framework. |
|
165 | - */ |
|
161 | + * The path to the app directory of personal language. |
|
162 | + * |
|
163 | + * This feature is not yet available. |
|
164 | + * You can help us do this if you are nice or wish to see the developed framework. |
|
165 | + */ |
|
166 | 166 | define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS); |
167 | 167 | |
168 | 168 | /** |
169 | - * The path to the directory of your personal libraries |
|
170 | - * |
|
171 | - * It contains your PHP classes, package, etc. |
|
172 | - * Note: you should not put your personal libraries in the system library directory, |
|
173 | - * because it is recalled in case of updating the system you might have surprises. |
|
174 | - */ |
|
169 | + * The path to the directory of your personal libraries |
|
170 | + * |
|
171 | + * It contains your PHP classes, package, etc. |
|
172 | + * Note: you should not put your personal libraries in the system library directory, |
|
173 | + * because it is recalled in case of updating the system you might have surprises. |
|
174 | + */ |
|
175 | 175 | define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS); |
176 | 176 | |
177 | 177 | /** |
178 | - * The path to the directory that contains the log files. |
|
179 | - * |
|
180 | - * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, |
|
181 | - * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more |
|
182 | - * details see the documentation of your web server. |
|
183 | - * Example for Unix or linux with apache web server: |
|
184 | - * # chmod -R 700 /path/to/your/logs/directory/ |
|
185 | - * # chown -R www-data:www-data /path/to/your/logs/directory/ |
|
186 | - */ |
|
178 | + * The path to the directory that contains the log files. |
|
179 | + * |
|
180 | + * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, |
|
181 | + * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more |
|
182 | + * details see the documentation of your web server. |
|
183 | + * Example for Unix or linux with apache web server: |
|
184 | + * # chmod -R 700 /path/to/your/logs/directory/ |
|
185 | + * # chown -R www-data:www-data /path/to/your/logs/directory/ |
|
186 | + */ |
|
187 | 187 | define('LOGS_PATH', ROOT_PATH . 'logs' . DS); |
188 | 188 | |
189 | 189 | /** |
190 | - * The path to the modules directory. |
|
191 | - * |
|
192 | - * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
|
193 | - * in HMVC architecture (hierichical, controllers, models, views). |
|
194 | - */ |
|
190 | + * The path to the modules directory. |
|
191 | + * |
|
192 | + * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
|
193 | + * in HMVC architecture (hierichical, controllers, models, views). |
|
194 | + */ |
|
195 | 195 | define('MODULE_PATH', ROOT_PATH . 'modules' . DS); |
196 | 196 | |
197 | 197 | /** |
198 | - * The path to the directory of sources external to your application. |
|
199 | - * |
|
200 | - * If you have already used "composer" you know what that means. |
|
201 | - */ |
|
198 | + * The path to the directory of sources external to your application. |
|
199 | + * |
|
200 | + * If you have already used "composer" you know what that means. |
|
201 | + */ |
|
202 | 202 | define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS); |
203 | 203 | |
204 | 204 | /** |
205 | - * The front controller of your application. |
|
206 | - * |
|
207 | - * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of |
|
208 | - * your application by using the rewrite module URL of your web server . |
|
209 | - * For example, under apache web server, there is a configuration example file that is located at the root |
|
210 | - * of your framework folder : "htaccess.txt" rename it to ".htaccess". |
|
211 | - */ |
|
205 | + * The front controller of your application. |
|
206 | + * |
|
207 | + * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of |
|
208 | + * your application by using the rewrite module URL of your web server . |
|
209 | + * For example, under apache web server, there is a configuration example file that is located at the root |
|
210 | + * of your framework folder : "htaccess.txt" rename it to ".htaccess". |
|
211 | + */ |
|
212 | 212 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
213 | 213 | |
214 | 214 | /** |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | define('IS_CLI', stripos('cli', php_sapi_name()) !== false); |
218 | 218 | |
219 | 219 | /** |
220 | - * The environment of your application (production, test, development). |
|
221 | - * |
|
222 | - * if your application is still in development you use the value "development" |
|
223 | - * so you will have the display of the error messages, etc. |
|
224 | - * Once you finish the development of your application that is to put it online |
|
225 | - * you change this value to "production" or "testing", in this case there will be deactivation of error messages, |
|
226 | - * the loading of the system, will be fast. |
|
227 | - */ |
|
220 | + * The environment of your application (production, test, development). |
|
221 | + * |
|
222 | + * if your application is still in development you use the value "development" |
|
223 | + * so you will have the display of the error messages, etc. |
|
224 | + * Once you finish the development of your application that is to put it online |
|
225 | + * you change this value to "production" or "testing", in this case there will be deactivation of error messages, |
|
226 | + * the loading of the system, will be fast. |
|
227 | + */ |
|
228 | 228 | define('ENVIRONMENT', 'development'); |
229 | 229 | |
230 | 230 | /* ---------------------------------------------------------------------------------- */ |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
257 | - * let's go. |
|
258 | - * Everything is OK now we launch our application. |
|
259 | - */ |
|
257 | + * let's go. |
|
258 | + * Everything is OK now we launch our application. |
|
259 | + */ |
|
260 | 260 | require_once CORE_PATH . 'bootstrap.php'; |
261 | 261 | \ No newline at end of file |
@@ -243,7 +243,7 @@ |
||
243 | 243 | if (version_compare(PHP_VERSION, '5.3', '>=')) { |
244 | 244 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
245 | 245 | } |
246 | - else{ |
|
246 | + else { |
|
247 | 247 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
248 | 248 | } |
249 | 249 | break; |
@@ -242,8 +242,7 @@ |
||
242 | 242 | ini_set('display_errors', 0); |
243 | 243 | if (version_compare(PHP_VERSION, '5.3', '>=')) { |
244 | 244 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
245 | - } |
|
246 | - else{ |
|
245 | + } else{ |
|
247 | 246 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
248 | 247 | } |
249 | 248 | break; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @file bootstrap.php |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * inclusion of global constants of the environment that contain : name of the framework, |
|
50 | - * version, release date, version of PHP required, etc. |
|
51 | - */ |
|
49 | + * inclusion of global constants of the environment that contain : name of the framework, |
|
50 | + * version, release date, version of PHP required, etc. |
|
51 | + */ |
|
52 | 52 | require_once CORE_PATH . 'constants.php'; |
53 | 53 | |
54 | 54 | /** |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | $BENCHMARK->mark('APP_EXECUTION_START'); |
66 | 66 | |
67 | 67 | /** |
68 | - * instance of the Log class |
|
69 | - */ |
|
70 | - $LOGGER =& class_loader('Log', 'classes'); |
|
68 | + * instance of the Log class |
|
69 | + */ |
|
70 | + $LOGGER =& class_loader('Log', 'classes'); |
|
71 | 71 | |
72 | - $LOGGER->setLogger('ApplicationBootstrap'); |
|
72 | + $LOGGER->setLogger('ApplicationBootstrap'); |
|
73 | 73 | |
74 | - $LOGGER->debug('Checking PHP version ...'); |
|
74 | + $LOGGER->debug('Checking PHP version ...'); |
|
75 | 75 | |
76 | 76 | /** |
77 | - * Verification of the PHP environment: minimum and maximum version |
|
78 | - */ |
|
77 | + * Verification of the PHP environment: minimum and maximum version |
|
78 | + */ |
|
79 | 79 | if (version_compare(phpversion(), TNH_REQUIRED_PHP_MIN_VERSION, '<')){ |
80 | 80 | show_error('Your PHP Version [' . phpversion() . '] is less than [' . TNH_REQUIRED_PHP_MIN_VERSION . '], please install a new version or update your PHP to the latest.', 'PHP Error environment'); |
81 | 81 | } |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $LOGGER->info('PHP version [' . phpversion() . '] is OK [REQUIRED MINIMUM: ' . TNH_REQUIRED_PHP_MIN_VERSION . ', REQUIRED MAXIMUM: ' . TNH_REQUIRED_PHP_MAX_VERSION . '], application can work without any issue'); |
86 | 86 | |
87 | 87 | /** |
88 | - * Setting of the PHP error message handling function |
|
89 | - */ |
|
88 | + * Setting of the PHP error message handling function |
|
89 | + */ |
|
90 | 90 | set_error_handler('php_error_handler'); |
91 | 91 | |
92 | 92 | /** |
93 | - * Setting of the PHP error exception handling function |
|
94 | - */ |
|
93 | + * Setting of the PHP error exception handling function |
|
94 | + */ |
|
95 | 95 | set_exception_handler('php_exception_handler'); |
96 | 96 | |
97 | 97 | /** |
@@ -124,18 +124,18 @@ discard block |
||
124 | 124 | |
125 | 125 | $BENCHMARK->mark('CONFIG_INIT_START'); |
126 | 126 | /** |
127 | - * Load configurations and using the |
|
128 | - * static method "init()" to initialize the Config class . |
|
129 | - */ |
|
127 | + * Load configurations and using the |
|
128 | + * static method "init()" to initialize the Config class . |
|
129 | + */ |
|
130 | 130 | $CONFIG =& class_loader('Config', 'classes'); |
131 | 131 | $CONFIG->init(); |
132 | 132 | $BENCHMARK->mark('CONFIG_INIT_END'); |
133 | 133 | |
134 | 134 | $BENCHMARK->mark('MODULE_INIT_START'); |
135 | 135 | /** |
136 | - * Load modules and using the |
|
137 | - * static method "init()" to initialize the Module class. |
|
138 | - */ |
|
136 | + * Load modules and using the |
|
137 | + * static method "init()" to initialize the Module class. |
|
138 | + */ |
|
139 | 139 | $MODULE =& class_loader('Module', 'classes'); |
140 | 140 | $MODULE->init(); |
141 | 141 | $BENCHMARK->mark('MODULE_INIT_END'); |
@@ -148,19 +148,19 @@ discard block |
||
148 | 148 | $LOGGER->info('Base Controller loaded successfully'); |
149 | 149 | |
150 | 150 | /** |
151 | - * Register controllers autoload function |
|
152 | - */ |
|
151 | + * Register controllers autoload function |
|
152 | + */ |
|
153 | 153 | spl_autoload_register('autoload_controller'); |
154 | 154 | |
155 | 155 | /** |
156 | - * Loading Security class |
|
157 | - */ |
|
156 | + * Loading Security class |
|
157 | + */ |
|
158 | 158 | $SECURITY =& class_loader('Security', 'classes'); |
159 | 159 | $SECURITY->checkWhiteListIpAccess(); |
160 | 160 | |
161 | 161 | /** |
162 | - * Loading Url class |
|
163 | - */ |
|
162 | + * Loading Url class |
|
163 | + */ |
|
164 | 164 | $URL =& class_loader('Url', 'classes'); |
165 | 165 | |
166 | 166 | if(get_config('cache_enable', false)){ |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | |
191 | 191 | $LOGGER->info('Everything is OK load Router library and dispatch the request to the corresponding controller'); |
192 | 192 | /** |
193 | - * Routing |
|
194 | - * instantiation of the "Router" class and user request routing processing. |
|
195 | - */ |
|
193 | + * Routing |
|
194 | + * instantiation of the "Router" class and user request routing processing. |
|
195 | + */ |
|
196 | 196 | $ROUTER = & class_loader('Router', 'classes'); |
197 | 197 | $ROUTER->run(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | |
43 | 43 | //if the application is running in CLI mode $_SESSION global variable is not available |
44 | - if(IS_CLI){ |
|
44 | + if (IS_CLI) { |
|
45 | 45 | $_SESSION = array(); |
46 | 46 | } |
47 | 47 | |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * The Benchmark class |
62 | 62 | */ |
63 | - $BENCHMARK =& class_loader('Benchmark'); |
|
63 | + $BENCHMARK = & class_loader('Benchmark'); |
|
64 | 64 | |
65 | 65 | $BENCHMARK->mark('APP_EXECUTION_START'); |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * instance of the Log class |
69 | 69 | */ |
70 | - $LOGGER =& class_loader('Log', 'classes'); |
|
70 | + $LOGGER = & class_loader('Log', 'classes'); |
|
71 | 71 | |
72 | 72 | $LOGGER->setLogger('ApplicationBootstrap'); |
73 | 73 | |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * Verification of the PHP environment: minimum and maximum version |
78 | 78 | */ |
79 | - if (version_compare(phpversion(), TNH_REQUIRED_PHP_MIN_VERSION, '<')){ |
|
79 | + if (version_compare(phpversion(), TNH_REQUIRED_PHP_MIN_VERSION, '<')) { |
|
80 | 80 | show_error('Your PHP Version [' . phpversion() . '] is less than [' . TNH_REQUIRED_PHP_MIN_VERSION . '], please install a new version or update your PHP to the latest.', 'PHP Error environment'); |
81 | 81 | } |
82 | - else if(version_compare(phpversion(), TNH_REQUIRED_PHP_MAX_VERSION, '>')){ |
|
82 | + else if (version_compare(phpversion(), TNH_REQUIRED_PHP_MAX_VERSION, '>')) { |
|
83 | 83 | show_error('Your PHP Version [' . phpversion() . '] is greather than [' . TNH_REQUIRED_PHP_MAX_VERSION . '] please install a PHP version that is compatible.', 'PHP Error environment'); |
84 | 84 | } |
85 | 85 | $LOGGER->info('PHP version [' . phpversion() . '] is OK [REQUIRED MINIMUM: ' . TNH_REQUIRED_PHP_MIN_VERSION . ', REQUIRED MAXIMUM: ' . TNH_REQUIRED_PHP_MAX_VERSION . '], application can work without any issue'); |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | |
102 | 102 | //if user have some composer packages |
103 | 103 | $LOGGER->debug('Check for composer autoload'); |
104 | - if(file_exists(VENDOR_PATH . 'autoload.php')){ |
|
104 | + if (file_exists(VENDOR_PATH . 'autoload.php')) { |
|
105 | 105 | $LOGGER->info('The composer autoload file exists include it'); |
106 | 106 | require_once VENDOR_PATH . 'autoload.php'; |
107 | 107 | } |
108 | - else{ |
|
108 | + else { |
|
109 | 109 | $LOGGER->info('The composer autoload file does not exist skipping'); |
110 | 110 | } |
111 | 111 | |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | * Load the EventDispatcher class |
121 | 121 | * @var EventDispatcher |
122 | 122 | */ |
123 | - $DISPATCHER =& class_loader('EventDispatcher', 'classes'); |
|
123 | + $DISPATCHER = & class_loader('EventDispatcher', 'classes'); |
|
124 | 124 | |
125 | 125 | $BENCHMARK->mark('CONFIG_INIT_START'); |
126 | 126 | /** |
127 | 127 | * Load configurations and using the |
128 | 128 | * static method "init()" to initialize the Config class . |
129 | 129 | */ |
130 | - $CONFIG =& class_loader('Config', 'classes'); |
|
130 | + $CONFIG = & class_loader('Config', 'classes'); |
|
131 | 131 | $CONFIG->init(); |
132 | 132 | $BENCHMARK->mark('CONFIG_INIT_END'); |
133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * Load modules and using the |
137 | 137 | * static method "init()" to initialize the Module class. |
138 | 138 | */ |
139 | - $MODULE =& class_loader('Module', 'classes'); |
|
139 | + $MODULE = & class_loader('Module', 'classes'); |
|
140 | 140 | $MODULE->init(); |
141 | 141 | $BENCHMARK->mark('MODULE_INIT_END'); |
142 | 142 | |
@@ -155,34 +155,34 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * Loading Security class |
157 | 157 | */ |
158 | - $SECURITY =& class_loader('Security', 'classes'); |
|
158 | + $SECURITY = & class_loader('Security', 'classes'); |
|
159 | 159 | $SECURITY->checkWhiteListIpAccess(); |
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Loading Url class |
163 | 163 | */ |
164 | - $URL =& class_loader('Url', 'classes'); |
|
164 | + $URL = & class_loader('Url', 'classes'); |
|
165 | 165 | |
166 | - if(get_config('cache_enable', false)){ |
|
166 | + if (get_config('cache_enable', false)) { |
|
167 | 167 | /** |
168 | 168 | * Load Cache interface file |
169 | 169 | */ |
170 | 170 | require_once CORE_CLASSES_CACHE_PATH . 'CacheInterface.php'; |
171 | 171 | $cacheHandler = get_config('cache_handler'); |
172 | - if(! $cacheHandler){ |
|
172 | + if (!$cacheHandler) { |
|
173 | 173 | show_error('The cache feature is enabled in the configuration but the cache handler class is not set.'); |
174 | 174 | } |
175 | 175 | $CACHE = null; |
176 | 176 | //first check if the cache handler is the system driver |
177 | - if(file_exists(CORE_CLASSES_CACHE_PATH . $cacheHandler . '.php')){ |
|
178 | - $CACHE =& class_loader($cacheHandler, 'classes/cache'); |
|
177 | + if (file_exists(CORE_CLASSES_CACHE_PATH . $cacheHandler . '.php')) { |
|
178 | + $CACHE = & class_loader($cacheHandler, 'classes/cache'); |
|
179 | 179 | } |
180 | - else{ |
|
180 | + else { |
|
181 | 181 | //it's not a system driver use user library |
182 | - $CACHE =& class_loader($cacheHandler); |
|
182 | + $CACHE = & class_loader($cacheHandler); |
|
183 | 183 | } |
184 | 184 | //check if the page already cached |
185 | - if(! empty($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'get'){ |
|
185 | + if (!empty($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'get') { |
|
186 | 186 | $RESPONSE = & class_loader('Response', 'classes'); |
187 | 187 | $RESPONSE->renderFinalPageFromCache($CACHE); |
188 | 188 | } |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | if (version_compare(phpversion(), TNH_REQUIRED_PHP_MIN_VERSION, '<')){ |
80 | 80 | show_error('Your PHP Version [' . phpversion() . '] is less than [' . TNH_REQUIRED_PHP_MIN_VERSION . '], please install a new version or update your PHP to the latest.', 'PHP Error environment'); |
81 | - } |
|
82 | - else if(version_compare(phpversion(), TNH_REQUIRED_PHP_MAX_VERSION, '>')){ |
|
81 | + } else if(version_compare(phpversion(), TNH_REQUIRED_PHP_MAX_VERSION, '>')){ |
|
83 | 82 | show_error('Your PHP Version [' . phpversion() . '] is greather than [' . TNH_REQUIRED_PHP_MAX_VERSION . '] please install a PHP version that is compatible.', 'PHP Error environment'); |
84 | 83 | } |
85 | 84 | $LOGGER->info('PHP version [' . phpversion() . '] is OK [REQUIRED MINIMUM: ' . TNH_REQUIRED_PHP_MIN_VERSION . ', REQUIRED MAXIMUM: ' . TNH_REQUIRED_PHP_MAX_VERSION . '], application can work without any issue'); |
@@ -104,8 +103,7 @@ discard block |
||
104 | 103 | if(file_exists(VENDOR_PATH . 'autoload.php')){ |
105 | 104 | $LOGGER->info('The composer autoload file exists include it'); |
106 | 105 | require_once VENDOR_PATH . 'autoload.php'; |
107 | - } |
|
108 | - else{ |
|
106 | + } else{ |
|
109 | 107 | $LOGGER->info('The composer autoload file does not exist skipping'); |
110 | 108 | } |
111 | 109 | |
@@ -176,8 +174,7 @@ discard block |
||
176 | 174 | //first check if the cache handler is the system driver |
177 | 175 | if(file_exists(CORE_CLASSES_CACHE_PATH . $cacheHandler . '.php')){ |
178 | 176 | $CACHE =& class_loader($cacheHandler, 'classes/cache'); |
179 | - } |
|
180 | - else{ |
|
177 | + } else{ |
|
181 | 178 | //it's not a system driver use user library |
182 | 179 | $CACHE =& class_loader($cacheHandler); |
183 | 180 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * You should have received a copy of the GNU General Public License |
23 | 23 | * along with this program; if not, write to the Free Software |
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | class Config{ |
28 | 28 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
25 | 25 | */ |
26 | 26 | |
27 | - class Config{ |
|
27 | + class Config { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * The list of loaded configuration |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * The signleton of the logger |
43 | 43 | * @return Object the Log instance |
44 | 44 | */ |
45 | - private static function getLogger(){ |
|
46 | - if(static::$logger == null){ |
|
47 | - static::$logger[0] =& class_loader('Log', 'classes'); |
|
45 | + private static function getLogger() { |
|
46 | + if (static::$logger == null) { |
|
47 | + static::$logger[0] = & class_loader('Log', 'classes'); |
|
48 | 48 | static::$logger[0]->setLogger('Library::Config'); |
49 | 49 | } |
50 | 50 | return static::$logger[0]; |
@@ -53,35 +53,35 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Initialize the configuration by loading all the configuration from config file |
55 | 55 | */ |
56 | - public static function init(){ |
|
56 | + public static function init() { |
|
57 | 57 | $logger = static::getLogger(); |
58 | 58 | $logger->debug('Initialization of the configuration'); |
59 | 59 | static::$config = & load_configurations(); |
60 | - if(! static::$config['base_url'] || ! is_url(static::$config['base_url'])){ |
|
61 | - if(ENVIRONMENT == 'production'){ |
|
60 | + if (!static::$config['base_url'] || !is_url(static::$config['base_url'])) { |
|
61 | + if (ENVIRONMENT == 'production') { |
|
62 | 62 | $logger->warning('Application base URL is not set or invalid, please set application base URL to increase the application loading time'); |
63 | 63 | } |
64 | 64 | $baseUrl = null; |
65 | - if (isset($_SERVER['SERVER_ADDR'])){ |
|
65 | + if (isset($_SERVER['SERVER_ADDR'])) { |
|
66 | 66 | //check if the server is running under IPv6 |
67 | - if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE){ |
|
68 | - $baseUrl = '['.$_SERVER['SERVER_ADDR'].']'; |
|
67 | + if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE) { |
|
68 | + $baseUrl = '[' . $_SERVER['SERVER_ADDR'] . ']'; |
|
69 | 69 | } |
70 | - else{ |
|
70 | + else { |
|
71 | 71 | $baseUrl = $_SERVER['SERVER_ADDR']; |
72 | 72 | } |
73 | - $port = ((isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] != '80' && ! is_https() || $_SERVER['SERVER_PORT'] != '443' && is_https()) ) ? ':' . $_SERVER['SERVER_PORT'] : ''); |
|
74 | - $baseUrl = (is_https() ? 'https' : 'http').'://' . $baseUrl . $port |
|
73 | + $port = ((isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] != '80' && !is_https() || $_SERVER['SERVER_PORT'] != '443' && is_https())) ? ':' . $_SERVER['SERVER_PORT'] : ''); |
|
74 | + $baseUrl = (is_https() ? 'https' : 'http') . '://' . $baseUrl . $port |
|
75 | 75 | . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME']))); |
76 | 76 | } |
77 | - else{ |
|
77 | + else { |
|
78 | 78 | $logger->warning('Can not determine the application base URL automatically, use http://localhost as default'); |
79 | 79 | $baseUrl = 'http://localhost/'; |
80 | 80 | } |
81 | 81 | self::set('base_url', $baseUrl); |
82 | 82 | } |
83 | - static::$config['base_url'] = rtrim(static::$config['base_url'], '/') .'/'; |
|
84 | - if(ENVIRONMENT == 'production' && in_array(strtolower(static::$config['log_level']), array('debug', 'info','all'))){ |
|
83 | + static::$config['base_url'] = rtrim(static::$config['base_url'], '/') . '/'; |
|
84 | + if (ENVIRONMENT == 'production' && in_array(strtolower(static::$config['log_level']), array('debug', 'info', 'all'))) { |
|
85 | 85 | $logger->warning('You are in production environment, please set log level to WARNING, ERROR, FATAL to increase the application performance'); |
86 | 86 | } |
87 | 87 | $logger->info('Configuration initialized successfully'); |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | * @param mixed $default the default value to use if can not find the config item in the list |
95 | 95 | * @return mixed the config value if exist or the default value |
96 | 96 | */ |
97 | - public static function get($item, $default = null){ |
|
97 | + public static function get($item, $default = null) { |
|
98 | 98 | $logger = static::getLogger(); |
99 | - if(array_key_exists($item, static::$config)){ |
|
99 | + if (array_key_exists($item, static::$config)) { |
|
100 | 100 | return static::$config[$item]; |
101 | 101 | } |
102 | - $logger->warning('Cannot find config item ['.$item.'] using the default value ['.$default.']'); |
|
102 | + $logger->warning('Cannot find config item [' . $item . '] using the default value [' . $default . ']'); |
|
103 | 103 | return $default; |
104 | 104 | } |
105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param string $item the config item name to set |
109 | 109 | * @param mixed $value the config item value |
110 | 110 | */ |
111 | - public static function set($item, $value){ |
|
111 | + public static function set($item, $value) { |
|
112 | 112 | static::$config[$item] = $value; |
113 | 113 | } |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * Get all the configuration values |
117 | 117 | * @return array the config values |
118 | 118 | */ |
119 | - public static function getAll(){ |
|
119 | + public static function getAll() { |
|
120 | 120 | return static::$config; |
121 | 121 | } |
122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * Set the configuration values bu merged with the existing configuration |
125 | 125 | * @param array $config the config values to add in the configuration list |
126 | 126 | */ |
127 | - public static function setAll(array $config = array()){ |
|
127 | + public static function setAll(array $config = array()) { |
|
128 | 128 | static::$config = array_merge(static::$config, $config); |
129 | 129 | } |
130 | 130 | |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | * @param string $item the config item name to be deleted |
134 | 134 | * @return boolean true if the item exists and is deleted successfully otherwise will return false. |
135 | 135 | */ |
136 | - public static function delete($item){ |
|
136 | + public static function delete($item) { |
|
137 | 137 | $logger = static::getLogger(); |
138 | - if(array_key_exists($item, static::$config)){ |
|
139 | - $logger->info('Delete config item ['.$item.']'); |
|
138 | + if (array_key_exists($item, static::$config)) { |
|
139 | + $logger->info('Delete config item [' . $item . ']'); |
|
140 | 140 | unset(static::$config[$item]); |
141 | 141 | return true; |
142 | 142 | } |
143 | - else{ |
|
144 | - $logger->warning('Config item ['.$item.'] to be deleted does not exists'); |
|
143 | + else { |
|
144 | + $logger->warning('Config item [' . $item . '] to be deleted does not exists'); |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * Load the configuration file. This an alias with the Loader::config() |
151 | 151 | * @param string $config the config name to be loaded |
152 | 152 | */ |
153 | - public static function load($config){ |
|
153 | + public static function load($config) { |
|
154 | 154 | Loader::config($config); |
155 | 155 | } |
156 | 156 | } |
@@ -66,15 +66,13 @@ discard block |
||
66 | 66 | //check if the server is running under IPv6 |
67 | 67 | if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE){ |
68 | 68 | $baseUrl = '['.$_SERVER['SERVER_ADDR'].']'; |
69 | - } |
|
70 | - else{ |
|
69 | + } else{ |
|
71 | 70 | $baseUrl = $_SERVER['SERVER_ADDR']; |
72 | 71 | } |
73 | 72 | $port = ((isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] != '80' && ! is_https() || $_SERVER['SERVER_PORT'] != '443' && is_https()) ) ? ':' . $_SERVER['SERVER_PORT'] : ''); |
74 | 73 | $baseUrl = (is_https() ? 'https' : 'http').'://' . $baseUrl . $port |
75 | 74 | . substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME']))); |
76 | - } |
|
77 | - else{ |
|
75 | + } else{ |
|
78 | 76 | $logger->warning('Can not determine the application base URL automatically, use http://localhost as default'); |
79 | 77 | $baseUrl = 'http://localhost/'; |
80 | 78 | } |
@@ -139,8 +137,7 @@ discard block |
||
139 | 137 | $logger->info('Delete config item ['.$item.']'); |
140 | 138 | unset(static::$config[$item]); |
141 | 139 | return true; |
142 | - } |
|
143 | - else{ |
|
140 | + } else{ |
|
144 | 141 | $logger->warning('Config item ['.$item.'] to be deleted does not exists'); |
145 | 142 | return false; |
146 | 143 | } |