From dcff5718f345f55f7ea81f18d1f086facde4eacf Mon Sep 17 00:00:00 2001 From: pedro_morgan <pedro_morgan@ispconfig3> Date: Tue, 21 Aug 2007 03:14:51 +0000 Subject: [PATCH] * Using new ISPC_*_PATH constants * Adding new data schema (to be moved shortly * no more $conf['classpath'] --- interface/lib/app.inc.php | 11 +- interface/lib/classes/tpl.inc.php | 12 +- interface/lib/classes/tpl_error.inc.php | 6 +- interface/lib/config.inc.php | 34 ++--- .../defs.ftp_servers_sites_domains.php | 125 ++++++++++++++---- 5 files changed, 127 insertions(+), 61 deletions(-) diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index 25409980b2..fc63f02498 100644 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -67,13 +67,13 @@ class app { public function uses($classes) { - $cl = explode(',',$classes); + $cl = explode(',', $classes); if(is_array($cl)) { foreach($cl as $classname){ $classname = trim($classname); //* Class is not loaded so load it if(!array_key_exists($classname, $this->_loaded_classes)){ - require_once($this->_conf['classpath'] . '/'.$classname.'.inc.php'); + include_once(ISPC_CLASS_PATH."/$classname.inc.php"); $this->$classname = new $classname(); $this->_loaded_classes[$classname] = true; } @@ -87,7 +87,7 @@ class app { if(is_array($fl)) { foreach($fl as $file){ $file = trim($file); - include_once($this->_conf['classpath'] . '/'.$file.'.inc.php'); + include_once(ISPC_CLASS_PATH."/$file.inc.php"); } } } @@ -145,8 +145,9 @@ class app { { if($this->_language_inc != 1) { //* loading global and module Wordbook - @include_once($this->_conf['rootpath'].'/lib/lang/'.$_SESSION['s']['language'].'.lng'); - @include_once($this->_conf['rootpath'].'/web/'.$_SESSION['s']['module']['name'].'/lib/lang/'.$_SESSION['s']['language'].'.lng'); + // TODO: this need to be made clearer somehow - pedro + @include_once(ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng'); + @include_once(ISPC_ROOT_PATH.'/web/'.$_SESSION['s']['module']['name'].'/lib/lang/'.$_SESSION['s']['language'].'.lng'); $this->_wb = $wb; $this->_language_inc = 1; } diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php index 2343747723..fe254b1fb5 100644 --- a/interface/lib/classes/tpl.inc.php +++ b/interface/lib/classes/tpl.inc.php @@ -22,12 +22,12 @@ // // $Id: class.tpl.inc.php,v 1.1 2003/07/08 12:31:10 platinum Exp $ -//** check to avoid multiple including of class +//** check and avoid multiple loading of class if (!defined('vlibTemplateClassLoaded')) { + define('vlibTemplateClassLoaded', 1); - global $conf; - include_once ($conf['classpath'].'/tpl_error.inc.php'); - include_once ($conf['classpath'].'/tpl_ini.inc.php'); + include_once (ISPC_CLASS_PATH.'/tpl_error.inc.php'); + include_once (ISPC_CLASS_PATH.'/tpl_ini.inc.php'); class tpl{ @@ -1361,8 +1361,8 @@ if (!defined('vlibTemplateClassLoaded')) { function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');} } // << end class Def - //include_once ($conf['classpath'].'/vlibTemplate/debug.php'); - include_once ($conf['classpath'].'/tpl_cache.inc.php'); + //include_once (ISPC_CLASS_PATH.'/vlibTemplate/debug.php'); + include_once (ISPC_CLASS_PATH.'/tpl_cache.inc.php'); } // << end if(!defined()).. ?> \ No newline at end of file diff --git a/interface/lib/classes/tpl_error.inc.php b/interface/lib/classes/tpl_error.inc.php index 2f139882b9..25ea71e176 100644 --- a/interface/lib/classes/tpl_error.inc.php +++ b/interface/lib/classes/tpl_error.inc.php @@ -10,10 +10,10 @@ // // $Id: error.php,v 1.1 2003/07/08 12:32:06 platinum Exp $ -define('FATAL', E_USER_ERROR); +define('FATAL', E_USER_ERROR); define('WARNING', E_USER_WARNING); -define('NOTICE', E_USER_NOTICE); -define('KILL', -1); // used for killing inside parsing. +define('NOTICE', E_USER_NOTICE); +define('KILL', -1); // used for killing inside parsing. /** * Class is used by vlibTemplate. diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php index efe42f9c35..e5d155af14 100644 --- a/interface/lib/config.inc.php +++ b/interface/lib/config.inc.php @@ -35,7 +35,9 @@ header('Content-Type: text/html'); //* TODO: Js caching - pedro //** Key paramaters +define('ISPC_APP_TITLE', 'ISPConfig'); $conf['app_title'] = 'ISPConfig'; +define('ISPC_APP_VERSION', '3.0.0'); $conf['app_version'] = '3.0.0'; $conf['modules_available'] = 'admin,mail,sites,monitor,client,dns'; @@ -84,20 +86,14 @@ if(file_exists(dirname(__FILE__).'/db_local.php')){ $conf['db_database'] = 'ispconfig3'; } -/* Dynamic constants are another technique as well as key files as constants. - The base root directory is the interface/ directory which is the top level for php - From this eveything else is be defined underneath as constants - The constants are directory paths with no trailing / - This should do away with the $conf['rootpath'] etc - The $conf['fs_div'] is unnecessary if only / is used, will work on windoze also - -*/ -//** The main ROOT is the parent directory to this file, ie interface -define('ISPC_ROOT', realpath('../')); -define('ISPC_CLASS_PATH', ISPC_ROOT.'/lib/classes'); -define('ISPC_TEMP_PATH', ISPC_ROOT.'/temp'); -define('ISPC_CACHE_PATH', ISPC_ROOT.'/cache'); -//<< End pedro rfc block + +//** The main ROOT is the parent directory to this file, ie Interface/. NO trailing slashes. +define('ISPC_ROOT_PATH', realpath(dirname(__FILE__).'/../')); +define('ISPC_LIB_PATH', ISPC_ROOT_PATH.'/lib'); +define('ISPC_CLASS_PATH', ISPC_ROOT_PATH.'/lib/classes'); +define('ISPC_TEMP_PATH', ISPC_ROOT_PATH.'/temp'); +define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache'); + //** Database Settings /* See above @@ -110,23 +106,19 @@ $conf['db_database'] = 'ispconfig3'; $conf['rootpath'] = substr(dirname(__FILE__),0,-4); $conf['fs_div'] = '/'; // File system divider, \\ on windows and / on linux and unix -$conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes'; $conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp'; // predro notes: not sure this is the right thing ? $conf['cache_dir'] = $conf['rootpath'].$conf['fs_div'].'/cache'; -define('DIR_TRENNER', $conf['fs_div']); -define('SERVER_ROOT', $conf['rootpath']); -define('INCLUDE_ROOT', SERVER_ROOT.DIR_TRENNER.'lib'); -define('CLASSES_ROOT', INCLUDE_ROOT.DIR_TRENNER.'classes'); -/* pedro notes ? this stuff is REALLY not necessay, can leak everywhere */ +/* pedro notes ? this stuff is REALLY not necessay, can leak everywhere + Don think this lot is being used so commented out define('DB_TYPE', $conf['db_type']); define('DB_HOST', $conf['db_host']); define('DB_DATABASE',$conf['db_database']); define('DB_USER', $conf['db_user']); define('DB_PASSWORD', $conf['db_password']); - +*/ //** External programs //$conf["programs"]["convert"] = "/usr/bin/convert"; diff --git a/interface/sql/db_installer_sandbox/defs.ftp_servers_sites_domains.php b/interface/sql/db_installer_sandbox/defs.ftp_servers_sites_domains.php index f84b3f16ab..4ee59131df 100644 --- a/interface/sql/db_installer_sandbox/defs.ftp_servers_sites_domains.php +++ b/interface/sql/db_installer_sandbox/defs.ftp_servers_sites_domains.php @@ -1,32 +1,105 @@ <?php +//************************************************************************************* +// DNS +//************************************************************************************* +//TODO - Enum +$tables['dns_rr'] = " +`id` I unsigned NOTNULL AUTO PRIMARY, +`sys_userid` I NOTNULL, +`sys_groupid` I NOTNULL, +`sys_perm_user` C(5) NOTNULL, +`sys_perm_group` C(5) NOTNULL, +`sys_perm_other` C(5) NOTNULL, +`server_id` I NOTNULL DEFAULT '1', +`zone` I unsigned NOTNULL, +`name` C(64) NOTNULL, +`type` enum('A','AAAA','ALIAS','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') , +`data` char(128) NOTNULL, +`aux` I unsigned NOTNULL DEFAULT '0', +`ttl` I unsigned NOTNULL DEFAULT '86400', +`active` enum('N','Y') NOTNULL DEFAULT 'Y' +"; + +//TODO char(255) +$tables['dns_soa'] = " +`id` I unsigned NOTNULL AUTO PRIMARY, +`sys_userid` I NOTNULL, +`sys_groupid` I NOTNULL, +`sys_perm_user` C(5) NOTNULL, +`sys_perm_group` C(5) NOTNULL, +`sys_perm_other` C(5) NOTNULL, +`server_id` I NOTNULL DEFAULT '1', +`origin` char(255) NOTNULL, +`ns` char(255) NOTNULL, +`mbox` char(255) NOTNULL, +`serial` I NOTNULL DEFAULT '1', +`refresh` I NOTNULL DEFAULT '28800', +`retry` I NOTNULL DEFAULT '7200', +`expire` I NOTNULL DEFAULT '604800', +`minimum` I NOTNULL DEFAULT '86400', +`ttl` I unsigned NOTNULL DEFAULT '86400', +`active` enum('Y','N') NOTNULL, +`xfer` char(255) NOTNULL +"; + + +//************************************************************************************* +// Ftp Related +//************************************************************************************* + +$tables['ftp_user'] = " +`ftp_user_id` I8 NOTNULL AUTO PRIMARY, +`sys_userid` I NOTNULL DEFAULT '0', +`sys_groupid` I NOTNULL DEFAULT '0', +`sys_perm_user` C(5), +`sys_perm_group` C(5), +`sys_perm_other` C(5), +`server_id` I NOTNULL DEFAULT '0', +`parent_domain_id` I NOTNULL DEFAULT '0', +`username` C(255), +`password` C(255), +`quota_size` I NOTNULL DEFAULT '-1', +`active` C(255) NOTNULL DEFAULT 'y', +`uid` C(255), +`gid` C(255), +`dir` C(255), +`quota_files` I NOTNULL DEFAULT '-1', +`ul_ratio` I NOTNULL DEFAULT '-1', +`dl_ratio` I NOTNULL DEFAULT '-1', +`ul_bandwidth` I NOTNULL DEFAULT '-1', +`dl_bandwidth` I NOTNULL DEFAULT '-1' +"; + +//************************************************************************************* +// Web Domain +//************************************************************************************* $tables['web_domain'] = " - `domain_id` bigint(20) NOTNULL AUTO PRIMARY, - `sys_userid` I NOTNULL DEFAULT '0', - `sys_groupid` I NOTNULL DEFAULT '0', - `sys_perm_user` C(5) , - `sys_perm_group` C(5) , - `sys_perm_other` C(5) , - `server_id` I NOTNULL DEFAULT '0', - `ip_address` C(15) , - `domain` C(255) , - `type` C(255) NOTNULL DEFAULT 'y', - `parent_domain_id` I NOTNULL DEFAULT '0', - `vhost_type` C(255) , - `document_root` C(255) , - `system_user` C(255) , - `system_group` C(255) , - `hd_quota` I NOTNULL DEFAULT '0', - `traffic_quota` I NOTNULL DEFAULT '0', - `cgi` C(255) NOTNULL DEFAULT 'y', - `ssi` C(255) NOTNULL DEFAULT 'y', - `suexec` C(255) NOTNULL DEFAULT 'y', - `php` C(255) NOTNULL DEFAULT 'y', - `redirect_type` C(255) , - `redirect_path` C(255) , - `active` C(255) NOTNULL DEFAULT 'y', - PRIMARY KEY (`domain_id`) -) ; +`domain_id` I8 NOTNULL AUTO PRIMARY, +`sys_userid` I NOTNULL DEFAULT '0', +`sys_groupid` I NOTNULL DEFAULT '0', +`sys_perm_user` C(5), +`sys_perm_group` C(5), +`sys_perm_other` C(5), +`server_id` I NOTNULL DEFAULT '0', +`ip_address` C(15) , +`domain` C(255) , +`type` C(255) NOTNULL DEFAULT 'y', +`parent_domain_id` I NOTNULL DEFAULT '0', +`vhost_type` C(255), +`document_root` C(255), +`system_user` C(255), +`system_group` C(255), +`hd_quota` I NOTNULL DEFAULT '0', +`traffic_quota` I NOTNULL DEFAULT '0', +`cgi` C(255) NOTNULL DEFAULT 'y', +`ssi` C(255) NOTNULL DEFAULT 'y', +`suexec` C(255) NOTNULL DEFAULT 'y', +`php` C(255) NOTNULL DEFAULT 'y', +`redirect_type` C(255), +`redirect_path` C(255), +`active` C(255) NOTNULL DEFAULT 'y' +"; ?> \ No newline at end of file -- GitLab