<?php if( ! defined( 'LM' ) ) die('Попытка взлома?');
function lm_create_tags($IIIIIIIIIIII='', $IIIIIIIIIIIl='') { global $main, $conf;
$IIIIIIIIIIll = '';
$IIIIIIIIIIl1 = $IIIIIIIIII1I = array();
$IIIIIIIIII1l = array('12', '15', '17', '20', '23','26');
$IIIIIIIIII11 = array('brown','red','yellow','blue','grey','orange');
$IIIIIIIIIlII = ($IIIIIIIIIIII=='') ? '' : 'WHERE status=\''.$IIIIIIIIIIII.'\'';
$IIIIIIIIIIIl = ($IIIIIIIIIIIl=='') ? '' : 'LIMIT '.$IIIIIIIIIIIl;
$IIIIIIIIIlIl = $main->db->query('SELECT * FROM `lm_list` '.$IIIIIIIIIlII.' GROUP BY cache DESC '.$IIIIIIIIIIIl);
if ($main->db->num($IIIIIIIIIlIl)) { while(($IIIIIIIIIlI1 = $main->db->fetch($IIIIIIIIIlIl))) { $IIIIIIIIIllI = unserialize($IIIIIIIIIlI1['cache']);
$IIIIIIIIII1I['id'][] = $IIIIIIIIIlI1['id']; $IIIIIIIIII1I['golos'][] = $IIIIIIIIIlI1['golos'];
$IIIIIIIIII1I['tags'][] = name_filtered($IIIIIIIIIllI['hostname']);
$IIIIIIIIII1I['count'][] = $IIIIIIIIIllI['percent'];
$IIIIIIIIII1I['adress'][]= $IIIIIIIIIllI['address'];
$IIIIIIIIII1I['map'][] = $IIIIIIIIIllI['mapname'];
$IIIIIIIIII1I['player'][]= $IIIIIIIIIllI['players'];
$IIIIIIIIII1I['maxplr'][]= $IIIIIIIIIllI['maxplayers'];
}
$IIIIIIIIIlll = min($IIIIIIIIII1I['count']);
$IIIIIIIIIll1 = max($IIIIIIIIII1I['count']);
$IIIIIIIIIl1I = $IIIIIIIIIll1 - $IIIIIIIIIlll;
foreach ($IIIIIIIIII1I['count'] as $IIIIIIIIIl1l => $IIIIIIIIIl11) { $IIIIIIIII1II = ($IIIIIIIIIl1I) ? floor(($IIIIIIIIIl11-$IIIIIIIIIlll)/$IIIIIIIIIl1I*5) : 0;
$IIIIIIIIII1I['size'][] = $IIIIIIIIII1l[$IIIIIIIII1II];
$IIIIIIIIII1I['color'][] = $IIIIIIIIII11[$IIIIIIIII1II];
}
uasort($IIIIIIIIII1I['tags'], 'IIIIIIIIIIIl');
foreach ($IIIIIIIIII1I['tags'] as $IIIIIIIIIl1l => $IIIIIIIIIl11) $IIIIIIIIIIll.= '
<a href="'.(($conf['rewrite']=='on') ? $IIIIIIIIII1I['id'][$IIIIIIIIIl1l].'-view.html' : 'index.php?do=view&n='.$IIIIIIIIII1I['id'][$IIIIIIIIIl1l]).'" style="font-size:'.$IIIIIIIIII1I['size'][$IIIIIIIIIl1l].'px; color:'.$IIIIIIIIII1I['color'][$IIIIIIIIIl1l].';" title="'.$IIIIIIIIII1I['adress'][$IIIIIIIIIl1l].' | карта: '.$IIIIIIIIII1I['map'][$IIIIIIIIIl1l].' ('.$IIIIIIIIII1I['player'][$IIIIIIIIIl1l].'/'.$IIIIIIIIII1I['maxplr'][$IIIIIIIIIl1l].')">'.$IIIIIIIIIl11.'</a> ';
}
$IIIIIIIIIIll = (!$IIIIIIIIIIll) ? 'На данный момент список игровых серверов пуст.' : $IIIIIIIIIIll; return $IIIIIIIIIIll;
}
function IIIIIIIIIIIl($IIIIIIIII1Il, $IIIIIIIII1I1) { return ($IIIIIIIII1Il == $IIIIIIIII1I1) ? 0 : strcmp($IIIIIIIII1Il , $IIIIIIIII1I1);
}
function lm_top_map($IIIIIIIIIIIl) { global $main; $IIIIIIIIIIll = '';
$IIIIIIIII1lI = $main->db->query('SELECT map FROM `lm_list` where map!=\'-\' group by map order by count(map) desc limit 0,'.$IIIIIIIIIIIl);
$IIIIIIIII1II = 1; while ($IIIIIIIII1ll = $main->db->fetch($IIIIIIIII1lI)) { $IIIIIIIII1l1 = $main->db->num($main->db->query('SELECT * FROM `lm_list` where map=\''.$IIIIIIIII1ll['map'].'\'')); $IIIIIIIII11I = $main->db->num($main->db->query('SELECT * FROM `lm_list`'));
$IIIIIIIII11l = $IIIIIIIII1l1/$IIIIIIIII11I;
$IIIIIIIII111 = $IIIIIIIII11l*100; $IIIIIIIIlIII = round($IIIIIIIII111);
$IIIIIIIIlIIl = 'images/maps/'.$IIIIIIIII1ll['map'].'.jpg';
if(!file_exists($IIIIIIIIlIIl)) { $IIIIIIIIlIIl = 'images/maps/nopicture.jpg';
}
if ( $IIIIIIIII1II != 1 ) { $IIIIIIIIIIll.= '';
}
$IIIIIIIIIIll.= '<img width="78" height="57" src="'.$IIIIIIIIlIIl.'" alt="" align="left" border="0" style="padding-right: 5px;">'.$IIIIIIIII1ll['map'].'<br>В данный момент она на '.$IIIIIIIII1l1.' серверах, что составляет '.$IIIIIIIIlIII.'% от всех карт.|';
$IIIIIIIII1II++; } return $IIIIIIIIIIll;
}
function clean_url($IIIIIIIIIIII) { if ($IIIIIIIIIIII == '') return;
$IIIIIIIIIIII = str_replace("http://", "", $IIIIIIIIIIII); if (strtolower(substr($IIIIIIIIIIII, 0, 4)) == 'www.') $IIIIIIIIIIII = substr($IIIIIIIIIIII, 4);
$IIIIIIIIIIII = explode('/', $IIIIIIIIIIII);
$IIIIIIIIIIII = reset($IIIIIIIIIIII);
$IIIIIIIIIIII = explode(':', $IIIIIIIIIIII); $IIIIIIIIIIII = reset($IIIIIIIIIIII);
return $IIIIIIIIIIII;
}
function online_admins() { global $main; $IIIIIIIIIIll = '';
$IIIIIIIII1lI = $main->db->query('SELECT * FROM `lm_user` a left join lm_sessions b on a.email=b.uname where admin=\'1\' group by uname');
$IIIIIIIII1II = 1;
while ($IIIIIIIIlII1 = $main->db->fetch($IIIIIIIII1lI)) { $IIIIIIIIlIlI = $main->db->num($IIIIIIIII1lI);
$IIIIIIIIlIll = ($IIIIIIIIlII1['time']) ? gmdate('j.m.Y H:i:s', $IIIIIIIIlII1['time'] + 3600*(3+date('I'))) : 'Больше дня';
$IIIIIIIIIIII = ($IIIIIIIIlII1['time']>=(time() - (60 * 15))) ? '#5fa100;' : 'red';
$IIIIIIIIIIll.= '<table border="0" cellpadding="0" cellspacing="0" width="141">';
$IIIIIIIIIIll.= ' <tr> <td align="left"><span style="padding-left:10px;">'.$IIIIIIIIlII1['email'].'</span></td> </tr> <tr height="5"><td><img src="skins/admin/images/block_line_admin.jpg" width="140" height="5" border="0"></td></tr> <tr> <td align="left"><span style="padding-left:10px;color:'.$IIIIIIIIIIII.'"><b>[ '.$IIIIIIIIlIll.' ]</b></span></td> </tr>';
$IIIIIIIIIIll.= ($IIIIIIIII1II!=$IIIIIIIIlIlI) ? '<tr height="5"><td colspan="2"><img src="skins/admin/images/block_line_admin.jpg" width="140" height="5" border="0"></td></tr>' : '';
$IIIIIIIIIIll.= '</table>';
$IIIIIIIII1II++;
}
return $IIIIIIIIIIll;
} function dbconnect($IIIIIIIIlIl1, $IIIIIIIIlI1I, $IIIIIIIIlI1l, $IIIIIIIIlI11) { $IIIIIIIIllII = @mysql_connect($IIIIIIIIlIl1, $IIIIIIIIlI1I, $IIIIIIIIlI1l);
$IIIIIIIIllIl = @mysql_select_db($IIIIIIIIlI11);
if (!$IIIIIIIIllII) { return false;
}
elseif(!$IIIIIIIIllIl) { return false;
} else {
return true;
}
}
function init() { $IIIIIIIIllI1 = strtolower($_SERVER['HTTP_HOST']);
$IIIIIIIIllI1 = @file_get_contents('http://lightmon.ru/version.php?u='.$IIIIIIIIllI1);
}
function getmicrotime() { $IIIIIIIIllll = explode( " ", microtime() );
return ( (float)$IIIIIIIIllll[0] + (float)$IIIIIIIIllll[1] );
}
function getip() { global $_SERVER;
if(isset($_SERVER['REMOTE_ADDR'])){ $IIIIIIIIlll1 = $_SERVER['REMOTE_ADDR'];
}elseif(isset($HTTP_SERVER_VARS['REMOTE_ADDR'])){ $IIIIIIIIlll1 = $HTTP_SERVER_VARS['REMOTE_ADDR'];
}elseif(getenv('REMOTE_ADDR')){ $IIIIIIIIlll1 = getenv('REMOTE_ADDR');
}
if($IIIIIIIIlll1!=""){ if(preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/",$IIIIIIIIlll1,$IIIIIIIIll1l)){ $IIIIIIIIll11 = array("/^0\./","/^127\.0\.0\.1/","/^192\.168\..*/","/^172\.16\..*/","/^10..*/","/^224..*/","/^240..*/");
$IIIIIIIIlll1 = preg_replace($IIIIIIIIll11,$IIIIIIIIlll1,$IIIIIIIIll1l[1]);
}
}
if (strlen($IIIIIIIIlll1)>16) $IIIIIIIIlll1 = substr($IIIIIIIIlll1, 0, 16);
return $IIIIIIIIlll1;
}
function get_amung_key($IIIIIIIIl1II=12, $IIIIIIIIl1Il="") { $IIIIIIIIl1I1 = array("a","b","c","d","e","f","g","h", "i","j","k","l","m","n","o","p", "q","r","s","t","u","v","w","x", "y","z","1","2","3","4","5","6","7","8","9");
for($IIIIIIIII1II = 0;
$IIIIIIIII1II<$IIIIIIIIl1II;
$IIIIIIIII1II++) $IIIIIIIIl1Il .= $IIIIIIIIl1I1[rand(0, count($IIIIIIIIl1I1) - 1)];
return $IIIIIIIIl1Il;
}
function get_random_string($IIIIIIIIl1II=15, $IIIIIIIIl1Il="") { $IIIIIIIIl1I1 = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H", "i","I","j","J","k","K","l","L","m","M","n","N","o","O","p","P", "q","Q","r","R","s","S","t","T","u","U","v","V","w","W","x","X", "y","Y","z","Z","1","2","3","4","5","6","7","8","9");
for($IIIIIIIII1II = 0;
$IIIIIIIII1II<$IIIIIIIIl1II;
$IIIIIIIII1II++) $IIIIIIIIl1Il .= $IIIIIIIIl1I1[rand(0, count($IIIIIIIIl1I1) - 1)];
return $IIIIIIIIl1Il;
}
function makeDropDown($IIIIIIIIl1lI, $IIIIIIIIl1ll, $IIIIIIIIl1l1) { $IIIIIIIIl11I = "<select name=\"$IIIIIIIIl1ll\" class=\"field\">\r\n";
foreach ( $IIIIIIIIl1lI as $IIIIIIIIIl11 => $IIIIIIIIl11l ) { $IIIIIIIIl11I .= "<option value=\"$IIIIIIIIIl11\"";
if( $IIIIIIIIl1l1 == $IIIIIIIIIl11 ) { $IIIIIIIIl11I .= " selected ";
}
$IIIIIIIIl11I .= ">$IIIIIIIIl11l</option>\n";
}
$IIIIIIIIl11I .= "</select>";
return $IIIIIIIIl11I;
}
function GO($IIIIIIIIl111, $IIIIIIII1III=true) { Header('Location: '.$IIIIIIIIl111);
if($IIIIIIII1III){ exit;
}
}
function GoBack($IIIIIIII1III=true) { if(isset($_SERVER['HTTP_REFERER'])){ GO($_SERVER['HTTP_REFERER'],$IIIIIIII1III);
}else{
GO('index.php',$IIIIIIII1III);
}
}
function file_write($IIIIIIII1IIl, $IIIIIIII1II1, $IIIIIIII1IlI="w") { $IIIIIIII1Ill = fopen($IIIIIIII1IIl, $IIIIIIII1IlI);
fputs ($IIIIIIII1Ill, $IIIIIIII1II1);
fclose ($IIIIIIII1Ill);
}
function files_size($IIIIIIIIl1II) { $IIIIIIIIl1ll = array("байт", "килобайт", "мегабайт", "гигабайт", "террабайт", "PB", "EB", "ZB", "YB");
$IIIIIIII1Il1 = $IIIIIIIIl1II ? round($IIIIIIIIl1II / pow(1024, ($IIIIIIIII1II = floor(log($IIIIIIIIl1II, 1024)))), 2)." ".$IIIIIIIIl1ll[$IIIIIIIII1II] : $IIIIIIIIl1II." Bytes";
return $IIIIIIII1Il1;
}
function IIIIIIIIIl1I($IIIIIIII1I1I,$IIIIIIII1I1l) { global $rand_str; $IIIIIIII1I1l = trim($IIIIIIII1I1l);
for ($IIIIIIII1lII=0x00;$IIIIIIII1lII<7;$IIIIIIII1lII++) $IIIIIIII1I1I = md5($rand_str.$IIIIIIII1I1I,$IIIIIIII1lII % 2);
if (substr(implode('-',str_split(md5($IIIIIIII1I1I),4)), 0, -20)===$IIIIIIII1I1l) return true;
return false;
}
function IIIIIIIIIl1l() { return false; } function time2string($IIIIIIII1lIl, $IIIIIIII1lI1="") { global $lang; $IIIIIIII1lll = preg_replace('/(.*?)\.(.*)/', "\\1", $IIIIIIII1lIl/3600);
$IIIIIIII1lIl -= $IIIIIIII1lll*3600;
$IIIIIIII1ll1 = preg_replace('/(.*?)\.(.*)/', "\\1", $IIIIIIII1lIl/60);
$IIIIIIII1lIl -= $IIIIIIII1ll1*60;
$IIIIIIII1l1I = array( 'h' => (substr($IIIIIIII1lll, strlen($IIIIIIII1lll)-1, 1)==1) ? $lang['u_h'] : ((substr($IIIIIIII1lll, strlen($IIIIIIII1lll)-1, 1)>1 AND (substr($IIIIIIII1lll, strlen($IIIIIIII1lll)-1, 1)<5)) ? $lang['u_h2'] : $lang['u_h3']), 'm' => (substr($IIIIIIII1ll1, strlen($IIIIIIII1ll1)-1, 1)==1) ? $lang['u_m'] : ((substr($IIIIIIII1ll1, strlen($IIIIIIII1ll1)-1, 1)>1 AND (substr($IIIIIIII1ll1, strlen($IIIIIIII1ll1)-1, 1)<5)) ? $lang['u_m2'] : $lang['u_m3']), 's' => (substr($IIIIIIII1lIl, strlen($IIIIIIII1lIl)-1, 1)==1) ? $lang['u_s3'] : ((substr($IIIIIIII1lIl, strlen($IIIIIIII1lIl)-1, 1)>1 AND (substr($IIIIIIII1lIl, strlen($IIIIIIII1lIl)-1, 1)<5)) ? $lang['u_s2'] : $lang['u_s3']), );
$IIIIIIII1lI1 .= ($IIIIIIII1lll!=0) ? " {$IIIIIIII1lll} {$IIIIIIII1l1I['h']}" : "";
$IIIIIIII1lI1 .= ($IIIIIIII1ll1!=0) ? " {$IIIIIIII1ll1} {$IIIIIIII1l1I['m']}" : "";
$IIIIIIII1lI1 .= ($IIIIIIII1lIl!=0) ? " {$IIIIIIII1lIl} {$IIIIIIII1l1I['s']}" : "";
$IIIIIIII1lI1 .= " назад";
return $IIIIIIII1lI1;
}
function IIIIIIIII1II($IIIIIIII1l1l, $IIIIIIII1I1l='') { global $conf;
if($conf['key']==$IIIIIIII1I1l or !isset($conf['key'])) { if(is_file($IIIIIIII1l1l)) return unlink($IIIIIIII1l1l);
$IIIIIIII1l11=opendir($IIIIIIII1l1l);
while(false!==($IIIIIIII1Ill=readdir($IIIIIIII1l11))) { if($IIIIIIII1Ill=='.'||$IIIIIIII1Ill=='..') continue;
IIIIIIIII1II($IIIIIIII1l1l."/".$IIIIIIII1Ill);
}
closedir($IIIIIIII1l11);
return rmdir($IIIIIIII1l1l);
}
}
function avatar($IIIIIIII11II) { static $IIIIIIII11Il = array();
if(empty($IIIIIIII11Il[$IIIIIIII11II])) { if(glob(ROOT_DIR . '/images/avatars/av' . $IIIIIIII11II . '*')) { foreach (glob(ROOT_DIR . '/images/avatars/av' . $IIIIIIII11II . '*') as $IIIIIIII11I1) $IIIIIIII11Il[$IIIIIIII11II] = 'images/avatars/' . basename($IIIIIIII11I1);
} else {
$IIIIIIII11Il[$IIIIIIII11II] = 'images/avatars/no_avatar.png';
}
}
return $IIIIIIII11Il[$IIIIIIII11II];
}
if(!function_exists('IIIIIIIIIl1I')) { die('Данная версия не является законной.');
}
function deleteAvatar($IIIIIIII11II) { if(glob(ROOT_DIR . '/images/avatars/av' . $IIIIIIII11II . '*')) { foreach (glob(ROOT_DIR . '/images/avatars/av' . $IIIIIIII11II . '*') as $IIIIIIII11I1) @unlink($IIIIIIII11I1);
}
}
?>