File size: 3.91Kb
<?
#-----------------------------------------------#
# Аuthor: Nu3oN #
# ICQ : 100-50-97 #
#-----------------------------------------------#
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/'.$config['themes'].'/index.php');
require_once ('distribution/swapping.php');
show_title('partners.gif', ' Анекдоты / Админ-ка');
if (is_admin(array(101,102,103,105)))
{
if (is_file($Dir_db.'/jokes/'.$nCat.'.dat'))
{
if (is_file($Dir_db.'/names/'.$nCat.'.dat'))
{
$_exp = explode(':||:', file_get_contents($Dir_db.'/names/'.$nCat.'.dat'));
$nameCat = $_exp['0'];
}
else
{
$nameCat = $nCat;
}
$opFile = file($Dir_db.'/jokes/'.$nCat.'.dat');
if (isset($opFile[$id]))
{
$_arr = explode(':||:', $opFile[$id]);
$_arr['0'] = str_replace('<br />', "\r\n", nosmiles($_arr['0']));
if (isset($_POST['submit_edit_joke']) and $_POST['submit_edit_joke'])
{
if (isset($_POST['text_joke']) and iconv_strlen($_POST['text_joke'],'UTF-8') > 5 and iconv_strlen($_POST['text_joke'],'UTF-8') < 1000):
$_textJoke = smiles(antimat(no_br(check($_POST['text_joke']), '<br />')));
$_textJoke = no_br($_textJoke.':||:'.$_arr['1'].':||:'.$_arr['2'].':||:'.$_arr['3'].':||:'.$_arr['4'].':||:');
replace_lines($Dir_db.'/jokes/'.$nCat.'.dat', $id, $_textJoke);
header('Refresh: 1; url=index.php?cat='.$nCat.'&'.SID);
echo '<div class="isset"> Анекдот успешно отредатирован </div><br />
<img src="../images/img/back.gif" alt=""> <a href="index.php?cat='.$nCat.'&'.SID.'">'.$nameCat.'</a><br />
<img src="../images/img/back.gif" alt=""> <a href="index.php?'.SID.'">Вернуться</a> <br />
<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;
else: show_error('Ошибка! Слишком длинное или короткое сообщение!<br />'); endif;
}
if (isset($_POST['submit_delete_joke']) and $_POST['submit_delete_joke'])
{
delete_lines($Dir_db.'/jokes/'.$nCat.'.dat', $id);
$_refTot = $_exp['0'].':||:'.(trim($_exp['1']) ? ($_exp['1']-1) : 0).':||:';
replace_lines($Dir_db.'/names/'.$nCat.'.dat', 0, $_refTot);
header('Refresh: 1; url=index.php?cat='.$nCat.'&'.SID);
echo '<div class="isset"> Анекдот успешно удален </div><br />
<img src="../images/img/back.gif" alt=""> <a href="index.php?cat='.$nCat.'&'.SID.'">'.$nameCat.'</a><br />
<img src="../images/img/back.gif" alt=""> <a href="index.php?'.SID.'">Вернуться</a> <br />
<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once ('../themes/'.$config['themes'].'/foot.php'); die;
}
echo '<form action="admin.php?cat='.$nCat.'&id='.$id.'&'.SID.'" method="post">
<div class="b"><textarea cols="55" rows="5" name="text_joke">'.$_arr['0'].'</textarea><br />
Выбери действие:<br />
<input name="submit_edit_joke" type="submit" value=" Редактировать" />
<input name="submit_delete_joke" type="submit" value=" Удалить " />
</div></form>';
}
else
{
show_error('Такого анекдота не существует');
}
echo '<br /><img src="../images/img/back.gif" alt=""> <a href="index.php?cat='.$nCat.'&'.SID.'">'.$nameCat.'</a>';
}
else
{
show_error('Категории не существует');
}
echo '<br /><img src="../images/img/back.gif" alt=""> <a href="index.php?'.SID.'">Вернуться</a> <br />
<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
}
else
{
header ('Location: ../index.php?isset=404&'.SID); die;
}
include_once ('../themes/'.$config['themes'].'/foot.php');
?>