Changeset 153


Ignore:
Timestamp:
Feb 16, 2009, 6:16:00 PM (15 years ago)
Author:
george
Message:
  • Přidáno: Zobrazování chyb v SQL povelech. Nastavení v konfigureaci.
  • Upraveno: Zpřístupnění stavu financí dle ip i dle přihlášení.
Location:
www
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • www/aktuality/news.php

    r151 r153  
    8585  function Show()
    8686  {
    87     $Output = '<div class="PanelTitle"><span class="MenuItem">Aktuálně:</span><div class="MenuItem2"><a href="?Action=CustomizeNews">Upravit</a></div></div>';
     87    $Output = '<div class="PanelTitle"><span class="MenuItem">Aktuálně</span><div class="MenuItem2"><a href="?Action=CustomizeNews">Upravit</a></div></div>';
    8888
    8989    $UploadedFilesFolder = 'aktuality/uploads/';
  • www/config.sample.php

    r148 r153  
    11<?php
    22
    3 $Config = array(
     3$Config = array
     4(
    45  'Database' => array
    56  (
     
    1718    'RootFolder' => '',
    1819    'Description' => 'Komunitní počítačová síť',
    19     'Title' => 'ZděchovNET',
    20     'Admin' => 'Chronos',
    21     'AdminEmail' => 'robie@centrum.cz',
    22     'ShowError' => 1,
     20    'Title' => 'Síť',
     21    'Admin' => 'Admin',
     22    'AdminEmail' => 'admin@localhost',
     23    'ShowError' => false,
     24    'ShowSQLError' => false,
     25    'ShowSQLQuery' => false,
    2326    'ErrorLogFile' => '/var/www/html/dev/centrala/www/php_script_error.log',   
    2427    'WebcamPassword' => '',
    2528    'WebcamRefresh' => 5,
     29        'UserSupport' => 1,
    2630    'News' => array
    2731        (
  • www/database.php

    r148 r153  
    22
    33// Extended database class
    4 // Date: 2007-07-19
     4// Date: 2009-02-16
    55
    66class Database extends mysqli
    77{
    88  var $Prefix = '';
    9   var $LastQuery = '';
    109 
    1110  function query($Query)
    1211  {
    13     $this->LastQuery = $Query;
    14     return(parent::query($Query)); 
     12        global $Config;
     13       
     14        if($Config['Web']['ShowSQLQuery'] == true)
     15          echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>');
     16        $Result = parent::query($Query);
     17    if(($this->error != '') and ($Config['Web']['ShowSQLError'] == true))
     18          echo('<div><strong>SQL Error: </strong>'.$this->error.'<br>'.$Query.'</div>');
     19
     20    return($Result); 
    1521  }
    1622
    1723  function select($Table, $What = '*', $Condition = 1)
    1824  {
    19     $this->LastQuery = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition;
    20     return($this->query($this->LastQuery)); 
     25    return($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition)); 
    2126  }
    2227
    2328  function delete($Table, $Condition)
    2429  {
    25     $this->LastQuery = "DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition;
    26     $this->query($this->LastQuery); 
     30    $this->query('DELETE FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 
    2731  }
    2832 
     
    4145    $Name = substr($Name, 1);
    4246    $Values = substr($Values, 1);
    43     $this->LastQuery = 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')';
    44     $this->query($this->LastQuery);
     47    $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
    4548  }
    4649 
     
    5558    }
    5659    $Values = substr($Values, 2); 
    57     $this->LastQuery = 'UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')';
    58     $this->query($this->LastQuery);
     60    $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');
    5961  }
    6062 
     
    7375    $Values = substr($Values, 1);
    7476    //echo('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES ('.$Values.')<br>');
    75     $this->LastQuery = 'REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')';
    76     $this->query($this->LastQuery);
     77    $this->query('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
    7778    //echo($this->error().'<br>');
    7879  }
     
    8081  function charset($Charset)
    8182  {
    82     $this->LastQuery = "SET NAMES '".$Charset."'";
    83     $this->query($this->LastQuery);
     83    $this->query('SET NAMES "'.$Charset.'"');
    8484  }
    8585
  • www/error.php

    r47 r153  
    66//error_reporting(0);                                   // Vypni interní obsluhu chyb
    77
    8 function obsluha_chyb($errno, $errmsg, $filename, $linenum, $vars)
     8function CustomErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
    99{
    1010  global $Config;
     
    5757    '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"></head><body>'."\n".
    5858    'Došlo k vnitřní chybě!<br> O chybě byl uvědoměn správce webu a chybu brzy odstraní.<br><br>');
    59         if($Config['Web']['ShowError'] == 1) echo('<pre>'.$err.'</pre><br>');                   // V případě ladění chybu i zobraz
     59        if($Config['Web']['ShowError'] == true) echo('<pre>'.$err.'</pre><br>');                        // V případě ladění chybu i zobraz
    6060    echo('</body></html>');
    6161    if((E_ERROR | E_PARSE) & $errno) die();
     
    6363}
    6464
    65 set_error_handler('obsluha_chyb');                              // Aktivuj novou obsluhu chyb
     65set_error_handler('CustomErrorHandler');                                // Aktivuj novou obsluhu chyb
    6666
    6767?>
  • www/finance/index.php

    r152 r153  
    1515
    1616    $Output .= '<table><tr><td width="30%">';
    17         if(GetMemberByIP(GetRemoteAddress()) > 0) $Output .= '<a href="user_state.php">Vaše finanční operace</a><br /><br /><br />';
     17        if(GetMemberByIP(GetRemoteAddress()) > 0) $Output .= '<a href="user_state_ip.php">Vaše finanční operace (Tato volba je také přístupná po přihlášení do systému v uživatelském menu).</a><br /><br /><br />';
    1818       
    1919    $Output .= '<a href="monthly_overall.php">Měsíční přehledy</a><br />';
  • www/finance/prepocet.php

    r133 r153  
    182182      echo($TimePeriodText.': '.$PayPerMonth." * ".$MonthCount." = ".$PayPerPeriod."\n");
    183183      $BillCode = GetNextDocumentLineNumber(6); // Faktury vydané
    184       $BillId = $InvoiceGenerator->CreateBill($User['id'], array(array('description' => 'Připojení k síti', 'price' => $PayPerPeriod, 'quantity' => 1)), $PeriodFrom, $PeriodTo, $BillCode);
     184      $BillId = $Bill->CreateBill($User['id'], array(array('description' => 'Připojení k síti', 'price' => $PayPerPeriod, 'quantity' => 1)), $PeriodFrom, $PeriodTo, $BillCode);
    185185      $Database->insert('finance_operations', array('money' => -$PayPerPeriod, 'user' => $User['id'], 'type' => 2, 'date' => 'NOW()', 'comment' => 'Připojení k síti za období '.$TimePeriodText, 'group' => 1, 'bill_id' => $BillId, 'BillCode' => $BillCode));
    186186    } else echo("\n");
  • www/finance/user_state.php

    r152 r153  
    1616    if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
    1717
    18     //$UserId = $this->System->Modules['User']->User['Id'];
    19         $UserId = GetMemberByIP(GetRemoteAddress());
    20     if(!array_key_exists('show',$_GET)) $_GET['show'] = '';
     18    $UserId = $this->System->Modules['User']->User['Id'];
     19    if(!array_key_exists('show', $_GET)) $_GET['show'] = '';
    2120    $DbResult = $this->Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE id=".$UserId);
    2221    $Row2 = $DbResult->fetch_array();
  • www/global.php

    r152 r153  
    88include('config.php');
    99include('database.php');
    10 //include('error.php');
     10include('error.php');
    1111include_once('code.php');
    1212$Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);
  • www/index.php

    r152 r153  
    7777    //{
    7878      $Title = array_shift($LinkGroup);
    79       $Result .= '<div class="PanelTitle">'.$Title.':</div>';
     79      $Result .= '<div class="PanelTitle">'.$Title.'</div>';
    8080      foreach($LinkGroup as $Link)
    8181      {
     
    137137  {
    138138    $Output = '<div class="PanelTitle">Nabídka uživatele:</div>'.
    139     '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení účtu</a><br />'.
    140     '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/user_state.php">Stav financí</a><br />'.
    141    '<a href="'.$this->System->Config['Web']['RootFolder'].'/network/user_hosts.php">Registrované počítače</a><br />'.
    142    '<a href="'.$this->System->Config['Web']['RootFolder'].'/aktuality/?action=add">Vložení aktuality</a><br />';
    143    if($this->System->Modules['User']->CheckPermission('EatingPlace', 'Edit')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/jidelna/menuedit.php">Editace jídelníčků</a><br />';
    144    if($this->System->Modules['User']->CheckPermission('Finance', 'Manage')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/manage.php">Správa financí</a><br />';
    145    if($this->System->Modules['User']->CheckPermission('Network', 'Administration')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/is/administration_page.php">Správa sítě</a><br />';
     139    '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení účtu</a><br />';
     140    if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))
     141          $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/user_state.php">Stav financí</a><br />';
     142    if($this->System->Modules['User']->CheckPermission('Network', 'RegistredHostList'))
     143          $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/network/user_hosts.php">Registrované počítače</a><br />';
     144    //if($this->System->Modules['User']->CheckPermission('EatingPlace', 'Edit'))
     145          $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/aktuality/?action=add">Vložení aktuality</a><br />';
     146    if($this->System->Modules['User']->CheckPermission('EatingPlace', 'Edit')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/jidelna/menuedit.php">Editace jídelníčků</a><br />';
     147    if($this->System->Modules['User']->CheckPermission('Finance', 'Manage')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/finance/manage.php">Správa financí</a><br />';
     148    if($this->System->Modules['User']->CheckPermission('Network', 'Administration')) $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/is/administration_page.php">Správa sítě</a><br />';
    146149    return($Output);
    147150  }
     
    149152  function WebcamPanel()
    150153  {
    151     $Output = '<div class="PanelTitle">Webkamery:</div>';
     154    $Output = '<div class="PanelTitle">Webkamery</div>';
    152155    $Output .= $this->System->Modules['Webcam']->ShowImage();
    153156    return($Output);
     
    159162    global $Database;
    160163
    161     $Output = '<div class="PanelTitle">Online počítače:</div><span style="font-size: smaller;">';
     164    $Output = '<div class="PanelTitle">Online počítače</div><span style="font-size: smaller;">';
    162165    $DbResult = $Database->select('hosts', '*', 'online=1 AND show_online=1 ORDER BY name');
    163166    while($Row = $DbResult->fetch_array())
     
    169172  }
    170173
    171   /*
    172174  // Zobrazení seznamu neplaticich uzivatelu
    173175  function ShowBadPayerList()
     
    179181      $Output .= $Row['fullname'].'<br />';
    180182    }
    181     echo('</span>');
    182     return($Output);
    183   }
    184   */
     183    $Output .= '</span>';
     184    return($Output);
     185  }
    185186
    186187  // Zobrazení času běhu počítače
     
    208209    global $Database, $Config, $User;
    209210
    210     $Database->select_db('share');
     211    //$Database->select_db('share');
    211212    //$Output = $this->InfoBar();
    212 
    213213    // Process cookies
     214        $Output = '';
    214215    if(array_key_exists('Action', $_GET))
    215216    {
     
    232233        </tr>
    233234        <tr align="left">
    234                 <td><a href="?Action=RegistrationForm">Registrovat se</a></td>
     235                <td><a href="?Action=UserRegister">Registrovat se</a></td>
    235236                <td><a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></td>
    236237        </tr>
     
    310311    $Output .= '<div class="Panel">'.$this->System->Modules['News']->Show().'</div>';
    311312    $Output .= '</td><td valign="top">';
    312     if($this->System->Modules['User']->User['Id'] != $this->System->Modules['User']->AnonymousUserId) $Output .= '<div class="Panel">'.$this->UserPanel().'</div>';
     313    if($this->System->Modules['User']->User['Id'] != $this->System->Modules['User']->AnonymousUserId)
     314          $Output .= '<div class="Panel">'.$this->UserPanel().'</div>';
    313315    $Output .= '<div class="Panel">'.$this->WebcamPanel().'</div>';
    314316    $Output .= '<div class="Panel">'.$this->OnlineHostList().'</div>';
  • www/network/user_hosts.php

    r148 r153  
    1111  {
    1212
    13     $Output = '<br /><table border="1" cellspacing="0" cellpadding="3" style="font-size: small; text-align: center;">
     13    $Output = '<br /><table class="WideTable">
    1414<tr><th>Jméno počítače</th><th>Místní IP adresa</th><th>Veřejná IP adresa</th><th>CZFree IP adresa</th><th>Naposledy online</th><th>Fyzická adresa</th></tr>';
    1515
     
    2424      if($Host['online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
    2525      if($Host['IP'] == '') $Host['IP'] = '&nbsp;';
     26      if($Host['name'] == '') $Host['name'] = '&nbsp;';
     27      if($Host['czfree_ip'] == '') $Host['czfree_ip'] = '&nbsp;';
     28      if($Host['external_ip'] == '') $Host['external_ip'] = '&nbsp;';
     29      if($Host['MAC'] == '') $Host['MAC'] = '&nbsp;';
    2630      $Output .= '<tr><td style="text-align: left; '.$Style.'">'.$Host['name'].'</td><td>'.$Host['IP'].'</td><td>'.$Host['external_ip'].'</td><td>'.$Host['czfree_ip'].'</td><td >'.HumanDate($Host['last_online']).'</td><td>'.$Host['MAC'].'</td></tr>';
    2731    }
     
    2933    return($Output);
    3034  }
    31 
    3235}
    3336
  • www/otevreno.php

    r148 r153  
    1111  {
    1212    $Output = '<div align="center">';
    13     $DbResult = $this->Database->query('SELECT SubjectOpenTime.*, DATE_FORMAT(SubjectOpenTime.UpdateTime, "%e.%c.%Y") as UpdateTime, Subject.Name as Name FROM SubjectOpenTime JOIN Subject ON Subject.Id = SubjectOpenTime.Subject');
    14     while($Subject = $DbResult->fetch_array())
     13    $DbResult = $this->Database->query('SELECT SubjectOpenTime.*, DATE_FORMAT(SubjectOpenTime.UpdateTime, "%e.%c.%Y") as UpdateTime, Subject.Name as Name FROM SubjectOpenTime JOIN Subject ON Subject.Id = SubjectOpenTime.Subject ORDER BY Name');
     14    while($Subject = $DbResult->fetch_assoc())
    1515    {
    1616      $Output .= '<strong>'.$Subject['Name'].':</strong><br />';
     
    1818      if($DbResult2->num_rows > 0)
    1919      {
    20         $DbRow = $DbResult2->fetch_array();
     20        $DbRow = $DbResult2->fetch_assoc();
    2121        $Output .= 'Zavírá za '.$DbRow['RemainTime'];
    2222      } else
    2323      {
    2424        $DbResult2 = $this->Database->query('SELECT Subject, OpenTime, CloseTime, TIMEDIFF(OpenTime, DATE_FORMAT(NOW(), "0000-01-%w %T")) as RemainTime FROM `SubjectOpenTimeInterval` WHERE DATE_FORMAT(NOW(), "0000-01-%w %T") < OpenTime AND Subject='.$Subject['Subject'].' ORDER BY OpenTime LIMIT 1');
    25         $DbRow = $DbResult2->fetch_array();
     25        $DbRow = $DbResult2->fetch_assoc();
    2626        $Output .= 'Otevírá za '.$DbRow['RemainTime'];
    2727      }
     
    3434        if($DbResult2->num_rows)
    3535        {
    36           while($TimeInterval = $DbResult2->fetch_array())
     36          while($TimeInterval = $DbResult2->fetch_assoc())
    3737          {
    3838            $Output .= $TimeInterval['OpenTime'].' - '.$TimeInterval['CloseTime'].' &nbsp;&nbsp; ';
  • www/style.css

    r148 r153  
    263263  border-width: 0px 0px 1px 1px;
    264264  padding: 1px 10px 1px 10px;
    265 }
     265  text-align: center;
     266}
  • www/temp/transform.php

    r151 r153  
    105105  function SubjectOpenTime()
    106106  {
    107     $this->Database->query('DELETE FROM Subject WHERE Subject.Id = SubjectOpenTime.Subject');
    108     $this->Database->query('TRUNCATE TABLE SubjectOpenTime');
    109     $this->Database->query('TRUNCATE TABLE SubjectOpenTimeInterval');
     107    //$this->Database->query('DELETE FROM `Subject` WHERE `Subject`.`Id` = (SELECT `Subject` FROM `SubjectOpenTime`)');
     108    $this->Database->query('TRUNCATE TABLE `SubjectOpenTime`');
     109    $this->Database->query('TRUNCATE TABLE `SubjectOpenTimeInterval`');
    110110    foreach($this->Subjects as $SubjectName => $Subject)
    111111    {
     
    159159    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupOthers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
    160160
     161    $this->Database->insert('PermissionOperation', array('Module' => 'News', 'Operation' => 'Display', 'Item' => 'Item'));
     162    $OperationId = $this->Database->insert_id;
     163    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupOthers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     164
    161165    $DbResult = $this->Database->select('news_category', 'id, permission');
    162166    while($DbRow = $DbResult->fetch_array())
     
    167171      $OperationIdDisplay = $this->Database->insert_id;
    168172      $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupOthers, 'GroupOrOperation' => $OperationIdDisplay, 'Type' => 'Operation'));
    169       if($DbRow['permission'] == 1)
    170       {
    171         $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOoperation' => $OperationIdInsert, 'Type' => 'Operation'));
     173      if($DbRow['permission'] == 0)
     174      {
     175        $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationIdInsert, 'Type' => 'Operation'));
    172176      } else
    173177      {
     
    189193
    190194    $this->Database->insert('PermissionOperation', array('Module' => 'EatingPlace', 'Operation' => 'Edit'));
    191     $OperationId = $this->Database->insert_id;
    192     $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupMembers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     195    //$OperationId = $this->Database->insert_id;
     196    //$this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupMembers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
    193197
    194198    $this->Database->insert('PermissionOperation', array('Module' => 'Finance', 'Operation' => 'Manage'));
     
    207211    $OperationId = $this->Database->insert_id;
    208212    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     213
     214    $this->Database->insert('PermissionOperation', array('Module' => 'Network', 'Operation' => 'RegistredHostList'));
     215    $OperationId = $this->Database->insert_id;
     216    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupSubjects, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
    209217
    210218    // Init User table from users
     
    212220    while($DbRow = $DbResult->fetch_array())
    213221    {
    214       $this->Database->insert('User', array('Id' => $DbRow['id'], 'Name' => $DbRow['nick'], 'FirstName' => $DbRow['first_name'], 'SecondName' => $DbRow['second_name'], 'PhoneNumber' => $DbRow['phone'], 'Password' => substr(sha1(strtoupper($DbRow['nick'])), 0, 7), 'ICQ' => $DbRow['icq'], 'Email' => $DbRow['email'], 'Locked' => 0));
     222      $this->Database->insert('User', array('Id' => $DbRow['id'], 'Name' => $DbRow['nick'], 'FirstName' => $DbRow['first_name'], 'SecondName' => $DbRow['second_name'], 'PhoneNumber' => $DbRow['phone'], 'Password' => substr(sha1(strtoupper($DbRow['nick'])), 0, 70), 'ICQ' => $DbRow['icq'], 'Email' => $DbRow['email'], 'Locked' => 0));
    215223      $UserId = $this->Database->insert_id;
    216224      if($DbRow['id'] == 1)
  • www/user.php

    r152 r153  
    22
    33define('NICK_USED', 'Přihlašovací jméno již použito.');
    4 define('EMAIL_USED', 'Email je již použitý.');
    5 define('USER_REGISTRATED', 'Uživatel zaregistrován.');
     4define('EMAIL_USED', 'Email je již použitý. Použijte jiný email nebo si můžete nechat zaslat nové heslo na email.');
     5define('USER_REGISTRATED', 'Uživatel registrován. Na zadanou emailovou adresu byl poslán mail s odkazem pro aktivování účtu.');
    66define('USER_REGISTRATION_CONFIRMED', 'Vaše registrace byla potvrzena.');
    77define('DATA_MISSING', 'Chybí emailová adresa, přezdívka, nebo některé z hesel.');
    88define('PASSWORDS_UNMATCHED', 'Hesla si neodpovídají.');
    9 define('ACCOUNT_LOCKED', 'Účet uzamčen. Po registraci je nutné provést aktivaci účtu podle zaslaného aktivačního emailu.');
     9define('ACCOUNT_LOCKED', 'Účet je uzamčen. Po registraci je nutné provést aktivaci účtu pomocí odkazu zaslaného v aktivačním emailu.');
    1010define('USER_NOT_LOGGED', 'Nejste přihlášen.');
    1111define('USER_LOGGED', 'Uživatel přihlášen.');
     
    9494          $this->Database->insert('User', array('Name' => $Nick, 'FirstName' => $FirstName, 'SecondName' => $SecondName, 'Password' => sha1($Password), 'Email' => $Email, 'RegistrationTime' => 'NOW()', 'Locked' => 1));
    9595          $UserId = $this->Database->insert_id;
     96                  $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => 1, 'Type' => 'Group'));
    9697         
    9798          $Subject = FromUTF8('Registrace nového účtu', 'iso2');
    98           $Message = 'Provedli jste registraci nového účtu na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVáš účet je: ".$Nick."\n<br>Pro dokončení registrace klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&amp;User='.$UserId.'&amp;H='.sha1($Password).'">tento odkaz</a>.'."\n<br> \n\n<br><br>Na tento email neodpovídejte.";
     99          $Message = 'Provedli jste registraci nového účtu na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVáš účet je: ".$Nick."\n<br>Pro dokončení registrace klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.sha1($Password).'">tento odkaz</a>.'."\n<br> \n\n<br><br>Na tento email neodpovídejte.";
    99100          $AdditionalHeaders = "To: ".$Nick." <".$Email.">\n"."From: ".FromUTF8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8";
    100101          mail($Email, $Subject, $Message, $AdditionalHeaders);
     
    130131    if($Query->num_rows > 0)
    131132    {
    132       $Row = $Query->fetch_array();
     133      $Row = $Query->fetch_assoc();
    133134      if($Row['Password'] != sha1($Password)) $Result = BAD_PASSWORD;
    134135      else if($Row['Locked'] == 1) $Result = ACCOUNT_LOCKED;
     
    136137      {
    137138        $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()'));
     139       
    138140        $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id']));
    139141        // načtení stavu stromu
     
    203205  function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0)
    204206  {
    205     return(true);
    206207        $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"');
    207208    if($DbResult->num_rows > 0)
     
    235236
    236237      $Subject = 'Obnova hesla';
    237       $Message = 'Požádali jste o zaslání nového hesla na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVaše nové heslo k účtu ".$Row['Name']." je: ".$NewPassword."\n<br>Pro aktivaci tohoto hesla klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=PasswordRecoveryConfirm&amp;User='.$Row['Id'].'&amp;H='.$Row['Password'].'&amp;P='.$NewPassword.'">tento odkaz</a>.'."\n<br> Po přihlášení si prosím změňte heslo na nové.\n\n<br><br>Na tento email neodpovídejte.";
     238      $Message = 'Požádali jste o zaslání nového hesla na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVaše nové heslo k účtu ".$Row['Name']." je: ".$NewPassword."\n<br>Pro aktivaci tohoto hesla klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=PasswordRecoveryConfirm&User='.$Row['Id'].'&H='.$Row['Password'].'&P='.$NewPassword.'">tento odkaz</a>.'."\n<br> Po přihlášení si prosím změňte heslo na nové.\n\n<br><br>Na tento email neodpovídejte.";
    238239      $AdditionalHeaders = "To: ".$Row['Name']." <".$Row['Email'].">\n"."From: ".FromUTF8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8";
    239240      mail($Row['Email'], $Subject, $Message, $AdditionalHeaders);
Note: See TracChangeset for help on using the changeset viewer.