Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1795

Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)

Novinky:
- #344: implementace informacniho panelu

Upravy:
- vylepsen helper status

Zobrazit rozdíly:

freenetis/branches/1.1/application/i18n/cs_CZ/texts.php
'refresh interfaces of device' => 'Znovunačti rozhraní zařízení',
'reg' => 'Přih.',
'register' => 'Registrovat',
'register this connection' => 'zaregistrovat tuto přípojku',
'register to %s' => 'Registrovat na %s',
'registered' => 'Registrovaný',
'registered applicants' => 'Registrovaní zájemci',
freenetis/branches/1.1/application/i18n/cs_CZ/help.php
'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_info_short' => 'Pro připojení neregistrované přípojky/zařízení vyplňte prosím tento formulář.',
'connection_request_user_pre_info' => 'V naší síti není přípojka (zařízení), kterou aktuálně používáte, zaregistrována a tudíž z ní nebude povolen přístup na internet, přejete si %s?',
'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ů.',
......
'whitelist' => 'IP adresám, které jsou umístěny na bílé listině, je sice možné aktivovat přesměrování, ale nebudou odeslány na centrální router. Tedy nebudou přesměrovány, dokud nebudou odebrány z bílé listiny. Dočasná bílá listina se od trvalé liší v tom, že je pravidelně promazávána.',
'your mysql password' => 'Vaše MySQL heslo.',
'your mysql username' => 'Vaše MySQL uživatelské jméno.',
);
freenetis/branches/1.1/application/i18n/en_US/help.php
'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_info_short' => 'To connect unregistered connections/device please fill out this form.',
'connection_request_user_pre_info' => 'In our network the connection (device) that you are currently using is not registered and therefore it is not allowed to access the internet with it. Would you like to %s?',
'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.',
freenetis/branches/1.1/application/helpers/status.php
/**
* Helper for creating queue of status flash messages.
* Messages are stored into session var.
* Messages are stored into session var or in memory.
*
* @author Ondřej Fibich
* @package Helper
......
const TYPE_INFO = 3;
/** Session var name */
const SESSION_VAR_NAME = 'status_message';
/** Non-session storage */
private static $messages_in_mem = array();
/**
* CSS classes for message types
......
(
self::TYPE_SUCCESS => 'status_message_success',
self::TYPE_WARNING => 'status_message_warning',
self::TYPE_ERROR => 'status_message_error',
self::TYPE_ERROR => 'status_message_error',
self::TYPE_INFO => 'status_message_info',
);
......
*/
public static function success($message, $translate = TRUE, $args = array())
{
self::_add_message(self::TYPE_SUCCESS, $message, $translate, $args);
self::_add_message(TRUE, self::TYPE_SUCCESS, $message, $translate, $args);
}
/**
......
*/
public static function warning($message, $translate = TRUE, $args = array())
{
self::_add_message(self::TYPE_WARNING, $message, $translate, $args);
self::_add_message(TRUE, self::TYPE_WARNING, $message, $translate, $args);
}
/**
......
*/
public static function error($message, $translate = TRUE, $args = array())
{
self::_add_message(self::TYPE_ERROR, $message, $translate, $args);
self::_add_message(TRUE, self::TYPE_ERROR, $message, $translate, $args);
}
/**
* Adds success message to memory queue.
*
* @param string $message Info message
* @param string $translate Enable auto-translation of message
* @param array $args Arguments of message
*/
public static function msuccess($message, $translate = TRUE, $args = array())
{
self::_add_message(FALSE, self::TYPE_SUCCESS, $message, $translate, $args);
}
/**
* Adds warning message to memory queue.
*
* @param string $message Info message
* @param string $translate Enable auto-translation of message
* @param array $args Arguments of message
*/
public static function mwarning($message, $translate = TRUE, $args = array())
{
self::_add_message(FALSE, self::TYPE_WARNING, $message, $translate, $args);
}
/**
* Adds error message to memory queue.
*
* @param string $message Info message
* @param string $translate Enable auto-translation of message
* @param array $args Arguments of message
*/
public static function merror($message, $translate = TRUE, $args = array())
{
self::_add_message(FALSE, self::TYPE_ERROR, $message, $translate, $args);
}
/**
* Adds info message to queue.
......
* @param string $translate Enable auto-translation of message
* @param array $args Arguments of message
*/
public static function info($message, $translate = TRUE, $args = array())
public static function minfo($message, $translate = TRUE, $args = array())
{
self::_add_message(self::TYPE_INFO, $message, $translate, $args);
self::_add_message(FALSE, self::TYPE_INFO, $message, $translate, $args);
}
/**
......
$messages = self::_get_once();
$rendered_messages = '';
// session
foreach ($messages as $type => $message)
{
$class = @self::$css_classes[$type];
$rendered_messages .= "<div class=\"status-message $class\">$message</div>";
}
// memory
foreach (self::$messages_in_mem as $type => $message)
{
$class = @self::$css_classes[$type];
$rendered_messages .= "<div class=\"status-message $class\">$message</div>";
}
// clean mem
self::$messages_in_mem = array();
return $rendered_messages;
}
/**
* Adds message to session var in queue order
*
* @param boolean $session Store to session?
* @param integer $type Type of message (one of type constants)
* @param string $message Message to strore
* @param string $translate Enable auto-translation of message
* @param array $args Arguments of message
*/
private static function _add_message(
$type, $message, $translate = TRUE, $args = array())
$session, $type, $message, $translate = TRUE, $args = array())
{
if (!empty($message))
{
// translate if enabled
$message = ($translate) ? __($message, $args) : $message;
// merge old messages with new
$messages = self::_get_once() + array
(
$type => $message
);
// set message
Session::instance()->set_flash(self::SESSION_VAR_NAME, $messages);
$message = ($translate) ? __($message, $args) : $message;
// store
if ($session) // session
{
// merge old messages with new
$messages = self::_get_once() + array
(
$type => $message
);
// set message
Session::instance()->set_flash(self::SESSION_VAR_NAME, $messages);
}
else // memory
{
self::$messages_in_mem += array
(
$type => $message
);
}
}
}
freenetis/branches/1.1/application/models/subnet.php
return ORM::factory('ip_address')->get_gateway_of_subnet($subnet_id);
}
/**
* This method is used for determining whether the user is connected
* from registered connection. If he is the null is returned.
* If not then subnet from which he is connected is searched.
* If the user may obtain this IP from the searched subnet
* the ID of subnet is returned.
*
* @author Ondřej Fibich
* @param int $member_id User description
* @param string $ip_address IP address from which the connection request is made
* @return int|null Subnet ID or null if invalid request was made
*/
public function get_subnet_for_connection_request($member_id, $ip_address)
{
$result = $this->db->query("
SELECT s.id
FROM subnets s
LEFT JOIN ip_addresses ip ON ip.subnet_id = s.id AND
inet_aton(ip.ip_address) = inet_aton(?)
WHERE inet_aton(s.netmask) & inet_aton(?) = inet_aton(s.network_address)
", $ip_address, $ip_address);
return ($result->count() == 1 ? $result->current()->id : NULL);
}
}
freenetis/branches/1.1/application/libraries/MY_Controller.php
{
// helper class
$member = new Member_Model();
$ra_ip = server::remote_addr();
// boolean variable if user has any phone invoices (for menu rendering)
$phone_invoice_user = new Phone_invoice_user_Model();
$this->user_has_phone_invoices = (
$this->member_id != 1 &&
$this->member_id != Member_Model::ASSOCIATION &&
$phone_invoice_user->has_phone_invoices($this->user_id)
);
......
// gets account id of memeber
if ($this->acl_check_view('Accounts_Controller', 'transfers', $this->member_id) &&
$this->member_id != 1)
$this->member_id != Member_Model::ASSOCIATION)
{
$this->member_account_id = $member->get_first_member_account_id($this->member_id);
}
......
}
// ip address span
$this->ip_address_span = server::remote_addr();
$this->ip_address_span = $ra_ip;
// DZOLO (2011-09-05)
// This function is wery slow, when internet connection is off.
......
}
}
}
// connection request staff (#143)
if (Settings::get('connection_request_enable') &&
url_lang::current(2) != 'connection_requests/add')
{
$sid = ORM::factory('subnet')->get_subnet_for_connection_request(
$this->member_id, $ra_ip);
// can user make connection request for $ra_ip?
if ($sid)
{ // so we will inform him!
$url = '/connection_requests/add/' . $sid . '/' . $ra_ip;
$link = html::anchor($url, __('register this connection'));
$m = url_lang::lang('help.connection_request_user_pre_info', $link);
status::minfo($m, FALSE);
}
}
}

Také k dispozici: Unified diff