Changeset 455 for trunk/includes/global_function.php
- Timestamp:
- Apr 13, 2010, 10:03:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global_function.php
r443 r455 36 36 function GetPageList($TotalCount) 37 37 { 38 global $ Database, $Config;38 global $System; 39 39 40 40 $QueryItems = GetQueryStringArray($_SERVER['QUERY_STRING']); 41 41 42 $ItemPerPage = $ Config['Web']['ItemsPerPage'];43 $Around = round($ Config['Web']['VisiblePagingItems'] / 2);42 $ItemPerPage = $System->Config['Web']['ItemsPerPage']; 43 $Around = round($System->Config['Web']['VisiblePagingItems'] / 2); 44 44 $Result = ''; 45 45 $PageCount = floor($TotalCount / $ItemPerPage) + 1; … … 218 218 function GetLanguageList() 219 219 { 220 global $ Database;220 global $System; 221 221 222 222 $Result = array(); 223 $DbResult = $ Database->SQLCommand('SELECT * FROM `Language` WHERE `Enabled` = 1');224 while($DbRow = mysql_fetch_assoc($DbResult))223 $DbResult = $System->Database->query('SELECT * FROM `Language` WHERE `Enabled` = 1'); 224 while($DbRow = $DbResult->fetch_assoc()) 225 225 $Result[$DbRow['Id']] = $DbRow; 226 226 return($Result); … … 229 229 function GetTranslationTree() 230 230 { 231 global $ Database;231 global $System; 232 232 233 233 $Result = array(); 234 $DbResult = $ Database->SQLCommand('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group` ORDER BY `Name`');235 while($DbRow = mysql_fetch_assoc($DbResult))234 $DbResult = $System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group` ORDER BY `Name`'); 235 while($DbRow = $DbResult->fetch_assoc()) 236 236 { 237 237 $DbRow['Items'] = array(); 238 238 $Result[$DbRow['Id']] = $DbRow; 239 239 } 240 $DbResult = $ Database->SQLCommand('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`');241 while($DbRow = mysql_fetch_assoc($DbResult))240 $DbResult = $System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`'); 241 while($DbRow = $DbResult->fetch_assoc()) 242 242 { 243 243 $Result[$DbRow['Group']]['Items'][] = $DbRow; … … 250 250 function WriteLog($Text, $Type) 251 251 { 252 global $ Database, $Config, $User;252 global $System, $User; 253 253 254 254 if(!isset($_SERVER['REMOTE_ADDR'])) $IP = 'Konzole'; 255 255 else $IP = addslashes($_SERVER['REMOTE_ADDR']); 256 256 257 $Database->SelectDatabase($Config['Database']['Database']); 257 if(isset($User->Id)) $UserId = $User->Id; 258 else $UserId = 0; 258 259 $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP` ) 259 VALUES ('.$User ->Id.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'")';260 $ Database->SQLCommand($Query);260 VALUES ('.$UserId.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'")'; 261 $System->Database->query($Query); 261 262 } 262 263 … … 273 274 function FollowingTran($TextID, $Table, $GroupId, $Prev = false) 274 275 { 275 global $ Database;276 global $System; 276 277 277 278 if($Prev) … … 283 284 } 284 285 285 $Next = mysql_fetch_assoc($Database->SQLCommand($sql)); 286 $DbResult = $System->Database->query($sql); 287 $Next = $DbResult->fetch_assoc(); 286 288 if($Next) 287 289 { 288 290 if($Prev) echo('<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> '); 289 291 else echo('<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> '); 290 return 'form.php?group='.$GroupId.'&ID='.$Next['ID'];292 return('form.php?group='.$GroupId.'&ID='.$Next['ID']); 291 293 } 292 294 } … … 294 296 function GetBuildNumber($Version) 295 297 { 296 global $ Database, $BuildNumbers;298 global $System, $BuildNumbers; 297 299 298 300 if(isset($BuildNumbers[$Version]) == false) 299 301 { 300 302 $sql = 'SELECT `BuildNumber` FROM `ClientVersion` WHERE `Version` = "'.$Version.'"'; 301 $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql)); 303 $DbResult = $System->Database->query($sql); 304 $DbRow = $DbResult->fetch_assoc(); 302 305 $BuildNumbers[$Version] = $DbRow['BuildNumber']; 303 306 } … … 307 310 function GetVersionWOW($BuildNumber) 308 311 { 309 global $ Database, $VersionsWOW;312 global $System, $VersionsWOW; 310 313 311 314 if(isset($VersionsWOW[$BuildNumber]) == false) 312 315 { 313 316 $sql = 'SELECT `Version` FROM `ClientVersion` WHERE `BuildNumber` = "'.$BuildNumber.'"'; 314 $Version = mysql_fetch_assoc($Database->SQLCommand($sql)); 317 $DbResult = $System->Database->query($sql); 318 $Version = $DbResult->fetch_assoc(); 315 319 $VersionsWOW[$BuildNumber] = $Version['Version']; 316 320 } … … 442 446 } 443 447 444 445 448 function GetTranslatNames($Text,$mode,$TablesColumn) 446 449 { 447 global $ Database;450 global $System; 448 451 449 452 /* $TablesID = array('gameobject' => 5, … … 482 485 } 483 486 } 484 $where = substr($where, 0,strlen($where)-4);487 $where = substr($where, 0, strlen($where) - 4); 485 488 $where .= ')'; 486 489 if ($SqlOK) { 487 $ ID = $Database->SQLCommand($sql.$where.$groupby);490 $DbResult = $System->Database->query($sql.$where.$groupby); 488 491 // echo ($sql.'|'.$where.'|'.$groupby); 489 while($Line = mysql_fetch_assoc($ID)) { 490 $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 492 while($Line = $DbResult->fetch_assoc()) 493 { 494 $buff[] = array($Line['ID'], GetIDbyName($Table), $Line[$Column], $Line['Tran']); 491 495 } 492 496 }
Note:
See TracChangeset
for help on using the changeset viewer.