Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Onlinestats and CPGOcat together: doubled output  (Read 7031 times)

0 Members and 1 Guest are viewing this topic.

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Onlinestats and CPGOcat together: doubled output
« on: August 29, 2006, 03:41:59 pm »

Hi,

If you are using both, Nibbler's statistics plugin and Paver's Orderable Category List plugin together, Coppermine could mess up the output page:

If the index page shows the category list twice and the online stats twice (underneath eachother), you have to change the position of the plugins in the plugin manager: the online stats have to be placed above the CPGOcat plugin. That's all :-)

Regards,
Ralf
« Last Edit: August 31, 2006, 03:14:48 pm by Paver »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Onlinestats and CPGOcat together: doubled output
« Reply #1 on: August 30, 2006, 02:50:05 am »

Are you sure?  I just tested it on my testbed gallery with only those two plugins, and I don't see doubled output, no matter which plugin is on top.

It is true in general that if a plugin is not written correctly, the order of the plugin with respect to other plugins might be important.  So if you do have this issue, it would be useful to fix the offending plugin.

Please post information about your Coppermine version, plugin versions (for both), and any other plugins you might have installed (along with any mods/hacks you have applied).
Logged

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Onlinestats and CPGOcat together: doubled output
« Reply #2 on: August 31, 2006, 11:38:10 am »

Hi Paver,

Here are my plugins. Normally I have more activated, but in my configuration it is definitely these two causing the mess:

[edit GauGau]replaced hotlinked pic with attachment "plugs.gif"[/edit]

The output is funny:

[edit GauGau]replaced hotlinked pic with attachment "out.gif"[/edit]

My main page content is "breadcrumb/catlist/alblist/onlinestats"

On a first, rough look, I thought, the first is the patched catlist with the summary and below is the 'original table'. But this is not true because both tables show the right summary numbers.

And believe me: if I change the sort order and put the stats on top, it works.

I have 1.4.8 installed - together with some really small mods (prev/next tab, changed login.php, included 'Add to favorites' to the icon bar in displayimage.php), but nothing in index.php

I'll try to install a naked 1.4.9 together with the two plugins and then restore my mods one after the other.

Regards,
Ralfs
« Last Edit: September 01, 2006, 12:22:32 am by GauGau »
Logged

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Onlinestats and CPGOcat together: doubled output
« Reply #3 on: August 31, 2006, 01:03:01 pm »

Hello again,

I duplicated my /cpg directory and replaced everything but my theme and the config.inc.php with original v1.4.9 files. Result: the same.
Then I tried theme 'Classic' and 'iGames'. Result: the same.

Then I made some tests on the plugin sort order and I got interesting results:
1. If OCat is above Stats, the category list gets doubled. It doesn't matter if there is another plugin between the two.
2. If Stats is the last plugin in the list, the statistics gets doubled. But only, if OCat is active.

I have tested that behaviour with three and with four activated plugins ('Search albums' and 'Special Edit')

Regards,
Ralf
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Onlinestats and CPGOcat together: doubled output
« Reply #4 on: August 31, 2006, 01:38:07 pm »

Thanks for the detailed report.  It turns out that I was using a version of onlinestats called "1.2 (working with mods by Paver)".  I thought my mods were just simple display-type mods (that I did when assisting users in the plugin support thead).

Well, something is very strange indeed.  My modded plugin has a different folder name, and is missing certain header and comments that makes me think somehow I didn't start with the 1.2 version that is publicly available here.  I must have created my own 1.2 version and didn't download the 1.2 version released thinking it was the same as mine.

In any case, here's the relevant code you need to change.

Look for the following three lines:
Code: [Select]
function online_mainpage()
{
        global $CONFIG, $cpg_udb, $comment_date_fmt, $matches ;
Replace them with these three lines:
Code: [Select]
function online_mainpage($matches)
{
        global $CONFIG, $cpg_udb, $comment_date_fmt ;

Let me know if this works for you.  I reproduced your issue on my testbed, then made the change, and it fixed the issue, so it should work.

I've been rather hands-off about the onlinestats plugin, just adding comments here & there, and not really looking at it carefully.  I'll check it out and make sure there aren't any other issues before helping to release version 1.3 of that plugin.
Logged

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Onlinestats and CPGOcat together: doubled output
« Reply #5 on: August 31, 2006, 02:14:00 pm »

Yeah, that was it!

Many thanks for the fast help - it's great fun to be part of such an active and motivated community.

Regards,
Ralf
Logged

natrlhy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 77
Re: Onlinestats and CPGOcat together: doubled output
« Reply #6 on: February 27, 2007, 07:33:29 pm »

I had a similar issue where only 1 registered user was logged in but the onlinestats (v1.7) displayed 2 logged in. Making the changes listed below worked for my situation as well:

old code:

Code: [Select]
function online_mainpage()
{
        global $CONFIG, $cpg_udb, $matches, $lang_plugin_onlinestats, $lang_plugin_onlinestats_date_fmt ;

new code:

Code: [Select]
function online_mainpage($matches)
{
        global $CONFIG, $cpg_udb, $lang_plugin_onlinestats, $lang_plugin_onlinestats_date_fmt ;
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.