Esempio n. 1
0
/**
 * Get page components to view a blog post.
 *
 * @param int $guid GUID of a blog entity.
 * @return array
 */
function blog_get_page_content_read($guid = NULL)
{
    $return = array();
    elgg_entity_gatekeeper($guid, 'object', 'blog');
    $blog = get_entity($guid);
    // no header or tabs for viewing an individual blog
    $return['filter'] = '';
    elgg_set_page_owner_guid($blog->container_guid);
    elgg_group_gatekeeper();
    $return['title'] = $blog->title;
    $container = $blog->getContainerEntity();
    $crumbs_title = $container->name;
    if (elgg_instanceof($container, 'group')) {
        elgg_push_breadcrumb($crumbs_title, "blog/group/{$container->guid}/all");
    } else {
        elgg_push_breadcrumb($crumbs_title, "blog/owner/{$container->username}");
    }
    elgg_push_breadcrumb($blog->title);
    $return['content'] = elgg_view_entity($blog, array('full_view' => true));
    // check to see if we should allow comments
    if ($blog->comments_on != 'Off' && $blog->status == 'published') {
        $return['content'] .= elgg_view_comments($blog);
    }
    return $return;
}
Esempio n. 2
0
<?php

$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', \ColdTrick\EventManager\Event\Day::SUBTYPE);
$entity = get_entity($guid);
$title = $entity->title;
if (!$entity->delete()) {
    register_error(elgg_echo('entity:delete:fail', [$title]));
}
Esempio n. 3
0
<?php

$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', \Wizard::SUBTYPE);
$entity = get_entity($guid);
$new_entity = clone $entity;
$new_entity->save();
foreach ($entity->getSteps() as $step) {
    $new_step = clone $step;
    $new_step->container_guid = $new_entity->guid;
    $new_step->save();
}
forward('admin/administer_utilities/wizard');
Esempio n. 4
0
<?php

$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_set_page_owner_guid($guid);
elgg_group_gatekeeper();
$title = elgg_echo('groups:members:title', array($group->name));
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb(elgg_echo('groups:members'));
$db_prefix = elgg_get_config('dbprefix');
$content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
Esempio n. 5
0
File: view.php Progetto: ibou77/elgg
<?php

/**
 * View a bookmark
 *
 * @package ElggBookmarks
 */
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'object', 'bookmarks');
$bookmark = get_entity($guid);
$page_owner = elgg_get_page_owner_entity();
elgg_group_gatekeeper();
$crumbs_title = $page_owner->name;
if (elgg_instanceof($page_owner, 'group')) {
    elgg_push_breadcrumb($crumbs_title, "bookmarks/group/{$page_owner->guid}/all");
} else {
    elgg_push_breadcrumb($crumbs_title, "bookmarks/owner/{$page_owner->username}");
}
$title = $bookmark->title;
elgg_push_breadcrumb($title);
$content = elgg_view_entity($bookmark, array('full_view' => true));
$content .= elgg_view_comments($bookmark);
$body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'filter' => ''));
echo elgg_view_page($title, $body);
<?php

/**
 * Quickly open/close a discussion
 */
$guid = (int) get_input('guid');
if (empty($guid)) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
elgg_entity_gatekeeper($guid, 'object', 'discussion');
$entity = get_entity($guid);
if (!$entity->canEdit()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
if ($entity->status === 'closed') {
    $entity->status = 'open';
    system_message(elgg_echo('discussions_tools:action:discussions:toggle_status:success:open'));
} else {
    $entity->status = 'closed';
    system_message(elgg_echo('discussions_tools:action:discussions:toggle_status:success:close'));
}
forward(REFERER);
Esempio n. 7
0
<?php

/**
 * View a question
 *
 * @package ElggQuestions
 */
$guid = (int) elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid, 'object', 'question');
$question = get_entity($guid);
// set page owner
$page_owner = $question->getContainerEntity();
// set breadcrumb
$crumbs_title = $page_owner->name;
if ($page_owner instanceof ElggGroup) {
    elgg_push_breadcrumb($crumbs_title, "questions/group/{$page_owner->guid}");
} else {
    elgg_push_breadcrumb($crumbs_title, "questions/owner/{$page_owner->username}");
}
$title = $question->title;
elgg_push_breadcrumb($title);
// build page elements
$title_icon = '';
$content = elgg_view_entity($question, ['full_view' => true]);
$answers = '';
// add the answer marked as the correct answer first
$marked_answer = $question->getMarkedAnswer();
if (!empty($marked_answer)) {
    $answers .= elgg_view_entity($marked_answer);
}
// add the rest of the answers
Esempio n. 8
0
<?php

