From 1d3b83e6791b1e9e3386bb79937ef58240ba94ba Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 31 Jul 2010 19:38:29 +0000 Subject: moved some actions into the admin directory --- actions/admin/create_thumbnails.php | 60 +++++++++++++++++++++++++++++ actions/admin/flickrSetup.php | 36 +++++++++++++++++ actions/admin/imtest.php | 18 +++++++++ actions/admin/settings.php | 77 +++++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+) create mode 100644 actions/admin/create_thumbnails.php create mode 100644 actions/admin/flickrSetup.php create mode 100644 actions/admin/imtest.php create mode 100644 actions/admin/settings.php (limited to 'actions/admin') diff --git a/actions/admin/create_thumbnails.php b/actions/admin/create_thumbnails.php new file mode 100644 index 000000000..18dae6b78 --- /dev/null +++ b/actions/admin/create_thumbnails.php @@ -0,0 +1,60 @@ +getFilename(); +$container_guid = $image->container_guid; +if (!$filename || !$container_guid) { + echo "Error retrieving information about the image"; + return; +} + +$title = $image->title; +$prefix = "image/$container_guid/"; +$filestorename = substr($filename, strlen($prefix)); + +$image_lib = get_plugin_setting('image_lib', 'tidypics'); +if (!$image_lib) { + $image_lib = "GD"; +} + +if ($image_lib == 'ImageMagick') { // ImageMagick command line + + if (tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename) != true) { + trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING); + echo "Failed to create thumbnails"; + } + +} else if ($image_lib == 'ImageMagickPHP') { // imagick PHP extension + + if (tp_create_imagick_thumbnails($image, $prefix, $filestorename) != true) { + trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING); + echo "Failed to create thumbnails"; + } + +} else { + + if (tp_create_gd_thumbnails($image, $prefix, $filestorename) != true) { + trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING); + echo "Failed to create thumbnails"; + } + +} // end of image library selector + +echo "wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&size=large\" alt=\"{$title}\" />"; diff --git a/actions/admin/flickrSetup.php b/actions/admin/flickrSetup.php new file mode 100644 index 000000000..ee31b8c34 --- /dev/null +++ b/actions/admin/flickrSetup.php @@ -0,0 +1,36 @@ +people_findByUsername( $flickr_username ); + if( !empty( $flickr_user["id"] )) { + create_metadata( $user->guid, "flickr_username", $flickr_username, "text", $user->guid, ACCESS_PUBLIC ); + create_metadata( $user->guid, "flickr_id", $flickr_user["id"], "text", $user->guid, ACCESS_PUBLIC ); + if( $album_id ) { + create_metadata( $user->guid, "flickr_album_id", $album_id, "text", $user->guid, ACCESS_PUBLIC ); + $album = get_entity( $album_id ); + } + + system_message( sprintf( elgg_echo( 'flickr:savedusername' ), $flickr_username )); + system_message( sprintf( elgg_echo( 'flickr:saveduserid' ), $flickr_user["id"] )); + system_message( sprintf( elgg_echo( 'flickr:savedalbum' ), $album->title )); + } else { + register_error( sprintf( elgg_echo( 'flickr:errorusername' ), $flickr_username )); + } +} + +forward($_SERVER['HTTP_REFERER']); +//echo "
"; var_dump( array($flickr_username, $return_url )); echo "
"; diff --git a/actions/admin/imtest.php b/actions/admin/imtest.php new file mode 100644 index 000000000..293a9b2e8 --- /dev/null +++ b/actions/admin/imtest.php @@ -0,0 +1,18 @@ + $v) { + if (!set_plugin_setting($k, $v, 'tidypics')) { + register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics')); + forward($_SERVER['HTTP_REFERER']); + } +} + +// check boxes +if (is_array(get_input('download_link'))) { // this can be done due to way Elgg uses checkboxes + set_plugin_setting('download_link', 'enabled', 'tidypics'); +} else { + set_plugin_setting('download_link', 'disabled', 'tidypics'); +} + +if (is_array(get_input('tagging'))) { + set_plugin_setting('tagging', 'enabled', 'tidypics'); +} else { + set_plugin_setting('tagging', 'disabled', 'tidypics'); +} + +if (is_array(get_input('photo_ratings'))) { + set_plugin_setting('photo_ratings', 'enabled', 'tidypics'); +} else { + set_plugin_setting('photo_ratings', 'disabled', 'tidypics'); +} + +if (is_array(get_input('exif'))) { + set_plugin_setting('exif', 'enabled', 'tidypics'); +} else { + set_plugin_setting('exif', 'disabled', 'tidypics'); +} + +if (is_array(get_input('view_count'))) { + set_plugin_setting('view_count', 'enabled', 'tidypics'); +} else { + set_plugin_setting('view_count', 'disabled', 'tidypics'); +} + +if (is_array(get_input('grp_perm_override'))) { + set_plugin_setting('grp_perm_override', 'enabled', 'tidypics'); +} else { + set_plugin_setting('grp_perm_override', 'disabled', 'tidypics'); +} + + +// image sizes +$image_sizes = array(); +$image_sizes['large_image_width'] = get_input('large_thumb_width'); +$image_sizes['large_image_height'] = get_input('large_thumb_height'); +$image_sizes['small_image_width'] = get_input('small_thumb_width'); +//$image_sizes['small_image_height'] = get_input('small_thumb_height'); +$image_sizes['small_image_height'] = get_input('small_thumb_width'); +$image_sizes['thumb_image_width'] = get_input('thumb_width'); +//$image_sizes['thumb_image_height'] = get_input('thumb_height'); +$image_sizes['thumb_image_height'] = get_input('thumb_width'); +set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics'); + + + +system_message(elgg_echo('tidypics:settings:save:ok')); + +forward($_SERVER['HTTP_REFERER']); -- cgit v1.2.3