Purpose : save structured blogging post Author: tekriti Bug fixes: */ require_once dirname(__FILE__) . "/../ext/BlogPost/BlogPost.php"; global $base_url, $network_info; $user = get_login_user(); filter_all_post($_REQUEST); filter_all_post($_POST, FALSE, TRUE); // don't strip html *everywhere*, just strip bad tags - or we'll mutilate any html content. // TO DO: This array should be populated from the database. $sb_types = array('event' => array(array('caption' => 'Generic', 'sb_mc_type' => 'event/generic'), array('caption' => 'Conference', 'sb_mc_type' => 'event/conference'), array('caption' => 'Concert', 'sb_mc_type' => 'event/concert')), 'review' => array(array('caption' => 'Local Service', 'sb_mc_type' => 'review/localservice'), array('caption' => 'Event', 'sb_mc_type' => 'review/event'), array('caption' => 'Bar/Club', 'sb_mc_type' => 'review/club'), array('caption' => 'Restaurant', 'sb_mc_type' => 'review/restaurant'), array('caption' => 'Café', 'sb_mc_type' => 'review/cafe'), array('caption' => 'Hotel/Resort', 'sb_mc_type' => 'review/hotel'), array('caption' => 'Book', 'sb_mc_type' => 'review/book'), array('caption' => 'Album', 'sb_mc_type' => 'review/album'), array('caption' => 'Article', 'sb_mc_type' => 'review/article'), array('caption' => 'Magazine', 'sb_mc_type' => 'review/magazine'), array('caption' => 'Movie', 'sb_mc_type' => 'review/movie'), array('caption' => 'Software', 'sb_mc_type' => 'review/software'), array('caption' => 'Song', 'sb_mc_type' => 'review/song'), array('caption' => 'Website', 'sb_mc_type' => 'review/website'))); if ($_POST) { $succ_msg = NULL; // check to see if there are any errors $SbHelper = new SbHelper(); $SbHelper->set_mc_type($_REQUEST['sb_mc_type']); $error_array = $SbHelper->processForm(); // check for album creation if (@$_POST['new_album']) { // try to create new album $save_alb = createalbum(); if ($save_alb['error'] == TRUE) { array_push($error_array, $save_alb['msg']); } else { $created_album_id = $save_alb; } } if (sizeof($error_array) && $_POST['save_publish_post'] == TRUE) { $post_err = "Your post could not be saved due to the following errors:<br />"; $err = @implode('<br />', $error_array);
function setup_module($column, $moduleName, $obj) { global $sb_mc_type, $cid, $ccid, $error_array, $err_album_name_exist, $content_type, $sb_types; global $display, $is_edit, $album_save_error, $data_array, $error, $sb_mc_type, $targets; global $show_external_blogs, $outputthis_error_mesg, $path_prefix; global $post_err; switch ($column) { case 'middle': $obj->get_user_albums(); $obj->author_id = $_SESSION['user']['id']; if (!empty($_REQUEST["sb_mc_type"])) { $content_type = 'SBMicroContent'; require_once "sb_content.php"; if (!empty($cid)) { $obj->set_id($cid); } $sb_mc_type = trim($_REQUEST["sb_mc_type"]); $temp_array = explode("/", $_REQUEST["sb_mc_type"]); if (count($temp_array) > 1) { // for getting the media, audio and video SB contents $display = $temp_array[0]; } else { $display = ""; } $obj->set_sb_vars($sb_mc_type, $cid, $ccid); $obj->error_array = $error_array; $obj->err_album_name_exist = $err_album_name_exist; $obj->content_type = $content_type; $obj->sb_types = $sb_types; $obj->display = $display; $obj->is_edit = $is_edit; if ($album_save_error) { $obj->set_error_msg($album_save_error); } $obj->tags = @$_POST['tags']; } else { $content_type = 'BlogPost'; $login_uid = $_SESSION['user']['id']; require_once "createcontent.php"; if (!empty($cid)) { $obj->set_id($cid); } if (strlen($error) > 0) { $obj->set_error_msg($error, $data_array); } $obj->display = 'blog'; } $obj->album_type = SbHelper::get_album_type($sb_mc_type); $obj->targets = $targets; $obj->show_external_blogs = $show_external_blogs; $obj->outputthis_error_mesg = $outputthis_error_mesg; $obj->is_edit = $is_edit; $obj->ccid = $ccid; break; } }