Ignore:
Timestamp:
Feb 22, 2015, 11:20:50 PM (9 years ago)
Author:
chronos
Message:
  • Modified: Tabs converted to spaces.
  • Modified: Remove spaces from end of lines.
  • Added: Code format script.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/system.php

    r812 r816  
    2525  function Init()
    2626  {
    27         global $Config, $LocaleManager;
     27    global $Config, $LocaleManager;
    2828
    2929    $this->Config = $Config;
     
    5959    $this->Menu = array
    6060    (
    61    /*           array(
    62                                 'Title' => T('Files'),
    63                                 'Hint' => 'Stahování různých pomocných souborů a programů',
    64                                 'Link' => $this->Link('/download.php'),
    65                                 'Permission' => LICENCE_ANONYMOUS,
    66                                 'Icon' => '',
    67                 ),
    68                 */
    69                 array(
    70                                 'Title' => T('Instructions'),
    71                                 'Hint' => 'Informace k překladu hry',
    72                                 'Link' => $this->Link('/info.php'),
    73                                 'Permission' => LICENCE_ANONYMOUS,
    74                                 'Icon' => '',
    75                 ),
    76                 array(
    77                                 'Title' => T('Data source'),
    78                                 'Hint' => 'Informace o překladových skupinách',
    79                                 'Link' => $this->Link('/TranslationList.php?action=grouplist'),
    80                                 'Permission' => LICENCE_ANONYMOUS,
    81                                 'Icon' => '',
    82                 ),
    83                 array(
    84                                 'Title' => T('Presentation'),
    85                                 'Hint' => 'Prezentace a motivace překladu',
    86                                 'Link' => $this->Link('/promotion.php'),
    87                                 'Permission' => LICENCE_ANONYMOUS,
    88                                 'Icon' => '',
    89                 ),
    90                 array(
    91                                 'Title' => T('IRC chat'),
    92                                 'Hint' => 'IRC chat pro překladatele',
    93                                 'Link' => 'http://embed.mibbit.com/?server=game.zdechov.net%3A6667&channel=%23wowpreklad&forcePrompt=true&charset=utf-8',
    94                                 'Permission' => LICENCE_ANONYMOUS,
    95                                 'Icon' => '',
    96                 ),
    97                 array(
    98                                 'Title' => T('Administration'),
    99                                 'Hint' => 'Volby pro správu',
    100                                 'Link' => $this->Link('/admin/'),
    101                                 'Permission' => LICENCE_ADMIN,
    102                                 'Icon' => '',
    103                 ),
     61   /*     array(
     62            'Title' => T('Files'),
     63            'Hint' => 'Stahování různých pomocných souborů a programů',
     64            'Link' => $this->Link('/download.php'),
     65            'Permission' => LICENCE_ANONYMOUS,
     66            'Icon' => '',
     67        ),
     68        */
     69        array(
     70            'Title' => T('Instructions'),
     71            'Hint' => 'Informace k překladu hry',
     72            'Link' => $this->Link('/info.php'),
     73            'Permission' => LICENCE_ANONYMOUS,
     74            'Icon' => '',
     75        ),
     76        array(
     77            'Title' => T('Data source'),
     78            'Hint' => 'Informace o překladových skupinách',
     79            'Link' => $this->Link('/TranslationList.php?action=grouplist'),
     80            'Permission' => LICENCE_ANONYMOUS,
     81            'Icon' => '',
     82        ),
     83        array(
     84            'Title' => T('Presentation'),
     85            'Hint' => 'Prezentace a motivace překladu',
     86            'Link' => $this->Link('/promotion.php'),
     87            'Permission' => LICENCE_ANONYMOUS,
     88            'Icon' => '',
     89        ),
     90        array(
     91            'Title' => T('IRC chat'),
     92            'Hint' => 'IRC chat pro překladatele',
     93            'Link' => 'http://embed.mibbit.com/?server=game.zdechov.net%3A6667&channel=%23wowpreklad&forcePrompt=true&charset=utf-8',
     94            'Permission' => LICENCE_ANONYMOUS,
     95            'Icon' => '',
     96        ),
     97        array(
     98            'Title' => T('Administration'),
     99            'Hint' => 'Volby pro správu',
     100            'Link' => $this->Link('/admin/'),
     101            'Permission' => LICENCE_ADMIN,
     102            'Icon' => '',
     103        ),
    104104    );
    105105  }
     
    108108  {
    109109    global $System, $ScriptStartTime, $TranslationTree, $User, $StopAfterUpdateManager,
    110             $UpdateManager, $Config, $DatabaseRevision;
     110      $UpdateManager, $Config, $DatabaseRevision;
    111111
    112112    $ScriptStartTime = GetMicrotime();
     
    129129    foreach($_POST as $Index => $Item)
    130130    {
    131           if(is_array($_POST[$Index]))
    132                   foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2);
    133         else $_POST[$Index] = addslashes($_POST[$Index]);
     131      if(is_array($_POST[$Index]))
     132        foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2);
     133      else $_POST[$Index] = addslashes($_POST[$Index]);
    134134    }
    135135    foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     
    166166    if($this->DoNotShowPage == false)
    167167    {
    168           $this->ShowPage();
     168      $this->ShowPage();
    169169    }
    170170  }
     
    183183  function RegisterPage($Path, $Handler)
    184184  {
    185         if(is_array($Path))
     185    if(is_array($Path))
    186186    {
    187187      $Page = &$this->Pages;
     
    198198  function RegisterMenuItem($MenuItem, $Pos = NULL)
    199199  {
    200         if(is_null($Pos)) $this->Menu[] = $MenuItem;
    201           else {
    202                 array_splice($this->Menu, $Pos, 0, array($MenuItem));
    203           }
     200    if(is_null($Pos)) $this->Menu[] = $MenuItem;
     201      else {
     202        array_splice($this->Menu, $Pos, 0, array($MenuItem));
     203      }
    204204  }
    205205
     
    216216      } else
    217217      {
    218         if(count($PathItems) == 1) return($Pages[$PathItem]);
    219           else return(''); // Unexpected subpages
     218        if(count($PathItems) == 1) return($Pages[$PathItem]);
     219          else return(''); // Unexpected subpages
    220220      }
    221221    } else return('');
     
    224224  function PageNotFound()
    225225  {
    226         // Send correct HTTP status code to signal unknown page
    227         if(array_key_exists('SERVER_PROTOCOL', $_SERVER))
    228           Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
    229         if(array_key_exists('HTTP_REFERER', $_SERVER)) $Referer = ' Referer: '.$_SERVER['HTTP_REFERER'];
    230           else $Referer = '';
    231         if(isset($this->ModuleManager->Modules['Log']))
    232           $this->ModuleManager->Modules['Log']->WriteLog('Stránka "'.
    233           implode('/', $this->PathItems).'" nenalezena'.$Referer, LOG_TYPE_PAGE_NOT_FOUND);
     226    // Send correct HTTP status code to signal unknown page
     227    if(array_key_exists('SERVER_PROTOCOL', $_SERVER))
     228      Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
     229    if(array_key_exists('HTTP_REFERER', $_SERVER)) $Referer = ' Referer: '.$_SERVER['HTTP_REFERER'];
     230      else $Referer = '';
     231    if(isset($this->ModuleManager->Modules['Log']))
     232      $this->ModuleManager->Modules['Log']->WriteLog('Stránka "'.
     233        implode('/', $this->PathItems).'" nenalezena'.$Referer, LOG_TYPE_PAGE_NOT_FOUND);
    234234    return(ShowMessage(sprintf(T('Page "%s" not found'), implode('/', $this->PathItems)), MESSAGE_CRITICAL));
    235235  }
     
    237237  function ShowPage()
    238238  {
    239         $Output = '';
     239    $Output = '';
    240240    /* @var $Page Page */
    241241    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
     
    248248    } else {
    249249      $Output2 = '';
    250         if((count($this->OnPageNotFound) == 2)
     250      if((count($this->OnPageNotFound) == 2)
    251251  and method_exists($this->OnPageNotFound[0], $this->OnPageNotFound[1]))
    252           $Output2 = call_user_func_array($this->OnPageNotFound, array());
     252        $Output2 = call_user_func_array($this->OnPageNotFound, array());
    253253     if($Output2 != '') $Output .= $this->BaseView->ShowPage($Output2);
    254                 else {
    255                         $Output = $this->PageNotFound();
    256           $this->BaseView->Title = T('Page not found');
     254      else {
     255        $Output = $this->PageNotFound();
     256        $this->BaseView->Title = T('Page not found');
    257257        $Output = $this->BaseView->ShowPage($Output);
    258                 }
    259         }
     258      }
     259    }
    260260    echo($Output);
    261261  }
     
    264264class BaseView extends View
    265265{
    266         var $Title;
    267 
    268         function ShowTopBar()
    269         {
    270                 global $LocaleManager;
    271 
    272                 $Output = '<div class="Menu">';
    273                 if(!$this->System->User->Licence(LICENCE_USER))
    274                         $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>';
    275                 $Output .= '<span class="MenuItem"></span><span class="MenuItem2">';
    276                 if($this->System->User->Licence(LICENCE_USER))
    277                 {
    278                         //$DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team);
    279                         //$Team = $DbResult->fetch_assoc();
    280                         //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>';
    281                         $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'.
    282                                         ' <a href="'.$this->System->Link('/user.php?user='.$this->System->User->Id).'">'.T('My page').'</a>'.
    283                                         ' <a href="'.$this->System->Link('/Options.php').'">'.T('Options').'</a>'.
    284                                         ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='.
    285                                         $this->System->User->Id.'&amp;group=0&amp;state=2&amp;text=&amp;entry=').'">'.T('Translated').'</a>'.
    286                                         ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='.
    287                                         $this->System->User->Id.'&amp;group=0&amp;state=3&amp;text=&amp;entry=').'">'.T('Unfinished').'</a>'.
    288                                         ' <a title="Nikým nepřeložené texty" href="'.
    289                                         $this->System->Link('/TranslationList.php?user=0&amp;group=0&amp;state=1&amp;text=&amp;entry=').'">'.T('Untranslated').'</a>';
    290                 } else
    291                 {
    292                         $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a>&nbsp;'.
    293                                         '<a href="'.$this->System->Link('/registrace.php').'">'.T('Registration').'</a>';
    294                 }
    295                 //$Output .= ' <form action="?setlocale" method="get">';
    296                 $Output .= ' <select onchange="window.location=\'?locale=\'+this.value">';
    297                 foreach($LocaleManager->Available as $Locale)
    298                 {
    299                         if($Locale['Code'] == $LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
    300                           else $Selected = '';
    301                         $Output .= '<option title="" value="'.$Locale['Code'].'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>';
    302                 }
    303                 $Output .= '</select><noscript><span><input type="submit" value="Submit"/></span></noscript>';
    304                 //$Output .= '</form>';
    305                 $Output .= '</span></div>';
    306                 return($Output);
    307         }
    308 
    309         function ShowLoginBox()
    310         {
    311                 $Output = '';
    312                 if($this->System->User->Licence(LICENCE_USER))
    313                 {
    314                         // $Output .= 'Jste přihlášen jako: <b>'.$tUser->Id.'</b> <a href="index.php?Logout">Odhlásit</a>';
    315                 } else
    316                 {
    317                         $Output .= '<strong>'.T('Login').':</strong>
    318                         <form action="" method="post">
    319                         <table>
    320                         <tr>
    321                         <td><input type="text" name="LoginUser" size="13" /></td>
    322                         </tr>
    323                         <tr>
    324                         <td><input type="password" name="LoginPass" size="13" /></td>
    325                         </tr>
    326                         <tr>
    327                         <th><input type="submit" value="'.T('Do login').'" /></th>
    328                         </tr>
    329                         </table>
    330                         </form>';
    331                 }
    332                 return($Output);
    333         }
    334 
    335         function ShowSearchBox()
    336         {
    337                 $Output = '<strong>'.T('Search').':</strong>'.
    338                                 '<form action="'.$this->System->Link('/search/').'" method="get"><div>'.
    339                                 '<table>'.
    340                                 '<tr>'.
    341                                 '<td><input type="text" name="text" size="13" /></td>'.
    342                                 '</tr>'.
    343                                 '<tr>'.
    344                                 '<th><input type="submit" value="'.T('Do search').'" /></th>'.
    345                                 '</tr>'.
    346                                 '</table></div>'.
    347                                 '</form>';
    348                 return($Output);
    349         }
    350 
    351         function ShowMainMenu()
    352         {
    353                 $Output = '<strong>'.T('Menu').':</strong>'.
    354                                 '<div class="verticalmenu"><ul>';
    355                 foreach($this->System->Menu as $MenuItem)
    356                         if($this->System->User->Licence($MenuItem['Permission']))
    357                         {
    358                                 if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';
    359                                 else $OnClick = '';
    360                                 if($MenuItem['Icon'] != '') $Icon = '<img src="'.$this->System->Link('/images/menu/'.$MenuItem['Icon']).'"/>';
    361                                 else $Icon = '';
    362                                 $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'.
    363                                         $MenuItem['Link'].'"'.$OnClick.'>'.$MenuItem['Title'].'</a></li>';
    364                         }
    365                         $Output .= '</ul></div>';
    366                         return($Output);
    367         }
    368 
    369         function ShowTranslatedMenu()
    370         {
    371                 global $TranslationTree;
    372 
    373                 $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">';
    374                 $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`');
    375                 while($Group = $DbResult->fetch_assoc())
    376                 {
    377                         $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'.
    378                                         '<a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">'.str_replace(' ','&nbsp;',$Group['Name']).'</a></div>'.
    379                                         '<div id="group'.$Group['Id'].'" class="hidden-menu-item" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">';
    380                         $Output .= '&nbsp;<a title="Zde můžete začít překládat" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=1&amp;user=0&amp;entry=&amp;text=').'">Nepřeložené</a><br />'.
    381                                         '&nbsp;<a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=2&amp;user=0&amp;entry=&amp;text=').'">Přeložené</a><br />';
    382                         if($this->System->User->Licence(LICENCE_USER))
    383                         {
    384                                 $Output .= '&nbsp;<a title="Nedokončené překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=3').'">Rozepsané</a><br />
    385                                 &nbsp;<a title="Všechny překlady, které jste přeložil" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=1&amp;user='.$this->System->User->Id).'&amp;entry=&amp;text=">Vlastní</a><br />';
    386                         }
    387                         $Output .= '&nbsp;<a title="Sestavit speciální filtr" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">Filtr</a><br />';
    388                         $Output .= '</div>';
    389                 }
    390                 $Output .= '</div>';
    391                 return($Output);
    392         }
    393 
    394         function ShowHeader()
    395         {
    396                 $Output = ''.
    397                 '<!DOCTYPE html>'.
    398                 '<html>'.
    399                 '<head>'.
    400                 '<meta http-equiv="content-type" content="text/html; charset='.$this->System->Config['Web']['Charset'].'" />'.
    401                 '<meta name="keywords" content="wow, quest, questy, questů, preklad, mangos, překlad, překládání, přeložený, přeložení, čeština, world of warcraft, open source, free, addon" />'.
    402                 '<meta name="description" content="'.$this->System->Config['Web']['Description'].'" />'.
    403                 '<meta name="robots" content="all" />'.
    404                 '<link rel="stylesheet" href="'.$this->System->Link('/style/style.css').'" type="text/css" media="all" />'.
    405                 '<script type="text/javascript" src="'.$this->System->Link('/style/global.js').'"></script>'.
    406                 '<link rel="shortcut icon" href="'.$this->System->Link('/images/favicon.ico').'" />';
    407                 $Output .= $this->System->ModuleManager->Modules['News']->ShowRSSHeader();
    408                 $Title = $this->System->Config['Web']['Title'];
    409                 if($this->Title != '') $Title = $this->Title.' - '.$Title;
    410                 $Output .= '<title>'.$Title.'</title>'.
    411                 '</head><body>';
    412 
    413                 $Output .= $this->ShowTopBar();
    414                 $Output .= '<table class="page"><tr><td class="menu">';
    415                 $Output .= $this->ShowMainMenu();
    416                 $Output .= $this->System->ModuleManager->Modules['User']->ShowOnlineList();
    417                 $Output .= '<br />';
    418                 $Output .= $this->ShowSearchBox();
    419 
    420                 $Output .= '</td><td id="border-left"></td><td class="content">';
    421                 return($Output);
    422         }
    423 
    424         function ShowFooter()
    425         {
    426                 global $ScriptStartTime, $Revision, $ReleaseTime;
    427 
    428                 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2);
    429 
    430                 $Output = '</td>'.
     266  var $Title;
     267
     268  function ShowTopBar()
     269  {
     270    global $LocaleManager;
     271
     272    $Output = '<div class="Menu">';
     273    if(!$this->System->User->Licence(LICENCE_USER))
     274      $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>';
     275    $Output .= '<span class="MenuItem"></span><span class="MenuItem2">';
     276    if($this->System->User->Licence(LICENCE_USER))
     277    {
     278      //$DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team);
     279      //$Team = $DbResult->fetch_assoc();
     280      //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>';
     281      $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'.
     282          ' <a href="'.$this->System->Link('/user.php?user='.$this->System->User->Id).'">'.T('My page').'</a>'.
     283          ' <a href="'.$this->System->Link('/Options.php').'">'.T('Options').'</a>'.
     284          ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='.
     285          $this->System->User->Id.'&amp;group=0&amp;state=2&amp;text=&amp;entry=').'">'.T('Translated').'</a>'.
     286          ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='.
     287          $this->System->User->Id.'&amp;group=0&amp;state=3&amp;text=&amp;entry=').'">'.T('Unfinished').'</a>'.
     288          ' <a title="Nikým nepřeložené texty" href="'.
     289          $this->System->Link('/TranslationList.php?user=0&amp;group=0&amp;state=1&amp;text=&amp;entry=').'">'.T('Untranslated').'</a>';
     290    } else
     291    {
     292      $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a>&nbsp;'.
     293          '<a href="'.$this->System->Link('/registrace.php').'">'.T('Registration').'</a>';
     294    }
     295    //$Output .= ' <form action="?setlocale" method="get">';
     296    $Output .= ' <select onchange="window.location=\'?locale=\'+this.value">';
     297    foreach($LocaleManager->Available as $Locale)
     298    {
     299      if($Locale['Code'] == $LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
     300        else $Selected = '';
     301      $Output .= '<option title="" value="'.$Locale['Code'].'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>';
     302    }
     303    $Output .= '</select><noscript><span><input type="submit" value="Submit"/></span></noscript>';
     304    //$Output .= '</form>';
     305    $Output .= '</span></div>';
     306    return($Output);
     307  }
     308
     309  function ShowLoginBox()
     310  {
     311    $Output = '';
     312    if($this->System->User->Licence(LICENCE_USER))
     313    {
     314      // $Output .= 'Jste přihlášen jako: <b>'.$tUser->Id.'</b> <a href="index.php?Logout">Odhlásit</a>';
     315    } else
     316    {
     317      $Output .= '<strong>'.T('Login').':</strong>
     318      <form action="" method="post">
     319      <table>
     320      <tr>
     321      <td><input type="text" name="LoginUser" size="13" /></td>
     322      </tr>
     323      <tr>
     324      <td><input type="password" name="LoginPass" size="13" /></td>
     325      </tr>
     326      <tr>
     327      <th><input type="submit" value="'.T('Do login').'" /></th>
     328      </tr>
     329      </table>
     330      </form>';
     331    }
     332    return($Output);
     333  }
     334
     335  function ShowSearchBox()
     336  {
     337    $Output = '<strong>'.T('Search').':</strong>'.
     338        '<form action="'.$this->System->Link('/search/').'" method="get"><div>'.
     339        '<table>'.
     340        '<tr>'.
     341        '<td><input type="text" name="text" size="13" /></td>'.
     342        '</tr>'.
     343        '<tr>'.
     344        '<th><input type="submit" value="'.T('Do search').'" /></th>'.
     345        '</tr>'.
     346        '</table></div>'.
     347        '</form>';
     348    return($Output);
     349  }
     350
     351  function ShowMainMenu()
     352  {
     353    $Output = '<strong>'.T('Menu').':</strong>'.
     354        '<div class="verticalmenu"><ul>';
     355    foreach($this->System->Menu as $MenuItem)
     356      if($this->System->User->Licence($MenuItem['Permission']))
     357      {
     358        if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';
     359        else $OnClick = '';
     360        if($MenuItem['Icon'] != '') $Icon = '<img src="'.$this->System->Link('/images/menu/'.$MenuItem['Icon']).'"/>';
     361        else $Icon = '';
     362        $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'.
     363          $MenuItem['Link'].'"'.$OnClick.'>'.$MenuItem['Title'].'</a></li>';
     364      }
     365      $Output .= '</ul></div>';
     366      return($Output);
     367  }
     368
     369  function ShowTranslatedMenu()
     370  {
     371    global $TranslationTree;
     372
     373    $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">';
     374    $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`');
     375    while($Group = $DbResult->fetch_assoc())
     376    {
     377      $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'.
     378          '<a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">'.str_replace(' ','&nbsp;',$Group['Name']).'</a></div>'.
     379          '<div id="group'.$Group['Id'].'" class="hidden-menu-item" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">';
     380      $Output .= '&nbsp;<a title="Zde můžete začít překládat" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=1&amp;user=0&amp;entry=&amp;text=').'">Nepřeložené</a><br />'.
     381          '&nbsp;<a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=2&amp;user=0&amp;entry=&amp;text=').'">Přeložené</a><br />';
     382      if($this->System->User->Licence(LICENCE_USER))
     383      {
     384        $Output .= '&nbsp;<a title="Nedokončené překlady" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=3').'">Rozepsané</a><br />
     385        &nbsp;<a title="Všechny překlady, které jste přeložil" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=1&amp;user='.$this->System->User->Id).'&amp;entry=&amp;text=">Vlastní</a><br />';
     386      }
     387      $Output .= '&nbsp;<a title="Sestavit speciální filtr" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">Filtr</a><br />';
     388      $Output .= '</div>';
     389    }
     390    $Output .= '</div>';
     391    return($Output);
     392  }
     393
     394  function ShowHeader()
     395  {
     396    $Output = ''.
     397    '<!DOCTYPE html>'.
     398    '<html>'.
     399    '<head>'.
     400    '<meta http-equiv="content-type" content="text/html; charset='.$this->System->Config['Web']['Charset'].'" />'.
     401    '<meta name="keywords" content="wow, quest, questy, questů, preklad, mangos, překlad, překládání, přeložený, přeložení, čeština, world of warcraft, open source, free, addon" />'.
     402    '<meta name="description" content="'.$this->System->Config['Web']['Description'].'" />'.
     403    '<meta name="robots" content="all" />'.
     404    '<link rel="stylesheet" href="'.$this->System->Link('/style/style.css').'" type="text/css" media="all" />'.
     405    '<script type="text/javascript" src="'.$this->System->Link('/style/global.js').'"></script>'.
     406    '<link rel="shortcut icon" href="'.$this->System->Link('/images/favicon.ico').'" />';
     407    $Output .= $this->System->ModuleManager->Modules['News']->ShowRSSHeader();
     408    $Title = $this->System->Config['Web']['Title'];
     409    if($this->Title != '') $Title = $this->Title.' - '.$Title;
     410    $Output .= '<title>'.$Title.'</title>'.
     411    '</head><body>';
     412
     413    $Output .= $this->ShowTopBar();
     414    $Output .= '<table class="page"><tr><td class="menu">';
     415    $Output .= $this->ShowMainMenu();
     416    $Output .= $this->System->ModuleManager->Modules['User']->ShowOnlineList();
     417    $Output .= '<br />';
     418    $Output .= $this->ShowSearchBox();
     419
     420    $Output .= '</td><td id="border-left"></td><td class="content">';
     421    return($Output);
     422  }
     423
     424  function ShowFooter()
     425  {
     426    global $ScriptStartTime, $Revision, $ReleaseTime;
     427
     428    $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2);
     429
     430    $Output = '</td>'.
    431431      '<td class="menu2">';
    432                 $Output .= $this->ShowTranslatedMenu();
    433                 $Output .= '</td>'.
     432    $Output .= $this->ShowTranslatedMenu();
     433    $Output .= '</td>'.
    434434      '</tr><tr>'.
    435435      '<td colspan="4" class="page-bottom">'.T('Version').': '.$Revision.' ('.HumanDate($ReleaseTime).')'.
     
    438438      $this->System->Config['Web']['WebCounter'];
    439439
    440                 $Output .= '</td></tr>';
    441                 if($this->System->Config['Web']['ShowRuntimeInfo'] == true)
    442                         $Output .= '<tr><td colspan="3" style="text-align: center;">'.T('Generating duration').': '.
    443                 $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s &nbsp;&nbsp; '.T('Used memory').': '.
    444                 HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B &nbsp;&nbsp; <a href="http://validator.w3.org/check?uri='.
    445                 htmlentities('http://'.$_SERVER['HTTP_HOST'].GetRequestURI().'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>';
    446                 $Output .= '</table>'.
     440    $Output .= '</td></tr>';
     441    if($this->System->Config['Web']['ShowRuntimeInfo'] == true)
     442      $Output .= '<tr><td colspan="3" style="text-align: center;">'.T('Generating duration').': '.
     443    $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s &nbsp;&nbsp; '.T('Used memory').': '.
     444    HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B &nbsp;&nbsp; <a href="http://validator.w3.org/check?uri='.
     445    htmlentities('http://'.$_SERVER['HTTP_HOST'].GetRequestURI().'?'.$_SERVER['QUERY_STRING']).'">HTML validator</a></td></tr>';
     446    $Output .= '</table>'.
    447447      '</body>'.
    448448      '</html>';
    449                 return($Output);
    450         }
    451 
    452         function ShowPage($Content)
    453         {
    454                 $Output = $this->ShowHeader().$Content.$this->ShowFooter();
    455                 if($this->System->Config['Web']['FormatOutput'])
    456               $Output = $this->FormatOutput($Output);
    457                 return($Output);
    458         }
    459 
    460         function FormatOutput($s)
    461         {
    462                 $out = '';
    463                 $nn = 0;
    464                 $n = 0;
    465                 while($s != '')
    466                 {
    467                         $start = strpos($s, '<');
    468                         $end = strpos($s, '>');
    469                         if($start != 0)
    470                         {
    471                                 $end = $start - 1;
    472                                 $start = 0;
    473                         }
    474                         $line = trim(substr($s, $start, $end + 1));
    475                         if(strlen($line) > 0)
    476                                 if($line[0] == '<')
    477                                 {
    478                                         if($s[$start + 1] == '/')
    479                                         {
    480                                                 $n = $n - 2;
    481                                                 $nn = $n;
    482                                         } else
    483                                         {
    484                                                 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
    485                                                 else $cmd = substr($line, 1, strlen($line) - 2);
    486                                                 //echo('['.$cmd.']');
    487                                                 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
    488                                         }
    489                                 }// else $line = '['.$line.']';
    490                                 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
    491                                 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
    492                                 $s = substr($s, $end + 1, strlen($s));
    493                                 $nn = $n;
    494                 }
    495                 return($out);
    496         }
     449    return($Output);
     450  }
     451
     452  function ShowPage($Content)
     453  {
     454    $Output = $this->ShowHeader().$Content.$this->ShowFooter();
     455    if($this->System->Config['Web']['FormatOutput'])
     456          $Output = $this->FormatOutput($Output);
     457    return($Output);
     458  }
     459
     460  function FormatOutput($s)
     461  {
     462    $out = '';
     463    $nn = 0;
     464    $n = 0;
     465    while($s != '')
     466    {
     467      $start = strpos($s, '<');
     468      $end = strpos($s, '>');
     469      if($start != 0)
     470      {
     471        $end = $start - 1;
     472        $start = 0;
     473      }
     474      $line = trim(substr($s, $start, $end + 1));
     475      if(strlen($line) > 0)
     476        if($line[0] == '<')
     477        {
     478          if($s[$start + 1] == '/')
     479          {
     480            $n = $n - 2;
     481            $nn = $n;
     482          } else
     483          {
     484            if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
     485            else $cmd = substr($line, 1, strlen($line) - 2);
     486            //echo('['.$cmd.']');
     487            if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
     488          }
     489        }// else $line = '['.$line.']';
     490        //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
     491        if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
     492        $s = substr($s, $end + 1, strlen($s));
     493        $nn = $n;
     494    }
     495    return($out);
     496  }
    497497}
Note: See TracChangeset for help on using the changeset viewer.