46
           
            
                
     
    
    Quote:
phppp wrote:
Quote:
Peekay wrote:
my question is, why has this method been changed and what benefits in terms of speed, efficiency and security are we gaining from that change? 
It is not a good change and I also have the same question.
Unfortunately it is too late to revert or refactor many similar changes in 2.4*.
It seems at this moment the practical solution is to keep as it as and provide patches once bugs are discovered.
+1
Regarding the patches provided, I guess it would be easier to patch the module instead of patching the core.
In xhelp/servicemain.php, right after this lines:
 //Include XOOPS Global Includes 
error_reporting(E_ALL); //Enable Error Reporting 
$xoopsOption['nocommon'] = 1; 
 
require '../../mainfile.php';  
you could add additional code required for 2.4.x class and files.
Example:
 //Include XOOPS Global Includes 
error_reporting(E_ALL); //Enable Error Reporting 
$xoopsOption['nocommon'] = 1; 
 
require '../../mainfile.php'; 
 
/*** ADDING CODE HERE ***/ 
if (version_compare(PHP_VERSION, '5.3.0', '<')) { 
    set_magic_quotes_runtime(0); 
} 
 
global $xoops, $xoopsPreload, $xoopsLogger, $xoopsErrorHandler, $xoopsSecurity, $sess_handler; 
 
/** 
 * YOU SHOULD NEVER USE THE FOLLOWING TO CONSTANTS, THEY WILL BE REMOVED 
 */ 
defined('DS') or define('DS', DIRECTORY_SEPARATOR); 
defined('NWLINE')or define('NWLINE', "n"); 
 
/** 
 * Include files with definitions 
 */ 
include_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'defines.php'; 
include_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'version.php'; 
include_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'license.php'; 
 
/** 
 * Include XoopsLoad 
 */ 
require_once XOOPS_ROOT_PATH . DS . 'class' . DS . 'xoopsload.php'; 
 
/** 
 * YOU SHOULD BE CAREFUL WITH THE PRELOAD METHODS IN 2.4*, THEY WILL BE DEPRECATED AND IMPLEMENTED IN A DIFFERENT WAY 
 */ 
/** 
 *  Create Instance of Preload Object 
 */ 
XoopsLoad::load('preload'); 
$xoopsPreload =& XoopsPreload::getInstance(); 
$xoopsPreload->triggerEvent('core.include.common.start'); 
 
/** 
 * YOU SHOULD BE CAREFUL WITH THE {@xos_kernel_Xoops2}, MOST METHODS WILL BE DEPRECATED 
 */ 
/** 
 * Create Instance of xos_kernel_Xoops2 Object 
 * Atention, not all methods can be used at this point 
 */ 
XoopsLoad::load('xoopskernel'); 
$xoops = new xos_kernel_Xoops2(); 
$xoops->pathTranslation(); 
$xoopsRequestUri =& $_SERVER['REQUEST_URI'];// Deprecated (use the corrected $_SERVER variable now)  
This should solve the missing $xoops global and the preload class required by database class.
Not tested.