/**
 * Edit an existing newsletter
 *
 * @uses get_input("guid") the guid of the newsletter to edit
 */
elgg_gatekeeper();
elgg_require_js('newsletter/edit');
$guid = (int) get_input('guid');
$subpage = get_input('subpage');
// validate input
elgg_entity_gatekeeper($guid, 'object', Newsletter::SUBTYPE);
$entity = get_entity($guid);
if (!$entity->canEdit()) {
    register_error(elgg_echo('limited_access'));
    forward(REFERER);
}
// set page owner
$container = $entity->getContainerEntity();
if (elgg_instanceof($container, 'group')) {
    elgg_set_page_owner_guid($entity->getContainerGUID());
} else {
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
}
// breadcrumb
elgg_push_breadcrumb(elgg_echo('newsletter:breadcrumb:site'), 'newsletter/site');
if (elgg_instanceof($container, 'group')) {
    elgg_push_breadcrumb($container->name, 'newsletter/group/' . $container->getGUID());
}
elgg_push_breadcrumb($entity->title, $entity->getURL());
Esempio n. 9
0
<?php

/**
* Read a message page
*
* @package ElggMessages
*/
elgg_gatekeeper();
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'object', 'messages');
$message = get_entity($guid);
$from_user = get_user($message->fromId);
$to_user = get_user($message->toId);
// mark the message as read
$message->readYet = true;
elgg_set_page_owner_guid($message->getOwnerGUID());
$page_owner = elgg_get_page_owner_entity();
$title = htmlspecialchars($message->title, ENT_QUOTES, 'UTF-8');
$inbox = false;
if ($page_owner->getGUID() == $message->toId) {
    $inbox = true;
    elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'messages/inbox/' . $page_owner->username);
} else {
    elgg_push_breadcrumb(elgg_echo('messages:sent'), 'messages/sent/' . $page_owner->username);
}
elgg_push_breadcrumb($title);
$from_user->name = utf8_encode($from_user->name);
$to_user->name = utf8_encode($to_user->name);
$message->title = utf8_encode($message->title);
$content = elgg_view_entity($message, array('full_view' => true));
if ($inbox) {
<?php

$guid = (int) get_input('guid');
$user = (int) get_input('user');
// could also be a registration object
elgg_entity_gatekeeper($guid, 'object', Event::SUBTYPE);
$event = get_entity($guid);
elgg_entity_gatekeeper($user);
$object = get_entity($user);
if (!$event->canEdit()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
event_manager_send_registration_validation_email($event, $object);
system_message(elgg_echo('event_manager:action:resend_confirmation:success'));
forward(REFERER);
Esempio n. 11
0
File: view.php Progetto: ibou77/elgg
<?php

/**
 * View individual wire post
 */
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'object', 'thewire');
$post = get_entity($guid);
$owner = $post->getOwnerEntity();
if (!$owner) {
    forward();
}
$title = elgg_echo('thewire:by', array($owner->name));
elgg_push_breadcrumb(elgg_echo('thewire'), 'thewire/all');
elgg_push_breadcrumb($owner->name, 'thewire/owner/' . $owner->username);
elgg_push_breadcrumb($title);
$content = elgg_view_entity($post);
$body = elgg_view_layout('content', array('filter' => false, 'content' => $content, 'title' => $title));
echo elgg_view_page($title, $body);
Esempio n. 12
0
<?php

elgg_gatekeeper();
$folder_guid = get_input("folder_guid");
elgg_entity_gatekeeper($folder_guid, "object", FILE_TOOLS_SUBTYPE);
$folder = get_entity($folder_guid);
if (!$folder->canEdit()) {
    register_error(elgg_echo("limited_access"));
    forward(REFERER);
}
// set context and page_owner
elgg_set_context("file");
elgg_set_page_owner_guid($folder->getContainerGUID());
// build page elements
$title_text = elgg_echo("file_tools:edit:title");
$form_vars = array("id" => "file_tools_edit_form");
$body_vars = array("folder" => $folder, "page_owner_entity" => elgg_get_page_owner_entity());
$edit = elgg_view_form("file_tools/folder/edit", $form_vars, $body_vars);
// build page
$body = elgg_view_layout("one_sidebar", array("title" => $title_text, "content" => $edit));
echo elgg_view_page($title_text, $body);
Esempio n. 13
0
<?php

elgg_admin_gatekeeper();
$guid = (int) elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid, 'object', WizardStep::SUBTYPE);
/* @var $entity WizardStep */
$entity = get_entity($guid);
/* @var $container Wizard */
$container = $entity->getContainerEntity();
$title = elgg_echo('wizard:step:edit:title', [$entity->getDisplayName(), $container->title]);
$form = elgg_view_form('wizard_step/edit', [], ['entity' => $entity]);
if (elgg_is_xhr()) {
    echo elgg_view_module('inline', $title, $form);
} else {
    $page_data = elgg_view_layout('content', ['title' => $title, 'content' => $form, 'filter' => '']);
    echo elgg_view_page($title, $page_data);
}
Esempio n. 14
0
<?php

