Просмотр файла gb/admin.php

Размер файла: 13.47Kb
<?
/*
GB(v1.0) by Viktor
icq:357332321
site: http://yarap.ru
http://xwab.ru/forum/profile656
[admin pamel]
*/
include('incl/head.php');

if($_SESSION['adm']<>1)
    {
    if($_GET['error']<>NULL)$template->assign_block_vars("error", array(
        "ERROR"=>$l[2]));
    $template->assign_vars(array(
        "INDEX"=>$l[1],
        "PASS"=>$l[3],
        "TEXT"=>$l[4],
        "AVTORIZ"=>$l[5]));
    $template->set_filenames(array(
            'body' => 'a.tpl'));
    }
else
    {
    $m=$_GET['m'];
    if($m=='reklama')
        {
        $template->set_filenames(array(
                'body' => 'admin_reklama.tpl'));
        $res1=query("SELECT * FROM ".$pref."reklama WHERE id<0");
        while ($row1=row($res1))
            {
            $template->assign_block_vars("rek1", array(
                "K"=>$row1['k'],
                "LINK"=>$row1['link'],
                "TEXT"=>$row1['text'],
                "ID"=>$row1['id']));
            $i1++;
            }
        $res2=query("SELECT * FROM ".$pref."reklama WHERE id>0");
        while ($row2=row($res2))
            {
            $template->assign_block_vars("rek2", array(
                "K"=>$row2['k'],
                "LINK"=>$row2['link'],
                "TEXT"=>$row2['text'],
                "ID"=>$row2['id']));
            $i2++;
            }
        $res3=query("SELECT * FROM ".$pref."baners");
        while ($row3=row($res3))
            {
            $template->assign_block_vars("baners", array(
                "TEXT"=>$row3['text'],
                "ID"=>$row3['id']));
            $i3++;
            }
        if ($i1==0)$template->assign_block_vars("rek10", array("L"=>$l[11]));
        if ($i2==0)$template->assign_block_vars("rek20", array("L"=>$l[11]));
        if ($i3==0)$template->assign_block_vars("baners0", array("L"=>$l[11]));
        $template->assign_vars(array(
            "BANERS"=>$l[24],
            "DEL"=>$l[12],
            "ADD"=>$l[10],
            "MENU"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "REK1"=>$l[8],
            "REK2"=>$l[9]));
        }
    elseif($m=='reklama_add')
        {
        $template->set_filenames(array(
                'body' => 'admin_reklama_add.tpl'));
        $i=intval($_GET['i']);
        if($i<>1)$i=-1;
        $template->assign_vars(array(
            "TEXT"=>$l[13],
            "COLOR"=>$l[14],
            "LINK"=>$l[15],
            "B"=>$l[16],
            "KURSIV"=>$l[17],
            "U"=>$l[18],
            "REKLAMA"=>$l[7],
            "I"=>$i,
            "ADD"=>$l[10],
            "MENU"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "REK"=>($i==1) ? $l[9] : $l[8]));
        }
    elseif($m=='baners_add')
        {
        $template->set_filenames(array(
                'body' => 'admin_baners_add.tpl'));
        $i=intval($_GET['i']);
        if($i<>1)$i=-1;
        $template->assign_vars(array(
            "TEXT"=>$l[13],
            "REKLAMA"=>$l[7],
            "ADD"=>$l[10],
            "BANERS"=>$l[24],
            "MENU"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin));
        }
    elseif($m=='config')
        {
        $template->set_filenames(array(
            'body' => 'admin_config.tpl'));
        $sql_title2=sql("SELECT * FROM ".$pref."config WHERE c='title2'");
        $title2=$sql_title2['o'];
        if(sql("SELECT * FROM ".$pref."config WHERE c='http' AND o='1'"))$http_c=' checked="checked"';
        if(sql("SELECT * FROM ".$pref."config WHERE c='code' AND o='1'"))$code=' checked="checked"';
        if(sql("SELECT * FROM ".$pref."config WHERE c='online' AND o='1'"))$online=' checked="checked"';
        if(sql("SELECT * FROM ".$pref."config WHERE c='close' AND o='1'"))$close=' checked="checked"';
        $email=sql("SELECT * FROM ".$pref."config WHERE c='mail'");
        $max=sql("SELECT * FROM ".$pref."config WHERE c='max_name'");
        $max_name=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='min_name'");
        $min_name=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='max_text'");
        $max_text=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='min_text'");
        $min_text=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='gb'");
        $gb=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='site'");
        $site=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='pagin'");
        $pagin=$max['o'];
        $max=sql("SELECT * FROM ".$pref."config WHERE c='lang'");
        $lang=$max['o'];
        $res_lang=query("SELECT * FROM ".$pref."lang");
        while($row=row($res_lang))
            {
            $template->assign_block_vars("lang", array(
                "ID"=>$row['id'],
                "CH"=>($row['id']==$lang) ? " selected" : "",
                "NAME"=>$row['name']));
            }
        $template->assign_vars(array(
            "CLOSE"=>$close,
            "SCLOSE"=>$l[104],
            "ONLINE"=>$online,
            "SONLINE"=>$l[102],
            "CODE"=>$l[85],
            "SCODE"=>$code,
            "LANG"=>$l[81],
            "PAGIN"=>$l[62],
            "SPAGIN"=>$pagin,
            "GB"=>$l[61],
            "SITE"=>$l[60],
            "SGB"=>$gb,
            "SSITE"=>$site,
            "MAX_NAME"=>$max_name,
            "MAX_TEXT"=>$max_text,
            "MIN_NAME"=>$min_name,
            "MIN_TEXT"=>$min_text,
            "MAXT"=>$l[31],
            "MINT"=>$l[32],
            "MAXN"=>$l[33],
            "MINN"=>$l[34],
            "MAIL"=>$l[30],
            "EMAIL"=>$email['o'],
            "HTTP_C"=>$http_c,
            "HTTP"=>$l[22],
            "T1"=>$title,
            "T2"=>$title2,
            "TITLE1"=>$l[20],
            "TITLE2"=>$l[21],
            "CONFIG"=>$l[19],
            "INDEX"=>$l[1],
            "MENU"=>$l[6],
            "ADMIN"=>$admin));
        }
    elseif($m=='otv')
        {
        $template->set_filenames(array(
            'body' => 'admin_otv.tpl'));
        $id=intval($_GET['id']);
        if(!($otv=sql("SELECT * FROM ".$pref."mes WHERE id=$id")))
            {
            echo '<script language="JavaScript">window.location.href = "index.php"</script>';exit;
            }
        else
            {
            $site_sql=sql("SELECT * FROM ".$pref."config WHERE c='site'");
            $site=$site_sql['o'];
            $gb_sql=sql("SELECT * FROM ".$pref."config WHERE c='gb'");
            $gb=$site_sql['o'];
            if($otv['mail'])
            $template->assign_block_vars("mail", array(
                "TEXTMAIL"=>$l[56],
                "M"=>$l[53]));
            $template->assign_vars(array(
                "MAILNAME"=>$l[59],
                "TEMA"=>sprintf($l[57], $site),
                "STEMA"=>$l[58],
                "SNAME"=>$_SESSION[$pref.'name'],
                "ID"=>$id,
                "SMAIL"=>sprintf($l[55], $site, "http://".$gb."/post$id"),
                "INDEX"=>$l[1],
                "TEXT"=>$l[27],
                "OT"=>$l[54],
                "NAME"=>$l[25]));
            }
        }
    elseif($m=='clear')
        {
        $template->set_filenames(array(
            'body' => 'admin_clear.tpl'));
        $template->assign_vars(array(
            "ADMINKA"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "CLEAR"=>$l[63],
            "YES"=>$l[65],
            "NO"=>$l[66],
            "UV"=>$l[64]));
        }
    elseif($m=='lang')
        {
        $template->set_filenames(array(
            'body' => 'admin_lang.tpl'));
        $template->assign_vars(array(
            "IZM"=>$l[82],
            "ADD"=>$l[70],
            "ADMINKA"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "LANG"=>$l[69]));
        }
    elseif($m=='lang_add')
        {
        $template->set_filenames(array(
            'body' => 'admin_lang_add.tpl'));
        if($_GET['az'])$template->assign_block_vars("az", array("A"=>$l[76]));
        if($_GET['maxfile'])$template->assign_block_vars("maxfile", array("A"=>$l[77]));
        if($_GET['file'])$template->assign_block_vars("file", array("A"=>$l[78]));
        if($_GET['lang'])$template->assign_block_vars("langerror", array("A"=>$l[79]));
        if($_GET['post'])$template->assign_block_vars("post", array("A"=>$l[80]));
        foreach ($l as $key => $value)
            {
            $template->assign_block_vars("lang", array(
                "S"=>$_SESSION[$pref.'l_'.$key],
                "ID"=>$key,
                "L"=>$value));
            }
        $template->assign_vars(array(
            "FRAZA"=>$l[74],
            "PEREVOD"=>$l[75],
            "INFO"=>$l[73],
            "FILENAME"=>$l[71],
            "LANGNAME"=>$l[72],
            "LANG_ADD"=>$l[70],
            "ADMINKA"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "LANG"=>$l[69]));
        }
    elseif($m=='ban')
        {
        $id=intval(abs($_GET['id']));
        if(!($mes=sql("SELECT * FROM ".$pref."mes WHERE id=$id")))
            {
            echo 'script language="JavaScript">window.location.href = "index.php"</script>';exit;
            }
        if($mes['ip']==user_ip())
            {
            echo 'script language="JavaScript">window.location.href = "index.php"</script>';exit;
            }
        $template->set_filenames(array(
            'body' => 'admin_ban.tpl'));
        $template->assign_vars(array(
            "BAN"=>$l[87],
            "BAN2"=>$l[86],
            "INDEX"=>$l[1],
            "ID"=>$id,
            "PRI"=>$l[88],
            "SROK"=>$l[89],
            "MIN"=>$l[90],
            "CHAS"=>$l[91],
            "DEN"=>$l[92],
            "MES"=>$l[93],
            "DEL"=>$l[95],
            "OVER"=>$l[94],
            "DELALL"=>$l[96],
            "NAME"=>$mes['name']));
        }
    elseif($m=='bans')
        {
        $template->set_filenames(array(
                'body' => 'admin_bans.tpl'));
        $res=query("SELECT * FROM ".$pref."bans");
        while($row=row($res))
            {
            $template->assign_block_vars("bans", array(
                "DATA"=>($row['time']==-1) ? $l[94] : data($row['time']),
                "IP"=>$row['ip'],
                "PRI"=>$row['pri'],
                "TEXT"=>$row['text'],
                "NAME"=>$row['name']));
            }
        $template->assign_vars(array(
            "STEXT"=>$l[27],
            "PRI"=>$l[88],
            "UNBAN"=>$l[98],
            "BANS"=>$l[97],
            "INDEX"=>$l[1],
            "ADMINKA"=>$l[6],
            "MENU"=>$l[6],
            "ADMIN"=>$admin));
        }
/*    elseif($m=='lang_izm2')
        {
        $id=intval($_GET['id']);
        if(!($lang=sql("SELECT * FROM ".$pref."lang WHERE id=$id")))
            {
            echo 'script language="JavaScript">window.location.href = "index.php"</script>';exit;
            }
        $template->set_filenames(array(
            'body' => 'admin_lang_izm2.tpl'));
        if($_GET['lang'])$template->assign_block_vars("langerror", array("A"=>$l[79]));
        if($_GET['post'])$template->assign_block_vars("post", array("A"=>$l[80]));
        if($_SESSION[$pref.'lang']<>$id && !(sql("SELECT * FROM ".$pref."config WHERE c='lang' AND o='$id'")))include('lang/'.$lang['file'].'.php');
        foreach ($l as $key => $value)
            {
            $template->assign_block_vars("lang_izm", array(
                "S"=>$_SESSION[$pref.'l_'.$key],
                "ID"=>$key,
                "L"=>$value));
            }
        $sql=sql("SELECT * FROM ".$pref."config WHERE c='lang'");
        $sql2=sql("SELECT * FROM ".$pref."lang WHERE id=".$sql['o']);
        if($_SESSION[$pref.'lang'])$sql3=sql("SELECT * FROM ".$pref."lang WHERE id=".$_SESSION[$pref.'lang']);
        if($_SESSION[$pref.'lang']<>$id && !(sql("SELECT * FROM ".$pref."config WHERE c='lang' AND o='$id'")))include('lang/'.(($_SESSION[$pref.'lang']) ? $sql3 : $sql2['file']).'.php');
        $template->assign_vars(array(
            "LANG1"=>$lang['name'],
            "FRAZA"=>$l[74],
            "PEREVOD"=>$l[75],
            "INFO"=>$l[73],
            "LANG_NAME"=>$l[82],
            "LANGNAME"=>$l[72],
            "LANG_ADD"=>$l[70],
            "ADMINKA"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "LANG"=>$l[69]));
        }
    elseif($m=='lang_izm')
        {
        $template->set_filenames(array(
            'body' => 'admin_lang_izm.tpl'));
        $res=query("SELECT * FROM ".$pref."lang");
        while($row=row($res))
            {
            $template->assign_block_vars("lang_izm", array("ID"=>$row['id'], "NAME"=>$row['name']));
            }
        $template->assign_vars(array(
            "IZM"=>$l[82],
            "VUBOR"=>$l[83],
            "ADMINKA"=>$l[6],
            "INDEX"=>$l[1],
            "ADMIN"=>$admin,
            "LANG"=>$l[69]));
        }*/
    else
        {
        $template->set_filenames(array(
                'body' => 'admin.tpl'));
        $template->assign_vars(array(
            "LANG"=>$l[69],
            "CLEAR"=>$l[63],
            "CONFIG"=>$l[19],
            "INDEX"=>$l[1],
            "BAN"=>$l[97],
            "MENU"=>$l[6],
            "ADMIN"=>$admin,
            "REK"=>$l[7]));
        }
    }
$template->pparse('body');
include('incl/foot.php');
?>