made members of config class private
This commit is contained in:
parent
bf323b807c
commit
4bb25a5c17
|
@ -164,25 +164,25 @@ function metaRefresh($page) {
|
||||||
class LAMConfig {
|
class LAMConfig {
|
||||||
|
|
||||||
/** Server address (e.g. ldap://127.0.0.1:389) */
|
/** Server address (e.g. ldap://127.0.0.1:389) */
|
||||||
var $ServerURL;
|
private $ServerURL;
|
||||||
|
|
||||||
/** Array of string: users with admin rights */
|
/** Array of string: users with admin rights */
|
||||||
var $Admins;
|
private $Admins;
|
||||||
|
|
||||||
/** Password to edit preferences */
|
/** Password to edit preferences */
|
||||||
private $Passwd;
|
private $Passwd;
|
||||||
|
|
||||||
/** LDAP suffix for tree view */
|
/** LDAP suffix for tree view */
|
||||||
var $treesuffix;
|
private $treesuffix;
|
||||||
|
|
||||||
/** Default language */
|
/** Default language */
|
||||||
var $defaultLanguage;
|
private $defaultLanguage;
|
||||||
|
|
||||||
/** module settings */
|
/** module settings */
|
||||||
var $moduleSettings = array();
|
private $moduleSettings = array();
|
||||||
|
|
||||||
/** type settings */
|
/** type settings */
|
||||||
var $typeSettings = array();
|
private $typeSettings = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path to external lamdaemon script on server where it is executed
|
* Path to external lamdaemon script on server where it is executed
|
||||||
|
@ -190,12 +190,12 @@ class LAMConfig {
|
||||||
* This is used for managing quota and home directories.
|
* This is used for managing quota and home directories.
|
||||||
* optional setting, may not be defined
|
* optional setting, may not be defined
|
||||||
*/
|
*/
|
||||||
var $scriptPath;
|
private $scriptPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The rights for the home directory
|
* The rights for the home directory
|
||||||
*/
|
*/
|
||||||
var $scriptRights = '750';
|
private $scriptRights = '750';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Servers where lamdaemon script is executed
|
* Servers where lamdaemon script is executed
|
||||||
|
@ -203,16 +203,16 @@ class LAMConfig {
|
||||||
* This is used for managing quota and home directories.
|
* This is used for managing quota and home directories.
|
||||||
* optional setting, may not be defined
|
* optional setting, may not be defined
|
||||||
*/
|
*/
|
||||||
var $scriptServer;
|
private $scriptServer;
|
||||||
|
|
||||||
/** LDAP cache timeout */
|
/** LDAP cache timeout */
|
||||||
var $cachetimeout;
|
private $cachetimeout;
|
||||||
|
|
||||||
/** Active account types */
|
/** Active account types */
|
||||||
var $activeTypes = "user,group,host,smbDomain";
|
private $activeTypes = "user,group,host,smbDomain";
|
||||||
|
|
||||||
/** Name of configuration file */
|
/** Name of configuration file */
|
||||||
var $file;
|
private $file;
|
||||||
|
|
||||||
/** List of all settings in config file */
|
/** List of all settings in config file */
|
||||||
private $settings = array("ServerURL", "Passwd", "Admins", "treesuffix",
|
private $settings = array("ServerURL", "Passwd", "Admins", "treesuffix",
|
||||||
|
@ -388,6 +388,15 @@ class LAMConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the config file
|
||||||
|
*
|
||||||
|
* @return String name
|
||||||
|
*/
|
||||||
|
public function getName() {
|
||||||
|
return $this->file;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the file can be written on the filesystem.
|
* Returns if the file can be written on the filesystem.
|
||||||
*
|
*
|
||||||
|
|
|
@ -50,7 +50,7 @@ function lamdaemon($commands, $server) {
|
||||||
|
|
||||||
$userstring = implode ("\n", $commands);
|
$userstring = implode ("\n", $commands);
|
||||||
$output_array = array();
|
$output_array = array();
|
||||||
$towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->scriptPath)." - -";
|
$towrite = escapeshellarg($server)." ".escapeshellarg($_SESSION['config']->get_scriptPath())." - -";
|
||||||
$descriptorspec = array(
|
$descriptorspec = array(
|
||||||
0 => array("pipe", "r"), // stdin
|
0 => array("pipe", "r"), // stdin
|
||||||
1 => array("pipe", "w"), // stout
|
1 => array("pipe", "w"), // stout
|
||||||
|
@ -112,7 +112,7 @@ function lamdaemonSSH($commands, $server) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
if (@ssh2_auth_password($handle, $userName, $credentials[1])) {
|
if (@ssh2_auth_password($handle, $userName, $credentials[1])) {
|
||||||
$shell = ssh2_exec($handle, "sudo " . $_SESSION['config']->scriptPath);
|
$shell = ssh2_exec($handle, "sudo " . $_SESSION['config']->get_scriptPath());
|
||||||
fwrite($shell, $commands);
|
fwrite($shell, $commands);
|
||||||
$return = array();
|
$return = array();
|
||||||
$time = time() + (sizeof($commands) * 30);
|
$time = time() + (sizeof($commands) * 30);
|
||||||
|
|
|
@ -553,7 +553,7 @@ class posixAccount extends baseModule {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = lamdaemon(array($this->attributes['uid'][0] . " home add 0".$_SESSION['config']->scriptRights), $server);
|
$result = lamdaemon(array($this->attributes['uid'][0] . " home add 0".$_SESSION['config']->get_scriptRights()), $server);
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (is_array($result)) {
|
||||||
foreach ($result as $singleresult) {
|
foreach ($result as $singleresult) {
|
||||||
|
@ -974,7 +974,7 @@ class posixAccount extends baseModule {
|
||||||
array('kind' => 'text', 'text' => _('Home directory').'*'),
|
array('kind' => 'text', 'text' => _('Home directory').'*'),
|
||||||
array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]),
|
array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]),
|
||||||
array('kind' => 'help', 'value' => 'homeDirectory'));
|
array('kind' => 'help', 'value' => 'homeDirectory'));
|
||||||
if ($this->getAccountContainer()->isNewAccount && isset($_SESSION['config']->scriptPath) && ($_SESSION['config']->scriptPath != '')) {
|
if ($this->getAccountContainer()->isNewAccount && ($_SESSION['config']->get_scriptPath() != null) && ($_SESSION['config']->get_scriptPath() != '')) {
|
||||||
// get list of lamdaemon servers
|
// get list of lamdaemon servers
|
||||||
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
|
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
|
||||||
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {
|
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {
|
||||||
|
@ -1030,7 +1030,7 @@ class posixAccount extends baseModule {
|
||||||
* @return meta HTML code
|
* @return meta HTML code
|
||||||
*/
|
*/
|
||||||
function display_html_delete() {
|
function display_html_delete() {
|
||||||
if ($this->get_scope() == 'user' && isset($_SESSION['config']->scriptPath)) {
|
if ($this->get_scope() == 'user' && ($_SESSION['config']->get_scriptPath() != null)) {
|
||||||
$return[] = array (
|
$return[] = array (
|
||||||
array('kind' => 'text', 'text' => _('Delete home directory')),
|
array('kind' => 'text', 'text' => _('Delete home directory')),
|
||||||
array('kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'),
|
array('kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'),
|
||||||
|
@ -1593,7 +1593,7 @@ class posixAccount extends baseModule {
|
||||||
// create home directories
|
// create home directories
|
||||||
elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) {
|
elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) {
|
||||||
$pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])];
|
$pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])];
|
||||||
$result = lamdaemon(array($data[$pos][$ids['posixAccount_userName']] . " home add 0".$_SESSION['config']->scriptRights),
|
$result = lamdaemon(array($data[$pos][$ids['posixAccount_userName']] . " home add 0".$_SESSION['config']->get_scriptRights()),
|
||||||
$data[$pos][$ids['posixAccount_createHomeDir']]);
|
$data[$pos][$ids['posixAccount_createHomeDir']]);
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if (($result != false) && (sizeof($result) == 1)) {
|
if (($result != false) && (sizeof($result) == 1)) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ $conf = &$_SESSION['conf_config'];
|
||||||
|
|
||||||
// check if password is valid
|
// check if password is valid
|
||||||
// if not: load login page
|
// if not: load login page
|
||||||
if (!$conf->check_Passwd($passwd) && !($_SESSION['conf_isAuthenticated'] === $conf->file)) {
|
if (!$conf->check_Passwd($passwd) && !($_SESSION['conf_isAuthenticated'] === $conf->getName())) {
|
||||||
$sessionKeys = array_keys($_SESSION);
|
$sessionKeys = array_keys($_SESSION);
|
||||||
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
for ($i = 0; $i < sizeof($sessionKeys); $i++) {
|
||||||
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
if (substr($sessionKeys[$i], 0, 5) == "conf_") unset($_SESSION[$sessionKeys[$i]]);
|
||||||
|
@ -72,7 +72,7 @@ if (!$conf->check_Passwd($passwd) && !($_SESSION['conf_isAuthenticated'] === $co
|
||||||
require('conflogin.php');
|
require('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$_SESSION['conf_isAuthenticated'] = $conf->file;
|
$_SESSION['conf_isAuthenticated'] = $conf->getName();
|
||||||
|
|
||||||
// check if button was pressed and if we have to save the setting or go back to login
|
// check if button was pressed and if we have to save the setting or go back to login
|
||||||
if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmodules']) || isset($_POST['edittypes'])){
|
if (isset($_POST['back']) || isset($_POST['submitconf']) || isset($_POST['editmodules']) || isset($_POST['edittypes'])){
|
||||||
|
|
|
@ -323,7 +323,7 @@ function display_LoginPage($config_object) {
|
||||||
<?php
|
<?php
|
||||||
echo _("Server profile") . ": ";
|
echo _("Server profile") . ": ";
|
||||||
if(empty($_POST['profileChange'])) {
|
if(empty($_POST['profileChange'])) {
|
||||||
$_POST['profile'] = $_SESSION['config']->file;
|
$_POST['profile'] = $_SESSION['config']->getName();
|
||||||
}
|
}
|
||||||
?></b>
|
?></b>
|
||||||
<?php echo $_POST['profile']; ?>
|
<?php echo $_POST['profile']; ?>
|
||||||
|
|
|
@ -67,7 +67,7 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) {
|
||||||
flush();
|
flush();
|
||||||
$lamdaemonOk = false;
|
$lamdaemonOk = false;
|
||||||
$errorMessage = "";
|
$errorMessage = "";
|
||||||
$shell = ssh2_exec($handle, "sudo " . $_SESSION['config']->scriptPath);
|
$shell = ssh2_exec($handle, "sudo " . $_SESSION['config']->get_scriptPath());
|
||||||
$stderr = ssh2_fetch_stream($shell, SSH2_STREAM_STDERR);
|
$stderr = ssh2_fetch_stream($shell, SSH2_STREAM_STDERR);
|
||||||
fwrite($shell, $command);
|
fwrite($shell, $command);
|
||||||
$return = array();
|
$return = array();
|
||||||
|
@ -138,7 +138,7 @@ for ($i = 0; $i < sizeof($servers); $i++) {
|
||||||
echo "<td>" . _("Error") . "</td>\n";
|
echo "<td>" . _("Error") . "</td>\n";
|
||||||
echo "<td bgcolor=\"red\">" . _("No lamdaemon server set, please update your LAM configuration settings.") . "</td>";
|
echo "<td bgcolor=\"red\">" . _("No lamdaemon server set, please update your LAM configuration settings.") . "</td>";
|
||||||
}
|
}
|
||||||
elseif (!isset($_SESSION['config']->scriptPath) || (strlen($_SESSION['config']->scriptPath) < 10)) {
|
elseif (($_SESSION['config']->get_scriptPath() == null) || (strlen($_SESSION['config']->get_scriptPath()) < 10)) {
|
||||||
echo "<td bgcolor=\"red\">" . _("Error") . " </td>\n";
|
echo "<td bgcolor=\"red\">" . _("Error") . " </td>\n";
|
||||||
echo "<td bgcolor=\"red\">" . _("No lamdaemon path set, please update your LAM configuration settings.") . "</td>";
|
echo "<td bgcolor=\"red\">" . _("No lamdaemon path set, please update your LAM configuration settings.") . "</td>";
|
||||||
$stopTest = true;
|
$stopTest = true;
|
||||||
|
|
Loading…
Reference in New Issue