Huge script change, see http://forum.mxchange.org/topic-458.html for details:
[mailer.git] / inc / modules / admin / what-optimize.php
index bdcbe49127b4ed3f39f6c8aa270ac99a1aae125c..622a148e8969431ddbf9ff6ea39e08ec2060534f 100644 (file)
@@ -17,7 +17,7 @@
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  ************************************************************************/
 
 // Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
-       require($INC);
-}
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
 
 // Add description as navigation point
-ADD_DESCR('admin', __FILE__);
+addMenuDescription('admin', __FILE__);
 
 // Optimize and repair database and return the result as a multi-dimensional array
-$DATA = REPAIR_OPTIMIZE_DB();
+$DATA = repairOptimizeDatabase();
 
 // Output rows
 $SW = 2; $gain_tabs = 0; $OUT = '';
-foreach ($DATA['tables'] as $row_array)
-{
+foreach ($DATA['tables'] as $row_array) {
        // Init variables
        $B1 = ''; $B2 = '';
 
        // Fixes a bug which causes a parser error on eval'd code
-       if (empty($row_array[1])) $row_array[1] = "NONE";
+       if (empty($row_array[1])) $row_array[1] = 'NONE';
 
        // Get optimization status
-       $REP = getMessage('OPTIMIZE_STATUS_'.strtoupper($row_array[1]).'');
+       $REP = getMessage('OPTIMIZE_STATUS_' . strtoupper($row_array[1]).'');
 
-       $OPT = OPTIMIZE_STATUS_UNSUPPORTED;
+       $OPT = getMessage('OPTIMIZE_STATUS_UNSUPPORTED');
 
        if ($row_array[4] > 0) {
-               $OPT = OPTIMIZE_STATUS_OPTIMIZED;
-               $B1 = "<strong>"; $B2 = "<strong>";
+               $OPT = getMessage('OPTIMIZE_STATUS_OPTIMIZED');
+               $B1 = '<strong>'; $B2 = '<strong>';
                $gain_tabs++;
-       } elseif (count(explode(" ", $row_array[2])) == 0) {
-               $OPT = getMessage('OPTIMIZE_STATUS_'.strtoupper($row_array[2]).'');
+       } elseif (count(explode(' ', $row_array[2])) == 0) {
+               $OPT = getMessage('OPTIMIZE_STATUS_' . strtoupper($row_array[2]).'');
        }
 
        // Prepare data for the row template
@@ -84,21 +82,23 @@ foreach ($DATA['tables'] as $row_array)
        );
 
        // Load row template and switch color
-       $OUT .= LOAD_TEMPLATE("admin_optimize_row", true, $content);
+       $OUT .= loadTemplate('admin_optimize_row', true, $content);
        $SW = 3 - $SW;
-}
-define('__ROWS', $OUT);
+} // END - foreach
+
+// Remember rows
+$content['rows'] = $OUT;
 
 // Prepare data for the template
-define('__TOTAL_TABS'     , $DATA['total_tabs']);
-define('__TOTAL_SIZE'     , translateComma($DATA['total_size']));
-define('__TOTAL_CALLS'    , $DATA['total_rows']);
-define('__TOTAL_OPTIMIZED', translateComma($DATA['total_opti']));
-define('__NOW_OPTIMIZED'  , $gain_tabs);
-define('__NOW_SAVED'      , translateComma($DATA['total_gain']));
+$content['total_tabs']      = $DATA['total_tabs'];
+$content['total_size']      = translateComma($DATA['total_size']);
+$content['total_rows']      = $DATA['total_rows'];
+$content['total_optimized'] = translateComma($DATA['total_opti']);
+$content['now_optimized']   = $gain_tabs;
+$content['now_saved']       = translateComma($DATA['total_gain']);
 
 // Load main template
-LOAD_TEMPLATE("admin_optimize");
+loadTemplate('admin_optimize', false, $content);
 
-//
+// [EOF]
 ?>