Fix: Must work with PHP 5.*

This commit is contained in:
Laurent Destailleur
2011-11-05 03:15:35 +01:00
parent de8018a5f0
commit c819b3b87c
2 changed files with 17 additions and 13 deletions

View File

@@ -31,6 +31,22 @@
*/
if (! function_exists('json_encode'))
{
/**
* Implement json_encode for PHP that does not support it
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function json_encode($elements)
{
if (is_array($elements)) return '["' . join('","', $elements) . '"]';
else return '"'.$elements.'"';
}
}
/**
* Return a DoliDB instance (database handler).
*
@@ -52,18 +68,6 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
}
/**
* This function output memory used by PHP and exit everything. Used for debugging purpose.
*
* @return void
*/
function dol_stopwithmem()
{
print memory_get_usage();
llxFooter();
exit;
}
/**
* Function called at end of web php process
*
@@ -77,6 +81,7 @@ function dol_shutdown()
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].($disconnectdone?' (Warn: db disconnection forced)':''), ($disconnectdone?LOG_WARNING:LOG_DEBUG));
}
/**
* Return value of a param into GET or POST supervariable
*

View File

@@ -232,7 +232,6 @@ if (! empty($conf->file->main_force_https))
if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/core/class/menu.class.php"); // Need 10ko memory (11ko in 2.2)
if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); // Need 660ko memory (800ko in 2.2)
if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once(DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'); // Need 22ko memory
//dol_stopwithmem();
// If install or upgrade process not done or not completely finished, we call the install page.
if (! empty($conf->global->MAIN_NOT_INSTALLED) || ! empty($conf->global->MAIN_NOT_UPGRADED))