plugins/admin/Home.php
author Dan
Thu, 17 Dec 2009 04:31:55 -0500
changeset 1170 71cb87b7dc3f
parent 1140 d90e55caba3a
child 1215 ec7f8f6312bb
permissions -rw-r--r--
ACP: Added lockout management feature
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
1081
745200a9cc2a Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
parents: 951
diff changeset
     5
 * Copyright (C) 2006-2009 Dan Fuhry
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     6
 *
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
     7
 * 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
     8
 * 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
     9
 *
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    10
 * 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
    11
 * 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
    12
 */
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
function page_Admin_Home()
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    15
{
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    16
  global $db, $session, $paths, $template, $plugins; // Common objects
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    17
  global $lang;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    18
  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
    19
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    20
    $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
    21
    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
    22
    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
    23
    return;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    24
  }
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
  if ( $paths->getParam(0) == 'updates.xml' )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    27
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    28
    return acphome_process_updates();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    29
  }
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
  // Welcome
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    32
  echo '<h2>' . $lang->get('acphome_heading_main') . '</h2>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    33
  echo '<p>' . $lang->get('acphome_welcome_line1') . '</p>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    34
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    35
  // Stats
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    36
  acphome_show_stats();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    37
  
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
  // Alerts
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    40
  //
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
  echo '<h3>' . $lang->get('acphome_heading_alerts') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    43
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    44
  // Demo mode
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    45
  if ( defined('ENANO_DEMO_MODE') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    46
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    47
    echo '<div class="acphome-box info">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    48
      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
    49
            <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
    50
    echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    51
  }
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
  // Check for the installer scripts
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    54
  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
    55
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    56
    echo '<div class="acphome-box warning">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    57
            <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
    58
            <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
    59
          </div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    60
  }
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
  // Inactive users
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    63
  $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
    64
  if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    65
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    66
    if ( $db->numrows() > 0 )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    67
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    68
      $n = $db->numrows();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    69
      $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
    70
      if ( $n == 1 )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    71
        $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
    72
      else
1140
d90e55caba3a Admin Home: fixed undefined %num_users% in string acphome_msg_inactive_users_plural
Dan
parents: 1081
diff changeset
    73
        $s = $lang->get('acphome_msg_inactive_users_plural', array('um_flags' => $um_flags, 'num_users' => $n));
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    74
      echo '<div class="acphome-box notice">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    75
              <h3>' . $lang->get('acphome_heading_inactive_users') . '</h3>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    76
              ' . $s . '
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    77
            </div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    78
    }
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
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    81
  
1170
71cb87b7dc3f ACP: Added lockout management feature
Dan
parents: 1140
diff changeset
    82
  acp_usermanager_lockouts(true);
