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