Changeset 829 for trunk/Modules


Ignore:
Timestamp:
Mar 25, 2015, 9:18:42 AM (10 years ago)
Author:
chronos
Message:
  • Modified: Changed user Login and Registration form to be horizontally centered.
  • Modified: Disabled public visibility of captured referrers. There is no way how to block spam referrers automatically.
  • Fixed: Indentation in Dictionary module.
Location:
trunk/Modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Dictionary/Dictionary.php

    r816 r829  
    3434class PageDictionary extends Page
    3535{
    36 
    37 function WriteTranslatNames($Text, $mode)
    38 {
    39   $Output = '';
    40   if ($mode == 0) $Output .= '..'.T('Found names of items, places and NPC');
    41   if ($mode == 1) $Output .= '..'.T('All untranslated');
    42   if ($mode == 2) $Output .= '..'.T('Untranslated');
    43   $Output .= '<table class="BaseTable">';
    44   $Output .= '<tr><th>'.T('Original').'</th>'.'<th>'.T('Translation').'</th></tr>';
    45 
    46   $TablesColumn = array
    47   (
    48     'TextGameObject' => 'Name',
    49     'TextCreature' => 'name',
    50     'TextItem' => 'Name',
    51     'TextTransport' => 'Name',
    52     'TextAreaTriggerTeleport' => 'Name',
    53     'TextAreaTriggerTavern' => 'Name',
    54     'Dictionary' => 'Text',
    55     'TextArea' => 'Name',
    56     'TextAreaPOI' => 'Name',
    57     'TextCharacterClass' => 'Name',
    58     'TextCharacterRace' => 'Name1',
    59     'TextItemSubClass' => 'Name',
    60     'TextCreatureType' => 'Name',
    61   );
    62 
    63   $buff = GetTranslatNames($Text,$mode,GetTranslatNamesArray());
    64 
    65    // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
    66   foreach($buff as $Line) {
     36  function WriteTranslatNames($Text, $mode)
     37  {
     38    $Output = '';
     39    if ($mode == 0) $Output .= '..'.T('Found names of items, places and NPC');
     40    if ($mode == 1) $Output .= '..'.T('All untranslated');
     41    if ($mode == 2) $Output .= '..'.T('Untranslated');
     42    $Output .= '<table class="BaseTable">';
     43    $Output .= '<tr><th>'.T('Original').'</th>'.'<th>'.T('Translation').'</th></tr>';
     44
     45    // TODO: Remove static table names in code. They should be controlled from database
     46    $TablesColumn = array
     47    (
     48      'TextGameObject' => 'Name',
     49      'TextCreature' => 'name',
     50      'TextItem' => 'Name',
     51      'TextTransport' => 'Name',
     52      'TextAreaTriggerTeleport' => 'Name',
     53      'TextAreaTriggerTavern' => 'Name',
     54      'Dictionary' => 'Text',
     55      'TextArea' => 'Name',
     56      'TextAreaPOI' => 'Name',
     57      'TextCharacterClass' => 'Name',
     58      'TextCharacterRace' => 'Name1',
     59      'TextItemSubClass' => 'Name',
     60      'TextCreatureType' => 'Name',
     61    );
     62
     63    $buff = GetTranslatNames($Text,$mode,GetTranslatNamesArray());
     64
     65    // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     66    foreach($buff as $Line)
     67    {
    6768      if ($mode == 0)
    6869      {
     
    7677      {
    7778        $Output .= '<tr><td>'.$Line[2].'</td>';
    78           if ($Line[3] <> '') $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">'.$Line[3].'</a></td></tr>';
     79        if ($Line[3] <> '') $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">'.$Line[3].'</a></td></tr>';
    7980          else $Output .= '<td><a target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Line[1].'&amp;ID='.$Line[0]).'">Překládat</a></td></tr>';
    8081      }
    81   }
    82   $Output .= '</table>';
    83   return($Output);
    84 }
    85 
    86 function DictionaryInsert()
    87 {
    88   $Output = '';
    89   if($this->System->User->Licence(LICENCE_USER))
    90   {
    91     $Output .= '<form action="?action=save" method="post">'.
     82    }
     83    $Output .= '</table>';
     84    return($Output);
     85  }
     86
     87  function DictionaryInsert()
     88  {
     89    $Output = '';
     90    if($this->System->User->Licence(LICENCE_USER))
     91    {
     92      $Output .= '<form action="?action=save" method="post">'.
    9293        '<fieldset><legend>Vložení nového slova</legend>'.
    9394        '<table><tr><td>'.
     
    100101        '</fieldset>'.
    101102        '</form>';
    102   } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    103   return($Output);
    104 }
    105 
    106 function DictionarySave()
    107 {
    108   if($this->System->User->Licence(LICENCE_USER))
    109   {
    110     if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))
    111     {
    112       // Check if original text exists and determine entry id
    113       $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '.
    114         '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']);
     103    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
     104    return($Output);
     105  }
     106
     107  function DictionarySave()
     108  {
     109    if($this->System->User->Licence(LICENCE_USER))
     110    {
     111      if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))
     112      {
     113        // Check if original text exists and determine entry id
     114        $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '.
     115          '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']);
     116        if($DbResult->num_rows > 0)
     117        {
     118          $DbRow = $DbResult->fetch_assoc();
     119          $Entry = $DbRow['Entry'];
     120        } else
     121        {
     122          $DbResult = $this->Database->query('SELECT MAX(`Entry`) FROM `Dictionary`');
     123          $DbRow = $DbResult->fetch_row();
     124          $Entry = $DbRow[0] + 1;
     125          $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '.
     126            '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$this->System->Config['OriginalLanguage'].');');
     127        }
     128
     129        $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '.
     130          '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id);
     131        if($DbResult->num_rows > 0)
     132        {
     133          $DbRow = $DbResult->fetch_assoc();
     134          $this->Database->query('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", '.
     135            '`Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']);
     136        } else
     137          $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '.
     138            '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.
     139            $_POST['Description'].'", '.$this->System->User->Id.', '.$_POST['Language'].')');
     140        $Output = ShowMessage('Záznam byl uložen!');
     141      } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL);
     142    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
     143    return($Output);
     144  }
     145
     146  function DictionaryRemove()
     147  {
     148    if($this->System->User->Licence(LICENCE_USER))
     149    {
     150      $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')');
     151      $Output = ShowMessage(T('Record removed'));
     152    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
     153    return($Output);
     154  }
     155
     156  function DictionaryModify()
     157  {
     158    if($this->System->User->Licence(LICENCE_USER))
     159    {
     160      $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1));
    115161      if($DbResult->num_rows > 0)
    116162      {
    117163        $DbRow = $DbResult->fetch_assoc();
    118         $Entry = $DbRow['Entry'];
    119       } else
    120       {
    121         $DbResult = $this->Database->query('SELECT MAX(`Entry`) FROM `Dictionary`');
    122         $DbRow = $DbResult->fetch_row();
    123         $Entry = $DbRow[0] + 1;
    124         $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '.
    125           '`User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$this->System->Config['OriginalLanguage'].');');
    126       }
    127 
    128       $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '.
    129         '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id);
    130       if($DbResult->num_rows > 0)
    131       {
    132         $DbRow = $DbResult->fetch_assoc();
    133         $this->Database->query('UPDATE `Dictionary` SET `Text`="'.$_POST['Translated'].'", '.
    134           '`Description` = "'.$_POST['Description'].'" WHERE Id='.$DbRow['Id']);
    135       } else
    136         $this->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , '.
    137           '`User`, `Language` ) VALUES ("'.$_POST['Translated'].'", "'.$Entry.'", "'.
    138           $_POST['Description'].'", '.$this->System->User->Id.', '.$_POST['Language'].')');
    139       $Output = ShowMessage('Záznam byl uložen!');
    140     } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL);
    141   } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    142   return($Output);
    143 }
    144 
    145 function DictionaryRemove()
    146 {
    147   if($this->System->User->Licence(LICENCE_USER))
    148   {
    149     $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')');
    150     $Output = ShowMessage(T('Record removed'));
    151   } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    152   return($Output);
    153 }
    154 
    155 function DictionaryModify()
    156 {
    157   if($this->System->User->Licence(LICENCE_USER))
    158   {
    159     $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1));
    160     if($DbResult->num_rows > 0)
    161     {
    162       $DbRow = $DbResult->fetch_assoc();
    163       $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '.
    164         'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$this->System->Config['OriginalLanguage'].')');
    165       $DbRow2 = $DbResult->fetch_assoc();
    166       $Output = '<form action="?action=save" method="post">'.
    167         '<fieldset><legend>Upravení slova</legend>'.
    168         '<input type="hidden" name="id"  value="'.$_GET['id'].'"/>'.
    169         '<table><tr><td>'.
    170         'Původní anglické slovo:</td><td><input type="text" name="Original" value="'.$DbRow2['Text'].'" /></td></tr>'.
    171         '<tr><td>Přeložené:</td><td><input type="text" name="Translated"  value="'.$DbRow['Text'].'" /></td></tr>'.
    172         '<tr><td>'.T('Language').':</td><td>'.WriteLanguages($DbRow['Language']).'</td></tr>'.
    173         '<tr><td>'.T('Description').':</td><td><input type="text" name="Description"  value="'.$DbRow['Description'].'" /></td></tr>'.
    174         '<tr><td colspan="2"><input type="submit" value="'.T('Save').'" /></td></tr>'.
    175         '</td></tr></table>'.
    176         '</fieldset>'.
    177         '</form>';
    178     } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    179   } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    180   return($Output);
    181 }
    182 
    183 function DictionaryGroup()
    184 {
    185   global $TranslationTree;
    186 
    187   $Output = '';
    188   $GroupId = LoadGroupIdParameter();
    189   if(array_key_exists('mode', $_GET)) $mode = $_GET['mode'];
    190   else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated
    191   $Table = $TranslationTree[$GroupId]['TablePrefix'];
    192 
    193   if(array_key_exists('ID', $_GET))
    194   {
    195     $TextID = $_GET['ID'];
    196     $Output .= T('Translated names related to translation text').': <a target="_NEW" href="'.$this->System->Link('/form.php?group='.$GroupId.'&amp;ID='.$TextID).'">'.$TextID.'</a><br />'.
     164        $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) '.
     165          'AND (`Entry`='.$DbRow['Entry'].') AND (`Language`= '.$this->System->Config['OriginalLanguage'].')');
     166        $DbRow2 = $DbResult->fetch_assoc();
     167        $Output = '<form action="?action=save" method="post">'.
     168          '<fieldset><legend>Upravení slova</legend>'.
     169          '<input type="hidden" name="id"  value="'.$_GET['id'].'"/>'.
     170          '<table><tr><td>'.
     171          'Původní anglické slovo:</td><td><input type="text" name="Original" value="'.$DbRow2['Text'].'" /></td></tr>'.
     172          '<tr><td>Přeložené:</td><td><input type="text" name="Translated"  value="'.$DbRow['Text'].'" /></td></tr>'.
     173          '<tr><td>'.T('Language').':</td><td>'.WriteLanguages($DbRow['Language']).'</td></tr>'.
     174          '<tr><td>'.T('Description').':</td><td><input type="text" name="Description"  value="'.$DbRow['Description'].'" /></td></tr>'.
     175          '<tr><td colspan="2"><input type="submit" value="'.T('Save').'" /></td></tr>'.
     176          '</td></tr></table>'.
     177          '</fieldset>'.
     178          '</form>';
     179      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
     180    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
     181    return($Output);
     182  }
     183
     184  function DictionaryGroup()
     185  {
     186    global $TranslationTree;
     187
     188    $Output = '';
     189    $GroupId = LoadGroupIdParameter();
     190    if(array_key_exists('mode', $_GET)) $mode = $_GET['mode'];
     191    else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated
     192    $Table = $TranslationTree[$GroupId]['TablePrefix'];
     193
     194    if(array_key_exists('ID', $_GET))
     195    {
     196      $TextID = $_GET['ID'];
     197      $Output .= T('Translated names related to translation text').': <a target="_NEW" href="'.$this->System->Link('/form.php?group='.$GroupId.'&amp;ID='.$TextID).'">'.$TextID.'</a><br />'.
    197198        '<a href="?action=group&amp;mode=1&amp;group='.$GroupId.'&amp;ID='.$TextID.'" title="'.T('Show all similar results').'">'.T('All').'</a> '.
    198199        '<a href="?action=group&amp;mode=0&amp;group='.$GroupId.'&amp;ID='.$TextID.'" title="'.T('Show all exact results').'">'.T('Exact').'</a> '.
    199200        '<a href="?action=group&amp;mode=2&amp;group='.$GroupId.'&amp;ID='.$TextID.'" title="'.T('Show all untranslated').'">'.T('Untranslated').'</a> ';
    200     $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID);
    201     $Line = $DbResult->fetch_assoc();
    202     if(!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL);
    203     else
    204     {
    205       $Text = '';
    206       foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    207         $Text .= ' '.$Line[$TextItem['Column']];
    208       $Output .= $this->WriteTranslatNames($Text, $mode);
    209     }
    210   }
    211   return($Output);
    212 }
    213 
    214 function DictionaryShow()
    215 {
    216   global $LanguageList;
    217 
    218   $Output = '<form action="?" method="get" style="margin: 0px; padding: 0px;">'.
    219   '<table style="width: 100%; height: 100%;">';
    220 
    221   if(array_key_exists('search', $_GET)) $Search = $_GET['search'];
    222     else $Search = '';
    223 
    224   $Output .= '<tr><td>
    225     <input type="text" value="'.$Search.'" name="search" size="30" />
    226     <input type="submit" value="'.T('Search').'" />';
    227   if($this->System->User->Licence(LICENCE_USER))
    228     $Output .= ' <a href="?action=insert">'.T('Add word').'</a>';
    229 
    230   $Output .= '</td></tr>'.
    231     '<tr><td>'.T('Language').': ';
    232   $Lang = '<a href="?language=">'.T('All').'</a>';
    233   if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
    234     else $Output .= $Lang;
    235   foreach($LanguageList as $Language)
    236     if($Language['Enabled'] == 1)
    237     {
    238       $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>';
    239       if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
    240         else $Output .= $Lang;
    241     }
    242   $Output .= '</td></tr>'.
    243     '<tr><td>';
    244   //<div style="overflow: auto; width: 100%; height: 100%;">');
    245 
    246   if(!is_numeric($_SESSION['language'])) $LanguageFilter = '';
    247     else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')';
    248 
    249   if($Search <> '')
    250   {
    251     $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '.
    252       ' (LOWER(`T2`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '.
    253       '(LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%"))';
    254   } else $Condition = '';
    255   $sql = 'SELECT `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId`, '.
     201      $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID);
     202      $Line = $DbResult->fetch_assoc();
     203      if(!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL);
     204      else
     205      {
     206        $Text = '';
     207        foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     208          $Text .= ' '.$Line[$TextItem['Column']];
     209        $Output .= $this->WriteTranslatNames($Text, $mode);
     210      }
     211    }
     212    return($Output);
     213  }
     214
     215  function DictionaryShow()
     216  {
     217    global $LanguageList;
     218
     219    $Output = '<form action="?" method="get" style="margin: 0px; padding: 0px;">'.
     220      '<table style="width: 100%; height: 100%;">';
     221
     222    if(array_key_exists('search', $_GET)) $Search = $_GET['search'];
     223      else $Search = '';
     224
     225    $Output .= '<tr><td>
     226      <input type="text" value="'.$Search.'" name="search" size="30" />
     227      <input type="submit" value="'.T('Search').'" />';
     228    if($this->System->User->Licence(LICENCE_USER))
     229      $Output .= ' <a href="?action=insert">'.T('Add word').'</a>';
     230
     231    $Output .= '</td></tr>'.
     232      '<tr><td>'.T('Language').': ';
     233    $Lang = '<a href="?language=">'.T('All').'</a>';
     234    if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
     235      else $Output .= $Lang;
     236    foreach($LanguageList as $Language)
     237      if($Language['Enabled'] == 1)
     238      {
     239        $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>';
     240        if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
     241          else $Output .= $Lang;
     242      }
     243    $Output .= '</td></tr>'.
     244      '<tr><td>';
     245
     246    if(!is_numeric($_SESSION['language'])) $LanguageFilter = '';
     247      else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')';
     248
     249    if($Search <> '')
     250    {
     251      $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '.
     252        ' (LOWER(`T2`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '.
     253        '(LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%"))';
     254    } else $Condition = '';
     255    $sql = 'SELECT `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId`, '.
    256256      '`Language`.`Name` AS `LangName`, `T1`.`Id` AS `Id`, '.
    257257      '`T1`.`Entry`, `T2`.`Text` AS `Original`, `T1`.`Text` AS `Translated`, `T1`.`Description` '.
     
    263263      $LanguageFilter.$Condition;
    264264
    265   $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');
    266   $DbRow = $DbResult->fetch_row();
    267   $PageList = GetPageList($DbRow[0]);
    268 
    269   $Output .= $PageList['Output'];
    270 
    271   if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
    272     else $LanguageName = 'Překlad';
    273   $TableColumns = array(
    274     array('Name' => 'Original', 'Title' => T('English')),
    275     array('Name' => 'Translated', 'Title' => $LanguageName),
    276   );
    277   if(!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language'));
    278   $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description'));
    279   $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator'));
    280   if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));
    281   $Order = GetOrderTableHeader($TableColumns, 'Original');
    282   $Output .= '<table class="BaseTable">'.$Order['Output'];
    283 
    284   $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit'];
    285   $DbResult = $this->Database->query($sql_page);
    286   while($Line = $DbResult->fetch_assoc())
    287   {
    288     $Output .= '<tr>'.
    289     '<td>'.$Line['Original'].'</td>'.
    290     '<td><strong>'.$Line['Translated'].'</strong></td>';
    291     if(!is_numeric($_SESSION['language'])) $Output .= '<td>'.$Line['LangName'].'</td>';
    292     $Output .= '<td>'.$Line['Description'].'</td>'.
    293     '<td><a href="'.$this->System->Link('/user.php?user='.$Line['UserId']).'">'.$Line['UserName'].'</a></td>';
    294     if($this->System->User->Licence(LICENCE_USER))
    295     {
    296       if($Line['UserId'] == $this->System->User->Id)
    297         $Output .= '<td><a href="?action=remove&amp;id='.$Line['Id'].'" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'.
    298         ' <a href="?action=modify&amp;id='.$Line['Id'].'">'.T('Modify').'</a></td>';
    299         else $Output .= '<td></td>';
    300     }
    301     $Output .= '</tr>';
    302   }
    303   $Output .= '</table>'.
     265    $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');
     266    $DbRow = $DbResult->fetch_row();
     267    $PageList = GetPageList($DbRow[0]);
     268
     269    $Output .= $PageList['Output'];
     270
     271    if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
     272      else $LanguageName = 'Překlad';
     273    $TableColumns = array(
     274      array('Name' => 'Original', 'Title' => T('English')),
     275      array('Name' => 'Translated', 'Title' => $LanguageName),
     276    );
     277    if(!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language'));
     278    $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description'));
     279    $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator'));
     280    if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));
     281    $Order = GetOrderTableHeader($TableColumns, 'Original');
     282    $Output .= '<table class="BaseTable">'.$Order['Output'];
     283
     284    $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit'];
     285    $DbResult = $this->Database->query($sql_page);
     286    while($Line = $DbResult->fetch_assoc())
     287    {
     288      $Output .= '<tr>'.
     289        '<td>'.$Line['Original'].'</td>'.
     290        '<td><strong>'.$Line['Translated'].'</strong></td>';
     291      if(!is_numeric($_SESSION['language'])) $Output .= '<td>'.$Line['LangName'].'</td>';
     292      $Output .= '<td>'.$Line['Description'].'</td>'.
     293        '<td><a href="'.$this->System->Link('/user.php?user='.$Line['UserId']).'">'.$Line['UserName'].'</a></td>';
     294      if($this->System->User->Licence(LICENCE_USER))
     295      {
     296        if($Line['UserId'] == $this->System->User->Id)
     297          $Output .= '<td><a href="?action=remove&amp;id='.$Line['Id'].'" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'.
     298            ' <a href="?action=modify&amp;id='.$Line['Id'].'">'.T('Modify').'</a></td>';
     299          else $Output .= '<td></td>';
     300      }
     301      $Output .= '</tr>';
     302    }
     303    $Output .= '</table>'.
    304304    $PageList['Output'].
    305     '</td></tr>'.
    306     '</table></form>';
    307   return($Output);
     305      '</td></tr>'.
     306      '</table></form>';
     307    return($Output);
     308  }
     309
     310  function Show()
     311  {
     312    global $LanguageList;
     313
     314    $this->Title = T('Dictionary');
     315
     316    $LanguageList = GetLanguageList();
     317
     318    if(!isset($_SESSION['language']))
     319    {
     320      if($this->System->User->Licence(LICENCE_USER))
     321      {
     322        $_SESSION['language'] = $this->System->User->Language;
     323      } else $_SESSION['language'] = '';
     324    }
     325    if(array_key_exists('language', $_GET))
     326    {
     327      if($_GET['language'] == '') $_SESSION['language'] = '';
     328        else $_SESSION['language'] = $_GET['language'] * 1;
     329    }
     330
     331    $Output = '<h3>'.T('Dictionary').'</h3>';
     332
     333    $ShowList = true;
     334    if(array_key_exists('action', $_GET))
     335    {
     336      if($_GET['action'] == 'group')
     337      {
     338        $Output .= $this->DictionaryGroup();
     339        $ShowList = false;
     340      }
     341      else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert();
     342      else if($_GET['action'] == 'save') $Output .= $this->DictionarySave();
     343      else if($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove();
     344      else if($_GET['action'] == 'modify') $Output .= $this->DictionaryModify();
     345      else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL);
     346    }
     347    if($ShowList == true) $Output .= $this->DictionaryShow();
     348    return($Output);
     349  }
    308350}
    309 
    310 function Show()
    311 {
    312   global $LanguageList;
    313 
    314   $this->Title = T('Dictionary');
    315 
    316 $LanguageList = GetLanguageList();
    317 
    318 if(!isset($_SESSION['language']))
    319 {
    320   if($this->System->User->Licence(LICENCE_USER))
    321   {
    322     $_SESSION['language'] = $this->System->User->Language;
    323   } else $_SESSION['language'] = '';
    324 }
    325 if(array_key_exists('language', $_GET)) {
    326   if($_GET['language'] == '') $_SESSION['language'] = '';
    327     else $_SESSION['language'] = $_GET['language'] * 1;
    328 }
    329 
    330 $Output = '<h3>'.T('Dictionary').'</h3>';
    331 
    332 $ShowList = true;
    333 if(array_key_exists('action', $_GET))
    334 {
    335   if($_GET['action'] == 'group') {
    336     $Output .= $this->DictionaryGroup();
    337     $ShowList = false;
    338   }
    339   else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert();
    340   else if($_GET['action'] == 'save') $Output .= $this->DictionarySave();
    341   else if($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove();
    342   else if($_GET['action'] == 'modify') $Output .= $this->DictionaryModify();
    343   else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL);
    344 }
    345 if($ShowList == true) $Output .= $this->DictionaryShow();
    346     return($Output);
    347   }
    348 }
  • trunk/Modules/Referrer/Referrer.php

    r816 r829  
    9090    $Output .= $Banner.' &nbsp;&nbsp;<textarea rows="2" cols="30">'.htmlspecialchars($Banner).'</textarea><br />';
    9191    $Output .= $BannerSmall.' &nbsp;&nbsp;<textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />';
     92
     93    if($this->System->User->Licence(LICENCE_ADMIN)) {
    9294
    9395    $MonthAge = 3;
     
    153155    $Output .= '</table>';
    154156    $Output .= $PageList['Output'];
     157
     158    }
    155159    return($Output);
    156160  }
  • trunk/Modules/User/Registration.php

    r816 r829  
    88      else $Human = false;
    99    if(array_key_exists('user', $_POST)) $UserName = $_POST['user'];
    10     else $UserName = '';
     10      else $UserName = '';
    1111    if(array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
    12     else $Email = '';
     12      else $Email = '';
    1313    if(array_key_exists('Team', $_POST)) $Team = $_POST['Team'];
    14     else $Team = '';
     14      else $Team = '';
    1515    if(array_key_exists('Language', $_POST)) $Language = $_POST['Language'];
    16     else $Language = 1;
     16      else $Language = 1;
    1717
    18     $Output = '<form action="?" method="post">
     18    $Output = '<form action="?" method="post" class="Form">
    1919    <fieldset><legend>'.T('New user registration').'</legend>
    2020    <table>
    2121    <tr><td colspan="2">Pozorně si přečtěte <a href="info.php">pokyny k překladu</a> a řiďte se jimi. Překládat je nutno včetně háčků a čárek!<br/><br/></td></tr>
    2222    <tr>
    23     <td>Jsi člověk? </td>';
     23    <th class="Left">Jsi člověk?</th>';
    2424    if($Human) $Checked = ' checked="checked"';
    25     else $Checked = '';
     25      else $Checked = '';
    2626    $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td>
    2727    </tr>
    2828    <tr>
    29     <td>Jméno:</td>
     29    <th class="Left">Jméno:</th>
    3030    <td><input type="text" name="user" value="'.$UserName.'"/></td>
    3131    </tr>
    3232    <tr>
    33     <td>Heslo:</td>
     33    <th class="Left">Heslo:</th>
    3434    <td><input type="password" name="pass" /></td>
    3535    </tr>
    3636    <tr>
    37     <td>Potvrzení Hesla: </td>
     37    <th class="Left">Potvrzení Hesla:</th>
    3838    <td><input type="password" name="pass2" /></td>
    3939    </tr>
    4040    <tr>
    41     <td>Email: </td>
     41    <th class="Left">Email:</th>
    4242    <td><input type="text" name="Email" value="'.$Email.'"/></td>
    4343    </tr>
    4444    <tr>
    45     <td>Normálně budu překládat do: </td>
     45    <th class="Left">Normálně budu překládat do:</th>
    4646    <td>'.WriteLanguages($Language).'</td>
    4747    </tr>
    4848    <tr>
    49     <td>Patřím do týmu: </td>';
     49    <th class="Left">Patřím do týmu:</th>';
    5050    if($Team == '') $Selected = ' selected="selected"';
    51     else $Selected = '';
    52     $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option>
    53     ';
     51      else $Selected = '';
     52    $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>Žádného</option>';
    5453    $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`');
    5554    while($Line = $DbResult->fetch_assoc())
     
    5958      $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.$Line['Name'].'</option>';
    6059    }
    61     $Output .= '</select></td>
    62     </tr>';
     60    $Output .= '</select>';
    6361    $Output .= '</td></tr>'.
    64         '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection('').'</td></tr>';
     62      '<tr><th class="Left">Upřednostněná verze klienta:</th><td>'.ClientVersionSelection('').'</td></tr>';
    6563
    66         $Output .= '<tr><td>';
    6764    $Query = 'SELECT * FROM UserTagType';
    6865    $DbResult = $this->Database->query($Query);
    69     $Output .= 'Vyberte pravidla, kterými se při překladu chcete řídit:</td><td>';
    70     while ($UserTag = $DbResult->fetch_array()) {
     66    $Output .= '<tr><th class="Left">'.
     67      'Vyberte pravidla, kterými se při překladu chcete řídit:</th><td>';
     68    while ($UserTag = $DbResult->fetch_array())
     69    {
    7170      $checked = false;
    7271
     
    7776
    7877    $Output .= '<tr>
    79     <th><input type="submit" value="Registrovat" /></th>
     78    <th colspan="2" class="Center"><input type="submit" value="Registrovat" /></th>
    8079    </tr>
    8180    </table></fieldset></form>';
     
    128127                $ShowForm = false;
    129128
    130                       //tag
     129                // User tags
    131130                $Query = 'SELECT * FROM UserTagType';
    132131                $DbResult = $this->Database->query($Query);
  • trunk/Modules/User/User.php

    r816 r829  
    6060  function Show()
    6161  {
    62     $Output = '<form action="'.$this->System->Link('/?action=login').'" method="post">'.
     62    $Output = '<form action="'.$this->System->Link('/?action=login').'" method="post" class="Form">'.
    6363      '<fieldset><legend>'.T('Login').'</legend>
    6464      <table>
    6565      <tr>
    66       <td>'.T('Name').':</td><td><input type="text" name="LoginUser" size="13" /></td>
    67       </tr>
    68       <tr>
    69       <td>'.T('Password').':</td><td><input type="password" name="LoginPass" size="13" /></td>
    70       </tr>
    71       <tr>
    72       <td>'.T('Stay logged').':</td><td><input type="checkbox" name="StayLogged" /></td>
    73       </tr>
    74       <tr>
    75       <th><input type="submit" value="'.T('Do login').'" /></th>
     66      <th class="Left">'.T('Name').':</th><td><input type="text" name="LoginUser" size="13" /></td>
     67      </tr>
     68      <tr>
     69      <th class="Left">'.T('Password').':</th><td><input type="password" name="LoginPass" size="13" /></td>
     70      </tr>
     71      <tr>
     72      <th class="Left">'.T('Stay logged').':</th><td><input type="checkbox" name="StayLogged" /></td>
     73      </tr>
     74      <tr>
     75      <th class="Center"colspan="2"><input type="submit" value="'.T('Do login').'" /></th>
    7676      </tr>
    7777      </table>
Note: See TracChangeset for help on using the changeset viewer.