$guid = (int) get_input('guid');
$post = $_POST;
$registrationFields = [];
elgg_entity_gatekeeper($guid, 'object', EventRegistration::SUBTYPE);
$registration = get_entity($guid);
foreach ($post as $key => $value) {
    if (substr($key, 0, 8) !== 'question') {
        continue;
    }
    $questionId = substr($key, 8, strlen($key));
    $registrationFields[] = $questionId . '|' . $value;
}
$event = $registration->getEntitiesFromRelationship(['relationship' => 'event_user_registered', 'inverse_relationship' => true]);
$registration->clearAnnotations('answer');
foreach ($registrationFields as $answer) {
    $registration->annotate('answer', $answer, $event[0]->access_id);
}
system_message(elgg_echo('event_manager:action:event:edit:ok'));
forward($event[0]->getURL());
Esempio n. 15
0
elgg_gatekeeper();
$guid = (int) elgg_extract('guid', $vars);
$body_vars = [];
$sidebar = '';
$page_owner = elgg_get_page_owner_entity();
$site = elgg_get_site_entity();
if (!$page_owner instanceof ElggGroup) {
    elgg_set_page_owner_guid($site->getGUID());
    $page_owner = $site;
}
$body_vars['owner'] = $page_owner;
elgg_push_breadcrumb(elgg_echo('static:all'), 'static/all');
$ia = elgg_set_ignore_access(true);
if ($guid) {
    elgg_entity_gatekeeper($guid, 'object', 'static');
    $entity = get_entity($guid);
    if (!$entity->canEdit()) {
        elgg_set_ignore_access($ia);
        forward(REFERER);
    }
    $body_vars['entity'] = $entity;
    elgg_set_page_owner_guid($entity->getOwnerGUID());
    $page_owner = elgg_get_page_owner_entity();
    $body_vars['owner'] = $page_owner;
    $sidebar = elgg_view('static/sidebar/revisions', ['entity' => $entity]);
}
if ($page_owner instanceof ElggGroup) {
    elgg_push_breadcrumb(elgg_echo('static:groups:title'), "static/group/{$page_owner->getGUID()}");
}
if (!empty($entity)) {
Esempio n. 16
0
<?php

$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', Event::SUBTYPE);
$entity = get_entity($guid);
$forward = 'events';
$container = $entity->getContainerEntity();
if ($container instanceof \ElggGroup) {
    $forward = 'events/event/list/' . $container->getGUID();
}
$title = $entity->title;
if ($entity->delete()) {
    system_message(elgg_echo('entity:delete:success', [$title]));
    forward($forward);
} else {
    register_error(elgg_echo('entity:delete:fail', [$title]));
}
forward(REFERER);
Esempio n. 17
0
/**
 * View a discussion topic
 *
 * @param int $guid GUID of topic
 */
function discussion_handle_view_page($guid)
{
    // We now have RSS on topics
    global $autofeed;
    $autofeed = true;
    elgg_entity_gatekeeper($guid, 'object', 'groupforumtopic');
    $topic = get_entity($guid);
    $group = $topic->getContainerEntity();
    if (!elgg_instanceof($group, 'group')) {
        register_error(elgg_echo('group:notfound'));
        forward();
    }
    elgg_load_js('elgg.discussion');
    elgg_set_page_owner_guid($group->getGUID());
    elgg_group_gatekeeper();
    elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}");
    elgg_push_breadcrumb($topic->title);
    $params = array('topic' => $topic, 'show_add_form' => false);
    $content = elgg_view_entity($topic, array('full_view' => true));
    if ($topic->status == 'closed') {
        $content .= elgg_view('discussion/replies', $params);
        $content .= elgg_view('discussion/closed');
    } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) {
        $params['show_add_form'] = true;
        $content .= elgg_view('discussion/replies', $params);
    } else {
        $content .= elgg_view('discussion/replies', $params);
    }
    $params = array('content' => $content, 'title' => $topic->title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($topic->title, $body);
}
Esempio n. 18
0
<?php

