217 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			217 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
|  | <?php | |||
|  | 
 | |||
|  | if(!defined('DATALIFEENGINE')) | |||
|  | { | |||
|  |   die("Hacking attempt!"); | |||
|  | } | |||
|  | 
 | |||
|  |     //----------------------------------
 | |||
|  |     // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  |     //----------------------------------
 | |||
|  | 
 | |||
|  | $stats = array(); | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_reputation"); | |||
|  | $stats['changes'] = $row['count']; | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_reputation WHERE how > '0'"); | |||
|  | $stats['incr'] = $row['count']; | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_reputation WHERE how < '0'"); | |||
|  | $stats['decr'] = $row['count']; | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_reputation WHERE how = 'totalminus'"); | |||
|  | $stats['tot_m'] = $row['count']; | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_reputation WHERE how = 'totalplus'"); | |||
|  | $stats['tot_p'] = $row['count']; | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".USERPREFIX."_users WHERE repa_off='1'"); | |||
|  | $stats['repa_off'] = $row['count']; | |||
|  | $row = $db->super_query("SELECT COUNT(*) as count FROM ".USERPREFIX."_users WHERE r_freeze='1'"); | |||
|  | $stats['r_freeze'] = $row['count']; | |||
|  | 
 | |||
|  | function show_stats() { | |||
|  | global $repa_cf, $stats, $lang, $lang_repa; | |||
|  | 
 | |||
|  | if ($repa_cf['status'] == 'yes') $repastatus = '<span style="color: #009933; font-weight: bold;">'.$lang_repa['repa_st_on'].'</span>'; | |||
|  | else $repastatus = '<span style="color: #FF0000; font-weight: bold;">'.$lang_repa['repa_st_off'].''; | |||
|  | echo "<table width=\"100%\">
 | |||
|  | <tr> | |||
|  | <td style=\"padding:2px;\">{$lang_repa['repa_st_st']}</td><td>{$repastatus}</td>
 | |||
|  | </tr> | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_ca']}</td><td>{$stats['changes']}</td>
 | |||
|  | </tr> | |||
|  | <tr><td background=\"system/skins/images/mline.gif\" height=1 colspan=7></td></tr>
 | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_in']}</td><td>{$stats['incr']}</td>
 | |||
|  | </tr> | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_tot_p']}</td><td>{$stats['tot_p']}</td>
 | |||
|  | </tr> | |||
|  | <tr><td background=\"system/skins/images/mline.gif\" height=1 colspan=7></td></tr>
 | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_es']}</td><td>{$stats['decr']}</td>
 | |||
|  | </tr> | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_tot_m']}</td><td>{$stats['tot_m']}</td>
 | |||
|  | </tr> | |||
|  | <tr><td background=\"system/skins/images/mline.gif\" height=1 colspan=7></td></tr>
 | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_repa_off']}</td><td>{$stats['repa_off']}</td>
 | |||
|  | </tr> | |||
|  | <tr> | |||
|  | <td width=\"265\" style=\"padding:2px;\">{$lang_repa['repa_st_freeze']}</td><td>{$stats['r_freeze']}</td>
 | |||
|  | </tr> | |||
|  | <tr><td background=\"system/skins/images/mline.gif\" height=1 colspan=7></td></tr>
 | |||
|  | <tr> | |||
|  | </table> | |||
|  | <form enctype='multipart/form-data' method='post'><table width=\"100%\"><tr><td style=\"padding-top:10px;\">
 | |||
|  | <input type=\"hidden\" name=\"save_moderation\" value=\"1\">
 | |||
|  | <input class=\"edit\" style=\"width:160px;\" type=\"submit\" value=\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\">
 | |||
|  | </td></tr></table></form> | |||
|  | ";
 | |||
|  | } | |||
|  |     echoheader("options", $lang_repa['repa_options']); | |||
|  | 
 | |||
|  | 	$options = array(); | |||
|  | 
 | |||
|  |     $options['menu'] = array( | |||
|  | 
 | |||
|  |                     array( | |||
|  |                     'name'       	=> $lang_repa['repa_m_opts'], | |||
|  |                     'url'        	=> "$PHP_SELF?mod=repa&action=opt", | |||
|  | 					'descr'      	=> $lang_repa['repa_m_sub'], | |||
|  | 					'image'      	=> "repa_opt.png", | |||
|  |                     'access'     	=> "1", | |||
|  |                     ), | |||
|  | 
 | |||
|  |                     array( | |||
|  |                        'name'       => $lang_repa['repa_control'], | |||
|  |                        'url'        => "$PHP_SELF?mod=repa&action=control", | |||
|  | 					   'descr'      => $lang_repa['repa_con_sub'], | |||
|  | 					   'image'      => "repa_control.png", | |||
|  |                        'access'     => "1", | |||
|  |                     ), | |||
|  | 
 | |||
|  | 
 | |||
|  |      ); | |||
|  | 
 | |||
