From d86fb7ed23d4e61a2ee4d4cc2ba289581b177098 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Fri, 31 Jul 2015 10:44:33 +0200 Subject: [PATCH] avoid empty value for makeCorrectDir as the assert-check runs before evaluating to / in certain places Signed-off-by: Michael Kaufmann (d00p) --- customer_domains.php | 2 +- customer_extras.php | 10 +++++----- customer_ftp.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/customer_domains.php b/customer_domains.php index 416f3e4b..2e0fb0f2 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -141,7 +141,7 @@ if ($page == 'overview') { foreach ($domain_array as $row) { if (strpos($row['documentroot'], $userinfo['documentroot']) === 0) { - $row['documentroot'] = makeCorrectDir(substr($row['documentroot'], strlen($userinfo['documentroot']))); + $row['documentroot'] = makeCorrectDir(substr($row['documentroot'], strlen($userinfo['documentroot']) - 1)); } // get ssl-ips if activated diff --git a/customer_extras.php b/customer_extras.php index 4c88883c..def51907 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -53,7 +53,7 @@ if ($page == 'overview') { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { if ($paging->checkDisplay($i)) { if (strpos($row['path'], $userinfo['documentroot']) === 0) { - $row['path'] = substr($row['path'], strlen($userinfo['documentroot'])); + $row['path'] = substr($row['path'], strlen($userinfo['documentroot']) - 1); } $row = htmlentities_array($row); @@ -86,7 +86,7 @@ if ($page == 'overview') { redirectTo($filename, array('page' => $page, 's' => $s)); } else { if (strpos($result['path'], $userinfo['documentroot']) === 0) { - $result['path'] = substr($result['path'], strlen($userinfo['documentroot'])); + $result['path'] = substr($result['path'], strlen($userinfo['documentroot']) - 1); } ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')'); @@ -302,11 +302,11 @@ if ($page == 'overview') { AND `id`= :id" ); Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); - $log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); + $log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'"); inserttask('1'); redirectTo($filename, array('page' => $page, 's' => $s)); } else { - ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '', $result['path'])); + ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '/', $result['path'])); } } } elseif ($action == 'add') { @@ -438,7 +438,7 @@ if ($page == 'overview') { "id" => $id ); Database::pexecute($stmt, $params); - $log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); + $log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'"); } redirectTo($filename, array('page' => $page, 's' => $s)); diff --git a/customer_ftp.php b/customer_ftp.php index 0a86b43d..606ae86e 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -57,7 +57,7 @@ if ($page == 'overview') { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { if ($paging->checkDisplay($i)) { if (strpos($row['homedir'], $userinfo['documentroot']) === 0) { - $row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot'])); + $row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot']) - 1); } else { $row['documentroot'] = $row['homedir']; }