private function handleGET_deleteContent($request_data) { $location = $request_data['back_page']; if (!empty($request_data['cid']) && !empty(PA::$login_uid)) { $params = array('permissions' => 'delete_content', 'uid' => PA::$login_uid, 'cid' => $request_data['cid']); if (PermissionsHandler::can_user(PA::$login_uid, $params)) { Content::delete_by_id($request_data['cid']); Activities::update(array('type' => 'user_post_a_blog', 'subject' => PA::$login_uid, 'object' => $request_data['cid']), 'deleted'); } else { $location .= '&msg_id=7033'; $this->controller->redirect($location); exit; } if (PA::$network_info) { $nid = '_network_' . PA::$network_info->network_id; } else { $nid = ''; } //unique name $cache_id = 'content_' . $request_data['cid'] . $nid; CachedTemplate::invalidate_cache($cache_id); $location .= '&msg_id=7024'; $this->controller->redirect($location); exit; } else { $this->controller->redirect($location); exit; } }
function __construct() { parent::__construct(); $this->main_block_id = "mod_edit_profile"; $this->block_type = 'EditProfile'; if (empty(PA::$config->simple['omit_advacedprofile'])) { //This is not simple PA. Add the advanced profile types to valid types. array_push($this->valid_profile_types, 'export'); } //by default basic profile will be shown $this->profile_type = 'basic'; $this->uid = PA::$login_uid; $this->user_info = PA::$login_user; // if a userID is specified and the logged in user can manage the network, let them edit if (isset($_GET) && isset($_GET['uid']) && PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_settings'))) { $this->uid = intval($_GET['uid']); $this->user_info = new User(); $this->user_info->load($this->uid); } }
function uihelper_generate_center_content_permalink($cid, $show = 0) { global $app; $image_media_gallery = FALSE; $back_page = PA::$url . $app->current_route; $content = CNContent::load_content((int) $cid, (int) PA::$login_uid); // filter content fields for output $content->title = _out($content->title); $content->body = _out($content->body); if (strstr($back_page, PA_ROUTE_CONTENT) || strstr($back_page, PA_ROUTE_PERMALINK)) { if ($content->parent_collection_id > 0) { $collection = ContentCollection::load_collection((int) $content->parent_collection_id, PA::$login_uid); if ($collection->type == GROUP_COLLECTION_TYPE) { $back_page = PA::$url . PA_ROUTE_GROUP . "/gid=" . $content->parent_collection_id; } else { $back_page = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid=" . $content->author_id; } // IF permalink content is a group content redirect to group homepage } else { //if coming from permalink page then redirect to user page $back_page = PA::$url . PA_ROUTE_USER_PRIVATE; } } $moderateduser = Group::is_admin((int) $content->parent_collection_id, (int) PA::$login_uid) ? 1 : 0; $back_page = urlencode($back_page); if (!$content->is_html) { $content->body = nl2br($content->body); } $media_gallery_content = NULL; $media_gallery_content = in_array(trim($content->type), array('Image', 'Audio', 'Video')); $editable = PA::$login_uid == $content->author_id || $moderateduser; $comments = Comment::get_comment_for_content($cid, '', 'ASC'); $number_of_comments = count($comments); $content->no_of_comments = $number_of_comments; $trackback = CNContent::get_trackbacks_for_content($cid); $number_of_trackbacks = count($trackback); $content->no_of_trackbacks = $number_of_trackbacks; $content->trackback_url = PA::$url . "/pa_trackback.php?cid=" . $cid; $content_user = new User(); $content_user->load((int) $content->author_id); $content->create_time = PA::date($content->changed, 'long'); // date("l, F d, Y", $content->changed); $tags = Tag::load_tags_for_content($cid); if ($tags) { $t = array(); for ($i = 0; $i < count($tags); $i++) { $name = _out($tags[$i]['name']); $uid = PA::$login_uid; $url = PA::$url . '/' . FILE_TAG_SEARCH . '?name_string=content_tag&keyword=' . $tags[$i]["name"]; $t[] = "<a href={$url}>" . $name . "</a>"; } $tag_string = "<b>Tags : </b>" . implode(", ", $t); } else { $tag_string = ""; } $content->tag_entry = $tag_string; if (property_exists($content, 'sbname')) { if (substr($content->sbname, 0, 5) == 'event') { $content->type = 'SBEvent'; } elseif (substr($content->sbname, 0, 6) == 'review') { $content->type = 'Review'; } elseif (substr($content->sbname, 0, 11) == 'media/audio') { $content->type = 'Audio'; } elseif (substr($content->sbname, 0, 11) == 'media/video') { $content->type = 'Video'; } elseif (substr($content->sbname, 0, 11) == 'media/image') { $content->type = 'Image'; } elseif (substr($content->sbname, 0, 14) == 'showcase/group') { $content->type = 'GroupShowCase'; } elseif (substr($content->sbname, 0, 15) == 'showcase/person') { $content->type = 'PersonShowCase'; } } // replace magic strings $content->replace_percent_strings(PA::$url); $type = $content->type; $type = $type . 'Permalink'; // comments $comments_list_tpl = new Template(CURRENT_THEME_FSPATH . "/cncontent_comments.php"); $comments_list_tpl->set('current_theme_path', PA::$theme_url); $comments_list_tpl->set('comments', $comments); $comments_list_tpl->set('author_id', $content->author_id); // Setting the variable for the abuse form ... $comments_list = $comments_list_tpl->fetch(); //comment form $cnform_comment_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_comment.php"); $cnform_comment_tpl->set('current_theme_path', PA::$theme_url); if (isset(PA::$login_uid)) { $user = new User(); $user->load((int) PA::$login_uid); $login_name = $user->login_name; $cnform_comment_tpl->set('name', $login_name); $cnform_comment_tpl->set('login_name', $user->login_name); } $cnform_comment_tpl->set('cid', $cid); if ($content->parent_collection_id > 0) { $cnform_comment_tpl->set('ccid', $content->parent_collection_id); } // abuse form $cnform_abuse_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_abuse.php"); /* Permalink and edit links for content */ if ($content->parent_collection_id != -1) { $perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id . '&ccid=' . $content->parent_collection_id; } else { $perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id; } $params = array('permissions' => 'edit_content', 'uid' => PA::$login_uid, 'cid' => $content->content_id); if (PermissionsHandler::can_user(PA::$login_uid, $params)) { if ($media_gallery_content) { $edit_link = PA::$url . '/edit_media.php?cid=' . $content->content_id; } else { $edit_link = PA::$url . "/cncontent_blog.php?cid=" . $content->content_id; } $delete_link = PA::$url . PA_ROUTE_CONTENT . "?action=deleteContent&cid=" . $content->content_id . '&back_page=' . $back_page; // handle Event separately if ($type == "EventPermalink") { $edit_link = PA::$url . '/calendar.php?cid=' . $content->content_id; $delete_link = $edit_link . "&delete=1" . '&back_page=' . $back_page; } } else { $edit_link = $delete_link = NULL; } $user_link = PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $content->author_id; /* Code for Approval and Denial links for a content */ if ($moderateduser && $content->is_active == 2) { $approval_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&apv=1'; $denial_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&dny=1'; } else { $approval_link = $denial_link = NULL; } // Show comments form to logged in users, only if comments enabled. global $comments_disabled; // fix by Z.Hron; if group content - only members of group can comment it $can_user_comment = true; if (isset($_GET['gid']) && isset(PA::$login_uid)) { $can_user_comment = Group::member_exists((int) $_GET['gid'], PA::$login_uid); } if (!$comments_disabled && !empty(PA::$login_uid) && $can_user_comment) { $cnform_comment = $cnform_comment_tpl->fetch(); $cnform_abuse = $cnform_abuse_tpl->fetch(); } else { $cnform_comment = $cnform_abuse = NULL; } if (getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php")) { $middle_content = new Template(getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php")); $middle_content->set_object('contents', $content); $middle_content->set('editable', $editable); $middle_content->set('picture_name', $content_user->picture); // to set picture name for diplaying in contets $middle_content->set('user_id', $content_user->user_id); $middle_content->set('user_name', $content_user->first_name . ' ' . $content_user->last_name); $middle_content->set('current_theme_path', PA::$theme_url); $middle_content->set('back_page', $back_page); $middle_content->set('comments', $comments_list); $middle_content->set('cnform_comment', $cnform_comment); $middle_content->set('cnform_abuse', $cnform_abuse); $middle_content->set('media_gallery_content', $media_gallery_content); if ($show == 1) { $middle_content->set('show', $show); } $middle_content->set('permalink', $perma_link); $middle_content->set('edit_link', $edit_link); $middle_content->set('approval_link', $approval_link); $middle_content->set('denial_link', $denial_link); $middle_content->set('delete_link', $delete_link); $middle_content->set('user_link', $user_link); $return_content = $middle_content->fetch(); } else { $return_content = '<p>Content does not have a display template.</p><p>Create a ' . $type . '.php file to display this content type.</p>'; } return $return_content; }
function initializeModule($request_method, $request_data) { global $error_msg; $error = false; $msg = array(); $form_data = NULL; $edit = false; $message = NULL; // check permissions! $user_may = false; $user_may = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_ads')); // check for manageads of group permissions if (!empty($_REQUEST['gid']) && !$user_may) { // we do this checl only if the user is not already permitted to manage ads $gp_access = PermissionsHandler::can_group_user(PA::$login_uid, $_REQUEST['gid'], array('permissions' => 'manage_ads')); $user_may = $gp_access; } if (!$user_may) { $error_msg = __("You do not have permission to manage Ads."); return "skip"; } // paging if (!empty($request_data['page'])) { $this->Paging["page"] = (int) $request_data['page']; } if (!empty($request_data['action']) && $request_data['action'] == 'edit' && !empty($request_data['ad_id'])) { $edit = TRUE; $res = Advertisement::get($params = NULL, $condition = array('ad_id' => (int) $request_data['ad_id'])); if (!empty($res)) { $form_data['ad_id'] = $res[0]->ad_id; $form_data['ad_image'] = $res[0]->ad_image; $form_data['ad_script'] = $res[0]->ad_script; $form_data['ad_url'] = $res[0]->url; $form_data['ad_title'] = $res[0]->title; $form_data['ad_description'] = $res[0]->description; $form_data['ad_page_id'] = $res[0]->page_id; $form_data['orientation'] = $res[0]->orientation; $form_data['created'] = $res[0]->created; } } else { if (!empty($request_data['action']) && $request_data['action'] == 'delete' && !empty($request_data['ad_id'])) { if (!empty($request_data['ad_id'])) { try { Advertisement::delete((int) $request_data['ad_id']); $error_msg = 19013; } catch (CNException $e) { $msg[] = $e->message; } } } else { if (!empty($request_data['action']) && !empty($request_data['ad_id'])) { $update = false; switch ($request_data['action']) { case 'disable': $field_value = DELETED; $msg_id = 19010; $update = true; break; case 'enable': $field_value = ACTIVE; $msg_id = 19011; $update = true; break; } if ($update) { $update_fields = array('is_active' => $field_value); $condition = array('ad_id' => $request_data['ad_id']); try { Advertisement::update($update_fields, $condition); $error_msg = $msg_id; } catch (CNException $e) { $msg[] = $e->message; } } } } } $advertisement = new Advertisement(); if (!$error && $request_method == 'POST' && $request_data['btn_apply_name']) { // if page is submitted if (!empty($request_data['ad_id'])) { $advertisement->ad_id = $request_data['ad_id']; $advertisement->created = $request_data['created']; $msg_id = 19007; } else { $msg_id = 19008; $advertisement->created = time(); } if (!empty($_FILES['ad_image']['name'])) { $filename = $_FILES['ad_image']['name']; $uploadfile = PA::$upload_path . basename($filename); $myUploadobj = new FileUploader(); $file = $myUploadobj->upload_file(PA::$upload_path, 'ad_image', TRUE, TRUE, 'image'); $advertisement->ad_image = $form_data['ad_image'] = $file; if ($file == FALSE) { $error = TRUE; $msg[] = $myUploadobj->error; } } else { if (!empty($request_data['ad_id'])) { $advertisement->ad_image = $request_data['edit_image']; } } if (empty($request_data['ad_url']) && empty($request_data['ad_script'])) { $error = TRUE; $msg[] = MessagesHandler::get_message(19012); } if (!empty($request_data['ad_url'])) { // if url is given then validate $request_data['ad_url'] = Validation::validate_url($request_data['ad_url']); if (!Validation::isValidURL($request_data['ad_url'])) { $error = TRUE; $msg[] = MessagesHandler::get_message(19009); } } $advertisement->user_id = PA::$login_uid; $advertisement->url = $form_data['ad_url'] = $request_data['ad_url']; $advertisement->ad_script = $form_data['ad_script'] = $request_data['ad_script']; $advertisement->title = $form_data['ad_title'] = $request_data['ad_title']; $advertisement->description = $form_data['ad_description'] = $request_data['ad_description']; $advertisement->page_id = $form_data['ad_page_id'] = $request_data['ad_page_id']; $advertisement->orientation = $form_data['orientation'] = $request_data['x_loc'] . ',' . $request_data['y_loc']; $advertisement->changed = time(); $advertisement->is_active = ACTIVE; if (!empty($_REQUEST['gid'])) { $advertisement->group_id = (int) $_REQUEST['gid']; } if (!$error) { try { $ad_id = $advertisement->save(); if (!empty($file)) { Storage::link($file, array("role" => "ad", "ad" => $ad_id)); } $error_msg = $msg_id; } catch (CNException $e) { $error_msg = $e->message; } } else { $error_msg = implode("<br/>", $msg); } } $this->form_data = $form_data; $this->edit = $edit; $this->message = $message; }
function __construct($cb, $page_id, $title, $page_template = "homepage_pa.tpl", $header_template = "header.tpl", $default_mode = PRI, $default_block_type = HOMEPAGE, $network_info_ = NULL, $onload = NULL, $setting_data = NULL) { global $app, $page; if (PA::$profiler) { PA::$profiler->startTimer('PageRenderer_init'); } // we may want to know the page_tpe elsewhere too PA::$config->page_type = $page_id; // NOTE: PA::$config->page_type var = $page_id and should be removed! $this->page_id = $page_id; $this->debugging = isset($_GET['debug']); $this->page_template = $page_template; $this->top_navigation_template = 'top_navigation_bar.tpl'; //TO DO: Remove this hardcoded text afterwards $this->header_template = $header_template; //settings for current network $this->network_info = $network_info_ ? $network_info_ : PA::$network_info; //FIXME: does this have to be a parameter? can't we just always use the global PA::$network_info? $this->module_arrays = array(); // the function hide_message_window is added here // so whenever html page is loaded the message window's ok button gets focus // here if previouly some function is defined as // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls);" // now it will look like // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls); hide_message_window();" $this->onload = "{$onload} hide_message_window('confirm_btn');"; $this->page_title = $title; $this->html_body_attributes = ""; // default settings for the tiers $this->main_tier = @$_GET['tier_one']; $this->second_tier = @$_GET['tier_two']; $this->third_tier = @$_GET['tier_three']; $navigation = new Navigation(); $this->navigation_links = $navigation->get_links(); $this->message_count = null; if (!isset(PA::$login_uid)) { PA::$login_uid = @$_SESSION['user']['id']; } if (PA::$login_uid) { $this->message_count = Message::get_new_msg_count(PA::$login_uid); } if (!isset($dynamic_page)) { $dynamic_page = new DynamicPage($this->page_id); if (!is_object($dynamic_page) or !$dynamic_page->docLoaded) { throw new Exception("Page XML config file for page ID: {$page_id} - not found!"); } $dynamic_page->initialize(); } if (false !== strpos($dynamic_page->page_type, 'group') && (!empty($_REQUEST['gid']) || !empty($_REQUEST['ccid']))) { // page is a group page - get group module settings $_gr_id = !empty($_REQUEST['gid']) ? $_REQUEST['gid'] : $_REQUEST['ccid']; $this->setting_data = ModuleSetting::load_setting($this->page_id, $_gr_id, 'group'); $this->page_template = $this->setting_data['page_template']; if (empty($this->setting_data['access_permission'])) { // no permissions required to access page $access_permission = true; } else { $access_permission = PermissionsHandler::can_group_user(PA::$login_uid, $_gr_id, array('permissions' => $this->setting_data['access_permission'])); } } else { if (false !== strpos($dynamic_page->page_type, 'user') && !empty(PA::$login_uid)) { // page is an user page - get user module settings // echo "POSTING TO USER PAGE"; die(); $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$login_uid, 'user'); $this->page_template = $this->setting_data['page_template']; if (empty($this->setting_data['access_permission'])) { // no permissions required to access page $access_permission = true; } else { $access_permission = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => $this->setting_data['access_permission'])); } } else { // page is a network page - get network module settings $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$network_info->network_id, 'network'); $this->page_template = $this->setting_data['page_template']; if (empty($this->setting_data['access_permission'])) { // no permissions required to access page $access_permission = true; } else { $access_permission = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => $this->setting_data['access_permission'])); } } } $this->page = new Template(CURRENT_THEME_FSPATH . "/" . $this->page_template); $this->page->set('current_theme_path', PA::$theme_url); $this->page->set('current_theme_rel_path', PA::$theme_rel); // Loading the templates variables for the Outer templates files $this->page->set('outer_class', get_class_name(PA::$config->page_type)); $this->top_navigation_bar = new Template(CURRENT_THEME_FSPATH . "/" . $this->top_navigation_template); $this->top_navigation_bar->set('current_theme_path', PA::$theme_url); $this->top_navigation_bar->set('current_theme_rel_path', PA::$theme_rel); $this->top_navigation_bar->set('navigation_links', $this->navigation_links); $this->setHeader($this->header_template); $this->footer = new Template(CURRENT_THEME_FSPATH . "/footer.tpl"); $this->footer->set('current_theme_path', PA::$theme_url); $this->footer->set('page_name', $title); $page = $this; $this->preInitialize($this->setting_data); $this->initNew($cb, $default_mode, $default_block_type, $this->setting_data); if (!$access_permission) { $configure = unserialize(ModuleData::get('configure')); if (PA::logged_in()) { $redir_url = PA::$url . PA_ROUTE_USER_PRIVATE; } else { if (!isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) { $redir_url = PA::$url . '/' . FILE_LOGIN; } else { $redir_url = PA::$url; } } $er_msg = urlencode("Sorry! you are not authorized to to access this page."); $this->showDialog($er_msg, $type = 'error', $redir_url, 10); } if (PA::$profiler) { PA::$profiler->stopTimer('PageRenderer_init'); } }
* Author: tekritisoftware * The lastest version of PeopleAggregator can be obtained from: * http://peopleaggregator.org * For questions, help, comments, discussion, etc. please visit * http://wiki.peopleaggregator.org/index.php * */ $login_required = TRUE; //including necessary files $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include_once "web/includes/page.php"; require_once "web/includes/network.inc.php"; require_once "api/Roles/Roles.php"; require_once "api/Permissions/PermissionsHandler.class.php"; $res = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => 'post_to_community, edit_content'), true); echo "Manage settings: {$res}"; $msg = ''; if (@$_GET['msg']) { $msg = $_GET['msg']; } //echo '<pre>';print_r($_POST);exit; if (@$_POST['save']) { $count_role = (int) $_POST['totalcount']; for ($i = 1; $i <= $count_role; $i++) { $role_id = $_POST['link_id' . $i]; $role = new Roles(); $task_count = (int) $_POST['taskcount']; for ($j = 1; $j <= $task_count; $j++) { $task_id = $_POST['taskid' . $j]; $chk = $role_id . '~' . $task_id;
private function checkUser($request_data) { $this->login_user = PA::$login_user; if (PA::$login_uid && is_object($this->board)) { $member = null; $members = PaForumsUsers::listPaForumsUsers("user_id = " . PA::$login_uid . " AND board_id = " . $this->board->get_id()); if (isset($members[0])) { $member = $members[0]; } if ($member) { // check is user a member $this->forum_user = $member; $user_status = $this->forum_user->get_user_status(); $this->shared_data['board_member'] = $this->forum_user; } else { // logged user but not member of this board! $is_member = false; switch ($this->board_type) { case PaForumBoard::network_board: $is_member = Network::member_exists($this->shared_data['network_id'], PA::$login_uid); break; case PaForumBoard::group_board: $is_member = Group::member_exists($this->gid, PA::$login_uid); break; case PaForumBoard::personal_board: $is_member = false; break; default: $is_member = false; } if ($is_member) { $user_status = PaForumsUsers::_allowed; try { $params = array("user_id" => PA::$login_uid, "board_id" => $this->board->get_id(), "user_status" => $user_status, "is_active" => 1, "date_join" => date("Y-m-d H:i:s")); PaForumsUsers::insertPaForumsUsers($params); $members = PaForumsUsers::listPaForumsUsers("user_id = " . PA::$login_uid . " AND board_id = " . $this->board->get_id()); if (isset($members[0])) { $this->forum_user = $members[0]; } } catch (Exception $e) { $error_msg = "Exception in ForumModule, function checkUser();<br />Message: " . $e->getMessage(); } } else { $user_status = PaForumsUsers::_notmember | PaForumsUsers::_anonymous; $this->forum_user = null; } } $params = array('permissions' => 'manage_forum', 'board' => $this->board, 'gid' => !empty($this->gid) ? $this->gid : null); if (PermissionsHandler::can_user(PA::$login_uid, $params)) { $user_status = $user_status | PaForumsUsers::_admin; } if ($user_status & PaForumsUsers::_banned) { $board = $this->getDefaultBoard($request_data, false); $this->setupBoard($board); $user = new User(); $user->load((int) $this->forum_user->get_user_id()); $this->title = __('Banned User'); $this->set_inner_template('cnmodule_content_banned_user.php'); $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'forum_user' => $user, 'user_status' => $user_status, 'board_settings' => $this->board_settings)); return false; } } else { $this->forum_user = null; $user_status = PaForumsUsers::_anonymous; } return $user_status; }
* [filename] is a part of PeopleAggregator. * [description including history] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @author [creator, or "Original Author"] * @license http://bit.ly/aVWqRV PayAsYouGo License * @copyright Copyright (c) 2010 Broadband Mechanics * @package PeopleAggregator */ $login_required = TRUE; include_once "web/includes/page.php"; require_once "api/Content/Content.php"; require_once "api/Announcement/Announcement.php"; require_once "api/Permissions/PermissionsHandler.class.php"; if ($_GET['aid']) { $params = array('permissions' => 'delete_content', 'cid' => $_GET['aid']); if (PermissionsHandler::can_user(PA::$login_uid, $params)) { $announcement = new Announcement(); $announcement->content_id = $_GET['aid']; $announcement->delete(); } } if (PA::$network_info) { $nid = PA::$network_info->network_id; } else { $nid = ''; } //unique name $cache_id = 'content_' . $_GET['cid'] . $nid; CachedTemplate::invalidate_cache($cache_id); $location = PA::$url . '/network_announcement.php'; header("Location: {$location}");
* For questions, help, comments, discussion, etc. please visit * https://github.com/CyberspaceNetworks/CoreSystem * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ require_once "api/CNPermissions/CNPermissionsHandler.php"; require_once "web/includes/classes/CNTinyMCE.php"; $tiny = new CNTinyMCE('blog'); echo $tiny->installTinyMCE(); /* require_once "web/includes/tinymce.php"; install_tinymce('full'); */ if (!empty($_REQUEST['ccid'])) { $permission_to_upload = PermissionsHandler::can_group_user(PA::$login_uid, $_REQUEST['ccid'], array('permissions' => 'upload_images, upload_videos')); } else { $permission_to_upload = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => 'upload_images, upload_videos')); } ?> <fieldset> <input id="blog_type" name="blog_type" type="hidden" value="<?php echo $blog_type == 'Suggestion' ? 'Suggestion' : 'CNBlogPost'; ?> " /> <input id="redirect" name="redirect" type="hidden" value="<?php echo urldecode(stripslashes($redirect)); ?> " /> <div class="field" > <label for="title"><span class="required"> * </span><b> <?php echo __("Title"); ?>
--> <option value=""> Select group blogs </option> <?php $var_groups = ""; for ($counter = 0; $counter < count($user_groups); $counter++) { $grp_id = $user_groups[$counter]['gid']; if ($grp_id == $ccid || in_array($grp_id, $existing_route_targets_group)) { $selected = "selected"; } else { $selected = ""; } $var_groups = $var_groups . $user_groups[$counter]['gid'] . ','; ?> <?php $permission_to_post = PermissionsHandler::can_group_user(PA::$login_uid, $user_groups[$counter]['gid'], array('permissions' => 'post_to_group')); if ($permission_to_post) { ?> <option value="<?php echo $user_groups[$counter]['gid']; ?> " <?php echo $selected; ?> ><?php echo chop_string(stripslashes($user_groups[$counter]['name']), NAME_LENGTH); ?> </option> <?php } ?>
<div class="post_info"><a href="#comment_<?php echo $comment['comment_id']; ?> "><?php echo PA::datetime($comment['created']); ?> </a> <?php $params = array('comment_info' => array('user_id' => $comment['user_id'], 'content_id' => $comment['content_id']), 'permissions' => 'delete_comment'); echo '</div>'; if (!empty(PA::$login_uid)) { echo '<div id="buttonbar"><ul>'; if (PermissionsHandler::can_user(PA::$login_uid, $params)) { echo '<li><a href="' . PA::$url . '/deletecomment.php?comment_id=' . $comment['comment_id'] . '" onclick="return confirm_delete(\'Are you sure you want to delete this comment ? \');">Delete</a></li>'; } if (PermissionsHandler::can_user(PA::$login_uid, $param_array) && $comment['user_id'] != PA::$login_uid) { echo '<li><a href="javascript: return void();" onclick = showhide_block("report_abuse_div_' . $comment['comment_id'] . '"); >Report abuse </a></li>'; } echo '</ul></div>'; } ?> </td> </tr> <tr><td colspan="2" <?php $id = $comment['comment_id']; $param['type'] = 'comment'; $param['div_id'] = "report_abuse_div_{$id}"; $param['id'] = $comment['comment_id']; echo uihelper_create_abuse_from($param); ?>
/** * Saves Group data to database * @access public * @param int $user_id ID of the user trying to save */ public function save($user_id = NULL) { Logger::log('Enter: Group::save() | Args: \\$user_id = ' . $user_id); if (!empty($user_id)) { $this->author_id = $user_id; } if (empty($this->title)) { Logger::log('Exit: Group::save(). Title of the group is not specified.'); throw new PAException(GROUP_NAME_NOT_EXIST, 'Title of the group is not specified'); } if (!isset($this->access_type)) { Logger::log('Exit: Group::save(). Access type for the group is not specifed'); throw new PAException(GROUP_ACCESS_TYPE_NOT_EXIST, 'Access type for the group is not specifed'); } if (!isset($this->reg_type)) { Logger::log('Exit: Group::save(). User registration type is not specified for the group.'); throw new PAException(GROUP_REGISTRATION_TYPE_NOT_EXIST, 'User registration type is not specified for the group.'); } if (!isset($this->is_moderated)) { Logger::log('Exit: Group::save(). Moderation type is not specifed for the group.'); throw new PAException(GROUP_IS_MODERATED_NOT_EXIST, 'Moderation type is not specifed for the group.'); } if (!empty($this->extra)) { $this->extra = serialize($this->extra); } //if collection_id exists the update else insert if ($this->collection_id) { // $user_type = Group::get_user_type ($this->author_id, $this->collection_id); // $access = $this->acl_object->acl_check( 'action', 'edit', 'users', $user_type, 'group', 'all' ); $access = PermissionsHandler::can_group_user(Group::get_owner_id((int) $this->collection_id), $this->collection_id, array('permissions' => 'manage_groups')); if (!$access) { throw new PAException(OPERATION_NOT_PERMITTED, 'You are not authorized to edit this group.'); } $sql = "UPDATE {groups} SET access_type = ?, reg_type = ?, is_moderated = ?, category_id = ? , header_image = ? , header_image_action = ?, display_header_image = ?, group_type =?, extra=? WHERE group_id = ?"; try { $res = Dal::query($sql, array($this->access_type, $this->reg_type, $this->is_moderated, $this->category_id, $this->header_image, $this->header_image_action, $this->display_header_image, $this->group_type, @$this->extra, $this->collection_id)); parent::save(); } catch (Exception $e) { Dal::rollback(); throw $e; } } else { //only registered user can create a group // This already has been taken care via session // we can add further modification if not use session user_id try { parent::save(); $sql = "INSERT INTO {groups} (group_id, access_type, reg_type, is_moderated, category_id, header_image, header_image_action, display_header_image, group_type, extra) VALUES (?, ?, ?, ?, ?,?,?,?, ?, ?)"; $data = array($this->collection_id, $this->access_type, $this->reg_type, $this->is_moderated, $this->category_id, $this->header_image, $this->header_image_action, $this->display_header_image, $this->group_type, @$this->extra); $res = Dal::query($sql, $data); $this->created = time(); $sql = "INSERT INTO {groups_users} (group_id, user_id, user_type, created) VALUES (?, ?, ?, ?)"; $res = Dal::query($sql, array($this->collection_id, $this->author_id, OWNER, $this->created)); foreach ($this->moderators as $mod) { $sql = "INSERT INTO {groups_users} (group_id, user_id, user_type, created) VALUES (?, ?, ?, ?)"; $res = Dal::query($sql, array($this->collection_id, $mod, MODERATOR, $this->created)); } Dal::commit(); // setup extra permissions for group owner // so, we need to assign group admin role to group owner now: $role_extra = array('user' => false, 'network' => false, 'groups' => array($this->collection_id)); $user_roles[] = array('role_id' => GROUP_ADMIN_ROLE, 'extra' => serialize($role_extra)); $group_owner = new User(); $group_owner->load($this->author_id); $group_owner->set_user_role($user_roles); } catch (Exception $e) { Dal::rollback(); throw $e; } } Logger::log("Exit: Group::save()"); return $this->collection_id; }
function initializeModule($request_method, $request_data) { if (empty($this->shared_data['group_info'])) { return 'skip'; } $this->group_details = $this->shared_data['group_info']; if (empty($request_data['gid'])) { return 'skip'; } // sanity check // we do this check only if the user is not already permitted to manage ads $gp_access = PermissionsHandler::can_group_user(PA::$login_uid, $request_data['gid'], array('permissions' => 'manage_groups')); if (!$gp_access) { return 'skip'; } // user shoudn't have gotten here in the first place, just don't show anything $error_msg = false; if ($request_method == 'POST') { $value_to_validate = array('title' => 'Title', 'bulletin_body' => 'Bulletin body'); foreach ($value_to_validate as $key => $value) { $request_data[$key] = trim($request_data[$key]); if (empty($request_data[$key])) { $error_msg .= $value . ' can not be empty<br>'; } } if (!$error_msg) { // if no errors yet $subject = $request_data['title']; $bull_message = $request_data['bulletin_body']; $group = new Group(); $group->load($request_data['gid']); if (!empty($request_data['bulletins'])) { // send to all members $gms = $group->get_members(); foreach ($gms as $i => $m) { $u = new User(); $u->load((int) $m['user_id']); $to_members[] = $u; } } else { if (!empty($request_data['send_to_me_only'])) { // test send to admin user $to_members = array(PA::$login_user); } } $this->sent_to = array(); // send it if (!empty($to_members)) { foreach ($to_members as $recipient) { $this->sent_to[] = $recipient->display_name; PANotify::send("group_bulletin_sent", $recipient, $group, array('bulletin.message' => $bull_message, 'bulletin.subject' => $subject)); } } // wannt a preview with that? if (!empty($request_data['preview'])) { // if preview is selected. $container_html = 'default_email_container.tpl'; $email_container = new Template('config/email_containers/' . $container_html); $email_container->set('subject', $subject); $email_container->set('message', $bull_message); $this->preview_msg = $email_container->fetch(); } } } }
"> approve </a> <?php } ?> <?php if ($denial_link) { ?> <a href="<?php echo $denial_link; ?> "> deny </a> <?php } ?> <?php if (PermissionsHandler::can_user(PA::$login_uid, $param_array) && $user_id != PA::$login_uid) { ?> <div id="buttonbar"> <ul> <li> <a href="javascript: return void();" onclick = "javascript: showhide_block('report_abuse_div');" >Report abuse</a> </li> </ul> </div> <?php } ?> </div> </td> </tr>
echo $id; ?> > <div class="box-header with-border"> <?php if (!empty($title)) { ?> <h3 class="box-title"><?php echo $title; ?> </h3> <?php } ?> <?php if (PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_ads'))) { ?> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i> </button> </div> <?php } else { ?> <div class="box-tools pull-right"> <div id="account_info"> <a href="#" class="btn btn-box-tool"><i class="fa fa-info"></i></a> </div> </div>
echo $label; ?> </a></div> <div class="panel-body"> <?php echo sprintf(__("There are %s entries in this directory."), $mod->groupCount[$type]); ?> <hr/> <?php if (!isset($_SESSION['user'])) { ?> <div class="alert alert-dismissable alert-danger"> <p>Please, log in or create a new account to add a new directory entry.</p> </div> <?php } elseif (PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'create_groups'))) { ?> <form action="<?php echo PA::$url . '/' . FILE_ADDGROUP; ?> "> <input type="hidden" name="entityType" value="<?php echo $type; ?> " /> <input type="submit" name="submit" class="btn btn-success btn-lg btn-block" value="<?php echo sprintf(__("Create new %s"), $label); ?> " /> </form> <?php
<?php /** ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * [filename] is a part of PeopleAggregator. * [description including history] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @author [creator, or "Original Author"] * @license http://bit.ly/aVWqRV PayAsYouGo License * @copyright Copyright (c) 2010 Broadband Mechanics * @package PeopleAggregator */ $can_manage_network = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_settings')); ?> <div class="id_list" id="id_list"> <!-- This div is added for open and close script --> <div id="open_close" class="display_false"> <?php $target = !empty($_REQUEST['gid']) ? '?ccid=' . $_REQUEST['gid'] : null; ?> <div class="edit_logoff" id="shortcut_post"> <a href="<?php echo PA::$url; ?> /post_content.php<?php echo $target; ?> "><?php echo __("Create Post"); ?> </a>
/** Purpose : this function is core funtion of this Navigation class. It is used to make links level_1,level_2,level_3 Some links need extra parameters append them here but first set them in their methods e.g. public function set_group_id($group_id){ $this->group_id = $group_id; } public function get_group_id() { return $this->group_id(); } Scope : public @param - it needs no direct input @return - it sets class variables level_1,level_2,level_3 which can be used further. **/ function make_links() { $user_id = isset($_SESSION['user']['id']) ? $_SESSION['user']['id'] : 0; ////These are level 1 links shown in top navigation bar $level_1 = array('home_network' => array('caption' => __('Return to home network'), 'url' => $this->mothership_info['url'])); // Display network directory, if network operation is enabled. if (PA::$network_capable) { $level_1['networks_directory'] = array('caption' => __('Network directory'), 'url' => $this->base_url . '/' . FILE_NETWORKS_HOME); } $owner = Network::is_admin($this->network_info->network_id, $user_id); //is_member will be true when user is registered member of the nework. $is_member = Network::member_exists($this->network_info->network_id, $this->get_uid()); if (!$this->is_anonymous && $this->network_info && !$is_member && $this->network_info->type != MOTHER_NETWORK_TYPE) { $level_1['join_network'] = array('caption' => __('JOIN Network'), 'url' => $this->base_url . '/' . FILE_NETWORK_ACTION . '?action=join&nid=' . $this->network_info->network_id . '&cid=' . $this->network_info->category_id); } else { if (!$this->is_anonymous && $is_member && !$owner && $this->network_info->type != MOTHER_NETWORK_TYPE) { $level_1['unjoin_network'] = array('caption' => __('Unjoin Network'), 'url' => $this->base_url . '/' . FILE_NETWORK_ACTION . '?action=leave&nid=' . $this->network_info->network_id . '&cid=' . $this->network_info->category_id); } else { if (Network::is_admin($this->network_info->network_id, (int) $user_id)) { $level_1['configure_network'] = array('caption' => __('Configure'), 'url' => $this->base_url . PA_ROUTE_CONFIGURE_NETWORK); } } } if ($this->network_info->type == MOTHER_NETWORK_TYPE) { unset($level_1['home_network']); } if (PA::$config->enable_network_spawning) { $level_1['create_network'] = array('caption' => __('Create a network'), 'url' => $this->mothership_info['extra']['links']['create_network']); } ////END OF These are level 1 links shown in top navigation bar ////These are level 2 links shown in second navigation bar $level_2 = array('home' => array('caption' => __('Home'), 'url' => $this->base_url . PA_ROUTE_HOME_PAGE), 'user' => array('caption' => __(PA::$mypage_noun), 'url' => $this->base_url . PA_ROUTE_USER_PRIVATE), 'people' => array('caption' => __(PA::$people_noun), 'url' => $this->base_url . PA_ROUTE_PEOPLES_PAGE), 'groups' => array('caption' => __(PA::$group_noun_plural), 'url' => $this->base_url . PA_ROUTE_GROUPS)); if (!empty(PA::$config->useTypedGroups)) { $level_2 = $level_2 + array('directory' => array('caption' => __('Orgs'), 'url' => $this->base_url . PA_ROUTE_TYPED_DIRECTORY)); if (!empty(PA::$config->simple['use_families'])) { $level_2 = $level_2 + array('families' => array('caption' => __('Neighbors'), 'url' => $this->base_url . PA_ROUTE_FAMILY_DIRECTORY)); } } $level_2 = $level_2 + array('forum' => array('caption' => __('Forum'), 'url' => $this->base_url . PA_ROUTE_FORUMS . "/network_id=" . $this->network_info->network_id), 'search' => array('caption' => __('Search'), 'url' => $this->base_url . PA_ROUTE_SEARCH_HOME . '/btn_searchContent=Search+Content')); ////END OF These are level 2 links shown in second navigation bar /// children of user 2nd level link $uid = $this->get_uid(); //we need uid for some links $user_children = array(); $user_children = $user_children + array('user_private' => array('caption' => __('My Page'), 'url' => $this->base_url . PA_ROUTE_USER_PRIVATE)); $user_children = $user_children + array('user_widgets' => array('caption' => __('My Widgets'), 'url' => $this->base_url . '/' . FILE_WIDGET)); $user_children = $user_children + array('messages' => array('caption' => __('My Messages'), 'url' => $this->base_url . PA_ROUTE_MYMESSAGE)); $user_children = $user_children + array('my_gallery' => array('caption' => __('My Gallery'), 'url' => $this->base_url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$uid}")); $user_children = $user_children + array('my_events' => array('caption' => __('My Events'), 'url' => $this->base_url . '/' . FILE_USER_CALENDAR), 'my_friends' => array('caption' => __('My Friends'), 'url' => $this->base_url . "/view_all_members.php?view_type=in_relations&uid={$uid}")); $user_children = $user_children + array('my_forum' => array('caption' => __('My Forum'), 'url' => $this->base_url . PA_ROUTE_FORUMS . "/network_id=" . $this->network_info->network_id . '&user_id=' . $uid)); $user_children = $user_children + array('my_points' => array('caption' => __('My Points'), 'url' => $this->base_url . PA_ROUTE_POINTS_DIRECTORY . "?uid={$uid}")); if (!empty(PA::$config->simple['use_families'])) { // get this users Family or Families require_once "api/Entity/TypedGroupEntityRelation.php"; $userfamilyRelations = TypedGroupEntityRelation::get_relation_for_user($uid, 'family'); if (count($userfamilyRelations) == 1) { $user_children = $user_children + array('my_family' => array('caption' => __('My Family'), 'url' => $this->base_url . PA_ROUTE_FAMILY . "?gid=" . $userfamilyRelations[0]->object_id)); } else { $html = "<ul>"; foreach ($userfamilyRelations as $i => $relation) { $group = ContentCollection::load_collection((int) $relation->object_id, PA::$login_uid); $html .= "<li>"; $html .= "<a href=\"" . $this->base_url . PA_ROUTE_FAMILY . "?gid=" . $relation->object_id . "\">" . $group->title . "</a>"; $html .= "</li>"; } $html .= "</ul>"; $user_children = $user_children + array('my_family' => array('caption' => __('My Families'), 'html' => $html)); } } // end of !empty(PA::$config->simple['use_families']) $user_children = $user_children + array('settings' => array('caption' => __('Edit My Account'), 'url' => $this->base_url . PA_ROUTE_EDIT_PROFILE)); $user_children = $user_children + array('customize_ui' => array('caption' => __('Themes'), 'url' => $this->base_url . PA_ROUTE_CUSTOMIZE_USER_GUI . "/theme/uid={$uid}")); if ($this->is_anonymous) { //these links are not for anonymous unset($user_children); } ///END OF children of user 2nd level link /// children of people 2nd level link //required friend id in some places $friend_id = $this->get_friend_uid(); $people_children = array('find_people' => array('caption' => sprintf(__('Find %s'), __(PA::$people_noun)), 'url' => $this->base_url . PA_ROUTE_PEOPLES_PAGE), 'my_friends' => array('caption' => __('My friends'), 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=relations&uid=' . $uid), 'friends_gallery' => array('caption' => __('Friends gallery'), 'url' => $this->base_url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$friend_id}&view=friends")); if ($this->is_anonymous) { //these links are not for anonymous unset($people_children); } ///EOF children of people 2nd level link $family_children = array('neighbors' => array('caption' => __("Neighbors"), 'url' => $this->base_url . PA_ROUTE_FAMILY_DIRECTORY), 'family_home' => array('caption' => __("Family Homepage"), 'url' => $this->base_url . PA_ROUTE_FAMILY . "/gid=" . $this->group_id), 'family_members' => array('caption' => __("Family Members"), 'url' => $this->base_url . PA_ROUTE_FAMILY_MEMBERS . "/gid=" . $this->group_id)); /// group general children // $users_first_group_id = $this->get_users_first_group_id(); $groups_general = array('find_groups' => array('caption' => sprintf(__('Find %s'), __(PA::$group_noun_plural)), 'url' => $this->base_url . PA_ROUTE_GROUPS), 'create_group' => array('caption' => __('Create'), 'url' => $this->base_url . '/' . FILE_ADDGROUP), 'invite' => array('caption' => __('Invite'), 'url' => $this->base_url . '/' . FILE_GROUP_INVITATION)); if ($this->is_anonymous) { //these links are not for anonymous unset($groups_general['create_group']); unset($groups_general['invite']); unset($groups_general['group_media_gallery']); } /// EOF group general children ///group specific menu children $gid = $group_id = $this->get_group_id(); $group_specific = array('group_home' => array('caption' => sprintf(__('%s Home'), __(PA::$group_noun)), 'url' => $this->base_url . PA_ROUTE_GROUP . '/gid=' . $group_id), 'group_forum' => array('caption' => sprintf(__('%s Forum'), __(PA::$group_noun)), 'url' => $this->base_url . PA_ROUTE_FORUMS . "/network_id=" . $this->network_info->network_id . '&gid=' . $group_id), 'group_members' => array('caption' => sprintf(__('%s Members'), __(PA::$group_noun)), 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?gid=' . $group_id), 'group_gallery' => array('caption' => sprintf(__('%s Gallery'), __(PA::$group_noun)), 'url' => $this->base_url . PA_ROUTE_MEDIA_GALLEY_IMAGES . '/view=groups_media&gid=' . $group_id), 'group_events' => array('caption' => sprintf(__('%s Events'), __(PA::$group_noun)), 'url' => $this->base_url . '/' . FILE_GROUP_CALENDAR . '?gid=' . $group_id)); $group_member = FALSE; $group_may_post = FALSE; $group_may_invite = FALSE; $group_moderator = FALSE; $group_manange_ads = FALSE; $group_owner = FALSE; if (PA::$login_uid) { if (Group::member_exists($gid, PA::$login_uid)) { $group_member = TRUE; // TODO: split this out to it's own perm check $group_may_post = TRUE; $group_may_invite = TRUE; } if (PermissionsHandler::can_group_user(PA::$login_uid, $gid, array('permissions' => 'manage_groups, manage_roles')) || Group::is_admin($gid, PA::$login_uid)) { $group_owner = TRUE; $group_moderator = TRUE; } else { if (PermissionsHandler::can_group_user(PA::$login_uid, $gid, array('permissions' => 'manage_groups'))) { $group_moderator = TRUE; } } // network level ad manager? $group_manange_ads = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_ads')); // check for manageads of group permissions if (!$group_manange_ads) { // we do this check only if the user is not already permitted to manage ads $group_manange_ads = PermissionsHandler::can_group_user(PA::$login_uid, $gid, array('permissions' => 'manage_ads')); } if ($group_may_invite) { $group_specific = array('invite' => array('caption' => __("Invite a Friend"), 'url' => PA::$url . PA_ROUTE_GROUP_INVITE . '/gid=' . $gid)) + $group_specific; } if ($group_may_post) { // member get's a 'Create Post' link on top $group_specific = array('create_post' => array('caption' => __("Create post"), 'url' => PA::$url . '/post_content.php?ccid=' . $gid)) + $group_specific; } // admin / owner if ($group_owner) { $group_specific = $group_specific + array('settings' => array('caption' => __("Group Settings"), 'url' => PA::$url . '/addgroup.php?gid=' . $gid), 'group_poll_select' => array('caption' => sprintf(__('%s Poll Select'), __(PA::$group_noun)), 'url' => $this->base_url . '/group_poll.php?gid=' . $group_id . '&type=select'), 'group_poll_create' => array('caption' => sprintf(__('%s Poll Create'), __(PA::$group_noun)), 'url' => $this->base_url . '/group_poll.php?gid=' . $group_id . '&type=create')); } // admin / moderator if ($group_moderator) { $group_specific = $group_specific + array('bulletin' => array('caption' => __("Group Bulletin"), 'url' => PA::$url . PA_ROUTE_GROUP_BULLETINS . '?gid=' . $gid), 'moderate' => array('caption' => __("Moderate"), 'url' => PA::$url . PA_ROUTE_GROUP_MODERATION . '/view=members&gid=' . $gid), 'manage_members' => array('caption' => __("Manage Content"), 'url' => PA::$url . '/manage_group_content.php?gid=' . $gid), 'group_customize_ui' => array('caption' => __('Group Appearance'), 'url' => $this->base_url . PA_ROUTE_CUSTOMIZE_GROUP_GUI . '/theme/gid=' . $group_id)); } // ads if ($group_manange_ads) { $group_specific = $group_specific + array('ads' => array('caption' => __("Manage Ads"), 'url' => PA::$url . PA_ROUTE_GROUP_AD_CENTER . '?gid=' . $gid)); } // the join/unjoin/delete go last if ($group_owner) { // only the owner can delete $group_specific = $group_specific + array('delete_group' => array('caption' => __('Delete'), 'url' => $this->base_url . PA_ROUTE_GROUP . '/action=delete&gid=' . $group_id, 'extra' => ' onclick ="return delete_confirmation_msg(\'' . __('Are you sure you want to delete this group') . '?\') "')); } else { // anyone else if ($group_member) { $group_specific = $group_specific + array('unjoin' => array('caption' => __('Unjoin'), 'url' => $this->base_url . PA_ROUTE_GROUP . '/gid=' . $group_id . '&action=leave')); } else { $group_specific = $group_specific + array('join' => array('caption' => __('Join'), 'url' => $this->base_url . PA_ROUTE_GROUP . '/gid=' . $group_id . '&action=join')); } } } ///EOF group specific menu children /// children of group $groups_children = array('groups_general' => $groups_general, 'group_specific' => $group_specific); ///EOF children of group //for network option at 3 level $network = array('configure_network' => array('caption' => __('Configure'), 'url' => $this->base_url . PA_ROUTE_CONFIGURE_NETWORK)) + $level_2; $network_notify = array('email_notification' => array('caption' => __('Email Notification'), 'url' => $this->base_url . '/' . FILE_EMAIL_NOTIFICATION), 'network_bulletins' => array('caption' => __('Bulletins'), 'url' => $this->base_url . '/' . FILE_NETWORK_BULLETINS)); $network_setting = array('network_feature' => array('caption' => __('Set Feature Network'), 'url' => $this->base_url . '/' . FILE_NETWORK_FEATURE), 'manage_emblem' => array('caption' => __('Manage Emblem'), 'url' => $this->base_url . '/' . FILE_MANAGE_EMBLEM), 'manage_taketour' => array('caption' => __('Personalized Video'), 'url' => $this->base_url . '/' . FILE_MANAGE_TAKETOUR), 'splash_page' => array('caption' => __('Configure Splash Page'), 'url' => $this->base_url . '/' . FILE_CONFIGURE_SPLASH_PAGE), 'top_bar' => array('caption' => __('Top Bar Enable/Disable'), 'url' => '#')); $network_default = array('new_user_by_admin' => array('caption' => __('Create User'), 'url' => $this->base_url . '/' . FILE_NEW_USER_BY_ADMIN), 'user_defaults' => array('caption' => __('User Defaults'), 'url' => $this->base_url . '/' . FILE_NETWORK_USER_DEFAULTS), 'relationship_settings' => array('caption' => __('Relationships'), 'url' => $this->base_url . '/' . FILE_RELATIONSHIP_SETTINGS)); $manage_network = array('manage_user' => array('caption' => __('Manage Users'), 'url' => $this->base_url . '/' . FILE_NETWORK_MANAGE_USER), 'manage_content' => array('caption' => __('Manage Contents'), 'url' => $this->base_url . '/' . FILE_NETWORK_MANAGE_CONTENT), 'manage_links' => array('caption' => __('Manage Links'), 'url' => $this->base_url . '/' . FILE_NETWORK_LINKS)); $network_stats = array('statistics' => array('caption' => __('General'), 'url' => $this->base_url . PA_ROUTE_CONFIGURE_NETWORK), 'customize_ui' => array('caption' => __('Customize UI'), 'url' => $this->base_url . '/' . FILE_NETWORK_CUSTOMIZE_UI_PAGE)); $network_module_selector = array('home_page_id' => array('caption' => __('Home Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=home_page_id'), 'user_default_page_id' => array('caption' => __('User Default Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=user_default_page_id'), 'group_directory_page_id' => array('caption' => __('Group Directory Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=group_directory_page_id'), 'network_directory_page_id' => array('caption' => __('Network Directory Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=network_directory_page_id')); if ($this->network_info->type != MOTHER_NETWORK_TYPE) { unset($network['meta_network']); } if ($this->network_info->type != MOTHER_NETWORK_TYPE) { unset($network['manage_taketour']); unset($network['manage_emblem']); } //end /// second level menu for network $level_3 = array('user' => @$user_children, 'people' => @$people_children, 'family' => @$family_children, 'groups' => $groups_children, 'network' => $network, 'network_notify' => $network_notify, 'network_module_selector' => $network_module_selector, 'network_setting' => $network_setting, 'network_default' => $network_default, 'manage_network' => $manage_network, 'network_stats' => $network_stats); ///EOF second level menu children ///set level menu items $this->level_1 = $level_1; $this->level_2 = $level_2; $this->level_3 = $level_3; }
function generate_inner_html($contents) { $request_data = $this->request_data; $inner_html = ''; if ($this->mode == PRI && $this->type == 'user') { if (PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_content'))) { $inner_html .= ' <ul class="nav nav-tabs"> <li class="active"><a href="' . PA::$url . '/cncontent_blog.php"> ' . __("Create post") . '</a> </li> <li><a href="' . PA::$url . '/cncontent_management.php"> ' . __("Manage posts") . '</a> </li> <li><a href="' . PA::$url . PA_ROUTE_USER_PUBLIC . '/' . PA::$login_uid . '"> ' . __("View my public page") . '</a> </li> </ul> '; } else { $inner_html .= ' <ul class="nav nav-tabs"> <li class="active"><a href="' . PA::$url . '/cncontent_blog.php"> ' . __("Create post") . '</a> </li> <li><a href="' . PA::$url . PA_ROUTE_USER_PUBLIC . '/' . PA::$login_uid . '"> ' . __("View my public page") . '</a> </li> </ul> '; } } else { if ($this->type == 'user') { if (PA::$page_uid == PA::$login_uid) { $inner_html .= ' <ul class="nav nav-tabs"> <li class="active"><a href="' . PA::$url . PA_ROUTE_USER_PRIVATE . '"> ' . __("Return to private page") . '</a> </li> </ul> '; } } } if ($this->type == 'tag') { $tag_name = Tag::get_tag_name($this->tag_id); $inner_html .= "<h1>" . sprintf(__("Showing results for tag %s."), $tag_name) . "</h1>"; } // if ($this->type == 'group') if ($contents) { // echo "<pre>".print_r($contents, 1)."</pre>"; //foreach ($contents as $content) { for ($i = 0; $i < count($contents); $i++) { if ($i == 0) { $inner_html .= uihelper_generate_center_content($contents[$i]['content_id'], 0, 1); } else { $inner_html .= uihelper_generate_center_content($contents[$i]['content_id']); } } } else { if ($this->type == "search") { $inner_html .= "<div class=\"center\" style=\"text-align:center; padding: 16px\"><b>" . __("No items match your search criteria.") . "</b><br /><br /><input type=\"button\" value=\"" . __('Back') . "\" onclick=\"history.back()\"/>" . "</div>"; } else { $inner_html .= '<div class="auto">' . $this->message['message']; if ($this->mode == 'private' || isset($this->group)) { if (!empty($this->message['queryString'])) { $link = PA::$url . '/cncontent_blog.php?' . $this->message['queryString']; if (isset($this->group->collection_id) && $this->group->collection_id > 0) { $link = PA::$url . '/cncontent_blog.php?' . $this->message['queryString'] . '&ccid=' . $this->group->collection_id; } } else { $link = PA::$url . '/cncontent_blog.php'; if (isset($this->group->collection_id) && $this->group->collection_id > 0) { $link = PA::$url . '/cncontent_blog.php?ccid=' . $this->group->collection_id; } } if (PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_content'))) { $inner_html .= " " . sprintf(__('Click <a href="%s">here</a> to add content.'), $link); } else { $inner_html .= '<p>Please update your account to create new posts.</p>'; } } $inner_html .= "</div>"; } } return $inner_html; }