if ($can_save) {
$author = new Author();
if ($id > 0) {
$author = new Author($id);
$isNewAuthor = false;
} else {
$author->create(array('first_name' => $first_name, 'last_name' => $last_name));
$isNewAuthor = true;
}
$uploadFileSpecified = isset($_FILES['file']) && isset($_FILES['file']['name']) && !empty($_FILES['file']['name']);
$author->setFirstName($first_name);
$author->setLastName($last_name);
$author->commit();
// Reset types
$types = Input::Get('type', 'array', array());
AuthorAssignedType::ResetAuthorAssignedTypes($author->getId());
foreach ($types as $type) {
$author->setType($type);
}
$author->setSkype(Input::Get('skype'));
$author->setJabber(Input::Get('jabber'));
$author->setAim(Input::Get('aim'));
$author->setEmail(Input::Get('email'));
$authorBiography = array();
$authorBiography['biography'] = Input::Get("txt_biography", "string");
$authorBiography['language'] = Input::Get("lang", "int", 0);
$authorBiography['first_name'] = Input::Get("lang_first_name");
$authorBiography['last_name'] = Input::Get("lang_last_name");
$author->setBiography($authorBiography);
if ($uploadFileSpecified) {
$attributes = array();