Revize 2202
Přidáno uživatelem David Raška před asi 11 roky(ů)
freenetis/branches/1.1/application/controllers/settings.php | ||
---|---|---|
|
||
$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'));
|
||
... | ... | |
}
|
||
}// end of validatation function
|
||
|
||
/**
|
||
* Validates suffix
|
||
*
|
||
* @param object $input
|
||
*/
|
||
public function valid_suffix($input = null)
|
||
{
|
||
// validators cannot be accessed
|
||
if (empty($input) || !is_object($input))
|
||
{
|
||
self::error(PAGE);
|
||
}
|
||
|
||
if (!preg_match ("/^\/([A-Za-z0-9\-_]+\/)*$/", $input->value))
|
||
{
|
||
$input->add_error('required', __("Suffix has to start with slash character, has to end with slash character and contains only a-z, 0-9, - and /"));
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Validates domain
|
||
*
|
||
* @param object $input
|
||
*/
|
||
public function valid_domain($input = null)
|
||
{
|
||
// validators cannot be accessed
|
||
if (empty($input) || !is_object($input))
|
||
{
|
||
self::error(PAGE);
|
||
}
|
||
|
||
if (!preg_match ("/^[A-Za-z0-9\-_\.]+$/", $input->value))
|
||
{
|
||
$input->add_error('required', __("Domain has to contain only a-z, 0-9, -, / and dot characters"));
|
||
}
|
||
}
|
||
}
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'do you want to end membership of this member' => 'Chcete ukončit členství tohoto člena',
|
||
'do you want to restore membership of this member' => 'Chcete obnovit členství tohoto člena',
|
||
'domain' => 'Doména',
|
||
'domain has to contain only a-z, 0-9, -, / and dot characters' => 'Doméma musí obsahovat pouze znaky a-z, 0-9, -, / a tečku',
|
||
'document' => 'dokument',
|
||
'documentation' => 'Dokumentace',
|
||
'domicile' => 'Trvalé bydliště',
|
||
... | ... | |
'subnets to qos' => 'Podsítě pro QoS',
|
||
'subnets with dhcp' => 'Podsítě s DHCP',
|
||
'suffix' => 'Přípona',
|
||
'suffix has to start with slash character and has to end with slash character' => 'Přípona musí začínat lomítkem a musí končit lomítkem.',
|
||
'suffix has to start with slash character, has to end with slash character and contains only a-z, 0-9, - and /' => 'Přípona musí začínat lomítkem, musí končit lomítkem a obsahovat pouze znaky a-z, 0-9, - a /',
|
||
'suggest amount' => 'Navrhovaná částka',
|
||
'sum' => 'Součet',
|
||
'sum of costs and total cost are not equal' => 'Součet částek nesouhlasí s celkovou částkou.',
|
freenetis/branches/1.1/application/views/js/base.php | ||
---|---|---|
$.validator.addMethod('suffix', function(value)
|
||
{
|
||
return value.match(/^\/([^\/]+\/)*$/);
|
||
}, '<?php echo __('suffix has to start with slash character and has to end with slash character') ?>');
|
||
}, '<?php echo __('Suffix has to start with slash character, has to end with slash character and contains only a-z, 0-9, - and /') ?>');
|
||
|
||
$.validator.addMethod('var_sym', function(value)
|
||
{
|
Také k dispozici: Unified diff
Opravy:
- Oprava validatoru pro domain a suffix v nastaveni