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 '../php/filestorage.class.php';
|
||||||
include '../preferences.php';
|
include '../preferences.php';
|
||||||
include '../php/json.class.php';
|
|
||||||
include '../php/functions.php';
|
include '../php/functions.php';
|
||||||
include '../php/yshout.class.php';
|
include '../php/yshout.class.php';
|
||||||
include '../php/ajaxcall.class.php';
|
include '../php/ajaxcall.class.php';
|
||||||
@ -41,7 +40,7 @@ function doLogin() {
|
|||||||
'html' => cp()
|
'html' => cp()
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ function doLogin() {
|
|||||||
} else
|
} else
|
||||||
$result['error'] = 'invalid';
|
$result['error'] = 'invalid';
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doLogout() {
|
function doLogout() {
|
||||||
@ -63,7 +62,7 @@ function doLogout() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doUnban() {
|
function doUnban() {
|
||||||
@ -74,7 +73,7 @@ function doUnban() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ function doUnban() {
|
|||||||
$result['error'] = 'notbanned';
|
$result['error'] = 'notbanned';
|
||||||
|
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doUnbanAll() {
|
function doUnbanAll() {
|
||||||
@ -103,7 +102,7 @@ function doUnbanAll() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +115,7 @@ function doUnbanAll() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ function doSetPreference() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +149,7 @@ function doSetPreference() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ function doResetPreferences() {
|
|||||||
'error' => false
|
'error' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +176,7 @@ function doResetPreferences() {
|
|||||||
'prefs' => $prefs
|
'prefs' => $prefs
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($result);
|
echo json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CP Display */
|
/* CP Display */
|
||||||
@ -456,4 +455,3 @@ function about() {
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
include '../php/filestorage.class.php';
|
include '../php/filestorage.class.php';
|
||||||
include '../preferences.php';
|
include '../preferences.php';
|
||||||
include '../php/json.class.php';
|
|
||||||
include '../php/functions.php';
|
include '../php/functions.php';
|
||||||
include '../php/yshout.class.php';
|
include '../php/yshout.class.php';
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
$null = null;
|
$null = null;
|
||||||
include 'php/filestorage.class.php';
|
include 'php/filestorage.class.php';
|
||||||
include 'preferences.php';
|
include 'preferences.php';
|
||||||
include 'php/json.class.php';
|
|
||||||
include 'php/functions.php';
|
include 'php/functions.php';
|
||||||
include 'php/yshout.class.php';
|
include 'php/yshout.class.php';
|
||||||
include 'php/ajaxcall.class.php';
|
include 'php/ajaxcall.class.php';
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
$send['error'] = false;
|
$send['error'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doUnban() {
|
function doUnban() {
|
||||||
@ -115,7 +115,7 @@
|
|||||||
$send['error'] = false;
|
$send['error'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
@ -132,7 +132,7 @@
|
|||||||
$send['error'] = false;
|
$send['error'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
|
|
||||||
function banSelf() {
|
function banSelf() {
|
||||||
@ -143,7 +143,7 @@
|
|||||||
$send = array();
|
$send = array();
|
||||||
$send['error'] = false;
|
$send['error'] = false;
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unbanSelf() {
|
function unbanSelf() {
|
||||||
@ -158,7 +158,7 @@
|
|||||||
$send['error'] = 'admin';
|
$send['error'] = 'admin';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
@ -168,7 +168,7 @@
|
|||||||
$posts = $ys->latestPosts($prefs['truncate']);
|
$posts = $ys->latestPosts($prefs['truncate']);
|
||||||
$this->setSessTimestamp($posts);
|
$this->setSessTimestamp($posts);
|
||||||
$this->updates['posts'] = $posts;
|
$this->updates['posts'] = $posts;
|
||||||
echo jsonEncode($this->updates);
|
echo json_encode($this->updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSession() {
|
function initSession() {
|
||||||
@ -186,7 +186,7 @@
|
|||||||
'banned' => true
|
'banned' => true
|
||||||
);
|
);
|
||||||
|
|
||||||
echo jsonEncode($this->updates);
|
echo json_encode($this->updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendUpdates() {
|
function sendUpdates() {
|
||||||
@ -199,7 +199,7 @@
|
|||||||
|
|
||||||
$this->updates['posts'] = $posts;
|
$this->updates['posts'] = $posts;
|
||||||
|
|
||||||
echo jsonEncode($this->updates);
|
echo json_encode($this->updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSessTimestamp(&$posts) {
|
function setSessTimestamp(&$posts) {
|
||||||
@ -231,7 +231,7 @@
|
|||||||
if ($ys->banned(ip()))
|
if ($ys->banned(ip()))
|
||||||
$this->updates['banned'] = true;
|
$this->updates['banned'] = true;
|
||||||
|
|
||||||
echo jsonEncode($this->updates);
|
echo json_encode($this->updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanPrefs($prefs) {
|
function cleanPrefs($prefs) {
|
||||||
@ -253,7 +253,7 @@
|
|||||||
$send['error'] = false;
|
$send['error'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearLogs() {
|
function clearLogs() {
|
||||||
@ -277,7 +277,7 @@
|
|||||||
$send['error'] = false;
|
$send['error'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo jsonEncode($send);
|
echo json_encode($send);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,19 +45,6 @@
|
|||||||
return false;
|
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) {
|
function validIP($ip) {
|
||||||
if ($ip == long2ip(ip2long($ip)))
|
if ($ip == long2ip(ip2long($ip)))
|
||||||
return true;
|
return true;
|
||||||
|
@ -246,7 +246,6 @@ class YShout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ob_start();
|
ob_start();
|
||||||
set_error_handler('errorOccurred');
|
set_error_handler('errorOccurred');
|
||||||
include 'include.php';
|
include 'include.php';
|
||||||
|
|
||||||
if (isset($_POST['reqFor']))
|
if (isset($_POST['reqFor']))
|
||||||
switch($_POST['reqFor']) {
|
switch($_POST['reqFor']) {
|
||||||
case 'shout':
|
case 'shout':
|
||||||
@ -20,20 +22,17 @@ if (isset($_POST['reqFor']))
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
exit;
|
exit;
|
||||||
|
} else {
|
||||||
|
include 'example.html';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
include 'example.html';
|
|
||||||
|
|
||||||
function errorOccurred($num, $str, $file, $line) {
|
function errorOccurred($num, $str, $file, $line) {
|
||||||
$err = array (
|
$err = array (
|
||||||
'yError' => "$str. \n File: $file \n Line: $line"
|
'yError' => "$str. \n File: $file \n Line: $line"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (function_exists('jsonEncode'))
|
echo json_encode($err);
|
||||||
echo jsonEncode($err);
|
|
||||||
else
|
|
||||||
echo $err['yError'];
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user