Skip to content

Commit 9026a45

Browse files
author
pedro_morgan
committed
* Ammended config in with $DB connection idea
* Minor tweaks to app * Made $conf global in teh tempalte class (its not global in the loader function either)
1 parent 0d5152c commit 9026a45

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

interface/lib/app.inc.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ public function __construct()
6767

6868
public function uses($classes)
6969
{
70-
$cl = explode(',',$classes);
70+
$cl = explode(', ',$classes);
7171
if(is_array($cl)) {
7272
foreach($cl as $classname){
7373
if(!array_key_exists($classname, $this->_loaded_classes)){
74-
include_once($this->_conf['classpath'] . '/'.$classname.'.inc.php');
75-
$this->$classname = new $classname;
74+
require_once($this->_conf['classpath'] . '/'.$classname.'.inc.php');
75+
$this->$classname = new $classname();
7676
$this->_loaded_classes[$classname] = true;
7777
}
7878
}
@@ -81,9 +81,9 @@ public function uses($classes)
8181

8282
public function load($files)
8383
{
84-
$fl = explode(',',$files);
84+
$fl = explode(',', $files);
8585
if(is_array($fl)) {
86-
foreach($fl as $file) {
86+
foreach($fl as $file){
8787
include_once($this->_conf['classpath'] . '/'.$file.'.inc.php');
8888
}
8989
}

interface/lib/classes/tpl.inc.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<?php
2+
/**
3+
* Template Class
4+
*
5+
* @author Kelvin Jones <kelvin@kelvinjones.co.uk>
6+
* @copyright 2002 Active Fish Group
7+
* @version 1.1
8+
* @package ISPConfig
9+
*/
210

311
/* vim: set expandtab tabstop=4 shiftwidth=4: */
412
// +----------------------------------------------------------------------+
@@ -14,7 +22,7 @@
1422
// check to avoid multiple including of class
1523
if (!defined('vlibTemplateClassLoaded')) {
1624
define('vlibTemplateClassLoaded', 1);
17-
25+
global $conf;
1826
include_once ($conf['classpath'].'/tpl_error.inc.php');
1927
include_once ($conf['classpath'].'/tpl_ini.inc.php');
2028

interface/lib/config.inc.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,35 +38,34 @@
3838
$conf['modules_available'] = 'admin,mail,sites,monitor,client,dns';
3939

4040

41-
//** Future Code - pedro comments
41+
//** Future Code - pedro - rfc
4242
/* Database connection
43-
The only time its needed is to connectm otherwise it not needed as
44-
variables aronf the application. Connected and done.
43+
The only time paramaters are needed is to connect, otherwise its not needed
44+
variables "around" the application. ie Connected and done.
4545
Prefered is an array as $DB in capitals, ie
4646
$DB['host'] = 'type';
4747
$DB['host'] = 'ip';
4848
$DB['user'] = 'me';
4949
$DB['password'] = 'secret';
50-
$DB['database'] = 'persistent_data_stash';
50+
$DB['database'] = 'db_name';
5151
5252
The connection paramaters are all contained within one array structure
5353
With this array structure the connection can be passed around, to functions
54-
However it can also leak. and be destroyed eg
55-
$db->connect($DB);
54+
However it can also leak so it can be destroyed eg
55+
$dbClass->connect($DB);
5656
unset($DB); // only the paranoid survive
5757
5858
Also there is a scenario where we are devloping and using this file
59-
and the database paramaters might leak.
59+
and the database paramaters might leak into svn etc.
60+
(This idea is borrowed from the tikiwiki.org project)
6061
To resolve this there is a file called db_local.php.skel which is not detected
61-
rename this to db_local.php and edit the paramaters
62+
rename this to db_local.php and edit the paramaters.
6263
6364
$DB['type'] = 'mysql';
6465
$DB['host'] = 'localhost';
6566
$DB['database'] = 'ispconfig3';
6667
$DB['user'] = 'root';
6768
$DB['password'] = '';
68-
69-
7069
*/
7170

7271
//** Detect for local database setting or set and load default params
@@ -92,25 +91,23 @@
9291
$conf['fs_div'] = '/'; // File system divider, \\ on windows and / on linux and unix
9392
$conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
9493
$conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
95-
94+
//$conf['cache_dir'] = $conf['rootpath'].$conf['fs_div'].'FOOtemp';
9695

9796
define('DIR_TRENNER', $conf['fs_div']);
9897
define('SERVER_ROOT', $conf['rootpath']);
9998
define('INCLUDE_ROOT', SERVER_ROOT.DIR_TRENNER.'lib');
10099
define('CLASSES_ROOT', INCLUDE_ROOT.DIR_TRENNER.'classes');
101100

102101
/* pedro notes ? this stuff is REALLY not necessay */
103-
/*
104102
define('DB_TYPE', $conf['db_type']);
105103
define('DB_HOST', $conf['db_host']);
106104
define('DB_DATABASE',$conf['db_database']);
107105
define('DB_USER', $conf['db_user']);
108106
define('DB_PASSWORD', $conf['db_password']);
109-
*/
107+
110108

111109
//** External programs
112110
//$conf["programs"]["convert"] = "/usr/bin/convert";
113-
// ?? WTF ?? pedro
114111
$conf['programs']['wput'] = $conf['rootpath']."\\tools\\wput\\wput.exe";
115112

116113

@@ -120,7 +117,7 @@
120117
$conf['logo'] = 'themes/default/images/mydnsconfig_logo.gif';
121118

122119
//** Default Language
123-
$conf["language"] = 'en';
120+
$conf['language'] = 'en';
124121

125122
//** Auto Load Modules
126123
$conf['start_db'] = true;

0 commit comments

Comments
 (0)