Revize c1bdc1c4
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/controllers/settings.php | ||
---|---|---|
{
|
||
|
||
private $links;
|
||
|
||
/**
|
||
* Definitions of modules and their dependencies
|
||
*
|
||
* @author Michal Kliment
|
||
* @var array
|
||
*/
|
||
public static $modules = array
|
||
(
|
||
'allowed_subnets' => array
|
||
(
|
||
'name' => 'allowed_subnets_enabled',
|
||
'dependencies' => array('notification', 'redirection')
|
||
),
|
||
'approval' => array
|
||
(
|
||
'name' => 'approval_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'connection_request' => array
|
||
(
|
||
'name' => 'connection_request_enable',
|
||
'dependencies' => array('networks'),
|
||
),
|
||
'email' => array
|
||
(
|
||
'name' => 'email_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'finance' => array
|
||
(
|
||
'name' => 'finance_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'forgotten_password' => array
|
||
(
|
||
'name' => 'forgotten_password',
|
||
'dependencies' => array('email')
|
||
),
|
||
'membership_interrupt' => array
|
||
(
|
||
'name' => 'membership_interrupt_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'monitoring' => array
|
||
(
|
||
'name' => 'monitoring_enabled',
|
||
'dependencies' => array('networks', 'email', 'notification')
|
||
),
|
||
'networks' => array
|
||
(
|
||
'name' => 'networks_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'notification' => array
|
||
(
|
||
'name' => 'notification_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'phone_invoices' => array
|
||
(
|
||
'name' => 'users_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'qos' => array
|
||
(
|
||
'name' => 'qos_enabled',
|
||
'dependencies' => array('networks')
|
||
),
|
||
'redirection' => array
|
||
(
|
||
'name' => 'redirection_enabled',
|
||
'dependencies' => array('networks', 'notification')
|
||
),
|
||
'self_registration' => array
|
||
(
|
||
'name' => 'self_registration',
|
||
'dependencies' => array()
|
||
),
|
||
'sms' => array
|
||
(
|
||
'name' => 'sms_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'snmp' => array
|
||
(
|
||
'name' => 'snmp_enabled',
|
||
'dependencies' => array('networks')
|
||
),
|
||
'cgi' => array
|
||
(
|
||
'name' => 'cgi_enabled',
|
||
'dependencies' => array('networks')
|
||
),
|
||
'ulogd' => array
|
||
(
|
||
'name' => 'ulogd_enabled',
|
||
'dependencies' => array('networks')
|
||
),
|
||
'users' => array
|
||
(
|
||
'name' => 'users_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'voip' => array
|
||
(
|
||
'name' => 'voip_enabled',
|
||
'dependencies' => array()
|
||
),
|
||
'vtiger' => array
|
||
(
|
||
'name' => 'vtiger_integration',
|
||
'dependencies' => array()
|
||
),
|
||
'works' => array
|
||
(
|
||
'name' => 'works_enabled',
|
||
'dependencies' => array('approval')
|
||
),
|
||
);
|
||
|
||
/**
|
||
* Test whether module is enabled
|
||
*
|
||
* @author Michal Kliment
|
||
* @param string $module
|
||
* @return boolean
|
||
* @throws Exception
|
||
*/
|
||
public static function isModuleEnabled($module)
|
||
{
|
||
if (isset(self::$modules[$module]['name']))
|
||
{
|
||
return Settings::get(self::$modules[$module]['name']);
|
||
}
|
||
else
|
||
{
|
||
throw new Exception('Unknown module: '.$module);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Disable given module
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $module
|
||
* @return type
|
||
* @throws Exception
|
||
*/
|
||
private static function disableModule($module)
|
||
{
|
||
if (isset(self::$modules[$module]['name']))
|
||
{
|
||
return Settings::set(self::$modules[$module]['name'], 0);
|
||
}
|
||
else
|
||
{
|
||
throw new Exception('Unknown module: '.$module);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Contruct of controller sets tabs names
|
||
... | ... | |
{
|
||
parent::__construct();
|
||
|
||
$this->sections = array
|
||
(
|
||
'info' => __('Info'),
|
||
'system' => __('System'),
|
||
'approval' => __('Approval'),
|
||
'email' => __('Email'),
|
||
'sms' => __('SMS'),
|
||
'voip' => __('VoIP'),
|
||
'notifications' => __('Notifications'),
|
||
'qos' => __('QoS'),
|
||
'monitoring' => __('Monitoring'),
|
||
'logging' => __('Logging'),
|
||
'registration_export' => __('Export of registration')
|
||
);
|
||
$this->sections = array();
|
||
|
||
if ($this->acl_check_view('Settings_Controller', 'info'))
|
||
$this->sections['info'] = __('Info');
|
||
|
||
if ($this->acl_check_edit('Settings_Controller', 'system_settings'))
|
||
$this->sections['system'] = __('System');
|
||
|
||
if ($this->acl_check_edit('Settings_Controller', 'users_settings'))
|
||
$this->sections['users'] = __('Users');
|
||
|
||
// are finance enabled
|
||
if (self::isModuleEnabled('finance') &&
|
||
$this->acl_check_edit('Settings_Controller', 'finance_settings'))
|
||
$this->sections['finance'] = __('Finance');
|
||
|
||
// is approval enabled
|
||
if (self::isModuleEnabled('approval') &&
|
||
$this->acl_check_edit('Settings_Controller', 'approval_settings'))
|
||
$this->sections['approval'] = __('Approval');
|
||
|
||
// are networks enabled
|
||
if (self::isModuleEnabled('networks') &&
|
||
$this->acl_check_edit('Settings_Controller', 'networks_settings'))
|
||
$this->sections['networks'] = __('Networks');
|
||
|
||
if (self::isModuleEnabled('email') &&
|
||
$this->acl_check_edit('Settings_Controller', 'email_settings'))
|
||
$this->sections['email'] = __('Email');
|
||
|
||
// are SMS enabled
|
||
if (self::isModuleEnabled('sms') &&
|
||
$this->acl_check_edit('Settings_Controller', 'sms_settings'))
|
||
$this->sections['sms'] = __('SMS');
|
||
|
||
// is voip enabled
|
||
if (self::isModuleEnabled('voip') &&
|
||
$this->acl_check_edit('Settings_Controller', 'voip_settings'))
|
||
$this->sections['voip'] = __('VoIP');
|
||
|
||
// is notification enabled
|
||
if (self::isModuleEnabled('notification') &&
|
||
$this->acl_check_edit('Settings_Controller', 'notification_settings'))
|
||
$this->sections['notifications'] = __('Notifications');
|
||
|
||
// is QoS enabled
|
||
if (self::isModuleEnabled('qos') &&
|
||
$this->acl_check_edit('Settings_Controller', 'qos_settings'))
|
||
$this->sections['qos'] = __('QoS');
|
||
|
||
// is monitoring enabled
|
||
if (self::isModuleEnabled('monitoring') &&
|
||
$this->acl_check_edit('Settings_Controller', 'monitoring_settings'))
|
||
$this->sections['monitoring'] = __('Monitoring');
|
||
|
||
// is vtiger integration enabled
|
||
if (self::isModuleEnabled('vtiger') &&
|
||
$this->acl_check_edit('Settings_Controller', 'vtiger_settings'))
|
||
$this->sections['vtiger'] = __('Vtiger');
|
||
|
||
if ($this->acl_check_edit('Settings_Controller', 'logging_settings'))
|
||
$this->sections['logging'] = __('Logging');
|
||
|
||
if (count($this->sections) <= 1)
|
||
$this->sections = NULL;
|
||
}
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
public function index()
|
||
{
|
||
$this->info();
|
||
if ($this->acl_check_view('Settings_Controller', 'info'))
|
||
$this->info();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'system_settings'))
|
||
$this->system();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'users_settings'))
|
||
$this->users();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'finance_settings'))
|
||
$this->finance();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'approval_settings'))
|
||
$this->approval();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'networks_settings'))
|
||
$this->networks();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'email_settings'))
|
||
$this->email();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'sms_settings'))
|
||
$this->sms();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'voip_settings'))
|
||
$this->voip();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'notification_settings'))
|
||
$this->notifications();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'qos_settings'))
|
||
$this->qos();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'monitoring_settings'))
|
||
$this->monitoring();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'vtiger_settings'))
|
||
$this->vtiger();
|
||
else if ($this->acl_check_edit('Settings_Controller', 'logging_settings'))
|
||
$this->logging();
|
||
else
|
||
Controller::error(ACCESS);
|
||
}
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
public function info()
|
||
{
|
||
if (!$this->acl_check_edit('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_view('Settings_Controller', 'info'))
|
||
Controller::error(ACCESS);
|
||
|
||
$data = array();
|
||
... | ... | |
}
|
||
|
||
$data[__('DB schema revision')] = Settings::get('db_schema_version');
|
||
$data[__('CRON state')] = module_state::get_state('cron');
|
||
$data[__('Redirection state')] = module_state::get_state('redirection');
|
||
$data[__('QoS state')] = module_state::get_state('qos');
|
||
$data[__('Monitoring state')] = module_state::get_state('monitoring');
|
||
$data[__('Logging state')] = module_state::get_state('logging');
|
||
$data[__('CRON state')] = module::get_state('cron');
|
||
|
||
// redirection is enabled
|
||
if (Settings::get('redirection_enabled'))
|
||
$data[__('Redirection state')] = module::get_state('redirection');
|
||
|
||
if (Settings::get('qos_enabled'))
|
||
$data[__('QoS state')] = module::get_state('qos');
|
||
|
||
if (Settings::get('monitoring_enabled'))
|
||
$data[__('Monitoring state')] = module::get_state('monitoring');
|
||
|
||
if (Settings::get('logging_enabled'))
|
||
$data[__('Logging state')] = module::get_state('logging');
|
||
|
||
if (Settings::get('allowed_subnets_enabled'))
|
||
$data[__('Allowed subnet state')] = module::get_state('allowed_subnets_update');
|
||
|
||
ob_start();
|
||
|
||
... | ... | |
public function system()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit('Settings_Controller', 'system'))
|
||
if (!$this->acl_check_edit('Settings_Controller', 'system_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge('settings/system');
|
||
|
||
$this->form->set_attr('id', 'settings-system-form');
|
||
|
||
$this->form->group('System variables');
|
||
|
||
... | ... | |
->options($countries)
|
||
->selected(Settings::get('default_country'))
|
||
->style('width:200px');
|
||
|
||
// currency
|
||
$this->form->input('currency')
|
||
->rules('length[3,40]|required')
|
||
->value(Settings::get('currency'));
|
||
|
||
$this->form->radio('grid_hide_on_first_load')
|
||
->label('Hide grid on its first load')
|
||
->options(arr::bool())
|
||
->default(Settings::get('grid_hide_on_first_load'))
|
||
->help('grid_hide_on_first_load');
|
||
|
||
$form_modules = array();
|
||
|
||
$this->form->group(__('Modules').' '.help::hint('modules'));
|
||
|
||
// self-registration
|
||
$this->form->radio('self_registration')
|
||
$form_modules['self_registration'] = $this->form->radio('self_registration')
|
||
->label('Self-registration')
|
||
->options(arr::bool())
|
||
->default(Settings::get('self_registration'));
|
||
|
||
// connection requests
|
||
$form_modules['connection_request'] = $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')
|
||
$form_modules['forgotten_password'] = $this->form->radio('forgotten_password')
|
||
->label('Forgotten password')
|
||
->options(arr::bool())
|
||
->default(Settings::get('forgotten_password'));
|
||
|
||
// membership interrupts
|
||
$form_modules['membership_interrupt'] = $this->form->radio('membership_interrupt_enabled')
|
||
->label('Membership interrupt')
|
||
->options(arr::bool())
|
||
->default(Settings::get('membership_interrupt_enabled'));
|
||
|
||
// finance
|
||
$form_modules['finance'] = $this->form->radio('finance_enabled')
|
||
->label('Finance')
|
||
->options(arr::bool())
|
||
->default(Settings::get('finance_enabled'));
|
||
|
||
// approval
|
||
$form_modules['approval'] = $this->form->radio('approval_enabled')
|
||
->label('Approval')
|
||
->options(arr::bool())
|
||
->default(Settings::get('approval_enabled'));
|
||
|
||
// Works
|
||
$form_modules['works'] = $this->form->radio('works_enabled')
|
||
->label('Works')
|
||
->options(arr::bool())
|
||
->default(Settings::get('works_enabled'));
|
||
|
||
// Phone invoice
|
||
$form_modules['phone_invoices'] = $this->form->radio('phone_invoices_enabled')
|
||
->label('Phone invoices')
|
||
->options(arr::bool())
|
||
->default(Settings::get('phone_invoices_enabled'));
|
||
|
||
// e-mail
|
||
$form_modules['email'] = $this->form->radio('email_enabled')
|
||
->label('E-mail')
|
||
->options(arr::bool())
|
||
->default(Settings::get('email_enabled'));
|
||
|
||
// SMS
|
||
$form_modules['sms'] = $this->form->radio('sms_enabled')
|
||
->label('SMS')
|
||
->options(arr::bool())
|
||
->default(Settings::get('sms_enabled'));
|
||
|
||
// VoIP
|
||
$form_modules['voip'] = $this->form->radio('voip_enabled')
|
||
->label('VoIP')
|
||
->options(arr::bool())
|
||
->default(Settings::get('voip_enabled'));
|
||
|
||
// Network
|
||
$form_modules['networks'] = $this->form->radio('networks_enabled')
|
||
->label('Networks')
|
||
->options(arr::bool())
|
||
->default(Settings::get('networks_enabled'));
|
||
|
||
// SNMP
|
||
$form_modules['snmp'] = $this->form->radio('snmp_enabled')
|
||
->label('SNMP')
|
||
->options(arr::bool())
|
||
->default(Settings::get('snmp_enabled'));
|
||
|
||
// CGI
|
||
$form_modules['cgi'] = $this->form->radio('cgi_enabled')
|
||
->label('CGI scripts')
|
||
->options(arr::bool())
|
||
->default(Settings::get('cgi_enabled'));
|
||
|
||
// QoS
|
||
$form_modules['qos'] = $this->form->radio('qos_enabled')
|
||
->label('QoS')
|
||
->options(arr::bool())
|
||
->default(Settings::get('qos_enabled'));
|
||
|
||
// Monitoring
|
||
$form_modules['monitoring'] = $this->form->radio('monitoring_enabled')
|
||
->label('Monitoring')
|
||
->options(arr::bool())
|
||
->default(Settings::get('monitoring_enabled'));
|
||
|
||
// Redirection
|
||
$form_modules['redirection'] = $this->form->radio('redirection_enabled')
|
||
->label('Redirection')
|
||
->options(arr::bool())
|
||
->default(Settings::get('redirection_enabled'));
|
||
|
||
// Notification
|
||
$form_modules['notification'] = $this->form->radio('notification_enabled')
|
||
->label('Notifications')
|
||
->options(arr::bool())
|
||
->default(Settings::get('notification_enabled'));
|
||
|
||
$this->form->group('E-mail settings');
|
||
// vtiger CRM integration
|
||
$form_modules['vtiger'] = $this->form->radio('vtiger_integration')
|
||
->label('Vtiger integration')
|
||
->options(arr::bool())
|
||
->default(Settings::get('vtiger_integration'));
|
||
|
||
// add info about modules dependencies
|
||
foreach ($form_modules as $module => $item)
|
||
{
|
||
// module have at least one dependency
|
||
if (count(self::$modules[$module]['dependencies']))
|
||
{
|
||
$form_modules[$module]->additional_info(
|
||
__('Require module') . ': <b>' .
|
||
implode(', ', array_map(
|
||
'__', self::$modules[$module]['dependencies'])
|
||
) . '</b>'
|
||
);
|
||
}
|
||
}
|
||
|
||
$this->form->input('email_default_email')
|
||
->label('Default e-mail')
|
||
->rules('length[3,100]|valid_email')
|
||
->value(Settings::get('email_default_email'));
|
||
$this->form->group('Module settings');
|
||
|
||
$timeout = Settings::get('module_status_timeout');
|
||
|
||
$this->form->input('module_status_timeout')
|
||
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->value($timeout)
|
||
->style('width:30px')
|
||
->help('Time threshold in minutes, before module is shown as inactive');
|
||
|
||
$this->form->group(__('URL settings') . ' ' . help::hint('url_settings'));
|
||
|
||
$this->form->dropdown('protocol')
|
||
->rules('length[3,100]')
|
||
->rules('required|length[3,100]')
|
||
->options(array
|
||
(
|
||
'http' => 'http',
|
||
... | ... | |
|
||
$this->form->input('domain')
|
||
->rules('required|length[3,100]')
|
||
->callback(array($this, 'valid_domain'))
|
||
->value(url::domain());
|
||
|
||
$this->form->input('suffix')
|
||
->rules('required|valid_suffix')
|
||
->rules('required')
|
||
->callback(array($this, 'valid_suffix'))
|
||
->value(url::suffix());
|
||
|
||
$this->form->group(__('Address points'));
|
||
|
||
$this->form->input('address_point_url')
|
||
->label('Address point URL')
|
||
->help('address_point_url')
|
||
->value(Settings::get('address_point_url'));
|
||
|
||
$selected_countries = ORM::factory('country')->select('id')->where('enabled', 1)->find_all()->as_array();
|
||
|
||
$this->form->dropdown('enabled_countries[]')
|
||
->label('Enabled countries')
|
||
->options($countries)
|
||
->selected($selected_countries)
|
||
->multiple('multiple')
|
||
->size(10);
|
||
|
||
// load .htaccess sample file
|
||
if (($htaccessFile = @file('.htaccess-sample')) != FALSE)
|
||
... | ... | |
->help($help);
|
||
}
|
||
}
|
||
|
||
$this->form->group('Network settings');
|
||
|
||
$this->form->textarea('address_ranges')
|
||
->help('address_ranges')
|
||
->rules('valid_address_ranges')
|
||
->value(str_replace(",","\n", Settings::get('address_ranges')))
|
||
->class('autosize');
|
||
|
||
$this->form->group('Module settings');
|
||
|
||
$timeout = Settings::get('module_status_timeout');
|
||
|
||
$this->form->input('module_status_timeout')
|
||
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->value($timeout)
|
||
->help('Time threshold in minutes, before module is shown as inactive');
|
||
|
||
|
||
$this->form->submit('Save');
|
||
|
||
... | ... | |
{
|
||
$form_data = $this->form->as_array();
|
||
|
||
$issaved = true;
|
||
$issaved = TRUE;
|
||
$message = '';
|
||
|
||
$issaved = $issaved && ORM::factory('country')->enable_countries($form_data['enabled_countries']);
|
||
|
||
unset($form_data['enabled_countries']);
|
||
|
||
// write suffix to .htaccess
|
||
if (!file_exists('.htaccess'))
|
||
{
|
||
$htaccess = '.htaccess-sample';
|
||
}
|
||
else
|
||
{
|
||
$htaccess = '.htaccess';
|
||
}
|
||
|
||
if (is_writable('.') || (file_exists('.htaccess') && is_writable('.htaccess')))
|
||
{
|
||
// load .htaccess file
|
||
$htaccessFile = @file($htaccess);
|
||
|
||
if ($htaccessFile)
|
||
{
|
||
foreach ($htaccessFile as $line_num => $line)
|
||
{
|
||
// find line with RewriteBase
|
||
if (preg_match("/^RewriteBase (.+)/", $line))
|
||
{
|
||
// and set there our suffix (subdirectory)
|
||
$htaccessFile[$line_num] = preg_replace(
|
||
"/^(RewriteBase )(.+)/",
|
||
'${1}/'.trim($form_data['suffix'], " /").'/', $line
|
||
);
|
||
}
|
||
}
|
||
|
||
$handle = @fopen('.htaccess', 'w');
|
||
|
||
if ($handle)
|
||
{
|
||
foreach($htaccessFile as $line)
|
||
{
|
||
@fwrite($handle, $line);
|
||
}
|
||
|
||
@fclose($handle);
|
||
}
|
||
else
|
||
{
|
||
$issaved = FALSE;
|
||
$message = __('Cannot open %s for writing', '.htaccess');
|
||
|
||
// if not saved to htaccess do not save to database
|
||
unset($form_data['suffix']);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$issaved = FALSE;
|
||
$message = __('Failed to read from %s', '.htaccess');
|
||
|
||
// if not saved to htaccess do not save to database
|
||
unset($form_data['suffix']);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$issaved = FALSE;
|
||
$message = __('File %s does not exists and cannot be created', '.htaccess');
|
||
|
||
// if not saved to htaccess do not save to database
|
||
unset($form_data['suffix']);
|
||
}
|
||
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
if ($name == 'module_status_timeout')
|
||
{
|
||
$value = max($value, 1);
|
||
}
|
||
else if ($name == 'address_ranges')
|
||
else if ($name == 'security_password_length')
|
||
{
|
||
$value = str_replace("\n", ",", $value);
|
||
$value = min(50, max(1, $value)); // <1..50>
|
||
}
|
||
|
||
$issaved = $issaved && Settings::set($name, $value);
|
||
}
|
||
|
||
foreach (self::$modules as $module => $module_info)
|
||
{
|
||
foreach ($module_info['dependencies'] as $dependency)
|
||
{
|
||
if (self::isModuleEnabled($module) && !self::isModuleEnabled($dependency))
|
||
{
|
||
status::error(__('Cannot enable module %s, enabled module %s is required.', array($module, $dependency)));
|
||
self::disableModule($module);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if ($issaved)
|
||
// if all action were succesfull
|
||
{
|
||
... | ... | |
// if not
|
||
{
|
||
status::error(
|
||
__('System variables havent been successfully updated.').
|
||
'<br />' . $message, FALSE
|
||
__('System variables havent been updated.').
|
||
'<br />' . $message, NULL, FALSE
|
||
);
|
||
}
|
||
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Settings of users variables
|
||
*
|
||
* @author Michal Kliment
|
||
*/
|
||
public function users()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit('Settings_Controller', 'users_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge();
|
||
|
||
$this->form->group('Members');
|
||
|
||
$this->form->checkbox('former_member_auto_device_remove')
|
||
->label('Enable automatical deletion of devices of former members')
|
||
->checked(Settings::get('former_member_auto_device_remove'));
|
||
|
||
$this->form->group('Security');
|
||
|
||
$this->form->input('security_password_length')
|
||
->label('Minimal password length')
|
||
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->style('width:30px')
|
||
->value(Settings::get('security_password_length'));
|
||
|
||
$pass_levels = array
|
||
(
|
||
1 => __('very weak'),
|
||
2 => __('weak'),
|
||
3 => __('good'),
|
||
4 => __('strong'),
|
||
);
|
||
|
||
$this->form->dropdown('security_password_level')
|
||
->options($pass_levels)
|
||
->label('Minimal password level')
|
||
->rules('required')
|
||
->selected(Settings::get('security_password_level'));
|
||
|
||
|
||
if (Settings::get('membership_interrupt_enabled'))
|
||
{
|
||
$this->form->group('Membership interrupt');
|
||
|
||
$this->form->input('membership_interrupt_minimum')
|
||
->label('Minimum membership interrupt period (months)')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('membership_interrupt_minimum'));
|
||
|
||
$this->form->input('membership_interrupt_maximum')
|
||
->label('Maximum membership interrupt period (months)')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('membership_interrupt_maximum'));
|
||
}
|
||
|
||
if (Settings::get('self_registration'))
|
||
{
|
||
$this->form->group('Applicant for membership');
|
||
|
||
$this->form->checkbox('self_registration_enable_approval_without_registration')
|
||
->label('Enable approval of membership without submited registration')
|
||
->checked(Settings::get('self_registration_enable_approval_without_registration'));
|
||
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
$this->form->checkbox('self_registration_enable_additional_payment')
|
||
->label('Enable additional member fee during the approval of membership')
|
||
->checked(Settings::get('self_registration_enable_additional_payment'));
|
||
}
|
||
}
|
||
|
||
$this->form->group('Export of registration');
|
||
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
$bank_account = new Bank_account_Model();
|
||
$concat = "CONCAT(account_nr, '/', bank_nr, IF(name IS NULL, '', CONCAT(' - ', name)))";
|
||
|
||
$this->form->dropdown('export_header_bank_account')
|
||
->label('Bank account')
|
||
->options($bank_account->where('member_id', Member_Model::ASSOCIATION)->select_list('id', $concat))
|
||
->selected(Settings::get('export_header_bank_account'))
|
||
->rules('required');
|
||
}
|
||
|
||
// directory is writable
|
||
if (is_writable('upload'))
|
||
{
|
||
$additional_info = '';
|
||
$logo = Settings::get('registration_logo');
|
||
|
||
if (file_exists($logo))
|
||
{
|
||
$additional_info = '<img src="'. url_lang::base().'export/logo" style="margin-left:10%;height:50px;vertical-align:middle"/>';
|
||
}
|
||
|
||
$this->form->upload('registration_logo')
|
||
->label('Logo')
|
||
->rules('allow[jpg]')
|
||
->new_name('registration_logo.jpg')
|
||
->help(help::hint('registration_logo'))
|
||
->additional_info($additional_info);
|
||
}
|
||
|
||
$this->form->html_textarea('registration_info')
|
||
->label('Info')
|
||
->rows(5)
|
||
->cols(100)
|
||
->value(Settings::get('registration_info'));
|
||
|
||
$this->form->html_textarea('registration_license')
|
||
->label('License')
|
||
->rows(5)
|
||
->cols(100)
|
||
->value(Settings::get('registration_license'));
|
||
|
||
$this->form->submit('Save');
|
||
|
||
// form validate
|
||
if ($this->form->validate())
|
||
{
|
||
$form_data = $this->form->as_array(FALSE);
|
||
|
||
$issaved = true;
|
||
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
$issaved = $issaved && Settings::set($name, $value);
|
||
}
|
||
|
||
if ($issaved)
|
||
// if all action were succesfull
|
||
{
|
||
status::success('System variables have been successfully updated.');
|
||
}
|
||
else
|
||
// if not
|
||
{
|
||
status::error('System variables havent been successfully updated.');
|
||
}
|
||
|
||
url::redirect('settings/users');
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Settings') . ' - ' . __('Users');
|
||
$view->content = new View('settings/main');
|
||
$view->content->current = 'users';
|
||
$view->content->content = $this->form->html();
|
||
$view->content->headline = __('Users');
|
||
|
||
// directory is not writable
|
||
if (!is_writable('upload'))
|
||
{
|
||
$view->content->warning = __(
|
||
'Directory "upload" is not writable, change access ' .
|
||
'rights to be able upload your own logo.'
|
||
);
|
||
}
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Settings of finance variables
|
||
*
|
||
* @author Ondrej Fibich
|
||
*/
|
||
public function finance()
|
||
{
|
||
// access control
|
||
if (!module::e('finance') ||
|
||
!$this->acl_check_edit('Settings_Controller', 'finance_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge();
|
||
|
||
$this->form->group('Finance settings');
|
||
|
||
$this->form->input('currency')
|
||
->rules('length[3,40]|required')
|
||
->value(Settings::get('currency'));
|
||
|
||
$this->form->group('Automatic actions');
|
||
|
||
$deduct_day = Settings::get('deduct_day');
|
||
|
||
$this->form->checkbox('deduct_fees_automatically_enabled')
|
||
->value('1')
|
||
->checked(Settings::get('deduct_fees_automatically_enabled'))
|
||
->label(__('Deduct fees automatically') . ' ' .
|
||
help::hint('deduct_fees_automatically_enabled', $deduct_day));
|
||
|
||
$this->form->group('Variable symbol settings');
|
||
|
||
$this->form->dropdown('variable_key_generator_id')
|
||
->options(array(NULL => '') + Variable_Key_Generator::get_drivers_for_dropdown())
|
||
->label('Algorithm for generation of variable symbols')
|
||
->selected(Variable_Key_Generator::get_active_driver())
|
||
->style('width:200px');
|
||
|
||
$this->form->submit('Save');
|
||
|
||
// form validate
|
||
if ($this->form->validate())
|
||
{
|
||
$form_data = $this->form->as_array(FALSE);
|
||
|
||
$issaved = true;
|
||
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
$issaved = $issaved && Settings::set($name, $value);
|
||
}
|
||
|
||
if ($issaved)
|
||
// if all action were succesfull
|
||
{
|
||
status::success('System variables have been successfully updated.');
|
||
}
|
||
else
|
||
// if not
|
||
{
|
||
status::error('System variables havent been successfully updated.');
|
||
}
|
||
|
||
url::redirect('settings/finance');
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Settings') . ' - ' . __('Finance');
|
||
$view->content = new View('settings/main');
|
||
$view->content->current = 'finance';
|
||
$view->content->content = $this->form->html();
|
||
$view->content->headline = __('Finance');
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Settings for QoS
|
||
*/
|
||
public function qos()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit('Settings_Controller', 'system'))
|
||
if (!module::e('qos') ||
|
||
!$this->acl_check_edit('Settings_Controller', 'qos_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge('settings/qos');
|
||
|
||
$this->form->group('Variables for QoS');
|
||
|
||
$this->form->checkbox('qos_enabled')
|
||
->value('1')
|
||
->label('Enable QoS');
|
||
|
||
if (Settings::get('qos_enabled') == 1)
|
||
$this->form->qos_enabled->checked('checked');
|
||
|
||
$this->form->input('qos_total_speed')
|
||
->rules('valid_speed_size')
|
||
... | ... | |
$view->content->current = 'qos';
|
||
$view->content->content = $this->form->html();
|
||
$view->content->headline = __('QoS');
|
||
$view->content->description = module_state::get_state('qos', TRUE);
|
||
$view->content->description = module::get_state('qos', TRUE);
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
... | ... | |
public function email()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit('Settings_Controller', 'system'))
|
||
if (!module::e('email') ||
|
||
!$this->acl_check_edit('Settings_Controller', 'email_settings'))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge('settings/email');
|
||
|
||
$this->form->group('E-mail settings');
|
||
|
||
$this->form->input('email_default_email')
|
||
->label('Default e-mail')
|
||
->rules('length[3,100]|valid_email')
|
||
->value(Settings::get('email_default_email'));
|
||
|
||
$this->form->group('E-mail variables');
|
||
|
||
$this->form->dropdown('email_driver')
|
||
... | ... | |
$this->form->input('email_hostname')
|
||
->label('Hostname')
|
||
->value(Settings::get('email_hostname'))
|
||
->help('For SMTP settings only.');
|
||
->help(__('For SMTP settings only.'));
|
||
|
||
$this->form->input('email_port')
|
||
->label('Port')
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('email_port'))
|
||
->help('For SMTP settings only.');
|
||
->help(__('For SMTP settings only.'));
|
||
|
||
$this->form->input('email_username')
|
||
->label('User name')
|
||
->value(Settings::get('email_username'))
|
||
->help('For SMTP settings only.');
|
||
->help(__('For SMTP settings only.'));
|
||
|
||
$this->form->input('email_password')
|
||
->label('Password')
|
||
->value(Settings::get('email_password'))
|
||
->help('For SMTP settings only.');
|
||
->help(__('For SMTP settings only.'));
|
||
|
||
$this->form->submit('Save');
|
||
|
||
... | ... | |
public function approval()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit('Settings_Controller', 'system'))
|
||
if (!module::e('approval') ||
|
||
!$this->acl_check_edit('Settings_Controller', 'approval_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
$approval_templates = ORM::factory('approval_template')->select_list('id', 'name');
|
||
|
||
$arr_approval_templates = array
|
||
(
|
||
NULL => '----- ' . __('Select approval template') . ' -----'
|
||
) + $approval_templates;
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge('settings/approval');
|
||
|
||
$this->form->group('Work');
|
||
|
||
$this->form->dropdown('default_work_approval_template')
|
||
->label('Default approval template')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_work_approval_template'))
|
||
->rules('required');
|
||
|
||
$this->form->group('Work report');
|
||
|
||
$this->form->dropdown('default_work_report_approval_template')
|
||
->label('Default approval template')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_work_report_approval_template'))
|
||
->rules('required');
|
||
|
||
$this->form->group('Request');
|
||
|
||
$this->form->dropdown('default_request_approval_template')
|
||
->label('Default approval template')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_request_approval_template'))
|
||
->rules('required');
|
||
$arr_approval_templates = array
|
||
(
|
||
NULL => '----- ' . __('Select approval template') . ' -----'
|
||
) + $approval_templates;
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge('settings/approval');
|
||
|
||
if (Settings::get('works_enabled'))
|
||
{
|
||
$this->form->group('Work');
|
||
|
||
$this->form->dropdown('default_work_approval_template')
|
||
->label('Default approval template')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_work_approval_template'))
|
||
->rules('required');
|
||
|
||
$this->form->group('Work report');
|
||
|
||
$this->form->dropdown('default_work_report_approval_template')
|
||
->label('Default approval template')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_work_report_approval_template'))
|
||
->rules('required');
|
||
}
|
||
|
||
$this->form->group('Request');
|
||
|
||
$this->form->dropdown('default_request_approval_template')
|
||
->label('Default approval template for "proposals to association"')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_request_approval_template'))
|
||
->rules('required');
|
||
|
||
$this->form->dropdown('default_request_support_approval_template')
|
||
->label('Default approval template for "support requests"')
|
||
->options($arr_approval_templates)
|
||
->selected(Settings::get('default_request_support_approval_template'))
|
||
->rules('required');
|
||
|
||
|
||
$this->form->submit('Save');
|
||
|
||
if ($this->form->validate())
|
||
{
|
||
$form_data = $this->form->as_array(FALSE);
|
||
$issaved = true;
|
||
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
$issaved = $issaved && Settings::set($name, $value);
|
||
}
|
||
|
||
if ($issaved)
|
||
{
|
||
status::success('System variables have been successfully updated.');
|
||
}
|
||
else
|
||
{
|
||
status::error('System variables havent been successfully updated.');
|
||
}
|
||
|
||
url::redirect('settings/approval');
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Settings') . ' - ' . __('Approval');
|
||
$view->content = new View('settings/main');
|
||
$view->content->current = 'approval';
|
||
$view->content->headline = __('Approval');
|
||
$view->content->link_back = $this->links;
|
||
$view->content->content = $this->form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Networks settings
|
||
*/
|
||
public function networks()
|
||
{
|
||
// access control
|
||
if (!module::e('networks') ||
|
||
!$this->acl_check_edit('Settings_Controller', 'networks_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge();
|
||
|
||
$this->form->group('Network settings');
|
||
|
||
$this->form->textarea('address_ranges')
|
||
->help('address_ranges')
|
||
->rules('valid_address_ranges')
|
||
->value(str_replace(",","\n", Settings::get('address_ranges')))
|
||
->class('autosize');
|
||
|
||
$this->form->textarea('dns_servers')
|
||
->help('dns_servers')
|
||
->rules('valid_ip_address')
|
||
->value(str_replace(",","\n", Settings::get('dns_servers')))
|
||
->class('autosize');
|
||
|
||
$this->form->input('dhcp_server_reload_timeout')
|
||
->label('DHCP server maximal timeout')
|
||
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->value(Settings::get('dhcp_server_reload_timeout'))
|
||
->style('width:50px')
|
||
->help('dhcp_server_reload_timeout');
|
||
|
||
if (Settings::get('connection_request_enable'))
|
||
{
|
||
$this->form->group('Connection requests');
|
||
|
||
// enum types for device
|
||
$enum_type_model = new Enum_type_Model();
|
||
$types = $enum_type_model->get_values(Enum_type_Model::DEVICE_TYPE_ID);
|
||
|
||
$allowed_types = explode(':', Settings::get('connection_request_device_types'));
|
||
$default_types = $types;
|
||
|
||
// throw away unallowed types
|
||
if (Settings::get('connection_request_device_types'))
|
||
{
|
||
foreach ($default_types as $key => $val)
|
||
{
|
||
if (array_search($key, $allowed_types) === FALSE)
|
||
{
|
||
unset($default_types[$key]);
|
||
}
|
||
}
|
||
}
|
||
|
||
$default_types[NULL] = '--- ' . __('Select type') . ' ---';
|
||
asort($default_types);
|
||
|
||
$this->form->dropdown('connection_request_device_default_type')
|
||
->label('Default device type')
|
||
->options($default_types)
|
||
->selected(Settings::get('connection_request_device_default_type'))
|
||
->style('width:200px');
|
||
|
||
$this->form->dropdown('connection_request_device_types[]')
|
||
->label('Allowed device types')
|
||
->options($types)
|
||
->selected($allowed_types)
|
||
->multiple('multiple')
|
||
->size(10);
|
||
|
||
$this->form->html_textarea('connection_request_info')
|
||
->label('Add form information')
|
||
->help(help::hint('connection_request_info_form'))
|
||
->rows(5)
|
||
->cols(100)
|
||
->value(Settings::get('connection_request_info'));
|
||
}
|
||
|
||
$this->form->group('Other settings');
|
||
|
||
$this->form->checkbox('device_add_auto_link_enabled')
|
||
->label('Enable automatic loading of "connected to" field during adding of device')
|
||
->checked(Settings::get('device_add_auto_link_enabled'));
|
||
|
||
// CGI scripts
|
||
if (module::e('cgi'))
|
||
{
|
||
$this->form->group('CGI scripts');
|
||
|
||
$this->form->input('cgi_arp_url')
|
||
->label('URL for ARP table')
|
||
->value(Settings::get('cgi_arp_url'))
|
||
->style('width: 400px');
|
||
}
|
||
|
||
$this->form->submit('Save');
|
||
|
||
... | ... | |
|
||
foreach ($form_data as $name => $value)
|
||
{
|
||
if ($name == 'address_ranges')
|
||
{
|
||
$value = str_replace("\n", ",", $value);
|
||
}
|
||
else if ($name == 'connection_request_device_types')
|
||
{
|
||
$value = empty($value) ? '' : implode(':', $value);
|
||
}
|
||
else if ($name == 'dns_servers')
|
||
{
|
||
$old_value = Settings::get('dns_servers');
|
||
// expire DHCP? (#472)
|
||
if (trim($value) != trim($old_value))
|
||
{
|
||
ORM::factory('subnet')->set_expired_all_subnets();
|
||
}
|
||
}
|
||
|
||
$issaved = $issaved && Settings::set($name, $value);
|
||
}
|
||
|
||
... | ... | |
status::error('System variables havent been successfully updated.');
|
||
}
|
||
|
||
url::redirect('settings/approval');
|
||
url::redirect('settings/networks');
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Settings') . ' - ' . __('Approval');
|
||
$view->title = __('Settings') . ' - ' . __('Networks');
|
||
$view->content = new View('settings/main');
|
||
$view->content->current = 'approval';
|
||
$view->content->headline = __('Approval');
|
||
$view->content->current = 'networks';
|
||
$view->content->headline = __('Networks');
|
||
$view->content->link_back = $this->links;
|
||
$view->content->content = $this->form->html();
|
||
$view->render(TRUE);
|
||
... | ... | |
public function voip()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit(get_class($this), 'system'))
|
||
if (!module::e('voip') ||
|
||
!$this->acl_check_edit(get_class($this), 'voip_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
... | ... | |
status::error(__(
|
||
'Cannot enable VoIP driver, allow `%s` rights for MySQL user',
|
||
array('CREATE ROUTINE')
|
||
) . '.', FALSE);
|
||
) . '.',NULL, FALSE);
|
||
}
|
||
else if ($issaved)
|
||
{
|
||
... | ... | |
public function sms()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit(get_class($this), 'system'))
|
||
if (!module::e('sms') ||
|
||
!$this->acl_check_edit(get_class($this), 'sms_settings'))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
||
... | ... | |
|
||
/* Build form */
|
||
|
||
$this->form->group(Sms::get_driver_name($key));
|
||
$this->form->group(Sms::get_driver_name($key, TRUE));
|
||
|
||
$this->form->dropdown('sms_driver_state' . $key)
|
||
->label('Driver state')
|
||
... | ... | |
{
|
||
$this->form->dropdown('sms_test_mode' . $key)
|
||
->label(__('Test mode') . ':')
|
||
->help(__('SMS will not be send if test mode is enabled, ' .
|
||
'driver will only try to send them'))
|
||
->options(arr::rbool())
|
||
->selected(Settings::get('sms_test_mode' . $key));
|
||
}
|
||
... | ... | |
public function notifications()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit('Messages_Controller', 'message'))
|
||
if (!self::isModuleEnabled('notification') ||
|
||
!$this->acl_check_edit('Settings_Controller', 'notification_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
... | ... | |
->rules('required|valid_numeric')
|
||
->value(Settings::get('initial_debtor_immunity'));
|
||
|
||
$this->form->group('Redirection');
|
||
|
||
$this->form->input('gateway')
|
||
->label(__('Gateway IP address').":")
|
||
->value(Settings::get('gateway'));
|
||
|
||
$this->form->input('redirection_port_self_cancel')
|
||
->label(__('Port for self-canceling').": ".help::hint('redirection_port_self_cancel'))
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('redirection_port_self_cancel'));
|
||
if (Settings::get('self_registration'))
|
||
{
|
||
$this->form->input('applicant_connection_test_duration')
|
||
->label('Test connection duration')
|
||
->help(help::hint('applicant_connection_test_duration'))
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('applicant_connection_test_duration'));
|
||
}
|
||
|
||
// directory is writable
|
||
if (is_writable('upload'))
|
||
// redirection is enabled
|
||
if (Settings::get('redirection_enabled'))
|
||
{
|
||
$additional_info = '';
|
||
$logo = Settings::get('redirection_logo_url');
|
||
|
||
if (file_exists($logo))
|
||
$this->form->group('Redirection');
|
||
|
||
$this->form->input('gateway')
|
||
->label(__('Gateway IP address').":")
|
||
->value(Settings::get('gateway'));
|
||
|
||
$this->form->input('redirection_port_self_cancel')
|
||
->label(__('Port for self-canceling').": ".help::hint('redirection_port_self_cancel'))
|
||
->rules('valid_numeric')
|
||
->value(Settings::get('redirection_port_self_cancel'));
|
||
|
||
// directory is writable
|
||
if (is_writable('upload'))
|
||
{
|
||
$additional_info = '<img src="'. url_lang::base().'redirect/logo" style="margin-left:10%;height:49px;vertical-align:middle"/>';
|
||
$additional_info = '';
|
||
$logo = Settings::get('redirection_logo_url');
|
||
|
||
if (file_exists($logo))
|
||
{
|
||
$additional_info = '<img src="'. url_lang::base().'redirect/logo" style="margin-left:10%;height:49px;vertical-align:middle"/>';
|
||
}
|
||
|
||
$this->form->upload('redirection_logo_url')
|
||
->label('Redirection logo URL')
|
||
->rules('allow[jpg,png]')
|
||
->new_name('redirection_logo.jpg')
|
||
->help(help::hint('redirection_logo'))
|
||
->additional_info($additional_info);
|
||
}
|
||
|
||
$this->form->input('self_cancel_text')
|
||
->label(__('Text for self cancel anchor').": ".
|
||
help::hint('self_cancel_text'))
|
||
->value(Settings::get('self_cancel_text'));
|
||
|
||
// allowed subnets
|
||
$this->form->group(__('Allowed subnets') . ' ' . help::hint('allowed_subnets'));
|
||
|
||
$this->form->upload('redirection_logo_url')
|
||
->label('Redirection logo URL')
|
||
->rules('allow[jpg,png]')
|
||
->new_name('redirection_logo.jpg')
|
||
->help(help::hint('redirection_logo'))
|
||
->additional_info($additional_info);
|
||
$this->form->checkbox('allowed_subnets_enabled')
|
||
->value('1')
|
||
->checked(Settings::get('allowed_subnets_enabled'))
|
||
->label('Enable allowed subnets');
|
||
|
||
if (Settings::get('allowed_subnets_enabled'))
|
||
{
|
||
$this->form->input('allowed_subnets_update_interval')
|
||
->label('Interval of update')
|
||
->help(help::hint('allowed_subnets_update_interval'))
|
||
->rules('required|valid_numeric')
|
||
->value(Settings::get('allowed_subnets_update_interval'));
|
||
}
|
||
}
|
||
|
||
$this->form->input('self_cancel_text')
|
||
->label(__('Text for self cancel anchor').": ".
|
||
help::hint('self_cancel_text'))
|
||
->value(Settings::get('self_cancel_text'));
|
||
|
||
$this->form->group('E-mail');
|
||
|
||
$this->form->input('email_subject_prefix')
|
||
... | ... | |
|
||
url::redirect('settings/notifications');
|
||
}
|
||
|
||
|
||
// states of modules
|
||
$states = array();
|
||
|
||
if (Settings::get('redirection_enabled'))
|
||
$states[] = module::get_state('redirection', TRUE);
|
||
|
||
if (Settings::get('allowed_subnets_enabled'))
|
||
$states[] = module::get_state('allowed_subnets_update', TRUE);
|
||
|
||
// create view for this template
|
||
$view = new View('main');
|
||
$view->title = __('System') . ' - ' . __('Notification settings');
|
||
... | ... | |
$view->content->current = 'notifications';
|
||
$view->content->content = $this->form->html();
|
||
$view->content->headline = __('Notification settings');
|
||
$view->content->description = module_state::get_state('redirection', TRUE);
|
||
$view->content->description = implode('<br />', $states);
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
... | ... | |
public function logging()
|
||
{
|
||
// access control
|
||
if (!$this->acl_check_edit(get_class($this), 'system'))
|
||
if (!$this->acl_check_edit(get_class($this), 'logging_settings'))
|
||
Controller::error(ACCESS);
|
||
|
||
$user_model = new User_Model();
|
||
... | ... | |
}
|
Také k dispozici: Unified diff
Release 1.1.0