Changeset 626
- Timestamp:
- Dec 4, 2013, 9:50:16 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/AoWoW/AoWoW.php
r548 r626 23 23 'Icon' => '', 24 24 )); 25 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 26 $this->System->ModuleManager->Modules['Search']->RegisterSearch('aowow', 27 T('AoWoW'), array(), '', $this->System->Link('/aowow/?search=')); 25 28 } 26 29 } -
trunk/Modules/Dictionary/Dictionary.php
r622 r626 25 25 'Icon' => '', 26 26 ), 1); 27 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 28 $this->System->ModuleManager->Modules['Search']->RegisterSearch('dictionary', 29 T('Dictionary'), array('Text', 'Description'), 30 '(SELECT * FROM `Dictionary` WHERE `Language` = '.$this->System->Config['OriginalLanguage'].') AS `T`', $this->System->Link('/dictionary/?search=')); 27 31 } 28 32 } -
trunk/Modules/Search/Search.php
r595 r626 14 14 $this->Description = 'Allow test search in other modules content.'; 15 15 $this->Dependencies = array(); 16 $this->SearchItems = array(); 16 17 } 17 18 … … 21 22 } 22 23 23 function Register Content($Name, $Columns, $Query)24 function RegisterSearch($Name, $Title, $Columns, $Query, $Link) 24 25 { 25 $this->SearchItems[$Name] = array('Columns' => $Columns, 'Query' => $Query); 26 // Query can be table name or subselect query 27 $this->SearchItems[$Name] = array('Name' => $Title, 'Columns' => $Columns, 28 'Query' => $Query, 'Link' => $Link); 26 29 } 27 30 28 function Unregister Content($Name)31 function UnregisterSearch($Name) 29 32 { 30 33 unset($this->SearchItems[$Name]); … … 36 39 function Show() 37 40 { 38 global $TranslationTree;39 40 41 if(array_key_exists('text', $_GET)) $Search = $_GET['text']; 41 42 else if(array_key_exists('text', $_POST)) $Search = $_POST['text']; 42 43 else $Search = ''; 43 44 $SearchHTML = htmlentities($Search); 44 45 $Output = '<table class="BaseTable"><tr><th> Skupina</th><th>Výsledků</th></tr>';46 foreach($ TranslationTree as $Group)45 46 $Output = '<table class="BaseTable"><tr><th>'.T('Section').'</th><th>'.T('Found count').'</th></tr>'; 47 foreach($this->System->ModuleManager->Modules['Search']->SearchItems as $SearchItem) 47 48 { 48 $Table = $Group['TablePrefix']; 49 50 $sql = 'SELECT COUNT(*) FROM `'.$Table.'` WHERE '. 51 ' (`ID` LIKE "%'.$Search.'%")'. 52 ' OR (`Entry` LIKE "%'.$Search.'%")'; 53 foreach($Group['Items'] as $Item) 49 $ColumnQuery = array(); 50 foreach($SearchItem['Columns'] as $Column) 54 51 { 55 if($Item['Column'] != '') $sql .= ' OR (`'.$Item['Column'].'` LIKE "%'.$Search.'%")'; 56 } 57 $DbResult = $this->Database->query($sql); 58 $Line = $DbResult->fetch_row(); 59 if ($Line[0] <> '0') 60 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='. 61 $Group['Id'].'&user=0&state=0&text='.$SearchHTML.'&entry=').'">'. 62 $Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>'; 52 $ColumnQuery[] = '(`'.$Column.'` LIKE "%'.$Search.'%")'; 53 } 54 $ColumnQuery = implode(' OR ', $ColumnQuery); 55 if($SearchItem['Query'] != '') 56 { 57 $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$SearchItem['Query'].' WHERE '.$ColumnQuery); 58 $Line = $DbResult->fetch_row(); 59 $Line = $Line[0]; 60 } else $Line = ''; 61 $Output .= '<tr><td><a href="'.$SearchItem['Link'].$SearchHTML.'">'.$SearchItem['Name'].'</a></td><td>'.$Line.'</td></tr>'; 63 62 } 64 65 $DbResult = $this->Database->query('SELECT count(*) FROM `User` WHERE `Name` LIKE "%'.$Search.'%"'); 66 $Line = $DbResult->fetch_row(); 67 $Output .= '<tr><td><a href="'.$this->System->Link('/userlist.php?search='.$SearchHTML).'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>'; 68 69 $DbResult = $this->Database->query('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"'); 70 $Line = $DbResult->fetch_row(); 71 $Output .= '<tr><td><a href="'.$this->System->Link('/team/?search='.$SearchHTML).'">Týmy</a></td><td>'.$Line[0].'</td></tr>'; 72 73 $DbResult = $this->Database->query('SELECT count(*) FROM `CzWoWPackageVersion` WHERE `Text` LIKE "%'.$Search.'%"'); 74 $Line = $DbResult->fetch_row(); 75 $Output .= '<tr><td><a href="'.$this->System->Link('/download.php?addon').'">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>'; 76 $Output .= '<tr><td><a href="'.$this->System->Link('/aowow/?search='.$SearchHTML).'">Vyhledávací databáze AoWoW</a></td></tr>'; 77 78 $DbResult = $this->Database->query('SELECT count(*) FROM `Dictionary` WHERE '. 79 '(`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = '.$this->System->Config['OriginalLanguage']); 80 $Line = $DbResult->fetch_row(); 81 $Output .= '<tr><td><a href="'.$this->System->Link('/dictionary/?search='.$SearchHTML). 82 '">Slovníček</a></td><td>'.$Line[0].'</td></tr>'; 83 84 $Output .= '</table>'; 63 64 $Output .= '</table>'; 85 65 return($Output); 86 66 } -
trunk/Modules/ShoutBox/ShoutBox.php
r622 r626 20 20 'Title' => 'Kecátko', 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'), 21 21 'Permission' => LICENCE_ANONYMOUS)); 22 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 23 $this->System->ModuleManager->Modules['Search']->RegisterSearch('shoutbox', 24 T('Shoutbox'), array('UserName', 'Text'), '`ShoutBox`', $this->System->Link('/shoutbox/?search=')); 22 25 } 23 26 24 27 function ShowBox() 25 28 { 26 $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T(' Chatbox').':</a></strong>';29 $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>'; 27 30 28 31 if($this->System->User->Licence(LICENCE_USER)) … … 52 55 function ShowList() 53 56 { 54 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ShoutBox`'); 57 $Output = ''; 58 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 59 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 60 if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 61 if($_SESSION['search'] != '') 62 { 63 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; 64 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 65 } else $SearchQuery = ''; 66 67 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ShoutBox` WHERE 1'.$SearchQuery); 55 68 $DbRow = $DbResult->fetch_row(); 56 $PageList = GetPageList($DbRow[0]); 57 58 $Output = '<h3>Kecátko</h3>'.$PageList['Output'];69 $PageList = GetPageList($DbRow[0]); 70 71 $Output .= '<h3>'.T('Shoutbox').'</h3>'.$PageList['Output']; 59 72 if($this->System->User->Licence(LICENCE_USER)) 60 73 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 61 74 $Output .= '<div class="shoutbox">'; 62 $DbResult = $this->System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);75 $DbResult = $this->System->Database->query('SELECT * FROM `ShoutBox` WHERE 1'.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 63 76 while($Line = $DbResult->fetch_assoc()) 64 77 $Output .= '<div><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</div>'; -
trunk/Modules/Team/Team.php
r622 r626 20 20 'Title' => T('Teams'), 21 21 'Hint' => T('List of translating teams'), 22 'Link' => $this->System->Link('/team/ ?search='),22 'Link' => $this->System->Link('/team/'), 23 23 'Permission' => LICENCE_ANONYMOUS, 24 24 'Icon' => '', 25 25 ), 1); 26 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('team', 28 T('Teams'), array('Name'), '`Team`', $this->System->Link('/team/?search=')); 26 29 } 27 30 } … … 36 39 $Output .= 'Týmy jsou seskupení překladatelů, kteří se hlásí k něčemu společnému jako např. WoW serveru, způsobu překladu, ke stejnému hernímu spolku, aj. Být členem týmu samo o sobě nemá žádný zásadní důsledek a spíše to může pomoci se lépe orientovat mezi překladateli někomu, kdo sestavuje export.<br/>'; 37 40 38 if($this->System->User->Licence(LICENCE_USER)) 41 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 42 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 43 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 44 45 if($this->System->User->Licence(LICENCE_USER)) 39 46 $Output .= '<br /><div style="text-align: center;"><a href="?action=create">'.T('Create translating team').'</a></div><br/>'; 47 if($_SESSION['search'] != '') 48 { 49 $SearchQuery = ' AND ((`Name` LIKE "%'.$_SESSION['search'].'%") OR (`Description` LIKE "%'.$_SESSION['search'].'%"))'; 50 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 51 } else $SearchQuery = ''; 40 52 41 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` ');53 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE 1'.$SearchQuery); 42 54 $DbRow = $DbResult->fetch_row(); 43 55 $PageList = GetPageList($DbRow[0]); … … 56 68 57 69 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); 58 $Output .= $Order['Output']; 59 60 if(array_key_exists('search', $_GET)) $_SESSION['search'] = ' WHERE `Name` LIKE "%'.$_GET['search'].'%" OR `Description` LIKE "%'.$_GET['search'].'%"'; 61 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 62 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 70 $Output .= $Order['Output']; 63 71 64 72 $DbResult = $this->Database->query('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) AS `NumberUser`, '. 65 73 '(SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` '. 66 'FROM `Team` '.$_SESSION['search'].$Order['SQL'].$PageList['SQLLimit']);74 'FROM `Team` WHERE 1'.$SearchQuery.$Order['SQL'].$PageList['SQLLimit']); 67 75 while($Team = $DbResult->fetch_assoc()) 68 76 { -
trunk/Modules/Translation/Translation.php
r622 r626 22 22 function Start() 23 23 { 24 global $TranslationTree; 25 24 26 $this->System->RegisterPage('comparison.php', 'PageTranslationComparison'); 25 27 $this->System->RegisterPage('form.php', 'PageTranslationForm'); … … 35 37 'Permission' => LICENCE_ANONYMOUS, 36 38 'Icon' => '', 37 ), 1); 39 ), 1); 40 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 41 { 42 foreach($TranslationTree as $Group) 43 { 44 $Table = $Group['TablePrefix']; 45 46 $Columns = array('ID', 'Entry'); 47 foreach($Group['Items'] as $Item) 48 { 49 if($Item['Column'] != '') $Columns[] = $Item['Column']; 50 } 51 52 $this->System->ModuleManager->Modules['Search']->RegisterSearch('group'.$Group['Id'], 53 sprintf(T('Translation group "%s"'), $Group['Name']), $Columns, '`'.$Table.'`', $this->System->Link('/TranslationList.php?group='. 54 $Group['Id'].'&user=0&state=0&entry=&text=')); 55 } 56 } 38 57 } 39 58 -
trunk/Modules/User/User.php
r622 r626 29 29 'Title' => T('Translators'), 30 30 'Hint' => 'Seznam registrovaných uživatelů', 31 'Link' => $this->System->Link('/userlist.php ?action=nofilter'),31 'Link' => $this->System->Link('/userlist.php'), 32 32 'Permission' => LICENCE_ANONYMOUS, 33 33 'Icon' => '', 34 34 ), 0); 35 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 36 $this->System->ModuleManager->Modules['Search']->RegisterSearch('user', 37 T('Translators'), array('Name'), '`User`', $this->System->Link('/userlist.php?search=')); 35 38 } 36 39 -
trunk/Modules/User/UserList.php
r577 r626 10 10 11 11 $Output = ''; 12 if(array_key_exists('search', $_GET)) 12 if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search']; 13 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 14 if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 15 if($_SESSION['search'] != '') 13 16 { 14 $_SESSION['Where'] = ' WHERE `User`.`Name` LIKE "%'.$_GET['search'].'%"'; 15 } 17 $SearchQuery = ' AND (`User`.`Name` LIKE "%'.$_SESSION['search'].'%")'; 18 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 19 } else $SearchQuery = ''; 20 21 $TeamFilter = ''; 16 22 if(array_key_exists('team', $_GET)) 17 23 { … … 20 26 { 21 27 $Team = $DbResult->fetch_assoc(); 22 $Output .= '<h3>Seznam uživatelů v týmu '.$Team['Name'].'</h3>'; 23 $_SESSION['Where'] = ' WHERE `Team`='.$_GET['team']; 24 if($_GET['team'] == '') $_SESSION['Where'] = ''; 28 $Output .= '<h3>'.sprintf(T('Users in team %s'), $Team['Name']).'</h3>'; 29 $TeamFilter = ' AND (`Team`='.$_GET['team'].')'; 25 30 } else { 26 $Output .= ShowMessage('Tým '.$_GET['team'].' nenalezen', MESSAGE_CRITICAL); 27 $_SESSION['Where'] = ' WHERE FALSE'; 31 $Output .= ShowMessage('Tým '.$_GET['team'].' nenalezen', MESSAGE_CRITICAL); 28 32 } 29 33 } else 30 34 { 31 $Output .= '<h3>Seznam uživatelů</h3>'; 32 if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = ''; 35 $Output .= '<h3>'.T('User list').'</h3>'; 33 36 } 34 37 35 if(array_key_exists('action', $_GET)) 36 { 37 if($_GET['action'] == 'nofilter') $_SESSION['Where'] = ''; 38 } 39 //if($_SESSION['Where'] <> '') $Output .= ' <a href="?action=nofilter">Zrušit filtr uživatelů</a><br />'; 40 41 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User`'.$_SESSION['Where']); 38 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User` WHERE 1'.$SearchQuery.$TeamFilter); 42 39 $DbRow = $DbResult->fetch_row(); 43 40 $PageList = GetPageList($DbRow[0]); … … 56 53 ); 57 54 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1); 58 $Output .= $Order['Output']; 59 55 $Output .= $Order['Output']; 60 56 61 57 $Query = 'SELECT `User`.`ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` '. 62 58 'FROM `User` '. 63 59 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '. 64 $_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit'];60 'WHERE 1'.$SearchQuery.$TeamFilter.$Order['SQL'].$PageList['SQLLimit']; 65 61 66 62 $DbResult = $this->Database->query($Query); -
trunk/includes/Version.php
r625 r626 6 6 // and system will need database update. 7 7 8 $Revision = 62 5; // Subversion revision8 $Revision = 626; // Subversion revision 9 9 $DatabaseRevision = 610; // Database structure revision 10 10 $ReleaseTime = '2013-12-04'; -
trunk/locale/cs.php
r622 r626 58 58 'Used memory' => 'Použitá paměť', 59 59 'Add word' => 'Vložit slovo', 60 'Chatbox' => 'Kecátko',61 60 'System changes' => 'Změny systému', 62 61 'Date' => 'Datum', … … 87 86 'User actions' => 'Uživatelské akce', 88 87 'Create translating team' => 'Vytvořit překladatelský tým', 88 'Section' => 'Výběr', 89 'Found count' => 'Počet nalezených', 90 'Shoutbox' => 'Kecátko', 91 'Disable filter "%s"' => 'Vypnout filtr "%s"', 92 'Users in team %s' => 'Uživatelé v týmu %s', 93 'User list' => 'Seznam uživatelů', 94 'AoWoW' => 'AoWoW', 95 'Translation group "%s"' => 'Překladová skupina "%s"', 89 96 ); 90 97 } -
trunk/locale/en.php
r622 r626 58 58 'Used memory' => '', 59 59 'Add word' => '', 60 'Chatbox' => '',61 60 'System changes' => '', 62 61 'Date' => '', … … 87 86 'User actions' => '', 88 87 'Create translating team' => '', 88 'Section' => '', 89 'Found count' => '', 90 'Shoutbox' => '', 91 'Disable filter "%s"' => '', 92 'Users in team %s' => '', 93 'User list' => '', 94 'AoWoW' => '', 95 'Translation group "%s"' => '', 89 96 ); 90 97 }
Note:
See TracChangeset
for help on using the changeset viewer.