/** * Returns HTML to edit a blog post. * * @param int $guid * @param int annotation id optional revision to edit * @return string html */ function blog_get_page_content_edit($guid, $revision = NULL) { $vars = array(); if ($guid) { $blog = get_entity((int) $guid); if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $vars['entity'] = $blog; if ($revision) { $revision = get_annotation((int) $revision); $vars['revision'] = $revision; if (!$revision || !($revision->entity_guid == $guid)) { $content = elgg_echo('blog:error:revision_not_found'); } } elgg_push_breadcrumb($blog->title, $blog->getURL()); elgg_push_breadcrumb(elgg_echo('edit')); $content = elgg_view('blog/forms/edit', $vars); $sidebar = elgg_view('blog/sidebar_revisions', array('entity' => $blog)); //$sidebar .= elgg_view('blog/sidebar_related'); } else { $content = elgg_echo('blog:error:post_not_found'); } } else { elgg_push_breadcrumb(elgg_echo('blog:new')); $content = elgg_view('blog/forms/edit', $vars); //$sidebar = elgg_view('blog/sidebar_related'); } return array('content' => $content, 'sidebar' => $sidebar); }
<?php /** * Elgg Pages * * @package ElggPages * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd * @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ */ // Output body $entity = $vars['entity']; $rev = (int) get_input('rev'); if ($rev) { $latest = get_annotation($rev); } else { $latest = $entity->getAnnotations('page', 1, 0, 'desc'); if ($latest) { $latest = $latest[0]; } } ?> <div class="contentWrapper"> <div id="pages_page"> <?php if ($entity) { echo elgg_view('output/longtext', array('value' => $latest->value)); $tags = $vars['entity']->tags;
<?php /** * Elgg delete comment action * * @package Elgg * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider <curverider.co.uk> * @copyright Curverider Ltd 2008-2009 * @link http://elgg.org/ */ // Ensure we're logged in if (!isloggedin()) { forward(); } // Make sure we can get the comment in question $annotation_id = (int) get_input('annotation_id'); if ($comment = get_annotation($annotation_id)) { $entity = get_entity($comment->entity_guid); if ($comment->canEdit()) { $comment->delete(); system_message(elgg_echo("generic_comment:deleted")); forward($entity->getURL()); } } else { $url = ""; } register_error(elgg_echo("generic_comment:notdeleted")); forward($entity->getURL());
/** * For a given ID, return the object associated with it. * This is used by the river functionality primarily. * This is useful for checking access permissions etc on objects. */ public function getObjectFromID($id) { return get_annotation($id); }
*/ // Make sure we're logged in (send us to the front page if not) if (!isloggedin()) { forward(); } // Check the user is a dgroup member $dgroup_guid = get_input('dgroup'); $dgroup_entity = get_entity($dgroup_guid); if (!$dgroup_entity->isMember($vars['user'])) { forward(); } //get the required variables $post = get_input("post"); $field_num = get_input("field_num"); $post_comment = get_input("postComment{$field_num}"); $annotation = get_annotation($post); $commentOwner = $annotation->owner_guid; $access_id = $annotation->access_id; $topic = get_input("topic"); if ($annotation) { //can edit? Either the comment owner or admin can if (dgroups_can_edit_discussion($annotation, page_owner_entity()->owner_guid)) { update_annotation($post, "dgroup_topic_post", $post_comment, "", $commentOwner, $access_id); system_message(elgg_echo("dgroups:forumpost:edited")); } else { system_message(elgg_echo("dgroups:forumpost:error")); } } else { system_message(elgg_echo("dgroups:forumpost:error")); } // Forward to the dgroup forum page
* * @package ElggGroups * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider <*****@*****.**> * @copyright Curverider Ltd 2008-2010 * @link http://elgg.org/ */ // Ensure we're logged in if (!isloggedin()) { forward(); } // Make sure we can get the comment in question $post_id = (int) get_input('post'); $group_guid = (int) get_input('group'); $topic_guid = (int) get_input('topic'); if ($post = get_annotation($post_id)) { //check that the user can edit as well as admin if ($post->canEdit() || $post->owner_guid == $_SESSION['user']->guid) { //delete $post->delete(); //display confirmation message system_message(elgg_echo("grouppost:deleted")); } } else { $url = ""; system_message(elgg_echo("grouppost:notdeleted")); } // Forward to the group forum page global $CONFIG; $url = $CONFIG->wwwroot . "mod/groups/topicposts.php?topic={$topic_guid}&group_guid={$group_guid}"; forward($url);
* Elgg Message board: delete message action * * @package ElggMessageBoard * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd <*****@*****.**> * @copyright Curverider Ltd 2008-2009 * @link http://elgg.org/ */ // Ensure we're logged in if (!isloggedin()) { forward(); } // Make sure we can get the comment in question $annotation_id = (int) get_input('annotation_id'); //make sure that there is a message on the message board matching the passed id if ($message = get_annotation($annotation_id)) { //grab the user or group entity $entity = get_entity($message->entity_guid); //check to make sure the current user can actually edit the message board if ($message->canEdit()) { //delete the comment $message->delete(); //display message system_message(elgg_echo("messageboard:deleted")); //generate the url to forward to $url = "pg/messageboard/" . $entity->username; //forward the user back to their message board forward($url); } } else { $url = "";
* @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ */ $performed_by = get_entity($vars['item']->subject_guid); $object = get_entity($vars['item']->object_guid); $url = $object->getURL(); $title = $object->title; if (!$title) { $title = elgg_echo('untitled'); } $subtype = get_subtype_from_id($object->subtype); //grab the annotation, if one exists if ($vars['item']->annotation_id != 0) { $comment = get_annotation($vars['item']->annotation_id)->value; } $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; $string = sprintf(elgg_echo("river:posted:generic"), $url) . " "; $string .= elgg_echo("{$subtype}:river:annotate") . " | <a href=\"{$object->getURL()}\">" . $title . "</a>"; $string .= "<div class=\"river_content_display\">"; if ($comment) { $contents = strip_tags($comment); //this is so we don't get large images etc in the activity river if (strlen($contents) > 200) { $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; } else { $string .= $contents; } } $string .= "</div>";
$annotation = create_annotation($entity->guid, 'generic_comment', $comment_text, "", $user->guid, $entity->access_id); // tell user annotation posted if (!$annotation) { register_error(elgg_echo("generic_comment:failure")); forward(REFERER); } // notify if poster wasn't owner if ($entity->owner_guid != $user->guid) { notify_user($entity->owner_guid, $user->guid, elgg_echo('generic_comment:email:subject'), elgg_echo('generic_comment:email:body', array($entity->title, $user->name, $comment_text, $entity->getURL(), $user->name, $user->getURL()))); } if (!$callback) { system_message(elgg_echo("generic_comment:posted")); // Forward to the entity page forward($_SERVER['HTTP_REFERER']); } else { //Fix for elgg version minor or equal than 1.6.2 if ($annotation) { $annotation = elgg_get_annotations(array('guid' => $entity_guid, 'annotation_name' => 'generic_comment', 'annotation_values' => $comment_text, 'annotation_owner_guid' => $user->guid)); //$annotation = get_annotations($entity_guid, '','', 'generic_comment', $comment_text, $user->guid, 1); if (!empty($annotation)) { $annotation = array_shift($annotation); } $comment = $annotation; } else { $comment = get_annotation($annotation); } if ($comment) { $owner = get_user($comment->owner_guid); echo elgg_view('river_comments/river_comment', array('owner' => $owner, 'annotation' => $comment)); } }
<?php /** * Remove photo tag action */ $annotation = get_annotation(get_input('annotation_id')); if (!$annotation instanceof ElggAnnotation || $annotation->name != 'phototag') { register_error(elgg_echo("tidypics:phototagging:delete:error")); forward(REFERER); } if (!$annotation->canEdit()) { register_error(elgg_echo("tidypics:phototagging:delete:error")); forward(REFERER); } if ($annotation->delete()) { system_message(elgg_echo("tidypics:phototagging:delete:success")); } else { system_message(elgg_echo("tidypics:phototagging:delete:error")); } forward(REFERER);
} $m = new ElggMetadata(); $m->value = $v; $m->name = $id_or_name; $m->entity_guid = $guid; $m->time_created = $entity->time_created; $m->time_updated = $entity->time_updated; $m->owner_guid = $entity->owner_guid; $m->id = $id_or_name; $m->type = "attr"; break; case 'metadata': $m = get_metadata($id_or_name); break; case 'annotation': $m = get_annotation($id_or_name); break; case 'relationship': $r = get_relationship($id_or_name); break; case 'volatile': $m = trigger_plugin_hook('volatile', 'metadata', array('guid' => $guid, 'varname' => $id_or_name)); break; default: throw new InvalidParameterException(sprintf(elgg_echo('InvalidParameterException:CanNotExportType'), $type)); } // Render metadata or relationship if (!$m && !$r) { throw new InvalidParameterException(elgg_echo('InvalidParameterException:NoDataFound')); } // Exporting metadata?
<?php $tagger = get_entity($vars['item']->subject_guid); $tagged = get_entity($vars['item']->object_guid); $annotation = get_annotation($vars['item']->annotation_id); if ($annotation) { $image = get_entity($annotation->entity_guid); // viewer may not have permission to view image if (!$image) { return; } $image_title = $image->getTitle(); } $tagger_link = "<a href=\"{$tagger->getURL()}\">{$tagger->name}</a>"; $tagged_link = "<a href=\"{$tagged->getURL()}\">{$tagged->name}</a>"; if (!empty($image_title)) { $image_link = "<a href=\"{$image->getURL()}\">{$image_title}</a>"; $string = sprintf(elgg_echo('image:river:tagged'), $tagger_link, $tagged_link, $image_link); } else { $string = sprintf(elgg_echo('image:river:tagged:unknown'), $tagger_link, $tagged_link); } echo $string;
$entity = elgg_extract('entity', $vars); $score = $entity->annotation_value; if ((int) $score < 0) { $score_str = "<span class=\"gm-score-negative\">{$score}</span>"; } else { $score_str = "<span class=\"gm-score-positive\">+{$score}</span>"; } $rule = $entity->rule; $rule_str = elgg_echo('mechanics:' . $rule); switch ($entity->object_type) { case 'user': case 'group': case 'object': $object = get_entity($entity->object_id); if ($object) { $rule_str .= ' - ' . elgg_view('output/url', array('text' => isset($object->title) ? $object->title : $object->name, 'href' => $object->getURL())); } break; case 'annotation': $object = get_annotation($entity->object_id); if ($object) { $rule_str .= ' - ' . elgg_get_excerpt($annotation->value, 100); } break; } if ($entity->note) { $rule_str .= elgg_view('output/longtext', array('value' => $entity->note)); } $time_str = elgg_view_friendly_time($entity->time_created); echo elgg_view_image_block($score_str, $rule_str, array('image_alt' => $time_str, 'class' => 'gm-score-line-item'));
<?php //get the required variables $annotation_id = get_input("annotation_id"); $post_comment = get_input("postComment"); $annotation = get_annotation($annotation_id); $commentOwner = $annotation->owner_guid; $access_id = $annotation->access_id; if ($annotation && $annotation->canEdit()) { //can edit? Either the comment owner or admin can $result = update_annotation($annotation_id, "generic_comment", $post_comment, "", $commentOwner, $access_id); if ($result) { system_message(elgg_echo("comment:edited")); forward($annotation->getEntity()->getURL()); } } else { system_message(elgg_echo("comment:error")); } forward(REFERER);