- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 70 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Core.php
r878 r880 34 34 35 35 $this->Config = $Config; 36 if (isset($this->Config['Web']['Timezone']))36 if (isset($this->Config['Web']['Timezone'])) 37 37 date_default_timezone_set($this->Config['Web']['Timezone']); 38 38 mb_internal_encoding("UTF-8"); 39 39 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']; 49 49 } 50 50 … … 60 60 ); 61 61 62 if (GetRemoteAddress() != '')62 if (GetRemoteAddress() != '') 63 63 { 64 64 $this->BaseURL = $_SERVER["CONTEXT_PREFIX"]; … … 68 68 69 69 // Detect interface locale 70 if (isset($this->Config['Web']['Locale']))70 if (isset($this->Config['Web']['Locale'])) 71 71 $this->LocaleManager->DefaultLangCode = $this->Config['Web']['Locale']; 72 72 $this->LocaleManager->LangCode = $this->LocaleManager->DefaultLangCode; 73 if (count($this->PathItems) > 0)73 if (count($this->PathItems) > 0) 74 74 { 75 75 $NewLangCode = $this->PathItems[0]; 76 if (array_key_exists($NewLangCode, $this->LocaleManager->Available)) {76 if (array_key_exists($NewLangCode, $this->LocaleManager->Available)) { 77 77 array_shift($this->PathItems); 78 78 $this->LocaleManager->LangCode = $NewLangCode; 79 79 } 80 80 } 81 if (array_key_exists($this->LocaleManager->LangCode, $this->LocaleManager->Available))81 if (array_key_exists($this->LocaleManager->LangCode, $this->LocaleManager->Available)) 82 82 $this->LocaleManager->LoadLocale($this->LocaleManager->LangCode); 83 83 … … 109 109 110 110 $ScriptStartTime = GetMicrotime(); 111 //if (GetRemoteAddress() != '')111 //if (GetRemoteAddress() != '') 112 112 session_start(); 113 113 114 114 // 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); 119 119 else $_POST[$Index] = addslashes($_POST[$Index]); 120 120 } 121 foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);121 foreach ($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 122 122 123 123 $this->RegisterPageBar('Top'); … … 130 130 $this->Setup->Start(); 131 131 $this->Setup->UpdateManager->VersionTable = 'DbVersion'; 132 if ($this->Setup->CheckState())132 if ($this->Setup->CheckState()) 133 133 { 134 134 $this->ModuleManager->Start(); … … 136 136 137 137 $this->BaseView = new BaseView($this); 138 if ($this->DoNotShowPage == false)138 if ($this->DoNotShowPage == false) 139 139 { 140 140 $this->ShowPage(); … … 145 145 { 146 146 list($Usec, $Sec) = explode(' ', microtime()); 147 return ( (float)$Usec + (float)$Sec);147 return (float)$Usec + (float)$Sec; 148 148 } 149 149 … … 152 152 $Remaining = substr($Target, strlen($this->BaseURL)); 153 153 $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)) 157 157 { 158 return ($this->BaseURL.$Target);159 } 160 } 161 return ($this->LinkLocale($Target));158 return $this->BaseURL.$Target; 159 } 160 } 161 return $this->LinkLocale($Target); 162 162 } 163 163 … … 168 168 $RemainingParts = explode('?', $Remaining); 169 169 $Directory = $RemainingParts[0]; 170 if (count($RemainingParts) > 1)170 if (count($RemainingParts) > 1) 171 171 { 172 172 $Params = $RemainingParts[1]; … … 180 180 181 181 $DirectoryParts = explode('/', $Directory); 182 foreach ($DirectoryParts as $Index => $Item)182 foreach ($DirectoryParts as $Index => $Item) 183 183 { 184 184 $NewText = $TargetLocaleManager->CurrentLocale->Texts->Translate($Item, 'URL'); … … 187 187 $Directory = implode('/', $DirectoryParts); 188 188 $Remaining = $Directory; 189 if ($Params != '') $Remaining .= '?'.$Params;190 191 return ($Remaining);189 if ($Params != '') $Remaining .= '?'.$Params; 190 191 return $Remaining; 192 192 } 193 193 … … 198 198 $RemainingParts = explode('?', $Remaining); 199 199 $Directory = $RemainingParts[0]; 200 if (count($RemainingParts) > 1)200 if (count($RemainingParts) > 1) 201 201 { 202 202 $Params = $RemainingParts[1]; … … 210 210 211 211 $DirectoryParts = explode('/', $Directory); 212 foreach ($DirectoryParts as $Index => $Item)212 foreach ($DirectoryParts as $Index => $Item) 213 213 { 214 214 $NewText = $TargetLocaleManager->CurrentLocale->Texts->TranslateReverse($Item, 'URL'); … … 217 217 $Directory = implode('/', $DirectoryParts); 218 218 $Remaining = $Directory; 219 if ($Params != '') $Remaining .= '?'.$Params;220 221 return ($Remaining);219 if ($Params != '') $Remaining .= '?'.$Params; 220 221 return $Remaining; 222 222 } 223 223 224 224 function LinkLocale($Target, $Locale = '') 225 225 { 226 if ($Locale == '') $Locale = $this->LocaleManager->LangCode;226 if ($Locale == '') $Locale = $this->LocaleManager->LangCode; 227 227 228 228 $Target = $this->TranslateURL($Target, $Locale); 229 229 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; 233 233 } 234 234 235 235 function RegisterPage($Path, $Handler) 236 236 { 237 if (is_array($Path))237 if (is_array($Path)) 238 238 { 239 239 $Page = &$this->Pages; 240 240 $LastKey = array_pop($Path); 241 foreach ($Path as $PathItem)241 foreach ($Path as $PathItem) 242 242 { 243 243 $Page = &$Page[$PathItem]; 244 244 } 245 if (!is_array($Page)) $Page = array('' => $Page);245 if (!is_array($Page)) $Page = array('' => $Page); 246 246 $Page[$LastKey] = $Handler; 247 247 } else $this->Pages[$Path] = $Handler; … … 250 250 function RegisterMenuItem($MenuItem, $Pos = NULL) 251 251 { 252 if (is_null($Pos)) $this->Menu[] = $MenuItem;252 if (is_null($Pos)) $this->Menu[] = $MenuItem; 253 253 else { 254 254 array_splice($this->Menu, $Pos, 0, array($MenuItem)); … … 258 258 function SearchPage($PathItems, $Pages) 259 259 { 260 if (count($PathItems) == 0) $PathItems = array('');260 if (count($PathItems) == 0) $PathItems = array(''); 261 261 $PathItem = $PathItems[0]; 262 262 $PathItem = $this->LocaleManager->CurrentLocale->Texts->TranslateReverse($PathItem, 'URL'); 263 263 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])) 267 267 { 268 268 array_shift($PathItems); 269 return ($this->SearchPage($PathItems, $Pages[$PathItem]));269 return $this->SearchPage($PathItems, $Pages[$PathItem]); 270 270 } else 271 271 { 272 if (count($PathItems) == 1) return($Pages[$PathItem]);273 else return (''); // Unexpected subpages274 } 275 } else return ('');272 if (count($PathItems) == 1) return $Pages[$PathItem]; 273 else return ''; // Unexpected subpages 274 } 275 } else return ''; 276 276 } 277 277 … … 279 279 { 280 280 // 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)) 282 282 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']; 284 284 else $Referer = ''; 285 if (isset($this->ModuleManager->Modules['Log']))285 if (isset($this->ModuleManager->Modules['Log'])) 286 286 $this->ModuleManager->Modules['Log']->WriteLog('Stránka "'. 287 287 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); 289 289 } 290 290 … … 295 295 /* @var $Page Page */ 296 296 $ClassName = $this->SearchPage($this->PathItems, $this->Pages); 297 if (($ClassName != '') and (class_exists($ClassName)))297 if (($ClassName != '') and (class_exists($ClassName))) 298 298 { 299 299 $Page = new $ClassName($this); 300 300 $Output = $Page->GetOutput(); 301 301 $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); 303 303 } else { 304 304 $Output2 = ''; 305 if ((count($this->OnPageNotFound) == 2)305 if ((count($this->OnPageNotFound) == 2) 306 306 and method_exists($this->OnPageNotFound[0], $this->OnPageNotFound[1])) 307 307 $Output2 = call_user_func_array($this->OnPageNotFound, array()); 308 if ($Output2 != '') $Output .= $this->BaseView->ShowPage($Output2);308 if ($Output2 != '') $Output .= $this->BaseView->ShowPage($Output2); 309 309 else { 310 310 $Output = $this->PageNotFound(); … … 338 338 function HumanDate($Time) 339 339 { 340 return (date('j.n.Y', $Time));340 return date('j.n.Y', $Time); 341 341 } 342 342 } -
trunk/Application/DefaultConfig.php
r861 r880 6 6 { 7 7 $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1')); 8 return (array(8 return array( 9 9 array('Name' => 'SystemPassword', 'Type' => 'PasswordEncoded', 'Default' => '', 'Title' => 'System password'), 10 10 array('Name' => 'Database/Host', 'Type' => 'String', 'Default' => 'localhost', 'Title' => 'Server'), … … 46 46 array('Name' => 'OriginalLanguage', 'Type' => 'Integer', 'Default' => 1, 'Title' => 'Original language'), 47 47 array('Name' => 'EnableGoogleTranslate', 'Type' => 'Boolean', 'Default' => false, 'Title' => 'Enable Google translate'), 48 ) );48 ); 49 49 } 50 50 } -
trunk/Application/UpdateTrace.php
r879 r880 2483 2483 2484 2484 $DbResult = $System->Database->query('SELECT `TablePrefix` FROM `Group`'); 2485 while ($Group = $DbResult->fetch_assoc())2485 while ($Group = $DbResult->fetch_assoc()) 2486 2486 { 2487 2487 $Manager->Execute('ALTER TABLE `'.$Group['TablePrefix'].'` ADD FOREIGN KEY ( `Language` ) REFERENCES `Language` ('. … … 2532 2532 // Set all string collation to utf8 general 2533 2533 $DbResult = $Manager->Execute("SHOW TABLES"); 2534 while ($DbRow = $DbResult->fetch_row())2534 while ($DbRow = $DbResult->fetch_row()) 2535 2535 { 2536 2536 $Manager->Execute("ALTER TABLE `".$DbRow[0]."` CONVERT TO CHARACTER SET utf8"); … … 2946 2946 2947 2947 function UpdateTo872($Manager) 2948 { 2948 { 2949 2949 // Allow to store IPv6 addresses 2950 2950 $Manager->Execute('ALTER TABLE `UserOnline` CHANGE `IpAddress` `IpAddress` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT "";'); … … 2957 2957 2958 2958 function UpdateTo873($Manager) 2959 { 2959 { 2960 2960 $Manager->Execute('ALTER TABLE `User` CHANGE `XP` `XP` INT(11) NOT NULL DEFAULT "0";'); 2961 2961 $Manager->Execute('ALTER TABLE `User` CHANGE `TranslatedCount` `TranslatedCount` INT(11) NOT NULL DEFAULT "0";'); … … 2971 2971 function Get() 2972 2972 { 2973 return (array(2973 return array( 2974 2974 498 => array('Revision' => 506, 'Function' => 'UpdateTo506'), 2975 2975 506 => array('Revision' => 510, 'Function' => 'UpdateTo510'), … … 3006 3006 867 => array('Revision' => 872, 'Function' => 'UpdateTo872'), 3007 3007 872 => array('Revision' => 873, 'Function' => 'UpdateTo873'), 3008 ) );3008 ); 3009 3009 } 3010 3010 } -
trunk/Application/View.php
r864 r880 9 9 //$Output .= ' <form action="?setlocale" method="get">'; 10 10 $Output = ' <select onchange="window.location=this.value">'; 11 foreach ($this->System->LocaleManager->Available as $Locale)11 foreach ($this->System->LocaleManager->Available as $Locale) 12 12 { 13 13 $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.'/') 15 15 $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"'; 17 17 else $Selected = ''; 18 18 $Remaining = $this->System->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode); … … 23 23 $Output .= '</select><noscript><span><input type="submit" value="Submit"/></span></noscript>'; 24 24 25 return ($Output);25 return $Output; 26 26 } 27 27 … … 29 29 { 30 30 $Output = '<div class="Menu">'; 31 if (isset($this->System->User))31 if (isset($this->System->User)) 32 32 { 33 if (!$this->System->User->Licence(LICENCE_USER))33 if (!$this->System->User->Licence(LICENCE_USER)) 34 34 $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>'; 35 35 } … … 38 38 // Show bars items 39 39 $Bar = ''; 40 foreach ($this->System->Bars['Top'] as $BarItem)40 foreach ($this->System->Bars['Top'] as $BarItem) 41 41 $Bar .= call_user_func($BarItem); 42 if (trim($Bar) != '') $Output .= $Bar;42 if (trim($Bar) != '') $Output .= $Bar; 43 43 else $Output .= ' '; 44 44 … … 46 46 //$Output .= '</form>'; 47 47 $Output .= '</span></div>'; 48 return ($Output);48 return $Output; 49 49 } 50 50 … … 53 53 $Output = '<strong>'.T('Menu').':</strong>'. 54 54 '<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'])) 57 57 { 58 if (isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';58 if (isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"'; 59 59 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']).'"/>'; 61 61 else $Icon = ''; 62 62 $Output .= '<li>'.$Icon.'<a class="verticalmenua" title="'.$MenuItem['Hint'].'" href="'. … … 64 64 } 65 65 $Output .= '</ul></div>'; 66 return ($Output);66 return $Output; 67 67 } 68 68 … … 83 83 // Show page headers 84 84 $Bar = ''; 85 foreach ($this->System->PageHeaders as $Item)85 foreach ($this->System->PageHeaders as $Item) 86 86 $Output .= call_user_func($Item); 87 87 88 88 $Title = $this->System->Config['Web']['Title']; 89 if ($this->Title != '') $Title = $this->Title.' - '.$Title;89 if ($this->Title != '') $Title = $this->Title.' - '.$Title; 90 90 $Output .= '<title>'.$Title.'</title>'. 91 91 '<script src="'.$this->System->Link('/style/respond.js').'"></script>'. … … 98 98 // Show bars items 99 99 $Bar = ''; 100 foreach ($this->System->Bars['Left'] as $BarItem)100 foreach ($this->System->Bars['Left'] as $BarItem) 101 101 $Bar .= call_user_func($BarItem); 102 if (trim($Bar) != '') $Output .= $Bar;102 if (trim($Bar) != '') $Output .= $Bar; 103 103 else $Output .= ' '; 104 104 105 105 $Output .= '</td><td id="border-left"></td><td class="content">'; 106 return ($Output);106 return $Output; 107 107 } 108 108 … … 117 117 // Show bars items 118 118 $Bar = ''; 119 foreach ($this->System->Bars['Right'] as $BarItem)119 foreach ($this->System->Bars['Right'] as $BarItem) 120 120 $Bar .= call_user_func($BarItem); 121 if (trim($Bar) != '') $Output .= $Bar;121 if (trim($Bar) != '') $Output .= $Bar; 122 122 else $Output .= ' '; 123 123 $Output .= '</td>'; … … 129 129 130 130 $Output .= '</td></tr>'; 131 if ($this->System->Config['Web']['ShowRuntimeInfo'] == true)131 if ($this->System->Config['Web']['ShowRuntimeInfo'] == true) 132 132 $Output .= '<tr><td colspan="3" style="text-align: center;">'.T('Generating duration').': '. 133 133 $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s '.T('Used memory').': '. … … 137 137 '</body>'. 138 138 '</html>'; 139 return ($Output);139 return $Output; 140 140 } 141 141 … … 143 143 { 144 144 $Output = $this->ShowHeader().$Content.$this->ShowFooter(); 145 if ($this->System->Config['Web']['FormatOutput'])145 if ($this->System->Config['Web']['FormatOutput']) 146 146 $Output = $this->FormatOutput($Output); 147 return ($Output);147 return $Output; 148 148 } 149 149 … … 153 153 $nn = 0; 154 154 $n = 0; 155 while ($s != '')155 while ($s != '') 156 156 { 157 157 $start = strpos($s, '<'); 158 158 $end = strpos($s, '>'); 159 if ($start != 0)159 if ($start != 0) 160 160 { 161 161 $end = $start - 1; … … 163 163 } 164 164 $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] == '<') 167 167 { 168 if ($s[$start + 1] == '/')168 if ($s[$start + 1] == '/') 169 169 { 170 170 $n = $n - 2; … … 172 172 } else 173 173 { 174 if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);174 if (strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 175 175 else $cmd = substr($line, 1, strlen($line) - 2); 176 176 //echo('['.$cmd.']'); 177 if (strpos($s, '</'.$cmd.'>')) $n = $n + 2;177 if (strpos($s, '</'.$cmd.'>')) $n = $n + 2; 178 178 } 179 179 }// 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"); 183 183 $s = substr($s, $end + 1, strlen($s)); 184 184 $nn = $n; 185 185 } 186 return ($out);186 return $out; 187 187 } 188 188 } -
trunk/Modules/Admin/Admin.php
r859 r880 52 52 '<a href="'.$this->System->Link('/admin/?action=merge').'">Sjednocení textů</a><br/>'. 53 53 '<small>Sjednotí stejné originální texty v databázi</small><br/><br/>'; 54 return ($Output);54 return $Output; 55 55 } 56 56 … … 72 72 function ShowPHPInfo() 73 73 { 74 return (phpinfo());74 return phpinfo(); 75 75 } 76 76 … … 86 86 '<a href="'.$this->System->Link('/admin/?action=sqlerror').'">Chybný SQL dotaz</a><br/>'. 87 87 '<small>Vyvolá testovací chybu</small><br/><br/>'; 88 return ($Output);88 return $Output; 89 89 } 90 90 … … 103 103 ); 104 104 $Output = 'Questy: <br />'; 105 while ($quest = $DbResult->fetch_assoc())105 while ($quest = $DbResult->fetch_assoc()) 106 106 { 107 107 $Output .= $quest['ID'].', '; … … 109 109 } 110 110 $Output .= '<br / ><br / >Questy nastaveny jako nedokončené!'; 111 return ($Output);111 return $Output; 112 112 } 113 113 … … 117 117 118 118 $Output = ''; 119 foreach ($TranslationTree as $Group)119 foreach ($TranslationTree as $Group) 120 120 // $Group = $TranslationTree[1]; 121 121 { … … 130 130 $DbResult = $this->System->Database->query($sql); 131 131 echo ': <br />'.$Group['TablePrefix'].': <br />'; 132 while ($line = $DbResult->fetch_assoc())132 while ($line = $DbResult->fetch_assoc()) 133 133 { 134 134 echo ($line['ID'].', '); … … 138 138 echo '<br / >Verze '.$Group['TablePrefix'].' opraveny!'; 139 139 } 140 return ('Hotovo!');140 return 'Hotovo!'; 141 141 } 142 142 … … 145 145 $Text = strtolower($Text); 146 146 $Text = str_replace(' ', '', $Text); 147 return ($Text);147 return $Text; 148 148 } 149 149 … … 153 153 154 154 $Output = ''; 155 foreach ($TranslationTree as $Group)155 foreach ($TranslationTree as $Group) 156 156 // $Group = $TranslationTree[1]; 157 157 { … … 164 164 $DbResult = $this->System->Database->query($sql); 165 165 echo ': <br />'.$Group['TablePrefix'].': '; 166 while ($line = $DbResult->fetch_assoc())166 while ($line = $DbResult->fetch_assoc()) 167 167 { 168 168 $sql = 'SELECT * FROM `'.$Group['TablePrefix'] .'` as `T` '. … … 171 171 // echo $sql; 172 172 $DbResult2 = $this->System->Database->query($sql); 173 if ($DbResult2->num_rows > 0) {173 if ($DbResult2->num_rows > 0) { 174 174 $line2 = $DbResult2->fetch_assoc(); 175 175 176 176 $Same = true; 177 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {177 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 178 178 if ($this->StripText($line[$Column['Column']]) <> $this->StripText($line2[$Column['Column']])) 179 179 $Same = false; … … 186 186 ' WHERE `T`.`Entry` = '.$line['Entry'].' AND (`T`.`Take` = '.$line['ID'].' OR `T`.`Take` = '.$line2['ID'].') '; 187 187 $DbResult3 = $this->System->Database->query($sql); 188 while ($line3 = $DbResult3->fetch_assoc()) {188 while ($line3 = $DbResult3->fetch_assoc()) { 189 189 echo $line3['ID'].' '; 190 190 $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$line2['VersionEnd'].', `VersionStart` = '.$line['VersionStart'].', `Take` = '.$line['ID'].' WHERE ID='.$line3['ID']); … … 199 199 echo('Texty '.$Group['TablePrefix'].' sjednoceny!'); 200 200 } 201 return ('Hotovo!');201 return 'Hotovo!'; 202 202 } 203 203 … … 224 224 $Group = $TranslationTree[$_GET['id']]; 225 225 // $Output .= '<form action="?action=dbcstructure&id='.$Group['Id'].'">'; 226 // foreach ($Group['Items'] as $GroupItem)226 // foreach ($Group['Items'] as $GroupItem) 227 227 // { 228 228 // $Output .= $GroupItem['Column'].': <input name="'.$GroupItem['Id'].'"><br />'; … … 236 236 $Group['DBCFileName'].'.dbc.csv'); 237 237 238 //while (!$File->EOF())238 //while (!$File->EOF()) 239 239 240 240 $Output .= '<table class="BaseTable">'; … … 248 248 $Output .= '</td></tr><tr><td>'; 249 249 for ($i = 0; $i < substr_count($Line, ','); $i++) { 250 foreach ($Group['Items'] as $GroupItem)250 foreach ($Group['Items'] as $GroupItem) 251 251 $Output .= ' <a href="'.$this->System->Link('/admin/?action=dbcstructure&id='. 252 252 $Group['Id'].'&GroupItem='.$GroupItem['Id'].'&ColumnIndex='.$i).'">'. … … 269 269 } else { 270 270 $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion`'); 271 while ($Version = $DbResult->fetch_assoc())271 while ($Version = $DbResult->fetch_assoc()) 272 272 { 273 273 $Output .= '<a href="'.$this->System->Link('/admin/?action=dbcstructure&GameVersion='. … … 276 276 $Output .= '<br /><br />'; 277 277 278 foreach ($TranslationTree as $Group)278 foreach ($TranslationTree as $Group) 279 279 { 280 280 if ($Group['DBCFileName'] <> '') … … 283 283 } 284 284 } 285 return ($Output);285 return $Output; 286 286 } 287 287 … … 291 291 $Output = 'Překlad rozhraní přegenerován'; 292 292 $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) 294 294 $Output .= '<tr><td>'.$Index.'</td><td>'.$Item.'</td></tr>'; 295 295 $Output .= '</table>'; 296 296 $Output .= 'Překladové soubory zaktualizovány'; 297 return ($Output);297 return $Output; 298 298 } 299 299 … … 302 302 $this->Title = T('Administration'); 303 303 $Output = ''; 304 if ($this->System->User->Licence(LICENCE_ADMIN))304 if ($this->System->User->Licence(LICENCE_ADMIN)) 305 305 { 306 if (array_key_exists('action', $_GET))306 if (array_key_exists('action', $_GET)) 307 307 { 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(); 318 318 else $Output .= $this->ShowMenu(); 319 319 } else $Output .= $this->ShowMenu(); 320 320 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 321 return ($Output);321 return $Output; 322 322 } 323 323 } -
trunk/Modules/AoWoW/AoWoW.php
r838 r880 23 23 'Icon' => '', 24 24 )); 25 if (array_key_exists('Search', $this->System->ModuleManager->Modules))25 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 26 26 $this->System->ModuleManager->Modules['Search']->RegisterSearch('aowow', 27 27 T('AoWoW'), array(), '', $this->System->Link('/aowow/?search=')); -
trunk/Modules/ClientVersion/ClientVersion.php
r843 r880 31 31 function Show() 32 32 { 33 if (array_key_exists('action', $_GET))33 if (array_key_exists('action', $_GET)) 34 34 { 35 if ($_GET['action'] == 'item') $Output = $this->ShowItem();35 if ($_GET['action'] == 'item') $Output = $this->ShowItem(); 36 36 else $Output = $this->ShowList(); 37 37 } else $Output = $this->ShowList(); 38 return ($Output);38 return $Output; 39 39 } 40 40 41 41 function ShowItem() 42 42 { 43 if (array_key_exists('id', $_GET))43 if (array_key_exists('id', $_GET)) 44 44 { 45 45 $YesNo = array('Ne', 'Ano'); 46 46 $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) 48 48 { 49 49 $Version = $DbResult->fetch_assoc(); … … 60 60 '</table>'; 61 61 $Output .= '<div><a href="?">'.T('All versions list').'</a></div>'; 62 if ($Version['Imported'])62 if ($Version['Imported']) 63 63 $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='. 64 64 $Version['Version']).'">'.T('Progress').'</a></div>'; 65 65 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 66 66 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 67 return ($Output);67 return $Output; 68 68 } 69 69 … … 92 92 93 93 $DbResult = $this->System->Database->query('SELECT * FROM ClientVersion '.$Order['SQL'].$PageList['SQLLimit']); 94 while ($Version = $DbResult->fetch_assoc())94 while ($Version = $DbResult->fetch_assoc()) 95 95 { 96 96 $Output .= '<tr><td><a href="?action=item&id='.$Version['Id'].'">'. … … 101 101 $Output .= '</table>'. 102 102 $PageList['Output']; 103 return ($Output);103 return $Output; 104 104 } 105 105 } -
trunk/Modules/Dictionary/Dictionary.php
r861 r880 25 25 'Icon' => '', 26 26 ), 1); 27 if (array_key_exists('Search', $this->System->ModuleManager->Modules))27 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 28 28 $this->System->ModuleManager->Modules['Search']->RegisterSearch('dictionary', 29 29 T('Dictionary'), array('Text', 'Description'), … … 65 65 66 66 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 67 foreach ($buff as $Line)67 foreach ($buff as $Line) 68 68 { 69 69 if ($mode == 0) … … 83 83 } 84 84 $Output .= '</table>'; 85 return ($Output);85 return $Output; 86 86 } 87 87 … … 89 89 { 90 90 $Output = ''; 91 if ($this->System->User->Licence(LICENCE_USER))91 if ($this->System->User->Licence(LICENCE_USER)) 92 92 { 93 93 $Output .= '<form action="?action=save" method="post">'. … … 103 103 '</form>'; 104 104 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 105 return ($Output);105 return $Output; 106 106 } 107 107 108 108 function DictionarySave() 109 109 { 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)) 113 113 { 114 114 // Check if original text exists and determine entry id 115 115 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE '. 116 116 '`Text` = "'.$_POST['Original'].'" AND `Language`= '.$this->System->Config['OriginalLanguage']); 117 if ($DbResult->num_rows > 0)117 if ($DbResult->num_rows > 0) 118 118 { 119 119 $DbRow = $DbResult->fetch_assoc(); … … 130 130 $DbResult = $this->Database->query('SELECT `Id` FROM `Dictionary` WHERE '. 131 131 '`Entry` = '.$Entry.' AND `Language`='.$_POST['Language'].' AND `User`='.$this->System->User->Id); 132 if ($DbResult->num_rows > 0)132 if ($DbResult->num_rows > 0) 133 133 { 134 134 $DbRow = $DbResult->fetch_assoc(); … … 142 142 } else $Output = ShowMessage(T('You have to fill all column of form.'), MESSAGE_CRITICAL); 143 143 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 144 return ($Output);144 return $Output; 145 145 } 146 146 147 147 function DictionaryRemove() 148 148 { 149 if ($this->System->User->Licence(LICENCE_USER))149 if ($this->System->User->Licence(LICENCE_USER)) 150 150 { 151 151 $this->Database->query('DELETE FROM `Dictionary` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 152 152 $Output = ShowMessage(T('Record removed')); 153 153 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 154 return ($Output);154 return $Output; 155 155 } 156 156 157 157 function DictionaryModify() 158 158 { 159 if ($this->System->User->Licence(LICENCE_USER))159 if ($this->System->User->Licence(LICENCE_USER)) 160 160 { 161 161 $DbResult = $this->Database->query('SELECT * FROM `Dictionary` WHERE `Id`='.($_GET['id'] * 1)); 162 if ($DbResult->num_rows > 0)162 if ($DbResult->num_rows > 0) 163 163 { 164 164 $DbRow = $DbResult->fetch_assoc(); … … 180 180 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 181 181 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 182 return ($Output);182 return $Output; 183 183 } 184 184 … … 189 189 $Output = ''; 190 190 $GroupId = LoadGroupIdParameter(); 191 if (array_key_exists('mode', $_GET)) $mode = $_GET['mode'];191 if (array_key_exists('mode', $_GET)) $mode = $_GET['mode']; 192 192 else $mode = 0; //0 = exact names, 1=all names, 2=nontranslated 193 193 $Table = $TranslationTree[$GroupId]['TablePrefix']; 194 194 195 if (array_key_exists('ID', $_GET))195 if (array_key_exists('ID', $_GET)) 196 196 { 197 197 $TextID = $_GET['ID']; … … 202 202 $DbResult = $this->Database->query('SELECT * FROM '.$Table.' WHERE ID = '.$TextID); 203 203 $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); 205 205 else 206 206 { 207 207 $Text = ''; 208 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)208 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 209 209 $Text .= ' '.$Line[$TextItem['Column']]; 210 210 $Output .= $this->WriteTranslatNames($Text, $mode); 211 211 } 212 212 } 213 return ($Output);213 return $Output; 214 214 } 215 215 … … 221 221 '<table style="width: 100%; height: 100%;">'; 222 222 223 if (array_key_exists('search', $_GET)) $Search = $_GET['search'];223 if (array_key_exists('search', $_GET)) $Search = $_GET['search']; 224 224 else $Search = ''; 225 225 … … 227 227 <input type="text" value="'.$Search.'" name="search" size="30" /> 228 228 <input type="submit" value="'.T('Search').'" />'; 229 if ($this->System->User->Licence(LICENCE_USER))229 if ($this->System->User->Licence(LICENCE_USER)) 230 230 $Output .= ' <a href="?action=insert">'.T('Add word').'</a>'; 231 231 … … 233 233 '<tr><td>'.T('Language').': '; 234 234 $Lang = '<a href="?language=">'.T('All').'</a>'; 235 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';235 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 236 236 else $Output .= $Lang; 237 foreach ($LanguageList as $Language)238 if ($Language['Enabled'] == 1)237 foreach ($LanguageList as $Language) 238 if ($Language['Enabled'] == 1) 239 239 { 240 240 $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> '; 242 242 else $Output .= $Lang; 243 243 } … … 245 245 '<tr><td>'; 246 246 247 if (!is_numeric($_SESSION['language'])) $LanguageFilter = '';247 if (!is_numeric($_SESSION['language'])) $LanguageFilter = ''; 248 248 else $LanguageFilter = ' AND (`T1`.`Language` = '.$_SESSION['language'].')'; 249 249 250 if ($Search <> '')250 if ($Search <> '') 251 251 { 252 252 $Condition = ' AND (LOWER(`T1`.`Text`) LIKE LOWER("%'.$Search.'%")) OR '. … … 270 270 $Output .= $PageList['Output']; 271 271 272 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];272 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 273 273 else $LanguageName = T('Translation'); 274 274 $TableColumns = array( … … 276 276 array('Name' => 'Translated', 'Title' => T($LanguageName)), 277 277 ); 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')); 279 279 $TableColumns[] = array('Name' => 'Description', 'Title' => T('Description')); 280 280 $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')); 282 282 $Order = GetOrderTableHeader($TableColumns, 'Original'); 283 283 $Output .= '<table class="BaseTable">'.$Order['Output']; … … 285 285 $sql_page = $sql.$Order['SQL'].$PageList['SQLLimit']; 286 286 $DbResult = $this->Database->query($sql_page); 287 while ($Line = $DbResult->fetch_assoc())287 while ($Line = $DbResult->fetch_assoc()) 288 288 { 289 289 $Output .= '<tr>'. 290 290 '<td>'.htmlspecialchars($Line['Original']).'</td>'. 291 291 '<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>'; 293 293 $Output .= '<td>'.htmlspecialchars($Line['Description']).'</td>'. 294 294 '<td><a href="'.$this->System->Link('/user/?user='.$Line['UserId']).'">'. 295 295 $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) 299 299 $Output .= '<td><a href="?action=remove&id='.$Line['Id']. 300 300 '" onclick="return confirmAction(\''.T('Do you really want to delete item?').'\');">'.T('Delete').'</a>'. … … 308 308 '</td></tr>'. 309 309 '</table></form>'; 310 return ($Output);310 return $Output; 311 311 } 312 312 … … 319 319 $LanguageList = GetLanguageList(); 320 320 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)) 324 324 { 325 325 $_SESSION['language'] = $this->System->User->Language; 326 326 } else $_SESSION['language'] = ''; 327 327 } 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'] = ''; 331 331 else $_SESSION['language'] = $_GET['language'] * 1; 332 332 } … … 335 335 336 336 $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') 340 340 { 341 341 $Output .= $this->DictionaryGroup(); 342 342 $ShowList = false; 343 343 } 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(); 348 348 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 349 349 } 350 if ($ShowList == true) $Output .= $this->DictionaryShow();351 return ($Output);350 if ($ShowList == true) $Output .= $this->DictionaryShow(); 351 return $Output; 352 352 } 353 353 } -
trunk/Modules/Download/Download.php
r850 r880 74 74 '<a href="'.$fileslink.'/DBCtoCSV.exe">DBCtoCSV</a> - '.T('tool for transform DBC files to CSV').'<br />'. 75 75 '<a href="'.$fileslink.'/ClientDBExtractor.exe">ClientDBExtractor.exe</a> - '.T('tool for exporting dbc files from game client').'<br />'; 76 return ($Output);76 return $Output; 77 77 } 78 78 … … 144 144 $PageList['Output']; 145 145 146 return ($Output);146 return $Output; 147 147 } 148 148 … … 154 154 else $Output .= $this->ShowDownload(); 155 155 156 return ($Output);156 return $Output; 157 157 } 158 158 } -
trunk/Modules/Error/Error.php
r860 r880 23 23 function DoStart() 24 24 { 25 if (isset($this->System->Config['Web']['ShowPHPError']))25 if (isset($this->System->Config['Web']['ShowPHPError'])) 26 26 $this->ErrorHandler->ShowError = $this->System->Config['Web']['ShowPHPError']; 27 27 else $this->ErrorHandler->ShowError = true; … … 36 36 function DoError($Error) 37 37 { 38 foreach ($this->OnError as $OnError)38 foreach ($this->OnError as $OnError) 39 39 call_user_func($OnError, $Error); 40 40 } -
trunk/Modules/Export/CreateAddon.php
r859 r880 17 17 $string = str_replace('$r', '"..'.$strlower.'(UnitRace("player")).."', $string); 18 18 $Gender = '$G'; 19 while (strpos($string, $Gender) !== false)19 while (strpos($string, $Gender) !== false) 20 20 { 21 21 $Before = substr($string, 0, strpos($string, $Gender)); … … 30 30 } 31 31 $Gender = '$g'; 32 while (strpos($string, $Gender) !== false)32 while (strpos($string, $Gender) !== false) 33 33 { 34 34 $Before = substr($string, 0, strpos($string, $Gender)); … … 46 46 $string = str_replace("\r", '', $string); 47 47 $string = str_replace("\n", '\r\n', $string); 48 return ($string);48 return $string; 49 49 } 50 50 … … 64 64 $string = str_replace('\\n', ' ', $string); 65 65 $string = str_replace(' ', '', $string); 66 // while (strpos($string, ' '))66 // while (strpos($string, ' ')) 67 67 // $string = str_replace(' ', ' ', $string); 68 return ($string);68 return $string; 69 69 } 70 70 … … 75 75 $string = str_replace('$b', '\r\n', $string); 76 76 $string = $this->ReplaceVarInText($string,''); 77 return ($string);77 return $string; 78 78 } 79 79 … … 81 81 { 82 82 //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; 85 85 } 86 86 … … 98 98 $string = str_replace('\\\\124', '\\124',$string); 99 99 100 return ($string);100 return $string; 101 101 } 102 102 … … 113 113 $CreatedFileListCount = array(); 114 114 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); 116 116 117 117 $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()) 119 119 { 120 120 //získání čísla verze pro export … … 126 126 else $ExportVersion = ''; 127 127 128 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)129 if ($Column['AddonFileName'] != '')128 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) 129 if ($Column['AddonFileName'] != '') 130 130 { 131 131 $this->AddProgress(1); 132 if (!isset($CreatedFileListCount[$Column['AddonFileName']]))132 if (!isset($CreatedFileListCount[$Column['AddonFileName']])) 133 133 $CreatedFileListCount[$Column['AddonFileName']] = 0; 134 134 $CreatedFileListCount[$Column['AddonFileName']]++; … … 149 149 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 150 150 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 151 if ($ID->num_rows > 0) {151 if ($ID->num_rows > 0) { 152 152 $ExportVersionOld = $ID->fetch_assoc(); 153 153 $ExportVersionOld = $ExportVersionOld['BuildNumber']; 154 154 155 155 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 156 while ($Line = $DbResult2->fetch_assoc())156 while ($Line = $DbResult2->fetch_assoc()) 157 157 { 158 158 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 159 159 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 160 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))160 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 161 161 { 162 162 $TableTexts[$en] = $cz; … … 167 167 168 168 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 169 while ($Line = $DbResult2->fetch_assoc())169 while ($Line = $DbResult2->fetch_assoc()) 170 170 { 171 171 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 172 172 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 174 174 { 175 175 $TableTexts[$en] = $cz; … … 177 177 } 178 178 179 foreach ($TableTexts as $key => $value) {179 foreach ($TableTexts as $key => $value) { 180 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 181 $i++; … … 194 194 $CountFiles = 'CountFiles.lua'; 195 195 $Buffer = ''; 196 foreach ($CreatedFileList as $CreatedFile)196 foreach ($CreatedFileList as $CreatedFile) 197 197 $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) 200 200 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 201 201 { … … 209 209 $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"; 210 210 $Buffer .= '<script file="'.$CountFiles.'"/>'."\n"; 211 foreach ($CreatedFileList as $CreatedFile)211 foreach ($CreatedFileList as $CreatedFile) 212 212 $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n"; 213 213 $Buffer .= '</Ui>'; 214 214 file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer); 215 return ($Output);215 return $Output; 216 216 } 217 217 … … 235 235 236 236 $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated)); 237 while ($Line = $DbResult->fetch_array())237 while ($Line = $DbResult->fetch_array()) 238 238 { 239 239 $Original = $this->my_trim($Line['En'.$Column['Column']]); 240 240 $Translated = $this->my_trim($Line[$Column['Column']]); 241 if ($this->ClientVersion['Version'] == '2.4.3')241 if ($this->ClientVersion['Version'] == '2.4.3') 242 242 { 243 243 $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original); … … 247 247 } 248 248 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); 250 250 file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer); 251 251 } … … 253 253 function MakeAddon() 254 254 { 255 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);255 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 256 256 $Output = $this->MakeLanguageFiles(); 257 257 $Output .= $this->MakeClientStrings(); 258 258 // $Output .= MakeMainScript($Setting); 259 return ($Output);259 return $Output; 260 260 } 261 261 … … 283 283 '; 284 284 $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 285 while ($Line = $DbResult->fetch_assoc())285 while ($Line = $DbResult->fetch_assoc()) 286 286 { 287 287 $Buffer .=' -
trunk/Modules/Export/Export.php
r879 r880 17 17 { 18 18 $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); 20 20 $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 21 21 $this->SourceDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['SourceFolder']; 22 22 $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); 24 24 } 25 25 … … 29 29 if ($Export['AllUsers']) { 30 30 $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()) 32 32 { 33 33 $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID']; 34 34 $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) 36 36 { 37 37 // $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); … … 50 50 { 51 51 $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'); 53 53 $this->Export = $DbResult->fetch_assoc(); 54 54 … … 58 58 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '. 59 59 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 60 while ($UserLine = $DbResult->fetch_assoc())60 while ($UserLine = $DbResult->fetch_assoc()) 61 61 { 62 62 $this->UserNames .= ', '.$UserLine['Name']; … … 64 64 $this->UserNames = substr($this->UserNames, 2); 65 65 66 if ($this->Export['ClientVersion'] != '')66 if ($this->Export['ClientVersion'] != '') 67 67 { 68 68 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); … … 82 82 83 83 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id); 84 while ($GroupItem = $DbResultItem->fetch_assoc())84 while ($GroupItem = $DbResultItem->fetch_assoc()) 85 85 { 86 86 $GroupItems[$GroupItem['GroupItem']] = 1; … … 88 88 // Build selected columns 89 89 $Columns = ''; 90 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {90 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 91 91 if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, '; 92 92 } … … 104 104 // Build columns for english texts 105 105 $OriginalColumns = ''; 106 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {106 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 107 107 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, '; 108 108 if (isset($GroupItems[$Column['Id']])) … … 117 117 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 118 118 119 return ($Query);119 return $Query; 120 120 } 121 121 … … 129 129 if (file_exists($file)) 130 130 $date = date('Y-m-d H:i',(filemtime($file))); 131 else return (true);131 else return true; 132 132 // echo $file; 133 133 … … 135 135 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 136 136 $result = false; 137 while ($Group = $DbResult->fetch_assoc())137 while ($Group = $DbResult->fetch_assoc()) 138 138 { 139 139 $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'. … … 149 149 } 150 150 } 151 return ($result);151 return $result; 152 152 } 153 153 … … 172 172 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 173 173 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 174 while ($Group = $DbResult->fetch_assoc())174 while ($Group = $DbResult->fetch_assoc()) 175 175 { 176 176 $Buffer .= $Group['TablePrefix'].', '; … … 180 180 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 181 181 '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'] != '') 185 185 { 186 186 $Buffer .= "\n\n-- ".$Group['Name']."\n\n"; 187 187 $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()) 190 190 { 191 191 $Values = ''; 192 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)193 if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key192 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 193 if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key 194 194 { 195 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];195 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column']; 196 196 $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"'; 197 197 } … … 200 200 // Get multicolumn index 201 201 $ColumnItems = explode(',', $Group['MangosTableIndex']); 202 if (count($ColumnItems) > 1)202 if (count($ColumnItems) > 1) 203 203 { 204 204 $Where = 'CONCAT('; 205 foreach ($ColumnItems as $ColumnItem)205 foreach ($ColumnItems as $ColumnItem) 206 206 $Where .= '`'.$ColumnItem.'`, "_", '; 207 207 $Where = substr($Where, 0, -7).')'; … … 216 216 } 217 217 } 218 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);219 return ($Buffer);218 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 219 return $Buffer; 220 220 } 221 221 … … 243 243 'aowow_skill' => 'skillID', 244 244 ); 245 foreach ($AoWoWTables as $AoWoWTable => $IndexColum)245 foreach ($AoWoWTables as $AoWoWTable => $IndexColum) 246 246 { 247 247 $Buffer .= '--'.$AoWoWTable.', '; … … 249 249 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 250 250 $DbResult = $Database2->query($Query); 251 while ($Line = $DbResult->fetch_assoc())251 while ($Line = $DbResult->fetch_assoc()) 252 252 { 253 253 $Ori_text = $Line['name']; … … 259 259 $Tran = $DbResult2->fetch_assoc(); 260 260 //echo ($Line['name'].'='.$Tran['tran']); 261 if ($Tran['Tran'] == '')261 if ($Tran['Tran'] == '') 262 262 { 263 263 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, … … 270 270 } 271 271 272 if ($Tran['Tran'] <> '')272 if ($Tran['Tran'] <> '') 273 273 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 274 274 } … … 276 276 } 277 277 */ 278 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);279 return ($Buffer);278 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 279 return $Buffer; 280 280 } 281 281 … … 299 299 if (false === strpos($String2,$varible)) { 300 300 // echo $varible; 301 return (false);301 return false; 302 302 } 303 303 } 304 304 } 305 return (true);305 return true; 306 306 } 307 307 … … 324 324 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 325 325 $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n"; 326 while ($Group = $DbResult->fetch_assoc())326 while ($Group = $DbResult->fetch_assoc()) 327 327 { 328 328 $this->AddProgress(2); 329 329 $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')) 331 331 { 332 332 // Load string column index list … … 335 335 $ColumnIndexes = array(); 336 336 $ColumnFormat = array(); 337 while ($DbRow = $DbResult2->fetch_assoc())337 while ($DbRow = $DbResult2->fetch_assoc()) 338 338 { 339 339 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; … … 344 344 $LookupTable = array(); 345 345 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 346 while ($DbRow = $DbResult2->fetch_assoc()) {346 while ($DbRow = $DbResult2->fetch_assoc()) { 347 347 //Export only if translate have same varible % 348 348 $CanExport = true; 349 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {349 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 350 350 $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]); 351 351 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) { … … 369 369 370 370 // 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); 372 372 $NewDBCFile = new DBCFile(); 373 373 $NewDBCFile->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); … … 381 381 $RowCount = $SourceDBCFile->GetRecordCount(); 382 382 $FieldCount = $SourceDBCFile->GetFieldCount(); 383 for ($Row = 0; $Row < $RowCount; $Row++)383 for ($Row = 0; $Row < $RowCount; $Row++) 384 384 { 385 385 $Line = $SourceDBCFile->GetLine($Row); … … 388 388 $PrimaryKeyItem = ''; 389 389 $ColumnItems = explode(',', $Group['DBCIndex']); 390 if (count($ColumnItems) > 1)390 if (count($ColumnItems) > 1) 391 391 { 392 foreach ($ColumnItems as $ColumnItem)392 foreach ($ColumnItems as $ColumnItem) 393 393 $PrimaryKeyItem .= $Line[$ColumnItem].'_'; 394 394 $PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1); 395 395 } else $PrimaryKeyItem = $Line[$Group['DBCIndex']]; 396 396 397 if (array_key_exists($PrimaryKeyItem, $LookupTable))397 if (array_key_exists($PrimaryKeyItem, $LookupTable)) 398 398 { 399 399 // Replace text columns 400 400 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 401 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)401 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 402 402 { 403 if (array_key_exists($GroupItem['Id'], $ColumnIndexes))403 if (array_key_exists($GroupItem['Id'], $ColumnIndexes)) 404 404 $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']]; 405 405 } … … 409 409 // Show completion progress 410 410 $Progress = round($Row / $RowCount * 100); 411 if ($Progress != $OldProgress)411 if ($Progress != $OldProgress) 412 412 { 413 413 if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01); … … 422 422 } 423 423 $Output .= 'Hotovo <br />'; 424 return ($Output);424 return $Output; 425 425 } 426 426 … … 432 432 433 433 $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); 435 435 $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()) 437 437 { 438 438 $this->AddProgress(1); … … 448 448 $LookupTable = array(); 449 449 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 450 while ($DbRow = $DbResult2->fetch_assoc()) {450 while ($DbRow = $DbResult2->fetch_assoc()) { 451 451 $CanExport = true; 452 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {452 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 453 453 // if (strpos($DbRow[$Column['Column']],'\\')) 454 454 // $CanExport = false; … … 502 502 } 503 503 504 while (!$File->EOF())504 while (!$File->EOF()) 505 505 { 506 506 $Line = $File->ReadLine(); 507 if (strpos($Line, '=') !== false)507 if (strpos($Line, '=') !== false) 508 508 { 509 509 $LineParts = explode('=', $Line, 2); … … 511 511 $Line = trim($LineParts[1]); 512 512 513 if ($Line[0] == '"')513 if ($Line[0] == '"') 514 514 { 515 515 // Quoted string value … … 532 532 $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --" 533 533 534 if (array_key_exists($Value['ShortCut'], $LookupTable))534 if (array_key_exists($Value['ShortCut'], $LookupTable)) 535 535 { 536 536 $DbRow = $LookupTable[$Value['ShortCut']]; … … 548 548 } 549 549 $NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";'; 550 //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];550 //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment']; 551 551 $NewLine .= "\r\n"; 552 552 $File2->WriteLine($NewLine); … … 555 555 $Output .= 'Hotovo <br/>'; 556 556 } 557 return ($Output);557 return $Output; 558 558 } 559 559 … … 656 656 " <author>".$this->System->User->Name."</author>\n". 657 657 " <contributors>\n"; 658 foreach (explode(',', $this->UserNames) as $UserName)658 foreach (explode(',', $this->UserNames) as $UserName) 659 659 $Buffer .= " <user>".$UserName."</user>\n"; 660 660 $Buffer .= … … 665 665 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 666 666 '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'] == '') 670 670 { 671 671 $Group['MangosTable'] = $Group['TablePrefix']; … … 674 674 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 675 675 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 676 while ($Line = $DbResult2->fetch_assoc())676 while ($Line = $DbResult2->fetch_assoc()) 677 677 { 678 678 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 679 679 $Values = ''; 680 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)680 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 681 681 { 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']] != '') 684 684 $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'. 685 685 $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n"; … … 689 689 $Buffer .= " </group>\n"; 690 690 } 691 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);691 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 692 692 $Buffer .= " </translation>\n". 693 693 "</document>"; 694 return ($Buffer);694 return $Buffer; 695 695 } 696 696 } … … 732 732 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 733 733 '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id 734 while ($Task = $DbResult->fetch_assoc())734 while ($Task = $DbResult->fetch_assoc()) 735 735 { 736 736 $Export = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; … … 744 744 // Show estimated time to complete 745 745 $PrefixMultiplier = new PrefixMultiplier(); 746 if ($Task['Progress'] > 0) {746 if ($Task['Progress'] > 0) { 747 747 $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']); 748 748 $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / '; … … 752 752 $Output .= '</div>'; 753 753 754 if ($Task['Progress'] > 99)754 if ($Task['Progress'] > 99) 755 755 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 756 756 'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'. 757 757 '</script>'; 758 758 } 759 return ($Output);759 return $Output; 760 760 } 761 761 } -
trunk/Modules/Export/ExportOutput.php
r867 r880 10 10 { 11 11 $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 != '..')) 15 15 { 16 if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');16 if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 17 17 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 18 18 } … … 28 28 $Export->Id = $ExportId; 29 29 $Export->Init(); 30 if (function_exists('gzcompress'))30 if (function_exists('gzcompress')) 31 31 { 32 32 $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip'; … … 45 45 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 46 46 '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; 48 48 } 49 49 … … 58 58 htmlspecialchars($Export->ExportToAoWoWSQL()). 59 59 '</pre>'; 60 return ($Output );60 return $Output ; 61 61 } 62 62 … … 69 69 $Export->Id = $ExportId; 70 70 $Export->Init(); 71 if (function_exists('gzcompress'))71 if (function_exists('gzcompress')) 72 72 { 73 73 $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip'; … … 86 86 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 87 87 '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; 89 89 } 90 90 … … 99 99 htmlspecialchars($Export->ExportToMangosSQL()). 100 100 '</pre>'; 101 return ($Output);101 return $Output; 102 102 } 103 103 … … 106 106 global $System; 107 107 108 if (function_exists('gzcompress'))108 if (function_exists('gzcompress')) 109 109 { 110 110 $Addon = new ExportAddon($System); … … 135 135 '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.'; 136 136 $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; 138 138 } 139 139 … … 146 146 $Export->Id = $ExportId; 147 147 $Export->Init(); 148 if (function_exists('gzcompress'))148 if (function_exists('gzcompress')) 149 149 { 150 150 $SaveFilename = $Export->TempDir.'CzWoW_XML.zip'; … … 163 163 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'. 164 164 '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; 166 166 } 167 167 … … 176 176 htmlspecialchars($Export->ExportToXML()). 177 177 '</pre>'; 178 return ($Output);178 return $Output; 179 179 } 180 180 … … 190 190 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 191 191 ') 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)) 195 195 { 196 196 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0 , `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); … … 211 211 212 212 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 213 if ($DbResult->num_rows == 0)213 if ($DbResult->num_rows == 0) 214 214 { 215 215 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeQueued` ) VALUES ('.$ExportId.', NOW())'); … … 220 220 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 221 221 $ExportTask = $DbResult->fetch_assoc(); 222 if ($ExportTask['TimeFinish'] <> '')222 if ($ExportTask['TimeFinish'] <> '') 223 223 { 224 224 $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>'; 225 225 $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()) 227 227 { 228 if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))228 if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 229 229 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>'; 230 230 } … … 233 233 234 234 } 235 return ($Output);235 return $Output; 236 236 } 237 237 … … 261 261 'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 262 262 '(`TimeFinish` IS NULL) AND (`TimeQueued` < (NOW() - '.$Timeout.'))'); 263 if ($DbResult->num_rows > 0)263 if ($DbResult->num_rows > 0) 264 264 { 265 265 $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR); 266 266 } 267 return ($Output);267 return $Output; 268 268 } 269 269 … … 281 281 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 282 282 ') 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)) 286 286 { 287 287 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0, `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); … … 298 298 // Start task for the first time if export task was not yet started 299 299 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 300 if ($DbResult->num_rows == 0)300 if ($DbResult->num_rows == 0) 301 301 { 302 302 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); … … 306 306 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 307 307 $ExportTask = $DbResult->fetch_assoc(); 308 if ($ExportTask['TimeFinish'] <> '')308 if ($ExportTask['TimeFinish'] <> '') 309 309 { 310 310 $FileName = 'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe'; … … 313 313 $Output .= ShowProgress($Export); 314 314 } 315 return ($Output);315 return $Output; 316 316 } 317 317 … … 324 324 $Export->Init(); 325 325 326 if (function_exists('gzcompress'))326 if (function_exists('gzcompress')) 327 327 { 328 328 $Output = 'Generování lua souborů...<br />'; … … 342 342 'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />'; 343 343 $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()) 345 345 { 346 346 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'lua/'.$Group['LuaFileName'].'.lua').'">'.$Group['LuaFileName'].'.lua</a><br/>'; 347 347 } 348 348 $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; 350 350 } 351 351 352 352 function ExportOutput($ExportId, $Type) 353 353 { 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); 364 364 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 17 17 { 18 18 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if ($this->System->User->Licence(LICENCE_USER))19 if ($this->System->User->Licence(LICENCE_USER)) 20 20 { 21 21 $Output .= ' <a href="?Action=ViewList&Filter=Others">'.T('Others').'</a>'. … … 23 23 } 24 24 25 if ($this->System->User->Licence(LICENCE_USER))25 if ($this->System->User->Licence(LICENCE_USER)) 26 26 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 27 28 28 $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; 33 33 } 34 34 … … 62 62 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 63 63 '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()) 65 65 { 66 66 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 67 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">'.T('Make export').'</a>'; 68 if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&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&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&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&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>'; 70 70 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 71 '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 79 79 $PageList['Output']; 80 80 81 return ($Output);81 return $Output; 82 82 } 83 83 84 84 function ExportCreate() 85 85 { 86 if ($this->System->User->Licence(LICENCE_USER))86 if ($this->System->User->Licence(LICENCE_USER)) 87 87 { 88 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 89 89 $DbRow = $DbResult->fetch_row(); 90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 91 91 { 92 92 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 98 98 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 99 99 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 return ($Output);100 return $Output; 101 101 } 102 102 103 103 function ExportCreateFinish() 104 104 { 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)) 108 108 { 109 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 110 110 $DbRow = $DbResult->fetch_row(); 111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 112 112 { 113 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); … … 120 120 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 121 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 122 return ($Output);122 return $Output; 123 123 } 124 124 125 125 function ExportDelete() 126 126 { 127 if ($this->System->User->Licence(LICENCE_USER))127 if ($this->System->User->Licence(LICENCE_USER)) 128 128 { 129 129 $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) 131 131 { 132 132 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); … … 143 143 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 144 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return ($Output);145 return $Output; 146 146 } 147 147 … … 163 163 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 164 $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; 166 166 else $Editable = false; 167 167 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') 171 171 { 172 172 //print_r($_POST); 173 173 // Update user selection page 174 foreach ($_POST as $Index => $Value)174 foreach ($_POST as $Index => $Value) 175 175 { 176 if (substr($Index, 0, 3) == 'seq')176 if (substr($Index, 0, 3) == 'seq') 177 177 { 178 178 $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; 180 180 else $Selected = false; 181 181 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 182 182 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 183 if ($DbResult->num_rows > 0)183 if ($DbResult->num_rows > 0) 184 184 { 185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 186 186 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 187 187 } else 188 188 { 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.')'); 190 190 } 191 191 } … … 221 221 ); 222 222 $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); 224 224 else $InitialOrder = ''; 225 225 … … 234 234 $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 235 235 '<h3>'.T('Translators').'</h3>'; 236 if ($Editable)236 if ($Editable) 237 237 { 238 238 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 252 252 $this->System->Database->query('SET @I = 0'); 253 253 $DbResult = $this->System->Database->query($Query); 254 while ($UserLine = $DbResult->fetch_assoc())254 while ($UserLine = $DbResult->fetch_assoc()) 255 255 { 256 256 $XP = GetLevelMinMax($UserLine['XP']); … … 268 268 '</form>'. 269 269 $PageList['Output']; 270 return ($Output);270 return $Output; 271 271 } 272 272 … … 278 278 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 279 $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; 281 281 else $Editable = false; 282 282 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; 287 287 else $WithDiacritic = 0; 288 288 if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1; … … 296 296 } 297 297 298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; 299 299 else $WithDiacritic = ''; 300 300 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 301 301 '<table>'; 302 if ($this->System->User->Id != null)302 if ($this->System->User->Id != null) 303 303 { 304 304 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. 305 305 '<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].'/>'; 307 307 $Output .= ' <a href="?Action=Clone&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)) 309 309 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 310 310 $Output .= '</td></tr>'; … … 314 314 '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 315 315 '</table></form>'; 316 return ($Output);316 return $Output; 317 317 } 318 318 … … 325 325 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 326 326 $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; 328 328 else $Editable = false; 329 329 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') 333 333 { 334 334 //print_r($_POST); 335 335 // Update user selection page 336 foreach ($_POST as $Index => $Value)336 foreach ($_POST as $Index => $Value) 337 337 { 338 if (substr($Index, 0, 3) == 'seq')338 if (substr($Index, 0, 3) == 'seq') 339 339 { 340 340 $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; 342 342 else $Selected = false; 343 343 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 344 344 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 345 if ($DbResult->num_rows > 0)345 if ($DbResult->num_rows > 0) 346 346 { 347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 348 348 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 349 349 } else 350 350 { 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.')'); 352 352 } 353 353 } … … 377 377 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 378 378 '<h3>'.T('Languages').'</h3>'; 379 if ($Editable)379 if ($Editable) 380 380 { 381 381 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 393 393 $this->System->Database->query('SET @I = 0'); 394 394 $DbResult = $this->System->Database->query($Query); 395 while ($Langugage = $DbResult->fetch_assoc())395 while ($Langugage = $DbResult->fetch_assoc()) 396 396 { 397 397 $Checked = $Langugage['Sequence'] != ''; … … 405 405 '</form>'. 406 406 $PageList['Output']; 407 return ($Output);407 return $Output; 408 408 } 409 409 … … 416 416 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 417 417 $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; 419 419 else $Editable = false; 420 420 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') 424 424 { 425 425 //print_r($_POST); 426 426 // Update user selection page 427 foreach ($_POST as $Index => $Value)427 foreach ($_POST as $Index => $Value) 428 428 { 429 if (substr($Index, 0, 3) == 'seq')429 if (substr($Index, 0, 3) == 'seq') 430 430 { 431 431 $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; 433 433 else $Selected = false; 434 434 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 435 435 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 436 if ($DbResult->num_rows > 0)436 if ($DbResult->num_rows > 0) 437 437 { 438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 439 439 } else 440 440 { 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.')'); 442 442 } 443 443 } … … 446 446 } 447 447 //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; 452 452 else $Selected = false; 453 453 //we will save only forbitten collums and need to be visible … … 457 457 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id']; 458 458 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition); 459 if ($DbResult->num_rows > 0)459 if ($DbResult->num_rows > 0) 460 460 { 461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition); 462 462 } else 463 463 { 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'].')'); 465 465 } 466 466 … … 486 486 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 487 487 '<h3>'.T('Translation groups').'</h3>'; 488 if ($Editable)488 if ($Editable) 489 489 { 490 490 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 500 500 501 501 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 502 while ($GroupItem = $DbResultItem->fetch_assoc())502 while ($GroupItem = $DbResultItem->fetch_assoc()) 503 503 { 504 504 $GroupItems[$GroupItem['GroupItem']] = 1; … … 507 507 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 508 508 $DbResult = $this->System->Database->query($Query); 509 while ($Group = $DbResult->fetch_assoc())509 while ($Group = $DbResult->fetch_assoc()) 510 510 { 511 511 $Columns = ''; 512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 513 513 if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], 514 514 !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>'; … … 533 533 '</form>'. 534 534 $PageList['Output']; 535 return ($Output);535 return $Output; 536 536 } 537 537 … … 540 540 $Output = ''; 541 541 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 542 if (array_key_exists('ExportId', $_GET))542 if (array_key_exists('ExportId', $_GET)) 543 543 { 544 544 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 545 if ($DbRows->num_rows > 0)545 if ($DbRows->num_rows > 0) 546 546 { 547 547 $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; 549 549 else $Editable = false; 550 550 551 if (array_key_exists('Operation', $_POST))552 if ($_POST['Operation'] == 'Save')551 if (array_key_exists('Operation', $_POST)) 552 if ($_POST['Operation'] == 'Save') 553 553 { 554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0)) 555 555 { 556 556 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); … … 564 564 $Output .= '<h3>'.T('Format the generated output').'</h3>'. 565 565 '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'; 566 if ($Editable)566 if ($Editable) 567 567 { 568 568 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 571 571 } 572 572 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 573 while ($ExportFormat = $DbResult->fetch_assoc())573 while ($ExportFormat = $DbResult->fetch_assoc()) 574 574 { 575 575 $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>'; … … 578 578 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 579 579 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 580 return ($Output);580 return $Output; 581 581 } 582 582 … … 587 587 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 588 588 $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; 590 590 else $Editable = false; 591 591 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))) 594 594 { 595 595 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); … … 600 600 $Export = $DbResult->fetch_assoc(); 601 601 602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 603 603 else { 604 604 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '. … … 620 620 '<h3>'.T('Client version').'</h3>'; 621 621 622 if ($Editable)622 if ($Editable) 623 623 { 624 624 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 633 633 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 634 634 $DbResult = $this->System->Database->query($Query); 635 while ($Version = $DbResult->fetch_assoc())635 while ($Version = $DbResult->fetch_assoc()) 636 636 { 637 637 $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Version['Id']).'">'. … … 646 646 $PageList['Output']; 647 647 } 648 return ($Output);648 return $Output; 649 649 } 650 650 … … 654 654 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 655 655 $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); 658 658 else { 659 659 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 660 if ($DbResult->num_rows > 0)660 if ($DbResult->num_rows > 0) 661 661 { 662 662 $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) 664 664 { 665 665 if (array_key_exists('Auto', $_GET) == false) … … 669 669 } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL); 670 670 } 671 return ($Output);671 return $Output; 672 672 } 673 673 … … 679 679 $Export->LoadFilters(); 680 680 681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == '')) 682 682 $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 683 683 else { … … 687 687 $UnionItems = array(); 688 688 $DbResult = $this->System->Database->query($GroupListQuery.$Where); 689 while ($DbRow = $DbResult->fetch_assoc())689 while ($DbRow = $DbResult->fetch_assoc()) 690 690 { 691 691 $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 721 721 $Translated = 0; 722 722 $Total = 0; 723 if (count($UnionItems) > 0)723 if (count($UnionItems) > 0) 724 724 { 725 725 $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()) 727 727 { 728 728 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 731 731 } 732 732 } 733 if ($Total > 0) $Percent = $Translated / $Total * 100;733 if ($Total > 0) $Percent = $Translated / $Total * 100; 734 734 else $Percent = 100; 735 735 … … 737 737 $Output .= '</table>'; 738 738 } 739 return ($Output);739 return $Output; 740 740 } 741 741 … … 743 743 { 744 744 $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'])) 746 746 { 747 747 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 748 if ($DbResult->num_rows > 0)748 if ($DbResult->num_rows > 0) 749 749 { 750 750 $Export = $DbResult->fetch_assoc(); … … 759 759 T('Statistic'), T('Output'))); 760 760 $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(); 769 769 else $Output .= $this->ExportViewGeneral(); 770 770 … … 772 772 } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 773 773 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 774 return ($Output);774 return $Output; 775 775 } 776 776 777 777 function ExportClone() 778 778 { 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'])) 782 782 { 783 783 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 784 784 $DbRow = $DbResult->fetch_row(); 785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 786 786 { 787 787 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 788 if ($DbResult->num_rows > 0)788 if ($DbResult->num_rows > 0) 789 789 { 790 790 $DbRow = $DbResult->fetch_assoc(); … … 810 810 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 811 811 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 812 return ($Output);812 return $Output; 813 813 } 814 814 … … 816 816 { 817 817 $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(); 825 825 else $Output = $this->ExportList(); 826 826 } else $Output = $this->ExportList(); 827 return ($Output);827 return $Output; 828 828 } 829 829 } … … 839 839 function Show() 840 840 { 841 if (array_key_exists('i', $_GET))841 if (array_key_exists('i', $_GET)) 842 842 $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1); 843 843 else $Output = 'Missing task id'; 844 return ($Output);844 return $Output; 845 845 } 846 846 } -
trunk/Modules/Export/ProcessAoWoWExport.php
r848 r880 14 14 $Output = ''; 15 15 16 if (defined('STDIN') == false)16 if (defined('STDIN') == false) 17 17 { 18 18 $Output = T('Access denied'); … … 20 20 } 21 21 22 foreach ($_SERVER['argv'] as $parameter)22 foreach ($_SERVER['argv'] as $parameter) 23 23 { 24 if (strpos($parameter, '=') !== false)24 if (strpos($parameter, '=') !== false) 25 25 { 26 26 $index = substr($parameter, 0, strpos($parameter, '=')); … … 33 33 echo 'Generuji Export:'; 34 34 $Export = new Export($System); 35 if (!array_key_exists('AoWoWExportId', $Config)) {35 if (!array_key_exists('AoWoWExportId', $Config)) { 36 36 $Export->Id = $Config['AoWoWExportId']; 37 37 } else $Export->Id = 37; … … 45 45 $UserSelection = array(); 46 46 $DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`'); 47 while ($DbRow = $DbResult->fetch_assoc())47 while ($DbRow = $DbResult->fetch_assoc()) 48 48 { 49 49 $UserSelection[$DbRow['ID']] = $DbRow['XP']; … … 53 53 // Update export user selection sequence 54 54 $Sequence = 1; 55 foreach ($UserSelection as $ID => $XP)55 foreach ($UserSelection as $ID => $XP) 56 56 { 57 57 $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) 59 59 $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID; 60 60 else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')'; … … 70 70 $Database2->query('SET NAMES '.$Config['Database']['Charset']); 71 71 $Database2->select_db($Config['Database']['DatabaseAoWoW']); 72 foreach ($SQL as $Line)72 foreach ($SQL as $Line) 73 73 { 74 74 //echo '.'; 75 75 //echo($Line."\n"); 76 if (trim($Line) != '') $Database2->query($Line);76 if (trim($Line) != '') $Database2->query($Line); 77 77 } 78 78 echo 'Hotovo … … 83 83 // Delete temporary cache files 84 84 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos'); 85 foreach ($Files as $File)85 foreach ($Files as $File) 86 86 { 87 87 $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); 89 89 } 90 90 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead'); 91 foreach ($Files as $File)91 foreach ($Files as $File) 92 92 { 93 93 $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); 95 95 } 96 96 echo 'Hotovo -
trunk/Modules/Export/ProcessTask.php
r869 r880 23 23 function DeleteOldFiles($deldir) 24 24 { 25 if (file_exists($deldir.'/'))25 if (file_exists($deldir.'/')) 26 26 { 27 27 $Dir = opendir($deldir.'/') ; 28 while (($File = readdir($Dir)) !== false)28 while (($File = readdir($Dir)) !== false) 29 29 { 30 if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);30 if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File); 31 31 } 32 32 closedir($Dir); … … 56 56 function MPQPack($packdir) 57 57 { 58 if (file_exists($packdir.DIRECTORY_SEPARATOR))58 if (file_exists($packdir.DIRECTORY_SEPARATOR)) 59 59 { 60 60 $Dir = opendir($packdir.DIRECTORY_SEPARATOR); 61 while (($File = readdir($Dir)) !== false)61 while (($File = readdir($Dir)) !== false) 62 62 { 63 if (($File != '..') and ($File != '.')) {63 if (($File != '..') and ($File != '.')) { 64 64 $File = str_replace('/', DIRECTORY_SEPARATOR, $File); 65 65 $InDir = ''; … … 109 109 // Delete old files 110 110 $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'); 112 112 113 113 $this->SetProgress(20); 114 if (function_exists('gzcompress'))114 if (function_exists('gzcompress')) 115 115 { 116 116 $Export->ExportToDBC(); … … 185 185 global $Config; 186 186 187 while (1)187 while (1) 188 188 { 189 189 $DbResult = $this->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, '. … … 191 191 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '. 192 192 '(`ExportTask`.`TimeFinish` IS NULL) ORDER BY `TimeQueued`'); 193 while ($Task = $DbResult->fetch_assoc())193 while ($Task = $DbResult->fetch_assoc()) 194 194 { 195 195 $this->Id = $Task['Id']; 196 if ($Task['ExportId'] != '')196 if ($Task['ExportId'] != '') 197 197 { 198 198 try … … 201 201 $this->Database->update('ExportTask', '`Id`='.$this->Id, array('TimeStart' => 'NOW()')); 202 202 203 if ($Task['ExportOutput'] == 9)203 if ($Task['ExportOutput'] == 9) 204 204 { 205 205 $this->ExportDBC($Task); 206 206 } else 207 if ($Task['ExportOutput'] == 10)207 if ($Task['ExportOutput'] == 10) 208 208 { 209 209 $this->ExportEXE($Task); -
trunk/Modules/Export/cmdmpqexport.php
r867 r880 17 17 $Output = ''; 18 18 19 if (defined('STDIN') == false)19 if (defined('STDIN') == false) 20 20 { 21 21 $Output = T('Access denied'); … … 23 23 } 24 24 25 foreach ($_SERVER['argv'] as $parameter)25 foreach ($_SERVER['argv'] as $parameter) 26 26 { 27 if (strpos($parameter, '=') !== false)27 if (strpos($parameter, '=') !== false) 28 28 { 29 29 $index = substr($parameter, 0, strpos($parameter, '=')); … … 33 33 } else $_GET[$parameter] = ''; 34 34 } 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)) {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)) { 36 36 $Output .= 'Usage type_export=id_export -for export<br />'; 37 37 $Output .= 'Usage ExportId=id_export - for write export info<br />'; … … 43 43 } 44 44 //37 45 if (array_key_exists('lua', $_GET)) {45 if (array_key_exists('lua', $_GET)) { 46 46 $Export = new Export($System); 47 47 $Export->Id = $_GET['lua']; … … 53 53 ',$Output); 54 54 } 55 if (array_key_exists('version', $_GET)) {55 if (array_key_exists('version', $_GET)) { 56 56 $Export = new Export($System); 57 57 $Export->Id = $_GET['version']; … … 63 63 ',$Output); 64 64 } 65 if (array_key_exists('dbc', $_GET)) {65 if (array_key_exists('dbc', $_GET)) { 66 66 $Export = new Export($System); 67 67 $Export->Id = $_GET['dbc']; … … 73 73 ',$Output); 74 74 } 75 if (array_key_exists('addon', $_GET)) {75 if (array_key_exists('addon', $_GET)) { 76 76 $Addon = new ExportAddon($System); 77 77 $Addon->Id = $_GET['addon']; … … 84 84 } 85 85 86 if (array_key_exists('needgeneration', $_GET)) {86 if (array_key_exists('needgeneration', $_GET)) { 87 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '. 88 88 '`Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,'. … … 96 96 if ($Export->NeedGeneration()) { 97 97 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$Export->Id); 98 if ($DbResult->num_rows == 0)98 if ($DbResult->num_rows == 0) 99 99 { 100 100 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())'); … … 114 114 } 115 115 116 if (array_key_exists('ExportId', $_GET)) {116 if (array_key_exists('ExportId', $_GET)) { 117 117 $Export = new Export($System); 118 118 $Export->Id = $_GET['ExportId']; -
trunk/Modules/Forum/Forum.php
r854 r880 21 21 'Permission' => LICENCE_ANONYMOUS)); 22 22 23 if (array_key_exists('Search', $this->System->ModuleManager->Modules))23 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 24 24 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forum', 25 25 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)) 27 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('forumthread', 28 28 T('Name of thread forum'), array('UserName', 'Text'), '`ForumThread`', … … 53 53 $DbResult = $this->Database->query($Query); 54 54 $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()) 56 56 { 57 57 $Output .= '<tr>'. … … 62 62 } 63 63 $Output .= '</table></div>'; 64 return ($Output);64 return $Output; 65 65 } 66 66 } … … 72 72 $Output = ''; 73 73 $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']; 76 76 else $Action = ''; 77 77 if (array_key_exists('Edit', $_GET)) { … … 86 86 if (array_key_exists('Thread', $_GET)) { 87 87 $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(); 90 90 $Output .= $this->ShowList(); 91 91 } else { 92 92 $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(); 95 95 $Output .= $this->ShowListThread(); 96 96 } 97 return ($Output);97 return $Output; 98 98 } 99 99 … … 104 104 $DbResult = $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); 105 105 $Output .= ShowMessage(T('Text edited.')); 106 return ($Output);106 return $Output; 107 107 } 108 108 … … 110 110 { 111 111 $Output = ''; 112 if ($this->System->User->Licence(LICENCE_USER))112 if ($this->System->User->Licence(LICENCE_USER)) 113 113 { 114 114 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']); … … 118 118 '<fieldset><legend>'.T('Edit message').'</legend>'. 119 119 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 />'; 121 121 else $Output .= '<input type="text" name="user" /><br />'; 122 122 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. … … 127 127 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 128 128 } else $Output .= ShowMessage(T('You can edit only your own message.'), MESSAGE_CRITICAL); 129 return ($Output);129 return $Output; 130 130 } 131 131 … … 150 150 $DbResult = $this->System->Database->query('SELECT `ForumText`.`Text`, `ForumText`.`Date`, `ForumText`.`UserName`,'. 151 151 '`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()) 153 153 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'. 154 154 htmlspecialchars($Line['ThreadName']).'</a><br /><strong>'.$Line['UserName']. 155 155 '</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> '; 156 156 $Output .= '</div>'.$PageList['Output']; 157 return ($Output);157 return $Output; 158 158 } 159 159 … … 169 169 $Output .= '<div class="shoutbox">'; 170 170 $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()) 172 172 $Output .= '<div><span style="float:right;"><strong>'.$Line['UserName']. 173 173 '</strong> - ('.HumanDate($Line['Date']).')</span> <a href="?Thread='.$Line['ID'].'">'. 174 174 str_replace("\n", '', htmlspecialchars($Line['Text'])).'</a></div>'; 175 175 $Output .= '</div>'.$PageList['Output']; 176 return ($Output);176 return $Output; 177 177 } 178 178 … … 183 183 $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email'))); 184 184 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'] != '') 189 189 { 190 190 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; … … 193 193 194 194 $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) 196 196 { 197 197 $Thread = $DbResult->fetch_assoc(); … … 206 206 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '. 207 207 ($_GET['Thread']*1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']); 208 while ($Line = $DbResult->fetch_assoc()) {208 while ($Line = $DbResult->fetch_assoc()) { 209 209 if ($this->System->User->Id == $Line['User']) 210 210 $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>'; … … 216 216 $Output .= '</div>'.$PageList['Output']; 217 217 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 218 return ($Output);218 return $Output; 219 219 } 220 220 … … 222 222 { 223 223 $Output = ''; 224 if ($this->System->User->Licence(LICENCE_USER))224 if ($this->System->User->Licence(LICENCE_USER)) 225 225 { 226 226 $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'. 227 227 '<fieldset><legend>'.T('New Forum Message').'</legend>'. 228 228 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 />'; 230 230 else $Output .= '<input type="text" name="user" /><br />'; 231 231 $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'. … … 235 235 '</form>'; 236 236 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 237 return ($Output);237 return $Output; 238 238 } 239 239 … … 241 241 { 242 242 $Output = ''; 243 if ($this->System->User->Licence(LICENCE_USER))243 if ($this->System->User->Licence(LICENCE_USER)) 244 244 { 245 245 $Output .= '<form action="?" method="post">'. 246 246 '<fieldset><legend>'.T('New thread').'</legend>'. 247 247 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 />'; 249 249 else $Output .= '<input type="text" name="user" /><br />'; 250 250 $Output .= T('Name of thread').': <br />'. … … 254 254 '</form>'; 255 255 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 256 return ($Output);256 return $Output; 257 257 } 258 258 … … 260 260 { 261 261 $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)) 265 265 { 266 266 $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); 268 268 else 269 269 { … … 273 273 $DbResult = $this->System->Database->query('SELECT `Text` FROM `'.$Table.'` WHERE 1 '.$Thread.' AND (`User` = "'. 274 274 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 275 if ($DbResult->num_rows > 0)275 if ($DbResult->num_rows > 0) 276 276 { 277 277 $DbRow = $DbResult->fetch_assoc(); 278 278 } else $DbRow['Text'] = ''; 279 279 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); 281 281 else 282 282 { … … 284 284 285 285 $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) 287 287 { 288 288 $this->System->Database->query('INSERT INTO `'.$Table.'` ( `User`, `UserName` , `Text` , `Date` , `IP` , `Thread` ) '. … … 300 300 $Output .= '<br/>'; 301 301 } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL); 302 return ($Output);302 return $Output; 303 303 } 304 304 … … 313 313 '`User`, `UserName`, `Text`, ( SELECT `Text` FROM `ForumThread` '. 314 314 '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()) 316 316 { 317 317 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 318 if (mb_strlen($Title) == $TitleLength) $Title .= '...';318 if (mb_strlen($Title) == $TitleLength) $Title .= '...'; 319 319 $Items[] = array 320 320 ( … … 333 333 'Items' => $Items, 334 334 )); 335 return ($Output);335 return $Output; 336 336 } 337 337 } -
trunk/Modules/FrontPage/FrontPage.php
r854 r880 31 31 global $Message, $MessageType; 32 32 33 if (array_key_exists('action', $_GET))33 if (array_key_exists('action', $_GET)) 34 34 { 35 if ($_GET['action'] == 'login')35 if ($_GET['action'] == 'login') 36 36 { 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)) 38 38 { 39 if (array_key_exists('StayLogged', $_POST)) $StayLogged = true;39 if (array_key_exists('StayLogged', $_POST)) $StayLogged = true; 40 40 else $StayLogged = false; 41 41 $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) 43 43 { 44 44 $Message = T('Incorrect name or password'); … … 55 55 } 56 56 } else 57 if ($_GET['action'] == 'logout')57 if ($_GET['action'] == 'logout') 58 58 { 59 if ($this->System->User->Role != LICENCE_ANONYMOUS)59 if ($this->System->User->Role != LICENCE_ANONYMOUS) 60 60 { 61 61 $this->System->ModuleManager->Modules['Log']->WriteLog('Odhlášení', LOG_TYPE_USER); … … 78 78 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 79 79 $Output = ''; 80 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);80 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType); 81 81 82 82 $Output .= ''. … … 90 90 '<div class="box-left">'.$this->System->ModuleManager->Modules['Forum']->ShowBox().'</div>'. 91 91 '<div class="box-right">'.$this->System->ModuleManager->Modules['Translation']->ShowBox().'</div>'; 92 return ($Output);92 return $Output; 93 93 } 94 94 … … 96 96 { 97 97 // 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'])) 100 100 { 101 if ($_GET['Action'] == 'HideWelcome')101 if ($_GET['Action'] == 'HideWelcome') 102 102 { 103 103 $_COOKIE['HideWelcome'] = 1; 104 104 setcookie('HideWelcome', $_COOKIE['HideWelcome'], time() + 3600 * 24 * 365); 105 105 } 106 if ($_GET['Action'] == 'UnHideWelcome')106 if ($_GET['Action'] == 'UnHideWelcome') 107 107 { 108 108 $_COOKIE['HideWelcome'] = 0; … … 111 111 } 112 112 113 if (isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1))113 if (isset($_COOKIE['HideWelcome']) and ($_COOKIE['HideWelcome'] == 1)) 114 114 { 115 115 $Action = '<a href="?Action=UnHideWelcome">'.T('Show welcome').'</a>'; … … 122 122 123 123 // Echo text even if it is hidden because of caching by external searching engines 124 return ('<div style="'.$HideWelcome.'">'.124 return '<div style="'.$HideWelcome.'">'. 125 125 '<div id="bannertitle">'.$this->System->Config['Web']['Title'].'</div>'. 126 126 T('Open web system for translation texts from game World of Warcraft (WoW).<br/>'. … … 133 133 '<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>'. 134 134 '<li>Texts can be translated to multiple languages, e.g. Czech and Slovak.</li>'. 135 '</ul>').'</div>'.$Action );135 '</ul>').'</div>'.$Action; 136 136 } 137 137 } -
trunk/Modules/Import/Import.php
r859 r880 49 49 $Columns = ''; 50 50 //$Values = ''; 51 foreach ($this->Group['Items'] as $GroupItem)51 foreach ($this->Group['Items'] as $GroupItem) 52 52 { 53 53 $Columns .= ', `'.$GroupItem['Column'].'` '; … … 61 61 $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'); 62 62 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)) 64 64 { 65 65 // Update existed text … … 68 68 $DbRowBefore = $DbResultBefore->fetch_assoc(); 69 69 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) ) 71 71 { 72 72 $insert = false; … … 78 78 79 79 } 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)) 81 81 { 82 82 $insert = false; … … 104 104 105 105 //if [DEPRECATED] do not import 106 foreach ($this->Group['Items'] as $GroupItem) {106 foreach ($this->Group['Items'] as $GroupItem) { 107 107 if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED')) { 108 108 echo('d '.$DbRowBefore['Entry'].' '); … … 113 113 if ($insert) { 114 114 $insert = false; 115 foreach ($this->Group['Items'] as $GroupItem)115 foreach ($this->Group['Items'] as $GroupItem) 116 116 { 117 117 if ($Value[$GroupItem['Column']] <> '') $insert = true; … … 128 128 $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`'; 129 129 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 130 foreach ($this->Group['Items'] as $GroupItem)130 foreach ($this->Group['Items'] as $GroupItem) 131 131 { 132 132 $Columns .= ', `'.$GroupItem['Column'].'`'; … … 150 150 { 151 151 // 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']]; 153 153 else 154 154 { … … 156 156 $Value['Entry'] = 1; 157 157 $DbResult = $this->System->Database->query('SELECT MAX(`Entry`) FROM `'.$this->Group['TablePrefix'].'`'); 158 if ($DbResult->num_rows > 0)158 if ($DbResult->num_rows > 0) 159 159 { 160 160 $DbRow = $DbResult->fetch_row(); … … 165 165 $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber']; 166 166 $insert = false; 167 foreach ($this->Group['Items'] as $GroupItem)167 foreach ($this->Group['Items'] as $GroupItem) 168 168 { 169 169 $Columns .= ', `'.$GroupItem['Column'].'`'; … … 188 188 $Output = 'Načítání textů z LUA souboru...'; 189 189 190 if (($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != ''))190 if (($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != '')) 191 191 { 192 192 193 193 $Output .= '<br />'.$this->Group['Name'].'<br />'; 194 // if ($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)194 // if ($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1) 195 195 { 196 196 $File = new FileStream(); … … 199 199 $this->NewItemCount = 0; 200 200 $Count = 0; 201 while (!$File->EOF())201 while (!$File->EOF()) 202 202 { 203 203 $Line = $File->ReadLine(); 204 if (strpos($Line, '=') !== false)204 if (strpos($Line, '=') !== false) 205 205 { 206 206 $LineParts = explode('=', $Line, 2); 207 207 $Value['ShortCut'] = trim($LineParts[0]); 208 208 $Line = trim($LineParts[1]); 209 if ($Line[0] == '"')209 if ($Line[0] == '"') 210 210 { 211 211 // Quoted string value … … 234 234 } else $Output .= ShowMessage('Není definováno jméno zdrojového souboru', MESSAGE_CRITICAL); 235 235 $Output .= ShowMessage('Dokončeno.'); 236 return ($Output);236 return $Output; 237 237 } 238 238 … … 243 243 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 244 244 $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) 246 246 { 247 247 $Output .= '<br />'.$Group['Name'].' '; 248 248 $do = true; 249 while ($do)249 while ($do) 250 250 { 251 251 $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '. … … 258 258 '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`'); 259 259 $do = ($DbResult->num_rows > 0); 260 while ($DbRow = $DbResult->fetch_assoc())260 while ($DbRow = $DbResult->fetch_assoc()) 261 261 { 262 262 echo('`'); … … 267 267 $Output .= '<strong>Dokončeno.</strong>'; 268 268 } 269 return ($Output);269 return $Output; 270 270 } 271 271 … … 273 273 { 274 274 $result = true; 275 foreach ($Group['Items'] as $GroupItem)275 foreach ($Group['Items'] as $GroupItem) 276 276 { 277 277 $old = $DbRow2[$GroupItem['Column']]; … … 324 324 } 325 325 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')) 330 330 { 331 331 // echo $old.'X'.$new; … … 339 339 } 340 340 341 return ($result);341 return $result; 342 342 } 343 343 … … 348 348 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 349 349 $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'] != '')) 351 351 { 352 352 $Output .= '<br />'.$this->Group['Name'].'<br />'; … … 357 357 $ColumnIndexes = array(); 358 358 $ColumnFormat = array(); 359 while ($DbRow = $DbResult->fetch_assoc())359 while ($DbRow = $DbResult->fetch_assoc()) 360 360 { 361 361 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; … … 369 369 $Count = 0; 370 370 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)) 375 375 { 376 376 $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']])); … … 380 380 $Columns = explode(',', $this->Group['DBCIndex']); 381 381 $ColumnValue = ''; 382 foreach ($Columns as $Column)382 foreach ($Columns as $Column) 383 383 $ColumnValue .= '_'.$DBCFile->GetUint($I, $Column); 384 384 $ColumnValue = substr($ColumnValue, 1); … … 391 391 } 392 392 $Output .= '<strong>Dokončeno.</strong>'; 393 return ($Output);393 return $Output; 394 394 } 395 395 … … 400 400 $this->Group = $TranslationTree[$GroupId]; 401 401 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(); 405 405 else $Output = ShowMessage('Neznámý typ zdroje pro import', MESSAGE_CRITICAL); 406 406 $Output .= $this->UpdateTranslated(); 407 return ($Output);407 return $Output; 408 408 } 409 409 … … 420 420 $folow_structure = false; 421 421 $i = 0; 422 while ((!$File->EOF()))422 while ((!$File->EOF())) 423 423 { 424 424 $Line = $File->ReadLine(); 425 425 // Struktura 426 if (strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false)426 if (strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false) 427 427 { 428 428 $Line = ''; … … 430 430 $i = 0; 431 431 } 432 if ((strpos($Line, ';') !== false) and ($folow_structure == true))432 if ((strpos($Line, ';') !== false) and ($folow_structure == true)) 433 433 { 434 434 $folow_structure = false; … … 437 437 // echo ('<br /><br />'); 438 438 } 439 if (($folow_structure == true) and ($Line != ''))439 if (($folow_structure == true) and ($Line != '')) 440 440 { 441 441 $str = substr($Line, 0, strpos($Line, '`')); 442 442 $Line = substr($Line, strpos($Line, '`') + 1); 443 443 $Line = substr($Line, 0, strpos($Line, '`')); 444 if (strlen($str) < 3) $structure[$i] = $Line;444 if (strlen($str) < 3) $structure[$i] = $Line; 445 445 $i++; 446 446 } 447 447 448 448 //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))) 450 450 { 451 451 while ((strpos($Line, ');') === false) or ($File->EOF())) … … 461 461 $value_buff = ''; 462 462 $Value = ''; 463 foreach ($LineParts as $LinePart)463 foreach ($LineParts as $LinePart) 464 464 { 465 465 466 466 unset($Value, $value_buff); 467 foreach ($structure as $i => $column)467 foreach ($structure as $i => $column) 468 468 { 469 469 if (substr($LinePart, 0, 1) != "'") … … 475 475 $LinePart = substr($LinePart, 1); 476 476 $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) == "\\") 478 478 { 479 479 $str = substr($LinePart, strlen($value_buff)); … … 484 484 $LinePart = substr($LinePart, strlen($value_buff) + 2); 485 485 } 486 if (($value_buff != 'null') and ($value_buff != 'NULL'))486 if (($value_buff != 'null') and ($value_buff != 'NULL')) 487 487 { 488 488 $str = ''; 489 while (substr($value_buff, strlen($value_buff) - 1,1) == " ")489 while (substr($value_buff, strlen($value_buff) - 1,1) == " ") 490 490 { 491 491 $value_buff = substr($value_buff, 0, strlen($value_buff) - 1); … … 493 493 } 494 494 $str2 = ''; 495 while (substr($value_buff, 0, 1) == ' ')495 while (substr($value_buff, 0, 1) == ' ') 496 496 { 497 497 $value_buff = substr($value_buff, 1, strlen($value_buff) - 1); … … 505 505 // echo ($column.'-"'.$Value[$column].'"<br>'); 506 506 } 507 foreach ($this->Group['Items'] as $GroupItem)507 foreach ($this->Group['Items'] as $GroupItem) 508 508 { 509 if ($GroupItem['MangosColumn'] != '')509 if ($GroupItem['MangosColumn'] != '') 510 510 if (isset($Value[$GroupItem['MangosColumn']])) 511 511 $Value[$GroupItem['Column']] = $Value[$GroupItem['MangosColumn']]; … … 519 519 $Columns = explode(',', $this->Group['MangosTableIndex']); 520 520 $ColumnValue = ''; 521 foreach ($Columns as $Column)521 foreach ($Columns as $Column) 522 522 $ColumnValue .= '_'.$Value[$Column]; 523 523 $ColumnValue = substr($ColumnValue, 1); … … 530 530 $Output = '<br />Celkem: '.$Count.' Nových: '.$this->NewItemCount.'<br />'; 531 531 $this->UpdateLastVersion(); 532 return ($Output);532 return $Output; 533 533 } 534 534 -
trunk/Modules/Import/Manage.php
r859 r880 19 19 '<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>'. 20 20 '</ol>'; 21 return ($Output);21 return $Output; 22 22 } 23 23 … … 26 26 global $System; 27 27 28 if (array_key_exists('id', $_GET))28 if (array_key_exists('id', $_GET)) 29 29 { 30 30 $Output = '<div style="font-size: xx-small;">'; … … 38 38 $Output .= '</div>'; 39 39 } else $Output = ShowMessage('Nebylo zadáno id skupiny.', MESSAGE_CRITICAL); 40 return ($Output);40 return $Output; 41 41 } 42 42 … … 68 68 69 69 $DbResult = $this->System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 70 while ($Group = $DbResult->fetch_assoc())70 while ($Group = $DbResult->fetch_assoc()) 71 71 { 72 72 $Output .= '<tr><td>'.T($Group['Name']).'</td>'. 73 73 '<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 '; 77 77 $Output .= '</td>'. 78 78 '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="../log/?group='.$Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td>'. … … 82 82 } 83 83 $Output .= '</table>'; 84 return ($Output);84 return $Output; 85 85 } 86 86 … … 93 93 $Output .= $Import->UpdateTranslated(); 94 94 $Output .= '</div>'; 95 return ($Output);95 return $Output; 96 96 } 97 97 … … 100 100 $this->Title = T('Import'); 101 101 $Output = ''; 102 if ($this->System->User->Licence(LICENCE_ADMIN))102 if ($this->System->User->Licence(LICENCE_ADMIN)) 103 103 { 104 if (array_key_exists('action', $_GET))104 if (array_key_exists('action', $_GET)) 105 105 { 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(); 109 109 else $Output .= $this->ShowMenu(); 110 110 } else $Output .= $this->ShowMenu(); 111 111 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 112 return ($Output);112 return $Output; 113 113 } 114 114 } -
trunk/Modules/Import/cmd.php
r859 r880 13 13 $Output = ''; 14 14 15 if (defined('STDIN') == false)15 if (defined('STDIN') == false) 16 16 { 17 17 $Output = T('Access denied'); … … 19 19 } 20 20 21 foreach ($_SERVER['argv'] as $parameter)21 foreach ($_SERVER['argv'] as $parameter) 22 22 { 23 if (strpos($parameter, '=') !== false)23 if (strpos($parameter, '=') !== false) 24 24 { 25 25 $index = substr($parameter, 0, strpos($parameter, '=')); … … 30 30 } 31 31 32 if (!array_key_exists('id', $_GET))32 if (!array_key_exists('id', $_GET)) 33 33 { 34 34 $Output .= ' … … 49 49 $Output .= ' version=<version> - nastaví verzi importu default: '.$System->Config['Web']['GameVersion'].'<br /><br />'; 50 50 $Output .= ' <id_import_group>:'; 51 foreach ($TranslationTree as $Group)51 foreach ($TranslationTree as $Group) 52 52 { 53 53 $Output .= '<br /> '.$Group['Id'].' '; -
trunk/Modules/Import/generatecodeXML.php
r815 r880 30 30 31 31 $files = scandir($verze); 32 foreach ($files as $file)32 foreach ($files as $file) 33 33 { 34 34 $end = substr($file, strlen($file) - 3); 35 if ($end == 'xml')35 if ($end == 'xml') 36 36 { 37 37 echo('<br />--'.$file.'<br /><br />'); -
trunk/Modules/Info/Info.php
r864 r880 69 69 '</ul><br />'. 70 70 '<br />'; 71 return ($Output);71 return $Output; 72 72 } 73 73 } … … 94 94 '<iframe width="420" height="315" src="https://www.youtube.com/embed/6EhBFv59syk" frameborder="0" allowfullscreen></iframe><br/>'. 95 95 '<img src="'.$this->System->Link('/images/promotion.bmp').'" width="800" alt="addon-obr">'; 96 return ($Output);96 return $Output; 97 97 } 98 98 } -
trunk/Modules/Log/Log.php
r861 r880 33 33 function WriteLog($Text, $Type) 34 34 { 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)) 36 36 $UserId = $this->System->User->Id; 37 37 else $UserId = 'NULL'; … … 60 60 global $System, $User; 61 61 62 if (isset($User) and !is_null($User->Id)) $UserId = $User->Id;62 if (isset($User) and !is_null($User->Id)) $UserId = $User->Id; 63 63 else $UserId = 'NULL'; 64 64 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '. … … 75 75 $Output = ''; 76 76 $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).'"'; 78 78 else $Where = ''; 79 79 $sql = 'SELECT *, UNIX_TIMESTAMP(`Date`) AS `TimeCreate`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `Log`.`User`) AS `UserName`, `Date` FROM `Log`'. 80 80 $Where.' ORDER BY `Date` DESC LIMIT 100'; 81 81 $DbResult = $this->System->Database->query($sql); 82 while ($Line = $DbResult->fetch_assoc())82 while ($Line = $DbResult->fetch_assoc()) 83 83 { 84 84 $DbResult2 = $this->System->Database->query('SELECT * FROM `LogType` WHERE `Id`='.$Line['Type']); 85 85 $LogType = $DbResult2->fetch_assoc(); 86 86 87 if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']);87 if ($Line['Type'] == LOG_TYPE_ERROR) $Line['Text'] = htmlspecialchars($Line['Text']); 88 88 $Line['Text'] = str_replace("\n", '<br>', $Line['Text']); 89 89 … … 106 106 'Items' => $Items, 107 107 )); 108 return ($Output);108 return $Output; 109 109 } 110 110 111 111 function Show() 112 112 { 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']; 115 115 else $Action = ''; 116 if ($Action == 'delerrlog') $Output = $this->DeleteErrorLog();116 if ($Action == 'delerrlog') $Output = $this->DeleteErrorLog(); 117 117 else $Output = $this->ShowList(); 118 return ($Output);118 return $Output; 119 119 } 120 120 … … 125 125 $this->Title = T('System log'); 126 126 $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'].')'; 133 133 else $WhereType = '1=1'; 134 134 … … 138 138 139 139 // Show category filter 140 if ($this->System->User->Licence(LICENCE_MODERATOR))140 if ($this->System->User->Licence(LICENCE_MODERATOR)) 141 141 { 142 142 $Output = '<strong>'.T('Filter').':</strong>'; 143 143 $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>'; 145 145 $Output .= ' '.$Item; 146 146 $DbResult = $this->System->Database->query('SELECT * FROM `LogType`'); 147 while ($LogType = $DbResult->fetch_assoc())147 while ($LogType = $DbResult->fetch_assoc()) 148 148 { 149 149 $Item = '<a href="'.$this->System->Link('/log/?type='.$LogType['Id']).'" style="color:'. 150 150 $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>'; 152 152 $Output .= ' '.$Item; 153 153 } … … 155 155 $Output .= '<br /><br />'; 156 156 157 if (array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType;157 if (array_key_exists('type', $_SESSION)) $Where = ' WHERE '.$WhereType; 158 158 else 159 159 { 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'].'%"'; 161 161 else $Where = ''; 162 162 } 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'].'%"'; 164 164 165 165 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Log` '.$Where); … … 172 172 array('Name' => 'Date', 'Title' => T('Time')), 173 173 ); 174 if ($_SESSION['type'] == '') $TableColumns[] =174 if ($_SESSION['type'] == '') $TableColumns[] = 175 175 array('Name' => 'LogName', 'Title' => T('Type')); 176 176 $TableColumns = array_merge($TableColumns, array( … … 187 187 '(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']; 188 188 $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']); 192 192 $Line['Text'] = str_replace("\n", '<br/>', $Line['Text']); 193 193 $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>'; 195 195 $Output .= '<td><span style="color: '.$Line['LogColor'].'">'.$Line['Text'].'</span></td>'. 196 196 '<td><a href="'.$this->System->Link('/user/?user='.$Line['User']).'">'.$Line['UserName'].'</a></td>'. … … 200 200 $Output .= '</table>'. 201 201 $PageList['Output']; 202 if ($this->System->User->Licence(LICENCE_ADMIN))202 if ($this->System->User->Licence(LICENCE_ADMIN)) 203 203 { 204 204 $Output .= '<div>'.T('Remove').': <a href="'.$this->System->Link('/log/?a=delerrlog&type='.LOG_TYPE_ERROR).'">'.T('Error logs').'</a> '. … … 207 207 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 208 208 209 return ($Output);209 return $Output; 210 210 } 211 211 212 212 function DeleteErrorLog() 213 213 { 214 if ($this->System->User->Licence(LICENCE_ADMIN) and214 if ($this->System->User->Licence(LICENCE_ADMIN) and 215 215 (($_GET['type'] == LOG_TYPE_ERROR) or ($_GET['type'] == LOG_TYPE_PAGE_NOT_FOUND))) 216 216 { … … 223 223 $Output = ShowMessage('Smazáno všech '.$DbRow[0].' záznamů z '.$LogType['Description'].'.'); 224 224 $Output .= $this->ShowList(); 225 return ($Output);225 return $Output; 226 226 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 227 227 } -
trunk/Modules/News/News.php
r862 r880 35 35 $DbResult = $this->Database->query('SELECT `News`.`Time`, `User`.`Name`, `News`.`Text`,`News`.`Title`, `News`.`Id` '. 36 36 ' 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()) 38 38 { 39 39 $Output .= '<h4><a href="'.$this->System->Link('/news/?a=item&i='.$DbRow['Id']).'">'.$DbRow['Title'].'</a> ('.HumanDate($DbRow['Time']).')</h4>'. … … 41 41 } 42 42 $Output .= '</div></div>'; 43 return ($Output);43 return $Output; 44 44 } 45 45 … … 48 48 $this->RSSChannels[$Channel['Channel']] = $Channel; 49 49 50 if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel'];50 if (is_null($Pos)) $this->RSSChannelsPos[] = $Channel['Channel']; 51 51 else { 52 52 array_splice($this->RSSChannelsPos, $Pos, 0, $Channel['Channel']); … … 57 57 { 58 58 $Output = ''; 59 foreach ($this->RSSChannels as $Channel)59 foreach ($this->RSSChannels as $Channel) 60 60 { 61 if ($this->System->User->Licence($Channel['Permission']))61 if ($this->System->User->Licence($Channel['Permission'])) 62 62 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 63 63 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 64 64 } 65 return ($Output);65 return $Output; 66 66 } 67 67 } … … 72 72 { 73 73 $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']; 76 76 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(); 80 80 else $Output = $this->ShowList(); 81 return ($Output);81 return $Output; 82 82 } 83 83 … … 89 89 90 90 $Output = '<h3>'.T('News').'</h3>'; 91 if ($this->System->User->Licence(LICENCE_ADMIN))91 if ($this->System->User->Licence(LICENCE_ADMIN)) 92 92 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 93 93 $Output .= $PageList['Output']; … … 95 95 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '. 96 96 '`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()) 98 98 { 99 99 $Output .= '<h4><a href="?a=item&i='.$Line['Id'].'">'.$Line['Title'].'</a> ('.HumanDate($Line['Time']).')</h4><div>'.$Line['Text'].' ('.$Line['User'].')</div>'; 100 100 } 101 101 $Output .= '</div>'.$PageList['Output']; 102 return ($Output);102 return $Output; 103 103 } 104 104 105 105 function ShowItem() 106 106 { 107 if (array_key_exists('i', $_GET))107 if (array_key_exists('i', $_GET)) 108 108 { 109 109 $Output = '<h3>'.T('News').'</h3>'; 110 110 $DbResult = $this->System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, `News`.`Id`, '. 111 111 '`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) 113 113 { 114 114 $Line = $DbResult->fetch_assoc(); … … 117 117 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 118 118 $Output .= '<br/><a href="'.$this->System->Link('/news/').'">'.T('All news').'</a>'; 119 return ($Output);119 return $Output; 120 120 } 121 121 122 122 function ShowAddForm() 123 123 { 124 if ($this->System->User->Licence(LICENCE_ADMIN))124 if ($this->System->User->Licence(LICENCE_ADMIN)) 125 125 { 126 126 $Output = '<form action="?" method="POST">'. … … 134 134 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 135 135 $Output .= $this->ShowList(); 136 return ($Output);136 return $Output; 137 137 } 138 138 139 139 function SaveNew() 140 140 { 141 if ($this->System->User->Licence(LICENCE_ADMIN))141 if ($this->System->User->Licence(LICENCE_ADMIN)) 142 142 { 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)) 144 144 { 145 145 $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '. … … 151 151 } else $Output = ShowMessage(T('Data not specified'), MESSAGE_CRITICAL); 152 152 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 153 return ($Output);153 return $Output; 154 154 } 155 155 … … 160 160 '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text`, `News`.`Id` '. 161 161 '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()) 163 163 { 164 164 $Items[] = array … … 178 178 'Items' => $Items, 179 179 )); 180 return ($Output);180 return $Output; 181 181 } 182 182 } -
trunk/Modules/News/RSS.php
r876 r880 15 15 " <pubDate>".date('r')."</pubDate>\n". 16 16 " <ttl>20</ttl>\n"; 17 foreach ($Data['Items'] as $Item)17 foreach ($Data['Items'] as $Item) 18 18 { 19 19 $Result .= " <item>\n". … … 26 26 $Result .= " </channel>\n". 27 27 "</rss>"; 28 return ($Result);28 return $Result; 29 29 } 30 30 … … 35 35 $this->RawPage = true; 36 36 37 if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel'];37 if (array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel']; 38 38 else $ChannelName = ''; 39 if (array_key_exists('token', $_GET)) $Token = $_GET['token'];39 if (array_key_exists('token', $_GET)) $Token = $_GET['token']; 40 40 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)) 42 42 { 43 43 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if ($this->System->User->Licence($Channel['Permission']) or44 if ($this->System->User->Licence($Channel['Permission']) or 45 45 $this->System->User->CheckToken($Channel['Permission'], $Token)) 46 46 { 47 if (is_string($Channel['Callback'][0]))47 if (is_string($Channel['Callback'][0])) 48 48 { 49 49 $Class = new $Channel['Callback'][0]($this->System); … … 53 53 } else $Output = T('Access denied'); 54 54 } else $Output = 'Nezadán žádný kanál'; 55 return ($Output);55 return $Output; 56 56 } 57 57 } -
trunk/Modules/Redirection/Redirection.php
r861 r880 24 24 Header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'); 25 25 Header('Location: '.$Location); 26 return ('<h3 align="center">'.T('').'</h3>');26 return '<h3 align="center">'.T('').'</h3>'; 27 27 } 28 28 … … 30 30 { 31 31 $Output = ''; 32 if (count($this->System->PathItems) > 0)32 if (count($this->System->PathItems) > 0) 33 33 { 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) 52 52 { 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')) 54 54 $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')) 56 56 $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')) 58 58 $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')) 60 60 $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')) 62 62 $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')) 64 64 $Output = $this->Redirect($this->System->Link('/files/ceske_fonty_do_wow.zip')); 65 65 } 66 66 } 67 return ($Output);67 return $Output; 68 68 } 69 69 } -
trunk/Modules/Referrer/Referrer.php
r860 r880 34 34 function Log() 35 35 { 36 if (array_key_exists('HTTP_REFERER', $_SERVER))36 if (array_key_exists('HTTP_REFERER', $_SERVER)) 37 37 { 38 38 $Referrer = addslashes($_SERVER['HTTP_REFERER']); 39 39 $HostName = substr($Referrer, strpos($Referrer, '/') + 2); 40 40 $HostName = substr($HostName, 0, strpos($HostName, '/')); 41 if (!in_array($HostName, $this->Excludes))41 if (!in_array($HostName, $this->Excludes)) 42 42 { 43 43 $IP = GetRemoteAddress(); … … 46 46 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `BlackList` WHERE `IP` = "'.$IP.'"'); 47 47 $DbRow = $DbResult->fetch_row(); 48 if ($DbRow[0] == 0)48 if ($DbRow[0] == 0) 49 49 { 50 50 $Visible = '1'; … … 58 58 // Check if host name is already stored and need just to update hit counter 59 59 $DbResult = $this->System->Database->query('SELECT `Id` FROM `Referrer` WHERE `Web` = "'.$HostName.'"'); 60 if ($DbResult->num_rows > 0)60 if ($DbResult->num_rows > 0) 61 61 { 62 62 $DbRow = $DbResult->fetch_assoc(); … … 92 92 $Output .= $BannerSmall.' <textarea rows="2" cols="30">'.htmlspecialchars($BannerSmall).'</textarea><br />'; 93 93 94 if ($this->System->User->Licence(LICENCE_ADMIN)) {94 if ($this->System->User->Licence(LICENCE_ADMIN)) { 95 95 96 96 $MonthAge = 3; … … 99 99 <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 />'; 100 100 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)'; 102 102 else $Where = ''; 103 103 $Query = 'SELECT *, (SELECT Web FROM `Referrer` AS T4 WHERE T4.Id = T3.Parent) AS ParentName '. … … 123 123 array('Name' => 'TotalHits', 'Title' => T('Hits')), 124 124 ); 125 if ($this->System->User->Licence(LICENCE_ADMIN))125 if ($this->System->User->Licence(LICENCE_ADMIN)) 126 126 { 127 127 $TableColumns[] = array('Name' => 'Visible', 'Title' => T('Visible')); … … 137 137 138 138 $DbResult = $this->Database->query($Query); 139 while ($Line = $DbResult->fetch_assoc())139 while ($Line = $DbResult->fetch_assoc()) 140 140 { 141 141 $Output .= '<tr><td><a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a></td>'. 142 142 '<td>'.HumanDate($Line['MaxDateLast']).'</td>'. 143 143 '<td>'.$Line['TotalHits'].'</td>'; 144 if ($this->System->User->Licence(LICENCE_ADMIN))144 if ($this->System->User->Licence(LICENCE_ADMIN)) 145 145 { 146 146 $Output .= … … 158 158 159 159 } 160 return ($Output);160 return $Output; 161 161 } 162 162 … … 165 165 $Output = '<select name="Parent">'; 166 166 $Output .= '<option value=""'; 167 if ($Selected == '')167 if ($Selected == '') 168 168 $Output .= ' selected="selected"'; 169 169 $Output .= '></option>'; 170 170 $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) 173 173 { 174 174 $Output .= '<option value="'.$Language['Id'].'"'; 175 if ($Selected == $Language['Id'])175 if ($Selected == $Language['Id']) 176 176 $Output .= ' selected="selected"'; 177 177 $Output .= '>'.$Language['Web'].'</option>'; 178 178 } 179 179 $Output .= '</select>'; 180 return ($Output);180 return $Output; 181 181 } 182 182 183 183 function Spam() 184 184 { 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)) 188 188 { 189 189 $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']); 190 if ($DbResult->num_rows > 0)190 if ($DbResult->num_rows > 0) 191 191 { 192 192 $Item = $DbResult->fetch_assoc(); 193 193 $this->Database->update('Referrer', 'Id='.$_GET['id'], array('Visible' => 0, 'Description' => 'Spam')); 194 194 $DbResult2 = $this->Database->select('BlackList', '*', 'IP="'.$Item['LastIP'].'"'); 195 if ($DbResult2->num_rows == 0)195 if ($DbResult2->num_rows == 0) 196 196 { 197 197 $this->Database->insert('BlackList', array('Time' => 'NOW()', 'IP' => $Item['LastIP'])); … … 202 202 } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL); 203 203 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 204 return ($Output);204 return $Output; 205 205 } 206 206 207 207 function Edit() 208 208 { 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)) 212 212 { 213 213 $DbResult = $this->Database->select('Referrer', '*', 'Id='.$_GET['id']); 214 if ($DbResult->num_rows > 0)214 if ($DbResult->num_rows > 0) 215 215 { 216 216 $Item = $DbResult->fetch_assoc(); 217 if ($Item['Visible'] == 1) $Visible = ' checked ';217 if ($Item['Visible'] == 1) $Visible = ' checked '; 218 218 else $Visible = ''; 219 219 $Output = '<form action="?action=editsave&id='.$_GET['id'].'" method="post"><table>'. … … 227 227 } else $Output = ShowMessage(T('Item not specified'), MESSAGE_CRITICAL); 228 228 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 229 return ($Output);229 return $Output; 230 230 } 231 231 232 232 function EditSave() 233 233 { 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; 237 237 $_POST['Visible'] = array_key_exists('Visible', $_POST); 238 238 $DbResult = $this->Database->update('Referrer', 'Id='.$_GET['id'], array( … … 243 243 $Output .= $this->ShowList(); 244 244 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 245 return ($Output);245 return $Output; 246 246 } 247 247 … … 249 249 { 250 250 $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(); 256 256 else $Output = $this->ShowList(); 257 257 } else $Output = $this->ShowList(); 258 return ($Output);258 return $Output; 259 259 } 260 260 } -
trunk/Modules/Search/Search.php
r861 r880 48 48 '</table></div>'. 49 49 '</form>'; 50 return ($Output);50 return $Output; 51 51 } 52 52 } … … 57 57 { 58 58 $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']; 61 61 else $Search = ''; 62 62 $SearchHTML = urlencode($Search); 63 63 64 64 $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) 66 66 { 67 67 $ColumnQuery = array(); 68 foreach ($SearchItem['Columns'] as $Column)68 foreach ($SearchItem['Columns'] as $Column) 69 69 { 70 70 $ColumnQuery[] = '(`'.$Column.'` LIKE "%'.$Search.'%")'; 71 71 } 72 72 $ColumnQuery = implode(' OR ', $ColumnQuery); 73 if ($SearchItem['Query'] != '')73 if ($SearchItem['Query'] != '') 74 74 { 75 75 $DbResult = $this->Database->query('SELECT COUNT(*) FROM '.$SearchItem['Query'].' WHERE '.$ColumnQuery); … … 82 82 83 83 $Output .= '</table>'; 84 return ($Output);84 return $Output; 85 85 } 86 86 } -
trunk/Modules/Server/Server.php
r838 r880 57 57 $Output .= '<h3>'.T('Translated server list').'</h3>'; 58 58 $Output .= parent::ViewList(); 59 return ($Output);59 return $Output; 60 60 } 61 61 } -
trunk/Modules/ShoutBox/ShoutBox.php
r857 r880 20 20 'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'), 21 21 'Permission' => LICENCE_ANONYMOUS)); 22 if (array_key_exists('Search', $this->System->ModuleManager->Modules))22 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 23 23 $this->System->ModuleManager->Modules['Search']->RegisterSearch('shoutbox', 24 24 T('Shoutbox'), array('UserName', 'Text'), '`ShoutBox`', $this->System->Link('/shoutbox/?search=')); … … 29 29 $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>'; 30 30 31 if ($this->System->User->Licence(LICENCE_USER))31 if ($this->System->User->Licence(LICENCE_USER)) 32 32 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 33 33 $Output .= '<div class="box"><div class="shoutbox"><table>'; 34 34 $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()) 36 36 $Output .= '<tr><td><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</td></tr>'; 37 37 $Output .= '</table></div></div>'; 38 return ($Output);38 return $Output; 39 39 } 40 40 } … … 45 45 { 46 46 $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']; 49 49 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(); 52 52 else $Output = $this->ShowList(); 53 return ($Output);53 return $Output; 54 54 } 55 55 … … 57 57 { 58 58 $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'] != '') 63 63 { 64 64 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; … … 71 71 72 72 $Output .= '<h3>'.T('Shoutbox').'</h3>'; 73 if ($this->System->User->Licence(LICENCE_USER))73 if ($this->System->User->Licence(LICENCE_USER)) 74 74 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 75 75 $Output .= $PageList['Output']; 76 76 $Output .= '<div class="shoutbox">'; 77 77 $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()) 79 79 $Output .= '<div><strong>'.$Line['UserName'].'</strong>: '.MakeActiveLinks($Line['Text']).'</div>'; 80 80 $Output .= '</div>'.$PageList['Output']; 81 return ($Output);81 return $Output; 82 82 } 83 83 … … 85 85 { 86 86 $Output = ''; 87 if ($this->System->User->Licence(LICENCE_USER))87 if ($this->System->User->Licence(LICENCE_USER)) 88 88 { 89 89 $Output .= '<form action="?" method="post">'. 90 90 '<fieldset><legend>'.T('New message').'</legend>'. 91 91 '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 />'; 93 93 else $Output .= '<input type="text" name="user" /><br />'; 94 94 $Output .= 'Text zprávy: <br/>'. … … 99 99 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 100 100 $Output .= $this->ShowList(); 101 return ($Output);101 return $Output; 102 102 } 103 103 … … 105 105 { 106 106 $Output = ''; 107 if ($this->System->User->Licence(LICENCE_USER))107 if ($this->System->User->Licence(LICENCE_USER)) 108 108 { 109 if (array_key_exists('text', $_POST))109 if (array_key_exists('text', $_POST)) 110 110 { 111 111 $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); 113 113 else 114 114 { … … 116 116 $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'. 117 117 $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1'); 118 if ($DbResult->num_rows > 0)118 if ($DbResult->num_rows > 0) 119 119 { 120 120 $DbRow = $DbResult->fetch_assoc(); 121 121 } else $DbRow['Text'] = ''; 122 122 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); 124 124 else 125 125 { … … 134 134 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 135 135 $Output .= $this->ShowList(); 136 return ($Output);136 return $Output; 137 137 } 138 138 … … 143 143 mb_internal_encoding('utf-8'); 144 144 $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()) 146 146 { 147 147 $Title = mb_substr($DbRow['Text'], 0, $TitleLength); 148 if (mb_strlen($Title) == $TitleLength) $Title .= '...';148 if (mb_strlen($Title) == $TitleLength) $Title .= '...'; 149 149 $Items[] = array 150 150 ( … … 163 163 'Items' => $Items, 164 164 )); 165 return ($Output);165 return $Output; 166 166 } 167 167 } -
trunk/Modules/Team/Team.php
r851 r880 24 24 'Icon' => '', 25 25 ), 1); 26 if (array_key_exists('Search', $this->System->ModuleManager->Modules))26 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 27 27 $this->System->ModuleManager->Modules['Search']->RegisterSearch('team', 28 28 T('Teams'), array('Name'), '`Team`', $this->System->Link('/team/?search=')); … … 38 38 $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/>'; 39 39 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'] = ''; 42 42 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 43 43 44 if ($this->System->User->Licence(LICENCE_USER))44 if ($this->System->User->Licence(LICENCE_USER)) 45 45 $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'] != '') 47 47 { 48 48 $SearchQuery = ' AND ((`Name` LIKE "%'.$_SESSION['search'].'%") OR (`Description` LIKE "%'.$_SESSION['search'].'%"))'; … … 64 64 array('Name' => 'TimeCreate', 'Title' => T('Founding date')), 65 65 ); 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')); 67 67 68 68 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); … … 72 72 '(SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` '. 73 73 'FROM `Team` WHERE 1'.$SearchQuery.$Order['SQL'].$PageList['SQLLimit']); 74 while ($Team = $DbResult->fetch_assoc())74 while ($Team = $DbResult->fetch_assoc()) 75 75 { 76 76 $Output .= '<tr>'. … … 80 80 '<td><a href="'.$this->System->Link('/users/?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 81 81 '<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&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&id='.$Team['Id'].'">'.T('Edit').'</a>'; 85 85 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>'; 87 87 $Output .= '<td><a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter').'</a>'.$Action.'</td>'; 88 88 } … … 92 92 $PageList['Output']; 93 93 94 return ($Output);94 return $Output; 95 95 } 96 96 97 97 function TeamJoin() 98 98 { 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)) 102 102 { 103 103 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$this->System->User->Id); … … 114 114 } else $Output = ShowMessage('Nutno zadat id týmu.', MESSAGE_CRITICAL); 115 115 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 116 return ($Output);116 return $Output; 117 117 } 118 118 … … 120 120 { 121 121 $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)) 125 125 { 126 126 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE `Name` = "'.trim($_POST['Name']).'"'); 127 127 $DbRow = $DbResult->fetch_row(); 128 128 $Count = $DbRow[0]; 129 if (($Count == 0) and ($_POST['Name'] != ''))129 if (($Count == 0) and ($_POST['Name'] != '')) 130 130 { 131 131 $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'. … … 142 142 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 143 143 $Output .= $this->ShowTeamList(); 144 return ($Output);144 return $Output; 145 145 } 146 146 147 147 function TeamModify() 148 148 { 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)) 152 152 { 153 153 $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) 155 155 { 156 156 $Team = $DbResult->fetch_assoc(); … … 165 165 } else $Output = ShowMessage('Nezadáno id týmu', MESSAGE_CRITICAL); 166 166 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 167 return ($Output);167 return $Output; 168 168 } 169 169 … … 171 171 { 172 172 $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)) 176 176 { 177 177 $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) 179 179 { 180 180 $Team = $DbResult->fetch_assoc(); … … 182 182 $DbRow = $DbResult->fetch_row(); 183 183 $Count = $DbRow[0]; 184 if (($Count == 0) and ($_POST['Name'] != ''))184 if (($Count == 0) and ($_POST['Name'] != '')) 185 185 { 186 186 $this->Database->query('UPDATE `Team` SET `Name`="'.$_POST['Name'].'", `Description`="'.$_POST['Description'].'", `URL`="'.$_POST['URL'].'" WHERE Id='.$Team['Id']); … … 192 192 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 193 193 $Output .= $this->ShowTeamList(); 194 return ($Output);194 return $Output; 195 195 } 196 196 197 197 function TeamCreate() 198 198 { 199 if ($this->System->User->Licence(LICENCE_USER))199 if ($this->System->User->Licence(LICENCE_USER)) 200 200 { 201 201 $Output ='<form action="?action=finish_create" method="post">'. … … 207 207 '</table></fieldset></form>'; 208 208 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 209 return ($Output);209 return $Output; 210 210 } 211 211 … … 213 213 { 214 214 $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'])) 216 216 { 217 217 $DbResult = $this->Database->query('SELECT `Id`, `Name`, `Description`, `URL`, `Leader`, '. … … 221 221 '(SELECT ROUND(AVG(`XP`)) FROM `User` WHERE `Team` = `Team`.`Id`) AS `AverageXP` FROM '. 222 222 '`Team` WHERE `Id`='.($_GET['id'] * 1)); 223 if ($DbResult->num_rows > 0)223 if ($DbResult->num_rows > 0) 224 224 { 225 225 $Team = $DbResult->fetch_assoc(); 226 226 $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) 228 228 { 229 229 $Leader = $DbResult2->fetch_assoc(); … … 233 233 T('Web pages').': <a href="http://'.htmlspecialchars($Team['URL']).'">'.htmlspecialchars($Team['URL']).'</a><br/>'. 234 234 T('Leader').': <a href="'.$this->System->Link('/user/?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>'; 235 if ($Team['Description'] != '')235 if ($Team['Description'] != '') 236 236 $Output .= T('Description').': '.htmlspecialchars($Team['Description']).'<br />'; 237 237 $Output .= '<br />'; 238 238 //$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)) 240 240 $Output .='<a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter to team').'</a><br /><br />'; 241 241 $XP = GetLevelMinMax($Team['AverageXP']); … … 252 252 $Query = ''; 253 253 $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()) 257 257 { 258 258 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 289 289 $Total = 0; 290 290 $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()) 292 292 { 293 293 $Output .='<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated']. … … 296 296 $Total += $Group['Total']; 297 297 } 298 if ($Total > 0) $Progress = round($Translated / $Total * 100, 2);298 if ($Total > 0) $Progress = round($Translated / $Total * 100, 2); 299 299 else $Progress = 0; 300 300 $Output .='<tr><td><strong>'.T('Total').'</strong></td><td><strong>'. … … 306 306 } else $Output .= ShowMessage('Tým nenalezen', MESSAGE_CRITICAL); 307 307 } else $Output .= ShowMessage('Musíte zadat id týmu', MESSAGE_CRITICAL); 308 return ($Output);308 return $Output; 309 309 } 310 310 311 311 function TeamLeave() 312 312 { 313 if ($this->System->User->Licence(LICENCE_USER))313 if ($this->System->User->Licence(LICENCE_USER)) 314 314 { 315 315 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$this->System->User->Id); … … 325 325 $Output .= $this->ShowTeamList(); 326 326 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 327 return ($Output);327 return $Output; 328 328 } 329 329 330 330 function Show() 331 331 { 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(); 341 341 else $Output = $this->ShowTeamList(); 342 342 } else $Output = $this->ShowTeamList(); 343 return ($Output);343 return $Output; 344 344 } 345 345 } -
trunk/Modules/Translation/Comparison.php
r859 r880 12 12 $ArrStr2 = explode(' ', $String2); 13 13 14 for ($i = 0; $i < count($ArrStr1); $i++)14 for ($i = 0; $i < count($ArrStr1); $i++) 15 15 { 16 if (isset($ArrStr2[$i]))16 if (isset($ArrStr2[$i])) 17 17 { 18 if ($ArrStr1[$i] == $ArrStr2[$i])18 if ($ArrStr1[$i] == $ArrStr2[$i]) 19 19 { 20 20 $Result .= $ArrStr1[$i].' '; … … 22 22 { 23 23 $find = false; 24 for ($j = 0; $j < count($ArrStr2); $j++)24 for ($j = 0; $j < count($ArrStr2); $j++) 25 25 { 26 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))26 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false)) 27 27 { 28 28 $Result .= $ArrStr1[$i].' '; … … 30 30 } 31 31 } 32 if ($find == false)32 if ($find == false) 33 33 $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 34 34 } 35 35 } else $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 36 36 } 37 return ($Result);37 return $Result; 38 38 } 39 39 … … 44 44 $Output = ''; 45 45 46 if ($this->System->User->Licence(LICENCE_USER))46 if ($this->System->User->Licence(LICENCE_USER)) 47 47 { 48 48 $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 />'; … … 51 51 $Table = $TranslationTree[$GroupId]['TablePrefix']; 52 52 53 if (array_key_exists('entry', $_GET))53 if (array_key_exists('entry', $_GET)) 54 54 { 55 55 $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ů 57 57 { 58 58 $TextID1 = $_GET['ID1']; … … 66 66 ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '. 67 67 'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`'); 68 while ($Line[] = $DataID->fetch_assoc());68 while ($Line[] = $DataID->fetch_assoc()); 69 69 array_pop($Line); 70 70 … … 74 74 '<table class="BaseTable">'. 75 75 '<tr><th>Přeložil</th>'; 76 foreach ($Line as $Index => $LineItem)76 foreach ($Line as $Index => $LineItem) 77 77 $Output .= '<th>'.$LineItem['UserName'].'</th>'; 78 78 $Output .= '</tr>'. 79 79 '<tr>'. 80 80 '<th>ID textu</th>'; 81 foreach ($Line as $Index => $LineItem)81 foreach ($Line as $Index => $LineItem) 82 82 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>'; 83 83 $Output .= '</tr>'. 84 84 '<tr><th>Převzato</th>'; 85 foreach ($Line as $Index => $LineItem)85 foreach ($Line as $Index => $LineItem) 86 86 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>'; 87 87 $Output .= '</tr>'. 88 88 '<tr><th>'.T('Language').'</th>'; 89 foreach ($Line as $Index => $LineItem)89 foreach ($Line as $Index => $LineItem) 90 90 $Output .= '<td>'.T($LineItem['LanguageName']).'</td>'; 91 91 $Output .= '</tr>'. 92 92 '<tr><th>'.T('Version').'</th>'; 93 foreach ($Line as $Index => $LineItem)93 foreach ($Line as $Index => $LineItem) 94 94 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>'; 95 95 $Output .= '</tr>'; 96 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)96 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 97 97 { 98 98 $writethis = false; 99 for ($i = 0; $i < count($Line); $i++)99 for ($i = 0; $i < count($Line); $i++) 100 100 { 101 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true;101 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true; 102 102 } 103 if ($writethis)103 if ($writethis) 104 104 { 105 105 $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 106 for ($i = 0; $i < count($Line); $i++)106 for ($i = 0; $i < count($Line); $i++) 107 107 { 108 if ($i > 0)108 if ($i > 0) 109 109 { 110 110 $Output .= '<td>'; … … 120 120 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL); 121 121 122 return ($Output);122 return $Output; 123 123 } 124 124 } -
trunk/Modules/Translation/Form.php
r859 r880 10 10 $this->Title = T('Translation'); 11 11 $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(); 15 15 else $Output = $this->ShowForm(); 16 return ($Output);16 return $Output; 17 17 } 18 18 … … 26 26 $this->GroupId = $GroupId; 27 27 $Table = $TranslationTree[$GroupId]['TablePrefix']; 28 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];28 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 29 29 else $Action = ''; 30 30 31 if (array_key_exists('ID', $_GET))31 if (array_key_exists('ID', $_GET)) 32 32 { 33 33 $TextID = $_GET['ID'] * 1; … … 36 36 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 37 37 $Line = $DbResult->fetch_assoc(); 38 if (!$Line)38 if (!$Line) 39 39 { 40 40 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); … … 47 47 else $Language = '`Language` != '.$this->System->Config['OriginalLanguage']; 48 48 $Columns = ''; 49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 50 50 $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,'; 51 51 … … 56 56 $DbResult = $this->Database->query($sql.$join.$where); 57 57 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) 60 60 if (($LineAJ[$TextItem['Column']] <> '') and 61 61 ($LineSearch[$TextItem['Column']] <> '') and … … 74 74 $LineAJ = $DbResult->fetch_assoc(); 75 75 } 76 if (!$LineAJ)76 if (!$LineAJ) 77 77 { 78 78 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); … … 80 80 { 81 81 82 if ($Line['User'] != '')82 if ($Line['User'] != '') 83 83 { 84 84 $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); … … 89 89 $Output .= T('Group').': <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 90 90 91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 92 92 $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'])) 94 94 { 95 95 $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); … … 105 105 } 106 106 $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>'; 110 110 else $Output .= ' <b>'.T('Stored in unfinished').'</b> '; 111 111 } else $Output .= ' <b>'.T('Original version').'</b> '; … … 120 120 $Version = $DbResult->fetch_row(); 121 121 $Version = $Version[0]; 122 if ($Version > 0)122 if ($Version > 0) 123 123 { 124 124 $Output .= '<form action="comparison.php" method="get"><a href="'.$this->System->Link('/TranslationList.php?group='. … … 128 128 <input type="hidden" name="ID2" value="'.$TextID.'" />'; 129 129 130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user 131 131 $Output .= '<select onchange="this.form.submit();" name="ID1"> 132 132 <option value="-1">'.T('Select text for comparison').'</option> 133 133 <option value="-1">'.T('Show/compare all').'</option>'; 134 134 $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()) 136 136 { 137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'.137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'. 138 138 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' ('.T('taken over').')</option>'; 139 139 else 140 140 { 141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original');141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original'); 142 142 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 143 143 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. … … 155 155 156 156 // 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)) 158 158 { 159 159 $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>'; 160 160 // 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)) 162 162 $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&group='. 163 163 $GroupId.'&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>'; … … 169 169 } 170 170 171 if ($TranslationTree[$GroupId]['WowheadName'] != '')171 if ($TranslationTree[$GroupId]['WowheadName'] != '') 172 172 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName']. 173 173 '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; … … 187 187 <td>'.T('Original').'</td> 188 188 <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) 191 191 { 192 192 $Language = $this->System->User->Language; 193 193 } 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); 195 195 else { 196 196 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')'); 197 if ($DbResult3->num_rows > 0)197 if ($DbResult3->num_rows > 0) 198 198 { 199 199 $Language = $DbResult3->fetch_assoc(); … … 209 209 '<script>'; 210 210 $Output .= '$(document).ready(function() {'; 211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 212 212 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 213 213 … … 215 215 '</script>'; 216 216 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) 219 219 { 220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 221 221 { 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'))) 223 223 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 224 224 else $Output .= '<tr><th>'.T($TextItem['Name']).'</th>'; 225 225 $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td> 226 226 <td>'; 227 if ($this->System->User->Licence(LICENCE_USER))227 if ($this->System->User->Licence(LICENCE_USER)) 228 228 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 229 229 $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>'; 231 231 } 232 232 } else … … 235 235 } 236 236 $Output .= '</table></div>'; 237 if ($this->System->User->Licence(LICENCE_USER)) {237 if ($this->System->User->Licence(LICENCE_USER)) { 238 238 $Output .= '</form>'; 239 239 240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and 241 241 $this->System->Config['Web']['EnableGoogleTranslate']) 242 242 { 243 243 $Output .= '<br/><table class="BaseTable">'. 244 244 '<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) 247 247 if ($LineAJ[$TextItem['Column']] <> '') 248 248 $Output .= '<tr><td>'.$TextItem['Column'].'</td>'. … … 256 256 } 257 257 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 258 return ($Output);258 return $Output; 259 259 } 260 260 … … 263 263 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 264 264 265 if ($this->System->User->Licence(LICENCE_MODERATOR))265 if ($this->System->User->Licence(LICENCE_MODERATOR)) 266 266 { 267 267 $GroupId = LoadGroupIdParameter(); … … 273 273 $this->System->ModuleManager->Modules['Log']->WriteLog('Překlad byl smazán! <a href="'.$this->System->Link('/form.php?group='.$this->GroupId.'&ID='.$TextID).'">'.$TextID.'</a>', LOG_TYPE_MODERATOR); 274 274 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 275 return ($Output);275 return $Output; 276 276 } 277 277 } -
trunk/Modules/Translation/LoadNames.php
r859 r880 18 18 } 19 19 // } 20 return ($Text);20 return $Text; 21 21 } 22 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) … … 26 26 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'. 27 27 $this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 28 return ($Text);28 return $Text; 29 29 } 30 30 … … 44 44 $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text); 45 45 $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) { 47 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 48 48 if ($Line[3] <> '') { … … 61 61 62 62 $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); 67 67 $Table = $TranslationTree[$GroupId]['TablePrefix']; 68 68 $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); … … 73 73 $names = array(); 74 74 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)) 76 76 { 77 77 //<span class="edit">barvou.</span> 78 78 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 79 79 } else { 80 if (($GroupId == 13)) {80 if (($GroupId == 13)) { 81 81 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 82 82 'TextGlobalString' => 'Text', 'TextArea' => 'Name', … … 87 87 } 88 88 //$LineAJ[$Column] 89 return ($this->ColorNames(htmlspecialchars($Text),$names));89 return $this->ColorNames(htmlspecialchars($Text),$names); 90 90 } 91 91 … … 93 93 { 94 94 $this->RawPage = true; 95 return (str_replace("\n", '<br/>', $this->LoadNames()));95 return str_replace("\n", '<br/>', $this->LoadNames()); 96 96 } 97 97 } -
trunk/Modules/Translation/Progress.php
r847 r880 8 8 9 9 $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'].')'; 11 11 else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')'; 12 12 … … 14 14 $Query = ''; 15 15 $DbResult = $this->Database->query($GroupListQuery); 16 if ($DbResult->num_rows > 0)16 if ($DbResult->num_rows > 0) 17 17 { 18 while ($DbRow = $DbResult->fetch_assoc())18 while ($DbRow = $DbResult->fetch_assoc()) 19 19 { 20 20 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 50 50 $Total = 0; 51 51 $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()) 53 53 { 54 54 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 56 56 $Total += $Group['Total']; 57 57 } 58 if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);58 if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2); 59 59 else $TotalCount = 0; 60 60 $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>'. 61 61 '</table>'; 62 62 } 63 return ($Output);63 return $Output; 64 64 } 65 65 … … 69 69 $LanguageList = GetLanguageList(); 70 70 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)) 73 73 { 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 != '')) 75 75 { 76 76 $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame; … … 80 80 } 81 81 82 if (!isset($_SESSION['language']))82 if (!isset($_SESSION['language'])) 83 83 { 84 if ($this->System->User->Licence(LICENCE_USER))84 if ($this->System->User->Licence(LICENCE_USER)) 85 85 { 86 86 $_SESSION['language'] = $this->System->User->Language; … … 89 89 } 90 90 } 91 if (array_key_exists('language', $_GET))91 if (array_key_exists('language', $_GET)) 92 92 { 93 if ($_GET['language'] == '') {93 if ($_GET['language'] == '') { 94 94 $_SESSION['language'] = ''; 95 95 } else { … … 97 97 } 98 98 } 99 if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';99 if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = ''; 100 100 101 101 // Show client version selection 102 102 $Output = T('Client version:').' '; 103 103 $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()) 105 105 $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> '; 106 106 $Output .= '<br/>'; … … 109 109 $Output .= T('Language:').' '; 110 110 $Lang = '<a href="?language=">'.T('All').'</a>'; 111 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';111 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 112 112 else $Output .= $Lang; 113 foreach ($LanguageList as $Language)114 if ($Language['Enabled'] == 1)113 foreach ($LanguageList as $Language) 114 if ($Language['Enabled'] == 1) 115 115 { 116 116 $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> '; 118 118 else $Output .= $Lang; 119 119 } 120 120 121 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];121 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 122 122 else $LanguageName = T('All'); 123 123 $Output .= '<br/><br/><h3>'.sprintf(T('Statistics of translation completion of language %s for version %s'), T($LanguageName), $_SESSION['StatVersion']).'</h3><br/>'; 124 124 $Output .= $this->ShowStatTable(); 125 125 126 return ($Output);126 return $Output; 127 127 } 128 128 } -
trunk/Modules/Translation/Save.php
r859 r880 11 11 // Get source text record from database by ID 12 12 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID`='.$TextID); 13 if ($DbResult->num_rows > 0)13 if ($DbResult->num_rows > 0) 14 14 { 15 15 $SourceText = $DbResult->fetch_assoc(); … … 19 19 'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '. 20 20 'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')'); 21 if ($DbResult->num_rows > 0)21 if ($DbResult->num_rows > 0) 22 22 { 23 23 $EnglishText = $DbResult->fetch_assoc(); … … 25 25 // Get all similar english texts 26 26 $Filter = array(); 27 foreach ($Group['Items'] as $GroupItem)27 foreach ($Group['Items'] as $GroupItem) 28 28 { 29 if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))29 if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != '')) 30 30 $Filter[] = '(`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")'; 31 31 } 32 if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';32 if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')'; 33 33 else $Filter = ' AND 0'; 34 34 35 35 $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter; 36 36 $DbResult = $this->Database->query($Query); 37 while ($EnglishFound = $DbResult->fetch_assoc())37 while ($EnglishFound = $DbResult->fetch_assoc()) 38 38 { 39 39 // Get user translation paired to found english item entry … … 41 41 ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart']. 42 42 ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')'); 43 if ($DbResult2->num_rows > 0)43 if ($DbResult2->num_rows > 0) 44 44 { 45 45 // Update existed user translation … … 47 47 $Modified = false; 48 48 $Values = '`Language` = '.$Language; 49 if ($Language != $ExistedText['Language']) $Modified = true;49 if ($Language != $ExistedText['Language']) $Modified = true; 50 50 51 51 $Completable = true; 52 52 $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']]) 58 58 { 59 if (array_key_exists($GroupItem['Column'], $_POST))59 if (array_key_exists($GroupItem['Column'], $_POST)) 60 60 { 61 if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])61 if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']]) 62 62 $Modified = true; 63 63 … … 66 66 } 67 67 } 68 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and68 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and 69 69 ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 70 70 } 71 71 } 72 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed72 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 73 73 else $NewComplete = 0; 74 74 75 75 // Update completion status for edited translation item 76 if ($SourceText['ID'] == $ExistedText['ID'])76 if ($SourceText['ID'] == $ExistedText['ID']) 77 77 { 78 78 $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)); 83 83 } 84 84 } 85 85 $Values .= ', `Complete`='.$NewComplete.', `CompleteParts` = '.$CompleteParts; 86 if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))86 if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts'])) 87 87 $Modified = true; 88 88 89 89 $Values .= ', `ModifyTime` = NOW()'; 90 if ($Modified)90 if ($Modified) 91 91 { 92 92 // Update user translation … … 114 114 $CompleteParts = 0; 115 115 $Completable = true; 116 foreach ($Group['Items'] as $GroupItem)116 foreach ($Group['Items'] as $GroupItem) 117 117 { 118 118 $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']]) 122 122 { 123 123 // Read form user data 124 if (array_key_exists($GroupItem['Column'], $_POST))124 if (array_key_exists($GroupItem['Column'], $_POST)) 125 125 { 126 126 $Values .= ', "'.$_POST[$GroupItem['Column']].'"'; … … 128 128 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 129 129 } 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; 131 131 } else 132 132 { … … 135 135 } 136 136 } 137 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed137 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 138 138 else $NewComplete = 0; 139 139 // Update completion status for edited translation item 140 if ($SourceText['ID'] == $EnglishFound['ID'])140 if ($SourceText['ID'] == $EnglishFound['ID']) 141 141 { 142 142 $TakeID = $TextID; 143 143 $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)); 148 148 } 149 149 } … … 171 171 } else $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 172 172 } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL); 173 return ($Output);173 return $Output; 174 174 } 175 175 … … 183 183 unset($Message); 184 184 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 185 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);185 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType); 186 186 187 187 $GroupId = LoadGroupIdParameter(); 188 188 $Group = $TranslationTree[$GroupId]; 189 189 $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'])) 193 193 { 194 194 $Entry = $_POST['entry'] * 1; 195 195 $TextID = $_POST['ID'] * 1; 196 196 $Language = $_POST['Language'] * 1; 197 if (array_key_exists('End', $_POST)) $Complete = 1;197 if (array_key_exists('End', $_POST)) $Complete = 1; 198 198 else $Complete = 0; 199 199 … … 207 207 { 208 208 // 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)) 210 210 { 211 211 $Output .= 'Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'. … … 216 216 '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />'; 217 217 218 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)218 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 219 219 { 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 = ''; 221 221 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />'; 222 222 } … … 232 232 } else $Output = ShowMessage('Nezadány požadované údaje.', MESSAGE_CRITICAL); 233 233 } 234 return ($Output);234 return $Output; 235 235 } 236 236 … … 246 246 $redirecting = $DbResult->fetch_assoc(); 247 247 248 switch ($redirecting['Redirecting'])248 switch ($redirecting['Redirecting']) 249 249 { 250 250 case 1: … … 254 254 break; 255 255 case 2: 256 if ($next <> '')256 if ($next <> '') 257 257 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 258 258 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. … … 260 260 break; 261 261 case 3: 262 if ($prev <> '')262 if ($prev <> '') 263 263 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 264 264 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. … … 269 269 $Output .= sprintf(T('You can be redirected automatically from this page. You can set where you want to be transfered here: %s'), '<a href="'. 270 270 $this->System->Link('/options/').'" title="'.T('User settings').'">'.T('Options').'</a>'); 271 return ($Output);271 return $Output; 272 272 } 273 273 } -
trunk/Modules/Translation/Translation.php
r861 r880 47 47 'Icon' => '', 48 48 )); 49 if (array_key_exists('Search', $this->System->ModuleManager->Modules))49 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 50 50 { 51 51 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 52 foreach ($TranslationTree as $Group)52 foreach ($TranslationTree as $Group) 53 53 { 54 54 $Table = $Group['TablePrefix']; 55 55 56 56 $Columns = array('ID', 'Entry'); 57 foreach ($Group['Items'] as $Item)57 foreach ($Group['Items'] as $Item) 58 58 { 59 if ($Item['Column'] != '') $Columns[] = $Item['Column'];59 if ($Item['Column'] != '') $Columns[] = $Item['Column']; 60 60 } 61 61 … … 74 74 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '. 75 75 '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()) 77 77 { 78 78 $Items[] = array … … 92 92 'Items' => $Items, 93 93 )); 94 return ($Output);94 return $Output; 95 95 } 96 96 … … 105 105 $UnionItems = array(); 106 106 $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()) 110 110 { 111 111 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. … … 122 122 $DbResult = $this->Database->query($Query); 123 123 $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()) 125 125 { 126 126 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. … … 133 133 } 134 134 $Output .= '</div>'; 135 return ($Output);135 return $Output; 136 136 } 137 137 138 138 function GetTranslationTree() 139 139 { 140 if (isset($this->TranslationTree)) return($this->TranslationTree);140 if (isset($this->TranslationTree)) return $this->TranslationTree; 141 141 else { 142 142 $Result = array(); 143 143 $Groups = array(); 144 144 $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()) 146 146 $Groups[T($DbRow['Name'])] = $DbRow; 147 147 ksort($Groups); 148 foreach ($Groups as $Group)148 foreach ($Groups as $Group) 149 149 { 150 150 $Group['Items'] = array(); … … 153 153 } 154 154 $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`'); 155 while ($DbRow = $DbResult->fetch_assoc())155 while ($DbRow = $DbResult->fetch_assoc()) 156 156 { 157 157 $Result[$DbRow['Group']]['Items'][] = $DbRow; 158 158 } 159 159 $this->TranslationTree = $Result; 160 return ($Result);160 return $Result; 161 161 } 162 162 } … … 168 168 $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">'; 169 169 $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`'); 170 while ($Group = $DbResult->fetch_assoc())170 while ($Group = $DbResult->fetch_assoc()) 171 171 { 172 172 $Groups[T($Group['Name'])] = $Group; 173 173 } 174 174 ksort($Groups); 175 foreach ($Groups as $Group)175 foreach ($Groups as $Group) 176 176 { 177 177 $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'. … … 183 183 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'. 184 184 $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&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)) 186 186 { 187 187 $Output .= ' <a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">'.T('Unfinished').'</a><br />'. … … 196 196 } 197 197 $Output .= '</div>'; 198 return ($Output);198 return $Output; 199 199 } 200 200 } -
trunk/Modules/Translation/TranslationList.php
r859 r880 47 47 ); 48 48 foreach ($StateTypes as $index => $StateType) { 49 if ($Filter['State'] == $index) $Selected = ' selected="selected"';49 if ($Filter['State'] == $index) $Selected = ' selected="selected"'; 50 50 else $Selected = ''; 51 51 $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>'; … … 54 54 55 55 // Translation group 56 if ($GroupId == 0)56 if ($GroupId == 0) 57 57 { 58 58 $Filter['Group'] = GetParameter('group', 0, true, true); 59 if ($Filter['Group'] != 0)59 if ($Filter['Group'] != 0) 60 60 { 61 if (isset($TranslationTree[$Filter['Group']]) == false)61 if (isset($TranslationTree[$Filter['Group']]) == false) 62 62 ErrorMessage('Překladová skupina dle zadaného Id neexistuje.'); 63 63 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; … … 70 70 71 71 $Output .= '<td><select name="group" style="width: 80px">'; 72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"';72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"'; 73 73 else $Selected = ''; 74 74 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 75 75 $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`'); 76 while ($Group = $DbResult->fetch_assoc())76 while ($Group = $DbResult->fetch_assoc()) 77 77 $Groups[T($Group['Name'])] = $Group; 78 78 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"'; 82 82 else $Selected = ''; 83 83 $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>'; … … 89 89 else 90 90 $Filter['Version'] = GetParameter('version', 0, true, true); 91 if ($Filter['Version'] != 0)91 if ($Filter['Version'] != 0) 92 92 { 93 93 $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) 95 95 { 96 96 $DbRow = $DbResult->fetch_assoc(); … … 99 99 } 100 100 $Output .= '<td><select name="version">'; 101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"';101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"'; 102 102 else $Selected = ''; 103 103 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 104 104 $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"'; 108 108 else $Selected = ''; 109 109 $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>'; 110 110 } 111 111 $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'].')'; 113 113 else $VersionFilter = ''; 114 114 //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry) … … 117 117 $Filter['Language'] = GetParameter('lang', 0, true, true); 118 118 $Output .= '<td><select name="lang">'; 119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"';119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"'; 120 120 else $Selected = ''; 121 121 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 122 122 $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"'; 126 126 else $Selected = ''; 127 127 $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>'; … … 130 130 $LanguageFilter = ''; 131 131 $LanguageFilterSub = ''; 132 if ($Filter['Language'] != 0) {132 if ($Filter['Language'] != 0) { 133 133 $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')'; 134 134 $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')'; … … 138 138 $Filter['User'] = GetParameter('user', 0, true, true); 139 139 $Output .= '<td><select name="user" style="width: 80px">'; 140 if ($Filter['User'] == 0) $Selected = ' selected="selected"';140 if ($Filter['User'] == 0) $Selected = ' selected="selected"'; 141 141 else $Selected = ''; 142 142 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 143 143 $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"'; 147 147 else $Selected = ''; 148 148 $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>'; 149 149 } 150 150 $Output .= '</select></td>'; 151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')'; 152 152 else $UserFilter = ''; 153 153 … … 155 155 $Filter['Text'] = GetParameter('text', '', false, true); 156 156 $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>'; 157 if ($Filter['Text'] != '')157 if ($Filter['Text'] != '') 158 158 { 159 159 $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) 163 163 $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")'; 164 164 $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')'; … … 168 168 $Filter['Entry'] = GetParameter('entry', '', false, true); 169 169 $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>'; 170 if ($Filter['Entry'] != '')170 if ($Filter['Entry'] != '') 171 171 { 172 172 $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")'; 173 173 } 174 174 175 if ($Filter['Group'] != 0)175 if ($Filter['Group'] != 0) 176 176 { 177 177 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 179 179 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '. 180 180 '(`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) { 183 183 $ItemsVar[] = 'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) '. 184 184 ' < ('. … … 188 188 ')'; 189 189 } 190 if ($Filter['State'] == CompletionState::All) {190 if ($Filter['State'] == CompletionState::All) { 191 191 $Filter['SQL'] .= $UserFilter.$VersionFilter; 192 192 } else 193 if ($Filter['State'] == CompletionState::NotTranslated) {193 if ($Filter['State'] == CompletionState::NotTranslated) { 194 194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 195 195 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 198 198 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 199 199 } else 200 if ($Filter['State'] == CompletionState::Translated) {200 if ($Filter['State'] == CompletionState::Translated) { 201 201 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 202 202 } else 203 if ($Filter['State'] == CompletionState::NotFinished) {203 if ($Filter['State'] == CompletionState::NotFinished) { 204 204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 205 205 ') AND (`T`.`Complete` = 0)'; 206 206 } else 207 if ($Filter['State'] == CompletionState::Original) {207 if ($Filter['State'] == CompletionState::Original) { 208 208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 209 209 } else 210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 211 211 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 212 212 ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 213 213 ') AND (`T`.`Complete` = 0)'; 214 214 } else 215 if ($Filter['State'] == CompletionState::Missing1) {215 if ($Filter['State'] == CompletionState::Missing1) { 216 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 217 217 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 218 218 } else 219 if ($Filter['State'] == CompletionState::Missing2) {219 if ($Filter['State'] == CompletionState::Missing2) { 220 220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 221 221 $Filter['SQL'] .= ' '. $WithoutAlter; … … 226 226 /* 227 227 // 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']; 229 229 else $Filter['Owner'] = 0; 230 230 $Output .= ' <td><select name="owner">'; 231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"'; 232 232 else $Selected = ''; 233 233 $Output .= '<option value="0"'.$Selected.'>Všech</option>'; 234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"'; 235 235 else $Selected = ''; 236 236 $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"'; 238 238 else $Selected = ''; 239 239 $Output .= '<option value="2"'.$Selected.'>Překladatele</option>'; 240 240 $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'].')'; 242 242 */ 243 243 … … 246 246 $Output .= '</form><br/>'; 247 247 $Filter['Output'] = $Output; 248 return ($Filter);248 return $Filter; 249 249 } 250 250 … … 289 289 290 290 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 291 while ($Line = $DbResult->fetch_assoc())291 while ($Line = $DbResult->fetch_assoc()) 292 292 { 293 293 $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'. … … 305 305 $Output .= '</table>'. 306 306 $PageList['Output']; 307 return ($Output);307 return $Output; 308 308 } 309 309 … … 316 316 $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>'; 317 317 $Total = 0; 318 foreach ($TranslationTree as $Group)319 if ($Group['TablePrefix'] != '')318 foreach ($TranslationTree as $Group) 319 if ($Group['TablePrefix'] != '') 320 320 { 321 321 $Filter = $this->ShowFilter($Group['Id']); … … 328 328 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 329 329 '</table>'; 330 return ($Output);330 return $Output; 331 331 } 332 332 … … 336 336 337 337 $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); 339 339 else { 340 340 $Table = $TranslationTree[$GroupId]['TablePrefix']; … … 351 351 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 352 352 353 if ($this->System->User->Licence(LICENCE_USER))353 if ($this->System->User->Licence(LICENCE_USER)) 354 354 { 355 355 $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3&user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td> … … 373 373 $Output .= '</table>'; 374 374 } 375 return ($Output);375 return $Output; 376 376 } 377 377 … … 380 380 $this->Title = T('Translation groups'); 381 381 $Action = GetParameter('action', ''); 382 if ($Action == 'filter') $Output = $this->ShowMenu();382 if ($Action == 'filter') $Output = $this->ShowMenu(); 383 383 else 384 384 { 385 385 $Filter = $this->ShowFilter(); 386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter); 387 387 else $Output = $this->ShowGroupList($Filter); 388 388 } 389 return ($Output);389 return $Output; 390 390 } 391 391 } … … 409 409 array('Name' => 'LastVersion', 'Title' => T('Version of last import')), 410 410 ); 411 if ($this->System->User->Licence(LICENCE_ADMIN))411 if ($this->System->User->Licence(LICENCE_ADMIN)) 412 412 $TableColumns[] = array('Name' => '', 'Title' => T('Actions')); 413 413 … … 416 416 417 417 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 418 while ($Group = $DbResult->fetch_assoc())418 while ($Group = $DbResult->fetch_assoc()) 419 419 { 420 420 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'. 421 421 '<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 '; 425 425 $Output .= '</td>'; 426 if ($this->System->User->Licence(LICENCE_ADMIN))426 if ($this->System->User->Licence(LICENCE_ADMIN)) 427 427 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='. 428 428 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>'; … … 430 430 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 431 431 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 432 if ($this->System->User->Licence(LICENCE_ADMIN))432 if ($this->System->User->Licence(LICENCE_ADMIN)) 433 433 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>'; 434 434 $Output .= '</tr>'; … … 436 436 $Output .= '</table>'. 437 437 '<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; 440 440 } 441 441 442 442 function ShowGroupAdd() 443 443 { 444 if ($this->System->User->Licence(LICENCE_ADMIN))444 if ($this->System->User->Licence(LICENCE_ADMIN)) 445 445 { 446 446 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 452 452 '</table></form>'; 453 453 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 454 return ($Output);454 return $Output; 455 455 } 456 456 457 457 function ShowGroupAddFinish() 458 458 { 459 if ($this->System->User->Licence(LICENCE_ADMIN))459 if ($this->System->User->Licence(LICENCE_ADMIN)) 460 460 { 461 461 $TableName = 'Text'.$_POST['TablePrefix']; 462 462 $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"'); 463 if ($DbResult->num_rows == 0)463 if ($DbResult->num_rows == 0) 464 464 { 465 465 … … 500 500 $Output .= $this->ShowList(); 501 501 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 502 return ($Output);502 return $Output; 503 503 } 504 504 505 505 function ShowGroupDelete() 506 506 { 507 if ($this->System->User->Licence(LICENCE_ADMIN))507 if ($this->System->User->Licence(LICENCE_ADMIN)) 508 508 { 509 509 $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']); 510 if ($DbResult->num_rows == 1)510 if ($DbResult->num_rows == 1) 511 511 { 512 512 $Group = $DbResult->fetch_assoc(); … … 518 518 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 519 519 $Output .= $this->ShowList(); 520 return ($Output);520 return $Output; 521 521 } 522 522 … … 525 525 $this->Title = T('Translation groups'); 526 526 $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(); 530 530 else $Output = $this->ShowList(); 531 return ($Output);531 return $Output; 532 532 } 533 533 } -
trunk/Modules/Translation/UserLevel.php
r859 r880 11 11 $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú", 12 12 "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"); 13 for ($i = 0; $i < count($Diakrit); $i = $i + 1)13 for ($i = 0; $i < count($Diakrit); $i = $i + 1) 14 14 { 15 if (strpos($Word, $Diakrit[$i]) <> false)15 if (strpos($Word, $Diakrit[$i]) <> false) 16 16 $Result = true; 17 17 } 18 return ($Result);18 return $Result; 19 19 } 20 20 … … 26 26 27 27 $xp = 0; 28 foreach ($TranslationTree as $Group)28 foreach ($TranslationTree as $Group) 29 29 { 30 if ($Group['TablePrefix'] != '')30 if ($Group['TablePrefix'] != '') 31 31 { 32 32 $GroupBy = 'GROUP BY '; 33 33 $TakeColumns = ''; 34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 35 35 { 36 36 $GroupBy .= '`T`.`'.$TextItem['Column'].'`, '; … … 42 42 'LEFT JOIN `'.$Group['TablePrefix'].'` AS `T2` ON `T2`.`ID` = `T`.`Take` '. 43 43 '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()) 45 45 { 46 46 $xp_translation = 0; 47 47 $translated = true; 48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 49 49 { 50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and 51 51 (strlen($Line[$TextItem['Column']]) > (strlen($Line[$TextItem['Column'].'_Take']) * 0.5))) 52 52 { 53 53 $TextArr = explode(' ', $Line[$TextItem['Column']]); 54 foreach ($TextArr as $Word)54 foreach ($TextArr as $Word) 55 55 { 56 if (CheckDiakrit($Word)) $indikator = $from_diakrit;56 if (CheckDiakrit($Word)) $indikator = $from_diakrit; 57 57 else $indikator = 1; 58 58 $xp_translation = $xp_translation + ($indikator * $xp_from_word); … … 65 65 } 66 66 } 67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated 68 68 } 69 69 } 70 70 } 71 return ($xp);71 return $xp; 72 72 } 73 73 … … 79 79 // Main code for users 80 80 $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId); 81 if ($DbResult->num_rows > 0)81 if ($DbResult->num_rows > 0) 82 82 { 83 while ($LineUser = $DbResult->fetch_array())83 while ($LineUser = $DbResult->fetch_array()) 84 84 { 85 85 // Build TranslatedCount query 86 86 $TranslatedCount = '('; 87 if (count($TranslationTree) > 0)87 if (count($TranslationTree) > 0) 88 88 { 89 foreach ($TranslationTree as $Group)90 if ($Group['TablePrefix'] != '')89 foreach ($TranslationTree as $Group) 90 if ($Group['TablePrefix'] != '') 91 91 { 92 92 $Count = '(SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`Language` <> '. -
trunk/Modules/User/Options.php
r861 r880 17 17 '<option value="0">'.T('Nowhere').'</option>'. 18 18 '<option value="1"'; 19 if ($this->System->User->Redirecting == '1') $Output .= ' selected="selected"';19 if ($this->System->User->Redirecting == '1') $Output .= ' selected="selected"'; 20 20 $Output .= '>'.T('To untranslated').'</option>'; 21 21 $Output .= '<option value="2"'; 22 if ($this->System->User->Redirecting == '2') $Output .= ' selected="selected"';22 if ($this->System->User->Redirecting == '2') $Output .= ' selected="selected"'; 23 23 $Output .= '>'.T('To next translation').'</option>'; 24 24 $Output .= '<option value="3"'; 25 if ($this->System->User->Redirecting == '3') $Output .= ' selected="selected"';25 if ($this->System->User->Redirecting == '3') $Output .= ' selected="selected"'; 26 26 $Output .= '>'.T('To previous translation').'</option>'; 27 27 $Output .= '</select>'; … … 60 60 '<input type="hidden" name="action" value="gointeam"/>'. 61 61 '<select name="id">'; 62 while ($LineTeam = $DbResult->fetch_assoc())62 while ($LineTeam = $DbResult->fetch_assoc()) 63 63 { 64 64 $Output .= '<option value="'.$LineTeam['Id'].'"'; … … 69 69 </form>'; 70 70 $Output .= '</fieldset>'; 71 return ($Output);71 return $Output; 72 72 } 73 73 … … 75 75 { 76 76 $Output = ''; 77 if (array_key_exists('Email', $_POST))77 if (array_key_exists('Email', $_POST)) 78 78 { 79 79 $Email = $_POST['Email']; … … 84 84 $Redirecting = $_POST['redirecting']; 85 85 $PreferredVersion = $_POST['ClientVersion']; 86 if ($PreferredVersion == '') $PreferredVersion = null;86 if ($PreferredVersion == '') $PreferredVersion = null; 87 87 $Info = $_POST['info']; 88 88 89 89 // Do user want to change password? 90 if (($OldPass != '') or ($NewPass != '') or ($NewPass2 != ''))90 if (($OldPass != '') or ($NewPass != '') or ($NewPass2 != '')) 91 91 { 92 if ($NewPass == $NewPass2)92 if ($NewPass == $NewPass2) 93 93 { 94 94 $DbResult = $this->System->Database->query('SELECT `Pass`, '.$this->System->User->CryptPasswordSQL('"'.$OldPass.'"', '`Salt`').' AS `Hash` FROM `User` WHERE `ID`= '.$this->System->User->Id); 95 95 $DbRow = $DbResult->fetch_assoc(); 96 if ($DbRow['Hash'] == $DbRow['Pass'])96 if ($DbRow['Hash'] == $DbRow['Pass']) 97 97 { 98 98 // Update password … … 130 130 $this->System->User->Load(); 131 131 } else $Output .= ShowMessage('Nezadány údaje.', MESSAGE_CRITICAL); 132 return ($Output);132 return $Output; 133 133 } 134 134 … … 137 137 $this->Title = T('User settings'); 138 138 $Output = ''; 139 if ($this->System->User->Licence(LICENCE_USER))139 if ($this->System->User->Licence(LICENCE_USER)) 140 140 { 141 if (array_key_exists('action', $_GET) and ($_GET['action'] == 'save'))141 if (array_key_exists('action', $_GET) and ($_GET['action'] == 'save')) 142 142 { 143 143 $Output .= $this->UserOptionsSave(); … … 145 145 $Output .= $this->UserOptionsFrom(); 146 146 } else $Output .= ShowMessage('Nejste přihlášený.', MESSAGE_CRITICAL); 147 return ($Output);147 return $Output; 148 148 } 149 149 } -
trunk/Modules/User/Profile.php
r861 r880 6 6 { 7 7 $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)) 10 10 { 11 11 $Text = $_POST['text']; … … 16 16 'Text: <strong>'.$Text.'</strong><br />'; 17 17 18 if (@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].18 if (@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail']. 19 19 '\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/')) 20 20 { … … 23 23 else $Output .= ShowMessage('Nepodařilo se odesat E-mail.', MESSAGE_CRITICAL); 24 24 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 25 return ($Output);25 return $Output; 26 26 } 27 27 … … 57 57 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 58 58 '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()) 60 60 { 61 61 $Action = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=0').'">'.T('Show').'</a> '. 62 62 '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Export['Id'].'&Tab=7').'">'.T('Export').'</a>'; 63 if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&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&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&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&ExportId='.$Export['Id']).'" onclick="return confirmAction(\''.T('Really clone item?').'\');">'.T('Clone').'</a>'; 65 65 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 66 66 '<td>'.htmlspecialchars($Export['Title']).'</td>'. … … 74 74 75 75 $Output .= '<div style="text-align: center;"><a href="'.$this->System->Link('/export/').'">'.T('Export page').'</a></div>'; 76 return ($Output);76 return $Output; 77 77 } 78 78 … … 86 86 $UnionItems = array(); 87 87 $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()) 91 91 { 92 92 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. … … 106 106 $Output .= '<table class="BaseTable"><tr>'. 107 107 '<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()) 109 109 { 110 110 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. … … 115 115 $Output .= '</table>'; 116 116 } 117 return ($Output);117 return $Output; 118 118 } 119 119 … … 130 130 'JOIN `ForumThread` ON `ForumThread`.`ID` = `ForumText`.`Thread` '. 131 131 '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()) 133 133 $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.htmlspecialchars($Line['ThreadName']).'</a><br />'. 134 134 '<strong>'.$Line['UserName'].'</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> '; 135 135 $Output .= '</div>'; 136 return ($Output);136 return $Output; 137 137 } 138 138 … … 151 151 'WHERE `User`.`Id` = '.($_GET['user'] * 1); 152 152 $DbResult = $this->Database->query($Query); 153 if ($DbResult->num_rows > 0)153 if ($DbResult->num_rows > 0) 154 154 { 155 155 $UserLine = $DbResult->fetch_array(); … … 163 163 T('Number of translated:').' <a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'. 164 164 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'] != '')) 166 166 $Output .= T('Member of team:').' <a href="'.$this->System->Link('/team/?action=team&id='.$UserLine['Team']).'"><strong>'.htmlspecialchars($UserLine['TeamName']).'</strong></a><br />'; 167 167 … … 187 187 '</tr></table>'; 188 188 $Output .= '<br />'.$this->ShowLastForum().'<br />'; 189 if ($this->System->User->Licence(LICENCE_MODERATOR))189 if ($this->System->User->Licence(LICENCE_MODERATOR)) 190 190 { 191 191 $Output .= '<fieldset><legend>Moderování</legend>'; … … 243 243 } 244 244 } else $Output .= ShowMessage('Uživatel nenalezen', MESSAGE_CRITICAL); 245 return ($Output);245 return $Output; 246 246 } 247 247 … … 250 250 $this->Title = T('User profile'); 251 251 $Output = $this->SendMail(); 252 if (array_key_exists('user', $_GET))252 if (array_key_exists('user', $_GET)) 253 253 { 254 254 $Output .= $this->ShowProfile(); 255 255 } else $Output .= ShowMessage('Nevybrán uživatel', MESSAGE_CRITICAL); 256 return ($Output);256 return $Output; 257 257 } 258 258 } -
trunk/Modules/User/Registration.php
r861 r880 5 5 function ShowForm() 6 6 { 7 if (array_key_exists('sc', $_POST)) $Human = true;7 if (array_key_exists('sc', $_POST)) $Human = true; 8 8 else $Human = false; 9 if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];9 if (array_key_exists('user', $_POST)) $UserName = $_POST['user']; 10 10 else $UserName = ''; 11 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];11 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 12 12 else $Email = ''; 13 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'];13 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team']; 14 14 else $Team = ''; 15 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'];15 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language']; 16 16 else $Language = 1; 17 17 … … 24 24 <tr> 25 25 <th class="Left">'.T('Are you human?').'</th>'; 26 if ($Human) $Checked = ' checked="checked"';26 if ($Human) $Checked = ' checked="checked"'; 27 27 else $Checked = ''; 28 28 $Output .= '<td><input type="checkbox" name="sc" '.$Checked.'/></td> … … 50 50 <tr> 51 51 <th class="Left">'.T('I belong to team').':</th>'; 52 if ($Team == '') $Selected = ' selected="selected"';52 if ($Team == '') $Selected = ' selected="selected"'; 53 53 else $Selected = ''; 54 54 $Output .= '<td><select name="Team"><option value="0"'.$Selected.'>'.T('none').'</option>'; 55 55 $DbResult = $this->Database->query('SELECT `Name`, `Id` FROM `Team`'); 56 while ($Line = $DbResult->fetch_assoc())56 while ($Line = $DbResult->fetch_assoc()) 57 57 { 58 if ($Team == $Line['Id']) $Selected = ' selected="selected"';58 if ($Team == $Line['Id']) $Selected = ' selected="selected"'; 59 59 else $Selected = ''; 60 60 $Output .= '<option value="0'.$Line['Id'].'"'.$Selected.'>'.htmlspecialchars($Line['Name']).'</option>'; … … 81 81 </tr> 82 82 </table></fieldset></form>'; 83 return ($Output);83 return $Output; 84 84 } 85 85 … … 91 91 $ShowForm = true; 92 92 93 if (array_key_exists('user', $_POST)) $UserName = $_POST['user'];93 if (array_key_exists('user', $_POST)) $UserName = $_POST['user']; 94 94 else $UserName = ''; 95 if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass'];95 if (array_key_exists('pass', $_POST)) $Pass = $_POST['pass']; 96 96 else $Pass = ''; 97 if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2'];97 if (array_key_exists('pass2', $_POST)) $Pass2 = $_POST['pass2']; 98 98 else $Pass2 = ''; 99 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email'];99 if (array_key_exists('Email', $_POST)) $Email = $_POST['Email']; 100 100 else $Email = ''; 101 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1;101 if (array_key_exists('Team', $_POST)) $Team = $_POST['Team'] * 1; 102 102 else $Team = ''; 103 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1;103 if (array_key_exists('Language', $_POST)) $Language = $_POST['Language'] * 1; 104 104 else $Language = ''; 105 if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1;105 if (array_key_exists('ClientVersion', $_POST)) $PreferredVersion = $_POST['ClientVersion'] * 1; 106 106 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']; 109 109 else $SpamCheck = ''; 110 110 111 if ($SpamCheck != '')111 if ($SpamCheck != '') 112 112 { 113 if (($UserName != '') and ($Pass != '') and ($Pass2 != ''))113 if (($UserName != '') and ($Pass != '') and ($Pass2 != '')) 114 114 { 115 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames']))115 if (!in_array(strtolower($UserName), $Config['ForbiddedUserNames'])) 116 116 { 117 if ($Pass == $Pass2)117 if ($Pass == $Pass2) 118 118 { 119 119 $DbResult = $this->Database->query('SELECT * FROM `User` WHERE LOWER(`Name`) = LOWER("'.$UserName.'")'); 120 120 $Line = $DbResult->fetch_row(); 121 if (!$Line)121 if (!$Line) 122 122 { 123 if ($Team == 0) $Team = 'NULL';123 if ($Team == 0) $Team = 'NULL'; 124 124 $this->System->User->Register($UserName, $Pass, $Email, $Language, $Team, $PreferredVersion); 125 125 $Output .= ShowMessage(T('Registration was successful')); … … 154 154 } else $Output = ShowMessage('Nejsi člověk. Strojům není dovoleno se registrovat.', MESSAGE_CRITICAL); 155 155 156 if ($ShowForm) $Output .= $this->ShowForm();157 return ($Output);156 if ($ShowForm) $Output .= $this->ShowForm(); 157 return $Output; 158 158 } 159 159 … … 162 162 $this->Title = T('User registration'); 163 163 $Output = ''; 164 if (array_key_exists('user', $_POST))164 if (array_key_exists('user', $_POST)) 165 165 { 166 166 $Output .= $this->CheckRegistration(); 167 167 } else $Output .= $this->ShowForm(); 168 return ($Output);168 return $Output; 169 169 } 170 170 } -
trunk/Modules/User/User.php
r871 r880 34 34 'Icon' => '', 35 35 ), 0); 36 if (array_key_exists('Search', $this->System->ModuleManager->Modules))36 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 37 37 $this->System->ModuleManager->Modules['Search']->RegisterSearch('user', 38 38 T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search=')); … … 49 49 'WHERE (`ActivityTime` >= NOW() - 300) '. 50 50 'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`'); 51 while ($DbUser = $DbResult->fetch_assoc())51 while ($DbUser = $DbResult->fetch_assoc()) 52 52 { 53 53 $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>'; 54 54 $Output .= $Name.'<br />'; 55 55 } 56 return ($Output);56 return $Output; 57 57 } 58 58 … … 60 60 { 61 61 $Output = ''; 62 if ($this->System->User->Licence(LICENCE_USER))62 if ($this->System->User->Licence(LICENCE_USER)) 63 63 { 64 64 //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team); … … 79 79 '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>'; 80 80 } 81 return ($Output);81 return $Output; 82 82 } 83 83 } … … 104 104 </table> 105 105 </fieldset></form>'; 106 return ($Output);106 return $Output; 107 107 } 108 108 } … … 132 132 $this->Database = &$System->Database; 133 133 $this->OnlineStateTimeout = 600; // in seconds 134 if (isset($_SESSION)) $this->Check();134 if (isset($_SESSION)) $this->Check(); 135 135 } 136 136 … … 144 144 $DbResult = $this->Database->query('SELECT `ID` FROM `User` WHERE '. 145 145 'LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`')); 146 if ($DbResult->num_rows > 0)146 if ($DbResult->num_rows > 0) 147 147 { 148 148 $User = $DbResult->fetch_assoc(); … … 151 151 // Prepare cookies for permanent login 152 152 $StayLoggedSalt = $this->GetPasswordSalt(); 153 if ($StayLogged == true) $StayLoggedValue = 1; else $StayLoggedValue = 0;153 if ($StayLogged == true) $StayLoggedValue = 1; else $StayLoggedValue = 0; 154 154 $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array( 155 155 'User' => $User['ID'], 'StayLogged' => $StayLoggedValue, 'StayLoggedHash' => $StayLoggedSalt)); 156 if ($StayLogged)156 if ($StayLogged) 157 157 { 158 158 setcookie('LoginUserId', $User['ID'], time() + 365 * 24 * 60 * 60); … … 176 176 { 177 177 $SID = session_id(); 178 if ($this->Role != LICENCE_ANONYMOUS)178 if ($this->Role != LICENCE_ANONYMOUS) 179 179 { 180 180 $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array('User' => null)); … … 192 192 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id` = `User`.`PreferredVersion` '. 193 193 'WHERE `User`.`ID` = '.$this->Id); 194 if ($DbResult->num_rows > 0)194 if ($DbResult->num_rows > 0) 195 195 { 196 196 $User = $DbResult->fetch_assoc(); … … 222 222 function Licence($Licence) 223 223 { 224 if (GetRemoteAddress() == '') return(true); // Execution from command line225 else return ($this->Role >= $Licence);224 if (GetRemoteAddress() == '') return true; // Execution from command line 225 else return $this->Role >= $Licence; 226 226 } 227 227 … … 229 229 { 230 230 $DbResult = $this->Database->select('APIToken', 'User', '`Token`="'.$Token.'"'); 231 if ($DbResult->num_rows > 0)231 if ($DbResult->num_rows > 0) 232 232 { 233 233 $DbRow = $DbResult->fetch_assoc(); 234 234 $DbResult2 = $this->Database->select('User', 'GM', '`ID`="'.$DbRow['User'].'"'); 235 235 $DbRow2 = $DbResult2->fetch_assoc(); 236 return ($DbRow2['GM'] >= $Licence);237 } else return (false);236 return $DbRow2['GM'] >= $Licence; 237 } else return false; 238 238 } 239 239 240 240 function GetPasswordSalt() 241 241 { 242 return (substr(sha1(mt_rand()), 0, 8));242 return substr(sha1(mt_rand()), 0, 8); 243 243 } 244 244 245 245 function CryptPasswordSQL($Password, $Salt) 246 246 { 247 return ('SHA1(CONCAT(SHA1('.$Password.'), '.$Salt.'))');247 return 'SHA1(CONCAT(SHA1('.$Password.'), '.$Salt.'))'; 248 248 } 249 249 … … 253 253 // Lookup user record 254 254 $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"'); 255 if ($Query->num_rows > 0)255 if ($Query->num_rows > 0) 256 256 { 257 257 // Refresh time of last access 258 258 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('ActivityTime' => 'NOW()')); 259 259 } else { 260 if (GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress());260 if (GetRemoteAddress() != '') $HostName = gethostbyaddr(GetRemoteAddress()); 261 261 else $HostName = ''; 262 262 $this->Database->insert('UserOnline', array('SessionId' => $SID, … … 267 267 268 268 // Logged permanently? 269 if (array_key_exists('LoginHash', $_COOKIE))269 if (array_key_exists('LoginHash', $_COOKIE)) 270 270 { 271 271 $DbResult = $this->Database->query('SELECT * FROM `UserOnline` WHERE `User`='.$_COOKIE['LoginUserId']. 272 272 ' AND `StayLogged`=1 AND SessionId!="'.$SID.'"'); 273 if ($DbResult->num_rows > 0)273 if ($DbResult->num_rows > 0) 274 274 { 275 275 $DbRow = $DbResult->fetch_assoc(); 276 if (sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash'])276 if (sha1($_COOKIE['LoginUserId'].$DbRow['StayLoggedHash']) == $_COOKIE['LoginHash']) 277 277 { 278 278 $this->Database->query('DELETE FROM `UserOnline` WHERE `SessionId`="'.$SID.'"'); … … 285 285 $Query = $this->Database->select('UserOnline', '*', '`SessionId`="'.$SID.'"'); 286 286 $Row = $Query->fetch_assoc(); 287 if ($Row['User'] != '')287 if ($Row['User'] != '') 288 288 { 289 289 $this->Id = $Row['User']; … … 296 296 // Remove nonactive users 297 297 $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()) 299 299 { 300 300 $this->Database->delete('UserOnline', 'Id='.$DbRow['Id']); … … 305 305 { 306 306 $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'; 309 309 $this->Database->query('INSERT INTO `User` '. 310 310 '(`Name` , `Pass` , `Salt`, `Email` , `Language` , `Team` , `NeedUpdate`, `RegistrationTime`, `PreferredVersion` ) '. -
trunk/Modules/User/UserList.php
r851 r880 7 7 $this->Title = T('Translators'); 8 8 $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'] != '') 13 13 { 14 14 $SearchQuery = ' AND (`User`.`Name` LIKE "%'.$_SESSION['search'].'%")'; … … 17 17 18 18 $TeamFilter = ''; 19 if (array_key_exists('team', $_GET))19 if (array_key_exists('team', $_GET)) 20 20 { 21 21 $TeamId = $_GET['team'] * 1; 22 22 $DbResult = $this->Database->select('Team', 'Name', '`Id`='.$TeamId); 23 if ($DbResult->num_rows > 0)23 if ($DbResult->num_rows > 0) 24 24 { 25 25 $Team = $DbResult->fetch_assoc(); … … 58 58 59 59 $DbResult = $this->Database->query($Query); 60 while ($Line = $DbResult->fetch_assoc())60 while ($Line = $DbResult->fetch_assoc()) 61 61 { 62 62 $XP = GetLevelMinMax($Line['XP']); … … 71 71 $PageList['Output']; 72 72 73 return ($Output);73 return $Output; 74 74 } 75 75 } -
trunk/Modules/Wiki/Wiki.php
r843 r880 22 22 { 23 23 $DbResult = $this->Database->select('WikiPage', '*', '`VisibleInMenu`=1'); 24 while ($DbRow = $DbResult->fetch_assoc())24 while ($DbRow = $DbResult->fetch_assoc()) 25 25 { 26 26 $this->System->RegisterPage($DbRow['NormalizedName'], 'PageWiki'); … … 40 40 function Show() 41 41 { 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(); 47 47 else $Output = $this->ShowContent(); 48 48 } else $Output = $this->ShowContent(); 49 return ($Output);49 return $Output; 50 50 } 51 51 … … 54 54 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 55 55 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 56 if ($DbResult->num_rows > 0)56 if ($DbResult->num_rows > 0) 57 57 { 58 58 $DbRow = $DbResult->fetch_assoc(); 59 if (array_key_exists('ver', $_GET))59 if (array_key_exists('ver', $_GET)) 60 60 { 61 61 $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) 63 63 { 64 64 $DbRow2 = $DbResult2->fetch_assoc(); 65 65 $Output = '<h3>Archív stránky '.$DbRow['Name'].' ('.HumanDateTime($DbRow2['Time']).')</h3>'; 66 66 $Output .= $DbRow2['Content']; 67 if ($this->System->User->Licence(LICENCE_MODERATOR))67 if ($this->System->User->Licence(LICENCE_MODERATOR)) 68 68 $Output .= '<div><a href="?Action=Edit">Upravit nejnovější</a> <a href="?Action=History">Historie</a></div>'; 69 69 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); … … 71 71 { 72 72 $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) 74 74 { 75 75 $DbRow2 = $DbResult2->fetch_assoc(); 76 76 $Output = '<h3>'.$DbRow['Name'].'</h3>'; 77 77 $Output .= $DbRow2['Content']; 78 if ($this->System->User->Licence(LICENCE_MODERATOR))78 if ($this->System->User->Licence(LICENCE_MODERATOR)) 79 79 $Output .= '<hr><div><a href="?Action=Edit">Upravit</a> <a href="?Action=History">Historie</a></div>'; 80 80 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 81 81 } 82 82 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 83 return ($Output);83 return $Output; 84 84 } 85 85 86 86 function EditContent() 87 87 { 88 if ($this->System->User->Licence(LICENCE_MODERATOR))88 if ($this->System->User->Licence(LICENCE_MODERATOR)) 89 89 { 90 90 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 91 91 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 92 if ($DbResult->num_rows > 0)92 if ($DbResult->num_rows > 0) 93 93 { 94 94 $DbRow = $DbResult->fetch_assoc(); 95 95 $Output = '<h3>Úprava '.$DbRow['Name'].'</h3>'; 96 96 $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) 98 98 { 99 99 $DbRow2 = $DbResult2->fetch_assoc(); … … 106 106 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 107 107 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 108 return ($Output);108 return $Output; 109 109 } 110 110 111 111 function SaveContent() 112 112 { 113 if ($this->System->User->Licence(LICENCE_MODERATOR))113 if ($this->System->User->Licence(LICENCE_MODERATOR)) 114 114 { 115 115 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 116 116 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 117 if ($DbResult->num_rows > 0)117 if ($DbResult->num_rows > 0) 118 118 { 119 119 $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)) 121 121 { 122 122 $DbResult2 = $this->Database->insert('WikiPageContent', array('Content' => stripslashes($_POST['content']), … … 127 127 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 128 128 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 129 return ($Output);129 return $Output; 130 130 } 131 131 132 132 function ShowHistory() 133 133 { 134 if ($this->System->User->Licence(LICENCE_MODERATOR))134 if ($this->System->User->Licence(LICENCE_MODERATOR)) 135 135 { 136 136 $PageName = $this->System->PathItems[count($this->System->PathItems) - 1]; 137 137 $DbResult = $this->Database->select('WikiPage', 'Name, Id', 'NormalizedName="'.$PageName.'"'); 138 if ($DbResult->num_rows > 0)138 if ($DbResult->num_rows > 0) 139 139 { 140 140 $DbRow = $DbResult->fetch_assoc(); … … 160 160 ' FROM `WikiPageContent` WHERE Page='. 161 161 $DbRow['Id'].' '.$Order['SQL'].$PageList['SQLLimit']); 162 while ($PageContent = $DbResult2->fetch_assoc())162 while ($PageContent = $DbResult2->fetch_assoc()) 163 163 { 164 164 $Output .= '<tr>'. … … 173 173 } else $Output = ShowMessage('Wiki stránka nenalezena', MESSAGE_CRITICAL); 174 174 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 175 return ($Output);175 return $Output; 176 176 } 177 177 … … 200 200 $text = str_replace("\r\n", '<br/>', $text); 201 201 $text = '<p>'.$text.'</p>'; 202 return ($text);202 return $text; 203 203 } 204 204 } -
trunk/Packages/Common/AppModule.php
r860 r880 77 77 function Install() 78 78 { 79 if ($this->Installed) return;79 if ($this->Installed) return; 80 80 $List = array(); 81 81 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotInstalled)); … … 89 89 function Uninstall() 90 90 { 91 if (!$this->Installed) return;91 if (!$this->Installed) return; 92 92 $this->Stop(); 93 93 $this->Installed = false; … … 100 100 function Upgrade() 101 101 { 102 if (!$this->Installed) return;103 if ($this->InstalledVersion == $this->Version) return;102 if (!$this->Installed) return; 103 if ($this->InstalledVersion == $this->Version) return; 104 104 $List = array(); 105 105 $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed)); … … 117 117 function Start() 118 118 { 119 if ($this->Running) return;120 if (!$this->Installed) return;119 if ($this->Running) return; 120 if (!$this->Installed) return; 121 121 $List = array(); 122 122 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotRunning)); … … 128 128 function Stop() 129 129 { 130 if (!$this->Running) return;130 if (!$this->Running) return; 131 131 $this->Running = false; 132 132 $List = array(); … … 144 144 function Enable() 145 145 { 146 if ($this->Enabled) return;147 if (!$this->Installed) return;146 if ($this->Enabled) return; 147 if (!$this->Installed) return; 148 148 $List = array(); 149 149 $this->Manager->EnumDependenciesCascade($this, $List, array(ModuleCondition::NotEnabled)); … … 154 154 function Disable() 155 155 { 156 if (!$this->Enabled) return;156 if (!$this->Enabled) return; 157 157 $this->Stop(); 158 158 $this->Enabled = false; … … 203 203 function Perform($List, $Actions, $Conditions = array(ModuleCondition::All)) 204 204 { 205 foreach ($List as $Index => $Module)206 { 207 if (in_array(ModuleCondition::All, $Conditions) or205 foreach ($List as $Index => $Module) 206 { 207 if (in_array(ModuleCondition::All, $Conditions) or 208 208 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or 209 209 (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or … … 213 213 (!$Module->Enabled and in_array(ModuleCondition::NotEnabled, $Conditions))) 214 214 { 215 foreach ($Actions as $Action)215 foreach ($Actions as $Action) 216 216 { 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(); 224 224 } 225 225 } … … 229 229 function EnumDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All)) 230 230 { 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)) 234 234 throw new Exception(sprintf(T('Module "%s" dependency "%s" not found'), $Module->Name, $Dependency)); 235 235 $DepModule = $this->Modules[$Dependency]; 236 if (in_array(ModuleCondition::All, $Conditions) or236 if (in_array(ModuleCondition::All, $Conditions) or 237 237 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or 238 238 (!$Module->Running and in_array(ModuleCondition::NotRunning, $Conditions)) or … … 250 250 function EnumSuperiorDependenciesCascade($Module, &$List, $Conditions = array(ModuleCondition::All)) 251 251 { 252 foreach ($this->Modules as $RefModule)253 { 254 if (in_array($Module->Name, $RefModule->Dependencies) and252 foreach ($this->Modules as $RefModule) 253 { 254 if (in_array($Module->Name, $RefModule->Dependencies) and 255 255 (in_array(ModuleCondition::All, $Conditions) or 256 256 ($Module->Running and in_array(ModuleCondition::Running, $Conditions)) or … … 270 270 { 271 271 $this->LoadModules(); 272 if (file_exists($this->FileName)) $this->LoadState();272 if (file_exists($this->FileName)) $this->LoadState(); 273 273 $this->StartEnabled(); 274 274 } … … 315 315 function ModulePresent($Name) 316 316 { 317 return (array_key_exists($Name, $this->Modules));317 return array_key_exists($Name, $this->Modules); 318 318 } 319 319 320 320 function ModuleEnabled($Name) 321 321 { 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; 323 323 } 324 324 325 325 function ModuleRunning($Name) 326 326 { 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; 328 328 } 329 329 … … 331 331 function SearchModuleById($Id) 332 332 { 333 foreach ($this->Modules as $Module)333 foreach ($this->Modules as $Module) 334 334 { 335 335 //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 ''; 339 339 } 340 340 … … 343 343 $ConfigModules = array(); 344 344 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)) 348 348 { 349 349 $this->Modules[$Mod['Name']] = $this->Modules[$Mod['Name']]; … … 358 358 { 359 359 $Data = array(); 360 foreach ($this->Modules as $Module)360 foreach ($this->Modules as $Module) 361 361 { 362 362 $Data[] = array('Name' => $Module->Name, 'Enabled' => $Module->Enabled, … … 381 381 { 382 382 $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')) 386 386 { 387 387 include_once($Directory.'/'.$Item.'/'.$Item.'.php'); … … 394 394 function LoadModules() 395 395 { 396 if (method_exists($this->OnLoadModules[0], $this->OnLoadModules[1]))396 if (method_exists($this->OnLoadModules[0], $this->OnLoadModules[1])) 397 397 $this->OnLoadModules(); 398 398 else $this->LoadModulesFromDir($this->ModulesDir); -
trunk/Packages/Common/Common.php
r858 r880 59 59 60 60 $Result = ''; 61 if (array_key_exists('all', $QueryItems))61 if (array_key_exists('all', $QueryItems)) 62 62 { 63 63 $PageCount = 1; … … 70 70 } 71 71 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; 76 76 $CurrentPage = $_SESSION['Page']; 77 77 … … 79 79 80 80 $Result = ''; 81 if ($PageCount > 1)81 if ($PageCount > 1) 82 82 { 83 if ($CurrentPage > 0)83 if ($CurrentPage > 0) 84 84 { 85 85 $QueryItems['page'] = 0; … … 90 90 $PagesMax = $PageCount - 1; 91 91 $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)) 94 94 { 95 95 $Result.= ' ... '; 96 96 $PagesMin = $CurrentPage - $Around; 97 97 } 98 for ($i = $PagesMin; $i <= $PagesMax; $i++)98 for ($i = $PagesMin; $i <= $PagesMax; $i++) 99 99 { 100 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';100 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 101 101 else { 102 102 $QueryItems['page'] = $i; … … 104 104 } 105 105 } 106 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';107 if ($CurrentPage < ($PageCount - 1))106 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 107 if ($CurrentPage < ($PageCount - 1)) 108 108 { 109 109 $QueryItems['page'] = ($CurrentPage + 1); … … 114 114 } 115 115 $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>'; 117 117 118 118 $Result = '<div style="text-align: center">'.$Result.'</div>'; 119 119 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 120 120 $this->Page = $CurrentPage; 121 return ($Result);121 return $Result; 122 122 } 123 123 } -
trunk/Packages/Common/Config.php
r838 r880 12 12 function ReadValue($Name) 13 13 { 14 if (!is_array($Name)) $Name = explode('/', $Name);14 if (!is_array($Name)) $Name = explode('/', $Name); 15 15 $Last = array_pop($Name); 16 16 $Data = &$this->Data; 17 foreach ($Name as $Item)17 foreach ($Name as $Item) 18 18 { 19 19 $Data = &$Data[$Item]; 20 20 } 21 return ($Data[$Last]);21 return $Data[$Last]; 22 22 } 23 23 24 24 function WriteValue($Name, $Value) 25 25 { 26 if (!is_array($Name)) $Name = explode('/', $Name);26 if (!is_array($Name)) $Name = explode('/', $Name); 27 27 $Last = array_pop($Name); 28 28 $Data = &$this->Data; 29 foreach ($Name as $Item)29 foreach ($Name as $Item) 30 30 { 31 31 $Data = &$Data[$Item]; … … 38 38 $ConfigData = array(); 39 39 include $FileName; 40 foreach ($this->Data as $Index => $Item)40 foreach ($this->Data as $Index => $Item) 41 41 { 42 if (array_key_exits($Index, $ConfigData))42 if (array_key_exits($Index, $ConfigData)) 43 43 $this->Data[$Index] = $ConfigData[$Index]; 44 44 } … … 52 52 function GetAsArray() 53 53 { 54 return ($this->Data);54 return $this->Data; 55 55 } 56 56 } -
trunk/Packages/Common/Database.php
r858 r880 11 11 function fetch_assoc() 12 12 { 13 return ($this->PDOStatement->fetch(PDO::FETCH_ASSOC));13 return $this->PDOStatement->fetch(PDO::FETCH_ASSOC); 14 14 } 15 15 16 16 function fetch_array() 17 17 { 18 return ($this->PDOStatement->fetch(PDO::FETCH_BOTH));18 return $this->PDOStatement->fetch(PDO::FETCH_BOTH); 19 19 } 20 20 21 21 function fetch_row() 22 22 { 23 return ($this->PDOStatement->fetch(PDO::FETCH_NUM));23 return $this->PDOStatement->fetch(PDO::FETCH_NUM); 24 24 } 25 25 } … … 54 54 function Connect($Host, $User, $Password, $Database) 55 55 { 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; 58 58 else $ConnectionString = ''; 59 59 try { … … 74 74 function Connected() 75 75 { 76 return (isset($this->PDO));76 return isset($this->PDO); 77 77 } 78 78 … … 84 84 function query($Query) 85 85 { 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(); 88 88 $this->LastQuery = $Query; 89 if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))89 if (($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) 90 90 $Duration = ' ; '.round(microtime() - $QueryStartTime, 4). ' s'; 91 if ($this->LogSQLQuery == true)91 if ($this->LogSQLQuery == true) 92 92 file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND); 93 if ($this->ShowSQLQuery == true)93 if ($this->ShowSQLQuery == true) 94 94 echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; '. 95 95 'padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.$Duration.'</div>'."\n"); 96 96 $Result = new DatabaseResult(); 97 97 $Result->PDOStatement = $this->PDO->query($Query); 98 if ($Result->PDOStatement)98 if ($Result->PDOStatement) 99 99 { 100 100 $Result->num_rows = $Result->PDOStatement->rowCount(); … … 104 104 $this->Error = $this->PDO->errorInfo(); 105 105 $this->Error = $this->Error[2]; 106 if (($this->Error != '') and ($this->ShowSQLError == true))106 if (($this->Error != '') and ($this->ShowSQLError == true)) 107 107 echo('<div><strong>SQL Error: </strong>'.$this->Error.'<br />'.$Query.'</div>'); 108 108 throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query); 109 109 } 110 return ($Result);110 return $Result; 111 111 } 112 112 113 113 function select($Table, $What = '*', $Condition = 1) 114 114 { 115 return ($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));115 return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 116 116 } 117 117 … … 125 125 $Name = ''; 126 126 $Values = ''; 127 foreach ($Data as $Key => $Value)127 foreach ($Data as $Key => $Value) 128 128 { 129 129 $Name .= ',`'.$Key.'`'; 130 if (!in_array($Value, $this->Functions))130 if (!in_array($Value, $this->Functions)) 131 131 { 132 if (is_null($Value)) $Value = 'NULL';132 if (is_null($Value)) $Value = 'NULL'; 133 133 else $Value = $this->PDO->quote($Value); 134 134 } … … 144 144 { 145 145 $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)) 149 149 { 150 if (is_null($Value)) $Value = 'NULL';150 if (is_null($Value)) $Value = 'NULL'; 151 151 else $Value = $this->PDO->quote($Value); 152 152 } … … 161 161 $Name = ''; 162 162 $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)) 166 166 { 167 if (is_null($Value)) $Value = 'NULL';167 if (is_null($Value)) $Value = 'NULL'; 168 168 else $Value = $this->PDO->quote($Value); 169 169 } … … 185 185 function real_escape_string($Text) 186 186 { 187 return (addslashes($Text));187 return addslashes($Text); 188 188 } 189 189 190 190 function quote($Text) 191 191 { 192 return ($this->PDO->quote($Text));192 return $this->PDO->quote($Text); 193 193 } 194 194 … … 205 205 function TimeToMysqlDateTime($Time) 206 206 { 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); 209 209 } 210 210 211 211 function TimeToMysqlDate($Time) 212 212 { 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); 215 215 } 216 216 217 217 function TimeToMysqlTime($Time) 218 218 { 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); 221 221 } 222 222 223 223 function MysqlDateTimeToTime($DateTime) 224 224 { 225 if ($DateTime == '') return(NULL);225 if ($DateTime == '') return NULL; 226 226 $Parts = explode(' ', $DateTime); 227 227 $DateParts = explode('-', $Parts[0]); 228 228 $TimeParts = explode(':', $Parts[1]); 229 229 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 230 return ($Result);230 return $Result; 231 231 } 232 232 233 233 function MysqlDateToTime($Date) 234 234 { 235 if ($Date == '') return(NULL);236 return (MysqlDateTimeToTime($Date.' 0:0:0'));235 if ($Date == '') return NULL; 236 return MysqlDateTimeToTime($Date.' 0:0:0'); 237 237 } 238 238 239 239 function MysqlTimeToTime($Time) 240 240 { 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 45 45 ); 46 46 47 if (($this->UserErrors & $Number))47 if (($this->UserErrors & $Number)) 48 48 { 49 49 // Error was suppressed with the @-operator 50 if (0 === error_reporting())50 if (0 === error_reporting()) 51 51 { 52 52 return false; … … 58 58 $Backtrace[0]['line'] = $LineNumber; 59 59 $this->Report($Backtrace); 60 //if ((E_ERROR | E_PARSE) & $Number)60 //if ((E_ERROR | E_PARSE) & $Number) 61 61 die(); 62 62 } … … 82 82 'An internal error occurred!<br/>'. 83 83 '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) 85 85 $Output .= '<pre>'.$Message.'</pre><br/>'; 86 86 $Output .= '</body></html>'; … … 92 92 $Date = date('Y-m-d H:i:s'); 93 93 $Error = '# '.$Date."\n"; 94 foreach ($Backtrace as $Item)94 foreach ($Backtrace as $Item) 95 95 { 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'] = ''; 98 98 99 99 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 100 100 $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) 103 103 { 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)."',"; 106 106 else $Arguments .= "'".$Item."',"; 107 107 } 108 if (strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')';108 if (strlen($Arguments) > 0) $Error .= '('.substr($Arguments, 0, -1).')'; 109 109 $Error .= "\n"; 110 110 } 111 111 $Error .= "\n"; 112 112 113 foreach ($this->OnError as $OnError)113 foreach ($this->OnError as $OnError) 114 114 call_user_func($OnError, $Error); 115 115 } -
trunk/Packages/Common/Image.php
r838 r880 65 65 function SaveToFile($FileName) 66 66 { 67 if ($this->Type == IMAGETYPE_JPEG)67 if ($this->Type == IMAGETYPE_JPEG) 68 68 { 69 69 imagejpeg($this->Image, $FileName); 70 70 } else 71 if ($this->Type == IMAGETYPE_GIF)71 if ($this->Type == IMAGETYPE_GIF) 72 72 { 73 imagegif ($this->Image, $FileName);73 imagegif ($this->Image, $FileName); 74 74 } else 75 if ($this->Type == IMAGETYPE_PNG)75 if ($this->Type == IMAGETYPE_PNG) 76 76 { 77 77 imagepng($this->Image, $FileName); … … 83 83 $ImageInfo = getimagesize($FileName); 84 84 $this->Type = $ImageInfo[2]; 85 if ($this->Type == IMAGETYPE_JPEG)85 if ($this->Type == IMAGETYPE_JPEG) 86 86 { 87 87 $this->Image = imagecreatefromjpeg($FileName); 88 88 } else 89 if ($this->Type == IMAGETYPE_GIF)89 if ($this->Type == IMAGETYPE_GIF) 90 90 { 91 91 $this->Image = imagecreatefromgif($FileName); 92 92 } else 93 if ( $this->Type == IMAGETYPE_PNG)93 if ( $this->Type == IMAGETYPE_PNG) 94 94 { 95 95 $this->Image = imagecreatefrompng($FileName); … … 112 112 function GetWidth() 113 113 { 114 return (imagesx($this->Image));114 return imagesx($this->Image); 115 115 } 116 116 117 117 function GetHeight() 118 118 { 119 return (imagesy($this->Image));119 return imagesy($this->Image); 120 120 } 121 121 … … 127 127 function ConvertColor($Color) 128 128 { 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); 130 130 } 131 131 -
trunk/Packages/Common/Locale.php
r858 r880 20 20 function Translate($Text, $Group = '') 21 21 { 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; 25 25 } 26 26 … … 28 28 { 29 29 $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; 32 32 } 33 33 } … … 47 47 { 48 48 $FileName = $this->Dir.'/'.$Language.'.php'; 49 if (file_exists($FileName)) {49 if (file_exists($FileName)) { 50 50 include_once($FileName); 51 51 $ClassName = 'LocaleText'.$Language; … … 59 59 // Search for php files 60 60 $FileList = scandir($Path); 61 foreach ($FileList as $FileName)61 foreach ($FileList as $FileName) 62 62 { 63 63 $FullName = $Path.'/'.$FileName; 64 if (($FileName == '.') or ($FileName == '..')) ; // Skip virtual items65 else if (substr($FileName, 0, 1) == '.') ; // Skip Linux hidden files66 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') 70 70 { 71 71 $Content = file_get_contents($FullName); 72 72 // Search occurence of T() function 73 while (strpos($Content, 'T(') !== false)73 while (strpos($Content, 'T(') !== false) 74 74 { 75 75 $Previous = strtolower(substr($Content, strpos($Content, 'T(') - 1, 1)); … … 77 77 $Ord = ord($Previous); 78 78 //echo($Ord.','); 79 if (!(($Ord >= ord('a')) and ($Ord <= ord('z'))))79 if (!(($Ord >= ord('a')) and ($Ord <= ord('z')))) 80 80 { 81 81 // Do for non-alpha previous character 82 82 $Original = substr($Content, 0, strpos($Content, ')')); 83 83 $Original2 = ''; 84 if ((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'"))84 if ((substr($Original, 0, 1) == "'") and (substr($Original, -1, 1) == "'")) 85 85 $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) == '"')) 87 87 $Original2 = substr($Original, 1, -1); 88 if ($Original2 != '')88 if ($Original2 != '') 89 89 { 90 if (!array_key_exists($Original2, $this->Texts->Data))90 if (!array_key_exists($Original2, $this->Texts->Data)) 91 91 $this->Texts->Data[$Original2] = ''; 92 92 } … … 109 109 ' $this->Title = \''.$this->Texts->Title.'\';'."\n". 110 110 ' $this->Data = array('."\n"; 111 foreach ($this->Texts->Data as $Index => $Item)111 foreach ($this->Texts->Data as $Index => $Item) 112 112 { 113 113 $Content .= " '".$Index."' => '".$Item."',\n"; … … 122 122 { 123 123 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 124 if ($DbResult->num_rows > 0)124 if ($DbResult->num_rows > 0) 125 125 { 126 126 $Language = $DbResult->fetch_assoc(); 127 127 $this->Texts->Data = array(); 128 128 $DbResult = $Database->select('Locale', '`Original`, `Translated`', '`Language`='.$Language['Id']); 129 while ($DbRow = $DbResult->fetch_assoc())129 while ($DbRow = $DbResult->fetch_assoc()) 130 130 $this->Texts->Data[$DbRow['Original']] = $DbRow['Translated']; 131 131 } … … 135 135 { 136 136 $DbResult = $Database->select('Language', '*', 'Code='.$Database->quote($LangCode)); 137 if ($DbResult->num_rows > 0)137 if ($DbResult->num_rows > 0) 138 138 { 139 139 $Language = $DbResult->fetch_assoc(); 140 140 $Database->delete('Locale', '`Language`='.$Language['Id']); 141 foreach ($this->Texts->Data as $Index => $Item)141 foreach ($this->Texts->Data as $Index => $Item) 142 142 $Database->query('INSERT INTO `Locale` (`Language`,`Original`,`Translated`) '. 143 143 'VALUES('.$Language['Id'].','.$Database->quote($Index).','.$Database->quote($Item).')'); … … 148 148 { 149 149 $DbResult = $Database->select('Language', '*', '`Code`='.$Database->quote($LangCode)); 150 if ($DbResult->num_rows > 0)150 if ($DbResult->num_rows > 0) 151 151 { 152 152 $Language = $DbResult->fetch_assoc(); 153 foreach ($this->Texts->Data as $Index => $Item)153 foreach ($this->Texts->Data as $Index => $Item) 154 154 { 155 155 $DbResult = $Database->select('Locale', '*', '(`Original` ='.$Database->quote($Index). 156 156 ') AND (`Language`='.($Language['Id']).')'); 157 if ($DbResult->num_rows > 0)157 if ($DbResult->num_rows > 0) 158 158 $Database->update('Locale', '(`Language`='.($Language['Id']).') AND '. 159 159 '(`Original` ='.$Database->quote($Index).')', array('Translated' => $Item)); … … 188 188 $this->Available = array(); 189 189 $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') 193 193 { 194 194 $Code = substr($FileName, 0, -4); … … 206 206 $Locale->AnalyzeCode($Directory); 207 207 $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') 211 211 { 212 212 $FileLocale = new LocaleFile($this->System); … … 215 215 216 216 // 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)) 219 219 $FileLocale->Texts->Data[$Index] = $Item; 220 220 // 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)) 223 223 unset($FileLocale->Texts->Data[$Index]); 224 224 $FileLocale->UpdateToDatabase($this->System->Database, $FileLocale->Texts->Code); … … 232 232 function LoadLocale($Code) 233 233 { 234 if (array_key_exists($Code, $this->Available))234 if (array_key_exists($Code, $this->Available)) 235 235 { 236 236 $this->CurrentLocale->Dir = $this->Dir; … … 245 245 global $GlobalLocaleManager; 246 246 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 69 69 function Organization($org) 70 70 { 71 if (trim($org != '')) $this->xheaders['Organization'] = $org;71 if (trim($org != '')) $this->xheaders['Organization'] = $org; 72 72 } 73 73 74 74 function Priority($Priority) 75 75 { 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; 79 79 80 80 $this->xheaders['X-Priority'] = $this->priorities[$Priority - 1]; 81 return (true);81 return true; 82 82 } 83 83 … … 96 96 function Send() 97 97 { 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')); 99 99 100 100 $Body = $this->BuildAttachment($this->BuildBody()); … … 103 103 $this->Headers['CC'] = ''; 104 104 $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 .= ', '; 110 110 $To .= $Recipient['Address']; 111 111 } else 112 if ($Recipient['Type'] == 'Send')113 { 114 if ($Index > 0) $To .= ', ';112 if ($Recipient['Type'] == 'Send') 113 { 114 if ($Index > 0) $To .= ', '; 115 115 $To .= $Recipient['Name'].' <'.$Recipient['Address'].'>'; 116 116 } 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'] .= ', '; 120 120 $this->Headers['CC'] .= $Recipient['Name'].' <'.$To['Address'].'>'; 121 121 } 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'] .= ', '; 125 125 $this->Headers['BCC'] .= $Recipient['Name'].' <'.$To['Address'].'>'; 126 126 } 127 127 } 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')); 129 129 130 130 $this->Headers['Mime-Version'] = '1.0'; 131 131 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; 135 135 136 136 $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"; 140 140 } 141 141 142 142 $this->Subject = strtr($this->Subject, "\r\n", ' '); 143 143 144 if ($this->Subject == '') throw new Exception(T('Mail message missing Subject'));144 if ($this->Subject == '') throw new Exception(T('Mail message missing Subject')); 145 145 146 146 147 147 $res = mail($To, $this->Subject, $Body, $Headers); 148 return ($res);148 return $res; 149 149 } 150 150 151 151 function ValidEmail($Address) 152 152 { 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; 157 157 } 158 158 159 159 function CheckAdresses($Addresses) 160 160 { 161 foreach ($Addresses as $Address)162 { 163 if (!$this->ValidEmail($Address))161 foreach ($Addresses as $Address) 162 { 163 if (!$this->ValidEmail($Address)) 164 164 throw new Exception(sprintf(T('Mail message invalid address %s'), $Address)); 165 165 } … … 168 168 private function ContentEncoding($Charset) 169 169 { 170 if ($Charset != CHARSET_ASCII) return('8bit');171 else return ('7bit');170 if ($Charset != CHARSET_ASCII) return '8bit'; 171 else return '7bit'; 172 172 } 173 173 174 174 private function BuildAttachment($Body) 175 175 { 176 if (count($this->Attachments) > 0)176 if (count($this->Attachments) > 0) 177 177 { 178 178 $this->Headers['Content-Type'] = "multipart/mixed;\n boundary=\"PHP-mixed-".$this->Boundary."\""; … … 181 181 $Result .= $Body; 182 182 183 foreach ($this->Attachments as $Attachment)183 foreach ($this->Attachments as $Attachment) 184 184 { 185 185 $FileName = $Attachment['FileName']; … … 187 187 $ContentType = $Attachment['FileType']; 188 188 $Disposition = $Attachment['Disposition']; 189 if ($Attachment['Type'] == 'File')189 if ($Attachment['Type'] == 'File') 190 190 { 191 if (!file_exists($FileName))191 if (!file_exists($FileName)) 192 192 throw new Exception(sprintf(T('Mail message attached file %s can\'t be found'), $FileName)); 193 193 $Data = file_get_contents($FileName); 194 194 } else 195 if ($Attachment['Type'] == 'Data') $Data = $Attachment['Data'];195 if ($Attachment['Type'] == 'Data') $Data = $Attachment['Data']; 196 196 else $Data = ''; 197 197 … … 203 203 } 204 204 } else $Result = $Body; 205 return ($Result);205 return $Result; 206 206 } 207 207 … … 209 209 { 210 210 $Result = ''; 211 if (count($this->Bodies) > 1)211 if (count($this->Bodies) > 1) 212 212 { 213 213 $this->Headers['Content-Type'] = 'multipart/alternative; boundary="PHP-alt-'.$this->Boundary.'"'; … … 221 221 222 222 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"; 226 226 $Result .= 'Content-Type: '.$Body['Type'].'; charset='.$Body['Charset']. 227 227 "\nContent-Transfer-Encoding: ".$this->ContentEncoding($Body['Charset'])."\n\n".$Body['Content']."\n"; 228 228 } 229 return ($Result);229 return $Result; 230 230 } 231 231 } -
trunk/Packages/Common/NetworkAddress.php
r861 r880 14 14 function GetNetMask() 15 15 { 16 return (0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1));16 return 0xffffffff ^ ((1 << (32 - $this->Prefix)) - 1); 17 17 } 18 18 19 19 function AddressToString() 20 20 { 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))); 22 22 } 23 23 … … 37 37 $To->Address = $From->Address + $HostMask; 38 38 $To->Prefix = 32; 39 return (array('From' => $From, 'To' => $To));39 return array('From' => $From, 'To' => $To); 40 40 } 41 41 … … 43 43 { 44 44 $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; 47 47 $this->Address = $this->Address & $this->GetNetMask(); 48 48 } … … 51 51 { 52 52 $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; 54 54 else $Result = false; 55 55 //echo($Address->AddressToString().'/'.$Address->Prefix.' in '.$this->AddressToString().'/'.$this->Prefix.' '.$Result."\n"); 56 return ($Result);56 return $Result; 57 57 } 58 58 } … … 71 71 function AddressToString() 72 72 { 73 return (inet_ntop($this->Address));73 return inet_ntop($this->Address); 74 74 } 75 75 … … 83 83 $Result = array(); 84 84 $Data = array_reverse(unpack('C*', $this->Address)); 85 foreach ($Data as $Item)85 foreach ($Data as $Item) 86 86 { 87 87 … … 89 89 $Result[] = dechex(($Item >> 4) & 15); 90 90 } 91 return ($Result);91 return $Result; 92 92 } 93 93 -
trunk/Packages/Common/Page.php
r838 r880 17 17 function Show() 18 18 { 19 return ('');19 return ''; 20 20 } 21 21 … … 23 23 { 24 24 $Output = $this->Show(); 25 return ($Output);25 return $Output; 26 26 } 27 27 28 28 function SystemMessage($Title, $Text) 29 29 { 30 return (call_user_func_array($this->OnSystemMessage, array($Title, $Text)));30 return call_user_func_array($this->OnSystemMessage, array($Title, $Text)); 31 31 } 32 32 } -
trunk/Packages/Common/PrefixMultiplier.php
r838 r880 74 74 function TruncateDigits($Value, $Digits = 4) 75 75 { 76 for ($II = 2; $II > -6; $II--)76 for ($II = 2; $II > -6; $II--) 77 77 { 78 if ($Value >= pow(10, $II))78 if ($Value >= pow(10, $II)) 79 79 { 80 if ($Digits < ($II + 1)) $RealDigits = $II + 1;80 if ($Digits < ($II + 1)) $RealDigits = $II + 1; 81 81 else $RealDigits = $Digits; 82 82 $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1); … … 84 84 } 85 85 } 86 return ($Value);86 return $Value; 87 87 } 88 88 … … 93 93 $Negative = ($Value < 0); 94 94 $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); 97 97 98 98 $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; 100 100 101 if ($Value > 1)101 if ($Value > 1) 102 102 { 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)) 104 104 $I = $I + 1; 105 105 } else 106 if ($Value < 1)106 if ($Value < 1) 107 107 { 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)) 109 109 $I = $I - 1; 110 110 } … … 113 113 // Truncate digits count 114 114 $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; 117 117 } 118 118 } -
trunk/Packages/Common/RSS.php
r861 r880 28 28 " <pubDate>".date('r')."</pubDate>\n". 29 29 " <ttl>20</ttl>\n"; 30 foreach ($this->Items as $Item)30 foreach ($this->Items as $Item) 31 31 { 32 32 $Result .= " <item>\n". … … 39 39 $Result .= " </channel>\n". 40 40 "</rss>"; 41 return ($Result);41 return $Result; 42 42 } 43 43 } -
trunk/Packages/Common/Setup.php
r879 r880 29 29 '<input type="submit" name="login" value="'.T('Login').'"/>'. 30 30 '</form>'; 31 return ($Output);31 return $Output; 32 32 } 33 33 … … 37 37 38 38 $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()) 40 40 { 41 41 $Output .= 'Je instalováno: '.$this->YesNo[$this->UpdateManager->IsInstalled()].'<br/>'; 42 if ($this->UpdateManager->IsInstalled())42 if ($this->UpdateManager->IsInstalled()) 43 43 $Output .= 'Je aktuální: '.$this->YesNo[$this->UpdateManager->IsUpToDate()].'<br/>'. 44 44 'Verze databáze: '.$this->UpdateManager->GetDbVersion().'<br/>'; 45 45 $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()) 49 49 $Output .= '<a href="?action=upgrade">'.T('Upgrade').'</a> '; 50 50 $Output .= '<a href="?action=insert_sample_data">Vložit vzorová data</a> '; … … 59 59 $Output .= '<a href="'.$this->System->Link('/').'">'.T('Go to main page').'</a> '; 60 60 $Output .= ''; 61 return ($Output);61 return $Output; 62 62 } 63 63 … … 73 73 74 74 $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']) 80 80 { 81 81 $Output .= $this->LoginPanel(); 82 82 } else 83 83 { 84 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];84 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 85 85 else $Action = ''; 86 if ($Action == 'logout')86 if ($Action == 'logout') 87 87 { 88 88 $_SESSION['SystemPassword'] = ''; … … 90 90 $Output .= $this->LoginPanel(); 91 91 } else 92 if ($Action == 'models')92 if ($Action == 'models') 93 93 { 94 94 $this->System->FormManager->UpdateSQLMeta(); 95 95 } else 96 if ($Action == 'upgrade')96 if ($Action == 'upgrade') 97 97 { 98 98 $Output .= '<h3>Povýšení</h3>'; … … 105 105 $Output .= $this->ControlPanel(); 106 106 } else 107 if ($Action == 'install')107 if ($Action == 'install') 108 108 { 109 109 $Output .= '<h3>Instalace</h3>'; … … 114 114 $Output .= $this->ControlPanel(); 115 115 } else 116 if ($Action == 'uninstall')116 if ($Action == 'uninstall') 117 117 { 118 118 $Output .= '<h3>Odinstalace</h3>'; … … 120 120 $Output .= $this->ControlPanel(); 121 121 } else 122 if ($Action == 'reload_modules')122 if ($Action == 'reload_modules') 123 123 { 124 124 $Output .= '<h3>Znovunačtení seznamu modulů</h3>'; … … 127 127 $Output .= $this->ControlPanel(); 128 128 } else 129 if ($Action == 'insert_sample_data')129 if ($Action == 'insert_sample_data') 130 130 { 131 131 $Output .= '<h3>Vložení vzorových dat</h3>'; … … 133 133 $Output .= $this->ControlPanel(); 134 134 } else 135 if ($Action == 'modules')135 if ($Action == 'modules') 136 136 { 137 137 $Output .= $this->ShowModules(); 138 138 } else 139 if ($Action == 'configure_save')139 if ($Action == 'configure_save') 140 140 { 141 141 $Output .= $this->ConfigSave($this->Config); 142 142 $Output .= $this->ControlPanel(); 143 143 } else 144 if ($Action == 'configure')144 if ($Action == 'configure') 145 145 { 146 146 $Output .= $this->PrepareConfig($this->Config); … … 152 152 } else 153 153 { 154 if (array_key_exists('configure_save', $_POST))154 if (array_key_exists('configure_save', $_POST)) 155 155 { 156 156 $Output .= $this->ConfigSave(array()); … … 160 160 } 161 161 } 162 return ($Output);162 return $Output; 163 163 } 164 164 … … 166 166 { 167 167 $Output = ''; 168 if (array_key_exists('op', $_GET)) $Operation = $_GET['op'];168 if (array_key_exists('op', $_GET)) $Operation = $_GET['op']; 169 169 else $Operation = ''; 170 if ($Operation == 'install')170 if ($Operation == 'install') 171 171 { 172 172 $this->System->ModuleManager->Modules[$_GET['name']]->Install(); … … 174 174 $Output .= 'Modul '.$_GET['name'].' instalován<br/>'; 175 175 } else 176 if ($Operation == 'uninstall')176 if ($Operation == 'uninstall') 177 177 { 178 178 $this->System->ModuleManager->Modules[$_GET['name']]->Uninstall(); … … 180 180 $Output .= 'Modul '.$_GET['name'].' odinstalován<br/>'; 181 181 } else 182 if ($Operation == 'enable')182 if ($Operation == 'enable') 183 183 { 184 184 $this->System->ModuleManager->Modules[$_GET['name']]->Enable(); … … 186 186 $Output .= 'Modul '.$_GET['name'].' povolen<br/>'; 187 187 } else 188 if ($Operation == 'disable')188 if ($Operation == 'disable') 189 189 { 190 190 $this->System->ModuleManager->Modules[$_GET['name']]->Disable(); … … 192 192 $Output .= 'Modul '.$_GET['name'].' zakázán<br/>'; 193 193 } else 194 if ($Operation == 'upgrade')194 if ($Operation == 'upgrade') 195 195 { 196 196 $this->System->ModuleManager->Modules[$_GET['name']]->Upgrade(); … … 200 200 $Output .= '<h3>Správa modulů</h3>'; 201 201 $Output .= $this->ShowList(); 202 return ($Output);202 return $Output; 203 203 } 204 204 … … 221 221 array('Name' => '', 'Title' => 'Akce'), 222 222 )); 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); 226 226 else $Dependencies = ' '; 227 227 $Actions = ''; 228 if ($Module->Installed == true)228 if ($Module->Installed == true) 229 229 { 230 230 $Actions .= ' <a href="?action=modules&op=uninstall&name='.$Module->Name.'">Odinstalovat</a>'; 231 if ($Module->Enabled == true) $Actions .= ' <a href="?action=modules&op=disable&name='.$Module->Name.'">Zakázat</a>';231 if ($Module->Enabled == true) $Actions .= ' <a href="?action=modules&op=disable&name='.$Module->Name.'">Zakázat</a>'; 232 232 else $Actions .= ' <a href="?action=modules&op=enable&name='.$Module->Name.'">Povolit</a>'; 233 if ($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&op=upgrade&name='.$Module->Name.'">Povýšit</a>';233 if ($Module->InstalledVersion != $Module->Version) $Actions .= ' <a href="?action=modules&op=upgrade&name='.$Module->Name.'">Povýšit</a>'; 234 234 } else $Actions .= ' <a href="?action=modules&op=install&name='.$Module->Name.'">Instalovat</a>'; 235 235 … … 244 244 $Output .= $Pageing->Show(); 245 245 //$Output .= '<p><a href="?A=SaveToDb">Uložit do databáze</a></p>'; 246 return ($Output);246 return $Output; 247 247 } 248 248 … … 250 250 { 251 251 $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)) 253 253 $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')) 255 255 $Output .= 'Varování: Konfigurační soubor nebude možné zapsat, protože soubor "'.$this->ConfigDir.'/Config.php" není povolen pro zápis!'; 256 256 $Output .= '<h3>Nastavení systému</h3>'. 257 257 '<form action="?action=configure_save" method="post">'. 258 258 '<table>'; 259 foreach ($this->ConfigDefinition as $Def)259 foreach ($this->ConfigDefinition as $Def) 260 260 { 261 261 $PathParts = explode('/', $Def['Name']); 262 262 $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)) 265 265 { 266 266 $TempConfig = &$TempConfig[$Part]; 267 267 } 268 if (!is_array($TempConfig)) $Value = $TempConfig;268 if (!is_array($TempConfig)) $Value = $TempConfig; 269 269 else $Value = $Def['Default']; 270 270 $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).'"/>'; 278 278 } 279 279 $Output .= '</td></tr>'. … … 281 281 '</table>'. 282 282 '</form>'; 283 return ($Output);283 return $Output; 284 284 } 285 285 … … 287 287 { 288 288 $Config = $DefaultConfig; 289 foreach ($this->ConfigDefinition as $Def)289 foreach ($this->ConfigDefinition as $Def) 290 290 { 291 291 $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)) 293 293 $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']] != '')) 295 295 $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']] != '')) 297 297 $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)) 299 299 $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)) 301 301 $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)) 303 303 $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)) 305 305 $Value = explode(',', $_POST[$Def['Name']]); 306 if (!is_null($Value))306 if (!is_null($Value)) 307 307 { 308 308 $PathParts = explode('/', $Def['Name']); 309 309 $TempConfig = &$Config; 310 foreach ($PathParts as $Part)310 foreach ($PathParts as $Part) 311 311 { 312 312 $TempConfig = &$TempConfig[$Part]; 313 313 } 314 if (!is_array($TempConfig)) $TempConfig = $Value;314 if (!is_array($TempConfig)) $TempConfig = $Value; 315 315 else $Value = $Def['Default']; 316 316 } … … 319 319 file_put_contents($this->ConfigDir.'/Config.php', $ConfigText); 320 320 $Output = 'Konfigurace nastavena<br/>'; 321 return ($Output);321 return $Output; 322 322 } 323 323 … … 327 327 "\$IsDeveloper = array_key_exists('REMOTE_ADDR', \$_SERVER) and in_array(\$_SERVER['REMOTE_ADDR'], array('127.0.0.1'));\n\n"; 328 328 329 foreach ($this->ConfigDefinition as $Def)329 foreach ($this->ConfigDefinition as $Def) 330 330 { 331 331 $PathParts = explode('/', $Def['Name']); 332 332 $Output .= "\$Config"; 333 foreach ($PathParts as $Part)333 foreach ($PathParts as $Part) 334 334 $Output .= "['".$Part."']"; 335 335 $TempConfig = &$Config; 336 336 $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)) 339 339 { 340 340 $TempConfig = &$TempConfig[$Part]; 341 341 } 342 if (!is_array($TempConfig)) $Value = $TempConfig;342 if (!is_array($TempConfig)) $Value = $TempConfig; 343 343 else $Value = $Def['Default']; 344 if ($Def['Type'] == 'Array')344 if ($Def['Type'] == 'Array') 345 345 { 346 346 $Output .= ' array('; 347 foreach ($Value as $Index => $Item)347 foreach ($Value as $Index => $Item) 348 348 $Output .= '\''.$Item.'\', '; 349 349 $Output .= ')'; … … 353 353 } 354 354 $Output .= "\n\n"; 355 return ($Output);355 return $Output; 356 356 } 357 357 } … … 362 362 { 363 363 $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>'; 365 365 else { 366 if (!$this->System->Setup->UpdateManager->IsInstalled())366 if (!$this->System->Setup->UpdateManager->IsInstalled()) 367 367 $Output .= T('System requires database initialization').'<br>'; 368 368 else 369 if (!$this->System->Setup->UpdateManager->IsUpToDate())369 if (!$this->System->Setup->UpdateManager->IsUpToDate()) 370 370 $Output .= T('System requires database upgrade').'<br>'; 371 371 } 372 372 $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; 374 374 } 375 375 } … … 402 402 function CheckState() 403 403 { 404 return ($this->Database->Connected() and $this->UpdateManager->IsInstalled() and405 $this->UpdateManager->IsUpToDate() );404 return $this->Database->Connected() and $this->UpdateManager->IsInstalled() and 405 $this->UpdateManager->IsUpToDate(); 406 406 } 407 407 … … 435 435 { 436 436 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->UpdateManager->VersionTable.'"'); 437 return ($DbResult->num_rows > 0);437 return $DbResult->num_rows > 0; 438 438 } 439 439 … … 443 443 $this->UpdateManager->Trace = $Updates->Get(); 444 444 $Output = $this->UpdateManager->Upgrade(); 445 return ($Output);445 return $Output; 446 446 } 447 447 } -
trunk/Packages/Common/Table.php
r858 r880 7 7 function Show() 8 8 { 9 return ('');9 return ''; 10 10 } 11 11 } … … 15 15 function GetCell($Y, $X) 16 16 { 17 return ('');17 return ''; 18 18 } 19 19 … … 28 28 function RowsCount() 29 29 { 30 return (0);30 return 0; 31 31 } 32 32 } … … 38 38 function GetCell($Y, $X) 39 39 { 40 return ($this->Cells[$Y][$X]);40 return $this->Cells[$Y][$X]; 41 41 } 42 42 43 43 function RowsCount() 44 44 { 45 return (count($this->Cells));45 return count($this->Cells); 46 46 } 47 47 } … … 55 55 function GetCell($Y, $X) 56 56 { 57 return ($this->Cells[$Y][$X]);57 return $this->Cells[$Y][$X]; 58 58 } 59 59 … … 62 62 $this->Cells = array(); 63 63 $DbResult = $this->Database->query($this->Query); 64 while ($DbRow = $DbResult->fetch_row())64 while ($DbRow = $DbResult->fetch_row()) 65 65 { 66 66 $this->Cells[] = $DbRow; … … 75 75 function RowsCount() 76 76 { 77 return (count($this->Cells));77 return count($this->Cells); 78 78 } 79 79 } … … 114 114 { 115 115 $this->Columns = array(); 116 foreach ($Columns as $Column)116 foreach ($Columns as $Column) 117 117 { 118 118 $NewCol = new TableColumn(); … … 121 121 $this->Columns[] = $NewCol; 122 122 } 123 if (count($this->Columns) > 0)123 if (count($this->Columns) > 0) 124 124 $this->DefaultColumn = $this->Columns[0]->Name; 125 125 else $this->DefaultColumn = ''; … … 131 131 $Output .= $this->GetOrderHeader(); 132 132 $this->Table->BeginRead(); 133 for ($Y = 0; $Y < $this->Table->RowsCount(); $Y++)133 for ($Y = 0; $Y < $this->Table->RowsCount(); $Y++) 134 134 { 135 135 $Output .= '<tr>'; 136 136 137 for ($X = 0; $X < count($this->Columns); $X++)137 for ($X = 0; $X < count($this->Columns); $X++) 138 138 { 139 139 $Cell = $this->Table->GetCell($Y, $X); 140 if ($Cell == '') $Output .= '<td> </td>';140 if ($Cell == '') $Output .= '<td> </td>'; 141 141 else $Output .= '<td>'.$Cell.'</td>'; 142 142 } … … 145 145 $this->Table->EndRead(); 146 146 $Output .= '</table>'; 147 return ($Output);147 return $Output; 148 148 } 149 149 150 150 function GetOrderHeader() 151 151 { 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; 156 156 157 157 // Check OrderCol 158 158 $Found = false; 159 foreach ($this->Columns as $Column)159 foreach ($this->Columns as $Column) 160 160 { 161 if ($Column->Name == $_SESSION['OrderCol'])161 if ($Column->Name == $_SESSION['OrderCol']) 162 162 { 163 163 $Found = true; … … 165 165 } 166 166 } 167 if ($Found == false)167 if ($Found == false) 168 168 { 169 169 $_SESSION['OrderCol'] = $this->DefaultColumn; … … 171 171 } 172 172 // Check OrderDir 173 if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1))173 if (($_SESSION['OrderDir'] != 0) and ($_SESSION['OrderDir'] != 1)) 174 174 $_SESSION['OrderDir'] = 0; 175 175 176 176 $Result = ''; 177 177 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 178 foreach ($this->Columns as $Index => $Column)178 foreach ($this->Columns as $Index => $Column) 179 179 { 180 180 $QueryItems['OrderCol'] = $Column->Name; 181 181 $QueryItems['OrderDir'] = 1 - $_SESSION['OrderDir']; 182 if ($Column->Name == $_SESSION['OrderCol'])182 if ($Column->Name == $_SESSION['OrderCol']) 183 183 $ArrowImage = '<img style="vertical-align: middle; border: 0px;" src="'.$this->OrderArrowImage[$_SESSION['OrderDir']].'" alt="order arrow">'; 184 184 else $ArrowImage = ''; 185 if ($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>';185 if ($Column->Name == '') $Result .= '<th>'.$Column->Title.'</th>'; 186 186 else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column->Title.$ArrowImage.'</a></th>'; 187 187 } … … 190 190 $this->OrderDirection = $_SESSION['OrderDir']; 191 191 192 return ('<tr>'.$Result.'</tr>');192 return '<tr>'.$Result.'</tr>'; 193 193 } 194 194 } -
trunk/Packages/Common/UTF8.php
r838 r880 529 529 { 530 530 $Result = ''; 531 for ($I = 0; $I < strlen($String); $I++)531 for ($I = 0; $I < strlen($String); $I++) 532 532 { 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) 535 535 { 536 536 $Result .= $this->CharTable[$Charset][ord($String[$I])]; 537 537 } 538 538 } 539 return ($Result);539 return $Result; 540 540 } 541 541 … … 544 544 $Result = ''; 545 545 $UTFPrefix = ''; 546 for ($I = 0; $I < strlen($String); $I++)546 for ($I = 0; $I < strlen($String); $I++) 547 547 { 548 if (ord($String{$I}) & 0x80) // UTF control character548 if (ord($String{$I}) & 0x80) // UTF control character 549 549 { 550 if (ord($String{$I}) & 0x40) // First550 if (ord($String{$I}) & 0x40) // First 551 551 { 552 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));552 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset])); 553 553 $UTFPrefix = $String{$I}; 554 554 } … … 556 556 } else 557 557 { 558 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset]));558 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset])); 559 559 $UTFPrefix = ''; 560 560 $Result .= $String{$I}; 561 561 } 562 562 } 563 return ($Result);563 return $Result; 564 564 } 565 565 } -
trunk/Packages/Common/Update.php
r858 r880 23 23 $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1'); 24 24 $Version = $DbResult->fetch_assoc(); 25 return ($Version['Revision']);25 return $Version['Revision']; 26 26 } 27 27 … … 29 29 { 30 30 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); 31 return ($DbResult->num_rows > 0);31 return $DbResult->num_rows > 0; 32 32 } 33 33 34 34 function IsUpToDate() 35 35 { 36 return ($this->Revision <= $this->GetDbVersion());36 return $this->Revision <= $this->GetDbVersion(); 37 37 } 38 38 … … 41 41 $DbRevision = $this->GetDbVersion(); 42 42 $Output = 'Počáteční revize databáze: '.$DbRevision.'<br/>'; 43 while ($this->Revision > $DbRevision)43 while ($this->Revision > $DbRevision) 44 44 { 45 45 $TraceItem = $this->Trace[$DbRevision]; … … 54 54 $TraceItem['Revision'].' WHERE `Id`=1'); 55 55 } 56 return ($Output);56 return $Output; 57 57 } 58 58 … … 79 79 echo($Query.';<br/>'); 80 80 flush(); 81 return ($this->Database->query($Query));81 return $this->Database->query($Query); 82 82 } 83 83 } -
trunk/Packages/Common/VarDumper.php
r838 r880 49 49 self::$_depth=$depth; 50 50 self::dumpInternal($var,0); 51 if ($highlight)51 if ($highlight) 52 52 { 53 53 $result=highlight_string("<?php\n".self::$_output,true); … … 60 60 private static function dumpInternal($var,$level) 61 61 { 62 switch (gettype($var))62 switch (gettype($var)) 63 63 { 64 64 case 'boolean': … … 84 84 break; 85 85 case 'array': 86 if (self::$_depth<=$level)86 if (self::$_depth<=$level) 87 87 self::$_output.='array(...)'; 88 else if (empty($var))88 else if (empty($var)) 89 89 self::$_output.='array()'; 90 90 else … … 93 93 $spaces=str_repeat(' ',$level*4); 94 94 self::$_output.="array\n".$spaces.'('; 95 foreach ($keys as $key)95 foreach ($keys as $key) 96 96 { 97 97 self::$_output.="\n".$spaces." [$key] => "; … … 102 102 break; 103 103 case 'object': 104 if (($id=array_search($var,self::$_objects,true))!==false)104 if (($id=array_search($var,self::$_objects,true))!==false) 105 105 self::$_output.=get_class($var).'#'.($id+1).'(...)'; 106 else if (self::$_depth<=$level)106 else if (self::$_depth<=$level) 107 107 self::$_output.=get_class($var).'(...)'; 108 108 else … … 114 114 $spaces=str_repeat(' ',$level*4); 115 115 self::$_output.="$className#$id\n".$spaces.'('; 116 foreach ($keys as $key)116 foreach ($keys as $key) 117 117 { 118 118 $keyDisplay=strtr(trim($key),array("\0"=>':')); -
trunk/alert.php
r848 r880 15 15 $DbResult = $this->Database->query('SELECT `News`.`Time`, `News`.`Text`, `News`.`Title`, '. 16 16 '`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()) 18 18 { 19 19 $Output .= ('> '.HumanDate($Article['Time']).' '.$Article['Title']."\n".strip_tags($Article['Text'])."\n\n"); 20 20 } 21 return ($Output);21 return $Output; 22 22 } 23 23 } -
trunk/includes/FileStream.php
r815 r880 15 15 function __destruct() 16 16 { 17 if ($this->Handle)17 if ($this->Handle) 18 18 fclose($this->Handle); 19 19 } … … 24 24 $this->CloseFile(); 25 25 $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)); 27 27 } 28 28 … … 32 32 $this->CloseFile(); 33 33 $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)); 35 35 } 36 36 37 37 public function CloseFile() 38 38 { 39 if ($this->Handle)39 if ($this->Handle) 40 40 fclose($this->Handle); 41 41 } … … 43 43 public function ReadBlock($Count) 44 44 { 45 return (fread($this->Handle, $Count));45 return fread($this->Handle, $Count); 46 46 } 47 47 48 48 public function ReadByte() 49 49 { 50 return (fread($this->Handle, 1));50 return fread($this->Handle, 1); 51 51 } 52 52 … … 54 54 { 55 55 $val = unpack('V*', fread($this->Handle, 4)); 56 return ($val[1]);56 return $val[1]; 57 57 } 58 58 … … 60 60 { 61 61 $val = unpack('I*', fread($this->Handle, 4)); 62 return ($val[1]);62 return $val[1]; 63 63 } 64 64 … … 66 66 { 67 67 $val = unpack('f*', fread($this->Handle, 4)); 68 return ($val[1]);68 return $val[1]; 69 69 } 70 70 71 71 public function ReadChar() 72 72 { 73 return (fread($this->Handle, 1));73 return fread($this->Handle, 1); 74 74 } 75 75 76 76 public function ReadLine() 77 77 { 78 return (fgets($this->Handle));78 return fgets($this->Handle); 79 79 } 80 80 81 81 public function ReadTextLine() 82 82 { 83 return (fgets($this->Handle));83 return fgets($this->Handle); 84 84 } 85 85 … … 131 131 public function GetPosition() 132 132 { 133 return (ftell($this->Handle));133 return ftell($this->Handle); 134 134 } 135 135 136 136 public function GetSize() 137 137 { 138 return (filesize($this->FileName));138 return filesize($this->FileName); 139 139 } 140 140 141 141 public function SetSize($Size) 142 142 { 143 return (ftruncate($this->Handle, $Size));143 return ftruncate($this->Handle, $Size); 144 144 } 145 145 146 146 public function EOF() 147 147 { 148 return (feof($this->Handle));148 return feof($this->Handle); 149 149 } 150 150 } -
trunk/includes/Global.php
r879 r880 2 2 3 3 include_once(dirname(__FILE__).'/../Packages/Common/Common.php'); 4 if (file_exists(dirname(__FILE__).'/../Config/Config.php'))4 if (file_exists(dirname(__FILE__).'/../Config/Config.php')) 5 5 include_once(dirname(__FILE__).'/../Config/Config.php'); 6 6 include_once(dirname(__FILE__).'/../Application/Core.php'); … … 13 13 14 14 // Back compatibility, will be removed 15 if (isset($InitSystem) and $InitSystem)15 if (isset($InitSystem) and $InitSystem) 16 16 { 17 17 $System = new Core(); … … 25 25 { 26 26 global $TempPageContent; 27 return ($TempPageContent);27 return $TempPageContent; 28 28 } 29 29 } … … 54 54 { 55 55 list($Usec, $Sec) = explode(' ', microtime()); 56 return ( (float)$Usec + (float)$Sec);56 return (float)$Usec + (float)$Sec; 57 57 } 58 58 … … 64 64 65 65 $UnitIndex = 0; 66 while ($Value > 1024)66 while ($Value > 1024) 67 67 { 68 68 $Value = round($Value / 1024, 3); 69 69 $UnitIndex++; 70 70 } 71 return ($Value.' '.$UnitNames[$UnitIndex]);71 return $Value.' '.$UnitNames[$UnitIndex]; 72 72 } 73 73 … … 76 76 $Result = array(); 77 77 $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 .= '='; 83 83 $Item = explode('=', $Part); 84 84 $Result[$Item[0]] = $Item[1]; 85 85 } 86 86 } 87 return ($Result);87 return $Result; 88 88 } 89 89 … … 91 91 { 92 92 $Parts = array(); 93 foreach ($QueryStringArray as $Index => $Item)93 foreach ($QueryStringArray as $Index => $Item) 94 94 { 95 95 $Parts[] = $Index.'='.$Item; 96 96 } 97 return (implode('&', $Parts));97 return implode('&', $Parts); 98 98 } 99 99 … … 107 107 //$return = Str_Replace(Array("(",")",".","!",",","\"","'"), "", $return); //odstraní ().!,"' 108 108 //$return = StrToLower($return); // velká písmena nahradí malými. 109 return ($return);109 return $return; 110 110 } 111 111 … … 116 116 $Days = floor($Days - $month * 30); 117 117 $month = $month - $year * 12; 118 return ($year.'r '.$month.'m '.$Days.'d');118 return $year.'r '.$month.'m '.$Days.'d'; 119 119 } 120 120 … … 137 137 138 138 error_reporting(E_ALL ^ E_WARNING); 139 if (($handle = @fopen($url, "r")) === FALSE) return (false);139 if (($handle = @fopen($url, "r")) === FALSE) return false; 140 140 141 141 $data = stream_get_contents($handle); … … 164 164 $data = strip_tags($data); 165 165 166 return ($data);166 return $data; 167 167 } 168 168 … … 178 178 $PageCount = floor($TotalCount / $ItemPerPage) + 1; 179 179 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; 184 184 $CurrentPage = $_SESSION['Page']; 185 185 … … 188 188 189 189 $Result = ''; 190 if ($PageCount > 1)191 { 192 if ($CurrentPage > 0)190 if ($PageCount > 1) 191 { 192 if ($CurrentPage > 0) 193 193 { 194 194 $QueryItems['page'] = 0; … … 199 199 $PagesMax = $PageCount - 1; 200 200 $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)) 203 203 { 204 204 $Result.= ' ... '; 205 205 $PagesMin = $CurrentPage - $Around; 206 206 } 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> '; 210 210 else { 211 211 $QueryItems['page'] = $i; … … 213 213 } 214 214 } 215 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';216 if ($CurrentPage < ($PageCount - 1))215 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 216 if ($CurrentPage < ($PageCount - 1)) 217 217 { 218 218 $QueryItems['page'] = ($CurrentPage + 1); … … 223 223 } 224 224 $Result = '<div style="text-align: center">'.$Result.'</div>'; 225 return (array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage,225 return array('SQLLimit' => ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage, 226 226 'Page' => $CurrentPage, 227 227 'Output' => $Result, 228 ) );228 ); 229 229 } 230 230 … … 236 236 global $OrderDirSQL, $OrderArrowImage, $Config, $System; 237 237 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))) 240 240 $_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; 243 243 244 244 // Check OrderCol 245 245 $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']) 249 249 { 250 250 $Found = true; … … 252 252 } 253 253 } 254 if ($Found == false)254 if ($Found == false) 255 255 { 256 256 $_SESSION['OrderCol'] = $DefaultColumn; … … 258 258 } 259 259 // 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; 261 261 262 262 $Result = ''; 263 263 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 264 foreach ($Columns as $Index => $Column)264 foreach ($Columns as $Index => $Column) 265 265 { 266 266 $QueryItems['OrderCol'] = $Column['Name']; 267 267 $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="'. 269 269 $System->Link('/images/'.$OrderArrowImage[$_SESSION['OrderDir']]).'" alt="order arrow"/>'; 270 270 else $ArrowImage = ''; 271 if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>';271 if ($Column['Name'] == '') $Result .= '<th>'.$Column['Title'].'</th>'; 272 272 else $Result .= '<th><a href="?'.SetQueryStringArray($QueryItems).'">'.$Column['Title'].$ArrowImage.'</a></th>'; 273 273 } 274 return (array(274 return array( 275 275 'SQL' => ' ORDER BY `'.$_SESSION['OrderCol'].'` '.$OrderDirSQL[$_SESSION['OrderDir']], 276 276 'Output' => '<tr>'.$Result.'</tr>', 277 277 'Column' => $_SESSION['OrderCol'], 278 278 'Direction' => $_SESSION['OrderDir'], 279 ) );279 ); 280 280 } 281 281 … … 287 287 $DbResult = $System->Database->select('ClientVersion', '`Id`, `Version`', '`Imported` = 1'); 288 288 $Output .= '<option value=""'; 289 if ($Selected == '')289 if ($Selected == '') 290 290 $Output .= ' selected="selected"'; 291 291 $Output .= '>'.T('None').'</option>'; 292 while ($ClientVersion = $DbResult->fetch_assoc())292 while ($ClientVersion = $DbResult->fetch_assoc()) 293 293 { 294 294 $Output .= '<option value="'.$ClientVersion['Id'].'"'; 295 if ($Selected == $ClientVersion['Id'])295 if ($Selected == $ClientVersion['Id']) 296 296 $Output .= ' selected="selected"'; 297 297 $Output .= '>'.$ClientVersion['Version'].'</option>'; 298 298 } 299 299 $Output .= '</select>'; 300 return ($Output);300 return $Output; 301 301 } 302 302 … … 307 307 $Result = array(); 308 308 $DbResult = $System->Database->query('SELECT * FROM `Language` WHERE `Enabled` = 1'); 309 while ($DbRow = $DbResult->fetch_assoc())309 while ($DbRow = $DbResult->fetch_assoc()) 310 310 $Result[$DbRow['Id']] = $DbRow; 311 return ($Result);311 return $Result; 312 312 } 313 313 … … 316 316 function HumanDate($SQLDateTime) 317 317 { 318 if ($SQLDateTime == '') return(' ');318 if ($SQLDateTime == '') return ' '; 319 319 $DateTimeParts = explode(' ', $SQLDateTime); 320 if ($DateTimeParts[0] != '0000-00-00')320 if ($DateTimeParts[0] != '0000-00-00') 321 321 { 322 322 $DateParts = explode('-', $DateTimeParts[0]); 323 return (($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1));324 } else return (' ');323 return ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1); 324 } else return ' '; 325 325 } 326 326 327 327 function HumanDateTime($SQLDateTime) 328 328 { 329 if ($SQLDateTime == '') return(' ');329 if ($SQLDateTime == '') return ' '; 330 330 $DateTimeParts = explode(' ', $SQLDateTime); 331 if ($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '')331 if ($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '') 332 332 { 333 333 $DateParts = explode('-', $DateTimeParts[0]); 334 334 $Output = ($DateParts[2] * 1).'.'.($DateParts[1] * 1).'.'.($DateParts[0] * 1); 335 335 } else $Output = ' '; 336 if (count($DateTimeParts) > 1)337 if ($DateTimeParts[1] != '00:00:00')336 if (count($DateTimeParts) > 1) 337 if ($DateTimeParts[1] != '00:00:00') 338 338 { 339 339 $TimeParts = explode(':', $DateTimeParts[1]); 340 340 $Output .= ' '.($TimeParts[0] * 1).':'.($TimeParts[1] * 1).':'.($TimeParts[2] * 1); 341 341 }; 342 return ($Output);342 return $Output; 343 343 } 344 344 … … 347 347 global $System, $Config; 348 348 349 if ($Prev)349 if ($Prev) 350 350 $sql = 'SELECT `ID` FROM `'.$Table.'` AS `item` WHERE '. 351 351 '(`Language` = '.$Config['OriginalLanguage'].') AND NOT EXISTS(SELECT `entry` '. … … 359 359 $DbResult = $System->Database->query($sql); 360 360 $Next = $DbResult->fetch_assoc(); 361 if ($Next)362 { 363 if ($Prev) $Output = '<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ';361 if ($Next) 362 { 363 if ($Prev) $Output = '<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> '; 364 364 else $Output = '<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> '; 365 return ('form.php?group='.$GroupId.'&ID='.$Next['ID']);365 return 'form.php?group='.$GroupId.'&ID='.$Next['ID']; 366 366 } 367 367 } … … 371 371 global $System, $BuildNumbers; 372 372 373 if (isset($BuildNumbers[$Version]) == false)373 if (isset($BuildNumbers[$Version]) == false) 374 374 { 375 375 $sql = 'SELECT `BuildNumber` FROM `ClientVersion` WHERE `Version` = "'.$Version.'"'; … … 378 378 $BuildNumbers[$Version] = $DbRow['BuildNumber']; 379 379 } 380 return ($BuildNumbers[$Version]);380 return $BuildNumbers[$Version]; 381 381 } 382 382 … … 386 386 global $System, $VersionsWOW; 387 387 388 if (isset($VersionsWOW[$BuildNumber]) == false)388 if (isset($VersionsWOW[$BuildNumber]) == false) 389 389 { 390 390 $sql = 'SELECT `Version` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"'; … … 393 393 $VersionsWOW[$BuildNumber] = $Version['Version']; 394 394 } 395 return ($VersionsWOW[$BuildNumber]);395 return $VersionsWOW[$BuildNumber]; 396 396 } 397 397 … … 401 401 global $System, $VersionsWOWId; 402 402 403 if (isset($VersionsWOWId[$BuildNumber]) == false)403 if (isset($VersionsWOWId[$BuildNumber]) == false) 404 404 { 405 405 $sql = 'SELECT `Id` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"'; … … 408 408 $VersionsWOWId[$BuildNumber] = $Version['Id']; 409 409 } 410 return ($VersionsWOWId[$BuildNumber]);410 return $VersionsWOWId[$BuildNumber]; 411 411 } 412 412 … … 416 416 $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree(); 417 417 418 if (array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1;418 if (array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1; 419 419 else $GroupId = 1; 420 420 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; 423 423 } 424 424 425 425 function LoadCommandLineParameters() 426 426 { 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) 432 432 { 433 433 $Index = substr($Parameter, 0, strpos($Parameter, '=')); … … 444 444 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 445 445 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; 449 449 $Output = '<div id="header">'. 450 450 '<ul>'; 451 foreach ($Tabs as $Index => $Tab)451 foreach ($Tabs as $Index => $Tab) 452 452 { 453 453 $QueryItems['Tab'] = $Index; 454 if ($Index == $_SESSION['Tab']) $Selected = ' id="selected"';454 if ($Index == $_SESSION['Tab']) $Selected = ' id="selected"'; 455 455 else $Selected = ''; 456 456 $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>'; 457 457 } 458 458 $Output .= '</ul></div>'; 459 return ($Output);459 return $Output; 460 460 } 461 461 462 462 function CheckBox($Name, $Checked = false, $Id = '', $Class = '', $Disabled = false) 463 463 { 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.' />'; 469 469 } 470 470 471 471 function RadioButton($Name, $Value, $Checked = false, $OnClick = '', $Disabled = false) 472 472 { 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.'/>'; 477 477 } 478 478 479 479 function SelectOption($Name, $Text, $Selected = false) 480 480 { 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>'; 483 483 } 484 484 485 485 function DeleteDirectory($dirname) 486 486 { 487 if (is_dir($dirname))487 if (is_dir($dirname)) 488 488 { 489 489 $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 != '..')) 494 494 { 495 if (!is_dir($dirname.'/'.$file)) unlink($dirname.'/'.$file);495 if (!is_dir($dirname.'/'.$file)) unlink($dirname.'/'.$file); 496 496 else DeleteDirectory($dirname.'/'.$file); 497 497 } … … 500 500 rmdir($dirname); 501 501 } 502 return (true);502 return true; 503 503 } 504 504 … … 515 515 $TranslationTree = $System->ModuleManager->Modules['Translation']->GetTranslationTree(); 516 516 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; 520 520 } 521 521 } … … 540 540 'Dictionary' => 'Text', 541 541 ); 542 return ($TablesColumn);542 return $TablesColumn; 543 543 } 544 544 … … 578 578 $sqlall = ''; 579 579 580 foreach ($TablesColumn as $Table => $Column)580 foreach ($TablesColumn as $Table => $Column) 581 581 { 582 582 $orderinby = ' ORDER BY ID DESC '; … … 588 588 589 589 $where = '(`Language` = '.$Config['OriginalLanguage'].') '; 590 if ($mode == 1) 590 if ($mode == 1) 591 591 { 592 592 $where .= ' AND EXISTS(SELECT 1 FROM `'.$Table. … … 594 594 ') AND (`Sub`.`Entry` = `O`.`Entry`))'; 595 595 } 596 if ($mode == 2) 596 if ($mode == 2) 597 597 { 598 598 $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table. … … 601 601 } 602 602 $where .= ' AND ('; 603 if (array_search('the', $ArrStr)) 603 if (array_search('the', $ArrStr)) 604 604 { 605 605 $where .= '(`O`.`'.$Column.'` LIKE "The %") OR '; … … 607 607 608 608 $SqlOK = false; 609 if (count($ArrStr) > 0) 609 if (count($ArrStr) > 0) 610 610 { 611 611 for ($i = 0; $i < count($ArrStr); $i++) … … 614 614 if ((strlen($ArrStr[$i]) > 3) or ( ((count($ArrStr) < 6) or ($i == 0)) and (strlen($ArrStr[$i]) > 0) ) ) //length 615 615 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) 617 617 { // first in array 618 618 $where .= '(`O`.`'.$Column.'` LIKE "'.addslashes($ArrStr[$i]).'%") OR '; … … 623 623 $where .= ')'; 624 624 } 625 if ($SqlOK) 625 if ($SqlOK) 626 626 { 627 627 //$sql.$where.$groupby.$orderby 628 628 // $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.' )'; 632 632 } else { 633 $sqlall .= ' ( '.$sql.$where.$groupby.' )'; 633 $sqlall .= ' ( '.$sql.$where.$groupby.' )'; 634 634 } 635 635 } 636 636 } 637 if ($SqlOK) 637 if ($SqlOK) 638 638 { 639 639 $orderby = ' ORDER BY LENGTH(Orig) DESC '; … … 641 641 $DbResult = $System->Database->query($sqlall.$orderby); 642 642 // echo ($sql.'|'.$where.'|'.$groupby); 643 while ($Line = $DbResult->fetch_assoc())643 while ($Line = $DbResult->fetch_assoc()) 644 644 { 645 645 $buff[] = array($Line['ID'], $Line['GroupId'], $Line['Orig'], $Line['Tran']); … … 652 652 { 653 653 $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">'. 658 658 '<div class="bar" style="width: '.$Pixels.'px;"></div>'. 659 659 '<div class="text" style="width: '.$Width.'px">'.$Text.'</div>'. 660 '</div>' );660 '</div>'; 661 661 } 662 662 … … 665 665 $IndexLevel = 100; 666 666 667 if ($XP > 0) $Level = floor(sqrt($XP / $IndexLevel));667 if ($XP > 0) $Level = floor(sqrt($XP / $IndexLevel)); 668 668 else $Level = 0; 669 669 $MinXP = $Level * $Level * $IndexLevel; … … 671 671 $MaxXP = $MaxXP - $MinXP; 672 672 $XP = $XP - $MinXP; 673 return (array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP));673 return array('Level' => $Level, 'XP' => $XP, 'MaxXP' => $MaxXP); 674 674 } 675 675 … … 677 677 { 678 678 $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; 685 685 } 686 686 … … 693 693 $Result = ''; 694 694 $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://'); 699 699 $Result .= substr($Content, 0, $I); 700 700 $Content = substr($Content, $I); 701 701 $SpacePos = strpos($Content, ' '); 702 if ($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' '));702 if ($SpacePos !== false) $URL = substr($Content, 0, strpos($Content, ' ')); 703 703 else $URL = substr($Content, 0); 704 704 … … 707 707 } 708 708 $Result .= $Content; 709 return ($Result);709 return $Result; 710 710 } 711 711 … … 729 729 ); 730 730 731 return ('<div class="message" style="background-color: '.$BackgroundColor[$Type].731 return '<div class="message" style="background-color: '.$BackgroundColor[$Type]. 732 732 ';"><table><tr><td class="icon"><img src="'. 733 733 $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>'; 735 735 } 736 736 737 737 function ProcessURL() 738 738 { 739 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))739 if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 740 740 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 741 741 else $PathString = ''; 742 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);742 if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 743 743 $PathItems = explode('/', $PathString); 744 if (strpos(GetRequestURI(), '?') !== false)744 if (strpos(GetRequestURI(), '?') !== false) 745 745 $_SERVER['QUERY_STRING'] = substr(GetRequestURI(), strpos(GetRequestURI(), '?') + 1); 746 746 else $_SERVER['QUERY_STRING'] = ''; 747 747 parse_str($_SERVER['QUERY_STRING'], $_GET); 748 748 // 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; 751 751 } 752 752 … … 757 757 $Output = '<select name="Language">'; 758 758 $DbResult = $System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1'); 759 while ($Language = $DbResult->fetch_assoc())759 while ($Language = $DbResult->fetch_assoc()) 760 760 { 761 761 $Output .= '<option value="'.$Language['Id'].'"'; 762 if ($Selected == $Language['Id'])762 if ($Selected == $Language['Id']) 763 763 $Output .= ' selected="selected"'; 764 764 $Output .= '>'.T($Language['Name']).'</option>'; 765 765 } 766 766 $Output .= '</select>'; 767 return ($Output);767 return $Output; 768 768 } 769 769 770 770 function GetClientProxyAddresses() 771 771 { 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']; 773 773 else $IP = array(); 774 774 } … … 776 776 function GetRemoteAddress() 777 777 { 778 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR'];778 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IP = $_SERVER['REMOTE_ADDR']; 779 779 else $IP = ''; 780 return ($IP);780 return $IP; 781 781 } 782 782 783 783 function GetRequestURI() 784 784 { 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 20 20 $Result = substr($this->Data, $this->Position, $Count); 21 21 $this->Position = $this->Position + $Count; 22 return ($Result);22 return $Result; 23 23 } 24 24 … … 27 27 $Result = $this->Data[$this->Position]; 28 28 $this->Position = $this->Position + 1; 29 return ($Result);29 return $Result; 30 30 } 31 31 … … 34 34 $val = unpack('V*', substr($this->Data, $this->Position, 4)); 35 35 $this->Position = $this->Position + 4; 36 return ($val[1]);36 return $val[1]; 37 37 } 38 38 … … 41 41 $val = unpack('I*', substr($this->Data, $this->Position, 4)); 42 42 $this->Position = $this->Position + 4; 43 return ($val[1]);43 return $val[1]; 44 44 } 45 45 … … 48 48 $val = unpack('f*', substr($this->Data, $this->Position, 4)); 49 49 $this->Position = $this->Position + 4; 50 return ($val[1]);50 return $val[1]; 51 51 } 52 52 … … 55 55 $Result = $this->Data[$this->Position]; 56 56 $this->Position = $this->Position + 1; 57 return ($Result);57 return $Result; 58 58 } 59 59 … … 62 62 $Length = 0; 63 63 $StartPosition = $this->Position; 64 while (!$this->EOF())64 while (!$this->EOF()) 65 65 { 66 66 $Char = $this->ReadChar(); 67 if ($Char == $EndSymbol) break;67 if ($Char == $EndSymbol) break; 68 68 } 69 69 $Result = substr($this->Data, $StartPosition, $this->Position - $StartPosition); 70 return ($Result);70 return $Result; 71 71 } 72 72 … … 116 116 public function GetPosition() 117 117 { 118 return ($this->Position);118 return $this->Position; 119 119 } 120 120 121 121 public function GetSize() 122 122 { 123 return (strlen($this->Data));123 return strlen($this->Data); 124 124 } 125 125 126 126 public function SetSize($Size) 127 127 { 128 return ($this->Data = substr($this->Data, 0, $Size));128 return $this->Data = substr($this->Data, 0, $Size); 129 129 } 130 130 131 131 public function EOF() 132 132 { 133 return ($this->Position >= strlen($this->Data));133 return $this->Position >= strlen($this->Data); 134 134 } 135 135 } -
trunk/includes/PageEdit.php
r838 r880 16 16 ); 17 17 $this->AllowEdit = false; 18 if ($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&id=#Id');18 if ($this->AllowEdit) $this->ItemActions[] = array('Name' => T('Delete'), 'URL' => '?action=remove&id=#Id'); 19 19 } 20 20 … … 22 22 { 23 23 $Output = ''; 24 if (array_key_exists('action', $_GET))24 if (array_key_exists('action', $_GET)) 25 25 { 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(); 31 31 else $Output .= ShowMessage(T('Unknown action'), MESSAGE_CRITICAL); 32 32 } else $Output .= $this->ViewList(); 33 return ($Output);33 return $Output; 34 34 } 35 35 … … 37 37 { 38 38 $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) 40 40 { 41 41 $DbRow = $DbResult->fetch_assoc(); … … 43 43 $Output = T('Item'). 44 44 '<table>'; 45 foreach ($this->Definition as $DefIndex => $Def)45 foreach ($this->Definition as $DefIndex => $Def) 46 46 { 47 47 $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->ViewControl($Def['Type'], $DefIndex, $DbRow[$DefIndex]).'</tr>'; … … 50 50 '</table>'; 51 51 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 52 if ($this->AllowEdit)52 if ($this->AllowEdit) 53 53 { 54 54 $Output .= '<a href="?action=add">'.T('Add').'</a> '; … … 57 57 } 58 58 $Output .= '<a href="?">'.T('List').'</a><br/>'; 59 return ($Output);59 return $Output; 60 60 } 61 61 … … 69 69 $Output .= '<table class="BaseTable">'; 70 70 $TableColumns = array(); 71 foreach ($this->Definition as $Index => $Def)72 if ($Def['InList'])71 foreach ($this->Definition as $Index => $Def) 72 if ($Def['InList']) 73 73 $TableColumns[] = array('Name' => $Index, 'Title' => $Def['Title']); 74 if (count($this->ItemActions) > 0)74 if (count($this->ItemActions) > 0) 75 75 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 76 76 … … 79 79 80 80 $DbResult = $this->Database->query('SELECT * FROM ('.$this->Table.') '.$Order['SQL'].$PageList['SQLLimit']); 81 while ($Item = $DbResult->fetch_assoc())81 while ($Item = $DbResult->fetch_assoc()) 82 82 { 83 83 $Output .= '<tr>'; 84 foreach ($this->Definition as $Index => $Def)85 if ($Def['InList'])84 foreach ($this->Definition as $Index => $Def) 85 if ($Def['InList']) 86 86 { 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>'; 88 88 else $Output .= '<td>'.$Item[$Index].'</td>'; 89 89 } 90 if (count($this->ItemActions) > 0)90 if (count($this->ItemActions) > 0) 91 91 { 92 92 $Output .= '<td>'; 93 foreach ($this->ItemActions as $Index => $Action)93 foreach ($this->ItemActions as $Index => $Action) 94 94 { 95 95 $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); 97 97 $Output .= '<a href="'.$URL.'">'.$Action['Name'].'</a> '; 98 98 } … … 102 102 } 103 103 $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; 106 106 } 107 107 … … 109 109 { 110 110 $Output = ''; 111 if ($this->System->User->Licence(LICENCE_USER))111 if ($this->System->User->Licence(LICENCE_USER)) 112 112 { 113 if (array_key_exists('finish', $_GET))113 if (array_key_exists('finish', $_GET)) 114 114 { 115 115 $Items = array(); 116 foreach ($this->Definition as $Index => $Def)116 foreach ($this->Definition as $Index => $Def) 117 117 { 118 118 $Items[$Index] = $_POST[$Index]; … … 125 125 '<fieldset><legend>'.T('New item').'</legend>'. 126 126 '<table>'; 127 foreach ($this->Definition as $DefIndex => $Def)127 foreach ($this->Definition as $DefIndex => $Def) 128 128 { 129 129 $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->GetControl($Def['Type'], $DefIndex, '').'</tr>'; … … 135 135 } 136 136 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 137 return ($Output);137 return $Output; 138 138 } 139 139 140 140 function DeleteItem() 141 141 { 142 if ($this->System->User->Licence(LICENCE_USER))142 if ($this->System->User->Licence(LICENCE_USER)) 143 143 { 144 144 $this->Database->query('DELETE FROM `'.$this->Table.'` WHERE (`User`='.$this->System->User->Id.') AND (`Id`='.($_GET['id'] * 1).')'); 145 145 $Output = ShowMessage(T('Record removed')); 146 146 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 147 return ($Output);147 return $Output; 148 148 } 149 149 150 150 function GetControl($Type, $Name, $Value) 151 151 { 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.'"/>'; 154 154 else $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>'; 155 return ($Output);155 return $Output; 156 156 } 157 157 158 158 function ViewControl($Type, $Name, $Value) 159 159 { 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; 163 163 else $Output = $Value; 164 return ($Output);164 return $Output; 165 165 } 166 166 } -
trunk/includes/dbc.php
r815 r880 35 35 36 36 $this->ColumnFormat = $ColumnFormat; 37 if ($this->ReadUint() != DBC_SIGNATURE) die(NOT_DBC_FILE);37 if ($this->ReadUint() != DBC_SIGNATURE) die(NOT_DBC_FILE); 38 38 39 39 $this->RecordCount = $this->ReadUint(); … … 43 43 44 44 $this->GenerateOffsetTable(); 45 if ($this->EndOffset != $this->RecordSize)45 if ($this->EndOffset != $this->RecordSize) 46 46 die(RECORD_SIZE_NOT_MATCH.$this->EndOffset.' <> '.$this->RecordSize); 47 47 } … … 71 71 { 72 72 // 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); 74 74 else $this->Offsets = array(); 75 75 76 76 $Offset = 0; 77 77 $I = 0; 78 while ($I < $this->FieldCount)78 while ($I < $this->FieldCount) 79 79 { 80 80 $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]; 82 82 else $Format = FORMAT_UINT32; 83 switch ($Format)83 switch ($Format) 84 84 { 85 85 case FORMAT_BYTE: … … 100 100 private function CellPos($Row, $Column) 101 101 { 102 return ($this->HeaderSize + $Row * $this->RecordSize + $this->Offsets[$Column]);102 return $this->HeaderSize + $Row * $this->RecordSize + $this->Offsets[$Column]; 103 103 } 104 104 … … 106 106 { 107 107 $this->SetPosition($this->CellPos($Row, $Column)); 108 return ($this->ReadByte());108 return $this->ReadByte(); 109 109 } 110 110 … … 112 112 { 113 113 $this->SetPosition($this->CellPos($Row, $Column)); 114 return ($this->ReadUint());114 return $this->ReadUint(); 115 115 } 116 116 … … 118 118 { 119 119 $this->SetPosition($this->CellPos($Row, $Column)); 120 return ($this->ReadInt());120 return $this->ReadInt(); 121 121 } 122 122 … … 124 124 { 125 125 $this->SetPosition($this->CellPos($Row, $Column)); 126 return ($this->ReadFloat());126 return $this->ReadFloat(); 127 127 } 128 128 … … 156 156 157 157 $Position = $this->HeaderSize + $this->RecordCount * $this->RecordSize + $Offset; 158 if ($Position >= $this->GetSize()) return('');158 if ($Position >= $this->GetSize()) return ''; 159 159 $this->SetPosition($Position); 160 160 161 161 $String = ''; 162 while (($Char = $this->ReadChar()) != "\0")162 while (($Char = $this->ReadChar()) != "\0") 163 163 { 164 164 $String .= $Char; 165 165 } 166 return ($String);166 return $String; 167 167 } 168 168 169 169 public function SetString($Row, $Column, $Value) 170 170 { 171 if (in_array($Value, $this->StringList))171 if (in_array($Value, $this->StringList)) 172 172 { 173 173 $this->SetUint($Row, $Column, $this->StringListOffset[array_search($Value, $this->StringList)]); … … 192 192 $this->SetPosition($this->HeaderSize + $this->RecordCount * $this->RecordSize); 193 193 $this->WriteByte(0); 194 foreach ($this->StringList as $Index => $Item)194 foreach ($this->StringList as $Index => $Item) 195 195 { 196 196 $this->WriteString($Item."\0"); … … 206 206 207 207 // 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); 209 209 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]; 213 213 else $Format = FORMAT_UINT32; 214 214 $Record->SetPosition($this->Offsets[$I]); 215 switch ($Format)215 switch ($Format) 216 216 { 217 217 case FORMAT_BYTE: … … 231 231 232 232 $Position = $this->HeaderSize + $this->RecordCount * $this->RecordSize + $Offset; 233 if ($Position >= $this->GetSize()) $String = '';233 if ($Position >= $this->GetSize()) $String = ''; 234 234 else 235 235 { 236 236 $this->SetPosition($Position); 237 237 $String = ''; 238 while (($Char = $this->ReadChar()) != "\0")238 while (($Char = $this->ReadChar()) != "\0") 239 239 $String .= $Char; 240 240 } … … 245 245 } 246 246 } 247 return ($Line);247 return $Line; 248 248 } 249 249 … … 253 253 $Record = new MemoryStream(); 254 254 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]; 258 258 else $Format = FORMAT_UINT32; 259 259 $Record->SetPosition($this->Offsets[$I]); 260 switch ($Format)260 switch ($Format) 261 261 { 262 262 case FORMAT_BYTE: … … 273 273 break; 274 274 case FORMAT_STRING: 275 if (in_array($Line[$I], $this->StringList))275 if (in_array($Line[$I], $this->StringList)) 276 276 { 277 277 $Record->WriteUint($this->StringListOffset[array_search($Line[$I], $this->StringList)]); … … 291 291 $this->SetPosition($this->CellPos($Row, 0)); 292 292 $this->WriteBlock($Record->Data, $this->RecordSize); 293 return ($Line);293 return $Line; 294 294 } 295 295 296 296 public function GetRecordCount() 297 297 { 298 return ($this->RecordCount);298 return $this->RecordCount; 299 299 } 300 300 … … 306 306 public function GetFieldCount() 307 307 { 308 return ($this->FieldCount);308 return $this->FieldCount; 309 309 } 310 310
Note:
See TracChangeset
for help on using the changeset viewer.