Changeset 3


Ignore:
Timestamp:
May 5, 2008, 8:33:15 AM (16 years ago)
Author:
george
Message:

Přidáno: Nastavení počtu zobrazených serverů na stránku a počtu nej serverů v konfiguračním souboru.
Opraveno: Pročištění použití stylů a vyřešení překrývání hlavního seznamu s pravým sloupcem u některých prohlížečů. Všechny informace o stylech musí být v souboru CSS a ne v HTML kódu.

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • includes/config.sample.php

    r1 r3  
    11<?php
    22
    3 $db_congig['host'] = 'localhost';
     3$Config = array(
     4  'DisplayServerCountPerPage' => 40,
     5  'TopServersCount' => 10,
     6);
     7
     8$db_config['host'] = 'localhost';
    49$db_config['user'] = 'root';
    510$db_config['pass'] = '';
  • includes/htmltempl.php

    r1 r3  
    1 <?
     1<?php
    22class Html_template
    33  {
     
    1515  function __construct()
    1616    {
    17     ob_start($compression);
     17    ob_start($this->compression);
    1818    }
    1919 
  • index.php

    r1 r3  
    2626$tpl = new Html_template;
    2727$tpl->global_template = './templates/index.html';
     28if(!array_key_exists('page', $geted)) $geted['page'] = 'servers';
    2829$page_info = $db->query_fetch_assoc('SELECT * FROM `pages` WHERE `page` LIKE  "'.$geted['page'].'"');
    2930if  (empty($page_info))
     
    4041  $tpl->menu_template = './templates/menu.html';
    4142  $tpl->output['bg_color'] = '#ffffff';
    42   $db->query('top_online','SELECT `id`, LEFT(`name`, 25) as `name`, CAST(`online_players_sum`/`player_checks` AS UNSIGNED) as online FROM `servers` ORDER BY `online` DESC LIMIT 5');
     43  $db->query('top_online','SELECT `id`, LEFT(`name`, 25) as `name`, CAST(`online_players_sum`/`player_checks` AS UNSIGNED) as online FROM `servers` ORDER BY `online` DESC LIMIT '.$Config['TopServersCount']);
    4344  $tpl->output['top_online']='';
    4445  while ($row = $db->strip($db->fetch_assoc('top_online')))
     
    4748    $tpl->output['top_online_data'].='<li>'.ulink('server/'.$row['id'], $row['name']).' - '.$row['online'].' '.$text['players'].'</li>';
    4849    }
    49   $db->query('top_rating','SELECT `id`, LEFT(`name`, 25) as `name`, `rating_sum`/`ratings` as rating FROM `servers` ORDER BY `rating` DESC LIMIT 5');
     50  $db->query('top_rating','SELECT `id`, LEFT(`name`, 25) as `name`, `rating_sum`/`ratings` as rating FROM `servers` ORDER BY `rating` DESC LIMIT '.$Config['TopServersCount']);
    5051  $tpl->output['top_rating_data'] = '';
    5152  while ($row = $db->strip($db->fetch_assoc('top_rating')))
  • lang/en.php

    r1 r3  
    11<?php
    2 $text = array (
    3 'top_rating' => '<h3>Top rated servers.</h3>',
    4 'top_online' => '<h3Biggest servers.</h3>',
    5 'banned' => 'Your account is banned.',
    6 'wrong_pass' => 'Wrong password or login.',
    7 'loging_ok' => 'Login successful<br />This window will close in few seconds.',
    8 'name' => 'Name',
    9 'pass' => 'Password',
    10 'pass_again' => 'Password again',
    11 'pass_ok' => 'Password is correct.',
    12 'pass_error' => 'Passwords have to MATCH',
    13 'login_ok' => 'This name is correct.',
    14 'login_error' => 'This name is already taken.',
    15 'no_pass' => 'You have to enter passweord.',
    16 'email_ok' => 'Email entered is all right.',
    17 'email_wrong' => 'Email entered is in incorrect form.',
    18 'email_used' => 'Email you entered is already registred.',
    19 'no_login' => 'You have to enter name.',
    20 'subject' => 'Registration on WoW Server Status',
    21 'email_body' => 'Visit this webpage.<br />',
    22 'regiter_success' => 'Check your e-mail for activation code.',
    23 'regist_finishing_error' => 'Account not found!',
    24 'registr_finished' => ' activated <br /> <a href="'.$config['base_url'].'">Continue by loging in.</a>',
    25 'add_server_name_used' => 'Theres already server with that name.',
    26 'add_server_not_accept' => 'You have to agree with rules.',
    27 'add_server_not_name' =>'You have to fill in Server name.',
    28 'add_server_success_msg' => 'Server successfuly added.',
    29 'players' => 'Players',
    30 'info_owner' => 'Owner',
    31 'info_avarage_players' => 'Avearge online players',
    32 'info_place' => 'Location',
    33 'vote_only' => 'Only registred users can vote, and only one time per server.',
    34 'comment_h3' => 'Comments',
    35 'no_comments' => 'There are no comments so far.',
    36 'added_comment' => 'Comment added',
    37 'add_comment'=> 'Add comment',
    38 'deny_adding_comments' => 'Only registred users are able to post comments.',
    39 'add_comment' => 'Add comment',
    40 'server_added_info' => 'Added',
    41 'order_by' => 'Sort by',
    42 'abroad_servers' => 'Foreign servers',
    43 'th_players' => 'Players',
    44 'info_servers' =>'Servers',
    45 'info_num_of_servers' => 'Number of servers',
    46 'info_num_of_comments' => 'Number of comments',
    47 'users' => 'Users',
    48 'only_logged' => 'Only registred users are able to add servers.\nLog-in, please',
    49 'add_server_not_web' => 'You have to fill Server webpages and Registration page in.'
     2$text = array(
     3  'top_rating' => '<h3>Top rated servers.</h3>',
     4  'top_online' => '<h3>Biggest servers.</h3>',
     5  'banned' => 'Your account is banned.',
     6  'wrong_pass' => 'Wrong password or login.',
     7  'loging_ok' => 'Login successful<br />This window will close in few seconds.',
     8  'name' => 'Name',
     9  'pass' => 'Password',
     10  'pass_again' => 'Password again',
     11  'pass_ok' => 'Password is correct.',
     12  'pass_error' => 'Passwords have to MATCH',
     13  'login_ok' => 'This name is correct.',
     14  'login_error' => 'This name is already taken.',
     15  'no_pass' => 'You have to enter passweord.',
     16  'email_ok' => 'Email entered is all right.',
     17  'email_wrong' => 'Email entered is in incorrect form.',
     18  'email_used' => 'Email you entered is already registred.',
     19  'no_login' => 'You have to enter name.',
     20  'subject' => 'Registration on WoW Server Status',
     21  'email_body' => 'Visit this webpage.<br />',
     22  'regiter_success' => 'Check your e-mail for activation code.',
     23  'regist_finishing_error' => 'Account not found!',
     24  'registr_finished' => ' activated <br /> <a href="'.$config['base_url'].'">Continue by loging in.</a>',
     25  'add_server_name_used' => 'Theres already server with that name.',
     26  'add_server_not_accept' => 'You have to agree with rules.',
     27  'add_server_not_name' => 'You have to fill in Server name.',
     28  'add_server_success_msg' => 'Server successfuly added.',
     29  'players' => 'Players',
     30  'info_owner' => 'Owner',
     31  'info_avarage_players' => 'Avearge online players',
     32  'info_place' => 'Location',
     33  'vote_only' => 'Only registred users can vote, and only one time per server.',
     34  'comment_h3' => 'Comments',
     35  'no_comments' => 'There are no comments so far.',
     36  'added_comment' => 'Comment added',
     37  'add_comment'=> 'Add comment',
     38  'deny_adding_comments' => 'Only registred users are able to post comments.',
     39  'add_comment' => 'Add comment',
     40  'server_added_info' => 'Added',
     41  'order_by' => 'Sort by',
     42  'abroad_servers' => 'Foreign servers',
     43  'th_players' => 'Players',
     44  'info_servers' => 'Servers',
     45  'info_num_of_servers' => 'Number of servers',
     46  'info_num_of_comments' => 'Number of comments',
     47  'users' => 'Users',
     48  'only_logged' => 'Only registred users are able to add servers.\nLog-in, please',
     49  'add_server_not_web' => 'You have to fill Server webpages and Registration page in.'
     50);
    5051
    51 
    52 
    53 
    54 
    55 );
    5652$text['add_server_h2'] = 'Add server';
    5753$text['reg_name_server'] = 'Server name';
     
    6763$text['reg_accept_rules'] = 'I agree with these rules.';
    6864
    69 
    7065$dny["Mon"] = "Monday";
    71   $dny["Tue"] = "Tuesday";
    72   $dny["Wed"] = "Wednesday";
    73   $dny["Thu"] = "Thursday"; 
    74   $dny["Fri"] = "Friday"; 
    75   $dny["Sat"] = "Saturday";
    76   $dny["Sun"] = "Sunday";
     66$dny["Tue"] = "Tuesday";
     67$dny["Wed"] = "Wednesday";
     68$dny["Thu"] = "Thursday"; 
     69$dny["Fri"] = "Friday"; 
     70$dny["Sat"] = "Saturday";
     71$dny["Sun"] = "Sunday";
    7772
    7873  $mesice = array(1=>"January", "February", "March",
  • pages/a_servers.php

    r1 r3  
    66$tpl->output['place'] = $text['info_place'];
    77
     8if(!array_key_exists('order', $_GET)) $_GET['order'] = 0;
    89$order_index = (int) $_GET['order'];
    910switch ($order_index)
     
    5758    $place = $text['reg_abroad'];
    5859    }
    59   $tpl->output['servers_data'] .= '<tr style="overflow: hidden; "class="table center">';
    60   $tpl->output['servers_data'] .= ($row['wss_partner']==1)?'<td style="width: 5px;"><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
     60  $tpl->output['servers_data'] .= '<tr>';
     61  $tpl->output['servers_data'] .= ($row['wss_partner']==1)?'<td><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
    6162  $tpl->output['servers_data'] .='<td align="left">'.ulink('server/'.$row['id'], $row['name']).'</td>';
    6263  $tpl->output['servers_data'] .='<td>'.round($row['rating'],2).'</td>';
  • pages/servers.php

    r1 r3  
    11<?php
    22$tpl->output['th_players'] = $text['th_players'];
    3 $tpl->output['th_name'] =$text['name'];
     3$tpl->output['th_name'] = $text['name'];
    44$tpl->output['order_by'] = $text['order_by'];
    55$tpl->output['place'] = $text['info_place'];
    66
     7if(!array_key_exists('order', $_GET)) $_GET['order'] = 0;
    78$order_index = (int) $_GET['order'];
    89switch ($order_index)
    9   {
     10{
    1011  case 0: $order = ' order by `name` desc '; break;
    1112  case 1: $order = ' order by `rating` desc '; break;
     
    1516  case 5: $order = ' order by `players` desc '; break;
    1617  case 6: $order = ' order by `online` desc '; break;
    17   }
     18}
    1819$tpl->output['s0'] = '';
    1920$tpl->output['s1'] = '';
     
    2425$tpl->output['s6'] = '';
    2526if (empty($order_index))
    26   {
     27{
    2728  $tpl->output['s0'] = 'SELECTED';
    28   }
     29}
    2930else
    30   {
     31{
    3132  $tpl->output['s'.$order_index] = 'SELECTED';
    32   }
     33}
    3334 
    3435$pa = new CleverPager('select `id`,`wss_partner`, LEFT(`name`, 25) as `name`, `place`, `rating_sum`/`ratings` as `rating`, `version`, `type`, `xp`, `online`/`online_checks` as `online`, `online_players_sum`/`player_checks` as `players` from `servers` where `place`=1 '.$order, 'p');
    35 $pa->PageSize = 20;
     36$pa->PageSize = $Config['DisplayServerCountPerPage'];
    3637$pa->PageLinksDisplayed = 5;
    3738$pa->CountCommand = 'select count(*) as Count from `servers` where `place` =1';
     
    3940$tpl->output['servers_data'] = '';
    4041while ($row = $pa->GetOne())
     42{
     43  switch ($row['xp'])
    4144  {
    42   switch ($row['xp'])
    43     {
    4445    case 1: $xp = 'Very low'; break;
    4546    case 2: $xp = 'Low'; break;
     
    4748    case 4: $xp = 'High'; break;
    4849    case 5: $xp = 'Very high'; break; 
    49     }
    50   if ($row['place']==1)
    51     {
     50  }
     51  if ($row['place'] == 1)
     52  {
    5253    $place = $text['reg_czech'];
    53     }
     54  }
    5455  else
    55     {
     56  {
    5657    $place = $text['reg_abroad'];
    57     }
    58   $tpl->output['servers_data'] .= '<tr style="overflow: hidden; "class="table center">';
    59   $tpl->output['servers_data'] .= ($row['wss_partner']==1)?'<td style="width: 5px;"><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
     58  }
     59  $tpl->output['servers_data'] .= '<tr>';
     60  $tpl->output['servers_data'] .= ($row['wss_partner'] == 1)?'<td><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
    6061  $tpl->output['servers_data'] .='<td align="left">'.ulink('server/'.$row['id'], $row['name']).'</td>';
    61   $tpl->output['servers_data'] .='<td>'.round($row['rating'],2).'</td>';
     62  $tpl->output['servers_data'] .='<td>'.round($row['rating'], 2).'</td>';
    6263  $tpl->output['servers_data'] .='<td>'.$row['version'].'</td>';
    6364  $tpl->output['servers_data'] .='<td>'.$row['type'].'</td>';
  • pages/users.php

    r1 r3  
    3434while ($row = $pa->GetOne())
    3535  {
    36   $tpl->output['data'].='<tr class="table"><td>'.print_nick($row['id']).'</td><td align="center">'.$db->query_result('select count(*) as pocet from servers where owner='.$row['id']).'</td><td align="center">'.$db->query_result('select count(*) as pocet from comments where author='.$row['id']).'</td></tr>';
     36  $tpl->output['data'].='<tr><td align="left">'.print_nick($row['id']).'</td><td align="center">'.$db->query_result('select count(*) as pocet from servers where owner='.$row['id']).'</td><td align="center">'.$db->query_result('select count(*) as pocet from comments where author='.$row['id']).'</td></tr>';
    3737  }
    3838ob_start();
  • pages/wss_partners.php

    r1 r3  
    5656    $place = $text['reg_abroad'];
    5757    }
    58   $tpl->output['servers_data'] .= '<tr style="overflow: hidden; "class="table center">';
    59   $tpl->output['servers_data'] .= ($row['wss_partner']==1)?'<td style="width: 5px;"><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
     58  $tpl->output['servers_data'] .= '<tr>';
     59  $tpl->output['servers_data'] .= ($row['wss_partner']==1)?'<td><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
    6060  $tpl->output['servers_data'] .='<td align="left">'.ulink('server/'.$row['id'], $row['name']).'</td>';
    6161  $tpl->output['servers_data'] .='<td>'.round($row['rating'],2).'</td>';
  • scripts/check.php

    r1 r3  
    22require ('../includes/config.php');
    33$db = new tMySql;
    4   $db->dbServer = $db_config['host'];
    5   $db->dbUser = $db_config['user'];
    6   $db->dbPassword = $db_config['pass'];
    7   $db->dbName = $db_config['name'];
     4$db->dbServer = $db_config['host'];
     5$db->dbUser = $db_config['user'];
     6$db->dbPassword = $db_config['pass'];
     7$db->dbName = $db_config['name'];
    88$db->connect();
    99
    10 $db->query('del', 'select `id`, `created` from `servers` where (`online`/`online_checks`)<0.8');
     10$db->query('del', 'select `id`, `created` from `servers` where (`online`/`online_checks`) < 0.8');
    1111while ($row = $db->fetch_assoc('del'))
     12{
     13  if (($row['created'] + 3600 * 24 * 3) < time())
    1214  {
    13   if (($row['created']+3600*24*3)<time())
    14     {
    1515    delserver($row['id']);
    16     }
    1716  }
     17}
    1818?>
  • templates/a_servers.html

    r1 r3  
    11<h2>{servers_h2}</h2>
    2 <div class="table" style="text-align: center; width: 600px">
     2<div class="table">
    33<b>{order_by}:</b>  <select onchange="location.href='index.php?page=a-servers&amp;order='+this.selectedIndex">
    44    <option {s0}>{th_name}</option>
     
    1111  </select>
    1212</div>
    13 <div class="table" style="text-align: center; width: 600px">
     13<div class="table">
    1414{pager}
    1515</div>
    1616
    17 <table class="table" border="1" style=" width: 600px">
    18 <tr class="table">
     17<table class="table">
     18<tr>
    1919  <th><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></th>
    2020  <th>{th_name}</th>
     
    2929</table>
    3030
    31 <div class="table" style="text-align: center; width: 600px">
     31<div class="table">
    3232{pager}
    3333</div>
  • templates/servers.html

    r1 r3  
    11<h2>České servery</h2>
    2 <div class="table" style="text-align: center; width: 600px">
     2<div class="table">
    33<b>{order_by}:</b>  <select onchange="location.href='index.php?page=servers&amp;order='+this.selectedIndex">
    44    <option {s0}>{th_name}</option>
     
    1111  </select>
    1212</div>
    13 <div class="table" style="text-align: center; width: 600px">
     13<div class="table">
    1414{pager}
    1515</div>
    1616
    17 <table class="table" border="1" style=" width: 600px">
    18 <tr class="table">
     17<table class="table">
     18<tr>
    1919  <th><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></th>
    2020  <th>{th_name}</th>
     
    2929</table>
    3030
    31 <div class="table" style="text-align: center; width: 600px">
     31<div class="table" style="text-align: center; width: 500px">
    3232{pager}
    3333</div>
  • templates/style/screen2.css

    r1 r3  
    6060}
    6161.box {
    62     text-align:left;
    63     padding: 20px;
    64     background-color: #e6e6e6;
    65         border: 1px solid #b8b8b8;
    66         width: 272px;
    67         margin-bottom: 2px;
     62  text-align:left;
     63  padding: 20px;
     64  background-color: #e6e6e6;
     65  border: 1px solid #b8b8b8;
     66  width: 272px;
     67  margin-bottom: 2px;
     68  padding-left: 30px;
     69  padding-right: 10px;
    6870}
    6971#foot {
     
    9698    border: 1px solid #b8b8b8;
    9799    background: rgb(237,237,237);
    98     width: 500px;
    99     Border-collapse: collapse;
     100    width: 600px;
     101    border-collapse: collapse;
     102    text-align: center;
     103
    100104}
    101105
    102106.table td {
    103     padding: 5px 15px 5px 15px;
     107    border: 1px solid #b8b8b8;
     108    padding: 5px 10px 5px 10px;
     109}
     110
     111.table th {
     112    border: 1px solid #b8b8b8;
     113    padding: 2px 5px 2px 5px;
    104114}
    105115
     
    180190        background: #ffffff;
    181191        text-align: center;
    182         width: 160px;
    183         height: 40px;
    184         padding: 5px;
     192        align: center;
     193        _width: 160px;
     194        _height: 40px;
     195        _padding: 5px;
    185196        margin: 5px auto 5px auto;
    186197}
  • templates/wss_partners.html

    r1 r3  
    11<h2>{wss_partners_h2}</h2>
    2 <div class="table" style="text-align: center; width: 600px">
     2<div class="table">
    33<b>{order_by}:</b>  <select onchange="location.href='index.php?page=wss-partners&amp;order='+this.selectedIndex">
    44    <option {s0}>{th_name}</option>
     
    1111  </select>
    1212</div>
    13 <div class="table" style="text-align: center; width: 600px">
     13<div class="table">
    1414{pager}
    1515</div>
    1616
    17 <table class="table" border="1" style=" width: 600px">
    18 <tr class="table">
     17<table class="table">
     18<tr>
    1919  <th><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></th>
    2020  <th>{th_name}</th>
     
    2929</table>
    3030
    31 <div class="table" style="text-align: center; width: 600px">
     31<div class="table">
    3232{pager}
    3333</div>
Note: See TracChangeset for help on using the changeset viewer.