Changeset 880


Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
Location:
trunk
Files:
70 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Core.php

    r878 r880  
    3434
    3535    $this->Config = $Config;
    36     if(isset($this->Config['Web']['Timezone']))
     36    if (isset($this->Config['Web']['Timezone']))
    3737      date_default_timezone_set($this->Config['Web']['Timezone']);
    3838    mb_internal_encoding("UTF-8");
    3939
    40     if(isset($this->Config['Database']))
    41     {
    42     $this->Database->Connect($this->Config['Database']['Host'],
    43       $this->Config['Database']['User'], $this->Config['Database']['Password'],
    44       $this->Config['Database']['Database']);
    45     $this->Database->charset($this->Config['Database']['Charset']);
    46     $this->Database->ShowSQLQuery = $this->Config['Web']['ShowSQLQuery'];
    47     $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];
    48     $this->Database->LogSQLQuery = $this->Config['Web']['LogSQLQuery'];
     40    if (isset($this->Config['Database']))
     41    {
     42      $this->Database->Connect($this->Config['Database']['Host'],
     43        $this->Config['Database']['User'], $this->Config['Database']['Password'],
     44        $this->Config['Database']['Database']);
     45      $this->Database->charset($this->Config['Database']['Charset']);
     46      $this->Database->ShowSQLQuery = $this->Config['Web']['ShowSQLQuery'];
     47      $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];
     48      $this->Database->LogSQLQuery = $this->Config['Web']['LogSQLQuery'];
    4949    }
    5050
     
    6060    );
    6161
    62     if(GetRemoteAddress() != '')
     62    if (GetRemoteAddress() != '')
    6363    {
    6464      $this->BaseURL = $_SERVER["CONTEXT_PREFIX"];
     
    6868
    6969    // Detect interface locale
    70     if(isset($this->Config['Web']['Locale']))
     70    if (isset($this->Config['Web']['Locale']))
    7171      $this->LocaleManager->DefaultLangCode = $this->Config['Web']['Locale'];
    7272    $this->LocaleManager->LangCode = $this->LocaleManager->DefaultLangCode;
    73     if(count($this->PathItems) > 0)
     73    if (count($this->PathItems) > 0)
    7474    {
    7575      $NewLangCode = $this->PathItems[0];
    76       if(array_key_exists($NewLangCode, $this->LocaleManager->Available)) {
     76      if (array_key_exists($NewLangCode, $this->LocaleManager->Available)) {
    7777        array_shift($this->PathItems);
    7878        $this->LocaleManager->LangCode = $NewLangCode;
    7979      }
    8080    }
    81     if(array_key_exists($this->LocaleManager->LangCode, $this->LocaleManager->Available))
     81    if (array_key_exists($this->LocaleManager->LangCode, $this->LocaleManager->Available))
    8282      $this->LocaleManager->LoadLocale($this->LocaleManager->LangCode);
    8383
     
    109109
    110110    $ScriptStartTime = GetMicrotime();
    111     //if(GetRemoteAddress() != '')
     111    //if (GetRemoteAddress() != '')
    112112      session_start();
    113113
    114114    // SQL injection hack protection
    115     foreach($_POST as $Index => $Item)
    116     {
    117       if(is_array($_POST[$Index]))
    118         foreach($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2);
     115    foreach ($_POST as $Index => $Item)
     116    {
     117      if (is_array($_POST[$Index]))
     118        foreach ($_POST[$Index] as $Index2 => $Item2) $_POST[$Index][$Index2] = addslashes($Item2);
    119119      else $_POST[$Index] = addslashes($_POST[$Index]);
    120120    }
    121     foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     121    foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    122122
    123123    $this->RegisterPageBar('Top');
     
    130130    $this->Setup->Start();
    131131    $this->Setup->UpdateManager->VersionTable = 'DbVersion';
    132     if($this->Setup->CheckState())
     132    if ($this->Setup->CheckState())
    133133    {
    134134      $this->ModuleManager->Start();
     
    136136
    137137    $this->BaseView = new BaseView($this);
    138     if($this->DoNotShowPage == false)
     138    if ($this->DoNotShowPage == false)
    139139    {
    140140      $this->ShowPage();
     
    145145  {
    146146    list($Usec, $Sec) = explode(' ', microtime());
    147     return ((float)$Usec + (float)$Sec);
     147    return (float)$Usec + (float)$Sec;
    148148  }
    149149
     
    152152    $Remaining = substr($Target, strlen($this->BaseURL));
    153153    $TargetParts = explode('/', $Remaining);
    154     if(count($TargetParts) > 0)
    155     {
    156       if(in_array($TargetParts[0], $this->LinkLocaleExceptions))
     154    if (count($TargetParts) > 0)
     155    {
     156      if (in_array($TargetParts[0], $this->LinkLocaleExceptions))
    157157      {
    158         return($this->BaseURL.$Target);
    159       }
    160     }
    161     return($this->LinkLocale($Target));
     158        return $this->BaseURL.$Target;
     159      }
     160    }
     161    return $this->LinkLocale($Target);
    162162  }
    163163
     
    168168    $RemainingParts = explode('?', $Remaining);
    169169    $Directory = $RemainingParts[0];
    170     if(count($RemainingParts) > 1)
     170    if (count($RemainingParts) > 1)
    171171    {
    172172      $Params = $RemainingParts[1];
     
    180180
    181181    $DirectoryParts = explode('/', $Directory);
    182     foreach($DirectoryParts as $Index => $Item)
     182    foreach ($DirectoryParts as $Index => $Item)
    183183    {
    184184      $NewText = $TargetLocaleManager->CurrentLocale->Texts->Translate($Item, 'URL');
     
    187187    $Directory = implode('/', $DirectoryParts);
    188188    $Remaining = $Directory;
    189     if($Params != '') $Remaining .= '?'.$Params;
    190 
    191     return($Remaining);
     189    if ($Params != '') $Remaining .= '?'.$Params;
     190
     191    return $Remaining;
    192192  }
    193193
     
    198198    $RemainingParts = explode('?', $Remaining);
    199199    $Directory = $RemainingParts[0];
    200     if(count($RemainingParts) > 1)
     200    if (count($RemainingParts) > 1)
    201201    {
    202202      $Params = $RemainingParts[1];
     
    210210
    211211    $DirectoryParts = explode('/', $Directory);
    212     foreach($DirectoryParts as $Index => $Item)
     212    foreach ($DirectoryParts as $Index => $Item)
    213213    {
    214214      $NewText = $TargetLocaleManager->CurrentLocale->Texts->TranslateReverse($Item, 'URL');
     
    217217    $Directory = implode('/', $DirectoryParts);
    218218    $Remaining = $Directory;
    219     if($Params != '') $Remaining .= '?'.$Params;
    220 
    221     return($Remaining);
     219    if ($Params != '') $Remaining .= '?'.$Params;
     220
     221    return $Remaining;
    222222  }
    223223
    224224  function LinkLocale($Target, $Locale = '')
    225225  {
    226     if($Locale == '') $Locale = $this->LocaleManager->LangCode;
     226    if ($Locale == '') $Locale = $this->LocaleManager->LangCode;
    227227
    228228    $Target = $this->TranslateURL($Target, $Locale);
    229229
    230     if($Locale == $this->LocaleManager->DefaultLangCode)
    231       return($this->BaseURL.$Target);
    232     return($this->BaseURL.'/'.$Locale.$Target);
     230    if ($Locale == $this->LocaleManager->DefaultLangCode)
     231      return $this->BaseURL.$Target;
     232    return $this->BaseURL.'/'.$Locale.$Target;
    233233  }
    234234
    235235  function RegisterPage($Path, $Handler)
    236236  {
    237     if(is_array($Path))
     237    if (is_array($Path))
    238238    {
    239239      $Page = &$this->Pages;
    240240      $LastKey = array_pop($Path);
    241       foreach($Path as $PathItem)
     241      foreach ($Path as $PathItem)
    242242      {
    243243        $Page = &$Page[$PathItem];
    244244      }
    245       if(!is_array($Page)) $Page = array('' => $Page);
     245      if (!is_array($Page)) $Page = array('' => $Page);
    246246      $Page[$LastKey] = $Handler;
    247247    } else $this->Pages[$Path] = $Handler;
     
    250250  function RegisterMenuItem($MenuItem, $Pos = NULL)
    251251  {
    252     if(is_null($Pos)) $this->Menu[] = $MenuItem;
     252    if (is_null($Pos)) $this->Menu[] = $MenuItem;
    253253      else {
    254254        array_splice($this->Menu, $Pos, 0, array($MenuItem));
     
    258258  function SearchPage($PathItems, $Pages)
    259259  {
    260     if(count($PathItems) == 0) $PathItems = array('');
     260    if (count($PathItems) == 0) $PathItems = array('');
    261261    $PathItem = $PathItems[0];
    262262    $PathItem = $this->LocaleManager->CurrentLocale->Texts->TranslateReverse($PathItem, 'URL');
    263263
    264     if(array_key_exists($PathItem, $Pages))
    265     {
    266       if(is_array($Pages[$PathItem]))
     264    if (array_key_exists($PathItem, $Pages))
     265    {
     266      if (is_array($Pages[$PathItem]))
    267267      {
    268268        array_shift($PathItems);
    269         return($this->SearchPage($PathItems, $Pages[$PathItem]));
     269        return $this->SearchPage($PathItems, $Pages[$PathItem]);
    270270      } else
    271271      {
    272         if(count($PathItems) == 1) return($Pages[$PathItem]);
    273           else return(''); // Unexpected subpages
    274       }
    275     } else return('');
     272        if (count($PathItems) == 1) return $Pages[$PathItem];
     273          else return ''; // Unexpected subpages
     274      }
     275    } else return '';
    276276  }
    277277
     
    279279  {
    280280    // Send correct HTTP status code to signal unknown page
    281     if(array_key_exists('SERVER_PROTOCOL', $_SERVER))
     281    if (array_key_exists('SERVER_PROTOCOL', $_SERVER))
    282282      Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
    283     if(array_key_exists('HTTP_REFERER', $_SERVER)) $Referer = ' Referer: '.$_SERVER['HTTP_REFERER'];
     283    if (array_key_exists('HTTP_REFERER', $_SERVER)) $Referer = ' Referer: '.$_SERVER['HTTP_REFERER'];
    284284      else $Referer = '';
    285     if(isset($this->ModuleManager->Modules['Log']))
     285    if (isset($this->ModuleManager->Modules['Log']))
    286286      $this->ModuleManager->Modules['Log']->WriteLog('Stránka "'.
    287287        implode('/', $this->PathItems).'" nenalezena'.$Referer, LOG_TYPE_PAGE_NOT_FOUND);
    288     return(ShowMessage(sprintf(T('Page "%s" not found'), implode('/', $this->PathItems)), MESSAGE_CRITICAL));
     288    return ShowMessage(sprintf(T('Page "%s" not found'), implode('/', $this->PathItems)), MESSAGE_CRITICAL);
    289289  }
    290290
     
    295295    /* @var $Page Page */
    296296    $ClassName = $this->SearchPage($this->PathItems, $this->Pages);
    297     if(($ClassName != '') and (class_exists($ClassName)))
     297    if (($ClassName != '') and (class_exists($ClassName)))
    298298    {
    299299      $Page = new $ClassName($this);
    300300      $Output = $Page->GetOutput();
    301301      $this->BaseView->Title = $Page->Title;
    302       if($Page->RawPage == false) $Output = $this->BaseView->ShowPage($Output);
     302      if ($Page->RawPage == false) $Output = $this->BaseView->ShowPage($Output);
    303303    } else {
    304304      $Output2 = '';
    305       if((count($this->OnPageNotFound) == 2)
     305      if ((count($this->OnPageNotFound) == 2)
    306306        and method_exists($this->OnPageNotFound[0], $this->OnPageNotFound[1]))
    307307        $Output2 = call_user_func_array($this->OnPageNotFound, array());
    308      if($Output2 != '') $Output .= $this->BaseView->ShowPage($Output2);
     308     if ($Output2 != '') $Output .= $this->BaseView->ShowPage($Output2);
    309309      else {
    310310        $Output = $this->PageNotFound();
     
    338338  function HumanDate($Time)
    339339  {
    340     return(date('j.n.Y', $Time));
     340    return date('j.n.Y', $Time);
    341341  }
    342342}
  • trunk/Application/DefaultConfig.php

    r861 r880  
    66  {
    77    $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1'));
    8     return(array(
     8    return array(
    99      array('Name' => 'SystemPassword', 'Type' => 'PasswordEncoded', 'Default' => '', 'Title' => 'System password'),
    1010      array('Name' => 'Database/Host', 'Type' => 'String', 'Default' => 'localhost', 'Title' => 'Server'),
     
    4646      array('Name' => 'OriginalLanguage', 'Type' => 'Integer', 'Default' => 1, 'Title' => 'Original language'),
    4747      array('Name' => 'EnableGoogleTranslate', 'Type' => 'Boolean', 'Default' => false, 'Title' => 'Enable Google translate'),
    48     ));
     48    );
    4949  }
    5050}
  • trunk/Application/UpdateTrace.php

    r879 r880  
    24832483
    24842484  $DbResult = $System->Database->query('SELECT `TablePrefix` FROM `Group`');
    2485   while($Group = $DbResult->fetch_assoc())
     2485  while ($Group = $DbResult->fetch_assoc())
    24862486  {
    24872487    $Manager->Execute('ALTER TABLE `'.$Group['TablePrefix'].'` ADD FOREIGN KEY ( `Language` ) REFERENCES `Language` ('.
     
    25322532  // Set all string collation to utf8 general
    25332533  $DbResult = $Manager->Execute("SHOW TABLES");
    2534   while($DbRow = $DbResult->fetch_row())
     2534  while ($DbRow = $DbResult->fetch_row())
    25352535  {
    25362536    $Manager->Execute("ALTER TABLE `".$DbRow[0]."` CONVERT TO CHARACTER SET utf8");
     
    29462946
    29472947function UpdateTo872($Manager)
    2948 {       
     2948{
    29492949  // Allow to store IPv6 addresses
    29502950  $Manager->Execute('ALTER TABLE `UserOnline` CHANGE `IpAddress` `IpAddress` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT "";');
     
    29572957
    29582958function UpdateTo873($Manager)
    2959 {       
     2959{
    29602960  $Manager->Execute('ALTER TABLE `User` CHANGE `XP` `XP` INT(11) NOT NULL DEFAULT "0";');
    29612961  $Manager->Execute('ALTER TABLE `User` CHANGE `TranslatedCount` `TranslatedCount` INT(11) NOT NULL DEFAULT "0";');
     
    29712971  function Get()
    29722972  {
    2973     return(array(
     2973    return array(
    29742974      498 => array('Revision' => 506, 'Function' => 'UpdateTo506'),
    29752975      506 => array('Revision' => 510, 'Function' => 'UpdateTo510'),
     
    30063006      867 => array('Revision' => 872, 'Function' => 'UpdateTo872'),
    30073007      872 => array('Revision' => 873, 'Function' => 'UpdateTo873'),
    3008     ));
     3008    );
    30093009  }
    30103010}
  • trunk/Application/View.php

    r864 r880  
    99    //$Output .= ' <form action="?setlocale" method="get">';
    1010    $Output = ' <select onchange="window.location=this.value">';
    11     foreach($this->System->LocaleManager->Available as $Locale)
     11    foreach ($this->System->LocaleManager->Available as $Locale)
    1212    {
    1313      $Remaining = substr($_SERVER["REQUEST_URI"], strlen($this->System->BaseURL));
    14       if(substr($Remaining, 1, strlen($Locale['Code'].'/')) == $this->System->LocaleManager->LangCode.'/')
     14      if (substr($Remaining, 1, strlen($Locale['Code'].'/')) == $this->System->LocaleManager->LangCode.'/')
    1515        $Remaining = substr($Remaining, strlen('/'.$Locale['Code']));
    16       if($Locale['Code'] == $this->System->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
     16      if ($Locale['Code'] == $this->System->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
    1717        else $Selected = '';
    1818      $Remaining = $this->System->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode);
     
    2323    $Output .= '</select><noscript><span><input type="submit" value="Submit"/></span></noscript>';
    2424
    25     return($Output);
     25    return $Output;
    2626  }
    2727
     
    2929  {
    3030    $Output = '<div class="Menu">';
    31     if(isset($this->System->User))
     31    if (isset($this->System->User))
    3232    {
    33       if(!$this->System->User->Licence(LICENCE_USER))
     33      if (!$this->System->User->Licence(LICENCE_USER))
    3434        $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>';
    3535    }
     
    3838    // Show bars items
    3939    $Bar = '';
    40     foreach($this->System->Bars['Top'] as $BarItem)
     40    foreach ($this->System->Bars['Top'] as $BarItem)
    4141      $Bar .= call_user_func($BarItem);
    42       if(trim($Bar) != '') $Output .= $Bar;
     42      if (trim($Bar) != '') $Output .= $Bar;
    4343      else $Output .= '&nbsp;';
    4444
     
    4646    //$Output .= '</form>';
    4747    $Output .= '</span></div>';
    48     return($Output);
     48    return $Output;
    4949  }
    5050
     
    5353    $Output = '<strong>'.T('Menu').':</strong>'.
    5454      '<div class="verticalmenu"><ul>';
    55     foreach($this->System->Menu as $MenuItem)
    56       if(!isset($this->System->User) or $this->System->User->Licence($MenuItem['Permission']))
     55    foreach ($this->System->Menu as $MenuItem)
     56      if (!isset($this->System->User) or $this->System->User->Licence($MenuItem['Permission']))
    5757      {
    58         if(isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';
     58        if (isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';
    5959        else $OnClick = '';
    60         if($MenuItem['Icon'] != '') $Icon = '<img src="'.$this->System->Link('/images/menu/'.$MenuItem['Icon']).'"/>';
     60        if ($MenuItem['Icon'] != '') $Icon = '<img src="'.$this->System->Link('/images/menu/'.$MenuItem['Icon']).'"/>';
    6161        else $Icon = '';
    6262        $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'.
     
    6464      }
    6565      $Output .= '</ul></div>';
    66       return($Output);
     66      return $Output;
    6767  }
    6868
     
    8383    // Show page headers
    8484    $Bar = '';
    85     foreach($this->System->PageHeaders as $Item)
     85    foreach ($this->System->PageHeaders as $Item)
    8686      $Output .= call_user_func($Item);
    8787
    8888    $Title = $this->System->Config['Web']['Title'];
    89     if($this->Title != '') $Title = $this->Title.' - '.$Title;
     89    if ($this->Title != '') $Title = $this->Title.' - '.$Title;
    9090    $Output .= '<title>'.$Title.'</title>'.
    9191    '<script src="'.$this->System->Link('/style/respond.js').'"></script>'.
     
    9898    // Show bars items
    9999    $Bar = '';
    100     foreach($this->System->Bars['Left'] as $BarItem)
     100    foreach ($this->System->Bars['Left'] as $BarItem)
    101101      $Bar .= call_user_func($BarItem);
    102       if(trim($Bar) != '') $Output .= $Bar;
     102      if (trim($Bar) != '') $Output .= $Bar;
    103103      else $Output .= '&nbsp;';
    104104
    105105    $Output .= '</td><td id="border-left"></td><td class="content">';
    106     return($Output);
     106    return $Output;
    107107  }
    108108
     
    117117    // Show bars items
    118118    $Bar = '';
    119     foreach($this->System->Bars['Right'] as $BarItem)
     119    foreach ($this->System->Bars['Right'] as $BarItem)
    120120      $Bar .= call_user_func($BarItem);
    121       if(trim($Bar) != '') $Output .= $Bar;
     121      if (trim($Bar) != '') $Output .= $Bar;
    122122      else $Output .= '&nbsp;';
    123123    $Output .= '</td>';
     
    129129
    130130    $Output .= '</td></tr>';
    131     if($this->System->Config['Web']['ShowRuntimeInfo'] == true)
     131    if ($this->System->Config['Web']['ShowRuntimeInfo'] == true)
    132132      $Output .= '<tr><td colspan="3" style="text-align: center;">'.T('Generating duration').': '.
    133133    $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s &nbsp;&nbsp; '.T('Used memory').': '.
     
    137137      '</body>'.
    138138      '</html>';
    139     return($Output);
     139    return $Output;
    140140  }
    141141
     
    143143  {
    144144    $Output = $this->ShowHeader().$Content.$this->ShowFooter();
    145     if($this->System->Config['Web']['FormatOutput'])
     145    if ($this->System->Config['Web']['FormatOutput'])
    146146      $Output = $this->FormatOutput($Output);
    147     return($Output);
     147    return $Output;
    148148  }
    149149
     
    153153    $nn = 0;
    154154    $n = 0;
    155     while($s != '')
     155    while ($s != '')
    156156    {
    157157      $start = strpos($s, '<');
    158158      $end = strpos($s, '>');
    159       if($start != 0)
     159      if ($start != 0)
    160160      {
    161161        $end = $start - 1;
     
    163163      }
    164164      $line = trim(substr($s, $start, $end + 1));
    165       if(strlen($line) > 0)
    166         if($line[0] == '<')
     165      if (strlen($line) > 0)
     166        if ($line[0] == '<')
    167167        {
    168           if($s[$start + 1] == '/')
     168          if ($s[$start + 1] == '/')
    169169          {
    170170            $n = $n - 2;
     
    172172          } else
    173173          {
    174             if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
     174            if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
    175175            else $cmd = substr($line, 1, strlen($line) - 2);
    176176            //echo('['.$cmd.']');
    177             if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
     177            if (strpos($s, '</'.$cmd.'>')) $n = $n + 2;
    178178          }
    179179        }// else $line = '['.$line.']';
    180         //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
    181         if($nn < 0) $nn = 0;
    182         if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
     180        //if ($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
     181        if ($nn < 0) $nn = 0;
     182        if ($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
    183183        $s = substr($s, $end + 1, strlen($s));
    184184        $nn = $n;
    185185    }
    186     return($out);
     186    return $out;
    187187  }
    188188}
  • trunk/Modules/Admin/Admin.php

    r859 r880  
    5252      '<a href="'.$this->System->Link('/admin/?action=merge').'">Sjednocení textů</a><br/>'.
    5353      '<small>Sjednotí stejné originální texty v databázi</small><br/><br/>';
    54     return($Output);
     54    return $Output;
    5555  }
    5656
     
    7272  function ShowPHPInfo()
    7373  {
    74     return(phpinfo());
     74    return phpinfo();
    7575  }
    7676
     
    8686      '<a href="'.$this->System->Link('/admin/?action=sqlerror').'">Chybný SQL dotaz</a><br/>'.
    8787      '<small>Vyvolá testovací chybu</small><br/><br/>';
    88     return($Output);
     88    return $Output;
    8989  }
    9090
     
    103103    );
    104104    $Output = 'Questy: <br />';
    105     while($quest = $DbResult->fetch_assoc())
     105    while ($quest = $DbResult->fetch_assoc())
    106106    {
    107107      $Output .= $quest['ID'].', ';
     
    109109    }
    110110    $Output .= '<br / ><br / >Questy nastaveny jako nedokončené!';
    111     return($Output);
     111    return $Output;
    112112  }
    113113
     
    117117
    118118    $Output = '';
    119     foreach($TranslationTree as $Group)
     119    foreach ($TranslationTree as $Group)
    120120    // $Group = $TranslationTree[1];
    121121    {
     
    130130      $DbResult = $this->System->Database->query($sql);
    131131      echo ': <br />'.$Group['TablePrefix'].': <br />';
    132       while($line = $DbResult->fetch_assoc())
     132      while ($line = $DbResult->fetch_assoc())
    133133      {
    134134        echo ($line['ID'].', ');
     
    138138      echo '<br / >Verze '.$Group['TablePrefix'].' opraveny!';
    139139    }
    140     return('Hotovo!');
     140    return 'Hotovo!';
    141141  }
    142142
     
    145145    $Text = strtolower($Text);
    146146    $Text = str_replace(' ', '', $Text);
    147     return ($Text);
     147    return $Text;
    148148  }
    149149
     
    153153
    154154    $Output = '';
    155     foreach($TranslationTree as $Group)
     155    foreach ($TranslationTree as $Group)
    156156    //  $Group = $TranslationTree[1];
    157157    {
     
    164164      $DbResult = $this->System->Database->query($sql);
    165165      echo ': <br />'.$Group['TablePrefix'].': ';
    166       while($line = $DbResult->fetch_assoc())
     166      while ($line = $DbResult->fetch_assoc())
    167167      {
    168168        $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '.
     
    171171        //   echo $sql;
    172172        $DbResult2 = $this->System->Database->query($sql);
    173         if($DbResult2->num_rows > 0) {
     173        if ($DbResult2->num_rows > 0) {
    174174          $line2 = $DbResult2->fetch_assoc();
    175175
    176176          $Same = true;
    177           foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     177          foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    178178            if ($this->StripText($line[$Column['Column']]) <> $this->StripText($line2[$Column['Column']]))
    179179              $Same = false;
     
    186186                ' WHERE `T`.`Entry` = '.$line['Entry'].' AND (`T`.`Take` = '.$line['ID'].' OR `T`.`Take` = '.$line2['ID'].') ';
    187187            $DbResult3 = $this->System->Database->query($sql);
    188             while($line3 = $DbResult3->fetch_assoc()) {
     188            while ($line3 = $DbResult3->fetch_assoc()) {
    189189              echo $line3['ID'].' ';
    190190              $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].', `VersionStart` = '.$line['VersionStart'].', `Take` = '.$line['ID'].' WHERE ID='.$line3['ID']);
     
    199199      echo('Texty '.$Group['TablePrefix'].' sjednoceny!');
    200200    }
    201     return('Hotovo!');
     201    return 'Hotovo!';
    202202  }
    203203
     
    224224        $Group = $TranslationTree[$_GET['id']];
    225225        //  $Output .= '<form action="?action=dbcstructure&amp;id='.$Group['Id'].'">';
    226         //  foreach($Group['Items'] as $GroupItem)
     226        //  foreach ($Group['Items'] as $GroupItem)
    227227        //   {
    228228          //     $Output .= $GroupItem['Column'].': <input name="'.$GroupItem['Id'].'"><br />';
     
    236236          $Group['DBCFileName'].'.dbc.csv');
    237237
    238         //while(!$File->EOF())
     238        //while (!$File->EOF())
    239239
    240240        $Output .= '<table class="BaseTable">';
     
    248248        $Output .= '</td></tr><tr><td>';
    249249        for ($i = 0; $i < substr_count($Line, ','); $i++) {
    250           foreach($Group['Items'] as $GroupItem)
     250          foreach ($Group['Items'] as $GroupItem)
    251251            $Output .=   ' <a href="'.$this->System->Link('/admin/?action=dbcstructure&amp;id='.
    252252              $Group['Id'].'&amp;GroupItem='.$GroupItem['Id'].'&amp;ColumnIndex='.$i).'">'.
     
    269269      } else {
    270270        $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion`');
    271         while($Version = $DbResult->fetch_assoc())
     271        while ($Version = $DbResult->fetch_assoc())
    272272        {
    273273          $Output .= '<a href="'.$this->System->Link('/admin/?action=dbcstructure&amp;GameVersion='.
     
    276276        $Output .= '<br /><br />';
    277277
    278         foreach($TranslationTree as $Group)
     278        foreach ($TranslationTree as $Group)
    279279        {
    280280          if ($Group['DBCFileName'] <> '')
     
    283283        }
    284284      }
    285       return($Output);
     285      return $Output;
    286286  }
    287287
     
    291291    $Output = 'Překlad rozhraní přegenerován';
    292292    $Output .= '<table class="BaseTable"><tr><th>Originál</th><th>Překlad</th></tr>';
    293     foreach($this->System->LocaleManager->CurrentLocale->Texts->Data as $Index => $Item)
     293    foreach ($this->System->LocaleManager->CurrentLocale->Texts->Data as $Index => $Item)
    294294      $Output .= '<tr><td>'.$Index.'</td><td>'.$Item.'</td></tr>';
    295295    $Output .= '</table>';
    296296    $Output .= 'Překladové soubory zaktualizovány';
    297     return($Output);
     297    return $Output;
    298298  }
    299299
     
    302302    $this->Title = T('Administration');
    303303    $Output = '';
    304     if($this->System->User->Licence(LICENCE_ADMIN))
     304    if ($this->System->User->Licence(LICENCE_ADMIN))
    305305    {
    306       if(array_key_exists('action', $_GET))
     306      if (array_key_exists('action', $_GET))
    307307      {
    308         if($_GET['action'] == 'error') $Output .= $this->TestError(12, 'test');
    309         else if($_GET['action'] == 'exception') $Output .= $this->TestException(12, 'test');
    310         else if($_GET['action'] == 'sqlerror') $Output .= $this->TestSQLError('SELECT dads FROM sdas');
    311         else if($_GET['action'] == 'testing') $Output .= $this->Testing();
    312         else if($_GET['action'] == 'phpinfo') $Output .= $this->ShowPHPInfo();
    313         else if($_GET['action'] == 'locale') $Output .= $this->ShowLocale();
    314         else if($_GET['action'] == 'uncomplete') $Output .= $this->Uncomplete();
    315         else if($_GET['action'] == 'repairversion') $Output .= $this->RepairVersionEnd();
    316         else if($_GET['action'] == 'dbcstructure') $Output .= $this->DbcStructure();
    317         else if($_GET['action'] == 'merge') $Output .= $this->MergeSameText();
     308        if ($_GET['action'] == 'error') $Output .= $this->TestError(12, 'test');
     309        else if ($_GET['action'] == 'exception') $Output .= $this->TestException(12, 'test');
     310        else if ($_GET['action'] == 'sqlerror') $Output .= $this->TestSQLError('SELECT dads FROM sdas');
     311        else if ($_GET['action'] == 'testing') $Output .= $this->Testing();
     312        else if ($_GET['action'] == 'phpinfo') $Output .= $this->ShowPHPInfo();
     313        else if ($_GET['action'] == 'locale') $Output .= $this->ShowLocale();
     314        else if ($_GET['action'] == 'uncomplete') $Output .= $this->Uncomplete();
     315        else if ($_GET['action'] == 'repairversion') $Output .= $this->RepairVersionEnd();
     316        else if ($_GET['action'] == 'dbcstructure') $Output .= $this->DbcStructure();
     317        else if ($_GET['action'] == 'merge') $Output .= $this->MergeSameText();
    318318        else $Output .= $this->ShowMenu();
    319319      } else $Output .= $this->ShowMenu();
    320320    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    321     return($Output);
     321    return $Output;
    322322  }
    323323}
  • trunk/Modules/AoWoW/AoWoW.php

    r838 r880  
    2323      'Icon' => '',
    2424    ));
    25     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     25    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    2626      $this->System->ModuleManager->Modules['Search']->RegisterSearch('aowow',
    2727      T('AoWoW'), array(), '', $this->System->Link('/aowow/?search='));
  • trunk/Modules/ClientVersion/ClientVersion.php

    r843 r880  
    3131  function Show()
    3232  {
    33     if(array_key_exists('action', $_GET))
     33    if (array_key_exists('action', $_GET))
    3434    {
    35       if($_GET['action'] == 'item') $Output = $this->ShowItem();
     35      if ($_GET['action'] == 'item') $Output = $this->ShowItem();
    3636      else $Output = $this->ShowList();
    3737    } else $Output = $this->ShowList();
    38     return($Output);
     38    return $Output;
    3939  }
    4040
    4141  function ShowItem()
    4242  {
    43     if(array_key_exists('id', $_GET))
     43    if (array_key_exists('id', $_GET))
    4444    {
    4545      $YesNo = array('Ne', 'Ano');
    4646      $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.($_GET['id']*1));
    47       if($DbResult->num_rows > 0)
     47      if ($DbResult->num_rows > 0)
    4848      {
    4949        $Version = $DbResult->fetch_assoc();
     
    6060        '</table>';
    6161        $Output .= '<div><a href="?">'.T('All versions list').'</a></div>';
    62         if($Version['Imported'])
     62        if ($Version['Imported'])
    6363          $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='.
    6464            $Version['Version']).'">'.T('Progress').'</a></div>';
    6565      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    6666    } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    67     return($Output);
     67    return $Output;
    6868  }
    6969
     
    9292
    9393    $DbResult = $this->System->Database->query('SELECT * FROM ClientVersion '.$Order['SQL'].$PageList['SQLLimit']);
    94     while($Version = $DbResult->fetch_assoc())
     94    while ($Version = $DbResult->fetch_assoc())
    9595    {
    9696      $Output .= '<tr><td><a href="?action=item&amp;id='.$Version['Id'].'">'.
     
    101101    $Output .= '</table>'.
    102102      $PageList['Output'];
    103     return($Output);
     103    return $Output;
    104104  }
    105105}
  • trunk/Modules/Dictionary/Dictionary.php

    r861 r880  
    2525      'Icon' => '',
    2626    ), 1);
    27     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     27    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    2828      $this->System->ModuleManager->Modules['Search']->RegisterSearch('dictionary',
    2929      T('Dictionary'), array('Text', 'Description'),
     
    6565
    6666    // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
    67     foreach($buff as $Line)
     67    foreach ($buff as $Line)
    6868    {
    6969      if ($mode == 0)
     
    8383    }
    8484    $Output .= '</table>';
    85     return($Output);
     85    return $Output;
    8686  }
    8787
     
    8989  {
    9090    $Output = '';
    91     if($this->System->User->Licence(LICENCE_USER))
     91    if ($this->System->User->Licence(LICENCE_USER))
    9292    {
    9393      $Output .= '<form action="?action=save" method="post">'.
     
    103103        '</form>';
    104104    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    105     return($Output);
     105    return $Output;
    106106  }
    107107
    108108  function DictionarySave()
    109109  {
    110     if($this->System->User->Licence(LICENCE_USER))
    111     {
    112       if(array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))
     110    if ($this->System->User->Licence(LICENCE_USER))
     111    {
     112      if (array_key_exists('Original', $_POST) and array_key_exists('Translated', $_POST) and array_key_exists('Description', $_POST))
    113113      {
    114114        // Check if original text exists and determine entry id
    115115        $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '.
    116116          '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']);
    117         if($DbResult->num_rows > 0)
     117        if ($DbResult->num_rows > 0)
    118118        {
    119119          $DbRow = $DbResult->fetch_assoc();
     
    130130        $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '.
    131131          '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id);
    132         if($DbResult->num_rows > 0)
     132        if ($DbResult->num_rows > 0)
    133133        {
    134134          $DbRow = $DbResult->fetch_assoc();
     
    142142      } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL);
    143143    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    144     return($Output);
     144    return $Output;
    145145  }
    146146
    147147  function DictionaryRemove()
    148148  {
    149     if($this->System->User->Licence(LICENCE_USER))
     149    if ($this->System->User->Licence(LICENCE_USER))
    150150    {
    151151      $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')');
    152152      $Output = ShowMessage(T('Record removed'));
    153153    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    154     return($Output);
     154    return $Output;
    155155  }
    156156
    157157  function DictionaryModify()
    158158  {
    159     if($this->System->User->Licence(LICENCE_USER))
     159    if ($this->System->User->Licence(LICENCE_USER))
    160160    {
    161161      $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1));
    162       if($DbResult->num_rows > 0)
     162      if ($DbResult->num_rows > 0)
    163163      {
    164164        $DbRow = $DbResult->fetch_assoc();
     
    180180      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    181181    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    182     return($Output);
     182    return $Output;
    183183  }
    184184
     
    189189    $Output = '';
    190190    $GroupId = LoadGroupIdParameter();
    191     if(array_key_exists('mode', $_GET)) $mode = $_GET['mode'];
     191    if (array_key_exists('mode', $_GET)) $mode = $_GET['mode'];
    192192    else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated
    193193    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    194194
    195     if(array_key_exists('ID', $_GET))
     195    if (array_key_exists('ID', $_GET))
    196196    {
    197197      $TextID = $_GET['ID'];
     
    202202      $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID);
    203203      $Line = $DbResult->fetch_assoc();
    204       if(!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL);
     204      if (!$Line) $Output .= ShowMessage(T('Translation not found'), MESSAGE_CRITICAL);
    205205      else
    206206      {
    207207        $Text = '';
    208         foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     208        foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    209209          $Text .= ' '.$Line[$TextItem['Column']];
    210210        $Output .= $this->WriteTranslatNames($Text, $mode);
    211211      }
    212212    }
    213     return($Output);
     213    return $Output;
    214214  }
    215215
     
    221221      '<table style="width: 100%; height: 100%;">';
    222222
    223     if(array_key_exists('search', $_GET)) $Search = $_GET['search'];
     223    if (array_key_exists('search', $_GET)) $Search = $_GET['search'];
    224224      else $Search = '';
    225225
     
    227227      <input type="text" value="'.$Search.'" name="search" size="30" />
    228228      <input type="submit" value="'.T('Search').'" />';
    229     if($this->System->User->Licence(LICENCE_USER))
     229    if ($this->System->User->Licence(LICENCE_USER))
    230230      $Output .= ' <a href="?action=insert">'.T('Add word').'</a>';
    231231
     
    233233      '<tr><td>'.T('Language').': ';
    234234    $Lang = '<a href="?language=">'.T('All').'</a>';
    235     if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
     235    if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
    236236      else $Output .= $Lang;
    237     foreach($LanguageList as $Language)
    238       if($Language['Enabled'] == 1)
     237    foreach ($LanguageList as $Language)
     238      if ($Language['Enabled'] == 1)
    239239      {
    240240        $Lang = ' <a href="?language='.$Language['Id'].'">'.T($Language['Name']).'</a>';
    241         if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
     241        if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
    242242          else $Output .= $Lang;
    243243      }
     
    245245      '<tr><td>';
    246246
    247     if(!is_numeric($_SESSION['language'])) $LanguageFilter = '';
     247    if (!is_numeric($_SESSION['language'])) $LanguageFilter = '';
    248248      else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')';
    249249
    250     if($Search <> '')
     250    if ($Search <> '')
    251251    {
    252252      $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '.
     
    270270    $Output .= $PageList['Output'];
    271271
    272     if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
     272    if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
    273273      else $LanguageName = T('Translation');
    274274    $TableColumns = array(
     
    276276      array('Name' => 'Translated', 'Title' => T($LanguageName)),
    277277    );
    278     if(!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language'));
     278    if (!is_numeric($_SESSION['language'])) $TableColumns[] = array('Name' => 'LangName', 'Title' => T('Language'));
    279279    $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description'));
    280280    $TableColumns[] = array('Name' => 'UserName', 'Title' => T('Translator'));
    281     if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));
     281    if ($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('Action'));
    282282    $Order = GetOrderTableHeader($TableColumns, 'Original');
    283283    $Output .= '<table class="BaseTable">'.$Order['Output'];
     
    285285    $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit'];
    286286    $DbResult = $this->Database->query($sql_page);
    287     while($Line = $DbResult->fetch_assoc())
     287    while ($Line = $DbResult->fetch_assoc())
    288288    {
    289289      $Output .= '<tr>'.
    290290        '<td>'.htmlspecialchars($Line['Original']).'</td>'.
    291291        '<td><strong>'.htmlspecialchars($Line['Translated']).'</strong></td>';
    292       if(!is_numeric($_SESSION['language'])) $Output .= '<td>'.T($Line['LangName']).'</td>';
     292      if (!is_numeric($_SESSION['language'])) $Output .= '<td>'.T($Line['LangName']).'</td>';
    293293      $Output .= '<td>'.htmlspecialchars($Line['Description']).'</td>'.
    294294        '<td><a href="'.$this->System->Link('/user/?user='.$Line['UserId']).'">'.
    295295        $Line['UserName'].'</a></td>';
    296       if($this->System->User->Licence(LICENCE_USER))
    297       {
    298         if($Line['UserId'] == $this->System->User->Id)
     296      if ($this->System->User->Licence(LICENCE_USER))
     297      {
     298        if ($Line['UserId'] == $this->System->User->Id)
    299299          $Output .= '<td><a href="?action=remove&amp;id='.$Line['Id'].
    300300            '" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'.
     
    308308      '</td></tr>'.
    309309      '</table></form>';
    310     return($Output);
     310    return $Output;
    311311  }
    312312
     
    319319    $LanguageList = GetLanguageList();
    320320
    321     if(!isset($_SESSION['language']))
    322     {
    323       if($this->System->User->Licence(LICENCE_USER))
     321    if (!isset($_SESSION['language']))
     322    {
     323      if ($this->System->User->Licence(LICENCE_USER))
    324324      {
    325325        $_SESSION['language'] = $this->System->User->Language;
    326326      } else $_SESSION['language'] = '';
    327327    }
    328     if(array_key_exists('language', $_GET))
    329     {
    330       if($_GET['language'] == '') $_SESSION['language'] = '';
     328    if (array_key_exists('language', $_GET))
     329    {
     330      if ($_GET['language'] == '') $_SESSION['language'] = '';
    331331        else $_SESSION['language'] = $_GET['language'] * 1;
    332332    }
     
    335335
    336336    $ShowList = true;
    337     if(array_key_exists('action', $_GET))
    338     {
    339       if($_GET['action'] == 'group')
     337    if (array_key_exists('action', $_GET))
     338    {
     339      if ($_GET['action'] == 'group')
    340340      {
    341341        $Output .= $this->DictionaryGroup();
    342342        $ShowList = false;
    343343      }
    344       else if($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert();
    345       else if($_GET['action'] == 'save') $Output .= $this->DictionarySave();
    346       else if($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove();
    347       else if($_GET['action'] == 'modify') $Output .= $this->DictionaryModify();
     344      else if ($_GET['action'] == 'insert') $Output .= $this->DictionaryInsert();
     345      else if ($_GET['action'] == 'save') $Output .= $this->DictionarySave();
     346      else if ($_GET['action'] == 'remove') $Output .= $this->DictionaryRemove();
     347      else if ($_GET['action'] == 'modify') $Output .= $this->DictionaryModify();
    348348      else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL);
    349349    }
    350     if($ShowList == true) $Output .= $this->DictionaryShow();
    351     return($Output);
     350    if ($ShowList == true) $Output .= $this->DictionaryShow();
     351    return $Output;
    352352  }
    353353}
  • trunk/Modules/Download/Download.php

    r850 r880  
    7474  '<a href="'.$fileslink.'/DBCtoCSV.exe">DBCtoCSV</a> - '.T('tool for transform DBC files to CSV').'<br />'.
    7575  '<a href="'.$fileslink.'/ClientDBExtractor.exe">ClientDBExtractor.exe</a> - '.T('tool for exporting dbc files from game client').'<br />';
    76   return($Output);
     76  return $Output;
    7777  }
    7878
     
    144144      $PageList['Output'];
    145145
    146     return($Output);
     146    return $Output;
    147147  }
    148148
     
    154154    else $Output .= $this->ShowDownload();
    155155
    156     return($Output);
     156    return $Output;
    157157  }
    158158}
  • trunk/Modules/Error/Error.php

    r860 r880  
    2323  function DoStart()
    2424  {
    25     if(isset($this->System->Config['Web']['ShowPHPError']))
     25    if (isset($this->System->Config['Web']['ShowPHPError']))
    2626      $this->ErrorHandler->ShowError = $this->System->Config['Web']['ShowPHPError'];
    2727      else $this->ErrorHandler->ShowError = true;
     
    3636  function DoError($Error)
    3737  {
    38     foreach($this->OnError as $OnError)
     38    foreach ($this->OnError as $OnError)
    3939      call_user_func($OnError, $Error);
    4040  }
  • trunk/Modules/Export/CreateAddon.php

    r859 r880  
    1717    $string = str_replace('$r', '"..'.$strlower.'(UnitRace("player")).."', $string);
    1818    $Gender = '$G';
    19     while(strpos($string, $Gender) !== false)
     19    while (strpos($string, $Gender) !== false)
    2020    {
    2121      $Before = substr($string, 0, strpos($string, $Gender));
     
    3030    }
    3131    $Gender = '$g';
    32     while(strpos($string, $Gender) !== false)
     32    while (strpos($string, $Gender) !== false)
    3333    {
    3434      $Before = substr($string, 0, strpos($string, $Gender));
     
    4646    $string = str_replace("\r", '', $string);
    4747    $string = str_replace("\n", '\r\n', $string);
    48     return($string);
     48    return $string;
    4949  }
    5050
     
    6464    $string = str_replace('\\n', ' ', $string);
    6565    $string = str_replace(' ', '', $string);
    66 //    while(strpos($string, '  '))
     66//    while (strpos($string, '  '))
    6767//      $string = str_replace('  ', ' ', $string);
    68     return($string);
     68    return $string;
    6969  }
    7070
     
    7575    $string = str_replace('$b', '\r\n', $string);
    7676    $string = $this->ReplaceVarInText($string,'');
    77     return($string);
     77    return $string;
    7878  }
    7979
     
    8181  {
    8282    //echo (strpos($string,'<html>'));
    83     if (strpos($string,'<html>') > -1) return(false);
    84       else return(true);
     83    if (strpos($string,'<html>') > -1) return false;
     84      else return true;
    8585  }
    8686
     
    9898    $string = str_replace('\\\\124', '\\124',$string);
    9999
    100     return ($string);
     100    return $string;
    101101  }
    102102
     
    113113    $CreatedFileListCount = array();
    114114
    115     if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);
     115    if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);
    116116
    117117    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != ""');
    118     while($Group = $DbResult->fetch_assoc())
     118    while ($Group = $DbResult->fetch_assoc())
    119119    {
    120120    //získání čísla verze pro export
     
    126126      else $ExportVersion = '';
    127127
    128       foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
    129       if($Column['AddonFileName'] != '')
     128      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
     129      if ($Column['AddonFileName'] != '')
    130130      {
    131131        $this->AddProgress(1);
    132         if(!isset($CreatedFileListCount[$Column['AddonFileName']]))
     132        if (!isset($CreatedFileListCount[$Column['AddonFileName']]))
    133133        $CreatedFileListCount[$Column['AddonFileName']] = 0;
    134134        $CreatedFileListCount[$Column['AddonFileName']]++;
     
    149149        $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '.
    150150        ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY  `BuildNumber` DESC LIMIT 1');
    151         if($ID->num_rows > 0) {
     151        if ($ID->num_rows > 0) {
    152152          $ExportVersionOld = $ID->fetch_assoc();
    153153          $ExportVersionOld = $ExportVersionOld['BuildNumber'];
    154154
    155155          $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld));
    156           while($Line = $DbResult2->fetch_assoc())
     156          while ($Line = $DbResult2->fetch_assoc())
    157157          {
    158158            $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']]));
    159159            $cz = $this->ReplaceCzText($Line[$Column['Column']]);
    160             if(($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
     160            if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
    161161            {
    162162               $TableTexts[$en] = $cz;
     
    167167
    168168        $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion));
    169         while($Line = $DbResult2->fetch_assoc())
     169        while ($Line = $DbResult2->fetch_assoc())
    170170        {
    171171          $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']]));
    172172          $cz = $this->ReplaceCzText($Line[$Column['Column']]);
    173           if(($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
     173          if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
    174174          {
    175175             $TableTexts[$en] = $cz;
     
    177177        }
    178178
    179         foreach($TableTexts as $key => $value) {
     179        foreach ($TableTexts as $key => $value) {
    180180            $Buffer .= "\n".'["'.$key.'"]="'.$value.'",';
    181181            $i++;
     
    194194    $CountFiles = 'CountFiles.lua';
    195195    $Buffer = '';
    196     foreach($CreatedFileList as $CreatedFile)
     196    foreach ($CreatedFileList as $CreatedFile)
    197197      $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n";
    198     foreach($TranslationTree as $Group)
    199       foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
     198    foreach ($TranslationTree as $Group)
     199      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
    200200      if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList)))
    201201      {
     
    209209    $Buffer = '<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd">'."\n";
    210210    $Buffer .= '<script file="'.$CountFiles.'"/>'."\n";
    211     foreach($CreatedFileList as $CreatedFile)
     211    foreach ($CreatedFileList as $CreatedFile)
    212212      $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n";
    213213    $Buffer .= '</Ui>';
    214214    file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer);
    215     return($Output);
     215    return $Output;
    216216  }
    217217
     
    235235
    236236    $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated));
    237     while($Line = $DbResult->fetch_array())
     237    while ($Line = $DbResult->fetch_array())
    238238    {
    239239      $Original = $this->my_trim($Line['En'.$Column['Column']]);
    240240      $Translated = $this->my_trim($Line[$Column['Column']]);
    241       if($this->ClientVersion['Version'] == '2.4.3')
     241      if ($this->ClientVersion['Version'] == '2.4.3')
    242242      {
    243243        $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original);
     
    247247    }
    248248
    249     if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',0777, true);
     249    if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',0777, true);
    250250    file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer);
    251251  }
     
    253253  function MakeAddon()
    254254  {
    255     if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
     255    if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
    256256    $Output = $this->MakeLanguageFiles();
    257257    $Output .= $this->MakeClientStrings();
    258258    // $Output .= MakeMainScript($Setting);
    259     return($Output);
     259    return $Output;
    260260  }
    261261
     
    283283    ';
    284284    $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');
    285     while($Line = $DbResult->fetch_assoc())
     285    while ($Line = $DbResult->fetch_assoc())
    286286    {
    287287      $Buffer .='
  • trunk/Modules/Export/Export.php

    r879 r880  
    1717  {
    1818    $this->TempDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
    19     if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
     19    if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
    2020    $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
    2121    $this->SourceDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['SourceFolder'];
    2222    $this->SourceDirRelative = $this->System->Config['Web']['SourceFolder'];
    23     if(!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);
     23    if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);
    2424  }
    2525
     
    2929    if ($Export['AllUsers']) {
    3030      $DbResult2 = $this->System->Database->query('SELECT ID FROM `User` WHERE `ID` NOT IN(SELECT `User` FROM `ExportUser` WHERE `Export`='.$this->Id.')');
    31       while($UserLine = $DbResult2->fetch_assoc())
     31      while ($UserLine = $DbResult2->fetch_assoc())
    3232      {
    3333            $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID'];
    3434            $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence
    35             if($DbResult->num_rows > 0)
     35            if ($DbResult->num_rows > 0)
    3636            {
    3737            //  $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
     
    5050  {
    5151    $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
    52     if($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');
     52    if ($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');
    5353    $this->Export = $DbResult->fetch_assoc();
    5454
     
    5858      'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '.
    5959      'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`');
    60     while($UserLine = $DbResult->fetch_assoc())
     60    while ($UserLine = $DbResult->fetch_assoc())
    6161    {
    6262      $this->UserNames .= ', '.$UserLine['Name'];
     
    6464    $this->UserNames = substr($this->UserNames, 2);
    6565
    66     if($this->Export['ClientVersion'] != '')
     66    if ($this->Export['ClientVersion'] != '')
    6767    {
    6868      $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']);
     
    8282
    8383    $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id);
    84     while($GroupItem = $DbResultItem->fetch_assoc())
     84    while ($GroupItem = $DbResultItem->fetch_assoc())
    8585    {
    8686      $GroupItems[$GroupItem['GroupItem']] = 1;
     
    8888    // Build selected columns
    8989    $Columns = '';
    90     foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     90    foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    9191      if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
    9292    }
     
    104104    // Build columns for english texts
    105105    $OriginalColumns = '';
    106     foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     106    foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    107107      $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, ';
    108108      if (isset($GroupItems[$Column['Id']]))
     
    117117    '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)';
    118118
    119     return($Query);
     119    return $Query;
    120120  }
    121121
     
    129129    if (file_exists($file))
    130130      $date = date('Y-m-d H:i',(filemtime($file)));
    131     else return(true);
     131    else return true;
    132132  // echo $file;
    133133
     
    135135      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    136136    $result = false;
    137     while($Group = $DbResult->fetch_assoc())
     137    while ($Group = $DbResult->fetch_assoc())
    138138    {
    139139      $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'.
     
    149149        }
    150150    }
    151     return($result);
     151    return $result;
    152152  }
    153153
     
    172172    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
    173173      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    174     while($Group = $DbResult->fetch_assoc())
     174    while ($Group = $DbResult->fetch_assoc())
    175175    {
    176176      $Buffer .= $Group['TablePrefix'].', ';
     
    180180    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
    181181      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    182     while($Group = $DbResult->fetch_assoc())
    183     {
    184       if($Group['MangosTable'] != '')
     182    while ($Group = $DbResult->fetch_assoc())
     183    {
     184      if ($Group['MangosTable'] != '')
    185185      {
    186186        $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
    187187        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    188         if($DbResult2->num_rows > 0)
    189         while($Line = $DbResult2->fetch_array())
     188        if ($DbResult2->num_rows > 0)
     189        while ($Line = $DbResult2->fetch_array())
    190190        {
    191191          $Values = '';
    192           foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    193           if($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key
     192          foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     193          if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key
    194194          {
    195             if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
     195            if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
    196196            $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"';
    197197          }
     
    200200          // Get multicolumn index
    201201          $ColumnItems = explode(',', $Group['MangosTableIndex']);
    202           if(count($ColumnItems) > 1)
     202          if (count($ColumnItems) > 1)
    203203          {
    204204            $Where = 'CONCAT(';
    205             foreach($ColumnItems as $ColumnItem)
     205            foreach ($ColumnItems as $ColumnItem)
    206206              $Where .= '`'.$ColumnItem.'`, "_", ';
    207207            $Where = substr($Where, 0, -7).')';
     
    216216      }
    217217    }
    218     if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
    219     return($Buffer);
     218    if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
     219    return $Buffer;
    220220  }
    221221
     
    243243      'aowow_skill' => 'skillID',
    244244    );
    245     foreach($AoWoWTables as $AoWoWTable => $IndexColum)
     245    foreach ($AoWoWTables as $AoWoWTable => $IndexColum)
    246246    {
    247247      $Buffer .= '--'.$AoWoWTable.', ';
     
    249249      $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`';
    250250      $DbResult = $Database2->query($Query);
    251       while($Line = $DbResult->fetch_assoc())
     251      while ($Line = $DbResult->fetch_assoc())
    252252      {
    253253        $Ori_text = $Line['name'];
     
    259259        $Tran = $DbResult2->fetch_assoc();
    260260        //echo ($Line['name'].'='.$Tran['tran']);
    261         if($Tran['Tran'] == '')
     261        if ($Tran['Tran'] == '')
    262262        {
    263263          $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`,
     
    270270        }
    271271
    272         if($Tran['Tran'] <> '')
     272        if ($Tran['Tran'] <> '')
    273273          $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
    274274      }
     
    276276    }
    277277    */
    278     if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
    279     return($Buffer);
     278    if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
     279    return $Buffer;
    280280  }
    281281
     
    299299          if (false === strpos($String2,$varible)) {
    300300              //  echo $varible;
    301             return(false);
     301            return false;
    302302          }
    303303      }
    304304    }
    305     return (true);
     305    return true;
    306306  }
    307307
     
    324324      'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""');
    325325    $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n";
    326     while($Group = $DbResult->fetch_assoc())
     326    while ($Group = $DbResult->fetch_assoc())
    327327    {
    328328      $this->AddProgress(2);
    329329      $Output .= $Group['Name'].', ';
    330       if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))
     330      if (file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))
    331331      {
    332332        // Load string column index list
     
    335335        $ColumnIndexes = array();
    336336        $ColumnFormat = array();
    337         while($DbRow = $DbResult2->fetch_assoc())
     337        while ($DbRow = $DbResult2->fetch_assoc())
    338338        {
    339339          $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
     
    344344        $LookupTable = array();
    345345        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    346         while($DbRow = $DbResult2->fetch_assoc()) {
     346        while ($DbRow = $DbResult2->fetch_assoc()) {
    347347          //Export only if translate have same varible %
    348348          $CanExport = true;
    349           foreach($TranslationTree[$Group['Id']]['Items'] as $Column)  {
     349          foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)  {
    350350            $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]);
    351351            if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) {
     
    369369
    370370        // Create new DBC file
    371         if(!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true);
     371        if (!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true);
    372372        $NewDBCFile = new DBCFile();
    373373        $NewDBCFile->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat);
     
    381381        $RowCount = $SourceDBCFile->GetRecordCount();
    382382        $FieldCount = $SourceDBCFile->GetFieldCount();
    383         for($Row = 0; $Row < $RowCount; $Row++)
     383        for ($Row = 0; $Row < $RowCount; $Row++)
    384384        {
    385385          $Line = $SourceDBCFile->GetLine($Row);
     
    388388          $PrimaryKeyItem = '';
    389389          $ColumnItems = explode(',', $Group['DBCIndex']);
    390           if(count($ColumnItems) > 1)
     390          if (count($ColumnItems) > 1)
    391391          {
    392             foreach($ColumnItems as $ColumnItem)
     392            foreach ($ColumnItems as $ColumnItem)
    393393              $PrimaryKeyItem .= $Line[$ColumnItem].'_';
    394394            $PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1);
    395395          } else $PrimaryKeyItem = $Line[$Group['DBCIndex']];
    396396
    397           if(array_key_exists($PrimaryKeyItem, $LookupTable))
     397          if (array_key_exists($PrimaryKeyItem, $LookupTable))
    398398          {
    399399            // Replace text columns
    400400            $LookupTableItem = $LookupTable[$PrimaryKeyItem];
    401             foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     401            foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    402402            {
    403               if(array_key_exists($GroupItem['Id'], $ColumnIndexes))
     403              if (array_key_exists($GroupItem['Id'], $ColumnIndexes))
    404404                $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']];
    405405            }
     
    409409          // Show completion progress
    410410          $Progress = round($Row / $RowCount * 100);
    411           if($Progress != $OldProgress)
     411          if ($Progress != $OldProgress)
    412412          {
    413413            if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01);
     
    422422    }
    423423    $Output .= 'Hotovo <br />';
    424     return($Output);
     424    return $Output;
    425425  }
    426426
     
    432432
    433433    $Output = '';
    434     if(!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);
     434    if (!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);
    435435    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`LuaFileName` != ""');
    436     while($Group = $DbResult->fetch_assoc())
     436    while ($Group = $DbResult->fetch_assoc())
    437437    {
    438438      $this->AddProgress(1);
     
    448448      $LookupTable = array();
    449449      $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    450       while($DbRow = $DbResult2->fetch_assoc()) {
     450      while ($DbRow = $DbResult2->fetch_assoc()) {
    451451          $CanExport = true;
    452           foreach($TranslationTree[$Group['Id']]['Items'] as $Column)  {
     452          foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)  {
    453453          //  if (strpos($DbRow[$Column['Column']],'\\'))
    454454           //   $CanExport = false;
     
    502502      }
    503503
    504       while(!$File->EOF())
     504      while (!$File->EOF())
    505505      {
    506506        $Line = $File->ReadLine();
    507         if(strpos($Line, '=') !== false)
     507        if (strpos($Line, '=') !== false)
    508508        {
    509509          $LineParts = explode('=', $Line, 2);
     
    511511          $Line = trim($LineParts[1]);
    512512
    513           if($Line[0] == '"')
     513          if ($Line[0] == '"')
    514514          {
    515515            // Quoted string value
     
    532532          $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
    533533
    534           if(array_key_exists($Value['ShortCut'], $LookupTable))
     534          if (array_key_exists($Value['ShortCut'], $LookupTable))
    535535          {
    536536            $DbRow = $LookupTable[$Value['ShortCut']];
     
    548548          }
    549549          $NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";';
    550           //if($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];
     550          //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];
    551551          $NewLine .= "\r\n";
    552552          $File2->WriteLine($NewLine);
     
    555555      $Output .= 'Hotovo <br/>';
    556556    }
    557     return($Output);
     557    return $Output;
    558558  }
    559559
     
    656656    "    <author>".$this->System->User->Name."</author>\n".
    657657    "    <contributors>\n";
    658     foreach(explode(',', $this->UserNames) as $UserName)
     658    foreach (explode(',', $this->UserNames) as $UserName)
    659659      $Buffer .= "      <user>".$UserName."</user>\n";
    660660    $Buffer .=
     
    665665    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
    666666      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    667     while($Group = $DbResult->fetch_assoc())
    668     {
    669       if($Group['MangosTable'] == '')
     667    while ($Group = $DbResult->fetch_assoc())
     668    {
     669      if ($Group['MangosTable'] == '')
    670670      {
    671671        $Group['MangosTable'] = $Group['TablePrefix'];
     
    674674      $Buffer .= '    <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
    675675      $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    676       while($Line = $DbResult2->fetch_assoc())
     676      while ($Line = $DbResult2->fetch_assoc())
    677677      {
    678678        $Buffer .= '      <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n";
    679679        $Values = '';
    680         foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     680        foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    681681        {
    682           if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
    683           if($Line[$GroupItem['Column']] != '')
     682          if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
     683          if ($Line[$GroupItem['Column']] != '')
    684684          $Buffer .= '        <text index="'.$GroupItem['Id'].'" name="'.
    685685            $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n";
     
    689689      $Buffer .= "    </group>\n";
    690690    }
    691     if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
     691    if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
    692692    $Buffer .= "  </translation>\n".
    693693  "</document>";
    694     return($Buffer);
     694    return $Buffer;
    695695  }
    696696}
     
    732732      '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '.
    733733      '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id
    734     while($Task = $DbResult->fetch_assoc())
     734    while ($Task = $DbResult->fetch_assoc())
    735735    {
    736736      $Export = '<a href="'.$this->System->Link('/export/?Action=View&amp;ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>';
     
    744744      // Show estimated time to complete
    745745      $PrefixMultiplier = new PrefixMultiplier();
    746       if($Task['Progress'] > 0) {
     746      if ($Task['Progress'] > 0) {
    747747        $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']);
    748748        $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / ';
     
    752752      $Output .= '</div>';
    753753
    754       if($Task['Progress'] > 99)
     754      if ($Task['Progress'] > 99)
    755755        $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    756756        'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'.
    757757        '</script>';
    758758    }
    759     return($Output);
     759    return $Output;
    760760  }
    761761}
  • trunk/Modules/Export/ExportOutput.php

    r867 r880  
    1010{
    1111  $FileList = scandir($Path);
    12   foreach($FileList as $FileName)
    13   {
    14     if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
     12  foreach ($FileList as $FileName)
     13  {
     14    if (file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
    1515    {
    16       if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
     16      if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
    1717        else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName);
    1818    }
     
    2828  $Export->Id = $ExportId;
    2929  $Export->Init();
    30   if(function_exists('gzcompress'))
     30  if (function_exists('gzcompress'))
    3131  {
    3232    $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip';
     
    4545    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'.
    4646    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    47   return($Output);
     47  return $Output;
    4848}
    4949
     
    5858     htmlspecialchars($Export->ExportToAoWoWSQL()).
    5959    '</pre>';
    60   return($Output );
     60  return $Output ;
    6161}
    6262
     
    6969  $Export->Id = $ExportId;
    7070  $Export->Init();
    71   if(function_exists('gzcompress'))
     71  if (function_exists('gzcompress'))
    7272  {
    7373    $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip';
     
    8686    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'.
    8787    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    88   return($Output);
     88  return $Output;
    8989}
    9090
     
    9999    htmlspecialchars($Export->ExportToMangosSQL()).
    100100    '</pre>';
    101   return($Output);
     101  return $Output;
    102102}
    103103
     
    106106  global $System;
    107107
    108   if(function_exists('gzcompress'))
     108  if (function_exists('gzcompress'))
    109109  {
    110110    $Addon = new ExportAddon($System);
     
    135135    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    136136  $Output .= '<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.';
    137   return($Output);
     137  return $Output;
    138138}
    139139
     
    146146  $Export->Id = $ExportId;
    147147  $Export->Init();
    148   if(function_exists('gzcompress'))
     148  if (function_exists('gzcompress'))
    149149  {
    150150    $SaveFilename = $Export->TempDir.'CzWoW_XML.zip';
     
    163163    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'.
    164164    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    165   return($Output);
     165  return $Output;
    166166}
    167167
     
    176176    htmlspecialchars($Export->ExportToXML()).
    177177    '</pre>';
    178   return($Output);
     178  return $Output;
    179179}
    180180
     
    190190  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId.
    191191      ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))');
    192   if($DbResult->num_rows == 0)
    193   {
    194     if(array_key_exists('Regenerate', $_POST))
     192  if ($DbResult->num_rows == 0)
     193  {
     194    if (array_key_exists('Regenerate', $_POST))
    195195    {
    196196      $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0 , `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId);
     
    211211
    212212  $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId);
    213   if($DbResult->num_rows == 0)
     213  if ($DbResult->num_rows == 0)
    214214  {
    215215    $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeQueued` ) VALUES ('.$ExportId.', NOW())');
     
    220220  $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId);
    221221  $ExportTask = $DbResult->fetch_assoc();
    222   if($ExportTask['TimeFinish'] <> '')
     222  if ($ExportTask['TimeFinish'] <> '')
    223223  {
    224224    $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>';
    225225    $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`DBCFileName` != ""');
    226     while($Group = $DbResult->fetch_assoc())
     226    while ($Group = $DbResult->fetch_assoc())
    227227    {
    228       if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))
     228      if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))
    229229        $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>';
    230230    }
     
    233233
    234234  }
    235   return($Output);
     235  return $Output;
    236236}
    237237
     
    261261    'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '.
    262262    '(`TimeFinish` IS NULL) AND (`TimeQueued` < (NOW() - '.$Timeout.'))');
    263   if($DbResult->num_rows > 0)
     263  if ($DbResult->num_rows > 0)
    264264  {
    265265    $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR);
    266266  }
    267   return ($Output);
     267  return $Output;
    268268}
    269269
     
    281281  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId.
    282282    ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))');
    283   if($DbResult->num_rows == 0)
    284   {
    285     if(array_key_exists('Regenerate', $_POST))
     283  if ($DbResult->num_rows == 0)
     284  {
     285    if (array_key_exists('Regenerate', $_POST))
    286286    {
    287287      $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0, `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId);
     
    298298  // Start task for the first time if export task was not yet started
    299299  $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId);
    300   if($DbResult->num_rows == 0)
     300  if ($DbResult->num_rows == 0)
    301301  {
    302302    $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())');
     
    306306  $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId);
    307307  $ExportTask = $DbResult->fetch_assoc();
    308   if($ExportTask['TimeFinish'] <> '')
     308  if ($ExportTask['TimeFinish'] <> '')
    309309  {
    310310    $FileName = 'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe';
     
    313313    $Output .= ShowProgress($Export);
    314314  }
    315   return($Output);
     315  return $Output;
    316316}
    317317
     
    324324  $Export->Init();
    325325
    326   if(function_exists('gzcompress'))
     326  if (function_exists('gzcompress'))
    327327  {
    328328    $Output = 'Generování lua souborů...<br />';
     
    342342    'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />';
    343343  $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`LuaFileName` != ""');
    344   while($Group = $DbResult->fetch_assoc())
     344  while ($Group = $DbResult->fetch_assoc())
    345345  {
    346346    $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'lua/'.$Group['LuaFileName'].'.lua').'">'.$Group['LuaFileName'].'.lua</a><br/>';
    347347  }
    348348  $Output .= '<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky jako Data/enUS/patch-enUS-5.MPQ nebo Data/enUS/patch-enGB-5.MPQ. Pro starší verze hry než 3.2.0 je nutné spouštět hru pomocí programu WoWMe.exe (WoW Model Editor Fix).';
    349   return($Output);
     349  return $Output;
    350350}
    351351
    352352function ExportOutput($ExportId, $Type)
    353353{
    354   if($Type == 1) $Output = OutputMangosSQLToHTML($ExportId);
    355   else if($Type == 2) $Output = OutputMangosSQLToFile($ExportId);
    356   else if($Type == 3) $Output = OutputAoWoWToHTML($ExportId);
    357   else if($Type == 4) $Output = OutputAoWoWToFile($ExportId);
    358   else if($Type == 5) $Output = OutputXMLToHTML($ExportId);
    359   else if($Type == 6) $Output = OutputXMLToFile($ExportId);
    360   else if($Type == 7) $Output = OutputAddon($ExportId);
    361   else if($Type == 8) $Output = OutputLua($ExportId);
    362   else if($Type == 9) $Output = OutputDBCToFile($ExportId);
    363   else if($Type == 10) $Output = OutputEXEToFile($ExportId);
     354  if ($Type == 1) $Output = OutputMangosSQLToHTML($ExportId);
     355  else if ($Type == 2) $Output = OutputMangosSQLToFile($ExportId);
     356  else if ($Type == 3) $Output = OutputAoWoWToHTML($ExportId);
     357  else if ($Type == 4) $Output = OutputAoWoWToFile($ExportId);
     358  else if ($Type == 5) $Output = OutputXMLToHTML($ExportId);
     359  else if ($Type == 6) $Output = OutputXMLToFile($ExportId);
     360  else if ($Type == 7) $Output = OutputAddon($ExportId);
     361  else if ($Type == 8) $Output = OutputLua($ExportId);
     362  else if ($Type == 9) $Output = OutputDBCToFile($ExportId);
     363  else if ($Type == 10) $Output = OutputEXEToFile($ExportId);
    364364  else $Output = ShowMessage('Nebyl vybrán žádný formát výstupu.', MESSAGE_CRITICAL);
    365   return($Output);
    366 }
     365  return $Output;
     366}
  • trunk/Modules/Export/Page.php

    r864 r880  
    1717  {
    1818    $Output = '<a href="?Action=ViewList">'.T('All').'</a>';
    19     if($this->System->User->Licence(LICENCE_USER))
     19    if ($this->System->User->Licence(LICENCE_USER))
    2020    {
    2121      $Output .= ' <a href="?Action=ViewList&amp;Filter=Others">'.T('Others').'</a>'.
     
    2323    }
    2424
    25     if($this->System->User->Licence(LICENCE_USER))
     25    if ($this->System->User->Licence(LICENCE_USER))
    2626      $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>';
    2727
    2828    $Filter = '';
    29     if(array_key_exists('Filter', $_GET))
    30     {
    31       if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
    32       if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
     29    if (array_key_exists('Filter', $_GET))
     30    {
     31      if ($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
     32      if ($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
    3333    }
    3434
     
    6262      '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '.
    6363      'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
    64     while($Export = $DbResult->fetch_assoc())
     64    while ($Export = $DbResult->fetch_assoc())
    6565    {
    6666      $Action = '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=0">'.T('View').'</a> '.
    6767        '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=7">'.T('Make export').'</a>';
    68       if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';
    69       if($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
     68      if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';
     69      if ($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
    7070      $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
    7171          '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
     
    7979        $PageList['Output'];
    8080
    81     return($Output);
     81    return $Output;
    8282  }
    8383
    8484  function ExportCreate()
    8585  {
    86     if($this->System->User->Licence(LICENCE_USER))
     86    if ($this->System->User->Licence(LICENCE_USER))
    8787    {
    8888      $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    8989      $DbRow = $DbResult->fetch_row();
    90       if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     90      if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    9191      {
    9292        $Output = '<form action="?Action=CreateFinish" method="post">'.
     
    9898      } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);
    9999    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    100     return($Output);
     100    return $Output;
    101101  }
    102102
    103103  function ExportCreateFinish()
    104104  {
    105     if($this->System->User->Licence(LICENCE_USER))
    106     {
    107       if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
     105    if ($this->System->User->Licence(LICENCE_USER))
     106    {
     107      if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    108108      {
    109109        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    110110        $DbRow = $DbResult->fetch_row();
    111         if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     111        if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    112112        {
    113113          $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
     
    120120      } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL);
    121121    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    122     return($Output);
     122    return $Output;
    123123  }
    124124
    125125  function ExportDelete()
    126126  {
    127     if($this->System->User->Licence(LICENCE_USER))
     127    if ($this->System->User->Licence(LICENCE_USER))
    128128    {
    129129      $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')');
    130       if($DbResult->num_rows > 0)
     130      if ($DbResult->num_rows > 0)
    131131      {
    132132        $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);
     
    143143      } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    144144    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    145     return($Output);
     145    return $Output;
    146146  }
    147147
     
    163163    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    164164    $Export = $DbResult->fetch_assoc();
    165     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     165    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    166166    else $Editable = false;
    167167
    168     if(array_key_exists('Operation', $_POST))
    169     {
    170       if($_POST['Operation'] == 'Save')
     168    if (array_key_exists('Operation', $_POST))
     169    {
     170      if ($_POST['Operation'] == 'Save')
    171171      {
    172172        //print_r($_POST);
    173173        // Update user selection page
    174         foreach($_POST as $Index => $Value)
     174        foreach ($_POST as $Index => $Value)
    175175        {
    176           if(substr($Index, 0, 3) == 'seq')
     176          if (substr($Index, 0, 3) == 'seq')
    177177          {
    178178            $UserId = substr($Index, 3) * 1;
    179             if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
     179            if (array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
    180180            else $Selected = false;
    181181            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId;
    182182            $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
    183             if($DbResult->num_rows > 0)
     183            if ($DbResult->num_rows > 0)
    184184            {
    185               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
     185              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
    186186              else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
    187187            } else
    188188            {
    189               if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
     189              if ($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
    190190            }
    191191          }
     
    221221    );
    222222    $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
    223     if($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
     223    if ($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
    224224    else $InitialOrder = '';
    225225
     
    234234    $Output .= '<form name="Translators" action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    235235        '<h3>'.T('Translators').'</h3>';
    236     if($Editable)
     236    if ($Editable)
    237237    {
    238238      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    252252    $this->System->Database->query('SET @I = 0');
    253253    $DbResult = $this->System->Database->query($Query);
    254     while($UserLine = $DbResult->fetch_assoc())
     254    while ($UserLine = $DbResult->fetch_assoc())
    255255    {
    256256      $XP = GetLevelMinMax($UserLine['XP']);
     
    268268        '</form>'.
    269269        $PageList['Output'];
    270     return($Output);
     270    return $Output;
    271271  }
    272272
     
    278278    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    279279    $Export = $DbRows->fetch_assoc();
    280     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     280    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    281281    else $Editable = false;
    282282
    283     if(array_key_exists('Operation', $_POST))
    284       if($_POST['Operation'] == 'Save')  if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    285       {
    286         if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
     283    if (array_key_exists('Operation', $_POST))
     284      if ($_POST['Operation'] == 'Save')  if ($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
     285      {
     286        if (array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
    287287        else $WithDiacritic = 0;
    288288        if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1;
     
    296296      }
    297297
    298       if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
     298      if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
    299299      else $WithDiacritic = '';
    300300      $Output .= '<form action="?Action=View&amp;Tab=0&amp;ExportId='.$Export['Id'].'" method="post">'.
    301301          '<table>';
    302       if($this->System->User->Id != null)
     302      if ($this->System->User->Id != null)
    303303      {
    304304        $Output .= '<input type="hidden" name="Operation" value="Save"/>'.
    305305            '<tr><td colspan="2">';
    306         if($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';
     306        if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';
    307307        $Output .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> ';
    308         if($this->System->User->Licence(LICENCE_ADMIN))
     308        if ($this->System->User->Licence(LICENCE_ADMIN))
    309309          $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' ';
    310310        $Output .= '</td></tr>';
     
    314314          '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'.
    315315          '</table></form>';
    316       return($Output);
     316      return $Output;
    317317  }
    318318
     
    325325    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    326326    $Export = $DbRows->fetch_assoc();
    327     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     327    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    328328    else $Editable = false;
    329329
    330     if(array_key_exists('Operation', $_POST))
    331     {
    332       if($_POST['Operation'] == 'Save')
     330    if (array_key_exists('Operation', $_POST))
     331    {
     332      if ($_POST['Operation'] == 'Save')
    333333      {
    334334        //print_r($_POST);
    335335        // Update user selection page
    336         foreach($_POST as $Index => $Value)
     336        foreach ($_POST as $Index => $Value)
    337337        {
    338           if(substr($Index, 0, 3) == 'seq')
     338          if (substr($Index, 0, 3) == 'seq')
    339339          {
    340340            $LanguageId = substr($Index, 3) * 1;
    341             if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
     341            if (array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
    342342            else $Selected = false;
    343343            $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
    344344            $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
    345             if($DbResult->num_rows > 0)
     345            if ($DbResult->num_rows > 0)
    346346            {
    347               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
     347              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
    348348              else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
    349349            } else
    350350            {
    351               if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
     351              if ($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
    352352            }
    353353          }
     
    377377    $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    378378        '<h3>'.T('Languages').'</h3>';
    379     if($Editable)
     379    if ($Editable)
    380380    {
    381381      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    393393    $this->System->Database->query('SET @I = 0');
    394394    $DbResult = $this->System->Database->query($Query);
    395     while($Langugage = $DbResult->fetch_assoc())
     395    while ($Langugage = $DbResult->fetch_assoc())
    396396    {
    397397      $Checked = $Langugage['Sequence'] != '';
     
    405405        '</form>'.
    406406        $PageList['Output'];
    407     return($Output);
     407    return $Output;
    408408  }
    409409
     
    416416    $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
    417417    $Export = $DbRows->fetch_assoc();
    418     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     418    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    419419    else $Editable = false;
    420420
    421     if(array_key_exists('Operation', $_POST))
    422     {
    423       if($_POST['Operation'] == 'Save')
     421    if (array_key_exists('Operation', $_POST))
     422    {
     423      if ($_POST['Operation'] == 'Save')
    424424      {
    425425        //print_r($_POST);
    426426        // Update user selection page
    427         foreach($_POST as $Index => $Value)
     427        foreach ($_POST as $Index => $Value)
    428428        {
    429           if(substr($Index, 0, 3) == 'seq')
     429          if (substr($Index, 0, 3) == 'seq')
    430430          {
    431431            $GroupId = substr($Index, 3) * 1;
    432             if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
     432            if (array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
    433433            else $Selected = false;
    434434            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
    435435            $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
    436             if($DbResult->num_rows > 0)
     436            if ($DbResult->num_rows > 0)
    437437            {
    438               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
     438              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
    439439            } else
    440440            {
    441               if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
     441              if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
    442442            }
    443443          }
     
    446446      }
    447447      //items
    448       foreach($TranslationTree as $Group)
    449       {
    450         foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
    451           if(array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
     448      foreach ($TranslationTree as $Group)
     449      {
     450        foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
     451          if (array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
    452452          else $Selected = false;
    453453          //we will save only forbitten collums and need to be visible
     
    457457            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id'];
    458458            $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition);
    459             if($DbResult->num_rows > 0)
     459            if ($DbResult->num_rows > 0)
    460460            {
    461               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
     461              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
    462462            } else
    463463            {
    464               if($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
     464              if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
    465465            }
    466466
     
    486486    $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    487487        '<h3>'.T('Translation groups').'</h3>';
    488     if($Editable)
     488    if ($Editable)
    489489    {
    490490      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    500500
    501501    $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']);
    502     while($GroupItem = $DbResultItem->fetch_assoc())
     502    while ($GroupItem = $DbResultItem->fetch_assoc())
    503503    {
    504504      $GroupItems[$GroupItem['GroupItem']] = 1;
     
    507507    $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    508508    $DbResult = $this->System->Database->query($Query);
    509     while($Group = $DbResult->fetch_assoc())
     509    while ($Group = $DbResult->fetch_assoc())
    510510    {
    511511      $Columns = '';
    512       foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     512      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    513513        if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'],
    514514          !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>';
     
    533533      '</form>'.
    534534      $PageList['Output'];
    535     return($Output);
     535    return $Output;
    536536  }
    537537
     
    540540    $Output = '';
    541541    $DisabledInput = array(false => ' disabled="disabled"', true => '');
    542     if(array_key_exists('ExportId', $_GET))
     542    if (array_key_exists('ExportId', $_GET))
    543543    {
    544544      $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    545       if($DbRows->num_rows > 0)
     545      if ($DbRows->num_rows > 0)
    546546      {
    547547        $Export = $DbRows->fetch_assoc();
    548         if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     548        if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    549549        else $Editable = false;
    550550
    551         if(array_key_exists('Operation', $_POST))
    552           if($_POST['Operation'] == 'Save')
     551        if (array_key_exists('Operation', $_POST))
     552          if ($_POST['Operation'] == 'Save')
    553553          {
    554             if(array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
     554            if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
    555555            {
    556556              $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
     
    564564          $Output .= '<h3>'.T('Format the generated output').'</h3>'.
    565565              '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">';
    566           if($Editable)
     566          if ($Editable)
    567567          {
    568568            $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    571571          }
    572572          $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
    573           while($ExportFormat = $DbResult->fetch_assoc())
     573          while ($ExportFormat = $DbResult->fetch_assoc())
    574574          {
    575575            $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>';
     
    578578      } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    579579    } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL);
    580     return($Output);
     580    return $Output;
    581581  }
    582582
     
    587587    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    588588    $Export = $DbRows->fetch_assoc();
    589     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     589    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    590590    else $Editable = false;
    591591
    592     if(array_key_exists('Operation', $_POST))
    593       if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
     592    if (array_key_exists('Operation', $_POST))
     593      if (($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
    594594      {
    595595        $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
     
    600600      $Export = $DbResult->fetch_assoc();
    601601
    602       if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
     602      if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    603603      else {
    604604        $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '.
     
    620620            '<h3>'.T('Client version').'</h3>';
    621621
    622         if($Editable)
     622        if ($Editable)
    623623        {
    624624          $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    633633        $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    634634        $DbResult = $this->System->Database->query($Query);
    635         while($Version = $DbResult->fetch_assoc())
     635        while ($Version = $DbResult->fetch_assoc())
    636636        {
    637637          $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.$Version['Id']).'">'.
     
    646646            $PageList['Output'];
    647647      }
    648       return($Output);
     648      return $Output;
    649649  }
    650650
     
    654654    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    655655    $Export = $DbResult->fetch_assoc();
    656     if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    657     else if($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
     656    if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
     657    else if ($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
    658658    else {
    659659      $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
    660       if($DbResult->num_rows > 0)
     660      if ($DbResult->num_rows > 0)
    661661      {
    662662        $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');
    663         if($DbResult->num_rows > 0)
     663        if ($DbResult->num_rows > 0)
    664664        {
    665665          if (array_key_exists('Auto', $_GET) == false)
     
    669669      } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL);
    670670    }
    671     return($Output);
     671    return $Output;
    672672  }
    673673
     
    679679    $Export->LoadFilters();
    680680
    681     if(($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
     681    if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
    682682      $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
    683683    else {
     
    687687      $UnionItems = array();
    688688      $DbResult = $this->System->Database->query($GroupListQuery.$Where);
    689       while($DbRow = $DbResult->fetch_assoc())
     689      while ($DbRow = $DbResult->fetch_assoc())
    690690      {
    691691        $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    721721      $Translated = 0;
    722722      $Total = 0;
    723       if(count($UnionItems) > 0)
     723      if (count($UnionItems) > 0)
    724724      {
    725725        $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    726         while($Group = $ID->fetch_assoc())
     726        while ($Group = $ID->fetch_assoc())
    727727        {
    728728          $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';
     
    731731        }
    732732      }
    733       if($Total > 0) $Percent = $Translated / $Total * 100;
     733      if ($Total > 0) $Percent = $Translated / $Total * 100;
    734734      else $Percent = 100;
    735735
     
    737737      $Output .= '</table>';
    738738    }
    739     return($Output);
     739    return $Output;
    740740  }
    741741
     
    743743  {
    744744    $Output = '';
    745     if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
     745    if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    746746    {
    747747      $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    748       if($DbResult->num_rows > 0)
     748      if ($DbResult->num_rows > 0)
    749749      {
    750750        $Export = $DbResult->fetch_assoc();
     
    759759          T('Statistic'), T('Output')));
    760760        $Output .= '<div id="content">';
    761         if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
    762         else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
    763         else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
    764         else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
    765         else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
    766         else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
    767         else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
    768         else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
     761        if ($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
     762        else if ($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
     763        else if ($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
     764        else if ($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
     765        else if ($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
     766        else if ($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
     767        else if ($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
     768        else if ($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
    769769        else $Output .= $this->ExportViewGeneral();
    770770
     
    772772      } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    773773    } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL);
    774     return($Output);
     774    return $Output;
    775775  }
    776776
    777777  function ExportClone()
    778778  {
    779     if($this->System->User->Licence(LICENCE_USER))
    780     {
    781       if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
     779    if ($this->System->User->Licence(LICENCE_USER))
     780    {
     781      if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    782782      {
    783783        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    784784        $DbRow = $DbResult->fetch_row();
    785         if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     785        if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    786786        {
    787787          $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    788           if($DbResult->num_rows > 0)
     788          if ($DbResult->num_rows > 0)
    789789          {
    790790            $DbRow = $DbResult->fetch_assoc();
     
    810810      } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    811811    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    812     return($Output);
     812    return $Output;
    813813  }
    814814
     
    816816  {
    817817    $this->Title = T('Export');
    818     if(array_key_exists('Action', $_GET))
    819     {
    820       if($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
    821       else if($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
    822       else if($_GET['Action'] == 'View') $Output = $this->ExportView();
    823       else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
    824       else if($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
     818    if (array_key_exists('Action', $_GET))
     819    {
     820      if ($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
     821      else if ($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
     822      else if ($_GET['Action'] == 'View') $Output = $this->ExportView();
     823      else if ($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
     824      else if ($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
    825825      else $Output = $this->ExportList();
    826826    } else $Output = $this->ExportList();
    827     return($Output);
     827    return $Output;
    828828  }
    829829}
     
    839839  function Show()
    840840  {
    841     if(array_key_exists('i', $_GET))
     841    if (array_key_exists('i', $_GET))
    842842      $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1);
    843843      else $Output = 'Missing task id';
    844     return($Output);
     844    return $Output;
    845845  }
    846846}
  • trunk/Modules/Export/ProcessAoWoWExport.php

    r848 r880  
    1414$Output = '';
    1515
    16 if(defined('STDIN') == false)
     16if (defined('STDIN') == false)
    1717{
    1818  $Output = T('Access denied');
     
    2020}
    2121
    22 foreach($_SERVER['argv'] as $parameter)
     22foreach ($_SERVER['argv'] as $parameter)
    2323{
    24   if(strpos($parameter, '=') !== false)
     24  if (strpos($parameter, '=') !== false)
    2525  {
    2626    $index = substr($parameter, 0, strpos($parameter, '='));
     
    3333echo 'Generuji Export:';
    3434  $Export = new Export($System);
    35 if(!array_key_exists('AoWoWExportId', $Config)) {
     35if (!array_key_exists('AoWoWExportId', $Config)) {
    3636  $Export->Id = $Config['AoWoWExportId'];
    3737} else $Export->Id = 37;
     
    4545$UserSelection = array();
    4646$DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`');
    47 while($DbRow = $DbResult->fetch_assoc())
     47while ($DbRow = $DbResult->fetch_assoc())
    4848{
    4949  $UserSelection[$DbRow['ID']] = $DbRow['XP'];
     
    5353// Update export user selection sequence
    5454$Sequence = 1;
    55 foreach($UserSelection as $ID => $XP)
     55foreach ($UserSelection as $ID => $XP)
    5656{
    5757  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID);
    58   if($DbResult->num_rows > 0)
     58  if ($DbResult->num_rows > 0)
    5959    $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID;
    6060    else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')';
     
    7070$Database2->query('SET NAMES '.$Config['Database']['Charset']);
    7171$Database2->select_db($Config['Database']['DatabaseAoWoW']);
    72 foreach($SQL as $Line)
     72foreach ($SQL as $Line)
    7373{
    7474//echo '.';
    7575  //echo($Line."\n");
    76   if(trim($Line) != '') $Database2->query($Line);
     76  if (trim($Line) != '') $Database2->query($Line);
    7777}
    7878echo 'Hotovo
     
    8383// Delete temporary cache files
    8484$Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos');
    85 foreach($Files as $File)
     85foreach ($Files as $File)
    8686{
    8787  $End = substr($File, strlen($File) - 3);
    88   if($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
     88  if ($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
    8989}
    9090$Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead');
    91 foreach($Files as $File)
     91foreach ($Files as $File)
    9292{
    9393  $End = substr($File, strlen($File) - 3);
    94   if($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
     94  if ($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
    9595}
    9696echo 'Hotovo
  • trunk/Modules/Export/ProcessTask.php

    r869 r880  
    2323  function DeleteOldFiles($deldir)
    2424  {
    25     if(file_exists($deldir.'/'))
     25    if (file_exists($deldir.'/'))
    2626    {
    2727      $Dir = opendir($deldir.'/') ;
    28       while(($File = readdir($Dir)) !== false)
     28      while (($File = readdir($Dir)) !== false)
    2929      {
    30         if(($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);
     30        if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);
    3131      }
    3232      closedir($Dir);
     
    5656  function MPQPack($packdir)
    5757  {
    58     if(file_exists($packdir.DIRECTORY_SEPARATOR))
     58    if (file_exists($packdir.DIRECTORY_SEPARATOR))
    5959    {
    6060      $Dir = opendir($packdir.DIRECTORY_SEPARATOR);
    61       while(($File = readdir($Dir)) !== false)
     61      while (($File = readdir($Dir)) !== false)
    6262      {
    63         if(($File != '..') and ($File != '.')) {
     63        if (($File != '..') and ($File != '.')) {
    6464          $File = str_replace('/', DIRECTORY_SEPARATOR, $File);
    6565          $InDir = '';
     
    109109    // Delete old files
    110110    $this->DeleteOldFiles($Export->TempDir.'dbc');
    111     if(file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip');
     111    if (file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip');
    112112
    113113    $this->SetProgress(20);
    114     if(function_exists('gzcompress'))
     114    if (function_exists('gzcompress'))
    115115    {
    116116      $Export->ExportToDBC();
     
    185185    global $Config;
    186186
    187     while(1)
     187    while (1)
    188188    {
    189189      $DbResult = $this->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, '.
     
    191191        'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '.
    192192        '(`ExportTask`.`TimeFinish` IS NULL) ORDER BY `TimeQueued`');
    193       while($Task = $DbResult->fetch_assoc())
     193      while ($Task = $DbResult->fetch_assoc())
    194194      {
    195195        $this->Id = $Task['Id'];
    196         if($Task['ExportId'] != '')
     196        if ($Task['ExportId'] != '')
    197197        {
    198198          try
     
    201201            $this->Database->update('ExportTask', '`Id`='.$this->Id, array('TimeStart' => 'NOW()'));
    202202
    203             if($Task['ExportOutput'] == 9)
     203            if ($Task['ExportOutput'] == 9)
    204204            {
    205205              $this->ExportDBC($Task);
    206206            } else
    207             if($Task['ExportOutput'] == 10)
     207            if ($Task['ExportOutput'] == 10)
    208208            {
    209209              $this->ExportEXE($Task);
  • trunk/Modules/Export/cmdmpqexport.php

    r867 r880  
    1717$Output = '';
    1818
    19 if(defined('STDIN') == false)
     19if (defined('STDIN') == false)
    2020{
    2121  $Output = T('Access denied');
     
    2323}
    2424
    25 foreach($_SERVER['argv'] as $parameter)
     25foreach ($_SERVER['argv'] as $parameter)
    2626{
    27   if(strpos($parameter, '=') !== false)
     27  if (strpos($parameter, '=') !== false)
    2828  {
    2929    $index = substr($parameter, 0, strpos($parameter, '='));
     
    3333  } else $_GET[$parameter] = '';
    3434}
    35 if(!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
     35if (!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
    3636  $Output .= 'Usage type_export=id_export -for export<br />';
    3737  $Output .= 'Usage ExportId=id_export - for write export info<br />';
     
    4343}
    4444                     //37
    45 if(array_key_exists('lua', $_GET)) {
     45if (array_key_exists('lua', $_GET)) {
    4646  $Export = new Export($System);
    4747  $Export->Id = $_GET['lua'];
     
    5353',$Output);
    5454}
    55 if(array_key_exists('version', $_GET)) {
     55if (array_key_exists('version', $_GET)) {
    5656  $Export = new Export($System);
    5757  $Export->Id = $_GET['version'];
     
    6363',$Output);
    6464}
    65 if(array_key_exists('dbc', $_GET)) {
     65if (array_key_exists('dbc', $_GET)) {
    6666  $Export = new Export($System);
    6767  $Export->Id = $_GET['dbc'];
     
    7373',$Output);
    7474}
    75 if(array_key_exists('addon', $_GET)) {
     75if (array_key_exists('addon', $_GET)) {
    7676    $Addon = new ExportAddon($System);
    7777    $Addon->Id = $_GET['addon'];
     
    8484}
    8585
    86 if(array_key_exists('needgeneration', $_GET)) {
     86if (array_key_exists('needgeneration', $_GET)) {
    8787  $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '.
    8888    '`Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,'.
     
    9696  if ($Export->NeedGeneration()) {
    9797    $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$Export->Id);
    98     if($DbResult->num_rows == 0)
     98    if ($DbResult->num_rows == 0)
    9999    {
    100100      $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())');
     
    114114}
    115115
    116 if(array_key_exists('ExportId', $_GET)) {
     116if (array_key_exists('ExportId', $_GET)) {
    117117  $Export = new Export($System);
    118118  $Export->Id = $_GET['ExportId'];
  • trunk/Modules/Forum/Forum.php

    r854 r880  
    2121      'Permission' => LICENCE_ANONYMOUS));
    2222
    23     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     23    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    2424      $this->System->ModuleManager->Modules['Search']->RegisterSearch('forum',
    2525      T('Forum'), array('UserName', 'Text'), '`ForumText`', $this->System->Link('/forum/?search='));
    26     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     26    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    2727      $this->System->ModuleManager->Modules['Search']->RegisterSearch('forumthread',
    2828      T('Name of thread forum'), array('UserName', 'Text'), '`ForumThread`',
     
    5353    $DbResult = $this->Database->query($Query);
    5454    $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('User').'</th><th>'.T('Post').'</th></tr>';
    55     while($DbRow = $DbResult->fetch_assoc())
     55    while ($DbRow = $DbResult->fetch_assoc())
    5656    {
    5757      $Output .= '<tr>'.
     
    6262    }
    6363    $Output .= '</table></div>';
    64     return($Output);
     64    return $Output;
    6565  }
    6666}
     
    7272    $Output = '';
    7373    $this->Title = T('Forum');
    74     if(array_key_exists('a', $_POST)) $Action = $_POST['a'];
    75       else if(array_key_exists('a', $_GET)) $Action = $_GET['a'];
     74    if (array_key_exists('a', $_POST)) $Action = $_POST['a'];
     75      else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];
    7676       else $Action = '';
    7777    if (array_key_exists('Edit', $_GET)) {
     
    8686    if (array_key_exists('Thread', $_GET)) {
    8787      $Output .= '<h3>'.T('Forum - Thread').'</h3>';
    88       if($Action == 'add2') $Output .= $this->AddFinish();
    89       if($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm();
     88      if ($Action == 'add2') $Output .= $this->AddFinish();
     89      if ($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddForm();
    9090      $Output .= $this->ShowList();
    9191    } else {
    9292      $Output .= '<h3>'.T('Forum - List of Thread').'</h3>';
    93       if($Action == 'add2') $Output .= $this->AddFinish('ForumThread');
    94       if($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread();
     93      if ($Action == 'add2') $Output .= $this->AddFinish('ForumThread');
     94      if ($this->System->User->Licence(LICENCE_USER)) $Output .= $this->ShowAddFormThread();
    9595      $Output .= $this->ShowListThread();
    9696    }
    97     return($Output);
     97    return $Output;
    9898  }
    9999
     
    104104    $DbResult = $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']);
    105105    $Output .= ShowMessage(T('Text edited.'));
    106     return ($Output);
     106    return $Output;
    107107  }
    108108
     
    110110  {
    111111    $Output = '';
    112     if($this->System->User->Licence(LICENCE_USER))
     112    if ($this->System->User->Licence(LICENCE_USER))
    113113    {
    114114      $DbResult = $this->System->Database->query('SELECT * FROM `ForumText`  WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']);
     
    118118            '<fieldset><legend>'.T('Edit message').'</legend>'.
    119119            T('User').': ';
    120         if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     120        if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
    121121          else $Output .= '<input type="text" name="user" /><br />';
    122122        $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'.
     
    127127      } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);
    128128    }   else $Output .= ShowMessage(T('You can edit only your own message.'), MESSAGE_CRITICAL);
    129     return($Output);
     129    return $Output;
    130130  }
    131131
     
    150150    $DbResult = $this->System->Database->query('SELECT `ForumText`.`Text`, `ForumText`.`Date`, `ForumText`.`UserName`,'.
    151151    '`ForumThread`.`Text` as `ThreadName`,`ForumText`.`Thread` FROM `ForumText` '.$join.' WHERE '.$where.' ORDER BY `ForumText`.`Date` DESC '.$PageList['SQLLimit']);
    152     while($Line = $DbResult->fetch_assoc())
     152    while ($Line = $DbResult->fetch_assoc())
    153153      $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.
    154154      htmlspecialchars($Line['ThreadName']).'</a><br /><strong>'.$Line['UserName'].
    155155      '</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> ';
    156156    $Output .= '</div>'.$PageList['Output'];
    157     return($Output);
     157    return $Output;
    158158  }
    159159
     
    169169    $Output .= '<div class="shoutbox">';
    170170    $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE 1 ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    171     while($Line = $DbResult->fetch_assoc())
     171    while ($Line = $DbResult->fetch_assoc())
    172172      $Output .= '<div><span style="float:right;"><strong>'.$Line['UserName'].
    173173    '</strong> - ('.HumanDate($Line['Date']).')</span> <a href="?Thread='.$Line['ID'].'">'.
    174174    str_replace("\n", '', htmlspecialchars($Line['Text'])).'</a></div>';
    175175    $Output .= '</div>'.$PageList['Output'];
    176     return($Output);
     176    return $Output;
    177177  }
    178178
     
    183183    $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email')));
    184184
    185     if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
    186     else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
    187     if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
    188     if($_SESSION['search'] != '')
     185    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
     186    else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
     187    if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
     188    if ($_SESSION['search'] != '')
    189189    {
    190190      $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")';
     
    193193
    194194    $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1');
    195     if($DbResult->num_rows > 0)
     195    if ($DbResult->num_rows > 0)
    196196    {
    197197    $Thread = $DbResult->fetch_assoc();
     
    206206    $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '.
    207207      ($_GET['Thread']*1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    208     while($Line = $DbResult->fetch_assoc()) {
     208    while ($Line = $DbResult->fetch_assoc()) {
    209209      if ($this->System->User->Id == $Line['User'])
    210210        $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>';
     
    216216    $Output .= '</div>'.$PageList['Output'];
    217217    } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    218     return($Output);
     218    return $Output;
    219219  }
    220220
     
    222222  {
    223223    $Output = '';
    224     if($this->System->User->Licence(LICENCE_USER))
     224    if ($this->System->User->Licence(LICENCE_USER))
    225225    {
    226226      $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'.
    227227        '<fieldset><legend>'.T('New Forum Message').'</legend>'.
    228228        T('User').': ';
    229       if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     229      if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
    230230        else $Output .= '<input type="text" name="user" /><br />';
    231231      $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'.
     
    235235        '</form>';
    236236    } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);
    237     return($Output);
     237    return $Output;
    238238  }
    239239
     
    241241  {
    242242    $Output = '';
    243     if($this->System->User->Licence(LICENCE_USER))
     243    if ($this->System->User->Licence(LICENCE_USER))
    244244    {
    245245        $Output .= '<form action="?" method="post">'.
    246246            '<fieldset><legend>'.T('New thread').'</legend>'.
    247247            T('User').': ';
    248         if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     248        if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
    249249        else $Output .= '<input type="text" name="user" /><br />';
    250250      $Output .= T('Name of thread').': <br />'.
     
    254254      '</form>';
    255255    } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);
    256     return($Output);
     256    return $Output;
    257257  }
    258258
     
    260260  {
    261261    $Output = '';
    262     if($this->System->User->Licence(LICENCE_USER))
    263     {
    264       if(array_key_exists('text', $_POST))
     262    if ($this->System->User->Licence(LICENCE_USER))
     263    {
     264      if (array_key_exists('text', $_POST))
    265265      {
    266266        $Text = $_POST['text'];
    267         if(trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);
     267        if (trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);
    268268        else
    269269        {
     
    273273          $DbResult = $this->System->Database->query('SELECT `Text` FROM `'.$Table.'` WHERE 1 '.$Thread.' AND (`User` = "'.
    274274              $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1');
    275           if($DbResult->num_rows > 0)
     275          if ($DbResult->num_rows > 0)
    276276          {
    277277            $DbRow = $DbResult->fetch_assoc();
    278278          } else $DbRow['Text'] = '';
    279279
    280           if($DbRow['Text'] == $Text) $Output .= ShowMessage(T('You can\' add same message twice.'), MESSAGE_WARNING);
     280          if ($DbRow['Text'] == $Text) $Output .= ShowMessage(T('You can\' add same message twice.'), MESSAGE_WARNING);
    281281          else
    282282          {
     
    284284
    285285              $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1');
    286               if($DbResult->num_rows > 0)
     286              if ($DbResult->num_rows > 0)
    287287              {
    288288                $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP` , `Thread` ) '.
     
    300300      $Output .= '<br/>';
    301301    } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);
    302     return($Output);
     302    return $Output;
    303303  }
    304304
     
    313313      '`User`, `UserName`, `Text`, ( SELECT `Text` FROM `ForumThread` '.
    314314      'WHERE `ID` = `ForumText`.`Thread`) AS `ThreadText` FROM `ForumText` ORDER BY `ID` DESC LIMIT 20');
    315     while($DbRow = $DbResult->fetch_assoc())
     315    while ($DbRow = $DbResult->fetch_assoc())
    316316    {
    317317      $Title = mb_substr($DbRow['Text'], 0, $TitleLength);
    318       if(mb_strlen($Title) == $TitleLength) $Title .= '...';
     318      if (mb_strlen($Title) == $TitleLength) $Title .= '...';
    319319      $Items[] = array
    320320      (
     
    333333      'Items' => $Items,
    334334    ));
    335     return($Output);
     335    return $Output;
    336336  }
    337337}
  • trunk/Modules/FrontPage/FrontPage.php

    r854 r880  
    3131    global $Message, $MessageType;
    3232
    33     if(array_key_exists('action', $_GET))
     33    if (array_key_exists('action', $_GET))
    3434    {
    35       if($_GET['action'] == 'login')
     35      if ($_GET['action'] == 'login')
    3636      {
    37         if(array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST))
     37        if (array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST))
    3838        {
    39           if(array_key_exists('StayLogged', $_POST)) $StayLogged = true;
     39          if (array_key_exists('StayLogged', $_POST)) $StayLogged = true;
    4040            else $StayLogged = false;
    4141          $this->System->User->Login($_POST['LoginUser'], $_POST['LoginPass'], $StayLogged);
    42           if($this->System->User->Role == LICENCE_ANONYMOUS)
     42          if ($this->System->User->Role == LICENCE_ANONYMOUS)
    4343          {
    4444            $Message = T('Incorrect name or password');
     
    5555        }
    5656      } else
    57         if($_GET['action'] == 'logout')
     57        if ($_GET['action'] == 'logout')
    5858        {
    59           if($this->System->User->Role != LICENCE_ANONYMOUS)
     59          if ($this->System->User->Role != LICENCE_ANONYMOUS)
    6060          {
    6161            $this->System->ModuleManager->Modules['Log']->WriteLog('Odhlášení', LOG_TYPE_USER);
     
    7878    $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm();
    7979    $Output = '';
    80     if(isset($Message)) $Output .= ShowMessage($Message, $MessageType);
     80    if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);
    8181
    8282    $Output .= ''.
     
    9090      '<div class="box-left">'.$this->System->ModuleManager->Modules['Forum']->ShowBox().'</div>'.
    9191      '<div class="box-right">'.$this->System->ModuleManager->Modules['Translation']->ShowBox().'</div>';
    92      return($Output);
     92     return $Output;
    9393  }
    9494
     
    9696  {
    9797    // Cookies have to be used before any text is sent to output
    98     if(!array_key_exists('HideWelcome', $_COOKIE)) $_COOKIE['HideWelcome'] = 0;
    99     if(isset($_GET['Action']))
     98    if (!array_key_exists('HideWelcome', $_COOKIE)) $_COOKIE['HideWelcome'] = 0;
     99    if (isset($_GET['Action']))
    100100    {
    101       if($_GET['Action'] == 'HideWelcome')
     101      if ($_GET['Action'] == 'HideWelcome')
    102102      {
    103103        $_COOKIE['HideWelcome'] = 1;
    104104        setcookie('HideWelcome', $_COOKIE['HideWelcome'], time() + 3600 * 24 * 365);
    105105      }
    106       if($_GET['Action'] == 'UnHideWelcome')
     106      if ($_GET['Action'] == 'UnHideWelcome')
    107107      {
    108108        $_COOKIE['HideWelcome'] = 0;
     
    111111    }
    112112
    113     if(isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1))
     113    if (isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1))
    114114    {
    115115      $Action = '<a href="?Action=UnHideWelcome">'.T('Show welcome').'</a>';
     
    122122
    123123    // Echo text even if it is hidden because of caching by external searching engines
    124     return('<div style="'.$HideWelcome.'">'.
     124    return '<div style="'.$HideWelcome.'">'.
    125125      '<div id="bannertitle">'.$this->System->Config['Web']['Title'].'</div>'.
    126126      T('Open web system for translation texts from game World of Warcraft (WoW).<br/>'.
     
    133133      '<li>Thanks for sophisticated system of selectable exports you can download any part of translation, even just quests. And so exclude translation of items, creatures and others.</li>'.
    134134      '<li>Texts can be translated to multiple languages, e.g. Czech and Slovak.</li>'.
    135       '</ul>').'</div>'.$Action);
     135      '</ul>').'</div>'.$Action;
    136136  }
    137137}
  • trunk/Modules/Import/Import.php

    r859 r880  
    4949    $Columns = '';
    5050    //$Values = '';
    51     foreach($this->Group['Items'] as $GroupItem)
     51    foreach ($this->Group['Items'] as $GroupItem)
    5252    {
    5353      $Columns .= ', `'.$GroupItem['Column'].'` ';
     
    6161    $DbResultAfter  = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionStart` LIMIT 1');
    6262
    63     if(($DbResultMiddle->num_rows > 0) or ($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0))
     63    if (($DbResultMiddle->num_rows > 0) or ($DbResultBefore->num_rows > 0) or ($DbResultAfter->num_rows > 0))
    6464    {
    6565      // Update existed text
     
    6868      $DbRowBefore = $DbResultBefore->fetch_assoc();
    6969
    70       if($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) )
     70      if ($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) )
    7171      {
    7272          $insert = false;
     
    7878
    7979      } else
    80       if($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0))
     80      if ($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0))
    8181      {
    8282          $insert = false;
     
    104104
    105105            //if [DEPRECATED] do not import
    106         foreach($this->Group['Items'] as $GroupItem) {
     106        foreach ($this->Group['Items'] as $GroupItem) {
    107107          if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED')) {
    108108            echo('d '.$DbRowBefore['Entry'].' ');
     
    113113        if ($insert) {
    114114          $insert = false;
    115           foreach($this->Group['Items'] as $GroupItem)
     115          foreach ($this->Group['Items'] as $GroupItem)
    116116          {
    117117            if ($Value[$GroupItem['Column']] <> '') $insert = true;
     
    128128          $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
    129129          $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
    130           foreach($this->Group['Items'] as $GroupItem)
     130          foreach ($this->Group['Items'] as $GroupItem)
    131131          {
    132132            $Columns .= ', `'.$GroupItem['Column'].'`';
     
    150150    {
    151151      // Insert new text
    152       if(is_numeric($Value[$this->Group['PrimaryKeyItem']])) $Value['Entry'] = $Value[$this->Group['PrimaryKeyItem']];
     152      if (is_numeric($Value[$this->Group['PrimaryKeyItem']])) $Value['Entry'] = $Value[$this->Group['PrimaryKeyItem']];
    153153      else
    154154      {
     
    156156        $Value['Entry'] = 1;
    157157        $DbResult = $this->System->Database->query('SELECT MAX(`Entry`) FROM `'.$this->Group['TablePrefix'].'`');
    158         if($DbResult->num_rows > 0)
     158        if ($DbResult->num_rows > 0)
    159159        {
    160160          $DbRow = $DbResult->fetch_row();
     
    165165      $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
    166166      $insert = false;
    167       foreach($this->Group['Items'] as $GroupItem)
     167      foreach ($this->Group['Items'] as $GroupItem)
    168168      {
    169169        $Columns .= ', `'.$GroupItem['Column'].'`';
     
    188188    $Output = 'Načítání textů z LUA souboru...';
    189189
    190     if(($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != ''))
     190    if (($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != ''))
    191191    {
    192192
    193193        $Output .= '<br />'.$this->Group['Name'].'<br />';
    194       //  if($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)
     194      //  if ($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)
    195195        {
    196196          $File = new FileStream();
     
    199199          $this->NewItemCount = 0;
    200200          $Count = 0;
    201           while(!$File->EOF())
     201          while (!$File->EOF())
    202202          {
    203203            $Line = $File->ReadLine();
    204             if(strpos($Line, '=') !== false)
     204            if (strpos($Line, '=') !== false)
    205205            {
    206206              $LineParts = explode('=', $Line, 2);
    207207              $Value['ShortCut'] = trim($LineParts[0]);
    208208              $Line = trim($LineParts[1]);
    209               if($Line[0] == '"')
     209              if ($Line[0] == '"')
    210210              {
    211211                // Quoted string value
     
    234234      } else $Output .= ShowMessage('Není definováno jméno zdrojového souboru', MESSAGE_CRITICAL);
    235235    $Output .= ShowMessage('Dokončeno.');
    236     return ($Output);
     236    return $Output;
    237237  }
    238238
     
    243243    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    244244    $Output = '<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />';
    245     foreach($TranslationTree as $Group)
     245    foreach ($TranslationTree as $Group)
    246246    {
    247247      $Output .= '<br />'.$Group['Name'].' ';
    248248      $do = true;
    249       while($do)
     249      while ($do)
    250250      {
    251251      $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '.
     
    258258        '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`');
    259259        $do = ($DbResult->num_rows > 0);
    260         while($DbRow = $DbResult->fetch_assoc())
     260        while ($DbRow = $DbResult->fetch_assoc())
    261261        {
    262262          echo('`');
     
    267267      $Output .= '<strong>Dokončeno.</strong>';
    268268    }
    269     return($Output);
     269    return $Output;
    270270  }
    271271
     
    273273  {
    274274    $result = true;
    275     foreach($Group['Items'] as $GroupItem)
     275    foreach ($Group['Items'] as $GroupItem)
    276276    {
    277277      $old = $DbRow2[$GroupItem['Column']];
     
    324324        }
    325325
    326       if(($old == 'null') or ($old == 'NULL')) $old = '';
    327       if(($new == 'null') or ($new == 'NULL')) $new = '';
    328 
    329       if(($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment'))
     326      if (($old == 'null') or ($old == 'NULL')) $old = '';
     327      if (($new == 'null') or ($new == 'NULL')) $new = '';
     328
     329      if (($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment'))
    330330      {
    331331        //  echo $old.'X'.$new;
     
    339339    }
    340340
    341     return($result);
     341    return $result;
    342342  }
    343343
     
    348348    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    349349    $Output = 'Načítání textů z DBC souboru...';
    350     if(($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != ''))
     350    if (($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != ''))
    351351    {
    352352      $Output .= '<br />'.$this->Group['Name'].'<br />';
     
    357357      $ColumnIndexes = array();
    358358      $ColumnFormat = array();
    359       while($DbRow = $DbResult->fetch_assoc())
     359      while ($DbRow = $DbResult->fetch_assoc())
    360360      {
    361361        $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
     
    369369      $Count = 0;
    370370
    371       for($I = 0; $I < $ItemCount; $I++)
    372       {
    373         foreach($this->Group['Items'] as $GroupItem)
    374         if(array_key_exists($GroupItem['Id'], $ColumnIndexes))
     371      for ($I = 0; $I < $ItemCount; $I++)
     372      {
     373        foreach ($this->Group['Items'] as $GroupItem)
     374        if (array_key_exists($GroupItem['Id'], $ColumnIndexes))
    375375        {
    376376          $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']]));
     
    380380        $Columns = explode(',', $this->Group['DBCIndex']);
    381381        $ColumnValue = '';
    382         foreach($Columns as $Column)
     382        foreach ($Columns as $Column)
    383383          $ColumnValue .= '_'.$DBCFile->GetUint($I, $Column);
    384384        $ColumnValue = substr($ColumnValue, 1);
     
    391391    }
    392392    $Output .= '<strong>Dokončeno.</strong>';
    393     return($Output);
     393    return $Output;
    394394  }
    395395
     
    400400    $this->Group = $TranslationTree[$GroupId];
    401401
    402     if($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC();
    403     else if($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL();
    404     else if($this->Group['SourceType'] == 'lua') $Output = $this->ImportLUA();
     402    if ($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC();
     403    else if ($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL();
     404    else if ($this->Group['SourceType'] == 'lua') $Output = $this->ImportLUA();
    405405    else $Output = ShowMessage('Neznámý typ zdroje pro import', MESSAGE_CRITICAL);
    406406    $Output .= $this->UpdateTranslated();
    407     return($Output);
     407    return $Output;
    408408  }
    409409
     
    420420    $folow_structure = false;
    421421    $i = 0;
    422     while((!$File->EOF()))
     422    while ((!$File->EOF()))
    423423    {
    424424      $Line = $File->ReadLine();
    425425      // Struktura
    426       if(strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false)
     426      if (strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false)
    427427      {
    428428        $Line = '';
     
    430430        $i = 0;
    431431      }
    432       if((strpos($Line, ';') !== false) and ($folow_structure == true))
     432      if ((strpos($Line, ';') !== false) and ($folow_structure == true))
    433433      {
    434434        $folow_structure = false;
     
    437437        //  echo ('<br /><br />');
    438438      }
    439       if(($folow_structure == true) and ($Line != ''))
     439      if (($folow_structure == true) and ($Line != ''))
    440440      {
    441441        $str = substr($Line, 0, strpos($Line, '`'));
    442442        $Line = substr($Line, strpos($Line, '`') + 1);
    443443        $Line = substr($Line, 0, strpos($Line, '`'));
    444         if(strlen($str) < 3) $structure[$i] = $Line;
     444        if (strlen($str) < 3) $structure[$i] = $Line;
    445445        $i++;
    446446      }
    447447
    448448      //data
    449       if((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure)))
     449      if ((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure)))
    450450      {
    451451        while ((strpos($Line, ');') === false) or ($File->EOF()))
     
    461461        $value_buff = '';
    462462        $Value = '';
    463         foreach($LineParts as $LinePart)
     463        foreach ($LineParts as $LinePart)
    464464        {
    465465
    466466          unset($Value, $value_buff);
    467           foreach($structure as $i => $column)
     467          foreach ($structure as $i => $column)
    468468          {
    469469            if (substr($LinePart, 0, 1) != "'")
     
    475475              $LinePart = substr($LinePart, 1);
    476476              $value_buff = substr($LinePart, 0, strpos($LinePart, "'"));
    477               while(substr($value_buff, strlen($value_buff) - 1, 1) == "\\")
     477              while (substr($value_buff, strlen($value_buff) - 1, 1) == "\\")
    478478              {
    479479                $str = substr($LinePart, strlen($value_buff));
     
    484484              $LinePart = substr($LinePart, strlen($value_buff) + 2);
    485485            }
    486             if(($value_buff != 'null') and ($value_buff != 'NULL'))
     486            if (($value_buff != 'null') and ($value_buff != 'NULL'))
    487487            {
    488488              $str = '';
    489               while(substr($value_buff, strlen($value_buff) - 1,1) == " ")
     489              while (substr($value_buff, strlen($value_buff) - 1,1) == " ")
    490490              {
    491491                $value_buff = substr($value_buff, 0, strlen($value_buff) - 1);
     
    493493              }
    494494              $str2 = '';
    495               while(substr($value_buff, 0, 1) == ' ')
     495              while (substr($value_buff, 0, 1) == ' ')
    496496              {
    497497                $value_buff = substr($value_buff, 1, strlen($value_buff) - 1);
     
    505505            //  echo ($column.'-"'.$Value[$column].'"<br>');
    506506          }
    507           foreach($this->Group['Items'] as $GroupItem)
     507          foreach ($this->Group['Items'] as $GroupItem)
    508508          {
    509             if($GroupItem['MangosColumn'] != '')
     509            if ($GroupItem['MangosColumn'] != '')
    510510              if (isset($Value[$GroupItem['MangosColumn']]))
    511511                $Value[$GroupItem['Column']] = $Value[$GroupItem['MangosColumn']];
     
    519519          $Columns = explode(',', $this->Group['MangosTableIndex']);
    520520          $ColumnValue = '';
    521           foreach($Columns as $Column)
     521          foreach ($Columns as $Column)
    522522            $ColumnValue .= '_'.$Value[$Column];
    523523          $ColumnValue = substr($ColumnValue, 1);
     
    530530    $Output = '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
    531531    $this->UpdateLastVersion();
    532     return($Output);
     532    return $Output;
    533533  }
    534534
  • trunk/Modules/Import/Manage.php

    r859 r880  
    1919    '<li>Po provedení importu je potřeba několikrát spustit skript na aktualizaci verze u překladu. Je potřeba ho provádět opakovaně dokud nezmizí tečky označující, že byly provedeny změny.</li>'.
    2020    '</ol>';
    21     return($Output);
     21    return $Output;
    2222  }
    2323
     
    2626    global $System;
    2727
    28     if(array_key_exists('id', $_GET))
     28    if (array_key_exists('id', $_GET))
    2929    {
    3030      $Output = '<div style="font-size: xx-small;">';
     
    3838      $Output .= '</div>';
    3939    } else $Output = ShowMessage('Nebylo zadáno id skupiny.', MESSAGE_CRITICAL);
    40     return($Output);
     40    return $Output;
    4141  }
    4242
     
    6868
    6969    $DbResult = $this->System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    70     while($Group = $DbResult->fetch_assoc())
     70    while ($Group = $DbResult->fetch_assoc())
    7171    {
    7272      $Output .= '<tr><td>'.T($Group['Name']).'</td>'.
    7373        '<td>'.$Group['SourceType'].'</td><td>';
    74       if($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
    75       if($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
    76       if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
     74      if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
     75      if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
     76      if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
    7777      $Output .= '</td>'.
    7878        '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="../log/?group='.$Group['Id'].'&amp;type=11">'.HumanDate($Group['LastImport']).'</a></td>'.
     
    8282    }
    8383    $Output .= '</table>';
    84     return($Output);
     84    return $Output;
    8585  }
    8686
     
    9393    $Output .= $Import->UpdateTranslated();
    9494    $Output .= '</div>';
    95     return($Output);
     95    return $Output;
    9696  }
    9797
     
    100100    $this->Title = T('Import');
    101101    $Output = '';
    102     if($this->System->User->Licence(LICENCE_ADMIN))
     102    if ($this->System->User->Licence(LICENCE_ADMIN))
    103103    {
    104     if(array_key_exists('action', $_GET))
     104    if (array_key_exists('action', $_GET))
    105105    {
    106       if($_GET['action'] == 'instructions') $Output .= $this->ShowInstructions();
    107       else if($_GET['action'] == 'importgroup') $Output .= $this->ShowImportGroup();
    108       else if($_GET['action'] == 'update_translated') $Output .= $this->UpdateTranslated();
     106      if ($_GET['action'] == 'instructions') $Output .= $this->ShowInstructions();
     107      else if ($_GET['action'] == 'importgroup') $Output .= $this->ShowImportGroup();
     108      else if ($_GET['action'] == 'update_translated') $Output .= $this->UpdateTranslated();
    109109      else $Output .= $this->ShowMenu();
    110110    } else $Output .= $this->ShowMenu();
    111111    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    112     return($Output);
     112    return $Output;
    113113  }
    114114}
  • trunk/Modules/Import/cmd.php

    r859 r880  
    1313$Output = '';
    1414
    15 if(defined('STDIN') == false)
     15if (defined('STDIN') == false)
    1616{
    1717  $Output = T('Access denied');
     
    1919}
    2020
    21 foreach($_SERVER['argv'] as $parameter)
     21foreach ($_SERVER['argv'] as $parameter)
    2222{
    23   if(strpos($parameter, '=') !== false)
     23  if (strpos($parameter, '=') !== false)
    2424  {
    2525    $index = substr($parameter, 0, strpos($parameter, '='));
     
    3030}
    3131
    32 if(!array_key_exists('id', $_GET))
     32if (!array_key_exists('id', $_GET))
    3333{
    3434  $Output .= '
     
    4949  $Output .= '   version=<version> - nastaví verzi importu default: '.$System->Config['Web']['GameVersion'].'<br /><br />';
    5050      $Output .= '    <id_import_group>:';
    51     foreach($TranslationTree as $Group)
     51    foreach ($TranslationTree as $Group)
    5252    {
    5353      $Output .= '<br />    '.$Group['Id'].' ';
  • trunk/Modules/Import/generatecodeXML.php

    r815 r880  
    3030
    3131$files = scandir($verze);
    32 foreach($files as $file)
     32foreach ($files as $file)
    3333{
    3434  $end = substr($file, strlen($file) - 3);
    35   if($end == 'xml')
     35  if ($end == 'xml')
    3636  {
    3737    echo('<br />--'.$file.'<br /><br />');
  • trunk/Modules/Info/Info.php

    r864 r880  
    6969  '</ul><br />'.
    7070  '<br />';
    71   return($Output);
     71  return $Output;
    7272  }
    7373}
     
    9494'<iframe width="420" height="315" src="https://www.youtube.com/embed/6EhBFv59syk" frameborder="0" allowfullscreen></iframe><br/>'.
    9595'<img src="'.$this->System->Link('/images/promotion.bmp').'" width="800" alt="addon-obr">';
    96     return($Output);
     96    return $Output;
    9797  }
    9898}
  • trunk/Modules/Log/Log.php

    r861 r880  
    3333  function WriteLog($Text, $Type)
    3434  {
    35     if(isset($this->System->User) and !is_null($this->System->User->Id))
     35    if (isset($this->System->User) and !is_null($this->System->User->Id))
    3636      $UserId = $this->System->User->Id;
    3737      else $UserId = 'NULL';
     
    6060  global $System, $User;
    6161
    62   if(isset($User) and !is_null($User->Id)) $UserId = $User->Id;
     62  if (isset($User) and !is_null($User->Id)) $UserId = $User->Id;
    6363    else $UserId = 'NULL';
    6464  $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '.
     
    7575    $Output = '';
    7676    $Items = array();
    77     if(array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"';
     77    if (array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"';
    7878      else $Where = '';
    7979    $sql = 'SELECT *, UNIX_TIMESTAMP(`Date`) AS `TimeCreate`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `UserName`, `Date` FROM `Log`'.
    8080      $Where.' ORDER BY `Date` DESC LIMIT 100';
    8181    $DbResult = $this->System->Database->query($sql);
    82     while($Line = $DbResult->fetch_assoc())
     82    while ($Line = $DbResult->fetch_assoc())
    8383    {
    8484      $DbResult2 = $this->System->Database->query('SELECT * FROM `LogType` WHERE `Id`='.$Line['Type']);
    8585      $LogType = $DbResult2->fetch_assoc();
    8686
    87       if($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);
     87      if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);
    8888      $Line['Text'] = str_replace("\n", '<br>', $Line['Text']);
    8989
     
    106106      'Items' => $Items,
    107107    ));
    108     return($Output);
     108    return $Output;
    109109  }
    110110
    111111  function Show()
    112112  {
    113     if(array_key_exists('a', $_POST)) $Action = $_POST['a'];
    114       else if(array_key_exists('a', $_GET)) $Action = $_GET['a'];
     113    if (array_key_exists('a', $_POST)) $Action = $_POST['a'];
     114      else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];
    115115      else $Action = '';
    116     if($Action == 'delerrlog') $Output = $this->DeleteErrorLog();
     116    if ($Action == 'delerrlog') $Output = $this->DeleteErrorLog();
    117117    else $Output = $this->ShowList();
    118     return($Output);
     118    return $Output;
    119119  }
    120120
     
    125125    $this->Title = T('System log');
    126126    $Output = '';
    127     if(array_key_exists('type', $_GET)) $_SESSION['type'] = $_GET['type'] * 1;
    128     else if(!array_key_exists('type', $_SESSION)) $_SESSION['type'] = '';
    129 
    130     if(array_key_exists('group', $_GET)) $_SESSION['group'] = $_GET['group'];
    131 
    132     if($_SESSION['type'] != '') $WhereType = ' (`Type`='.$_SESSION['type'].')';
     127    if (array_key_exists('type', $_GET)) $_SESSION['type'] = $_GET['type'] * 1;
     128    else if (!array_key_exists('type', $_SESSION)) $_SESSION['type'] = '';
     129
     130    if (array_key_exists('group', $_GET)) $_SESSION['group'] = $_GET['group'];
     131
     132    if ($_SESSION['type'] != '') $WhereType = ' (`Type`='.$_SESSION['type'].')';
    133133      else $WhereType = '1=1';
    134134
     
    138138
    139139    // Show category filter
    140     if($this->System->User->Licence(LICENCE_MODERATOR))
     140    if ($this->System->User->Licence(LICENCE_MODERATOR))
    141141    {
    142142      $Output = '<strong>'.T('Filter').':</strong>';
    143143        $Item = '<a href="'.$this->System->Link('/log/?type=').'" title="Bez filtrování">'.T('All').'</a>';
    144       if($_SESSION['type'] == '') $Item = '<strong>'.$Item.'</strong>';
     144      if ($_SESSION['type'] == '') $Item = '<strong>'.$Item.'</strong>';
    145145      $Output .= ' '.$Item;
    146146      $DbResult = $this->System->Database->query('SELECT * FROM `LogType`');
    147       while($LogType = $DbResult->fetch_assoc())
     147      while ($LogType = $DbResult->fetch_assoc())
    148148      {
    149149        $Item = '<a href="'.$this->System->Link('/log/?type='.$LogType['Id']).'" style="color:'.
    150150          $LogType['Color'].'" title="'.$LogType['Name'].'">'.T($LogType['Name']).'</a>';
    151         if($_SESSION['type'] == $LogType['Id']) $Item = '<strong>'.$Item.'</strong>';
     151        if ($_SESSION['type'] == $LogType['Id']) $Item = '<strong>'.$Item.'</strong>';
    152152        $Output .= ' '.$Item;
    153153      }
     
    155155     $Output .= '<br /><br />';
    156156
    157     if(array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType;
     157    if (array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType;
    158158    else
    159159    {
    160       if(array_key_exists('group', $_SESSION)) $Where = ' WHERE `Text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
     160      if (array_key_exists('group', $_SESSION)) $Where = ' WHERE `Text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
    161161        else $Where = '';
    162162    }
    163     //if(($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
     163    //if (($Where != '') and (array_key_exists('group', $_SESSION))) $Where .= ' AND text LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';
    164164
    165165    $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Log` '.$Where);
     
    172172      array('Name' => 'Date', 'Title' => T('Time')),
    173173    );
    174     if($_SESSION['type'] == '') $TableColumns[] =
     174    if ($_SESSION['type'] == '') $TableColumns[] =
    175175      array('Name' => 'LogName', 'Title' => T('Type'));
    176176    $TableColumns = array_merge($TableColumns, array(
     
    187187      '(SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `UserName` FROM `Log` LEFT JOIN `LogType` ON `LogType`.`Id`=`Log`.`Type` '.$Where.$Order['SQL'].$PageList['SQLLimit'];
    188188    $DbResult = $this->System->Database->query($sql);
    189     while($Line = $DbResult->fetch_assoc())
    190     {
    191       if($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);
     189    while ($Line = $DbResult->fetch_assoc())
     190    {
     191      if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);
    192192      $Line['Text'] = str_replace("\n", '<br/>', $Line['Text']);
    193193      $Output .= '<tr><td>'.$Line['Date'].'</td>';
    194       if($_SESSION['type'] == '') $Output .= '<td>'.T($Line['LogName']).'</td>';
     194      if ($_SESSION['type'] == '') $Output .= '<td>'.T($Line['LogName']).'</td>';
    195195      $Output .= '<td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td>'.
    196196      '<td><a href="'.$this->System->Link('/user/?user='.$Line['User']).'">'.$Line['UserName'].'</a></td>'.
     
    200200    $Output .= '</table>'.
    201201      $PageList['Output'];
    202       if($this->System->User->Licence(LICENCE_ADMIN))
     202      if ($this->System->User->Licence(LICENCE_ADMIN))
    203203      {
    204204        $Output .= '<div>'.T('Remove').': <a href="'.$this->System->Link('/log/?a=delerrlog&amp;type='.LOG_TYPE_ERROR).'">'.T('Error logs').'</a> '.
     
    207207    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    208208
    209     return($Output);
     209    return $Output;
    210210  }
    211211
    212212  function DeleteErrorLog()
    213213  {
    214     if($this->System->User->Licence(LICENCE_ADMIN) and
     214    if ($this->System->User->Licence(LICENCE_ADMIN) and
    215215    (($_GET['type'] == LOG_TYPE_ERROR) or ($_GET['type'] == LOG_TYPE_PAGE_NOT_FOUND)))
    216216    {
     
    223223      $Output = ShowMessage('Smazáno všech '.$DbRow[0].' záznamů z '.$LogType['Description'].'.');
    224224      $Output .= $this->ShowList();
    225       return($Output);
     225      return $Output;
    226226    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    227227  }
  • trunk/Modules/News/News.php

    r862 r880  
    3535    $DbResult = $this->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text`,`News`.`Title`, `News`.`Id` '.
    3636      ' FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT '.$Count);
    37     while($DbRow = $DbResult->fetch_assoc())
     37    while ($DbRow = $DbResult->fetch_assoc())
    3838    {
    3939      $Output .= '<h4><a href="'.$this->System->Link('/news/?a=item&amp;i='.$DbRow['Id']).'">'.$DbRow['Title'].'</a> ('.HumanDate($DbRow['Time']).')</h4>'.
     
    4141    }
    4242    $Output .= '</div></div>';
    43     return($Output);
     43    return $Output;
    4444  }
    4545
     
    4848    $this->RSSChannels[$Channel['Channel']] = $Channel;
    4949
    50     if(is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];
     50    if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];
    5151    else {
    5252      array_splice($this->RSSChannelsPos, $Pos, 0, $Channel['Channel']);
     
    5757  {
    5858    $Output = '';
    59     foreach($this->RSSChannels as $Channel)
     59    foreach ($this->RSSChannels as $Channel)
    6060    {
    61       if($this->System->User->Licence($Channel['Permission']))
     61      if ($this->System->User->Licence($Channel['Permission']))
    6262        $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'.
    6363          $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />';
    6464    }
    65     return($Output);
     65    return $Output;
    6666  }
    6767}
     
    7272  {
    7373    $this->Title = T('News');
    74     if(array_key_exists('a', $_POST)) $Action = $_POST['a'];
    75       else if(array_key_exists('a', $_GET)) $Action = $_GET['a'];
     74    if (array_key_exists('a', $_POST)) $Action = $_POST['a'];
     75      else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];
    7676      else $Action = '';
    77     if($Action == 'add2') $Output = $this->SaveNew();
    78     else if($Action == 'add') $Output = $this->ShowAddForm();
    79     else if($Action == 'item') $Output = $this->ShowItem();
     77    if ($Action == 'add2') $Output = $this->SaveNew();
     78    else if ($Action == 'add') $Output = $this->ShowAddForm();
     79    else if ($Action == 'item') $Output = $this->ShowItem();
    8080    else $Output = $this->ShowList();
    81     return($Output);
     81    return $Output;
    8282  }
    8383
     
    8989
    9090    $Output = '<h3>'.T('News').'</h3>';
    91     if($this->System->User->Licence(LICENCE_ADMIN))
     91    if ($this->System->User->Licence(LICENCE_ADMIN))
    9292      $Output .= ' <a href="?a=add">'.T('Add').'</a>';
    9393    $Output .= $PageList['Output'];
     
    9595    $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '.
    9696        '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']);
    97     while($Line = $DbResult->fetch_assoc())
     97    while ($Line = $DbResult->fetch_assoc())
    9898    {
    9999      $Output .= '<h4><a href="?a=item&amp;i='.$Line['Id'].'">'.$Line['Title'].'</a> ('.HumanDate($Line['Time']).')</h4><div>'.$Line['Text'].' ('.$Line['User'].')</div>';
    100100    }
    101101    $Output .= '</div>'.$PageList['Output'];
    102     return($Output);
     102    return $Output;
    103103  }
    104104
    105105  function ShowItem()
    106106  {
    107     if(array_key_exists('i', $_GET))
     107    if (array_key_exists('i', $_GET))
    108108    {
    109109      $Output = '<h3>'.T('News').'</h3>';
    110110      $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '.
    111111        '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` WHERE `News`.`Id` = '.($_GET['i'] * 1));
    112       if($DbResult->num_rows == 1)
     112      if ($DbResult->num_rows == 1)
    113113      {
    114114        $Line = $DbResult->fetch_assoc();
     
    117117    } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    118118    $Output .= '<br/><a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>';
    119     return($Output);
     119    return $Output;
    120120  }
    121121
    122122  function ShowAddForm()
    123123  {
    124     if($this->System->User->Licence(LICENCE_ADMIN))
     124    if ($this->System->User->Licence(LICENCE_ADMIN))
    125125    {
    126126      $Output = '<form action="?" method="POST">'.
     
    134134    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    135135    $Output .= $this->ShowList();
    136     return($Output);
     136    return $Output;
    137137  }
    138138
    139139  function SaveNew()
    140140  {
    141     if($this->System->User->Licence(LICENCE_ADMIN))
     141    if ($this->System->User->Licence(LICENCE_ADMIN))
    142142    {
    143       if(array_key_exists('text', $_POST) and array_key_exists('title', $_POST))
     143      if (array_key_exists('text', $_POST) and array_key_exists('title', $_POST))
    144144      {
    145145        $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '.
     
    151151      } else $Output = ShowMessage(T('Data not specified'), MESSAGE_CRITICAL);
    152152    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    153     return($Output);
     153    return $Output;
    154154  }
    155155
     
    160160      '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text`, `News`.`Id` '.
    161161      'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
    162     while($DbRow = $DbResult->fetch_assoc())
     162    while ($DbRow = $DbResult->fetch_assoc())
    163163    {
    164164     $Items[] = array
     
    178178      'Items' => $Items,
    179179    ));
    180     return($Output);
     180    return $Output;
    181181  }
    182182}
  • trunk/Modules/News/RSS.php

    r876 r880  
    1515      "    <pubDate>".date('r')."</pubDate>\n".
    1616      "    <ttl>20</ttl>\n";
    17   foreach($Data['Items'] as $Item)
     17  foreach ($Data['Items'] as $Item)
    1818  {
    1919    $Result .= "    <item>\n".
     
    2626  $Result .= "  </channel>\n".
    2727      "</rss>";
    28   return($Result);
     28  return $Result;
    2929}
    3030
     
    3535    $this->RawPage = true;
    3636
    37     if(array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];
     37    if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];
    3838      else $ChannelName = '';
    39     if(array_key_exists('token', $_GET)) $Token = $_GET['token'];
     39    if (array_key_exists('token', $_GET)) $Token = $_GET['token'];
    4040      else $Token = '';
    41     if(array_key_exists($ChannelName, $this->System->ModuleManager->Modules['News']->RSSChannels))
     41    if (array_key_exists($ChannelName, $this->System->ModuleManager->Modules['News']->RSSChannels))
    4242    {
    4343      $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName];
    44       if($this->System->User->Licence($Channel['Permission']) or
     44      if ($this->System->User->Licence($Channel['Permission']) or
    4545      $this->System->User->CheckToken($Channel['Permission'], $Token))
    4646      {
    47         if(is_string($Channel['Callback'][0]))
     47        if (is_string($Channel['Callback'][0]))
    4848        {
    4949          $Class = new $Channel['Callback'][0]($this->System);
     
    5353      } else $Output = T('Access denied');
    5454    } else $Output = 'Nezadán žádný kanál';
    55     return($Output);
     55    return $Output;
    5656  }
    5757}
  • trunk/Modules/Redirection/Redirection.php

    r861 r880  
    2424    Header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently');
    2525    Header('Location: '.$Location);
    26     return('<h3 align="center">'.T('').'</h3>');
     26    return '<h3 align="center">'.T('').'</h3>';
    2727  }
    2828
     
    3030  {
    3131    $Output = '';
    32     if(count($this->System->PathItems) > 0)
     32    if (count($this->System->PathItems) > 0)
    3333    {
    34       if($this->System->PathItems[0] == 'user.php') $Output = $this->Redirect($this->System->Link('/user/'));
    35       if($this->System->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/'));
    36       if($this->System->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/'));
    37       if($this->System->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/'));
    38       if($this->System->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/'));
    39       if($this->System->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/'));
    40       if($this->System->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/'));
    41       if($this->System->PathItems[0] == 'registrace.php') $Output = $this->Redirect($this->System->Link('/registration/'));
    42       if($this->System->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/'));
    43       if($this->System->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/'));
    44       if($this->System->PathItems[0] == 'banners.php') $Output = $this->Redirect($this->System->Link('/referrer/'));
    45       if($this->System->PathItems[0] == 'download.php') $Output = $this->Redirect($this->System->Link('/download/'));
    46       if($this->System->PathItems[0] == 'serverlist.php') $Output = $this->Redirect($this->System->Link('/server/'));
    47       if($this->System->PathItems[0] == 'info.php') $Output = $this->Redirect($this->System->Link('/info/'));
    48       if($this->System->PathItems[0] == 'userlist.php') $Output = $this->Redirect($this->System->Link('/users/'));
    49       if($this->System->PathItems[0] == 'promotion.php') $Output = $this->Redirect($this->System->Link('/promotion/'));
    50       if($this->System->PathItems[0] == 'log.php') $Output = $this->Redirect($this->System->Link('/log/'));
    51       if(count($this->System->PathItems) > 1)
     34      if ($this->System->PathItems[0] == 'user.php') $Output = $this->Redirect($this->System->Link('/user/'));
     35      if ($this->System->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/'));
     36      if ($this->System->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/'));
     37      if ($this->System->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/'));
     38      if ($this->System->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/'));
     39      if ($this->System->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/'));
     40      if ($this->System->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/'));
     41      if ($this->System->PathItems[0] == 'registrace.php') $Output = $this->Redirect($this->System->Link('/registration/'));
     42      if ($this->System->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/'));
     43      if ($this->System->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/'));
     44      if ($this->System->PathItems[0] == 'banners.php') $Output = $this->Redirect($this->System->Link('/referrer/'));
     45      if ($this->System->PathItems[0] == 'download.php') $Output = $this->Redirect($this->System->Link('/download/'));
     46      if ($this->System->PathItems[0] == 'serverlist.php') $Output = $this->Redirect($this->System->Link('/server/'));
     47      if ($this->System->PathItems[0] == 'info.php') $Output = $this->Redirect($this->System->Link('/info/'));
     48      if ($this->System->PathItems[0] == 'userlist.php') $Output = $this->Redirect($this->System->Link('/users/'));
     49      if ($this->System->PathItems[0] == 'promotion.php') $Output = $this->Redirect($this->System->Link('/promotion/'));
     50      if ($this->System->PathItems[0] == 'log.php') $Output = $this->Redirect($this->System->Link('/log/'));
     51      if (count($this->System->PathItems) > 1)
    5252      {
    53         if(($this->System->PathItems[0] == 'team') and ($this->System->PathItems[1] == 'userlist.php'))
     53        if (($this->System->PathItems[0] == 'team') and ($this->System->PathItems[1] == 'userlist.php'))
    5454          $Output = $this->Redirect($this->System->Link('/userlist/'));
    55         if(($this->System->PathItems[0] == 'dictionary') and ($this->System->PathItems[1] == 'user.php'))
     55        if (($this->System->PathItems[0] == 'dictionary') and ($this->System->PathItems[1] == 'user.php'))
    5656          $Output = $this->Redirect($this->System->Link('/user/'));
    57         if(($this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php'))
     57        if (($this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php'))
    5858          $Output = $this->Redirect($this->System->Link('/forum/'));
    59         if(($this->System->PathItems[0] == 'phpbb3') and ($this->System->PathItems[1] == 'index.php'))
     59        if (($this->System->PathItems[0] == 'phpbb3') and ($this->System->PathItems[1] == 'index.php'))
    6060          $Output = $this->Redirect($this->System->Link('/forum/'));
    61         if(($this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php'))
     61        if (($this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php'))
    6262          $Output = $this->Redirect($this->System->Link('/forum/'));
    63         if(($this->System->PathItems[0] == 'download') and ($this->System->PathItems[1] == 'ceske_fonty_do_wow.zip'))
     63        if (($this->System->PathItems[0] == 'download') and ($this->System->PathItems[1] == 'ceske_fonty_do_wow.zip'))
    6464          $Output = $this->Redirect($this->System->Link('/files/ceske_fonty_do_wow.zip'));
    6565      }
    6666    }
    67     return($Output);
     67    return $Output;
    6868  }
    6969}
  • trunk/Modules/Referrer/Referrer.php

    r860 r880  
    3434  function Log()
    3535  {
    36     if(array_key_exists('HTTP_REFERER', $_SERVER))
     36    if (array_key_exists('HTTP_REFERER', $_SERVER))
    3737    {
    3838      $Referrer = addslashes($_SERVER['HTTP_REFERER']);
    3939      $HostName = substr($Referrer, strpos($Referrer, '/') + 2);
    4040      $HostName = substr($HostName, 0, strpos($HostName, '/'));
    41       if(!in_array($HostName, $this->Excludes))
     41      if (!in_array($HostName, $this->Excludes))
    4242      {
    4343        $IP = GetRemoteAddress();
     
    4646        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `BlackList` WHERE `IP` = "'.$IP.'"');
    4747        $DbRow = $DbResult->fetch_row();
    48         if($DbRow[0] == 0)
     48        if ($DbRow[0] == 0)
    4949        {
    5050          $Visible = '1';
     
    5858        // Check if host name is already stored and need just to update hit counter
    5959        $DbResult = $this->System->Database->query('SELECT `Id` FROM `Referrer` WHERE `Web` = "'.$HostName.'"');
    60         if($DbResult->num_rows > 0)
     60        if ($DbResult->num_rows > 0)
    6161        {
    6262          $DbRow = $DbResult->fetch_assoc();
     
    9292    $Output .= $BannerSmall.' &nbsp;&nbsp;<textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />';
    9393
    94     if($this->System->User->Licence(LICENCE_ADMIN)) {
     94    if ($this->System->User->Licence(LICENCE_ADMIN)) {
    9595
    9696    $MonthAge = 3;
     
    9999    <div style="font-size: 10px;">Seznam je automaticky aktualizován a zobrazeny jsou servery, ze kterých přišli uživatelé během posledních třech měsíců řazený sestupně dle nejnovějších.</div><br />';
    100100
    101     if(!$this->System->User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)';
     101    if (!$this->System->User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Visible`=1) AND (`Parent` IS NULL)';
    102102    else $Where = '';
    103103    $Query = 'SELECT *, (SELECT Web FROM `Referrer` AS T4 WHERE T4.Id = T3.Parent) AS ParentName '.
     
    123123        array('Name' => 'TotalHits', 'Title' => T('Hits')),
    124124    );
    125     if($this->System->User->Licence(LICENCE_ADMIN))
     125    if ($this->System->User->Licence(LICENCE_ADMIN))
    126126    {
    127127      $TableColumns[] = array('Name' => 'Visible', 'Title' => T('Visible'));
     
    137137
    138138    $DbResult = $this->Database->query($Query);
    139     while($Line = $DbResult->fetch_assoc())
     139    while ($Line = $DbResult->fetch_assoc())
    140140    {
    141141      $Output .= '<tr><td><a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a></td>'.
    142142          '<td>'.HumanDate($Line['MaxDateLast']).'</td>'.
    143143          '<td>'.$Line['TotalHits'].'</td>';
    144       if($this->System->User->Licence(LICENCE_ADMIN))
     144      if ($this->System->User->Licence(LICENCE_ADMIN))
    145145      {
    146146        $Output .=
     
    158158
    159159    }
    160     return($Output);
     160    return $Output;
    161161  }
    162162
     
    165165    $Output = '<select name="Parent">';
    166166    $Output .= '<option value=""';
    167     if($Selected == '')
     167    if ($Selected == '')
    168168      $Output .= ' selected="selected"';
    169169    $Output .= '></option>';
    170170    $DbResult = $this->Database->select('Referrer', '`Id`, `Web`', '`Parent` IS NULL ORDER BY `Web`');
    171     while($Language = $DbResult->fetch_assoc())
    172     if($Language['Id'] != $Self)
     171    while ($Language = $DbResult->fetch_assoc())
     172    if ($Language['Id'] != $Self)
    173173    {
    174174      $Output .= '<option value="'.$Language['Id'].'"';
    175       if($Selected == $Language['Id'])
     175      if ($Selected == $Language['Id'])
    176176        $Output .= ' selected="selected"';
    177177      $Output .= '>'.$Language['Web'].'</option>';
    178178    }
    179179    $Output .= '</select>';
    180     return($Output);
     180    return $Output;
    181181  }
    182182
    183183  function Spam()
    184184  {
    185     if($this->System->User->Licence(LICENCE_ADMIN))
    186     {
    187       if(array_key_exists('id', $_GET))
     185    if ($this->System->User->Licence(LICENCE_ADMIN))
     186    {
     187      if (array_key_exists('id', $_GET))
    188188      {
    189189        $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']);
    190         if($DbResult->num_rows > 0)
     190        if ($DbResult->num_rows > 0)
    191191        {
    192192          $Item = $DbResult->fetch_assoc();
    193193          $this->Database->update('Referrer', 'Id='.$_GET['id'], array('Visible' => 0, 'Description' => 'Spam'));
    194194          $DbResult2 = $this->Database->select('BlackList', '*', 'IP="'.$Item['LastIP'].'"');
    195           if($DbResult2->num_rows == 0)
     195          if ($DbResult2->num_rows == 0)
    196196          {
    197197            $this->Database->insert('BlackList', array('Time' => 'NOW()', 'IP' => $Item['LastIP']));
     
    202202      } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL);
    203203    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    204     return($Output);
     204    return $Output;
    205205  }
    206206
    207207  function Edit()
    208208  {
    209     if($this->System->User->Licence(LICENCE_ADMIN))
    210     {
    211       if(array_key_exists('id', $_GET))
     209    if ($this->System->User->Licence(LICENCE_ADMIN))
     210    {
     211      if (array_key_exists('id', $_GET))
    212212      {
    213213        $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']);
    214         if($DbResult->num_rows > 0)
     214        if ($DbResult->num_rows > 0)
    215215        {
    216216          $Item = $DbResult->fetch_assoc();
    217           if($Item['Visible'] == 1) $Visible = ' checked ';
     217          if ($Item['Visible'] == 1) $Visible = ' checked ';
    218218            else $Visible = '';
    219219          $Output = '<form action="?action=editsave&amp;id='.$_GET['id'].'" method="post"><table>'.
     
    227227      } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL);
    228228    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    229     return($Output);
     229    return $Output;
    230230  }
    231231
    232232  function EditSave()
    233233  {
    234     if($this->System->User->Licence(LICENCE_ADMIN))
    235     {
    236       if($_POST['Parent'] == '') $_POST['Parent'] = null;
     234    if ($this->System->User->Licence(LICENCE_ADMIN))
     235    {
     236      if ($_POST['Parent'] == '') $_POST['Parent'] = null;
    237237      $_POST['Visible'] = array_key_exists('Visible', $_POST);
    238238      $DbResult = $this->Database->update('Referrer', 'Id='.$_GET['id'], array(
     
    243243      $Output .= $this->ShowList();
    244244    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    245     return($Output);
     245    return $Output;
    246246  }
    247247
     
    249249  {
    250250    $this->Title = T('Promotion');
    251     if(array_key_exists('action', $_GET))
    252     {
    253       if($_GET['action'] == 'edit') $Output = $this->Edit();
    254       else if($_GET['action'] == 'spam') $Output = $this->Spam();
    255       else if($_GET['action'] == 'editsave') $Output = $this->EditSave();
     251    if (array_key_exists('action', $_GET))
     252    {
     253      if ($_GET['action'] == 'edit') $Output = $this->Edit();
     254      else if ($_GET['action'] == 'spam') $Output = $this->Spam();
     255      else if ($_GET['action'] == 'editsave') $Output = $this->EditSave();
    256256      else $Output = $this->ShowList();
    257257    } else $Output = $this->ShowList();
    258     return($Output);
     258    return $Output;
    259259  }
    260260}
  • trunk/Modules/Search/Search.php

    r861 r880  
    4848      '</table></div>'.
    4949      '</form>';
    50     return($Output);
     50    return $Output;
    5151  }
    5252}
     
    5757  {
    5858    $this->Title = T('Search');
    59     if(array_key_exists('text', $_GET)) $Search = $_GET['text'];
    60     else if(array_key_exists('text', $_POST)) $Search = $_POST['text'];
     59    if (array_key_exists('text', $_GET)) $Search = $_GET['text'];
     60    else if (array_key_exists('text', $_POST)) $Search = $_POST['text'];
    6161    else $Search = '';
    6262    $SearchHTML = urlencode($Search);
    6363
    6464    $Output = '<table class="BaseTable"><tr><th>'.T('Section').'</th><th>'.T('Found count').'</th></tr>';
    65     foreach($this->System->ModuleManager->Modules['Search']->SearchItems as $SearchItem)
     65    foreach ($this->System->ModuleManager->Modules['Search']->SearchItems as $SearchItem)
    6666    {
    6767      $ColumnQuery = array();
    68       foreach($SearchItem['Columns'] as $Column)
     68      foreach ($SearchItem['Columns'] as $Column)
    6969      {
    7070        $ColumnQuery[] = '(`'.$Column.'` LIKE "%'.$Search.'%")';
    7171      }
    7272      $ColumnQuery = implode(' OR ', $ColumnQuery);
    73       if($SearchItem['Query'] != '')
     73      if ($SearchItem['Query'] != '')
    7474      {
    7575        $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$SearchItem['Query'].' WHERE '.$ColumnQuery);
     
    8282
    8383    $Output .= '</table>';
    84     return($Output);
     84    return $Output;
    8585  }
    8686}
  • trunk/Modules/Server/Server.php

    r838 r880  
    5757    $Output .= '<h3>'.T('Translated server list').'</h3>';
    5858    $Output .= parent::ViewList();
    59     return($Output);
     59    return $Output;
    6060  }
    6161}
  • trunk/Modules/ShoutBox/ShoutBox.php

    r857 r880  
    2020      'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'),
    2121      'Permission' => LICENCE_ANONYMOUS));
    22     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     22    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    2323      $this->System->ModuleManager->Modules['Search']->RegisterSearch('shoutbox',
    2424      T('Shoutbox'), array('UserName', 'Text'), '`ShoutBox`', $this->System->Link('/shoutbox/?search='));
     
    2929    $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>';
    3030
    31     if($this->System->User->Licence(LICENCE_USER))
     31    if ($this->System->User->Licence(LICENCE_USER))
    3232      $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>';
    3333    $Output .= '<div class="box"><div class="shoutbox"><table>';
    3434    $DbResult = $this->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 30');
    35     while($Line = $DbResult->fetch_assoc())
     35    while ($Line = $DbResult->fetch_assoc())
    3636      $Output .= '<tr><td><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>';
    3737    $Output .= '</table></div></div>';
    38     return($Output);
     38    return $Output;
    3939  }
    4040}
     
    4545  {
    4646    $this->Title = T('Shoutbox');
    47     if(array_key_exists('a', $_POST)) $Action = $_POST['a'];
    48       else if(array_key_exists('a', $_GET)) $Action = $_GET['a'];
     47    if (array_key_exists('a', $_POST)) $Action = $_POST['a'];
     48      else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];
    4949      else $Action = '';
    50     if($Action == 'add2') $Output = $this->AddFinish();
    51     if($Action == 'add') $Output = $this->ShowAddForm();
     50    if ($Action == 'add2') $Output = $this->AddFinish();
     51    if ($Action == 'add') $Output = $this->ShowAddForm();
    5252    else $Output = $this->ShowList();
    53     return($Output);
     53    return $Output;
    5454  }
    5555
     
    5757  {
    5858    $Output = '';
    59     if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
    60     else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
    61     if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
    62     if($_SESSION['search'] != '')
     59    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
     60    else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
     61    if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
     62    if ($_SESSION['search'] != '')
    6363    {
    6464      $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")';
     
    7171
    7272    $Output .= '<h3>'.T('Shoutbox').'</h3>';
    73     if($this->System->User->Licence(LICENCE_USER))
     73    if ($this->System->User->Licence(LICENCE_USER))
    7474      $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>';
    7575    $Output .= $PageList['Output'];
    7676    $Output .= '<div class="shoutbox">';
    7777    $DbResult = $this->System->Database->query('SELECT * FROM `ShoutBox`  WHERE 1'.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    78     while($Line = $DbResult->fetch_assoc())
     78    while ($Line = $DbResult->fetch_assoc())
    7979      $Output .= '<div><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</div>';
    8080    $Output .= '</div>'.$PageList['Output'];
    81     return($Output);
     81    return $Output;
    8282  }
    8383
     
    8585  {
    8686    $Output = '';
    87     if($this->System->User->Licence(LICENCE_USER))
     87    if ($this->System->User->Licence(LICENCE_USER))
    8888    {
    8989        $Output .= '<form action="?" method="post">'.
    9090            '<fieldset><legend>'.T('New message').'</legend>'.
    9191            'Uživatel: ';
    92         if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     92        if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
    9393        else $Output .= '<input type="text" name="user" /><br />';
    9494      $Output .= 'Text zprávy: <br/>'.
     
    9999    } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL);
    100100    $Output .= $this->ShowList();
    101     return($Output);
     101    return $Output;
    102102  }
    103103
     
    105105  {
    106106    $Output = '';
    107     if($this->System->User->Licence(LICENCE_USER))
     107    if ($this->System->User->Licence(LICENCE_USER))
    108108    {
    109       if(array_key_exists('text', $_POST))
     109      if (array_key_exists('text', $_POST))
    110110      {
    111111        $Text = $_POST['text'];
    112         if(trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);
     112        if (trim($Text) == '') $Output .= ShowMessage('Nelze vložit prázdnou zprávu.', MESSAGE_WARNING);
    113113        else
    114114        {
     
    116116          $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'.
    117117              $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1');
    118           if($DbResult->num_rows > 0)
     118          if ($DbResult->num_rows > 0)
    119119          {
    120120            $DbRow = $DbResult->fetch_assoc();
    121121          } else $DbRow['Text'] = '';
    122122
    123           if($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING);
     123          if ($DbRow['Text'] == $Text) $Output .= ShowMessage('Nelze vložit stejnou zprávu vícekrát za sebou.', MESSAGE_WARNING);
    124124          else
    125125          {
     
    134134    } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL);
    135135    $Output .= $this->ShowList();
    136     return($Output);
     136    return $Output;
    137137  }
    138138
     
    143143    mb_internal_encoding('utf-8');
    144144    $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
    145     while($DbRow = $DbResult->fetch_assoc())
     145    while ($DbRow = $DbResult->fetch_assoc())
    146146    {
    147147      $Title = mb_substr($DbRow['Text'], 0, $TitleLength);
    148       if(mb_strlen($Title) == $TitleLength) $Title .= '...';
     148      if (mb_strlen($Title) == $TitleLength) $Title .= '...';
    149149      $Items[] = array
    150150      (
     
    163163      'Items' => $Items,
    164164    ));
    165     return($Output);
     165    return $Output;
    166166  }
    167167}
  • trunk/Modules/Team/Team.php

    r851 r880  
    2424      'Icon' => '',
    2525    ), 1);
    26     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     26    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    2727      $this->System->ModuleManager->Modules['Search']->RegisterSearch('team',
    2828      T('Teams'), array('Name'), '`Team`', $this->System->Link('/team/?search='));
     
    3838    $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/>';
    3939
    40     if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
    41     else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
     40    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
     41    else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
    4242    if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
    4343
    44     if($this->System->User->Licence(LICENCE_USER))
     44    if ($this->System->User->Licence(LICENCE_USER))
    4545      $Output .= '<br /><div style="text-align: center;"><a href="?action=create">'.T('Create translating team').'</a></div><br/>';
    46     if($_SESSION['search'] != '')
     46    if ($_SESSION['search'] != '')
    4747    {
    4848      $SearchQuery = ' AND ((`Name` LIKE "%'.$_SESSION['search'].'%") OR (`Description` LIKE "%'.$_SESSION['search'].'%"))';
     
    6464      array('Name' => 'TimeCreate', 'Title' => T('Founding date')),
    6565    );
    66     if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions'));
     66    if ($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions'));
    6767
    6868    $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1);
     
    7272      '(SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` '.
    7373      'FROM `Team` WHERE 1'.$SearchQuery.$Order['SQL'].$PageList['SQLLimit']);
    74     while($Team = $DbResult->fetch_assoc())
     74    while ($Team = $DbResult->fetch_assoc())
    7575    {
    7676      $Output .= '<tr>'.
     
    8080        '<td><a href="'.$this->System->Link('/users/?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'.
    8181        '<td>'.HumanDate($Team['TimeCreate']).'</td>';
    82       if($this->System->User->Licence(LICENCE_USER))
    83       {
    84         if($Team['Leader'] == $this->System->User->Id) $Action = ' <a href="?action=modify&amp;id='.$Team['Id'].'">'.T('Edit').'</a>';
     82      if ($this->System->User->Licence(LICENCE_USER))
     83      {
     84        if ($Team['Leader'] == $this->System->User->Id) $Action = ' <a href="?action=modify&amp;id='.$Team['Id'].'">'.T('Edit').'</a>';
    8585        else $Action = '';
    86         if($Team['Id'] == $this->System->User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>';
     86        if ($Team['Id'] == $this->System->User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>';
    8787        $Output .= '<td><a href="?action=gointeam&amp;id='.$Team['Id'].'">'.T('Enter').'</a>'.$Action.'</td>';
    8888      }
     
    9292      $PageList['Output'];
    9393
    94     return($Output);
     94    return $Output;
    9595  }
    9696
    9797  function TeamJoin()
    9898  {
    99     if($this->System->User->Licence(LICENCE_USER))
    100     {
    101       if(array_key_exists('id', $_GET))
     99    if ($this->System->User->Licence(LICENCE_USER))
     100    {
     101      if (array_key_exists('id', $_GET))
    102102      {
    103103        $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$this->System->User->Id);
     
    114114      } else $Output = ShowMessage('Nutno zadat id týmu.', MESSAGE_CRITICAL);
    115115    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    116     return($Output);
     116    return $Output;
    117117  }
    118118
     
    120120  {
    121121    $Output = '';
    122     if($this->System->User->Licence(LICENCE_USER))
    123     {
    124       if(array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST))
     122    if ($this->System->User->Licence(LICENCE_USER))
     123    {
     124      if (array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST))
    125125      {
    126126        $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"');
    127127        $DbRow = $DbResult->fetch_row();
    128128        $Count = $DbRow[0];
    129         if(($Count == 0) and ($_POST['Name'] != ''))
     129        if (($Count == 0) and ($_POST['Name'] != ''))
    130130        {
    131131          $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'.
     
    142142    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    143143    $Output .= $this->ShowTeamList();
    144     return($Output);
     144    return $Output;
    145145  }
    146146
    147147  function TeamModify()
    148148  {
    149     if($this->System->User->Licence(LICENCE_USER))
    150     {
    151       if(array_key_exists('id', $_GET))
     149    if ($this->System->User->Licence(LICENCE_USER))
     150    {
     151      if (array_key_exists('id', $_GET))
    152152      {
    153153        $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$this->System->User->Id);
    154         if($DbResult->num_rows > 0)
     154        if ($DbResult->num_rows > 0)
    155155        {
    156156          $Team = $DbResult->fetch_assoc();
     
    165165      } else $Output = ShowMessage('Nezadáno id týmu', MESSAGE_CRITICAL);
    166166    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    167     return($Output);
     167    return $Output;
    168168  }
    169169
     
    171171  {
    172172    $Output = '';
    173     if($this->System->User->Licence(LICENCE_USER))
    174     {
    175       if(array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST))
     173    if ($this->System->User->Licence(LICENCE_USER))
     174    {
     175      if (array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST))
    176176      {
    177177        $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$this->System->User->Id);
    178         if($DbResult->num_rows > 0)
     178        if ($DbResult->num_rows > 0)
    179179        {
    180180          $Team = $DbResult->fetch_assoc();
     
    182182          $DbRow = $DbResult->fetch_row();
    183183          $Count = $DbRow[0];
    184           if(($Count == 0) and ($_POST['Name'] != ''))
     184          if (($Count == 0) and ($_POST['Name'] != ''))
    185185          {
    186186            $this->Database->query('UPDATE `Team` SET `Name`="'.$_POST['Name'].'", `Description`="'.$_POST['Description'].'", `URL`="'.$_POST['URL'].'" WHERE Id='.$Team['Id']);
     
    192192    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    193193    $Output .= $this->ShowTeamList();
    194     return($Output);
     194    return $Output;
    195195  }
    196196
    197197  function TeamCreate()
    198198  {
    199     if($this->System->User->Licence(LICENCE_USER))
     199    if ($this->System->User->Licence(LICENCE_USER))
    200200    {
    201201      $Output ='<form action="?action=finish_create" method="post">'.
     
    207207        '</table></fieldset></form>';
    208208    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    209     return($Output);
     209    return $Output;
    210210  }
    211211
     
    213213  {
    214214    $Output = '';
    215     if(array_key_exists('id', $_GET) and is_numeric($_GET['id']))
     215    if (array_key_exists('id', $_GET) and is_numeric($_GET['id']))
    216216    {
    217217      $DbResult = $this->Database->query('SELECT `Id`, `Name`, `Description`, `URL`, `Leader`, '.
     
    221221        '(SELECT ROUND(AVG(`XP`)) FROM `User` WHERE `Team` = `Team`.`Id`) AS `AverageXP` FROM '.
    222222        '`Team` WHERE `Id`='.($_GET['id'] * 1));
    223       if($DbResult->num_rows > 0)
     223      if ($DbResult->num_rows > 0)
    224224      {
    225225        $Team = $DbResult->fetch_assoc();
    226226        $DbResult2 = $this->Database->query('SELECT `Name`, `Id` FROM `User` WHERE `ID`='.$Team['Leader']);
    227         if($DbResult2->num_rows > 0)
     227        if ($DbResult2->num_rows > 0)
    228228        {
    229229          $Leader = $DbResult2->fetch_assoc();
     
    233233          T('Web pages').': <a href="http://'.htmlspecialchars($Team['URL']).'">'.htmlspecialchars($Team['URL']).'</a><br/>'.
    234234          T('Leader').': <a href="'.$this->System->Link('/user/?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>';
    235         if($Team['Description'] != '')
     235        if ($Team['Description'] != '')
    236236          $Output .= T('Description').': '.htmlspecialchars($Team['Description']).'<br />';
    237237        $Output .= '<br />';
    238238        //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> ';
    239         if($this->System->User->Licence(LICENCE_USER))
     239        if ($this->System->User->Licence(LICENCE_USER))
    240240          $Output .='<a href="?action=gointeam&amp;id='.$Team['Id'].'">'.T('Enter to team').'</a><br /><br />';
    241241        $XP = GetLevelMinMax($Team['AverageXP']);
     
    252252        $Query = '';
    253253        $DbResult = $this->Database->query($GroupListQuery);
    254         if($DbResult->num_rows > 0)
    255         {
    256           while($DbRow = $DbResult->fetch_assoc())
     254        if ($DbResult->num_rows > 0)
     255        {
     256          while ($DbRow = $DbResult->fetch_assoc())
    257257          {
    258258            $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    289289          $Total = 0;
    290290          $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    291           while($Group = $DbResult->fetch_assoc())
     291          while ($Group = $DbResult->fetch_assoc())
    292292          {
    293293            $Output .='<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].
     
    296296            $Total += $Group['Total'];
    297297          }
    298           if($Total > 0) $Progress = round($Translated / $Total * 100, 2);
     298          if ($Total > 0) $Progress = round($Translated / $Total * 100, 2);
    299299          else $Progress = 0;
    300300          $Output .='<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.
     
    306306      } else $Output .= ShowMessage('Tým nenalezen', MESSAGE_CRITICAL);
    307307    } else $Output .= ShowMessage('Musíte zadat id týmu', MESSAGE_CRITICAL);
    308     return($Output);
     308    return $Output;
    309309  }
    310310
    311311  function TeamLeave()
    312312  {
    313     if($this->System->User->Licence(LICENCE_USER))
     313    if ($this->System->User->Licence(LICENCE_USER))
    314314    {
    315315      $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$this->System->User->Id);
     
    325325      $Output .= $this->ShowTeamList();
    326326    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    327     return($Output);
     327    return $Output;
    328328  }
    329329
    330330  function Show()
    331331  {
    332     if(array_key_exists('action', $_GET))
    333     {
    334       if($_GET['action'] == 'gointeam') $Output = $this->TeamJoin();
    335       else if($_GET['action'] == 'finish_create') $Output = $this->TeamCreateFinish();
    336       else if($_GET['action'] == 'modify') $Output = $this->TeamModify();
    337       else if($_GET['action'] == 'finish_modify') $Output = $this->TeamModifyFinish();
    338       else if($_GET['action'] == 'create') $Output = $this->TeamCreate();
    339       else if($_GET['action'] == 'team') $Output = $this->TeamShow();
    340       else if($_GET['action'] == 'leave') $Output = $this->TeamLeave();
     332    if (array_key_exists('action', $_GET))
     333    {
     334      if ($_GET['action'] == 'gointeam') $Output = $this->TeamJoin();
     335      else if ($_GET['action'] == 'finish_create') $Output = $this->TeamCreateFinish();
     336      else if ($_GET['action'] == 'modify') $Output = $this->TeamModify();
     337      else if ($_GET['action'] == 'finish_modify') $Output = $this->TeamModifyFinish();
     338      else if ($_GET['action'] == 'create') $Output = $this->TeamCreate();
     339      else if ($_GET['action'] == 'team') $Output = $this->TeamShow();
     340      else if ($_GET['action'] == 'leave') $Output = $this->TeamLeave();
    341341      else $Output = $this->ShowTeamList();
    342342    } else $Output = $this->ShowTeamList();
    343     return($Output);
     343    return $Output;
    344344  }
    345345}
  • trunk/Modules/Translation/Comparison.php

    r859 r880  
    1212    $ArrStr2 = explode(' ', $String2);
    1313
    14     for($i = 0; $i < count($ArrStr1); $i++)
     14    for ($i = 0; $i < count($ArrStr1); $i++)
    1515    {
    16       if(isset($ArrStr2[$i]))
     16      if (isset($ArrStr2[$i]))
    1717      {
    18         if($ArrStr1[$i] == $ArrStr2[$i])
     18        if ($ArrStr1[$i] == $ArrStr2[$i])
    1919        {
    2020          $Result .= $ArrStr1[$i].' ';
     
    2222        {
    2323          $find = false;
    24           for($j = 0; $j < count($ArrStr2); $j++)
     24          for ($j = 0; $j < count($ArrStr2); $j++)
    2525          {
    26             if(($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))
     26            if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))
    2727            {
    2828              $Result .= $ArrStr1[$i].' ';
     
    3030            }
    3131          }
    32           if($find == false)
     32          if ($find == false)
    3333          $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>';
    3434        }
    3535      } else $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>';
    3636    }
    37     return($Result);
     37    return $Result;
    3838  }
    3939
     
    4444    $Output = '';
    4545
    46     if($this->System->User->Licence(LICENCE_USER))
     46    if ($this->System->User->Licence(LICENCE_USER))
    4747    {
    4848    $Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />';
     
    5151    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    5252
    53     if(array_key_exists('entry', $_GET))
     53    if (array_key_exists('entry', $_GET))
    5454    {
    5555      $Textentry = $_GET['entry'];
    56       if((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1))  //porovnání pouze 2 textů
     56      if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1))  //porovnání pouze 2 textů
    5757      {
    5858        $TextID1 = $_GET['ID1'];
     
    6666          ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '.
    6767          'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`');
    68       while($Line[] = $DataID->fetch_assoc());
     68      while ($Line[] = $DataID->fetch_assoc());
    6969      array_pop($Line);
    7070
     
    7474          '<table class="BaseTable">'.
    7575          '<tr><th>Přeložil</th>';
    76       foreach($Line as $Index => $LineItem)
     76      foreach ($Line as $Index => $LineItem)
    7777        $Output .= '<th>'.$LineItem['UserName'].'</th>';
    7878      $Output .= '</tr>'.
    7979          '<tr>'.
    8080          '<th>ID textu</th>';
    81       foreach($Line as $Index => $LineItem)
     81      foreach ($Line as $Index => $LineItem)
    8282        $Output .= '<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>';
    8383      $Output .= '</tr>'.
    8484          '<tr><th>Převzato</th>';
    85       foreach($Line as $Index => $LineItem)
     85      foreach ($Line as $Index => $LineItem)
    8686        $Output .= '<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>';
    8787      $Output .= '</tr>'.
    8888          '<tr><th>'.T('Language').'</th>';
    89       foreach($Line as $Index => $LineItem)
     89      foreach ($Line as $Index => $LineItem)
    9090        $Output .= '<td>'.T($LineItem['LanguageName']).'</td>';
    9191      $Output .= '</tr>'.
    9292          '<tr><th>'.T('Version').'</th>';
    93       foreach($Line as $Index => $LineItem)
     93      foreach ($Line as $Index => $LineItem)
    9494        $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>';
    9595      $Output .= '</tr>';
    96       foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     96      foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    9797      {
    9898        $writethis = false;
    99         for($i = 0; $i < count($Line); $i++)
     99        for ($i = 0; $i < count($Line); $i++)
    100100        {
    101           if($Line[$i][$TextItem['Column']] <> '') $writethis = true;
     101          if ($Line[$i][$TextItem['Column']] <> '') $writethis = true;
    102102        }
    103         if($writethis)
     103        if ($writethis)
    104104        {
    105105          $Output .= '<tr><th>'.$TextItem['Name'].'</th>';
    106           for($i = 0; $i < count($Line); $i++)
     106          for ($i = 0; $i < count($Line); $i++)
    107107          {
    108             if($i > 0)
     108            if ($i > 0)
    109109            {
    110110              $Output .= '<td>';
     
    120120  } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL);
    121121
    122     return($Output);
     122    return $Output;
    123123  }
    124124}
  • trunk/Modules/Translation/Form.php

    r859 r880  
    1010    $this->Title = T('Translation');
    1111    $Action = '';
    12     if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
    13 
    14     if($Action == 'delete') $Output = $this->Delete();
     12    if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
     13
     14    if ($Action == 'delete') $Output = $this->Delete();
    1515      else $Output = $this->ShowForm();
    16     return($Output);
     16    return $Output;
    1717  }
    1818
     
    2626    $this->GroupId = $GroupId;
    2727    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    28     if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
     28    if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
    2929    else $Action = '';
    3030
    31     if(array_key_exists('ID', $_GET))
     31    if (array_key_exists('ID', $_GET))
    3232    {
    3333      $TextID = $_GET['ID'] * 1;
     
    3636      $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID);
    3737      $Line = $DbResult->fetch_assoc();
    38       if(!$Line)
     38      if (!$Line)
    3939      {
    4040        $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL);
     
    4747          else $Language = '`Language` != '.$this->System->Config['OriginalLanguage'];
    4848          $Columns = '';
    49           foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     49          foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    5050            $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,';
    5151
     
    5656          $DbResult = $this->Database->query($sql.$join.$where);
    5757          while ($LineSearch = $DbResult->fetch_assoc()) {
    58             foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    59               if($TextItem['Visible'] == 1)
     58            foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     59              if ($TextItem['Visible'] == 1)
    6060                if (($LineAJ[$TextItem['Column']] <> '') and
    6161                    ($LineSearch[$TextItem['Column']] <> '') and
     
    7474          $LineAJ = $DbResult->fetch_assoc();
    7575        }
    76         if(!$LineAJ)
     76        if (!$LineAJ)
    7777        {
    7878          $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL);
     
    8080        {
    8181
    82           if($Line['User'] != '')
     82          if ($Line['User'] != '')
    8383          {
    8484            $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']);
     
    8989          $Output .= T('Group').': <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />';
    9090
    91           if(($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))
     91          if (($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))
    9292            $Output .= T('Translated by').': <a href="'.$this->System->Link('/user/?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />';
    93           if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
     93          if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))
    9494          {
    9595            $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']);
     
    105105          }
    106106          $Output .= 'Text: ';
    107           if($Line['Language'] <> 0)
    108           {
    109             if($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';
     107          if ($Line['Language'] <> 0)
     108          {
     109            if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';
    110110            else $Output .= ' <b>'.T('Stored in unfinished').'</b> ';
    111111          } else $Output .= ' <b>'.T('Original version').'</b> ';
     
    120120          $Version = $DbResult->fetch_row();
    121121          $Version = $Version[0];
    122           if($Version > 0)
     122          if ($Version > 0)
    123123          {
    124124            $Output .= '<form action="comparison.php" method="get"><a href="'.$this->System->Link('/TranslationList.php?group='.
     
    128128            <input type="hidden" name="ID2" value="'.$TextID.'" />';
    129129
    130             if($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user
     130            if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user
    131131              $Output .= '<select onchange="this.form.submit();" name="ID1">
    132132              <option value="-1">'.T('Select text for comparison').'</option>
    133133              <option value="-1">'.T('Show/compare all').'</option>';
    134134              $DataID = $this->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].')');
    135               while($Version = $DataID->fetch_array())
     135              while ($Version = $DataID->fetch_array())
    136136              {
    137                 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'.
     137                if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'.
    138138                 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' ('.T('taken over').')</option>';
    139139                else
    140140                {
    141                   if($Version['Language'] == 0) $Version['UserName'] = T('Original');
     141                  if ($Version['Language'] == 0) $Version['UserName'] = T('Original');
    142142                  $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.
    143143                      $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '.
     
    155155
    156156          // Special characters: $B - New line, $N - Name, $C - profession
    157           if($this->System->User->Licence(LICENCE_USER))
     157          if ($this->System->User->Licence(LICENCE_USER))
    158158          {
    159159            $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>';
    160160            // TODO: Remove fixed group id condition
    161           //  if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
     161          //  if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
    162162            $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&amp;group='.
    163163              $GroupId.'&amp;ID='.$LineAJ['ID']).'" target="_blank"  title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">'.T('Search in names').'</a>';
     
    169169          }
    170170
    171           if($TranslationTree[$GroupId]['WowheadName'] != '')
     171          if ($TranslationTree[$GroupId]['WowheadName'] != '')
    172172            $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName'].
    173173              '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>';
     
    187187          <td>'.T('Original').'</td>
    188188          <td>';
    189           if($Line['Language'] <> 0) $Language = $Line['Language'];
    190           else if($this->System->User->Id != 0)
     189          if ($Line['Language'] <> 0) $Language = $Line['Language'];
     190          else if ($this->System->User->Id != 0)
    191191          {
    192192            $Language = $this->System->User->Language;
    193193          } else $Language = 0;
    194           if($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);
     194          if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);
    195195            else {
    196196            $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')');
    197             if($DbResult3->num_rows > 0)
     197            if ($DbResult3->num_rows > 0)
    198198            {
    199199              $Language = $DbResult3->fetch_assoc();
     
    209209             '<script>';
    210210          $Output .=    '$(document).ready(function() {';
    211           foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     211          foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    212212            $Output .=   '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");';
    213213
     
    215215            '</script>';
    216216
    217           foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    218             if($TextItem['Visible'] == 1)
     217          foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     218            if ($TextItem['Visible'] == 1)
    219219            {
    220               if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))
     220              if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))
    221221              {
    222                 if(($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))
     222                if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))
    223223                  $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>';
    224224                else $Output .= '<tr><th>'.T($TextItem['Name']).'</th>';
    225225                $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td>
    226226                <td>';
    227                 if($this->System->User->Licence(LICENCE_USER))
     227                if ($this->System->User->Licence(LICENCE_USER))
    228228                  $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">';
    229229                $Output .=  htmlspecialchars($Line[$TextItem['Column']]);
    230                 if($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';
     230                if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';
    231231              }
    232232            } else
     
    235235            }
    236236            $Output .= '</table></div>';
    237             if($this->System->User->Licence(LICENCE_USER)) {
     237            if ($this->System->User->Licence(LICENCE_USER)) {
    238238              $Output .= '</form>';
    239239
    240               if(isset($this->System->Config['Web']['EnableGoogleTranslate']) and
     240              if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and
    241241                $this->System->Config['Web']['EnableGoogleTranslate'])
    242242              {
    243243              $Output .= '<br/><table class="BaseTable">'.
    244244              '<tr><th>'.T('Google translator').':</th><th>'.T('Not translated').'</th><th>'.T('Translated').'</th>';
    245               foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    246                 if($TextItem['Visible'] == 1)
     245              foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     246                if ($TextItem['Visible'] == 1)
    247247                  if ($LineAJ[$TextItem['Column']] <> '')
    248248                    $Output .= '<tr><td>'.$TextItem['Column'].'</td>'.
     
    256256      }
    257257    } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL);
    258     return($Output);
     258    return $Output;
    259259  }
    260260
     
    263263    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    264264
    265     if($this->System->User->Licence(LICENCE_MODERATOR))
     265    if ($this->System->User->Licence(LICENCE_MODERATOR))
    266266    {
    267267      $GroupId = LoadGroupIdParameter();
     
    273273      $this->System->ModuleManager->Modules['Log']->WriteLog('Překlad byl smazán! <a href="'.$this->System->Link('/form.php?group='.$this->GroupId.'&amp;ID='.$TextID).'">'.$TextID.'</a>', LOG_TYPE_MODERATOR);
    274274    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    275     return($Output);
     275    return $Output;
    276276  }
    277277}
  • trunk/Modules/Translation/LoadNames.php

    r859 r880  
    1818    }
    1919  //   }
    20     return ($Text);
     20    return $Text;
    2121  }
    2222  function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group)
     
    2626    $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'.
    2727      $this->System->Link('/form.php?group='.$Group.'&amp;ID='.$ID).'">'.$orig_replace.'</a></span>',$Text);
    28     return ($Text);
     28    return $Text;
    2929  }
    3030
     
    4444    $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text);
    4545    $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text);
    46     foreach($names as $Line) {
     46    foreach ($names as $Line) {
    4747     if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId']))
    4848      if ($Line[3] <> '')  {
     
    6161
    6262    $Output = '';
    63     if(array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];
    64       else return(ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL));
    65     if(!array_key_exists('ID', $_GET)) return(ShowMessage(T('ID not specified'), MESSAGE_CRITICAL));
    66     if(!array_key_exists('Column', $_GET)) return(ShowMessage(T('Column not specified'), MESSAGE_CRITICAL));
     63    if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];
     64      else return ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL);
     65    if (!array_key_exists('ID', $_GET)) return ShowMessage(T('ID not specified'), MESSAGE_CRITICAL);
     66    if (!array_key_exists('Column', $_GET)) return ShowMessage(T('Column not specified'), MESSAGE_CRITICAL);
    6767    $Table = $TranslationTree[$GroupId]['TablePrefix'];
    6868    $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1');
     
    7373          $names = array();
    7474          if ($this->System->User->Licence(LICENCE_USER))
    75           if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
     75          if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
    7676          {
    7777            //<span class="edit">barvou.</span>
    7878            $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
    7979          } else {
    80             if(($GroupId == 13)) {
     80            if (($GroupId == 13)) {
    8181              $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text',
    8282                'TextGlobalString' => 'Text', 'TextArea' => 'Name',
     
    8787          }
    8888                                   //$LineAJ[$Column]
    89           return ($this->ColorNames(htmlspecialchars($Text),$names));
     89          return $this->ColorNames(htmlspecialchars($Text),$names);
    9090    }
    9191
     
    9393  {
    9494    $this->RawPage = true;
    95     return(str_replace("\n", '<br/>', $this->LoadNames()));
     95    return str_replace("\n", '<br/>', $this->LoadNames());
    9696  }
    9797}
  • trunk/Modules/Translation/Progress.php

    r847 r880  
    88
    99    $BuildNumber = GetBuildNumber($_SESSION['StatVersion']);
    10     if(is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';
     10    if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';
    1111    else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')';
    1212
     
    1414    $Query = '';
    1515    $DbResult = $this->Database->query($GroupListQuery);
    16     if($DbResult->num_rows > 0)
     16    if ($DbResult->num_rows > 0)
    1717    {
    18       while($DbRow = $DbResult->fetch_assoc())
     18      while ($DbRow = $DbResult->fetch_assoc())
    1919      {
    2020        $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    5050      $Total = 0;
    5151      $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    52       while($Group = $DbResult->fetch_assoc())
     52      while ($Group = $DbResult->fetch_assoc())
    5353      {
    5454        $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';
     
    5656        $Total += $Group['Total'];
    5757      }
    58       if($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);
     58      if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);
    5959      else $TotalCount = 0;
    6060      $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $TotalCount).'</strong></td></tr>'.
    6161          '</table>';
    6262    }
    63     return($Output);
     63    return $Output;
    6464  }
    6565
     
    6969    $LanguageList = GetLanguageList();
    7070
    71     if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
    72     if(!array_key_exists('StatVersion', $_SESSION))
     71    if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
     72    if (!array_key_exists('StatVersion', $_SESSION))
    7373    {
    74       if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))
     74      if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))
    7575      {
    7676        $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame;
     
    8080    }
    8181
    82     if(!isset($_SESSION['language']))
     82    if (!isset($_SESSION['language']))
    8383    {
    84       if($this->System->User->Licence(LICENCE_USER))
     84      if ($this->System->User->Licence(LICENCE_USER))
    8585      {
    8686        $_SESSION['language'] = $this->System->User->Language;
     
    8989      }
    9090    }
    91     if(array_key_exists('language', $_GET))
     91    if (array_key_exists('language', $_GET))
    9292    {
    93       if($_GET['language'] == '') {
     93      if ($_GET['language'] == '') {
    9494        $_SESSION['language'] = '';
    9595      } else {
     
    9797      }
    9898    }
    99     if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
     99    if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
    100100
    101101    // Show client version selection
    102102    $Output = T('Client version:').' ';
    103103    $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');
    104     while($DbRow = $DbResult->fetch_assoc())
     104    while ($DbRow = $DbResult->fetch_assoc())
    105105      $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> ';
    106106    $Output .= '<br/>';
     
    109109    $Output .= T('Language:').' ';
    110110    $Lang = '<a href="?language=">'.T('All').'</a>';
    111     if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
     111    if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
    112112      else $Output .= $Lang;
    113     foreach($LanguageList as $Language)
    114     if($Language['Enabled'] == 1)
     113    foreach ($LanguageList as $Language)
     114    if ($Language['Enabled'] == 1)
    115115    {
    116116      $Lang = ' <a href="?language='.$Language['Id'].'">'.T($Language['Name']).'</a>';
    117       if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
     117      if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
    118118        else $Output .= $Lang;
    119119    }
    120120
    121     if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
     121    if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
    122122      else $LanguageName = T('All');
    123123    $Output .= '<br/><br/><h3>'.sprintf(T('Statistics of translation completion of language %s for version %s'), T($LanguageName), $_SESSION['StatVersion']).'</h3><br/>';
    124124    $Output .= $this->ShowStatTable();
    125125
    126     return($Output);
     126    return $Output;
    127127  }
    128128}
  • trunk/Modules/Translation/Save.php

    r859 r880  
    1111    // Get source text record from database by ID
    1212    $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID`='.$TextID);
    13     if($DbResult->num_rows > 0)
     13    if ($DbResult->num_rows > 0)
    1414    {
    1515      $SourceText = $DbResult->fetch_assoc();
     
    1919          'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '.
    2020          'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');
    21       if($DbResult->num_rows > 0)
     21      if ($DbResult->num_rows > 0)
    2222      {
    2323        $EnglishText = $DbResult->fetch_assoc();
     
    2525        // Get all similar english texts
    2626        $Filter = array();
    27         foreach($Group['Items'] as $GroupItem)
     27        foreach ($Group['Items'] as $GroupItem)
    2828        {
    29           if(($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))
     29          if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))
    3030            $Filter[] = '(`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")';
    3131        }
    32         if(count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';
     32        if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';
    3333          else $Filter = ' AND 0';
    3434
    3535          $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter;
    3636          $DbResult = $this->Database->query($Query);
    37           while($EnglishFound = $DbResult->fetch_assoc())
     37          while ($EnglishFound = $DbResult->fetch_assoc())
    3838          {
    3939            // Get user translation paired to found english item entry
     
    4141              ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart'].
    4242              ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')');
    43             if($DbResult2->num_rows > 0)
     43            if ($DbResult2->num_rows > 0)
    4444            {
    4545              // Update existed user translation
     
    4747              $Modified = false;
    4848              $Values = '`Language` = '.$Language;
    49               if($Language != $ExistedText['Language']) $Modified = true;
     49              if ($Language != $ExistedText['Language']) $Modified = true;
    5050
    5151              $Completable = true;
    5252              $CompleteParts = $ExistedText['CompleteParts'];
    53               foreach($Group['Items'] as $GroupItem)
    54               {
    55                 if($GroupItem['Visible'] == 1)
    56                 {
    57                   if($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
     53              foreach ($Group['Items'] as $GroupItem)
     54              {
     55                if ($GroupItem['Visible'] == 1)
     56                {
     57                  if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
    5858                  {
    59                     if(array_key_exists($GroupItem['Column'], $_POST))
     59                    if (array_key_exists($GroupItem['Column'], $_POST))
    6060                    {
    61                       if($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])
     61                      if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])
    6262                        $Modified = true;
    6363
     
    6666                    }
    6767                  }
    68                   if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and
     68                  if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and
    6969                      ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;
    7070                }
    7171              }
    72               if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
     72              if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
    7373                else $NewComplete = 0;
    7474
    7575              // Update completion status for edited translation item
    76               if($SourceText['ID'] == $ExistedText['ID'])
     76              if ($SourceText['ID'] == $ExistedText['ID'])
    7777              {
    7878                $NewComplete = $Complete; // Our original user text, set complete according user choice
    79                 if($Complete == 1)
    80                 {
    81                   foreach($Group['Items'] as $GroupItem)
    82                     if($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
     79                if ($Complete == 1)
     80                {
     81                  foreach ($Group['Items'] as $GroupItem)
     82                    if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
    8383                }
    8484              }
    8585              $Values .= ', `Complete`='.$NewComplete.', `CompleteParts` = '.$CompleteParts;
    86               if(($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))
     86              if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))
    8787                $Modified = true;
    8888
    8989              $Values .= ', `ModifyTime` = NOW()';
    90               if($Modified)
     90              if ($Modified)
    9191              {
    9292                // Update user translation
     
    114114              $CompleteParts = 0;
    115115              $Completable = true;
    116               foreach($Group['Items'] as $GroupItem)
     116              foreach ($Group['Items'] as $GroupItem)
    117117              {
    118118                $Columns .= ', `'.$GroupItem['Column'].'`';
    119                 if($GroupItem['Visible'] == 1)
    120                 {
    121                   if($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
     119                if ($GroupItem['Visible'] == 1)
     120                {
     121                  if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])
    122122                  {
    123123                    // Read form user data
    124                     if(array_key_exists($GroupItem['Column'], $_POST))
     124                    if (array_key_exists($GroupItem['Column'], $_POST))
    125125                    {
    126126                      $Values .= ', "'.$_POST[$GroupItem['Column']].'"';
     
    128128                    } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"';
    129129                  } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"';
    130                   if((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;
     130                  if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;
    131131                } else
    132132                {
     
    135135                }
    136136              }
    137               if($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
     137              if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed
    138138                else $NewComplete = 0;
    139139              // Update completion status for edited translation item
    140               if($SourceText['ID'] == $EnglishFound['ID'])
     140              if ($SourceText['ID'] == $EnglishFound['ID'])
    141141              {
    142142                $TakeID = $TextID;
    143143                $NewComplete = $Complete; // Our original user text, set complete according user choice
    144                 if($Complete == 1)
    145                 {
    146                   foreach($Group['Items'] as $GroupItem)
    147                     if($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
     144                if ($Complete == 1)
     145                {
     146                  foreach ($Group['Items'] as $GroupItem)
     147                    if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));
    148148                }
    149149              }
     
    171171      } else $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL);
    172172    } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL);
    173     return($Output);
     173    return $Output;
    174174  }
    175175
     
    183183    unset($Message);
    184184    $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm();
    185     if(isset($Message)) $Output .= ShowMessage($Message, $MessageType);
     185    if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);
    186186
    187187    $GroupId = LoadGroupIdParameter();
    188188    $Group = $TranslationTree[$GroupId];
    189189    $Table = $Group['TablePrefix'];
    190     if($this->System->User->Licence(LICENCE_USER))
    191     {
    192       if(array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))
     190    if ($this->System->User->Licence(LICENCE_USER))
     191    {
     192      if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))
    193193      {
    194194        $Entry = $_POST['entry'] * 1;
    195195        $TextID = $_POST['ID'] * 1;
    196196        $Language = $_POST['Language'] * 1;
    197         if(array_key_exists('End', $_POST)) $Complete = 1;
     197        if (array_key_exists('End', $_POST)) $Complete = 1;
    198198          else $Complete = 0;
    199199
     
    207207    {
    208208      // User automatically logged out. Show login dialog and allow to save retry.
    209       if(array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST))
     209      if (array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST))
    210210      {
    211211        $Output .= 'Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'.
     
    216216          '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />';
    217217
    218         foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     218        foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    219219        {
    220           if(array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = '';
     220          if (array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = '';
    221221          $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />';
    222222        }
     
    232232      } else $Output = ShowMessage('Nezadány požadované údaje.', MESSAGE_CRITICAL);
    233233    }
    234     return($Output);
     234    return $Output;
    235235  }
    236236
     
    246246    $redirecting = $DbResult->fetch_assoc();
    247247
    248     switch($redirecting['Redirecting'])
     248    switch ($redirecting['Redirecting'])
    249249    {
    250250      case 1:
     
    254254        break;
    255255      case 2:
    256         if($next <> '')
     256        if ($next <> '')
    257257          $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    258258            'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'.
     
    260260          break;
    261261      case 3:
    262         if($prev <> '')
     262        if ($prev <> '')
    263263          $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    264264            'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'.
     
    269269    $Output .= sprintf(T('You can be redirected automatically from this page. You can set where you want to be transfered here: %s'), '<a href="'.
    270270      $this->System->Link('/options/').'" title="'.T('User settings').'">'.T('Options').'</a>');
    271     return($Output);
     271    return $Output;
    272272  }
    273273}
  • trunk/Modules/Translation/Translation.php

    r861 r880  
    4747      'Icon' => '',
    4848    ));
    49     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     49    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    5050    {
    5151      $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    52       foreach($TranslationTree as $Group)
     52      foreach ($TranslationTree as $Group)
    5353      {
    5454        $Table = $Group['TablePrefix'];
    5555
    5656        $Columns = array('ID', 'Entry');
    57         foreach($Group['Items'] as $Item)
     57        foreach ($Group['Items'] as $Item)
    5858        {
    59           if($Item['Column'] != '') $Columns[] = $Item['Column'];
     59          if ($Item['Column'] != '') $Columns[] = $Item['Column'];
    6060        }
    6161
     
    7474    $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '.
    7575    'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
    76     while($DbRow = $DbResult->fetch_assoc())
     76    while ($DbRow = $DbResult->fetch_assoc())
    7777    {
    7878      $Items[] = array
     
    9292      'Items' => $Items,
    9393    ));
    94     return($Output);
     94    return $Output;
    9595  }
    9696
     
    105105    $UnionItems = array();
    106106    $DbResult = $this->Database->query($GroupListQuery);
    107     if($DbResult->num_rows > 0)
    108     {
    109       while($DbRow = $DbResult->fetch_assoc())
     107    if ($DbResult->num_rows > 0)
     108    {
     109      while ($DbRow = $DbResult->fetch_assoc())
    110110      {
    111111        $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '.
     
    122122      $DbResult = $this->Database->query($Query);
    123123      $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('Who').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>';
    124       while($DbRow = $DbResult->fetch_assoc())
     124      while ($DbRow = $DbResult->fetch_assoc())
    125125      {
    126126        $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'.
     
    133133    }
    134134    $Output .= '</div>';
    135     return($Output);
     135    return $Output;
    136136  }
    137137
    138138  function GetTranslationTree()
    139139  {
    140     if(isset($this->TranslationTree)) return($this->TranslationTree);
     140    if (isset($this->TranslationTree)) return $this->TranslationTree;
    141141    else {
    142142      $Result = array();
    143143      $Groups = array();
    144144      $DbResult = $this->System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`');
    145       while($DbRow = $DbResult->fetch_assoc())
     145      while ($DbRow = $DbResult->fetch_assoc())
    146146        $Groups[T($DbRow['Name'])] = $DbRow;
    147147      ksort($Groups);
    148       foreach($Groups as $Group)
     148      foreach ($Groups as $Group)
    149149      {
    150150        $Group['Items'] = array();
     
    153153      }
    154154      $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');
    155       while($DbRow = $DbResult->fetch_assoc())
     155      while ($DbRow = $DbResult->fetch_assoc())
    156156      {
    157157        $Result[$DbRow['Group']]['Items'][] = $DbRow;
    158158      }
    159159      $this->TranslationTree = $Result;
    160       return($Result);
     160      return $Result;
    161161    }
    162162  }
     
    168168    $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">';
    169169    $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`');
    170     while($Group = $DbResult->fetch_assoc())
     170    while ($Group = $DbResult->fetch_assoc())
    171171    {
    172172      $Groups[T($Group['Name'])] = $Group;
    173173    }
    174174    ksort($Groups);
    175     foreach($Groups as $Group)
     175    foreach ($Groups as $Group)
    176176    {
    177177      $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'.
     
    183183        '&nbsp;<a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'.
    184184        $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=2&amp;user=0&amp;entry=&amp;text=').'">'.T('Translated').'</a><br />';
    185       if(isset($this->System->User) and $this->System->User->Licence(LICENCE_USER))
     185      if (isset($this->System->User) and $this->System->User->Licence(LICENCE_USER))
    186186      {
    187187        $Output .= '&nbsp;<a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;state=3').'">'.T('Unfinished').'</a><br />'.
     
    196196    }
    197197    $Output .= '</div>';
    198     return($Output);
     198    return $Output;
    199199  }
    200200}
  • trunk/Modules/Translation/TranslationList.php

    r859 r880  
    4747    );
    4848    foreach ($StateTypes as $index => $StateType) {
    49       if($Filter['State'] == $index) $Selected = ' selected="selected"';
     49      if ($Filter['State'] == $index) $Selected = ' selected="selected"';
    5050      else $Selected = '';
    5151      $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>';
     
    5454
    5555    // Translation group
    56     if($GroupId == 0)
     56    if ($GroupId == 0)
    5757    {
    5858      $Filter['Group'] = GetParameter('group', 0, true, true);
    59       if($Filter['Group'] != 0)
     59      if ($Filter['Group'] != 0)
    6060      {
    61         if(isset($TranslationTree[$Filter['Group']]) == false)
     61        if (isset($TranslationTree[$Filter['Group']]) == false)
    6262          ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
    6363        $Table = $TranslationTree[$Filter['Group']]['TablePrefix'];
     
    7070
    7171    $Output .= '<td><select name="group" style="width: 80px">';
    72     if($Filter['Group'] == 0) $Selected = ' selected="selected"';
     72    if ($Filter['Group'] == 0) $Selected = ' selected="selected"';
    7373    else $Selected = '';
    7474    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    7575    $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`');
    76     while($Group = $DbResult->fetch_assoc())
     76    while ($Group = $DbResult->fetch_assoc())
    7777      $Groups[T($Group['Name'])] = $Group;
    7878    ksort($Groups);
    79     foreach($Groups as $Group)
    80     {
    81       if($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';
     79    foreach ($Groups as $Group)
     80    {
     81      if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';
    8282      else $Selected = '';
    8383      $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>';
     
    8989    else
    9090      $Filter['Version'] = GetParameter('version', 0, true, true);
    91     if($Filter['Version'] != 0)
     91    if ($Filter['Version'] != 0)
    9292    {
    9393      $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')');
    94       if($DbResult->num_rows > 0)
     94      if ($DbResult->num_rows > 0)
    9595      {
    9696        $DbRow = $DbResult->fetch_assoc();
     
    9999    }
    100100    $Output .= '<td><select name="version">';
    101     if($Filter['Version'] == 0) $Selected = ' selected="selected"';
     101    if ($Filter['Version'] == 0) $Selected = ' selected="selected"';
    102102    else $Selected = '';
    103103    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    104104    $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC');
    105     while($Version = $DbResult->fetch_assoc())
    106     {
    107       if($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';
     105    while ($Version = $DbResult->fetch_assoc())
     106    {
     107      if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';
    108108      else $Selected = '';
    109109      $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>';
    110110    }
    111111    $Output .= '</select></td>';
    112     if($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';
     112    if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';
    113113    else $VersionFilter = '';
    114114    //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry)
     
    117117    $Filter['Language'] = GetParameter('lang', 0, true, true);
    118118    $Output .= '<td><select name="lang">';
    119     if($Filter['Language'] == 0) $Selected = ' selected="selected"';
     119    if ($Filter['Language'] == 0) $Selected = ' selected="selected"';
    120120    else $Selected = '';
    121121    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    122122    $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`');
    123     while($Language = $DbResult->fetch_assoc())
    124     {
    125       if($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';
     123    while ($Language = $DbResult->fetch_assoc())
     124    {
     125      if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';
    126126      else $Selected = '';
    127127      $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>';
     
    130130    $LanguageFilter = '';
    131131    $LanguageFilterSub = '';
    132     if($Filter['Language'] != 0) {
     132    if ($Filter['Language'] != 0) {
    133133      $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')';
    134134      $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')';
     
    138138    $Filter['User'] = GetParameter('user', 0, true, true);
    139139    $Output .= '<td><select name="user" style="width: 80px">';
    140     if($Filter['User'] == 0) $Selected = ' selected="selected"';
     140    if ($Filter['User'] == 0) $Selected = ' selected="selected"';
    141141    else $Selected = '';
    142142    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    143143    $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`');
    144     while($User = $DbResult->fetch_assoc())
    145     {
    146       if($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';
     144    while ($User = $DbResult->fetch_assoc())
     145    {
     146      if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';
    147147      else $Selected = '';
    148148      $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>';
    149149    }
    150150    $Output .= '</select></td>';
    151     if($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';
     151    if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';
    152152    else $UserFilter = '';
    153153
     
    155155    $Filter['Text'] = GetParameter('text', '', false, true);
    156156    $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>';
    157     if($Filter['Text'] != '')
     157    if ($Filter['Text'] != '')
    158158    {
    159159      $Items = array('(`T`.`ID` LIKE "%'.$Filter['Text'].'%")', '(`T`.`Entry` LIKE "%'.$Filter['Text'].'%")');
    160       if($Filter['Group'] != 0)
    161         foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
    162         if($GroupItem['Visible'] == 1)
     160      if ($Filter['Group'] != 0)
     161        foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
     162        if ($GroupItem['Visible'] == 1)
    163163        $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")';
    164164      $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')';
     
    168168    $Filter['Entry'] = GetParameter('entry', '', false, true);
    169169    $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>';
    170     if($Filter['Entry'] != '')
     170    if ($Filter['Entry'] != '')
    171171    {
    172172      $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")';
    173173    }
    174174
    175     if($Filter['Group'] != 0)
     175    if ($Filter['Group'] != 0)
    176176    {
    177177        $WithoutAlter =       ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
     
    179179          ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '.
    180180          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) ';
    181         foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
    182           if($GroupItem['Visible'] == 1) {
     181        foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)
     182          if ($GroupItem['Visible'] == 1) {
    183183            $ItemsVar[] =    'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`,  \'$\',  \'\' ) ) '.
    184184                           ' < ('.
     
    188188                              ')';
    189189          }
    190       if($Filter['State'] == CompletionState::All) {
     190      if ($Filter['State'] == CompletionState::All) {
    191191        $Filter['SQL'] .= $UserFilter.$VersionFilter;
    192192      } else
    193       if($Filter['State'] == CompletionState::NotTranslated) {
     193      if ($Filter['State'] == CompletionState::NotTranslated) {
    194194        $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '.
    195195          'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
     
    198198          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))';
    199199      } else
    200       if($Filter['State'] == CompletionState::Translated) {
     200      if ($Filter['State'] == CompletionState::Translated) {
    201201        $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)';
    202202      } else
    203       if($Filter['State'] == CompletionState::NotFinished) {
     203      if ($Filter['State'] == CompletionState::NotFinished) {
    204204        $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    205205      ') AND (`T`.`Complete` = 0)';
    206206      } else
    207       if($Filter['State'] == CompletionState::Original) {
     207      if ($Filter['State'] == CompletionState::Original) {
    208208        $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')';
    209209      } else
    210       if($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
     210      if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
    211211        $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter.
    212212      ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    213213      ') AND (`T`.`Complete` = 0)';
    214214      } else
    215       if($Filter['State'] == CompletionState::Missing1) {
     215      if ($Filter['State'] == CompletionState::Missing1) {
    216216        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    217217        $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') ';
    218218      } else
    219       if($Filter['State'] == CompletionState::Missing2) {
     219      if ($Filter['State'] == CompletionState::Missing2) {
    220220        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    221221        $Filter['SQL'] .= ' '. $WithoutAlter;
     
    226226    /*
    227227     // Ownership
    228     if(array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];
     228    if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];
    229229    else $Filter['Owner'] = 0;
    230230    $Output .= ' <td><select name="owner">';
    231     if($Filter['Owner'] == 0) $Selected = ' selected="selected"';
     231    if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';
    232232    else $Selected = '';
    233233    $Output .= '<option value="0"'.$Selected.'>Všech</option>';
    234     if($Filter['Owner'] == 1) $Selected = ' selected="selected"';
     234    if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';
    235235    else $Selected = '';
    236236    $Output .= '<option value="1"'.$Selected.'>Překladatelův tým</option>';
    237     if($Filter['Owner'] == 2) $Selected = ' selected="selected"';
     237    if ($Filter['Owner'] == 2) $Selected = ' selected="selected"';
    238238    else $Selected = '';
    239239    $Output .= '<option value="2"'.$Selected.'>Překladatele</option>';
    240240    $Output .= '</select></td>';
    241     if(($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';
     241    if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';
    242242    */
    243243
     
    246246    $Output .= '</form><br/>';
    247247    $Filter['Output'] = $Output;
    248     return($Filter);
     248    return $Filter;
    249249  }
    250250
     
    289289
    290290    $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']);
    291     while($Line = $DbResult->fetch_assoc())
     291    while ($Line = $DbResult->fetch_assoc())
    292292    {
    293293      $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&amp;ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'.
     
    305305    $Output .= '</table>'.
    306306        $PageList['Output'];
    307     return($Output);
     307    return $Output;
    308308  }
    309309
     
    316316    $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>';
    317317    $Total = 0;
    318     foreach($TranslationTree as $Group)
    319       if($Group['TablePrefix'] != '')
     318    foreach ($TranslationTree as $Group)
     319      if ($Group['TablePrefix'] != '')
    320320      {
    321321        $Filter = $this->ShowFilter($Group['Id']);
     
    328328      $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'.
    329329          '</table>';
    330       return($Output);
     330      return $Output;
    331331  }
    332332
     
    336336
    337337    $GroupId = GetParameter('group', 0, true);
    338     if($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);
     338    if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);
    339339    else {
    340340      $Table = $TranslationTree[$GroupId]['TablePrefix'];
     
    351351          '<td>'.T('Texts marked as unfinished').'</td></tr>';
    352352
    353       if($this->System->User->Licence(LICENCE_USER))
     353      if ($this->System->User->Licence(LICENCE_USER))
    354354      {
    355355        $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&amp;state=3&amp;user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td>
     
    373373      $Output .= '</table>';
    374374    }
    375     return($Output);
     375    return $Output;
    376376  }
    377377
     
    380380    $this->Title = T('Translation groups');
    381381    $Action = GetParameter('action', '');
    382     if($Action == 'filter') $Output = $this->ShowMenu();
     382    if ($Action == 'filter') $Output = $this->ShowMenu();
    383383    else
    384384    {
    385385      $Filter = $this->ShowFilter();
    386       if($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
     386      if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
    387387        else $Output = $this->ShowGroupList($Filter);
    388388    }
    389     return($Output);
     389    return $Output;
    390390  }
    391391}
     
    409409      array('Name' => 'LastVersion', 'Title' => T('Version of last import')),
    410410   );
    411    if($this->System->User->Licence(LICENCE_ADMIN))
     411   if ($this->System->User->Licence(LICENCE_ADMIN))
    412412   $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));
    413413
     
    416416
    417417   $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    418    while($Group = $DbResult->fetch_assoc())
     418   while ($Group = $DbResult->fetch_assoc())
    419419   {
    420420     $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">'.T($Group['Name']).'</a></td>'.
    421421       '<td>'.$Group['SourceType'].'</td><td>';
    422      if($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
    423      if($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
    424      if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
     422     if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';
     423     if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';
     424     if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';
    425425     $Output .= '</td>';
    426      if($this->System->User->Licence(LICENCE_ADMIN))
     426     if ($this->System->User->Licence(LICENCE_ADMIN))
    427427       $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.
    428428     $Group['Id'].'&amp;type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';
     
    430430     $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.
    431431       GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';
    432      if($this->System->User->Licence(LICENCE_ADMIN))
     432     if ($this->System->User->Licence(LICENCE_ADMIN))
    433433       $Output .= '<td><a href="?action=groupdelete&amp;id='.$Group['Id'].'">'.T('Remove').'</a></td>';
    434434     $Output .= '</tr>';
     
    436436    $Output .= '</table>'.
    437437      '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>';
    438     if($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';
    439     return($Output);
     438    if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';
     439    return $Output;
    440440  }
    441441
    442442  function ShowGroupAdd()
    443443  {
    444     if($this->System->User->Licence(LICENCE_ADMIN))
     444    if ($this->System->User->Licence(LICENCE_ADMIN))
    445445    {
    446446      $Output = '<h3>Vložení nové překladové skupiny</h3>'.
     
    452452          '</table></form>';
    453453    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    454     return($Output);
     454    return $Output;
    455455  }
    456456
    457457  function ShowGroupAddFinish()
    458458  {
    459     if($this->System->User->Licence(LICENCE_ADMIN))
     459    if ($this->System->User->Licence(LICENCE_ADMIN))
    460460    {
    461461      $TableName = 'Text'.$_POST['TablePrefix'];
    462462      $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"');
    463       if($DbResult->num_rows == 0)
     463      if ($DbResult->num_rows == 0)
    464464      {
    465465
     
    500500      $Output .= $this->ShowList();
    501501    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    502     return($Output);
     502    return $Output;
    503503  }
    504504
    505505  function ShowGroupDelete()
    506506  {
    507     if($this->System->User->Licence(LICENCE_ADMIN))
     507    if ($this->System->User->Licence(LICENCE_ADMIN))
    508508    {
    509509      $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']);
    510       if($DbResult->num_rows == 1)
     510      if ($DbResult->num_rows == 1)
    511511      {
    512512        $Group = $DbResult->fetch_assoc();
     
    518518    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    519519    $Output .= $this->ShowList();
    520     return($Output);
     520    return $Output;
    521521  }
    522522
     
    525525    $this->Title = T('Translation groups');
    526526    $Action = GetParameter('action', '');
    527     if($Action == 'groupadd') $Output = $this->ShowGroupAdd();
    528     else if($Action == 'groupdelete') $Output = $this->ShowGroupDelete();
    529     else if($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();
     527    if ($Action == 'groupadd') $Output = $this->ShowGroupAdd();
     528    else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete();
     529    else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();
    530530    else $Output = $this->ShowList();
    531     return($Output);
     531    return $Output;
    532532  }
    533533}
  • trunk/Modules/Translation/UserLevel.php

    r859 r880  
    1111  $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú",
    1212  "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž");
    13   for($i = 0; $i < count($Diakrit); $i = $i + 1)
     13  for ($i = 0; $i < count($Diakrit); $i = $i + 1)
    1414  {
    15     if(strpos($Word, $Diakrit[$i]) <> false)
     15    if (strpos($Word, $Diakrit[$i]) <> false)
    1616      $Result = true;
    1717  }
    18   return($Result);
     18  return $Result;
    1919}
    2020
     
    2626
    2727  $xp = 0;
    28   foreach($TranslationTree as $Group)
     28  foreach ($TranslationTree as $Group)
    2929  {
    30     if($Group['TablePrefix'] != '')
     30    if ($Group['TablePrefix'] != '')
    3131    {
    3232      $GroupBy = 'GROUP BY ';
    3333      $TakeColumns = '';
    34       foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
     34      foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
    3535      {
    3636        $GroupBy .= '`T`.`'.$TextItem['Column'].'`, ';
     
    4242        'LEFT JOIN `'.$Group['TablePrefix'].'` AS `T2` ON `T2`.`ID` = `T`.`Take` '.
    4343        'WHERE (`T`.`User` = '.$UserId.') AND (`T`.`Complete` = 1) AND (`T`.`Take` IS NOT NULL) '.$GroupBy);
    44       while($Line = $IDtran->fetch_array())
     44      while ($Line = $IDtran->fetch_array())
    4545      {
    4646        $xp_translation = 0;
    4747        $translated = true;
    48         foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
     48        foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
    4949        {
    50           if(($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and
     50          if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and
    5151            (strlen($Line[$TextItem['Column']]) > (strlen($Line[$TextItem['Column'].'_Take']) * 0.5)))
    5252          {
    5353            $TextArr = explode(' ', $Line[$TextItem['Column']]);
    54             foreach($TextArr as $Word)
     54            foreach ($TextArr as $Word)
    5555            {
    56               if(CheckDiakrit($Word)) $indikator = $from_diakrit;
     56              if (CheckDiakrit($Word)) $indikator = $from_diakrit;
    5757                else $indikator = 1;
    5858              $xp_translation = $xp_translation + ($indikator * $xp_from_word);
     
    6565          }
    6666        }
    67         if($translated) $xp = $xp + $xp_translation;   // XP addition for entire translation if complete translated
     67        if ($translated) $xp = $xp + $xp_translation;   // XP addition for entire translation if complete translated
    6868      }
    6969    }
    7070  }
    71   return($xp);
     71  return $xp;
    7272}
    7373
     
    7979  // Main code for users
    8080  $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId);
    81   if($DbResult->num_rows > 0)
     81  if ($DbResult->num_rows > 0)
    8282  {
    83     while($LineUser = $DbResult->fetch_array())
     83    while ($LineUser = $DbResult->fetch_array())
    8484    {
    8585      // Build TranslatedCount query
    8686      $TranslatedCount = '(';
    87       if(count($TranslationTree) > 0)
     87      if (count($TranslationTree) > 0)
    8888      {
    89       foreach($TranslationTree as $Group)
    90         if($Group['TablePrefix'] != '')
     89      foreach ($TranslationTree as $Group)
     90        if ($Group['TablePrefix'] != '')
    9191        {
    9292          $Count = '(SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`Language` <> '.
  • trunk/Modules/User/Options.php

    r861 r880  
    1717        '<option value="0">'.T('Nowhere').'</option>'.
    1818        '<option value="1"';
    19     if($this->System->User->Redirecting == '1') $Output .= ' selected="selected"';
     19    if ($this->System->User->Redirecting == '1') $Output .= ' selected="selected"';
    2020    $Output .= '>'.T('To untranslated').'</option>';
    2121    $Output .= '<option value="2"';
    22     if($this->System->User->Redirecting == '2') $Output .= ' selected="selected"';
     22    if ($this->System->User->Redirecting == '2') $Output .= ' selected="selected"';
    2323    $Output .= '>'.T('To next translation').'</option>';
    2424    $Output .= '<option value="3"';
    25     if($this->System->User->Redirecting == '3') $Output .= ' selected="selected"';
     25    if ($this->System->User->Redirecting == '3') $Output .= ' selected="selected"';
    2626    $Output .= '>'.T('To previous translation').'</option>';
    2727    $Output .= '</select>';
     
    6060        '<input type="hidden" name="action" value="gointeam"/>'.
    6161        '<select name="id">';
    62     while($LineTeam = $DbResult->fetch_assoc())
     62    while ($LineTeam = $DbResult->fetch_assoc())
    6363    {
    6464      $Output .= '<option value="'.$LineTeam['Id'].'"';
     
    6969    </form>';
    7070    $Output .= '</fieldset>';
    71     return($Output);
     71    return $Output;
    7272  }
    7373
     
    7575  {
    7676    $Output = '';
    77     if(array_key_exists('Email', $_POST))
     77    if (array_key_exists('Email', $_POST))
    7878    {
    7979      $Email = $_POST['Email'];
     
    8484      $Redirecting = $_POST['redirecting'];
    8585      $PreferredVersion = $_POST['ClientVersion'];
    86       if($PreferredVersion == '') $PreferredVersion = null;
     86      if ($PreferredVersion == '') $PreferredVersion = null;
    8787      $Info = $_POST['info'];
    8888
    8989      // Do user want to change password?
    90       if(($OldPass != '') or ($NewPass != '') or ($NewPass2 != ''))
     90      if (($OldPass != '') or ($NewPass != '') or ($NewPass2 != ''))
    9191      {
    92         if($NewPass == $NewPass2)
     92        if ($NewPass == $NewPass2)
    9393        {
    9494          $DbResult = $this->System->Database->query('SELECT `Pass`, '.$this->System->User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$this->System->User->Id);
    9595          $DbRow = $DbResult->fetch_assoc();
    96           if($DbRow['Hash'] == $DbRow['Pass'])
     96          if ($DbRow['Hash'] == $DbRow['Pass'])
    9797          {
    9898            // Update password
     
    130130      $this->System->User->Load();
    131131    } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL);
    132     return($Output);
     132    return $Output;
    133133  }
    134134
     
    137137    $this->Title = T('User settings');
    138138    $Output = '';
    139     if($this->System->User->Licence(LICENCE_USER))
     139    if ($this->System->User->Licence(LICENCE_USER))
    140140    {
    141       if(array_key_exists('action', $_GET) and ($_GET['action'] == 'save'))
     141      if (array_key_exists('action', $_GET) and ($_GET['action'] == 'save'))
    142142      {
    143143        $Output .= $this->UserOptionsSave();
     
    145145      $Output .= $this->UserOptionsFrom();
    146146    } else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL);
    147     return($Output);
     147    return $Output;
    148148  }
    149149}
  • trunk/Modules/User/Profile.php

    r861 r880  
    66  {
    77    $Output = '';
    8     if(array_key_exists('text', $_POST))
    9     if($this->System->User->Licence(LICENCE_ADMIN))
     8    if (array_key_exists('text', $_POST))
     9    if ($this->System->User->Licence(LICENCE_ADMIN))
    1010    {
    1111      $Text = $_POST['text'];
     
    1616        'Text: <strong>'.$Text.'</strong><br />';
    1717
    18       if(@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].
     18      if (@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].
    1919        '\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))
    2020      {
     
    2323      else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL);
    2424    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    25     return($Output);
     25    return $Output;
    2626  }
    2727
     
    5757      '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '.
    5858      'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
    59     while($Export = $DbResult->fetch_assoc())
     59    while ($Export = $DbResult->fetch_assoc())
    6060    {
    6161      $Action = '<a href="'.$this->System->Link('/export/?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=0').'">'.T('Show').'</a> '.
    6262        '<a href="'.$this->System->Link('/export/?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=7').'">'.T('Export').'</a>';
    63       if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Really remove item?').'\');">'.T('Remove').'</a>';
    64       if($this->System->User->Id != null) $Action .= ' <a href="'.$this->System->Link('/export/?Action=Clone&amp;ExportId='.$Export['Id']).'" onclick="return confirmAction(\''.T('Really clone item?').'\');">'.T('Clone').'</a>';
     63      if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Really remove item?').'\');">'.T('Remove').'</a>';
     64      if ($this->System->User->Id != null) $Action .= ' <a href="'.$this->System->Link('/export/?Action=Clone&amp;ExportId='.$Export['Id']).'" onclick="return confirmAction(\''.T('Really clone item?').'\');">'.T('Clone').'</a>';
    6565      $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
    6666        '<td>'.htmlspecialchars($Export['Title']).'</td>'.
     
    7474
    7575    $Output .= '<div style="text-align: center;"><a href="'.$this->System->Link('/export/').'">'.T('Export page').'</a></div>';
    76     return($Output);
     76    return $Output;
    7777  }
    7878
     
    8686    $UnionItems = array();
    8787    $DbResult = $this->Database->query($GroupListQuery);
    88     if($DbResult->num_rows > 0)
    89     {
    90       while($DbRow = $DbResult->fetch_assoc())
     88    if ($DbResult->num_rows > 0)
     89    {
     90      while ($DbRow = $DbResult->fetch_assoc())
    9191      {
    9292        $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '.
     
    106106      $Output .= '<table class="BaseTable"><tr>'.
    107107        '<th>'.T('Date').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>';
    108       while($DbRow = $DbResult->fetch_assoc())
     108      while ($DbRow = $DbResult->fetch_assoc())
    109109      {
    110110        $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'.
     
    115115      $Output .= '</table>';
    116116    }
    117     return($Output);
     117    return $Output;
    118118  }
    119119
     
    130130      'JOIN `ForumThread` ON `ForumThread`.`ID` = `ForumText`.`Thread` '.
    131131      'WHERE `ForumText`.`User` = '.($_GET['user'] * 1).' ORDER BY `ForumText`.`Date` DESC LIMIT '.$Count);
    132     while($Line = $DbResult->fetch_assoc())
     132    while ($Line = $DbResult->fetch_assoc())
    133133      $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.htmlspecialchars($Line['ThreadName']).'</a><br />'.
    134134        '<strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> ';
    135135    $Output .= '</div>';
    136     return($Output);
     136    return $Output;
    137137  }
    138138
     
    151151      'WHERE `User`.`Id` = '.($_GET['user'] * 1);
    152152    $DbResult = $this->Database->query($Query);
    153     if($DbResult->num_rows > 0)
     153    if ($DbResult->num_rows > 0)
    154154    {
    155155      $UserLine = $DbResult->fetch_array();
     
    163163        T('Number of translated:').' <a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&amp;state=2&amp;group=0').'" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'.
    164164        T('Level:').' <strong>'.$XP['Level'].'</strong> '.T('experience:').' '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>';
    165       if($this->System->ModuleManager->ModuleRunning('Team') and ($UserLine['TeamName'] != ''))
     165      if ($this->System->ModuleManager->ModuleRunning('Team') and ($UserLine['TeamName'] != ''))
    166166        $Output .= T('Member of team:').' <a href="'.$this->System->Link('/team/?action=team&amp;id='.$UserLine['Team']).'"><strong>'.htmlspecialchars($UserLine['TeamName']).'</strong></a><br />';
    167167
     
    187187      '</tr></table>';
    188188    $Output .= '<br />'.$this->ShowLastForum().'<br />';
    189     if($this->System->User->Licence(LICENCE_MODERATOR))
     189    if ($this->System->User->Licence(LICENCE_MODERATOR))
    190190    {
    191191      $Output .= '<fieldset><legend>Moderování</legend>';
     
    243243      }
    244244    } else $Output .= ShowMessage('Uživatel nenalezen', MESSAGE_CRITICAL);
    245     return($Output);
     245    return $Output;
    246246  }
    247247
     
    250250    $this->Title = T('User profile');
    251251    $Output = $this->SendMail();
    252     if(array_key_exists('user', $_GET))
     252    if (array_key_exists('user', $_GET))
    253253    {
    254254      $Output .= $this->ShowProfile();
    255255    } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL);
    256     return($Output);
     256    return $Output;
    257257  }
    258258}
  • trunk/Modules/User/Registration.php

    r861 r880  
    55  function ShowForm()
    66  {
    7     if(array_key_exists('sc', $_POST)) $Human = true;
     7    if (array_key_exists('sc', $_POST)) $Human = true;
    88      else $Human = false;
    9     if(array_key_exists('user', $_POST)) $UserName = $_POST['user'];
     9    if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];
    1010      else $UserName = '';
    11     if(array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
     11    if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
    1212      else $Email = '';
    13     if(array_key_exists('Team', $_POST)) $Team = $_POST['Team'];
     13    if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'];
    1414      else $Team = '';
    15     if(array_key_exists('Language', $_POST)) $Language = $_POST['Language'];
     15    if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'];
    1616      else $Language = 1;
    1717
     
    2424    <tr>
    2525    <th class="Left">'.T('Are you human?').'</th>';
    26     if($Human) $Checked = ' checked="checked"';
     26    if ($Human) $Checked = ' checked="checked"';
    2727      else $Checked = '';
    2828    $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td>
     
    5050    <tr>
    5151    <th class="Left">'.T('I belong to team').':</th>';
    52     if($Team == '') $Selected = ' selected="selected"';
     52    if ($Team == '') $Selected = ' selected="selected"';
    5353      else $Selected = '';
    5454    $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>'.T('none').'</option>';
    5555    $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`');
    56     while($Line = $DbResult->fetch_assoc())
     56    while ($Line = $DbResult->fetch_assoc())
    5757    {
    58       if($Team == $Line['Id']) $Selected = ' selected="selected"';
     58      if ($Team == $Line['Id']) $Selected = ' selected="selected"';
    5959      else $Selected = '';
    6060      $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.htmlspecialchars($Line['Name']).'</option>';
     
    8181    </tr>
    8282    </table></fieldset></form>';
    83     return($Output);
     83    return $Output;
    8484  }
    8585
     
    9191    $ShowForm = true;
    9292
    93       if(array_key_exists('user', $_POST)) $UserName = $_POST['user'];
     93      if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];
    9494        else $UserName = '';
    95       if(array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];
     95      if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];
    9696        else $Pass = '';
    97       if(array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];
     97      if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];
    9898        else $Pass2 = '';
    99       if(array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
     99      if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];
    100100        else $Email = '';
    101       if(array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;
     101      if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;
    102102        else $Team = '';
    103       if(array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;
     103      if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;
    104104        else $Language = '';
    105       if(array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;
     105      if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;
    106106        else $PreferredVersion = '';
    107       if($PreferredVersion == '') $PreferredVersion = 'NULL';
    108       if(array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];
     107      if ($PreferredVersion == '') $PreferredVersion = 'NULL';
     108      if (array_key_exists('sc', $_POST)) $SpamCheck = $_POST['sc'];
    109109        else $SpamCheck = '';
    110110
    111       if($SpamCheck != '')
     111      if ($SpamCheck != '')
    112112      {
    113         if(($UserName != '') and ($Pass != '') and ($Pass2 != ''))
     113        if (($UserName != '') and ($Pass != '') and ($Pass2 != ''))
    114114        {
    115           if(!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))
     115          if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))
    116116          {
    117             if($Pass == $Pass2)
     117            if ($Pass == $Pass2)
    118118            {
    119119              $DbResult = $this->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")');
    120120              $Line = $DbResult->fetch_row();
    121               if(!$Line)
     121              if (!$Line)
    122122              {
    123                 if($Team == 0) $Team = 'NULL';
     123                if ($Team == 0) $Team = 'NULL';
    124124                $this->System->User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion);
    125125                $Output .= ShowMessage(T('Registration was successful'));
     
    154154      } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL);
    155155
    156       if($ShowForm) $Output .= $this->ShowForm();
    157       return($Output);
     156      if ($ShowForm) $Output .= $this->ShowForm();
     157      return $Output;
    158158  }
    159159
     
    162162    $this->Title = T('User registration');
    163163    $Output = '';
    164     if(array_key_exists('user', $_POST))
     164    if (array_key_exists('user', $_POST))
    165165    {
    166166      $Output .= $this->CheckRegistration();
    167167    } else $Output .= $this->ShowForm();
    168     return($Output);
     168    return $Output;
    169169  }
    170170}
  • trunk/Modules/User/User.php

    r871 r880  
    3434      'Icon' => '',
    3535    ), 0);
    36     if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     36    if (array_key_exists('Search', $this->System->ModuleManager->Modules))
    3737      $this->System->ModuleManager->Modules['Search']->RegisterSearch('user',
    3838      T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search='));
     
    4949      'WHERE (`ActivityTime` >= NOW() - 300) '.
    5050      'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');
    51     while($DbUser = $DbResult->fetch_assoc())
     51    while ($DbUser = $DbResult->fetch_assoc())
    5252    {
    5353      $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';
    5454      $Output .= $Name.'<br />';
    5555    }
    56     return($Output);
     56    return $Output;
    5757  }
    5858
     
    6060  {
    6161    $Output = '';
    62     if($this->System->User->Licence(LICENCE_USER))
     62    if ($this->System->User->Licence(LICENCE_USER))
    6363    {
    6464      //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team);
     
    7979        '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>';
    8080    }
    81     return($Output);
     81    return $Output;
    8282  }
    8383}
     
    104104      </table>
    105105      </fieldset></form>';
    106       return($Output);
     106      return $Output;
    107107  }
    108108}
     
    132132    $this->Database = &$System->Database;
    133133    $this->OnlineStateTimeout = 600; // in seconds
    134     if(isset($_SESSION)) $this->Check();
     134    if (isset($_SESSION)) $this->Check();
    135135  }
    136136
     
    144144    $DbResult = $this->Database->query('SELECT `ID` FROM `User` WHERE '.
    145145      'LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`'));
    146     if($DbResult->num_rows > 0)
     146    if ($DbResult->num_rows > 0)
    147147    {
    148148      $User = $DbResult->fetch_assoc();
     
    151151      // Prepare cookies for permanent login
    152152      $StayLoggedSalt = $this->GetPasswordSalt();
    153       if($StayLogged == true) $StayLoggedValue = 1; else $StayLoggedValue = 0;
     153      if ($StayLogged == true) $StayLoggedValue = 1; else $StayLoggedValue = 0;
    154154      $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array(
    155155        'User' => $User['ID'], 'StayLogged' => $StayLoggedValue, 'StayLoggedHash' => $StayLoggedSalt));
    156       if($StayLogged)
     156      if ($StayLogged)
    157157      {
    158158        setcookie('LoginUserId', $User['ID'], time() + 365 * 24 * 60 * 60);
     
    176176  {
    177177    $SID = session_id();
    178     if($this->Role != LICENCE_ANONYMOUS)
     178    if ($this->Role != LICENCE_ANONYMOUS)
    179179    {
    180180      $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array('User' => null));
     
    192192    'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '.
    193193    'WHERE `User`.`ID` = '.$this->Id);
    194     if($DbResult->num_rows > 0)
     194    if ($DbResult->num_rows > 0)
    195195    {
    196196      $User = $DbResult->fetch_assoc();
     
    222222  function Licence($Licence)
    223223  {
    224     if(GetRemoteAddress() == '') return(true); // Execution from command line
    225       else return($this->Role >= $Licence);
     224    if (GetRemoteAddress() == '') return true; // Execution from command line
     225      else return $this->Role >= $Licence;
    226226  }
    227227
     
    229229  {
    230230    $DbResult = $this->Database->select('APIToken', 'User', '`Token`="'.$Token.'"');
    231     if($DbResult->num_rows > 0)
     231    if ($DbResult->num_rows > 0)
    232232    {
    233233      $DbRow = $DbResult->fetch_assoc();
    234234      $DbResult2 = $this->Database->select('User', 'GM', '`ID`="'.$DbRow['User'].'"');
    235235      $DbRow2 = $DbResult2->fetch_assoc();
    236       return($DbRow2['GM'] >= $Licence);
    237     } else return(false);
     236      return $DbRow2['GM'] >= $Licence;
     237    } else return false;
    238238  }
    239239
    240240  function GetPasswordSalt()
    241241  {
    242     return(substr(sha1(mt_rand()), 0, 8));
     242    return substr(sha1(mt_rand()), 0, 8);
    243243  }
    244244
    245245  function CryptPasswordSQL($Password, $Salt)
    246246  {
    247     return('SHA1(CONCAT(SHA1('.$Password.'), '.$Salt.'))');
     247    return 'SHA1(CONCAT(SHA1('.$Password.'), '.$Salt.'))';
    248248  }
    249249
     
    253253    // Lookup user record
    254254    $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
    255     if($Query->num_rows > 0)
     255    if ($Query->num_rows > 0)
    256256    {
    257257      // Refresh time of last access
    258258      $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()'));
    259259    } else {
    260       if(GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress());
     260      if (GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress());
    261261        else $HostName = '';
    262262      $this->Database->insert('UserOnline', array('SessionId' => $SID,
     
    267267
    268268    // Logged permanently?
    269     if(array_key_exists('LoginHash', $_COOKIE))
     269    if (array_key_exists('LoginHash', $_COOKIE))
    270270    {
    271271      $DbResult = $this->Database->query('SELECT * FROM `UserOnline` WHERE `User`='.$_COOKIE['LoginUserId'].
    272272        ' AND `StayLogged`=1 AND SessionId!="'.$SID.'"');
    273       if($DbResult->num_rows > 0)
     273      if ($DbResult->num_rows > 0)
    274274      {
    275275        $DbRow = $DbResult->fetch_assoc();
    276         if(sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash'])
     276        if (sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash'])
    277277        {
    278278          $this->Database->query('DELETE FROM `UserOnline` WHERE `SessionId`="'.$SID.'"');
     
    285285    $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"');
    286286    $Row = $Query->fetch_assoc();
    287     if($Row['User'] != '')
     287    if ($Row['User'] != '')
    288288    {
    289289      $this->Id = $Row['User'];
     
    296296    // Remove nonactive users
    297297    $DbResult = $this->Database->select('UserOnline', '`Id`, `User`', '(`ActivityTime` < DATE_SUB(NOW(), INTERVAL '.$this->OnlineStateTimeout.' SECOND)) AND (`StayLogged` = 0)');
    298     while($DbRow = $DbResult->fetch_array())
     298    while ($DbRow = $DbResult->fetch_array())
    299299    {
    300300      $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']);
     
    305305  {
    306306    $Salt = $this->GetPasswordSalt();
    307     if($Team == null) $Team = 'NULL';
    308     if($PreferredVersion == null) $PreferredVersion = 'NULL';
     307    if ($Team == null) $Team = 'NULL';
     308    if ($PreferredVersion == null) $PreferredVersion = 'NULL';
    309309    $this->Database->query('INSERT INTO `User` '.
    310310      '(`Name` , `Pass` , `Salt`, `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '.
  • trunk/Modules/User/UserList.php

    r851 r880  
    77    $this->Title = T('Translators');
    88    $Output = '';
    9     if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
    10     else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
    11     if(array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
    12     if($_SESSION['search'] != '')
     9    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
     10    else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
     11    if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = '';
     12    if ($_SESSION['search'] != '')
    1313    {
    1414      $SearchQuery = ' AND (`User`.`Name` LIKE "%'.$_SESSION['search'].'%")';
     
    1717
    1818    $TeamFilter = '';
    19     if(array_key_exists('team', $_GET))
     19    if (array_key_exists('team', $_GET))
    2020    {
    2121      $TeamId = $_GET['team'] * 1;
    2222      $DbResult = $this->Database->select('Team', 'Name', '`Id`='.$TeamId);
    23       if($DbResult->num_rows > 0)
     23      if ($DbResult->num_rows > 0)
    2424      {
    2525        $Team = $DbResult->fetch_assoc();
     
    5858
    5959    $DbResult = $this->Database->query($Query);
    60     while($Line = $DbResult->fetch_assoc())
     60    while ($Line = $DbResult->fetch_assoc())
    6161    {
    6262      $XP = GetLevelMinMax($Line['XP']);
     
    7171        $PageList['Output'];
    7272
    73     return($Output);
     73    return $Output;
    7474  }
    7575}
  • trunk/Modules/Wiki/Wiki.php

    r843 r880  
    2222  {
    2323    $DbResult = $this->Database->select('WikiPage', '*', '`VisibleInMenu`=1');
    24     while($DbRow = $DbResult->fetch_assoc())
     24    while ($DbRow = $DbResult->fetch_assoc())
    2525    {
    2626      $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki');
     
    4040  function Show()
    4141  {
    42     if(array_key_exists('Action', $_GET))
    43     {
    44       if($_GET['Action'] == 'Edit') $Output = $this->EditContent();
    45       else if($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();
    46       else if($_GET['Action'] == 'History') $Output = $this->ShowHistory();
     42    if (array_key_exists('Action', $_GET))
     43    {
     44      if ($_GET['Action'] == 'Edit') $Output = $this->EditContent();
     45      else if ($_GET['Action'] == 'EditSave') $Output = $this->SaveContent();
     46      else if ($_GET['Action'] == 'History') $Output = $this->ShowHistory();
    4747      else $Output = $this->ShowContent();
    4848    } else $Output = $this->ShowContent();
    49     return($Output);
     49    return $Output;
    5050  }
    5151
     
    5454    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    5555    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    56     if($DbResult->num_rows > 0)
     56    if ($DbResult->num_rows > 0)
    5757    {
    5858      $DbRow = $DbResult->fetch_assoc();
    59       if(array_key_exists('ver', $_GET))
     59      if (array_key_exists('ver', $_GET))
    6060      {
    6161        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1);
    62         if($DbResult2->num_rows > 0)
     62        if ($DbResult2->num_rows > 0)
    6363        {
    6464          $DbRow2 = $DbResult2->fetch_assoc();
    6565          $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>';
    6666          $Output .= $DbRow2['Content'];
    67           if($this->System->User->Licence(LICENCE_MODERATOR))
     67          if ($this->System->User->Licence(LICENCE_MODERATOR))
    6868            $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>';
    6969        } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
     
    7171      {
    7272        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
    73         if($DbResult2->num_rows > 0)
     73        if ($DbResult2->num_rows > 0)
    7474        {
    7575          $DbRow2 = $DbResult2->fetch_assoc();
    7676          $Output = '<h3>'.$DbRow['Name'].'</h3>';
    7777          $Output .= $DbRow2['Content'];
    78           if($this->System->User->Licence(LICENCE_MODERATOR))
     78          if ($this->System->User->Licence(LICENCE_MODERATOR))
    7979            $Output .= '<hr><div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>';
    8080        } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    8181      }
    8282    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    83     return($Output);
     83    return $Output;
    8484  }
    8585
    8686  function EditContent()
    8787  {
    88     if($this->System->User->Licence(LICENCE_MODERATOR))
     88    if ($this->System->User->Licence(LICENCE_MODERATOR))
    8989    {
    9090    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    9191    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    92     if($DbResult->num_rows > 0)
     92    if ($DbResult->num_rows > 0)
    9393    {
    9494      $DbRow = $DbResult->fetch_assoc();
    9595      $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>';
    9696      $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' ORDER BY Time DESC LIMIT 1');
    97       if($DbResult2->num_rows > 0)
     97      if ($DbResult2->num_rows > 0)
    9898      {
    9999        $DbRow2 = $DbResult2->fetch_assoc();
     
    106106    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    107107    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    108     return($Output);
     108    return $Output;
    109109  }
    110110
    111111  function SaveContent()
    112112  {
    113     if($this->System->User->Licence(LICENCE_MODERATOR))
     113    if ($this->System->User->Licence(LICENCE_MODERATOR))
    114114    {
    115115    $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    116116    $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    117     if($DbResult->num_rows > 0)
     117    if ($DbResult->num_rows > 0)
    118118    {
    119119      $DbRow = $DbResult->fetch_assoc();
    120       if(array_key_exists('content', $_POST) and array_key_exists('save', $_POST))
     120      if (array_key_exists('content', $_POST) and array_key_exists('save', $_POST))
    121121      {
    122122        $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']),
     
    127127    } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    128128    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    129     return($Output);
     129    return $Output;
    130130  }
    131131
    132132  function ShowHistory()
    133133  {
    134     if($this->System->User->Licence(LICENCE_MODERATOR))
     134    if ($this->System->User->Licence(LICENCE_MODERATOR))
    135135    {
    136136      $PageName = $this->System->PathItems[count($this->System->PathItems) - 1];
    137137      $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"');
    138       if($DbResult->num_rows > 0)
     138      if ($DbResult->num_rows > 0)
    139139      {
    140140        $DbRow = $DbResult->fetch_assoc();
     
    160160          ' FROM `WikiPageContent` WHERE Page='.
    161161          $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']);
    162         while($PageContent = $DbResult2->fetch_assoc())
     162        while ($PageContent = $DbResult2->fetch_assoc())
    163163        {
    164164          $Output .= '<tr>'.
     
    173173      } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL);
    174174    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    175     return($Output);
     175    return $Output;
    176176  }
    177177
     
    200200    $text = str_replace("\r\n", '<br/>', $text);
    201201    $text = '<p>'.$text.'</p>';
    202     return($text);
     202    return $text;
    203203  }
    204204}
  • trunk/Packages/Common/AppModule.php

    r860 r880  
    7777  function Install()
    7878  {
    79     if($this->Installed) return;
     79    if ($this->Installed) return;
    8080    $List = array();
    8181    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled));
     
    8989  function Uninstall()
    9090  {
    91     if(!$this->Installed) return;
     91    if (!$this->Installed) return;
    9292    $this->Stop();
    9393    $this->Installed = false;
     
    100100  function Upgrade()
    101101  {
    102     if(!$this->Installed) return;
    103     if($this->InstalledVersion == $this->Version) return;
     102    if (!$this->Installed) return;
     103    if ($this->InstalledVersion == $this->Version) return;
    104104    $List = array();
    105105    $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed));
     
    117117  function Start()
    118118  {
    119     if($this->Running) return;
    120     if(!$this->Installed) return;
     119    if ($this->Running) return;
     120    if (!$this->Installed) return;
    121121    $List = array();
    122122    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotRunning));
     
    128128  function Stop()
    129129  {
    130     if(!$this->Running) return;
     130    if (!$this->Running) return;
    131131    $this->Running = false;
    132132    $List = array();
     
    144144  function Enable()
    145145  {
    146     if($this->Enabled) return;
    147     if(!$this->Installed) return;
     146    if ($this->Enabled) return;
     147    if (!$this->Installed) return;
    148148    $List = array();
    149149    $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotEnabled));
     
    154154  function Disable()
    155155  {
    156     if(!$this->Enabled) return;
     156    if (!$this->Enabled) return;
    157157    $this->Stop();
    158158    $this->Enabled = false;
     
    203203  function Perform($List, $Actions, $Conditions = array(ModuleCondition::All))
    204204  {
    205     foreach($List as $Index => $Module)
    206     {
    207       if(in_array(ModuleCondition::All, $Conditions) or
     205    foreach ($List as $Index => $Module)
     206    {
     207      if (in_array(ModuleCondition::All, $Conditions) or
    208208        ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
    209209        (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or
     
    213213        (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions)))
    214214      {
    215         foreach($Actions as $Action)
     215        foreach ($Actions as $Action)
    216216        {
    217           if($Action == ModuleAction::Start) $Module->Start();
    218           if($Action == ModuleAction::Stop) $Module->Stop();
    219           if($Action == ModuleAction::Install) $Module->Install();
    220           if($Action == ModuleAction::Uninstall) $Module->Uninstall();
    221           if($Action == ModuleAction::Enable) $Module->Enable();
    222           if($Action == ModuleAction::Disable) $Module->Disable();
    223           if($Action == ModuleAction::Upgrade) $Module->Upgrade();
     217          if ($Action == ModuleAction::Start) $Module->Start();
     218          if ($Action == ModuleAction::Stop) $Module->Stop();
     219          if ($Action == ModuleAction::Install) $Module->Install();
     220          if ($Action == ModuleAction::Uninstall) $Module->Uninstall();
     221          if ($Action == ModuleAction::Enable) $Module->Enable();
     222          if ($Action == ModuleAction::Disable) $Module->Disable();
     223          if ($Action == ModuleAction::Upgrade) $Module->Upgrade();
    224224        }
    225225      }
     
    229229  function EnumDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All))
    230230  {
    231     foreach($Module->Dependencies as $Dependency)
    232     {
    233       if(!array_key_exists($Dependency, $this->Modules))
     231    foreach ($Module->Dependencies as $Dependency)
     232    {
     233      if (!array_key_exists($Dependency, $this->Modules))
    234234        throw new Exception(sprintf(T('Module "%s" dependency "%s" not found'), $Module->Name, $Dependency));
    235235      $DepModule = $this->Modules[$Dependency];
    236       if(in_array(ModuleCondition::All, $Conditions) or
     236      if (in_array(ModuleCondition::All, $Conditions) or
    237237        ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
    238238        (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or
     
    250250  function EnumSuperiorDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All))
    251251  {
    252     foreach($this->Modules as $RefModule)
    253     {
    254       if(in_array($Module->Name, $RefModule->Dependencies) and
     252    foreach ($this->Modules as $RefModule)
     253    {
     254      if (in_array($Module->Name, $RefModule->Dependencies) and
    255255          (in_array(ModuleCondition::All, $Conditions) or
    256256          ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or
     
    270270  {
    271271    $this->LoadModules();
    272     if(file_exists($this->FileName)) $this->LoadState();
     272    if (file_exists($this->FileName)) $this->LoadState();
    273273    $this->StartEnabled();
    274274  }
     
    315315  function ModulePresent($Name)
    316316  {
    317     return(array_key_exists($Name, $this->Modules));
     317    return array_key_exists($Name, $this->Modules);
    318318  }
    319319
    320320  function ModuleEnabled($Name)
    321321  {
    322     return(array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled);
     322    return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Enabled;
    323323  }
    324324
    325325  function ModuleRunning($Name)
    326326  {
    327     return(array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running);
     327    return array_key_exists($Name, $this->Modules) and $this->Modules[$Name]->Running;
    328328  }
    329329
     
    331331  function SearchModuleById($Id)
    332332  {
    333     foreach($this->Modules as $Module)
     333    foreach ($this->Modules as $Module)
    334334    {
    335335      //DebugLog($Module->Name.' '.$Module->Id);
    336       if($Module->Id == $Id) return($Module->Name);
    337     }
    338     return('');
     336      if ($Module->Id == $Id) return $Module->Name;
     337    }
     338    return '';
    339339  }
    340340
     
    343343    $ConfigModules = array();
    344344    include($this->FileName);
    345     foreach($ConfigModules as $Mod)
    346     {
    347       if(array_key_exists($Mod['Name'], $this->Modules))
     345    foreach ($ConfigModules as $Mod)
     346    {
     347      if (array_key_exists($Mod['Name'], $this->Modules))
    348348      {
    349349        $this->Modules[$Mod['Name']] = $this->Modules[$Mod['Name']];
     
    358358  {
    359359    $Data = array();
    360     foreach($this->Modules as $Module)
     360    foreach ($this->Modules as $Module)
    361361    {
    362362      $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled,
     
    381381  {
    382382    $List = scandir($Directory);
    383     foreach($List as $Item)
    384     {
    385       if(is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))
     383    foreach ($List as $Item)
     384    {
     385      if (is_dir($Directory.'/'.$Item) and ($Item != '.') and ($Item != '..') and ($Item != '.svn'))
    386386      {
    387387        include_once($Directory.'/'.$Item.'/'.$Item.'.php');
     
    394394  function LoadModules()
    395395  {
    396     if(method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
     396    if (method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))
    397397      $this->OnLoadModules();
    398398    else $this->LoadModulesFromDir($this->ModulesDir);
  • trunk/Packages/Common/Common.php

    r858 r880  
    5959
    6060    $Result = '';
    61     if(array_key_exists('all', $QueryItems))
     61    if (array_key_exists('all', $QueryItems))
    6262    {
    6363      $PageCount = 1;
     
    7070    }
    7171
    72     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    73     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    74     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    75     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     72    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     73    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     74    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     75    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    7676    $CurrentPage = $_SESSION['Page'];
    7777
     
    7979
    8080    $Result = '';
    81     if($PageCount > 1)
     81    if ($PageCount > 1)
    8282    {
    83       if($CurrentPage > 0)
     83      if ($CurrentPage > 0)
    8484      {
    8585        $QueryItems['page'] = 0;
     
    9090      $PagesMax = $PageCount - 1;
    9191      $PagesMin = 0;
    92       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    93       if($PagesMin < ($CurrentPage - $Around))
     92      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     93      if ($PagesMin < ($CurrentPage - $Around))
    9494      {
    9595        $Result.= ' ... ';
    9696        $PagesMin = $CurrentPage - $Around;
    9797      }
    98       for($i = $PagesMin; $i <= $PagesMax; $i++)
     98      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    9999      {
    100         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     100        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    101101        else {
    102102         $QueryItems['page'] = $i;
     
    104104        }
    105105      }
    106       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    107       if($CurrentPage < ($PageCount - 1))
     106      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     107      if ($CurrentPage < ($PageCount - 1))
    108108      {
    109109        $QueryItems['page'] = ($CurrentPage + 1);
     
    114114    }
    115115    $QueryItems['all'] = '1';
    116     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     116    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    117117
    118118    $Result = '<div style="text-align: center">'.$Result.'</div>';
    119119    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    120120    $this->Page = $CurrentPage;
    121     return($Result);
     121    return $Result;
    122122  }
    123123}
  • trunk/Packages/Common/Config.php

    r838 r880  
    1212  function ReadValue($Name)
    1313  {
    14     if(!is_array($Name)) $Name = explode('/', $Name);
     14    if (!is_array($Name)) $Name = explode('/', $Name);
    1515    $Last = array_pop($Name);
    1616    $Data = &$this->Data;
    17     foreach($Name as $Item)
     17    foreach ($Name as $Item)
    1818    {
    1919      $Data = &$Data[$Item];
    2020    }
    21     return($Data[$Last]);
     21    return $Data[$Last];
    2222  }
    2323
    2424  function WriteValue($Name, $Value)
    2525  {
    26     if(!is_array($Name)) $Name = explode('/', $Name);
     26    if (!is_array($Name)) $Name = explode('/', $Name);
    2727    $Last = array_pop($Name);
    2828    $Data = &$this->Data;
    29     foreach($Name as $Item)
     29    foreach ($Name as $Item)
    3030    {
    3131      $Data = &$Data[$Item];
     
    3838    $ConfigData = array();
    3939    include $FileName;
    40     foreach($this->Data as $Index => $Item)
     40    foreach ($this->Data as $Index => $Item)
    4141    {
    42       if(array_key_exits($Index, $ConfigData))
     42      if (array_key_exits($Index, $ConfigData))
    4343        $this->Data[$Index] = $ConfigData[$Index];
    4444    }
     
    5252  function GetAsArray()
    5353  {
    54     return($this->Data);
     54    return $this->Data;
    5555  }
    5656}
  • trunk/Packages/Common/Database.php

    r858 r880  
    1111  function fetch_assoc()
    1212  {
    13     return($this->PDOStatement->fetch(PDO::FETCH_ASSOC));
     13    return $this->PDOStatement->fetch(PDO::FETCH_ASSOC);
    1414  }
    1515
    1616  function fetch_array()
    1717  {
    18     return($this->PDOStatement->fetch(PDO::FETCH_BOTH));
     18    return $this->PDOStatement->fetch(PDO::FETCH_BOTH);
    1919  }
    2020
    2121  function fetch_row()
    2222  {
    23     return($this->PDOStatement->fetch(PDO::FETCH_NUM));
     23    return $this->PDOStatement->fetch(PDO::FETCH_NUM);
    2424  }
    2525}
     
    5454  function Connect($Host, $User, $Password, $Database)
    5555  {
    56     if($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;
    57       else if($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;
     56    if ($this->Type == 'mysql') $ConnectionString = 'mysql:host='.$Host.';dbname='.$Database;
     57      else if ($this->Type == 'pgsql') $ConnectionString = 'pgsql:dbname='.$Database.';host='.$Host;
    5858      else $ConnectionString = '';
    5959    try {
     
    7474  function Connected()
    7575  {
    76     return(isset($this->PDO));
     76    return isset($this->PDO);
    7777  }
    7878
     
    8484  function query($Query)
    8585  {
    86     if(!$this->Connected()) throw new Exception(T('Not connected to database'));
    87     if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime();
     86    if (!$this->Connected()) throw new Exception(T('Not connected to database'));
     87    if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime();
    8888    $this->LastQuery = $Query;
    89     if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
     89    if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
    9090      $Duration = ' ; '.round(microtime() - $QueryStartTime, 4). ' s';
    91     if($this->LogSQLQuery == true)
     91    if ($this->LogSQLQuery == true)
    9292      file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND);
    93     if($this->ShowSQLQuery == true)
     93    if ($this->ShowSQLQuery == true)
    9494      echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; '.
    9595      'padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.$Duration.'</div>'."\n");
    9696    $Result = new DatabaseResult();
    9797    $Result->PDOStatement = $this->PDO->query($Query);
    98     if($Result->PDOStatement)
     98    if ($Result->PDOStatement)
    9999    {
    100100      $Result->num_rows = $Result->PDOStatement->rowCount();
     
    104104      $this->Error = $this->PDO->errorInfo();
    105105      $this->Error = $this->Error[2];
    106       if(($this->Error != '') and ($this->ShowSQLError == true))
     106      if (($this->Error != '') and ($this->ShowSQLError == true))
    107107        echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>');
    108108        throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query);
    109109    }
    110     return($Result);
     110    return $Result;
    111111  }
    112112
    113113  function select($Table, $What = '*', $Condition = 1)
    114114  {
    115     return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));
     115    return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition);
    116116  }
    117117
     
    125125    $Name = '';
    126126    $Values = '';
    127     foreach($Data as $Key => $Value)
     127    foreach ($Data as $Key => $Value)
    128128    {
    129129      $Name .= ',`'.$Key.'`';
    130       if(!in_array($Value, $this->Functions))
     130      if (!in_array($Value, $this->Functions))
    131131      {
    132         if(is_null($Value)) $Value = 'NULL';
     132        if (is_null($Value)) $Value = 'NULL';
    133133        else $Value = $this->PDO->quote($Value);
    134134      }
     
    144144  {
    145145    $Values = '';
    146     foreach($Data as $Key => $Value)
    147     {
    148       if(!in_array($Value, $this->Functions))
     146    foreach ($Data as $Key => $Value)
     147    {
     148      if (!in_array($Value, $this->Functions))
    149149      {
    150         if(is_null($Value)) $Value = 'NULL';
     150        if (is_null($Value)) $Value = 'NULL';
    151151        else $Value = $this->PDO->quote($Value);
    152152      }
     
    161161    $Name = '';
    162162    $Values = '';
    163     foreach($Data as $Key => $Value)
    164     {
    165       if(!in_array($Value, $this->Functions))
     163    foreach ($Data as $Key => $Value)
     164    {
     165      if (!in_array($Value, $this->Functions))
    166166      {
    167         if(is_null($Value)) $Value = 'NULL';
     167        if (is_null($Value)) $Value = 'NULL';
    168168        else $Value = $this->PDO->quote($Value);
    169169      }
     
    185185  function real_escape_string($Text)
    186186  {
    187     return(addslashes($Text));
     187    return addslashes($Text);
    188188  }
    189189
    190190  function quote($Text)
    191191  {
    192     return($this->PDO->quote($Text));
     192    return $this->PDO->quote($Text);
    193193  }
    194194
     
    205205function TimeToMysqlDateTime($Time)
    206206{
    207   if($Time == NULL) return(NULL);
    208     else return(date('Y-m-d H:i:s', $Time));
     207  if ($Time == NULL) return NULL;
     208    else return date('Y-m-d H:i:s', $Time);
    209209}
    210210
    211211function TimeToMysqlDate($Time)
    212212{
    213   if($Time == NULL) return(NULL);
    214     else return(date('Y-m-d', $Time));
     213  if ($Time == NULL) return NULL;
     214    else return date('Y-m-d', $Time);
    215215}
    216216
    217217function TimeToMysqlTime($Time)
    218218{
    219   if($Time == NULL) return(NULL);
    220     else return(date('H:i:s', $Time));
     219  if ($Time == NULL) return NULL;
     220    else return date('H:i:s', $Time);
    221221}
    222222
    223223function MysqlDateTimeToTime($DateTime)
    224224{
    225   if($DateTime == '') return(NULL);
     225  if ($DateTime == '') return NULL;
    226226  $Parts = explode(' ', $DateTime);
    227227  $DateParts = explode('-', $Parts[0]);
    228228  $TimeParts = explode(':', $Parts[1]);
    229229  $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
    230   return($Result);
     230  return $Result;
    231231}
    232232
    233233function MysqlDateToTime($Date)
    234234{
    235   if($Date == '') return(NULL);
    236   return(MysqlDateTimeToTime($Date.' 0:0:0'));
     235  if ($Date == '') return NULL;
     236  return MysqlDateTimeToTime($Date.' 0:0:0');
    237237}
    238238
    239239function MysqlTimeToTime($Time)
    240240{
    241   if($Time == '') return(NULL);
    242   return(MysqlDateTimeToTime('0000-00-00 '.$Time));
    243 }
     241  if ($Time == '') return NULL;
     242  return MysqlDateTimeToTime('0000-00-00 '.$Time);
     243}
  • trunk/Packages/Common/Error.php

    r838 r880  
    4545    );
    4646
    47     if(($this->UserErrors & $Number))
     47    if (($this->UserErrors & $Number))
    4848    {
    4949      // Error was suppressed with the @-operator
    50       if(0 === error_reporting())
     50      if (0 === error_reporting())
    5151      {
    5252        return false;
     
    5858      $Backtrace[0]['line'] = $LineNumber;
    5959      $this->Report($Backtrace);
    60       //if((E_ERROR | E_PARSE) & $Number)
     60      //if ((E_ERROR | E_PARSE) & $Number)
    6161      die();
    6262    }
     
    8282      'An internal error occurred!<br/>'.
    8383      'Administrator will be notified and the problem will be investigated and fixed soon.'.'<br/><br/>';
    84     if($this->ShowError == true)
     84    if ($this->ShowError == true)
    8585      $Output .= '<pre>'.$Message.'</pre><br/>';
    8686    $Output .= '</body></html>';
     
    9292    $Date = date('Y-m-d H:i:s');
    9393    $Error = '# '.$Date."\n";
    94     foreach($Backtrace as $Item)
     94    foreach ($Backtrace as $Item)
    9595    {
    96       if(!array_key_exists('line', $Item)) $Item['line'] = '';
    97       if(!array_key_exists('file', $Item)) $Item['file'] = '';
     96      if (!array_key_exists('line', $Item)) $Item['line'] = '';
     97      if (!array_key_exists('file', $Item)) $Item['file'] = '';
    9898
    9999      $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function'];
    100100      $Arguments = '';
    101       if(array_key_exists('args', $Item) and is_array($Item['args']))
    102         foreach($Item['args'] as $Item)
     101      if (array_key_exists('args', $Item) and is_array($Item['args']))
     102        foreach ($Item['args'] as $Item)
    103103        {
    104           if(is_object($Item)) ;
    105           else if(is_array($Item)) $Arguments .= "'".serialize($Item)."',";
     104          if (is_object($Item)) ;
     105          else if (is_array($Item)) $Arguments .= "'".serialize($Item)."',";
    106106          else $Arguments .= "'".$Item."',";
    107107        }
    108         if(strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';
     108        if (strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';
    109109        $Error .= "\n";
    110110    }
    111111    $Error .= "\n";
    112112
    113     foreach($this->OnError as $OnError)
     113    foreach ($this->OnError as $OnError)
    114114      call_user_func($OnError, $Error);
    115115  }
  • trunk/Packages/Common/Image.php

    r838 r880  
    6565  function SaveToFile($FileName)
    6666  {
    67     if($this->Type == IMAGETYPE_JPEG)
     67    if ($this->Type == IMAGETYPE_JPEG)
    6868    {
    6969      imagejpeg($this->Image, $FileName);
    7070    } else
    71     if($this->Type == IMAGETYPE_GIF)
     71    if ($this->Type == IMAGETYPE_GIF)
    7272    {
    73       imagegif($this->Image, $FileName);
     73      imagegif ($this->Image, $FileName);
    7474    } else
    75     if($this->Type == IMAGETYPE_PNG)
     75    if ($this->Type == IMAGETYPE_PNG)
    7676    {
    7777      imagepng($this->Image, $FileName);
     
    8383    $ImageInfo = getimagesize($FileName);
    8484    $this->Type = $ImageInfo[2];
    85     if($this->Type == IMAGETYPE_JPEG)
     85    if ($this->Type == IMAGETYPE_JPEG)
    8686    {
    8787      $this->Image = imagecreatefromjpeg($FileName);
    8888    } else
    89     if($this->Type == IMAGETYPE_GIF)
     89    if ($this->Type == IMAGETYPE_GIF)
    9090    {
    9191      $this->Image = imagecreatefromgif($FileName);
    9292    } else
    93     if( $this->Type == IMAGETYPE_PNG)
     93    if ( $this->Type == IMAGETYPE_PNG)
    9494    {
    9595      $this->Image = imagecreatefrompng($FileName);
     
    112112  function GetWidth()
    113113  {
    114     return(imagesx($this->Image));
     114    return imagesx($this->Image);
    115115  }
    116116
    117117  function GetHeight()
    118118  {
    119     return(imagesy($this->Image));
     119    return imagesy($this->Image);
    120120  }
    121121
     
    127127  function ConvertColor($Color)
    128128  {
    129     return(imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff));
     129    return imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff);
    130130  }
    131131
  • trunk/Packages/Common/Locale.php

    r858 r880  
    2020  function Translate($Text, $Group = '')
    2121  {
    22     if(array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))
    23       return($this->Data[$Group][$Text]);
    24       else return($Text);
     22    if (array_key_exists($Text, $this->Data[$Group]) and ($this->Data[$Group][$Text] != ''))
     23      return $this->Data[$Group][$Text];
     24      else return $Text;
    2525  }
    2626
     
    2828  {
    2929    $Key = array_search($Text, $this->Data[$Group]);
    30     if(($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return($Text);
    31       else return($Key);
     30    if (($Key === FALSE) or ($this->Data[$Group][$Key] == '')) return $Text;
     31      else return $Key;
    3232  }
    3333}
     
    4747  {
    4848    $FileName = $this->Dir.'/'.$Language.'.php';
    49     if(file_exists($FileName)) {
     49    if (file_exists($FileName)) {
    5050      include_once($FileName);
    5151      $ClassName = 'LocaleText'.$Language;
     
    5959    // Search for php files
    6060    $FileList = scandir($Path);
    61     foreach($FileList as $FileName)
     61    foreach ($FileList as $FileName)
    6262    {
    6363      $FullName = $Path.'/'.$FileName;
    64       if(($FileName == '.') or ($FileName == '..')) ; // Skip virtual items
    65       else if(substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files
    66       else if(is_dir($FullName)) $this->AnalyzeCode($FullName);
    67       else if(file_exists($FullName))
    68       {
    69         if(substr($FullName, -4) == '.php')
     64      if (($FileName == '.') or ($FileName == '..')) ; // Skip virtual items
     65      else if (substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files
     66      else if (is_dir($FullName)) $this->AnalyzeCode($FullName);
     67      else if (file_exists($FullName))
     68      {
     69        if (substr($FullName, -4) == '.php')
    7070        {
    7171          $Content = file_get_contents($FullName);
    7272          // Search occurence of T() function
    73           while(strpos($Content, 'T(') !== false)
     73          while (strpos($Content, 'T(') !== false)
    7474          {
    7575            $Previous = strtolower(substr($Content, strpos($Content, 'T(') - 1, 1));
     
    7777            $Ord = ord($Previous);
    7878            //echo($Ord.',');
    79             if(!(($Ord >= ord('a')) and ($Ord <= ord('z'))))
     79            if (!(($Ord >= ord('a')) and ($Ord <= ord('z'))))
    8080            {
    8181              // Do for non-alpha previous character
    8282              $Original = substr($Content, 0, strpos($Content, ')'));
    8383              $Original2 = '';
    84               if((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'"))
     84              if ((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'"))
    8585                $Original2 = substr($Original, 1, -1);
    86               if((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"'))
     86              if ((substr($Original, 0, 1) == '"') and (substr($Original, -1, 1) == '"'))
    8787                $Original2 = substr($Original, 1, -1);
    88               if($Original2 != '')
     88              if ($Original2 != '')
    8989              {
    90                 if(!array_key_exists($Original2, $this->Texts->Data))
     90                if (!array_key_exists($Original2, $this->Texts->Data))
    9191                  $this->Texts->Data[$Original2] = '';
    9292              }
     
    109109    '    $this->Title = \''.$this->Texts->Title.'\';'."\n".
    110110    '    $this->Data = array('."\n";
    111     foreach($this->Texts->Data as $Index => $Item)
     111    foreach ($this->Texts->Data as $Index => $Item)
    112112    {
    113113      $Content .= "      '".$Index."' => '".$Item."',\n";
     
    122122  {
    123123    $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode));
    124     if($DbResult->num_rows > 0)
     124    if ($DbResult->num_rows > 0)
    125125    {
    126126      $Language = $DbResult->fetch_assoc();
    127127      $this->Texts->Data = array();
    128128      $DbResult = $Database->select('Locale', '`Original`, `Translated`', '`Language`='.$Language['Id']);
    129       while($DbRow = $DbResult->fetch_assoc())
     129      while ($DbRow = $DbResult->fetch_assoc())
    130130        $this->Texts->Data[$DbRow['Original']] = $DbRow['Translated'];
    131131    }
     
    135135  {
    136136    $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode));
    137     if($DbResult->num_rows > 0)
     137    if ($DbResult->num_rows > 0)
    138138    {
    139139      $Language = $DbResult->fetch_assoc();
    140140      $Database->delete('Locale', '`Language`='.$Language['Id']);
    141       foreach($this->Texts->Data as $Index => $Item)
     141      foreach ($this->Texts->Data as $Index => $Item)
    142142        $Database->query('INSERT INTO `Locale` (`Language`,`Original`,`Translated`) '.
    143143        'VALUES('.$Language['Id'].','.$Database->quote($Index).','.$Database->quote($Item).')');
     
    148148  {
    149149    $DbResult = $Database->select('Language', '*', '`Code`='.$Database->quote($LangCode));
    150     if($DbResult->num_rows > 0)
     150    if ($DbResult->num_rows > 0)
    151151    {
    152152      $Language = $DbResult->fetch_assoc();
    153       foreach($this->Texts->Data as $Index => $Item)
     153      foreach ($this->Texts->Data as $Index => $Item)
    154154      {
    155155        $DbResult = $Database->select('Locale', '*', '(`Original` ='.$Database->quote($Index).
    156156          ') AND (`Language`='.($Language['Id']).')');
    157         if($DbResult->num_rows > 0)
     157        if ($DbResult->num_rows > 0)
    158158        $Database->update('Locale', '(`Language`='.($Language['Id']).') AND '.
    159159          '(`Original` ='.$Database->quote($Index).')', array('Translated' => $Item));
     
    188188    $this->Available = array();
    189189    $FileList = scandir($this->Dir);
    190     foreach($FileList as $FileName)
    191     {
    192       if(substr($FileName, -4) == '.php')
     190    foreach ($FileList as $FileName)
     191    {
     192      if (substr($FileName, -4) == '.php')
    193193      {
    194194        $Code = substr($FileName, 0, -4);
     
    206206    $Locale->AnalyzeCode($Directory);
    207207    $FileList = scandir($this->Dir);
    208     foreach($FileList as $FileName)
    209     {
    210       if(substr($FileName, -4) == '.php')
     208    foreach ($FileList as $FileName)
     209    {
     210      if (substr($FileName, -4) == '.php')
    211211      {
    212212        $FileLocale = new LocaleFile($this->System);
     
    215215
    216216        // Add new
    217         foreach($Locale->Texts->Data as $Index => $Item)
    218           if(!array_key_exists($Index, $FileLocale->Texts->Data))
     217        foreach ($Locale->Texts->Data as $Index => $Item)
     218          if (!array_key_exists($Index, $FileLocale->Texts->Data))
    219219            $FileLocale->Texts->Data[$Index] = $Item;
    220220        // Remove old
    221         foreach($FileLocale->Texts->Data as $Index => $Item)
    222           if(!array_key_exists($Index, $Locale->Texts->Data))
     221        foreach ($FileLocale->Texts->Data as $Index => $Item)
     222          if (!array_key_exists($Index, $Locale->Texts->Data))
    223223            unset($FileLocale->Texts->Data[$Index]);
    224224        $FileLocale->UpdateToDatabase($this->System->Database, $FileLocale->Texts->Code);
     
    232232  function LoadLocale($Code)
    233233  {
    234     if(array_key_exists($Code, $this->Available))
     234    if (array_key_exists($Code, $this->Available))
    235235    {
    236236      $this->CurrentLocale->Dir = $this->Dir;
     
    245245  global $GlobalLocaleManager;
    246246
    247   if(isset($GlobalLocaleManager)) return($GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group));
    248     else return($Text);
    249 }
     247  if (isset($GlobalLocaleManager)) return $GlobalLocaleManager->CurrentLocale->Texts->Translate($Text, $Group);
     248    else return $Text;
     249}
  • trunk/Packages/Common/Mail.php

    r858 r880  
    6969  function Organization($org)
    7070  {
    71     if(trim($org != '')) $this->xheaders['Organization'] = $org;
     71    if (trim($org != '')) $this->xheaders['Organization'] = $org;
    7272  }
    7373
    7474  function Priority($Priority)
    7575  {
    76     if(!intval($Priority)) return(false);
    77 
    78     if(!isset($this->priorities[$Priority - 1])) return(false);
     76    if (!intval($Priority)) return false;
     77
     78    if (!isset($this->priorities[$Priority - 1])) return false;
    7979
    8080    $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1];
    81     return(true);
     81    return true;
    8282  }
    8383
     
    9696  function Send()
    9797  {
    98     if(count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body'));
     98    if (count($this->Bodies) == 0) throw new Exception(T('Mail message need at least one text body'));
    9999
    100100    $Body = $this->BuildAttachment($this->BuildBody());
     
    103103    $this->Headers['CC'] = '';
    104104    $this->Headers['BCC'] = '';
    105     foreach($this->Recipients as $Index => $Recipient)
    106     {
    107       if($Recipient['Type'] == 'SendCombined')
    108       {
    109         if($Index > 0) $To .= ', ';
     105    foreach ($this->Recipients as $Index => $Recipient)
     106    {
     107      if ($Recipient['Type'] == 'SendCombined')
     108      {
     109        if ($Index > 0) $To .= ', ';
    110110        $To .= $Recipient['Address'];
    111111      } else
    112       if($Recipient['Type'] == 'Send')
    113       {
    114         if($Index > 0) $To .= ', ';
     112      if ($Recipient['Type'] == 'Send')
     113      {
     114        if ($Index > 0) $To .= ', ';
    115115        $To .= $Recipient['Name'].' <'.$Recipient['Address'].'>';
    116116      } else
    117       if($Recipient['Type'] == 'Copy')
    118       {
    119         if($Index > 0) $this->Headers['CC'] .= ', ';
     117      if ($Recipient['Type'] == 'Copy')
     118      {
     119        if ($Index > 0) $this->Headers['CC'] .= ', ';
    120120        $this->Headers['CC'] .= $Recipient['Name'].' <'.$To['Address'].'>';
    121121      } else
    122       if($Recipient['Type'] == 'HiddenCopy')
    123       {
    124         if($Index > 0) $this->Headers['BCC'] .= ', ';
     122      if ($Recipient['Type'] == 'HiddenCopy')
     123      {
     124        if ($Index > 0) $this->Headers['BCC'] .= ', ';
    125125        $this->Headers['BCC'] .= $Recipient['Name'].' <'.$To['Address'].'>';
    126126      }
    127127    }
    128     if($To == '') throw new Exception(T('Mail message need at least one recipient address'));
     128    if ($To == '') throw new Exception(T('Mail message need at least one recipient address'));
    129129
    130130    $this->Headers['Mime-Version'] = '1.0';
    131131
    132     if($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;
    133     if($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo;
    134     if($this->From != '') $this->Headers['From'] = $this->From;
     132    if ($this->AgentIdent != '') $this->Headers['X-Mailer'] = $this->AgentIdent;
     133    if ($this->ReplyTo != '') $this->Headers['Reply-To'] = $this->ReplyTo;
     134    if ($this->From != '') $this->Headers['From'] = $this->From;
    135135
    136136    $Headers = '';
    137     foreach($this->Headers as $Header => $Value)
    138     {
    139       if(($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n";
     137    foreach ($this->Headers as $Header => $Value)
     138    {
     139      if (($Header != 'Subject') and ($Value != '')) $Headers .= $Header.': '.$Value."\n";
    140140    }
    141141
    142142    $this->Subject = strtr($this->Subject, "\r\n", '  ');
    143143
    144     if($this->Subject == '') throw new Exception(T('Mail message missing Subject'));
     144    if ($this->Subject == '') throw new Exception(T('Mail message missing Subject'));
    145145
    146146
    147147    $res = mail($To, $this->Subject, $Body, $Headers);
    148     return($res);
     148    return $res;
    149149  }
    150150
    151151  function ValidEmail($Address)
    152152  {
    153     if(ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1];
    154     if(ereg("^[^@  ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$", $Address))
    155       return(true);
    156       else return(false);
     153    if (ereg(".*<(.+)>", $Address, $regs)) $Address = $regs[1];
     154    if (ereg("^[^@  ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$", $Address))
     155      return true;
     156      else return false;
    157157  }
    158158
    159159  function CheckAdresses($Addresses)
    160160  {
    161     foreach($Addresses as $Address)
    162     {
    163       if(!$this->ValidEmail($Address))
     161    foreach ($Addresses as $Address)
     162    {
     163      if (!$this->ValidEmail($Address))
    164164  throw new Exception(sprintf(T('Mail message invalid address %s'), $Address));
    165165    }
     
    168168  private function ContentEncoding($Charset)
    169169  {
    170     if($Charset != CHARSET_ASCII) return('8bit');
    171       else return('7bit');
     170    if ($Charset != CHARSET_ASCII) return '8bit';
     171      else return '7bit';
    172172  }
    173173
    174174  private function BuildAttachment($Body)
    175175  {
    176     if(count($this->Attachments) > 0)
     176    if (count($this->Attachments) > 0)
    177177    {
    178178      $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\"";
     
    181181      $Result .= $Body;
    182182
    183       foreach($this->Attachments as $Attachment)
     183      foreach ($this->Attachments as $Attachment)
    184184      {
    185185        $FileName = $Attachment['FileName'];
     
    187187        $ContentType = $Attachment['FileType'];
    188188        $Disposition = $Attachment['Disposition'];
    189         if($Attachment['Type'] == 'File')
     189        if ($Attachment['Type'] == 'File')
    190190        {
    191           if(!file_exists($FileName))
     191          if (!file_exists($FileName))
    192192            throw new Exception(sprintf(T('Mail message attached file %s can\'t be found'), $FileName));
    193193          $Data = file_get_contents($FileName);
    194194        } else
    195         if($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];
     195        if ($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];
    196196          else $Data = '';
    197197
     
    203203      }
    204204    } else $Result = $Body;
    205     return($Result);
     205    return $Result;
    206206  }
    207207
     
    209209  {
    210210    $Result = '';
    211     if(count($this->Bodies) > 1)
     211    if (count($this->Bodies) > 1)
    212212    {
    213213      $this->Headers['Content-Type'] = 'multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"';
     
    221221
    222222
    223     foreach($this->Bodies as $Body)
    224     {
    225       if(count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";
     223    foreach ($this->Bodies as $Body)
     224    {
     225      if (count($this->Bodies) > 1) $Result .= "\n\n".'--PHP-alt-'.$this->Boundary."\n";
    226226      $Result .= 'Content-Type: '.$Body['Type'].'; charset='.$Body['Charset'].
    227227        "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n";
    228228    }
    229     return($Result);
     229    return $Result;
    230230  }
    231231}
  • trunk/Packages/Common/NetworkAddress.php

    r861 r880  
    1414  function GetNetMask()
    1515  {
    16     return(0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1));
     16    return 0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1);
    1717  }
    1818
    1919  function AddressToString()
    2020  {
    21     return(implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));
     21    return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255)));
    2222  }
    2323
     
    3737    $To->Address = $From->Address + $HostMask;
    3838    $To->Prefix = 32;
    39     return(array('From' => $From, 'To' => $To));
     39    return array('From' => $From, 'To' => $To);
    4040  }
    4141
     
    4343  {
    4444    $this->Prefix = $NewPrefix;
    45     if($this->Prefix > 32) $this->Prefix = 32;
    46     if($this->Prefix < 0) $this->Prefix = 0;
     45    if ($this->Prefix > 32) $this->Prefix = 32;
     46    if ($this->Prefix < 0) $this->Prefix = 0;
    4747    $this->Address = $this->Address & $this->GetNetMask();
    4848  }
     
    5151  {
    5252    $UpperNetmask = $this->GetNetMask();
    53     if(($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;
     53    if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;
    5454      else $Result = false;
    5555    //echo($Address->AddressToString().'/'.$Address->Prefix.' in '.$this->AddressToString().'/'.$this->Prefix.' '.$Result."\n");
    56     return($Result);
     56    return $Result;
    5757  }
    5858}
     
    7171  function AddressToString()
    7272  {
    73     return(inet_ntop($this->Address));
     73    return inet_ntop($this->Address);
    7474  }
    7575
     
    8383    $Result = array();
    8484    $Data = array_reverse(unpack('C*', $this->Address));
    85     foreach($Data as $Item)
     85    foreach ($Data as $Item)
    8686    {
    8787
     
    8989      $Result[] = dechex(($Item >> 4) & 15);
    9090    }
    91     return($Result);
     91    return $Result;
    9292  }
    9393
  • trunk/Packages/Common/Page.php

    r838 r880  
    1717  function Show()
    1818  {
    19     return('');
     19    return '';
    2020  }
    2121
     
    2323  {
    2424    $Output = $this->Show();
    25     return($Output);
     25    return $Output;
    2626  }
    2727
    2828  function SystemMessage($Title, $Text)
    2929  {
    30     return(call_user_func_array($this->OnSystemMessage, array($Title, $Text)));
     30    return call_user_func_array($this->OnSystemMessage, array($Title, $Text));
    3131  }
    3232}
  • trunk/Packages/Common/PrefixMultiplier.php

    r838 r880  
    7474  function TruncateDigits($Value, $Digits = 4)
    7575  {
    76     for($II = 2; $II > -6; $II--)
     76    for ($II = 2; $II > -6; $II--)
    7777    {
    78       if($Value >= pow(10, $II))
     78      if ($Value >= pow(10, $II))
    7979      {
    80         if($Digits < ($II + 1)) $RealDigits = $II + 1;
     80        if ($Digits < ($II + 1)) $RealDigits = $II + 1;
    8181          else $RealDigits = $Digits;
    8282        $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1);
     
    8484      }
    8585    }
    86     return($Value);
     86    return $Value;
    8787  }
    8888
     
    9393    $Negative = ($Value < 0);
    9494    $Value = abs($Value);
    95     if(($Unit == '') and ($PrefixType != 'Time'))
    96       return($this->TruncateDigits($Value, $Digits));
     95    if (($Unit == '') and ($PrefixType != 'Time'))
     96      return $this->TruncateDigits($Value, $Digits);
    9797
    9898    $I = $PrefixMultipliers[$PrefixType]['BaseIndex'];
    99     if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
     99    if ($Value == 0) return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit;
    100100
    101     if($Value > 1)
     101    if ($Value > 1)
    102102    {
    103       while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
     103      while ((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))
    104104        $I = $I + 1;
    105105    } else
    106     if($Value < 1)
     106    if ($Value < 1)
    107107    {
    108       while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))
     108      while ((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))
    109109        $I = $I - 1;
    110110    }
     
    113113    // Truncate digits count
    114114    $Value = $this->TruncateDigits($Value, $Digits);
    115     if($Negative) $Value = -$Value;
    116     return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);
     115    if ($Negative) $Value = -$Value;
     116    return $Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit;
    117117  }
    118118}
  • trunk/Packages/Common/RSS.php

    r861 r880  
    2828  "    <pubDate>".date('r')."</pubDate>\n".
    2929  "    <ttl>20</ttl>\n";
    30     foreach($this->Items as $Item)
     30    foreach ($this->Items as $Item)
    3131    {
    3232      $Result .= "    <item>\n".
     
    3939    $Result .= "  </channel>\n".
    4040    "</rss>";
    41     return($Result);
     41    return $Result;
    4242  }
    4343}
  • trunk/Packages/Common/Setup.php

    r879 r880  
    2929      '<input type="submit" name="login" value="'.T('Login').'"/>'.
    3030      '</form>';
    31     return($Output);
     31    return $Output;
    3232  }
    3333
     
    3737
    3838    $Output .= 'Je připojení k databázi: '.$this->YesNo[$this->UpdateManager->Database->Connected()].'<br/>';
    39     if($this->UpdateManager->Database->Connected())
     39    if ($this->UpdateManager->Database->Connected())
    4040    {
    4141      $Output .= 'Je instalováno: '.$this->YesNo[$this->UpdateManager->IsInstalled()].'<br/>';
    42       if($this->UpdateManager->IsInstalled())
     42      if ($this->UpdateManager->IsInstalled())
    4343        $Output .= 'Je aktuální: '.$this->YesNo[$this->UpdateManager->IsUpToDate()].'<br/>'.
    4444        'Verze databáze: '.$this->UpdateManager->GetDbVersion().'<br/>';
    4545      $Output .= 'Verze databáze kódu: '.$this->UpdateManager->Revision.'<br/>';
    46       if($this->UpdateManager->IsInstalled())
    47       {
    48         if(!$this->UpdateManager->IsUpToDate())
     46      if ($this->UpdateManager->IsInstalled())
     47      {
     48        if (!$this->UpdateManager->IsUpToDate())
    4949          $Output .= '<a href="?action=upgrade">'.T('Upgrade').'</a> ';
    5050        $Output .= '<a href="?action=insert_sample_data">Vložit vzorová data</a> ';
     
    5959    $Output .= '<a href="'.$this->System->Link('/').'">'.T('Go to main page').'</a> ';
    6060    $Output .= '';
    61     return($Output);
     61    return $Output;
    6262  }
    6363
     
    7373
    7474    $Output = '';
    75     if(isset($this->Config))
    76     {
    77       if(!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
    78       if(array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
    79       if(sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword'])
     75    if (isset($this->Config))
     76    {
     77      if (!array_key_exists('SystemPassword', $_SESSION)) $_SESSION['SystemPassword'] = '';
     78      if (array_key_exists('login', $_POST)) $_SESSION['SystemPassword'] = $_POST['SystemPassword'];
     79      if (sha1($_SESSION['SystemPassword']) != $this->Config['SystemPassword'])
    8080      {
    8181        $Output .= $this->LoginPanel();
    8282      } else
    8383      {
    84         if(array_key_exists('action', $_GET)) $Action = $_GET['action'];
     84        if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
    8585          else $Action = '';
    86         if($Action == 'logout')
     86        if ($Action == 'logout')
    8787        {
    8888          $_SESSION['SystemPassword'] = '';
     
    9090          $Output .= $this->LoginPanel();
    9191        } else
    92         if($Action == 'models')
     92        if ($Action == 'models')
    9393        {
    9494          $this->System->FormManager->UpdateSQLMeta();
    9595        } else
    96         if($Action == 'upgrade')
     96        if ($Action == 'upgrade')
    9797        {
    9898          $Output .= '<h3>Povýšení</h3>';
     
    105105          $Output .= $this->ControlPanel();
    106106        } else
    107         if($Action == 'install')
     107        if ($Action == 'install')
    108108        {
    109109          $Output .= '<h3>Instalace</h3>';
     
    114114          $Output .= $this->ControlPanel();
    115115        } else
    116         if($Action == 'uninstall')
     116        if ($Action == 'uninstall')
    117117        {
    118118          $Output .= '<h3>Odinstalace</h3>';
     
    120120          $Output .= $this->ControlPanel();
    121121        } else
    122         if($Action == 'reload_modules')
     122        if ($Action == 'reload_modules')
    123123        {
    124124          $Output .= '<h3>Znovunačtení seznamu modulů</h3>';
     
    127127          $Output .= $this->ControlPanel();
    128128        } else
    129         if($Action == 'insert_sample_data')
     129        if ($Action == 'insert_sample_data')
    130130        {
    131131          $Output .= '<h3>Vložení vzorových dat</h3>';
     
    133133          $Output .= $this->ControlPanel();
    134134        } else
    135         if($Action == 'modules')
     135        if ($Action == 'modules')
    136136        {
    137137          $Output .= $this->ShowModules();
    138138        } else
    139         if($Action == 'configure_save')
     139        if ($Action == 'configure_save')
    140140        {
    141141           $Output .= $this->ConfigSave($this->Config);
    142142           $Output .= $this->ControlPanel();
    143143        } else
    144         if($Action == 'configure')
     144        if ($Action == 'configure')
    145145        {
    146146          $Output .= $this->PrepareConfig($this->Config);
     
    152152    } else
    153153    {
    154       if(array_key_exists('configure_save', $_POST))
     154      if (array_key_exists('configure_save', $_POST))
    155155      {
    156156        $Output .= $this->ConfigSave(array());
     
    160160      }
    161161    }
    162     return($Output);
     162    return $Output;
    163163  }
    164164
     
    166166  {
    167167    $Output = '';
    168     if(array_key_exists('op', $_GET)) $Operation = $_GET['op'];
     168    if (array_key_exists('op', $_GET)) $Operation = $_GET['op'];
    169169      else $Operation = '';
    170     if($Operation == 'install')
     170    if ($Operation == 'install')
    171171    {
    172172      $this->System->ModuleManager->Modules[$_GET['name']]->Install();
     
    174174      $Output .= 'Modul '.$_GET['name'].' instalován<br/>';
    175175    } else
    176     if($Operation == 'uninstall')
     176    if ($Operation == 'uninstall')
    177177    {
    178178      $this->System->ModuleManager->Modules[$_GET['name']]->Uninstall();
     
    180180      $Output .= 'Modul '.$_GET['name'].' odinstalován<br/>';
    181181    } else
    182     if($Operation == 'enable')
     182    if ($Operation == 'enable')
    183183    {
    184184      $this->System->ModuleManager->Modules[$_GET['name']]->Enable();
     
    186186      $Output .= 'Modul '.$_GET['name'].' povolen<br/>';
    187187    } else
    188     if($Operation == 'disable')
     188    if ($Operation == 'disable')
    189189    {
    190190      $this->System->ModuleManager->Modules[$_GET['name']]->Disable();
     
    192192      $Output .= 'Modul '.$_GET['name'].' zakázán<br/>';
    193193    } else
    194     if($Operation == 'upgrade')
     194    if ($Operation == 'upgrade')
    195195    {
    196196      $this->System->ModuleManager->Modules[$_GET['name']]->Upgrade();
     
    200200    $Output .= '<h3>Správa modulů</h3>';
    201201    $Output .= $this->ShowList();
    202     return($Output);
     202    return $Output;
    203203  }
    204204
     
    221221      array('Name' => '', 'Title' => 'Akce'),
    222222    ));
    223     foreach($this->System->ModuleManager->Modules as $Module)
    224     {
    225       if(($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);
     223    foreach ($this->System->ModuleManager->Modules as $Module)
     224    {
     225      if (($Module->Dependencies) > 0) $Dependencies = implode(',', $Module->Dependencies);
    226226       else $Dependencies = '&nbsp;';
    227227      $Actions = '';
    228       if($Module->Installed == true)
     228      if ($Module->Installed == true)
    229229      {
    230230        $Actions .= ' <a href="?action=modules&amp;op=uninstall&amp;name='.$Module->Name.'">Odinstalovat</a>';
    231         if($Module->Enabled == true) $Actions .= ' <a href="?action=modules&amp;op=disable&amp;name='.$Module->Name.'">Zakázat</a>';
     231        if ($Module->Enabled == true) $Actions .= ' <a href="?action=modules&amp;op=disable&amp;name='.$Module->Name.'">Zakázat</a>';
    232232        else $Actions .= ' <a href="?action=modules&amp;op=enable&amp;name='.$Module->Name.'">Povolit</a>';
    233         if($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&amp;op=upgrade&amp;name='.$Module->Name.'">Povýšit</a>';
     233        if ($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&amp;op=upgrade&amp;name='.$Module->Name.'">Povýšit</a>';
    234234      } else $Actions .= ' <a href="?action=modules&amp;op=install&amp;name='.$Module->Name.'">Instalovat</a>';
    235235
     
    244244    $Output .= $Pageing->Show();
    245245    //$Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>';
    246     return($Output);
     246    return $Output;
    247247  }
    248248
     
    250250  {
    251251    $Output = '';
    252     if(!file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir))
     252    if (!file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir))
    253253      $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože složka "'.$this->ConfigDir.'" není povolená pro zápis!';
    254     if(file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir.'/Config.php'))
     254    if (file_exists($this->ConfigDir.'/Config.php') and !is_writable($this->ConfigDir.'/Config.php'))
    255255      $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor "'.$this->ConfigDir.'/Config.php" není povolen pro zápis!';
    256256    $Output .= '<h3>Nastavení systému</h3>'.
    257257        '<form action="?action=configure_save" method="post">'.
    258258        '<table>';
    259     foreach($this->ConfigDefinition as $Def)
     259    foreach ($this->ConfigDefinition as $Def)
    260260    {
    261261      $PathParts = explode('/', $Def['Name']);
    262262      $TempConfig = &$Config;
    263       foreach($PathParts as $Part)
    264         if(array_key_exists($Part, $TempConfig))
     263      foreach ($PathParts as $Part)
     264        if (array_key_exists($Part, $TempConfig))
    265265        {
    266266          $TempConfig = &$TempConfig[$Part];
    267267        }
    268       if(!is_array($TempConfig)) $Value = $TempConfig;
     268      if (!is_array($TempConfig)) $Value = $TempConfig;
    269269        else $Value = $Def['Default'];
    270270      $Output .= '<tr><td>'.$Def['Title'].'</td><td>';
    271       if($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    272       if($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
    273       if($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
    274       if($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    275       if($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    276       if($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
    277       if($Def['Type'] == 'Array') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.implode(',', $Value).'"/>';
     271      if ($Def['Type'] == 'String') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     272      if ($Def['Type'] == 'Password') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
     273      if ($Def['Type'] == 'PasswordEncoded') $Output .= '<input type="password" name="'.$Def['Name'].'"/>';
     274      if ($Def['Type'] == 'Integer') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     275      if ($Def['Type'] == 'Float') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     276      if ($Def['Type'] == 'Boolean') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.$Value.'"/>';
     277      if ($Def['Type'] == 'Array') $Output .= '<input type="text" name="'.$Def['Name'].'" value="'.implode(',', $Value).'"/>';
    278278    }
    279279    $Output .= '</td></tr>'.
     
    281281        '</table>'.
    282282        '</form>';
    283     return($Output);
     283    return $Output;
    284284  }
    285285
     
    287287  {
    288288    $Config = $DefaultConfig;
    289     foreach($this->ConfigDefinition as $Def)
     289    foreach ($this->ConfigDefinition as $Def)
    290290    {
    291291      $Value = null;
    292       if($Def['Type'] == 'String') if(array_key_exists($Def['Name'], $_POST))
     292      if ($Def['Type'] == 'String') if (array_key_exists($Def['Name'], $_POST))
    293293        $Value = $_POST[$Def['Name']];
    294       if($Def['Type'] == 'Password') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
     294      if ($Def['Type'] == 'Password') if (array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
    295295        $Value = $_POST[$Def['Name']];
    296       if($Def['Type'] == 'PasswordEncoded') if(array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
     296      if ($Def['Type'] == 'PasswordEncoded') if (array_key_exists($Def['Name'], $_POST) and ($_POST[$Def['Name']] != ''))
    297297        $Value = sha1($_POST[$Def['Name']]);
    298       if($Def['Type'] == 'Integer') if(array_key_exists($Def['Name'], $_POST))
     298      if ($Def['Type'] == 'Integer') if (array_key_exists($Def['Name'], $_POST))
    299299        $Value = $_POST[$Def['Name']];
    300       if($Def['Type'] == 'Float') if(array_key_exists($Def['Name'], $_POST))
     300      if ($Def['Type'] == 'Float') if (array_key_exists($Def['Name'], $_POST))
    301301        $Value = $_POST[$Def['Name']];
    302       if($Def['Type'] == 'Boolean') if(array_key_exists($Def['Name'], $_POST))
     302      if ($Def['Type'] == 'Boolean') if (array_key_exists($Def['Name'], $_POST))
    303303        $Value = $_POST[$Def['Name']];
    304       if($Def['Type'] == 'Array') if(array_key_exists($Def['Name'], $_POST))
     304      if ($Def['Type'] == 'Array') if (array_key_exists($Def['Name'], $_POST))
    305305        $Value = explode(',', $_POST[$Def['Name']]);
    306       if(!is_null($Value))
     306      if (!is_null($Value))
    307307      {
    308308        $PathParts = explode('/', $Def['Name']);
    309309        $TempConfig = &$Config;
    310         foreach($PathParts as $Part)
     310        foreach ($PathParts as $Part)
    311311        {
    312312          $TempConfig = &$TempConfig[$Part];
    313313        }
    314         if(!is_array($TempConfig)) $TempConfig = $Value;
     314        if (!is_array($TempConfig)) $TempConfig = $Value;
    315315        else $Value = $Def['Default'];
    316316      }
     
    319319    file_put_contents($this->ConfigDir.'/Config.php', $ConfigText);
    320320    $Output = 'Konfigurace nastavena<br/>';
    321     return($Output);
     321    return $Output;
    322322  }
    323323
     
    327327      "\$IsDeveloper = array_key_exists('REMOTE_ADDR', \$_SERVER) and  in_array(\$_SERVER['REMOTE_ADDR'], array('127.0.0.1'));\n\n";
    328328
    329     foreach($this->ConfigDefinition as $Def)
     329    foreach ($this->ConfigDefinition as $Def)
    330330    {
    331331      $PathParts = explode('/', $Def['Name']);
    332332      $Output .= "\$Config";
    333       foreach($PathParts as $Part)
     333      foreach ($PathParts as $Part)
    334334        $Output .= "['".$Part."']";
    335335      $TempConfig = &$Config;
    336336      $Output .= ' = ';
    337       foreach($PathParts as $Part)
    338         if(array_key_exists($Part, $TempConfig))
     337      foreach ($PathParts as $Part)
     338        if (array_key_exists($Part, $TempConfig))
    339339        {
    340340          $TempConfig = &$TempConfig[$Part];
    341341        }
    342       if(!is_array($TempConfig)) $Value = $TempConfig;
     342      if (!is_array($TempConfig)) $Value = $TempConfig;
    343343        else $Value = $Def['Default'];
    344       if($Def['Type'] == 'Array')
     344      if ($Def['Type'] == 'Array')
    345345      {
    346346        $Output .= ' array(';
    347         foreach($Value as $Index => $Item)
     347        foreach ($Value as $Index => $Item)
    348348          $Output .= '\''.$Item.'\', ';
    349349        $Output .= ')';
     
    353353    }
    354354    $Output .= "\n\n";
    355     return($Output);
     355    return $Output;
    356356  }
    357357}
     
    362362  {
    363363    $Output = '';
    364     if(!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>';
     364    if (!$this->Database->Connected()) $Output .= T('Can\'t connect to database').'<br>';
    365365    else {
    366       if(!$this->System->Setup->UpdateManager->IsInstalled())
     366      if (!$this->System->Setup->UpdateManager->IsInstalled())
    367367        $Output .= T('System requires database initialization').'<br>';
    368368      else
    369       if(!$this->System->Setup->UpdateManager->IsUpToDate())
     369      if (!$this->System->Setup->UpdateManager->IsUpToDate())
    370370        $Output .= T('System requires database upgrade').'<br>';
    371371    }
    372372    $Output .= sprintf(T('Front page was not configured. Continue to %s'), '<a href="'.$this->System->Link('/setup/').'">'.T('setup').'</a>');
    373     return($Output);
     373    return $Output;
    374374  }
    375375}
     
    402402  function CheckState()
    403403  {
    404     return($this->Database->Connected() and $this->UpdateManager->IsInstalled() and
    405       $this->UpdateManager->IsUpToDate());
     404    return $this->Database->Connected() and $this->UpdateManager->IsInstalled() and
     405      $this->UpdateManager->IsUpToDate();
    406406  }
    407407
     
    435435  {
    436436    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->UpdateManager->VersionTable.'"');
    437     return($DbResult->num_rows > 0);
     437    return $DbResult->num_rows > 0;
    438438  }
    439439
     
    443443    $this->UpdateManager->Trace = $Updates->Get();
    444444    $Output = $this->UpdateManager->Upgrade();
    445     return($Output);
     445    return $Output;
    446446  }
    447447}
  • trunk/Packages/Common/Table.php

    r858 r880  
    77  function Show()
    88  {
    9     return('');
     9    return '';
    1010  }
    1111}
     
    1515  function GetCell($Y, $X)
    1616  {
    17     return('');
     17    return '';
    1818  }
    1919
     
    2828  function RowsCount()
    2929  {
    30     return(0);
     30    return 0;
    3131  }
    3232}
     
    3838  function GetCell($Y, $X)
    3939  {
    40     return($this->Cells[$Y][$X]);
     40    return $this->Cells[$Y][$X];
    4141  }
    4242
    4343  function RowsCount()
    4444  {
    45     return(count($this->Cells));
     45    return count($this->Cells);
    4646  }
    4747}
     
    5555  function GetCell($Y, $X)
    5656  {
    57     return($this->Cells[$Y][$X]);
     57    return $this->Cells[$Y][$X];
    5858  }
    5959
     
    6262    $this->Cells = array();
    6363    $DbResult = $this->Database->query($this->Query);
    64     while($DbRow = $DbResult->fetch_row())
     64    while ($DbRow = $DbResult->fetch_row())
    6565    {
    6666      $this->Cells[] = $DbRow;
     
    7575  function RowsCount()
    7676  {
    77     return(count($this->Cells));
     77    return count($this->Cells);
    7878  }
    7979}
     
    114114  {
    115115    $this->Columns = array();
    116     foreach($Columns as $Column)
     116    foreach ($Columns as $Column)
    117117    {
    118118      $NewCol = new TableColumn();
     
    121121      $this->Columns[] = $NewCol;
    122122    }
    123     if(count($this->Columns) > 0)
     123    if (count($this->Columns) > 0)
    124124      $this->DefaultColumn = $this->Columns[0]->Name;
    125125      else $this->DefaultColumn = '';
     
    131131    $Output .= $this->GetOrderHeader();
    132132    $this->Table->BeginRead();
    133     for($Y = 0; $Y < $this->Table->RowsCount(); $Y++)
     133    for ($Y = 0; $Y < $this->Table->RowsCount(); $Y++)
    134134    {
    135135      $Output .= '<tr>';
    136136
    137       for($X = 0; $X < count($this->Columns); $X++)
     137      for ($X = 0; $X < count($this->Columns); $X++)
    138138      {
    139139        $Cell = $this->Table->GetCell($Y, $X);
    140         if($Cell == '') $Output .= '<td>&nbsp;</td>';
     140        if ($Cell == '') $Output .= '<td>&nbsp;</td>';
    141141          else $Output .= '<td>'.$Cell.'</td>';
    142142      }
     
    145145    $this->Table->EndRead();
    146146    $Output .= '</table>';
    147     return($Output);
     147    return $Output;
    148148  }
    149149
    150150  function GetOrderHeader()
    151151  {
    152     if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
    153     if(array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir'];
    154     if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn;
    155     if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder;
     152    if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
     153    if (array_key_exists('OrderDir', $_GET)) $_SESSION['OrderDir'] = $_GET['OrderDir'];
     154    if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $this->DefaultColumn;
     155    if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $this->DefaultOrder;
    156156
    157157    // Check OrderCol
    158158    $Found = false;
    159     foreach($this->Columns as $Column)
     159    foreach ($this->Columns as $Column)
    160160    {
    161       if($Column->Name == $_SESSION['OrderCol'])
     161      if ($Column->Name == $_SESSION['OrderCol'])
    162162      {
    163163        $Found = true;
     
    165165      }
    166166    }
    167     if($Found == false)
     167    if ($Found == false)
    168168    {
    169169      $_SESSION['OrderCol'] = $this->DefaultColumn;
     
    171171    }
    172172    // Check OrderDir
    173     if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))
     173    if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))
    174174      $_SESSION['OrderDir'] = 0;
    175175
    176176    $Result = '';
    177177    $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    178     foreach($this->Columns as $Index => $Column)
     178    foreach ($this->Columns as $Index => $Column)
    179179    {
    180180      $QueryItems['OrderCol'] = $Column->Name;
    181181      $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir'];
    182       if($Column->Name == $_SESSION['OrderCol'])
     182      if ($Column->Name == $_SESSION['OrderCol'])
    183183        $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->OrderArrowImage[$_SESSION['OrderDir']].'" alt="order arrow">';
    184184        else $ArrowImage = '';
    185       if($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>';
     185      if ($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>';
    186186        else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column->Title.$ArrowImage.'</a></th>';
    187187    }
     
    190190    $this->OrderDirection = $_SESSION['OrderDir'];
    191191
    192     return('<tr>'.$Result.'</tr>');
     192    return '<tr>'.$Result.'</tr>';
    193193  }
    194194}
  • trunk/Packages/Common/UTF8.php

    r838 r880  
    529529  {
    530530    $Result = '';
    531     for($I = 0; $I < strlen($String); $I++)
     531    for ($I = 0; $I < strlen($String); $I++)
    532532    {
    533        if(ord($String[$I]) < 128) $Result .= $String[$I];
    534        else if(ord($String[$I]) > 127)
     533       if (ord($String[$I]) < 128) $Result .= $String[$I];
     534       else if (ord($String[$I]) > 127)
    535535       {
    536536         $Result .= $this->CharTable[$Charset][ord($String[$I])];
    537537       }
    538538    }
    539     return($Result);
     539    return $Result;
    540540  }
    541541
     
    544544    $Result = '';
    545545    $UTFPrefix = '';
    546     for($I = 0; $I < strlen($String); $I++)
     546    for ($I = 0; $I < strlen($String); $I++)
    547547    {
    548       if(ord($String{$I}) & 0x80) // UTF control character
     548      if (ord($String{$I}) & 0x80) // UTF control character
    549549      {
    550         if(ord($String{$I}) & 0x40) // First
     550        if (ord($String{$I}) & 0x40) // First
    551551        {
    552           if($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
     552          if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
    553553          $UTFPrefix = $String{$I};
    554554        }
     
    556556      } else
    557557      {
    558         if($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
     558        if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));
    559559        $UTFPrefix = '';
    560560        $Result .= $String{$I};
    561561      }
    562562    }
    563     return($Result);
     563    return $Result;
    564564  }
    565565}
  • trunk/Packages/Common/Update.php

    r858 r880  
    2323    $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1');
    2424    $Version = $DbResult->fetch_assoc();
    25     return($Version['Revision']);
     25    return $Version['Revision'];
    2626  }
    2727
     
    2929  {
    3030    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
    31     return($DbResult->num_rows > 0);
     31    return $DbResult->num_rows > 0;
    3232  }
    3333
    3434  function IsUpToDate()
    3535  {
    36     return($this->Revision <= $this->GetDbVersion());
     36    return $this->Revision <= $this->GetDbVersion();
    3737  }
    3838
     
    4141    $DbRevision = $this->GetDbVersion();
    4242    $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>';
    43     while($this->Revision > $DbRevision)
     43    while ($this->Revision > $DbRevision)
    4444    {
    4545      $TraceItem = $this->Trace[$DbRevision];
     
    5454        $TraceItem['Revision'].' WHERE `Id`=1');
    5555    }
    56     return($Output);
     56    return $Output;
    5757  }
    5858
     
    7979    echo($Query.';<br/>');
    8080    flush();
    81     return($this->Database->query($Query));
     81    return $this->Database->query($Query);
    8282  }
    8383}
  • trunk/Packages/Common/VarDumper.php

    r838 r880  
    4949                self::$_depth=$depth;
    5050                self::dumpInternal($var,0);
    51                 if($highlight)
     51                if ($highlight)
    5252                {
    5353                        $result=highlight_string("<?php\n".self::$_output,true);
     
    6060        private static function dumpInternal($var,$level)
    6161        {
    62                 switch(gettype($var))
     62                switch (gettype($var))
    6363                {
    6464                        case 'boolean':
     
    8484                                break;
    8585                        case 'array':
    86                                 if(self::$_depth<=$level)
     86                                if (self::$_depth<=$level)
    8787                                        self::$_output.='array(...)';
    88                                 else if(empty($var))
     88                                else if (empty($var))
    8989                                        self::$_output.='array()';
    9090                                else
     
    9393                                        $spaces=str_repeat(' ',$level*4);
    9494                                        self::$_output.="array\n".$spaces.'(';
    95                                         foreach($keys as $key)
     95                                        foreach ($keys as $key)
    9696                                        {
    9797                                                self::$_output.="\n".$spaces."    [$key] => ";
     
    102102                                break;
    103103                        case 'object':
    104                                 if(($id=array_search($var,self::$_objects,true))!==false)
     104                                if (($id=array_search($var,self::$_objects,true))!==false)
    105105                                        self::$_output.=get_class($var).'#'.($id+1).'(...)';
    106                                 else if(self::$_depth<=$level)
     106                                else if (self::$_depth<=$level)
    107107                                        self::$_output.=get_class($var).'(...)';
    108108                                else
     
    114114                                        $spaces=str_repeat(' ',$level*4);
    115115                                        self::$_output.="$className#$id\n".$spaces.'(';
    116                                         foreach($keys as $key)
     116                                        foreach ($keys as $key)
    117117                                        {
    118118                                                $keyDisplay=strtr(trim($key),array("\0"=>':'));
  • trunk/alert.php

    r848 r880  
    1515    $DbResult = $this->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '.
    1616        '`User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`Id`=`News`.`User` ORDER BY `News`.`Time` DESC ');
    17     while($Article = $DbResult->fetch_assoc())
     17    while ($Article = $DbResult->fetch_assoc())
    1818    {
    1919      $Output .= ('> '.HumanDate($Article['Time']).' '.$Article['Title']."\n".strip_tags($Article['Text'])."\n\n");
    2020    }
    21     return($Output);
     21    return $Output;
    2222  }
    2323}
  • trunk/includes/FileStream.php

    r815 r880  
    1515  function __destruct()
    1616  {
    17     if($this->Handle)
     17    if ($this->Handle)
    1818      fclose($this->Handle);
    1919  }
     
    2424    $this->CloseFile();
    2525    $this->Handle = fopen($FileName, 'rb');
    26     if(!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
     26    if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
    2727  }
    2828
     
    3232    $this->CloseFile();
    3333    $this->Handle = fopen($FileName, 'wb+');
    34     if(!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
     34    if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
    3535  }
    3636
    3737  public function CloseFile()
    3838  {
    39     if($this->Handle)
     39    if ($this->Handle)
    4040      fclose($this->Handle);
    4141  }
     
    4343  public function ReadBlock($Count)
    4444  {
    45     return(fread($this->Handle, $Count));
     45    return fread($this->Handle, $Count);
    4646  }
    4747
    4848  public function ReadByte()
    4949  {
    50     return(fread($this->Handle, 1));
     50    return fread($this->Handle, 1);
    5151  }
    5252
     
    5454  {
    5555    $val = unpack('V*', fread($this->Handle, 4));
    56     return($val[1]);
     56    return $val[1];
    5757  }
    5858
     
    6060  {
    6161    $val = unpack('I*', fread($this->Handle, 4));
    62     return($val[1]);
     62    return $val[1];
    6363  }
    6464
     
    6666  {
    6767    $val = unpack('f*', fread($this->Handle, 4));
    68     return($val[1]);
     68    return $val[1];
    6969  }
    7070
    7171  public function ReadChar()
    7272  {
    73     return(fread($this->Handle, 1));
     73    return fread($this->Handle, 1);
    7474  }
    7575
    7676  public function ReadLine()
    7777  {
    78     return(fgets($this->Handle));
     78    return fgets($this->Handle);
    7979  }
    8080
    8181  public function ReadTextLine()
    8282  {
    83     return(fgets($this->Handle));
     83    return fgets($this->Handle);
    8484  }
    8585
     
    131131  public function GetPosition()
    132132  {
    133     return(ftell($this->Handle));
     133    return ftell($this->Handle);
    134134  }
    135135
    136136  public function GetSize()
    137137  {
    138     return(filesize($this->FileName));
     138    return filesize($this->FileName);
    139139  }
    140140
    141141  public function SetSize($Size)
    142142  {
    143     return(ftruncate($this->Handle, $Size));
     143    return ftruncate($this->Handle, $Size);
    144144  }
    145145
    146146  public function EOF()
    147147  {
    148     return(feof($this->Handle));
     148    return feof($this->Handle);
    149149  }
    150150}
  • trunk/includes/Global.php

    r879 r880  
    22
    33include_once(dirname(__FILE__).'/../Packages/Common/Common.php');
    4 if(file_exists(dirname(__FILE__).'/../Config/Config.php'))
     4if (file_exists(dirname(__FILE__).'/../Config/Config.php'))
    55  include_once(dirname(__FILE__).'/../Config/Config.php');
    66include_once(dirname(__FILE__).'/../Application/Core.php');
     
    1313
    1414// Back compatibility, will be removed
    15 if(isset($InitSystem) and $InitSystem)
     15if (isset($InitSystem) and $InitSystem)
    1616{
    1717  $System = new Core();
     
    2525  {
    2626    global $TempPageContent;
    27     return($TempPageContent);
     27    return $TempPageContent;
    2828  }
    2929}
     
    5454{
    5555  list($Usec, $Sec) = explode(' ', microtime());
    56   return ((float)$Usec + (float)$Sec);
     56  return (float)$Usec + (float)$Sec;
    5757}
    5858
     
    6464
    6565  $UnitIndex = 0;
    66   while($Value > 1024)
     66  while ($Value > 1024)
    6767  {
    6868    $Value = round($Value / 1024, 3);
    6969    $UnitIndex++;
    7070  }
    71   return($Value.' '.$UnitNames[$UnitIndex]);
     71  return $Value.' '.$UnitNames[$UnitIndex];
    7272}
    7373
     
    7676  $Result = array();
    7777  $Parts = explode('&', $QueryString);
    78   foreach($Parts as $Part)
    79   {
    80     if($Part != '')
    81     {
    82       if(!strpos($Part, '=')) $Part .= '=';
     78  foreach ($Parts as $Part)
     79  {
     80    if ($Part != '')
     81    {
     82      if (!strpos($Part, '=')) $Part .= '=';
    8383      $Item = explode('=', $Part);
    8484      $Result[$Item[0]] = $Item[1];
    8585    }
    8686  }
    87   return($Result);
     87  return $Result;
    8888}
    8989
     
    9191{
    9292  $Parts = array();
    93   foreach($QueryStringArray as $Index => $Item)
     93  foreach ($QueryStringArray as $Index => $Item)
    9494  {
    9595    $Parts[] = $Index.'='.$Item;
    9696  }
    97   return(implode('&amp;', $Parts));
     97  return implode('&amp;', $Parts);
    9898}
    9999
     
    107107  //$return = Str_Replace(Array("(",")",".","!",",","\"","'"), "", $return); //odstraní ().!,"'
    108108  //$return = StrToLower($return); // velká písmena nahradí malými.
    109   return($return);
     109  return $return;
    110110}
    111111
     
    116116  $Days = floor($Days - $month * 30);
    117117  $month = $month - $year * 12;
    118   return($year.'r '.$month.'m '.$Days.'d');
     118  return $year.'r '.$month.'m '.$Days.'d';
    119119}
    120120
     
    137137
    138138  error_reporting(E_ALL ^ E_WARNING);
    139   if (($handle = @fopen($url, "r")) === FALSE) return(false);
     139  if (($handle = @fopen($url, "r")) === FALSE) return false;
    140140
    141141  $data = stream_get_contents($handle);
     
    164164  $data = strip_tags($data);
    165165
    166   return($data);
     166  return $data;
    167167}
    168168
     
    178178  $PageCount = floor($TotalCount / $ItemPerPage) + 1;
    179179
    180   if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    181   if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    182   if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    183   if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     180  if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     181  if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     182  if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     183  if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    184184  $CurrentPage = $_SESSION['Page'];
    185185
     
    188188
    189189  $Result = '';
    190   if($PageCount > 1)
    191   {
    192     if($CurrentPage > 0)
     190  if ($PageCount > 1)
     191  {
     192    if ($CurrentPage > 0)
    193193    {
    194194      $QueryItems['page'] = 0;
     
    199199    $PagesMax = $PageCount - 1;
    200200    $PagesMin = 0;
    201     if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    202     if($PagesMin < ($CurrentPage - $Around))
     201    if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     202    if ($PagesMin < ($CurrentPage - $Around))
    203203    {
    204204      $Result.= ' ... ';
    205205      $PagesMin = $CurrentPage - $Around;
    206206    }
    207     for($i = $PagesMin; $i <= $PagesMax; $i++)
    208     {
    209       if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     207    for ($i = $PagesMin; $i <= $PagesMax; $i++)
     208    {
     209      if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    210210      else {
    211211       $QueryItems['page'] = $i;
     
    213213      }
    214214    }
    215     if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    216     if($CurrentPage < ($PageCount - 1))
     215    if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     216    if ($CurrentPage < ($PageCount - 1))
    217217    {
    218218      $QueryItems['page'] = ($CurrentPage + 1);
     
    223223  }
    224224  $Result = '<div style="text-align: center">'.$Result.'</div>';
    225   return(array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
     225  return array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,
    226226    'Page' => $CurrentPage,
    227227    'Output' => $Result,
    228   ));
     228  );
    229229}
    230230
     
    236236  global $OrderDirSQL, $OrderArrowImage, $Config, $System;
    237237
    238   if(array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
    239   if(array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))
     238  if (array_key_exists('OrderCol', $_GET)) $_SESSION['OrderCol'] = $_GET['OrderCol'];
     239  if (array_key_exists('OrderDir', $_GET) and (array_key_exists($_GET['OrderDir'], $OrderArrowImage)))
    240240    $_SESSION['OrderDir'] = $_GET['OrderDir'];
    241   if(!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;
    242   if(!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;
     241  if (!array_key_exists('OrderCol', $_SESSION)) $_SESSION['OrderCol'] = $DefaultColumn;
     242  if (!array_key_exists('OrderDir', $_SESSION)) $_SESSION['OrderDir'] = $DefaultOrder;
    243243
    244244  // Check OrderCol
    245245  $Found = false;
    246   foreach($Columns as $Column)
    247   {
    248     if($Column['Name'] == $_SESSION['OrderCol'])
     246  foreach ($Columns as $Column)
     247  {
     248    if ($Column['Name'] == $_SESSION['OrderCol'])
    249249    {
    250250      $Found = true;
     
    252252    }
    253253  }
    254   if($Found == false)
     254  if ($Found == false)
    255255  {
    256256    $_SESSION['OrderCol'] = $DefaultColumn;
     
    258258  }
    259259  // Check OrderDir
    260   if(($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;
     260  if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) $_SESSION['OrderDir'] = 0;
    261261
    262262  $Result = '';
    263263  $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    264   foreach($Columns as $Index => $Column)
     264  foreach ($Columns as $Index => $Column)
    265265  {
    266266    $QueryItems['OrderCol'] = $Column['Name'];
    267267    $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir'];
    268     if($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.
     268    if ($Column['Name'] == $_SESSION['OrderCol']) $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.
    269269      $System->Link('/images/'.$OrderArrowImage[$_SESSION['OrderDir']]).'" alt="order arrow"/>';
    270270      else $ArrowImage = '';
    271     if($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';
     271    if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';
    272272      else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>';
    273273  }
    274   return(array(
     274  return array(
    275275    'SQL' => ' ORDER BY `'.$_SESSION['OrderCol'].'` '.$OrderDirSQL[$_SESSION['OrderDir']],
    276276    'Output' => '<tr>'.$Result.'</tr>',
    277277    'Column' => $_SESSION['OrderCol'],
    278278    'Direction' => $_SESSION['OrderDir'],
    279   ));
     279  );
    280280}
    281281
     
    287287  $DbResult = $System->Database->select('ClientVersion', '`Id`, `Version`', '`Imported` = 1');
    288288  $Output .= '<option value=""';
    289   if($Selected == '')
     289  if ($Selected == '')
    290290    $Output .= ' selected="selected"';
    291291  $Output .= '>'.T('None').'</option>';
    292   while($ClientVersion = $DbResult->fetch_assoc())
     292  while ($ClientVersion = $DbResult->fetch_assoc())
    293293  {
    294294    $Output .= '<option value="'.$ClientVersion['Id'].'"';
    295     if($Selected == $ClientVersion['Id'])
     295    if ($Selected == $ClientVersion['Id'])
    296296      $Output .= ' selected="selected"';
    297297    $Output .= '>'.$ClientVersion['Version'].'</option>';
    298298  }
    299299  $Output .= '</select>';
    300   return($Output);
     300  return $Output;
    301301}
    302302
     
    307307  $Result = array();
    308308  $DbResult = $System->Database->query('SELECT * FROM `Language` WHERE `Enabled` = 1');
    309   while($DbRow = $DbResult->fetch_assoc())
     309  while ($DbRow = $DbResult->fetch_assoc())
    310310    $Result[$DbRow['Id']] = $DbRow;
    311   return($Result);
     311  return $Result;
    312312}
    313313
     
    316316function HumanDate($SQLDateTime)
    317317{
    318   if($SQLDateTime == '') return('&nbsp;');
     318  if ($SQLDateTime == '') return '&nbsp;';
    319319  $DateTimeParts = explode(' ', $SQLDateTime);
    320   if($DateTimeParts[0] != '0000-00-00')
     320  if ($DateTimeParts[0] != '0000-00-00')
    321321  {
    322322    $DateParts = explode('-', $DateTimeParts[0]);
    323     return(($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1));
    324   } else return('&nbsp;');
     323    return ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1);
     324  } else return '&nbsp;';
    325325}
    326326
    327327function HumanDateTime($SQLDateTime)
    328328{
    329   if($SQLDateTime == '') return('&nbsp;');
     329  if ($SQLDateTime == '') return '&nbsp;';
    330330  $DateTimeParts = explode(' ', $SQLDateTime);
    331   if($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '')
     331  if ($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '')
    332332  {
    333333    $DateParts = explode('-', $DateTimeParts[0]);
    334334    $Output = ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1);
    335335  } else $Output = '&nbsp;';
    336   if(count($DateTimeParts) > 1)
    337   if($DateTimeParts[1] != '00:00:00')
     336  if (count($DateTimeParts) > 1)
     337  if ($DateTimeParts[1] != '00:00:00')
    338338  {
    339339    $TimeParts = explode(':', $DateTimeParts[1]);
    340340    $Output .= ' '.($TimeParts[0] * 1).':'.($TimeParts[1] * 1).':'.($TimeParts[2] * 1);
    341341  };
    342   return($Output);
     342  return $Output;
    343343}
    344344
     
    347347  global $System, $Config;
    348348
    349   if($Prev)
     349  if ($Prev)
    350350    $sql = 'SELECT `ID` FROM `'.$Table.'` AS `item` WHERE '.
    351351      '(`Language` = '.$Config['OriginalLanguage'].') AND NOT EXISTS(SELECT `entry` '.
     
    359359  $DbResult = $System->Database->query($sql);
    360360  $Next = $DbResult->fetch_assoc();
    361   if($Next)
    362   {
    363     if($Prev) $Output = '<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ';
     361  if ($Next)
     362  {
     363    if ($Prev) $Output = '<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ';
    364364    else $Output = '<a href="form.php?group='.$GroupId.'&amp;ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> ';
    365       return('form.php?group='.$GroupId.'&amp;ID='.$Next['ID']);
     365      return 'form.php?group='.$GroupId.'&amp;ID='.$Next['ID'];
    366366  }
    367367}
     
    371371  global $System, $BuildNumbers;
    372372
    373   if(isset($BuildNumbers[$Version]) == false)
     373  if (isset($BuildNumbers[$Version]) == false)
    374374  {
    375375    $sql = 'SELECT `BuildNumber` FROM `ClientVersion` WHERE `Version` = "'.$Version.'"';
     
    378378    $BuildNumbers[$Version] = $DbRow['BuildNumber'];
    379379  }
    380   return($BuildNumbers[$Version]);
     380  return $BuildNumbers[$Version];
    381381}
    382382
     
    386386  global $System, $VersionsWOW;
    387387
    388   if(isset($VersionsWOW[$BuildNumber]) == false)
     388  if (isset($VersionsWOW[$BuildNumber]) == false)
    389389  {
    390390    $sql = 'SELECT `Version` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"';
     
    393393    $VersionsWOW[$BuildNumber] = $Version['Version'];
    394394  }
    395   return($VersionsWOW[$BuildNumber]);
     395  return $VersionsWOW[$BuildNumber];
    396396}
    397397
     
    401401  global $System, $VersionsWOWId;
    402402
    403   if(isset($VersionsWOWId[$BuildNumber]) == false)
     403  if (isset($VersionsWOWId[$BuildNumber]) == false)
    404404  {
    405405    $sql = 'SELECT `Id` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"';
     
    408408    $VersionsWOWId[$BuildNumber] = $Version['Id'];
    409409  }
    410   return($VersionsWOWId[$BuildNumber]);
     410  return $VersionsWOWId[$BuildNumber];
    411411}
    412412
     
    416416  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    417417
    418   if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;
     418  if (array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;
    419419    else $GroupId = 1;
    420420
    421   if(isset($TranslationTree[$GroupId]) == false) ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
    422   return($GroupId);
     421  if (isset($TranslationTree[$GroupId]) == false) ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
     422  return $GroupId;
    423423}
    424424
    425425function LoadCommandLineParameters()
    426426{
    427   if(!array_key_exists('REMOTE_ADDR', $_SERVER))
    428   {
    429     foreach($_SERVER['argv'] as $Parameter)
    430     {
    431       if(strpos($Parameter, '=') !== false)
     427  if (!array_key_exists('REMOTE_ADDR', $_SERVER))
     428  {
     429    foreach ($_SERVER['argv'] as $Parameter)
     430    {
     431      if (strpos($Parameter, '=') !== false)
    432432      {
    433433        $Index = substr($Parameter, 0, strpos($Parameter, '='));
     
    444444  $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']);
    445445
    446   if(array_key_exists('Tab', $_GET)) $_SESSION['Tab'] = $_GET['Tab'];
    447   if(!array_key_exists('Tab', $_SESSION)) $_SESSION['Tab'] = 0;
    448   if(($_SESSION['Tab'] < 0) or ($_SESSION['Tab'] > (count($Tabs) - 1))) $_SESSION['Tab'] = 0;
     446  if (array_key_exists('Tab', $_GET)) $_SESSION['Tab'] = $_GET['Tab'];
     447  if (!array_key_exists('Tab', $_SESSION)) $_SESSION['Tab'] = 0;
     448  if (($_SESSION['Tab'] < 0) or ($_SESSION['Tab'] > (count($Tabs) - 1))) $_SESSION['Tab'] = 0;
    449449  $Output = '<div id="header">'.
    450450    '<ul>';
    451   foreach($Tabs as $Index => $Tab)
     451  foreach ($Tabs as $Index => $Tab)
    452452  {
    453453    $QueryItems['Tab'] = $Index;
    454     if($Index == $_SESSION['Tab']) $Selected = ' id="selected"';
     454    if ($Index == $_SESSION['Tab']) $Selected = ' id="selected"';
    455455      else $Selected = '';
    456456    $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>';
    457457  }
    458458  $Output .= '</ul></div>';
    459   return($Output);
     459  return $Output;
    460460}
    461461
    462462function CheckBox($Name, $Checked = false, $Id = '', $Class = '', $Disabled = false)
    463463{
    464   if($Id) $Id = ' id="'.$Id.'"'; else $Id = '';
    465   if($Class) $Class = ' class="'.$Class.'"'; else $Class = '';
    466   if($Checked) $Checked = ' checked="checked"'; else $Checked = '';
    467   if($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
    468   return('<input type="checkbox" value="checked" name="'.$Name.'"'.$Checked.$Disabled.$Id.$Class.' />');
     464  if ($Id) $Id = ' id="'.$Id.'"'; else $Id = '';
     465  if ($Class) $Class = ' class="'.$Class.'"'; else $Class = '';
     466  if ($Checked) $Checked = ' checked="checked"'; else $Checked = '';
     467  if ($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
     468  return '<input type="checkbox" value="checked" name="'.$Name.'"'.$Checked.$Disabled.$Id.$Class.' />';
    469469}
    470470
    471471function RadioButton($Name, $Value, $Checked = false, $OnClick = '', $Disabled = false)
    472472{
    473   if($Checked) $Checked = ' checked="checked"'; else $Checked = '';
    474   if($OnClick != '') $OnClick = ' onclick="'.$OnClick.'"'; else $OnClick = '';
    475   if($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
    476   return('<input type="radio" name="'.$Name.'" value="'.$Value.'"'.$Checked.$Disabled.$OnClick.'/>');
     473  if ($Checked) $Checked = ' checked="checked"'; else $Checked = '';
     474  if ($OnClick != '') $OnClick = ' onclick="'.$OnClick.'"'; else $OnClick = '';
     475  if ($Disabled) $Disabled = ' disabled="disabled"'; else $Disabled = '';
     476  return '<input type="radio" name="'.$Name.'" value="'.$Value.'"'.$Checked.$Disabled.$OnClick.'/>';
    477477}
    478478
    479479function SelectOption($Name, $Text, $Selected = false)
    480480{
    481   if($Selected) $Selected = ' selected="selected"'; else $Selected = '';
    482   return('<option value="'.$Name.'"'.$Selected.'>'.$Text.'</option>');
     481  if ($Selected) $Selected = ' selected="selected"'; else $Selected = '';
     482  return '<option value="'.$Name.'"'.$Selected.'>'.$Text.'</option>';
    483483}
    484484
    485485function DeleteDirectory($dirname)
    486486{
    487   if(is_dir($dirname))
     487  if (is_dir($dirname))
    488488  {
    489489    $dir_handle = opendir($dirname);
    490     if(!$dir_handle) return(false);
    491     while($file = readdir($dir_handle))
    492     {
    493       if(($file != '.') and ($file != '..'))
     490    if (!$dir_handle) return false;
     491    while ($file = readdir($dir_handle))
     492    {
     493      if (($file != '.') and ($file != '..'))
    494494      {
    495         if(!is_dir($dirname.'/'.$file)) unlink($dirname.'/'.$file);
     495        if (!is_dir($dirname.'/'.$file)) unlink($dirname.'/'.$file);
    496496          else DeleteDirectory($dirname.'/'.$file);
    497497      }
     
    500500    rmdir($dirname);
    501501  }
    502   return(true);
     502  return true;
    503503}
    504504
     
    515515  $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree();
    516516
    517   foreach($TranslationTree as $TableID => $Value)
    518   {
    519     if($Value['TablePrefix'] == $Table) return $TableID;
     517  foreach ($TranslationTree as $TableID => $Value)
     518  {
     519    if ($Value['TablePrefix'] == $Table) return $TableID;
    520520  }
    521521}
     
    540540    'Dictionary' => 'Text',
    541541  );
    542   return($TablesColumn);
     542  return $TablesColumn;
    543543}
    544544
     
    578578  $sqlall = '';
    579579
    580   foreach($TablesColumn as $Table => $Column)
     580  foreach ($TablesColumn as $Table => $Column)
    581581  {
    582582    $orderinby = ' ORDER BY ID DESC ';
     
    588588
    589589    $where = '(`Language` = '.$Config['OriginalLanguage'].') ';
    590     if ($mode == 1) 
     590    if ($mode == 1)
    591591    {
    592592      $where .= ' AND EXISTS(SELECT 1 FROM `'.$Table.
     
    594594      ') AND (`Sub`.`Entry` = `O`.`Entry`))';
    595595    }
    596     if ($mode == 2) 
     596    if ($mode == 2)
    597597    {
    598598      $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.
     
    601601    }
    602602    $where .= ' AND (';
    603     if (array_search('the', $ArrStr)) 
     603    if (array_search('the', $ArrStr))
    604604    {
    605605      $where .= '(`O`.`'.$Column.'` LIKE "The %") OR ';
     
    607607
    608608    $SqlOK = false;
    609     if (count($ArrStr) > 0) 
     609    if (count($ArrStr) > 0)
    610610    {
    611611      for ($i = 0; $i < count($ArrStr); $i++)
     
    614614        if ((strlen($ArrStr[$i]) > 3) or ( ((count($ArrStr) < 6) or ($i == 0)) and (strlen($ArrStr[$i]) > 0) ) )  //length
    615615          if ((!$FirstBig) or (ctype_upper(substr($ArrStr[$i], 0, 1))) or (count($ArrStr) < 6) )  //first big
    616             if (array_search($ArrStr[$i], $ArrStr) == $i) 
     616            if (array_search($ArrStr[$i], $ArrStr) == $i)
    617617            {  // first in array
    618618              $where .= '(`O`.`'.$Column.'` LIKE "'.addslashes($ArrStr[$i]).'%") OR ';
     
    623623      $where .= ')';
    624624    }
    625     if ($SqlOK) 
     625    if ($SqlOK)
    626626    {
    627627        //$sql.$where.$groupby.$orderby
    628628//          $buff[] = array($Line['ID'], GetIDbyName($Table), $Line['Orig'], $Line['Tran']);
    629       if ($sqlall <> '') 
    630       { 
    631         $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';     
     629      if ($sqlall <> '')
     630      {
     631        $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';
    632632      } else {
    633         $sqlall .= ' ( '.$sql.$where.$groupby.' )';             
     633        $sqlall .= ' ( '.$sql.$where.$groupby.' )';
    634634      }
    635635    }
    636636  }
    637   if ($SqlOK) 
     637  if ($SqlOK)
    638638  {
    639639    $orderby = ' ORDER BY LENGTH(Orig) DESC ';
     
    641641    $DbResult = $System->Database->query($sqlall.$orderby);
    642642    //  echo ($sql.'|'.$where.'|'.$groupby);
    643     while($Line = $DbResult->fetch_assoc())
     643    while ($Line = $DbResult->fetch_assoc())
    644644    {
    645645      $buff[] = array($Line['ID'], $Line['GroupId'], $Line['Orig'], $Line['Tran']);
     
    652652{
    653653  $Pixels = $Width * ($Percent / 100);
    654   if($Pixels > $Width) $Pixels = $Width;
    655   if($Text == '') $Text = $Percent;
    656 
    657   return('<div class="progressbar" style="width: '.$Width.'px">'.
     654  if ($Pixels > $Width) $Pixels = $Width;
     655  if ($Text == '') $Text = $Percent;
     656
     657  return '<div class="progressbar" style="width: '.$Width.'px">'.
    658658    '<div class="bar" style="width: '.$Pixels.'px;"></div>'.
    659659    '<div class="text" style="width: '.$Width.'px">'.$Text.'</div>'.
    660     '</div>');
     660    '</div>';
    661661}
    662662
     
    665665  $IndexLevel = 100;
    666666
    667   if($XP > 0) $Level = floor(sqrt($XP / $IndexLevel));
     667  if ($XP > 0) $Level = floor(sqrt($XP / $IndexLevel));
    668668    else $Level = 0;
    669669  $MinXP = $Level * $Level * $IndexLevel;
     
    671671  $MaxXP = $MaxXP - $MinXP;
    672672  $XP = $XP - $MinXP;
    673   return(array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP));
     673  return array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP);
    674674}
    675675
     
    677677{
    678678  $Result = $Default;
    679   if(array_key_exists($Name, $_GET)) $Result = $_GET[$Name];
    680   else if(array_key_exists($Name, $_POST)) $Result = $_POST[$Name];
    681   else if($Session and array_key_exists($Name, $_SESSION)) $Result = $_SESSION[$Name];
    682   if($Numeric and !is_numeric($Result)) $Result = $Default;
    683   if($Session) $_SESSION[$Name] = $Result;
    684   return($Result);
     679  if (array_key_exists($Name, $_GET)) $Result = $_GET[$Name];
     680  else if (array_key_exists($Name, $_POST)) $Result = $_POST[$Name];
     681  else if ($Session and array_key_exists($Name, $_SESSION)) $Result = $_SESSION[$Name];
     682  if ($Numeric and !is_numeric($Result)) $Result = $Default;
     683  if ($Session) $_SESSION[$Name] = $Result;
     684  return $Result;
    685685}
    686686
     
    693693  $Result = '';
    694694  $I = 0;
    695   while((strpos($Content, 'http://') !== false) or (strpos($Content, 'https://') !== false))
    696   {
    697     if(strpos($Content, 'http://') !== false) $I = strpos($Content, 'http://');
    698     if(strpos($Content, 'https://') !== false) $I = strpos($Content, 'https://');
     695  while ((strpos($Content, 'http://') !== false) or (strpos($Content, 'https://') !== false))
     696  {
     697    if (strpos($Content, 'http://') !== false) $I = strpos($Content, 'http://');
     698    if (strpos($Content, 'https://') !== false) $I = strpos($Content, 'https://');
    699699    $Result .= substr($Content, 0, $I);
    700700    $Content = substr($Content, $I);
    701701    $SpacePos = strpos($Content, ' ');
    702     if($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' '));
     702    if ($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' '));
    703703      else $URL = substr($Content, 0);
    704704
     
    707707  }
    708708  $Result .= $Content;
    709   return($Result);
     709  return $Result;
    710710}
    711711
     
    729729  );
    730730
    731   return('<div class="message" style="background-color: '.$BackgroundColor[$Type].
     731  return '<div class="message" style="background-color: '.$BackgroundColor[$Type].
    732732    ';"><table><tr><td class="icon"><img src="'.
    733733    $System->Link('/images/message/'.$IconName[$Type].'.png').'" alt="'.
    734     $IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>');
     734    $IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>';
    735735}
    736736
    737737function ProcessURL()
    738738{
    739   if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
     739  if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
    740740    $PathString = $_SERVER['REDIRECT_QUERY_STRING'];
    741741  else $PathString = '';
    742   if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
     742  if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
    743743  $PathItems = explode('/', $PathString);
    744   if(strpos(GetRequestURI(), '?') !== false)
     744  if (strpos(GetRequestURI(), '?') !== false)
    745745    $_SERVER['QUERY_STRING'] = substr(GetRequestURI(), strpos(GetRequestURI(), '?') + 1);
    746746  else $_SERVER['QUERY_STRING'] = '';
    747747  parse_str($_SERVER['QUERY_STRING'], $_GET);
    748748  // SQL injection hack protection
    749   foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    750   return($PathItems);
     749  foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
     750  return $PathItems;
    751751}
    752752
     
    757757  $Output = '<select name="Language">';
    758758  $DbResult = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1');
    759   while($Language = $DbResult->fetch_assoc())
     759  while ($Language = $DbResult->fetch_assoc())
    760760  {
    761761    $Output .= '<option value="'.$Language['Id'].'"';
    762     if($Selected == $Language['Id'])
     762    if ($Selected == $Language['Id'])
    763763      $Output .= ' selected="selected"';
    764764    $Output .= '>'.T($Language['Name']).'</option>';
    765765  }
    766766  $Output .= '</select>';
    767   return($Output);
     767  return $Output;
    768768}
    769769
    770770function GetClientProxyAddresses()
    771771{
    772   if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
     772  if (array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
    773773    else $IP = array();
    774774}
     
    776776function GetRemoteAddress()
    777777{
    778   if(array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
     778  if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];
    779779    else $IP = '';
    780   return($IP);
     780  return $IP;
    781781}
    782782
    783783function GetRequestURI()
    784784{
    785   if(array_key_exists('REQUEST_URI', $_SERVER)) return($_SERVER['REQUEST_URI']);
    786     else return($_SERVER['PHP_SELF']);
    787 }
     785  if (array_key_exists('REQUEST_URI', $_SERVER)) return $_SERVER['REQUEST_URI'];
     786    else return $_SERVER['PHP_SELF'];
     787}
  • trunk/includes/MemoryStream.php

    r815 r880  
    2020    $Result = substr($this->Data, $this->Position, $Count);
    2121    $this->Position = $this->Position + $Count;
    22     return($Result);
     22    return $Result;
    2323  }
    2424
     
    2727    $Result = $this->Data[$this->Position];
    2828    $this->Position = $this->Position + 1;
    29     return($Result);
     29    return $Result;
    3030  }
    3131
     
    3434    $val = unpack('V*', substr($this->Data, $this->Position, 4));
    3535    $this->Position = $this->Position + 4;
    36     return($val[1]);
     36    return $val[1];
    3737  }
    3838
     
    4141    $val = unpack('I*', substr($this->Data, $this->Position, 4));
    4242    $this->Position = $this->Position + 4;
    43     return($val[1]);
     43    return $val[1];
    4444  }
    4545
     
    4848    $val = unpack('f*', substr($this->Data, $this->Position, 4));
    4949    $this->Position = $this->Position + 4;
    50     return($val[1]);
     50    return $val[1];
    5151  }
    5252
     
    5555    $Result = $this->Data[$this->Position];
    5656    $this->Position = $this->Position + 1;
    57     return($Result);
     57    return $Result;
    5858  }
    5959
     
    6262    $Length = 0;
    6363    $StartPosition = $this->Position;
    64     while(!$this->EOF())
     64    while (!$this->EOF())
    6565    {
    6666      $Char = $this->ReadChar();
    67       if($Char == $EndSymbol) break;
     67      if ($Char == $EndSymbol) break;
    6868    }
    6969    $Result = substr($this->Data, $StartPosition, $this->Position - $StartPosition);
    70     return($Result);
     70    return $Result;
    7171  }
    7272
     
    116116  public function GetPosition()
    117117  {
    118     return($this->Position);
     118    return $this->Position;
    119119  }
    120120
    121121  public function GetSize()
    122122  {
    123     return(strlen($this->Data));
     123    return strlen($this->Data);
    124124  }
    125125
    126126  public function SetSize($Size)
    127127  {
    128     return($this->Data = substr($this->Data, 0, $Size));
     128    return $this->Data = substr($this->Data, 0, $Size);
    129129  }
    130130
    131131  public function EOF()
    132132  {
    133     return($this->Position >= strlen($this->Data));
     133    return $this->Position >= strlen($this->Data);
    134134  }
    135135}
  • trunk/includes/PageEdit.php

    r838 r880  
    1616    );
    1717    $this->AllowEdit = false;
    18     if($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&amp;id=#Id');
     18    if ($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&amp;id=#Id');
    1919  }
    2020
     
    2222  {
    2323    $Output = '';
    24     if(array_key_exists('action', $_GET))
     24    if (array_key_exists('action', $_GET))
    2525    {
    26       if($_GET['action'] == 'add') $Output .= $this->AddItem();
    27       else if($_GET['action'] == 'view') $Output .= $this->ViewItem();
    28       else if($_GET['action'] == 'edit') $Output .= $this->ModifyItem();
    29       else if($_GET['action'] == 'remove') $Output .= $this->RemoveItem();
    30       else if($_GET['action'] == 'delete') $Output .= $this->DeleteItem();
     26      if ($_GET['action'] == 'add') $Output .= $this->AddItem();
     27      else if ($_GET['action'] == 'view') $Output .= $this->ViewItem();
     28      else if ($_GET['action'] == 'edit') $Output .= $this->ModifyItem();
     29      else if ($_GET['action'] == 'remove') $Output .= $this->RemoveItem();
     30      else if ($_GET['action'] == 'delete') $Output .= $this->DeleteItem();
    3131      else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL);
    3232    } else $Output .= $this->ViewList();
    33     return($Output);
     33    return $Output;
    3434  }
    3535
     
    3737  {
    3838    $DbResult = $this->Database->query('SELECT * FROM ('.$this->TableSQL.') AS `T` WHERE `Id`='.$_GET['id']);
    39     if($DbResult->num_rows > 0)
     39    if ($DbResult->num_rows > 0)
    4040    {
    4141      $DbRow = $DbResult->fetch_assoc();
     
    4343      $Output = T('Item').
    4444        '<table>';
    45       foreach($this->Definition as $DefIndex => $Def)
     45      foreach ($this->Definition as $DefIndex => $Def)
    4646      {
    4747        $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->ViewControl($Def['Type'], $DefIndex, $DbRow[$DefIndex]).'</tr>';
     
    5050        '</table>';
    5151    } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    52     if($this->AllowEdit)
     52    if ($this->AllowEdit)
    5353    {
    5454      $Output .= '<a href="?action=add">'.T('Add').'</a> ';
     
    5757    }
    5858    $Output .= '<a href="?">'.T('List').'</a><br/>';
    59     return($Output);
     59    return $Output;
    6060  }
    6161
     
    6969    $Output .= '<table class="BaseTable">';
    7070    $TableColumns = array();
    71     foreach($this->Definition as $Index => $Def)
    72       if($Def['InList'])
     71    foreach ($this->Definition as $Index => $Def)
     72      if ($Def['InList'])
    7373        $TableColumns[] = array('Name' => $Index, 'Title' => $Def['Title']);
    74     if(count($this->ItemActions) > 0)
     74    if (count($this->ItemActions) > 0)
    7575      $TableColumns[] = array('Name' => '', 'Title' => 'Akce');
    7676
     
    7979
    8080    $DbResult = $this->Database->query('SELECT * FROM ('.$this->Table.') '.$Order['SQL'].$PageList['SQLLimit']);
    81     while($Item = $DbResult->fetch_assoc())
     81    while ($Item = $DbResult->fetch_assoc())
    8282    {
    8383      $Output .= '<tr>';
    84       foreach($this->Definition as $Index => $Def)
    85       if($Def['InList'])
     84      foreach ($this->Definition as $Index => $Def)
     85      if ($Def['InList'])
    8686      {
    87         if($Def['Type'] == 'URL') $Output .= '<td><a href="'.$Item[$Index].'">'.$Item[$Index].'</a></td>';
     87        if ($Def['Type'] == 'URL') $Output .= '<td><a href="'.$Item[$Index].'">'.$Item[$Index].'</a></td>';
    8888          else $Output .= '<td>'.$Item[$Index].'</td>';
    8989      }
    90       if(count($this->ItemActions) > 0)
     90      if (count($this->ItemActions) > 0)
    9191      {
    9292        $Output .= '<td>';
    93         foreach($this->ItemActions as $Index => $Action)
     93        foreach ($this->ItemActions as $Index => $Action)
    9494        {
    9595          $URL = $Action['URL'];
    96           if(strpos($URL, '#Id')) $URL = str_replace('#Id', $Item['Id'], $URL);
     96          if (strpos($URL, '#Id')) $URL = str_replace('#Id', $Item['Id'], $URL);
    9797          $Output .= '<a href="'.$URL.'">'.$Action['Name'].'</a> ';
    9898        }
     
    102102    }
    103103    $Output .= '</table>';
    104     if($this->AllowEdit) $Output .= '<a href="?action=add">'.T('Add').'</a><br/>';
    105     return($Output);
     104    if ($this->AllowEdit) $Output .= '<a href="?action=add">'.T('Add').'</a><br/>';
     105    return $Output;
    106106  }
    107107
     
    109109  {
    110110    $Output = '';
    111     if($this->System->User->Licence(LICENCE_USER))
     111    if ($this->System->User->Licence(LICENCE_USER))
    112112    {
    113       if(array_key_exists('finish', $_GET))
     113      if (array_key_exists('finish', $_GET))
    114114      {
    115115        $Items = array();
    116         foreach($this->Definition as $Index => $Def)
     116        foreach ($this->Definition as $Index => $Def)
    117117        {
    118118          $Items[$Index] = $_POST[$Index];
     
    125125          '<fieldset><legend>'.T('New item').'</legend>'.
    126126          '<table>';
    127         foreach($this->Definition as $DefIndex => $Def)
     127        foreach ($this->Definition as $DefIndex => $Def)
    128128        {
    129129          $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->GetControl($Def['Type'], $DefIndex, '').'</tr>';
     
    135135      }
    136136    } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    137     return($Output);
     137    return $Output;
    138138  }
    139139
    140140  function DeleteItem()
    141141  {
    142     if($this->System->User->Licence(LICENCE_USER))
     142    if ($this->System->User->Licence(LICENCE_USER))
    143143    {
    144144      $this->Database->query('DELETE FROM `'.$this->Table.'` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')');
    145145      $Output = ShowMessage(T('Record removed'));
    146146    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    147     return($Output);
     147    return $Output;
    148148  }
    149149
    150150  function GetControl($Type, $Name, $Value)
    151151  {
    152     if($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>';
    153     else if($Type == 'Boolean') $Output = '<input type="checkbox" name="'.$Name.'"/>';
     152    if ($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>';
     153    else if ($Type == 'Boolean') $Output = '<input type="checkbox" name="'.$Name.'"/>';
    154154    else $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>';
    155     return($Output);
     155    return $Output;
    156156  }
    157157
    158158  function ViewControl($Type, $Name, $Value)
    159159  {
    160     if($Type == 'Text') $Output = $Value;
    161     else if($Type == 'URL') $Output = '<a href="'.$Value.'">'.$Value.'</a>';
    162     else if($Type == 'Boolean') $Output = $Value;
     160    if ($Type == 'Text') $Output = $Value;
     161    else if ($Type == 'URL') $Output = '<a href="'.$Value.'">'.$Value.'</a>';
     162    else if ($Type == 'Boolean') $Output = $Value;
    163163    else $Output = $Value;
    164     return($Output);
     164    return $Output;
    165165  }
    166166}
  • trunk/includes/dbc.php

    r815 r880  
    3535
    3636    $this->ColumnFormat = $ColumnFormat;
    37     if($this->ReadUint() != DBC_SIGNATURE) die(NOT_DBC_FILE);
     37    if ($this->ReadUint() != DBC_SIGNATURE) die(NOT_DBC_FILE);
    3838
    3939    $this->RecordCount = $this->ReadUint();
     
    4343
    4444    $this->GenerateOffsetTable();
    45     if($this->EndOffset != $this->RecordSize)
     45    if ($this->EndOffset != $this->RecordSize)
    4646    die(RECORD_SIZE_NOT_MATCH.$this->EndOffset.' <> '.$this->RecordSize);
    4747  }
     
    7171  {
    7272    // Preallocate array
    73     if($this->FieldCount > 0) $this->Offsets = array_fill(0, $this->FieldCount, 0);
     73    if ($this->FieldCount > 0) $this->Offsets = array_fill(0, $this->FieldCount, 0);
    7474      else $this->Offsets = array();
    7575
    7676    $Offset = 0;
    7777    $I = 0;
    78     while($I < $this->FieldCount)
     78    while ($I < $this->FieldCount)
    7979    {
    8080      $this->Offsets[$I] = $Offset;
    81       if(array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
     81      if (array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
    8282        else $Format = FORMAT_UINT32;
    83       switch($Format)
     83      switch ($Format)
    8484      {
    8585        case FORMAT_BYTE:
     
    100100  private function CellPos($Row, $Column)
    101101  {
    102     return($this->HeaderSize + $Row * $this->RecordSize + $this->Offsets[$Column]);
     102    return $this->HeaderSize + $Row * $this->RecordSize + $this->Offsets[$Column];
    103103  }
    104104
     
    106106  {
    107107    $this->SetPosition($this->CellPos($Row, $Column));
    108     return($this->ReadByte());
     108    return $this->ReadByte();
    109109  }
    110110
     
    112112  {
    113113    $this->SetPosition($this->CellPos($Row, $Column));
    114     return($this->ReadUint());
     114    return $this->ReadUint();
    115115  }
    116116
     
    118118  {
    119119    $this->SetPosition($this->CellPos($Row, $Column));
    120     return($this->ReadInt());
     120    return $this->ReadInt();
    121121  }
    122122
     
    124124  {
    125125    $this->SetPosition($this->CellPos($Row, $Column));
    126     return($this->ReadFloat());
     126    return $this->ReadFloat();
    127127  }
    128128
     
    156156
    157157    $Position = $this->HeaderSize + $this->RecordCount * $this->RecordSize + $Offset;
    158     if($Position >= $this->GetSize()) return('');
     158    if ($Position >= $this->GetSize()) return '';
    159159    $this->SetPosition($Position);
    160160
    161161    $String = '';
    162     while(($Char = $this->ReadChar()) != "\0")
     162    while (($Char = $this->ReadChar()) != "\0")
    163163    {
    164164      $String .= $Char;
    165165    }
    166     return($String);
     166    return $String;
    167167  }
    168168
    169169  public function SetString($Row, $Column, $Value)
    170170  {
    171     if(in_array($Value, $this->StringList))
     171    if (in_array($Value, $this->StringList))
    172172    {
    173173      $this->SetUint($Row, $Column, $this->StringListOffset[array_search($Value, $this->StringList)]);
     
    192192    $this->SetPosition($this->HeaderSize + $this->RecordCount * $this->RecordSize);
    193193    $this->WriteByte(0);
    194     foreach($this->StringList as $Index => $Item)
     194    foreach ($this->StringList as $Index => $Item)
    195195    {
    196196      $this->WriteString($Item."\0");
     
    206206
    207207    // Preallocate array
    208     if($this->FieldCount > 0) $Line = array_fill(0, $this->FieldCount, 0);
     208    if ($this->FieldCount > 0) $Line = array_fill(0, $this->FieldCount, 0);
    209209      else $Line = array();
    210     for($I = 0; $I < $this->FieldCount; $I++)
    211     {
    212       if(array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
     210    for ($I = 0; $I < $this->FieldCount; $I++)
     211    {
     212      if (array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
    213213        else $Format = FORMAT_UINT32;
    214214      $Record->SetPosition($this->Offsets[$I]);
    215       switch($Format)
     215      switch ($Format)
    216216      {
    217217        case FORMAT_BYTE:
     
    231231
    232232          $Position = $this->HeaderSize + $this->RecordCount * $this->RecordSize + $Offset;
    233           if($Position >= $this->GetSize()) $String = '';
     233          if ($Position >= $this->GetSize()) $String = '';
    234234          else
    235235          {
    236236            $this->SetPosition($Position);
    237237            $String = '';
    238             while(($Char = $this->ReadChar()) != "\0")
     238            while (($Char = $this->ReadChar()) != "\0")
    239239              $String .= $Char;
    240240          }
     
    245245      }
    246246    }
    247     return($Line);
     247    return $Line;
    248248  }
    249249
     
    253253    $Record = new MemoryStream();
    254254
    255     for($I = 0; $I < $this->FieldCount; $I++)
    256     {
    257       if(array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
     255    for ($I = 0; $I < $this->FieldCount; $I++)
     256    {
     257      if (array_key_exists($I, $this->ColumnFormat)) $Format = $this->ColumnFormat[$I];
    258258        else $Format = FORMAT_UINT32;
    259259      $Record->SetPosition($this->Offsets[$I]);
    260       switch($Format)
     260      switch ($Format)
    261261      {
    262262        case FORMAT_BYTE:
     
    273273          break;
    274274        case FORMAT_STRING:
    275           if(in_array($Line[$I], $this->StringList))
     275          if (in_array($Line[$I], $this->StringList))
    276276          {
    277277            $Record->WriteUint($this->StringListOffset[array_search($Line[$I], $this->StringList)]);
     
    291291    $this->SetPosition($this->CellPos($Row, 0));
    292292    $this->WriteBlock($Record->Data, $this->RecordSize);
    293     return($Line);
     293    return $Line;
    294294  }
    295295
    296296  public function GetRecordCount()
    297297  {
    298     return($this->RecordCount);
     298    return $this->RecordCount;
    299299  }
    300300
     
    306306  public function GetFieldCount()
    307307  {
    308     return($this->FieldCount);
     308    return $this->FieldCount;
    309309  }
    310310
Note: See TracChangeset for help on using the changeset viewer.