Revize c1bdc1c4
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/controllers/installation.php | ||
---|---|---|
*
|
||
*/
|
||
|
||
// url for registration to FreenetIS.org
|
||
define('REGISTER_URL', 'http://dev.freenetis.org/register.php');
|
||
|
||
/**
|
||
* Controller performs installation of FreenetIS
|
||
*
|
||
... | ... | |
->help(help::hint('login_name'))
|
||
->callback(array($this, 'valid_username'));
|
||
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form->password('password')
|
||
->rules('required|length[3,50]')
|
||
->class('password')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password')
|
||
->title(url_lang::lang('help.password'));
|
||
|
||
$form->password('confirm_password')
|
||
->rules('required|length[3,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
// association
|
||
... | ... | |
|
||
$form->group('Fees');
|
||
|
||
$form->input('deduct_day')
|
||
->rules('valid_numeric')
|
||
->help(help::hint('deduct_day'))
|
||
->rules('required')
|
||
->value(15);
|
||
|
||
$form->input('entrance_fee')
|
||
->rules('valid_numeric')
|
||
->help(help::hint('entrance_fee'));
|
||
... | ... | |
->rules('required')
|
||
->value($currency);
|
||
|
||
$link = html::anchor('http://www.freenetis.org', 'FreenetIS.org', array
|
||
(
|
||
'target' => '_blank'
|
||
));
|
||
|
||
$form->checkbox('register_install')
|
||
->label(__('Register to %s', $link))
|
||
->help(help::hint('register_install'))
|
||
->checked(TRUE);
|
||
|
||
// submit button
|
||
|
||
$form->submit('Install');
|
||
... | ... | |
try
|
||
{
|
||
$town_model->transaction_start();
|
||
|
||
// set deduct day
|
||
Settings::set('deduct_day', max(1, min(31, $form_data['deduct_day'])));
|
||
|
||
// first member is special, it represents association
|
||
$member = new Member_Model();
|
||
... | ... | |
$default_penalty->deactivation_date = $to;
|
||
$default_penalty->priority = 1;
|
||
$default_penalty->save_throwable();
|
||
|
||
// permament whitelist
|
||
$members_whitelist = new Members_whitelist_Model();
|
||
$members_whitelist->member_id = $member->id;
|
||
$members_whitelist->permanent = 1;
|
||
$members_whitelist->since = date('Y-m-d');
|
||
$members_whitelist->until = '9999-12-31';
|
||
$members_whitelist->save_throwable();
|
||
|
||
// system settings
|
||
Settings::set('title', $form_data['title']);
|
||
... | ... | |
catch (Exception $e)
|
||
{
|
||
$town_model->transaction_rollback();
|
||
|
||
throw new Exception(__('Installation has failed'), $e);
|
||
Log::add_exception($e);
|
||
throw new Exception(__('Installation has failed') . ': ' . $e);
|
||
}
|
||
|
||
// array for store error
|
||
... | ... | |
$suffix = substr(server::script_name(),0,-9);
|
||
Settings::set('suffix', $suffix);
|
||
|
||
// send registration data
|
||
if ($form_data['register_install'])
|
||
{
|
||
@file_get_contents(
|
||
REGISTER_URL .
|
||
'?name=' . urlencode($form_data['name']) .
|
||
'&email=' . urlencode($form_data['email']) .
|
||
'&address=' . urlencode($address_point->__toString())
|
||
);
|
||
}
|
||
|
||
$view = new View('installation/done');
|
||
|
||
// remove index.php from urls
|
||
... | ... | |
self::error(PAGE);
|
||
}
|
||
|
||
if (preg_match('/^[a-z]{1}[a-z0-9]+$/', $input->value) == 0)
|
||
$username_regex = Settings::get('username_regex');
|
||
|
||
if (preg_match($username_regex, $input->value) == 0)
|
||
{
|
||
$input->add_error(
|
||
'required', __(
|
Také k dispozici: Unified diff
Release 1.1.0