";
}
if (empty($_POST['description']) ) {
$error = TRUE;
$post_err.= "Description cannot be empty.
";
}
// if no error then do the rest of work
if ( !$error ) {
////////////get tags
$tags = explode(',', $_POST['tags']);
foreach ($tags as $term) {
$tr = trim($term);
if ($tr) {
$terms[] = $tr;
}
}
/////////////////
// check to see if user wants to edit the post
// now just edit and redirect to permalink
if( !empty($cid) ) {
$r = BlogPost::save_blogpost($cid, $login_uid, $_POST["blog_title"], $_POST["description"], $track, $terms);
//invalidate cache
if( $network_info ) {
$nid = '_network_'.$network_info->network_id;
} else {
$nid='';
}
//unique name
$cache_id = 'content_'.$cid.$nid;
CachedTemplate::invalidate_cache($cache_id);
$location = "$base_url/content.php?cid=$cid";
header("location:$location");exit;
}//.. end of edit
// If we have come this far it means it is not edit and we have to create post
//save post normally
if ( $_POST['route_to_pa_home']==1 ) {
$display_on_homepage = DISPLAY_ON_HOMEPAGE;//its zero
} else {
$display_on_homepage = NO_DISPLAY_ON_HOMEPAGE;//This will not show up on homepage - flag has opposite values
}
$post_saved = BlogPost::save_blogpost(0, $login_uid, $_POST["blog_title"], $_POST["description"], NULL, $terms, -1, 1,$display_on_homepage);
$permalink_cid = $post_saved['cid'];
$content_author_image = uihelper_resize_mk_user_img($user->picture, 80, 80,'alt="'.$user->first_name.'" align="left" style="padding: 0px 12px 12px 0px;"');
$params['cid'] = $permalink_cid;
$params['first_name'] = $user->first_name;
$params['user_id'] = $user->user_id;
$params['user_image'] = $content_author_image;
$params['content_title'] = $_POST["blog_title"];
$params['network_name'] = $network_info->name;
auto_email_notification('content_posted', $params);
if ($_POST['route_to_pa_home'] == 1) {
auto_email_notification('content_posted_to_comm_blog', $params);
}
//save post in groups
$routed_to_groups = route2groups();
// save post to outputthis
route_to_outputthis($_POST["blog_title"], $_POST["description"]);
//we have saved it in all the locations lets redirect it to various locations
if ( $_GET['ccid'] ) {
// it means user is coming from group's page then redirect it to group
//load group to see if group is if it is moderated
$location = "$base_url/group.php?gid=".$_REQUEST['ccid'];
header("location:$location");exit;
} else {
//just redirect it to permalink page
header("location:".$base_url."/content.php?cid=$permalink_cid");exit;
}
}
else {//..end of !$error
$post_err = 'Post could not be saved due to following errors:
'.$post_err;
}
}//$_POST
?>