diff options
-rw-r--r-- | languages/en.php | 27 | ||||
-rw-r--r-- | pages/admin.php | 1 | ||||
-rw-r--r-- | pages/server_analysis.php | 143 | ||||
-rw-r--r-- | start.php | 1 | ||||
-rw-r--r-- | views/default/admin/administer_utilities/tidypics_server_info.php | 130 | ||||
-rw-r--r-- | views/default/admin/statistics/tidypics.php | 6 | ||||
-rw-r--r-- | views/default/tidypics/admin/settings.php | 2 | ||||
-rw-r--r-- | views/default/tidypics/admin/tidypics.php | 3 |
8 files changed, 169 insertions, 144 deletions
diff --git a/languages/en.php b/languages/en.php index 54cf2f258..4e56c0074 100644 --- a/languages/en.php +++ b/languages/en.php @@ -11,8 +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_server_info' => 'Tidypics Server Analysis', 'photos:add' => "Create album", 'images:upload' => "Upload photos", @@ -98,7 +101,29 @@ $english = array( 'tidypics:stats:album_comments' => 'Total comments on albums', 'tidypics:stats:views' => 'Total views', 'tidypics:stats:tags' => 'Total tags', - + + // server analysis + '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', + //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 @@ -51,6 +51,7 @@ function tidypics_init() { // Add admin menu items elgg_register_admin_menu_item('configure', 'tidypics', 'settings'); elgg_register_admin_menu_item('administer', 'tidypics', 'statistics'); + elgg_register_admin_menu_item('administer', 'tidypics_server_info', 'administer_utilities'); // Register for search elgg_register_entity_type('object', 'image'); diff --git a/views/default/admin/administer_utilities/tidypics_server_info.php b/views/default/admin/administer_utilities/tidypics_server_info.php new file mode 100644 index 000000000..6a034a561 --- /dev/null +++ b/views/default/admin/administer_utilities/tidypics_server_info.php @@ -0,0 +1,130 @@ +<?php +/** + * Tidypics server analysis + */ + +$title = elgg_echo('admin:administer_utilities:tidypics_server_info'); + +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('admin:administer_utilities:tidypics_server_info'), $content); diff --git a/views/default/admin/statistics/tidypics.php b/views/default/admin/statistics/tidypics.php index 3e4af782a..25ace77da 100644 --- a/views/default/admin/statistics/tidypics.php +++ b/views/default/admin/statistics/tidypics.php @@ -5,12 +5,14 @@ $stats = array(); +// number of images $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; $stats['images'] = $total->total; +// number of albums $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); @@ -24,15 +26,19 @@ $options = array( 'annotation_name' => 'generic_comment' ); +// number of comments on photos $stats['photo_comments'] = elgg_get_annotations($options); +// number of comments on albums $options['subtype'] = 'album'; $stats['album_comments'] = elgg_get_annotations($options); +// number of views on images $options['subtype'] = 'image'; $options['annotation_name'] = 'tp_view'; $stats['views'] = elgg_get_annotations($options); +// number of photo tags on images if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { $options['annotation_name'] = 'phototag'; $stats['tags'] = elgg_get_annotations($options); diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php index e1d20f953..aff6acc8d 100644 --- a/views/default/tidypics/admin/settings.php +++ b/views/default/tidypics/admin/settings.php @@ -1,6 +1,8 @@ <?php /** * Tidypics admin settings tab + * + * @todo deprecated */ $form_body = elgg_view('forms/tidypics/admin/settings', $vars); diff --git a/views/default/tidypics/admin/tidypics.php b/views/default/tidypics/admin/tidypics.php index d3f188741..479eb86e2 100644 --- a/views/default/tidypics/admin/tidypics.php +++ b/views/default/tidypics/admin/tidypics.php @@ -1,4 +1,7 @@ <?php +/** + * @todo deprecated + */ global $CONFIG; |