do not perform sanity checks on each backend request

This commit is contained in:
Andrew Dolgov 2012-07-10 15:24:04 +04:00
parent 383b00906c
commit 545ca06789
3 changed files with 9 additions and 13 deletions

View file

@ -39,7 +39,6 @@
require_once "functions.php"; require_once "functions.php";
require_once "sessions.php"; require_once "sessions.php";
require_once "sanity_check.php";
require_once "config.php"; require_once "config.php";
require_once "db.php"; require_once "db.php";
require_once "db-prefs.php"; require_once "db-prefs.php";
@ -125,12 +124,12 @@
5 => __("Power User"), 5 => __("Power User"),
10 => __("Administrator")); 10 => __("Administrator"));
$error = sanity_check($link); #$error = sanity_check($link);
if ($error['code'] != 0 && $op != "logout") { #if ($error['code'] != 0 && $op != "logout") {
print json_encode(array("error" => $error)); # print json_encode(array("error" => $error));
return; # return;
} #}
function __autoload($class) { function __autoload($class) {
$file = "classes/".strtolower(basename($class)).".php"; $file = "classes/".strtolower(basename($class)).".php";

View file

@ -1,4 +1,7 @@
<?php <?php
define('EXPECTED_CONFIG_VERSION', 25);
define('SCHEMA_VERSION', 92);
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
if (defined('E_DEPRECATED')) { if (defined('E_DEPRECATED')) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

View file

@ -1,6 +1,4 @@
<?php <?php
require_once "functions.php";
function initial_sanity_check($link) { function initial_sanity_check($link) {
$errors = array(); $errors = array();
@ -9,10 +7,6 @@
array_push($errors, "Configuration file not found. Looks like you forgot to copy config.php-dist to config.php and edit it."); array_push($errors, "Configuration file not found. Looks like you forgot to copy config.php-dist to config.php and edit it.");
} else { } else {
define('EXPECTED_CONFIG_VERSION', 25);
define('SCHEMA_VERSION', 92);
require_once "config.php";
require_once "sanity_config.php"; require_once "sanity_config.php";
if (function_exists('posix_getuid') && posix_getuid() == 0) { if (function_exists('posix_getuid') && posix_getuid() == 0) {
@ -20,7 +14,7 @@
} }
if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) { if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
$array_push($errors, "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value."); array_push($errors, "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value.");
} }
$purifier_cache_dir = CACHE_DIR . "/htmlpurifier"; $purifier_cache_dir = CACHE_DIR . "/htmlpurifier";