Changeset 67


Ignore:
Timestamp:
Feb 5, 2009, 11:12:54 PM (15 years ago)
Author:
george
Message:
  • Přidáno: RSS kanál pro logovací záznamy.
  • Přidáno: Stránkování seznamu logovacích záznamů.
  • Upraveno: Soubor global nyní nezobrazuje ihned záhlaví stránky, ale je nutné volat funkci ShowPage. V odkazovaných souborech se sjednotila inicializace databáze a dalších součástí do jednoho souboru.
Location:
trunk
Files:
1 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Options.php

    r63 r67  
    11<?php
    22include('includes/global.php');
     3
     4ShowPage();
    35
    46if(Licence(LICENCE_USER))
  • trunk/TranslationList.php

    r64 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46
    57$TranslationItemPerPage = 200;
  • trunk/action.php

    r63 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46
    57if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
     
    5052  $Database->SQLCommand('UPDATE '.$Table.' SET Complete = 0 WHERE ID = '.$TextID);
    5153  echo('Překlad byl vrácen k opravě!');   
    52   WriteLog('Překlad byl vrácen k opravě˝ <a href="form.php?group='.$GroupID.'&amp;ID='.$TextID.'">'.$TextID.'</a>', 4);
     54  WriteLog('Překlad byl vrácen k opravě <a href="form.php?group='.$GroupID.'&amp;ID='.$TextID.'">'.$TextID.'</a>', 4);
    5355}
    5456
  • trunk/banners.php

    r60 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46 
    57$ID = $Database->SQLCommand("SELECT * FROM `banner` WHERE `Show`=1 AND `DateLast` > (NOW() - INTERVAL 3 MONTH)");
  • trunk/banners/banner.php

    r55 r67  
    11<?php
    22
    3 include('../includes/config.php');
    4 include('../includes/databaseconection.php');
    5 
    6 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
    7 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    8 $Database->SelectDatabase($Config['Database']['Database']);   
     3include('../includes/global.php');
    94
    105header('Content-Type: image/png');
  • trunk/dictionary.php

    r65 r67  
    11<?php
    22
    3 session_start();
    4 
    5 // SQL injection hack protection
    6 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($_POST[$Index]);
    7 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    8 
    9 include('includes/config.php');
    10 include('includes/databaseconection.php');
    11 
    12 //připojení do databáze
    13 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
    14 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    15 $Database->SelectDatabase($Config['Database']['Database']);   
    16 
    17 function Licence($Licence)
    18 {
    19   global $Database;
    20  
    21   if(isset($_SESSION['User']) and $_SESSION['User'] <> '')
    22   {
    23     $User = $_SESSION['User'];
    24     $Line = mysql_fetch_assoc($Database->SQLCommand("SELECT sha1('".$_SESSION['Pass']."') as pass;"));
    25     $Pass = $Line['pass'];
    26    
    27     $Line = mysql_fetch_assoc($Database->SQLCommand("SELECT * FROM user WHERE LOWER(user) = LOWER('$User')"));
    28     if(!$Line)
    29         {
    30        return false;
    31     } else
    32         {
    33       if($Licence == 1)
    34           {
    35         if($Line['gm'] == 1)
    36                 {
    37           return true;
    38         } else return false;
    39       } 
    40       if($Line['pass'] == $Pass)
    41           {
    42              
    43         // zapsání poslení použité IP
    44     //    $Addres = $_SERVER['REMOTE_ADDR'];   
    45     //    $Database->SQLCommand("UPDATE user SET LastLogin = now(), LastIP = '$Addres' WHERE user = '$User'");
    46 
    47         return True;
    48       } else { return False;
    49       //  die('Nemáte zde přístup, přihla‘te se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
    50       }
    51     }
    52     } else { return False;
    53       //  die('Nemáte zde přístup, přihla‘te se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
    54     }
    55 }
     3include('includes/global.php');
    564
    575echo('<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?>
  • trunk/download.php

    r63 r67  
    1212include('addon/make.php');
    1313
     14ShowPage();
     15
    1416function CheckBox($Name, $Checked = false)
    1517{
     
    4143  $ExportSetting = unserialize($_SESSION['ExportSetting']);
    4244}
     45if(!isset($ExportSetting)) $ExportSetting = array('Diacritics' => 1, 'language-cz' => 1,
     46  'language-sk' => 0, 'language-other' => 0, 'users-selection' => array(), 'users-order' => '');
    4347if(!array_key_exists('users-selection', $ExportSetting)) $ExportSetting['users-selection'] = array();
    4448
  • trunk/fill_database.php

    r64 r67  
    33include('includes/global.php');
    44include('dbc/dbc.php');
     5
     6ShowPage();
    57 
    68echo('Načítání textů z databáze MaNGOSu: ');
  • trunk/form.php

    r54 r67  
    22
    33include('includes/global.php');   
     4
     5ShowPage();
    46
    57if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
  • trunk/img_statistic.php

    r57 r67  
    11<?php
    22
    3 session_start();
    4 include('includes/config.php');
    5 include('includes/databaseconection.php');
    6 include('includes/global_function.php');
    7 
    8 // SQL injection hack protection
    9 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($_POST[$Index]);
    10 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    11 
    12 // Open database connection
    13 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
    14 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    15 $Database->SelectDatabase($Config['Database']['Database']);   
     3include('includes/global.php');
    164
    175$FontFile = 'images/FRIZQT__.ttf';
  • trunk/includes/config.sample.php

    r61 r67  
    1919        'ShowSQLError' => false,
    2020        'ShowPHPError' => false,
     21        'ItemsPerPage' => 50,
    2122  ),
    2223);
  • trunk/includes/global.php

    r65 r67  
    135135function ShowPage()
    136136{
    137   global $Config, $Database;   
     137  global $Config, $Database, $RSSChannels;     
    138138       
    139139  echo('<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?>
     
    144144<link rel="stylesheet" href="'.$Config['Web']['BaseURL'].'style/style.css" type="text/css" media="all" />
    145145<script type="text/javascript" src="'.$Config['Web']['BaseURL'].'style/global.js"></script>
    146 <link rel="SHORTCUT ICON" href="'.$Config['Web']['BaseURL'].'images/favicon.ico" />
    147 <title>Projekt překládání textů WoW</title>
     146<link rel="SHORTCUT ICON" href="'.$Config['Web']['BaseURL'].'images/favicon.ico" />');
     147if(isset($RSSChannels))
     148foreach($RSSChannels as $Channel)
     149  echo(' <link rel="alternate" title="'.$Channel['Title'].'" href="'.$Channel['URL'].'" type="application/rss+xml">');
     150echo('<title>Projekt překládání textů WoW</title>
    148151</head>
    149152<body>');
     
    197200}
    198201
    199 ShowPage();
    200 
    201202function ShowFooter()
    202203{
  • trunk/includes/global_function.php

    r65 r67  
    1616  //$return = StrToLower($return); // velká písmena nahradí malými.
    1717  return($return);
     18}
     19
     20function ListPaging($Address, $Table, $Where, $ItemsPerPage, $CurrentPage)
     21{
     22  global $Database;
     23       
     24  $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM '.$Table.' '.$Where));       
     25  $ItemCount = floor($Line[0] / $ItemsPerPage);
     26       
     27  echo('Počet položek: <strong>'.$Line[0].'</strong> &nbsp; Zobrazit stránku: ');
     28
     29  if($CurrentPage > $ItemCount) $CurrentPage = ($ItemCount / $ItemsPerPage) - 1;
     30  for($Page = 1; $Page <= $ItemCount; $Page++)
     31  {
     32    if($CurrentPage == $Page) echo('<strong>'.$Page.'</strong> ');
     33      else echo('<a href="'.$Address.$Page.'">'.$Page.'</a> ');
     34  }
     35  echo('<br />');       
    1836}
    1937
     
    116134(
    117135  //    index,   indexname  , barva ,  popis
    118   array('0', 'Download CZWoW', 'brown', 'Stáhnutí CZWoW souboru'),
    119   array('1', 'Questy', 'green', 'Operace s questy'),
    120   array('2', 'Download SQL', 'brown', 'Stáhnutí Sql souboru'),
     136  array('1', 'Překlady', 'green', 'Operace s překladdy'),
     137  array('2', 'Stažení', 'brown', 'Stáhnutí souboru'),
    121138  array('3', 'Uživatelé', 'blue', 'Přihlášení uživatelů, nastavení, registrace'),
    122139  array('4', 'Moderátor', 'red', 'Přihlášení uživatelů'),
    123   array('5', 'Hlasování', 'yellowgreen', 'Přihlášení uživatelů'),
    124   array('6', 'Npc_text', 'tomato', 'Operace s NPC_texty'),
    125   array('7', 'Page_text', 'aqua', 'Operace s page_texty'),
    126   array('8', 'Client_text', 'black', 'Operace s clien_texty'),
    127140);
    128141
  • trunk/index.php

    r63 r67  
    33include('includes/global.php');
    44 
     5ShowPage();
     6
    57$Banner = '<a href="'.$Config['Web']['BaseURL'].'">
    68<img src="banners/baner_468_60.jpg"
  • trunk/info.php

    r63 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46
    57echo('<h2>Informace k překladu hry:</h2>
  • trunk/log.php

    r49 r67  
    22
    33include('includes/global.php'); 
     4include('rss.php');
     5
     6if(array_key_exists('rss', $_GET))
     7{
     8  $Items = array();
     9  if(array_key_exists('type', $_GET)) $Where = ' WHERE type = "'.$_GET['type'].'"';
     10    else $Where = '';
     11  $sql = 'SELECT *,UNIX_TIMESTAMP(date), (SELECT user.user FROM user WHERE user.id = log.user) as user FROM log'.$Where.' ORDER BY date DESC LIMIT 100';
     12  $ID = $Database->SQLCommand($sql);
     13  while($Line = mysql_fetch_assoc($ID))
     14  {
     15    $Items[] = array
     16        (
     17      'Title' => $LogTypes[$Line['type']][1],
     18      'Link' =>  $Config['Web']['BaseURL'].'log.php',
     19      'Description' => $Line['text'].' ('.$Line['user'].', '.$Line['IP'].')',
     20      'Time' => $Line['UNIX_TIMESTAMP(date)'],
     21    );
     22  }     
     23
     24  echo(GenerateRSS(array
     25  (
     26    'Title' => 'WoWpřeklad',
     27    'Link' => $Config['Web']['BaseURL'],
     28    'Description' => 'Překlad textů WoW',
     29    'WebmasterEmail' => $Config['Web']['AdminEmail'],
     30    'Items' => $Items,
     31  )));
     32} else
     33{
     34  if(array_key_exists('type', $_GET)) $Type = '&amp;type='.$_GET['type'];
     35    else $Type = '';
    436 
    5 echo('<b>Filtr: </b>');
    6 echo('<a href="log.php" title="Bez filtrování"><span style="color:black">Všechny</span></a> ');
    7 foreach($LogTypes as $Index => $LogItem)
    8 {
    9   echo('<a href="log.php?type='.$LogItem[0].'" title="'.$LogItem[3].'"><span style="color:'.$LogItem[2].'">'.$LogItem[1].'</span></a> ');
     37  $RSSChannels = array(array('Title' => 'Záznamy změn', 'URL' => 'log.php?rss'.$Type));
     38  ShowPage();
     39 
     40  if(array_key_exists('Page', $_GET)) $_SESSION['Page'] = $_GET['Page'];
     41  else if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 1;
     42
     43  echo('<b>Filtr: </b>');
     44  echo('<a href="log.php" title="Bez filtrování"><span style="color:black">Všechny</span></a> ');
     45  foreach($LogTypes as $Index => $LogItem)
     46  {
     47    echo('<a href="log.php?type='.$LogItem[0].'" title="'.$LogItem[3].'"><span style="color:'.$LogItem[2].'">'.$LogItem[1].'</span></a> ');
     48  }
     49
     50  // echo ' Formát: datum: text zprávy (uživatel, IP)<br /><br />';
     51  echo('<br /><br />');
     52
     53  if(array_key_exists('type', $_GET)) $Where = ' WHERE type = "'.$_GET['type'].'"';
     54    else $Where = '';
     55  $sql = 'SELECT *,(SELECT user.user FROM user WHERE user.id = log.user) as user FROM log '.$Where.'ORDER BY date DESC LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage'];
     56   
     57  ListPaging('?Page=', 'log', $Where, $Config['Web']['ItemsPerPage'], $_SESSION['Page']);   
     58  $ID = $Database->SQLCommand($sql);
     59  while($Line = mysql_fetch_assoc($ID))
     60  {
     61    foreach($LogTypes as $Index => $LogItem)
     62    {
     63      if($Line['type'] == $LogItem[0]) $color = $LogItem[2];
     64    }
     65    echo($Line['date'].': <span style="color:'.$color.'">'.$Line['text'].'</span> ('.$Line['user'].', '.$Line['IP'].')<br />');
     66  }
     67  //ListPaging('?Page=', 'log', $Where, $Config['Web']['ItemsPerPage'], $_SESSION['Page']);   
     68         
     69  ShowFooter();     
    1070}
    1171
    12 // echo ' Formát: datum: text zprávy (uživatel, IP)<br /><br />';
    13 echo('<br /><br />');
    14 
    15 if(array_key_exists('type', $_GET))
    16 {
    17   $sql = "SELECT *,(SELECT user.user FROM user WHERE user.id = log.user) as user
    18     FROM log WHERE type = '".$_GET['type']."' ORDER BY date DESC LIMIT 100";
    19     //  if ($_GET['type'] == $LogItem[0]) { }
    20 } else $sql = "SELECT *,(SELECT user.user FROM user WHERE user.id = log.user) as user FROM log ORDER BY date DESC LIMIT 100";
    21        
    22 $ID = $Database->SQLCommand($sql);
    23 while($Line = mysql_fetch_array($ID))
    24 {
    25   foreach($LogTypes as $Index => $LogItem)
    26   {
    27     if($Line['type'] == $LogItem[0]) $color = $LogItem[2];
    28   }
    29   echo($Line['date'].': <span style="color:'.$color.'">'.$Line['text'].'</span> ('.$Line['user'].', '.$Line['IP'].')<br />');
    30 }           
    31          
    32 ShowFooter();     
    33 
    3472?>
  • trunk/registrace.php

    r65 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46 
    57if(array_key_exists('user', $_POST))
  • trunk/save.php

    r66 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46
    57// Ochrana proti neoprávněnému přístupu
  • trunk/statistic.php

    r57 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46
    57echo('<strong>Statistika:</strong><br />');
  • trunk/user.php

    r49 r67  
    22
    33include('includes/global.php');
     4
     5ShowPage();
    46
    57if(array_key_exists('text', $_POST) and Licence(LICENCE_ADMIN))
  • trunk/userlist.php

    r57 r67  
    33include('includes/global.php');
    44
    5 $ItemsPerPage = 50;
    6 
    7 function WritePages($Address, $Table, $Where, $ItemsPerPage, $CurrentPage)
    8 {
    9   global $Database;
    10        
    11   $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM '.$Table.' '.$Where));       
    12   $ItemCount = floor($Line[0] / $ItemsPerPage);
    13        
    14   echo('Počet položek: <strong>'.$Line[0].'</strong> &nbsp; Zobrazit stránku: ');
    15 
    16   if($CurrentPage > $ItemCount) $CurrentPage = ($ItemCount / $ItemsPerPage) - 1;
    17   for($Page = 1; $Page <= $ItemCount; $Page++)
    18   {
    19     if($CurrentPage == $Page) echo('<strong>'.$Page.'</strong> ');
    20       else echo('<a href="'.$Address.$Page.'">'.$Page.'</a> ');
    21   }       
    22 }
     5ShowPage();
    236
    247echo('<strong>Seznam uživatelů:</strong><br />');
     
    2912if(array_key_exists('Desc', $_GET)) $_SESSION['Desc'] = $_GET['Desc'];
    3013else if(!array_key_exists('Desc', $_SESSION)) $_SESSION['Desc'] = '';
    31 WritePages('?Page=', 'user', '', $ItemsPerPage, $_SESSION['Page']);
     14ListPaging('?Page=', 'user', '', $Config['Web']['ItemsPerPage'], $_SESSION['Page']);
    3215
    3316echo('<table class="BaseTable">');
     
    6346  if($Group['TablePrefix'] != '')
    6447    $Query .= '(SELECT count(Vote) AS Vote FROM `'.$Group['TablePrefix'].'` WHERE (User = user.ID) AND (Complete = 1) AND (Language <> 0)) + ';
    65 $Query .= '0) AS Vote FROM `user` ORDER BY '.$order.' '.$desc.' LIMIT '.($_SESSION['Page'] - 1) * $ItemsPerPage.','.$ItemsPerPage;
     48$Query .= '0) AS Vote FROM `user` ORDER BY '.$order.' '.$desc.' LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage'];
    6649$ID = $Database->SQLCommand($Query);
    6750while($Line = mysql_fetch_array($ID))
     
    7861}
    7962echo('</table>');
    80 WritePages('?Page=', 'user', '', $ItemsPerPage, $_SESSION['Page']);
     63ListPaging('?Page=', 'user', '', $Config['Web']['ItemsPerPage'], $_SESSION['Page']);
    8164         
    8265ShowFooter();     
Note: See TracChangeset for help on using the changeset viewer.