Changeset 107


Ignore:
Timestamp:
Sep 14, 2008, 5:54:37 PM (16 years ago)
Author:
george
Message:
  • Přidáno: Skripty pro import aktualit ze stránek zdechov.cz.
  • Upraveno: Doplněno generování oprávnění v prvotním transformačním skriptu.
  • Upraveno: Názvy položek oprávnění.
Location:
devel/www
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • devel/www/config.sample.php

    r89 r107  
    2727    ),
    2828  ),
     29  'Finance' => array(
     30    'MainUserId' => 1,
     31  ),
    2932  'Network' => array(
    3033    'MaxSubnetCount' => 7,
  • devel/www/finance/bill.php

    r87 r107  
    33include('../global.php');
    44
    5 $InvoiceGenerator->ShowStoredBill($_GET['id']);
     5$System->Modules['Bill']->ShowStoredBill($_GET['Id']);
    66
    77?>
  • devel/www/finance/bills.php

    r98 r107  
    11<?php
    2 //include_once('global.php');
    32
    43class Bill extends Module
     
    87  function GenerateInvoice($BillId)
    98  {
    10     global $SpecificSymbol;
     9    global $SpecificSymbol, $Config;
    1110
    1211    $DbResult = $this->Database->select('finance_bills', '*', 'id='.$BillId);
    1312    $Bill = $DbResult->fetch_array();
    14  
     13
    1514    $DbResult = $this->Database->select('users', '*', 'id='.$Bill['user_id']);
    1615    $User = $DbResult->fetch_array();
     16    $DbResult = $this->Database->select('users', '*', 'id='.$Config['Finance']['MainUserId']);
     17    $MainUser = $DbResult->fetch_array();
    1718
    1819    $Dodavka = array();
     
    2021    while($Item = $DbResult->fetch_array())
    2122    {
    22       $Dodavka[$Item['id']] = $Item; 
     23      $Dodavka[$Item['id']] = $Item;
    2324    }
    2425
     
    2728      '<hr></td></tr>'.
    2829      '<tr><td valign="top" width="50%"><strong>Dodavatel:</strong><br>'.
    29       'Ing. Jiří Hajda<br>'.
    30       'Zděchov 208<br>'.
    31       '75607 Zděchov<br>'.
    32       'IČO: 75904535<br>'.
    33       'DIČ: CZ8303255884<br>'.
     30      $MainUser['subject_name'].'<br>'.
     31      $MainUser['street'].'<br>'.
     32      $MainUser['psc'].' '.$User['town'].'<br>'.
     33      'IČO: '.$MainUser['ico'].'<br>'.
     34      'DIČ: '.$MainUser['dic'].'<br>'.
    3435      'Účet: 218098370 / 0300<br>'.
    3536      'Nejsem plátce DPH<br>'.
     
    5051      'Specifický symbol: '.$this->SpecificSymbol.'<br>'.
    5152      'Konstantní symbol:<br>'.
    52       'Způsob úhrady: převodem'.
     53      'Doporučený způsob úhrady: převodem'.
    5354      '</td><td valign="top">'.
    5455      '<br>'.
     
    9697    }
    9798
    98     $Output = '<table width="100%"><tr><td colspan="2">'.
    99       '<font size="6"><div align="center">Faktura - daňový doklad</font></div>'.
    100       '<hr></td></tr>'.
    101       '<tr><td valign="top" width="50%"><strong>Dodavatel:</strong><br>'.
     99    $Output = '<table width="100%"><tr><td>'.
     100      '<td valign="top" width="50%"><strong>Firma:</strong><br>'.
    102101      'Ing. Jiří Hajda<br>'.
    103102      'Zděchov 208<br>'.
     
    105104      'IČO: 75904535<br>'.
    106105      'DIČ: CZ8303255884<br>'.
    107       'Účet: 218098370 / 0300<br>'.
    108106      'Nejsem plátce DPH<br>'.
    109107      '</td><td valign="top">'.
     108      '<font size="6"><div align="center">JEDNODUCHÝ PŘIJMOVÝ POKLADNÍ DOKLAD č.</font></div>'.
     109      'Datum vystavení: '.HumanDate($Bill['time_create']).'<br></td>'.
     110      'Přijato od: <br>'.
     111
     112
    110113      '<strong>Odběratel:</strong><br>'.
    111114      $User['subject_name'].'<br>'.
     
    126129      '</td><td valign="top">'.
    127130      '<br>'.
    128       'Datum vystavení: '.HumanDate($Bill['time_create']).'<br>'.
    129131      'Datum splatnosti: '.HumanDate($Bill['time_due']).'<br>'.
    130132      'Fakturované období: '.HumanDate($Bill['time_from']).' - '.HumanDate($Bill['time_to']).'<br>'.
  • devel/www/finance/clenove.php

    r87 r107  
    1313    global $Tarify;
    1414
    15     if($this->System->Modules['User']->CheckPermission('Finance', 'UserList'))
     15    if($this->System->Modules['User']->CheckPermission('Finance', 'SubjectList'))
    1616    {
    1717      // Seznam členů
  • devel/www/finance/index.php

    r100 r107  
    1616    $Output .= '<table><tr><td width="30%">';
    1717    $Output .= '<a href="zarizeni.php">Výpis zařízení</a><br />';
    18     if($this->System->Modules['User']->CheckPermission('Finance', 'UserList')) $Output .= '<a href="clenove.php">Seznam členů</a><br />';
     18    if($this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) $Output .= '<a href="clenove.php">Seznam členů</a><br />';
    1919    $Output .= '<a href="spotreba.php">Spotřeba energie</a><br />';
    2020    $Output .= '<a href="'.$Config['Web']['RootFolder'].'/aktuality/index.php?category=9">Investice v síti</a><br />';
  • devel/www/finance/user_state.php

    r87 r107  
    1414    global $Tarify, $Sprava;
    1515
    16     if(!$this->System->Modules['User']->CheckPermission('Finance', 'UserState')) return('Nemáte oprávnění');
     16    if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
    1717
    1818    $UserId = $this->System->Modules['User']->User['Id'];
     
    2525    // Tabulka operaci
    2626    $Output .= 'Výpis operací pro účastníka '.$Row2['fullname'].':<br>';
    27     $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3"><tr><th>Datum</th><th>Popis</th><th>Doklad</th><th>Komentář</th></tr>';
     27    $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3"><tr><th>Datum</th><th>Popis</th><th>Částka</th><th>Doklad</th></tr>';
    2828    $Operations = array();
    2929    $DbResult = $this->Database->query('(SELECT Time, Value, Text, Bill FROM FinanceCashFlow WHERE Subject='.$UserId.') UNION ALL '.
    30       '(SELECT TimeCreation as Time, (-Value) as Value, Text, Bill FROM FinanceClaimsLiabilities WHERE Subject='.$UserId.') ORDER BY Time DESC');
     30      '(SELECT TimeCreation as Time, -Value as Value, Text, Bill FROM FinanceClaimsLiabilities WHERE Subject='.$UserId.') ORDER BY Time DESC');
    3131    while($DbRow = $DbResult->fetch_array())
    3232      $Operations[] = $DbRow;
    3333    foreach($Operations as $Row)
    3434    {
     35      if($Row['Value'] == -0) $Row['Value'] = 0;
    3536      if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
    36       if($Row['Bill'] > 0) $Invoice = '<a href="?show=bill&amp;id='.$Row['Bill'].'">PDF</a>'; else $Invoice = '&nbsp;';
    37       $Output .= '<tr><td align="right">'.HumanDate($Row['Time']).'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Invoice.'</td></tr>';
     37      if($Row['Bill'] > 0) $Invoice = '<a href="bill.php?Id='.$Row['Bill'].'">PDF</a>'; else $Invoice = '&nbsp;';
     38      $Output .= '<tr><td align="right">'.HumanDate($Row['Time']).'</td><td>'.$Row['Text'].'</td><td style="text-align: right;">'.$Row['Value'].'</td><td style="text-align: center;">'.$Invoice.'</td></tr>';
    3839    }
    3940    //echo('<tr><td>&nbsp;</td><td>-'.$Row2['network_device'].'</td><td>Proměnná cena za zařízení</td></tr>
  • devel/www/index.php

    r101 r107  
    4141    'search' => array('Vyhledávání',
    4242      array('Google', 'http://www.google.cz/', 'www_google_com.gif'),
    43       array('Morfeo', 'http://morfeo.centrum.cz', 'morfeo.png'),
    44       array('Centrum', 'http://www.centrum.cz', 'www_centrum_cz.gif'),
    45       array('Seznam', 'http://www.seznam.cz', 'www_seznam_cz.gif'),
    46       array('Atlas', 'http://www.atlas.cz', 'www_atlas_cz.gif'),
    47       array('Tiscali', 'http://www.tiscali.cz', 'www_tiscali_cz.gif'),
     43      array('Morfeo', 'http://morfeo.centrum.cz/', 'morfeo.png'),
     44      array('Centrum', 'http://www.centrum.cz/', 'www_centrum_cz.gif'),
     45      array('Seznam', 'http://www.seznam.cz/', 'www_seznam_cz.gif'),
     46      array('Atlas', 'http://www.atlas.cz/', 'www_atlas_cz.gif'),
     47      array('Tiscali', 'http://www.tiscali.cz/', 'www_tiscali_cz.gif'),
    4848    ),
    4949    'usefull' => array('Užitečné',
     
    115115    //$Output .= 'Server běží: '.$this->GetServerUptime().' &nbsp;  &nbsp; ';
    116116
    117     if($this->System->Modules['User']->CheckPermission('Finance', 'UserState'))
     117    if($this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState'))
    118118    {
    119119      $DbResult = $this->Database->select('users', 'cash', 'User='.$this->System->Modules['User']->User['Id']);
  • devel/www/is/restart.php

    r89 r107  
    1212  function Show()
    1313  {
    14     if(!$this->System->Modules['User']->CheckPermission('Network', 'RestartService')) return('Nemáte oprávnění');
     14    if(!$this->System->Modules['User']->CheckPermission('Network', 'Administration')) return('Nemáte oprávnění');
    1515
    1616    if(array_key_exists('set', $_POST))
  • devel/www/network/dostupnost.php

    r102 r107  
    1616    $Output .= '<br /><table style="font-size: small;" cellspacing="0" cellpadding="3" border="1">';
    1717    $Output .= '<tr><th>Jméno</th><th>Hodina [%]</th><th>Den [%]</th><th>Týden [%]</th><th>Měsíc [%]</th><th>Year [%]</th></tr>';
    18     $DbResult = $this->Database->query('SELECT hosts.name, PeriodHour.Percent as Hour, PeriodDay.Percent as Day, PeriodWeek.Percent as Week, PeriodMonth.Percent as Month, PeriodYear.Percent as Year FROM hosts LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 1 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 1 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodHour ON PeriodHour.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodDay ON PeriodDay.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 7 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 7 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodWeek ON PeriodWeek.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 30 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 30 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodMonth ON PeriodMonth.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 365 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 365 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodYear ON PeriodYear.host_id=hosts.id WHERE hosts.used=1 AND hosts.show_online=0');
     18    $DbResult = $this->Database->query('SELECT hosts.name, PeriodHour.Percent as Hour, PeriodDay.Percent as Day, PeriodWeek.Percent as Week, PeriodMonth.Percent as Month, PeriodYear.Percent as Year FROM hosts LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 1 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 1 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodHour ON PeriodHour.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodDay ON PeriodDay.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 7 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 7 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodWeek ON PeriodWeek.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 30 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 30 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodMonth ON PeriodMonth.host_id=hosts.id LEFT JOIN (SELECT stat_hosts.host_id, (SUM(stat_hosts.count) / 24 / 365 / 60 * 100) as Percent FROM stat_hosts WHERE (time > DATE_SUB(DATE_SUB(NOW(), INTERVAL 1 HOUR), INTERVAL 24 * 365 HOUR)) AND (time< DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY host_id) as PeriodYear ON PeriodYear.host_id=hosts.id WHERE hosts.used=1 AND hosts.show_online=0 GROUP BY hosts.IP ORDER BY name');
    1919    echo($this->Database->error);
    2020    while($Row = $DbResult->fetch_array())
  • devel/www/page.php

    r102 r107  
    2222    'map' => array('',
    2323      'index.php' => 'Mapa',
     24    ),
     25    'network' => array('',
     26      'dostupnost.php' => 'Dostupnost zařízení',
    2427    ),
    2528    'nabidky_pripojeni.php' => 'Nabídky připojení',
  • devel/www/temp/transform.php

    r102 r107  
    129129    $Output = '';
    130130
    131     // Init User table from users
     131    // Clear previous content
     132    $this->Database->query('TRUNCATE TABLE PermissionOperation');
     133    $this->Database->query('TRUNCATE TABLE PermissionGroup');
     134    $this->Database->query('TRUNCATE TABLE PermissionGroupAssignment');
     135    $this->Database->query('TRUNCATE TABLE PermissionUserAssignment');
    132136    $this->Database->query('TRUNCATE TABLE User');
    133137    $this->Database->query('TRUNCATE TABLE Subject');
    134138
     139    // Init permission groups
     140    $this->Database->insert('PermissionGroup', array('Description' => 'Ostatní'));
     141    $PermissionGroupOthers = $this->Database->insert_id;
     142    $this->Database->insert('PermissionGroup', array('Description' => 'Členové sítě'));
     143    $PermissionGroupMembers = $this->Database->insert_id;
     144    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupMembers, 'GroupOrOperation' => $PermissionGroupOthers, 'Type' => 'Group'));
     145echo($this->Database->LastQuery);
     146    $this->Database->insert('PermissionGroup', array('Description' => 'Zástupci za domácnost'));
     147    $PermissionGroupSubjects = $this->Database->insert_id;
     148    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupSubjects, 'GroupOrOperation' => $PermissionGroupMembers, 'Type' => 'Group'));
     149$this->Database->insert('PermissionGroup', array('Description' => 'Správci sítě'));
     150    $PermissionGroupNetworkAdmins = $this->Database->insert_id;
     151    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $PermissionGroupSubjects, 'Type' => 'Group'));
     152    $this->Database->insert('PermissionGroup', array('Description' => 'Systémoví administrátoři'));
     153    $PermissionGroupAdmin = $this->Database->insert_id;
     154    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupAdmin, 'GroupOrOperation' => $PermissionGroupNetworkAdmins, 'Type' => 'Group'));
     155
     156    // Init permission operations
     157    $this->Database->insert('PermissionOperation', array('Module' => 'News', 'Operation' => 'Display', 'Item' => 'Item'));
     158    $OperationId = $this->Database->insert_id;
     159    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupOthers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     160
     161    $DbResult = $this->Database->select('news_category', 'id, permission');
     162    while($DbRow = $DbResult->fetch_array())
     163    {
     164      $this->Database->insert('PermissionOperation', array('Module' => 'News', 'Operation' => 'Insert', 'Item' => 'Group', 'ItemId' => $DbRow['id']));
     165      $OperationIdInsert = $this->Database->insert_id;
     166      $this->Database->insert('PermissionOperation', array('Module' => 'News', 'Operation' => 'Display', 'Item' => 'Group', 'ItemId' => $DbRow['id']));
     167      $OperationIdDisplay = $this->Database->insert_id;
     168      $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'));
     172      } else
     173      {
     174        $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupOthers, 'GroupOrOperation' => $OperationIdInsert, 'Type' => 'Operation'));
     175      }
     176    }
     177
     178    $this->Database->insert('PermissionOperation', array('Module' => 'Chat', 'Operation' => 'Display'));
     179    $OperationId = $this->Database->insert_id;
     180    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupOthers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     181
     182    $this->Database->insert('PermissionOperation', array('Module' => 'Share', 'Operation' => 'Display'));
     183    $OperationId = $this->Database->insert_id;
     184    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupMembers, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     185
     186    $this->Database->insert('PermissionOperation', array('Module' => 'Finance', 'Operation' => 'DisplaySubjectState'));
     187    $OperationId = $this->Database->insert_id;
     188    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupSubjects, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     189
     190    $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'));
     193
     194    $this->Database->insert('PermissionOperation', array('Module' => 'Finance', 'Operation' => 'Manage'));
     195    $OperationId = $this->Database->insert_id;
     196    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     197
     198    $this->Database->insert('PermissionOperation', array('Module' => 'Network', 'Operation' => 'Edit'));
     199    $OperationId = $this->Database->insert_id;
     200    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     201
     202    $this->Database->insert('PermissionOperation', array('Module' => 'Finance', 'Operation' => 'SubjectList'));
     203    $OperationId = $this->Database->insert_id;
     204    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     205
     206    $this->Database->insert('PermissionOperation', array('Module' => 'Log', 'Operation' => 'Show'));
     207    $OperationId = $this->Database->insert_id;
     208    $this->Database->insert('PermissionGroupAssignment', array('Group' => $PermissionGroupNetworkAdmins, 'GroupOrOperation' => $OperationId, 'Type' => 'Operation'));
     209
     210    // Init User table from users
    135211    $DbResult = $this->Database->select('users', '*');
    136212    while($DbRow = $DbResult->fetch_array())
    137213    {
    138214      $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));
     215      $UserId = $this->Database->insert_id;
     216      if($DbRow['id'] == 1)
     217      {
     218        $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupAdmin, 'Type' => 'Group'));
     219      } else
    139220      if($DbRow['role'] == 2)
    140221      {
    141222        $this->Database->insert('Subject', array('Id' => $DbRow['id'], 'Name' => $DbRow['subject_name'], 'AddressStreet' => $DbRow['street'], 'AddressTown' => $DbRow['town'], 'AddressPSC' => $DbRow['psc'], 'IC' => $DbRow['ico'], 'DIC' => $DbRow['dic'], 'FamilyMemberCount' => $DbRow['family'], 'MapPositionX' => $DbRow['PositionX'], 'MapPositionY' => $DbRow['PositionY'], 'NetworkSegment' => $DbRow['network_segment'], 'InternetTariffCurrentMonth' => $DbRow['inet_tarif_now'], 'InternetTariffNextMonth' => $DbRow['inet_tarif_next'], 'MembershipDate' => $DbRow['membership_date']));
    142       }
     223        $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupSubjects, 'Type' => 'Group'));
     224      } else
     225        $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'GroupOrOperation' => $PermissionGroupMembers, 'Type' => 'Group'));
    143226    }
    144227
     228    // Insert anonymous user
    145229    $this->Database->insert('User', array('Name' => 'Anonym', 'Password' => 'dsafafdfadfs', 'Locked' => 0));
    146     $Output .=  $this->Database->insert_id;
    147 
     230    $Output .=  'Anonymní uživatel: '.$this->Database->insert_id.'</ br>';
     231    $AnonymousUserId = $this->Database->insert_id;
     232    $this->Database->insert('PermissionUserAssignment', array('User' => $AnonymousUserId, 'GroupOrOperation' => $PermissionGroupOthers, 'Type' => 'Group'));
     233
     234    // Init subjects open time
    148235    $this->SubjectOpenTime();
    149236
     
    151238    //$this->Database->query('TRUNCATE TABLE ChatHistory');
    152239    //$this->Database->query('INSERT INTO ChatHistory (SELECT id as Id, nick as Nick, text as Text, time as Time, color as Color, roomname as RoomName, roomtype as RoomType, "" as Host FROM `sunrisechat_history`)');
     240
     241
    153242    return($Output);
    154243  }
  • devel/www/user.php

    r101 r107  
    9191        else
    9292        {
    93           $this->Database->insert('User', array('Name' => $Nick, 'FirstName' => $FirstName, 'SecondName' => $SecondName, 'Password' => sha1($Password), 'Email' => $Email, 'RegistrationTime' => 'NOW()'));
     93          $this->Database->insert('User', array('Name' => $Nick, 'FirstName' => $FirstName, 'SecondName' => $SecondName, 'Password' => sha1($Password), 'Email' => $Email, 'RegistrationTime' => 'NOW()', 'Locked' => 1));
    9494          $UserId = $this->Database->insert_id;
    9595         
     
    251251      if(($NewPassword == $NewPassword2) and ($Hash == $Row['Password']))
    252252      {
    253         $this->Database->update('User', 'Id='.$Row['Id'], array('Password' => sha1($NewPassword)));
     253        $this->Database->update('User', 'Id='.$Row['Id'], array('Password' => sha1($NewPassword), 'Locked' => 0));
    254254        $Output = USER_PASSWORD_RECOVERY_CONFIRMED;
    255255        $this->System->Modules['Log']->NewRecord('User', 'PasswordRecoveryConfirm', 'Username='.$Row['Name']);
Note: See TracChangeset for help on using the changeset viewer.