Revize 651
Přidáno uživatelem Michal Kliment před asi 14 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/validation.php | ||
---|---|---|
|
||
// Upload errors
|
||
'user_aborted' => 'The %s file was aborted during upload.',
|
||
'invalid_type' => 'The %s file is not an allowed file type.',
|
||
'invalid_type' => 'Soubor nemá povolený typ souboru.',
|
||
'max_size' => 'The %s file you uploaded was too large. The maximum size allowed is %s.',
|
||
'max_width' => 'The %s file you uploaded was too big. The maximum allowed width is %spx.',
|
||
'max_height' => 'The %s file you uploaded was too big. The maximum allowed height is %spx.',
|
freenetis/trunk/kohana/application/controllers/settings.php | ||
---|---|---|
// access control
|
||
if (!$this->acl_check_edit(get_class($this),'system'))
|
||
Controller::error(ACCESS);
|
||
|
||
// creating of new forge
|
||
$this->form = new Forge(url_lang::base()."settings/registration_export", '', 'POST', array('id' => 'article_form'));
|
||
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$this->form->group('')->label(url_lang::lang('texts.Export of registration'));
|
||
$this->form->upload('registration_logo')->label(url_lang::lang('texts.Logo').':')->rules('allow[jpg]')->directory('media/images/')->new_name('logo.jpg');
|
||
$this->form->html_textarea('registration_info')->label(url_lang::lang('texts.Info').':')->rows(5)->cols(100)->value($this->settings->get('registration_info'));
|
||
$this->form->html_textarea('registration_license')->label(url_lang::lang('texts.License').':')->rows(5)->cols(100)->value($this->settings->get('registration_license'));
|
||
$this->form->submit('submit')->value(url_lang::lang('texts.Save'));
|
freenetis/trunk/kohana/application/libraries/Form_Upload.php | ||
---|---|---|
// Upload directory
|
||
protected $directory;
|
||
|
||
// Upload name
|
||
protected $new_name = '';
|
||
|
||
public function __construct($name)
|
||
{
|
||
parent::__construct($name);
|
||
... | ... | |
throw new Kohana_Exception('upload.not_writable', $dir);
|
||
|
||
$this->directory = $dir;
|
||
|
||
return $this;
|
||
}
|
||
|
||
public function new_name($new_name = NULL)
|
||
{
|
||
$this->new_name = $new_name;
|
||
|
||
return $this;
|
||
}
|
||
|
||
public function validate()
|
||
{
|
||
// exception handling added by jsvitak
|
||
... | ... | |
|
||
if ($status = parent::validate() AND $this->upload['error'] === UPLOAD_ERR_OK)
|
||
{
|
||
// Set the filename to the original name
|
||
$filename = $this->upload['name'];
|
||
if ($this->new_name!='')
|
||
$filename = $this->new_name;
|
||
else
|
||
// Set the filename to the original name
|
||
$filename = $this->upload['name'];
|
||
|
||
if (Settings::get('upload_remove_spaces'))
|
||
/*if (Settings::get('upload_remove_spaces'))
|
||
{
|
||
// Remove spaces, due to global upload configuration
|
||
$filename = preg_replace('/\s+/', '_', $this->data['value']);
|
||
}
|
||
}*/
|
||
|
||
$filename = $this->directory.$filename;
|
||
|
||
// Move the uploaded file to the upload directory
|
||
move_uploaded_file($this->upload['tmp_name'], $filename = $this->directory.$filename);
|
||
move_uploaded_file($this->upload['tmp_name'], $filename);
|
||
}
|
||
|
||
if ( ! empty($_POST[$this->data['name']]))
|
||
... | ... | |
// Reset the POST value to the new filename
|
||
$this->data['value'] = $_POST[$this->data['name']] = $filename;
|
||
}
|
||
|
||
return $status;
|
||
}
|
||
|
||
... | ... | |
if (empty($this->upload['tmp_name']) OR count($types = func_get_args()) == 0)
|
||
return;
|
||
|
||
/*
|
||
|
||
if (defined('FILEINFO_MIME'))
|
||
{
|
||
$info = new finfo(FILEINFO_MIME);
|
||
... | ... | |
else
|
||
{
|
||
// Trust the browser
|
||
$mime = $this->upload['type'];
|
||
}
|
||
|
||
}*/
|
||
|
||
// Allow nothing by default
|
||
$allow = FALSE;
|
||
|
||
$mime = $this->upload['type'];
|
||
|
||
$mimes = array
|
||
(
|
||
'7z' => array('application/x-7z-compressed'),
|
Také k dispozici: Unified diff
Pridana moznost nahravat vlastni logo pro prihlasku.