C_NGG_Admin_Overview

The NextGEN Gallery C NGG Admin Overview class.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/ngglegacy/admin/overview.php  
  1. class C_NGG_Admin_Overview 
  2.  
  3. /** 
  4. * Shows important server configuration details.  
  5. * @author GamerZ (http://www.lesterchan.net) 
  6. * @return void 
  7. */ 
  8.  
  9. public function server_info() 
  10. global $wpdb, $ngg; 
  11.  
  12. // Get MYSQL Version 
  13. $sqlversion = $wpdb->get_var("SELECT VERSION() AS version"); 
  14.  
  15. // GET SQL Mode 
  16. $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'"); 
  17. if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value; 
  18. if (empty($sql_mode)) $sql_mode = __('Not set', 'nggallery'); 
  19.  
  20. // Get PHP Safe Mode 
  21. if(ini_get('safe_mode')) $safe_mode = __('On', 'nggallery'); 
  22. else $safe_mode = __('Off', 'nggallery'); 
  23.  
  24. // Get PHP allow_url_fopen 
  25. if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'nggallery'); 
  26. else $allow_url_fopen = __('Off', 'nggallery'); 
  27.  
  28. // Get PHP Max Upload Size 
  29. if (function_exists('wp_max_upload_size')) $upload_max = strval(round((int) wp_max_upload_size() / (1024 * 1024))) . 'M'; 
  30. else if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize'); 
  31. else $upload_max = __('N/A', 'nggallery'); 
  32.  
  33. // Get PHP Output buffer Size 
  34. if(ini_get('pcre.backtrack_limit')) $backtrack_limit = ini_get('pcre.backtrack_limit'); 
  35. else $backtrack_limit = __('N/A', 'nggallery'); 
  36.  
  37. // Get PHP Max Post Size 
  38. if(ini_get('post_max_size')) $post_max = ini_get('post_max_size'); 
  39. else $post_max = __('N/A', 'nggallery'); 
  40.  
  41. // Get PHP Max execution time 
  42. if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time'); 
  43. else $max_execute = __('N/A', 'nggallery'); 
  44.  
  45. // Get PHP Memory Limit 
  46. if(ini_get('memory_limit')) $memory_limit = $ngg->memory_limit; 
  47. else $memory_limit = __('N/A', 'nggallery'); 
  48.  
  49. // Get actual memory_get_usage 
  50. if (function_exists('memory_get_usage')) $memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'nggallery'); 
  51. else $memory_usage = __('N/A', 'nggallery'); 
  52.  
  53. // required for EXIF read 
  54. if (is_callable('exif_read_data')) $exif = __('Yes', 'nggallery'). " (V" . substr(phpversion('exif'), 0, 4) . ")" ; 
  55. else $exif = __('No', 'nggallery'); 
  56.  
  57. // required for meta data 
  58. if (is_callable('iptcparse')) $iptc = __('Yes', 'nggallery'); 
  59. else $iptc = __('No', 'nggallery'); 
  60.  
  61. // required for meta data 
  62. if (is_callable('xml_parser_create')) $xml = __('Yes', 'nggallery'); 
  63. else $xml = __('No', 'nggallery'); 
  64.  
  65. ?> 
  66. <li><?php _e('Operating System', 'nggallery'); ?> : <span><?php echo PHP_OS; ?> (<?php echo (PHP_INT_SIZE * 8) ?> Bit)</span></li> 
  67. <li><?php _e('Server', 'nggallery'); ?> : <span><?php echo $_SERVER["SERVER_SOFTWARE"]; ?></span></li> 
  68. <li><?php _e('Memory usage', 'nggallery'); ?> : <span><?php echo $memory_usage; ?></span></li> 
  69. <li><?php _e('MYSQL Version', 'nggallery'); ?> : <span><?php echo $sqlversion; ?></span></li> 
  70. <li><?php _e('SQL Mode', 'nggallery'); ?> : <span><?php echo $sql_mode; ?></span></li> 
  71. <li><?php _e('PHP Version', 'nggallery'); ?> : <span><?php echo PHP_VERSION; ?></span></li> 
  72. <li><?php _e('PHP Safe Mode', 'nggallery'); ?> : <span><?php echo $safe_mode; ?></span></li> 
  73. <li><?php _e('PHP Allow URL fopen', 'nggallery'); ?> : <span><?php echo $allow_url_fopen; ?></span></li> 
  74. <li><?php _e('PHP Memory Limit', 'nggallery'); ?> : <span><?php echo $memory_limit; ?></span></li> 
  75. <li><?php _e('PHP Max Upload Size', 'nggallery'); ?> : <span><?php echo $upload_max; ?></span></li> 
  76. <li><?php _e('PHP Max Post Size', 'nggallery'); ?> : <span><?php echo $post_max; ?></span></li> 
  77. <li><?php _e('PCRE Backtracking Limit', 'nggallery'); ?> : <span><?php echo $backtrack_limit; ?></span></li> 
  78. <li><?php _e('PHP Max Script Execute Time', 'nggallery'); ?> : <span><?php echo $max_execute; ?>s</span></li> 
  79. <li><?php _e('PHP Exif support', 'nggallery'); ?> : <span><?php echo $exif; ?></span></li> 
  80. <li><?php _e('PHP IPTC support', 'nggallery'); ?> : <span><?php echo $iptc; ?></span></li> 
  81. <li><?php _e('PHP XML support', 'nggallery'); ?> : <span><?php echo $xml; ?></span></li> 
  82. <?php 
  83.  
  84. /** 
  85. * Show GD Library version information 
  86. * @return void 
  87. */ 
  88. function gd_info() 
  89. if (function_exists("gd_info")) 
  90. $info = gd_info(); 
  91. $keys = array_keys($info); 
  92. for ($i = 0; $i < count($keys); $i++) { 
  93. if (is_bool($info[$keys[$i]])) 
  94. echo "<li> " . $keys[$i] . " : <span>" . ($info[$keys[$i]] ? __('Yes', 'nggallery') : __('No', 'nggallery')) . "</span></li>\n"; 
  95. else 
  96. echo "<li> " . $keys[$i] . " : <span>" . $info[$keys[$i]] . "</span></li>\n"; 
  97. else { 
  98. echo '<h4>'.__('No GD support', 'nggallery').'!</h4>'; 
  99.  
  100. // Display File upload quota on dashboard 
  101. function dashboard_quota() 
  102. if (get_site_option('upload_space_check_disabled')) 
  103. return; 
  104.  
  105. if (!wpmu_enable_function('wpmuQuotaCheck')) 
  106. return; 
  107.  
  108. $settings = C_NextGen_Settings::get_instance(); 
  109. $fs = C_Fs::get_instance(); 
  110. $dir = $fs->join_paths($fs->get_document_root('content'), $settings->gallerypath); 
  111.  
  112. $quota = get_space_allowed(); 
  113. $used = get_dirsize($dir) / 1024 / 1024; 
  114.  
  115. if ($used > $quota) 
  116. $percentused = '100'; 
  117. else 
  118. $percentused = ($used / $quota) * 100; 
  119.  
  120. $used_color = ($percentused < 70) ? (($percentused >= 40) ? 'yellow' : 'green') : 'red'; 
  121. $used = round($used, 2); 
  122. $percentused = number_format($percentused); 
  123.  
  124. ?> 
  125. <p><?php print __('Storage Space'); ?></p> 
  126. <ul> 
  127. <li><?php printf(__('%1$sMB Allowed', 'nggallery'), $quota); ?></li> 
  128. <li class="<?php print $used_color; ?>"><?php printf(__('%1$sMB (%2$s%%) Used', 'nggallery'), $used, $percentused); ?></li> 
  129. </ul> 
  130. <?php 
  131.