Changeset 38 for branches/3
- Timestamp:
- Nov 25, 2008, 5:12:10 PM (16 years ago)
- Location:
- branches/3
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3/class/translation.php
r35 r38 7 7 8 8 // constructor 9 function translation($id, $database, $Get Text = true)9 function translation($id, $database, $Gettext = true) 10 10 { // BEGIN constructor 11 11 $this->id = $id; 12 12 $this->database = $database; 13 13 $this->GetData(); 14 if ($Get Text and isset($this->data)) $this->GetText();14 if ($Gettext and isset($this->data)) $this->Gettext(); 15 15 } // END constructor 16 16 17 17 function GetData() 18 18 { // BEGIN function GetData 19 $Query = $this->database->query('SELECT *,(SELECT Id FROM ` TextGroup` WHERE19 $Query = $this->database->query('SELECT *,(SELECT Id FROM `textGroup` WHERE 20 20 `Index` = `cz`.`Index` AND `Group` = `cz`.`Group` AND `Language` = 1) 21 as en_Id FROM TextGroup as cz WHERE Id="'.$this->id.'"');21 as en_Id FROM textGroup as cz WHERE Id="'.$this->id.'"'); 22 22 if($Query->num_rows > 0) { 23 23 $Row = $Query->fetch_array(); … … 34 34 } // END function SetData 35 35 36 function Get Text()37 { // BEGIN function Get Text38 $Query = $this->database->query("SELECT ` Text`,`Translation`.`Name`, `Translation`.`MangosColumn` FROM `Text`39 JOIN ` Translation` ON `Translation`.`Id` = `Text`.`GroupItem`40 WHERE ` TranslationGroup` = ".$this->id."");36 function Gettext() 37 { // BEGIN function Gettext 38 $Query = $this->database->query("SELECT `text`,`translation`.`Name`, `translation`.`MangosColumn` FROM `text` 39 JOIN `translation` ON `translation`.`Id` = `text`.`GroupItem` 40 WHERE `translationGroup` = ".$this->id.""); 41 41 while ($Row = $Query->fetch_array()) { 42 $this->text[$Row['Name']] = $Row[' Text'];42 $this->text[$Row['Name']] = $Row['text']; 43 43 } 44 44 $this->data['text'] = $this->text; 45 } // END function Get Text45 } // END function Gettext 46 46 47 47 } // END class translation -
branches/3/class/user.php
r34 r38 2 2 3 3 class user 4 { // BEGIN class User4 { // BEGIN class user 5 5 // variables 6 6 var $ID,$user,$Database; 7 var $Anonymous UserId = 0;7 var $AnonymoususerId = 0; 8 8 var $DefaultRole = 2; 9 9 var $IPAddress = ' '; … … 22 22 $this->IPAddress = gethostbyaddr($_SERVER['REMOTE_ADDR']).' '.$_SERVER['REMOTE_ADDR']; 23 23 // Lookup user record 24 $Query = $this->Database->select(' UserOnline', '*', 'SessionId="'.$SID.'"');24 $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"'); 25 25 if($this->Database->LastDataSet) 26 26 { 27 27 // Refresh time of last access 28 $this->Database->update(' UserOnline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()','IpAddress' => $this->IPAddress));28 $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()','IpAddress' => $this->IPAddress)); 29 29 } else { 30 $this->Database->insert(' UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'Time' => 'NOW()', 'IpAddress' => $this->IPAddress));30 $this->Database->insert('useronline', array('SessionId' => $SID, 'user' => $this->AnonymoususerId, 'Time' => 'NOW()', 'IpAddress' => $this->IPAddress)); 31 31 } 32 32 // Odeber neaktivní uživatele 33 $this->Database->delete(' UserOnline', 'Time < DATE_SUB(NOW(), INTERVAL '.USER_TIMEOUT.' SECOND)');33 $this->Database->delete('useronline', 'Time < DATE_SUB(NOW(), INTERVAL '.USER_TIMEOUT.' SECOND)'); 34 34 35 35 // Zkontroluj přihlášení 36 $Query = $this->Database->select(' UserOnline', '*', 'SessionId="'.$SID.'"');36 $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"'); 37 37 $Row = $Query->fetch_array(); 38 if($Row[' User'] != $this->AnonymousUserId)38 if($Row['user'] != $this->AnonymoususerId) 39 39 { 40 $Query = $this->Database->select(' User', '*', "Id=".$Row['User']."");40 $Query = $this->Database->select('user', '*', "Id=".$Row['user'].""); 41 41 $this->user = $Query->fetch_array(); 42 42 $Result = USER_LOGGED; 43 43 $this->LoadPermission($this->user['Permission']); 44 44 } else { 45 $Query = $this->Database->select(' User', '*', "Id=".$this->AnonymousUserId);45 $Query = $this->Database->select('user', '*', "Id=".$this->AnonymoususerId); 46 46 $this->user = $Query->fetch_array(); 47 47 $Result = USER_NOT_LOGGED; … … 60 60 { 61 61 // Je uživatel registrován? 62 $Query = $this->Database->select(' User', '*', 'Name = "'.$Data['Nick'].'"');62 $Query = $this->Database->select('user', '*', 'Name = "'.$Data['Nick'].'"'); 63 63 if($this->Database->LastDataSet) $Result = NICK_USED; 64 64 else 65 65 { 66 $this->Database->insert(' User', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()'));66 $this->Database->insert('user', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()')); 67 67 //echo $this->Database->LastQuery; 68 68 $Result = USER_REGISTRATED; … … 76 76 $SID = session_id(); 77 77 // Je uživatel registrován? 78 $Query = $this->Database->select(' User', '*', 'Name="'.$Data['Nick'].'"');78 $Query = $this->Database->select('user', '*', 'Name="'.$Data['Nick'].'"'); 79 79 if($Query->num_rows > 0) 80 80 { … … 83 83 else 84 84 { 85 $this->Database->update(' User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress));86 $this->Database->update(' UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id']));85 $this->Database->update('user', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress)); 86 $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('user' => $Row['Id'])); 87 87 // načtení stavu stromu 88 88 $Result = USER_LOGGED_IN; … … 97 97 { 98 98 $SID = session_id(); 99 $this->Database->update(' UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId));99 $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('user' => $this->AnonymoususerId)); 100 100 $this->Check(); 101 101 return(USER_LOGGED_OUT); … … 105 105 { 106 106 $this->user['Permission'] = array(); 107 $DbResult = $this->Database->select(' Permission','*','ID='.$Permission);107 $DbResult = $this->Database->select('permission','*','ID='.$Permission); 108 108 if($this->Database->LastDataSet) 109 109 while($DbRow = $DbResult->fetch_array()) … … 121 121 } // END function Permission 122 122 123 } // END class User123 } // END class user 124 124 125 125 ?> -
branches/3/frontend.php
r35 r38 28 28 echo '<li><a class="verticalmenua" href="'.$value[2].'" title="'.$value[1].'">'.$value[0].'</a></li>'; 29 29 }; 30 Write TranslationGroup();30 Writetranslationgroup(); 31 31 echo '</ul>'; 32 32 if ($user->Permission() > 1) { … … 51 51 } // END function ShowFoodter 52 52 53 function Write TranslationGroup()53 function Writetranslationgroup() 54 54 { // BEGIN function WriteTranslatedGroups 55 55 global $database; 56 $Query = $database->select(' TranslationGroup', '*');56 $Query = $database->select('translationgroup', '*'); 57 57 while($DbRow = $Query->fetch_array()) 58 58 { 59 echo '<li><a class="verticalmenua" href="? TranslationGroup='.$DbRow['Id'].'" title="'.TRANSLATION_GROUP_TITLE.$DbRow['Name'].'">'.$DbRow['Name'].'</a></li>';59 echo '<li><a class="verticalmenua" href="?translationgroup='.$DbRow['Id'].'" title="'.TRANSLATION_GROUP_TITLE.$DbRow['Name'].'">'.$DbRow['Name'].'</a></li>'; 60 60 } 61 61 } // END function WriteTranslatedGroups … … 70 70 { // BEGIN function WriteOnlineUsers 71 71 global $database; 72 $Query = $database->select(' UserOnline', '*, (SELECT Name FROM User WHERE User.Id = UserOnline.User) as Name');72 $Query = $database->select('useronline', '*, (SELECT Name FROM user WHERE user.Id = useronline.User) as Name'); 73 73 if ($database->LastDataSet) { 74 74 echo '<p>'.ONLINE_USERS.$database->LastNumRows.'<br />'; … … 93 93 <tr><td>'.REGISTRATION_PAGE_FULLNAME.'</td><td><input name="FullName" type="text" /></td></tr> 94 94 <tr><td>'.REGISTRATION_PAGE_LANGUAGE.'</td><td><select name="Language">'; 95 $Query = $database->select(' Language', '*');95 $Query = $database->select('language', '*'); 96 96 while($DbRow = $Query->fetch_array()) 97 97 { if ($DbRow['Id'] == 2)
Note:
See TracChangeset
for help on using the changeset viewer.