[icinga-checkins] icinga.org: icinga-web/mhein/testing: * Made api more tolerant, added slash to folder definition in logging.xml.in

git at icinga.org git at icinga.org
Thu Aug 11 16:44:11 CEST 2011


Module: icinga-web
Branch: mhein/testing
Commit: 634bb915dd45dc075cf8c65b82d6cd6f61334b80
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=634bb915dd45dc075cf8c65b82d6cd6f61334b80

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Thu Aug 11 16:13:06 2011 +0200

* Made api more tolerant, added slash to folder definition in logging.xml.in

---

 app/config/logging.xml.in                         |    4 ++--
 app/modules/Api/actions/ApiSearchAction.class.php |    7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/app/config/logging.xml.in b/app/config/logging.xml.in
index 1de9938..415d380 100755
--- a/app/config/logging.xml.in
+++ b/app/config/logging.xml.in
@@ -47,14 +47,14 @@
 			-->
 			<appender name="UniversalLogfileAppender" class="AgaviRotatingFileLoggerAppender" layout="ApacheStyle">
 				<ae:parameters>
-					<ae:parameter name="dir">@web_log_folder@</ae:parameter>
+					<ae:parameter name="dir">@web_log_folder@/</ae:parameter>
 					<ae:parameter name="prefix">icinga-web-</ae:parameter>
 				</ae:parameters>
 			</appender>
 			
 			<appender name="DebugLogfileAppender" class="AgaviRotatingFileLoggerAppender" layout="ApacheStyle">
 				<ae:parameters>
-					<ae:parameter name="dir">@web_log_folder@</ae:parameter>
+					<ae:parameter name="dir">@web_log_folder@/</ae:parameter>
 					<ae:parameter name="prefix">debug-</ae:parameter>
 				</ae:parameters>
 			</appender>
diff --git a/app/modules/Api/actions/ApiSearchAction.class.php b/app/modules/Api/actions/ApiSearchAction.class.php
index ec371fe..231128b 100644
--- a/app/modules/Api/actions/ApiSearchAction.class.php
+++ b/app/modules/Api/actions/ApiSearchAction.class.php
@@ -130,7 +130,8 @@ class Api_ApiSearchAction extends IcingaApiBaseAction {
 
         // POST filter definitions
         $advFilter = $rd->getParameter("filters",array());
-
+        if(!is_array($advFilter))
+            $advFilter = array($advFilter);
         foreach($advFilter as $fl) {
             $fl["value"] = str_replace("*","%",$fl["value"]);
             $search->setSearchFilter($fl["column"],$fl["value"],$fl["relation"]);
@@ -145,6 +146,8 @@ class Api_ApiSearchAction extends IcingaApiBaseAction {
         }
 
         $filterGroup = $search->createFilterGroup($filterdef["type"]);
+        if(!is_array($filterGroup))
+            $filterGroup = array($filterGroup);
         foreach($searchField as $element) {
             if ($element["type"] == "atom") {
                 $filterGroup->addFilter($search->createFilter($element["field"][0],$element["value"][0],$element["method"][0]));
@@ -195,6 +198,8 @@ class Api_ApiSearchAction extends IcingaApiBaseAction {
         }
         
         $columns = $rd->getParameter("columns",null);
+        if(!is_array($columns))
+            $columns = array($columns);
         foreach($columns as &$column) {
            $column = preg_replace("/[^1-9_A-Za-z]/","",$column);
            $column = strtoupper($column);





More information about the icinga-checkins mailing list