function _create_object_operation() { if (isset($_FILES[$this->name]['tmp_name']['file'])) { if ($_FILES[$this->name]['size']['file'] > ini_get('upload_max_filesize') * 1024 * 1024) { message_box::write_warning('uploaded file size exceeds limit'); return false; } $this->object->set_attribute('tmp_file_path', $_FILES[$this->name]['tmp_name']['file']); $this->object->set_attribute('file_name', $_FILES[$this->name]['name']['file']); $this->object->set_attribute('mime_type', $_FILES[$this->name]['type']['file']); } return parent::_create_object_operation(); }
function _update_object_operation(&$object) { if (isset($_FILES[$this->name]['tmp_name']['file'])) { if ($_FILES[$this->name]['size']['file'] > ini_get('upload_max_filesize') * 1024 * 1024) { message_box::write_warning('uploaded file size exceeds limit'); return false; } $object_data =& fetch_mapped_by_url(); $object->set_attribute('media_id', $object_data['media_id']); $object->set_attribute('tmp_file_path', $_FILES[$this->name]['tmp_name']['file']); $object->set_attribute('file_name', $_FILES[$this->name]['name']['file']); $object->set_attribute('mime_type', $_FILES[$this->name]['type']['file']); } return parent::_update_object_operation(&$object); }
function change_password() { if (!($user_id = $this->get_id())) { debug::write_error('user id not set', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); return false; } if (!($identifier = $this->get_identifier())) { debug::write_error('user identifier not set', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); return false; } $this->set_attribute('password', user::get_crypted_password($identifier, $this->get_attribute('password'))); if ($user_id == user::get_id()) { user::logout(); message_box::write_warning(strings::get('need_relogin', 'user')); } else { session::destroy_user_session($user_id); } return $this->update(false); }
function _check_result($result)//it's not really the place for it... { $image_variations = $this->_get_variations_ini_list(); foreach($image_variations as $variation => $variation_data) { $action = $this->get_attribute($variation . '_action'); if($action == 'upload' || $action == 'generate') { if (!$result[$variation]['saved']) { message_box :: write_warning($variation . ' not saved'); } if ($this->get_attribute($action . '_' . $variation . '_max_size') && !$result[$variation]['resized']) { message_box :: write_warning($variation . ' not resized'); } } } }