- removed some undefined variables
- fixed function openRootDB - fixed realtime-function (it's now a tcp connection), fixes #24 - fixed missing $-sign befor variable in makePathfield
This commit is contained in:
@@ -71,7 +71,7 @@ return array(
|
|||||||
'label' => $lng['serversettings']['system_realtime_port'],
|
'label' => $lng['serversettings']['system_realtime_port'],
|
||||||
'settinggroup' => 'system',
|
'settinggroup' => 'system',
|
||||||
'varname' => 'realtime_port',
|
'varname' => 'realtime_port',
|
||||||
'type' => 'int',
|
'type' => (function_exists('socket_create') ? 'int' : 'hidden'),
|
||||||
'int_max' => 65535,
|
'int_max' => 65535,
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
'save_method' => 'storeSettingField',
|
'save_method' => 'storeSettingField',
|
||||||
|
|||||||
@@ -781,11 +781,18 @@ if($page == 'customers'
|
|||||||
$mysqls = - 1;
|
$mysqls = - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
if($settings['aps']['aps_active'] == '1')
|
||||||
|
{
|
||||||
|
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||||
|
|
||||||
if(isset($_POST['number_of_aps_packages_ul']))
|
if(isset($_POST['number_of_aps_packages_ul']))
|
||||||
|
{
|
||||||
|
$number_of_aps_packages = - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$number_of_aps_packages = - 1;
|
$number_of_aps_packages = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$createstdsubdomain = intval($_POST['createstdsubdomain']);
|
$createstdsubdomain = intval($_POST['createstdsubdomain']);
|
||||||
|
|||||||
@@ -624,7 +624,9 @@ if($page == 'domains'
|
|||||||
elseif($action == 'edit'
|
elseif($action == 'edit'
|
||||||
&& $id != 0)
|
&& $id != 0)
|
||||||
{
|
{
|
||||||
$result = $db->query_first("SELECT `d`.`id`, `d`.`domain`, `d`.`customerid`, `d`.`adminid`, `d`.`email_only`, `d`.`documentroot`, `d`.`ssl`, `d`.`ssl_redirect`, `d`.`ssl_ipandport`,`d`.`ipandport`, `d`.`aliasdomain`, `d`.`isbinddomain`, `d`.`isemaildomain`, `d`.`subcanemaildomain`, `d`.`dkim`, `d`.`caneditdomain`, `d`.`zonefile`, `d`.`wwwserveralias`, `d`.`openbasedir`, `d`.`safemode`, `d`.`speciallogfile`, `d`.`specialsettings`, `d`.`add_date`, `d`.`registration_date`, `c`.`loginname`, `c`.`name`, `c`.`firstname`, `c`.`company`, `d`.`phpsettingid`, `d`.`mod_fcgid_starter`, `d`.`mod_fcgid_maxrequests` " . "FROM `" . TABLE_PANEL_DOMAINS . "` `d` " . "LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) " . "WHERE `d`.`parentdomainid`='0' AND `d`.`id`='" . (int)$id . "'" . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = '" . (int)$userinfo['adminid'] . "' "));
|
$result = $db->query_first("SELECT `d`.*, `c`.* FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`)
|
||||||
|
WHERE `d`.`parentdomainid`='0' AND `d`.`id`='" . (int)$id . "'"
|
||||||
|
. ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = '" . (int)$userinfo['adminid'] . "' "));
|
||||||
|
|
||||||
if($result['domain'] != '')
|
if($result['domain'] != '')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -439,9 +439,9 @@ elseif($page == 'domains')
|
|||||||
|| $ssl_redirect != $result['ssl_redirect'])
|
|| $ssl_redirect != $result['ssl_redirect'])
|
||||||
{
|
{
|
||||||
$log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'");
|
$log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'");
|
||||||
|
$result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot`='" . $db->escape($path) . "', `isemaildomain`='" . (int)$isemaildomain . "', `iswildcarddomain`='" . (int)$iswildcarddomain . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ",`openbasedir_path`='" . $db->escape($openbasedir_path) . "', `ssl_redirect`='" . $ssl_redirect . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||||
inserttask('1');
|
inserttask('1');
|
||||||
inserttask('4');
|
inserttask('4');
|
||||||
$result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot`='" . $db->escape($path) . "', `isemaildomain`='" . (int)$isemaildomain . "', `iswildcarddomain`='" . (int)$iswildcarddomain . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ",`openbasedir_path`='" . $db->escape($openbasedir_path) . "', `ssl_redirect`='" . $ssl_redirect . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||||
|
|||||||
@@ -174,17 +174,13 @@ if(!is_null($month)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = $db->query("(SELECT SUM(`http`) as sum FROM `" . TABLE_PANEL_TRAFFIC . "`
|
$result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
|
||||||
WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) UNION
|
WHERE `customerid`='" . $userinfo['customerid'] . "'
|
||||||
(SELECT SUM(`ftp_up`+`ftp_down`) FROM `" . TABLE_PANEL_TRAFFIC . "`
|
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
||||||
WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
$row = mysql_fetch_row($result);
|
||||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) UNION
|
rsort($row);
|
||||||
(SELECT SUM(`mail`) FROM `" . TABLE_PANEL_TRAFFIC . "`
|
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));
|
||||||
WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
|
||||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) ORDER BY sum DESC LIMIT 1");
|
|
||||||
$row = $db->fetch_array($result);
|
|
||||||
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));;
|
|
||||||
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
||||||
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
||||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ function makePathfield($path, $uid, $gid, $fieldType, $value = '')
|
|||||||
|
|
||||||
if(sizeof($dirList) > 0)
|
if(sizeof($dirList) > 0)
|
||||||
{
|
{
|
||||||
if(sizeof(dirList) <= 100)
|
if(sizeof($dirList) <= 100)
|
||||||
{
|
{
|
||||||
$field = '<select name="path">';
|
$field = '<select name="path">';
|
||||||
foreach($dirList as $key => $dir)
|
foreach($dirList as $key => $dir)
|
||||||
|
|||||||
@@ -60,16 +60,17 @@ function getNextCronjobs()
|
|||||||
|
|
||||||
function includeCronjobs($debugHandler, $pathtophpfiles)
|
function includeCronjobs($debugHandler, $pathtophpfiles)
|
||||||
{
|
{
|
||||||
|
global $settings;
|
||||||
|
|
||||||
$cronjobs = getNextCronjobs();
|
$cronjobs = getNextCronjobs();
|
||||||
|
|
||||||
$jobs_to_run = array();
|
$jobs_to_run = array();
|
||||||
|
$cron_path = makeCorrectDir($pathtophpfiles.'/scripts/jobs/');
|
||||||
|
|
||||||
if($cronjobs !== false
|
if($cronjobs !== false
|
||||||
&& is_array($cronjobs)
|
&& is_array($cronjobs)
|
||||||
&& isset($cronjobs[0]))
|
&& isset($cronjobs[0]))
|
||||||
{
|
{
|
||||||
$cron_path = makeCorrectDir($pathtophpfiles.'/scripts/jobs/');
|
|
||||||
|
|
||||||
foreach($cronjobs as $cronjob)
|
foreach($cronjobs as $cronjob)
|
||||||
{
|
{
|
||||||
$cron_file = makeCorrectFile($cron_path.$cronjob);
|
$cron_file = makeCorrectFile($cron_path.$cronjob);
|
||||||
@@ -77,6 +78,17 @@ function includeCronjobs($debugHandler, $pathtophpfiles)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if we're on realtime and cron_tasks is not one
|
||||||
|
* of the jobs to run, we add it so the changes are being applied
|
||||||
|
*/
|
||||||
|
if ($settings['system']['realtime_port'] !== 0) {
|
||||||
|
$cron_file = makeCorrectFile($cron_path.'/cron_tasks.php');
|
||||||
|
if (!in_array($cron_file, $jobs_to_run)) {
|
||||||
|
$jobs_to_run[] = $cron_file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $jobs_to_run;
|
return $jobs_to_run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,21 +64,23 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($doupdate === true
|
if($doupdate === true
|
||||||
&& (int)$settings['system']['realtime_port'] !== 0)
|
&& (int)$settings['system']['realtime_port'] !== 0
|
||||||
|
&& function_exists('socket_create'))
|
||||||
{
|
{
|
||||||
$timeout = 15;
|
$timeout = 15;
|
||||||
$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
//$socket = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||||
|
$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
|
|
||||||
if($socket !== false)
|
if($socket !== false)
|
||||||
{
|
{
|
||||||
// create the request packet
|
// create the request packet
|
||||||
$packet = chr(0) . chr(1) . 'RUN' . chr(0);
|
$packet = chr(0) . chr(1) . 'RUN' . chr(0);
|
||||||
// UDP is connectionless, so we just send on it.
|
// UDP is connectionless, so we just send on it.
|
||||||
@socket_sendto($socket, $packet, strlen($packet), 0x100, '127.0.0.1', (int)$settings['system']['realtime_port']);
|
//@socket_sendto($socket, $packet, strlen($packet), 0x100, '127.0.0.1', (int)$settings['system']['realtime_port']);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this is for TCP-Connections
|
* this is for TCP-Connections
|
||||||
*
|
*/
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
while(!@socket_connect($socket, '127.0.0.1', (int)$settings['system']['realtime_port']))
|
while(!@socket_connect($socket, '127.0.0.1', (int)$settings['system']['realtime_port']))
|
||||||
@@ -97,7 +99,9 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '')
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
/**
|
||||||
|
* close socket
|
||||||
|
*/
|
||||||
@socket_close($socket);
|
@socket_close($socket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,16 @@ function openRootDB($debugHandler, $lockfile)
|
|||||||
{
|
{
|
||||||
global $db_root;
|
global $db_root;
|
||||||
|
|
||||||
require ('./lib/userdata.inc.php');
|
require dirname(dirname(dirname(__FILE__))).'/userdata.inc.php';
|
||||||
|
|
||||||
|
// Legacy sql-root-information
|
||||||
|
if(isset($sql['root_user']) && isset($sql['root_password']) && (!isset($sql_root) || !is_array($sql_root)))
|
||||||
|
{
|
||||||
|
$sql_root = array(0 => array('caption' => 'Default', 'host' => $sql['host'], 'user' => $sql['root_user'], 'password' => $sql['root_password']));
|
||||||
|
unset($sql['root_user']);
|
||||||
|
unset($sql['root_password']);
|
||||||
|
}
|
||||||
|
|
||||||
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
|
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
|
||||||
|
|
||||||
if($db_root->link_id == 0)
|
if($db_root->link_id == 0)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
service froxlor
|
service froxlor
|
||||||
{
|
{
|
||||||
id = froxlor
|
id = froxlor
|
||||||
socket_type = dgram
|
socket_type = stream
|
||||||
protocol = udp
|
protocol = tcp
|
||||||
wait = no
|
wait = no
|
||||||
|
|
||||||
user = root
|
user = root
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
service froxlor
|
service froxlor
|
||||||
{
|
{
|
||||||
id = froxlor
|
id = froxlor
|
||||||
socket_type = dgram
|
socket_type = stream
|
||||||
protocol = udp
|
protocol = tcp
|
||||||
wait = no
|
wait = no
|
||||||
|
|
||||||
user = root
|
user = root
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
service froxlor
|
service froxlor
|
||||||
{
|
{
|
||||||
id = froxlor
|
id = froxlor
|
||||||
socket_type = dgram
|
socket_type = stream
|
||||||
protocol = udp
|
protocol = tcp
|
||||||
wait = no
|
wait = no
|
||||||
|
|
||||||
user = root
|
user = root
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
service froxlor
|
service froxlor
|
||||||
{
|
{
|
||||||
id = froxlor
|
id = froxlor
|
||||||
socket_type = dgram
|
socket_type = stream
|
||||||
protocol = udp
|
protocol = tcp
|
||||||
wait = no
|
wait = no
|
||||||
|
|
||||||
user = root
|
user = root
|
||||||
|
|||||||
Reference in New Issue
Block a user