aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-03 15:19:12 -0500
committercash <cash.costello@gmail.com>2011-12-03 15:19:12 -0500
commit5e7ea5369519949ea6dc7954a61f4d4eba29b0d0 (patch)
treec5c392a314669e3a45ff104437c55b30a50814c3
parent9b838be94d37d560b1a05f76cd5ecca5d41119fc (diff)
downloadelgg-5e7ea5369519949ea6dc7954a61f4d4eba29b0d0.tar.gz
elgg-5e7ea5369519949ea6dc7954a61f4d4eba29b0d0.tar.bz2
removed some old code
-rw-r--r--mostvieweddashboard.php43
-rw-r--r--start.php272
-rw-r--r--thumbnail.php80
3 files changed, 136 insertions, 259 deletions
diff --git a/mostvieweddashboard.php b/mostvieweddashboard.php
deleted file mode 100644
index e98e784da..000000000
--- a/mostvieweddashboard.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * Tidypics full view of an image
- * Given a GUID, this page will try and display any entity
- *
- */
-
-// Load Elgg engine
-include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-global $CONFIG;
-$prefix = $CONFIG->dbprefix;
-$max = 24;
-
-//this works but is wildly inefficient
-//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000);
-
-$sql = "SELECT ent.guid, count( * ) AS views
- FROM " . $prefix . "entities ent
- INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
- AND sub.subtype = 'image'
- INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
- INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
- AND ms.string = 'tp_view'
- GROUP BY ent.guid
- ORDER BY views DESC
- LIMIT $max";
-
-$result = get_data($sql);
-
-$entities = array();
-foreach($result as $entity) {
- $entities[] = get_entity($entity->guid);
-}
-
-tidypics_mostviewed_submenus();
-
-$title = elgg_echo("tidypics:mostvieweddashboard");
-$area2 = elgg_view_title($title);
-$area2 .= elgg_view_entity_list($entities, $max, 0, $max);
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-page_draw($title, $body);
diff --git a/start.php b/start.php
index b24f3cb61..ce0af7312 100644
--- a/start.php
+++ b/start.php
@@ -105,142 +105,6 @@ function tidypics_init() {
}
/**
- * Sets up sidebar menus for tidypics. Triggered on pagesetup.
- */
-function tidypics_submenus() {
-
- global $CONFIG;
-
- $page_owner = page_owner_entity();
-
- if ($page_owner instanceof ElggGroup) {
- if (get_context() == "groups") {
- if ($page_owner->photos_enable != "no") {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
- }
- }
- // context is only set to photos on individual pages, not on group pages
- else if (get_context() == "photos") {
-
- $view_count = get_plugin_setting('view_count', 'tidypics');
-
- // owner gets "your albumn", "your friends albums", "your most recent", "your most viewed"
- if (get_loggedin_userid() && get_loggedin_userid() == $page_owner->guid) {
-
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . "pg/photos/new/{$page_owner->username}/",
- 'tidypics-a' );
-
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
-
- add_submenu_item( elgg_echo('album:yours:friends'),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
-
- add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
- 'tidypics-a');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- } else if (isloggedin()) {
-
- $user = get_loggedin_user();
-
- // logged in not owner gets "page owners albums", "page owner's friends albums", "page owner's most viewed", "page owner's most recent"
- // and then "your albums", "your most recent", "your most viewed"
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/{$user->username}/",
- 'tidypics-b' );
-
- add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$user->username}/",
- 'tidypics-b');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$user->username}/",
- 'tidypics-b');
- }
-
- if ($page_owner->name) { // check to make sure the owner set their display name
- add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
- add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
-
- if ($view_count != 'disabled') {
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
- 'tidypics-a');
- }
- } else if ($page_owner->guid) {
- // non logged in user gets "page owners albums", "page owner's friends albums"
- add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
- add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- // everyone gets world albums, most recent, most viewed, most recently viewed, recently commented
- add_submenu_item( elgg_echo('album:all'),
- $CONFIG->wwwroot . "pg/photos/world/",
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:mostrecent'),
- $CONFIG->wwwroot . 'pg/photos/mostrecent/',
- 'tidypics-z');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:mostviewed'),
- $CONFIG->wwwroot . 'pg/photos/mostviewed/',
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
- $CONFIG->wwwroot . 'pg/photos/recentlyviewed/',
- 'tidypics-z');
- }
- add_submenu_item( elgg_echo('tidypics:recentlycommented'),
- $CONFIG->wwwroot . 'pg/photos/recentlycommented/',
- 'tidypics-z');
- }
-
-}
-
-/**
- * Sets up submenus for tidypics most viewed pages
- */
-function tidypics_mostviewed_submenus() {
-
- global $CONFIG;
-
- add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php");
- add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php");
- add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php");
- add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php");
- add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented/');
-}
-
-/**
* Tidypics page handler
*
* @param array $page Array of url segments
@@ -583,3 +447,139 @@ function tidypics_ajax_session_handler($hook, $entity_type, $returnvalue, $param
exit;
}
+
+/**
+ * Sets up sidebar menus for tidypics. Triggered on pagesetup.
+ */
+function tidypics_submenus() {
+
+ global $CONFIG;
+
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup) {
+ if (get_context() == "groups") {
+ if ($page_owner->photos_enable != "no") {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+ }
+ }
+ // context is only set to photos on individual pages, not on group pages
+ else if (get_context() == "photos") {
+
+ $view_count = get_plugin_setting('view_count', 'tidypics');
+
+ // owner gets "your albumn", "your friends albums", "your most recent", "your most viewed"
+ if (get_loggedin_userid() && get_loggedin_userid() == $page_owner->guid) {
+
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . "pg/photos/new/{$page_owner->username}/",
+ 'tidypics-a' );
+
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+
+ add_submenu_item( elgg_echo('album:yours:friends'),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+
+ add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
+ 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ } else if (isloggedin()) {
+
+ $user = get_loggedin_user();
+
+ // logged in not owner gets "page owners albums", "page owner's friends albums", "page owner's most viewed", "page owner's most recent"
+ // and then "your albums", "your most recent", "your most viewed"
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/{$user->username}/",
+ 'tidypics-b' );
+
+ add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$user->username}/",
+ 'tidypics-b');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$user->username}/",
+ 'tidypics-b');
+ }
+
+ if ($page_owner->name) { // check to make sure the owner set their display name
+ add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+ } else if ($page_owner->guid) {
+ // non logged in user gets "page owners albums", "page owner's friends albums"
+ add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ // everyone gets world albums, most recent, most viewed, most recently viewed, recently commented
+ add_submenu_item( elgg_echo('album:all'),
+ $CONFIG->wwwroot . "pg/photos/world/",
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:mostrecent'),
+ $CONFIG->wwwroot . 'pg/photos/mostrecent/',
+ 'tidypics-z');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:mostviewed'),
+ $CONFIG->wwwroot . 'pg/photos/mostviewed/',
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
+ $CONFIG->wwwroot . 'pg/photos/recentlyviewed/',
+ 'tidypics-z');
+ }
+ add_submenu_item( elgg_echo('tidypics:recentlycommented'),
+ $CONFIG->wwwroot . 'pg/photos/recentlycommented/',
+ 'tidypics-z');
+ }
+
+}
+
+/**
+ * Sets up submenus for tidypics most viewed pages
+ */
+function tidypics_mostviewed_submenus() {
+
+ global $CONFIG;
+
+ add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php");
+ add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented/');
+}
diff --git a/thumbnail.php b/thumbnail.php
deleted file mode 100644
index f9f9d1e5f..000000000
--- a/thumbnail.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * Tidypics Thumbnail
- *
- */
-
-include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-// Get file GUID
-$file_guid = (int) get_input('file_guid');
-
-// Get file thumbnail size
-$size = get_input('size');
-// only 3 possibilities
-if ($size != 'small' && $size != 'thumb') {
- $size = 'large';
-}
-
-$error_image = '';
-switch ($size) {
- case 'thumb':
- $error_image = "image_error_thumb.png";
- break;
- case 'small':
- $error_image = "image_error_small.png";
- break;
- case 'large':
- $error_image = "image_error_large.png";
- break;
-}
-
-// Get file entity
-$file = get_entity($file_guid);
-if (!$file) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-if ($file->getSubtype() != "image") {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// Get filename
-if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
-} else if ($size == "small") {
- $thumbfile = $file->smallthumb;
-} else {
- $thumbfile = $file->largethumb;
-}
-
-if (!$thumbfile) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// create Elgg File object
-$readfile = new ElggFile();
-$readfile->owner_guid = $file->owner_guid;
-$readfile->setFilename($thumbfile);
-$contents = $readfile->grabFile();
-
-// send error image if file could not be read
-if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// expires every 14 days
-$expires = 14 * 60*60*24;
-
-// overwrite header caused by php session code so images can be cached
-$mime = $file->getMimeType();
-header("Content-Type: $mime");
-header("Content-Length: " . strlen($contents));
-header("Cache-Control: public", true);
-header("Pragma: public", true);
-header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-// Return the thumbnail and exit
-echo $contents;
-exit;