Author:   Lars Michelsen <[email protected]>
Date:     Wed Jun 13 12:17:45 2012 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Jun 13 12:17:45 2012 +0200

Info page shows json_encode/json_decode capability of used PHP

---

 ChangeLog                                          |    3 +++
 TODO                                               |    1 -
 .../frontend/nagvis-js/classes/NagVisInfoView.php  |    4 +++-
 share/server/core/classes/CoreAuthHandler.php      |    2 +-
 share/server/core/functions/oldPhpVersionFixes.php |    6 ++++++
 share/userfiles/templates/default.info.html        |    2 ++
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 48cc52a..4e04aa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
 1.7b3
 Core
   * Bugfix: Better catching of exceptions on nested maps
+  * Suppressing debug messages in non debug mode
+
 Frontend
   * Bugfix: When releasing relative coordinates the parent object is not 
highlighted anymore
+  * Info page shows json_encode/json_decode capability of used PHP
 
 1.7b2
 Core
diff --git a/TODO b/TODO
index 9b04fe3..75e49bb 100644
--- a/TODO
+++ b/TODO
@@ -3,7 +3,6 @@ This is a small file for storing quick thoughts about new 
features and needed ch
 
 Probleme:
   - Sidebar auf/zu verschiebt Objekte, aber nicht den Hintergrund
-  - Warnings anzeigen, wenn Funktionen aus oldPhpVersionFixes.php angezogen 
werden
 
 Zu tun:
   - Automap zu source umbauen
diff --git a/share/frontend/nagvis-js/classes/NagVisInfoView.php 
b/share/frontend/nagvis-js/classes/NagVisInfoView.php
index 6178053..15e0067 100644
--- a/share/frontend/nagvis-js/classes/NagVisInfoView.php
+++ b/share/frontend/nagvis-js/classes/NagVisInfoView.php
@@ -86,7 +86,9 @@ class NagVisInfoView {
             'userPerms'          => json_encode($userPerms),
             'userAuthModule'     => $AUTH->getAuthModule(),
             'userLogonModule'    => $AUTH->getLogonModule(),
-            'userAuthTrusted'    => ($AUTH->authedTrusted() ? "yes" : "no"),
+            'userAuthTrusted'    => ($AUTH->authedTrusted() ? l("yes") : 
l("no")),
+            'compatJsonEncode'   => (!COMPAT_JSON_ENCODE ? l("yes") : l("no 
(compat mode, may lead to performance problems)")),
+            'compatJsonDecode'   => (!COMPAT_JSON_DECODE ? l("yes") : l("no 
(compat mode, may lead to performance problems)")),
         );
 
         // Build page based on the template file and the data array
diff --git a/share/server/core/classes/CoreAuthHandler.php 
b/share/server/core/classes/CoreAuthHandler.php
index 6bc8c80..292ac4d 100644
--- a/share/server/core/classes/CoreAuthHandler.php
+++ b/share/server/core/classes/CoreAuthHandler.php
@@ -202,7 +202,7 @@ class CoreAuthHandler {
         // Remove logins which were performed with different logon/auth modules
         if($this->SESS->get('logonModule') != cfg('global', 'logonmodule')
            || $this->SESS->get('authModule') != $this->sModuleName) {
-            debug('removing different logon/auth module data');
+            if(DEBUG&&DEBUGLEVEL&2) debug('removing different logon/auth 
module data');
             $this->logout(true);
             return false;
         }
diff --git a/share/server/core/functions/oldPhpVersionFixes.php 
b/share/server/core/functions/oldPhpVersionFixes.php
index 4780b53..4b280be 100644
--- a/share/server/core/functions/oldPhpVersionFixes.php
+++ b/share/server/core/functions/oldPhpVersionFixes.php
@@ -64,6 +64,7 @@ if(function_exists("date_default_timezone_get"))
  * @author     Lars Michelsen <[email protected]>
  */
 if (!function_exists('json_encode')) {
+        define('COMPAT_JSON_ENCODE', True);
        function json_encode($a=false) {
                if (is_null($a)) return 'null';
                if ($a === false) return 'false';
@@ -97,6 +98,8 @@ if (!function_exists('json_encode')) {
                        return '{' . join(',', $result) . '}';
                }
        }
+} else {
+    define('COMPAT_JSON_ENCODE', False);
 }
 
 /**
@@ -110,6 +113,7 @@ if (!function_exists('json_encode')) {
  * @author  Lars Michelsen <[email protected]>
  */
 if(!function_exists('json_decode')){
+        define('COMPAT_JSON_DECODE', True);
 
 if(!class_exists('Services_JSON')) {
        /**
@@ -923,6 +927,8 @@ if(!class_exists('Services_JSON')) {
                                        return $json->decode($content);
                        }
        }
+} else {
+        define('COMPAT_JSON_DECODE', False);
 }
 
 if(!class_exists('PEAR_Error')) {
diff --git a/share/userfiles/templates/default.info.html 
b/share/userfiles/templates/default.info.html
index db61fb7..c1114b8 100644
--- a/share/userfiles/templates/default.info.html
+++ b/share/userfiles/templates/default.info.html
@@ -36,6 +36,8 @@
                 <tr><td>max_execution_time</td><td>{$phpMaxExecTime} 
seconds</td></tr>
                 <tr><td>memory_limit</td><td>{$phpMemoryLimit}</td></tr>
                 <tr><td>loaded modules</td><td>{$phpLoadedExtensions}</td></tr>
+                <tr><td>json_encode</td><td>{$compatJsonEncode}</td></tr>
+                <tr><td>json_decode</td><td>{$compatJsonDecode}</td></tr>
                 <tr><th colspan="2">Client Information</th></tr>
                 <tr><td>USER_AGENT</td><td>{$userAgent}</td></tr>
                 <tr><th colspan="2">Logon Information</th></tr>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to