/**
 * edit a new site announcement
 */
// only for editors
site_announcements_editor_gatekeeper();
// get entity
$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', SITE_ANNOUNCEMENT_SUBTYPE);
$entity = get_entity($guid);
// breadcrumb
elgg_push_breadcrumb(elgg_echo('site_annoucements'), 'announcements/all');
elgg_push_breadcrumb(elgg_echo('edit'));
// build page elements
$title = elgg_echo('site_annoucements:edit:title');
$content = elgg_view_form('site_announcements/edit', array(), array('entity' => $entity));
// build page
$page_data = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => ''));
// draw page
echo elgg_view_page($title, $page_data);
Esempio n. 19
0
<?php

/**
 * This action marks an answer as the correct answer for a question.
 *
 */
$guid = (int) get_input('guid');
if (empty($guid)) {
    register_error(elgg_echo('InvalidParameterException:MissingParameter'));
    forward(REFERER);
}
elgg_entity_gatekeeper($guid, 'object', 'answer');
$entity = get_entity($guid);
// are you allowed to mark answers as correct
if (!questions_can_mark_answer($entity)) {
    register_error(elgg_echo('questions:action:answer:toggle_mark:error:not_allowed'));
    forward(REFERER);
}
$question = $entity->getContainerEntity();
$answer = $question->getMarkedAnswer();
if (empty($answer)) {
    // no answer yet, so mark this one
    $entity->markAsCorrect();
    system_message(elgg_echo('questions:action:answer:toggle_mark:success:mark'));
} elseif ($answer->getGUID() == $entity->getGUID()) {
    // the marked answer is this answer, so unmark
    $entity->undoMarkAsCorrect();
    system_message(elgg_echo('questions:action:answer:toggle_mark:success:unmark'));
} else {
    register_error(elgg_echo('questions:action:answer:toggle_mark:error:duplicate'));
}
Esempio n. 20
0
<?php

/**
 * Edit answer page
 *
 * @package ElggQuestions
 */
$answer_guid = get_input('guid');
elgg_entity_gatekeeper($answer_guid, 'object', ElggAnswer::SUBTYPE);
$answer = get_entity($answer_guid);
if (!$answer->canEdit()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERRER);
}
$question = $answer->getContainerEntity();
$title = elgg_echo('questions:answer:edit');
elgg_push_breadcrumb($question->title, $question->getURL());
elgg_push_breadcrumb($title);
$content = elgg_view_form('object/answer/edit', [], ['entity' => $answer]);
$body = elgg_view_layout('content', ['title' => $title, 'content' => $content, 'filter' => '']);
echo elgg_view_page($title, $body);
Esempio n. 21
0
<?php

$event_guid = (int) elgg_extract('event_guid', $vars);
$user_guid = (int) elgg_extract('user_guid', $vars);
$code = elgg_extract('code', $vars);
elgg_entity_gatekeeper($event_guid, 'object', Event::SUBTYPE);
$event = get_entity($event_guid);
elgg_entity_gatekeeper($user_guid);
$user = get_entity($user_guid);
// is the code valid
if (!event_manager_validate_registration_validation_code($event_guid, $user_guid, $code)) {
    register_error(elgg_echo('event_manager:registration:confirm:error:code'));
    forward();
}
// do we have a pending registration
if ($event->getRelationshipByUser($user_guid) != EVENT_MANAGER_RELATION_ATTENDING_PENDING) {
    forward($event->getURL());
}
// set page owner
elgg_set_page_owner_guid($event->getContainerGUID());
// build breadcrumb
elgg_push_breadcrumb($event->title, $event->getURL());
// let's show the confirm form
$title_text = elgg_echo('event_manager:registration:confirm:title', [$event->title]);
$body_vars = ['event' => $event, 'user' => $user, 'code' => $code];
$form = elgg_view_form('event_manager/registration/confirm', [], $body_vars);
// build page
$page_data = elgg_view_layout('content', ['title' => $title_text, 'content' => $form, 'filter' => '']);
// draw page
echo elgg_view_page($title_text, $page_data);
Esempio n. 22
0
<?php

