Commit 1d751b04 authored by pedro_morgan's avatar pedro_morgan
Browse files

* Got rid of $conf['cachedir']

* tidy tpl.php , removed $conf global 
parent 6fa4b7b8
......@@ -157,7 +157,9 @@ if (!defined('vlibTemplateClassLoaded')) {
*/
public function newTemplate($tmplfile)
{
if (!$tfile = $this->_fileSearch($tmplfile)) vlibTemplateError::raiseError('VT_ERROR_NOFILE',KILL,$tmplfile);
if (!$tfile = $this->_fileSearch($tmplfile)){
vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
}
//* make sure that any parsing vars are cleared for the new template
$this->_tmplfile = null;
......@@ -169,8 +171,9 @@ if (!defined('vlibTemplateClassLoaded')) {
$this->_totalparsetime = null;
//* reset debug module
if ($this->_debug) $this->_debugReset();
if ($this->_debug){
$this->_debugReset();
}
$this->_tmplfilename = $tfile;
return true;
}
......@@ -253,8 +256,7 @@ if (!defined('vlibTemplateClassLoaded')) {
*/
public function getVars()
{
if (empty($this->_vars)) return false;
return $this->_vars;
return empty($this->_vars) ? false : $this->_vars;
}
/**
......@@ -265,8 +267,7 @@ if (!defined('vlibTemplateClassLoaded')) {
public function getVar($var)
{
if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
if (empty($var) || !isset($this->_vars[$var])) return false;
return $this->_vars[$var];
return (empty($var) || !isset($this->_vars[$var])) ? false : $this->_vars[$var];
}
/**
......@@ -304,7 +305,7 @@ if (!defined('vlibTemplateClassLoaded')) {
$this->_arrvars[$k] = array();
if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR',WARNING,$k);
vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR', WARNING, $k);
}
}
return true;
......@@ -323,16 +324,17 @@ if (!defined('vlibTemplateClassLoaded')) {
{
$db_type = strtoupper($db_type);
if (!in_array($db_type, $this->allowed_loop_dbs)) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type);
return false;
}
$loop_arr = array();
// TODO: Are all these necessary as were onyl using mysql and possible postgres ? - pedro
switch ($db_type) {
case 'MYSQL':
if (get_resource_type($result) != 'mysql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while($r = mysql_fetch_assoc($result)) {
......@@ -342,7 +344,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'POSTGRESQL':
if (get_resource_type($result) != 'pgsql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
......@@ -355,7 +357,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'INFORMIX':
if (!$result) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while($r = ifx_fetch_row($result, 'NEXT')) {
......@@ -365,7 +367,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'INTERBASE':
if (get_resource_type($result) != 'interbase result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while($r = ibase_fetch_row($result)) {
......@@ -375,7 +377,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'INGRES':
if (!$result) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while($r = ingres_fetch_array(INGRES_ASSOC, $result)) {
......@@ -385,7 +387,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'MSSQL':
if (get_resource_type($result) != 'mssql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while($r = mssql_fetch_array($result)) {
......@@ -395,7 +397,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'MSQL':
if (get_resource_type($result) != 'msql result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while($r = msql_fetch_array($result, MSQL_ASSOC)) {
......@@ -405,7 +407,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'OCI8':
if (get_resource_type($result) != 'oci8 statement') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while(OCIFetchInto($result, &$r, OCI_ASSOC+OCI_RETURN_LOBS)) {
......@@ -415,7 +417,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'ORACLE':
if (get_resource_type($result) != 'oracle Cursor') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while(ora_fetch_into($result, &$r, ORA_FETCHINTO_ASSOC)) {
......@@ -425,7 +427,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'OVRIMOS':
if (!$result) {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
while(ovrimos_fetch_into($result, &$r, 'NEXT')) {
......@@ -435,7 +437,7 @@ if (!defined('vlibTemplateClassLoaded')) {
case 'SYBASE':
if (get_resource_type($result) != 'sybase-db result') {
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);
vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type);
return false;
}
......@@ -477,7 +479,7 @@ if (!defined('vlibTemplateClassLoaded')) {
if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);
vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
return false;
}
if (is_array($row)) {
......@@ -795,7 +797,9 @@ if (!defined('vlibTemplateClassLoaded')) {
if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
return;
} else {
if ($this->_debug) array_push ($this->_debugIncludedfiles, $tmplfile);
if ($this->_debug){
array_push ($this->_debugIncludedfiles, $tmplfile);
}
if ($do_eval) {
array_push($this->_currentincludedir, dirname($tmplfile));
$this->_includedepth++;
......
......@@ -48,8 +48,6 @@ if (!defined('vlibIniClassLoaded')) {
/** Returns $array of config vars for vlibTemplate */
public static function vlibTemplate()
{
global $conf;
$tpl_dir = ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates';
return array(
......@@ -89,7 +87,7 @@ if (!defined('vlibIniClassLoaded')) {
/* the following are only used by the vlibTemplateCache class. */
// pedro notes:: triggers a notice as its not set - was $conf['template']['cache_dir'],
'CACHE_DIRECTORY' => $conf['cache_dir'],
'CACHE_DIRECTORY' => ISPC_CACHE_PATH,
// Directory where the cached filesystem
// will be set up (full path, and must be writable)
// '/' or '\' off the end of the directory.
......
......@@ -41,6 +41,16 @@ define('ISPC_APP_VERSION', '3.0.0');
$conf['app_version'] = '3.0.0';
$conf['modules_available'] = 'admin,mail,sites,monitor,client,dns';
//** 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_WEB_PATH', ISPC_ROOT_PATH.'/web');
define('ISPC_THEMES_PATH', ISPC_ROOT_PATH.'/web/themes');
define('ISPC_TEMP_PATH', ISPC_ROOT_PATH.'/temp');
define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
//********************************************************************************
//** Future Code idea - pedro - rfc
......@@ -86,18 +96,6 @@ if(file_exists(dirname(__FILE__).'/db_local.php')){
$conf['db_database'] = 'ispconfig3';
}
//** 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_WEB_PATH', ISPC_ROOT_PATH.'/web');
define('ISPC_THEMES_PATH', ISPC_ROOT_PATH.'/web/themes');
define('ISPC_TEMP_PATH', ISPC_ROOT_PATH.'/temp');
define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
//** Database Settings
/* See above
$conf['db_type'] = 'mysql';
......@@ -108,18 +106,6 @@ $conf['db_database'] = 'ispconfig3';
*/
$conf['cache_dir'] = ISPC_ROOT_PATH.'/cache';
/* 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";
$conf['programs']['wput'] = ISPC_ROOT_PATH."\\tools\\wput\\wput.exe";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment