Changeset 22


Ignore:
Timestamp:
Mar 1, 2010, 9:12:44 PM (15 years ago)
Author:
george
Message:
  • Přidáno: Skript pro import ze databáze centrály.
  • Přidáno: Zprovozněno přihalšování a odhlašování uživatelů, prohlížení a změna profilu.
Location:
trunk
Files:
2 added
3 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Base/User.php

    r16 r22  
    3333  {
    3434    $DbResult = $this->System->Database->select('User', 'Id', 'Name="'.$Name.
    35       '" AND Password=SHA1(CONCAT("'.$Password.'", Salt))');
     35      '" AND Password=SHA1(CONCAT(SHA1("'.$Password.'"), Salt))');
    3636    if($DbResult->num_rows > 0)
    3737    {
     
    4646    $Salt = GetPasswordSalt();
    4747    $this->System->Database->insert('User', array('Name' => '"'.$Name.'"',
    48       'Salt' => '"'.$Salt.'"', 'Password' => 'SHA1(CONCAT("'.$Password.'", "'.$Salt.'"))',
     48      'Salt' => '"'.$Salt.'"', 'Password' => 'SHA1(CONCAT(SHA1("'.$Password.'"), "'.$Salt.'"))',
    4949      'Email' => '"'.$Email.'"', 'RegistrationTime' => 'NOW()'));
    5050  }
  • trunk/Base/UserOnline.php

    r16 r22  
    77  var $Id;
    88  var $User;
     9  var $AnonymousUserId;
    910
    1011  function __construct($System)
     
    1213    parent::__construct($System);
    1314    $this->Id = 0;
    14     $this->User = 1;
     15    $this->AnonymousUserId = 98;
     16    $this->User = $this->AnonymousUserId;
    1517  }
    1618
     
    2931    {
    3032      // Create new record
    31       $this->System->Database->insert('UserOnline', array('User' => 1,
     33      $this->System->Database->insert('UserOnline', array('User' => $this->AnonymousUserId,
    3234        'ActivityTime' => 'NOW()', 'SessionId' => '"'.session_id().'"',
    3335        'IpAddress' => '"'.$this->System->GetRemoteAddress().'"',
     
    5254    {
    5355      $this->System->Database->update('UserOnline', 'SessionId="'.session_id().'"',
    54         array('User' => 1));
    55       $this->User = 1;
     56        array('User' => $this->AnonymousUserId));
     57      $this->User = $this->AnonymousUserId;
    5658    }
    5759  }
  • trunk/CustomOutput.php

    r20 r22  
    3434  {
    3535    $Output = '<div class="Navigation">';
    36     if($this->System->UserOnline->User == 1)
    37     {
    3836      // Visitor
    3937      $Output .= '<ul class="MenuItem">';
     
    4644      $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Links'), $this->System->Navigation->MakeLink('Main', 'Links')).'</li>';
    4745      $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Contact'), $this->System->Navigation->MakeLink('Main', 'Contact')).'</li>';
     46    if($this->System->UserOnline->User == $this->System->UserOnline->AnonymousUserId)
     47    {
    4848      $Output .= '</ul>';
    4949      $Output .= '<ul class="MenuItem2">';
     
    5252    } else
    5353    {
    54       $Output .= '<ul class="MenuItem">';
    55       $Output .= '<li><a href="'.$this->System->Navigation->MakeLink('Lift', 'List').'">'.$this->System->Localization->Translate('Lifts').'</a></li>';
    56       $Output .= '<li><a href="'.$this->System->Navigation->MakeLink('LiftGroup', 'List').'">'.$this->System->Localization->Translate('LiftGroups').'</a></li>';
    57       $Output .= '<li><a href="'.$this->System->Navigation->MakeLink('LiftServiceCheck', 'List').'">'.$this->System->Localization->Translate('LiftServiceChecks').'</a></li>';
    5854      $Output .= '</ul>';
    5955      $Output .= '<ul class="MenuItem2">';
     
    131127    $this->Document->HeadTag->SubElements[] = $Keywords;
    132128   
    133     $this->Document->BodyTag->SubElements = array('<div class="Title">'.$Title.'</div>',
     129    $this->Document->BodyTag->SubElements = array('<div class="TitlePanel">'.$Title.'</div>',
    134130$this->TopMenu(), $this->PageMenu(), $Content, $this->Footer());
    135     echo($this->Document->GetOutput());
     131    return($this->Document->GetOutput());
    136132  }
    137133
  • trunk/Locale/csCZ.php

    r20 r22  
    1111  'Links' => 'Odkazy',
    1212  'Contact' => 'Kontakt',
     13  'UserName' => 'Jméno',
     14  'Password' => 'Heslo',
     15  'UserNotFound' => 'Uživatel nenalezen',
     16  'UserLoggedOut' => 'Uživatel odhlášen',
     17  'UserLogout' => 'Odhlášení',
     18  'UserView' => 'Profil',
     19  'Email' => 'E-mail',
     20  'Member' => 'Člen',
     21  'UserDetails' => 'Podrobnosti',
     22  'FullName' => 'Celé jméno',
     23  'Edit' => 'Upravit',
     24  'UserEdit' => 'Üprava účtu',
     25  'Save' => 'Uložit',
    1326);
    1427
  • trunk/Module/Main/Controller.php

    r21 r22  
    113113  function Hosting()
    114114  {
    115     $this->System->Output->Title = $this->System->Localization->Translate('Internet');
     115    $this->System->Output->Title = $this->System->Localization->Translate('Hosting');
    116116
    117117    $Output = 'V nabídce je provoz virtualizovaných Linuxových serverů dle dohodnutých parameterů.<br/><br/>';
  • trunk/Module/User/Controller.php

    r19 r22  
    204204        $this->System->User->Id = $this->System->UserOnline->User;
    205205        $this->System->User->LoadData();
    206         $_GET['M'] = 'Lift';
    207         $_GET['A'] = 'List';
    208         $LiftController = new LiftController($this->System);
    209         $Output .= $LiftController->Show();
     206       
     207        $_GET['M'] = $this->System->DefaultModule;
     208        unset($_GET['A']);
     209        $_GET['Panel'] = 1;
     210        $Output = $this->System->GetModuleOutput();
    210211      } catch (UserNotFoundException $E)
    211212      {
  • trunk/Style/Basic/Style.css

    r20 r22  
    439439}
    440440
    441 .Title
     441.TitlePanel
    442442{
    443443  background-color: #5050FF;
  • trunk/index.php

    r19 r22  
    1414include_once(dirname(__FILE__).'/CustomOutput.php');
    1515
     16include_once(dirname(__FILE__).'/Module/User/Controller.php');
    1617include_once(dirname(__FILE__).'/Module/Main/Controller.php');
    1718include_once(dirname(__FILE__).'/Module/Network/Controller.php');
     
    2728  var $BaseURL;
    2829  var $Type;
     30  var $DefaultModule;
    2931
    3032  function __construct()
     
    4042    $this->BaseURL = new URL();
    4143   
     44    $this->DefaultModule = 'Main';
    4245    $this->BaseURL->Scheme = 'http';
    4346    $this->BaseURL->Host = $_SERVER['SERVER_NAME'];
     
    5962  }
    6063
     64  function GetModuleOutput()
     65  {
     66    if(!array_key_exists('M', $_GET)) $_GET['M'] = $this->DefaultModule;
     67    $ModuleName = $_GET['M'];
     68    $ModuleName .= 'Controller';
     69    if(class_exists($ModuleName))
     70    {
     71      $Module = new $ModuleName($this);
     72      if(array_key_exists('Panel', $_GET)) $Output = $Module->Show();
     73        else $Output = $this->Output->Show($Module->Show());
     74    } else
     75      throw new Exception('Module not found');
     76    return($Output);
     77  }
     78
    6179  function Run()
    6280  {
     
    6583    $this->User->Id = $this->UserOnline->User;
    6684    $this->User->LoadData();
    67     if(!array_key_exists('M', $_GET)) $_GET['M'] = 'Main';
    68     $ModuleName = $_GET['M'];
    69     $ModuleName .= 'Controller';
    70     if(class_exists($ModuleName))
    71     {
    72       $Module = new $ModuleName($this);
    73       if(array_key_exists('Panel', $_GET)) echo($Module->Show());
    74         else $this->Output->Show($Module->Show());
    75     } else
    76       throw new Exception('Module not found');
     85    echo($this->GetModuleOutput());
    7786  }
    7887}
Note: See TracChangeset for help on using the changeset viewer.