Changeset 38 for branches


Ignore:
Timestamp:
Nov 25, 2008, 5:12:10 PM (16 years ago)
Author:
maron
Message:

Struktura databáze

Location:
branches/3
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3/class/translation.php

    r35 r38  
    77 
    88        // constructor
    9         function translation($id, $database, $GetText = true)
     9        function translation($id, $database, $Gettext = true)
    1010        { // BEGIN constructor
    1111                $this->id = $id;
    1212                $this->database = $database;
    1313                $this->GetData();
    14                 if ($GetText and isset($this->data)) $this->GetText();
     14                if ($Gettext and isset($this->data)) $this->Gettext();
    1515        } // END constructor
    1616       
    1717        function GetData()
    1818    { // BEGIN function GetData
    19       $Query = $this->database->query('SELECT *,(SELECT Id FROM `TextGroup` WHERE
     19      $Query = $this->database->query('SELECT *,(SELECT Id FROM `textGroup` WHERE
    2020       `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.'"');
    2222      if($Query->num_rows > 0) {
    2323        $Row = $Query->fetch_array();
     
    3434    } // END function SetData
    3535       
    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."");
     36        function Gettext()
     37    { // BEGIN function Gettext
     38        $Query = $this->database->query("SELECT `text`,`translation`.`Name`, `translation`.`MangosColumn` FROM `text`
     39JOIN `translation` ON `translation`.`Id` = `text`.`GroupItem`
     40 WHERE `translationGroup` = ".$this->id."");
    4141        while ($Row = $Query->fetch_array()) {
    42                 $this->text[$Row['Name']] = $Row['Text'];
     42                $this->text[$Row['Name']] = $Row['text'];
    4343        }       
    4444        $this->data['text'] = $this->text;
    45     } // END function GetText
     45    } // END function Gettext
    4646       
    4747  } // END class translation
  • branches/3/class/user.php

    r34 r38  
    22
    33  class user
    4   { // BEGIN class User
     4  { // BEGIN class user
    55        // variables
    66        var $ID,$user,$Database;
    7           var $AnonymousUserId = 0;
     7          var $AnonymoususerId = 0;
    88        var $DefaultRole = 2;
    99        var $IPAddress = ' ';
     
    2222    $this->IPAddress = gethostbyaddr($_SERVER['REMOTE_ADDR']).' '.$_SERVER['REMOTE_ADDR'];
    2323    // Lookup user record
    24     $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
     24    $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"');
    2525    if($this->Database->LastDataSet)
    2626    {
    2727      // 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));
    2929    } 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)); 
    3131    }
    3232    // 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)');
    3434
    3535    // Zkontroluj přihlášení
    36     $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
     36    $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"');
    3737    $Row = $Query->fetch_array();
    38     if($Row['User'] != $this->AnonymousUserId)
     38    if($Row['user'] != $this->AnonymoususerId)
    3939    {
    40       $Query = $this->Database->select('User', '*', "Id=".$Row['User']."");
     40      $Query = $this->Database->select('user', '*', "Id=".$Row['user']."");
    4141      $this->user = $Query->fetch_array();
    4242      $Result = USER_LOGGED;
    4343      $this->LoadPermission($this->user['Permission']);
    4444    } else {
    45       $Query = $this->Database->select('User', '*', "Id=".$this->AnonymousUserId);
     45      $Query = $this->Database->select('user', '*', "Id=".$this->AnonymoususerId);
    4646      $this->user = $Query->fetch_array();
    4747      $Result = USER_NOT_LOGGED;
     
    6060    {
    6161      // Je uživatel registrován?
    62       $Query = $this->Database->select('User', '*', 'Name = "'.$Data['Nick'].'"');
     62      $Query = $this->Database->select('user', '*', 'Name = "'.$Data['Nick'].'"');
    6363      if($this->Database->LastDataSet) $Result = NICK_USED;
    6464      else
    6565      {
    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()'));
    6767      //echo $this->Database->LastQuery;
    6868        $Result = USER_REGISTRATED;
     
    7676    $SID = session_id();
    7777    // Je uživatel registrován?
    78     $Query = $this->Database->select('User', '*', 'Name="'.$Data['Nick'].'"');
     78    $Query = $this->Database->select('user', '*', 'Name="'.$Data['Nick'].'"');
    7979    if($Query->num_rows > 0)
    8080    {
     
    8383      else
    8484      {
    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']));
    8787        // načtení stavu stromu
    8888        $Result = USER_LOGGED_IN;   
     
    9797  {
    9898    $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));
    100100    $this->Check();
    101101    return(USER_LOGGED_OUT);
     
    105105  {
    106106    $this->user['Permission'] = array();
    107     $DbResult = $this->Database->select('Permission','*','ID='.$Permission);
     107    $DbResult = $this->Database->select('permission','*','ID='.$Permission);
    108108    if($this->Database->LastDataSet)
    109109    while($DbRow = $DbResult->fetch_array())
     
    121121  } // END function Permission
    122122 
    123   } // END class User
     123  } // END class user
    124124 
    125125?>
  • branches/3/frontend.php

    r35 r38  
    2828                echo '<li><a class="verticalmenua" href="'.$value[2].'" title="'.$value[1].'">'.$value[0].'</a></li>';
    2929          };
    30           WriteTranslationGroup();
     30          Writetranslationgroup();
    3131          echo '</ul>';
    3232          if ($user->Permission() > 1) {
     
    5151  } // END function ShowFoodter
    5252 
    53   function WriteTranslationGroup()
     53  function Writetranslationgroup()
    5454  { // BEGIN function WriteTranslatedGroups
    5555        global $database;
    56       $Query = $database->select('TranslationGroup', '*');
     56      $Query = $database->select('translationgroup', '*');
    5757      while($DbRow = $Query->fetch_array())
    5858      {
    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>';
    6060      }
    6161  } // END function WriteTranslatedGroups
     
    7070  { // BEGIN function WriteOnlineUsers
    7171        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');
    7373    if ($database->LastDataSet) {
    7474      echo '<p>'.ONLINE_USERS.$database->LastNumRows.'<br />';
     
    9393    <tr><td>'.REGISTRATION_PAGE_FULLNAME.'</td><td><input name="FullName" type="text" /></td></tr>
    9494    <tr><td>'.REGISTRATION_PAGE_LANGUAGE.'</td><td><select name="Language">';
    95       $Query = $database->select('Language', '*');
     95      $Query = $database->select('language', '*');
    9696      while($DbRow = $Query->fetch_array())
    9797      { if ($DbRow['Id'] == 2)
Note: See TracChangeset for help on using the changeset viewer.