aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'start.php')
-rw-r--r--start.php179
1 files changed, 25 insertions, 154 deletions
diff --git a/start.php b/start.php
index 1e851b8f3..51cf7fa60 100644
--- a/start.php
+++ b/start.php
@@ -13,7 +13,7 @@ elgg_register_event_handler('init', 'system', 'tidypics_init');
*/
function tidypics_init() {
// Register libraries
- $base_dir = elgg_get_plugins_path() . 'tidypics/lib';
+ $base_dir = elgg_get_plugins_path() . 'lightpics/lib';
elgg_register_library('tidypics:core', "$base_dir/tidypics.php");
elgg_register_library('tidypics:upload', "$base_dir/upload.php");
elgg_register_library('tidypics:resize', "$base_dir/resize.php");
@@ -38,17 +38,20 @@ function tidypics_init() {
$js = elgg_get_simplecache_url('js', 'photos/tidypics');
elgg_register_simplecache_view('js/photos/tidypics');
elgg_register_js('tidypics', $js, 'footer');
- $js = elgg_get_simplecache_url('js', 'photos/tagging');
- elgg_register_simplecache_view('js/photos/tagging');
- elgg_register_js('tidypics:tagging', $js, 'footer');
- $js = elgg_get_simplecache_url('js', 'photos/uploading');
- elgg_register_simplecache_view('js/photos/uploading');
- elgg_register_js('tidypics:uploading', $js, 'footer');
-
- elgg_register_js('tidypics:slideshow', 'mod/tidypics/vendors/PicLensLite/piclens_optimized.js', 'footer');
- elgg_register_js('swfobject', 'mod/tidypics/vendors/uploadify/swfobject.js', 'footer');
- elgg_register_js('jquery.uploadify-tp', 'mod/tidypics/vendors/uploadify/jquery.uploadify.v2.1.1.min.js', 'footer');
+ $js_base = 'mod/lightpics/vendors/jquery-file-upload/js';
+
+ elgg_register_js('jquery-tmpl', "http://blueimp.github.com/JavaScript-Templates/tmpl.js", 'footer');
+ elgg_register_js('jquery-load-image', "$js_base/vendor/load-image.min.js", 'footer');
+ elgg_register_js('jquery-canvas-to-blob', "$js_base/vendor/canvas-to-blob.min.js", 'footer');
+ elgg_register_js('jquery-image-gallery', "$js_base/vendor/jquery.image-gallery.min.js", 'footer');
+ elgg_register_js('jquery-iframe-transport', "$js_base/jquery.iframe-transport.js", 'footer');
+
+ elgg_register_js('jquery-fileupload', "$js_base/jquery.fileupload.js", 'footer');
+ elgg_register_js('jquery-fileupload-fp', "$js_base/jquery.fileupload-fp.js", 'footer');
+ elgg_register_js('jquery-fileupload-ui', "$js_base/jquery.fileupload-ui.js", 'footer');
+ elgg_register_js('jquery-fileupload-jui', "$js_base/jquery.fileupload-jui.js", 'footer');
+
// Add photos link to owner block/hover menus
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu');
@@ -81,14 +84,8 @@ function tidypics_init() {
register_notification_object('object', 'album', elgg_echo('tidypics:newalbum_subject'));
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'tidypics_notify_message');
- // allow people in a walled garden to use flash uploader
- elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'tidypics_walled_garden_override');
-
- // flash session work around for uploads when use_only_cookies is set
- elgg_register_plugin_hook_handler('forward', 'csrf', 'tidypics_ajax_session_handler');
-
// Register actions
- $base_dir = elgg_get_plugins_path() . 'tidypics/actions/photos';
+ $base_dir = elgg_get_plugins_path() . 'lightpics/actions/photos';
elgg_register_action("photos/delete", "$base_dir/delete.php");
elgg_register_action("photos/album/save", "$base_dir/album/save.php");
@@ -99,8 +96,6 @@ function tidypics_init() {
elgg_register_action("photos/image/save", "$base_dir/image/save.php");
elgg_register_action("photos/image/ajax_upload", "$base_dir/image/ajax_upload.php", 'logged_in');
elgg_register_action("photos/image/ajax_upload_complete", "$base_dir/image/ajax_upload_complete.php", 'logged_in');
- elgg_register_action("photos/image/tag", "$base_dir/image/tag.php");
- elgg_register_action("photos/image/untag", "$base_dir/image/untag.php");
elgg_register_action("photos/batch/edit", "$base_dir/batch/edit.php");
@@ -121,9 +116,11 @@ function tidypics_page_handler($page) {
return false;
}
+ elgg_load_js('lightbox');
+ elgg_load_css('lightbox');
elgg_load_js('tidypics');
- $base = elgg_get_plugins_path() . 'tidypics/pages/photos';
+ $base = elgg_get_plugins_path() . 'lightpics/pages/photos';
switch ($page[0]) {
case "all": // all site albums
case "world":
@@ -145,7 +142,6 @@ function tidypics_page_handler($page) {
case "album": // view an album individually
set_input('guid', $page[1]);
- elgg_load_js('tidypics:slideshow');
require "$base/album/view.php";
break;
@@ -207,7 +203,7 @@ function tidypics_page_handler($page) {
if (isset($page[1])) {
set_input('batch', $page[1]);
}
- include($CONFIG->pluginspath . "tidypics/pages/edit_multiple.php");
+ include($CONFIG->pluginspath . "lightpics/pages/edit_multiple.php");
break;
case "download": // download an image
@@ -216,41 +212,34 @@ function tidypics_page_handler($page) {
include "$base/image/download.php";
break;
- case "tagged": // all photos tagged with user
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
- break;
-
case "mostviewed": // images with the most views
if (isset($page[1])) {
set_input('username', $page[1]);
}
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
+ include($CONFIG->pluginspath . "lightpics/pages/lists/mostviewedimages.php");
break;
case "mostrecent": // images uploaded most recently
if (isset($page[1])) {
set_input('username', $page[1]);
}
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
+ include($CONFIG->pluginspath . "lightpics/pages/lists/mostrecentimages.php");
break;
case "recentlyviewed": // images most recently viewed
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
+ include($CONFIG->pluginspath . "lightpics/pages/lists/recentlyviewed.php");
break;
case "recentlycommented": // images with the most recent comments
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
+ include($CONFIG->pluginspath . "lightpics/pages/lists/recentlycommented.php");
break;
case "highestrated": // images with the highest average rating
- include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
+ include($CONFIG->pluginspath . "lightpics/pages/lists/highestrated.php");
break;
case "admin":
- include ($CONFIG->pluginspath . "tidypics/pages/admin.php");
+ include ($CONFIG->pluginspath . "lightpics/pages/admin.php");
break;
default:
@@ -329,44 +318,7 @@ function tidypics_entity_menu_setup($hook, $type, $return, $params) {
);
$return[] = ElggMenuItem::factory($options);
}
-
- if (elgg_get_plugin_setting('tagging', 'tidypics')) {
- $options = array(
- 'name' => 'tagging',
- 'text' => elgg_echo('tidypics:actiontag'),
- 'href' => '#',
- 'title' => elgg_echo('tidypics:tagthisphoto'),
- 'rel' => 'photo-tagging',
- 'priority' => 80,
- );
- $return[] = ElggMenuItem::factory($options);
- }
- }
-
- // only show these options if there are images
- if (elgg_instanceof($entity, 'object', 'album') && $entity->getSize() > 0) {
- $url = $entity->getURL() . '?limit=50&view=rss';
- $url = elgg_format_url($url);
- $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
- $options = array(
- 'name' => 'slideshow',
- 'text' => elgg_echo('album:slideshow'),
- 'href' => $slideshow_link,
- 'priority' => 80,
- );
- $return[] = ElggMenuItem::factory($options);
-
- if ($entity->canEdit()) {
- $options = array(
- 'name' => 'sort',
- 'text' => elgg_echo('album:sort'),
- 'href' => "photos/sort/" . $entity->getGUID(),
- 'priority' => 90,
- );
- $return[] = ElggMenuItem::factory($options);
- }
}
-
return $return;
}
@@ -440,87 +392,6 @@ function tidypics_notify_message($hook, $type, $result, $params) {
}
/**
- * Allows the flash uploader actions through walled garden since
- * they come without the session cookie
- */
-function tidypics_walled_garden_override($hook, $type, $pages) {
- $pages[] = 'action/photos/image/ajax_upload';
- $pages[] = 'action/photos/image/ajax_upload_complete';
- return $pages;
-}
-
-/**
- * Work around for Flash/session issues
- *
- * Catches Elgg attempting to forward the Flash uploader because it doesn't
- * have a session cookie. Instead manually runs the action.
- *
- * @param string $hook The name of the hook
- * @param string $type The type of the hook
- * @param string $value Location being forwarded to
- * @param array $params Parameters related to the forward() call
- * @return void
- */
-function tidypics_ajax_session_handler($hook, $type, $value, $params) {
- $www_root = elgg_get_config('wwwroot');
- $url = $params['current_url'];
-
- if ($url !== "{$www_root}action/photos/image/ajax_upload") {
- return;
- }
-
- if (elgg_get_logged_in_user_guid() != 0) {
- return;
- }
-
- // action_gatekeeper rejected ajax call from Flash due to session issue
-
- // Validate token
- $token = get_input('__elgg_token');
- $ts = get_input('__elgg_ts');
- $session_id = get_input('Elgg');
- $session_token = get_input('session_token');
- $tidypics_token = get_input('tidypics_token');
- $user_guid = get_input('user_guid');
- $user = get_user($user_guid);
- $timeout = elgg_get_config('action_token_timeout');
- if (!$timeout) {
- $timeout = 2;
- }
-
- if (!$user) {
- trigger_error('Tidypics warning: failed to get user in flash uploader', E_USER_WARNING);
- return;
- }
-
- if (!$token || !$ts || !$session_id || !$tidypics_token) {
- trigger_error('Tidypics warning: token information missing in flash uploader', E_USER_WARNING);
- return;
- }
-
- $hour = 60*60;
- $now = time();
- if ($ts < $now-$hour || $ts > $now+$hour) {
- trigger_error('Tidypics warning: failed time check in flash uploader', E_USER_WARNING);
- return;
- }
-
- $generated_token = md5($session_id . get_site_secret() . $ts . $user->salt);
-
- if ($tidypics_token !== $generated_token) {
- trigger_error('Tidypics warning: token check failed in flash uploader', E_USER_WARNING);
- return;
- }
-
- // passed token test, so login and process action
- login($user);
- $actions = elgg_get_config('actions');
- include $actions['photos/image/ajax_upload']['file'];
-
- exit;
-}
-
-/**
* Sets up submenus for tidypics most viewed pages
*/
function tidypics_mostviewed_submenus() {