From 2828dfc8709904fa91a8d9454f68a10f0fb1e399 Mon Sep 17 00:00:00 2001 From: Estratos Consulting Date: Thu, 24 Jul 2014 05:46:08 -0600 Subject: [PATCH 1/4] Update index.php Comments about error coming from setting PHP Directive Display Errors to ON Initializing arg1, arg2, ...arg9 ='' may be useful to avoid this problem when calling the API from a script Error logic may break when you get this notifies on the response --- web/api/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/api/index.php b/web/api/index.php index 4ea052279..458342838 100644 --- a/web/api/index.php +++ b/web/api/index.php @@ -26,7 +26,10 @@ if (isset($_POST['user']) || isset($_POST['hash'])) { echo 'Error: only admin is allowed to use API'; exit; } - + // Not Declaring arguments may cause Notifies on the response on an API Call when the Directive Dysplay errors is enabled + // you may initialize argument arg1, arg2,... arg9 to = '' here + // Or post the unused args to ='' + // Prepare arguments if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']); if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']); From 387f673560d81400db85337106f3d50702089603 Mon Sep 17 00:00:00 2001 From: estratos Date: Fri, 25 Jul 2014 20:35:50 -0600 Subject: [PATCH 2/4] Changed cmd Query on Api index.php To avoid "Notice : undefined variables " changed the way the cmd query is built by validating each argument Not empty into the cmd command string --- web/api/index.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/web/api/index.php b/web/api/index.php index 458342838..cbaec6c34 100644 --- a/web/api/index.php +++ b/web/api/index.php @@ -26,9 +26,7 @@ if (isset($_POST['user']) || isset($_POST['hash'])) { echo 'Error: only admin is allowed to use API'; exit; } - // Not Declaring arguments may cause Notifies on the response on an API Call when the Directive Dysplay errors is enabled - // you may initialize argument arg1, arg2,... arg9 to = '' here - // Or post the unused args to ='' + // Prepare arguments if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']); @@ -42,8 +40,27 @@ if (isset($_POST['user']) || isset($_POST['hash'])) { if (isset($_POST['arg8'])) $arg8 = escapeshellarg($_POST['arg8']); if (isset($_POST['arg9'])) $arg9 = escapeshellarg($_POST['arg9']); - // Run query - exec (VESTA_CMD.$cmd." ".$arg1." ".$arg2." ".$arg3." ".$arg4." ".$arg5." ".$arg6." ".$arg7." ".$arg8." ".$arg9, $output, $return_var); + // Build query + $cmdquery = VESTA_CMD.$cmd." ".$arg1." ".$arg2." "; + if(!empty($arg3)){ + $cmdquery = $cmdquery.$arg3." "; } + if(!empty($arg4)){ + $cmdquery = $cmdquery.$arg4." "; } + + if(!empty($arg5)){ + $cmdquery = $cmdquery.$arg5." "; } + if(!empty($arg6)){ + $cmdquery = $cmdquery.$arg6." "; } + if(!empty($arg7)){ + $cmdquery = $cmdquery.$arg7." "; } + if(!empty($arg8)){ + $cmdquery = $cmdquery.$arg8." "; } + if(!empty($arg9)){ + $cmdquery = $cmdquery.$arg9; } + + // Run query + exec ($cmdquery, $output, $return_var); + if ((!empty($_POST['returncode'])) && ($_POST['returncode'] == 'yes')) { echo $return_var; } else { From c9bc37d8b827c8344e2143e8b3ee454e4901f24d Mon Sep 17 00:00:00 2001 From: estratos Date: Fri, 25 Jul 2014 20:45:43 -0600 Subject: [PATCH 3/4] Changed cmd Query on Api index.php To avoid "Notice : undefined variables " changed the way the cmd query is built by validating each argument Not empty into the cmd command string (update) --- web/api/index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/api/index.php b/web/api/index.php index cbaec6c34..80354da07 100644 --- a/web/api/index.php +++ b/web/api/index.php @@ -41,12 +41,16 @@ if (isset($_POST['user']) || isset($_POST['hash'])) { if (isset($_POST['arg9'])) $arg9 = escapeshellarg($_POST['arg9']); // Build query - $cmdquery = VESTA_CMD.$cmd." ".$arg1." ".$arg2." "; - if(!empty($arg3)){ + $cmdquery = VESTA_CMD.$cmd." "; + + if(!empty($arg1)){ + $cmdquery = $cmdquery.$arg1." "; } + if(!empty($arg2)){ + $cmdquery = $cmdquery.$arg2." "; } + if(!empty($arg3)){ $cmdquery = $cmdquery.$arg3." "; } if(!empty($arg4)){ $cmdquery = $cmdquery.$arg4." "; } - if(!empty($arg5)){ $cmdquery = $cmdquery.$arg5." "; } if(!empty($arg6)){ From 065e66c70d403d78ef9a1a8ead64d95f14960c8f Mon Sep 17 00:00:00 2001 From: estratos Date: Sat, 26 Jul 2014 03:48:44 -0600 Subject: [PATCH 4/4] Rusian languaje on Search page Comented Set Locale ru_RU.utf8 , now is on the correct languaje setting --- web/search/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/search/index.php b/web/search/index.php index bdb9a7166..fc5ffd069 100644 --- a/web/search/index.php +++ b/web/search/index.php @@ -25,7 +25,7 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); top_panel($user,$TAB); $lang = 'ru_RU.utf8'; -setlocale(LC_ALL, $lang); +//setlocale(LC_ALL, $lang); // Data if ($_SESSION['user'] == 'admin') {