} elseif ($created && !$post->title) {
$post->title = ucfirst($post->slug);
}
}
# set newborn properties
if ($created) {
if (!$post->mimeType) {
$post->mimeType = 'text/html';
gb::log('did force html');
} else {
gb::log('mime type is %s', $post->mimeType);
}
if (!$post->published) {
$post->published = $post->modified;
}
$post->name = $post->recommendedName();
} else {
gb::log('already exists (OK)');
}
# was the state actually modified?
if ($modified_state) {
gb::log('write %s', r($modified_state));
# write to work area
gb_admin::write_content($post);
}
# if the post was created, reload it to find appropriate values
if ($created) {
$post = GBPost::findByName($post->name, 'work');
$modified_state = array();
foreach ($state_fields as $k => $discard) {
if ($k === 'body') {