Revize 1747
Přidáno uživatelem Ondřej Fibich před asi 12 roky(ů)
freenetis/branches/1.1/db_upgrades/upgrade_1.1.0~alpha4.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is released under GPLv3 licence.
|
||
*
|
||
* More info about licence can be found:
|
||
* http://www.gnu.org/licenses/gpl-3.0.html
|
||
*
|
||
* More info about project can be found:
|
||
* http://www.freenetis.org/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* Adds messages for state of request for connection.
|
||
* Adds access rights for Logs and Login logs.
|
||
* Adds table for connection request.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @see #341
|
||
* @see #357
|
||
* @see #344
|
||
*/
|
||
$upgrade_sql['1.1.0~alpha4'] = array
|
||
(
|
||
// insert new message for informating message about request for connection (#341)
|
||
"INSERT INTO `messages` (`id`, `name`, `text`, `email_text`, `sms_text`, `type`, `self_cancel`, `ignore_whitelist`) VALUES
|
||
(NULL, 'Notice of adding connection request', NULL,
|
||
'Hello {member_name},<br /><br />your request for connection has been stored.<br /><br />Details:<br /> <br /> {comment}<br /><br />Your will be inform about approving/rejecting of your request by e-mail.<br /><br />Your association',
|
||
NULL, 13, NULL, 1);",
|
||
|
||
// insert new message for approving of request for connection (#341)
|
||
"INSERT INTO `messages` (`id`, `name`, `text`, `email_text`, `sms_text`, `type`, `self_cancel`, `ignore_whitelist`) VALUES
|
||
(NULL, 'Request for connection approved', NULL,
|
||
'Hello {member_name},<br/><br/>your request for connection has been approoved, details:<br/><br/>{comment}<br/><br/>Your association',
|
||
NULL, 11, NULL, 1);",
|
||
|
||
// insert new message for approving of request for connection (#341)
|
||
"INSERT INTO `messages` (`id`, `name`, `text`, `email_text`, `sms_text`, `type`, `self_cancel`, `ignore_whitelist`) VALUES
|
||
(NULL, 'Request for connection rejected', NULL,
|
||
'Hello {member_name},<br/><br/>your request for connection has been rejected, details:<br/><br/>{comment}<br/><br/>Your association',
|
||
NULL, 12, NULL, 1);",
|
||
|
||
// active logs access rights (#357)
|
||
"INSERT INTO `acl` (`id`, `note`) VALUES (NULL, 'Administrators can see logs of actions.');",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'view_all' FROM acl WHERE note = 'Administrators can see logs of actions.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`)
|
||
SELECT id, 32 FROM acl WHERE note = 'Administrators can see logs of actions.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `axo` (`id`, `section_value`, `value`, `name`) VALUES (179, 'Logs_Controller', 'logs', 'Logs');",
|
||
|
||
"INSERT INTO `axo_sections` (`id`, `value`, `name`) VALUES (29, 'Logs_Controller', 'Logs of operations on data');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`)
|
||
SELECT id, 'Logs_Controller', 'logs' FROM acl WHERE note = 'Administrators can see logs of actions.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
// active logs access rights (#357)
|
||
"INSERT INTO `acl` (`id`, `note`) VALUES(NULL, 'Administrators can see login logs.');",
|
||
|
||
"INSERT INTO `acl` (`id`, `note`) VALUES(NULL, 'Users can see their login logs.');",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'view_all' FROM acl WHERE note = 'Administrators can see login logs.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'view_own' FROM acl WHERE note = 'Users can see their login logs.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`)
|
||
SELECT id, 32 FROM acl WHERE note = 'Administrators can see login logs.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`)
|
||
SELECT id, 22 FROM acl WHERE note = 'Users can see their login logs.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `axo` (`id`, `section_value`, `value`, `name`) VALUES (180, 'Login_logs_Controller', 'logs', 'Login logs');",
|
||
|
||
"INSERT INTO `axo_sections` (`id`, `value`, `name`) VALUES (30, 'Login_logs_Controller', 'Logs of operations on data');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`)
|
||
SELECT id, 'Login_logs_Controller', 'logs' FROM acl WHERE note = 'Administrators can see login logs.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`)
|
||
SELECT id, 'Login_logs_Controller', 'logs' FROM acl WHERE note = 'Users can see their login logs.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
// connection requests table (#344)
|
||
"CREATE TABLE IF NOT EXISTS `connection_requests` (
|
||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||
`member_id` int(11) NOT NULL COMMENT 'Owner of the connection',
|
||
`user_id` int(11) DEFAULT NULL COMMENT 'Who made request',
|
||
`state` int(11) DEFAULT 0,
|
||
`created_at` datetime NOT NULL,
|
||
`ip_address` varchar(39) COLLATE utf8_czech_ci NOT NULL,
|
||
`subnet_id` int(11) NOT NULL,
|
||
`mac_address` varchar(17) COLLATE utf8_czech_ci NOT NULL,
|
||
`device_type_id` int(11) DEFAULT NULL,
|
||
`device_template_id` int(11) DEFAULT NULL,
|
||
`comment` text DEFAULT NULL COMMENT 'Comment of user who made request',
|
||
`comments_thread_id` int(11) DEFAULT NULL,
|
||
PRIMARY KEY (`id`),
|
||
FOREIGN KEY `member_id_fk` (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE,
|
||
FOREIGN KEY `user_id_fk` (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
|
||
FOREIGN KEY `subnet_id_fk` (`subnet_id`) REFERENCES `subnets` (`id`) ON DELETE CASCADE,
|
||
FOREIGN KEY `device_type_id_fk` (`device_type_id`) REFERENCES `enum_types` (`id`) ON DELETE SET NULL,
|
||
FOREIGN KEY `device_template_id_fk` (`device_template_id`) REFERENCES `device_templates` (`id`) ON DELETE SET NULL,
|
||
FOREIGN KEY `comments_thread_id_fk` (`comments_thread_id`) REFERENCES `comments_threads` (`id`) ON DELETE SET NULL
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;",
|
||
|
||
// add access rights for (#344)
|
||
"INSERT INTO `acl` (`id`, `note`) VALUES(NULL, 'Administrators can view request and change state of connection request.');",
|
||
|
||
"INSERT INTO `acl` (`id`, `note`) VALUES(NULL, 'Regular members and applicants can add new connection request and they can view their requests.');",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'view_all' FROM acl WHERE note = 'Administrators can view request and change state of connection request.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'edit_all' FROM acl WHERE note = 'Administrators can view request and change state of connection request.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'new_own' FROM acl WHERE note = 'Regular members and applicants can add new connection request and they can view their requests.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id` ,`value`)
|
||
SELECT id, 'view_own' FROM acl WHERE note = 'Regular members and applicants can add new connection request and they can view their requests.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`)
|
||
SELECT id, 32 FROM acl WHERE note = 'Administrators can view request and change state of connection request.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`)
|
||
SELECT id, 22 FROM acl WHERE note = 'Regular members and applicants can add new connection request and they can view their requests.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`)
|
||
SELECT id, 23 FROM acl WHERE note = 'Regular members and applicants can add new connection request and they can view their requests.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `axo_sections` (`id`, `value`, `name`) VALUES (31, 'Connection_Requests_Controller', 'Connection requests handling');",
|
||
|
||
"INSERT INTO `axo` (`id`, `section_value`, `value`, `name`) VALUES (181, 'Connection_Requests_Controller', 'request', 'Connection request');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`)
|
||
SELECT id, 'Connection_Requests_Controller', 'request' FROM acl WHERE note = 'Administrators can view request and change state of connection request.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`)
|
||
SELECT id, 'Connection_Requests_Controller', 'request' FROM acl WHERE note = 'Regular members and applicants can add new connection request and they can view their requests.' ORDER BY id DESC LIMIT 1;",
|
||
|
||
);
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add all records' => 'Přidávat všechny záznamy',
|
||
'add backup' => 'Přidat zálohu',
|
||
'add comment to financial state of member' => 'Přidat komentář k finančnímu stavu člena',
|
||
'add comment to connection request' => 'Přidat komentář k žádosti o připojení',
|
||
'add comment to work' => 'Přidat komentář k práci',
|
||
'add contact' => 'Přidat kontakt',
|
||
'add device' => 'Přidat zařízení',
|
||
'add device for acception of connection request' => 'Přidejte zařízení pro přijmutí požadavku o připojení.',
|
||
'add device template' => 'Přidat šablonu zařízení',
|
||
'add details to ip address' => 'Přidat detaily k IP adrese',
|
||
'add details to interface' => 'Přidat detaily k rozhraní',
|
||
... | ... | |
'add new redirection message' => 'Přidat novou zprávu přesměrování',
|
||
'add new rule' => 'Přidat nové pravidlo',
|
||
'add new link' => 'Přidat novou linku',
|
||
'add new request for connection' => 'Přidat nový požadavek o připojení',
|
||
'add new ssh key' => 'Přidat nový SSH klíč',
|
||
'add new ssh key to user' => 'Přidat nový SSH klíč uživateli',
|
||
'add new street' => 'Přidat novou ulici',
|
||
... | ... | |
'autocomplete of gps coords' => 'Automatické doplnění GPS souřadnic',
|
||
'automatically fill in gps coordinates' => 'Automaticky doplnit GPS souřadnice',
|
||
'automatically import admins' => 'Automaticky přidat správce oblastí',
|
||
'automatically load mac address' => 'Automaticky načti MAC adresu',
|
||
'availability' => 'Dostupnost',
|
||
'average' => 'Průměr',
|
||
'avarage day download' => 'Průměrný denní download',
|
||
... | ... | |
'caller' => 'Volající',
|
||
'callcon' => 'Volaný',
|
||
'calls' => 'Volání',
|
||
'notice of adding connection request' => 'Oznámení o přidání žádosti o připojení',
|
||
'canceling of message for redirection' => 'Rušení zprávy pro přesměrování',
|
||
'cannot add connection request' => 'Nelze přidat požadavek o připojení.',
|
||
'cannot change mode of the interface to client a virtual ap is derived from this interface' => 'Nemohu změnit mód rozhraní na klientský. Alespoň jedno virtuální AP je vytvořeno nad tímto rozhraním.',
|
||
'cannot connect to database' => 'Nelze se připojit k databázi',
|
||
'cannot delete, there are other records depending on this one' => 'Nelze smazat, na položce jsou závislé jiné záznamy',
|
||
... | ... | |
'cannot load services - data missing' => 'Nemohu načíst služby - data chybí',
|
||
'cannot open uploaded bank listing file!' => 'Nelze otevřít nahraný soubor s bankovním výpisem!',
|
||
'cannot parse fio listing header!' => 'Nelze parsovat hlavičku Fio výpisu!',
|
||
'cannot reject connection request' => 'Nelze zamítnou požadavek k připojení.',
|
||
'cannot remove default vlan' => 'Nelze odstranit výchozí VLAN',
|
||
'cannot save form' => 'Nemohu uložit formulář',
|
||
'cannot save gps, this address point has already gps coordinates' => 'Nemohu uložit GPS, adresní bod má již přiřazeny GPS souřadnice',
|
||
... | ... | |
'connected to device' => 'Připojeno k zařízení',
|
||
'connected to interface' => 'Připojeno k rozhraní',
|
||
'connecting place' => 'Přípojné místo',
|
||
'connection request' => 'Žádost o připojení',
|
||
'list of connection requests' => 'Seznam žádostí o připojení',
|
||
'connection owner' => 'Vlastník připojení',
|
||
'connection request has been rejected' => 'Požadavek na připojení byl zamítnut.',
|
||
'connection request has been succesfully edited' => 'Žádost o připojení byla úspěšně editována.',
|
||
'connection requests' => 'Požadavky na připojení',
|
||
'connection requests are not enabled' => 'Požadavky na připojení nejsou povoleny.',
|
||
'connections' => 'Připojení',
|
||
'constant symbol' => 'Konstantní symbol',
|
||
'contact is owned by another user' => 'Kontakt je vlastněn jiným uživatelem',
|
||
... | ... | |
'do you really want to activate notifications' => 'Chcete opravdu aktivovat upozornění?',
|
||
'do you really want to delete this record' => 'Chcete opravdu smazat tento záznam',
|
||
'do you really want to end editing of registrations' => 'Chcete opravdu ukončit editaci přihlášek?',
|
||
'do you really want to reject this request' => 'Chcete opravdu zamítnout tento požadavek',
|
||
'do you want to delete this users phone invoice' => 'Chcete opravdu smazat uživatelovu telefonní fakturu',
|
||
'do you want to cancel this redirection' => 'Chcete zrušit toto přesměrování',
|
||
'do you want to cancel this backup' => 'Chcete zrušit toto zálohování',
|
||
... | ... | |
'edit private phone number contact' => 'Upravit soukromý telefonní kontakt',
|
||
'edit redirection message' => 'Úprava zprávy přesměrování',
|
||
'edit registrations' => 'Upravit přihlášky',
|
||
'edit request for connection' => 'Upravit požadavek o připojení',
|
||
'edit routerboard backup' => 'Upravit zálohu routerboardu',
|
||
'edit link' => 'Úprava linku',
|
||
'edit smokeping record' => 'Upravit záznam smokepingu',
|
||
... | ... | |
'mac' => 'MAC',
|
||
'mac address' => 'MAC adresa',
|
||
'mac address already exists' => 'MAC adresa se již nachází v databázi',
|
||
'mac address of device' => 'MAC adresa zařízení',
|
||
'mac address is invalid' => 'MAC adresa je neplatná',
|
||
'mac restriction' => 'MAC restrikce',
|
||
'mac restriction file was successfully generated' => 'Soubor s MAC restrikcemi byl úspěšně vygenerován',
|
||
... | ... | |
'must be logged in' => 'Musíte se přihlásit.',
|
||
'must pay regular fee' => 'Platí pravidelný příspěvek',
|
||
'my backups' => 'Moje zálohy',
|
||
'my connection requests' => 'Moje žádosti o připojení',
|
||
'my devices' => 'Moje zařízení',
|
||
'my ip address' => 'Moje IP adresa',
|
||
'my mail' => 'Moje pošta',
|
||
... | ... | |
'recharge voip credit' => 'Dobít VoIP kredit',
|
||
'recharging of voip credit' => 'Dobití VoIP kreditu',
|
||
'recharge' => 'Dobít',
|
||
'reject' => 'Zamítnout',
|
||
'rejected' => 'Zamítnuto',
|
||
'rejected works' => 'Zamítnuté práce',
|
||
'rejected work reports' => 'Zamítnuté prácovní výkazy',
|
||
... | ... | |
'repository root' => 'Kořen úložiště',
|
||
'repository uuid' => 'UUID úložiště',
|
||
'request' => 'Požadavek',
|
||
'request for connection approved' => 'Požadavek na připojení schválen',
|
||
'request for connection rejected' => 'Požadavek na připojení zamítnut',
|
||
'request for membership' => 'Žádost o členství',
|
||
'reguest is invalid or expired' => 'Žádost je neplatná nebo expirovala',
|
||
'requests' => 'Požadavky',
|
||
... | ... | |
'types count' => 'Počet typů',
|
||
'ucp' => 'NPM',
|
||
'unconfirmed works' => 'Nepotvrzené práce',
|
||
'undecided' => 'Nerozhodnuto',
|
||
'unidentified transfers' => 'Neidentifikované platby',
|
||
'unknown error' => 'Neznámá chyba',
|
||
'unknown device' => 'Neznámé zařízení',
|
||
... | ... | |
'you have voted in' => 'Hlasoval jste v',
|
||
'you must create it manually and paste the following text into it' => 'Musíte jej vytvořit ručně a zkopírovat do něj následující text',
|
||
'you will need to know the following items before proceeding' => 'Budete potřebovat znát následující položky před pokračováním:',
|
||
'you will be inform by your email address about admin decision' => 'O rozhodnutí admina budete informován emailem',
|
||
'you will be informed about it\'s result by email' => 'O výsledku žádosti budete informováni e-mailem.',
|
||
'your votes' => 'Vaše hlasy',
|
||
'your ip address has not been found in database' => 'Vaše IP adresa nebyla nalezena v databázi.',
|
||
'your accout has been locked' => 'Váš účet byl uzamčen.',
|
||
... | ... | |
'your request for membership has not been approved yet' => 'Vaše žádost o členství zatím nebyla schválena',
|
||
'your name' => 'Vaše jméno',
|
||
'your registration has been sended and waiting for admin approval' => 'Vaše registrace byla odeslána a čeká na schválení adminem',
|
||
'you will be inform by your email address about admin decision' => 'O rozhodnutí admina budete informován emailem',
|
||
'your request has been succesfully stored' => 'Váš požadavek byl úspěšně uložen.',
|
||
'your work has been added' => 'Vaše práce byla přidána',
|
||
'your work has been approved' => 'Vaše práce byla schválena',
|
||
'your work has been deleted' => 'Vaše práce byla smazána',
|
freenetis/branches/1.1/application/i18n/cs_CZ/help.php | ||
---|---|---|
'bank_accounts' => 'Bankovní účty jsou primárně vytvářeny automaticky během importu bankovního výpisu. V případě úspěšného rozpoznání platby je rovnou tento bankovní účet svázán s rozpoznaným členem. V případě, že člen v budoucnu splete variabilní symbol, pak toto ukládání bankovních účtů usnadňuje identifikaci platby v případě, že opět platil ze stejného účtu. Ruční přidávání bankovních účtů je vyhrazeno pro nestandardní případy.',
|
||
'bank_accounts_of_association' => 'Sdružení může mít více bankovních účtů, jeden je vždy založen po instalaci, nicméně je časem možné přidávat další. Na příslušném bankovním účtu pak lze provádět import výpisů.',
|
||
'clean_temp_whitelist' => 'Po importu vymaže členy z dočasné bílé listiny',
|
||
'connection_request_device_type' => 'Obvykle zařízení, se kterým se snažíte přistoupit na internet (PC, notebook, mobil).',
|
||
'connection_request_info' => 'Pro připojení neregistrované přípojky/zařízení vyplňte prosím tento formulář.<br/>Rozhodnutí o vyhovění/zamítnutí Vaší žádosti Vám bude zasláno na Vaši e-mailovou adresu.',
|
||
'connection_request_mac_address' => 'Fyzická adresa zařízení, se kterým se snažíte přistoupit na internet (PC, notebook, mobil). Pokud nedokážete tuto vlastnost zjistit, použijte tlačítko u políčka, které se pokusí adresu načíst automaticky.',
|
||
'content_of_message' => 'Obsah zprávy pro přesměrování je možno díky zabudovanému editoru měnit jak ručně, tak s pomocí jeho palety formátování. V textu lze využít několik speciálních tagů ve složených závorkách, které se zobrazí podle IP adresy přesměrovaného člena. {member_name} zobrazí jméno člena, {member_id} ID člena, {ip_address} IP adresu, {subnet_name} název podsítě, {variable_symbol} variabilní symbol, {balance} zůstatek, {comment} osobní komentář.',
|
||
'credit_subaccounts' => 'Kreditní podúčty jsou jinde ve Freenetisu zmíněny jako kreditní účty, ovšem z pohledu účetního, jde spíše o podúčty. Z pohledu účetního jde stále o jeden účet 221100. Zde jsou ovšem vypsány podúčty, které vyjadřují vnitřní rozdělení peněz na účtu a jde o peníze na účtech jednotlivých členů.',
|
||
'current_credit' => 'Aktuální stav vašeho kreditu. Z vašeho účtu je každý měsíc strháván členský příspěvek. V případě, že se blížíte k nule, nebo jste se dostali do mínusu, je třeba kredit dobít zaplacením členského příspěvku.',
|
freenetis/branches/1.1/application/i18n/en_US/help.php | ||
---|---|---|
'bank_accounts' => 'Bank accounts are primarily created automatically during import bank statement. In case of successful recognition of payment is equal to the bank account linked with recognized member. In the event that a member makes a mistake in the future variable symbol, then the saving bank accounts, facilitating identification of the payment in case the back pay from the same account. Manually adding a bank account is reserved for unusual cases.',
|
||
'bank_accounts_of_association' => 'The Association may have multiple bank accounts, one is always based upon the installation, however, it is possible to add more time. The relevant bank account can then perform the import statements.',
|
||
'clean_temp_whitelist' => 'Removes members from temporary whilelist after import',
|
||
'connection_request_device_type' => 'Typically the device that you are trying to access the internet (PC, laptop, mobile, ...).',
|
||
'connection_request_info' => 'To connect unregistered connections/device please fill out this form.<br/>Decision on the pass/rejection of your request will be sent to your e-mail address.',
|
||
'connection_request_mac_address' => 'The physical address of the device that you are trying to access the internet (PC, laptop, mobile, ...). If you can not find this property, use the button near the field that tries to automatically load the address.',
|
||
'content_of_message' => 'The content of the message for redirection is possible thanks to the built-in editor to modify both manually and with its variety of formatting. In the text you can use some special tags in curly brackets, which are displayed by IP address redirected member. {member_name} display member\'s name, {member_id} Member ID, {ip_address} IP address, {subnet_name} subnet name, {variable_symbol} variable symbol, {balance} balance, {comment} personal commentary.',
|
||
'credit_subaccounts' => 'Credit sub-accounts are elsewhere in Freenetisu mentioned as credit accounts, but in terms of accounting, but rather a sub-accounts. From the perspective of accounting is still a single account 221100. Here, however, are sub-listed, which express the internal distribution of money in the account and the money goes to the accounts of individual members.',
|
||
'current_credit' => 'The current status of your credit. Membership fee is deducted monthly from account. In the event that you are approaching zero, or you get to minus, you need to recharge your credit by paying the membership fee.',
|
freenetis/branches/1.1/application/helpers/callback.php | ||
---|---|---|
break;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback function to print connection request state
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param object $item
|
||
* @param string $name
|
||
*/
|
||
public static function connection_request_state_field($item, $name)
|
||
{
|
||
switch ($item->state)
|
||
{
|
||
case Connection_request_Model::STATE_UNDECIDED:
|
||
echo "<span style='color: #999'>".__('Undecided')."</span>";
|
||
break;
|
||
|
||
case Connection_request_Model::STATE_APPROVED:
|
||
echo "<span style='color: green'>".__('Approved')."</span>";
|
||
break;
|
||
|
||
case Connection_request_Model::STATE_REJECTED:
|
||
echo "<span style='color: red'>".__('Rejected')."</span>";
|
||
break;
|
||
}
|
||
|
||
if (isset($item->a_comment) && !empty($item->a_comment))
|
||
{
|
||
echo '<span class="help" title="'.$item->a_comment.'">';
|
||
echo html::image('media/images/icons/comment.png');
|
||
echo '</span>';
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback to print enable/disable image
|
||
... | ... | |
{
|
||
$message = new Message_Model($item->id);
|
||
|
||
if ($message->type == Message_Model::CONTACT_INFORMATION ||
|
||
$message->type == Message_Model::CANCEL_MESSAGE ||
|
||
$message->type == Message_Model::UNKNOWN_DEVICE_MESSAGE ||
|
||
$message->type == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::APPLICANT_APPROVE_MEMBERSHIP ||
|
||
$message->type == Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (!Message_Model::can_be_activate_directly($message->type))
|
||
{
|
||
echo ' ';
|
||
}
|
||
... | ... | |
{
|
||
$message = new Message_Model($item->id);
|
||
|
||
if ($message->type == Message_Model::CONTACT_INFORMATION ||
|
||
$message->type == Message_Model::CANCEL_MESSAGE ||
|
||
$message->type == Message_Model::UNKNOWN_DEVICE_MESSAGE ||
|
||
$message->type == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::APPLICANT_APPROVE_MEMBERSHIP ||
|
||
$message->type == Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (!Message_Model::can_be_activate_directly($message->type))
|
||
{
|
||
echo ' ';
|
||
}
|
freenetis/branches/1.1/application/helpers/condition.php | ||
---|---|---|
{
|
||
return ($item->port_vlan != Vlan_Model::DEFAULT_VLAN_TAG);
|
||
}
|
||
|
||
/**
|
||
* Check if connection is undecided.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param object $item Data row
|
||
* @return boolean
|
||
*/
|
||
public static function is_connection_request_undecided($item)
|
||
{
|
||
return ($item->state == Connection_request_Model::STATE_UNDECIDED);
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/models/subnet.php | ||
---|---|---|
* @property ORM_Iterator $clouds
|
||
* @property ORM_Iterator $ip_addresses
|
||
* @property ORM_Iterator $allowed_subnets
|
||
* @property ORM_Iterator $connection_requests
|
||
*/
|
||
class Subnet_Model extends ORM
|
||
{
|
||
protected $has_one = array('subnets_owner');
|
||
protected $has_many = array('ip_addresses', 'allowed_subnets');
|
||
protected $has_many = array('ip_addresses', 'allowed_subnets', 'connection_requests');
|
||
protected $has_and_belongs_to_many = array('clouds');
|
||
|
||
/**
|
freenetis/branches/1.1/application/models/user.php | ||
---|---|---|
* @property ORM_Iterator $device_engineers
|
||
* @property ORM_Iterator $users_contacts
|
||
* @property ORM_Iterator $clouds
|
||
* @property ORM_Iterator $connection_requests
|
||
*/
|
||
class User_Model extends ORM
|
||
{
|
||
... | ... | |
(
|
||
'jobs', 'devices', 'logs', 'phone_invoices_users', 'sms_messages',
|
||
'users' => 'private_phone_contacts', 'users_keys', 'device_admins',
|
||
'device_engineers'
|
||
'device_engineers', 'connection_requests'
|
||
);
|
||
|
||
protected $has_and_belongs_to_many = array
|
freenetis/branches/1.1/application/models/message.php | ||
---|---|---|
*/
|
||
const APPLICANT_REFUSE_MEMBERSHIP = 10;
|
||
|
||
/**
|
||
* content of page for approved request for connection
|
||
*/
|
||
const CONNECTION_REQUEST_APPROVE = 11;
|
||
|
||
/**
|
||
* content of page for refused request for connection
|
||
*/
|
||
const CONNECTION_REQUEST_REFUSE = 12;
|
||
|
||
/**
|
||
* content of page for inforrmation about request for connection
|
||
*/
|
||
const CONNECTION_REQUEST_INFO = 13;
|
||
|
||
// self-cancel constants
|
||
|
||
/**
|
||
* self cancel disabled, remote computer cannot cancel this message
|
||
*/
|
||
const SELF_CANCEL_DISABLED = 0;
|
||
const SELF_CANCEL_DISABLED = 0;
|
||
|
||
/**
|
||
* self cancel enabled, every member's IP address will have cancelled
|
||
... | ... | |
*/
|
||
const SELF_CANCEL_IP = 2;
|
||
|
||
/**
|
||
* Self cancel messages
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @var array
|
||
*/
|
||
private static $self_cancel_messages = array
|
||
(
|
||
self::SELF_CANCEL_DISABLED => 'Disabled',
|
||
self::SELF_CANCEL_MEMBER => 'Possibility of canceling redirection to all IP addresses of member',
|
||
self::SELF_CANCEL_IP => 'Possibility of canceling redirection to only current IP address'
|
||
);
|
||
|
||
/**
|
||
* Gets set of self cancel messages
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param bool $translate Translate messages
|
||
* @return array
|
||
*/
|
||
public static function get_self_cancel_messages($translate = TRUE)
|
||
{
|
||
if ($translate)
|
||
{
|
||
return array_map('__', self::$self_cancel_messages);
|
||
}
|
||
|
||
return self::$self_cancel_messages;
|
||
}
|
||
|
||
/**
|
||
* Check if message may be self cancable.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function is_self_cancable($type)
|
||
{
|
||
return (
|
||
$type == self::USER_MESSAGE ||
|
||
$type == self::INTERRUPTED_MEMBERSHIP_MESSAGE ||
|
||
$type == self::DEBTOR_MESSAGE ||
|
||
$type == self::PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::UNALLOWED_CONNECTING_PLACE_MESSAGE
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Check if message may ignore the white list.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function is_white_list_ignorable($type)
|
||
{
|
||
return (
|
||
$type == self::USER_MESSAGE ||
|
||
$type == self::INTERRUPTED_MEMBERSHIP_MESSAGE ||
|
||
$type == self::DEBTOR_MESSAGE ||
|
||
$type == self::PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::UNALLOWED_CONNECTING_PLACE_MESSAGE
|
||
);
|
||
}
|
||
|
||
|
||
/**
|
||
* Check if message is special message.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function is_special_message($type)
|
||
{
|
||
return (
|
||
$type == self::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::APPLICANT_APPROVE_MEMBERSHIP ||
|
||
$type == self::APPLICANT_REFUSE_MEMBERSHIP ||
|
||
$type == self::CONNECTION_REQUEST_APPROVE ||
|
||
$type == self::CONNECTION_REQUEST_REFUSE ||
|
||
$type == self::CONNECTION_REQUEST_INFO
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Check if message contains redirection content.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function has_redirection_content($type)
|
||
{
|
||
return (
|
||
$type != self::RECEIVED_PAYMENT_NOTICE_MESSAGE &&
|
||
$type != self::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$type != self::APPLICANT_REFUSE_MEMBERSHIP &&
|
||
$type != self::CONNECTION_REQUEST_APPROVE &&
|
||
$type != self::CONNECTION_REQUEST_REFUSE &&
|
||
$type != self::CONNECTION_REQUEST_INFO
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Check if message contains email content.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function has_email_content($type)
|
||
{
|
||
return (
|
||
$type == self::USER_MESSAGE ||
|
||
$type == self::DEBTOR_MESSAGE ||
|
||
$type == self::PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::APPLICANT_APPROVE_MEMBERSHIP ||
|
||
$type == self::APPLICANT_REFUSE_MEMBERSHIP ||
|
||
$type == self::CONNECTION_REQUEST_APPROVE ||
|
||
$type == self::CONNECTION_REQUEST_REFUSE ||
|
||
$type == self::CONNECTION_REQUEST_APPROVE ||
|
||
$type == self::CONNECTION_REQUEST_REFUSE ||
|
||
$type == self::CONNECTION_REQUEST_INFO
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Check if message contains sms content.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function has_sms_content($type)
|
||
{
|
||
return (
|
||
$type == self::USER_MESSAGE ||
|
||
$type == self::DEBTOR_MESSAGE ||
|
||
$type == self::PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$type == self::CONNECTION_REQUEST_APPROVE ||
|
||
$type == self::CONNECTION_REQUEST_REFUSE
|
||
);
|
||
}
|
||
|
||
|
||
/**
|
||
* Check if message can be activated directly.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $type Type of message
|
||
* @return boolean
|
||
*/
|
||
public static function can_be_activate_directly($type)
|
||
{
|
||
return (
|
||
$type != self::CONTACT_INFORMATION &&
|
||
$type != self::CANCEL_MESSAGE &&
|
||
$type != self::UNKNOWN_DEVICE_MESSAGE &&
|
||
$type != self::RECEIVED_PAYMENT_NOTICE_MESSAGE &&
|
||
$type != self::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$type != self::APPLICANT_REFUSE_MEMBERSHIP &&
|
||
$type != self::CONNECTION_REQUEST_APPROVE &&
|
||
$type != self::CONNECTION_REQUEST_REFUSE &&
|
||
$type != self::CONNECTION_REQUEST_INFO
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Counts all activated redirections from junction table messages_ip_addresses.
|
||
*
|
||
* @author Jiri Svitak, Ondrej Fibich
|
||
... | ... | |
* @param integer $user_id Who redirects
|
||
* @param integer $email E-mail state
|
||
* @param integer $sms SMS state
|
||
* @param string $comment Comment for member
|
||
* @return boolean Notification made?
|
||
*/
|
||
public static function activate_special_notice(
|
||
$type, $member_id, $user_id, $email, $sms)
|
||
$type, $member_id, $user_id, $email, $sms, $comment = NULL)
|
||
{
|
||
if ($type != self::RECEIVED_PAYMENT_NOTICE_MESSAGE &&
|
||
$type != self::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$type != self::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (!self::is_special_message($type))
|
||
{
|
||
throw new Exception('Wrong type');
|
||
}
|
||
... | ... | |
$member_id, Contact_Model::TYPE_EMAIL, $message->ignore_whitelist
|
||
);
|
||
// send emails for finded emails
|
||
self::send_emails($message, $emails);
|
||
self::send_emails($message, $emails, $comment);
|
||
}
|
||
|
||
// send SMS messages
|
||
... | ... | |
$member_id, Contact_Model::TYPE_PHONE, $message->ignore_whitelist
|
||
);
|
||
// send SMS messages for finded phone numbers
|
||
self::send_sms_messages($message, $smss, $user_id);
|
||
self::send_sms_messages($message, $smss, $user_id, $comment);
|
||
}
|
||
|
||
// return stats array
|
freenetis/branches/1.1/application/models/member.php | ||
---|---|---|
* @property ORM_Iterator $transfers
|
||
* @property ORM_Iterator $bank_accounts
|
||
* @property ORM_Iterator $membership_interrupts
|
||
* @property ORM_Iterator $connection_requests
|
||
*/
|
||
class Member_Model extends ORM
|
||
{
|
||
... | ... | |
protected $has_many = array
|
||
(
|
||
'allowed_subnets', 'invoices', 'users', 'accounts',
|
||
'transfers', 'bank_accounts', 'membership_interrupts'
|
||
'transfers', 'bank_accounts', 'membership_interrupts',
|
||
'connection_requests'
|
||
);
|
||
|
||
protected $belongs_to = array('address_point', 'user');
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Returns ID of main user of member
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @return integer|null
|
||
*/
|
||
public function get_main_user($member_id = NULL)
|
||
{
|
||
if ($member_id === NULL && $this)
|
||
{
|
||
$member_id = $this->id;
|
||
}
|
||
|
||
$result = $this->db->query("
|
||
SELECT u.id
|
||
FROM users u
|
||
WHERE u.member_id = ? AND u.type = ?
|
||
", array($member_id, User_Model::MAIN_USER));
|
||
|
||
if ($result->count())
|
||
{
|
||
return $result->current()->id;
|
||
}
|
||
|
||
return NULL;
|
||
}
|
||
|
||
/**
|
||
* Returns all members belongs to link
|
||
*
|
||
* @author Michal Kliment
|
freenetis/branches/1.1/application/models/device_template.php | ||
---|---|---|
* @property string $name
|
||
* @property string $values
|
||
* @property boolean $default
|
||
* @property ORM_Iterator $connection_requests
|
||
*/
|
||
class Device_template_Model extends ORM
|
||
{
|
||
protected $belongs_to = array('enum_type');
|
||
protected $has_many = array('connection_requests');
|
||
|
||
/**
|
||
* Gets parsed value of current object
|
freenetis/branches/1.1/application/models/enum_type.php | ||
---|---|---|
* @property string $value
|
||
* @property boolean $read_only
|
||
* @property ORM_Iterator $device_templates
|
||
* @property ORM_Iterator $connection_requests
|
||
*/
|
||
class Enum_type_Model extends ORM
|
||
{
|
||
/* enum types names (same as enum type name IDs) ==> */
|
||
// types for device, member, user, contact, fee
|
||
const MEMBER_TYPE_ID = 1;
|
||
const DEVICE_TYPE_ID = 2;
|
||
const MEMBER_TYPE_ID = 1;
|
||
const DEVICE_TYPE_ID = 2;
|
||
const USER_TYPE_ID = 3;
|
||
const CONTACT_TYPE_ID = 4;
|
||
const FEE_TYPE_ID = 6;
|
||
... | ... | |
const ANTENNA_TYPE_ID = 10;
|
||
const POLARIZATION_TYPE_ID = 11;
|
||
|
||
const MEDIUM_TYPE_ID = 12;
|
||
const MEDIUM_TYPE_ID = 12;
|
||
// types for redirection
|
||
const REDIRECT_DURATION_ID = 13;
|
||
const REDIRECT_DESTINATION_ID = 14;
|
||
const REDIRECT_ACTION_ID = 15;
|
||
const REDIRECT_ACTION_ID = 15;
|
||
// types for bacup
|
||
const BACUP_ID = 16;
|
||
/* <== enum types names */
|
||
|
||
const READ_ONLY = 1;
|
||
const READ_WRITE = 0;
|
||
const READ_WRITE = 0;
|
||
|
||
protected $belongs_to = array
|
||
(
|
||
... | ... | |
|
||
protected $has_many = array
|
||
(
|
||
'device_templates'
|
||
'device_templates', 'connection_requests'
|
||
);
|
||
|
||
/**
|
freenetis/branches/1.1/application/models/connection_request.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is release under GPLv3 licence.
|
||
*
|
||
* More info about licence can be found:
|
||
* http://www.gnu.org/licenses/gpl-3.0.html
|
||
*
|
||
* More info about project can be found:
|
||
* http://www.freenetis.org/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* Connecttion request.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @package Model
|
||
*
|
||
* @property integer $id
|
||
* @property integer $member_id
|
||
* @property Member_Model $member
|
||
* @property integer $user_id
|
||
* @property User_Model $user
|
||
* @property integer $state
|
||
* @property datetime $created_at
|
||
* @property string $ip_address
|
||
* @property integer $subnet_id
|
||
* @property Subnet_Model $subnet
|
||
* @property string $mac_address
|
||
* @property integer $device_type_id
|
||
* @property Enum_type_Model $device_type
|
||
* @property integer $device_template_id
|
||
* @property Device_template_Model $device_template
|
||
* @property string $comment
|
||
* @property integer $comments_thread_id
|
||
* @property Comments_thread_Model $comments_thread
|
||
*/
|
||
class Connection_request_Model extends ORM
|
||
{
|
||
// states of request
|
||
|
||
/** Undecided state (default state) */
|
||
const STATE_UNDECIDED = 0;
|
||
/** Denied state - request was not approved */
|
||
const STATE_REJECTED = 1;
|
||
/** Approved state - request was approved */
|
||
const STATE_APPROVED = 2;
|
||
|
||
/**
|
||
* State messages
|
||
*
|
||
* @var array
|
||
*/
|
||
private static $state_messages = array
|
||
(
|
||
self::STATE_UNDECIDED => 'Undecided',
|
||
self::STATE_REJECTED => 'Rejected',
|
||
self::STATE_APPROVED => 'Approved'
|
||
);
|
||
|
||
// database relations
|
||
|
||
protected $belongs_to = array
|
||
(
|
||
'member', 'user', 'device_template',
|
||
'comments_thread', 'subnet', 'device_type' => 'enum_type'
|
||
);
|
||
|
||
// functions
|
||
|
||
/**
|
||
* Gets states messages
|
||
*
|
||
* @param boolean $translate Translate messages?
|
||
* @return array
|
||
*/
|
||
public static function get_state_messages($translate = TRUE)
|
||
{
|
||
if ($translate)
|
||
{
|
||
return array_map('__', self::$state_messages);
|
||
}
|
||
|
||
return self::$state_messages;
|
||
}
|
||
|
||
/**
|
||
* Counts filtered connection requests
|
||
*
|
||
* @param string $filter_sql SQL filter
|
||
* @return integer Count
|
||
*/
|
||
public function count_all_connection_requests($filter_sql = '')
|
||
{
|
||
$where = '';
|
||
|
||
if (!empty($filter_sql))
|
||
{
|
||
$where = 'WHERE ' . $filter_sql;
|
||
}
|
||
else
|
||
{
|
||
return $this->count_all();
|
||
}
|
||
|
||
return $this->db->query("
|
||
SELECT COUNT(*) AS total FROM (
|
||
SELECT cr.id, cr.mac_address, cr.ip_address, cr.comment, cr.state,
|
||
cr.created_at, cr.member_id, m.name AS member_name,
|
||
u.id AS user_id, CONCAT(u.name, ' ', u.surname) AS user_name,
|
||
s.id AS subnet_id, s.name AS subnet_name,
|
||
IFNULL(t.translated_term, e.value) AS device_type
|
||
FROM connection_requests cr
|
||
JOIN members m ON m.id = cr.member_id
|
||
JOIN subnets s ON s.id = cr.subnet_id
|
||
LEFT JOIN users u ON u.id = cr.user_id
|
||
LEFT JOIN enum_types e ON cr.device_type_id = e.id
|
||
LEFT JOIN translations t ON e.value LIKE t.original_term AND t.lang = ?
|
||
) c
|
||
$where
|
||
", Config::get('lang'))->current()->total;
|
||
}
|
||
|
||
/**
|
||
* Counts connection requests of members
|
||
*
|
||
* @param integer $member_id
|
||
* @return integer Count
|
||
*/
|
||
public function count_all_connection_requests_of_member($member_id)
|
||
{
|
||
return $this->db->query("
|
||
SELECT COUNT(*) AS total
|
||
FROM connection_requests cr
|
||
WHERE cr.member_id = ?
|
||
", $member_id)->current()->total;
|
||
}
|
||
|
||
/**
|
||
* Gets filtered connection requests
|
||
*
|
||
* @param integer $limit_from
|
||
* @param integer $limit_results
|
||
* @param string $order_by
|
||
* @param string $order_by_direction
|
||
* @param string $filter_sql SQL filter
|
||
* @return Mysql_Result
|
||
*/
|
||
public function get_all_connection_requests(
|
||
$limit_from = 0, $limit_results = 50, $order_by = 'id',
|
||
$order_by_direction = 'asc', $filter_sql = '')
|
||
{
|
||
$where = '';
|
||
|
||
if (!empty($filter_sql))
|
||
{
|
||
$where = 'WHERE ' . $filter_sql;
|
||
}
|
||
|
||
if (strtolower($order_by_direction) != 'asc')
|
||
{
|
||
$order_by_direction = 'desc';
|
||
}
|
||
|
||
return $this->db->query("
|
||
SELECT * FROM (
|
||
SELECT cr.id, cr.mac_address, cr.ip_address, cr.comment, cr.state,
|
||
cr.created_at, cr.member_id, m.name AS member_name,
|
||
u.id AS user_id, CONCAT(u.name, ' ', u.surname) AS user_name,
|
||
s.id AS subnet_id, s.name AS subnet_name,
|
||
IFNULL(t.translated_term, e.value) AS device_type,
|
||
co.a_comment
|
||
FROM connection_requests cr
|
||
JOIN members m ON m.id = cr.member_id
|
||
JOIN subnets s ON s.id = cr.subnet_id
|
||
LEFT JOIN users u ON u.id = cr.user_id
|
||
LEFT JOIN enum_types e ON cr.device_type_id = e.id
|
||
LEFT JOIN translations t ON e.value LIKE t.original_term AND t.lang = ?
|
||
LEFT JOIN
|
||
(
|
||
SELECT comments_thread_id,
|
||
GROUP_CONCAT(
|
||
CONCAT(
|
||
u.surname,' ',u.name,
|
||
' (',SUBSTRING(c.datetime,1,10),'):\n',c.text)
|
||
ORDER BY c.datetime DESC
|
||
SEPARATOR '\n\n'
|
||
) AS a_comment
|
||
FROM comments c
|
||
JOIN users u ON c.user_id = u.id
|
||
GROUP BY comments_thread_id
|
||
) co ON co.comments_thread_id = cr.comments_thread_id
|
||
) c
|
||
$where
|
||
ORDER BY " . $this->db->escape_column($order_by) . " $order_by_direction
|
||
LIMIT " . intval($limit_from) . ", " . intval($limit_results) . "
|
||
", Config::get('lang'));
|
||
}
|
||
|
||
/**
|
||
* Gets connection requests of member
|
||
*
|
||
* @param integer $member_id
|
||
* @return Mysql_Result
|
||
*/
|
||
public function get_all_connection_requests_of_member($member_id)
|
||
{
|
||
return $this->db->query("
|
||
SELECT cr.id, cr.mac_address, cr.ip_address, cr.comment, cr.state,
|
||
cr.created_at, cr.member_id, m.name AS member_name,
|
||
u.id AS user_id, CONCAT(u.name, ' ', u.surname) AS user_name,
|
||
s.id AS subnet_id, s.name AS subnet_name,
|
||
IFNULL(t.translated_term, e.value) AS device_type,
|
||
co.a_comment
|
||
FROM connection_requests cr
|
||
JOIN members m ON m.id = cr.member_id
|
||
JOIN subnets s ON s.id = cr.subnet_id
|
||
LEFT JOIN users u ON u.id = cr.user_id
|
||
LEFT JOIN enum_types e ON cr.device_type_id = e.id
|
||
LEFT JOIN translations t ON e.value LIKE t.original_term AND t.lang = ?
|
||
LEFT JOIN
|
||
(
|
||
SELECT comments_thread_id,
|
||
GROUP_CONCAT(
|
||
CONCAT(
|
||
u.surname,' ',u.name,
|
||
' (',SUBSTRING(c.datetime,1,10),'):\n',c.text)
|
||
ORDER BY c.datetime DESC
|
||
SEPARATOR '\n\n'
|
||
) AS a_comment
|
||
FROM comments c
|
||
JOIN users u ON c.user_id = u.id
|
||
GROUP BY comments_thread_id
|
||
) co ON co.comments_thread_id = cr.comments_thread_id
|
||
WHERE cr.member_id = ?
|
||
ORDER BY cr.created_at DESC
|
||
", Config::get('lang'), $member_id);
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/models/comments_thread.php | ||
---|---|---|
class Comments_thread_Model extends ORM
|
||
{
|
||
protected $has_many = array('comments');
|
||
protected $has_one = array('account', 'job');
|
||
protected $has_one = array('account', 'job', 'connection_request');
|
||
|
||
/**
|
||
* Return parent object of comment thread
|
freenetis/branches/1.1/application/controllers/users.php | ||
---|---|---|
if (!$user_model || !$user_model->id)
|
||
Controller::error(RECORD);
|
||
|
||
// cannot delete main user (fixes #384)
|
||
if ($user_model->id == User_Model::ASSOCIATION)
|
||
Controller::warning(PARAMETER);
|
||
|
||
$member_id = $user_model->member_id;
|
||
|
||
// access rights
|
freenetis/branches/1.1/application/controllers/logs.php | ||
---|---|---|
*/
|
||
public function show_all($limit_results = 50, $page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_view('Logs_Controller', 'logs'))
|
||
Controller::error(ACCESS);
|
||
|
||
if (Settings::get('action_logs_active') != 1)
|
||
... | ... | |
->values(array
|
||
(
|
||
Log_Model::ACTION_ADD => __('Added'),
|
||
Log_Model::ACTION_DELETE => __('Deleted'),
|
||
Log_Model::ACTION_UPDATE => __('Updated')
|
||
Log_Model::ACTION_DELETE => __('Deleted'),
|
||
Log_Model::ACTION_UPDATE => __('Updated')
|
||
));
|
||
|
||
$filter_form->add('object_id')
|
||
... | ... | |
public function show_by_user($user_id = null, $limit_results = 200,
|
||
$page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_view('Logs_Controller', 'logs'))
|
||
Controller::error(ACCESS);
|
||
|
||
if (!isset($user_id))
|
||
... | ... | |
->callback('callback::log_action_field');
|
||
|
||
$grid->field('table_name')
|
||
->label(__('Table'));
|
||
->label('Table');
|
||
|
||
$grid->callback_field('object_id')
|
||
->label('Object')
|
||
... | ... | |
$table, $object_id = null, $limit_results = 200,
|
||
$page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_view('Logs_Controller', 'logs'))
|
||
Controller::error(ACCESS);
|
||
|
||
if (!is_numeric($object_id) || !is_string($table))
|
||
... | ... | |
);
|
||
|
||
// create grid
|
||
$grid = new Grid(url_lang::base() . 'logs/show_all', '', array
|
||
$grid = new Grid('logs/show_all', '', array
|
||
(
|
||
'use_paginator' => true,
|
||
'use_selector' => true,
|
freenetis/branches/1.1/application/controllers/notifications.php | ||
---|---|---|
|
||
$filter_form->add('whitelisted')
|
||
->type('select')
|
||
->label(__('Whitelist'))
|
||
->values(array
|
||
(
|
||
Ip_address_Model::NO_WHITELIST => __('No whitelist'),
|
||
Ip_address_Model::PERNAMENT_WHITELIST => __('Permanent whitelist'),
|
||
Ip_address_Model::TEMPORARY_WHITELIST => __('Temporary whitelist')
|
||
));
|
||
->label('Whitelist')
|
||
->values(Ip_address_Model::get_whitelist_types());
|
||
|
||
$filter_form->add('balance')
|
||
->type('number');
|
||
... | ... | |
if (!$member || !$member->id)
|
||
Controller::error(RECORD);
|
||
|
||
$whitelist_array[Ip_address_Model::NO_WHITELIST] = __('No whitelist');
|
||
$whitelist_array[Ip_address_Model::PERNAMENT_WHITELIST] = __('Permanent whitelist');
|
||
$whitelist_array[Ip_address_Model::TEMPORARY_WHITELIST] = __('Temporary whitelist');
|
||
|
||
// form
|
||
$form = new Forge('notifications/set_whitelist/'.$member_id);
|
||
|
||
$form->dropdown('whitelist')
|
||
->options($whitelist_array);
|
||
->options(Ip_address_Model::get_whitelist_types());
|
||
|
||
$form->submit('Edit');
|
||
|
||
if ($form->validate())
|
||
{
|
||
if (!$this->acl_check_edit('Messages_Controller', 'member'))
|
||
Controller::error(ACCESS);
|
||
|
||
$form_data = $form->as_array();
|
||
$ip_model = new Ip_address_Model();
|
||
$ips = $ip_model->get_ip_addresses_of_member($member_id);
|
freenetis/branches/1.1/application/controllers/login_logs.php | ||
---|---|---|
$order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
// access
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_view('Login_logs_Controller', 'logs'))
|
||
Controller::error(ACCESS);
|
||
|
||
// filter
|
||
... | ... | |
Controller::error(RECORD);
|
||
|
||
// access
|
||
if (!$this->acl_check_view(get_class($this), 'users', $user->member_id) &&
|
||
!$this->acl_check_view('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_view('Login_logs_Controller', 'logs', $user->member_id))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
freenetis/branches/1.1/application/controllers/members.php | ||
---|---|---|
);
|
||
|
||
// delete user
|
||
$member->user->delete_depends_items($member->user->id);
|
||
$member->user->delete();
|
||
foreach ($member->users as $user)
|
||
{
|
||
$user->delete_depends_items($user->id);
|
||
$user->delete();
|
||
}
|
||
|
||
// delete account
|
||
$member->delete_accounts($member->id);
|
freenetis/branches/1.1/application/controllers/settings.php | ||
---|---|---|
->label('Self-registration')
|
||
->options(arr::bool())
|
||
->default(Settings::get('self_registration'));
|
||
|
||
// connection requests
|
||
$this->form->radio('connection_request_enable')
|
||
->label('Connection requests')
|
||
->options(arr::bool())
|
||
->default(Settings::get('connection_request_enable'));
|
||
|
||
// forgotten password
|
||
$this->form->radio('forgotten_password')
|
freenetis/branches/1.1/application/controllers/messages.php | ||
---|---|---|
if (!$this->acl_check_new('Messages_Controller', 'message'))
|
||
Controller::error(ACCESS);
|
||
|
||
// self cancel
|
||
$self_cancel[Message_Model::SELF_CANCEL_DISABLED] = __('Disabled');
|
||
$self_cancel[Message_Model::SELF_CANCEL_MEMBER] =
|
||
__('Possibility of canceling redirection to all IP addresses of member');
|
||
$self_cancel[Message_Model::SELF_CANCEL_IP] =
|
||
__('Possibility of canceling redirection to only current IP address');
|
||
|
||
$form = new Forge('messages/add');
|
||
|
||
$form->group('Basic information');
|
||
... | ... | |
|
||
$form->dropdown('self_cancel')
|
||
->label('User-cancelable')
|
||
->options($self_cancel)
|
||
->options(Message_Model::get_self_cancel_messages())
|
||
->selected(Message_Model::SELF_CANCEL_MEMBER)
|
||
->style('width: 600px');
|
||
|
||
... | ... | |
$sms_text = trim(text::cs_utf2ascii(strip_tags($form_data['sms_text'])));
|
||
$sms_text = empty($sms_text) ? NULL : $sms_text;
|
||
// set vars
|
||
$message->email_text = $email_text;
|
||
$message->email_text = empty($email_text) ? NULL : $email_text;
|
||
$message->sms_text = $sms_text;
|
||
$message->text = $form_data['text'];
|
||
|
||
$message->text = $form_data['text'];
|
||
unset($form_data);
|
||
|
||
if ($message->save())
|
||
... | ... | |
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('messages/show_all', 'Messages',
|
||
$this->acl_check_view(
|
||
'Redirection_Controller', 'redirection'
|
||
)
|
||
)
|
||
->disable_translation()
|
||
$this->acl_check_view('Redirection_Controller', 'redirection')
|
||
)->disable_translation()
|
||
->text($headline);
|
||
|
||
$view = new View('main');
|
||
... | ... | |
if (!$this->acl_check_edit('Messages_Controller', 'message'))
|
||
Controller::error(ACCESS);
|
||
|
||
// self cancel
|
||
$self_cancel[Message_Model::SELF_CANCEL_DISABLED] = __('Disabled');
|
||
$self_cancel[Message_Model::SELF_CANCEL_MEMBER] =
|
||
__('Possibility of canceling redirection to all IP addresses of member');
|
||
$self_cancel[Message_Model::SELF_CANCEL_IP] =
|
||
__('Possibility of canceling redirection to only current IP address');
|
||
|
||
$form = new Forge('messages/edit/'.$message_id);
|
||
|
||
$form->group('Basic information');
|
||
... | ... | |
->style('width: 600px');
|
||
}
|
||
|
||
if ($message->type == Message_Model::USER_MESSAGE ||
|
||
$message->type == Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE ||
|
||
$message->type == Message_Model::DEBTOR_MESSAGE ||
|
||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::UNALLOWED_CONNECTING_PLACE_MESSAGE)
|
||
if (Message_Model::is_self_cancable($message->type))
|
||
{
|
||
$form->dropdown('self_cancel')
|
||
->label(__('User-cancelable').
|
||
': '.help::hint('self_cancel'))
|
||
->options($self_cancel)
|
||
->label(__('User-cancelable').': '.help::hint('self_cancel'))
|
||
->options(Message_Model::get_self_cancel_messages())
|
||
->selected($message->self_cancel)
|
||
->style('width: 600px');
|
||
|
||
}
|
||
|
||
if (Message_Model::is_white_list_ignorable($message->type))
|
||
{
|
||
$form->dropdown('ignore_whitelist')
|
||
->label(__('Ignore whitelist').
|
||
': '.help::hint('ignore_whitelist'))
|
||
->label(__('Ignore whitelist').': '.help::hint('ignore_whitelist'))
|
||
->options(arr::rbool())
|
||
->selected($message->ignore_whitelist);
|
||
}
|
||
|
||
if ($message->type != Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE &&
|
||
$message->type != Message_Model::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$message->type != Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (Message_Model::has_redirection_content($message->type))
|
||
{
|
||
$form->html_textarea('text')
|
||
->label(__('Content of the message for redirection').': '.
|
||
... | ... | |
->value($message->text);
|
||
}
|
||
|
||
if ($message->type == Message_Model::USER_MESSAGE ||
|
||
$message->type == Message_Model::DEBTOR_MESSAGE ||
|
||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::APPLICANT_APPROVE_MEMBERSHIP ||
|
||
$message->type == Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (Message_Model::has_email_content($message->type))
|
||
{
|
||
$form->html_textarea('email_text')
|
||
->label(__('Content of the message for E-mail').': '.
|
||
... | ... | |
->rows(5)
|
||
->cols(100)
|
||
->value($message->email_text);
|
||
|
||
if ($message->type != Message_Model::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$message->type != Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
{
|
||
$form->textarea('sms_text')
|
||
->label(__('Content of the message for SMS').': '.
|
||
help::hint('content_of_message'))
|
||
->rules('length[1,760]')
|
||
->style('width: 100%; max-width: 633px; height: 150px')
|
||
->value($message->sms_text);
|
||
}
|
||
}
|
||
|
||
if (Message_Model::has_sms_content($message->type))
|
||
{
|
||
$form->textarea('sms_text')
|
||
->label(__('Content of the message for SMS').': '.
|
||
help::hint('content_of_message'))
|
||
->rules('length[1,760]')
|
||
->style('width: 100%; max-width: 633px; height: 150px')
|
||
->value($message->sms_text);
|
||
}
|
||
|
||
$form->submit('Edit');
|
||
|
||
if ($form->validate())
|
||
... | ... | |
$message->name = $form_data['name'];
|
||
}
|
||
|
||
if ($message->type == Message_Model::USER_MESSAGE ||
|
||
$message->type == Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE ||
|
||
$message->type == Message_Model::DEBTOR_MESSAGE ||
|
||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::UNALLOWED_CONNECTING_PLACE_MESSAGE)
|
||
if (Message_Model::is_self_cancable($message->type))
|
||
{
|
||
$message->self_cancel = htmlspecialchars($form_data['self_cancel']);
|
||
}
|
||
|
||
if (Message_Model::is_white_list_ignorable($message->type))
|
||
{
|
||
$message->ignore_whitelist = htmlspecialchars($form_data['ignore_whitelist']);
|
||
}
|
||
|
||
if ($message->type != Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE &&
|
||
$message->type != Message_Model::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$message->type != Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (Message_Model::has_redirection_content($message->type))
|
||
{
|
||
$message->text = $form_data['text'];
|
||
}
|
||
|
||
if ($message->type == Message_Model::USER_MESSAGE ||
|
||
$message->type == Message_Model::DEBTOR_MESSAGE ||
|
||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
|
||
$message->type == Message_Model::APPLICANT_APPROVE_MEMBERSHIP ||
|
||
$message->type == Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
if (Message_Model::has_email_content($message->type))
|
||
{
|
||
// email text
|
||
$email_text = trim($form_data['email_text']);
|
||
$email_text = empty($email_text) ? NULL : $email_text;
|
||
// set var
|
||
$message->email_text = $email_text;
|
||
|
||
if ($message->type != Message_Model::APPLICANT_APPROVE_MEMBERSHIP &&
|
||
$message->type != Message_Model::APPLICANT_REFUSE_MEMBERSHIP)
|
||
{
|
||
// sms text
|
||
$sms_text = trim(text::cs_utf2ascii(strip_tags($form_data['sms_text'])));
|
||
$sms_text = empty($sms_text) ? NULL : $sms_text;
|
||
// set var
|
||
$message->sms_text = $sms_text;
|
||
}
|
||
$message->email_text = empty($email_text) ? NULL : $email_text;
|
||
}
|
||
|
||
if (Message_Model::has_sms_content($message->type))
|
||
{
|
||
// sms text
|
||
$sms_text = trim(text::cs_utf2ascii(strip_tags($form_data['sms_text'])));
|
||
// set var
|
||
$message->sms_text = empty($sms_text) ? NULL : $sms_text;
|
||
}
|
||
|
Také k dispozici: Unified diff
Novinky:
- nedokoncena implementace #143:
-- fixes #341: Zpravy pro informaci o stavu zadosti
-- fixes #343: Uprava zpravy pro nezname zarizeni
-- #346: Formular pro zadani zadosti (nedokonceno)
-- #344: Rozhrani zobrazujici zadosti o pripojeni (nedokonceno)
- fixes #357: Samostatne ARO pro logy
Upravy:
- opravy a vylepseni ve zpravach pro upozorneni
Oprava:
- #384: chraneny ucet admina
- #383: mazani applikanta smaze uzivatele s ID 1