Advanced search  

News:

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

Pages: 1 2 3 [4] 5   Go Down

Author Topic: MOD: Detailed Gallery Statistics  (Read 88652 times)

0 Members and 1 Guest are viewing this topic.

pslawinski

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • Lighting-Gallery.net
Re: MOD: Detailed Gallery Statistics
« Reply #60 on: July 11, 2006, 03:35:39 pm »

I'm not sure what you're asking.
Logged

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #61 on: July 11, 2006, 05:18:46 pm »

I'm not sure what you're asking.

Ok, maybe my english is not so good. I'll try to explain again
With a 1.4.8 version of CPG and follow all the instructions and I have as return an error code (sorry, I didn't copy the text but I can repeat If you want) in the funtionts archive.
I use a spanish language versión of CPG. Maybe is this the problem. (I repeat the instructions twice with the same bad result)

regards

pslawinski

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • Lighting-Gallery.net
Re: MOD: Detailed Gallery Statistics
« Reply #62 on: July 12, 2006, 12:45:34 am »

Turn on Debug Mode and post the text provided at the bottom of the page with the error.
Logged

TheGamer1701

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 52
    • PartyNation.tv - Always the newest Party Facs from North Germany
Re: MOD: Detailed Gallery Statistics
« Reply #63 on: August 09, 2006, 10:16:20 am »

Hello,


I think this is a great mod ^^
I had big problems with 2 of the statistics, but finally solved it.
While trying to fix it I found out that you could improve your code.
Actually you have about 6 SQL Statements for every stat, b ut this could be just 1 if you use joins.
Unfortunetly I don't know how to make this coppermine compatible, I coded it "my own way".
But maybe this SQL Statement can help you a little and someone else can improve the code.
I guess it's worth it if you go down from 6 sql statements to 1 for every stat.


Example: Most Commented
1st SQL: Get all picture_ids from the comment table (very slow if you have a lot of comments)
Code: [Select]
SELECT pid FROM {$CONFIG['TABLE_COMMENTS']}
2nd SQL: For every of the Top 5 commented pics, get more infos from the db:
Code: [Select]
SELECT filepath, filename, owner_name, owner_id FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.pid = '$image'

Okay, now what did I do?
Simple:
I get all the info from the 2nd statement with the 1st SQL AND only ask the top 5 commented pictures, not all comments.
Code: [Select]
SELECT cc.pid, p.filepath, p.filename, p.owner_name, p.owner_id, a.title, c.name, p.hits, count(cc.pid) AS anzahl
FROM {$CONFIG['TABLE_COMMENTS']} AS cc, {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_ALBUMS']} AS a, {$CONFIG['TABLE_CATEGORIES']} AS c
WHERE cc.pid = p.pid AND p.aid = a.aid AND a.category = c.cid
GROUP BY cc.pid
ORDER BY anzahl DESC
LIMIT 0,5

Note: I added some extra infos to the pictures, e.g. album name, categorie and the number of hits.


Now, what do we need to do?
This statement is great, but I don't know how I have to alter your code to make it cpg compatible.
Sorry.

Logged

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #64 on: September 11, 2006, 03:46:46 pm »

Turn on Debug Mode and post the text provided at the bottom of the page with the error.

Sorry for the very big delay
Right now I run the 1.4.9 version, so I repeat again the process of 1.4.9 (the only tin is I'd change eh link from theme.php to template.html) I made the mod in functions.inc.php and I made the custom galleryStats.php that you put on the box (not the one of the first post in the zip)
The only ting I have is a blank screen with nothing
You can test in
http://www.fotomaf.com/galleryStats.php
The only thin that I can see in debug mode is
Quote
Alertas
/include/functions.inc.php

    * Warning line 483: sprintf() [function.sprintf]: Too few arguments
    * Warning line 483: sprintf() [function.sprintf]: Too few arguments
    * Warning line 483: sprintf() [function.sprintf]: Too few arguments
    * Warning line 483: sprintf() [function.sprintf]: Too few arguments
    * Warning line 483: sprintf() [function.sprintf]: Too few arguments
    * Warning line 483: sprintf() [function.sprintf]: Too few arguments
    * Warning line 483: sprintf() [function.sprintf]: Too few arguments

The 483 line is
Quote
$tabs = sprintf($template['left_text'], $items, $total_pages);
nothing relative to your mod

And in the galleryStats.php I can't debug nothing because I get, as I say, a blank screen

I must do anything more?

Best regards from Spain and sorry for my BAD english

Nibbler

  • Guest
Re: MOD: Detailed Gallery Statistics
« Reply #65 on: September 14, 2006, 01:49:35 pm »

If you get a blank screen it may be caused by having more comments than the daily graph code can handle. I had to make a more sane version for this reason. This is 1.3 code but changing db_query to cpg_db_query should make it work on 1.4. I also adjusted the scale and % rounding.

Code: [Select]
activityGraph("FROM_UNIXTIME(ctime)", $CONFIG['TABLE_PICTURES'], "Uploads", "images/bar.gif");
activityGraph("msg_date", $CONFIG['TABLE_COMMENTS'], "Comments", "images/bar.gif");


//Activity Graph Function
function activityGraph($cellName, $tableName, $title, $barTile, $notCtime=false)
{
global $CONFIG;
starttable('100%', $title, 26);

$query = "SELECT COUNT(*) AS number, HOUR($cellName) AS period FROM $tableName GROUP BY HOUR($cellName) ";
$result = db_query($query);
while ($row = mysql_fetch_assoc($result)) $rowset[$row['period']] = $row['number'];
mysql_free_result($result);

print('<tr><td align="center" colspan="26"><b>Time of Day</b></td></tr>');
print('<tr><td align="center" colspan="26" height="2"></td></tr>');
print('<tr><td align="center" colspan="26" height="2" bgcolor="#000000"></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td height="100" width="1" valign="bottom"><img src="images/spacer.gif" width="1" height="200" /></td>');

$total = array_sum($rowset);
$max = max($rowset);

foreach ($rowset as $number)
{
print('<td height="100" width="4%" valign="bottom" align="center" style="font-size: 80%">'.round(($number/$total)*100,1).'%<br /><img src="'.$barTile.'" border="1" alt="" width="15" height="'.round(($number/$max)*200,0).'" /></td>');
}
print('<td height="100" width="1" valign="bottom"><img src="images/spacer.gif" width="1" height="200" /></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td align="center" colspan="26" height="2" bgcolor="#000000"></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td></td>');
for($i = '0'; $i <= '23'; $i++)
{
print('<td width="4%" align="center">'.$i.'</td>');
}
print('<td></td></tr>');

endtable();
print('<img src="images/spacer.gif" alt="" height="17 width="1" />');
}
Logged

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #66 on: September 14, 2006, 02:31:19 pm »

hi Nibble thanks

now I don't have the blank screen I have a crazy screen!! ;)

Take a look in
http://www.fotomaf.com/galleryStats.php

My code por GalleryStats . Something wrong?
I revised the code to find something wrong with the with but I don't know to much HTML ;)

Code: [Select]
<?php

define
('IN_COPPERMINE'true);

require(
'include/init.inc.php');
pageheader("Gallery Statistics");

activityGraph("FROM_UNIXTIME(ctime)"$CONFIG['TABLE_PICTURES'], "Uploads""images/bar.gif");
activityGraph("msg_date"$CONFIG['TABLE_COMMENTS'], "Comments""images/bar.gif");


//Activity Graph Function
function activityGraph($cellName$tableName$title$barTile$notCtime=false)
{
global $CONFIG;
starttable('100%'$title26);

$query "SELECT COUNT(*) AS number, HOUR($cellName) AS period FROM $tableName GROUP BY HOUR($cellName) ";
$result cpg_db_query ($query);
while ($row mysql_fetch_assoc($result)) $rowset[$row['period']] = $row['number'];
mysql_free_result($result);

print('<tr><td align="center" colspan="26"><b>Time of Day</b></td></tr>');
print('<tr><td align="center" colspan="26" height="2"></td></tr>');
print('<tr><td align="center" colspan="26" height="2" bgcolor="#000000"></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td height="100" width="1" valign="bottom"><img src="images/spacer.gif" width="1" height="200" /></td>');

$total array_sum($rowset);
$max max($rowset);

foreach ($rowset as $number)
{
print('<td height="100" width="4%" valign="bottom" align="center" style="font-size: 80%">'.round(($number/$total)*100,1).'%<br /><img src="'.$barTile.'" border="1" alt="" width="15" height="'.round(($number/$max)*200,0).'" /></td>');
}
print('<td height="100" width="1" valign="bottom"><img src="images/spacer.gif" width="1" height="200" /></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td align="center" colspan="26" height="2" bgcolor="#000000"></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td></td>');
for($i '0'$i <= '23'$i++)
{
print('<td width="4%" align="center">'.$i.'</td>');
}
print('<td></td></tr>');

endtable();
print('<img src="images/spacer.gif" alt="" height="17 width="1" />');
}

//Start Most Commented
display_thumbnails('mostcom'$cat1$CONFIG['thumbcols'], 1false);
//End Most Commented

//Start Most Voted
display_thumbnails('mostvot'$cat1$CONFIG['thumbcols'], 1false);
//End Most Voted

//Start Most Viewed
display_thumbnails('topn'$cat1$CONFIG['thumbcols'], 1false);
//End Most Viewed

//Start User Most Commented
display_thumbnails('mostcomusr'$cat1$CONFIG['thumbcols'], 1false);
//End User Most Commented

//Start User Most Voted
display_thumbnails('mostvotusr'$cat1$CONFIG['thumbcols'], 1false);
//End User Most Voted

//Start User Most Viewed
display_thumbnails('mostvieusr'$cat1$CONFIG['thumbcols'], 1false);
//End User Most Viewed

//Start User Most Commenting
display_thumbnails('topcom'$cat1$CONFIG['thumbcols'], 1false);
//End User Most Commenting

//Start Album Most Commented
display_thumbnails('mostcomalb'$cat1$CONFIG['thumbcols'], 1false);
//End Album Most Commented

//Start Album Most Voted
display_thumbnails('mostvotalb'$cat1$CONFIG['thumbcols'], 1false);
//End Album Most Voted


//Start Album Most Viewed
display_thumbnails('mostviealb'$cat1$CONFIG['thumbcols'], 1false);
//End Album Most Viewed

//Start Upload Activity By Time
activityGraph("ctime"$CONFIG['TABLE_PICTURES'], "Upload Activity By Time""http://www.fotomaf.com/images/tile.gif");
//End Upload Activity By Time

//Start Comment Activity By Time
activityGraph("msg_date"$CONFIG['TABLE_COMMENTS'], "Comment Posting By Time""http://www.fotomaf.com/images/tile.gif"true);
//End Comment Activity By Time

//Start Vote Activity By Time
activityGraph("vote_time"$CONFIG['TABLE_VOTES'], "Voting Activity By Time""http://www.fotomaf.com/images/tile.gif");
//End Vote Activity By Time

//Start Viewing Activity By Time
//check to make sure hit_stats table exists
if(isset($CONFIG['TABLE_HIT_STATS']))
{
activityGraph("sdate"$CONFIG['TABLE_HIT_STATS'], "Viewing Activity By Time""http://www.fotomaf.com/images/tile.gif");
}
//End Viewing Activity By Time


pagefooter();

$signature 'Coppermine Photo Gallery ' COPPERMINE_VERSION ' ('COPPERMINE_VERSION_STATUS ')';

?>

Nibbler

  • Guest
Re: MOD: Detailed Gallery Statistics
« Reply #67 on: September 14, 2006, 02:38:30 pm »

You need to change "sdate" to "FROM_UNIXTIME(sdate)"
Logged

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #68 on: September 14, 2006, 04:47:38 pm »

Nibbler
thanks
that's works fine now!!

Farnsi

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 177
Re: MOD: Detailed Gallery Statistics
« Reply #69 on: October 14, 2006, 03:22:33 pm »

i was kind of surprised as i looked at the link from fotomaf: http://www.fotomaf.com/galleryStats.php
his stats are far more detailed than mine. is there a chance to have mine looking like the one of fotomaf?
my gallerystats: Link
i`d like to have 2 rows of thumbnails and the tabs below them, too. did i do anything "wrong" while implenting the mod or..?!
« Last Edit: September 10, 2008, 11:36:10 pm by Farnsi »
Logged
Regards,
Farnsi

Farnsi

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 177
Re: MOD: Detailed Gallery Statistics
« Reply #70 on: October 14, 2006, 03:26:17 pm »

this is how my stats.php looks like.
sorry for the doublepost, never noticed that one cannot edit one's posting.
Logged
Regards,
Farnsi

pslawinski

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • Lighting-Gallery.net
Re: MOD: Detailed Gallery Statistics
« Reply #71 on: October 14, 2006, 05:01:10 pm »

You would have to ask fotomaf to post his code.  It looks like he obviously changed a few things.
Logged

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #72 on: October 27, 2006, 12:52:42 pm »

Sorry for the delay Farsni

My code is

Code: [Select]
<?php

define
('IN_COPPERMINE'true);

require(
'include/init.inc.php');
pageheader("Gallery Statistics");

print(
'<center><h1 align="center" class="tableh1"><a href="http://www.fotomaf.com/estadisticas/" title="Estadisticas"><font  color="#ffffff"> Esta galer&iacute;a ha sido visitada <img src="http://www.fotomaf.com/estadisticas/showhits.php?id=Mauro&st=img" /> veces. </font></a></center></h1> ');

//Activity Graph Function
function activityGraph($cellName$tableName$title$barTile$notCtime=false)
{
global $CONFIG;
starttable('100%'$title26);

$query "SELECT COUNT(*) AS number, HOUR($cellName) AS period FROM $tableName GROUP BY HOUR($cellName) ";
$result cpg_db_query ($query);
while ($row mysql_fetch_assoc($result)) $rowset[$row['period']] = $row['number'];
mysql_free_result($result);
print('<tr><td align="center" colspan="26"><b>Hora del d&iacute;a</b></td></tr>');
print('<tr><td align="center" colspan="26" height="2"></td></tr>');
print('<tr><td align="center" colspan="26" height="2" bgcolor="#000000"></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td height="100" width="1" valign="bottom"><img src="images/spacer.gif" width="1" height="200" /></td>');

$total array_sum($rowset);
$max max($rowset);

foreach ($rowset as $number)
{
print('<td height="100%" width="4%" valign="bottom" align="center" style="font-size: 80%">'.round(($number/$total)*100,1).'%<br /><img src="'.$barTile.'" border="1" alt="" width="15" height="'.round(($number/$max)*200,0).'" /></td>');
}
print('<td height="100" width="1" valign="bottom"><img src="images/spacer.gif" width="1" height="200" /></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td align="center" colspan="26" height="2" bgcolor="#000000"></td></tr>');
print('<tr><td align="center" colspan="26" height="1"></td></tr>');
print('<tr><td></td>');
for($i '0'$i <= '23'$i++)
{
print('<td width="4%" align="center">'.$i.'</td>');
}
print('<td></td></tr>');

endtable();
print('<img src="images/spacer.gif" alt="" height="17 width="1" />');
}


       



display_thumbnails('lasthits'$cat1$CONFIG['thumbcols'], 4true);

display_thumbnails('toprated'$cat1$CONFIG['thumbcols'], 3true);

display_thumbnails('topn'$cat1$CONFIG['thumbcols'], 1true);
display_thumbnails('lastup'$cat1$CONFIG['thumbcols'], 3true);

//Start Most Commented
display_thumbnails('mostcom'$cat1$CONFIG['thumbcols'], 2true);
//End Most Commented

//Start Most Voted
display_thumbnails('mostvot'$cat1$CONFIG['thumbcols'], 2true);
//End Most Voted

//Start Album Most Commented
display_thumbnails('mostcomalb'$cat1$CONFIG['thumbcols'], 2true);
//End Album Most Commented

//Start Album Most Voted
display_thumbnails('mostvotalb'$cat1$CONFIG['thumbcols'], 2true);
//End Album Most Voted


//Start Album Most Viewed
display_thumbnails('mostviealb'$cat1$CONFIG['thumbcols'], 2true);
//End Album Most Viewed



//Start Upload Activity By Time
activityGraph("FROM_UNIXTIME(ctime)"$CONFIG['TABLE_PICTURES'], "hora de subida de fotos""http://www.fotomaf.com/images/tile.gif");
//End Upload Activity By Time

//Start Comment Activity By Time
activityGraph("msg_date"$CONFIG['TABLE_COMMENTS'], "Horas a las que mas se comenta""http://www.fotomaf.com/images/tile.gif"true);
//End Comment Activity By Time



//Start Viewing Activity By Time
//check to make sure hit_stats table exists
if(isset($CONFIG['TABLE_HIT_STATS']))
{
activityGraph("FROM_UNIXTIME(sdate)"$CONFIG['TABLE_HIT_STATS'], "Cuando me visita mas la gente""http://www.fotomaf.com/images/tile.gif");
}
//End Viewing Activity By Time


pagefooter();

$signature 'Coppermine Photo Gallery ' COPPERMINE_VERSION ' ('COPPERMINE_VERSION_STATUS ')';

?>

Farnsi

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 177
Re: MOD: Detailed Gallery Statistics
« Reply #73 on: October 29, 2006, 06:46:03 pm »

This is so great! thank you very much!  :)
Logged
Regards,
Farnsi

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #74 on: November 21, 2006, 09:21:59 am »

hi all!
I just update my gallery to the last stable version and mi GalleryStats.php doesn't work
Say "The album/file doesn't exist"
What is the change?

best regards

Nibbler

  • Guest
Re: MOD: Detailed Gallery Statistics
« Reply #75 on: November 21, 2006, 12:40:49 pm »

You probably failed to re-apply the modifications to include/functions.inc.php
Logged

Fotomaf

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 30
  • www.fotomaf.com gallery
    • Fotomaf Gallery
Re: MOD: Detailed Gallery Statistics
« Reply #76 on: November 21, 2006, 12:56:21 pm »

ok,
 forget my stupid question ;)
Thanks Nibber to the help
http://www.fotomaf.com/galleryStats.php works again fine ;)

Regards from Spain

Sebbit

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 25
    • PITA - stunt page
Re: MOD: Detailed Gallery Statistics
« Reply #77 on: November 29, 2006, 12:32:51 pm »

My galleryStats.php dosn't work and i get this error although the page is on my server. Anyone an idea why?
Logged

Sebbit

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 25
    • PITA - stunt page
Re: MOD: Detailed Gallery Statistics
« Reply #79 on: November 29, 2006, 02:39:04 pm »

Sorry I forget to say that I already use this modified code, doesn't work anyway...

See attachment...
Logged
Pages: 1 2 3 [4] 5   Go Up
 

Page created in 0.03 seconds with 21 queries.