fix 'su' on admin-traffic overview, thx Sephi

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-11 09:59:03 +01:00
parent a97c24634b
commit 101d972a14
5 changed files with 12 additions and 56 deletions

View File

@@ -180,7 +180,13 @@ if ($page == 'customers'
'lang' => $result['language']
));
$log->logAction(ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'");
redirectTo('customer_index.php', array('s' => $s), true);
$target = (isset($_GET['target']) ? $_GET['target'] : 'index');
$redirect = "customer_".$target.".php";
if (!file_exists(FROXLOR_INSTALL_DIR."/".$redirect)) {
$redirect = "customer_index.php";
}
redirectTo($redirect, array('s' => $s), true);
} else {
redirectTo('index.php', array('action' => 'login'));
@@ -1005,7 +1011,7 @@ if ($page == 'customers'
$mail->ClearAddresses();
$log->logAction(ADM_ACTION, LOG_NOTICE, "automatically sent password to user '" . $loginname . "'");
}
redirectTo($filename, Array('page' => $page, 's' => $s));
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {

View File

@@ -55,55 +55,6 @@ $months = array(
if ($page == 'overview' || $page == 'customers') {
if ($action == 'su' && $id != 0) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `customerid` = :id" .
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
);
$params = array('id' => $id);
if ($userinfo['customers_see_all'] == '0') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_stmt, params);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['loginname'] != '') {
$result2_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :id"
);
Database::pexecute($result2_stmt, array('id' => $userinfo['userid']));
$result2 = $result2_stmt->fetch(PDO::FETCH_ASSOC);
$s = md5(uniqid(microtime(), 1));
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET
`hash` = :hash,
`userid` = :id,
`ipaddress` = :ip,
`useragent` = :ua,
`lastactivity` = :la,
`language` = :lang,
`adminsession` = '0'
");
$ins_data = array(
'hash' => $s,
'id' => $id,
'ip' => $result['ipaddress'],
'ua' => $result['useragent'],
'la' => time(),
'lang' => $result['language']
);
Database::pexecute($ins_stmt, $ins_data);
redirectTo('customer_traffic.php', array('s' => $s));
} else {
redirectTo('index.php', array('action' => 'login'));
}
}
$customerview = 1;
$stats_tables = '';
$minyear_stmt = Database::query("SELECT `year` FROM `". TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");

View File

@@ -19,9 +19,6 @@
define('AREA', 'customer');
/**
* Include our init.php, which manages Sessions, Language etc.
*/
$need_db_sql_data = true;
$need_root_db_sql_data = true;
require('./lib/init.php');

View File

@@ -289,11 +289,13 @@ class nginx
$result_domains = $this->db->query($query);
while ($domain = $this->db->fetch_array($result_domains)) {
if (is_dir($this->settings['system']['apacheconf_vhost'])) {
safe_exec('mkdir -p '.escapeshellarg(makeCorrectDir($this->settings['system']['apacheconf_vhost'])));
$vhost_filename = $this->getVhostFilename($domain);
}
$vhost_filename = $this->getVhostFilename($domain);
if (!isset($this->nginx_data[$vhost_filename])) {
$this->nginx_data[$vhost_filename] = '';
}

View File

@@ -1,5 +1,5 @@
<tr>
<td>{$virtual_host['name']}<if $customerview == 1>&nbsp;<a href="{$linker->getLink(array('section' => 'traffic', 'page' => $page, 'action' => 'su', 'id' => $virtual_host['customerid']))}" rel="external">[{$lng['traffic']['details']}]</a></if></td>
<td>{$virtual_host['name']}<if $customerview == 1>&nbsp;<a href="{$linker->getLink(array('section' => 'customers', 'target' => 'traffic', 'page' => $page, 'action' => 'su', 'id' => $virtual_host['customerid']))}" rel="external">[{$lng['traffic']['details']}]</a></if></td>
<td style="text-align:right; font-size:10px;">{$virtual_host['jan']}</td>
<td style="text-align:right; font-size:10px;">{$virtual_host['feb']}</td>
<td style="text-align:right; font-size:10px;">{$virtual_host['mar']}</td>