|  | foreach($options as $sub_options => $value) | |||
|  | { | |||
|  |     $count_options = count($value); | |||
|  | 
 | |||
|  |     for($i=0; $i < $count_options; $i++){ | |||
|  |     	if($member_db[1] > $value[$i]['access'] AND $value[$i]['access'] != "all"){ | |||
|  | 			unset($options[$sub_options][$i]); | |||
|  |         } | |||
|  |     } | |||
|  | } | |||
|  | 
 | |||
|  | $subs = 0; | |||
|  | 
 | |||
|  | foreach($options as $sub_options) | |||
|  | { | |||
|  | 
 | |||
|  | if (!count($sub_options)) continue; | |||
|  | 
 | |||
|  | echo <<<HTML | |||
|  | <div style="padding-top:5px;padding-bottom:2px;"> | |||
|  | <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">{$lang['opt_hopt']}</div></td> | |||
|  |     </tr> | |||
|  | </table> | |||
|  | <div class="unterline"></div><table width="100%"><tr> | |||
|  | HTML; | |||
|  | 
 | |||
|  | $i=0; | |||
|  | 
 | |||
|  | foreach($sub_options as $option) | |||
|  | { | |||
|  | 
 | |||
|  | if ($i > 1) {echo "</tr><tr>"; $i=0;} | |||
|  | 
 | |||
|  | $i++; | |||
|  | 
 | |||
|  | echo <<<HTML | |||
|  | <td width="50%"> | |||
|  | <table width="100%"> | |||
|  |     <tr> | |||
|  |         <td width="70" height="70" valign="middle" align="center" style="padding-top:5px;padding-bottom:5px;"><img src="system/skins/images/{$option['image']}" border="0"></td> | |||
|  |         <td valign="middle"><div class="quick"><a href="{$option['url']}"><h3>{$option['name']}</h3>{$option['descr']}</a></div></td> | |||
|  |     </tr> | |||
|  | </table> | |||
|  | </td> | |||
|  | HTML; | |||
|  | 
 | |||
|  | } | |||
|  | 
 | |||
|  | echo <<<HTML | |||
|  | </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; | |||
|  | 
 | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | if ($_REQUEST['save_moderation']) | |||
|  | { | |||
|  | 	include_once SYSTEM_DIR.'/data/repa.php'; | |||
|  | 	$user = $db->query("SELECT user_id, name, repa FROM ".PREFIX."_users");   | |||
|  | 	while ($row = $db->get_row($user)) | |||
|  | 	{ | |||
|  | 		$repa_plus = 0; | |||
|  | 		$repa_minus = 0; | |||
|  | 		$repa_pereschet = $db->query("SELECT * FROM " . PREFIX . "_reputation WHERE komu = '$row[name]'"); | |||
|  | 		while ($row_min = $db->get_row($repa_pereschet)) | |||
|  | 		{ | |||
|  | 			if ($row_min['how'] < 0 OR $row_min['how'] == "totalminus") | |||
|  | 			{ | |||
|  | 				if ($row_min['how'] == "totalminus") | |||
|  | 					$repa_minus = $repa_minus + $repa_cf['adm_minus']; | |||
|  | 				else | |||
|  | 					$repa_minus = $repa_minus + $row_min['how']; | |||
|  | 			} | |||
|  | 			else | |||
|  | 			{ | |||
|  | 				if ($row_min['how'] == "totalplus") | |||
|  | 					$repa_plus = $repa_plus + $repa_cf['adm_plus']; | |||
|  | 				else | |||
|  | 					$repa_plus = $repa_plus + $row_min['how']; | |||
|  | 			} | |||
|  | 		} | |||
|  | 		$db->free($repa_pereschet); | |||
|  | 		$repa_sum = $repa_plus + $repa_minus; | |||
|  | 		$repa_mod = $repa_plus."|".$repa_minus; | |||
|  | 
 | |||
|  | 		$db->query("UPDATE " . USERPREFIX . "_users set repa='$repa_sum' WHERE user_id = '$row[user_id]'"); | |||
|  | 		$db->query("UPDATE " . USERPREFIX . "_users set repa_mod='$repa_mod' WHERE user_id = '$row[user_id]'"); | |||
|  | 	} | |||
|  | 	$db->free($user); | |||
|  | 	header( "Location: {$_SERVER['REQUEST_URI']}" ); | |||
|  | } | |||
|  | 
 | |||
|  | // ********************************************************************************
 | |||
|  | // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  | // ********************************************************************************
 | |||
|  | 	opentable(); | |||
|  | 	tableheader($lang_repa['repa_stats']); | |||
|  | 	show_stats(); | |||
|  | 	closetable(); | |||
|  |     	echofooter(); | |||
|  | 
 | |||
|  | ?>
 |