mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-02 11:29:58 +01:00
register_globals and formatting changes
This commit is contained in:
parent
4805243c8c
commit
173d81ab87
@ -527,12 +527,17 @@
|
||||
*/
|
||||
function execute_script($script, $order = '')
|
||||
{
|
||||
global $phpgw_info, $phpgw_domain, $current_config, $newsetting, $phpgw_setup, $SERVER_NAME;
|
||||
if ($order != '' && gettype($order) != 'array'){ $order = array($order); }
|
||||
if ($order == '') { $order = array(); }
|
||||
if ($order != '' && gettype($order) != 'array')
|
||||
{
|
||||
$order = array($order);
|
||||
}
|
||||
if ($order == '')
|
||||
{
|
||||
$order = array();
|
||||
}
|
||||
/* First include the ordered setup script file */
|
||||
reset ($order);
|
||||
while (list (, $appname) = each ($order))
|
||||
@reset ($order);
|
||||
while (list (,$appname) = @each($order))
|
||||
{
|
||||
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/setup/' . $script . '.inc.php';
|
||||
if (file_exists($f)) { include($f); }
|
||||
|
@ -23,7 +23,7 @@
|
||||
$d = dir(PHPGW_SERVER_ROOT);
|
||||
while($entry=$d->read())
|
||||
{
|
||||
if (!ereg("setup",$entry))
|
||||
if (!ereg('setup',$entry))
|
||||
{
|
||||
$f = PHPGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php';
|
||||
if (file_exists ($f))
|
||||
@ -35,15 +35,15 @@
|
||||
}
|
||||
$d->close();
|
||||
|
||||
// echo "<pre>"; echo var_dump($setup_info); echo "</pre>"; exit;
|
||||
// echo '<pre>'; echo var_dump($setup_info); echo '</pre>'; exit;
|
||||
return $setup_info;
|
||||
}
|
||||
|
||||
function get_db_versions($setup_info = "")
|
||||
function get_db_versions($setup_info='')
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
$this->db->Halt_On_Error = "no";
|
||||
$this->db->Halt_On_Error = 'no';
|
||||
$tables = $this->db->table_names();
|
||||
while(list($key,$val) = @each($tables))
|
||||
{
|
||||
@ -57,7 +57,7 @@
|
||||
/* one of these tables exists. checking for post/pre beta version */
|
||||
if ($newapps)
|
||||
{
|
||||
$this->db->query("select * from phpgw_applications");
|
||||
$this->db->query('select * from phpgw_applications');
|
||||
while (@$this->db->next_record())
|
||||
{
|
||||
$setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version');
|
||||
@ -128,7 +128,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo "<pre>"; echo var_dump($setup_info); echo "</pre>";
|
||||
//echo '<pre>'; echo var_dump($setup_info); echo '</pre>';
|
||||
return $setup_info;
|
||||
}
|
||||
|
||||
@ -184,39 +184,39 @@
|
||||
function check_header()
|
||||
{
|
||||
global $phpgw_domain, $phpgw_info;
|
||||
if(!file_exists("../header.inc.php"))
|
||||
if(!file_exists('../header.inc.php'))
|
||||
{
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage One";
|
||||
return "1";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage One';
|
||||
return '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($phpgw_info["server"]["header_admin_password"]))
|
||||
if (!isset($phpgw_info['server']['header_admin_password']))
|
||||
{
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage One (No header admin password set)";
|
||||
return "2";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage One (No header admin password set)';
|
||||
return '2';
|
||||
}
|
||||
elseif (!isset($phpgw_domain))
|
||||
{
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage One (Upgrade your header.inc.php)";
|
||||
return "3";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage One (Upgrade your header.inc.php)';
|
||||
return '3';
|
||||
}
|
||||
elseif ($phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"])
|
||||
elseif ($phpgw_info['server']['versions']['header'] != $phpgw_info['server']['versions']['current_header'])
|
||||
{
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage One (Upgrade your header.inc.php)";
|
||||
return "3";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage One (Upgrade your header.inc.php)';
|
||||
return '3';
|
||||
}
|
||||
}
|
||||
/* header.inc.php part settled. Moving to authentication */
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage One (Completed)";
|
||||
return "10";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage One (Completed)';
|
||||
return '10';
|
||||
}
|
||||
|
||||
function check_db()
|
||||
{
|
||||
global $phpgw_info,$setup_info;
|
||||
|
||||
$this->db->Halt_On_Error = "no";
|
||||
$this->db->Halt_On_Error = 'no';
|
||||
//echo '<pre>'.var_dump($setup_info).'</pre>';exit;
|
||||
|
||||
if (isset($setup_info['phpgwapi']['currentver']))
|
||||
@ -259,7 +259,7 @@
|
||||
function check_config()
|
||||
{
|
||||
global $phpgw_info;
|
||||
$this->db->Halt_On_Error = "no";
|
||||
$this->db->Halt_On_Error = 'no';
|
||||
if ($phpgw_info['setup']['stage']['db'] != 10){return '';}
|
||||
|
||||
// Since 0.9.10pre6 config table is named as phpgw_config
|
||||
@ -292,30 +292,34 @@
|
||||
function check_lang()
|
||||
{
|
||||
global $phpgw_info;
|
||||
$this->db->Halt_On_Error = "no";
|
||||
if ($phpgw_info["setup"]["stage"]["db"] != 10){return "";}
|
||||
|
||||
$this->db->Halt_On_Error = 'no';
|
||||
if ($phpgw_info['setup']['stage']['db'] != 10)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->db->query("select distinct lang from lang;");
|
||||
if ($this->db->num_rows() == 0)
|
||||
{
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage 3 (No languages installed)";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage 3 (No languages installed)';
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (@$this->db->next_record())
|
||||
{
|
||||
$phpgw_info["setup"]["installed_langs"][$this->db->f("lang")] = $this->db->f("lang");
|
||||
$phpgw_info['setup']['installed_langs'][$this->db->f('lang')] = $this->db->f('lang');
|
||||
}
|
||||
reset ($phpgw_info["setup"]["installed_langs"]);
|
||||
while (list ($key, $value) = each ($phpgw_info["setup"]["installed_langs"]))
|
||||
reset ($phpgw_info['setup']['installed_langs']);
|
||||
while (list ($key, $value) = each ($phpgw_info['setup']['installed_langs']))
|
||||
{
|
||||
$sql = "select lang_name from languages where lang_id = '".$value."';";
|
||||
$this->db->query($sql);
|
||||
$this->db->next_record();
|
||||
$phpgw_info["setup"]["installed_langs"][$value] = $this->db->f("lang_name");
|
||||
$phpgw_info['setup']['installed_langs'][$value] = $this->db->f('lang_name');
|
||||
}
|
||||
$phpgw_info["setup"]["header_msg"] = "Stage 3 (Completed)";
|
||||
$phpgw_info['setup']['header_msg'] = 'Stage 3 (Completed)';
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
@ -334,7 +338,7 @@
|
||||
{
|
||||
// Make a copy, else we send some callers into an infinite loop
|
||||
$copy = $setup_info;
|
||||
$this->db->Halt_On_Error = "no";
|
||||
$this->db->Halt_On_Error = 'no';
|
||||
$tablenames = $this->db->table_names();
|
||||
while(list($key,$val) = @each($tablenames))
|
||||
{
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
class phpgw_setup_html extends phpgw_setup_lang
|
||||
{
|
||||
var $db;
|
||||
|
||||
/*!
|
||||
@function generate_header
|
||||
@abstract generate header.inc.php file output - NOT a generic html header function
|
||||
@ -64,7 +62,7 @@
|
||||
$GLOBALS['setup_tpl']->set_var('page_title',$title);
|
||||
if ($configdomain == '')
|
||||
{
|
||||
$GLOBALS['setup_tpl']->set_var('configdomain',"");
|
||||
$GLOBALS['setup_tpl']->set_var('configdomain','');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -96,7 +96,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $key."*";
|
||||
$ret = $key.'*';
|
||||
}
|
||||
$ndx = 1;
|
||||
while( list($key,$val) = each( $vars ) )
|
||||
|
@ -72,12 +72,12 @@
|
||||
$i = 1;
|
||||
$passed = array();
|
||||
$passing = array();
|
||||
$pass_string = implode (":", $pass);
|
||||
$passing_string = implode (":", $passing);
|
||||
$pass_string = implode (':', $pass);
|
||||
$passing_string = implode (':', $passing);
|
||||
while ($pass_string != $passing_string)
|
||||
{
|
||||
$passing = array();
|
||||
if ($DEBUG) { echo '<br>process_pass(): #' . $i . " for " . $method . " processing\n"; }
|
||||
if ($DEBUG) { echo '<br>process_pass(): #' . $i . ' for ' . $method . ' processing' . "\n"; }
|
||||
// Check current versions and dependencies
|
||||
$setup_info = $this->get_db_versions($setup_info);
|
||||
$setup_info = $this->compare_versions($setup_info);
|
||||
@ -104,12 +104,12 @@
|
||||
|
||||
switch ($method)
|
||||
{
|
||||
case "new":
|
||||
case 'new':
|
||||
// Create tables and insert new records for each app in this list
|
||||
$passing = $this->process_current($pass,$DEBUG);
|
||||
$passing = $this->process_default_records($passing,$DEBUG);
|
||||
break;
|
||||
case "upgrade":
|
||||
case 'upgrade':
|
||||
// Run upgrade scripts on each app in the list
|
||||
$passing = $this->process_upgrade($pass,$DEBUG);
|
||||
//echo var_dump($pass);exit;
|
||||
@ -157,8 +157,8 @@
|
||||
echo "</pre>";
|
||||
exit;
|
||||
}
|
||||
$pass_string = implode (":", $pass);
|
||||
$passing_string = implode (":", $passing);
|
||||
$pass_string = implode (':', $pass);
|
||||
$passing_string = implode (':', $passing);
|
||||
}
|
||||
|
||||
// now return the list
|
||||
@ -235,13 +235,13 @@
|
||||
$appname = $setup_info[$key]['name'];
|
||||
$apptitle = $setup_info[$key]['title'];
|
||||
|
||||
if($DEBUG) { echo "<br>process_current(): Incoming status: " . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||
if($DEBUG) { echo '<br>process_current(): Incoming status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||
|
||||
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
|
||||
|
||||
if ($setup_info[$key]['tables'] && file_exists($appdir.'tables_current.inc.php'))
|
||||
{
|
||||
if($DEBUG) { echo "<br>process_current(): Including: " . $appdir.'tables_current.inc.php'; }
|
||||
if($DEBUG) { echo '<br>process_current(): Including: ' . $appdir.'tables_current.inc.php'; }
|
||||
include ($appdir.'tables_current.inc.php');
|
||||
$ret = $this->post_process($phpgw_baseline,$DEBUG);
|
||||
if($ret)
|
||||
@ -262,7 +262,7 @@
|
||||
else
|
||||
{
|
||||
// script processing failed
|
||||
if($DEBUG) { echo "<br>process_current(): Failed for " . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||
if($DEBUG) { echo '<br>process_current(): Failed for ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||
$setup_info[$key]['status'] = 'F';
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@
|
||||
}
|
||||
$setup_info[$key]['status'] = 'C';
|
||||
}
|
||||
if($DEBUG) { echo "<br>process_current(): Outgoing status: " . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||
if($DEBUG) { echo '<br>process_current(): Outgoing status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||
}
|
||||
|
||||
// Done, return current status
|
||||
@ -425,7 +425,7 @@
|
||||
{
|
||||
$this->init_process();
|
||||
}
|
||||
$this->oProc->m_odb->HaltOnError = "no";
|
||||
$this->oProc->m_odb->HaltOnError = 'no';
|
||||
$this->oProc->m_bDeltaOnly = True;
|
||||
|
||||
|
||||
@ -490,7 +490,7 @@
|
||||
$currentver = $setup_info[$key]['currentver'];
|
||||
|
||||
// build upgrade function name
|
||||
$function = $appname . "_upgrade" . ereg_replace("\.", "_", $value);
|
||||
$function = $appname . '_upgrade' . ereg_replace("\.", '_', $value);
|
||||
|
||||
if ($DEBUG)
|
||||
{
|
||||
|
@ -12,9 +12,9 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* ######## Start security check ########## */
|
||||
$d1 = strtolower(substr($phpgw_info['server']['api_inc'],0,3));
|
||||
$d2 = strtolower(substr($phpgw_info['server']['server_root'],0,3));
|
||||
$d3 = strtolower(substr($phpgw_info['server']['app_inc'],0,3));
|
||||
$d1 = strtolower(substr($GLOBALS['phpgw_info']['server']['api_inc'],0,3));
|
||||
$d2 = strtolower(substr($GLOBALS['phpgw_info']['server']['server_root'],0,3));
|
||||
$d3 = strtolower(substr($GLOBALS['phpgw_info']['server']['app_inc'],0,3));
|
||||
if($d1 == 'htt' || $d1 == 'ftp' || $d2 == 'htt' || $d2 == 'ftp' || $d3 == 'htt' || $d3 == 'ftp')
|
||||
{
|
||||
echo 'Failed attempt to break in via an old Security Hole!<br>';
|
||||
@ -38,10 +38,7 @@
|
||||
$p9='_UNDEF_',$p10='_UNDEF_',$p11='_UNDEF_',$p12='_UNDEF_',
|
||||
$p13='_UNDEF_',$p14='_UNDEF_',$p15='_UNDEF_',$p16='_UNDEF_')
|
||||
{
|
||||
global $phpgw_info;
|
||||
|
||||
/* error_reporting(0); */
|
||||
list($appname,$classname) = explode(".", $class);
|
||||
list($appname,$classname) = explode('.', $class);
|
||||
|
||||
if (!isset($GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) ||
|
||||
!$GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
|
||||
@ -73,11 +70,10 @@
|
||||
$code = substr($code,0,-1) . ');';
|
||||
eval($code);
|
||||
}
|
||||
/* error_reporting(E_ERROR | E_WARNING | E_PARSE); */
|
||||
return $obj;
|
||||
}
|
||||
|
||||
// This is needed is some parts of setup, until we include the API directly
|
||||
/* This is needed is some parts of setup, until we include the API directly */
|
||||
function filesystem_separator()
|
||||
{
|
||||
if (PHP_OS == 'Windows' || PHP_OS == 'OS/2')
|
||||
@ -94,8 +90,6 @@
|
||||
|
||||
function get_account_id($account_id = '',$default_id = '')
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
if (gettype($account_id) == 'integer')
|
||||
{
|
||||
return $account_id;
|
||||
@ -104,36 +98,41 @@
|
||||
{
|
||||
if ($default_id == '')
|
||||
{
|
||||
return $phpgw_info['user']['account_id'];
|
||||
return $GLOBALS['phpgw_info']['user']['account_id'];
|
||||
}
|
||||
elseif (gettype($default_id) == 'string')
|
||||
{
|
||||
return $phpgw->accounts->name2id($default_id);
|
||||
return $GLOBALS['phpgw']->accounts->name2id($default_id);
|
||||
}
|
||||
return intval($default_id);
|
||||
}
|
||||
elseif (gettype($account_id) == 'string')
|
||||
{
|
||||
if($phpgw->accounts->exists(intval($account_id)) == True)
|
||||
if($GLOBALS['phpgw']->accounts->exists(intval($account_id)) == True)
|
||||
{
|
||||
return intval($account_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $phpgw->accounts->name2id($account_id);
|
||||
return $GLOBALS['phpgw']->accounts->name2id($account_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function lang
|
||||
@abstract function to deal with multilanguage support
|
||||
@function lang
|
||||
@abstract function to handle multilanguage support
|
||||
*/
|
||||
function lang($key, $m1="", $m2="", $m3="", $m4="", $m5="", $m6="", $m7="", $m8="", $m9="", $m10="" )
|
||||
function lang($key,$m1='',$m2='',$m3='',$m4='',$m5='',$m6='',$m7='',$m8='',$m9='',$m10='')
|
||||
{
|
||||
// # TODO: check if $m1 is of type array.
|
||||
// If so, use it instead of $m2-$mN (Stephan)
|
||||
$vars = array( $m1, $m2, $m3, $m4, $m5, $m6, $m7, $m8, $m9, $m10 );
|
||||
if(is_array($m1))
|
||||
{
|
||||
$vars = $m1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
|
||||
}
|
||||
$value = $GLOBALS['phpgw_setup']->translate("$key", $vars );
|
||||
return $value;
|
||||
}
|
||||
@ -158,7 +157,7 @@
|
||||
$d = dir('./lang');
|
||||
while($entry=$d->read())
|
||||
{
|
||||
if (ereg("phpgw_",$entry))
|
||||
if (ereg('phpgw_',$entry))
|
||||
{
|
||||
$z = substr($entry,6,2);
|
||||
$languages[$z]['available'] = True;
|
||||
@ -194,14 +193,15 @@
|
||||
return $select;
|
||||
}
|
||||
|
||||
// Include to check user authorization against the
|
||||
// password in ../header.inc.php to protect all of the setup
|
||||
// pages from unauthorized use.
|
||||
/* Include to check user authorization against the
|
||||
password in ../header.inc.php to protect all of the setup
|
||||
pages from unauthorized use.
|
||||
*/
|
||||
|
||||
if(file_exists(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'))
|
||||
{
|
||||
include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); // To set the current core version
|
||||
// This will change to just use setup_info
|
||||
/* This will change to just use setup_info */
|
||||
$GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
|
||||
}
|
||||
else
|
||||
@ -213,7 +213,4 @@
|
||||
|
||||
include('./inc/class.setup.inc.php');
|
||||
$phpgw_setup = new phpgw_setup;
|
||||
|
||||
//include('./inc/class.schema_proc.inc.php');
|
||||
//$phpgw_lang = CreateObject('setup.setup_lang',$lang);
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user