elgg_gatekeeper();
$guid = (int) get_input('guid');
$type = get_input('type');
$entity = false;
if (!empty($guid)) {
    elgg_entity_gatekeeper($guid, 'object', Publication::SUBTYPE);
    $entity = get_entity($guid);
    if (!$entity->canEdit()) {
        return;
    }
}
$supported_types = publications_get_types();
if (!in_array($type, $supported_types)) {
    echo elgg_echo('publication:type_not_supported');
    return;
}
if (elgg_view_exists("publications/publication/edit/{$type}")) {
    echo elgg_view("publications/publication/edit/{$type}", ['entity' => $entity]);
    return;
}
Esempio n. 23
0
<?php

/**
 * Manage group invite requests.
 *
 * @package ElggGroups
 */
elgg_gatekeeper();
$guid = (int) get_input("group_guid");
elgg_entity_gatekeeper($guid, "group");
elgg_group_gatekeeper();
elgg_set_page_owner_guid($guid);
$group = get_entity($guid);
if (!$group->canEdit()) {
    register_error(elgg_echo("groups:noaccess"));
    forward(REFERER);
}
$title = elgg_echo("groups:membershiprequests");
// change page title
if ($group->isPublicMembership()) {
    $title = elgg_echo("group_tools:menu:invitations");
}
elgg_push_breadcrumb(elgg_echo("groups"), "groups/all");
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb($title);
elgg_register_menu_item("title", array("name" => "groups:invite", "href" => "groups/invite/" . $group->getGUID(), "text" => elgg_echo("groups:invite"), "link_class" => "elgg-button elgg-button-action"));
$subpage = get_input("subpage");
$offset = (int) get_input("offset");
$limit = (int) get_input("limit", 25);
$dbprefix = elgg_get_config("dbprefix");
elgg_push_context("group_membershipreq");
Esempio n. 24
0
<?php

$guid = (int) get_input('guid');
$vote = get_input('vote');
elgg_entity_gatekeeper($guid, 'object', Poll::SUBTYPE);
$entity = get_entity($guid);
if ($vote === null || $vote === '') {
    register_error(elgg_echo('poll:action:vote:error:input'));
    forward(REFERER);
}
if (!$entity->canVote()) {
    register_error(elgg_echo('poll:action:vote:error:can_vote'));
    forward(REFERER);
}
if ($entity->vote($vote)) {
    system_message(elgg_echo('poll:action:vote:success'));
} else {
    register_error(elgg_echo('poll:action:vote:error:vote'));
}
forward(REFERER);
Esempio n. 25
0
File: groups.php Progetto: n8b/VMN
/**
 * Group members page
 *
 * @param int $guid Group entity GUID
 */
