Code Removal: PHP has had JSON support directly baked into the language since 5.2.0 - there is no need to rely on an external library from 2006 for json support.
This commit is contained in:
parent
efb5038b20
commit
013222e4ee
@ -4,7 +4,6 @@ $kioskMode = false;
|
||||
|
||||
include '../php/filestorage.class.php';
|
||||
include '../preferences.php';
|
||||
include '../php/json.class.php';
|
||||
include '../php/functions.php';
|
||||
include '../php/yshout.class.php';
|
||||
include '../php/ajaxcall.class.php';
|
||||
@ -41,7 +40,7 @@ function doLogin() {
|
||||
'html' => cp()
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,7 +52,7 @@ function doLogin() {
|
||||
} else
|
||||
$result['error'] = 'invalid';
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
function doLogout() {
|
||||
@ -63,7 +62,7 @@ function doLogout() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
function doUnban() {
|
||||
@ -74,7 +73,7 @@ function doUnban() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,7 +91,7 @@ function doUnban() {
|
||||
$result['error'] = 'notbanned';
|
||||
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
function doUnbanAll() {
|
||||
@ -103,7 +102,7 @@ function doUnbanAll() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -116,7 +115,7 @@ function doUnbanAll() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +127,7 @@ function doSetPreference() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,7 +149,7 @@ function doSetPreference() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +161,7 @@ function doResetPreferences() {
|
||||
'error' => false
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -177,7 +176,7 @@ function doResetPreferences() {
|
||||
'prefs' => $prefs
|
||||
);
|
||||
|
||||
echo jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
/* CP Display */
|
||||
@ -456,4 +455,3 @@ function about() {
|
||||
return $html;
|
||||
}
|
||||
|
||||
?>
|
@ -3,7 +3,6 @@
|
||||
|
||||
include '../php/filestorage.class.php';
|
||||
include '../preferences.php';
|
||||
include '../php/json.class.php';
|
||||
include '../php/functions.php';
|
||||
include '../php/yshout.class.php';
|
||||
|
||||
|
@ -2,9 +2,7 @@
|
||||
$null = null;
|
||||
include 'php/filestorage.class.php';
|
||||
include 'preferences.php';
|
||||
include 'php/json.class.php';
|
||||
include 'php/functions.php';
|
||||
include 'php/yshout.class.php';
|
||||
include 'php/ajaxcall.class.php';
|
||||
|
||||
?>
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
||||
$send['error'] = false;
|
||||
}
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
|
||||
function doUnban() {
|
||||
@ -115,7 +115,7 @@
|
||||
$send['error'] = false;
|
||||
}
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
|
||||
function doDelete() {
|
||||
@ -132,7 +132,7 @@
|
||||
$send['error'] = false;
|
||||
}
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
|
||||
function banSelf() {
|
||||
@ -143,7 +143,7 @@
|
||||
$send = array();
|
||||
$send['error'] = false;
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
|
||||
function unbanSelf() {
|
||||
@ -158,7 +158,7 @@
|
||||
$send['error'] = 'admin';
|
||||
}
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
|
||||
function reload() {
|
||||
@ -168,7 +168,7 @@
|
||||
$posts = $ys->latestPosts($prefs['truncate']);
|
||||
$this->setSessTimestamp($posts);
|
||||
$this->updates['posts'] = $posts;
|
||||
echo jsonEncode($this->updates);
|
||||
echo json_encode($this->updates);
|
||||
}
|
||||
|
||||
function initSession() {
|
||||
@ -186,7 +186,7 @@
|
||||
'banned' => true
|
||||
);
|
||||
|
||||
echo jsonEncode($this->updates);
|
||||
echo json_encode($this->updates);
|
||||
}
|
||||
|
||||
function sendUpdates() {
|
||||
@ -199,7 +199,7 @@
|
||||
|
||||
$this->updates['posts'] = $posts;
|
||||
|
||||
echo jsonEncode($this->updates);
|
||||
echo json_encode($this->updates);
|
||||
}
|
||||
|
||||
function setSessTimestamp(&$posts) {
|
||||
@ -231,7 +231,7 @@
|
||||
if ($ys->banned(ip()))
|
||||
$this->updates['banned'] = true;
|
||||
|
||||
echo jsonEncode($this->updates);
|
||||
echo json_encode($this->updates);
|
||||
}
|
||||
|
||||
function cleanPrefs($prefs) {
|
||||
@ -253,7 +253,7 @@
|
||||
$send['error'] = false;
|
||||
}
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
|
||||
function clearLogs() {
|
||||
@ -277,7 +277,7 @@
|
||||
$send['error'] = false;
|
||||
}
|
||||
|
||||
echo jsonEncode($send);
|
||||
echo json_encode($send);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,19 +45,6 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function jsonEncode(&$array) {
|
||||
if ($array) {
|
||||
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
||||
return $json->encode($array);
|
||||
} else
|
||||
return 'ar';
|
||||
}
|
||||
|
||||
function jsonDecode($encoded) {
|
||||
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
||||
return $json->decode($encoded);
|
||||
}
|
||||
|
||||
function validIP($ip) {
|
||||
if ($ip == long2ip(ip2long($ip)))
|
||||
return true;
|
||||
|
@ -246,7 +246,6 @@ class YShout {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ob_start();
|
||||
set_error_handler('errorOccurred');
|
||||
include 'include.php';
|
||||
|
||||
if (isset($_POST['reqFor']))
|
||||
switch($_POST['reqFor']) {
|
||||
case 'shout':
|
||||
@ -20,20 +22,17 @@ if (isset($_POST['reqFor']))
|
||||
|
||||
default:
|
||||
exit;
|
||||
} else {
|
||||
include 'example.html';
|
||||
}
|
||||
else
|
||||
include 'example.html';
|
||||
|
||||
function errorOccurred($num, $str, $file, $line) {
|
||||
$err = array (
|
||||
'yError' => "$str. \n File: $file \n Line: $line"
|
||||
);
|
||||
|
||||
if (function_exists('jsonEncode'))
|
||||
echo jsonEncode($err);
|
||||
else
|
||||
echo $err['yError'];
|
||||
echo json_encode($err);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user