71cb87b7dc3f ACP: Added lockout management feature
Dan
parents: 1140
diff changeset
    83
  
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    84
  // Update checker
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    85
  echo '<div class="acphome-box info">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    86
    echo '<h3>' . $lang->get('acphome_heading_updates') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    87
    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
    88
    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
    89
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    90
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    91
  // Docs
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    92
  echo '<div class="acphome-box info halfwidth">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    93
  echo '<h3>' . $lang->get('acphome_heading_docs') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    94
  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
    95
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    96
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    97
  // Support
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    98
  echo '<div class="acphome-box info halfwidth">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    99
  echo '<h3>' . $lang->get('acphome_heading_support') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   100
  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
   101
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   102
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   103
  echo '<span class="menuclear"></span>';
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
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   106
  // Stats
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
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   109
  if(getConfig('log_hits') == '1')
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   110
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   111
    require_once(ENANO_ROOT . '/includes/stats.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   112
    $stats = stats_top_pages(10);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   113
    //die('<pre>'.print_r($stats,true).'</pre>');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   114
    $c = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   115
    $cls = 'row2';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   116
    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
   117
          <div class="tblholder">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   118
            <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
   119
              <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   120
                <th>' . $lang->get('acphome_th_toppages_page') . '</th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   121
                <th>' . $lang->get('acphome_th_toppages_hits') . '</th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   122
              </tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   123
    foreach($stats as $data)
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   124
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   125
      echo   '<tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   126
      $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   127
      echo     '<td class="'.$cls.'">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   128
                  <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
   129
             . '</td>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   130
      echo   '</tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   131
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   132
    echo '  </table>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   133
          </div>';
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
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   136
  // Any hooks?
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   137
  $code = $plugins->setHook('acp_home');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   138
  foreach ( $code as $cmd )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   139
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   140
    eval($cmd);
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
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   144
  // Security log
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
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   147
  echo '<h3>' . $lang->get('acphome_heading_seclog') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   148
  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
   149
  $seclog = get_security_log(5);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   150
  echo $seclog;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   151
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   152
  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
   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
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   156
function acphome_process_updates()
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   157
{
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   158
  require_once(ENANO_ROOT . '/includes/http.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   159
  
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   160
  try
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   161
  {
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   162
    $req = new Request_HTTP('ktulu.enanocms.org', '/meta/updates.xml');
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   163
    $response = $req->get_response_body();
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   164
    header('Content-type: application/xml');
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   165
  }
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   166
  catch ( Exception $e )
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   167
  {
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   168
    header('Content-type: application/xml');
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   169
    echo '<enano><error><![CDATA[
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   170
Cannot connect to server: ' . $e->getMessage() . '
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   171
]]></error></enano>';
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   172
    return true;
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   173
  }
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   174
  if ( $req->response_code != HTTP_OK )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   175
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   176
    // Error in response
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   177
    echo '<enano><error><![CDATA[
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   178
Did not properly receive response from server. Response code: ' . $req->response_code . ' ' . $req->response_string . '
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   179
]]></error></enano>';
915
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
  else
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
    // Retrieve first update
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   184
    $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
   185
    if ( !$first_update )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   186
    {
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   187
      echo '<enano><error><![CDATA[
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   188
Received invalid XML response.
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   189
]]></error></enano>';
915
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
    else
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
      if ( version_compare(enano_version(true), $match[2], '<') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   194
      {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   195
        $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
   196
      }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   197
      echo $response;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   198
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   199
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   200
  return true;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   201
}
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
function acphome_show_stats()
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   204
{
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   205
  global $db, $session, $paths, $template, $plugins; // Common objects
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   206
  global $lang;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   207
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   208
  // Page count
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   209
  $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
   210
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   211
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   212
  list($page_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   213
  $db->free_result();
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
  // Edits per day
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   216
  $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
   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
  $edit_info = $db->fetchrow();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   220
  $install_date =& $edit_info['install_date'];
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   221
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   222
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   223
  $days_installed = round( (time() / 86400) - ($install_date / 86400) );
916
05c341ea7545 Fixed division by zero on first day installed.
Dan
parents: 915
diff changeset
   224
  if ( $days_installed < 1 )
05c341ea7545 Fixed division by zero on first day installed.
Dan
parents: 915
diff changeset
   225
    $days_installed = 1;
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   226
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   227
  // Comments
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   228
  $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
   229
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   230
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   231
  list($comment_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   232
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   233
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   234
  // Users
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   235
  $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
   236
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   237
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   238
  list($user_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   239
  $db->free_result();
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
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   242
  $cache_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   243
  if ( $dr = @opendir(ENANO_ROOT . '/cache/') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   244
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   245
    while ( $dh = @readdir($dr) )
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
      $file = ENANO_ROOT . "/cache/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   248
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   249
        $cache_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   250
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   251
    closedir($dr);
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
  $cache_size = humanize_filesize($cache_size);
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 directory size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   256
  $files_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   257
  if ( $dr = @opendir(ENANO_ROOT . '/files/') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   258
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   259
    while ( $dh = @readdir($dr) )
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
      $file = ENANO_ROOT . "/files/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   262
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   263
        $files_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   264
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   265
    closedir($dr);
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
  $files_size = humanize_filesize($files_size);
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 directory size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   270
  $avatar_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   271
  if ( $dr = @opendir(ENANO_ROOT . '/files/avatars/') )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   272
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   273
    while ( $dh = @readdir($dr) )
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
      $file = ENANO_ROOT . "/files/avatars/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   276
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   277
        $avatar_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   278
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   279
    closedir($dr);
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
  $avatar_size = humanize_filesize($avatar_size);
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
  // Database size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   284
  $db_size = $lang->get('acphome_stat_dbsize_unsupported');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   285
  if ( ENANO_DBLAYER == 'MYSQL' )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   286
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   287
    $q = $db->sql_query('SHOW TABLE STATUS;');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   288
    if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   289
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   290
      $db_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   291
      while ( $row = $db->fetchrow() )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   292
      {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   293
        if ( preg_match('/^' . table_prefix . '/', $row['Name']) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   294
        {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   295
          $db_size += $row['Data_length'] + $row['Index_length'];
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   296
        }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   297
      }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   298
      $db_size = humanize_filesize($db_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   299
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   300
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   301
  else if ( ENANO_DBLAYER == 'PGSQL' )
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
    require(ENANO_ROOT . '/config.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   304
    global $dbname, $dbuser, $dbpasswd;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   305
    $dbuser = false;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   306
    $dbpasswd = false;
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
    $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
   309
    if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   310
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   311
      list($db_size) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   312
      $db_size = humanize_filesize($db_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   313
      $db->free_result();
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
  }
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
  // Install date
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   318
  $install_date_human = MemberlistFormatter::format_date($install_date);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   319
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   320
  // Last upgrade
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   321
  $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
   322
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   323
    $db->_die();
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
  if ( $db->numrows() < 1 )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   326
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   327
    $last_upgrade = $lang->get('acphome_stat_lastupdate_never');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   328
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   329
  else
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   330
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   331
    list($last_upgrade) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   332
    $last_upgrade = MemberlistFormatter::format_date($last_upgrade);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   333
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   334
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   335
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   336
  ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   337
  <div class="tblholder">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   338
  <table border="0" cellspacing="1" cellpadding="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   339
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   340
      <th colspan="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   341
        <?php echo $lang->get('acphome_stat_header'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   342
      </th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   343
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   344
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   345
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   346
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   347
        <?php echo $lang->get('acphome_stat_numpages'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   348
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   349
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   350
        <?php echo strval($page_count); ?>
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="row2" 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_edits'); ?>
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="row1" 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_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
   357
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   358
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   359
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   360
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   361
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   362
        <?php echo $lang->get('acphome_stat_comments'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   363
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   364
      <td class="row1" 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_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
   366
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   367
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   368
        <?php echo $lang->get('acphome_stat_users'); ?>
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="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   371
        <?php echo strval($user_count); ?>
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
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   374
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   375
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   376
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   377
        <?php echo $lang->get('acphome_stat_filesize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   378
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   379
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   380
        <?php echo $files_size; ?>
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="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   383
        <?php echo $lang->get('acphome_stat_cachesize'); ?>
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="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   386
        <?php echo $cache_size; ?>
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
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   389
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   390
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   391
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   392
        <?php echo $lang->get('acphome_stat_avatarsize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   393
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   394
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   395
        <?php echo $avatar_size; ?>
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="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   398
        <?php echo $lang->get('acphome_stat_dbsize'); ?>
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="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   401
        <?php echo $db_size; ?>
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
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   404
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   405
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   406
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   407
        <?php echo $lang->get('acphome_stat_installdate'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   408
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   409
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   410
        <?php echo $install_date_human; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   411
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   412
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   413
        <?php echo $lang->get('acphome_stat_lastupdate'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   414
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   415
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   416
        <?php echo $last_upgrade; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   417
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   418
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   419
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   420
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   421
      <th colspan="4" class="subhead systemversion">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   422
        <?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
   423
            'version' => enano_version(true),
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   424
            'releasename' => enano_codename(),
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   425
            'aboutlink' => makeUrlNS('Special', 'About_Enano')
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   426
          )); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   427
      </th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   428
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   429
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   430
  </table>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   431
  </div>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   432
  <?php
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   433
}