sibtracker/system/inc/repa/repa_control.php

183 lines
6.9 KiB
PHP
Raw Permalink Normal View History

2019-05-18 13:46:03 +08:00
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if (!$page)
$page = 1;
echoheader("","");
echo <<<HTML
<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"><EFBFBD><EFBFBD><EFBFBD><EFBFBD></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><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD></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']);
echo <<<HTML
<script type="text/javascript" src="system/ajax/menu.js"></script>
<script language="javascript" type="text/javascript">
<!--
function MenuBuild( m_id ){
var menu=new Array()
var lang_action = "";
menu[0]='<a onClick="document.location=\'?mod=repa&action=vminus&id=' + m_id + '\'; return(false)" href="#">{$lang_repa['avt_minus']} ($vminus_autor)</a>';
menu[1]='<a onClick="document.location=\'?mod=repa&action=vplus&id=' + m_id + '\'; return(false)" href="#">{$lang_repa['avt_plus']} ($vplus_autor)</a>';
menu[2]='<a onClick="javascript:confirmdelete(' + m_id + '); return(false)" href="#">{$lang_repa['full_del']}</a>';
menu[3]='<a onClick="document.location=\'?mod=repa&action=delcom&id=' + m_id + '\'; return(false)" href="#">{$lang_repa['delcom_done']}</a>';
menu[4]='<a onClick="document.location=\'?mod=repa&action=edit&id=' + m_id + '\'; return(false)" href="#">{$lang_repa['edit_this']}</a>';
return menu;
}
function confirmdelete(id)
{
var agree=confirm("{$lang_repa['del_quest']}");
if (agree)
document.location="?mod=repa&action=delete&id="+id;
}
//-->
</script>
HTML;
$query_count = "SELECT COUNT(*) as count from " . USERPREFIX . "_reputation";
$result_count = $db->super_query($query_count);
if ($result_count['count'] == 0)
echo "<br><br><center>{$lang_repa['repa_nothing']}</center><br><br>";
else
{
$all_count_results = $result_count['count'];
$N = 30;
if ( isset($_GET['page']) )
{
$page = intval($_GET['page']);
if ( $page < 1 ) $page = 1;
}
else
{
$page = 1;
}
$cnt_pages = ceil( $result_count['count'] / $N );
if ( $page > $cnt_pages ) $page = $cnt_pages;
$start = ( $page - 1 ) * $N;
$query = $db->query("SELECT * FROM `" . USERPREFIX . "_reputation` ORDER BY `date` DESC LIMIT $start, $N");
if ( $cnt_pages > 1 )
{
echo '<div align="center">&nbsp;'.$lang_repa['repa_pages'];
if ( $page > 3 )
$startpage = '<a title="'.$lang_repa['repa_first_p'].'" href="/'.$config['admin_path'].'?mod=repa&action=control&page=1"><<</a> ... ';
else
$startpage = '';
if ( $page < ($cnt_pages - 2) )
$endpage = ' ... <a title="'.$lang_repa['repa_last_p'].'" href="/'.$config['admin_path'].'?mod=repa&action=control&page='.$cnt_pages.'">>></a>';
else
$endpage = '';
if ( $page - 2 > 0 )
$page2left = ' <a href="/'.$config['admin_path'].'?mod=repa&action=control&page='.($page - 2).'">'.($page - 2).'</a>';
else
$page2left = '';
if ( $page - 1 > 0 )
$page1left = ' <a href="/'.$config['admin_path'].'?mod=repa&action=control&page='.($page - 1).'">'.($page - 1).'</a> ';
else
$page1left = '';
if ( $page + 2 <= $cnt_pages )
$page2right = ' <a href="/'.$config['admin_path'].'?mod=repa&action=control&page='.($page + 2).'">'.($page + 2).'</a> ';
else
$page2right = '';
if ( $page + 1 <= $cnt_pages )
$page1right = ' <a href="/'.$config['admin_path'].'?mod=repa&action=control&page='.($page + 1).'">'.($page + 1).'</a> ';
else
$page1right = '';
echo $startpage.$page2left.$page1left.'<strong>'.$page.'</strong>'.$page1right.$page2right.$endpage."\n";
echo '</div>';
echo '<div style="padding-left:5px; padding-bottom:10px;"><strong>'.$lang_repa['r_total'].' </strong>'. $result_count['count'].'</div>';
}
while ($row = $db->get_row())
{
$res_id = $row['id'];
if ($row['how'] > 0)
$how = "<img src=/templates/$config[skin]/images/repa_up.gif alt=\"{$lang_repa['repa_how_pl']}\">";
if ($row['how'] < 0)
$how = "<img src=/templates/$config[skin]/images/repa_dn.gif alt=\"{$lang_repa['repa_how_mn']}\">";
if ($row['how'] == "totalminus")
$how = "<img src=/templates/$config[skin]/images/repa_adm.png alt=\"{$lang_repa['repa_how_tm']}\">";
if ($row['how'] == "totalplus")
$how = "<img src=/templates/$config[skin]/images/repa_adm_p.png alt=\"{$lang_repa['repa_how_tm']}\">";
$results .= "
<tr>
<td class=\"list\" align=\"center\"><a class=list href=\"?mod=editusers&action=list&search=yes&search_name=".$row[author]."\">".$row[author]."</a></td>
<td class=\"list\" align=\"center\">&nbsp;&nbsp;<a class=list href=\"?mod=editusers&action=list&search=yes&search_name=".$row[komu]."\">".$row[komu]."</a></td>
<td class=\"list\" align=\"center\">$row[date]</td>
<td class=\"list\" align=\"center\">$how</td>
<td class=\"list\" align=\"left\">$row[text]</td>
<td class=\"list\" align=\"center\"><a onClick=\"return dropdownmenu(this, event, MenuBuild('".$res_id."'), '150px')\" href=\"#\"><img src=\"system/skins/images/browser_action.gif\" border=\"0\"></a></td>
</tr>
<tr><td background=\"system/skins/images/mline.gif\" height=1 colspan=6></td></tr>";
}
$db->free();
echo <<<HTML
<table width="100%">
<tr>
<td align="center">{$lang_repa['repa_who']}</td>
<td align="center">{$lang_repa['repa_to']}</td>
<td align="center"><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td>
<td align="center">{$lang_repa['repa_supp']}</td>
<td align="left">{$lang_repa['repa_commst']}</td>
<td align="center">{$lang_repa[vote_action]}</td>
</tr>
<tr><td colspan="6"><div class="hr_line"></div></td></tr>
{$results}
<tr></td></tr>
<tr><td colspan="6"></td></tr>
</table>
HTML;
}
closetable();
echofooter();
closetable();
?>