|
Revision 1735, 1.4 kB
(checked in by kop-labs, 6 years ago)
|
|
Changes directory structure
|
| Line | |
|---|
| 1 | <? |
|---|
| 2 | class ConfigUtil{ |
|---|
| 3 | function ConfigUtil(){ |
|---|
| 4 | global $conf; |
|---|
| 5 | include("lib/config.php"); |
|---|
| 6 | $this->app = $conf['dirs']['app']; |
|---|
| 7 | $this->tpl = $conf['dirs']['tpl']; |
|---|
| 8 | $this->img = $conf['dirs']['img']; |
|---|
| 9 | $this->pic = $conf['dirs']['pic']; |
|---|
| 10 | $this->thumb = $conf['dirs']['thumb']; |
|---|
| 11 | $this->lib = $conf['dirs']['lib']; |
|---|
| 12 | $this->tmp = $conf['dirs']['tmp']; |
|---|
| 13 | $this->dbType = $conf['db']['type']; |
|---|
| 14 | $this->dbUser = $conf['db']['user']; |
|---|
| 15 | $this->dbPassword = $conf['db']['password']; |
|---|
| 16 | $this->dbName = $conf['db']['name']; |
|---|
| 17 | $this->dbHost = $conf['db']['host']; |
|---|
| 18 | $this->logo = $conf['misc']['logo']; |
|---|
| 19 | unset($conf); |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | function load($lib){ |
|---|
| 23 | $r = true; |
|---|
| 24 | $libs = explode(",", $lib); |
|---|
| 25 | $i = 0; |
|---|
| 26 | |
|---|
| 27 | foreach($libs as $value){ |
|---|
| 28 | $value = trim($value); |
|---|
| 29 | $class = split(".", $value); |
|---|
| 30 | $class = $class[count($class)-1]; |
|---|
| 31 | if(!class_exists($class)){ |
|---|
| 32 | $value = trim(str_replace(".", "/", $value)); |
|---|
| 33 | $filename = sprintf("%s/%s.class.php", $this->lib, $value); |
|---|
| 34 | if(is_file($filename)){ |
|---|
| 35 | require_once($filename); |
|---|
| 36 | }else{ |
|---|
| 37 | printf("<p><b>[ImportError]:</b> %s: no such file or directory.</p>", $filename); |
|---|
| 38 | $r = false; |
|---|
| 39 | } |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | return $r; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | function dump($object){ |
|---|
| 46 | echo "<pre>"; |
|---|
| 47 | var_dump($object); |
|---|
| 48 | echo "</pre"; |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | ?> |
|---|