78 */ |
78 */ |
79 |
79 |
80 function process_json($json) |
80 function process_json($json) |
81 { |
81 { |
82 global $db, $session, $paths, $template, $plugins; // Common objects |
82 global $db, $session, $paths, $template, $plugins; // Common objects |
83 $parser = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); |
83 $data = enano_json_decode($json); |
84 $data = $parser->decode($json); |
|
85 $data = decode_unicode_array($data); |
84 $data = decode_unicode_array($data); |
86 if ( !isset($data['mode']) ) |
85 if ( !isset($data['mode']) ) |
87 { |
86 { |
88 $ret = Array('mode'=>'error','error'=>'No mode defined!'); |
87 $ret = Array('mode'=>'error','error'=>'No mode defined!'); |
89 echo $parser->encode($ret); |
88 echo enano_json_encode($ret); |
90 return $ret; |
89 return $ret; |
91 } |
90 } |
92 if ( getConfig('enable_comments') == '0' ) |
91 if ( getConfig('enable_comments') == '0' ) |
93 { |
92 { |
94 $ret = Array('mode'=>'error','error'=>'Comments are not enabled on this site.'); |
93 $ret = Array('mode'=>'error','error'=>'Comments are not enabled on this site.'); |
95 echo $parser->encode($ret); |
94 echo enano_json_encode($ret); |
96 return $ret; |
95 return $ret; |
97 } |
96 } |
98 $ret = Array(); |
97 $ret = Array(); |
99 $ret['mode'] = $data['mode']; |
98 $ret['mode'] = $data['mode']; |
100 $ret['avatar_directory'] = getConfig('avatar_directory'); |
99 $ret['avatar_directory'] = getConfig('avatar_directory'); |