Commit e38d145b authored by jwarnier's avatar jwarnier
Browse files

- setup and use $conf['ispconfig_log_dir'], somehow replacing ISPC_LOG_PATH/$conf['logpath']

- replace double-quotes with single-quotes whenever appropriate
- fix indentation
parent 47f5e03b
......@@ -889,8 +889,8 @@ class installer_dist extends installer_base {
// exec('chmod a+rx /usr/local/ispconfig/interface/web');
//* Create the ispconfig log directory
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
if(!is_file('/var/log/ispconfig/ispconfig.log')) exec('touch /var/log/ispconfig/ispconfig.log');
if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
exec('chown getmail /usr/local/bin/run-getmail.sh');
......
......@@ -752,11 +752,11 @@ class installer extends installer_base
}
// Create the ispconfig log directory
if (!is_dir('/var/log/ispconfig')) {
mkdir('/var/log/ispconfig');
if (!is_dir($conf['ispconfig_log_dir'])) {
mkdir($conf['ispconfig_log_dir']);
}
if (!is_file('/var/log/ispconfig/ispconfig.log')) {
exec('touch /var/log/ispconfig/ispconfig.log');
if (!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) {
exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
}
exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
......@@ -765,4 +765,4 @@ class installer extends installer_base
}
}
?>
\ No newline at end of file
?>
......@@ -901,8 +901,8 @@ class installer_dist extends installer_base {
exec('chmod a+rx /usr/local/ispconfig/interface/web');
//* Create the ispconfig log directory
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
if(!is_file('/var/log/ispconfig/ispconfig.log')) exec('touch /var/log/ispconfig/ispconfig.log');
if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
exec('chown getmail /usr/local/bin/run-getmail.sh');
......@@ -992,4 +992,4 @@ class installer_dist extends installer_base {
}
?>
\ No newline at end of file
?>
......@@ -97,7 +97,7 @@ function get_distname() {
}
//** OpenSuSE
elseif(file_exists("/etc/SuSE-release")) {
elseif(file_exists('/etc/SuSE-release')) {
if(stristr(file_get_contents('/etc/SuSE-release'),'11.0')) {
$distname = 'openSUSE';
$distver = '11.0';
......@@ -127,7 +127,7 @@ function get_distname() {
//** Redhat
elseif(file_exists("/etc/redhat-release")) {
elseif(file_exists('/etc/redhat-release')) {
$content = file_get_contents('/etc/redhat-release');
......@@ -171,7 +171,7 @@ function get_distname() {
}
//** Gentoo
elseif(file_exists("/etc/gentoo-release")) {
elseif(file_exists('/etc/gentoo-release')) {
$content = file_get_contents('/etc/gentoo-release');
......@@ -183,7 +183,7 @@ function get_distname() {
swriteln("Operating System: Gentoo $distver or compatible\n");
} else {
die('unrecognized Linux distribution');
die('Unrecognized GNU/Linux distribution');
}
return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
......@@ -203,7 +203,7 @@ function swriteln($text = '') {
}
function ilog($msg){
exec("echo `date` \"- [ISPConfig] - \"".$msg." >> ".ISPC_LOG_FILE);
exec("echo `date` \"- [ISPConfig] - \"".$msg.' >> '.ISPC_LOG_FILE);
}
function error($msg){
......@@ -501,8 +501,8 @@ function is_user($user){
$lines = explode("\n", $users);
if(is_array($lines)){
foreach($lines as $line){
if(trim($line) != ""){
list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(":", $line);
if(trim($line) != ''){
list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
if($f1 == $user) return true;
}
}
......@@ -517,8 +517,8 @@ function is_group($group){
$lines = explode("\n", $groups);
if(is_array($lines)){
foreach($lines as $line){
if(trim($line) != ""){
list($f1, $f2, $f3, $f4) = explode(":", $line);
if(trim($line) != ''){
list($f1, $f2, $f3, $f4) = explode(':', $line);
if($f1 == $group) return true;
}
}
......
......@@ -963,7 +963,7 @@ class installer_base {
global $conf;
//* Create the logging directory for the vhost logfiles
mkdir('/var/log/ispconfig/httpd', 0755, true);
mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
if(is_file('/etc/suphp/suphp.conf')) {
replaceLine('/etc/suphp/suphp.conf','php=php:/usr/bin','x-httpd-suphp="php:/usr/bin/php-cgi"',0);
......@@ -1470,10 +1470,10 @@ class installer_base {
if(@is_file('/var/log/clamav/clamav.log')) exec('chmod +r /var/log/clamav/clamav.log');
if(@is_file('/var/log/clamav/freshclam.log')) exec('chmod +r /var/log/clamav/freshclam.log');
//* Create the ispconfig log directory
if(!is_file('/var/log/ispconfig/ispconfig.log')) {
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig', 0755);
touch('/var/log/ispconfig/ispconfig.log');
//* Create the ispconfig log file and directory
if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) {
if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir'], 0755);
touch($conf['ispconfig_log_dir'].'/ispconfig.log');
}
rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh');
......@@ -1486,14 +1486,14 @@ class installer_base {
/* We rotate these logs in cron_daily.php
$fh = fopen('/etc/logrotate.d/logispc3', 'w');
fwrite($fh,
"/var/log/ispconfig/ispconfig.log { \n" .
"$conf['ispconfig_log_dir']/ispconfig.log { \n" .
" weekly \n" .
" missingok \n" .
" rotate 4 \n" .
" compress \n" .
" delaycompress \n" .
"} \n" .
"/var/log/ispconfig/cron.log { \n" .
"$conf['ispconfig_log_dir']/cron.log { \n" .
" weekly \n" .
" missingok \n" .
" rotate 4 \n" .
......@@ -1544,8 +1544,8 @@ class installer_base {
}
$root_cron_jobs = array(
"* * * * * $install_dir/server/server.sh > /dev/null 2>> /var/log/ispconfig/cron.log",
"30 00 * * * $install_dir/server/cron_daily.sh > /dev/null 2>> /var/log/ispconfig/cron.log"
"* * * * * $install_dir/server/server.sh > /dev/null 2>> $conf['ispconfig_log_dir']/cron.log",
"30 00 * * * $install_dir/server/cron_daily.sh > /dev/null 2>> $conf['ispconfig_log_dir']/cron.log"
);
foreach($root_cron_jobs as $cron_job) {
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
......@@ -1563,7 +1563,7 @@ class installer_base {
$existing_cron_jobs = file('crontab.txt');
$cron_jobs = array(
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log'
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> $conf['ispconfig_log_dir']/cron.log'
);
// remove existing ispconfig cronjobs, in case the syntax has changed
......@@ -1581,8 +1581,8 @@ class installer_base {
unlink('crontab.txt');
}
touch('/var/log/ispconfig/cron.log');
chmod('/var/log/ispconfig/cron.log', 0666);
touch($conf['ispconfig_log_dir'].'/cron.log');
chmod($conf['ispconfig_log_dir'].'/cron.log', 0666);
}
......
......@@ -60,27 +60,27 @@ define('ISPC_APP_VERSION', '3.0.3');
//** Database
$conf["db_type"] = 'mysql';
$conf["db_host"] = '{mysql_server_host}';
$conf["db_database"] = '{mysql_server_database}';
$conf["db_user"] = '{mysql_server_ispconfig_user}';
$conf["db_password"] = '{mysql_server_ispconfig_password}';
$conf["db_charset"] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
$conf['db_type'] = 'mysql';
$conf['db_host'] = '{mysql_server_host}';
$conf['db_database'] = '{mysql_server_database}';
$conf['db_user'] = '{mysql_server_ispconfig_user}';
$conf['db_password'] = '{mysql_server_ispconfig_password}';
$conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
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"]);
define("DB_CHARSET",$conf["db_charset"]);
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']);
define('DB_CHARSET',$conf['db_charset']);
//** Database settings for the master DB. This setting is only used in multiserver setups
$conf["dbmaster_type"] = 'mysql';
$conf["dbmaster_host"] = '{mysql_master_server_host}';
$conf["dbmaster_database"] = '{mysql_master_server_database}';
$conf["dbmaster_user"] = '{mysql_master_server_ispconfig_user}';
$conf["dbmaster_password"] = '{mysql_master_server_ispconfig_password}';
$conf['dbmaster_type'] = 'mysql';
$conf['dbmaster_host'] = '{mysql_master_server_host}';
$conf['dbmaster_database'] = '{mysql_master_server_database}';
$conf['dbmaster_user'] = '{mysql_master_server_ispconfig_user}';
$conf['dbmaster_password'] = '{mysql_master_server_ispconfig_password}';
//** Paths
......@@ -91,19 +91,19 @@ define('ISPC_WEB_PATH', ISPC_ROOT_PATH.'/web');
define('ISPC_THEMES_PATH', ISPC_ROOT_PATH.'/web/themes');
define('ISPC_WEB_TEMP_PATH', ISPC_WEB_PATH.'/temp'); // Path for downloads, accessible via browser
define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
define('ISPC_LOG_PATH', '/var/log/ispconfig');
define('ISPC_LOG_PATH', $conf['ispconfig_log_dir']);
//** Paths (Do not change!)
$conf["rootpath"] = substr(dirname(__FILE__),0,-4);
$conf["fs_div"] = "/"; // File system separator, "\\" on Windows and "/"" on Linux and UNIX
$conf["classpath"] = $conf["rootpath"].$conf["fs_div"]."lib".$conf["fs_div"]."classes";
$conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp";
$conf["logpath"] = ISPC_LOG_PATH;
$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
$conf['fs_div'] = '/'; // File system separator, "\\" on Windows and "/" on Linux and UNIX
$conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
$conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
$conf['logpath'] = ISPC_LOG_PATH; // Actually just a copy of $conf['ispconfig_log_dir'], might be removed in a later version
define("FS_DIV",$conf["fs_div"]);
define("SERVER_ROOT",$conf["rootpath"]);
define("INCLUDE_ROOT",SERVER_ROOT.FS_DIV."lib");
define("CLASSES_ROOT",INCLUDE_ROOT.FS_DIV."classes");
define('FS_DIV',$conf['fs_div']);
define('SERVER_ROOT',$conf['rootpath']);
define('INCLUDE_ROOT',SERVER_ROOT.FS_DIV.'lib');
define('CLASSES_ROOT',INCLUDE_ROOT.FS_DIV.'classes');
//** Server
......@@ -111,7 +111,7 @@ $conf['app_title'] = ISPC_APP_TITLE;
$conf['app_version'] = ISPC_APP_VERSION;
$conf['app_link'] = 'http://www.ispconfig.org/';
$conf['modules_available'] = 'dashboard,admin,mail,sites,monitor,client,dns,help';
$conf["server_id"] = "{server_id}";
$conf['server_id'] = '{server_id}';
//** Interface
......@@ -128,8 +128,8 @@ $conf['demo_mode'] = false;
//** Logging
$conf["log_file"] = $conf["logpath"].$conf["fs_div"]."ispconfig.log";
$conf["log_priority"] = {ispconfig_log_priority}; // 0 = Debug, 1 = Warning, 2 = Error
$conf['log_file'] = $conf['ispconfig_log_dir'].$conf['fs_div'].'ispconfig.log';
$conf['log_priority'] = {ispconfig_log_priority}; // 0 = Debug, 1 = Warning, 2 = Error
//** Allow software package installations
......@@ -137,29 +137,29 @@ $conf['software_updates_enabled'] = false;
//** Themes
$conf["theme"] = 'default';
$conf["html_content_encoding"] = 'utf-8'; // example: utf-8, iso-8859-1, ...
$conf["logo"] = 'themes/default/images/ispc_logo.png';
$conf['theme'] = 'default';
$conf['html_content_encoding'] = 'utf-8'; // example: utf-8, iso-8859-1, ...
$conf['logo'] = 'themes/default/images/ispc_logo.png';
//** Default Language
$conf["language"] = '{language}';
$conf["debug_language"] = false;
$conf['language'] = '{language}';
$conf['debug_language'] = false;
//** Misc.
$conf["interface_logout_url"] = ""; // example: http://www.domain.tld/
$conf['interface_logout_url'] = ''; // example: http://www.domain.tld/
//** Auto Load Modules
$conf["start_db"] = true;
$conf["start_session"] = true;
$conf['start_db'] = true;
$conf['start_session'] = true;
//** Constants
define("LOGLEVEL_DEBUG",0);
define("LOGLEVEL_WARN",1);
define("LOGLEVEL_ERROR",2);
define('LOGLEVEL_DEBUG',0);
define('LOGLEVEL_WARN',1);
define('LOGLEVEL_ERROR',2);
//** include a local config-file if there is one
//** IMPORTANT!!!
......
......@@ -82,7 +82,7 @@ define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
//** Paths (Do not change!)
$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
$conf['fs_div'] = '/'; // File system separator (divider), "\\" on Windows and "/"" on Linux and UNIX
$conf['fs_div'] = '/'; // File system separator (divider), "\\" on Windows and "/" on Linux and UNIX
$conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
$conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
......@@ -114,7 +114,7 @@ $conf['demo_mode'] = false;
//** Logging
$conf['log_file'] = '/var/log/ispconfig/ispconfig.log';
$conf['log_file'] = $conf['ispconfig_log_dir'].'/ispconfig.log';
$conf['log_priority'] = 0; // 0 = Debug, 1 = Warning, 2 = Error
......
......@@ -228,14 +228,14 @@ foreach($records as $rec) {
#######################################################################################################
// rotate the ispconfig.log when it exceeds a size of 10 MB
$logfile = '/var/log/ispconfig/ispconfig.log';
$logfile = $conf['ispconfig_log_dir'].'/ispconfig.log';
if(is_file($logfile) && filesize($logfile) > 10000000) {
exec("gzip -c $logfile > $logfile.1.gz");
exec("cat /dev/null > $logfile");
}
// rotate the cron.log when it exceeds a size of 10 MB
$logfile = '/var/log/ispconfig/cron.log';
$logfile = $conf['ispconfig_log_dir'].'/cron.log';
if(is_file($logfile) && filesize($logfile) > 10000000) {
exec("gzip -c $logfile > $logfile.1.gz");
exec("cat /dev/null > $logfile");
......
......@@ -36,7 +36,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var $linkId = 0; // last result of mysql_connect()
var $queryId = 0; // last result of mysql_query()
var $record = array(); // last record fetched
var $autoCommit = 1; // Autocommit Transactions
var $autoCommit = 1; // Autocommit Transactions
var $currentRow; // current row number
var $errorNumber = 0; // last error number
var $errorMessage = ''; // last error message
......@@ -339,7 +339,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
return true;
}
public function closeConn()
{
if($this->linkId)
......@@ -397,17 +398,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if($col['autoInc'] == true) $sql .= 'auto_increment ';
$sql.= ',';
// key Definitionen
if($col['option'] == 'primary') $index .= "PRIMARY KEY (".$col['name']."),";
if($col['option'] == 'index') $index .= "INDEX (".$col['name']."),";
if($col['option'] == 'unique') $index .= "UNIQUE (".$col['name']."),";
if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
}
$sql .= $index;
$sql = substr($sql,0,-1);
$sql .= ')';
$this->query($sql);
return true;
}
}
/*
$columns = array(action => add | alter | drop
......@@ -427,11 +427,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$sql = "ALTER TABLE $table_name ";
foreach($columns as $col){
if($col['action'] == 'add') {
$sql .= "ADD ".$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
$sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
} elseif ($col['action'] == 'alter') {
$sql .= "CHANGE ".$col['name']." ".$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
$sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
} elseif ($col['action'] == 'drop') {
$sql .= "DROP ".$col['name'].' ';
$sql .= 'DROP '.$col['name'].' ';
}
if($col['action'] != 'drop') {
if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
......@@ -442,10 +442,10 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
if($col['autoInc'] == true) $sql .= 'auto_increment ';
$sql.= ',';
// key Definitionen
if($col['option'] == 'primary') $index .= "PRIMARY KEY (".$col['name']."),";
if($col['option'] == 'index') $index .= "INDEX (".$col['name']."),";
if($col['option'] == 'unique') $index .= "UNIQUE (".$col['name']."),";
// Index definitions
if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
}
}
$sql .= $index;
......@@ -493,7 +493,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
global $go_api,$go_info;
// Tabellenfelder einlesen
if($rows = $go_api->db->queryAllRecords("SHOW FIELDS FROM ".$table_name)){
if($rows = $go_api->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
foreach($rows as $row) {
$name = $row[0];
$default = $row[4];
......
......@@ -34,7 +34,7 @@ class getconf {
function get_server_config($server_id, $section = '') {
global $app;
if(!is_array($this->config[$server_id])) {
$app->uses('ini_parser');
$server_id = intval($server_id);
......@@ -59,7 +59,6 @@ class getconf {
}
return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
}
}
?>
......@@ -28,7 +28,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class ini_parser {
class ini_parser{
var $config;
......@@ -37,9 +37,8 @@ class ini_parser {
$lines = explode("\n",$ini);
foreach($lines as $line) {
$line = trim($line);
if($line != '') {
$line = trim($line);
if(preg_match("/^\[([\w\d_]+)\]$/", $line, $matches)) {
$section = strtolower($matches[1]);
} elseif(preg_match("/^([\w\d_]+)=(.*)$/", $line, $matches) && $section != null) {
......@@ -70,4 +69,4 @@ class ini_parser {
}
?>
\ No newline at end of file
?>
......@@ -95,7 +95,7 @@ class monitor_core_module {
} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
$distname = 'Debian';
$distver = 'Squeeze/Sid';
$distid = 'debian40';
$distid = 'debian60';
$distbaseid = 'debian';
} else {
$distname = 'Debian';
......@@ -106,7 +106,7 @@ class monitor_core_module {
}
//** OpenSuSE
elseif(file_exists("/etc/SuSE-release")) {
elseif(file_exists('/etc/SuSE-release')) {
if(stristr(file_get_contents('/etc/SuSE-release'),'11.0')) {
$distname = 'openSUSE';
$distver = '11.0';
......@@ -132,7 +132,7 @@ class monitor_core_module {
//** Redhat
elseif(file_exists("/etc/redhat-release")) {
elseif(file_exists('/etc/redhat-release')) {
$content = file_get_contents('/etc/redhat-release');
......@@ -170,7 +170,7 @@ class monitor_core_module {
}
//** Gentoo
elseif(file_exists("/etc/gentoo-release")) {
elseif(file_exists('/etc/gentoo-release')) {
$content = file_get_contents('/etc/gentoo-release');
......@@ -181,7 +181,7 @@ class monitor_core_module {
$distbaseid = 'gentoo';
} else {
die('unrecognized Linux distribution');
die('Unrecognized GNU/Linux distribution');
}
return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
......@@ -229,7 +229,7 @@ class monitor_core_module {
$data = array();
/* the id of the server as int */
$server_id = intval($conf["server_id"]);
$server_id = intval($conf['server_id']);
/** The type of the data */
$type = 'harddisk_quota';
......@@ -238,7 +238,7 @@ class monitor_core_module {
$state = 'ok';
/** Fetch the data for all users*/
$dfData = shell_exec("repquota -asu");
$dfData = shell_exec('repquota -asu');
// split into array
$df = explode("\n", $dfData);
......@@ -251,7 +251,7 @@ class monitor_core_module {
/*
* Make a array of the data
*/
$s = preg_split ("/[\s]+/", $df[$i]);
$s = preg_split ('/[\s]+/', $df[$i]);
$username = $s[0];
$data['user'][$username]['used'] = $s[2];
$data['user'][$username]['soft'] = $s[3];
......@@ -260,7 +260,7 @@ class monitor_core_module {
}
/** Fetch the data for all users*/
$dfData = shell_exec("repquota -asg");
$dfData = shell_exec('repquota -asg');
// split into array
$df = explode("\n", $dfData);
......@@ -273,7 +273,7 @@ class monitor_core_module {
/*
* Make a array of the data
*/
$s = preg_split ("/[\s]+/", $df[$i]);
$s = preg_split ('/[\s]+/', $df[$i]);
$groupname = $s[0];
$data['group'][$groupname]['used'] = $s[1];
$data['group'][$groupname]['soft'] = $s[2];
......@@ -284,14 +284,14 @@ class monitor_core_module {
/*
Insert the data into the database
*/
$sql = "INSERT INTO monitor_data (server_id, type, created, data, state) " .
"VALUES (".
$server_id . ", " .
$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
'VALUES ('.
$server_id . ', ' .
"'" . $app->dbmaster->quote($type) . "', " .
time() . ", " .
time() . ', ' .
"'" . $app->dbmaster->quote(serialize($data)) . "', " .
"'" . $state . "'" .
")";
')';
$app->dbmaster->query($sql);
/* The new data is written, now we can delete the old one */
......@@ -303,7 +303,7 @@ class monitor_core_module {
global $conf;
/* the id of the server as int */
$server_id = intval($conf["server_id"]);
$server_id = intval($conf['server_id']);
/** The type of the data */
$type = 'server_load';
......@@ -316,15 +316,15 @@ class monitor_core_module {
$data['up_hours'] = floor(($procUptime-$data['up_days']*86400)/3600);
$data['up_minutes'] = floor(($procUptime-$data['up_days']*86400-$data['up_hours']*3600)/60);