diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/addalbum.php | 57 | ||||
-rw-r--r-- | actions/photos/album/save.php | 48 |
2 files changed, 48 insertions, 57 deletions
diff --git a/actions/addalbum.php b/actions/addalbum.php deleted file mode 100644 index 8ddcca131..000000000 --- a/actions/addalbum.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Tidypics Add New Album Action - * - */ - -// Make sure we're logged in -gatekeeper(); - -// Get input data -$title = get_input('tidypicstitle'); -$body = get_input('tidypicsbody'); -$tags = get_input('tidypicstags'); -$access = get_input('access_id'); -$container_guid = get_input('container_guid', get_loggedin_userid()); - -// Cache to the session -$_SESSION['tidypicstitle'] = $title; -$_SESSION['tidypicsbody'] = $body; -$_SESSION['tidypicstags'] = $tags; - - -if (empty($title)) { - register_error(elgg_echo("album:blank")); - forward($_SERVER['HTTP_REFERER']); -} - -$album = new TidypicsAlbum(); - -$album->container_guid = $container_guid; -$album->owner_guid = get_loggedin_userid(); -$album->access_id = $access; -$album->title = $title; -$album->description = $body; -if ($tags) { - $album->tags = string_to_tag_array($tags); -} -$album->new_album = TP_NEW_ALBUM; - -if (!$album->save()) { - register_error(elgg_echo("album:error")); - forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); -} - -mkdir(tp_get_img_dir() . $album->guid, 0755, true); - -system_message(elgg_echo("album:created")); - -// Remove the album post cache -unset($_SESSION['tidypicstitle']); -unset($_SESSION['tidypicsbody']); -unset($_SESSION['tidypicstags']); - -// plugins can register to be told when a new Tidypics album has been created -trigger_elgg_event('add', 'tp_album', $album); - -forward("pg/photos/upload/" . $album->guid); diff --git a/actions/photos/album/save.php b/actions/photos/album/save.php new file mode 100644 index 000000000..cc7181678 --- /dev/null +++ b/actions/photos/album/save.php @@ -0,0 +1,48 @@ +<?php +/** + * Save album action + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + + +// Get input data +$title = get_input('title'); +$description = get_input('description'); +$tags = get_input('tags'); +$access_id = get_input('access_id'); +$container_guid = get_input('container_guid', elgg_get_logged_in_user_guid()); +$guid = get_input('guid'); + +elgg_make_sticky_form('tidypics'); + +if (empty($title)) { + register_error(elgg_echo("album:blank")); + forward(REFERER); +} + +if ($guid) { + $album = get_entity($guid); +} else { + $album = new TidypicsAlbum(); +} + +$album->container_guid = $container_guid; +$album->owner_guid = elgg_get_logged_in_user_guid(); +$album->access_id = $access_id; +$album->title = $title; +$album->description = $description; +if ($tags) { + $album->tags = string_to_tag_array($tags); +} + +if (!$album->save()) { + register_error(elgg_echo("album:error")); + forward(REFERER); +} + +elgg_clear_sticky_form('tidypics'); + +system_message(elgg_echo("album:created")); +forward($album->getURL()); |