[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] setup/inc functions.inc.php,1.51
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] setup/inc functions.inc.php,1.51 |
Date: |
Sun, 15 May 2005 13:59:00 +0200 |
Update of setup/inc
Modified Files:
Branch: MAIN
functions.inc.php lines: +67 -83
Log Message:
fixes
====================================================
Index: setup/inc/functions.inc.php
diff -u setup/inc/functions.inc.php:1.50 setup/inc/functions.inc.php:1.51
--- setup/inc/functions.inc.php:1.50 Fri Apr 15 14:36:20 2005
+++ setup/inc/functions.inc.php Sun May 15 11:59:36 2005
@@ -1,85 +1,72 @@
<?php
- /**
- * Setup - functions
- *
- * Setup functions
- * @author Joseph Engo <address@hidden>
- * @author Dan Kuykendall <address@hidden>
- * @author Mark Peters <address@hidden>
- * @author Miles Lott <address@hidden>
- * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @package setup
- * @version $Id$
- */
-
- // ######## Start security check ##########
- $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
/>';
- exit;
- }
- unset($d1);unset($d2);unset($d3);
- /* ######## End security check ########## */
+ /**************************************************************************\
+ * phpGroupWare - Setup *
+ * http://www.phpgroupware.org *
+ * -------------------------------------------- *
+ * This file written by Joseph Engo<address@hidden> *
+ * and Dan Kuykendall<address@hidden> *
+ * and Mark Peters<address@hidden> *
+ * and Miles Lott<address@hidden> *
+ * and Dave Hall skwashd at phpgroupware.org *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
- if(file_exists('../header.inc.php'))
+ if ( file_exists('../header.inc.php') )
{
-
- /**
- * Include phpgroupware header
- */
- include_once('../header.inc.php');
+ require_once('../header.inc.php');
}
- if (!function_exists('version_compare'))//version_compare() is only
available in PHP4.1+
+ if ( !function_exists('sha1') ) //sha1() is only available in PHP4.3+
see http://www.php.net/ChangeLog-4.php#4.3.0
{
- echo 'phpGroupWare now requires PHP 4.1 or greater.<br />';
+ echo 'phpGroupWare now requires PHP 4.3 or greater.<br />';
echo 'Please contact your System Administrator';
exit;
}
-
-
/* If we included the header.inc.php, but it is somehow broken, cover
ourselves... */
- if(!defined('PHPGW_SERVER_ROOT') && !defined('PHPGW_INCLUDE_ROOT'))
+ if ( !defined('PHPGW_SERVER_ROOT') && !defined('PHPGW_INCLUDE_ROOT') )
{
- define('PHPGW_SERVER_ROOT','..');
- define('PHPGW_INCLUDE_ROOT','..');
+ define('PHPGW_SERVER_ROOT', realpath('..') );
+ define('PHPGW_INCLUDE_ROOT', realpath('..') );
}
- /**
- * Include common functions
- */
- include(PHPGW_INCLUDE_ROOT . '/phpgwapi/inc/common_functions.inc.php');
-
- /**
- * Include log functions
- */
- include(PHPGW_INCLUDE_ROOT . '/phpgwapi/inc/log_functions.inc.php');
+ define('SEP', DIRECTORY_SEPARATOR);
- /**
- * Platform dependend file separator
- */
- define('SEP',filesystem_separator());
+ if ( is_dir(PHPGW_INCLUDE_ROOT . SEP . 'phpgwapi') &&
is_dir(PHPGW_INCLUDE_ROOT . SEP . 'phpgwapi' . SEP . 'inc')
+ && is_file(PHPGW_INCLUDE_ROOT . SEP . 'phpgwapi' . SEP . 'inc'
. SEP . 'common_functions.inc.php') )
+ {
+ require_once(PHPGW_INCLUDE_ROOT . SEP . 'phpgwapi' . SEP .
'inc' . SEP . 'common_functions.inc.php');
+ require_once(PHPGW_INCLUDE_ROOT . SEP . 'phpgwapi' . SEP .
'inc' . SEP . 'log_functions.inc.php');
+ }
+ else
+ {
+ die('Your phpGroupWare install is incomplete, please try to '
+ . '<a href="http://download.phpgroupware.org/now"'
+ . ' target="_blank">download phpGroupWare</a> and try
again');
+ }
/**
- * Handle multilanguage support
+ * Translate a phrase
*
- * @param $key
- * @param string|array $m1
- * @param string $m2
- * @param string $m3
- * @param string $m4
- * @param string $m5
- * @param string $m6
- * @param string $m7
- * @param string $m8
- * @param string $m9
- * @param string $m10
- * @return array
+ * @param string $key phrase to translate (note: %n are replaces with
$mn)
+ * @param string $m1 substitution string
+ * @param string $m1 substitution string
+ * @param string $m2 substitution string
+ * @param string $m3 substitution string
+ * @param string $m4 substitution string
+ * @param string $m5 substitution string
+ * @param string $m6 substitution string
+ * @param string $m7 substitution string
+ * @param string $m8 substitution string
+ * @param string $m9 substitution string
+ * @param string $m10 substitution string
+ * @returns string translated phrase
*/
function
lang($key,$m1='',$m2='',$m3='',$m4='',$m5='',$m6='',$m7='',$m8='',$m9='',$m10='')
{
@@ -96,9 +83,9 @@
}
/**
- * Get supported languages
+ * Get a list of supported languages
*
- * @return array Supported languages
+ * @returns array supported language ['lang' => iso631_code, 'descr' =>
language_name, 'available' => bool_is_installed]
*/
function get_langs()
{
@@ -113,9 +100,9 @@
fclose($f);
$d = dir('./lang');
- while($entry=$d->read())
+ while ( $entry = $d->read() )
{
- if(ereg('^phpgw_',$entry))
+ if ( strpos($entry, 'phpgw_') === 0 )
{
$z = substr($entry,6,2);
$languages[$z]['available'] = True;
@@ -128,16 +115,16 @@
}
/**
- * Create HTML select with available languages
+ * Generate a select box of available languages
*
- * @param boolean $onChange Add JavaScript code for auto submit when true
- * @return string HTML code for select box
+ * @param bool $onChange javascript to trigger when selection changes
(optional)
+ * @returns string HTML snippet for select box
*/
- function lang_select($onChange=False)
+ function lang_select($onChange = '')
{
- $ConfigLang = get_var('ConfigLang',Array('POST','COOKIE'));
+ $ConfigLang = get_var('ConfigLang', Array('POST','COOKIE'));
- $select = '<select name="ConfigLang"'.($onChange ? '
onchange="this.form.submit();"' : '').'>' . "\n";
+ $select = '<select name="ConfigLang"' . ($onChange ? '
onChange="this.form.submit();"' : '') . '>' . "\n";
$languages = get_langs();
while(list($null,$data) = each($languages))
{
@@ -147,7 +134,7 @@
$short = substr($data['lang'],0,2);
if ($short == $ConfigLang || empty($ConfigLang)
&& $short == substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2))
{
- $selected = ' selected="selected"';
+ $selected = ' selected';
}
$select .= '<option value="' . $data['lang'] .
'"' . $selected . '>' . $data['descr'] . '</option>' . "\n";
}
@@ -157,13 +144,10 @@
return $select;
}
- if(file_exists(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'))
+ if(file_exists(PHPGW_SERVER_ROOT . '/phpgwapi/setup/setup.inc.php'))
{
- /**
- * Include API setup
- */
- include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); /*
To set the current core version */
- // This will change to just use setup_info
+ require(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); /*
To set the current core version */
+ /* This will change to just use setup_info */
$GLOBALS['phpgw_info']['server']['versions']['current_header']
= $setup_info['phpgwapi']['versions']['current_header'];
}
else
@@ -171,7 +155,7 @@
$GLOBALS['phpgw_info']['server']['versions']['phpgwapi'] =
'Undetected';
}
- $GLOBALS['phpgw_info']['server']['app_images'] =
'templates/default/images';
+ $GLOBALS['phpgw_info']['server']['app_images'] =
'templates/base/images';
- $GLOBALS['phpgw_setup'] = CreateObject('phpgwapi.setup',True,True);
+ $GLOBALS['phpgw_setup'] = CreateObject('phpgwapi.setup', True, True);
?>
- [Phpgroupware-cvs] setup/inc functions.inc.php,1.51,
skwashd <=