<?php
/****************************
*
* @file acp.php
* @copy GMC (c) 2010
* @contact ICQ 4884679
* @info free
*
****************************/
include_once './config.inc.php';
include_once './language/'.F_LNG.'.php';
include_once './include/function.inc.php';
include_once './include/acp.inc.php';
if(substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1)=="acp.php")
{
if(!acpAuth($_GET['admUsr'],$_GET['admPwd']))
{
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_auth.tpl';
include_once './skins/tpl/footer.tpl';
exit();
}
//Авторизация
if($_GET['index'] == "logout")
{
acpLogout();
$location = "./index.php";
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_logout_ok.tpl';
include_once './skins/tpl/footer.tpl';
}
//Выход
elseif ($_GET['index'] == "add_cat")
{
$sqlAddCat = "INSERT INTO `".F_DB_PX."category`
(`name`) VALUES ('".$mysqli->real_escape_string($_GET['catName'])."')";
acpAddCat($_GET['catName'], $sqlAddCat, $systemMess);
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_add_cat.tpl';
include_once './skins/tpl/footer.tpl';
}
//Добавить категорию
elseif ($_GET['index'] == "edit_cat")
{
if(empty($_GET['edit_id']))
{
$getCat = "SELECT * FROM `".F_DB_PX."category`";
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_edit_cat.tpl';
include_once './skins/tpl/footer.tpl';
}
else
{
if($_GET['edit'] == "ok")
{
acpEditCat($_GET['edit_id'],$_GET['catName'],$_GET['editActID'],
$_GET['actOrder'],'1',&$systemMess);
}
$getCat = "SELECT * FROM `".F_DB_PX."category` WHERE `id` = ".(int)$_GET['edit_id']."";
$getAct = "SELECT * FROM `".F_DB_PX."action_cat`";
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_edit_cat_id.tpl';
include_once './skins/tpl/footer.tpl';
}
}
//Редактировать категорию
elseif($_GET['index'] == "del_cat")
{
acpDelCat($_GET['delID'], $systemMess);
$getCat = "SELECT * FROM `".F_DB_PX."category`";
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_del_cat.tpl';
include_once './skins/tpl/footer.tpl';
}
//Удалить категорию
elseif ($_GET['index'] == "add_act")
{
$sqlAddCat = "INSERT INTO `".F_DB_PX."action_cat`
(`name`) VALUES ('".$mysqli->real_escape_string($_GET['actName'])."')";
acpAddAct($_GET['actName'], $sqlAddCat, $systemMess);
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_add_act.tpl';
include_once './skins/tpl/footer.tpl';
}
//Добавить подкатегорию
elseif($_GET['index'] == "del_act")
{
acpDelAct($_GET['delID'], $systemMess);
$getAct = "SELECT * FROM `".F_DB_PX."action_cat`";
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_del_act.tpl';
include_once './skins/tpl/footer.tpl';
}
//Удалить подкатегорию
elseif($_GET['index'] == "edit_act")
{
acpEditAct($_GET['editArr'], $systemMess);
$getAct = "SELECT * FROM `".F_DB_PX."action_cat`";
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_edit_act.tpl';
include_once './skins/tpl/footer.tpl';
}
//Редактировать подкатегорию
elseif($_GET['index'] == "view_ann")
{
$p = $_GET['p'] * F_ANN_STR;
if($_GET['view']=="paid")
{
$viewAnn = "SELECT * FROM `".F_DB_PX."announcement`
WHERE `paid` = 0 ORDER BY time_add DESC LIMIT ".(int)$p.", ".F_ANN_STR;
$countAnn = "SELECT count(id) FROM `".F_DB_PX."announcement`
WHERE `paid` = 0";
}
elseif ($_GET['view']=="new")
{
$viewAnn = "SELECT * FROM `".F_DB_PX."announcement`
WHERE `admin_view` = 0 ORDER BY time_add DESC LIMIT ".$p.", ".F_ANN_STR;
$countAnn = "SELECT count(id) FROM `".F_DB_PX."announcement`
WHERE `admin_view` = 0";
}
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_view_ann.tpl';
include_once './skins/tpl/footer.tpl';
}
//Просмотр объявления
elseif($_GET['index'] == "move")
{
$listCat = "SELECT * FROM `".F_DB_PX."category`";
acpMoveAnn($_GET['selectCatFrom'],$_GET['selectCatTo'],$systemMess);
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_move.tpl';
include_once './skins/tpl/footer.tpl';
}
//Переместить объявления
elseif ($_GET['index'] == "edit_ann")
{
$getAnn = "SELECT * FROM `".F_DB_PX."announcement`
WHERE `id` = ".(int)$_GET['edit_id'];
$listCat = "SELECT * FROM `".F_DB_PX."category`";
acpEditAnn($_GET['edit_id'],$_GET['selectCat'],$_GET['catOld'],
$_GET['selectCity'],$_GET['selectEmail'],$_GET['selectText'],
$_GET['selectPhone'],$_GET['selectUrl'],$_GET['send'],$systemMess);
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_edit_ann.tpl';
include_once './skins/tpl/footer.tpl';
}
//Редактировать объявления
elseif ($_GET['index'] == "del_ann")
{
$location = acpAddUrl($_SESSION['back']);
if($_GET['conf']=="ok")
{
acpDelAnn($_GET['edit_id'],$_GET['idc'],$_GET['ida'],$systemMess);
include_once './skins/tpl/header_go.tpl';
}
else include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_del_ann.tpl';
include_once './skins/tpl/footer.tpl';
}
//Удалить объявления
elseif ($_GET['index'] == "unset_paid_ann")
{
acpPaidAnn($_GET['edit_id'],"UNSET",$systemMess);
$location = acpAddUrl($_SERVER['HTTP_REFERER']);
include_once './skins/tpl/header_go.tpl';
include_once './skins/tpl/acp/acp_paid_ann.tpl';
include_once './skins/tpl/footer.tpl';
}
//Снять статус "платное"
elseif ($_GET['index'] == "set_paid_ann")
{
acpPaidAnn($_GET['edit_id'],"SET",$systemMess);
$location = acpAddUrl($_SERVER['HTTP_REFERER']);
include_once './skins/tpl/header_go.tpl';
include_once './skins/tpl/acp/acp_paid_ann.tpl';
include_once './skins/tpl/footer.tpl';
}
//Установить статус "платное"
else {
include_once './skins/tpl/header.tpl';
include_once './skins/tpl/acp/acp_index.tpl';
include_once './skins/tpl/footer.tpl';
}
//Админка
}
?>