plugins/admin/Home.php
author Dan
Thu, 17 Dec 2009 04:27:50 -0500
changeset 1168 277a9cdead3e
parent 1140 d90e55caba3a
child 1170 71cb87b7dc3f
permissions -rw-r--r--
Namespace_Default: added a workaround for an inconsistency in SQL. Basically, if you join the same table multiple times under multiple aliases, COUNT() always uses the first instance. Was affecting the comment counter in the "discussion" button.
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
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    82
  // Update checker
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    83
  echo '<div class="acphome-box info">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    84
    echo '<h3>' . $lang->get('acphome_heading_updates') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    85
    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
    86
    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
    87
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    88
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    89
  // Docs
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    90
  echo '<div class="acphome-box info halfwidth">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    91
  echo '<h3>' . $lang->get('acphome_heading_docs') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    92
  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
    93
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    94
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    95
  // Support
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    96
  echo '<div class="acphome-box info halfwidth">';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    97
  echo '<h3>' . $lang->get('acphome_heading_support') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
    98
  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
    99
  echo '</div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   100
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   101
  echo '<span class="menuclear"></span>';
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
  //
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   104
  // Stats
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
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   107
  if(getConfig('log_hits') == '1')
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
    require_once(ENANO_ROOT . '/includes/stats.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   110
    $stats = stats_top_pages(10);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   111
    //die('<pre>'.print_r($stats,true).'</pre>');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   112
    $c = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   113
    $cls = 'row2';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   114
    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
   115
          <div class="tblholder">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   116
            <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
   117
              <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   118
                <th>' . $lang->get('acphome_th_toppages_page') . '</th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   119
                <th>' . $lang->get('acphome_th_toppages_hits') . '</th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   120
              </tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   121
    foreach($stats as $data)
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   122
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   123
      echo   '<tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   124
      $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   125
      echo     '<td class="'.$cls.'">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   126
                  <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
   127
             . '</td>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   128
      echo   '</tr>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   129
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   130
    echo '  </table>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   131
          </div>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   132
  }
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
  // Any hooks?
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   135
  $code = $plugins->setHook('acp_home');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   136
  foreach ( $code as $cmd )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   137
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   138
    eval($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
  
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
  // Security log
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
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   145
  echo '<h3>' . $lang->get('acphome_heading_seclog') . '</h3>';
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   146
  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
   147
  $seclog = get_security_log(5);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   148
  echo $seclog;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   149
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   150
  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
   151
  
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
function acphome_process_updates()
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
  require_once(ENANO_ROOT . '/includes/http.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   157
  
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   158
  try
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   159
  {
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   160
    $req = new Request_HTTP('ktulu.enanocms.org', '/meta/updates.xml');
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   161
    $response = $req->get_response_body();
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   162
    header('Content-type: application/xml');
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   163
  }
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   164
  catch ( Exception $e )
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
    header('Content-type: application/xml');
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   167
    echo '<enano><error><![CDATA[
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   168
Cannot connect to server: ' . $e->getMessage() . '
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   169
]]></error></enano>';
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   170
    return true;
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   171
  }
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   172
  if ( $req->response_code != HTTP_OK )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   173
  {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   174
    // Error in response
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   175
    echo '<enano><error><![CDATA[
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   176
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
   177
]]></error></enano>';
915
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
    // Retrieve first update
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   182
    $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
   183
    if ( !$first_update )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   184
    {
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   185
      echo '<enano><error><![CDATA[
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   186
Received invalid XML response.
951
745cccc6b97d Admin: Home: Properly handles Request_HTTP exceptions now
Dan
parents: 916
diff changeset
   187
]]></error></enano>';
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   188
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   189
    else
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
      if ( version_compare(enano_version(true), $match[2], '<') )
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
        $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
   194
      }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   195
      echo $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
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   198
  return true;
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
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   201
function acphome_show_stats()
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
  global $db, $session, $paths, $template, $plugins; // Common objects
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   204
  global $lang;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   205
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   206
  // Page count
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   207
  $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
   208
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   209
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   210
  list($page_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   211
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   212
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   213
  // Edits per day
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   214
  $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
   215
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   216
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   217
  $edit_info = $db->fetchrow();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   218
  $install_date =& $edit_info['install_date'];
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   219
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   220
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   221
  $days_installed = round( (time() / 86400) - ($install_date / 86400) );
916
05c341ea7545 Fixed division by zero on first day installed.
Dan
parents: 915
diff changeset
   222
  if ( $days_installed < 1 )
05c341ea7545 Fixed division by zero on first day installed.
Dan
parents: 915
diff changeset
   223
    $days_installed = 1;
915
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   224
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   225
  // Comments
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   226
  $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
   227
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   228
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   229
  list($comment_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   230
  $db->free_result();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   231
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   232
  // Users
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   233
  $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
   234
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   235
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   236
  list($user_count) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   237
  $db->free_result();
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
  // Cache size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   240
  $cache_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   241
  if ( $dr = @opendir(ENANO_ROOT . '/cache/') )
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
    while ( $dh = @readdir($dr) )
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
      $file = ENANO_ROOT . "/cache/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   246
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   247
        $cache_size += filesize($file);
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
    closedir($dr);
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
  $cache_size = humanize_filesize($cache_size);
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
  // Files directory size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   254
  $files_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   255
  if ( $dr = @opendir(ENANO_ROOT . '/files/') )
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
    while ( $dh = @readdir($dr) )
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
      $file = ENANO_ROOT . "/files/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   260
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   261
        $files_size += filesize($file);
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
    closedir($dr);
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
  $files_size = humanize_filesize($files_size);
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
  // Avatar directory size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   268
  $avatar_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   269
  if ( $dr = @opendir(ENANO_ROOT . '/files/avatars/') )
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
    while ( $dh = @readdir($dr) )
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
      $file = ENANO_ROOT . "/files/avatars/$dh";
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   274
      if ( @is_file($file) )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   275
        $avatar_size += filesize($file);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   276
    }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   277
    closedir($dr);
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
  $avatar_size = humanize_filesize($avatar_size);
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
  // Database size
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   282
  $db_size = $lang->get('acphome_stat_dbsize_unsupported');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   283
  if ( ENANO_DBLAYER == 'MYSQL' )
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
    $q = $db->sql_query('SHOW TABLE STATUS;');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   286
    if ( $q )
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
      $db_size = 0;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   289
      while ( $row = $db->fetchrow() )
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
        if ( preg_match('/^' . table_prefix . '/', $row['Name']) )
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
          $db_size += $row['Data_length'] + $row['Index_length'];
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
      }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   296
      $db_size = humanize_filesize($db_size);
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
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   299
  else if ( ENANO_DBLAYER == 'PGSQL' )
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
    require(ENANO_ROOT . '/config.php');
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   302
    global $dbname, $dbuser, $dbpasswd;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   303
    $dbuser = false;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   304
    $dbpasswd = false;
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   305
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   306
    $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
   307
    if ( $q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   308
    {
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   309
      list($db_size) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   310
      $db_size = humanize_filesize($db_size);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   311
      $db->free_result();
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
  }
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
  // Install date
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   316
  $install_date_human = MemberlistFormatter::format_date($install_date);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   317
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   318
  // Last upgrade
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   319
  $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
   320
  if ( !$q )
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   321
    $db->_die();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   322
  
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   323
  if ( $db->numrows() < 1 )
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
    $last_upgrade = $lang->get('acphome_stat_lastupdate_never');
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
  else
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
    list($last_upgrade) = $db->fetchrow_num();
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   330
    $last_upgrade = MemberlistFormatter::format_date($last_upgrade);
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   331
  }
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   332
  $db->free_result();
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
  ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   335
  <div class="tblholder">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   336
  <table border="0" cellspacing="1" cellpadding="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   337
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   338
      <th colspan="4">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   339
        <?php echo $lang->get('acphome_stat_header'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   340
      </th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   341
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   342
    
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
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   345
        <?php echo $lang->get('acphome_stat_numpages'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   346
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   347
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   348
        <?php echo strval($page_count); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   349
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   350
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   351
        <?php echo $lang->get('acphome_stat_edits'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   352
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   353
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   354
        <?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
   355
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   356
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   357
    
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
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   360
        <?php echo $lang->get('acphome_stat_comments'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   361
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   362
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   363
        <?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
   364
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   365
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   366
        <?php echo $lang->get('acphome_stat_users'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   367
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   368
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   369
        <?php echo strval($user_count); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   370
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   371
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   372
    
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
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   375
        <?php echo $lang->get('acphome_stat_filesize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   376
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   377
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   378
        <?php echo $files_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   379
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   380
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   381
        <?php echo $lang->get('acphome_stat_cachesize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   382
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   383
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   384
        <?php echo $cache_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   385
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   386
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   387
    
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
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   390
        <?php echo $lang->get('acphome_stat_avatarsize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   391
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   392
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   393
        <?php echo $avatar_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   394
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   395
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   396
        <?php echo $lang->get('acphome_stat_dbsize'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   397
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   398
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   399
        <?php echo $db_size; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   400
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   401
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   402
    
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
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   405
        <?php echo $lang->get('acphome_stat_installdate'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   406
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   407
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   408
        <?php echo $install_date_human; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   409
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   410
      <td class="row2" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   411
        <?php echo $lang->get('acphome_stat_lastupdate'); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   412
      </td>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   413
      <td class="row1" style="width: 25%;">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   414
        <?php echo $last_upgrade; ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   415
      </td>
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
    <tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   419
      <th colspan="4" class="subhead systemversion">
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   420
        <?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
   421
            'version' => enano_version(true),
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   422
            'releasename' => enano_codename(),
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   423
            'aboutlink' => makeUrlNS('Special', 'About_Enano')
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   424
          )); ?>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   425
      </th>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   426
    </tr>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   427
    
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   428
  </table>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   429
  </div>
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   430
  <?php
91f4da84966f New, beautiful, rethought Admin:Home. No, really, you'll like it.
Dan
parents:
diff changeset
   431
}