plugins/admin/Home.php
author Dan
Mon, 04 May 2009 23:05:52 -0400
changeset 950 36289dcb5c8a
parent 916 05c341ea7545
child 951 745cccc6b97d
permissions -rw-r--r--
Security log: fixed typo in plugin enable/disable display
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     1
<?php
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     2
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     3
/*
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     5
 * Version 1.1.6 (Caoineag beta 1)
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     6
 * Copyright (C) 2006-2008 Dan Fuhry
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     7
 *
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    10
 *
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    13
 */
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    14
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    15
function page_Admin_Home()
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    16
{
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    17
  global $db, $session, $paths, $template, $plugins; // Common objects
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    18
  global $lang;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    19
  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    20
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    21
    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    22
    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    23
    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    24
    return;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    25
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    26
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    27
  if ( $paths->getParam(0) == 'updates.xml' )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    28
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    29
    return acphome_process_updates();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    30
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    31
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    32
  // Welcome
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    33
  echo '<h2>' . $lang->get('acphome_heading_main') . '</h2>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    34
  echo '<p>' . $lang->get('acphome_welcome_line1') . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    35
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    36
  // Stats
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    37
  acphome_show_stats();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    38
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    39
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    40
  // Alerts
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    41
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    42
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    43
  echo '<h3>' . $lang->get('acphome_heading_alerts') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    44
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    45
  // Demo mode
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    46
  if ( defined('ENANO_DEMO_MODE') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    47
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    48
    echo '<div class="acphome-box info">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    49
      echo '<h3>' . $lang->get('acphome_msg_demo_title') . '</h3>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    50
            <p>' . $lang->get('acphome_msg_demo_body', array('reset_url' => makeUrlNS('Special', 'DemoReset', false, true))) . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    51
    echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    52
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    53
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    54
  // Check for the installer scripts
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    55
  if( file_exists(ENANO_ROOT.'/install/install.php') && !defined('ENANO_DEMO_MODE') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    56
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    57
    echo '<div class="acphome-box warning">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    58
            <h3>' . $lang->get('acphome_msg_install_files_title') . '</h3>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    59
            <p>' . $lang->get('acphome_msg_install_files_body') . '</p>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    60
          </div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    61
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    62
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    63
  // Inactive users
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    64
  $q = $db->sql_query('SELECT time_id FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\';');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    65
  if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    66
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    67
    if ( $db->numrows() > 0 )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    68
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    69
      $n = $db->numrows();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    70
      $um_flags = 'href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'UserManager\'); return false;"';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    71
      if ( $n == 1 )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    72
        $s = $lang->get('acphome_msg_inactive_users_one', array('um_flags' => $um_flags));
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    73
      else
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    74
        $s = $lang->get('acphome_msg_inactive_users_plural', array('um_flags' => $um_flags));
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    75
      echo '<div class="acphome-box notice">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    76
              <h3>' . $lang->get('acphome_heading_inactive_users') . '</h3>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    77
              ' . $s . '
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    78
            </div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    79
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    80
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    81
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    82
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    83
  // Update checker
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    84
  echo '<div class="acphome-box info">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    85
    echo '<h3>' . $lang->get('acphome_heading_updates') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    86
    echo '<p>' . $lang->get('acphome_msg_updates_info', array('updates_url' => 'http://ktulu.enanocms.org/meta/updates.xml')) . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    87
    echo '<div id="update_check_container"><input type="button" onclick="ajaxUpdateCheck(this.parentNode.id);" value="' . $lang->get('acphome_btn_check_updates') . '" /></div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    88
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    89
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    90
  // Docs
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    91
  echo '<div class="acphome-box info halfwidth">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    92
  echo '<h3>' . $lang->get('acphome_heading_docs') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    93
  echo '<p>' . $lang->get('acphome_msg_docs_info') . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    94
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    95
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    96
  // Support
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    97
  echo '<div class="acphome-box info halfwidth">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    98
  echo '<h3>' . $lang->get('acphome_heading_support') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    99
  echo '<p>' . $lang->get('acphome_msg_support_info') . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   100
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   101
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   102
  echo '<span class="menuclear"></span>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   103
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   104
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   105
  // Stats
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   106
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   107
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   108
  if(getConfig('log_hits') == '1')
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   109
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   110
    require_once(ENANO_ROOT . '/includes/stats.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   111
    $stats = stats_top_pages(10);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   112
    //die('<pre>'.print_r($stats,true).'</pre>');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   113
    $c = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   114
    $cls = 'row2';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   115
    echo '<h3>' . $lang->get('acphome_heading_top_pages') . '</h3>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   116
          <div class="tblholder">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   117
            <table style="width: 100%;" border="0" cellspacing="1" cellpadding="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   118
              <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   119
                <th>' . $lang->get('acphome_th_toppages_page') . '</th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   120
                <th>' . $lang->get('acphome_th_toppages_hits') . '</th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   121
              </tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   122
    foreach($stats as $data)
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   123
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   124
      echo   '<tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   125
      $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   126
      echo     '<td class="'.$cls.'">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   127
                  <a href="'.makeUrl($data['page_urlname']).'">'.$data['page_title'].'</a></td><td style="text-align: center;" class="'.$cls.'">'.$data['num_hits']
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   128
             . '</td>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   129
      echo   '</tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   130
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   131
    echo '  </table>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   132
          </div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   133
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   134
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   135
  // Any hooks?
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   136
  $code = $plugins->setHook('acp_home');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   137
  foreach ( $code as $cmd )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   138
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   139
    eval($cmd);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   140
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   141
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   142
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   143
  // Security log
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   144
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   145
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   146
  echo '<h3>' . $lang->get('acphome_heading_seclog') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   147
  echo '<p>' . $lang->get('acphome_msg_seclog_info') . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   148
  $seclog = get_security_log(5);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   149
  echo $seclog;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   150
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   151
  echo '<p><a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'SecurityLog\'); return false;">' . $lang->get('acphome_btn_seclog_full') . '</a></p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   152
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   153
}
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   154
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   155
function acphome_process_updates()
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   156
{
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   157
  require_once(ENANO_ROOT . '/includes/http.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   158
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   159
  $req = new Request_HTTP('ktulu.enanocms.org', '/meta/updates.xml');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   160
  $response = $req->get_response_body();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   161
  header('Content-type: application/xml');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   162
  if ( $req->response_code != HTTP_OK )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   163
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   164
    // Error in response
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   165
    echo '<enano><latest><error><![CDATA[
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   166
Did not properly receive response from server. Response code: ' . $req->response_code . ' ' . $req->response_string . '
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   167
]]></error></latest></enano>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   168
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   169
  else
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   170
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   171
    // Retrieve first update
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   172
    $first_update = preg_match('/<release tag="([^"]+)" version="([^"]+)" (codename="([^"]+)" )?relnotes="([^"]+)" ?\/>/', $response, $match);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   173
    if ( !$first_update )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   174
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   175
      echo '<enano><latest><error><![CDATA[
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   176
Received invalid XML response.
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   177
]]></error></latest></enano>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   178
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   179
    else
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   180
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   181
      if ( version_compare(enano_version(true), $match[2], '<') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   182
      {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   183
        $response = str_replace_once('</latest>', "  <haveupdates />\n  </latest>", $response);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   184
      }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   185
      echo $response;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   186
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   187
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   188
  return true;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   189
}
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   190
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   191
function acphome_show_stats()
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   192
{
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   193
  global $db, $session, $paths, $template, $plugins; // Common objects
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   194
  global $lang;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   195
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   196
  // Page count
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   197
  $q = $db->sql_query('SELECT COUNT(*) FROM ' . table_prefix . "pages");
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   198
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   199
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   200
  list($page_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   201
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   202
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   203
  // Edits per day
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   204
  $q = $db->sql_query('SELECT ( COUNT(*) - 1 ) AS edit_count, MIN(time_id) AS install_date FROM ' . table_prefix . 'logs WHERE ( log_type = \'page\' AND action = \'edit\' ) OR ( log_type = \'security\' AND action = \'install_enano\' );');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   205
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   206
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   207
  $edit_info = $db->fetchrow();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   208
  $install_date =& $edit_info['install_date'];
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   209
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   210
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   211
  $days_installed = round( (time() / 86400) - ($install_date / 86400) );
916
05c341ea7545 Fixed division by zero on first day installed.
Dan
parents: 915
diff changeset
   212
  if ( $days_installed < 1 )
05c341ea7545 Fixed division by zero on first day installed.
Dan
parents: 915
diff changeset
   213
    $days_installed = 1;
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   214
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   215
  // Comments
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   216
  $q = $db->sql_query('SELECT COUNT(*) FROM ' . table_prefix . "comments");
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   217
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   218
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   219
  list($comment_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   220
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   221
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   222
  // Users
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   223
  $q = $db->sql_query('SELECT ( COUNT(*) - 1 ) FROM ' . table_prefix . "users");
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   224
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   225
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   226
  list($user_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   227
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   228
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   229
  // Cache size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   230
  $cache_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   231
  if ( $dr = @opendir(ENANO_ROOT . '/cache/') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   232
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   233
    while ( $dh = @readdir($dr) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   234
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   235
      $file = ENANO_ROOT . "/cache/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   236
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   237
        $cache_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   238
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   239
    closedir($dr);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   240
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   241
  $cache_size = humanize_filesize($cache_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   242
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   243
  // Files directory size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   244
  $files_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   245
  if ( $dr = @opendir(ENANO_ROOT . '/files/') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   246
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   247
    while ( $dh = @readdir($dr) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   248
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   249
      $file = ENANO_ROOT . "/files/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   250
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   251
        $files_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   252
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   253
    closedir($dr);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   254
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   255
  $files_size = humanize_filesize($files_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   256
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   257
  // Avatar directory size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   258
  $avatar_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   259
  if ( $dr = @opendir(ENANO_ROOT . '/files/avatars/') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   260
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   261
    while ( $dh = @readdir($dr) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   262
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   263
      $file = ENANO_ROOT . "/files/avatars/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   264
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   265
        $avatar_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   266
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   267
    closedir($dr);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   268
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   269
  $avatar_size = humanize_filesize($avatar_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   270
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   271
  // Database size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   272
  $db_size = $lang->get('acphome_stat_dbsize_unsupported');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   273
  if ( ENANO_DBLAYER == 'MYSQL' )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   274
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   275
    $q = $db->sql_query('SHOW TABLE STATUS;');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   276
    if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   277
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   278
      $db_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   279
      while ( $row = $db->fetchrow() )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   280
      {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   281
        if ( preg_match('/^' . table_prefix . '/', $row['Name']) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   282
        {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   283
          $db_size += $row['Data_length'] + $row['Index_length'];
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   284
        }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   285
      }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   286
      $db_size = humanize_filesize($db_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   287
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   288
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   289
  else if ( ENANO_DBLAYER == 'PGSQL' )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   290
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   291
    require(ENANO_ROOT . '/config.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   292
    global $dbname, $dbuser, $dbpasswd;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   293
    $dbuser = false;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   294
    $dbpasswd = false;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   295
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   296
    $q = $db->sql_query('SELECT pg_database_size(\'' . $db->escape($dbname) . '\');');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   297
    if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   298
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   299
      list($db_size) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   300
      $db_size = humanize_filesize($db_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   301
      $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   302
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   303
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   304
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   305
  // Install date
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   306
  $install_date_human = MemberlistFormatter::format_date($install_date);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   307
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   308
  // Last upgrade
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   309
  $q = $db->sql_query('SELECT time_id FROM ' . table_prefix . "logs WHERE log_type = 'security' AND action = 'upgrade_enano' ORDER BY time_id DESC LIMIT 1;");
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   310
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   311
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   312
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   313
  if ( $db->numrows() < 1 )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   314
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   315
    $last_upgrade = $lang->get('acphome_stat_lastupdate_never');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   316
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   317
  else
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   318
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   319
    list($last_upgrade) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   320
    $last_upgrade = MemberlistFormatter::format_date($last_upgrade);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   321
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   322
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   323
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   324
  ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   325
  <div class="tblholder">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   326
  <table border="0" cellspacing="1" cellpadding="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   327
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   328
      <th colspan="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   329
        <?php echo $lang->get('acphome_stat_header'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   330
      </th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   331
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   332
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   333
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   334
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   335
        <?php echo $lang->get('acphome_stat_numpages'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   336
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   337
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   338
        <?php echo strval($page_count); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   339
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   340
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   341
        <?php echo $lang->get('acphome_stat_edits'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   342
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   343
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   344
        <?php echo $lang->get('acphome_stat_edits_data', array('edit_count' => $edit_info['edit_count'], 'per_day' => number_format($edit_info['edit_count'] / $days_installed, 2))); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   345
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   346
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   347
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   348
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   349
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   350
        <?php echo $lang->get('acphome_stat_comments'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   351
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   352
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   353
        <?php echo $lang->get('acphome_stat_comments_data', array('comment_count' => $comment_count, 'per_day' => number_format($comment_count / $days_installed, 2))); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   354
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   355
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   356
        <?php echo $lang->get('acphome_stat_users'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   357
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   358
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   359
        <?php echo strval($user_count); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   360
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   361
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   362
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   363
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   364
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   365
        <?php echo $lang->get('acphome_stat_filesize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   366
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   367
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   368
        <?php echo $files_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   369
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   370
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   371
        <?php echo $lang->get('acphome_stat_cachesize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   372
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   373
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   374
        <?php echo $cache_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   375
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   376
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   377
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   378
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   379
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   380
        <?php echo $lang->get('acphome_stat_avatarsize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   381
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   382
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   383
        <?php echo $avatar_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   384
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   385
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   386
        <?php echo $lang->get('acphome_stat_dbsize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   387
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   388
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   389
        <?php echo $db_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   390
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   391
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   392
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   393
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   394
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   395
        <?php echo $lang->get('acphome_stat_installdate'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   396
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   397
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   398
        <?php echo $install_date_human; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   399
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   400
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   401
        <?php echo $lang->get('acphome_stat_lastupdate'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   402
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   403
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   404
        <?php echo $last_upgrade; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   405
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   406
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   407
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   408
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   409
      <th colspan="4" class="subhead systemversion">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   410
        <?php echo $lang->get('acphome_stat_enano_version', array(
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   411
            'version' => enano_version(true),
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   412
            'releasename' => enano_codename(),
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   413
            'aboutlink' => makeUrlNS('Special', 'About_Enano')
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   414
          )); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   415
      </th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   416
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   417
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   418
  </table>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   419
  </div>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   420
  <?php
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   421
}