Changeset 800


Ignore:
Timestamp:
Mar 16, 2014, 11:15:43 AM (10 years ago)
Author:
chronos
Message:
  • Added: Module Redirection responsible for redirection of old pages to new valid address.
  • Fixed: Error on client version item display if id was not specified.
  • Fixed: Error on silent application module reregistration.
  • Removed: White space on end of lines in some files.
Location:
trunk
Files:
2 added
8 edited

Legend:

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

    r790 r800  
    1313    $this->Dependencies = array('');
    1414  }
    15  
     15
    1616  function Start()
    1717  {
     
    3838                return($Output);
    3939        }
    40        
     40
    4141        function ShowItem()
    4242        {
    43      $YesNo = array('Ne', 'Ano');
    44      $DbResult = $this->System->Database->query('SELECT * FROM ClientVersion WHERE Id='.($_GET['id']*1));
    45      if($DbResult->num_rows > 0)
    46      {
    47          $Version = $DbResult->fetch_assoc();
    48    
    49      $Output = '<h3>'.T('Client version').'</h3>';
    50      $Output .= '<table class="BaseTable">'.
     43    if(array_key_exists('id', $_GET))
     44    {
     45      $YesNo = array('Ne', 'Ano');
     46      $DbResult = $this->System->Database->query('SELECT * FROM ClientVersion WHERE Id='.($_GET['id']*1));
     47      if($DbResult->num_rows > 0)
     48      {
     49        $Version = $DbResult->fetch_assoc();
     50
     51      $Output = '<h3>'.T('Client version').'</h3>';
     52      $Output .= '<table class="BaseTable">'.
    5153        '<tr><td>'.T('Version').'</td><td>'.$Version['Version'].'</td></tr>'.
    5254        '<tr><td>'.T('More information').'</td><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">wowwiki.com'.
     
    5860        '</table>';
    5961        $Output .= '<div><a href="?">'.T('All versions list').'</a></div>';
    60         if($Version['Imported']) 
     62        if($Version['Imported'])
    6163          $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='.$Version['Version']).'">'.T('Progress').'</a></div>';
    62      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
     64      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
     65    } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    6366                return($Output);
    6467        }
    65        
     68
    6669        function ShowList()
    67         {               
     70        {
    6871                $this->Title = T('Game version');
    6972    $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ClientVersion`');
    7073    $DbRow = $DbResult->fetch_row();
    71     $PageList = GetPageList($DbRow[0]);   
     74    $PageList = GetPageList($DbRow[0]);
    7275
    7376    $Output = '<h3>'.T('Game version').'</h3>'.
     
    7578
    7679    $TableColumns = array(
    77       array('Name' => 'Version', 'Title' => T('Version')), 
    78       array('Name' => 'BuildNumber', 'Title' => T('Build')), 
    79       array('Name' => 'ReleaseDate', 'Title' => T('Release date')), 
    80       array('Name' => 'Title', 'Title' => T('Title')), 
     80      array('Name' => 'Version', 'Title' => T('Version')),
     81      array('Name' => 'BuildNumber', 'Title' => T('Build')),
     82      array('Name' => 'ReleaseDate', 'Title' => T('Release date')),
     83      array('Name' => 'Title', 'Title' => T('Title')),
    8184      array('Name' => 'Imported', 'Title' => T('Imported')),
    8285    );
     
    8487    $Output .= '<table class="BaseTable">'.
    8588      $Order['Output'];
    86      
     89
    8790    $YesNo = array('Ne', 'Ano');
    8891
     
    97100    $Output .= '</table>'.
    98101      $PageList['Output'];
    99     return($Output);       
     102    return($Output);
    100103  }
    101104}
  • trunk/Modules/Download/Download.php

    r791 r800  
    1717        {
    1818                $this->System->RegisterPage('download', 'PageDownload');
    19                 $this->System->RegisterPage('download.php', 'PageDownload');
    2019                $this->System->RegisterMenuItem(array(
    2120      'Title' => T('Download'),
     
    3534$Output = '<h3>'.T('Accessories for client').'</h3>'.
    3635  '<strong><a href="'.$fileslink.'/WowLua/wowpatcher.exe">wowpatcher</a></strong> - '.T('Tool to command line, which search and edit file wow.exe for support editing files Glue Strings.lua and GlobalStrings.lua.').' '.
    37   T('Designed for one-time creation of new modified version of wow.exe. Help can be called with the - help option. The ability to modify future versions not guaranteed.').' '. 
     36  T('Designed for one-time creation of new modified version of wow.exe. Help can be called with the - help option. The ability to modify future versions not guaranteed.').' '.
    3837  '<br /><br/>'.
    39   '<strong>WowLua</strong> - '.T('Specific modified version of WoW.exe for free servers with support for translation Lua files').'<br/>'. 
     38  '<strong>WowLua</strong> - '.T('Specific modified version of WoW.exe for free servers with support for translation Lua files').'<br/>'.
    4039  'enGB a enUS: '.
    4140  ' <a href="'.$fileslink.'/WowLua/WowLua_3.3.5a.exe">3.3.5a</a>'.
     
    4645  ' <a href="'.$fileslink.'/WowLua/WowLua_1.12.1.exe">1.12.1</a>'.
    4746  '<br/><br/>'.
    48   '<strong>WoWMe</strong> - '.T('Edited files wow.exe with support of translation dbc files').':<br/>'. 
     47  '<strong>WoWMe</strong> - '.T('Edited files wow.exe with support of translation dbc files').':<br/>'.
    4948  '<a href="'.$fileslink.'/WoWMe/WoWMe_4.3.4.zip">4.3.4</a> '.
    5049  '<a href="'.$fileslink.'/WoWMe/WoWMe_3.2.0.rar">3.2.0</a> '.
     
    5453  '<br/><br/>'.
    5554  '<strong>CzechWoW</strong> - '.T('Czech for client with edited client files (old)').'<br/>';
    56    
     55
    5756  $Output .= '<a href="'.$fileslink.'/CzechWoW/Instalace_CzechWoW_3.3.5a_2010-09-09.exe">Instalace CzechWoW 3.3.5a 2010-09-09.exe</a><br/>'.
    5857  '<a href="'.$fileslink.'/CzechWoW/Instalace_CzechWoW_3.3.3a_2010-04-23.exe">Instalace CzechWoW 3.3.3a 2010-04-23.exe</a><br/>'.
     
    7776  return($Output);
    7877        }
    79        
    80         function ShowDownload() 
     78
     79        function ShowDownload()
    8180        {
    8281    $Output = '<h3>'.T('Download czech').'</h3><br />';
    83    
     82
    8483    $Output .= T('Additional files: modified wow.exe, fonts to game, translated interface aowow and more can be found on page').' <a href="'.$this->System->Link('/download/?Files').'">'.T('Files').'</a><br />';
    8584    $Output .= T('If none of these files is suitable for you, for example, to the Czech without the translated interface. You can generate your own section in section').' <a href="'.$this->System->Link('/export').'">'.T('Export').'</a><br /><br />';
     
    8786    $Output .= T('If you no longer want translation in game, you can uninstall it by file Uninstall.exe at the directory of game.').'<br />';
    8887    $Output .= '<br /><br />';
    89    
     88
    9089    $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `Featured`=1');
    9190    $DbRow = $DbResult->fetch_row();
    92     $PageList = GetPageList($DbRow[0]);   
     91    $PageList = GetPageList($DbRow[0]);
    9392
    9493    $Output .= $PageList['Output'];
    9594    $TableColumns = array(
    96       array('Name' => 'Version', 'Title' => T('Download')), 
    97       array('Name' => 'Title', 'Title' => T('Name2'),), 
    98       array('Name' => 'TimeCreate', 'Title' => T('Creation date')), 
     95      array('Name' => 'Version', 'Title' => T('Download')),
     96      array('Name' => 'Title', 'Title' => T('Name2'),),
     97      array('Name' => 'TimeCreate', 'Title' => T('Creation date')),
    9998      array('Name' => 'Description', 'Title' => T('Description')),
    100     );   
     99    );
    101100    $Order = GetOrderTableHeader($TableColumns, 'Id', 1);
    102101    $Output .= '<table class="BaseTable">'.
    103       $Order['Output'];                 
     102      $Order['Output'];
    104103        $DbRows = $this->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '.
    105104      '`Export`.`Id`, `Export`.`ClientVersion`, `Export`.`OutputType`, `Export`.`Title`, '.
     
    107106      'JOIN `ClientVersion` as `ClientVersion` ON `ClientVersion`.`Id`=`Export`.`ClientVersion` '.
    108107      'WHERE `Featured`=1 '.$Order['SQL'].$PageList['SQLLimit']);
    109     while ($DbExport = $DbRows->fetch_assoc()) 
     108    while ($DbExport = $DbRows->fetch_assoc())
    110109    {
    111110        $ExportId = $DbExport['Id'];
    112                    
     111
    113112                          if ($DbExport['OutputType'] == 10)
    114113                    $filename = $this->System->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'Instalace_CzechWoW_'.$DbExport['Version'].'.exe';
    115114                          if ($DbExport['OutputType'] == 7)
    116115                    $filename = $this->System->Config['Web']['TempFolder'].'Export/'.$ExportId.'/'.'CzWoW_Addon-'.$DbExport['Version'].'.zip';
    117                            
     116
    118117                          if ($DbExport['OutputType'] == 10)
    119118          $Output .= '<tr><td><a href="'.$this->System->Link('/'.$filename).
     
    129128            $ExportId.'&amp;Tab=7').'">'.T('Make export').'</a><br /> <a href="'.
    130129            $this->System->Link('/export/?Action=View&amp;ExportId='.$ExportId).'">Export '.$ExportId.'</a></td>';
    131                                
     130
    132131        $Output .= '<td>'.$DbExport['Title'].'</td>'; //.'<td>'.$DbExport['ClientVersion'].'</td>';
    133                                
     132
    134133                          if ((($DbExport['OutputType'] == 10) or ($DbExport['OutputType'] == 7)) and (file_exists($filename)))
    135134          $Output .= '<td>'.date('d.m.y H:i',filemtime($filename)).'</td>';
     
    137136          $Output .= '<td>&nbsp;</td>';
    138137
    139                                         $Output .= 
     138                                        $Output .=
    140139                                        '<td>'.str_replace("\n", '<br />',$DbExport['Description']).'</td>'.
    141140          '</tr>';
     
    143142    $Output .= '</table>'.
    144143      $PageList['Output'];
    145        
     144
    146145    return($Output);
    147146  }
    148        
    149         function Show() 
     147
     148        function Show()
    150149        {
    151150                $this->Title = T('Download');
     
    153152    if (isset($_GET['Files'])) $Output .= $this->ShowFiles();
    154153    else $Output .= $this->ShowDownload();
    155  
     154
    156155    return($Output);
    157   }     
     156  }
    158157}
    159    
  • trunk/Modules/Translation/Save.php

    r727 r800  
    2525                        $Language = $_POST['Language'] * 1;
    2626                        if(array_key_exists('End', $_POST)) $Complete = 1;
    27                         else $Complete = 0;
     27                          else $Complete = 0;
    2828       
    2929                        // Get source text record from database by ID
     
    3434       
    3535                                // Get data for english original
    36                                 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].
    37                                                 ') AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].
    38                                                 ') AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');
     36                                $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') '.
     37                                        'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '.
     38                                        'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');
    3939                                if($DbResult->num_rows > 0)
    4040                                {
  • trunk/includes/AppModule.php

    r545 r800  
    66  var $Name;
    77  var $Version;
    8   var $License; 
     8  var $License;
    99  var $Creator;
    1010  var $Description;
     
    1919  var $Manager;
    2020  var $OnChange;
    21  
     21
    2222  function __construct($System)
    2323  {
     
    2727    $this->Dependencies = array();
    2828  }
    29  
     29
    3030  function Install()
    3131  {
    3232  }
    33  
     33
    3434  function Uninstall()
    3535  {
    3636  }
    37  
     37
    3838  function Start()
    3939  {
    4040  }
    41  
     41
    4242  function Stop()
    4343  {
    44   } 
     44  }
    4545}
    4646
    47 class AppModuleManager 
     47class AppModuleManager
    4848{
    4949  var $Modules;
    50  
     50
    5151  function __construct()
    5252  {
    53     $this->Modules = array();     
     53    $this->Modules = array();
    5454  }
    55  
     55
    5656  function StartAll()
    5757  {
     
    7171    }
    7272  }
    73  
     73
    7474  function ModulePresent($Name)
    7575  {
    7676    return(array_key_exists($Name, $this->Modules));
    7777  }
    78  
     78
    7979  function RegisterModule(AppModule $Module)
    8080  {
    81     $this->Modules[$Module->Name] = &$Module; 
    82     $Module->Manager = &$this;
    83     $Module->OnChange = &$this->OnModuleChange;
     81    if(!isset($this->Modules[$Module->Name]))
     82    {
     83      $this->Modules[$Module->Name] = &$Module;
     84      $Module->Manager = &$this;
     85      $Module->OnChange = &$this->OnModuleChange;
     86    } else throw new Exception('Module '.$Module->Name.' redefined');
    8487  }
    85  
     88
    8689  function UnregisterModule($Module)
    8790  {
    88     unset($this->Modules[array_search($Module, $this->Modules)]); 
     91    unset($this->Modules[array_search($Module, $this->Modules)]);
    8992  }
    90  
     93
    9194  /* @return Module */
    9295  function SearchModuleById($Id)
     
    98101    }
    99102    return('');
    100   } 
     103  }
    101104}
  • trunk/includes/Database.php

    r770 r800  
    88  var $PDOStatement;
    99  var $num_rows = 0;
    10  
     10
    1111  function fetch_assoc()
    1212  {
    1313    return($this->PDOStatement->fetch(PDO::FETCH_ASSOC));
    1414  }
    15  
     15
    1616  function fetch_array()
    1717  {
     
    2929  var $Prefix;
    3030  var $Functions;
    31   var $Type; 
     31  var $Type;
    3232  var $PDO;
    3333  var $Error;
     
    3737  var $ShowSQLQuery;
    3838  var $LogFile;
    39  
     39
    4040  function __construct()
    41   {   
     41  {
    4242        $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');
    4343        $this->Type = 'mysql'; // mysql, pgsql
     
    4747        $this->LogFile = dirname(__FILE__).'/../Query.log';
    4848  }
    49  
     49
    5050  function Connect($Host, $User, $Password, $Database)
    51   {   
     51  {
    5252    if($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;
    5353      else if($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;
     
    5555    $this->PDO = new PDO($ConnectionString, $User, $Password);
    5656  }
    57  
     57
    5858  function select_db($Database)
    5959  {
    6060    $this->query('USE `'.$Database.'`');
    6161  }
    62  
     62
    6363  function query($Query)
    6464  {
     
    6767    $Result = new DatabaseResult();
    6868    $Result->PDOStatement = $this->PDO->query($Query);
    69     if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) 
    70       $Duration = ' ; '.round(microtime() - $QueryStartTime, 3). ' s';
     69    if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
     70      $Duration = ' ; '.round(microtime() - $QueryStartTime, 4). ' s';
    7171    if($this->LogSQLQuery == true)
    7272      file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND);
     
    8181      $this->Error = $this->PDO->errorInfo();
    8282      $this->Error = $this->Error[2];
    83       if(($this->Error != '') and ($this->ShowSQLError == true)) 
     83      if(($this->Error != '') and ($this->ShowSQLError == true))
    8484        echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>');
    8585        throw new Exception('SQL Error: '.$this->Error);
    8686    }
    87     return($Result); 
     87    return($Result);
    8888  }
    8989
    9090  function select($Table, $What = '*', $Condition = 1)
    91   {   
    92     return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition)); 
     91  {
     92    return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));
    9393  }
    9494
    9595  function delete($Table, $Condition)
    9696  {
    97     $this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 
    98   }
    99  
     97    $this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);
     98  }
     99
    100100  function insert($Table, $Data)
    101101  {
     
    105105    {
    106106      $Name .= ',`'.$Key.'`';
    107       if(!in_array($Value, $this->Functions)) 
     107      if(!in_array($Value, $this->Functions))
    108108      {
    109109        if(is_null($Value)) $Value = 'NULL';
     
    114114    $Name = substr($Name, 1);
    115115    $Values = substr($Values, 1);
    116     $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 
     116    $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
    117117    $this->insert_id = $this->PDO->lastInsertId();
    118118  }
    119  
     119
    120120  function update($Table, $Condition, $Data)
    121121  {
     
    123123    foreach($Data as $Key => $Value)
    124124    {
    125       if(!in_array($Value, $this->Functions)) 
     125      if(!in_array($Value, $this->Functions))
    126126      {
    127127        if(is_null($Value)) $Value = 'NULL';
     
    130130      $Values .= ', `'.$Key.'`='.$Value;
    131131    }
    132     $Values = substr($Values, 2); 
     132    $Values = substr($Values, 2);
    133133    $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');
    134134  }
    135  
     135
    136136  function replace($Table, $Data)
    137137  {
     
    140140    foreach($Data as $Key => $Value)
    141141    {
    142       if(!in_array($Value, $this->Functions)) 
     142      if(!in_array($Value, $this->Functions))
    143143      {
    144144        if(is_null($Value)) $Value = 'NULL';
     
    154154    //echo($this->error().'<br>');
    155155  }
    156  
     156
    157157  function charset($Charset)
    158158  {
    159159    $this->query('SET NAMES "'.$Charset.'"');
    160160  }
    161  
     161
    162162  function real_escape_string($Text)
    163163  {
    164164    return(addslashes($Text));
    165165  }
    166  
     166
    167167  function quote($Text)
    168168  {
    169169        return($this->PDO->quote($Text));
    170170  }
    171  
     171
    172172  function __sleep()
    173173  {
     
    177177  function __wakeup()
    178178  {
    179   } 
     179  }
    180180}
    181181
     
    183183{
    184184  if($Time == NULL) return(NULL);
    185     else return(date('Y-m-d H:i:s', $Time)); 
     185    else return(date('Y-m-d H:i:s', $Time));
    186186}
    187187
     
    189189{
    190190  if($Time == NULL) return(NULL);
    191     else return(date('Y-m-d', $Time)); 
     191    else return(date('Y-m-d', $Time));
    192192}
    193193
     
    195195{
    196196  if($Time == NULL) return(NULL);
    197     else return(date('H:i:s', $Time)); 
     197    else return(date('H:i:s', $Time));
    198198}
    199199
    200200function MysqlDateTimeToTime($DateTime)
    201201{
    202   if($DateTime == '') return(0);     
     202  if($DateTime == '') return(0);
    203203  $Parts = explode(' ', $DateTime);
    204   $DateParts = explode('-', $Parts[0]); 
     204  $DateParts = explode('-', $Parts[0]);
    205205  $TimeParts = explode(':', $Parts[1]);
    206   $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 
    207   return($Result); 
     206  $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
     207  return($Result);
    208208}
    209209
     
    211211{
    212212  if($Date == '') return(0);
    213   return(MysqlDateTimeToTime($Date.' 0:0:0')); 
     213  return(MysqlDateTimeToTime($Date.' 0:0:0'));
    214214}
    215215
     
    217217{
    218218  if($Time == '') return(0);
    219   return(MysqlDateTimeToTime('0000-00-00 '.$Time)); 
    220 }
     219  return(MysqlDateTimeToTime('0000-00-00 '.$Time));
     220}
  • trunk/includes/Version.php

    r799 r800  
    66// and system will need database update.
    77
    8 $Revision = 799; // Subversion revision
     8$Revision = 800; // Subversion revision
    99$DatabaseRevision = 787; // Database structure revision
    10 $ReleaseTime = '2014-03-09';
     10$ReleaseTime = '2014-03-16';
  • trunk/includes/global.php

    r798 r800  
    1111include_once(dirname(__FILE__).'/AppModule.php');
    1212include_once(dirname(__FILE__).'/Locale.php');
     13require_once(dirname(__FILE__).'/../HTML/BBCodeParser2.php');
    1314
    1415// Include application modules
     
    3334include_once(dirname(__FILE__).'/../Modules/Download/Download.php');
    3435include_once(dirname(__FILE__).'/../Modules/Forum/Forum.php');
    35 require_once(dirname(__FILE__).'/../HTML/BBCodeParser2.php');
     36include_once(dirname(__FILE__).'/../Modules/Redirection/Redirection.php');
    3637
    3738
  • trunk/includes/system.php

    r798 r800  
    158158    $this->ModuleManager->RegisterModule(new ModuleDownload($System));
    159159    $this->ModuleManager->RegisterModule(new ModuleForum($System));
     160    $this->ModuleManager->RegisterModule(new ModuleRedirection($System));
    160161    $this->ModuleManager->StartAll();
    161162
     
    203204  function SearchPage($PathItems, $Pages)
    204205  {
    205     if(count($PathItems) > 0) $PathItem = $PathItems[0];
    206       else $PathItem = '';
     206    if(count($PathItems) == 0) $PathItems = array('');
     207    $PathItem = $PathItems[0];
    207208    if(array_key_exists($PathItem, $Pages))
    208209    {
     
    237238    /* @var $Page Page */
    238239    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
    239     if($ClassName != '')
     240    if(($ClassName != '') and (class_exists($ClassName)))
    240241    {
    241242      $Page = new $ClassName($this);
Note: See TracChangeset for help on using the changeset viewer.