diff options
-rw-r--r-- | actions/photos/image/ajax_upload.php | 57 | ||||
-rw-r--r-- | actions/photos/image/ajax_upload_complete.php | 74 | ||||
-rw-r--r-- | languages/da.php | 1 | ||||
-rw-r--r-- | languages/de.php | 4 | ||||
-rw-r--r-- | languages/en.php | 4 | ||||
-rw-r--r-- | languages/es.php | 1 | ||||
-rw-r--r-- | languages/fr.php | 1 | ||||
-rw-r--r-- | languages/it.php | 1 | ||||
-rw-r--r-- | pages/photos/image/upload.php | 10 | ||||
-rw-r--r-- | start.php | 94 | ||||
-rw-r--r-- | views/default/forms/photos/admin/settings/main.php | 2 | ||||
-rw-r--r-- | views/default/forms/photos/ajax_upload.php | 54 | ||||
-rw-r--r-- | views/default/js/photos/uploading.php | 94 | ||||
-rw-r--r-- | views/default/photos/css.php | 59 |
14 files changed, 5 insertions, 451 deletions
diff --git a/actions/photos/image/ajax_upload.php b/actions/photos/image/ajax_upload.php deleted file mode 100644 index 312bc598c..000000000 --- a/actions/photos/image/ajax_upload.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Elgg single upload action for flash/ajax uploaders - */ - -elgg_load_library('tidypics:upload'); - -$album_guid = (int) get_input('album_guid'); -$file_var_name = get_input('file_var_name', 'Image'); -$batch = get_input('batch'); - -$album = get_entity($album_guid); -if (!$album) { - echo elgg_echo('tidypics:baduploadform'); - exit; -} - -// probably POST limit exceeded -if (empty($_FILES)) { - trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING); - register_error(elgg_echo('tidypics:exceedpostlimit')); - exit; -} - -$file = $_FILES[$file_var_name]; - -$mime = tp_upload_get_mimetype($file['name']); -if ($mime == 'unknown') { - echo 'Not an image'; - exit; -} - -// we have to override the mime type because uploadify sends everything as application/octet-string -$file['type'] = $mime; - -$image = new TidypicsImage(); -$image->container_guid = $album->getGUID(); -$image->setMimeType($mime); -$image->access_id = $album->access_id; -$image->batch = $batch; - -try { - $image->save($file); - $album->prependImageList(array($image->guid)); - - if (elgg_get_plugin_setting('img_river_view', 'tidypics') === "all") { - add_to_river('river/object/image/create', 'create', $image->getOwnerGUID(), $image->getGUID()); - } - - echo elgg_echo('success'); -} catch (Exception $e) { - // remove the bits that were saved - $image->delete(); - echo $e->getMessage(); -} - -exit;
\ No newline at end of file diff --git a/actions/photos/image/ajax_upload_complete.php b/actions/photos/image/ajax_upload_complete.php deleted file mode 100644 index 358a4fc6f..000000000 --- a/actions/photos/image/ajax_upload_complete.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * A batch is complete so check if this is first upload to album - * - */ - -$batch = get_input('batch'); -$album_guid = (int) get_input('album_guid'); -$img_river_view = elgg_get_plugin_setting('img_river_view', 'tidypics'); - -$album = get_entity($album_guid); -if (!elgg_instanceof($album, 'object', 'album')) { - exit; -} - -$params = array( - 'type' => 'object', - 'subtype' => 'image', - 'metadata_names' => 'batch', - 'metadata_values' => $batch, - 'limit' => 0 -); - -$images = elgg_get_entities_from_metadata($params); -if ($images) { - // Create a new batch object to contain these photos - $batch = new ElggObject(); - $batch->subtype = "tidypics_batch"; - $batch->access_id = ACCESS_PUBLIC; - $batch->container_guid = $album->guid; - - if ($batch->save()) { - foreach ($images as $image) { - add_entity_relationship($image->guid, "belongs_to_batch", $batch->getGUID()); - } - } -} else { - // @todo some sort of message to edit them manually. - exit; -} - -// "added images to album" river -if ($img_river_view == "batch" && $album->new_album == false) { - add_to_river('river/object/tidypics_batch/create', 'create', $batch->getOwnerGUID(), $batch->getGUID()); -} - -// "created album" river -if ($album->new_album) { - $album->new_album = false; - $album->first_upload = true; - - add_to_river('river/object/album/create', 'create', $album->getOwnerGUID(), $album->getGUID()); - - // "created album" notifications - // we throw the notification manually here so users are not told about the new album until - // there are at least a few photos in it - if ($album->shouldNotify()) { - object_notifications('create', 'object', $album); - $album->last_notified = time(); - } -} else { - // "added image to album" notifications - if ($album->first_upload) { - $album->first_upload = false; - } - - if ($album->shouldNotify()) { - object_notifications('create', 'object', $album); - $album->last_notified = time(); - } -} - -echo json_encode(array('batch_guid' => $batch->getGUID())); -exit;
\ No newline at end of file diff --git a/languages/da.php b/languages/da.php index 78113d467..c90e8f55d 100644 --- a/languages/da.php +++ b/languages/da.php @@ -92,7 +92,6 @@ $danish = array( 'tidypics:uploader:choose' => "Vælg fotos",
'tidypics:uploader:upload' => "Upload fotos",
'tidypics:uploader:describe' => "Beskriv fotos",
- 'tidypics:uploader:instructs' => 'Med tre nemme trin kan du tilføje fotos i dit album ved hjælp af denne uploader: vælg, upload og beskriv fotos. Hvis du ikke har Flash, er der også en <a href="%s">standard uploader</a> til rådighed.',
'tidypics:uploader:basic' => 'Du kan uploade op til 10 fotos ad gangen (%s MB maksimum pr. foto)',
'tidypics:sort:instruct' => 'Sortér fotos i albummet ved hjælp af drag and drop. Klik derefter på knappen Gem.',
diff --git a/languages/de.php b/languages/de.php index 1f439e981..b6817c589 100644 --- a/languages/de.php +++ b/languages/de.php @@ -68,7 +68,6 @@ $german = array( 'tidypics:settings:photo_ratings' => "Bewerten von Bildern erlauben (benötigt das Elggx Fivestar-Plugin oder ein vergleichbares)",
'tidypics:settings:exif' => "EXIF-Daten anzeigen",
'tidypics:settings:view_count' => "Zugriffszähler anzeigen",
- 'tidypics:settings:uploader' => "Flash-Uploader verwenden",
'tidypics:settings:grp_perm_override' => "Gruppen-Mitgliedern unbeschränkten Zugriff auf die Verwaltung von Gruppen-Alben geben",
'tidypics:settings:maxfilesize' => "Maximal erlaubte Bildgröße in Megabytes (MB):",
'tidypics:settings:quota' => "Quota für Benutzer in Megabytes (MB) (0 = kein Quota)",
@@ -101,8 +100,7 @@ $german = array( 'tidypics:server_info:post_max_size_desc' => '"Max post size" abzüglich der Größe der HTML-Form = Maximal mögliche Gesamtgröße von gleichzeitig hochzuladenden Bildern.',
'tidypics:server_info:max_input_time_desc' => 'Maximale erlaubte Dauer, in der das Hochladen von Daten auf den Server abgeschlossen sein muss.',
'tidypics:server_info:max_execution_time_desc' => 'Maximal erlaubte Ausführdauer für ein Skript auf dem Server.',
- 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions können den Flash-Uploader beeinträchtigen.',
-
+
'tidypics:server_info:php_version' => 'PHP-Version',
'tidypics:server_info:memory_limit' => 'Für PHP verfügbarer Speicher',
'tidypics:server_info:peak_usage' => 'Genutzer Speicher, um diese Seite zu laden',
diff --git a/languages/en.php b/languages/en.php index 62b43673d..1c40e5e0a 100644 --- a/languages/en.php +++ b/languages/en.php @@ -68,7 +68,6 @@ $english = array( 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)", 'tidypics:settings:exif' => "Display EXIF data", 'tidypics:settings:view_count' => "Display view count", - 'tidypics:settings:uploader' => "Use Flash uploader", 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums", 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):", 'tidypics:settings:quota' => "User Quota (MB) - 0 equals no quota", @@ -101,8 +100,7 @@ $english = array( 'tidypics:server_info:post_max_size_desc' => 'Max post size = sum of images + html form', 'tidypics:server_info:max_input_time_desc' => 'Time script waits for upload to finish', 'tidypics:server_info:max_execution_time_desc' => 'Max time a script will run', - 'tidypics:server_info:use_only_cookies_desc' => 'Cookie only sessions may affect the Flash uploader', - + 'tidypics:server_info:php_version' => 'PHP Version', 'tidypics:server_info:memory_limit' => 'Memory Available to PHP', 'tidypics:server_info:peak_usage' => 'Memory Used to Load This Page', diff --git a/languages/es.php b/languages/es.php index 704f01979..efe65d976 100644 --- a/languages/es.php +++ b/languages/es.php @@ -11,7 +11,6 @@ $spanish = array( 'caption' => "Título",
'photos' => "Fotos",
'images:upload' => "Cargar Imagenes",
- 'images:multiupload' => "Herramienta MultiCarga de Flash",
'images:multiupload:todo' => "Selecciona uno a más archivos para cargar..",
'album' => "Álbum de Fotos",
'albums' => "Álbumnes de Fotos",
diff --git a/languages/fr.php b/languages/fr.php index 375159e0b..1c653daa1 100644 --- a/languages/fr.php +++ b/languages/fr.php @@ -9,7 +9,6 @@ $french = array( 'caption' => "Légende" , 'photos' => "Photos" , 'images:upload' => "Charger des images" , - 'images:multiupload' => "Outil Flash de chargement multi fichiers" , 'images:multiupload:todo' => "Sélectionnez un ou plusieurs fichiers à charger." , 'album' => "Album photo" , 'albums' => "Albums photo" , diff --git a/languages/it.php b/languages/it.php index 764ecf5f7..27a9654a6 100644 --- a/languages/it.php +++ b/languages/it.php @@ -51,7 +51,6 @@ $italian = array( 'tidypics:uploader:choose' => "Scegli le Foto",
'tidypics:uploader:upload' => "Carica le Foto",
'tidypics:uploader:describe' => "Descrivi le Foto",
- 'tidypics:uploader:instructs' => 'Ci sono tre semplici passaggi per aggiungere le Foto al tuo Album usando questo caricatore: la scelta, il caricamento e il descriverle. Se non hai Flash, è disponibile anche un <a href="%s">caricatore di base</a>.',
'tidypics:uploader:basic' => 'Puoi caricare fino a 10 Foto alla volta (%s MB massimo per foto)',
'tidypics:sort:instruct' => 'Ordina i Foto Album trascinando le immagini. Poi clicca il bottone salva.',
diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php index 425d5689a..61be8523b 100644 --- a/pages/photos/image/upload.php +++ b/pages/photos/image/upload.php @@ -38,15 +38,7 @@ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username"); elgg_push_breadcrumb($album->getTitle(), $album->getURL()); elgg_push_breadcrumb(elgg_echo('album:addpix')); -$uploader = get_input('uploader'); -if ($uploader == 'basic') { - $content = elgg_view('forms/photos/basic_upload', array('entity' => $album)); -} else { - elgg_load_js('swfobject'); - elgg_load_js('jquery.uploadify-tp'); - elgg_load_js('tidypics:uploading'); - $content = elgg_view('forms/photos/ajax_upload', array('entity' => $album)); -} +$content = elgg_view('forms/photos/basic_upload', array('entity' => $album)); $body = elgg_view_layout('content', array( 'content' => $content, @@ -41,14 +41,9 @@ function tidypics_init() { $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'); - + // Add photos link to owner block/hover menus elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu'); @@ -81,12 +76,6 @@ 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'; elgg_register_action("photos/delete", "$base_dir/delete.php"); @@ -440,87 +429,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() { diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php index c99b9d688..f7950a7ad 100644 --- a/views/default/forms/photos/admin/settings/main.php +++ b/views/default/forms/photos/admin/settings/main.php @@ -5,7 +5,7 @@ $plugin = $vars['plugin']; -$checkboxes = array('tagging', 'view_count', 'uploader', 'exif', 'download_link'); +$checkboxes = array('tagging', 'view_count', 'exif', 'download_link'); foreach ($checkboxes as $checkbox) { echo '<div>'; $checked = $plugin->$checkbox ? 'checked' : false; diff --git a/views/default/forms/photos/ajax_upload.php b/views/default/forms/photos/ajax_upload.php deleted file mode 100644 index 3ab578a38..000000000 --- a/views/default/forms/photos/ajax_upload.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * Tidypics ajax upload form body - * - * @uses $vars['entity'] - */ - -$album = $vars['entity']; - -$ts = time(); -$batch = time(); -$tidypics_token = md5(session_id() . get_site_secret() . $ts . elgg_get_logged_in_user_entity()->salt); -$basic_uploader_url = current_page_url() . '/basic'; - -$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics'); -if (!$maxfilesize) { - $maxfilesize = 5; -} - -?> - -<p> -<?php - echo elgg_echo('tidypics:uploader:instructs', array($maxfilesize, $basic_uploader_url)); -?> -</p> - -<ul id="tidypics-uploader-steps"> - <li class="mbm"> - <div id="tidypics-uploader"> - <a id="tidypics-choose-button" href="<?php echo $basic_uploader_url; ?>"> - 1. <?php echo elgg_echo('tidypics:uploader:choose'); ?> - </a> - <div id="tidypics-flash-uploader"> - <input type="file" id="uploadify" name="uploadify" class="hidden" /> - <input type="hidden" name="album_guid" value="<?php echo $album->getGUID(); ?>" /> - <input type="hidden" name="batch" value="<?php echo $batch; ?>" /> - <input type="hidden" name="tidypics_token" value="<?php echo $tidypics_token; ?>" /> - <input type="hidden" name="user_guid" value="<?php echo elgg_get_logged_in_user_guid(); ?>" /> - <input type="hidden" name="Elgg" value="<?php echo session_id(); ?>" /> - </div> - </div> - </li> - <li class="mbm"> - <a id="tidypics-upload-button" class="tidypics-disable" href="#"> - 2. <?php echo elgg_echo('tidypics:uploader:upload'); ?> - </a> - </li> - <li class="mbm"> - <a id="tidypics-describe-button" class="tidypics-disable" href="#"> - 3. <?php echo elgg_echo('tidypics:uploader:describe'); ?> - </a> - </li> -</ul> diff --git a/views/default/js/photos/uploading.php b/views/default/js/photos/uploading.php deleted file mode 100644 index 465f937ab..000000000 --- a/views/default/js/photos/uploading.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * AJAX uploading - */ -?> - -//<script> -elgg.provide('elgg.tidypics.uploading'); - -elgg.tidypics.uploading.init = function() { - - var fields = ['Elgg', 'user_guid', 'album_guid', 'batch', 'tidypics_token']; - var data = elgg.security.token; - - $(fields).each(function(i, name) { - var value = $('input[name=' + name + ']').val(); - if (value) { - data[name] = value; - } - }); - - $("#uploadify").uploadify({ - 'uploader' : elgg.config.wwwroot + 'mod/tidypics/vendors/uploadify/uploadify.swf', - 'script' : elgg.config.wwwroot + 'action/photos/image/ajax_upload', - 'cancelImg' : elgg.config.wwwroot + 'mod/tidypics/vendors/uploadify/cancel.png', - 'fileDataName' : 'Image', - 'multi' : true, - 'auto' : false, - 'wmode' : 'transparent', - 'buttonImg' : " ", - 'height' : $('#tidypics-choose-button').height(), - 'width' : $('#tidypics-choose-button').width(), - 'scriptData' : data, - 'onEmbedFlash' : function(event) { - // @todo This is supposed to mimick hovering over the link. - // hover events aren't firing for the object. - $("#" + event.id).hover( - function(){ - $("#tidypics-choose-button").addClass('tidypics-choose-button-hover'); - }, - function(){ - $("#tidypics-choose-button").removeClass('tidypics-choose-button-hover'); - } - ); - }, - 'onSelectOnce' : function() { - $("#tidypics-upload-button").removeClass('tidypics-disable'); - }, - 'onAllComplete' : function() { - // @todo they can keep adding pics if they want. no need to disable this. - $("#tidypics-choose-button").addClass('tidypics-disable'); - $("#tidypics-upload-button").addClass('tidypics-disable').die(); - $("#tidypics-describe-button").removeClass('tidypics-disable'); - - elgg.action('photos/image/ajax_upload_complete', { - data: { - album_guid: data.album_guid, - batch: data.batch - }, - success: function(json) { - var url = elgg.normalize_url('photos/edit/' + json.batch_guid) - $('#tidypics-describe-button').attr('href', url); - } - }); - }, - 'onComplete' : function(event, queueID, fileObj, response) { - // check for errors here - if (response != 'success') { - $("#uploadify" + queueID + " .percentage").text(" - " + response); - $("#uploadify" + queueID).addClass('uploadifyError'); - } - $("#uploadify" + queueID + " > .cancel").remove(); - return false; - }, - 'onCancel' : function(event, queueID, fileObj, data) { - if (data.fileCount == 0) { - $("#tidypics-upload-button").addClass('tidypics-disable'); - } - }, - 'onError' : function (event, ID, fileObj, errorObj) { - // @todo do something useful with the limited information in the errorObj. - } - - }); - - // bind to upload button - $('#tidypics-upload-button').live('click', function(e) { - var $uploadify = $('#uploadify'); - $uploadify.uploadifyUpload(); - e.preventDefault(); - }); -} - -elgg.register_hook_handler('init', 'system', elgg.tidypics.uploading.init);
\ No newline at end of file diff --git a/views/default/photos/css.php b/views/default/photos/css.php index 2290e1f9a..3f0218fdc 100644 --- a/views/default/photos/css.php +++ b/views/default/photos/css.php @@ -144,11 +144,6 @@ float:left; } -#tidypics_flash_uploader { - position:relative; - z-index:100; -} - /* *************************************** AJAX UPLOADER *************************************** */ @@ -174,60 +169,6 @@ color:#cccccc; text-decoration:none; } - -.uploadifyQueueItem { -background-color:#F5F5F5; -border:2px solid #E5E5E5; -font-size:11px; -margin-top:5px; -padding:10px; -width:350px; -} - -.uploadifyProgress { -background-color:#FFFFFF; -border-color:#808080 #C5C5C5 #C5C5C5 #808080; -border-style:solid; -border-width:1px; -margin-top:10px; -width:100%; -} - -.uploadifyProgressBar { -background-color: #0054a7; -width: 1px; -height: 3px; -} - -#tidypics-uploader { - position:relative; - width:400px; - min-height:20px; -} - -#tidypics-choose-button { -position:absolute; -top:0; -left:0; -z-index:0; -display:block; -float:left; -} - -#tidypics-flash-uploader { -position:relative; -z-index:100; -} - -.uploadifyQueueItem .cancel { - float: right; -} - -.uploadifyError { -border: 2px solid #FBCBBC; -background-color: #FDE5DD; -} - <?php return true; ?> |