aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/reportedcontent/actions/add.php43
-rw-r--r--mod/reportedcontent/add.php36
-rw-r--r--mod/reportedcontent/index.php29
-rw-r--r--mod/reportedcontent/languages/en.php37
-rw-r--r--mod/reportedcontent/manifest.xml9
-rw-r--r--mod/reportedcontent/start.php66
-rw-r--r--mod/reportedcontent/views/default/reportedcontent/form.php71
-rw-r--r--mod/reportedcontent/views/default/reportedcontent/listing.php24
-rw-r--r--mod/reportedcontent/views/default/reportedcontent/user_report.php6
9 files changed, 321 insertions, 0 deletions
diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php
new file mode 100644
index 000000000..bfb5fcfb3
--- /dev/null
+++ b/mod/reportedcontent/actions/add.php
@@ -0,0 +1,43 @@
+<?php
+
+ /**
+ * Elgg report action
+ *
+ * @package ElggReportContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ $title = get_input('title');
+ $description = get_input('description');
+ $address = get_input('address');
+ $access = 0; //this is private and only admins can see it
+
+ if ($title && $address) {
+
+ $entity = new ElggObject;
+ $entity->subtype = "reported_content";
+ $entity->owner_guid = $_SESSION['user']->getGUID();
+ $entity->title = $title;
+ $entity->address = $address;
+ $entity->description = $description;
+ $entity->access_id = $access;
+
+ if ($entity->save()) {
+ system_message(elgg_echo('reportedcontent:success'));
+ forward($address);
+ } else {
+ register_error(elgg_echo('reportedcontent:failed'));
+ forward($address);
+ }
+
+ } else {
+
+ register_error(elgg_echo('reportedcontent:failed'));
+ forward($address);
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/reportedcontent/add.php b/mod/reportedcontent/add.php
new file mode 100644
index 000000000..3fdca2e83
--- /dev/null
+++ b/mod/reportedcontent/add.php
@@ -0,0 +1,36 @@
+<?php
+
+ /**
+ * Elgg reported content send report page
+ *
+ * @package ElggReportedContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Start engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // You need to be logged in for this one
+ gatekeeper();
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($page_owner->getGUID());
+ }
+
+ $area2 .= elgg_view_title(elgg_echo('reportedcontent:this'), false);
+
+ $area2 .= elgg_view('reportedcontent/form');
+
+ // Format page
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Draw it
+ echo page_draw(elgg_echo('reportedcontent:add'),$body);
+
+?> \ No newline at end of file
diff --git a/mod/reportedcontent/index.php b/mod/reportedcontent/index.php
new file mode 100644
index 000000000..3ce08e8b6
--- /dev/null
+++ b/mod/reportedcontent/index.php
@@ -0,0 +1,29 @@
+<?php
+ /**
+ * Elgg Reported content
+ *
+ * @package ElggReportedContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ admin_gatekeeper();
+ set_context('admin');
+
+ $title = elgg_view_title(elgg_echo('reportedcontent'));
+
+ $reported = get_entities("object", "reported_content");
+
+ $area2 = elgg_view("reportedcontent/listing", array('entity' => $reported));
+
+ if(!$reported)
+ $reported = elgg_echo("reportedcontent:none");
+
+// Display main admin menu
+ page_draw(elgg_echo('reportedcontent'),elgg_view_layout("two_column_left_sidebar", '', $title . $area2));
+
+?> \ No newline at end of file
diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php
new file mode 100644
index 000000000..83621afc4
--- /dev/null
+++ b/mod/reportedcontent/languages/en.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg reported content plugin language pack
+ *
+ * @package ElggReportedContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ $english = array(
+
+ /**
+ * Menu items and titles
+ */
+
+ 'reportedcontent' => 'Reported content',
+ 'reportedcontent:this' => 'Report this',
+ 'reportedcontent:none' => 'There is no reported content',
+ 'reportedcontent:report' => 'Report to admin',
+ 'reportedcontent:title' => 'Page title',
+ 'reportedcontent:delete' => 'Delete it',
+ 'reportedcontent:archive' => 'Archive it',
+ 'reportedcontent:by' => 'Report by',
+ 'reportedcontent:objecttitle' => 'Object title',
+ 'reportedcontent:objecturl' => 'Object url',
+ 'reportedcontent:reason' => 'Reason for report',
+ 'reportedcontent:description' => 'Why are you reporting this?',
+ 'reportedcontent:address' => 'Location of the item',
+ 'reportedcontent:success' => 'Your report has been sent to the site admin',
+ 'reportedcontent:failing' => 'Your report could not be sent',
+
+ );
+
+ add_translation("en",$english);
+?> \ No newline at end of file
diff --git a/mod/reportedcontent/manifest.xml b/mod/reportedcontent/manifest.xml
new file mode 100644
index 000000000..43a10c072
--- /dev/null
+++ b/mod/reportedcontent/manifest.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Curverider" />
+ <field key="version" value="1.0" />
+ <field key="description" value="Adds the option for users to report content and for admins to check it out." />
+ <field key="website" value="http://www.elgg.org/" />
+ <field key="copyright" value="(C) Curverider 2008" />
+ <field key="licence" value="GNU Public License version 2" />
+</plugin_manifest> \ No newline at end of file
diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php
new file mode 100644
index 000000000..e8c9614cd
--- /dev/null
+++ b/mod/reportedcontent/start.php
@@ -0,0 +1,66 @@
+<?php
+ /**
+ * Elgg Reported content.
+ *
+ * @package ElggReportedContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ /**
+ * Initialise the Reported content and set up the menus.
+ *
+ */
+ function reportedcontent_init()
+ {
+ global $CONFIG;
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('reportedcontent','reportedcontent_page_handler');
+
+ // Extend CSS
+ extend_view('css','reportedcontent/css');
+
+ // Extend context menu with reported content link
+ if(isloggedin())
+ extend_view('profile/menu/links','reportedcontent/user_report');
+
+ }
+
+ /**
+ * Adding the reported content to the admin menu
+ *
+ */
+ function reportedcontent_pagesetup()
+ {
+ if (get_context() == 'admin' && isadminloggedin()) {
+ global $CONFIG;
+ add_submenu_item(elgg_echo('reportedcontent'), $CONFIG->wwwroot . 'pg/reportedcontent/');
+ }
+ }
+
+ /**
+ * Reported content page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+ function reportedcontent_page_handler($page)
+ {
+ global $CONFIG;
+
+ // only interested in one page for now
+ include($CONFIG->pluginspath . "reportedcontent/index.php");
+ }
+
+
+
+ // Initialise Reported Content
+ register_elgg_event_handler('init','system','reportedcontent_init');
+ register_elgg_event_handler('pagesetup','system','reportedcontent_pagesetup');
+
+ //register action
+ register_action('reportedcontent/add',false,$CONFIG->pluginspath . "reportedcontent/actions/add.php");
+
+?> \ No newline at end of file
diff --git a/mod/reportedcontent/views/default/reportedcontent/form.php b/mod/reportedcontent/views/default/reportedcontent/form.php
new file mode 100644
index 000000000..64a06bb63
--- /dev/null
+++ b/mod/reportedcontent/views/default/reportedcontent/form.php
@@ -0,0 +1,71 @@
+<?php
+
+ /**
+ * Elgg report content plugin form
+ *
+ * @package ElggReportContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ $guid = 0;
+ $title = get_input('title',"");
+ $description = "";
+ $address = get_input('address',"");
+ if ($address == "previous")
+ $address = $_SERVER['HTTP_REFERER'];
+ $tags = array();
+ $access_id = 0;
+ $shares = array();
+ $owner = $vars['user'];
+
+?>
+
+ <form action="<?php echo $vars['url']; ?>action/reportedcontent/add" method="post">
+
+ <p>
+ <label>
+ <?php echo elgg_echo('reportedcontent:title'); ?>
+ <?php
+
+ echo elgg_view('input/text',array(
+ 'internalname' => 'title',
+ 'value' => $title,
+ ));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('reportedcontent:address'); ?>
+ <?php
+
+ echo elgg_view('input/url',array(
+ 'internalname' => 'address',
+ 'value' => $address,
+ ));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('reportedcontent:description'); ?>
+ <?php
+
+ echo elgg_view('input/longtext',array(
+ 'internalname' => 'description',
+ 'value' => $description,
+ ));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <input type="submit" value="<?php echo elgg_echo('report'); ?>" />
+ </p>
+
+ </form> \ No newline at end of file
diff --git a/mod/reportedcontent/views/default/reportedcontent/listing.php b/mod/reportedcontent/views/default/reportedcontent/listing.php
new file mode 100644
index 000000000..1976d0946
--- /dev/null
+++ b/mod/reportedcontent/views/default/reportedcontent/listing.php
@@ -0,0 +1,24 @@
+<?php
+
+ if($vars['entity']){
+
+ foreach($vars['entity'] as $report){
+
+ //get the user making the report
+ $user = get_user($report->owner_guid)->name;
+ $user_url = get_user($report->owner_guid)->getURL();
+
+ echo "<div class=\"reported_content\">";
+ echo "<p class=\"reported_detail\"><b>" . elgg_echo('reportedcontent:by') . ": </b><a href=\"{$user_url}\">" . $user . "</a>, " . friendly_time($report->time_created) . "</p>";
+ echo "<p class=\"reported_detail\"><b>" . elgg_echo('reportedcontent:objecttitle') . ": </b>" . $report->title . "</p>";
+ echo "<p class=\"reported_detail\"><b>" . elgg_echo('reportedcontent:objecturl') . ": </b><a href=\"{$report->address}\">" . $report->address . "</a></p>";
+ echo "<p class=\"reported_detail\"><b>" . elgg_echo('reportedcontent:reason') . ": </b>" .$report->description . "</p>";
+ echo "<p class=\"reported_detail\">[<a href=\"\">" . elgg_echo('reportedcontent:archive') . "</a>] - [<a href=\"\">" . elgg_echo('reportedcontent:delete') . "</a>]</p>";
+ echo elgg_view_comments($report);
+ echo "</div>";
+
+ }
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/reportedcontent/views/default/reportedcontent/user_report.php b/mod/reportedcontent/views/default/reportedcontent/user_report.php
new file mode 100644
index 000000000..6077ca620
--- /dev/null
+++ b/mod/reportedcontent/views/default/reportedcontent/user_report.php
@@ -0,0 +1,6 @@
+
+<p class="user_menu_profile">
+<?php
+ echo "<a href=\"javascript:location.href='". $CONFIG->wwwroot . "mod/reportedcontent/add.php?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">" . elgg_echo('reportedcontent:report') . "</a>";
+?>
+</p> \ No newline at end of file