Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 12:11 am EST

Geeklog Forums

stats header repeating


adbox

Anonymous
The header of my website repeats on the stats.php page.

If a subsection have statistics to report, it displays the header banner twice.
I've combed through stats.php and prodded but I cannot find the source of the problem.

I even went into my stats/ folder of my layout and completely deleted all the code in the thtml templats (sitestatistics.thtml, itemstatistics.thmtl,singlestat.thml, & singlessumary.thmtl) and then saved the file, but this did not affect how my stats page renders.

I have also tried replacing the stats.php file with the original downloaded file, no change.

http://www.shredthenews.com/stats.php

I appreciate any leads or help,
adbox
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
As it looks like it is a theme problem. Which GL version is it?
 Quote

adbox

Anonymous
(1.5.2sr4)

yeah thats what I would think too, but it doesnt make sense because I got to the layout/theme/stats/ folder and edit all the above mentioned files to where they have absolutely no cotnent (0 kb) and this does not affect the layout of the above posted url. , should I be looking somewhere else?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
I can see "DkBlog Template" but you seem to be using professional theme. Probably you mixed something up.

I`d use an unchanged DkBlog Template for trouble shooting.

 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Nothing I really worry about and I haven't really looked into it but since this topic deals with the stats page, on a few of my sites I get the word Array thrown in a few times on the page, almost like an array was being echoed in the php somewhere.

Anyone else getting this?

One of the Geeklog Core Developers.
 Quote

adbox

Anonymous
I am using the dk_blog template.

Are the template files for the stats page not located in /theme/stats?

I have deleted this directory from all my theme folders in my layout/ directory and no change happens to the stats.php page.

Where do I go to find the source of this looping header.thtml problem?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
If it is not in /theme/stats then it might be in /theme and possibly the header.thtml itself.
 Quote

adbox

Anonymous
I still am not able to find it.
the only file that edits the top stats page is the stats.php file itself in the public_html directory.

I cant figure out why it would loop a header though...

heres the code
Text Formatted Code

<?php

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.4                                                               |
// +---------------------------------------------------------------------------+
// | stats.php                                                                 |
// |                                                                           |
// | Geeklog system statistics page.                                           |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2005 by the following authors:                         |
// |                                                                           |
// | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
// |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
// |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
// |          Dirk Haun         - dirk AT haun-online DOT de                   |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
//
// $Id: stats.php,v 1.53 2008/02/20 20:07:58 mjervis Exp $

require_once('lib-common.php');
require_once( $_CONF['path_system'] . 'lib-admin.php' );

$display = '';

if (empty ($_USER['username']) &&
    (($_CONF['loginrequired'] == 1) || ($_CONF['statsloginrequired'] == 1))) {
    $display = COM_siteHeader ('menu', $LANG_LOGIN[1]);
    $display .= COM_startBlock ($LANG_LOGIN[1], '',
                                COM_getBlockTemplate ('_msg_block', 'header'));
    $login = new Template($_CONF['path_layout'] . 'submit');
    $login->set_file (array ('login'=>'submitloginrequired.thtml'));
    $login->set_var ( 'xhtml', XHTML );
    $login->set_var ('site_url', $_CONF['site_url']);
    $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
    $login->set_var ('layout_url', $_CONF['layout_url']);
    $login->set_var ('login_message', $LANG_LOGIN[2]);
    $login->set_var ('lang_login', $LANG_LOGIN[3]);
    $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
    $login->parse ('output', 'login');
    $display .= $login->finish ($login->get_var('output'));
    $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
    $display .= COM_siteFooter();
    echo $display;
    exit;
}

// MAIN

$display .= COM_siteHeader ('menu', $LANG10[1]);

// Overall Site Statistics

$header_arr = array(
    array('text' => $LANG10[1], 'field' => 'title', 'header_class' => 'stats-header-title'),
    array('text' => "", 'field' => 'stats', 'header_class' => 'stats-header-count', 'field_class' => 'stats-list-count'),
);
$data_arr = array();
$text_arr = array('has_menu'     =>  false,
                  'title'        => $LANG10[1],
);

$totalhits = DB_getItem ($_TABLES['vars'], 'value', "name = 'totalhits'");
$data_arr[] = array('title' => $LANG10[2], 'stats' => COM_NumberFormat ($totalhits));

if ($_CONF['lastlogin']) {
    // if we keep track of the last login date, count the number of users
    // that have logged in during the last 4 weeks
    $result = DB_query ("SELECT COUNT(*) AS count FROM {$_TABLES['users']} AS u,{$_TABLES['userinfo']} AS i WHERE (u.uid > 1) AND (u.uid = i.uid) AND (lastlogin <> '') AND (lastlogin >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 28 DAY)))");
    list($active_users) = DB_fetchArray ($result);
} else {
    // otherwise, just count all users with status 'active'
    // (i.e. those that logged in at least once and have not been banned since)
    $active_users = DB_count ($_TABLES['users'], 'status', 3);
    $active_users--; // don't count the anonymous user account
}
$data_arr[] = array('title' => $LANG10[27], 'stats' => COM_NumberFormat ($active_users));

$topicsql = COM_getTopicSql ('AND');

$id = array ('draft_flag', 'date');
$values = array ('0', 'NOW()');
$result = DB_query ("SELECT COUNT(*) AS count,SUM(comments) AS ccount FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getPermSQL ('AND') . $topicsql);
$A = DB_fetchArray ($result);
if (empty ($A['ccount'])) {
    $A['ccount'] = 0;
}
$data_arr[] = array('title' => $LANG10[3],
                    'stats' => COM_NumberFormat ($A['count'])
                           . " (". COM_NumberFormat ($A['ccount']) . ")");

// new stats plugin API call
$plg_stats = PLG_getPluginStats (3);
if (count ($plg_stats) > 0) {
    foreach ($plg_stats as $pstats) {
        if (is_array ($pstats[0])) {
            foreach ($pstats as $pmstats) {
                $data_arr[] = array('title' => $pmstats[0], 'stats' => $pmstats[1]);
            }
        } else {
            $data_arr[] = array('title' => $pstats[0], 'stats' => $pstats[1]);
        }
    }
}

$display .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);

// old stats plugin API call, for backward compatibilty
$display .= PLG_getPluginStats (1);

// Detailed story statistics

$result = DB_query("SELECT sid,title,hits FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW()) AND (Hits > 0)" . COM_getPermSQL ('AND') . $topicsql . " ORDER BY hits DESC LIMIT 10");
$nrows  = DB_numRows($result);

if ($nrows > 0) {
    $header_arr = array(
        array('text' => $LANG10[8], 'field' => 'sid', 'header_class' => 'stats-header-title'),
        array('text' => $LANG10[9], 'field' => 'hits', 'header_class' => 'stats-header-count', 'field_class' => 'stats-list-count'),
    );
    $data_arr = array();
    $text_arr = array('has_menu'     =>  false,
                      'title'        => $LANG10[7],
    );

    for ($i = 0; $i < $nrows; $i++) {
        $A = DB_fetchArray($result);
        $A['title'] = stripslashes(str_replace('$','&#36;',$A['title']));
        $A['sid'] = COM_createLink($A['title'],  COM_buildUrl ($_CONF['site_url']
                  . "/article.php?story={$A['sid']}"));
        $A['hits'] = COM_NumberFormat ($A['hits']);
        $data_arr[$i] = $A;

    }
    $display .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
} else {
    $display .= COM_startBlock($LANG10[7]);
    $display .= $LANG10[10];
    $display .= COM_endBlock();
}

// Top Ten Commented Stories

$result = DB_query("SELECT sid,title,comments FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW()) AND (comments > 0)" . COM_getPermSQL ('AND') . $topicsql . " ORDER BY comments DESC LIMIT 10");
$nrows  = DB_numRows($result);
if ($nrows > 0) {
    $header_arr = array(
        array('text' => $LANG10[8], 'field' => 'sid', 'header_class' => 'stats-header-title'),
        array('text' => $LANG10[12], 'field' => 'comments', 'header_class' => 'stats-header-count', 'field_class' => 'stats-list-count'),
    );
    $data_arr = array();
    $text_arr = array('has_menu'     =>  false,
                      'title'        => $LANG10[11],
    );
    for ($i = 0; $i < $nrows; $i++) {
        $A = DB_fetchArray($result);
        $A['title'] = stripslashes(str_replace('$','&#36;',$A['title']));
        $A['sid'] = COM_createLink($A['title'], COM_buildUrl ($_CONF['site_url']
                  . "/article.php?story={$A['sid']}"));
        $A['comments'] = COM_NumberFormat ($A['comments']);
        $data_arr[$i] = $A;
    }
    //$display .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);

} else {
    $display .= COM_startBlock($LANG10[11]);
    $display .= $LANG10[13];
    $display .= COM_endBlock();
}

// Top Ten Trackback Comments

if ($_CONF['trackback_enabled'] || $_CONF['pingback_enabled']) {
    $result = DB_query ("SELECT {$_TABLES['stories']}.sid,{$_TABLES['stories']}.title,COUNT(*) AS count FROM {$_TABLES['stories']},{$_TABLES['trackback']} AS t WHERE (draft_flag = 0) AND ({$_TABLES['stories']}.date <= NOW()) AND ({$_TABLES['stories']}.sid = t.sid) AND (t.type = 'article')" . COM_getPermSql ('AND') . $topicsql . " GROUP BY t.sid,{$_TABLES['stories']}.sid,{$_TABLES['stories']}.title ORDER BY count DESC LIMIT 10");
    $nrows = DB_numRows ($result);
    if ($nrows > 0) {
        $header_arr = array(
            array('text' => $LANG10[8], 'field' => 'sid', 'header_class' => 'stats-header-title'),
            array('text' => $LANG10[12], 'field' => 'count', 'header_class' => 'stats-header-count', 'field_class' => 'stats-list-count'),
        );
        $data_arr = array();
        $text_arr = array('has_menu'     =>  false,
                          'title'        => $LANG10[25],
        );
        for ($i = 0; $i < $nrows; $i++) {
            $A = DB_fetchArray ($result);
            $A['title'] = stripslashes(str_replace('$','&#36;',$A['title']));
            $A['sid'] = COM_createLink($A['title'], COM_buildUrl ($_CONF['site_url']
                      . "/article.php?story={$A['sid']}"));
            $A['count'] = COM_NumberFormat ($A['count']);
            $data_arr[$i] = $A;
        }
        $display .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);

    } else {
        $display .= COM_startBlock ($LANG10[25]);
        $display .= $LANG10[26];
        $display .= COM_endBlock ();
    }
}

// Top Ten Emailed Stories

$result = DB_query("SELECT sid,title,numemails FROM {$_TABLES['stories']} WHERE (numemails > 0) AND (draft_flag = 0) AND (date <= NOW())" . COM_getPermSQL ('AND') . $topicsql . " ORDER BY numemails DESC LIMIT 10");
$nrows = DB_numRows($result);

if ($nrows > 0) {
    $header_arr = array(
        array('text' => $LANG10[8], 'field' => 'sid', 'header_class' => 'stats-header-title'),
        array('text' => $LANG10[23], 'field' => 'numemails', 'header_class' => 'stats-header-count', 'field_class' => 'stats-list-count'),
    );
    $data_arr = array();
    $text_arr = array('has_menu'     =>  false,
                      'title'        => $LANG10[22],
    );
    for ($i = 0; $i < $nrows; $i++) {
        $A = DB_fetchArray($result);
        $A['title'] = stripslashes(str_replace('$','&#36;',$A['title']));
        $A['sid'] = COM_createLink($A['title'], COM_buildUrl ($_CONF['site_url']
                  . "/article.php?story={$A['sid']}"));
        $A['numemails'] = COM_NumberFormat ($A['numemails']);
        $data_arr[$i] = $A;

    }
    $display .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
} else {
    $display .= COM_startBlock($LANG10[22]);
    $display .= $LANG10[24];
    $display .= COM_endBlock();
}

// Now show stats for any plugins that want to be included
$display .= PLG_getPluginStats(2);
$display .= COM_siteFooter();

echo $display;

?>

 


once again the problem is that if there are stats to populate a section, then it echos out the header template for the section.
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Two things I would try to narrow down the problem.

Try using the professional theme to see if it still happens.

Then try disabling plugins one by one and viewing the stats page to see anything changes.

Tom
One of the Geeklog Core Developers.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
I can only repeat myself:

Quote by: 1000ideen

I can see "DkBlog Template" but you seem to be using professional theme. Probably you mixed something up.

I`d use an unchanged DkBlog Template for trouble shooting.

 Quote

adbox

Anonymous
Quote by: 1000ideen

I can only repeat myself:

Quote by: 1000ideen

I can see "DkBlog Template" but you seem to be using professional theme. Probably you mixed something up.

I`d use an unchanged DkBlog Template for trouble shooting.



I'm sorry for not answering, I renamed DkBlog's directory name to Professional, because I have having trouble getting DKBlog to load.
Can I ask how you know that my theme's name is Professional instead of DkBlog?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
If you go to your site and look at the source code you can see some details. The theme is called professional.

That`s why I said unse an "unchanged DkBlog Template for trouble shooting."
 Quote

All times are EST. The time is now 12:11 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content