Skip to content

Commit 336322c

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.1' into 'stable-3.1'
# Conflicts: # install/sql/incremental/upd_dev_collection.sql
2 parents e6c50f0 + ff5fe5d commit 336322c

File tree

9 files changed

+79
-14
lines changed

9 files changed

+79
-14
lines changed

install/lib/mysql.lib.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,15 @@ public function query($sQuery = '') {
286286
public function queryOneRecord($sQuery = '') {
287287

288288
$aArgs = func_get_args();
289-
290-
if(!preg_match('/limit \d+\s*,\s*\d+$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
291-
292-
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);
289+
if(!empty($aArgs)) {
290+
$sQuery = array_shift($aArgs);
291+
if($sQuery && !preg_match('/limit \d+(\s*,\s*\d+)?$/i', $sQuery)) {
292+
$sQuery .= ' LIMIT 0,1';
293+
}
294+
array_unshift($aArgs, $sQuery);
295+
}
296+
297+
$oResult = call_user_func_array([&$this, 'query'], $aArgs);
293298
if(!$oResult) return null;
294299

295300
$aReturn = $oResult->get();

install/sql/incremental/upd_0085.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-- folder_directive_snippets was missing in incremental, inserted for fixing older installations
2+
ALTER TABLE `web_domain` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`;
13
ALTER TABLE `web_domain` CHANGE `folder_directive_snippets` `folder_directive_snippets` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
24
ALTER TABLE `web_domain` ADD `log_retention` INT NOT NULL DEFAULT '30' AFTER `https_port`;
35
ALTER TABLE `web_domain` CHANGE `stats_type` `stats_type` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'awstats';

install/sql/incremental/upd_dev_collection.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ ALTER TABLE `dns_rr` CHANGE `type` `type` ENUM('A','AAAA','ALIAS','CNAME','DNAME
3939
-- change cc and sender_cc column type
4040
ALTER TABLE `mail_user` CHANGE `cc` `cc` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
4141
ALTER TABLE `mail_user` CHANGE `sender_cc` `sender_cc` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
42+
43+
-- was missing in incremental, inserted for fixing older installations
44+
ALTER TABLE `web_domain` ADD `folder_directive_snippets` TEXT NULL AFTER `https_port`;

interface/lib/classes/db_mysql.inc.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,15 @@ public function query($sQuery = '') {
356356
public function queryOneRecord($sQuery = '') {
357357

358358
$aArgs = func_get_args();
359-
360-
if(!preg_match('/limit \d+\s*(,\s*\d+)?$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
361-
362-
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);
359+
if(!empty($aArgs)) {
360+
$sQuery = array_shift($aArgs);
361+
if($sQuery && !preg_match('/limit \d+(\s*,\s*\d+)?$/i', $sQuery)) {
362+
$sQuery .= ' LIMIT 0,1';
363+
}
364+
array_unshift($aArgs, $sQuery);
365+
}
366+
367+
$oResult = call_user_func_array([&$this, 'query'], $aArgs);
363368
if(!$oResult) return null;
364369

365370
$aReturn = $oResult->get();

interface/lib/classes/getconf.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function get_security_config($section = '') {
6565
} else {
6666
$app->uses('ini_parser');
6767
$security_config_path = '/usr/local/ispconfig/security/security_settings.ini';
68-
if(!is_file($security_config_path)) $security_config_path = realpath(ISPC_ROOT_PATH.'/../security/security_settings.ini');
68+
if(!is_readable($security_config_path)) $security_config_path = realpath(ISPC_ROOT_PATH.'/../security/security_settings.ini');
6969
$this->security_config = $app->ini_parser->parse_ini_string(file_get_contents($security_config_path));
7070

7171
return ($section == '') ? $this->security_config : $this->security_config[$section];

interface/web/monitor/dataloghistory_view.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,48 @@
5050
$record = $app->db->queryOneRecord('SELECT * FROM sys_datalog WHERE datalog_id = ?', $id);
5151

5252
$out['id'] = $id;
53+
$out['username'] = $record['user'];
5354

5455
$out['timestamp'] = date($app->lng('conf_format_datetime'), $record['tstamp']);
5556
$out['table'] = $record['dbtable'];
57+
list($key, $value) = explode(':', $record['dbidx']);
58+
if (!empty($value)) {
59+
if ($record['action'] == 'd') {
60+
// No link for deleted content.
61+
$out['table_id'] = $record['dbidx'];
62+
} else {
63+
switch ($out['table']) {
64+
case 'mail_forwarding':
65+
$file = 'mail/mail_forward_edit.php';
66+
break;
67+
case 'mail_user':
68+
$file = 'mail/mail_user_edit.php';
69+
break;
70+
case 'mail_domain':
71+
$file = 'mail/mail_domain_edit.php';
72+
break;
73+
case 'web_domain':
74+
$file = 'sites/web_vhost_domain_edit.php';
75+
break;
76+
case 'web_database':
77+
$file = 'sites/database_edit.php';
78+
break;
79+
case 'web_database_user':
80+
$file = 'sites/database_user_edit.php';
81+
break;
82+
83+
// TODO Add a link per content type
84+
default:
85+
$file = '';
86+
}
87+
88+
if (!empty($file)) {
89+
$out['table_id'] = '<a href="#" data-load-content="' . $file . '?id=' . $value
90+
. '" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="link">'
91+
. $record['dbidx'] . '</a>';
92+
}
93+
}
94+
}
5695

5796
$out['action_char'] = $record['action'];
5897
$out['action_name'] = $app->lng($record['action']);

interface/web/monitor/lib/lang/en_dataloghistory_view.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ $wb['new_txt'] = 'New';
2323
$wb['btn_cancel_txt'] = 'Back';
2424
$wb['undo_txt'] = 'Undo action';
2525
$wb['undo_confirmation_txt'] = 'Do you really want to undo this action?';
26+
$wb['username_txt'] = 'Username';
2627
?>

interface/web/monitor/templates/dataloghistory_view.htm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ <h1><tmpl_var name="list_head_txt"></h1>
1212
</tr>
1313
</thead>
1414
<tbody>
15+
<tr>
16+
<td><tmpl_var name="username_txt"></td>
17+
<td><tmpl_var name="username"></td>
18+
</tr>
1519
<tr>
1620
<td><tmpl_var name="timestamp_txt"></td>
1721
<td><tmpl_var name="timestamp"></td>
1822
</tr>
1923
<tr>
2024
<td><tmpl_var name="table_txt"></td>
21-
<td><tmpl_var name="table"></td>
25+
<td><tmpl_var name="table"><tmpl_if name='table_id'> (<tmpl_var name="table_id">)</tmpl_if></td>
2226
</tr>
2327
<tr>
2428
<td><tmpl_var name="action_txt"></td>

server/lib/classes/db_mysql.inc.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,17 @@ public function query($sQuery = '') {
354354
* @return array result row or NULL if none found
355355
*/
356356
public function queryOneRecord($sQuery = '') {
357-
357+
358358
$aArgs = func_get_args();
359-
if(!preg_match('/limit \d+\s*(,\s*\d+)?$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
360-
361-
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);
359+
if(!empty($aArgs)) {
360+
$sQuery = array_shift($aArgs);
361+
if($sQuery && !preg_match('/limit \d+(\s*,\s*\d+)?$/i', $sQuery)) {
362+
$sQuery .= ' LIMIT 0,1';
363+
}
364+
array_unshift($aArgs, $sQuery);
365+
}
366+
367+
$oResult = call_user_func_array([&$this, 'query'], $aArgs);
362368
if(!$oResult) return null;
363369

364370
$aReturn = $oResult->get();

0 commit comments

Comments
 (0)