From 101d972a1489637b76b3190a9c616834fbaa400f Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Mon, 11 Nov 2013 09:59:03 +0100 Subject: [PATCH] fix 'su' on admin-traffic overview, thx Sephi Signed-off-by: Michael Kaufmann (d00p) --- admin_customers.php | 10 +++- admin_traffic.php | 49 ------------------- customer_mysql.php | 3 -- scripts/jobs/cron_tasks.inc.http.30.nginx.php | 4 +- .../Sparkle/admin/traffic/index_table_row.tpl | 2 +- 5 files changed, 12 insertions(+), 56 deletions(-) diff --git a/admin_customers.php b/admin_customers.php index 381400de..7de5d2eb 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -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 { diff --git a/admin_traffic.php b/admin_traffic.php index 9937a025..3469a598 100644 --- a/admin_traffic.php +++ b/admin_traffic.php @@ -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"); diff --git a/customer_mysql.php b/customer_mysql.php index 3e84ef5b..33c248e9 100644 --- a/customer_mysql.php +++ b/customer_mysql.php @@ -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'); diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index c6e0467b..1a50e454 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -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] = ''; } diff --git a/templates/Sparkle/admin/traffic/index_table_row.tpl b/templates/Sparkle/admin/traffic/index_table_row.tpl index 63075792..2874177c 100644 --- a/templates/Sparkle/admin/traffic/index_table_row.tpl +++ b/templates/Sparkle/admin/traffic/index_table_row.tpl @@ -1,5 +1,5 @@ - {$virtual_host['name']} [{$lng['traffic']['details']}] + {$virtual_host['name']} [{$lng['traffic']['details']}] {$virtual_host['jan']} {$virtual_host['feb']} {$virtual_host['mar']}