Changeset 843 for trunk/Modules/User


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.

Location:
trunk/Modules/User
Files:
4 edited

Legend:

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

    r837 r843  
    159159        T('Level:').' <strong>'.$XP['Level'].'</strong> '.T('experience:').' '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>';
    160160      if($UserLine['TeamName'] != '')
    161         $Output .= T('Member of team:').' <a href="team/?action=team&amp;id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
     161        $Output .= T('Member of team:').' <a href="'.$this->System->Link('/team/?action=team&amp;id='.$UserLine['Team']).'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
    162162
    163163      // User tags
     
    222222          'Prohlížeč: <strong>'.$UserLine['UserAgent'].'</strong><br />'.
    223223          'Email: <strong>'.$UserLine['Email'].'</strong><br />';
    224       $Output .= '<br/><form action="user.php" method="post"><div>'.
     224      $Output .= '<br/><form action="'.$this->System->Link('/user/').'" method="post"><div>'.
    225225        'Napsat E-mail:'.
    226226        '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.
  • trunk/Modules/User/Registration.php

    r837 r843  
    1919    <fieldset><legend>'.T('New user registration').'</legend>
    2020    <table>
    21     <tr><td colspan="2">'.T('Please read carefully <a href="info.php">translation guidelines</a> and follow them. Translate with diacritics!').'<br/><br/></td></tr>
     21    <tr><td colspan="2">'.T('Please read carefully <a href="'.$this->System->Link('/info/').'">translation guidelines</a> and follow them. Translate with diacritics!').'<br/><br/></td></tr>
    2222    <tr>
    2323    <th class="Left">'.T('Are you human?').'</th>';
  • 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);
  • trunk/Modules/User/UserList.php

    r826 r843  
    6161    {
    6262      $XP = GetLevelMinMax($Line['XP']);
    63       $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'.
    64         '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
     63      $Output .= '<tr><td><a href="'.$this->System->Link('/user/?user='.$Line['ID']).'">'.$Line['Name'].'</a></td>'.
     64        '<td style="text-align: center;"><a href="'.$this->System->Link('/TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2').'" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
    6565        '<td>'.$XP['Level'].'</td>'.
    6666        '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'.
Note: See TracChangeset for help on using the changeset viewer.