Fix: Miscellaneous fix

This commit is contained in:
Laurent Destailleur 2011-12-05 23:07:18 +01:00
parent 6260553e45
commit 17119f0d51

View File

@ -47,7 +47,7 @@ if (! function_exists('json_encode'))
function json_encode($elements) function json_encode($elements)
{ {
$num = count($elements); $num = count($elements);
// determine type // determine type
if (is_numeric(key($elements))) if (is_numeric(key($elements)))
{ {
@ -77,11 +77,11 @@ if (! function_exists('json_encode'))
} }
$output.= '}'; $output.= '}';
} }
// return // return
return $output; return $output;
} }
function _val($val) function _val($val)
{ {
if (is_string($val)) return '"'.rawurlencode($val).'"'; if (is_string($val)) return '"'.rawurlencode($val).'"';
@ -104,7 +104,7 @@ if (! function_exists('json_decode'))
function json_decode($json, $assoc=false) function json_decode($json, $assoc=false)
{ {
$comment = false; $comment = false;
for ($i=0; $i<strlen($json); $i++) for ($i=0; $i<strlen($json); $i++)
{ {
if (! $comment) if (! $comment)
@ -117,28 +117,28 @@ if (! function_exists('json_decode'))
else $out.= $json[$i]; else $out.= $json[$i];
if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment; if ($json[$i] == '"' && $json[($i-1)]!="\\") $comment = !$comment;
} }
// Return an array // Return an array
eval('$array = '.$out.';'); eval('$array = '.$out.';');
// Return an object // Return an object
if (! $assoc) if (! $assoc)
{ {
if (! empty($array)) if (! empty($array))
{ {
$object = false; $object = false;
foreach ($array as $key => $value) foreach ($array as $key => $value)
{ {
$object->{$key} = $value; $object->{$key} = $value;
} }
return $object; return $object;
} }
return false; return false;
} }
return $array; return $array;
} }
} }
@ -3937,7 +3937,8 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
unset($_SESSION['mesgarray']); unset($_SESSION['mesgarray']);
} }
if (! empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && ! preg_match('/<div class=".*">/i',$out)) // If inline message with no format, we add it.
if ((empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && ! preg_match('/<div class=".*">/i',$out))
{ {
$divstart='<div class="'.$style.'">'; $divstart='<div class="'.$style.'">';
$divend='</div>'; $divend='</div>';
@ -3967,7 +3968,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
if ($out) if ($out)
{ {
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded))
{ {
$return = '<script type="text/javascript"> $return = '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {