This file creates user / group permissions by editing
the /etc/passwd /etc/shadow and /etc/group files
*/
+require_once dirname(__FILE__).'/../../env.inc.php';
require_once $gfwww.'include/squal_pre.php';
require $gfcommon.'include/cron_utils.php';
+//error variable
+$err = '';
+
//
// Default values for the script
//
*************************************************************************/
// Read the passwd file line by line
-$passwd_orig = file("/etc/passwd", "r");
+$passwd_orig = file("/etc/passwd");
for ($i=0; $i < count($passwd_orig); $i++) {
$line = trim($passwd_orig[$i]);
*************************************************************************/
// Read the shadow file line by line
-$shadow_orig = file("/etc/shadow", "r");
+$shadow_orig = file("/etc/shadow");
for ($i=0; $i < count($shadow_orig); $i++) {
$line = trim($shadow_orig[$i]);
// If this does not work, then set defines to real path directly.
//
// In case of failure, the following defines are set:
-// GFCGFILE : Configuration file of gforge.
// $gfconfig : Directory where are the configuration files (/etc/gforge).
// $gfcommon : Directory common of gforge (for common php classes).
// $gfwww : Directory www of gforge (publicly accessible files).
if (getenv('sys_localinc')) {
$gfcgfile = getenv('sys_localinc');
$gfconfig = dirname($gfcgfile).'/';
-} elseif (file_exists($IP.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php')) {
+} elseif (isset($_SERVER['SERVER_NAME']) &&
+ file_exists($IP.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php')) {
$gfcgfile = $IP.'/config/'.$_SERVER['SERVER_NAME'].'/local.inc.php';
$gfconfig = $IP.'/config/'.$_SERVER['SERVER_NAME'].'/';
} elseif (file_exists($IP.'/config/local.inc.php')) {