function groups_handle_members_page($guid)
{
    elgg_entity_gatekeeper($guid, 'group');
    $group = get_entity($guid);
    elgg_set_page_owner_guid($guid);
    elgg_group_gatekeeper();
    $title = elgg_echo('groups:members:title', array($group->name));
    elgg_push_breadcrumb($group->name, $group->getURL());
    elgg_push_breadcrumb(elgg_echo('groups:members'));
    $db_prefix = elgg_get_config('dbprefix');
    $content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
    $params = array('content' => $content, 'title' => $title, 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
Esempio n. 26
0
<?php

/**
 * View a single page
 *
 * @package ElggPages
 */
$guid = elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid, 'object');
$page = get_entity($guid);
if (!pages_is_page($page)) {
    forward('', '404');
}
elgg_set_page_owner_guid($page->getContainerGUID());
elgg_group_gatekeeper();
$container = elgg_get_page_owner_entity();
if (!$container) {
    forward(REFERER);
}
$title = $page->title;
if (elgg_instanceof($container, 'group')) {
    elgg_push_breadcrumb($container->name, "pages/group/{$container->guid}/all");
} else {
    elgg_push_breadcrumb($container->name, "pages/owner/{$container->username}");
}
pages_prepare_parent_breadcrumbs($page);
elgg_push_breadcrumb($title);
$content = elgg_view_entity($page, array('full_view' => true));
$content .= elgg_view_comments($page);
// can add subpage if can edit this page and write to container (such as a group)
if ($page->canEdit() && $container->canWriteToContainer(0, 'object', 'page')) {
Esempio n. 27
0
<?php

$target_guid = elgg_extract('target_guid', $vars);
$post_guids = elgg_extract('post_guids', $vars);
elgg_entity_gatekeeper($target_guid);
elgg_group_gatekeeper(true, $target_guid);
$target = get_entity($target_guid);
elgg_set_page_owner_guid($target->guid);
elgg_push_breadcrumb(elgg_echo('wall'), hypeWall()->router->getPageHandlerId());
if (is_callable(array($target, 'getDisplayName'))) {
    $name = $target->getDisplayName();
} else {
    $name = $target instanceof ElggObject ? $target->title : $target->name;
}
$title = elgg_echo('wall:owner', array($name));
elgg_push_breadcrumb($title, hypeWall()->router->normalize($target->guid));
$content = elgg_view('lists/wall', array('entity' => $target, 'post_guids' => $post_guids));
if (elgg_is_xhr()) {
    echo $content;
} else {
    $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => false));
    echo elgg_view_page($title, $layout);
}
Esempio n. 28
0
<?php

$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', ElggQuestion::SUBTYPE);
$question = get_entity($guid);
if (!$question->canEdit()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
$container = $question->getContainerEntity();
$title = $question->getDisplayName();
if ($question->delete()) {
    system_message(elgg_echo('entity:delete:success', [$title]));
} else {
    register_error(elgg_echo('entity:delete:fail', [$title]));
    forward(REFERER);
}
$forward = get_input('forward');
if (!empty($forward)) {
    forward($forward);
} elseif ($container instanceof ElggUser) {
    forward("questions/owner/{$container->username}");
} elseif ($container instanceof ElggGroup) {
    forward("questions/group/{$container->getGUID()}/all");
}
forward();
Esempio n. 29
0
<?php

$guid = elgg_extract('guid', $vars);
if (!is_numeric($guid)) {
    $user = get_user_by_username($guid);
    if ($user) {
        $guid = $user->guid;
    }
}
elgg_entity_gatekeeper($guid);
$target = get_entity($guid);
elgg_set_page_owner_guid($guid);
$content = elgg_view('discussion/listing/owner', ['entity' => $target]);
if (elgg_is_xhr()) {
    echo $content;
    return;
}
if ($target instanceof ElggGroup) {
    // Before Elgg 2.0 only groups could work as containers for discussions.
    // Back then the URL that listed all discussions within a group was
    // "discussion/owner/<guid>". Now that any entity can be used as a
    // container, we use the standard "<content type>/group/<guid>" URL
    // also with discussions.
    forward("discussion/group/{$guid}", '301');
}
elgg_push_breadcrumb(elgg_echo('item:object:discussion'));
elgg_register_title_button();
$title = elgg_echo('item:object:discussion');
$site_wide_discussions = elgg_get_plugin_setting('site_wide_discussions', 'hypeDiscussions');
$filter = $site_wide_discussions ? null : '';
$params = array('content' => $content, 'title' => $title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => $filter, 'filter_context' => $target->guid == elgg_get_logged_in_user_guid() ? 'mine' : false);
Esempio n. 30
0
<?php

admin_gatekeeper();
$guid = elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid, 'object', 'modal_info');
$entity = get_entity($guid);
elgg_push_breadcrumb(elgg_echo('modal_info:all'), 'modal_info/all');
elgg_push_breadcrumb($entity->getDisplayName(), $entity->getURL());
$title = elgg_echo('modal_info:edit');
$content = elgg_view_form('modal_info/edit', array(), array('entity' => $entity));
$layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => ''));
echo elgg_view_page($title, $layout);