aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php30
-rw-r--r--languages/en.php2
-rw-r--r--start.php59
3 files changed, 37 insertions, 54 deletions
diff --git a/index.php b/index.php
index 00b09d14b..32c389e2e 100644
--- a/index.php
+++ b/index.php
@@ -2,17 +2,10 @@
/**
* Elgg tidypics photo gallery main page
*
- * @package ElggFile
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- *
- *
*
*/
- //require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
//get the owner of the current page
$owner = page_owner_entity();
@@ -25,21 +18,16 @@
}
//set the title
- $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name"));
-
- //allow new album creation
- if(can_write_to_container($_SESSION['guid'], page_owner())){
- $area2 .= '<a href="'.$CONFIG->wwwroot . "pg/photos/new/". $owner->username.'">'.elgg_echo('album:create').'</a><br><br>';
- }
-
+ $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name"));
+
// Get objects
- set_context('search');
- set_input('search_viewtype', 'gallery');
- $area2 .= list_entities("object","album",page_owner(),10);
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities("object","album",page_owner(),10);
- set_context('photos');
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
// Finally draw the page
- page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body);
+ page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body);
?> \ No newline at end of file
diff --git a/languages/en.php b/languages/en.php
index 21fe56f2d..7e7185c5d 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -23,7 +23,7 @@
//actions
- 'album:create' => "Create New Album",
+ 'album:create' => "Create new album",
'album:add' => "Add Photo Album",
'album:addpix' => "Add photos",
'album:edit' => "Edit album",
diff --git a/start.php b/start.php
index 74d6dd22e..7c3f888e8 100644
--- a/start.php
+++ b/start.php
@@ -9,7 +9,6 @@
*/
function tidypics_init()
{
- // Get config
global $CONFIG;
// Set up menu for logged in users
@@ -56,38 +55,42 @@
if (get_context() == "photos") {
// owner gets "your albumn", "your friends albums"
- if (get_loggedin_userid() == $page_owner->guid) {
+ if (get_loggedin_userid() == $page_owner->guid && get_loggedin_userid()) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . "pg/photos/new/". $page_owner->username,
+ 'tidypics' );
+
add_submenu_item( elgg_echo("album:yours"),
$CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
- '1view' );
+ 'tidypics' );
add_submenu_item( elgg_echo('album:yours:friends'),
$CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,
- '1view');
+ 'tidypics');
} else if (isloggedin()) {
// logged nut not owner gets "your albums", "page owners albums", "page owner's friends albums"
add_submenu_item( elgg_echo("album:yours"),
$CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
- '1view' );
+ 'tidypics' );
add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
$CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username,
- '1view' );
+ 'tidypics' );
add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
$CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,
- '1view');
- } else {
+ 'tidypics');
+ } 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,
- '1view' );
+ 'tidypics' );
add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
$CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,
- '1view');
+ 'tidypics');
}
add_submenu_item( sprintf(elgg_echo('album:all'),$page_owner->name),
$CONFIG->wwwroot . "pg/photos/world/",
- '1view');
+ 'tidypics');
}
if (isloggedin() && ($page_owner instanceof ElggGroup)) {
@@ -112,12 +115,6 @@
{
case "owned": //view list of albums owned by container
if (isset($page[1])) set_input('username',$page[1]);
-
- /* if you want to put new album action in the submenu, just do it like this --------->
- if(can_write_to_container($_SESSION['guid'], page_owner())){
- add_submenu_item(elgg_echo('album:create'), $CONFIG->wwwroot . "pg/photos/new/". page_owner_entity()->username, 'pagesactions');
- }
- */
include($CONFIG->pluginspath . "tidypics/index.php");
break;
@@ -128,7 +125,7 @@
case "album": //view an album individually
set_input('guid',$page[1]);
- @include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php");
+ include(dirname(dirname(dirname(__FILE__))) . "/entities/index.php");
break;
case "new": //create new album
@@ -167,21 +164,19 @@
* @param ElggEntity $entity album/image entity
* @return string File URL
*/
- function image_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
-
- }
+ function image_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
+ }
- function album_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
-
- }
+ function album_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
+ }
// Make sure tidypics_init is called on initialisation
register_elgg_event_handler('init','system','tidypics_init');