} } $error = NULL; if ($file_count != $cnt) { $error_msg = __("Select any {$media_type} file to upload"); } if (empty(PA::$login_uid)) { $error_msg = __("You have to login before uploading {$media_type}"); } } if (!empty($_POST) && empty($error_msg)) { for ($k = 0; $k < $cnt; $k++) { $upload = uihelper_upload_gallery(PA::$login_uid, $_POST, $_FILES, $extention, $k); if ($upload[3] == TRUE) { if ($extra['network_content_moderation'] == NET_YES && PA::$network_info->owner_id != PA::$login_uid) { Network::moderate_network_content((int) $upload['album_id'], $upload[4]); // is_active = 2 for unverified content $moderation_msg = TRUE; } $uploaded = TRUE; $success = true; } else { $error_msg = $upload[1]; //index 1 has the error message during uploading } } } // Code for Re-Direction if (isset($success) && $success == true) { switch ($_GET['type']) { case 'Images':
++$file_count; } } $error_msg = NULL; if ($file_count == $cnt) { $error_msg = "Select any {$media_type} file to upload"; } if (empty($login_uid)) { $error_msg = "You have to login before uploading {$media_type}"; } if (!empty($_POST) && empty($error_msg)) { for ($k = 0; $k < $cnt; $k++) { $upload = uihelper_upload_gallery_for_group($login_uid, $_POST, $_FILES, $extention, $k); if ($upload[3] == TRUE) { if ($extra['network_content_moderation'] == NET_YES && PA::$network_info->owner_id != $login_uid) { Network::moderate_network_content((int) $upload['collection_id'], $upload['content_id']); $msg_id = 1004; } $uploaded = TRUE; $success = true; } else { $error_msg = $upload[1]; //index 1 has the error message during uploading } } } // deleting media try { $id = @$_GET['id']; if (!empty($_GET['action']) && $_GET['action'] == 'delete') { if ($_GET['type'] == 'Images') {
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']; if ($extra['network_content_moderation'] == NET_YES && $network_info->owner_id != $user->user_id) { Network::moderate_network_content(-1, $permalink_cid); // -1 for contents; not a part of any collection $error_msg = "&err=" . urlencode(MessagesHandler::get_message(1004)); } $content_author_image = uihelper_resize_mk_user_img($user->picture, 80, 80, 'alt="' . $user->first_name . '" align="left" style="padding: 0px 12px 12px 0px;"'); $network_owner_name = User::map_ids_to_logins($network_info->owner_id); $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; $params['content_url'] = PA::$url . '/' . FILE_CONTENT . '?cid=' . $permalink_cid; $params['content_moderation_url'] = PA::$url . '/' . FILE_NETWORK_MANAGE_CONTENT; $params['config_site_name'] = $config_site_name; $params['network_owner_name'] = $network_owner_name[$network_info->owner_id];
function route2groups() { global $user, $is_edit; $extra = unserialize(PA::$network_info->extra); $tags = preg_split('/\\s*,\\s*/', strtolower($_POST['tags'])); $tags = array_unique($tags); $net_owner = new User(); $net_owner->load((int) PA::$network_info->owner_id); $valid_post_types = array('BlogPost', 'Contribution', 'Suggestion'); $type = isset($_POST) && isset($_POST['blog_type']) && in_array($_POST['blog_type'], $valid_post_types) ? $_POST['blog_type'] : 'BlogPost'; //find tag entry $terms = array(); foreach ($tags as $term) { $tr = trim($term); if ($tr) { $terms[] = $tr; } } if (!empty($_POST['route_to_pa_home']) && $_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 } if (is_array($_POST['route_targets_group'])) { if (in_array(-2, $_POST['route_targets_group'])) { //-2 means Select none of group // no need to post in any group } elseif (in_array(-1, $_POST['route_targets_group'])) { //-1 means select all the groups // post in all the groups $group_array = explode(',', $_POST['Allgroups']); foreach ($group_array as $gid) { // post to all the groups $_group = Group::load_group_by_id((int) $gid); $login_required_str = null; if ($_group->access_type == ACCESS_PRIVATE) { $login_required_str = '&login_required=true'; } switch ($type) { case 'BlogPost': default: $res = BlogPost::save_blogpost(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Contribution': $res = Contribution::save_contribution(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Suggestion': $res = Suggetion::save_suggestion(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; } $permalink_cid = $res['cid']; // NOTE: would this notification message be sent for each group ??? $content_obj = Content::load_content((int) $permalink_cid); PANotify::send("content_posted", PA::$network_info, $user, $content_obj); // notify network owner (maybe group owner would be better?) if ($display_on_homepage == DISPLAY_ON_HOMEPAGE) { PANotify::send("content_posted_to_comm_blog", PA::$network_info, $user, $content_obj); } //------- //for rivers of people $activity = 'group_post_a_blog'; $activity_extra['info'] = $user->first_name . 'posted a new blog'; $activity_extra['blog_name'] = $_POST["blog_title"]; $activity_extra['blog_id'] = $permalink_cid; $activity_extra['blog_url'] = PA::$url . PA_ROUTE_CONTENT . '/cid=' . $permalink_cid . $login_required_str; $extra = serialize($activity_extra); $object = $gid; // update status to unverified $group = ContentCollection::load_collection((int) $gid, PA::$login_uid); if ($group->reg_type == REG_MODERATED) { Network::moderate_network_content((int) $gid, $permalink_cid); } else { if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && PA::$network_info->owner_id != $user->user_id) { Network::moderate_network_content($gid, $permalink_cid); } } if (!PA::is_moderated_content() && $group->reg_type != REG_MODERATED) { //Write to activity log only when moderation is off Activities::save($user->user_id, $activity, $object, $extra); } } } else { // post in selected groups foreach ($_POST['route_targets_group'] as $gid) { //only send to selected groups $_group = Group::load_group_by_id((int) $gid); $login_required_str = null; if ($_group->access_type == ACCESS_PRIVATE) { $login_required_str = '&login_required=true'; } switch ($type) { case 'BlogPost': default: $res = BlogPost::save_blogpost(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Contribution': $res = Contribution::save_contribution(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Suggestion': $res = Suggestion::save_suggestion(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; } $permalink_cid = $res['cid']; $content_obj = Content::load_content((int) $permalink_cid); PANotify::send("content_posted", PA::$network_info, $user, $content_obj); // notify network owner (maybe group owner would be better?) if ($display_on_homepage == DISPLAY_ON_HOMEPAGE) { PANotify::send("content_posted_to_comm_blog", PA::$network_info, $user, $content_obj); } //for rivers of people $activity = 'group_post_a_blog'; $activity_extra['info'] = $user->first_name . 'posted a new blog'; $activity_extra['blog_name'] = $_POST["blog_title"]; $activity_extra['blog_id'] = $permalink_cid; $activity_extra['blog_url'] = PA::$url . PA_ROUTE_CONTENT . '/cid=' . $permalink_cid . $login_required_str; $extra = serialize($activity_extra); $object = $gid; // update status to unverified $group = ContentCollection::load_collection((int) $gid, PA::$login_uid); if ($group->reg_type == REG_MODERATED) { Network::moderate_network_content((int) $gid, $permalink_cid); } else { if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && PA::$network_info->owner_id != $user->user_id) { Network::moderate_network_content($gid, $permalink_cid); } } if (!PA::is_moderated_content() && $group->reg_type != REG_MODERATED) { //Write to activity log only when moderation is off Activities::save($user->user_id, $activity, $object, $extra); } } } } return TRUE; }
function save_post($cid = NULL, $ccid = NULL, $is_album = FALSE, $display_on = 1) { global $user, $network_info; $extra = unserialize($network_info->extra); $micro_content_post = new SBMicroContent(); $micro_content_post->set_mc_type($_REQUEST['sb_mc_type']); $content = $micro_content_post->format_structured_content(); $micro_content_post->body = $content; $micro_content_post->author_id = $_SESSION['user']['id']; $micro_content_post->allow_comments = 1; $micro_content_post->trackbacks = $_REQUEST['trackback']; $micro_content_post->is_active = 1; if ($cid) { $micro_content_post->content_id = $cid; $condition = array('content_id' => $cid); $is_active = ACTIVE; if ($extra['network_content_moderation'] == NET_YES) { $content = Content::load_all_content_for_moderation(NULL, $condition); if (!empty($content)) { $is_active = $content[0]['is_active']; } } $micro_content_post->is_active = $is_active; } if (!$ccid) { //independent post which is not part of any contentcollection $ccid = -1; } $micro_content_post->parent_collection_id = $ccid; $micro_content_post->display_on = $display_on; $sb_content = array(); $sb_content = SBMicroContent::get_sbtype_id($_REQUEST['sb_mc_type'], $with_name = true); $micro_content_post->sbtype_id = $sb_content["sbtype_id"]; $micro_content_post->title = $_POST[$sb_content["titlefield"]]; //echo '<pre>';print_r($content); $micro_content_post->save(); $return_array = array('title' => $_POST[$sb_content["titlefield"]], 'body' => $content, 'content_id' => $micro_content_post->content_id); if ($ccid != -1 && !$is_album) { // Code for checking groups with moderated content. //fix me change it for using ContentCollection::get_collection_type() $collection = ContentCollection::load_collection($micro_content_post->parent_collection_id, $micro_content_post->author_id); //$collection->assert_user_access($_SESSION['user']['id']); if ($collection->is_moderated) { $Group = new Group(); $Group->collection_id = $micro_content_post->parent_collection_id; $Group->moderate_content($micro_content_post->content_id); $return_array['is_moderated'] = 1; } } $permalink_cid = $micro_content_post->content_id; $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'] = $micro_content_post->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); } if ($extra['network_content_moderation'] == NET_YES && $network_info->owner_id != $user->user_id) { Network::moderate_network_content(-1, $permalink_cid); // -1 for contents; not a part of any collection $return_array['msg'] = 1004; } return $return_array; }
$location = $redirect_url . '/media/gallery/Videos/view=groups_media&gid=' . $_GET['group_id']; $params['media_full_view_url'] = $redirect_url . '/' . FILE_MEDIA_FULL_VIEW . '?cid=' . $new_video->content_id; $group = new Group(); $group->load((int) $_GET['group_id']); if ($group->reg_type == REG_MODERATED && !in_array(PA::$login_uid, $group->moderators)) { $moderation = TRUE; $params['media_full_view_url'] = $redirect_url . '/group_moderation.php?view=content&gid=' . $_GET['group_id']; } } else { $activity = 'user_video_upload'; //for rivers of people $location = $redirect_url . '/media/gallery/Videos/uid=' . PA::$login_uid; } $task = Roles::check_permission_by_value(PA::$login_uid, 'manage_content'); if (($network_extra['network_content_moderation'] == NET_YES && $network_details->owner_id != PA::$login_uid || $moderation) && PA::$login_uid != SUPER_USER_ID) { Network::moderate_network_content($new_video->parent_collection_id, $new_video->content_id); // is_active = 2 for unverified content // $location .= 1005; } else { //To send mail to all the members of the organization $params['content_type'] = 'Video'; $params['content_title'] = $new_video->title; $params['first_name'] = PA::$user->first_name; $params['content_url'] = $redirect_url . '/' . FILE_MEDIA_FULL_VIEW . '?type=Videos&display=videos&cid=' . $new_video->content_id . '&uid=' . PA::$login_uid; $params['nid'] = PA::$network_info->network_id; //To show this video in recent in system log $activity = 'user_video_upload'; //for rivers of people $activity_extra['info'] = PA::$user->first_name . ' uploaded a image in album id = ' . $new_video->parent_collection_id; $activity_extra['content_id'] = $new_video->content_id;
function route2groups() { global $login_uid, $user, $network_info; $extra = unserialize($network_info->extra); $tags = explode(',', $_POST['tags']); //find tag entry foreach ($tags as $term) { $tr = trim($term); if ($tr) { $terms[] = $tr; } } 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 } if (is_array($_POST['route_targets_group'])) { if (in_array(-2, $_POST['route_targets_group'])) { //-2 means Select none of group // no need to post in any group } elseif (in_array(-1, $_POST['route_targets_group'])) { //-1 means select all the groups // post in all the groups $group_array = explode(',', $_POST['Allgroups']); foreach ($group_array as $gid) { // post to all the groups $res = BlogPost::save_blogpost(0, $login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); $permalink_cid = $res['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); } } // update status to unverified if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && $network_info->owner_id != $user->user_id) { Network::moderate_network_content($gid, $permalink_cid); } } else { // post in selected groups foreach ($_POST['route_targets_group'] as $gid) { //only send to selected groups $res = BlogPost::save_blogpost(0, $login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); $permalink_cid = $res['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); } // update status to unverified if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && $network_info->owner_id != $user->user_id) { Network::moderate_network_content($gid, $permalink_cid); } } } } return TRUE; }