Changeset 524


Ignore:
Timestamp:
Feb 20, 2013, 9:40:53 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Nastavení předvolené verze klienta pro překládání v profilu překladatelů.
  • Přidáno: Vlastní text v profilu uživatele.
  • Upraveno: Nyní lze veřejně zobrazovat profily překladatelů.
  • Opraveno: Na některých místech opraveno použití id originálního jazyka textů.
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Options.php

    r506 r524  
    99  <fieldset><legend>Nastavení uživatele</legend>
    1010  <table>
    11     <tr>
    12       <td>Email: </td>
    13       <td><input type="text" name="Email" value="'.$User->Email.'" /></td>
    14     </tr>
    15     <tr>
    16       <td>Původní heslo: </td>
    17       <td><input type="password" name="OldPass" /></td>
    18     </tr>
    19     <tr>
    20       <td>Nové heslo: </td>
    21       <td><input type="password" name="NewPass" /></td>
    22     </tr>
    23     <tr>
    24       <td>Nové heslo pro potvrzení: </td>
    25       <td><input type="password" name="NewPass2" /></td>
    26     </tr>
    27     <tr>
    28       <td>Normálně budu překládat do: </td>
    29       <td>'.WriteLanguages($User->Language).'
    30       </td>
    31     </tr>
    32     <tr>
    33       <td>Po uložení překladu přesměrovat: </td>
    34       <td>';
    35    
     11    <tr><td>Email:</td><td><input type="text" name="Email" value="'.$User->Email.'" /></td></tr>
     12    <tr><td>Původní heslo:</td><td><input type="password" name="OldPass" /></td></tr>
     13    <tr><td>Nové heslo:</td><td><input type="password" name="NewPass" /></td></tr>
     14    <tr><td>Nové heslo pro potvrzení: </td><td><input type="password" name="NewPass2" /></td></tr>
     15    <tr><td>Normálně budu překládat do: </td><td>'.WriteLanguages($User->Language).'</td></tr>
     16    <tr><td>Po uložení překladu přesměrovat: </td><td>';   
    3617   $Output .= '<select name="redirecting">'.
    3718     '<option value="0">Nikam</option>'.
     
    4728     $Output .= '</select>';   
    4829   
    49      $Output .= '</td>'.
    50        '</tr><tr>'.
    51        '<th><input type="submit" value="Uložit" /></th>'.
    52        '</tr>'.
     30     $Output .= '</td></tr>'.
     31       '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($User->PreferredVersion).'</td></tr>'.
     32       '<tr><td>Veřejný text profilu:</td><td>'.
     33       '<textarea name="info" cols="60" rows="10">'.$User->Info.'</textarea></td></tr>'.
     34       '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'.
    5335       '</table></fieldset>'.
    5436       '</form>';
     
    7355}
    7456
     57function UserOptionsSave()
     58{
     59        global $System, $User;
     60       
     61        $Output = '';
     62        if(array_key_exists('Email', $_POST))
     63        {
     64                $Email = $_POST['Email'];
     65                $OldPass = $_POST['OldPass'];
     66                $NewPass = $_POST['NewPass'];
     67                $NewPass2 = $_POST['NewPass2'];
     68                $Language = $_POST['Language'];
     69                $Redirecting = $_POST['redirecting'];
     70                $PreferredVersion = $_POST['ClientVersion'];
     71                if($PreferredVersion == '') $PreferredVersion = null;
     72                $Info = $_POST['info'];
     73                print_r($_POST);
     74       
     75                // Do user want to change password?
     76                if(($OldPass != '') or ($NewPass != '') or ($NewPass2 != ''))
     77                {
     78                  if($NewPass == $NewPass2)
     79                  {
     80                          $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id);
     81                          $DbRow = $DbResult->fetch_assoc();
     82                          if($DbRow['Hash'] == $DbRow['Pass'])
     83                          {
     84                                  // Update password
     85                                  $Salt = $User->GetPasswordSalt();
     86                                  $System->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id);
     87                                  $Output .= ShowMessage('Heslo změněno.');     
     88                          } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL);
     89                  } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL);
     90                }
     91                $System->Database->update('User', '`ID` = '.$User->Id, array('Email' => $Email,
     92          'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info,
     93                        'PreferredVersion' => $PreferredVersion));
     94                $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b>');
     95                WriteLog('Úprava nastavení!', LOG_TYPE_USER);
     96                $User->Load();
     97        } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL);     
     98        return($Output);
     99}
     100
    75101$Output = '';
    76102if($User->Licence(LICENCE_USER))
     
    78104  if(array_key_exists('action', $_GET) and ($_GET['action'] == 'save'))
    79105  {
    80   if(array_key_exists('Email', $_POST))
    81   {
    82     $Email = $_POST['Email'];
    83     $OldPass = $_POST['OldPass'];
    84     $NewPass = $_POST['NewPass'];
    85     $NewPass2 = $_POST['NewPass2'];
    86     $Language = $_POST['Language'];
    87     $Redirecting = $_POST['redirecting'];
    88 
    89     if($NewPass == $NewPass2)
    90     {
    91       $DbResult = $System->Database->query('SELECT `Pass`, '.$User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$User->Id);
    92       $DbRow = $DbResult->fetch_assoc();
    93       if($DbRow['Hash'] == $DbRow['Pass'])
    94       {     
    95         // Update password
    96         $Salt = $User->GetPasswordSalt();
    97         $System->Database->query('UPDATE `User` SET `Pass` = '.$User->CryptPasswordSQL('"'.$NewPass.'"', '"'.$Salt.'"').', `Salt`="'.$Salt.'" WHERE `ID` = '.$User->Id);
    98         $Output .= ShowMessage('Heslo změněno.');
    99        
    100         $System->Database->query('UPDATE `User` SET `Email` = "'.$Email.'", `Language` = "'.$Language.'", `Redirecting` = "'.$Redirecting.'" WHERE `ID` = '.$User->Id);
    101         $Output .= ShowMessage('Úprava nastavení proběhla v pořádku, Email: <b>'.$Email.'</b> Uživatel: <b>'.$User->Name.'</b>');
    102         WriteLog('Úprava nastavení!', LOG_TYPE_USER);       
    103       } else $Output .= ShowMessage('Staré heslo neodpovídá.', MESSAGE_CRITICAL);
    104     } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL);   
    105   } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL);
    106   } 
    107  
     106        $Output .= UserOptionsSave();
     107  }   
    108108  $Output .= UserOptionsFrom();
    109109} else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL);
  • trunk/TranslationList.php

    r504 r524  
    284284  $Output .= '</table>'.
    285285    '<br /><a title="Záznam změn po importu" href="log.php?type=11">Záznam změn v textech při importu</a><br/>';
    286   //if($User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">Přidat překladovou skupinu</a>';
     286  if($User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">Přidat překladovou skupinu</a>';
    287287  return($Output);
    288288}
     
    339339  if($User->Licence(LICENCE_ADMIN))
    340340  {
    341     $Output = '<h3>Vložení nové skupiny</h3>'.
    342       '<form action="?action=groupadd" method="post">'.
    343     'Jméno: <input type="text" name="Name"/><br/>'.
    344     'Název tabulky: <input type="text" name="TablePrefix"/><br/>'.
    345     '</form>';
     341    $Output = '<h3>Vložení nové překladové skupiny</h3>'.
     342      '<form action="?action=groupaddfinish" method="post">'.
     343    '<table>'.
     344    '<tr><td>Název:</td><td><input type="text" name="Name"/></td></tr>'.
     345    '<tr><td>Název tabulky v databázi:</td><td><input type="text" name="TablePrefix"/></td></tr>'.
     346    '<tr><td>Typ zdroje:</td><td><input type="text" name="SourceType"/></td></tr>'.
     347    '<tr><td>Mangos databáze:</td><td><input type="text" name="MangosDatabase"/></td></tr>'.
     348    '<tr><td>Mangos tabulka:</td><td><input type="text" name="MangosTable"/></td></tr>'.
     349    '<tr><td colspan="2"><input type="submit" name="add" value="Přidat"/></td></tr>'.
     350    '</table></form>';
    346351  } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL);
    347352  return($Output);
     353}
     354
     355function ShowGroupAddFinish()
     356{
     357  global $User;
     358 
     359  if($User->Licence(LICENCE_ADMIN))
     360  {
     361       
     362  }
    348363}
    349364
     
    352367else if($Action == 'grouplist') $Output = ShowGroupTypeList();
    353368else if($Action == 'groupadd') $Output = ShowGroupAdd();
     369else if($Action == 'groupaddfinish') $Output = ShowGroupAddFinish();
    354370else
    355371{
  • trunk/admin/DefaultConfig.php

    r513 r524  
    3434    'Timezone' => 'Europe/Prague',
    3535  ),
    36   'ExportTaskProcessPeriod' => 10,
     36  'ForbiddedUserNames' => array('addon', 'admin', 'administrator'),
     37        'ExportTaskProcessPeriod' => 10,
    3738  'MaxExportPerUser' => 10,
    3839  'AoWoWExportId' => 1,
    39   'SystemPassword' => '',
     40        'OriginalLanguage' => 1,
     41        'SystemPassword' => '',
    4042);
    4143
  • trunk/admin/UpdateTrace.php

    r516 r524  
    23612361(13, 'CzWoW', 'violet', 'Překládací addon CzWoW'),
    23622362(14, 'Administrace', 'olive', 'Administrativní akce');");
     2363  $Manager->Execute("INSERT INTO `ClientVersion` (`Id`, `Version`, `BuildNumber`, `ReleaseDate`, `Title`, `Imported`) VALUES
     2364(1, '3.1.3', 9947, '2009-06-02', '', 0),
     2365(2, '3.1.2', 9901, '2009-05-15', '', 0),
     2366(3, '3.1.1a', 9835, '2009-04-28', '', 0),
     2367(4, '3.1.1', 9806, '2009-04-21', '', 0),
     2368(5, '3.1.0', 9767, '2009-04-14', 'Secrets of Ulduar', 0),
     2369(6, '3.0.9', 9551, '2009-02-10', '', 0),
     2370(7, '3.0.8a', 9506, '2009-01-27', '', 0),
     2371(8, '3.0.8', 9464, '2009-01-20', '', 0),
     2372(9, '3.0.3', 9183, '2008-11-04', '', 0),
     2373(10, '3.0.2', 9056, '2008-10-14', 'Echoes of Doom', 0),
     2374(11, '2.4.3', 8606, '2008-07-15', '', 0),
     2375(12, '2.4.2', 8209, '2008-06-13', '', 0),
     2376(13, '2.4.1', 8125, '2008-04-01', '', 0),
     2377(14, '2.4.0', 8089, '2008-03-25', 'Fury of the Sunwell', 0),
     2378(15, '2.3.3', 7799, '2008-01-22', '', 0),
     2379(16, '2.3.2', 7741, '2008-01-08', '', 0),
     2380(17, '2.3.0', 7561, '2007-11-13', 'The Gods of Zul''Aman', 0),
     2381(18, '2.2.3', 7359, '2007-10-09', '', 0),
     2382(19, '2.2.2', 7318, '2007-10-02', '', 0),
     2383(20, '2.2.0', 7272, '2007-09-25', 'Voice Chat!', 0),
     2384(21, '2.1.3', 6898, '2007-07-10', '', 0),
     2385(22, '2.1.2', 6803, '2007-06-19', '', 0),
     2386(23, '2.1.1', 6739, '2007-06-05', '', 0),
     2387(24, '2.1.0a', 6729, '2007-05-22', '', 0),
     2388(25, '2.1.0', 6692, '2007-05-22', 'The Black Temple', 0),
     2389(26, '2.0.12', 6546, '2007-04-03', '', 0),
     2390(27, '2.0.10', 6448, '2007-03-06', '', 0),
     2391(28, '2.0.8', 6403, '2007-02-16', '', 0),
     2392(29, '2.0.7', 6383, '2007-02-13', '', 0),
     2393(30, '2.0.6', 6337, '2007-01-23', '', 0),
     2394(31, '2.0.5', 6320, '2007-01-14', '', 0),
     2395(32, '2.0.4', 6320, '2007-01-12', '', 0),
     2396(33, '2.0.3', 6299, '2007-01-09', '', 0),
     2397(34, '2.0.1', 6180, '2006-12-05', 'Before the Storm', 0),
     2398(35, '1.12.2', 6005, '2006-11-13', '', 0),
     2399(36, '1.12.1', 5875, '2006-09-26', '', 0),
     2400(37, '1.12.0', 5595, '2006-09-22', 'Drums of War', 0),
     2401(38, '1.11.2', 5464, '2006-07-11', '', 0),
     2402(39, '1.11.1', 5462, '2006-06-28', '', 0),
     2403(40, '1.11.0', 5428, '2006-06-20', 'Shadow of the Necropolis', 0),
     2404(41, '1.10.2', 5302, '2006-05-02', '', 0),
     2405(42, '1.10.1', 5230, '2006-04-11', '', 0),
     2406(43, '1.10.0', 5195, '2006-03-28', 'Storms of Azeroth', 0),
     2407(44, '1.9.4', 5086, '2006-03-14', '', 0),
     2408(45, '1.9.3', 5059, '2006-02-07', 'Love is in the Air', 0),
     2409(46, '1.9.2', 4996, '2006-01-12', '', 0),
     2410(47, '1.9.1', 4983, '2006-01-10', '', 0),
     2411(48, '1.9.0', 4937, '2006-01-03', 'The Gates of Ahn''Qiraj', 0),
     2412(49, '1.8.4', 4878, '2005-12-05', '', 0),
     2413(50, '1.8.3', 4807, '2005-11-15', '', 0),
     2414(51, '1.8.2', 4784, '2005-10-27', '', 0),
     2415(52, '1.8.1', 4769, '2005-10-25', '', 0),
     2416(53, '1.8.0', 4735, '2005-10-10', 'Dragons of Nightmare', 0),
     2417(54, '1.7.1', 4695, '2005-09-22', '', 0),
     2418(55, '1.7.0', 4671, '2006-09-13', 'Rise of the Blood God', 0),
     2419(56, '1.6.1', 4544, '2005-08-02', '', 0),
     2420(57, '1.6.0', 4500, '2005-07-12', 'Assault on Blackwing Lair', 0),
     2421(58, '1.5.1', 4449, '2005-06-14', '', 0),
     2422(59, '1.5.0', 4442, '2005-06-07', 'Battlegrounds', 0),
     2423(60, '1.4.2', 4375, '2005-05-03', '', 0),
     2424(61, '1.4.1', 4364, '2005-05-03', '', 0),
     2425(62, '1.4.0', 4341, '2005-04-08', 'The Call to War', 0),
     2426(63, '1.3.2', 4299, '2005-03-22', '', 0),
     2427(64, '1.3.1', 4297, '2005-03-22', '', 0),
     2428(65, '1.3.0', 4284, '2005-03-07', 'Ruins of the Dire Maul', 0),
     2429(66, '1.2.4', 4222, '2005-02-22', '', 0),
     2430(67, '1.2.3', 4211, '2005-02-22', '', 0),
     2431(68, '1.2.2', 4196, '2005-02-15', '', 0),
     2432(69, '1.2.1', 4150, '2004-12-21', '', 0),
     2433(70, '1.2.0', 4149, '2004-12-18', 'Mysteries of Maraudon', 0),
     2434(71, '1.1.2', 4125, '2004-12-06', '', 0),
     2435(72, '1.1.1', 4062, '2004-11-17', '', 0),
     2436(73, '1.1.0', 4044, '2004-11-07', 'World of Warcraft', 0),
     2437(74, '3.2.0', 10192, '2009-08-05', 'Call of the Crusade', 0),
     2438(75, '3.3.0', 10958, '2009-11-08', 'Fall of the Lich King', 0),
     2439(76, '3.2.2a', 10505, '2009-09-25', '', 0),
     2440(77, '3.2.2', 10482, '2009-09-22', '', 0),
     2441(78, '3.2.0a', 10314, '2009-08-19', '', 0),
     2442(79, '3.3.0a', 11159, '2009-11-14', '', 0),
     2443(80, '3.3.2', 11403, '2010-02-02', '', 0),
     2444(81, '3.3.3', 11685, '2010-03-23', '', 0),
     2445(82, '3.3.3a', 11723, '2010-03-26', '', 0),
     2446(83, '3.3.5', 12213, '2010-06-22', 'Defending the Ruby Sanctum', 0),
     2447(84, '3.3.5a', 12340, '2010-06-29', '', 0),
     2448(85, '4.0.1', 13164, '2010-10-12', 'Cataclysm Systems', 0),
     2449(86, '4.0.3', 13202, '2010-11-17', 'The Shattering', 0),
     2450(87, '4.0.1a', 13205, '2010-10-26', '', 0),
     2451(88, '4.0.3a', 13329, '2010-11-23', '', 0),
     2452(89, '4.0.6', 13596, '2011-02-08', '', 0),
     2453(90, '4.0.6a', 13623, '2012-02-11', '', 0),
     2454(91, '4.1.0', 13914, '2011-04-26', 'Rise of the Zandalari', 0),
     2455(92, '4.2.0', 14333, '2011-06-28', 'Rage of the Firelands', 0),
     2456(93, '4.2.0a', 14480, '2011-08-08', '', 0),
     2457(94, '4.2.2', 14545, '2011-08-30', '', 0),
     2458(95, '4.3.0', 15005, '2011-11-29', 'Hour of Twilight', 0),
     2459(96, '4.3.0a', 15050, '2011-12-02', '', 0),
     2460(97, '4.3.2', 15211, '2012-01-31', '', 0),
     2461(98, '4.3.3', 15354, '2012-02-28', '', 0),
     2462(99, '4.3.4', 15595, '2012-04-17', '', 0),
     2463(100, '5.0.4', 16016, '2012-08-27', 'Mists of Pandaria', 0),
     2464(101, '5.0.5', 16057, '2012-09-13', '', 0),
     2465(102, '5.0.5b', 16135, '2012-10-11', '', 0),
     2466(103, '5.1.0', 16309, '2012-11-27', 'Landfall', 0),
     2467(104, '5.1.0a', 16357, '2012-12-10', '', 0);");
    23632468}
    23642469
     
    24062511}
    24072512
     2513function UpdateTo524($Manager)
     2514{     
     2515  global $System;
     2516 
     2517  $Manager->Execute('ALTER TABLE `User` ADD `PreferredVersion` INT NULL DEFAULT NULL');
     2518  $Manager->Execute('ALTER TABLE `User` ADD INDEX ( `PreferredVersion` )');
     2519  $Manager->Execute('ALTER TABLE `User` ADD FOREIGN KEY ( `PreferredVersion` ) '.
     2520        'REFERENCES `ClientVersion` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;');
     2521  $Manager->Execute('ALTER TABLE `User` ADD `Info` TEXT NOT NULL');
     2522}
     2523
    24082524$Updates = array(
    24092525        498 => array('Revision' => 506, 'Function' => 'UpdateTo506'),
    24102526        506 => array('Revision' => 510, 'Function' => 'UpdateTo510'),
     2527        510 => array('Revision' => 524, 'Function' => 'UpdateTo524'),
    24112528);
    24122529
  • trunk/admin/install.php

    r513 r524  
    119119    'Timezone' => 'Europe/Prague',
    120120  ),
     121  'ForbiddedUserNames' => array('addon', 'admin', 'administrator'),
    121122  'ExportTaskProcessPeriod' => 10,
    122123  'MaxExportPerUser' => 10,
    123124  'AoWoWExportId' => 1,
     125        'OriginalLanguage' => 1,
    124126  'SystemPassword' => '".$Config['SystemPassword']."',
    125127);
  • trunk/dictionary.php

    r507 r524  
    5353  {
    5454    $_SESSION['language'] = $User->Language;
    55   } else $_SESSION['language'] = 2;
     55  } else   {
     56    $LanguageId = reset($LanguageList);
     57    $_SESSION['language'] = $LanguageId['Id'];
     58  }     
    5659}
    5760if(array_key_exists('language', $_GET)) $_SESSION['language'] = LoadLanguageIdParameter();
     
    9598      'Původní anglické slovo:</td><td><input type="text" name="Original" /></td></tr>'.
    9699      '<tr><td>Přeložené:</td><td><input type="text" name="Translated" /></td></tr>'.
    97       '<tr><td>Popis:</td><td><input type="text" name="Description" /></td></tr>'.
     100      '<tr><td>Volitelný popis:</td><td><input type="text" name="Description" /></td></tr>'.
    98101      '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'.
    99102      '</td></tr></table>'.
     
    105108      if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))
    106109      {       
    107         $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`=0');
     110        $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `Text` = "'.$_POST['Original'].'" AND `Language`= '.$Config['OriginalLanguage']);
    108111        if($DbResult->num_rows > 0)
    109112        {
     
    115118          $DbRow = $DbResult->fetch_row();
    116119          $Entry = $DbRow[0] + 1;
    117           $System->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, 0);');
     120          $System->Database->query('INSERT INTO `Dictionary` ( `Text` , `Entry` , `Description` , `User`, `Language` ) VALUES ("'.$_POST['Original'].'", "'.$Entry.'", "", NULL, '.$Config['OriginalLanguage'].');');
    118121        }
    119122     
     
    137140      $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE `User`='.$User->Id.' AND `Entry`='.$_GET['entry'].' AND `Language`='.$_SESSION['language']);
    138141      $DbRow = $DbResult->fetch_assoc();
    139       $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) AND (`Entry`='.$_GET['entry'].') AND (`Language`=0)');
     142      $DbResult = $System->Database->query('SELECT * FROM `Dictionary` WHERE (`User` IS NULL) AND (`Entry`='.$_GET['entry'].') AND (`Language`= '.$Config['OriginalLanguage'].')');
    140143      $DbRow2 = $DbResult->fetch_assoc();
    141144      $Output .= '<form action="dictionary.php?action=save" method="post">'.
     
    169172    if($Language['Enabled'] == 1)
    170173    {
    171       if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>';
    172       $Output .= ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>';
    173       if($Language['Id'] == $_SESSION['language']) $Output .= '</strong>';
     174        $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>';
     175      if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
     176        else $Output .= $Lang;
    174177    }
    175178  $Output .= '</td></tr>'.
     
    179182  if($Search <> '')
    180183  {
    181     $sql = 'SELECT `User`.`Name` AS `UserName`, `User`. `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT `T2`.`User`, `T1`.`Language`, `T1`.`Text` AS `Original`, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].' WHERE LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%") OR LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%") ) AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0';
    182   } else $sql = 'SELECT `User`.`Name` AS `UserName`, `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT `T2`.`User`, `T1`.Language, `T1`.`Text` AS `Original`, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].') AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0';
     184    $sql = 'SELECT `User`.`Name` AS `UserName`, `User`. `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT `T2`.`User`, `T1`.`Language`, `T1`.`Text` AS `Original`, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].' WHERE LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%") OR LOWER(`T1`.`Description`) LIKE LOWER("%'.$Search.'%") ) AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = '.$Config['OriginalLanguage'];
     185  } else $sql = 'SELECT `User`.`Name` AS `UserName`, `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT `T2`.`User`, `T1`.Language, `T1`.`Text` AS `Original`, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `Dictionary` AS `T1` JOIN `Dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].') AS `T3` JOIN `User` ON `User`.`ID` = `T3`.`User` WHERE `T3`.`Language` = '.$Config['OriginalLanguage'];
    183186
    184187  $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$sql.') AS `T1`');
  • trunk/includes/Page.php

    r522 r524  
    157157  while($DbUser = $DbResult->fetch_assoc())
    158158  {
    159     if($User->Licence(LICENCE_MODERATOR))
    160       $Name = '<a href="user.php?user='.$DbUser['ID'].'">'.$DbUser['Name'].'</a>';
    161       else $Name = $DbUser['Name'];
    162     $TextGM = '';
    163     $Output .= '<strong>'.$Name.'</strong>'.$TextGM.'<br />';
     159    $Name = '<a href="user.php?user='.$DbUser['ID'].'">'.$DbUser['Name'].'</a>';
     160    $Output .= '<strong>'.$Name.'</strong><br />';
    164161  }
    165162  return($Output);
  • trunk/includes/Version.php

    r523 r524  
    11<?php
    22
    3 $Revision = 523; // Subversion revision
    4 $DatabaseRevision = 510;
    5 $ReleaseTime = '2013-02-19';
     3$Revision = 524; // Subversion revision
     4$DatabaseRevision = 524;
     5$ReleaseTime = '2013-02-20';
    66
    77?>
  • trunk/includes/global.php

    r512 r524  
    292292function WriteLanguages($Selected)
    293293{
    294   global $LanguageList, $System;
     294  global $System;
    295295 
    296296  $Output = '<select name="Language">';
     
    307307}
    308308
     309function ClientVersionSelection($Selected)
     310{
     311  global $System;
     312 
     313  $Output = '<select name="ClientVersion">';
     314  $DbResult = $System->Database->select('ClientVersion', '`Id`, `Version`', '`Imported` = 1');
     315  $Output .= '<option value=""';
     316  if($Selected == '')
     317    $Output .= ' selected="selected"';
     318  $Output .= '>Žádná</option>';
     319  while($ClientVersion = $DbResult->fetch_assoc())
     320  {
     321    $Output .= '<option value="'.$ClientVersion['Id'].'"';
     322    if($Selected == $ClientVersion['Id'])
     323      $Output .= ' selected="selected"';
     324    $Output .= '>'.$ClientVersion['Version'].'</option>';
     325  }   
     326  $Output .= '</select>';
     327  return($Output);   
     328}
     329
    309330function WriteLanguagesWithoutSel($Selected)
    310331{
     
    441462 
    442463  if(array_key_exists('language', $_GET)) $LanguageId = $_GET['language'] * 1;
    443     else $LanguageId = 2;
     464    else $LanguageId = '';
    444465 
    445466  if(isset($LanguageList[$LanguageId]) == false)
    446467  {
    447     ErrorMessage(ShowMessage('Jazyk dle zadaného Id neexistuje.', MESSAGE_CRITICAL));
     468    $LanguageId = reset($LanguageList);
     469    $LanguageId = $LanguageId['Id'];
    448470  }
    449471  return($LanguageId);
  • trunk/includes/user.php

    r514 r524  
    6262    $this->Role = $User['GM'];
    6363    $this->Email = $User['Email'];
     64    $this->Info = $User['Info'];
     65    $this->PreferredVersion = $User['PreferredVersion'];
    6466  }
    6567 
  • trunk/index.php

    r522 r524  
    1919function ShowLastTranslated()
    2020{
    21   global $System;
     21  global $System, $Config;
    2222
    2323  $Count = 40;
     
    3737    $DbRow['Id'].' AS `Group`, "'.addslashes($DbRow['Name']).'" AS `GroupName`, `T`.`Take` FROM `'.
    3838    $DbRow['TablePrefix'].'` AS `T`'.
    39     ' WHERE (`T`.`Complete` = 1) AND (`T`.`Language` != 0) ORDER BY `T`.`ModifyTime` DESC LIMIT '.
     39    ' WHERE (`T`.`Complete` = 1) AND (`T`.`Language` != '.$Config['OriginalLanguage'].') ORDER BY `T`.`ModifyTime` DESC LIMIT '.
    4040    $Count.') AS `T`';
    4141  }
    42   $Query = 'SELECT `TT`.*, `User`.`Name` AS `UserName` FROM ('.implode(' UNION ', $UnionItems).') AS `TT`'.
     42  $Query = 'SELECT `TT`.*, `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId` '.
     43  ' FROM ('.implode(' UNION ', $UnionItems).') AS `TT`'.
    4344  ' JOIN `User` ON `User`.`Id` = `TT`.`User`'.
    4445  ' ORDER BY `ModifyTime` DESC LIMIT '.$Count;
     
    4849  {
    4950    $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'.
    50     '<td>'.$DbRow['UserName'].'</td>'.
     51    '<td><a href="user.php?id='.$DbRow['UserId'].'">'.$DbRow['UserName'].'</a></td>'.
    5152    '<td><a href="form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['ID'].'">'.$DbRow['ID'].'</a></td>'.
    5253    '<td><a href="form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['Take'].'">'.$DbRow['Take'].'</a></td>'.
  • trunk/registrace.php

    r504 r524  
    6262    }
    6363    $Output .= '</select></td>
    64     </tr>
    65     <tr>
     64    </tr>';
     65     $Output .= '</td></tr>'.
     66       '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection('').'</td></tr>';
     67    $Output .= '<tr>
    6668      <th><input type="submit" value="Registrovat" /></th>
    6769    </tr>
     
    7072}
    7173 
    72 $ForbiddedNames = array('Addon', 'admin', 'administrator');
    7374
    7475$Output = '';
     
    8384  $Team = $_POST['Team'];
    8485  $Language = $_POST['Language'];
     86  $PreferredVersion = $_POST['ClientVersion'];
     87  if($PreferredVersion == '') $PreferredVersion = 'NULL';
    8588  if(array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];
    8689    else $SpamCheck = '';
     
    8891  if($SpamCheck != '')
    8992  {
    90     if($UserName != '')
     93    if(($UserName != '') and ($Pass != '') and ($Pass2 != ''))
    9194    {
    92       if(!in_array($UserName, $ForbiddedNames))
     95      if(!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))
    9396      {
    9497        if($Pass == $Pass2)
     
    100103            $Salt = $User->GetPasswordSalt();
    101104            if($Team == 0) $Team = 'NULL';
    102             $System->Database->query('INSERT INTO `User` (`Name` , `Pass` , `Salt`, `LastIP` , `LastLogin` , `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime` ) '.
    103               'VALUES ("'.$UserName.'", '.$User->CryptPasswordSQL('"'.$Pass.'"', '"'.$Salt.'"').', "'.$Salt.'", "'.$_SERVER['REMOTE_ADDR'].'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW())');
     105            $System->Database->query('INSERT INTO `User` (`Name` , `Pass` , `Salt`, `LastIP` , `LastLogin` , `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '.
     106              'VALUES ("'.$UserName.'", '.$User->CryptPasswordSQL('"'.$Pass.'"', '"'.$Salt.'"').', "'.$Salt.'", "'.$_SERVER['REMOTE_ADDR'].'", NOW(), "'.$Email.'", '.$Language.', '.$Team.', 1, NOW(), '.$PreferredVersion.')');
    104107            $Output .= ShowMessage('Registrace proběhla úspěšně.');
    105108            $Output .= 'Přečtěte si pozorně <a href="'.$System->Link('/info.php').'">pokyny pro překladání</a> a můžete pak hned začít překládat.';
     
    110113        } else $Output = ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL);
    111114      } else $Output = ShowMessage('To jméno uživatele nemůžete použít.', MESSAGE_CRITICAL);
    112     } else $Output = ShowMessage('Nelze použít prázdné jméno.', MESSAGE_CRITICAL);
     115    } else $Output = ShowMessage('Nelze použít prázdné jméno nebo heslo.', MESSAGE_CRITICAL);
    113116  } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL);
    114117 
  • trunk/statistic.php

    r516 r524  
    2424  $BuildNumber = GetBuildNumber($_SESSION['StatVersion']);
    2525 
    26   $GroupListQuery = 'SELECT `Group`.* FROM `Group`';
     26  $GroupListQuery = 'SELECT `Id`, `TablePrefix`, `Name` FROM `Group`';
    2727  $Query = '';
    2828  $DbResult = $System->Database->query($GroupListQuery);
  • trunk/team.php

    r507 r524  
    207207        'Webové stránky: <a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a><br/>'.
    208208        'Vedoucí: <strong>'.$Leader.'</strong><br/>'.
    209       $Team['Description'].'<br /><br />';
     209        'Popis: '.$Team['Description'].'<br /><br />';
    210210      //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> ';
    211211      if($User->Licence(LICENCE_USER))
     
    227227  {
    228228    $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
    229     ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'.
    230     ' WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) AND (`Complete` = 1) AND (`T`.`Language`!=0) AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
     229    ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
     230    'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '.
     231    'AND (`Complete` = 1) AND (`T`.`Language`!='.$Config['OriginalLanguage'].') '.
     232    'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
    231233    ') AS `C1`) AS `Translated`, '.
    232234    '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    262264    $Total += $Group['Total'];
    263265  }
    264   $Output .='<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Translated / $Total * 100, 2)).'</strong></td></tr>';
     266  if($Total > 0) $Progress = round($Translated / $Total * 100, 2);
     267    else $Progress = 0;
     268  $Output .='<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $Progress).'</strong></td></tr>';
    265269  $Output .='</table>';
    266270  }
  • trunk/user.php

    r506 r524  
    2020}
    2121 
    22 if(array_key_exists('user', $_GET) and $User->Licence(LICENCE_MODERATOR))
    23 
    24   $Query = 'SELECT `User`.*, `Language`.`Name` AS `LanguageName` FROM `User` '.
    25     'LEFT JOIN `Language` ON `Language`.`Id` = `User`.`Language` WHERE `User`.`Id` = '.$_GET['user'];
     22function ShowProfile()
     23{
     24        global $System, $User, $Config;
     25       
     26  $Output = '';
     27  $Query = 'SELECT `User`.`Name`, `User`.`LastLogin`, `User`.`LastIP`, `User`.`Email`, '.
     28    '`User`.`TranslatedCount`, `User`.`Team`, `User`.`ID`, `User`.`Info`, '.
     29    '`Team`.`Name` AS `TeamName`, `Language`.`Name` AS `LanguageName`, '.
     30    '`ClientVersion`.`Version` AS `Version` FROM `User` '.
     31    'LEFT JOIN `Language` ON `Language`.`Id` = `User`.`Language` '.
     32    'LEFT JOIN `Team` ON `Team`.`Id` = `User`.`Team` '.
     33    'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '.
     34    'WHERE `User`.`Id` = '.$_GET['user'];
    2635  $DbResult = $System->Database->query($Query);
    2736  $UserLine = $DbResult->fetch_array();
    2837   
    29   $Output .= 'ID: <strong>'.$UserLine['ID'].'</strong><br />'.
    30     'Jméno: <strong>'.$UserLine['Name'].'</strong><br />'.
     38  $Output .=
     39    '<h3>Překladatel '.$UserLine['Name'].'</h3>'.
    3140    'Výchozí jazyk: <strong>'.$UserLine['LanguageName'].'</strong><br />'.
     41    'Výchozí verze klienta: <strong>'.$UserLine['Version'].'</strong><br />'.
    3242    'Poslední připojení: <strong>'.$UserLine['LastLogin'].'</strong><br />'.
    33     'Poslední IP: <strong>'.$UserLine['LastIP'].'</strong><br />'.
    34     'Počet přeložených: <a href="TranslationList.php?user='.$UserLine['ID'].'&amp;state=2&group=0" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'.
    35     'Email: <strong>'.$UserLine['Email'].'</strong><br />'.
    36     '<br />'.   
    37 '<form action="user.php" method="post"><div>'.
     43    'Počet přeložených: <a href="TranslationList.php?user='.$UserLine['ID'].'&amp;state=2&group=0" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />';
     44    if($UserLine['TeamName'] != '')
     45      $Output .= 'Člen týmu: <a href="team.php?action=team&amp;id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
     46    $Output .= '<fieldset><legend>Text profilu:</legend>'.str_replace("\n", '<br/>', $UserLine['Info']).'</fieldset><br/>';
     47   
     48  if($User->Licence(LICENCE_MODERATOR))
     49  {   
     50        $Output .= '<fieldset><legend>Moderování</legend>';
     51        $Output .= 'Poslední IP: <strong>'.$UserLine['LastIP'].'</strong><br />'.
     52        'Email: <strong>'.$UserLine['Email'].'</strong><br />';
     53        $Output .= '<br/><form action="user.php" method="post"><div>'.
    3854'Napsat E-mail:'.
    39 '<input type="text" name="email" value="'.$UserLine['Email'].'" />'.
     55'<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.
    4056'Předmět:'.
    4157'<input type="text" name="subject" value="'.$Config['Web']['Title'].'" />'.
    42 '<input type="submit" value="Odeslat" />'.
    4358'<br />'.
    4459'<textarea name="text" rows="20" cols="62">'.
     
    4762'--------------------------------------------------------'."\n".
    4863$Config['Web']['Title'].' '.$Config['Web']['Host'].$System->Link('/')."\n".
    49 '</textarea>'.
    50 '</div></form>';
     64'</textarea><br/>'.
     65'<input type="submit" value="Odeslat" />'.
     66'</div></form></fieldset>';
     67  }
     68  return($Output);
    5169}
     70       
     71if(array_key_exists('user', $_GET))
     72
     73        $Output .= ShowProfile();
     74} else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL);
    5275
    5376ShowPage($Output);
    5477
    5578?>
    56 
  • trunk/userlist.php

    r504 r524  
    66ImgLevelUpdate();
    77
    8 
     8$Output = '';
    99if(array_key_exists('search', $_GET))
    1010{
     
    1313if(array_key_exists('team', $_GET))
    1414{
    15   $Output = '<h3>Seznam uživatelů v týmu</h3>';
    16   $_SESSION['Where'] = ' WHERE `Team`='.$_GET['team'];
    17   if($_GET['team'] == '') $_SESSION['Where'] = '';     
     15        $DbResult = $System->Database->select('Team', 'Name', 'Id='.$_GET['team']);
     16        if($DbResult->num_rows > 0)
     17        {
     18                $Team = $DbResult->fetch_assoc();
     19    $Output .= '<h3>Seznam uživatelů v týmu '.$Team['Name'].'</h3>';
     20    $_SESSION['Where'] = ' WHERE `Team`='.$_GET['team'];
     21    if($_GET['team'] == '') $_SESSION['Where'] = '';
     22        } else {
     23          $Output .= ShowMessage('Tým '.$_GET['team'].' nenalezen', MESSAGE_CRITICAL);
     24          $_SESSION['Where'] = ' WHERE FALSE';
     25        }
    1826} else
    1927{
    20   $Output = '<h3>Seznam uživatelů</h3>';
     28  $Output .= '<h3>Seznam uživatelů</h3>';
    2129  if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = '';
    2230}
     
    5361while($Line = $DbResult->fetch_assoc())
    5462{
    55   if($User->Licence(LICENCE_MODERATOR))
    56     $Name = '<a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a>';
    57     else $Name = $Line['Name'];
    58        
    5963    $XP = GetLevelMinMax($Line['XP']);
    60     $Output .= '<tr><td>'.$Name.'</td>
    61       <td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
     64    $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'.
     65      '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
    6266      '<td>'.$XP['Level'].'</td>'.
    6367      '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'.
Note: See TracChangeset for help on using the changeset viewer.