Changeset 49 for trunk


Ignore:
Timestamp:
Jan 30, 2009, 10:33:08 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Přepracován systém pro více skupin překladů. Původně přes samostatné php soubory, nyní dynamicky dle tabulek group a group_item.
  • Přidáno: Doplněna podpora skupin překladů item, creature, gameobject, mangos_string, mangos_command.
  • Opraveno: Export dat nyní bez výběru konkrétních sloupců s plným výběrem exportu překladových skupin. Přepracované extporotvané příkazy a forma dat.
  • Upraveno: Styl stránek částečně oddělen do souboru style.css. Podobně javascripty přesouvat do global.js.
Location:
trunk
Files:
3 added
15 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      SqlTranslate.zip
  • trunk/Options.php

    r43 r49  
    22include('includes/global.php');
    33
    4 if (Licence(0)) {
     4if(Licence(LICENCE_USER))
     5{
     6  $User = @$_SESSION['User'];
    57
    6     $User = @$_SESSION['User'];
    7 
    8   if (array_key_exists('Email', $_POST)) {
     8  if(array_key_exists('Email', $_POST))
     9  {
    910    $Email = $_POST['Email'];
    1011    $OldPass = $_POST['OldPass'];
     
    1415
    1516    $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE ID = ".$_SESSION['UserID']));
    16     if (($Line['pass'] == $OldPass) and ($NewPass == $NewPass2)) {
     17    if(($Line['pass'] == $OldPass) and ($NewPass == $NewPass2))
     18        {
    1719      $Database->SQLCommand("UPDATE user SET pass = '$NewPass' WHERE ID = ".$_SESSION['UserID']);
    18       echo 'Heslo změněno!<br />';
    19     } else echo '<br />Hesla se neshodují!<br />';
     20      echo('Heslo změněno!<br />');
     21    } else echo('<br />Hesla se neshodují!<br />)');
    2022    $Database->SQLCommand("UPDATE user SET Email = '$Email', Language = '$Language' WHERE ID = ".$_SESSION['UserID']);
    21       echo 'Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User.'</b><br />';
     23      echo('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User.'</b><br />');
    2224      WriteLog('Úprava nastavení!', 3);
    23   } else {
     25  } else
     26  {
    2427    $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE ID = ".$_SESSION['UserID']));   
    25 ?>
    26   <form action="Options.php" method="post">
     28    echo('<form action="Options.php" method="post">
    2729  <table>
    2830    <tr>
    2931      <td>Email: </td>
    30       <td><input type="text" name="Email" value="<?php echo $Line['Email']; ?>"></td>
     32      <td><input type="text" name="Email" value="'.$Line['Email'].'" /></td>
    3133    </tr>
    3234    <tr>
    3335      <td>Původní heslo: </td>
    34       <td><input type="password" name="OldPass"></td>
     36      <td><input type="password" name="OldPass" /></td>
    3537    </tr>
    3638    <tr>
    3739      <td>Nové heslo: </td>
    38       <td><input type="password" name="NewPass"></td>
     40      <td><input type="password" name="NewPass" /></td>
    3941    </tr>
    4042    <tr>
    4143      <td>Nové heslo pro potvrzení: </td>
    42       <td><input type="password" name="NewPass2"></td>
     44      <td><input type="password" name="NewPass2" /></td>
    4345    </tr>
    4446    <tr>
    4547      <td>Normálně budu překládat do: </td>
    46       <td><?php WriteLanguages($Line['Language']); ?></td>
     48      <td>');
     49          WriteLanguages($Line['Language']);
     50          echo('</td>
    4751    </tr>
    4852    <tr>
    49       <th><input type="submit" value="Uložit"></th>
     53      <th><input type="submit" value="Uložit" /></th>
    5054    </tr>
    5155  </table>
    52 </form>
    53    
    54    
    55 <?php
     56</form>');
    5657  }
    5758} else echo 'Nejste přihlášený!';
  • trunk/TranslationList.php

    r48 r49  
    44
    55$TranslationItemPerPage = 200;
    6 
    76
    87if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
     
    6665function WriteQuests($sql, $limit, $address)
    6766{
    68   global $Database, $order, $desc;
    69     
     67  global $Database, $order, $desc, $TranslationTree, $GroupId, $Table;
     68 
    7069  if($limit <> '') $limit = 'LIMIT '.$limit;
    7170
     
    8180       
    8281  echo('<table border="1" cellpadding="2" cellspacing="0"><tr>
    83     <th><a href="group='.$GroupId.'&amp;?'.$address.'&amp;order=ID&amp;desc='.$desc.'">Pořadové číslo</a></th>
    84     <th><a href="group='.$GroupId.'&amp;?'.$address.'&amp;order=entry&amp;desc='.$desc.'">Identifikační číslo</a></th>
    85     <th><a href="?group='.$GroupId.'&amp;'.$address.'&amp;order=Title&amp;desc='.$desc.'">Název</a></th>');
    86   if ($address == 'selection') echo('<th><a href="?group='.$GroupId.'&amp;'.$address.'&amp;order=CountQuests&amp;desc='.$desc.'">Výskyt</a></th>');
    87   else if($address <> 'notran') echo('<th><a href="?group='.$GroupId.'&amp;'.$address.'&amp;order=user&amp;desc='.$desc.'">Uživatel</a></th>
    88     <th><a href="?group='.$GroupId.'&amp;'.$address.'&amp;order=vote&amp;desc='.$desc.'">Známka</a></th>
    89     <th><a href="?group='.$GroupId.'&amp;'.$address.'&amp;order=CountVote&amp;desc='.$desc.'">Počet hlasování</a></th>');
     82    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=ID&amp;desc='.$desc.'">Pořadové číslo</a></th>
     83    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=entry&amp;desc='.$desc.'">Identifikační číslo</a></th>
     84    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=Title&amp;desc='.$desc.'">Název</a></th>');
     85  if ($address == 'selection') echo('<th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=CountQuests&amp;desc='.$desc.'">Výskyt</a></th>');
     86  else if($address <> 'notran') echo('<th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=user&amp;desc='.$desc.'">Uživatel</a></th>
     87    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=vote&amp;desc='.$desc.'">Známka</a></th>
     88    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=CountVote&amp;desc='.$desc.'">Počet hlasování</a></th>');
    9089  echo('</tr>');
    91              
    92   $ID = $Database->SQLCommand("$sql $order $desc $limit");
    93   while($Line = mysql_fetch_array($ID))
    94   {
    95     echo('<tr><td><a href="form.php?ID='.$Line['ID'].'">'.$Line['ID'].'</a></td>
     90   
     91  //print_r($TranslationTree[$GroupId]['Items']);
     92  $ID = $Database->SQLCommand($sql.' '.$order.' '.$desc.' '.$limit);
     93  while($Line = mysql_fetch_assoc($ID))
     94  {
     95    //print_r($Line);
     96        echo('<tr><td><a href="form.php?group='.$GroupId.'&amp;ID='.$Line['ID'].'">'.$Line['ID'].'</a></td>
    9697      <td>'.$Line['entry'].'</td>
    97       <td>'.htmlspecialchars($Line['Title']).'</td>');
     98      <td>'.htmlspecialchars($Line[$TranslationTree[$GroupId]['Items'][0]['Column']]).'</td>');
    9899    if($address == 'selection') echo('<td>'.$Line['CountQuest'].'</td>');
    99         else if($address <> 'notran') echo('<td>'.@$Line['User'].'</td>
     100        else if($address <> 'notran') echo('<td>'.$Line['User'].'</td>
    100101      <td>'.substr($Line['Vote'], 0, 4).'</td>
    101102      <td>'.$Line['CountVote'].'</td>');
     
    105106}
    106107
    107 if($Action == 'selection')
    108 {               
    109   echo('<a title="Zobrazit překlady podle vlasního filtru" href="?group='.$GroupId.'&amp;action=filter">Filtr překladů</a> ->
    110      <a title="Zde můžete začít překládat" href="?group='.$GroupId.'&amp;action=selection">Nepřeložené texty</a><br /><br />');
    111                
    112   echo('<table border="1" cellspacing="0" cellpadding="10"><tr><td>
    113     <br /><b>Prioritně byste měli překládat tyto texty:</b><br /><br />');
    114                
    115   WriteQuests('SELECT '.$Table.'.ID, entry, Title, CountQuest FROM '.$Table.', '.$Table.'_status
    116     WHERE '.$Table.'.language = 0 AND '.$Table.'.entry = '.$Table.'_status.questentry ORDER BY '.$Table.'_status.CountQuest DESC', 18, 'selection');
    117          
    118   echo('</td></tr><tr><td>
    119     <a href="?group='.$GroupId.'&amp;action=notran">Ostatní nepřeložené texty</a>');
    120          
    121   echo('</td></tr></table>');
    122 }
    123 
    124 
    125108if($Action == 'notran')
    126109{
     
    176159    <a title="Zatím nezkontrolované questy" href="?group='.$GroupId.'&amp;action=admin_nocheck">Nezkontrolované texty</a><br /><br />');
    177160
    178   WritePages('ListQuests.php?nocheck', ' WHERE Language <> 0 AND '.$Table.'.Complete = 1 AND admin_check <> 1');
     161  WritePages('?group='.$GroupId.'&amp;action=nocheck', ' WHERE Language <> 0 AND '.$Table.'.Complete = 1 AND admin_check <> 1');
    179162
    180163  WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User
     
    254237  $Search = $_GET['search'];
    255238 
    256   $sql = "SELECT * FROM $Table.'` WHERE `ID` LIKE '%$Search%'
    257     OR `entry` LIKE '%$Search%'
    258     OR `Title` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    259     OR `Details` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    260     OR `Objectives` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    261     OR `OfferRewardText` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    262     OR `RequestItemsText` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    263     OR `EndText` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    264     OR `ObjectiveText1` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    265     OR `ObjectiveText2` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    266     OR `ObjectiveText3` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    267     OR `ObjectiveText4` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
    268     OR `Language` LIKE '%$Search%'
    269     OR `Vote` LIKE '%$Search%'
    270     OR `User` LIKE '%$Search%'
    271     OR `complete` LIKE '%$Search%'";
     239  $sql = 'SELECT * FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
     240    OR `entry` LIKE "%'.$Search.'%"
     241    OR `Language` LIKE "%'.$Search.'%"
     242    OR `Vote` LIKE "%'.$Search.'%"
     243    OR `User` LIKE "%'.$Search.'%"
     244    OR `complete` LIKE "%'.$Search.'%"';
     245  foreach($TranslationTree[$GroupId]['Items'] as $Item)
     246  {
     247        if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"';
     248  }
    272249   
    273250  WriteQuests($sql, '', 'search='.$Search);
     
    276253if($Action == 'searchentry')
    277254{
    278   $Search = $_GET['searchentry'];
     255  $Search = $_GET['ID'];
    279256 
    280   $sql = 'SELECT * FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';
     257  $sql = 'SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';
    281258   
    282259  WriteQuests($sql, '', 'searchentry='.$Search);
     
    308285    &nbsp;<select name="users[]" size="10" multiple>');
    309286       
    310   $ID = $Database->SQLCommand('SELECT user,ID FROM `user` WHERE
     287  $ID = $Database->SQLCommand('SELECT user, ID FROM `user` WHERE
    311288    EXISTS(SELECT 1 FROM '.$Table.' WHERE user = user.ID) ORDER BY user');
    312   while($Line = mysql_fetch_array($ID))
     289  if($ID)
     290  while($Line = mysql_fetch_assoc($ID))
    313291    echo('<option value="'.$Line['ID'].'">'.$Line['user'].'</option>');
    314292 
  • trunk/action.php

    r47 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
    44
    5   if (array_key_exists('delete', $_GET) and Licence(1))
     5if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
     6$Table = $TranslationTree[$GroupId]['TablePrefix'];
     7if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = '';
     8
     9if(($Action == 'delete') and Licence(LICENCE_MODERATOR))
     10{
     11  $TextID = $_GET['ID'];       
     12  $Database->SQLCommand('DELETE FROM '.$Table.' WHERE ID = '.$TextID.' AND Language <> 0');
     13  echo('Překlad byl smazán!');   
     14  WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&amp;ID='.$TextID.'">'.$TextID.'</a>', 4);
     15}
     16
     17if((@$_POST['Action'] == 'type_translation') and Licence(LICENCE_MODERATOR))
     18{
     19  if(array_key_exists('1', $_POST)) $check = 1; else $check = 0;
     20  $ID_translation = $_POST['ID_translation'];       
     21  $type_translation = $_POST['type_translation'];       
     22  $Database->SQLCommand("DELETE FROM tag WHERE ID_user = ".$_SESSION['UserID']." AND ID_translation = $ID_translation AND type_translation = $type_translation");
     23  $Database->SQLCommand("INSERT INTO `tag` ( `type_translation` , `ID_translation` , `ID_user` , `tag` )
     24    VALUES ('$type_translation', '$ID_translation', '".$_SESSION['UserID']."', '$check')");
     25  echo('Překlad označen!');   
     26  WriteLog('Překlad označen: '.$check.' <a href="form.php?group='.$GroupId.'&amp;ID='.$ID_translation.'">'.$ID_translation.'</a>', 5);
     27}
     28
     29if(($Action == 'admin_check') and Licence(LICENCE_ADMIN))
     30{
     31  $ID = $_GET['ID'];       
     32  $admin_check = $_GET['admin_check'];       
     33  $entry = mysql_fetch_array($Database->SQLCommand('SELECT entry FROM '.$Table.' Where ID = '.$ID));
     34  $Database->SQLCommand('UPDATE '.$Table.' SET admin_check = 0 WHERE entry = '.$entry['entry'].' AND Language <> 0');
     35  $Database->SQLCommand('UPDATE '.$Table.' SET admin_check = '.$admin_check.' WHERE ID = '.$ID.' AND Language <> 0');
     36  if($admin_check == 1)
    637  {
    7     $QuestID = $_GET['ID'];       
    8     $Database->SQLCommand("DELETE FROM quests WHERE ID = '$QuestID' AND Language <> '0'");
    9     echo 'Překlad byl smazán!';   
    10       WriteLog('Překlad byl smazán! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 4);
     38    echo('Překlad byl zkontrolován!');   
     39    WriteLog('Překlad byl zkontrolován! <a href="form.php?group='.$GroupId.'&amp;ID='.$ID.'">'.$ID.'</a>', 4);
     40  } else
     41  {
     42        echo('U překladu bylo zrušeno zkontrolování!');   
     43    WriteLog('U překladu bylo zrušeno zkontrolování! <a href="form.php?group='.$GroupId.'&amp;ID='.$ID.'">'.$ID.'</a>', 4);
    1144  }
     45}
    1246
    13   if (array_key_exists('type_translation', $_POST) and Licence(1))
     47if(($Action == 'NotComplete') and Licence(LICENCE_MODERATOR))
     48{
     49  $TextID = $_GET['ID'];
     50  $Database->SQLCommand('UPDATE '.$Table.' SET Complete = 0 WHERE ID = '.$TextID);
     51  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);
     53}
     54
     55if($Action == 'shoutbox')
     56{
     57  $shoutbox = $_GET['shoutbox'];
     58  if($shoutbox == '')
    1459  {
    15     if (array_key_exists('1', $_POST))
    16       $check = 1;     
    17     else $check = 0;
    18     $ID_translation = $_POST['ID_translation'];       
    19     $type_translation = $_POST['type_translation'];       
    20     $Database->SQLCommand("DELETE FROM tag WHERE  ID_user = ".$_SESSION['UserID']." AND ID_translation = $ID_translation AND type_translation = $type_translation");
    21     $Database->SQLCommand("INSERT INTO `tag` ( `type_translation` , `ID_translation` , `ID_user` , `tag` )
    22       VALUES ('$type_translation', '$ID_translation', '".$_SESSION['UserID']."', '$check')");
    23     echo 'Překlad označen!';   
    24     if ($type_translation == 1)
    25       WriteLog('Překlad označen: '.$check.' <a href="form.php?ID='.$ID_translation.'">'.$ID_translation.'</a>', 5);
    26     if ($type_translation == 2)
    27       WriteLog('Překlad označen: '.$check.' <a href="npc_form.php?ID='.$ID_translation.'">'.$ID_translation.'</a>', 5);
    28     if ($type_translation == 3)
    29       WriteLog('Překlad označen: '.$check.' <a href="page_form.php?ID='.$ID_translation.'">'.$ID_translation.'</a>', 5);
    30   }
    31 
    32   if (array_key_exists('admin_check', $_GET) and Licence(2)) {
    33     $ID = $_GET['ID'];       
    34     $admin_check = $_GET['admin_check'];       
    35     $entry = mysql_fetch_array($Database->SQLCommand("SELECT entry FROM quests Where ID = $ID"));
    36     $Database->SQLCommand("UPDATE quests SET admin_check = '0' WHERE entry = '".$entry['entry']."' AND Language <> '0'");
    37     $Database->SQLCommand("UPDATE quests SET admin_check = '$admin_check' WHERE ID = '$ID' AND Language <> '0'");
    38     if ($admin_check == 1) {
    39       echo 'Překlad byl zkontrolován!';   
    40       WriteLog('Překlad byl zkontrolován! <a href="form.php?ID='.$ID.'">'.$ID.'</a>', 4);
    41     } else {
    42       echo 'U překladu bylo zrušeno zkontrolování!';   
    43       WriteLog('U překladu bylo zrušeno zkontrolování! <a href="form.php?ID='.$ID.'">'.$ID.'</a>', 4);
    44     }
    45   }
    46 
    47   if (array_key_exists('NotComplete', $_GET) and Licence(1)) {
    48     $QuestID = $_GET['ID'];
    49     $Database->SQLCommand("UPDATE quests SET Complete = '0' WHERE ID = '$QuestID'");
    50     echo 'Překlad byl vrácen k opravě!';   
    51       WriteLog('Překlad byl vrácen k opravě˝ <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 4);
    52   }
    53 
    54   if (array_key_exists('shoutbox', $_GET)) {
    55     $shoutbox = $_GET['shoutbox'];
    56     if ($shoutbox == '') {
    57       echo '<form action="action.php?shoutbox=1" method="post">
    58       Uživatel: ';
    59       if (Licence(0)) echo '<b>'.$_SESSION['User'].'</b><br />'; else  echo '<input type="text" name="user"><br />';
    60             echo 'Text zprávy: <br>
    61             <textarea name="text" cols="40"></textarea> <br>
    62             <input type="submit" value="Uložit"><br />
    63             </form>';
    64     } else {
    65       if (Licence(0)) $user = $_SESSION['User']; else {
    66         die('Pro vkládaní musíte byt registrováni!');
    67       }
    68       $text = $_POST['text'];
    69       $Database->SQLCommand("INSERT INTO `shoutbox` ( `user` , `text` , `date` , `IP` )
    70       VALUES ( '$user', '$text', now(), '".$_SERVER['REMOTE_ADDR']."');");
    71       echo('Zpráva vložena!<br>Budete přesměrováni...');   
    72             echo('
     60    echo('<form action="action.php?action=shoutbox&amp;shoutbox=1" method="post">
     61      Uživatel: ');
     62    if(Licence(LICENCE_USER)) echo('<b>'.$_SESSION['User'].'</b><br />');
     63        else echo('<input type="text" name="user" /><br />');
     64    echo('Text zprávy: <br>
     65      <textarea name="text" cols="40"></textarea> <br />
     66      <input type="submit" value="Uložit" /><br />
     67      </form>');
     68  } else
     69  {
     70    if(Licence(LICENCE_USER)) $user = $_SESSION['User'];
     71        else die('Pro vkládaní musíte byt registrováni!');
     72    $text = $_POST['text'];
     73    $Database->SQLCommand("INSERT INTO `shoutbox` ( `user` , `text` , `date` , `IP` )
     74    VALUES ( '$user', '$text', now(), '".$_SERVER['REMOTE_ADDR']."');");
     75    echo('Zpráva vložena!<br>Budete přesměrováni...');   
     76    echo('
    7377        <script type="text/javascript" language="JavaScript" charset="utf-8">
    7478            setTimeout("parent.location.href=\'index.php\'",1000)
    7579        </script>');
    7680
    77     }
    7881  }
     82}
    7983
    80   if (array_key_exists('vote', $_GET)) {
    81     $questID = $_GET['ID'];
    82     $vote = $_GET['vote'];
    83     $IDuser = $_SESSION['UserID'];
     84if($Action == 'vote')
     85{
     86  $TextID = $_GET['ID'];
     87  $vote = $_GET['vote'];
     88  $IDuser = $_SESSION['UserID'];
    8489   
    85     if (($vote > 5) OR ($vote < 1)) die ('špatná známka');
     90  if(($vote > 5) OR ($vote < 1)) die('špatná známka');
    8691   
     92  $Line = mysql_fetch_row($Database->SQLCommand('SELECT * FROM '.$Table.'_vote WHERE IDuser = '.$IDuser.' AND TextId = '.$TextID));
     93  if((!$Line) and (Licence(LICENCE_USER)))
     94  { 
     95    $Line = mysql_fetch_array($Database->SQLCommand('SELECT Vote,CountVote FROM '.$Table.' WHERE ID='.$TextID));
     96    $CountVote = $Line['CountVote'] + 1;
     97    $OldVote = $Line['Vote'] * $Line['CountVote'];
     98    $NewVote = ($OldVote + $vote) / $CountVote;
     99     
     100    $Database->SQLCommand('UPDATE '.$Table.' SET Vote = '.$NewVote.', CountVote = '.$CountVote.' WHERE ID = '.$TextID);
     101   
     102    $Database->SQLCommand('INSERT INTO `'.$Table.'_vote` ( `TextId` , `IDuser` , `vote` ) VALUES ( '.$TextID.', '.$IDuser.', '.$vote.')');
     103    echo('Hlas byl uložen! Hlasoval jste: '.$vote.'<br /> Nyní je známka překladu '.$NewVote);   
     104   
     105    WriteLog('Uživatel hlasoval: '.$vote.'! Nyní je známka překladu (<a href="form.php?group='.$GroupID.'&amp;ID='.$TextID.'">'.$TextID.'</a>): '.$NewVote, 5);
     106  } else echo('Již jste hlasoval nebo nemůžete hlasovat!');
     107}
    87108
    88     $Line = mysql_fetch_row($Database->SQLCommand("SELECT * FROM quests_vote WHERE IDuser = '$IDuser' AND IDquest = '$questID'"));
    89     if ((!$Line) and (Licence(0)))
    90     { 
    91       $Line = mysql_fetch_array($Database->SQLCommand("SELECT Vote,CountVote FROM quests WHERE ID = '$questID'"));
    92       $CountVote = $Line['CountVote'] + 1;
    93       $OldVote = $Line['Vote'] * $Line['CountVote'];
    94       $NewVote = ($OldVote + $vote) / $CountVote;
    95      
    96       $Database->SQLCommand("UPDATE quests SET Vote = '$NewVote', CountVote = '$CountVote' WHERE ID = '$questID'");
    97    
    98       $Database->SQLCommand("INSERT INTO `quests_vote` ( `IDquest` , `IDuser` , `vote` ) VALUES ( '$questID', '$IDuser', '$vote');");
    99       echo 'Hlas byl uložen! Hlasoval jste: '.$vote.'<br /> Nyní je známka překladu '.$NewVote;   
    100    
    101       WriteLog('Uživatel hlasoval: '.$vote.'! Nyní je známka překladu (<a href="form.php?ID='.$questID.'">'.$questID.'</a>): '.$NewVote, 5);
    102     } else echo 'Již jste hlasoval nebo nemůžete hlasovat!';
    103   }
     109ShowFooter();     
    104110
    105   ShowFooter();     
    106111?>
    107112
  • trunk/dictionary.php

    r43 r49  
    22
    33session_start();
     4
     5// SQL injection hack protection
     6foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($_POST[$Index]);
     7foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     8
    49include('includes/config.php');
    510include('includes/databaseconection.php');
     
    1015$Database->SelectDatabase($Config['Database']['Database']);   
    1116
    12 
    13   function Licence($Licence)
    14   { // BEGIN function Licence
    15     global $Database;
    16     if (isset($_SESSION['User']) and $_SESSION['User'] <> '') {
    17       $User = $_SESSION['User'];
    18       $Pass = $_SESSION['Pass'];
     17function Licence($Licence)
     18{
     19  global $Database;
     20 
     21  if (isset($_SESSION['User']) and $_SESSION['User'] <> '')
     22  {
     23    $User = $_SESSION['User'];
     24    $Pass = $_SESSION['Pass'];
    1925   
    2026    $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM user WHERE LOWER(user) = LOWER('$User')"));
    21     if (!$Line) {
     27    if (!$Line)
     28        {
    2229       return false;
    2330    } else {
     
    4148      //  die('Nemáte zde přístup, přihla‘te se: <a href="'.$Config['Web']['BaseURL'].'">zde</a>');
    4249    }
    43        
    44   } // END function Licence
     50}
    4551
    46 
    47 
    48 
    49 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     52echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    5053<HTML>
    5154<HEAD>
     
    5659  <TITLE>Projekt překládání textů do WoW</TITLE>
    5760</HEAD> 
    58   <body>
     61  <body>');
    5962 
    60   ';
    61  
    62   if (array_key_exists('insert', $_GET)) {
    63     echo '<form action="dictionary.php" method="post">
     63if(array_key_exists('insert', $_GET))
     64{
     65  echo('<form action="dictionary.php" method="post">
    6466          <input type="text" name="AJWord"> Anglické slovo<br>
    6567          <input type="text" name="CZWord"> České slovo<br>
    6668          <input type="text" name="description">  Popis<br>
    6769          <input type="submit" value="Uložit">
    68           </form>
    69           ';   
    70     $WinWidth = 230;
    71   } else  {
    72     $WinWidth = 345;
    73     if (array_key_exists('AJWord', $_POST)) {
    74       $AJWord = $_POST['AJWord'];
    75       $CZWord = $_POST['CZWord'];
    76       $description = $_POST['description'];
    77       $user = @$_SESSION['UserID'];
    78       $Database->SQLCommand("INSERT INTO `dictionary` ( `AJWord` , `CZWord` , `description` , `user` )
    79                               VALUES ('$AJWord', '$CZWord', '$description', '$user');");
    80       echo 'Záznam byl uložen!';
    81       $WinWidth = 325;
    82     }   
    83   }
     70          </form>');   
     71  $WinWidth = 230;
     72} else 
     73{
     74  $WinWidth = 345;
     75  if (array_key_exists('AJWord', $_POST))
     76  {
     77    $AJWord = $_POST['AJWord'];
     78    $CZWord = $_POST['CZWord'];
     79    $description = $_POST['description'];
     80    $user = @$_SESSION['UserID'];
     81    $Database->SQLCommand("INSERT INTO `dictionary` ( `AJWord` , `CZWord` , `description` , `user` ) VALUES ('$AJWord', '$CZWord', '$description', '$user');");
     82    echo('Záznam byl uložen!');
     83    $WinWidth = 325;
     84  }   
     85}
    8486
     87echo('<table border="1" width="100%">');
     88 
     89if(array_key_exists('search', $_GET))
     90{
     91  $Search = $_GET['search'];
     92} else
     93{
     94  $Search = '';
     95}
     96       
     97echo('<tr><td><form action="dictionary.php" method="get">
     98  <input type="text" value="'.$Search.'" name="search" size="30">
     99  <input type="submit" value="Vyhledat">');
     100if(Licence(0))
     101  echo(' <a href="dictionary.php?insert">Vložit slovo</a>');
     102           
     103echo('</form></td></tr>');
     104echo('<tr><td>
     105<p style="  overflow: auto;  width: 100%; height: '.$WinWidth.'px;">');
     106//todo select   
     107if($Search <> '')
     108{
     109  $sql = "SELECT * FROM `dictionary` WHERE LOWER(AJWord) LIKE LOWER('%$Search%') OR LOWER(CZWord) LIKE LOWER('%$Search%') OR LOWER(description) LIKE LOWER('%$Search%')";
     110} else
     111{
     112  $sql = "SELECT * FROM `dictionary`";
     113}
     114echo('<table border="1" cellpadding="2" cellspacing="0" width="100%">
     115  <tr><th>Eng</th>
     116  <th>Cze</th>
     117  <th>  Popis</th></tr>');
     118$ID = $Database->SQLCommand($sql);
     119while ($Line = mysql_fetch_array($ID))
     120{
     121  echo('<tr>
     122  <td>'.$Line['AJWord'].'</td>
     123  <th>'.$Line['CZWord'].'</th>
     124  <td>'.$Line['description'].'</td></tr>');
     125}
     126echo('</table>'); 
    85127
    86   echo '<table border="1" width="100%">';
    87  
    88   if (array_key_exists('search', $_GET)) {
    89     $Search = $_GET['search'];
    90   } else {
    91     $Search = '';
    92   }
    93  
    94          
    95     echo '<tr><td><form action="dictionary.php" method="get">
    96           <input type="text" value="'.$Search.'" name="search" size="30">
    97           <input type="submit" value="Vyhledat">';
    98     if (Licence(0))
    99      echo ' <a href="dictionary.php?insert">Vložit slovo</a>';
    100            
    101     echo '</form></td></tr>';
    102     echo '<tr><td>
    103     <p style="  overflow: auto;  width: 100%; height: '.$WinWidth.'px;">';
    104     //todo select   
    105     if ($Search <> '') {
    106       $sql = "SELECT * FROM `dictionary` WHERE LOWER(AJWord) LIKE LOWER('%$Search%') OR LOWER(CZWord) LIKE LOWER('%$Search%') OR LOWER(description) LIKE LOWER('%$Search%')";
    107     } else {
    108       $sql = "SELECT * FROM `dictionary`";
    109     }
    110         echo '<table border="1" cellpadding="2" cellspacing="0" width="100%">
    111           <tr><th>Eng</th>
    112           <th>Cze</th>
    113           <th>  Popis</th></tr>';
    114         $ID = $Database->SQLCommand($sql);
    115           while ($Line = mysql_fetch_array($ID)) {
    116             echo '<tr>
    117             <td>'.$Line['AJWord'].'</td>
    118             <th>'.$Line['CZWord'].'</th>
    119             <td>'.$Line['description'].'</td></tr>';
    120           }
    121         echo '</table>'; 
     128echo('</td></tr>');
    122129
    123     echo '</td></tr>';
    124    
    125   echo '</table>
    126   </body>';
     130echo('</table></body>');
     131
    127132?>
  • trunk/download.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
    44
    5   if (array_key_exists('Type', $_POST)) {
    6     include 'includes/zip.lib.php';
    7     include 'export.php';   
    8   } else {
    9 ?>
    10 <div style="    border: 2px dotted black;       padding: 0px 5px 5px 5px;">
    11   <big><b><i>Pro klinta:</i></b></big><br>
     5if(array_key_exists('Type', $_POST))
     6{
     7  include('includes/zip.lib.php');
     8  include('export.php');   
     9} else
     10{
     11  echo('<div style="border: 1px dotted black;   padding: 0px 5px 5px 5px;">
     12  <big><b><i>Pro klinta:</i></b></big><br />
    1213  <b><a href="download-addon.php">CZWoW</a></b> - <a href="download-addon.php">Stáhnout češtinu pro clienta</a><br />
    13    - Změny ve verzích můžete sledovat v: <a href="client_files/_czwow/CzWoW/CzWoW.html">ChangeLog</a><br>
     14   - Změny ve verzích můžete sledovat v: <a href="client_files/_czwow/CzWoW/CzWoW.html">ChangeLog</a><br />
    1415   - Čeština pro clienta obsahuje:<br />
    1516   - Přeložené texty z projektu wowpřeklad<br />
     
    2324   - zvukové soubory převzaté z české verze Warcraftu III <a href="http://www.wowresource.eu/index.php?showtopic=4260&amp;hl=hl%C3%A1%C5%A1ky" title="http://www.wowresource.eu/index.php?showtopic=4260&amp;hl=hl%C3%A1%C5%A1ky">České hlášky z Warcraftu III</a>
    2425</div>
    25 <br>
    26 <div style="    border: 2px dotted black;       padding: 0px 5px 5px 5px;">
     26<br />
     27<div style="border: 1px dotted black;   padding: 0px 5px 5px 5px;">
    2728  <big><b><i>Pro server:</i></b></big><br>
    2829  <b>Export překladu:</b><br />
     
    3132      <tr><th>Sql</th><th>Filtr</th><th>Jazyk</th><th>Texty</th></tr>
    3233      <tr><td>
    33         <input type="radio" name="Export" value="Zip" checked="true"> Exportovat do zip<br>
    34         <input type="radio" name="Export" value="Display"> Export zobrazit<br>
    35 <?php
    36       if (Licence(2)) {
    37           echo '<input type="radio" name="Export" value="Mangos"> Import na server (Admin only)<br>';
    38       }
    39 ?>
     34        <input type="radio" name="Export" value="Zip" checked="true"> Exportovat do zip<br />
     35        <input type="radio" name="Export" value="Display"> Export zobrazit<br />');
     36  if(Licence(LICENCE_ADMIN))
     37  {
     38    echo('<input type="radio" name="Export" value="Mangos" /> Import na server (pouze admin)<br />');
     39  }
     40  echo('<br />
     41        <input type="radio" name="Type" value="Insert" /> Insert (zatím nefunguje)<br />
     42        <input type="radio" name="Type" value="Update" checked="true" /> Update <br />
    4043        <br />
    41         <input type="radio" name="Type" value="Insert"> Insert (zatím nefunguje)<br>
    42         <input type="radio" name="Type" value="Update" checked="true"> Update <br>
    43         <br />
    44         <input type="checkbox" name="Use" checked="true"> Přidat Use mangos <br>
    45         <br />
    46         <input type="checkbox" name="Quests" checked="true"> Questy <br>
    47         <input type="checkbox" name="NPC_texts" checked="true"> NPC_texts <br>
    48         <input type="checkbox" name="page_texts" checked="true"> page_texts <br>
    49       </td><td>
    50         &nbsp; <input type="text" name="NumberVote" value="3" size="1"> Počet nutných hlasů <br>                                                               
    51         &nbsp; <input type="text" name="Vote" value="4" size="1"> Známka lepší nebo stejná jak  <br>                                                             
     44        <input type="checkbox" name="Use" checked="true"> Přidat Use mangos <br />
     45        <br />');
     46  echo('</td><td>
     47        &nbsp; <input type="text" name="NumberVote" value="3" size="1" /> Počet nutných hlasů <br />                                                               
     48        &nbsp; <input type="text" name="Vote" value="4" size="1" /> Známka lepší nebo stejná jak  <br />                                                             
    5249            <br />
    53         &nbsp; <select name="users[]" size="10" multiple>
    54          
    55 <?php
    56 // multiple="multiple"
    57     $ID = $Database->SQLCommand("SELECT user,ID FROM `user` WHERE
    58           EXISTS(SELECT 1 FROM quests WHERE user = user.ID) OR
    59           EXISTS(SELECT 1 FROM npc_text WHERE user = user.ID) ORDER BY user");
    60       while ($Line = mysql_fetch_array($ID))
    61         echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>';
    62    
    63 ?>         
    64          
    65         </select><br> &nbsp; Exportovat pouze od těchto uživatalů<br>
    66         &nbsp; Vybrat více uživatelů můžete pomocí CTRL+click
    67        
     50        &nbsp; <select name="users[]" size="10" multiple>');
     51
     52  // multiple="multiple"
     53  $Query = 'SELECT user,ID FROM `user` WHERE ';
     54  foreach($TranslationTree as $Group)
     55    if($Group['TablePrefix'] != '')
     56      $Query .= 'EXISTS(SELECT 1 FROM '.$Group['TablePrefix'].' WHERE user = user.ID) OR ';
     57  $Query .= ' 0 ORDER BY user';
     58  $ID = $Database->SQLCommand($Query);
     59  while ($Line = mysql_fetch_array($ID))
     60    echo('<option value="'.$Line['ID'].'">'.$Line['user'].'</option>');
     61
     62  echo('</select><br /> &nbsp; Exportovat pouze od těchto uživatalů<br />
     63        &nbsp; Vybrat více uživatelů můžete pomocí CTRL+click       
    6864
    6965      </td><td>
    70         <input type="checkbox" name="Diacritical" checked="true"> Včetně diakritiky <br> 
     66        <input type="checkbox" name="Diacritical" checked="true" /> Včetně diakritiky <br> 
    7167        <br />                                                               
    72         <input type="checkbox" name="CZ" checked="true"> Český překlad <br>                                                                 
    73         <input type="checkbox" name="SK" checked="true"> Slovenský překlad <br>                                                                 
    74         <input type="checkbox" name="OtherLanguage"> Jiné jazyky <br>
    75       </td><td>
    76         <b>Title questu:</b><br>
    77         <input type="radio" name="AddTitle" value="Translate" checked="true"> Přeložený název <br>
    78         <input type="radio" name="AddTitle" value="EN"> Původní název <br>
    79         <input type="radio" name="AddTitle" value="Both"> Přeložený název (Anglický název) <br>
    80     <br>                                                                 
    81 <?php   
    82   foreach($Texts as $Index => $TextItem)
    83     echo '<input type="checkbox" name="Add'.$TextItem[0].'" checked="true"> '.$TextItem[0].'<br>';
    84 ?>
    85       </td></tr>
     68        <input type="checkbox" name="CZ" checked="true" /> Český překlad <br />
     69        <input type="checkbox" name="SK" checked="true" /> Slovenský překlad <br />                                                                 
     70        <input type="checkbox" name="OtherLanguage" /> Jiné jazyky <br />
     71      </td><td>');
     72  foreach($TranslationTree as $Group)
     73    if($Group['TablePrefix'] != '')
     74      echo('<input type="checkbox" name="'.$Group['TablePrefix'].'" checked="true" /> '.$Group['Name'].'<br />');
     75
     76  echo('</td></tr>
    8677    </table>
    87     <br><input type="submit" value="Generovat SQL soubor překladu (Stažení)">
    88   </form> 
     78    <br /><input type="submit" value="Generovat SQL soubor překladu (Stažení)" />
     79  </form><br /> 
    8980  <b>Český překlad MaNGOS Minimanageru:</b><br />
    90   - Stránky projektu: <a href="http://sourceforge.net/projects/mmfpm/">http://sourceforge.net/projects/mmfpm/</a><br>
    91   - Překlad: <a href="http://wow.zdechov.net/minimanager/lang/csCZ.zip">Čeština do minimanageru</a><br>
     81  - Stránky projektu: <a href="http://sourceforge.net/projects/mmfpm/">http://sourceforge.net/projects/mmfpm/</a><br />
     82  - Překlad: <a href="http://wow.zdechov.net/minimanager/lang/csCZ.zip">Čeština do minimanageru</a><br />
    9283  - Diskusní forum pro případné připomínky k překladu: <a href="http://wow.zdechov.net/forum/viewtopic.php?p=5533">Forum</a>
    9384
    94 </div>
    95 <br>
    96 <?php
     85  </div>
     86  <br />');
    9787}
    98  
    99          
    100   ShowFooter();     
     88       
     89ShowFooter();     
    10190?>
  • trunk/fill_database.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
    44 
    5   echo 'Načítání questů z databáze: ';
     5echo('Načítání textů z databáze MaNGOSu: ');
     6echo('<div style="font-size: xx-small;">');
    67 
    7   $sql = "SELECT * FROM mangos.quest_template as mangos_quests
    8    WHERE NOT EXISTS (SELECT * FROM quests.quests WHERE quests.quests.entry=mangos_quests.entry)";
     8foreach($TranslationTree as $Group)
     9{
     10  if(($Group['MangosTable'] != '') and ($Group['TablePrefix'] != ''))
     11  {
     12        echo('<br />'.$Group['Name'].'<br />');
     13        $Columns = '`'.$Config['Database']['DatabaseMangos'].'`.`'.$Group['MangosTable'].'`.`'.$Group['MangosTableIndex'].'`';
     14        foreach($Group['Items'] as $GroupItem)
     15          $Columns .= ', `'.$Config['Database']['DatabaseMangos'].'`.`'.$Group['MangosTable'].'`.`'.$GroupItem['MangosColumn'].'` AS `'.$GroupItem['Column'].'`';
     16        $Query = 'SELECT '.$Columns.' FROM `'.$Config['Database']['DatabaseMangos'].'`.`'.$Group['MangosTable'].'`';
     17        echo($Query.'<br />'); 
     18        $Count = 0;
     19        $NewCount = 0;
     20        $DbResult = $Database->SQLCommand($Query);
     21        while($DbRow = mysql_fetch_assoc($DbResult))
     22        {
     23          //echo('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$DbRow[$Group['MangosTableIndex']].' AND Language=0'."<br>");
     24          $DbResult2 = $Database->SQLCommand('SELECT ID FROM '.$Group['TablePrefix'].' WHERE entry='.$DbRow[$Group['MangosTableIndex']].' AND Language=0');
     25          if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
     26          {
     27                $DbRow2 = mysql_fetch_assoc($DbResult2);
     28                //echo($DbRow2['ID']);
     29                $ColumnsValues = '';
     30            foreach($Group['Items'] as $GroupItem)
     31                {
     32              $ColumnsValues .= ', `'.$GroupItem['Column'].'`="'.addslashes($DbRow[$GroupItem['MangosColumn']]).'"';
     33                }
     34                $ColumnsValues = substr($ColumnsValues, 2);
     35                echo('. '); //'UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']."<br>");
     36                //print_r($DbRow2);
     37                $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET '.$ColumnsValues.' WHERE ID='.$DbRow2['ID']);
     38          } else
     39          {
     40                $Columns = 'entry, language';
     41                $Values = $DbRow[$Group['MangosTableIndex']].', 0';
     42            foreach($Group['Items'] as $GroupItem)
     43                {
     44              $Columns .= ', `'.$GroupItem['Column'].'`';
     45                  $Values .= ', "'.addslashes($DbRow[$GroupItem['MangosColumn']]).'"';
     46                }
     47                //$Columns = substr($Columns, 2);
     48                //$Values = substr($Values, 2);
     49                $Database->SQLCommand('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
     50                echo('# ');
     51                //echo('INSERT `'.$Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')'."<br>");
     52            $NewCount++;
     53          }
     54          $Count++;
     55        }
     56        echo('<br />Celkem: '.$Count.'  Nových: '.$NewCount.'<br />');
     57  }
     58}
     59echo('Dokončeno.</div>');
    960 
    10   $ID = $Database->SQLCommand($sql);
    11   while ($Line = mysql_fetch_array($ID)) {
     61WriteLog('Plnění databáze', 4);
    1262 
    13     $sql = "
    14      INSERT INTO `quests` ( `ID` , `entry` , `Title` , `Details` , `Objectives` ,
    15       `OfferRewardText` , `RequestItemsText` , `EndText` , `ObjectiveText1` , `ObjectiveText2` ,
    16        `ObjectiveText3` , `ObjectiveText4` , `Language`)
    17       VALUES (NULL , '".mysql_escape_string($Line['entry'])."', '".mysql_escape_string($Line['Title'])."', '".mysql_escape_string($Line['Details'])."',
    18        '".mysql_escape_string($Line['Objectives'])."', '".mysql_escape_string($Line['OfferRewardText'])."', '".mysql_escape_string($Line['RequestItemsText'])."', '".mysql_escape_string($Line['EndText'])."',
    19         '".mysql_escape_string($Line['ObjectiveText1'])."', '".mysql_escape_string($Line['ObjectiveText2'])."', '".mysql_escape_string($Line['ObjectiveText3'])."', '".mysql_escape_string($Line['ObjectiveText4'])."', '0')";
    20   //  echo $sql;
    21     $Database->SQLCommand($sql);
    22   }
    23   echo 'HOTOVO';
    24  
    25       WriteLog('Plnění databáze', 4);
    26  
    27          
    28   ShowFooter();     
     63ShowFooter();     
     64
    2965?>
  • trunk/form.php

    r43 r49  
    11<?php
     2
    23include('includes/global.php');   
    34
    4   if (array_key_exists('ID', $_GET)) {
    5     $QuestID = mysql_escape_string($_GET['ID']); 
     5if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
     6$Table = $TranslationTree[$GroupId]['TablePrefix'];
     7if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = '';
    68
    7     $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM quests Where ID = $QuestID"));
    8      
    9     $LineAJ = mysql_fetch_array($Database->SQLCommand("SELECT * FROM quests Where Language = '0'
    10     AND entry = '".$Line['entry']."'"));
    11  
    12     $User = @$_SESSION['User'];
    13     $IDUser = $Database->SQLCommand("SELECT * FROM user Where id = '".$Line['User']."'");
    14     $LineUser = mysql_fetch_array($IDUser);
     9if(array_key_exists('ID', $_GET))
     10{
     11  $TextID = $_GET['ID']; 
     12
     13  $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID));
     14  if(!$Line) die('Překlad nenalezen.');
     15   
     16  $LineAJ = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE Language = 0  AND entry = '.$Line['entry']));
     17  if(!$Line) die('Anglický originál k překladu nenalezen.');
     18 
     19  $User = @$_SESSION['User'];
     20  $IDUser = $Database->SQLCommand('SELECT * FROM user Where id = '.$Line['User']);
     21  $LineUser = mysql_fetch_array($IDUser);
    1522 
    1623     
    17       if ($Line['Language'] <> '0' and $LineUser['user'] <> '') echo 'Přeložil: <b>'.$LineUser['user'].'</b> <br />';
    18       if ($Line['Take'] <> '0' and $Line['Take'] <> $Line['ID']) {
    19         $Language = mysql_fetch_array($Database->SQLCommand("SELECT Language FROM quests Where ID = '".$Line['Take']."'"));
    20        // echo $Language['Language'].'  '.$Line['Take'];
    21         if ($Language['Language'] <> 0)
    22           echo 'Převzato z: <a href="form.php?ID='.$Line['Take'].'">'.$Line['Take'].'</a> <br />';
    23       }
    24     echo 'Quest: ';
    25     if ($Line['Language'] <> '0') {
    26       if ($Line['complete'] == 1) echo ' <b>Hotov</b><br />';
    27       else echo ' <b> Uložen v rozepsaných</b><br />';
    28     } else {
    29       echo ' <b>Anglická, původní verze</b><br />';
    30     }
     24  if(($Line['Language'] <> 0) and ($LineUser['user'] <> '')) echo('Přeložil: <strong>'.$LineUser['user'].'</strong> <br />');
     25  if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
     26  {
     27    $Language = mysql_fetch_array($Database->SQLCommand('SELECT Language FROM '.$Table.' Where ID = '.$Line['Take']));
     28    // echo $Language['Language'].'  '.$Line['Take'];
     29    if($Language['Language'] <> 0)
     30      echo('Převzato z: <a href="form.php?group='.$GroupId.'&amp;ID='.$Line['Take'].'">'.$Line['Take'].'</a> <br />');
     31  }
     32  echo('Text: ');
     33  if($Line['Language'] <> 0)
     34  {
     35    if($Line['complete'] == 1) echo(' <b>Hotov</b><br />');
     36      else echo(' <b> Uložen v rozepsaných</b><br />');
     37  } else
     38  {
     39    echo(' <b>Anglická, původní verze</b><br />');
     40  }
    3141   
    32     if ($Line['Language'] <> '0') {
    33       echo 'Známka Questu: <b>'.$Line['Vote'].'</b><br />';
    34     }
     42  if($Line['Language'] <> 0)
     43  {
     44    echo('Známka překladu: <b>'.$Line['Vote'].'</b><br />');
     45  }   
    3546   
    36    
    37   if (Licence(0) and ($LineUser['ID'] <> $_SESSION['UserID']) and ($Line['Language'] <> 0)) {
    38     $LineVote = mysql_fetch_array($Database->SQLCommand("SELECT * FROM quests_vote WHERE
    39     IDuser = ".$_SESSION['UserID']." AND IDquest = $QuestID"));
    40     if (!$LineVote) {
    41       echo ' Hodnotit Quest: ';
    42         for ($i=1; $i<6; ++$i)   
    43           echo '<a href="action.php?vote='.$i.'&amp;ID='.$QuestID.'">'.$i.'</a> ';
    44       echo ' bodů (5 nejlepší)';
    45     } else { echo ' Již jsi hlasoval: '.$LineVote['vote']; } 
    46   echo '<br>
    47 
    48 ';
    49  
    50  
    51  
     47  if(Licence(LICENCE_USER) and ($LineUser['ID'] <> $_SESSION['UserID']) and ($Line['Language'] <> 0))
     48  {
     49    $LineVote = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.'_vote WHERE IDuser = '.$_SESSION['UserID'].' AND TextId = '.$TextID));
     50    if(!$LineVote)
     51        {
     52      echo(' Hodnotit text: ');
     53      for($i = 1; $i < 6; ++$i)   
     54        echo('<a href="action.php?group='.$GroupId.'&amp;vote='.$i.'&amp;ID='.$TextID.'">'.$i.'</a> ');
     55      echo(' bodů (5 nejlepší)');
     56    } else
     57        {
     58          echo(' Již jsi hlasoval: '.$LineVote['vote']);
     59        } 
     60    echo('<br />');
    5261  }
    5362 
    54 //kontrolování textů 
    55   $ID_translation = $QuestID;
     63  // kontrolování textů 
     64  $ID_translation = $TextID;
    5665  $type_translation = 1;
    57   $check = mysql_fetch_array($Database->SQLCommand("SELECT * FROM tag WHERE ID_user = ".$_SESSION['UserID']." AND ID_translation = $ID_translation AND type_translation = $type_translation"));
    58   echo '<form action="action.php" method="post" name="check">';
    59   if ($check['tag'] == 1)
    60     echo '<input name="0" type="submit" value="Odebrat z vlastního výběru">';
     66  $check = mysql_fetch_array($Database->SQLCommand('SELECT * FROM tag WHERE ID_user = '.$_SESSION['UserID'].' AND ID_translation = '.$ID_translation.' AND type_translation = '.$type_translation));
     67  echo('<form action="action.php?group='.$GroupId.'" method="post" name="check">');
     68  if($check['tag'] == 1)
     69    echo('<input name="0" type="submit" value="Odebrat z vlastního výběru" />');
    6170  else
    62     echo '<input name="1" type="submit" value="Přidat do vlastního výběru">';
    63   echo '  <input type="hidden" name="ID_translation" value="'.$ID_translation.'">
    64   <input type="hidden" name="type_translation" value="'.$type_translation.'">
    65          
    66 </form>';
    67     if ($Line['admin_check'] <> '0') {
    68       echo '<b>Quest byl zkontrolován adminem</b><br />';
    69     }
    70     if (Licence(2)) {
    71       $admin_check = mysql_fetch_array($Database->SQLCommand("SELECT ID FROM quests Where entry = ".$Line['entry']." AND admin_check = 1 AND ID <> $QuestID"));
    72       if (isset($admin_check['ID']))
    73         echo 'Již byla zkontrolována adminem jiná verze questu: <a href="form.php?ID='.$admin_check['ID'].'">'.$admin_check['ID'].'</a><br />';
    74     }
    75       $number_version = mysql_fetch_array($Database->SQLCommand("SELECT count(*) FROM quests Where entry = ".$Line['entry']." AND Language <> 0"));
    76       echo 'Počet verzí: <b>'.$number_version['count(*)'].'</b> ';
    77     echo '<a href="ListQuests.php?searchentry='.$Line['entry'].'">Zobrazit všechny verze tohoto questu</a>';
     71    echo('<input name="1" type="submit" value="Přidat do vlastního výběru" />');
     72  echo('  <input type="hidden" name="ID_translation" value="'.$ID_translation.'" />
     73  <input type="hidden" name="type_translation" value="'.$type_translation.'" />         
     74</form>');
     75  if($Line['admin_check'] <> 0)
     76  {
     77    echo('<b>Překlad byl zkontrolován adminem</b><br />');
     78  }
     79  if(Licence(LICENCE_ADMIN))
     80  {
     81    $admin_check = mysql_fetch_array($Database->SQLCommand('SELECT ID FROM '.$Table.' Where entry = '.$Line['entry'].' AND admin_check = 1 AND ID <> '.$TextID));
     82    if(isset($admin_check['ID']))
     83      echo('Již byla zkontrolována adminem jiná verze překladu: <a href="form.php?group='.$GroupId.'&amp;ID='.$admin_check['ID'].'">'.$admin_check['ID'].'</a><br />');
     84  }
     85  $number_version = mysql_fetch_array($Database->SQLCommand('SELECT count(*) FROM '.$Table.' Where entry = '.$Line['entry'].' AND Language <> 0'));
     86  echo('Počet verzí: <b>'.$number_version['count(*)'].'</b> ');
     87  echo('<a href="TranslationList.php?group='.$GroupId.'&amp;action=searchentry&amp;ID='.$Line['entry'].'">Zobrazit všechny verze tohoto překladu</a>');
    7888   
    7989//    Speciální znaky: $B - Odřádkování, $N - Jméno, $C - povolání
    80 ?>   
    81   <form action="save.php" method="post">
    82 <?php
    83   if (Licence(0)) {
    84     echo '<input type="submit" value="Uložit do rozepsaných" name="save" Title="Klikněte na uložit pro pozdější dokončení Q">
    85     <input type="submit" value="Dokončeno" name="End" Title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat">';
    86 
     90  echo('<form action="save.php?group='.$GroupId.'" method="post">');
     91  if(Licence(LICENCE_USER))
     92  {
     93    echo('<input type="submit" value="Uložit do rozepsaných" name="save" Title="Klikněte na uložit pro pozdější dokončení překladu" />
     94    <input type="submit" value="Dokončeno" name="End" Title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" />');
    8795  }
    8896
    89 
    90   if (Licence(1) and $Line['Language'] <> 0) {
    91     echo '<input type="submit" value="Opravit" name="Repair" Title="Opravit po uživateli chyby (Moderator only)">'
     97  if (Licence(LICENCE_MODERATOR) and ($Line['Language'] <> 0))
     98  {
     99    echo('<input type="submit" value="Opravit" name="Repair" Title="Opravit po uživateli chyby (pouze moderátor)" />')
    92100  }
    93       if (Licence(1) and ($Line['Language'] <> 0)) {
     101  if(Licence(LICENCE_MODERATOR) and ($Line['Language'] <> 0))
     102  {
    94103      //  echo '<input type="submit" value="Opravit Q" name="Repair"> Klikněte Jestli si přejete opravit chyby v Questu<br>';
    95104       
    96         echo ' <input type="hidden" name="UserRepair" value="'.$Line['User'].'">';
    97         echo ' <a style="color: Red" title="smazat (Moderator only)" href="action.php?delete=1&amp;ID='.$QuestID.'">x</a> 
    98         <a style="color: Red" title="Není hotovo (Moderator only)" href="action.php?NotComplete=1&amp;ID='.$QuestID.'"><-</a>
    99        
    100         '; 
    101         if (Licence(2)) {
    102           if ($Line['admin_check'] <> '1') {
    103             echo ' <a style="color: Green" title="Zkontrolováno (Admin only)" href="action.php?admin_check=1&amp;ID='.$QuestID.'"><b>+</b></a>';
    104           } else {
    105             echo ' <a style="color: Green" title="Zrušit zkontrolování (Admin only)" href="action.php?admin_check=0&amp;ID='.$QuestID.'"><b>-</b></a>';
    106           }
    107         }
    108       }
    109 ?>
    110     <input type="hidden" name="entry" value="<?php echo $LineAJ['entry']?>">
    111     <input type="hidden" name="user" value="<?php echo $User ?>">
    112     <input type="hidden" name="ID" value="<?php echo $QuestID ?>">
     105    echo(' <input type="hidden" name="UserRepair" value="'.$Line['User'].'" />');
     106    echo(' <a style="color: Red" title="smazat (pouze moderátor)" href="action.php?group='.$GroupId.'&amp;action=delete&amp;delete=1&amp;ID='.$TextID.'">x</a> 
     107        <a style="color: Red" title="Není hotovo (pouze moderátor)" href="action.php?group='.$GroupId.'&amp;action=NotComplete&amp;NotComplete=1&amp;ID='.$TextID.'"><-</a>'); 
     108    if(Licence(LICENCE_ADMIN))
     109        {
     110      if($Line['admin_check'] <> '1')
     111          {
     112        echo(' <a style="color: Green" title="Zkontrolováno (pouze admin)" href="action.php?group='.$GroupId.'&amp;action=admin_check&amp;admin_check=1&amp;ID='.$TextID.'"><b>+</b></a>');
     113      } else
     114          {
     115        echo(' <a style="color: Green" title="Zrušit zkontrolování (pouze admin)" href="action.php?group='.$GroupId.'&amp;action=admin_check&amp;admin_check=0&amp;ID='.$TextID.'"><b>-</b></a>');
     116      }
     117    }
     118  }
     119
     120  echo('<input type="hidden" name="entry" value="'.$LineAJ['entry'].'" />
     121    <input type="hidden" name="user" value="'.$User.'" />
     122    <input type="hidden" name="ID" value="'.$TextID.'" />
    113123    <table border="1" cellpadding="1" cellspacing="0">
    114124      <tr>
    115         <th>Číslo Q.: <?php echo '<a Title="Zobrazit quest na wowhead.com" href="http://www.wowhead.com/?quest='.$LineAJ['entry'].'">'.$LineAJ['entry'].'</a>'; ?></th>
     125        <th>Číslo textu: <a Title="Zobrazit text na wowhead.com" href="http://www.wowhead.com/?quest='.$LineAJ['entry'].'">'.$LineAJ['entry'].'</a></th>
    116126        <th>Nepřeložené</th>
    117127        <th>Přeložené</th>
     
    121131        <td width="300">Anglický</td>
    122132        <td>
    123           Přeloženo do: <?php
    124           if ($Line['Language'] <> 0)
    125               $Language = $Line['Language'];
    126           else {
    127             $IDUser = $Database->SQLCommand("SELECT * FROM user Where id = '".@$_SESSION['UserID']."'");
    128             $LineUser = mysql_fetch_array($IDUser);
    129             $Language = $LineUser['Language'];  //jiný user vyčítám
    130           }
    131               WriteLanguages($Language);
    132               ?>
    133         </td>
    134       </tr>
    135       <tr>
    136         <th>Title</th>
    137         <td width="300"><?php echo htmlspecialchars($LineAJ['Title'])?></td>
    138         <td><input type="text" size="45" name="Title" value="<?php echo htmlspecialchars($Line['Title']) ?>"></td>
    139       </tr>
    140      
    141 <?php  foreach($Texts as $Index => $TextItem)
    142           {         
    143           if (($LineAJ[$TextItem[0]] <> '') or ($Line[$TextItem[0]] <> '')) 
    144             echo '
    145       <tr>
    146         <th>'.$TextItem[0].'</th>
    147         <td width="300">'.htmlspecialchars($LineAJ[$TextItem[0]]).'</td>
    148         <td><textarea rows="8" style="width: 300px; height=100%;" name="'.$TextItem[0].'">'.htmlspecialchars($Line[$TextItem[0]]).'</textarea></td>
    149       </tr>
    150       ';
    151      
    152       }
    153          
    154 ?>
    155    
    156     </table>           
    157   </form>
    158 <?php   
     133          Přeloženo do:');
     134  if($Line['Language'] <> 0) $Language = $Line['Language'];
     135  else
     136  {
     137    $IDUser = $Database->SQLCommand('SELECT * FROM user Where id = '.@$_SESSION['UserID']);
     138    $LineUser = mysql_fetch_array($IDUser);
     139    $Language = $LineUser['Language'];  //jiný user vyčítám
     140  }
     141  WriteLanguages($Language);
     142  echo('</td></tr><tr>');
     143  foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     144  {         
     145    if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 
     146    echo('<tr>
     147      <th>'.$TextItem['Name'].'</th>
     148      <td width="300">'.htmlspecialchars($LineAJ[$TextItem['Column']]).'</td>
     149      <td><textarea rows="8" style="width: 300px; height=100%;" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>');
     150  }
     151  echo('</table>           
     152  </form>');
     153} else
     154{
     155  // include 'ListQuests.php';   
     156  echo('Nebylo zadáno ID <a href="index.php">zpět</a>');
     157}
    159158
    160   } else {
    161    // include 'ListQuests.php';   
    162    
    163     echo 'Nebylo zadáno ID <a href="index.php">zpět</a>';
    164    
    165   }
     159ShowFooter();
    166160
    167 
    168  
    169    ShowFooter();
    170161?>   
    171162
  • trunk/img_statistic.php

    r43 r49  
    33include('includes/config.php');
    44include('includes/databaseconection.php');
     5
     6// SQL injection hack protection
     7foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($_POST[$Index]);
     8foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    59
    610//připojení do databáze
     
    1216
    1317//  echo  "SELECT count(distinct(entry)) FROM $TypeTexts WHERE Language <> '0' AND Complete = '1'";
    14   $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(distinct(entry)) FROM $TypeTexts WHERE Language <> '0' AND Complete = '1'"));
     18  $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(distinct(entry)) FROM ".$TypeTexts." WHERE Language <> '0' AND Complete = '1'"));
    1519  $NumberTranslate = $ID[0];
    1620 
    17   $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM $TypeTexts WHERE Language = '0'"));
     21  $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM ".$TypeTexts." WHERE Language = '0'"));
    1822  $NumberAJ = $ID[0];
    1923
    20   $Percent = ($NumberTranslate/$NumberAJ)*100;
     24  $Percent = ($NumberTranslate / $NumberAJ) * 100;
    2125  $Percent = substr($Percent, 0, 5);
    2226
    23   $PercentBar = $Percent*4;
    24   $obrazek = imagecreatetruecolor(400,60);
    25   $Color1 = imagecolorallocate($obrazek,225,246,247);
    26   $Color2 = imagecolorallocate($obrazek,77,225,251);
    27   $Color3 = imagecolorallocate($obrazek,2,59,199);
    28   imagefilledrectangle($obrazek,0,0,400,59,$Color1);
    29   imagefilledrectangle($obrazek,0,0,$PercentBar,59,$Color2);
    30   imagestring($obrazek, 10, 120, 15, $NumberTranslate.'/'.$NumberAJ, $Color3);
    31   imagestring($obrazek, 3, 300, 15, $TypeTexts, $Color3);
    32   imagestring($obrazek, 10, 120, 30, $Percent.' %', $Color3);
    33   imagestring($obrazek, 1, 240, 50, 'Aktualizováno: '.date("m.d.y  H:i"), $Color3);
    34  
     27  $PercentBar = $Percent * 4;
     28  $obrazek = imagecreatetruecolor(400, 40);
     29  $Color1 = imagecolorallocate($obrazek, 225, 246, 247);
     30  $Color2 = imagecolorallocate($obrazek, 77, 225, 251);
     31  $Color3 = imagecolorallocate($obrazek, 2, 9, 199);
     32  imagefilledrectangle($obrazek, 0, 0, 400, 39, $Color1);
     33  imagefilledrectangle($obrazek, 0, 0, $PercentBar, 59, $Color2);
     34  imagestring($obrazek, 10, 120, 5, $NumberTranslate.'/'.$NumberAJ, $Color3);
     35  imagestring($obrazek, 3, 300, 5, $TypeTexts, $Color3);
     36  imagestring($obrazek, 10, 120, 20, $Percent.' %', $Color3);
     37  imagestring($obrazek, 1, 240, 30, 'Aktualizace: '.date("m.d.y  H:i"), $Color3);
    3538 
    3639  header('Content-Type: image/png');
  • trunk/includes/config.sample.php

    r43 r49  
    66    'User' => 'root',
    77    'Password' => '',
    8     'Database' => 'quests',
     8    'Database' => 'wowpreklad',
    99    'DatabaseCharacters' => 'characters',
    1010    'DatabaseMangos' => 'mangos',
     
    1616    'Charset' => 'utf-8',
    1717    'BaseURL' => 'http://localhost/',
     18        'AdminEmail' => 'admin@localhost',
    1819  ),
    1920);
  • trunk/includes/databaseconection.php

    r47 r49  
    2222  {
    2323    $ReturnCommand = mysql_query($Command, $this->id_connection);
    24     return $ReturnCommand;
     24        if(mysql_error() != '') echo('<div>'.mysql_error().'<br>'.$Command.'</div>');
     25    return($ReturnCommand);
    2526  }
    2627   
  • trunk/includes/global.php

    r48 r49  
    44
    55// SQL injection hack protection
    6 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($_POST[$Index]);
     6foreach($_POST as $Index => $Item)
     7{
     8  if(is_array($_POST[$Index]))
     9    foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2);
     10  else $_POST[$Index] = addslashes($_POST[$Index]);
     11}
    712foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    813
     
    7075    'index.php?Logout' => array(LICENCE_USER, 'Odhlášení ze systému', 'Odhlásit'),
    7176        'log.php' => array(LICENCE_MODERATOR, 'Log dění (Pouze moderátor)', 'Záznamy'),
    72         'priorite.php' => array(LICENCE_ADMIN, 'Načtení priority questů (pouze admin)', 'Priorita'),
    73         'fill_database.php' => array(LICENCE_ADMIN, 'Načtení questů do database (pouze admin)', 'Plnění databáse'),
     77        'fill_database.php' => array(LICENCE_ADMIN, 'Načtení questů do database (pouze admin)', 'Import textů z MaNGOSu'),
    7478        //'client_files/generate_SQL.php' => array(LICENCE_ADMIN, 'Generování clientských souborů (pouze admin)', 'Generování C.S.'),
    7579    'https://wow.zdechov.net/mysql/' => array(LICENCE_ADMIN, 'phpMyAdmin(pouze admin)', 'Správa databáze'),
     
    8690  echo('<br />');
    8791 
     92  echo('<strong>Překladové skupiny:</strong><br />');
    8893  foreach($TranslationTree as $Group)
    8994  {
     
    9196      <a href="TranslationList.php?group='.$Group['Id'].'&amp;action=filter">'.$Group['Name'].'</a></div>       
    9297      <div id="group'.$Group['Id'].'" class="hidden-menu-item" onmousemove="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">');
    93     echo('&nbsp;<a title="Zde můžete začít překládat" href="TranslationList.php?group='.$Group['Id'].'&amp;action=selection">Nepřeložené</a><br />
     98    echo('&nbsp;<a title="Zde můžete začít překládat" href="TranslationList.php?group='.$Group['Id'].'&amp;action=notran">Nepřeložené</a><br />
    9499      &nbsp;<a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="TranslationList.php?group='.$Group['Id'].'&amp;action=Translate">Přeložené</a><br />');
    95100    if(Licence(LICENCE_USER))
     
    104109      echo('&nbsp;<a title="Zkontrolované překlady" href="TranslationList.php?group='.$Group['Id'].'&amp;action=check">Zkontrolované</a><br />');
    105110    }
    106     echo('&nbsp;<a title="Sestavit speciální fitr" href="TranslationList.php?group='.$Group['Id'].'&amp;action=filter">Filtr</a><br />');
     111    echo('&nbsp;<a title="Sestavit speciální filtr" href="TranslationList.php?group='.$Group['Id'].'&amp;action=filter">Filtr</a><br />');
    107112    echo('</div>');
    108113  }
  • trunk/includes/global_function.php

    r48 r49  
    8787  while($DbRow = mysql_fetch_assoc($DbResult))
    8888  {
    89         $Result[$DbRow['Group']]['Items'][$DbRow['Id']] = $DbRow;
     89        $Result[$DbRow['Group']]['Items'][] = $DbRow;
    9090  }
    9191  return($Result);
    9292}
    93 
    94 $Texts = array
    95 (
    96   //array('Title'),
    97   array('Details'),
    98   array('Objectives'),
    99   array('OfferRewardText'),
    100   array('RequestItemsText'),
    101   array('EndText'),
    102   array('ObjectiveText1'),
    103   array('ObjectiveText2'),
    104   array('ObjectiveText3'),
    105   array('ObjectiveText4'),
    106 );
    10793
    10894$LogTypes = array
     
    128114  $user = @$_SESSION['UserID'];
    129115  $Database->SelectDatabase($Config['Database']['Database']);   
    130   $Database->SQLCommand('INSERT INTO `log` ( `user` , `type` , `text` , `date` , `IP` )
    131    VALUES ( "'.$user.'", "'.$Type.'", "'.$Text.'", NOW(), "'.$_SERVER['REMOTE_ADDR'].'")');
     116  $Query = 'INSERT INTO `log` ( `user` , `type` , `text` , `date` , `IP` )
     117   VALUES ('.$user.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.addslashes($_SERVER['REMOTE_ADDR']).'")';
     118  $Database->SQLCommand($Query);
    132119}
    133120
    134 $npc_text = array
    135 (
    136   '0' => 'text0_0',
    137   '1' => 'text0_1',
    138   '2' => 'text1_0',
    139   '3' => 'text1_1',
    140   '4' => 'text2_0',
    141   '5' => 'text2_1',
    142   '6' => 'text3_0',
    143   '7' => 'text3_1',
    144   '8' => 'text4_0',
    145   '9' => 'text4_1',
    146   '10' => 'text5_0',
    147   '11' => 'text5_1',
    148   '12' => 'text6_0',
    149   '13' => 'text6_1',
    150   '14' => 'text7_0',
    151   '15' => 'text7_1',
    152 );
    153 
    154 $page_text = array
    155 (
    156   '0' => 'text',
    157 );
    158121
    159122$client_files = array
     
    168131);
    169132
    170 $client_text = array
    171 (
    172   '0' => 'text',
    173 );
    174 
    175133?>
  • trunk/index.php

    r47 r49  
    4141  - Pro překládání nestačí vložit text do PC Translatoru a nechat ho zpracovat. Je nutné provést ruční kontrolu a překlad.<br />
    4242  - Doporučujeme používat prohlížeč Mozilla Firefox a stáhnout si něj rozšiření pro kontrolu pravopisu:
    43   <a href="https://addons.mozilla.org/cs/firefox/browse/type:3">Rozšíření do mozily</a><br />
     43  <a href="https://addons.mozilla.org/cs/firefox/browse/type:3">Rozšíření do Firefoxu</a><br />
    4444  <br />
    4545 
    4646<?php
    4747//  Některé texty najdete <a href="http://wow-cz.wz.cz/index.php">zde</a>
    48   if (Licence(0))
     48  if(Licence(LICENCE_USER))
    4949  {
    50 
     50/*
    5151    $UserID = $_SESSION['UserID'];
    5252    $ID = $Database->SQLCommand("SELECT COUNT(*) FROM quests WHERE User='$UserID' AND complete = 0");
     
    5959    if($ID['Email'] == '')   
    6060      echo('<span style="color: red"><b>Nemáte nastavený e-mail, <a href="Options.php">nastavit</a></b></span>');
    61 
     61*/
    6262  }
    6363         
  • trunk/log.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php'); 
     3include('includes/global.php'); 
    44 
    5   echo '<b>Filtr: </b>';
    6     Echo '<a href="log.php" Title="Bez filtrování"><span style="color:black">Všechny</span></a> ';
     5echo('<b>Filtr: </b>');
     6echo('<a href="log.php" title="Bez filtrování"><span style="color:black">Všechny</span></a> ');
     7foreach($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> ');
     10}
     11
     12// echo ' Formát: datum: text zprávy (uživatel, IP)<br /><br />';
     13echo('<br /><br />');
     14
     15if(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);
     23while($Line = mysql_fetch_array($ID))
     24{
    725  foreach($LogTypes as $Index => $LogItem)
    826  {
    9     Echo '<a href="log.php?type='.$LogItem[0].'" Title="'.$LogItem[3].'"><span style="color:'.$LogItem[2].'">'.$LogItem[1].'</span></a> ';
     27    if($Line['type'] == $LogItem[0]) $color = $LogItem[2];
    1028  }
     29  echo($Line['date'].': <span style="color:'.$color.'">'.$Line['text'].'</span> ('.$Line['user'].', '.$Line['IP'].')<br />');
     30}           
     31         
     32ShowFooter();     
    1133
    12 
    13      // echo ' Formát: datum: text zprávy (uživatel, IP)<br /><br />';
    14      echo '<br /><br />';
    15 
    16   if (array_key_exists('type', $_GET)) {
    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
    21        FROM log ORDER BY date DESC LIMIT 100";
    22        
    23        
    24       $ID = $Database->SQLCommand($sql);
    25       while ($Line = mysql_fetch_array($ID)) {
    26         foreach($LogTypes as $Index => $LogItem)
    27         {
    28           if ($Line['type'] == $LogItem[0]) { $color = $LogItem[2]; }
    29         }
    30         echo $Line['date'].': <span style="color:'.$color.'">'.$Line['text'].'</span> ('.$Line['user'].', '.$Line['IP'].')<br />';
    31       }     
    32          
    33   ShowFooter();     
    3434?>
  • trunk/registrace.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
    44 
    5   if (array_key_exists('user', $_POST)) {
    6 
     5if(array_key_exists('user', $_POST))
     6{
    77  $User = $_POST['user'];
    88  $Pass = $_POST['pass'];
     
    1111  $Language = $_POST['Language'];
    1212
    13   if ($Pass == $Pass2) {
    14    
     13  if($Pass == $Pass2)
     14  {
    1515    $Line = mysql_fetch_row($Database->SQLCommand("SELECT * FROM user WHERE user = '$User'"));
    16     if (!$Line) {
     16    if(!$Line)
     17        {
    1718      $Addres = $_SERVER['REMOTE_ADDR'];
    1819      $Database->SQLCommand("INSERT INTO `user` (`user` , `pass` , `LastIP` , `LastLogin` , `Email` , `Language` )
    1920      VALUES ('$User','$Pass','$Addres',now(),'$Email','$Language')");
    2021   //   $Database->SQLCommand("INSERT INTO user () VALUES('$User','$Pass','0','$Addres',now(),'0','$Email')");
    21       echo 'Registrace proběhla úspěšně<br />';
     22      echo('Registrace proběhla úspěšně<br />)');
    2223      WriteLog('Uživatel se zaregistroval: '.$User, 3);
    2324     
     
    2930     
    3031 // echo $Database->id_connection;
    31     } else {
    32       echo 'Uživatel s touto přezdívkou již existuje
    33      <A href="registrace.php">zpět</a>';
     32    } else
     33        {
     34      echo('Uživatel s touto přezdívkou již existuje. <a href="registrace.php">Zpět</a>');
    3435    }
    35   } else {
    36     echo 'Hesla se neshodují
    37      <A href="registrace.php">zpět</a>';
    38   }
    39    
    40 } else {
    41 
    42 ?>
    43   <form action="registrace.php" method="post">
     36  } else
     37  {
     38        echo('Hesla se neshodují. <a href="registrace.php">Zpět</a>');
     39  }   
     40} else
     41{
     42  echo('<form action="registrace.php" method="post">
    4443  <table>
    4544    <tr>
    4645      <td>Jméno:</td>
    47       <td><input type="text" name="user"></td>
     46      <td><input type="text" name="user" /></td>
    4847    </tr>
    4948    <tr>
    5049      <td>Heslo:</td>
    51       <td><input type="password" name="pass"></td>
     50      <td><input type="password" name="pass" /></td>
    5251    </tr>
    5352    <tr>
    5453      <td>Potvrzení Hesla: </td>
    55       <td><input type="password" name="pass2"></td>
     54      <td><input type="password" name="pass2" /></td>
    5655    </tr>
    5756    <tr>
    5857      <td>Email: </td>
    59       <td><input type="text" name="Email"></td>
     58      <td><input type="text" name="Email" /></td>
    6059    </tr>
    6160    <tr>
    6261      <td>Normálně budu překládat do: </td>
    63       <td><?php WriteLanguages($Line['Language']); ?></td>
     62      <td>'); WriteLanguages(1); echo('</td>
    6463    </tr>
     64    <tr>
     65      <th><input type="submit" value="Registrovat" /></th>
     66    </tr>
     67  </table></form>');
     68}
     69 
     70ShowFooter();     
    6571
    66 
    67     <tr>
    68       <th><input type="submit" value="Registrovat"></th>
    69     </tr>
    70   </table>
    71 </form>
    72 
    73 <?php 
    74 
    75 }
    76        
    77   ShowFooter();     
    7872?>
  • trunk/save.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
    44
    5   // SQL injection hack protection
    6   foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
    7   foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    85
    9   //ochrana proti neoprávněnému přístupu
    10   if (Licence(0) == false) { die('Nemáte přístup do této sekce! Přihlašte se...'); }
     6// Ochrana proti neoprávněnému přístupu
     7if(Licence(LICENCE_USER) == false) die('Nemáte přístup do této sekce! Je nutné se přihásit.');
    118
    12   if (array_key_exists('entry', $_POST)) {
     9if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
     10$Table = $TranslationTree[$GroupId]['TablePrefix'];
     11
     12if(array_key_exists('entry', $_POST))
     13{
     14  $entry = $_POST['entry']; 
     15  $UserID = $_SESSION['UserID'];
     16  $TextID = $_POST['ID'];
     17  $Language = $_POST['Language'];
     18  if(array_key_exists('End', $_POST)) $complete = 1;
     19    else $complete = 0;
     20         
     21  if(array_key_exists('Repair', $_POST) and Licence(1))
     22  {
     23    $Line = mysql_fetch_array($Database->SQLCommand('SELECT user FROM '.$Table.' Where ID = '.$TextID));
     24    $UserID = $Line['user'];   
     25    $complete = 1;
     26    WriteLog($TranslationTree[$GroupId]['Name'].' '.$entry.' Opraven moderátorem! <a href="form.php?group='.$GroupId.'&amp;ID='.$TextID.'">'.$TextID.'</a>', 4);
     27  }
     28     
     29  //if(( == '') AND ($complete == 1)) die('Musite zadat název textu');
    1330   
    14     $entry = $_POST['entry']; 
    15     $Title = $_POST['Title']; 
    16     $Details = @$_POST['Details'];
    17     $Objectives = @$_POST['Objectives'];
    18     $OfferRewardText = @$_POST['OfferRewardText'];
    19     $RequestItemsText = @$_POST['RequestItemsText'];
    20     $EndText = @$_POST['EndText'];
    21     $ObjectiveText1 = @$_POST['ObjectiveText1'];
    22     $ObjectiveText2 = @$_POST['ObjectiveText2'];
    23     $ObjectiveText3 = @$_POST['ObjectiveText3'];
    24     $ObjectiveText4 = @$_POST['ObjectiveText4'];
    25 
    26     $UserID = $_SESSION['UserID'];
    27     $QuestID = $_POST['ID'];
    28     $Language = $_POST['Language'];
    29     if (array_key_exists('End', $_POST))
    30       $complete = 1;
    31     else
    32       $complete = 0;
     31  $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM '.$Table.' WHERE user='.$UserID.' AND entry = '.$entry));
     32  if(!$Line)
     33  {
     34        $Columns = '`entry`, `Language` , `User` , `complete` , `Take` , `Vote` , `CountVote`';
     35        $Values = $entry.','.$Language.','.$UserID.','.$complete.','.$TextID.', 3 ,1';
     36        foreach($TranslationTree[$GroupId]['Items'] as $GroupItem)
     37        {
     38          $Columns .= ', `'.$GroupItem['Column'].'`';
     39          $Values .= ', "'.@$_POST[$GroupItem['Column']].'"';
     40        } 
     41        //echo('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')');
     42    $Database->SQLCommand('INSERT INTO `'.$Table.'` ('.$Columns.') VALUES ('.$Values.')');
     43        $LastID = mysql_insert_id();
     44    echo('Překlad <a href="form.php?group='.$GroupId.'&amp;ID='.$TextID.'">'.$TextID.'</a> uložen!<br />');
     45    WriteLog($TranslationTree[$GroupId]['Name'].' <a href="form.php?group='.$GroupId.'&amp;ID='.$LastID.'">'.$LastID.'</a> uložen! Převzat z: <a href="form.php?group='.$GroupId.'&amp;ID='.$TextID.'">'.$TextID.'</a>', 1);
     46  } else
     47  {
     48    $sql = 'UPDATE '.$Table.' SET `complete` = '.$complete;
     49        foreach($TranslationTree[$GroupId]['Items'] as $GroupItem)
     50          $sql .= ', `'.$GroupItem['Column'].'`="'.@$_POST[$GroupItem['Column']].'"';
     51        $sql .= ', `Language` = '.$Language.', `Vote` = 3, `CountVote` = 1, admin_check = 0
     52        WHERE ID = '.$TextID.' AND Language <> 0';
     53        //echo($sql);
     54    $Database->SQLCommand($sql);
     55    //  echo $sql.'<br />';     
     56    echo('Změny v překladu: <a href="form.php?group='.$GroupId.'&amp;ID='.$TextID.'">'.$TextID.'</a> uloženy!<br />');
     57    WriteLog('Změny v překladu: '.$entry.' uloženy! <a href="form.php?group='.$GroupId.'&amp;ID='.$TextID.'">'.$TextID.'</a>', 1);
     58    $Database->SQLCommand('DELETE FROM `'.$Table.'_vote` WHERE `TextId` = '.$TextID);
     59    $type_translation = 1;
     60    $ID_translation = $TextID;
     61    $Database->SQLCommand("DELETE FROM tag WHERE ID_translation = $ID_translation AND type_translation = $type_translation");
     62  }
     63   
     64  echo('Překládat: <a href="TranslationList.php?group='.$GroupId.'&amp;action=notran">Nepřeložené</a>');
     65}
    3366         
    34     if ($complete == 1) $Database->SQLCommand("DELETE FROM `quests`.`quests_status` WHERE QuestEntry = '$entry'");
    35 
    36     if (array_key_exists('Repair', $_POST) and Licence(1)) {
    37       $Line = mysql_fetch_array($Database->SQLCommand("SELECT user FROM quests Where ID = '$QuestID'"));
    38       $UserID = $Line['user'];   
    39       $complete = 1;
    40       WriteLog('Quest: '.$entry.' Opraven moderátorem! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 4);
    41     }
    42      
    43     if (($Title == '') AND ($complete == 1)) die('Musite zadat název Q');
    44    
    45     $Line = mysql_fetch_array($Database->SQLCommand("SELECT * FROM quests WHERE user='$UserID' AND entry = '$entry'"));
    46     if (!$Line) {
    47    
    48       $Database->SQLCommand("INSERT INTO `quests` (`entry` , `Title` , `Details` , `Objectives` , `OfferRewardText` , `RequestItemsText` ,
    49       `EndText` , `ObjectiveText1` , `ObjectiveText2` , `ObjectiveText3` , `ObjectiveText4` , `Language` , `User` , `complete` , `Take` , `Vote` , `CountVote` )
    50       VALUES('$entry','$Title','$Details','$Objectives','$OfferRewardText','$RequestItemsText','$EndText','$ObjectiveText1',
    51       '$ObjectiveText2','$ObjectiveText3','$ObjectiveText4','$Language','$UserID','$complete','$QuestID','3','1')");
    52       echo 'Quest: '.$entry.' uložen!<br />';
    53       WriteLog('Quest: '.$entry.' uložen! Přvzat z: <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1);
    54     } else {
    55       $sql = "UPDATE quests SET complete = '$complete', Title = '$Title',
    56        Details = '$Details', Objectives = '$Objectives',
    57        OfferRewardText = '$OfferRewardText', RequestItemsText = '$RequestItemsText',
    58        EndText = '$EndText', ObjectiveText1 = '$ObjectiveText1', ObjectiveText2 = '$ObjectiveText2',
    59        ObjectiveText3 = '$ObjectiveText3', ObjectiveText4 = '$ObjectiveText4', Language = '$Language',
    60        Vote = '3', CountVote = '1', admin_check = '0'
    61         WHERE ID = ".$QuestID." AND Language <> 0";
    62       $Database->SQLCommand($sql);
    63     //  echo $sql.'<br />';     
    64       echo 'Změny v Questu: <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a> uloženy!<br />';
    65       WriteLog('Změny v Questu: '.$entry.' uloženy! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1);
    66       $Database->SQLCommand("DELETE FROM `quests_vote` WHERE `quests_vote`.`IDquest` = ".$QuestID);
    67       $type_translation = 1;
    68       $ID_translation = $QuestID;
    69       $Database->SQLCommand("DELETE FROM tag WHERE ID_translation = $ID_translation AND type_translation = $type_translation");
    70     }
    71    
    72     echo 'Překládat: <a href="ListQuests.php?selection">Nepřeložené</a> ';
    73      
    74   }
    75          
    76   ShowFooter();     
     67ShowFooter();     
    7768?>
  • trunk/statistic.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
     4
     5echo('<strong>Statistika:</strong><br />');
     6foreach($TranslationTree as $Group)
     7  if($Group['TablePrefix'] != '') echo('<img alt="'.$Group['TablePrefix'].'" src="img_statistic.php?TypeText='.$Group['TablePrefix'].'" title="statistika překladů '.$Group['Name'].'" style="margin: 2px 0px 0px 0px;" /><br />');
     8
     9echo('<br />
     10<b>Statistika v závislosti na čase: </b><a href="http://stat.zdechov.net/game/?Measure=18">Počet přeložených textů</a><br />
     11<br />
     12Počet stáhnutí přeložených textů v SQL souboru: <b>');
     13       
     14$ID = $Database->SQLCommand("SELECT count(distinct(IP)) FROM log WHERE type = 2");
     15$Line = mysql_fetch_row($ID);
     16echo($Line[0]);
     17
     18echo('</b><br />
     19Počet stáhnutí CZWoW pro clienta: <b>');
     20     
     21$ID = $Database->SQLCommand("SELECT count(distinct(IP)) FROM log WHERE type = 0");
     22$Line = mysql_fetch_row($ID);
     23echo($Line[0]);
     24
     25echo('</b><br /><br />
     26<b>Seznam uživatelů: </b>
     27<table border="1" cellpadding="2" cellspacing="0">');
     28
     29if(array_key_exists('order', $_GET))
     30{
     31  $order = $_GET['order'];
     32  $desc = $_GET['desc'];
     33} else
     34{
     35  $order = 'NumberTranslate';
     36  $desc = '';
     37}
     38
     39if($desc == '') $desc = 'desc'; else $desc = '';
     40
     41echo('<tr><th><a href="?order=user&amp;desc='.$desc.'">Jméno</a></th>
     42  <th><a href="statistic.php?order=NumberTranslate&amp;desc='.$desc.'" title="Počet přeložených textů">Přeložených</a></th>
     43  <th><a href="statistic.php?order=Vote&amp;desc='.$desc.'" title="Průměrná známka textů">Průměrná známka</a></th>
     44  <th><a href="statistic.php?order=GM&amp;desc='.$desc.'">Oprávnění</a></th>
     45  <th><a href="statistic.php?order=LastLogin&amp;desc='.$desc.'">Poslední připojení</a></th></tr>');
     46
     47$Query = 'SELECT ID,user, LastLogin, GM, (';
     48foreach($TranslationTree as $Group);
     49  if($Group['TablePrefix'] != '')
     50    $Query .= '(SELECT count(*) FROM `'.$Group['TablePrefix'].'` WHERE User = user.ID AND Complete = 1 AND Language <> 0) + ';
     51$Query .= '0) as NumberTranslate, (';
     52foreach($TranslationTree as $Group)
     53  if($Group['TablePrefix'] != '')
     54    $Query .= 'IFNULL((SELECT sum(Vote) AS Vote FROM `'.$Group['TablePrefix'].'` WHERE User = user.ID AND Complete =1 AND Language <> 0), 0) + ';
     55$Query .= '0) / (';
     56foreach($TranslationTree as $Group)
     57  if($Group['TablePrefix'] != '')
     58    $Query .= '(SELECT count(Vote) AS Vote FROM `'.$Group['TablePrefix'].'` WHERE User = user.ID AND Complete =1 AND Language <> 0) + ';
     59$Query .= '0) AS Vote FROM `user` ORDER BY '.$order.' '.$desc;
     60$ID = $Database->SQLCommand($Query);
     61while($Line = mysql_fetch_array($ID))
     62{
     63  if(Licence(LICENCE_MODERATOR))
     64    $Name = '<a href="user.php?user='.$Line['ID'].'">'.$Line['user'].'</a>';
     65    else $Name = $Line['user'];
     66       
     67    echo('<tr><td>'.$Name.'</td>
     68      <td>'.$Line['NumberTranslate'].'</td>
     69      <td>'.substr($Line['Vote'], 0, 4).'</td>
     70      <td>'.$Moderators[$Line['GM']].'</td>
     71      <td>'.$Line['LastLogin'].'</td></tr>');
     72}
     73echo('</table>');
     74         
     75ShowFooter();     
    476
    577?>
    6 
    7 <b>Statistika:</b><br>
    8  <img alt="quests" src="img_statistic.php?TypeText=quests" title="statistika překladu úkolů" style="margin: 2px 0px 0px 0px;"><br />
    9  <img alt="npc_text" src="img_statistic.php?TypeText=npc_text" title="statistika překladu NPC_textů" style="margin: 2px 0px 0px 0px;"><br />
    10  <img alt="page_text" src="img_statistic.php?TypeText=page_text" title="statistika překladu page_textů" style="margin: 2px 0px 0px 0px;"><br />
    11 <?php // <img alt="page_text" src="img_statistic.php?TypeText=client_text" title="statistika překladu client_textů" style="margin: 2px 0px 0px 0px;"><br />
    12 ?>
    13 
    14 <br>
    15 <b>Statistika v závislosti na čase: </b><a href="http://stat.zdechov.net/game/?Measure=18">Počet přeložených textů</a><br>
    16 <br />
    17 Počet stáhnutí přeložených textů v SQL souboru: <b>
    18 <?php
    19        
    20       $ID = $Database->SQLCommand("SELECT count(distinct(IP)) FROM log WHERE type = 2");
    21       $Line = mysql_fetch_row($ID);
    22       echo $Line[0];
    23 ?>
    24 </b><br />
    25 Počet stáhnutí CZWoW pro clienta: <b>
    26 <?php
    27        
    28       $ID = $Database->SQLCommand("SELECT count(distinct(IP)) FROM log WHERE type = 0");
    29       $Line = mysql_fetch_row($ID);
    30       echo $Line[0];
    31 ?>
    32 </b><br /><br />
    33 <b>Seznam uživatelů: </b>
    34 <table border="1" cellpadding="2" cellspacing="0">
    35 <?php 
    36 
    37   if(array_key_exists('order', $_GET)) {
    38     $order = $_GET['order'];
    39     $desc = $_GET['desc'];
    40   } else {
    41     $order = 'NumberTranslate';
    42     $desc = '';
    43   }
    44 
    45   if ($desc == '') $desc = 'desc'; else $desc = '';
    46 
    47   echo '<tr><th><a href="statistic.php?order=user&amp;desc='.$desc.'">Jméno</a></th>
    48   <th><a href="statistic.php?order=NumberTranslate&amp;desc='.$desc.'" Title="Počet přeložených textů">Přeložených</a></th>
    49   <th><a href="statistic.php?order=Vote&amp;desc='.$desc.'" Title="Průměrná známka textů">Průměrná známka</a></th>
    50   <th><a href="statistic.php?order=GM&amp;desc='.$desc.'">Oprávnění</a></th>
    51   <th><a href="statistic.php?order=LastLogin&amp;desc='.$desc.'">Poslední připojení</a></th></tr>';
    52 
    53 /*
    54 SELECT user, LastLogin, GM, (
    55      (SELECT count(*) FROM `quests` WHERE User = user.ID AND User <> 0 AND Complete = 1) +
    56      (SELECT count(*) FROM `npc_text` WHERE User = user.ID AND User <> 0 AND Complete = 1) +
    57      (SELECT count(*) FROM `page_text` WHERE User = user.ID AND User <> 0 AND Complete = 1)
    58    ) as NumberTranslate, (
    59      SELECT IFNULL((SELECT AVG(Vote) AS Vote FROM `quests` WHERE User = user.ID AND Complete =1),0)
    60      + IFNULL((SELECT AVG(Vote) AS Vote FROM `page_text` WHERE User = user.ID AND Complete =1),0)
    61      + IFNULL((SELECT AVG(Vote) AS Vote FROM `npc_text` WHERE User = user.ID AND Complete =1),0)
    62      ) /3 AS Vote
    63    FROM `user`
    64    
    65    */
    66 
    67   $ID = $Database->SQLCommand("
    68   SELECT ID,user, LastLogin, GM, (
    69      (SELECT count(*) FROM `quests` WHERE User = user.ID AND Complete = 1 AND Language <> 0)
    70     + (SELECT count(*) FROM `npc_text` WHERE User = user.ID AND Complete = 1 AND Language <> 0)
    71     + (SELECT count(*) FROM `page_text` WHERE User = user.ID AND Complete = 1 AND Language <> 0)
    72     + (SELECT count(*) FROM `client_text` WHERE User = user.ID AND Complete = 1 AND Language <> 0)
    73    ) as NumberTranslate, (
    74        IFNULL((SELECT sum(Vote) AS Vote FROM `quests` WHERE User = user.ID AND Complete =1 AND Language <> 0),0)
    75      + IFNULL((SELECT sum(Vote) AS Vote FROM `page_text` WHERE User = user.ID AND Complete =1 AND Language <> 0),0)
    76      + IFNULL((SELECT sum(Vote) AS Vote FROM `npc_text` WHERE User = user.ID AND Complete =1 AND Language <> 0),0)
    77      + IFNULL((SELECT sum(Vote) AS Vote FROM `client_text` WHERE User = user.ID AND Complete =1 AND Language <> 0),0)
    78      ) / (
    79        (SELECT count(Vote) AS Vote FROM `quests` WHERE User = user.ID AND Complete =1 AND Language <> 0)
    80      + (SELECT count(Vote) AS Vote FROM `page_text` WHERE User = user.ID AND Complete =1 AND Language <> 0)
    81      + (SELECT count(Vote) AS Vote FROM `npc_text` WHERE User = user.ID AND Complete =1 AND Language <> 0)
    82      + (SELECT count(Vote) AS Vote FROM `client_text` WHERE User = user.ID AND Complete =1 AND Language <> 0)
    83      ) AS Vote
    84    FROM `user` ORDER BY $order $desc");
    85    
    86       while ($Line = mysql_fetch_array($ID)) {
    87              
    88         if (Licence(1))
    89           $Name = '<a href="user.php?user='.$Line['ID'].'">'.$Line['user'].'</a>';
    90         else
    91           $Name = $Line['user'];
    92        
    93         echo '<tr><td>'.$Name.'</td>
    94         <td>'.$Line['NumberTranslate'].'</td>
    95         <td>'.substr($Line['Vote'], 0, 4).'</td>
    96         <td>'.$Moderators[$Line['GM']].'</td>
    97         <td>'.$Line['LastLogin'].'</td></tr>';
    98          
    99       }
    100          
    101   echo '</table>';
    102          
    103   ShowFooter();     
    104 ?>
  • trunk/user.php

    r43 r49  
    11<?php
    22
    3   include('includes/global.php');
     3include('includes/global.php');
    44
    5   // SQL injection hack protection
    6   foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
    7   foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    8 
    9 
    10   if (array_key_exists('text', $_POST) and Licence(2)) {
    11     $text = $_POST['text'];
    12     $email = $_POST['email'];
    13     $subject = $_POST['subject'];
    14     echo 'email: <b>'.$email.'</b><br />';
    15     echo 'předmět: <b>'.$subject.'</b><br />';
    16     echo 'text: <b>'.$text.'</b><br />';
     5if(array_key_exists('text', $_POST) and Licence(LICENCE_ADMIN))
     6{
     7  $text = $_POST['text'];
     8  $email = $_POST['email'];
     9  $subject = $_POST['subject'];
     10  echo('email: <b>'.$email.'</b><br />');
     11  echo('předmět: <b>'.$subject.'</b><br />');
     12  echo('text: <b>'.$text.'</b><br />');
    1713   
    18     if(@mail($email, $subject, $text, "From: maron2@centrum.cz\nReply-To: maron2@centrum.cz\nX-Mailer: PHP/")){
    19     echo 'Zpráva byla odeslána.<br /><br />';
    20       }
    21     else{ echo "Nepodařilo se odesat E-mail.<br /><br />"; };
    22    
     14  if(@mail($email, $subject, $text, 'From: '.$Config['Web']['AdminEmail'].'\nReply-To: '.$Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))
     15  {
     16    echo('Zpráva byla odeslána.<br /><br />');
    2317  }
     18  else
     19  {
     20    echo('Nepodařilo se odesat E-mail.<br /><br />');
     21  }
     22}
    2423 
    25   if (array_key_exists('user', $_GET) and Licence(1)) {
    26 
    27   $LineUser = mysql_fetch_array($Database->SQLCommand("
    28   SELECT *, (
    29      (SELECT count(*) FROM `quests` WHERE User = ".$_GET['user']." AND User <> 0 AND Complete = 1) +
    30      (SELECT count(*) FROM `npc_text` WHERE User = ".$_GET['user']." AND User <> 0 AND Complete = 1) +
    31      (SELECT count(*) FROM `page_text` WHERE User = ".$_GET['user']." AND User <> 0 AND Complete = 1)
    32    ) as NumberTranslate, (
    33        IFNULL((SELECT sum(Vote) AS Vote FROM `quests` WHERE User = ".$_GET['user']." AND Complete =1),0)
    34      + IFNULL((SELECT sum(Vote) AS Vote FROM `page_text` WHERE User = ".$_GET['user']." AND Complete =1),0)
    35      + IFNULL((SELECT sum(Vote) AS Vote FROM `npc_text` WHERE User = ".$_GET['user']." AND Complete =1),0)
    36      ) / (
    37        (SELECT count(Vote) AS Vote FROM `quests` WHERE User = ".$_GET['user']." AND Complete =1)
    38      + (SELECT count(Vote) AS Vote FROM `page_text` WHERE User = ".$_GET['user']." AND Complete =1)
    39      + (SELECT count(Vote) AS Vote FROM `npc_text` WHERE User = ".$_GET['user']." AND Complete =1)
    40      ) AS Vote
    41    FROM `user` WHERE ID = ".$_GET['user']));
     24if(array_key_exists('user', $_GET) and Licence(LICENCE_MODERATOR))
     25{
     26 
     27  $Query = 'SELECT *, (';
     28  foreach($TranslationTree as $Group)
     29    if($Group['TablePrefix'] != '')
     30          $Query .= '(SELECT count(*) FROM `'.$Group['TablePrefix'].'` WHERE User = '.$_GET['user'].' AND User <> 0 AND Complete = 1) + ';
     31  $Query .= '0) as NumberTranslate, (';
     32  foreach($TranslationTree as $Group)
     33    if($Group['TablePrefix'] != '')
     34      $Query .= 'IFNULL((SELECT sum(Vote) AS Vote FROM `'.$Group['TablePrefix'].'` WHERE User = '.$_GET['user'].' AND Complete = 1), 0) + ';
     35  $Query .= '0) / (';
     36  foreach($TranslationTree as $Group)
     37    if($Group['TablePrefix'] != '')
     38          $Query .= '(SELECT count(Vote) AS Vote FROM `'.$Group['TablePrefix'].'` WHERE User = '.$_GET['user'].' AND Complete = 1) +';
     39  $Query .= '0) AS Vote FROM `user` WHERE ID = '.$_GET['user'];
     40  $LineUser = mysql_fetch_array($Database->SQLCommand($Query));
    4241   
    43     echo 'ID: <b>'.$_GET['user'].'</b><br />';
    44     echo 'Jméno: <b>'.$LineUser['user'].'</b><br />';
    45     echo 'Implicitní jazyk: <b>'.$LineUser['Language'].'</b><br />';
    46     echo 'Posledí připojení: <b>'.$LineUser['LastLogin'].'</b><br />';
    47     echo 'Posledí IP: <b>'.$LineUser['LastIP'].'</b><br />';
    48     echo 'Počet přeložených: <b>'.$LineUser['NumberTranslate'].'</b><br />';
    49     echo 'Průměrná známka: <b>'.$LineUser['Vote'].'</b><br />';
    50     echo 'Email: <b>'.$LineUser['Email'].'</b><br />';
    51     echo '<br>
     42  echo('ID: <b>'.$_GET['user'].'</b><br />');
     43  echo('Jméno: <b>'.$LineUser['user'].'</b><br />');
     44  echo('Výchozí jazyk: <b>'.$LineUser['Language'].'</b><br />');
     45  echo('Poslední připojení: <b>'.$LineUser['LastLogin'].'</b><br />');
     46  echo('Poslední IP: <b>'.$LineUser['LastIP'].'</b><br />');
     47  echo('Počet přeložených: <b>'.$LineUser['NumberTranslate'].'</b><br />');
     48  echo('Průměrná známka: <b>'.$LineUser['Vote'].'</b><br />');
     49  echo('Email: <b>'.$LineUser['Email'].'</b><br />');
     50  echo('<br />
    5251
    5352<form action="user.php" method="post">
    5453Napsat E-mail:
    55 <input type="text" name="email" value="'.$LineUser['Email'].'">
     54<input type="text" name="email" value="'.$LineUser['Email'].'" />
    5655Předmět:
    57 <input type="text" name="subject" value="Projekt překládání textů WoW">
    58 <input type="submit" value="Odeslat">
     56<input type="text" name="subject" value="Projekt překládání textů WoW" />
     57<input type="submit" value="Odeslat" />
    5958<br>
    6059<textarea name="text" rows="20" cols="62">
    61 
    62 
    63 
    6460
    6561S pozdravem '.$_SESSION['User'].'
     
    6763Projekt překládání textů WoW '.$Config['Web']['BaseURL'].'
    6864</textarea>
    69 </form>   
    70     ';
    71    
    72   }
     65</form>');
     66}
    7367
    74   ShowFooter();     
     68ShowFooter();     
     69
    7570?>
    7671
Note: See TracChangeset for help on using the changeset viewer.