diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/photos/admin/upgrade.php | 4 | ||||
-rw-r--r-- | actions/photos/image/ajax_upload.php | 57 | ||||
-rw-r--r-- | actions/photos/image/ajax_upload_complete.php | 74 | ||||
-rw-r--r-- | actions/photos/image/tag.php | 109 | ||||
-rw-r--r-- | actions/photos/image/untag.php | 24 |
5 files changed, 2 insertions, 266 deletions
diff --git a/actions/photos/admin/upgrade.php b/actions/photos/admin/upgrade.php index c9ae1da48..8e03c6bc5 100644 --- a/actions/photos/admin/upgrade.php +++ b/actions/photos/admin/upgrade.php @@ -5,7 +5,7 @@ $plugins_path = elgg_get_plugins_path(); -require_once "{$plugins_path}tidypics/version.php"; +require_once "{$plugins_path}lightpics/version.php"; $local_version = elgg_get_plugin_setting('version', 'tidypics'); @@ -16,7 +16,7 @@ if ($version <= $local_version) { set_time_limit(0); -$base_dir = "{$plugins_path}tidypics/upgrades"; +$base_dir = "{$plugins_path}lightpics/upgrades"; // taken from engine/lib/version.php if ($handle = opendir($base_dir)) { 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/actions/photos/image/tag.php b/actions/photos/image/tag.php deleted file mode 100644 index e623bd546..000000000 --- a/actions/photos/image/tag.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php -/** - * Add photo tag action - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$coordinates_str = get_input('coordinates'); -$username = get_input('username'); -$image_guid = get_input('guid'); - -if ($image_guid == 0) { - register_error(elgg_echo("tidypics:phototagging:error")); - forward(REFERER); -} - -$image = get_entity($image_guid); -if (!$image) { - register_error(elgg_echo("tidypics:phototagging:error")); - forward(REFERER); -} - -if (empty($username)) { - register_error(elgg_echo("tidypics:phototagging:error")); - forward(REFERER); -} - -$user = get_user_by_username($username); -if (!$user) { - // plain tag - $relationships_type = 'word'; - $value = $username; -} else { - $relationships_type = 'user'; - $value = $user->guid; -} - -/* // not adding as plain tag yet -$new_word_tag = false; -if ($user_id != 0) { - $relationships_type = 'user'; - $value = $user_id; -} else { - $relationships_type = 'word'; - $value = $word; - - // check to see if the photo has this tag and add if not - if (!is_array($image->tags)) { - if ($image->tags != $word) { - $new_word_tag = true; - $tagarray = $image->tags . ',' . $word; - $tagarray = string_to_tag_array($tagarray); - } - } else { - if (!in_array($word, $image->tags)) { - $new_word_tag = true; - $tagarray = $image->tags; - $tagarray[] = $word; - } - } -} - -// add new tag now so it is available in search -if ($new_word_tag) { - $image->clearMetadata('tags'); - $image->tags = $tagarray; -} -*/ - -$tag = new stdClass(); -$tag->coords = $coordinates_str; -$tag->type = $relationships_type; -$tag->value = $value; -$access_id = $image->getAccessID(); - -$annotation_id = $image->annotate('phototag', serialize($tag), $access_id); -if ($annotation_id) { - // if tag is a user id, add relationship for searching (find all images with user x) - if ($tag->type === 'user') { - if (!check_entity_relationship($tag->value, 'phototag', $image_guid)) { - add_entity_relationship($tag->value, 'phototag', $image_guid); -/* - // also add this to the river - subject is image, object is the tagged user - add_to_river('river/object/image/tag', 'tag', $tagger->guid, $user_id, $access_id, 0, $annotation_id); - - // notify user of tagging as long as not self - if ($owner_id != $user_id) { - notify_user( - $user_id, - $owner_id, - elgg_echo('tidypics:tag:subject'), - sprintf( - elgg_echo('tidypics:tag:body'), - $image->getTitle(), - $tagger->name, - $image->getURL() - ) - ); - } - * - */ - } - } - - system_message(elgg_echo("tidypics:phototagging:success")); -} - -forward(REFERER); diff --git a/actions/photos/image/untag.php b/actions/photos/image/untag.php deleted file mode 100644 index 11c433a61..000000000 --- a/actions/photos/image/untag.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -/** - * Remove photo tag action - */ - -$annotation = elgg_get_annotation_from_id(get_input('annotation_id')); - -if (!$annotation instanceof ElggAnnotation || $annotation->name != 'phototag') { - register_error(elgg_echo("tidypics:phototagging:delete:error")); - forward(REFERER); -} - -if (!$annotation->canEdit()) { - register_error(elgg_echo("tidypics:phototagging:delete:error")); - forward(REFERER); -} - -if ($annotation->delete()) { - system_message(elgg_echo("tidypics:phototagging:delete:success")); -} else { - system_message(elgg_echo("tidypics:phototagging:delete:error")); -} - -forward(REFERER); |