Пример #1
0
require_once __CHV_PATH_INCLUDES__ . 'template.functions.php';
/*** Set some url paths ***/
define('__CHV_URL_SYSTEM_JS__', absolute_to_url(__CHV_PATH_SYSTEM_JS__));
define('__CHV_URL_THEME__', absolute_to_url(__CHV_PATH_THEME__));
define('__CHV_URL_UPDATE_SCRIPT__', __CHV_BASE_URL__ . 'update.php');
// Virtual paths
define('__CHV_VIRTUALFOLDER_IMAGE__', sanitize_path($config['virtual_folder_image']));
define('__CHV_VIRTUALFOLDER_UPLOADED__', sanitize_path($config['virtual_folder_uploaded']));
/*** Call the dB class ***/
require_once __CHV_PATH_CLASSES__ . 'class.db.php';
$dB = new dB();
/*** Call the Login class ***/
require_once __CHV_PATH_CLASSES__ . 'class.login.php';
$Login = new Login();
/*** Call the ShortURL class ***/
require_once __CHV_PATH_CLASSES__ . 'class.shorturl.php';
$ShortURL = new ShortURL();
/*** Flood protection ***/
if (preg_match('/upload/', access)) {
    $flood = is_upload_flood();
}
/*** maintenance ***/
if (preg_match('/upload|API|pref/', access) && chevereto_config('maintenance')) {
    status_header(400);
    die('maintenance');
}
/*** Call the handler ***/
if (check_value(access) && !preg_match("/API|update|pref/", access)) {
    require_once __CHV_PATH_CLASSES__ . 'class.handler.php';
    $handler = new Handler();
}
Пример #2
0
  --------------------------------------------------------------------- */
if (!defined('access') or !access) {
    die('This file cannot be directly accessed.');
}
/*** Session ***/
if (array_key_exists('sID', $_REQUEST)) {
    session_id($_REQUEST['sID']);
}
@session_start();
/** Block the invalid request ***/
if (is_invalid_request()) {
    json_output(array('error' => 'true', 'errorMsg' => 'bad request'));
}
/*** Detect Flood ***/
if (is_upload_flood()) {
    json_output(array('error' => 'true', 'errorMsg' => 'flood detected'));
}
/*** Ask for credentials ***/
if (is_config_private_mode() && !is_logged_user()) {
    json_output(array('error' => 'true', 'errorMsg' => 'login needed'));
}
/** Call the upload class ***/
require_once __CHV_PATH_CLASSES__ . 'class.upload.php';
$upload = new Upload($to_upload);
if ($is_remote) {
    $upload->is_remote = true;
}
$upload->img_upload_path = __CHV_PATH_IMAGES__;
if (isset($to_resize)) {
    $upload->resize_width = $to_resize;