Ignore:
Timestamp:
Jan 14, 2016, 10:25:47 PM (9 years ago)
Author:
chronos
Message:
  • Added: Support for translatable URLs. Now each language can have URL in its language.

This requires to all links inside web to use System->Link function which is responsible for translation.
All links need to be written in english so they can be translated to other language.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/User/User.php

    r838 r843  
    2222  {
    2323    $this->System->User = new User($this->System);
    24     $this->System->RegisterPage('userlist.php', 'PageUserList');
    25     $this->System->RegisterPage('Options.php', 'PageUserOptions');
    26     $this->System->RegisterPage('registrace.php', 'PageUserRegistration');
    27     $this->System->RegisterPage('user.php', 'PageUserProfile');
     24    $this->System->RegisterPage('users', 'PageUserList');
     25    $this->System->RegisterPage('options', 'PageUserOptions');
     26    $this->System->RegisterPage('registration', 'PageUserRegistration');
     27    $this->System->RegisterPage('user', 'PageUserProfile');
    2828    $this->System->RegisterPage('login', 'PageUserLogin');
    2929    $this->System->RegisterMenuItem(array(
    3030      'Title' => T('Translators'),
    3131      'Hint' => 'Seznam registrovaných uživatelů',
    32       'Link' => $this->System->Link('/userlist.php'),
     32      'Link' => $this->System->Link('/users/'),
    3333      'Permission' => LICENCE_ANONYMOUS,
    3434      'Icon' => '',
     
    3636    if(array_key_exists('Search', $this->System->ModuleManager->Modules))
    3737      $this->System->ModuleManager->Modules['Search']->RegisterSearch('user',
    38       T('Translators'), array('Name'), '`User`', $this->System->Link('/userlist.php?search='));
     38      T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search='));
    3939  }
    4040
     
    4343    $Output = T('Online translators').':<br />';
    4444    $DbResult = $this->System->Database->query('SELECT * FROM ('.
    45 'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '.
    46         'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '.
    47         'WHERE (`ActivityTime` >= NOW() - 300) '.
    48         'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');
     45      'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '.
     46      'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '.
     47      'WHERE (`ActivityTime` >= NOW() - 300) '.
     48      'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');
    4949    while($DbUser = $DbResult->fetch_assoc())
    5050    {
    51       $Name = '<a href="'.$this->System->Link('/user.php?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';
     51      $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';
    5252      $Output .= $Name.'<br />';
    5353    }
     
    124124      // Prepare cookies for permanent login
    125125      $StayLoggedSalt = $this->GetPasswordSalt();
    126       $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array(
     126      $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array(
    127127        'User' => $User['ID'], 'StayLogged' => $StayLogged, 'StayLoggedHash' => $StayLoggedSalt));
    128128      if($StayLogged)
    129129      {
    130         setcookie('LoginUserId', $User['ID'], time()+365*24*60*60);
    131         setcookie('LoginHash', sha1($User['ID'].$StayLoggedSalt), time()+365*24*60*60);
     130        setcookie('LoginUserId', $User['ID'], time() + 365 * 24 * 60 * 60);
     131        setcookie('LoginHash', sha1($User['ID'].$StayLoggedSalt), time() + 365 * 24 * 60 * 60);
    132132      } else {
    133133        setcookie('LoginUserId', '', time() - 3600);
     
    150150    if($this->Role != LICENCE_ANONYMOUS)
    151151    {
    152       $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => null));
     152      $this->Database->update('UserOnline', '`SessionId`="'.$SID.'"', array('User' => null));
    153153      $this->Database->query('UPDATE `UserTrace` SET '.
    154154        '`LastLogout` = NOW() WHERE `User` = '.$this->Id);
Note: See TracChangeset for help on using the changeset viewer.