<?php

if(!defined('DATALIFEENGINE'))
{
  die("Hacking attempt!");
}

$id = intval($_REQUEST['id']);

if ($id == 0)
	msg("info", $langms['sea_info'], "Вы ничего не выбрали.<br><br><input type='button' value=\" {$lang_repa['repa_go_back']} \" class='bbcodes' onclick=\"window.location='$PHP_SELF?mod=repa&action=control'\">", "");
else
{
	include_once SYSTEM_DIR.'/classes/parse.class.php';
	$parse = new ParseFilter();
	include_once SYSTEM_DIR . '/ajax/bbcode.php';

	if ($_POST['submit'])
	{
		$new = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['reason'] ), false ));
		$db->query("UPDATE `".USERPREFIX."_reputation` SET `text`='$new' WHERE `id`='$id'");
		msg("info", $langms['sea_info'], "{$lang_repa['repa_msg_chd']}<br><br><input type='button' value=\" {$lang_repa['repa_go_back']} \" class='bbcodes' onclick=\"window.location='$PHP_SELF?mod=repa&action=control'\">", "");
	}
	else
	{
		echoheader("","");

echo <<<HTML

<script language="javascript" type="text/javascript">
function ins_smile ( text ){
	doInsert(' ' + text + ' ', '', false);

	document.getElementById('dle_emo').style.visibility = "hidden";
	document.getElementById('dle_emo').style.display    = "none";
	ie_range_cache = null;
};
</script>

<table width="100%">
    <tr>
        <td width="4"><img src="system/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
        <td background="system/skins/images/tl_oo.gif"><img src="system/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
        <td width="6"><img src="system/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
    </tr>
    <tr>
        <td background="system/skins/images/tl_lb.gif"><img src="system/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
        <td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
    <tr>
        <td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">Меню</div></td>
    </tr>
</table>
<div class="unterline"></div>
<table width="100%">
    <tr>
HTML;
echo  "<td width=\"260\" style=\"padding:4px;\"><a href=\"".$config['http_home_url'].$config['admin_path']."?mod=repa\"><b>Главное меню</b></a></td>";
echo <<<HTML
     </tr>
    <tr>
        <td colspan="2"><div class="hr_line"></div></td>
    </tr>
</table>
</td>
        <td background="system/skins/images/tl_rb.gif"><img src="system/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
    </tr>
    <tr>
        <td><img src="system/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
        <td background="system/skins/images/tl_ub.gif"><img src="system/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
        <td><img src="system/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
    </tr>
</table>
</div>
HTML;

		opentable();
		tableheader($lang_repa['repa_cntrl']);

		$res = $db->super_query("SELECT * FROM ".PREFIX."_reputation where id = '$id'");
		if ($res['id'] == $id)
		{

			$text = $parse->decodeBBCodes( $res['text'], false );

echo <<<HTML
<form action="" method="post" name="ajaxcomments{$id}" id="ajaxcomments{$id}">
<table width="100%">
<tr>
<td style="padding:4px;width:400px;" class="option"><b>{$lang_repa['repa_comm_ed']}</b></td>
<td align=middle>{$bb_code}<textarea style="width:99%;height:100px;" class="f_textarea" name="reason" id="dleeditcomments{$id}">{$text}</textarea></td>
</tr>
<tr><td background="/system/skins/images/mline.gif" height=1 colspan=2></td></tr>
<tr>
<td>&nbsp;</td>
<td style="padding-top:10px; padding-bottom:10px;padding-right:10px;" align=right>
<input type=hidden name=mod value=repa>
<input type=hidden name=action value=edit>
<input class="buttons" type="submit" value="{$lang_repa['repa_done']}" name="submit" style="width:100px;"></td>
</tr></table></form>
HTML;

		}
		else
		{
			@header("Location: $PHP_SELF?mod=repa&action=control");
		}
		closetable();
		echofooter();
		closetable();
	}
}

?>