fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6634] API : check for suhosin.get. max_value_length


From: Sigurd Nes
Subject: [Fmsystem-commits] [6634] API : check for suhosin.get. max_value_length in order to use combine for js
Date: Fri, 03 Dec 2010 09:19:17 +0000

Revision: 6634
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6634
Author:   sigurdne
Date:     2010-12-03 09:19:17 +0000 (Fri, 03 Dec 2010)
Log Message:
-----------
API : check for suhosin.get.max_value_length in order to use combine for js

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.js.inc.php
    trunk/setup/manageheader.php

Modified: trunk/phpgwapi/inc/class.js.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.js.inc.php 2010-12-02 22:30:23 UTC (rev 6633)
+++ trunk/phpgwapi/inc/class.js.inc.php 2010-12-03 09:19:17 UTC (rev 6634)
@@ -118,6 +118,17 @@
                */
                public function get_script_links()
                {
+                       $combine = true;
+                       if(ini_get('suhosin.get.max_value_length') && 
ini_get('suhosin.get.max_value_length') < 2000)
+                       {
+                               $combine = false;
+                               
if(isset($GLOBALS['phpgw_info']['user']['apps']['admin']))
+                               {
+                                       $receipt = array();
+                                       $receipt['error'][]=array('msg'=> 
'Speed could be gained from setting suhosin.get.max_value_length = 2000 in 
php.ini');
+                                       phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                               }
+                       }
                        $links = "<!--JS Imports from phpGW javascript class 
-->\n";
                        $jsfiles = array();
                        if (is_array($this->files) && count($this->files))
@@ -132,20 +143,34 @@
                                                        {
                                                                foreach ($files 
as $file => $ignored)
                                                                {
-                                                                       // Add 
file path to array and replace path separator with "--" for URL-friendlyness
-                                                                       
$jsfiles[] = str_replace('/', '--', "{$app}/js/{$pkg}/{$file}.js");
+                                                                       
if($combine)
+                                                                       {
+                                                                               
// Add file path to array and replace path separator with "--" for 
URL-friendlyness
+                                                                               
$jsfiles[] = str_replace('/', '--', "{$app}/js/{$pkg}/{$file}.js");
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
//echo "file: 
{$GLOBALS['phpgw_info']['server']['webserver_url']}/{$app}/js/{$pkg}/{$file}.js 
<br>";
+                                                                               
$links .= '<script type="text/javascript" '
+                                                                               
. 
"src=\"{$GLOBALS['phpgw_info']['server']['webserver_url']}/{$app}/js/{$pkg}/{$file}.js\">"
+                                                                               
. "</script>\n";
+                                                                       }
                                                                }
                                                        }
                                                }
                                        }
                                }
                        }
-                       $cachedir = 
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
-                       $jsfiles = implode(',', $jsfiles);
-                       $links .= '<script type="text/javascript" '
+
+                       if($combine)
+                       {
+                               $cachedir = 
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
+                               $jsfiles = implode(',', $jsfiles);
+                               $links .= '<script type="text/javascript" '
                                        . 
"src=\"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files={$jsfiles}\">"
                                        . "</script>\n";
-                       unset($jsfiles);
+                               unset($jsfiles);
+                       }
 
                        return $links;
                }

Modified: trunk/setup/manageheader.php
===================================================================
--- trunk/setup/manageheader.php        2010-12-02 22:30:23 UTC (rev 6633)
+++ trunk/setup/manageheader.php        2010-12-03 09:19:17 UTC (rev 6634)
@@ -277,10 +277,7 @@
                        {
                                if (ini_get('suhosin.get.max_value_length') < 
2000)
                                {
-                                       $detected .= '<b><p align="center" 
class="msg">'
-                                               . lang('You need to set 
suhosin.get.max_value_length = 2000'). "\n"
-                                               . 
'</p></b><td></tr></table></body></html>';
-                                       die($detected);
+                                       $get_max_value_length = '<li 
class="warn">Speed could be gained from setting suhosin.get.max_value_length = 
2000 in php.ini'. "</li>\n";
                                }
                                else
                                {
@@ -614,7 +611,7 @@
                                $setup_tpl->set_var('comment_r',' -->');
 
                                
$GLOBALS['phpgw_info']['server']['header_admin_password'] = '';
-                               
$GLOBALS['phpgw_info']['server']['db_persistent'] = false;
+                               
$GLOBALS['phpgw_info']['server']['db_persistent'] = true;
                                
$GLOBALS['phpgw_info']['server']['sessions_type'] = 'php';
 //                             
$GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = extension_loaded('mcrypt');
                                
$GLOBALS['phpgw_info']['server']['show_domain_selectbox'] = false;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]