<?php
/*
=================================================================
Bullet Energy - by White-Master 
-----------------------------------------------------------------
http://white-master.ru/
-----------------------------------------------------------------
Copyright (c) 2011 White-Master
=================================================================
Данный код защищен авторскими правами
=================================================================
Файл: upload.php
=================================================================
*/
@error_reporting(E_ALL ^ E_NOTICE);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@ini_set('error_reporting', E_ALL ^ E_NOTICE);
define('DATALIFEENGINE', true);
define('ROOT_DIR', substr(dirname(__file__), 0, -26));
define('ENGINE_DIR', ROOT_DIR . '/engine');
if (array_key_exists('session', $_POST)) {
  session_id($_POST['session']);
} else {
  die('ERROR AJAX CODE №1');
}
session_start();
require_once ENGINE_DIR . '/classes/mysql.php';
require_once ENGINE_DIR . '/data/dbconfig.php';
require_once ENGINE_DIR . '/modules/functions.php';
require_once ENGINE_DIR . '/modules/sitelogin.php';
$user_group = get_vars("usergroup");
if (!$user_group) {
  $user_group = array();
  $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
  while ($row = $db->get_row()) {
    $user_group[$row['id']] = array();
    foreach ($row as $key => $value) {
      $user_group[$row['id']][$key] = stripslashes($value);
    }
  }
  set_vars("usergroup", $user_group);
  $db->free();
}
if (!is_array($member_id) or !is_string($dle_login_hash)) {
  die('ERROR AJAX CODE №2');
}
check_xss();
$gc = unserialize(@file_get_contents('../cache/system/groups_config.tmp'));
if (!$gc) {
  die('ERROR AJAX CODE №3');
}
if (intval($gc[$member_id['user_group']]['be_upload']) == 0) {
  die('ERROR AJAX CODE №4');
} elseif (intval($gc[$member_id['user_group']]['be_upload']) == 1) {
  if (!empty($_FILES)) {
    require_once '../classes/upload.class.php';
    $upload = new BulletEnergyUpload();
    $upload->save_file();
  } else {
    die('ERROR AJAX CODE №5');
  }
}

?>   