aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-07-13 22:02:22 -0400
committerCash Costello <cash.costello@gmail.com>2012-07-13 22:02:22 -0400
commit695651451b262c526d6aaf9d0988ce557ff50e95 (patch)
tree92afd91c81f851e78dd87af0e1f6c2f848f5a8b2
parenta2e4f84be4da51b7ec8fbe625b1b26dde2ad9289 (diff)
parent67d855d73499f36f15331e1ff18cccd13aa8aa74 (diff)
downloadelgg-695651451b262c526d6aaf9d0988ce557ff50e95.tar.gz
elgg-695651451b262c526d6aaf9d0988ce557ff50e95.tar.bz2
Merging admin changes from Brett's repo
-rw-r--r--actions/admin/create_thumbnails.php60
-rw-r--r--actions/photos/admin/create_thumbnails.php70
-rw-r--r--actions/photos/admin/imtest.php (renamed from actions/admin/imtest.php)2
-rw-r--r--languages/en.php59
-rw-r--r--pages/admin.php1
-rw-r--r--pages/server_analysis.php143
-rw-r--r--start.php1
-rw-r--r--views/default/admin/settings/tidypics.php65
-rw-r--r--views/default/admin/settings/tidypics/help.php (renamed from views/default/tidypics/admin/help.php)43
-rw-r--r--views/default/admin/settings/tidypics/image_lib.php38
-rw-r--r--views/default/admin/settings/tidypics/server_info.php130
-rw-r--r--views/default/admin/settings/tidypics/settings.php20
-rw-r--r--views/default/admin/settings/tidypics/thumbnail.php52
-rw-r--r--views/default/tidypics/admin/imagelib.php62
-rw-r--r--views/default/tidypics/admin/settings.php23
-rw-r--r--views/default/tidypics/admin/stats.php36
-rw-r--r--views/default/tidypics/admin/thumbnails.php33
-rw-r--r--views/default/tidypics/admin/tidypics.php60
-rw-r--r--views/default/tidypics/admin/upgrade.php35
19 files changed, 457 insertions, 476 deletions
diff --git a/actions/admin/create_thumbnails.php b/actions/admin/create_thumbnails.php
deleted file mode 100644
index a09965f65..000000000
--- a/actions/admin/create_thumbnails.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/**
- * Tidypics Thumbnail Creation Test
- *
- * Called through ajax
- */
-
-include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
-include dirname(dirname(dirname(__FILE__))) . "/lib/resize.php";
-
-global $CONFIG;
-
-$guid = get_input('guid');
-
-$image = get_entity($guid);
-if (!$image || !($image instanceof TidypicsImage)) {
- echo "Unable to get original image";
- return;
-}
-
-$filename = $image->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 "<img id=\"tidypics_image\" src=\"{$CONFIG->wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&amp;size=large\" alt=\"{$title}\" />";
diff --git a/actions/photos/admin/create_thumbnails.php b/actions/photos/admin/create_thumbnails.php
new file mode 100644
index 000000000..f2e9b26e2
--- /dev/null
+++ b/actions/photos/admin/create_thumbnails.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Tidypics Thumbnail Creation Test
+ *
+ * Called through ajax, but registered as an Elgg action.
+ *
+ */
+
+elgg_load_library('tidypics:resize');
+
+$guid = get_input('guid');
+$image = get_entity($guid);
+
+if (!$image || !($image instanceof TidypicsImage)) {
+ register_error(elgg_echo('tidypics:thumbnail_tool:unknown_image'));
+ forward(REFERER);
+}
+
+$filename = $image->getFilename();
+$container_guid = $image->container_guid;
+if (!$filename || !$container_guid) {
+ register_error(elgg_echo('tidypics:thumbnail_tool:invalid_image_info'));
+ forward(REFERER);
+}
+
+$title = $image->title;
+$prefix = "image/$container_guid/";
+$filestorename = substr($filename, strlen($prefix));
+
+$image_lib = elgg_get_plugin_setting('image_lib', 'tidypics');
+if (!$image_lib) {
+ $image_lib = "GD";
+}
+
+// ImageMagick command line
+if ($image_lib == 'ImageMagick') {
+ if (!tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename)) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:thumbnail_tool:create_failed'));
+ forward(REFERER);
+ }
+
+// imagick PHP extension
+} else if ($image_lib == 'ImageMagickPHP') {
+ if (!tp_create_imagick_thumbnails($image, $prefix, $filestorename)) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:thumbnail_tool:create_failed'));
+ forward(REFERER);
+ }
+// gd
+} else {
+ if (!tp_create_gd_thumbnails($image, $prefix, $filestorename)) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:thumbnail_tool:create_failed'));
+ forward(REFERER);
+ }
+}
+
+$url = elgg_normalize_url("photos/thumbnail/$guid/large");
+system_message(elgg_echo('tidypics:thumbnail_tool:created'));
+
+if (elgg_is_xhr()) {
+ echo json_encode(array(
+ 'guid' => $guid,
+ 'title' => $title,
+ 'thumbnail_src' => $url
+ ));
+}
+
+forward(REFERER); \ No newline at end of file
diff --git a/actions/admin/imtest.php b/actions/photos/admin/imtest.php
index 293a9b2e8..a58643d0e 100644
--- a/actions/admin/imtest.php
+++ b/actions/photos/admin/imtest.php
@@ -2,7 +2,7 @@
/**
* Tidypics ImageMagick Location Test
*
- * Called through ajax
+ * Called through ajax. Not a registered Elgg action.
*/
$location = $_GET['location'];
diff --git a/languages/en.php b/languages/en.php
index 6f3de51ef..dc109dd05 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -11,7 +11,11 @@ $english = array(
'photos' => "Photos",
'album' => "Photo Album",
'albums' => "Photo Albums",
+ 'tidypics:disabled' => 'Disabled',
+ 'tidypics:enabled' => 'Enabled',
'admin:settings:tidypics' => 'Tidypics',
+ 'admin:statistics:tidypics' => 'Tidypics',
+ 'admin:administer_utilities:tidypics_tools' => 'Tidypics Tools',
'photos:add' => "Create album",
'images:upload' => "Upload photos",
@@ -89,7 +93,60 @@ $english = array(
'tidypics:option:none' => 'None',
'tidypics:option:cover' => 'Cover',
'tidypics:option:set' => 'Set',
-
+
+ // server analysis
+ 'tidypics:server_info' => 'Server Information',
+ 'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded',
+ 'tidypics:server_info:exec_desc' => 'Required for ImageMagick command line',
+ 'tidypics:server_info:memory_limit_desc' => 'Change memory_limit to increase',
+ 'tidypics:server_info:peak_usage_desc' => 'This is approximately the minimum per page',
+ 'tidypics:server_info:upload_max_filesize_desc' => 'Max size of an uploaded image',
+ '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',
+ 'tidypics:server_info:upload_max_filesize' => 'Max File Upload Size',
+ 'tidypics:server_info:post_max_size' => 'Max Post Size',
+ 'tidypics:server_info:max_input_time' => 'Max Input Time',
+ 'tidypics:server_info:max_execution_time' => 'Max Execution Time',
+ 'tidypics:server_info:use_only_cookies' => 'Cookie only sessions',
+
+ 'tidypics:server_configuration_doc' => 'Server configuration documentation',
+
+ // library tools
+ 'tidypics:lib_tools' => 'Image library tools',
+ 'tidypics:lib_tools:overview' =>
+ 'An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.
+ There are three image library options with Tidypics: PHP extension <a href="http://www.php.net/manual/en/book.image.php">GD</a>,
+ <a href="http://www.imagemagick.org/">ImageMagick</a> called via a system call, and the PHP extension
+ <a href="http://pecl.php.net/package/imagick/">imagick</a>. GD is the most common of the three on hosted servers but suffers
+ from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the
+ PHP extension), we recommend that you use that.',
+ 'tidypics:lib_tools:testing' =>
+ 'To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can see the
+ configuration of your server on the "Server Information" tab.. Next, you need to determine the path to
+ ImageMagick on your server. Your hosting service should be able to provide this to you. You can test
+ if the location is correct below. If successful, it should display the version of ImageMagick installed
+ on your server.',
+
+ // thumbnail tool
+ 'tidypics:thumbnail_tool' => 'Thumbnail Creation',
+ 'tidypics:thumbnail_tool_blurb' =>
+ 'This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
+ You may experience problems with thumbnail creation if your image library is not configured properly or
+ if there is not enough memory for the GD library to load and resize an image. If your users have
+ experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the
+ thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
+ a photo) and enter it below.',
+ 'tidypics:thumbnail_tool:unknown_image' => 'Unable to get original image',
+ 'tidypics:thumbnail_tool:invalid_image_info' => 'Error retrieving information about the image',
+ 'tidypics:thumbnail_tool:create_failed' => 'Failed to create thumbnails',
+ 'tidypics:thumbnail_tool:created' => 'Created thumbnails.',
+
//actions
'album:create' => "Create new album",
'album:add' => "Add Photo Album",
diff --git a/pages/admin.php b/pages/admin.php
index 1a04ab279..c6be1212a 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -1,6 +1,7 @@
<?php
/**
* Tidypics Admin Page
+ * @todo deprecated
*/
admin_gatekeeper();
diff --git a/pages/server_analysis.php b/pages/server_analysis.php
deleted file mode 100644
index 7e4218b83..000000000
--- a/pages/server_analysis.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-/********************************************************************
- *
- * Tidypics System Analysis Script
- *
- * Helps admins configure their server
- *
- ********************************************************************/
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-global $CONFIG;
-
-admin_gatekeeper();
-
-set_context('admin');
-
-$title = 'TidyPics Server Analysis';
-
-
-function tp_readable_size($bytes) {
- if (strpos($bytes, 'M')) {
- return $bytes . 'B';
- }
-
- $size = $bytes / 1024;
- if ($size < 1024) {
- $size = number_format($size, 2);
- $size .= ' KB';
- } else {
- $size = $size / 1024;
- if ($size < 1024) {
- $size = number_format($size, 2);
- $size .= ' MB';
- } else {
- $size = $size / 1024;
- $size = number_format($size, 2);
- $size .= ' GB';
- }
- }
- return $size;
-}
-
-$disablefunc = explode(',', ini_get('disable_functions'));
-$exec_avail = "Disabled";
-if (is_callable('exec') && !in_array('exec',$disablefunc)) {
- $exec_avail = "Enabled";
-}
-
-ob_start();
-
-echo elgg_view_title($title);
-?>
-<div class="contentWrapper">
- <table width="100%">
- <tr>
- <td>PHP version</td>
- <td><?php echo phpversion(); ?></td>
- <td></td>
- </tr>
- <tr>
- <td>GD</td>
- <td><?php echo (extension_loaded('gd')) ? 'Enabled' : 'Disabled'; ?></td>
- <td>Elgg requires the GD extension to be loaded</td>
- </tr>
- <tr>
- <td>IMagick PHP extension</td>
- <td><?php echo (extension_loaded('imagick')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>exec()</td>
- <td><?php echo $exec_avail; ?></td>
- <td>Required for ImageMagick command line</td>
- </tr>
- <tr>
- <td>Memory Available to PHP</td>
- <td><?php echo tp_readable_size(ini_get('memory_limit')); ?></td>
- <td>Change memory_limit to increase</td>
- </tr>
- <tr>
- <td>Memory Used to Load This Page</td>
- <td><?php if (function_exists('memory_get_peak_usage')) echo tp_readable_size(memory_get_peak_usage()); ?></td>
- <td>This is approximately the minimum per page</td>
- </tr>
- <tr>
- <td>Max File Upload Size</td>
- <td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td>
- <td>Max size of an uploaded image</td>
- </tr>
- <tr>
- <td>Max Post Size</td>
- <td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td>
- <td>Max post size = sum of images + html form</td>
- </tr>
- <tr>
- <td>Max Input Time</td>
- <td><?php echo ini_get('max_input_time'); ?> s</td>
- <td>Time script waits for upload to finish</td>
- </tr>
- <tr>
- <td>Max Execution Time</td>
- <td><?php echo ini_get('max_execution_time'); ?> s</td>
- <td>Max time a script will run</td>
- </tr>
- <tr>
- <td>GD imagejpeg</td>
- <td><?php echo (is_callable('imagejpeg')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>GD imagepng</td>
- <td><?php echo (is_callable('imagepng')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>GD imagegif</td>
- <td><?php echo (is_callable('imagegif')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>EXIF</td>
- <td><?php echo (is_callable('exif_read_data')) ? 'Enabled' : 'Disabled'; ?></td>
- <td></td>
- </tr>
- <tr>
- <td>Cookie only sessions</td>
- <td><?php echo (ini_get('session.use_only_cookies')) ? 'Enabled' : 'Disabled'; ?></td>
- <td>Cookie only sessions may affect the Flash uploader</td>
- </tr>
- </table>
- <div style="margin-top:20px;">
- <a href="<?php echo $CONFIG->url . "mod/tidypics/docs/configure_server.txt"; ?>">Server configuration doc</a>
- </div>
-</div>
-<?php
-
-$content = ob_get_clean();
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $content);
-
-echo page_draw($title, $body); \ No newline at end of file
diff --git a/start.php b/start.php
index f1fdf8434..ad540bc8f 100644
--- a/start.php
+++ b/start.php
@@ -105,6 +105,7 @@ function tidypics_init() {
//register_action("tidypics/deletetag", false, "$base_dir/deletetag.php");
elgg_register_action("photos/admin/settings", "$base_dir/admin/settings.php", 'admin');
+ elgg_register_action("photos/admin/create_thumbnails", "$base_dir/admin/create_thumbnails.php", 'admin');
elgg_register_action("photos/admin/upgrade", "$base_dir/admin/upgrade.php", 'admin');
// Register libraries
diff --git a/views/default/admin/settings/tidypics.php b/views/default/admin/settings/tidypics.php
index 2e7d79942..cc9875c3b 100644
--- a/views/default/admin/settings/tidypics.php
+++ b/views/default/admin/settings/tidypics.php
@@ -6,18 +6,57 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
-if (tidypics_is_upgrade_available()) {
- echo '<div class="elgg-admin-notices">';
- echo '<p>';
- echo elgg_view('output/url', array(
- 'text' => elgg_echo('tidypics:upgrade'),
- 'href' => 'action/photos/admin/upgrade',
- 'is_action' => true,
- ));
- echo '</p>';
- echo '</div>';
-}
+$tab = get_input('tab', 'settings');
-echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
+echo elgg_view('navigation/tabs', array(
+ 'tabs' => array(
+ array(
+ 'text' => elgg_echo('settings'),
+ 'href' => '/admin/settings/tidypics',
+ 'selected' => ($tab == 'settings'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:server_info'),
+ 'href' => '/admin/settings/tidypics?tab=server_info',
+ 'selected' => ($tab == 'server_info'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:image_lib'),
+ 'href' => '/admin/settings/tidypics?tab=image_lib',
+ 'selected' => ($tab == 'image_lib'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:thumbnail'),
+ 'href' => '/admin/settings/tidypics?tab=thumbnail',
+ 'selected' => ($tab == 'thumbnail'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:help'),
+ 'href' => '/admin/settings/tidypics?tab=help',
+ 'selected' => ($tab == 'help'),
+ ),
+ )
+));
-echo elgg_view_form('photos/admin/settings');
+switch ($tab) {
+ case 'server_info':
+ echo elgg_view('admin/settings/tidypics/server_info');
+ break;
+
+ case 'image_lib':
+ echo elgg_view('admin/settings/tidypics/image_lib');
+ break;
+
+ case 'thumbnail':
+ echo elgg_view('admin/settings/tidypics/thumbnail');
+ break;
+
+ case 'help':
+ echo elgg_view('admin/settings/tidypics/help');
+ break;
+
+ default:
+ case 'settings':
+ echo elgg_view('admin/settings/tidypics/settings');
+ break;
+} \ No newline at end of file
diff --git a/views/default/tidypics/admin/help.php b/views/default/admin/settings/tidypics/help.php
index b939a74a8..bf08de284 100644
--- a/views/default/tidypics/admin/help.php
+++ b/views/default/admin/settings/tidypics/help.php
@@ -1,5 +1,13 @@
-<br />
-<h3>White screen when uploading images</h3>
+<?php
+/**
+ * Tidypics Help
+ *
+ * @todo This would be hard to localize cleanly.
+ */
+
+$title = 'White screen when uploading images';
+
+$body = <<<HTML
<p>
Tidypics tries to calculate the maximum size of an image that your server will support. If it
guesses incorrectly and someone uploads a photo that is too large, the script may crash when
@@ -7,26 +15,43 @@ resizing the image if you are using GD. The easiest way to test this is to set d
to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
should display on the screen. You can increased your php memory limit (see the docs directory).
A better option is to use ImageMagick if your server supports it (again see the docs directory).
-</p><p>
+</p>
+<p>
If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
-change display_error back to 0.
+change display_error back to 0.
</p>
-<h3>Question mark images appear</h3>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+$title = 'Question mark images appear';
+$body =<<<HTML
<p>
If you see question mark images when you look at your albums, this means the resizing of the images
failed. This could be due to the memory limits as described above. There are other causes. Tidypics
tries to detect these problems and write the cause to the error log. You should check your server
error log right after an upload that results in a question mark for these error messages. The messages
-will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
+will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
not see these warnings.
-</p><p>
+</p>
+<p>
Another possible cause is using ImageMagick when your server does not support it or specifying
the wrong path to the ImageMagick executables.
</p>
-<h3>Unable to save settings</h3>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+
+$title = 'Unable to save settings';
+$body =<<<HTML
<p>If you are unable to settings, there are two possible causes. First,
Apache can be configured to block pages that use file paths as Tidypics
does when setting the location of the ImageMagick executable. In this case,
leave that field blank. Second, there is some bad code in the Izaps video
plugin that can prevent the settings from being saved. Try disabling that plugin.
-</p> \ No newline at end of file
+</p>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
diff --git a/views/default/admin/settings/tidypics/image_lib.php b/views/default/admin/settings/tidypics/image_lib.php
new file mode 100644
index 000000000..44a7eb847
--- /dev/null
+++ b/views/default/admin/settings/tidypics/image_lib.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Tidypics image library tools
+ */
+
+$content = '<p>' . elgg_echo('tidypics:lib_tools:overview') . '</p>';
+$content .= '<p>' . elgg_echo('tidypics:lib_tools:testing') . '</p>';
+$content .= '<p><label>' . elgg_echo('tidypics:settings:im_path');
+$content .= elgg_view('input/text', array(
+ 'name' => 'im_location'
+));
+$content .= elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'tidypics-im-test'
+));
+$content .= '</p>';
+$content .= '<p id="tidypics-im-results"></p>';
+
+echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content);
+
+?>
+<script type="text/javascript">
+ $(function() {
+ $('#tidypics-im-test').click(function() {
+ var loc = $('input[name=im_location]').val();
+ $("#tidypics-im-results").html("");
+ $.ajax({
+ type: "GET",
+ url: elgg.normalize_url('mod/tidypics/actions/photos/admin/imtest.php'),
+ data: {location: loc},
+ cache: false,
+ success: function(html){
+ $("#tidypics-im-results").html(html);
+ }
+ });
+ });
+ });
+</script>
diff --git a/views/default/admin/settings/tidypics/server_info.php b/views/default/admin/settings/tidypics/server_info.php
new file mode 100644
index 000000000..96ccc555f
--- /dev/null
+++ b/views/default/admin/settings/tidypics/server_info.php
@@ -0,0 +1,130 @@
+<?php
+/**
+ * Tidypics server analysis
+ */
+
+$title = elgg_echo('admin:administer_utilities:tidypics_tools');
+
+function tp_readable_size($bytes) {
+ if (strpos($bytes, 'M')) {
+ return $bytes . 'B';
+ }
+
+ $size = $bytes / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' KB';
+ } else {
+ $size = $size / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' MB';
+ } else {
+ $size = $size / 1024;
+ $size = number_format($size, 2);
+ $size .= ' GB';
+ }
+ }
+ return $size;
+}
+
+$disablefunc = explode(',', ini_get('disable_functions'));
+$exec_avail = elgg_echo('tidypics:disabled');
+if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+ $exec_avail = elgg_echo('tidypics:enabled');
+}
+
+ob_start();
+
+?>
+<table class="elgg-table-alt">
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:php_version'); ?></td>
+ <td><?php echo phpversion(); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD</td>
+ <td><?php echo (extension_loaded('gd')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:gd_desc'); ?></td>
+ </tr>
+ <tr>
+ <td>IMagick</td>
+ <td><?php echo (extension_loaded('imagick')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>exec()</td>
+ <td><?php echo $exec_avail; ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:exec_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:memory_limit'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('memory_limit')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:memory_limit_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:peak_usage'); ?></td>
+ <td><?php if (function_exists('memory_get_peak_usage')) echo tp_readable_size(memory_get_peak_usage()); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:peak_usage_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:post_max_size'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:post_max_size_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:max_input_time'); ?></td>
+ <td><?php echo ini_get('max_input_time'); ?>s</td>
+ <td><?php echo elgg_echo('tidypics:server_info:max_input_time_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:max_execution_time'); ?></td>
+ <td><?php echo ini_get('max_execution_time'); ?> s</td>
+ <td><?php echo elgg_echo('tidypics:server_info:max_execution_time_desc'); ?></td>
+ </tr>
+ <tr>
+ <td>GD imagejpeg</td>
+ <td><?php echo (is_callable('imagejpeg')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD imagepng</td>
+ <td><?php echo (is_callable('imagepng')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD imagegif</td>
+ <td><?php echo (is_callable('imagegif')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>EXIF</td>
+ <td><?php echo (is_callable('exif_read_data')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies'); ?></td>
+ <td><?php echo (ini_get('session.use_only_cookies')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies_desc'); ?></td>
+ </tr>
+</table>
+
+<p class="ptl">
+ <?php
+ echo elgg_view('output/url', array(
+ 'href' => '/mod/tidypics/docs/configure_server.txt',
+ 'text' => elgg_echo('tidypics:server_configuration_doc')
+ ));
+ ?>
+</p>
+<?php
+
+$content = ob_get_clean();
+
+echo elgg_view_module('inline', elgg_echo('tidypics:server_info'), $content); \ No newline at end of file
diff --git a/views/default/admin/settings/tidypics/settings.php b/views/default/admin/settings/tidypics/settings.php
new file mode 100644
index 000000000..3645e749a
--- /dev/null
+++ b/views/default/admin/settings/tidypics/settings.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Tidypics main settings
+ */
+
+if (tidypics_is_upgrade_available()) {
+ echo '<div class="elgg-admin-notices">';
+ echo '<p>';
+ echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:upgrade'),
+ 'href' => 'action/photos/admin/upgrade',
+ 'is_action' => true,
+ ));
+ echo '</p>';
+ echo '</div>';
+}
+
+echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
+
+echo elgg_view_form('photos/admin/settings'); \ No newline at end of file
diff --git a/views/default/admin/settings/tidypics/thumbnail.php b/views/default/admin/settings/tidypics/thumbnail.php
new file mode 100644
index 000000000..502b5739e
--- /dev/null
+++ b/views/default/admin/settings/tidypics/thumbnail.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Tidypics thumbnail creation tool
+ */
+
+$title = elgg_echo('tidypics:settings:thumbnail');
+$body = '<p>' . elgg_echo('tidypics:thumbnail_tool_blurb') . '</p>';
+$im_id = elgg_echo('tidypics:settings:im_id');
+$input = elgg_view('input/text', array(
+ 'name' => 'image_id'
+));
+$submit = elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'elgg-tidypics-im-test'
+));
+
+$body .=<<<HTML
+ <p>
+ <label>$im_id $input</label>
+ $submit
+ <div id="elgg-tidypics-im-results"></div>
+ </p>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+?>
+
+<script type="text/javascript">
+ $(function() {
+ $('#elgg-tidypics-im-test').click(function() {
+ var image_id = $('input[name=image_id]').val();
+ $("#elgg-tidypics-im-results").html('<div class="elgg-ajax-loader"></div>');
+ elgg.action('photos/admin/create_thumbnails', {
+ format: 'JSON',
+ data: {guid: image_id},
+ cache: false,
+ success: function(result) {
+ // error
+ if (result.status < 0) {
+ var html = '';
+ } else {
+ var html = '<img class="elgg-photo tidypics-photo" src="'
+ + result.output.thumbnail_src + '" alt="' + result.output.title
+ + '" />';
+ }
+ $("#elgg-tidypics-im-results").html(html);
+ }
+ });
+ });
+ });
+</script> \ No newline at end of file
diff --git a/views/default/tidypics/admin/imagelib.php b/views/default/tidypics/admin/imagelib.php
deleted file mode 100644
index 2b7a3a7b0..000000000
--- a/views/default/tidypics/admin/imagelib.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-$img_type = get_subtype_id('object', 'image');
-$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_images = $total->total;
-
-$img_type = get_subtype_id('object', 'album');
-$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_albums = $total->total;
-
-$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
-$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
-
-$num_views = count_annotations(0, 'object', 'image', 'tp_view');
-
-if (get_plugin_setting('tagging', 'tidypics') != "disabled")
- $num_tags = count_annotations(0, 'object', 'image', 'phototag');
-?>
-<br />
-<h3>Overview</h3>
-<p>
- An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.
- There are three image library options with Tidypics: PHP extension <a href="http://www.php.net/manual/en/book.image.php">GD</a>,
- <a href="http://www.imagemagick.org/">ImageMagick</a> called via a system call, and the PHP extension
- <a href="http://pecl.php.net/package/imagick/">imagick</a>. GD is the most common of the three on hosted servers but suffers
- from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the
- PHP extension), we recommend that you use that.
-</p>
-<h3>Testing ImageMagick Commandline</h3>
-<p>
- To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our
- <a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; ?>">server analysis page</a> to find out the
- configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should
- be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of
- ImageMagick installed on your server.
-</p>
-<br />
-<p>
- <?php echo elgg_echo('tidypics:settings:im_path'); ?><br />
- <input name="im_location" type="text" />
- <input type="submit" value="Submit" onclick="TestImageMagickLocation();" />
-</p>
-<div id="im_results"></div>
-
-<script type="text/javascript">
- function TestImageMagickLocation()
- {
- var loc = $('input[name=im_location]').val();
- $("#im_results").html("");
- $.ajax({
- type: "GET",
- url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/admin/imtest.php'; ?>",
- data: {location: loc},
- cache: false,
- success: function(html){
- $("#im_results").html(html);
- }
- });
- }
-</script> \ No newline at end of file
diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php
deleted file mode 100644
index e1d20f953..000000000
--- a/views/default/tidypics/admin/settings.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Tidypics admin settings tab
- */
-
-$form_body = elgg_view('forms/tidypics/admin/settings', $vars);
-
-$server_analysis_link = elgg_view('output/url', array(
- 'href' => "{$vars['url']}mod/tidypics/pages/server_analysis.php",
- 'text' => elgg_echo('tidypics:settings:server:analysis'),
-));
-
-echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
-
-echo '<p>';
-echo elgg_view('tidypics/admin/upgrade');
-echo $server_analysis_link;
-echo '</p>';
-
-echo elgg_view('input/form', array(
- 'body' => $form_body,
- 'action' => $vars['url'] . 'action/tidypics/admin/settings',
-));
diff --git a/views/default/tidypics/admin/stats.php b/views/default/tidypics/admin/stats.php
deleted file mode 100644
index 0b088dc2e..000000000
--- a/views/default/tidypics/admin/stats.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-$img_type = get_subtype_id('object', 'image');
-$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_images = $total->total;
-
-$img_type = get_subtype_id('object', 'album');
-$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_albums = $total->total;
-
-$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
-$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
-
-$num_views = count_annotations(0, 'object', 'image', 'tp_view');
-
-if (get_plugin_setting('tagging', 'tidypics') != "disabled") {
- $num_tags = count_annotations(0, 'object', 'image', 'phototag');
-}
-?>
-<p>
- <br />
- Photos: <?php echo $num_images; ?><br />
- Albums: <?php echo $num_albums; ?><br />
- Comments on photos: <?php echo $num_comments_photos; ?><br />
- Comments on albums: <?php echo $num_comments_albums; ?><br />
- Total views: <?php echo $num_views; ?><br />
-<?php
-if ($num_tags) {
-?>
- Photo tags: <?php echo $num_tags; ?><br />
-<?php
-}
-?>
-</p> \ No newline at end of file
diff --git a/views/default/tidypics/admin/thumbnails.php b/views/default/tidypics/admin/thumbnails.php
deleted file mode 100644
index 5884b9dc3..000000000
--- a/views/default/tidypics/admin/thumbnails.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<br />
-<h3>Overview</h3>
-<p>
-This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
-You may experience problems with thumbnail creation if your image library is not configured properly or
-if there is not enough memory for the GD library to load and resize an image. If your users have
-experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the
-thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
-a photo) and enter it below.
-</p>
-<h3>Thumbnail Creation</h3>
-<p>
-<b><?php echo elgg_echo('tidypics:settings:im_id'); ?></b>:
-<input name="image_id" type="text" />
-<input type="submit" value="Submit" onclick="TestThumbnailCreation();" />
-</p>
-<div id="im_results"></div>
-<script type="text/javascript">
-function TestThumbnailCreation()
-{
- var image_id = $('input[name=image_id]').val();
- $("#im_results").html("");
- $.ajax({
- type: "GET",
- url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/admin/create_thumbnails.php'; ?>",
- data: {guid: image_id},
- cache: false,
- success: function(html){
- $("#im_results").html(html);
- }
- });
-}
-</script> \ No newline at end of file
diff --git a/views/default/tidypics/admin/tidypics.php b/views/default/tidypics/admin/tidypics.php
deleted file mode 100644
index d3f188741..000000000
--- a/views/default/tidypics/admin/tidypics.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-global $CONFIG;
-
-$tab = $vars['tab'];
-
-$settingsselect = '';
-$statsselect = '';
-$imagelibselect = '';
-$thumbnailselect = '';
-$helpselect = '';
-switch($tab) {
- case 'settings':
- $settingsselect = 'class="selected"';
- break;
- case 'stats':
- $statsselect = 'class="selected"';
- break;
- case 'imagelib':
- $imagelibselect = 'class="selected"';
- break;
- case 'thumbnail':
- $thumbnailselect = 'class="selected"';
- break;
- case 'help':
- $helpselect = 'class="selected"';
- break;
-}
-
-?>
-<div class="contentWrapper">
- <div id="elgg_horizontal_tabbed_nav">
- <ul>
- <li <?php echo $settingsselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=settings'; ?>"><?php echo elgg_echo('tidypics:settings'); ?></a></li>
- <li <?php echo $statsselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=stats'; ?>"><?php echo elgg_echo('tidypics:stats'); ?></a></li>
- <li <?php echo $imagelibselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=imagelib'; ?>"><?php echo elgg_echo('tidypics:settings:image_lib'); ?></a></li>
- <li <?php echo $thumbnailselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=thumbnail'; ?>"><?php echo elgg_echo('tidypics:settings:thumbnail'); ?></a></li>
- <li <?php echo $helpselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=help'; ?>"><?php echo elgg_echo('tidypics:settings:help'); ?></a></li>
- </ul>
- </div>
- <?php
- switch($tab) {
- case 'settings':
- echo elgg_view("tidypics/admin/settings");
- break;
- case 'stats':
- echo elgg_view("tidypics/admin/stats");
- break;
- case 'imagelib':
- echo elgg_view("tidypics/admin/imagelib");
- break;
- case 'thumbnail':
- echo elgg_view("tidypics/admin/thumbnails");
- break;
- case 'help':
- echo elgg_view("tidypics/admin/help");
- break;
- }
- ?>
-</div>
diff --git a/views/default/tidypics/admin/upgrade.php b/views/default/tidypics/admin/upgrade.php
deleted file mode 100644
index bb0a12467..000000000
--- a/views/default/tidypics/admin/upgrade.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-// sets $version based on code
-require_once "{$CONFIG->pluginspath}tidypics/version.php";
-
-$upgrade_url = "{$vars['url']}action/tidypics/admin/upgrade";
-
-// determine whether an upgrade is required
-$local_version = get_plugin_setting('version', 'tidypics');
-if ($local_version === FALSE) {
- // no version set so either new install or really old one
- if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album')) {
- $local_version = 0;
- } else {
- // set initial version for new install
- set_plugin_setting('version', $version, 'tidypics');
- $local_version = $version;
- }
-} elseif ($local_version == '1.62') {
- // special work around to handle old upgrade system
- $local_version = 2010010101;
- set_plugin_setting('version', $local_version, 'tidypics');
-}
-if ($local_version == $version) {
- // no upgrade required
- return TRUE;
-}
-
-echo elgg_view('output/url', array(
- 'text' => elgg_echo('tidypics:upgrade'),
- 'href' => $upgrade_url,
- 'is_action' => TRUE)
-);
-
-echo '<br />';