Просмотр файла akcii/comm.edit.php

Размер файла: 6.28Kb
<?php
include '../header/config.inc.php';
include '../header/function.inc.php';
include '../header/header.inc.php';
include '../header/connect.inc.php';
include '../header/click-club.class.php';
If (!isset($_GET['log'])) define("anybody","true");
include '../header/enter.inc.php';
include '../ban.php';

If ($_USER['login']){
 @mysql_query("update `".prefix."users` set `mesto`='Редактирует комментарий в акциях', `online`='".time()."' where `id` = '".$_USER['id']."';");

$id		=	intval($_GET['id']);
$news_id = intval($_GET['news_id']);
$text	=	mysql_escape_string(trim($_POST['text']));
$sql	=	mysql_query("SELECT * FROM `akcii_comment` WHERE `id` = '$id'");
if (mysql_num_rows($sql) < '1') {
	header("Location: /akcii/");
}


$sql	=	mysql_query("SELECT * FROM `akcii_comment` WHERE `id` = '$id'");
	$row	=	mysql_fetch_assoc($sql);

	$textt	=	nl2br($row['text']);
	$user	=	$row['user'];
	       if($_USER['login']==$user || $_USER['admin'])  {
if (empty($text)) {



echo '
<div class="downsw"><b>Редактирование</b></div>




';
     if($_USER['java']=='0'){

echo 	<<<HTML
<script language="javascript" type="text/javascript">
function ShowOrHide(d1) {
	  if (d1 != '') DoDiv(d1);
}

function DoDiv(id) {
	  var item = null;
	  if (document.getElementById) {
		item = document.getElementById(id);
	  } else if (document.all){
		item = document.all[id];
	  } else if (document.layers){
		item = document.layers[id];
	  }
	  if (!item) {
	  }
	  else if (item.style) {
		if (item.style.display == "none"){ item.style.display = ""; }
		else {item.style.display = "none"; }
	  }else{ item.visibility = "show"; }
}

function bbcode(text) {
        var txtarea = document.post.text;
        text = '' + text + '';
        if (txtarea.createTextRange && txtarea.caretPos) {
                var caretPos = txtarea.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
                txtarea.focus();
        } else {
                txtarea.value  += text;
                txtarea.focus();
        }
}

</script>

   <div class="menuindex">
<a href="javascript:ShowOrHide('1')">[BBcode]<img src="/images/niz.png" alt="red" title="Развернуть" border="0"/></a> <a href="javascript:ShowOrHide('2')">[Смайлы]<img src="/images/niz.png" alt="red" title="Развернуть" border="0"/></a></div>
<div id="1" style="display:none;"><div class="downsw">
<a href="javascript:bbcode('[red][/red]')"><img src="/includes/bb/re.png" alt="red" title="Красный" border="0"/></a>
<a href="javascript:bbcode('[green][/green]')"><img src="/includes/bb/gr.png" alt="green" title="Зеленый" border="0"/></a>
<a href="javascript:bbcode('[blue][/blue]')"><img src="/includes/bb/bl.png" alt="blue" title="Синий" border="0"/></a>
<a href="javascript:bbcode('[b][/b]')"><img src="/includes/bb/b.png" alt="b" title="Жирный" border="0"/></a>
<a href="javascript:bbcode('[i][/i]')"><img src="/includes/bb/i.png" alt="i" title="Наклонный" border="0"/></a>
<a href="javascript:bbcode('[u][/u]')"><img src="/includes/bb/u.png" alt="u" title="Подчеркнутый" border="0"/></a>
<a href="javascript:bbcode('[s][/s]')"><img src="/includes/bb/s.png" alt="s" title="Зачеркнутый" border="0"/></a>
<a href="javascript:bbcode('[url=][/url]')"><img src="/includes/bb/l.png" alt="url" title="Ссылка" border="0"/></a>
<a href="javascript:bbcode('[c][/c]')"><img src="/includes/bb/q.png" alt="quote" title="Цитата" border="0"/></a>
<a href="javascript:bbcode('[img alt=]http://[/img]')"><img src="/includes/bb/img.png" alt="img" title="Ссылка" border="0"/></a>
<a href="javascript:bbcode('[left][/left]')"><img src="/includes/bb/vl.png" alt="quote" title="Выравнивание влево" border="0"/></a>
<a href="javascript:bbcode('[center][/center]')"><img src="/includes/bb/vc.png" alt="quote" title="Выравнивание по центру" border="0"/></a>
<a href="javascript:bbcode('[right][/right]')"><img src="/includes/bb/vp.png" alt="quote" title="Выравнивание вправо" border="0"/></a>

 </div>

      </div>
      <div id="2" style="display:none;"><div class="downsw">
<a href="javascript:bbcode(':)')"><img src="/smile/1.gif" alt=":)" title=":)" border="0"/></a>
<a href="javascript:bbcode(':(')"><img src="/smile/2.gif" alt=":(" title=":(" border="0"/></a>
<a href="javascript:bbcode('lol')"><img src="/smile/6.gif" alt="lol" title="lol" border="0"/></a>
<a href="javascript:bbcode(':D')"><img src="/smile/7.gif" alt=":D" title=":D" border="0"/></a>
<a href="javascript:bbcode('zloy')"><img src="/smile/8.gif" alt="zloy" title="zloy" border="0"/></a>

<a href="javascript:bbcode('wall')"><img src="/smile/11.gif" alt="wall" title="wall" border="0"/></a>

<a href="javascript:bbcode('=O')"><img src="/smile/12.gif" alt="=O" title="=O" border="0"/></a>

<a href="javascript:bbcode('beer')"><img src="/smile/27.gif" alt="beer" title="beer" border="0"/></a>




 </div>

      </div>
<form action="comm.edit.php?id=$id&amp;news_id=$news_id" name="post" method="POST" onsubmit="return checkForm(this)">
&nbsp;&nbsp;<textarea name="text" rows="6" class="form" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">$textt</textarea>
<br />
&nbsp;&nbsp;<input type="submit"  class="form" value="Добавить" />    <input type="reset" value="Oчиcтить"/>
</form>


HTML;

}
else
{
	echo ' <form action="comm.edit.php?id='.$id.'&amp;news_id='.$news_id.'" name="post" method="POST">
&nbsp;&nbsp;<textarea type="text" name="text" rows="6"/>'.$textt.'</textarea>
<br />
&nbsp;&nbsp;<input type="submit"  class="form" value="Добавить" />    <input type="reset" value="Oчиcтить"/>
</form>';
}

                      echo'<div class="menuindex"><a href="/smiles.php'.$_zapros.'">Смайлы</a> | <a href="/bbkod.php'.$_zapros.'">BB-коды</a></div>';

     include "../header/end.inc.php";


break;

} else {        $user = ''.$_USER['login'].'';


	$sql	=	mysql_query("UPDATE `akcii_comment` SET `text` = '$text' WHERE `id` = '$id'");

	if ($sql) {


header("Location: /akcii/comment.php?news_id=".$news_id);
exit;
	} else {
echo '	<div class="menuindex">
Произошла ошибка!
</div>';
       include "../header/end.inc.php";

break;
	}

}  }
else{echo'<div class="menuindex">Свои сообщения редактируй а не чужие!</div>';}

} else {
	echo '<div class="menuindex">Что бы редактировать сообщения войдите в систему!</div>';
    include "../header/end.inc.php";

break;

}

    include "../header/end.inc.php";

?>