forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Statistics => Topic started by: pslawinski on November 22, 2005, 05:34:56 am
-
I always wondered about what image in my gallery had the most comments or what time most of the files were uploaded at so I made this page that displays a lot of statistics about the gallery.
Tested with 1.4.x
theme.php
Add:
$template_sub_menu = <<<EOT
{BUTTONS}$template_sys_menu_spacer
<a href="galleryStats.php">Gallery Statistics<font color="#FF0000">(NEW)</font></a>
EOT;
Extract and upload galleryStats.php to your server and test.
Note: See reply #9 for 1.3.x compatible version.
See Reply #18 for 1.4.x rewritten version
See Reply #22 for 1.3.x rewritten version
The page is too big for a grab showing what it looks like so here is the demo (http://www.lighting-gallery.net/gallery/galleryStats.php)
-
doesnt seem to work on 1.3.5
Fatal error: Call to undefined function: cpg_db_query() in
........./public_html/galleryStats.php on line 114
-
that's why it's labelled to be for cpg1.4.x only.
Reason: renamed function. If you know your way around, you could try renaming all function calls in the mod.
-
i think i need to upgrade to 1.4 ;D
-
cpg1.4.x currently goes unsupported, not recommended for production use yet, and only recommended for experienced users. I'd wait a few days, we're currently preparing the stable release.
-
Even if you renamed cpg_db_query() this would not work on 1.3.5 unless you removed some of the other features as well. That reminds me of something I forgot to mention. Detailed logging must be turned on in order for this to work completely. Some of the data is taken from TABLE_VOTES and TABLE_HIT_STATS.
-
Does anyone know how difficult it would be to turn some of the stats I have shown ex: Most Commented Images into an album?
-
Fairly simple - file functions.inc.php is your friend - look at the function get_pic_data - then look at the index.php file to see how Meta Albums are handled
-
functions.inc.php
Yeah, saw the functions. I guess I just didn't feel like writing the code to make it work at the time so I just wrote some code to display the four images.
I'll try and get to that sometime soon and if I do I'll post the code.
-
doesnt seem to work on 1.3.5
Ok, I think this new version will work with previous versions. I only tested to make sure it was still compatible with 1.4.x. I need someone else to test for 1.3.x as I do not have a working version on my server.
All I did was create a wrappers for cpg_db_query() and cpg_db_fetch_rowset() if the functions are not defined. I also made sure the last two charts are not attempted to be displayed if the tables do not exist.
If anyone gets this working on a 1.3.x gallery please let me know or post a link.
EDIT: 11/22/05
I tested the mod with version 1.3.5 and it works. The updated file is attached to this post
-
I saw in your file that we can display ''Viewing Activity By Time'' but I dont see it when I use it. All other stats are there but not ''Viewing Activity By Time''.
Is there something I should do to be able to display this stats?
I'm using version 1.3.5.
Thanks.
-
Is it possible that custom thumbnails are not displayed? I have a video with a custom thumb in the ''most voted'' stats and I see a red X instead of the thumb. The same thing apply to the video album which is in the ''most viewd album'' stats (this album only contains videos with custom thumb).
Otherwise, all those thumbs are displayed properly everywhere else (outside gallerystats.php).
Claude
-
If anyone gets this working on a 1.3.x gallery please let me know or post a link.
Yes it works now :)
http://www.bollyville.com/galleryStats.php
-
I saw in your file that we can display ''Viewing Activity By Time'' but I dont see it when I use it.
Ok, viewing activity only works with version 1.4.x and then only if you have detailed view stats enabled.
-
Is it possible that custom thumbnails are not displayed?
Did you install a mod for custom thumbnails? If so then it will likely not work with that.
-
Yes it works now :)
http://www.bollyville.com/galleryStats.php
I see on your site you do not have an image for the bar graphs. Perhaps I forgot to mention how to fix that. Here is how to do that:
Find:
//Start Upload Activity By Time
activityGraph("ctime", $CONFIG['TABLE_PICTURES'], "Upload Activity By Time", "images/siteLayout/Contentpanel_Sidebar_05.gif");
//End Upload Activity By Time
//Start Comment Activity By Time
activityGraph("msg_date", $CONFIG['TABLE_COMMENTS'], "Comment Posting By Time", "images/siteLayout/Contentpanel_Sidebar_05.gif", true);
//End Comment Activity By Time
//Start Vote Activity By Time
//check to make sure votes table exists
if(isset($CONFIG['TABLE_VOTES']))
{
activityGraph("vote_time", $CONFIG['TABLE_VOTES'], "Voting Activity By Time", "images/siteLayout/Contentpanel_Sidebar_05.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", "images/siteLayout/Contentpanel_Sidebar_05.gif");
}
//End Viewing Activity By Time
First let me explain the function activityGraph($cellName, $tableName, $title, $barTile, $notCtime=false).
First argument is the coloum to select from, the second argument is the name of the table to select from, the third argument is the title of the graph e.g. "Upload Activity by Time", the fourth argument defines the location of the image to use for the bars, and the last argument is optional. When the last argument is set to true the function assumes that the data for date and time is in the MM/DD/YY HH:MM:SS format.
To change the image displayed change the values for the four function calls above to an image of your choosing.
EX:
activityGraph("exRow", $config['EXAMPLE_TABLE'], "Title of Graph", "images/myImage.jpg");
Attached to this post is an image you can use for the bars, just upload it to somewhere like images/tile.gif
-
Is it possible that custom thumbnails are not displayed?
Did you install a mod for custom thumbnails? If so then it will likely not work with that.
My custom thumbnails are made manualy as describe in the Coppermine doc. Is there a mod for custom thumb?
Claude
-
My custom thumbnails are made manualy as describe in the Coppermine doc. Is there a mod for custom thumb?
I'm in the process of rewriting this whole script. All the thumbs will be generated by coppermine defined functions. I will make several meta albums availible in the process. I've completed work on one check it out here (http://www.lighting-gallery.net/thumbnails.php?album=mostcom).
-
Rewritten script:
1.4.x Version if you want the 1.3.x version see Replay #22:
Update 11/30: Made a few minor changes to improve appearance.
Let me know if you encounter any problems.
Demo here (http://www.lighting-gallery.net/gallery/galleryStats.php)
theme.php
Add:
$template_sub_menu = <<<EOT
{BUTTONS}$template_sys_menu_spacer
<a href="galleryStats.php">Gallery Statistics<font color="#FF0000">(NEW)</font></a>
EOT;
include/functions.inc.php
Find:
function build_caption(&$rowset,$must_have=array())
Replace With:
function build_caption(&$rowset,$must_have=array(), $custInfo=array(), $indexType='')
Find:
$rowset[$key]['caption_text'] = $caption;
Replace with:
if($custInfo != '')
{
switch($indexType)
{
case 'usrcom':
$index = $row['owner_id'];
$caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $custInfo[$index]);
$caption .='</span>';
break;
case 'usrvot':
$index = $row['owner_id'];
$caption .= "<span class=\"thumb_caption\">".sprintf($lang_get_pic_data['n_votes'], $custInfo[$index]);
$caption .='</span>';
break;
case 'usrvie':
$index = $row['owner_id'];
$caption .= "<span class=\"thumb_title\">".sprintf($lang_get_pic_data['n_views'], $custInfo[$index]);
$caption .='</span>';
break;
case 'albcom':
$index = $row['aid'];
$caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $custInfo[$index]);
$caption .='</span>';
break;
case 'albvot':
$index = $row['aid'];
$caption .= "<span class=\"thumb_caption\">".sprintf($lang_get_pic_data['n_votes'], $custInfo[$index]);
$caption .='</span>';
break;
case 'albvie':
$index = $row['aid'];
$caption .= "<span class=\"thumb_title\">".sprintf($lang_get_pic_data['n_views'], $custInfo[$index]);
$caption .='</span>';
break;
}
}
$rowset[$key]['caption_text'] = $caption;
Find:
default : // Invalid meta album
Replace with
case 'mostcom': //Most Commented Images
$album_name = "Most Commented Images";
$query = "SELECT pid FROM {$CONFIG['TABLE_COMMENTS']}";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$index = $row[0];
$mostCommented[$index] = @$mostCommented[$index] + 1;
}
$count = count($mostCommented);
arsort($mostCommented, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommented),$limit1,$limit2) as $image)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.pid = '$image' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
$preVal = $CONFIG['display_comment_count'];
$CONFIG['display_comment_count'] = 1;
if ($set_caption) build_caption($rowset,array('ctime'));
$CONFIG['display_comment_count'] = $preVal;
return $rowset;
break;
case 'mostvot': // Most Voted on Images
$album_name = "Most Voted on Images";
$query = "SELECT pid, votes FROM {$CONFIG['TABLE_PICTURES']}";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostVoted[$row[0]] = $row[1];
}
$count = count($mostVoted);
arsort($mostVoted, SORT_NUMERIC);
foreach(array_slice(array_keys($mostVoted),$limit1,$limit2) as $image)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.pid = '$image' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array('ctime', 'pic_rating'));
return $rowset;
break;
case 'mostcomusr': // Most Commented Users
$album_name = "Most Commented Users";
$query = "SELECT owner_id FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$mostCommentedUser[$row[0]] = @$mostCommentedUser[$row[0]] + 1;
}
$count = count($mostCommentedUser);
arsort($mostCommentedUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommentedUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostCommentedUser, 'usrcom');
return $rowset;
break;
case 'mostvotusr': // Most Voted on Users
$album_name = "Most Voted on Users";
$query = "SELECT owner_id, votes FROM {$CONFIG['TABLE_PICTURES']}";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostVotedUser[$row[0]] = @$mostVotedUser[$row[0]] + $row[1];
}
$count = count($mostVotedUser);
arsort($mostVotedUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostVotedUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostVotedUser, 'usrvot');
return $rowset;
break;
case 'mostvieusr': // Users With the Most Views
$album_name = "Users With the Most Views";
$query = "SELECT owner_id, hits FROM {$CONFIG['TABLE_PICTURES']}";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostViewedUser[$row[0]] = @$mostViewedUser[$row[0]] + $row[1];
}
$count = count($mostViewedUser);
arsort($mostViewedUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostViewedUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostViewedUser, 'usrvie');
return $rowset;
break;
case 'topcom': // Top Commenters
$album_name = "Top Commenters";
$query = "SELECT author_id FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$mostCommentingUser[$row[0]] = @$mostCommentingUser[$row[0]] + 1;
}
$count = count($mostCommentingUser);
arsort($mostCommentingUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommentingUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostCommentingUser, 'usrcom');
return $rowset;
break;
case 'mostcomalb': // Most Commented Album
$album_name = "Most Commented Album";
$query = "SELECT aid FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$mostCommentedAlbum[$row[0]] = @$mostCommentedAlbum[$row[0]] + 1;
}
$count = count($mostCommentedAlbum);
arsort($mostCommentedAlbum, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommentedAlbum),$limit1,$limit2) as $album)
{
$query = "SELECT *,a.title AS title FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = '$album' AND a.aid = '$album' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostCommentedAlbum, 'albcom');
return $rowset;
break;
case 'mostvotalb': // Most Voted on Album
$album_name = "Most Voted on Album";
$query = "SELECT aid, votes FROM {$CONFIG['TABLE_PICTURES']}";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostVotedAlbum[$row[0]] = @$mostVotedAlbum[$row[0]] + $row[1];
}
$count = count($mostVotedAlbum);
arsort($mostVotedAlbum, SORT_NUMERIC);
foreach(array_slice(array_keys($mostVotedAlbum),$limit1,$limit2) as $album)
{
$query = "SELECT *,a.title AS title FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = '$album' AND a.aid = '$album' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostVotedAlbum, 'albvot');
return $rowset;
break;
case 'mostviealb': // Most Viewed Album
$album_name = "Most Viewed Album";
$query = "SELECT aid, hits FROM {$CONFIG['TABLE_PICTURES']}";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostViewedAlbum[$row[0]] = @$mostViewedAlbum[$row[0]] + $row[1];
}
$count = count($mostViewedAlbum);
arsort($mostViewedAlbum, SORT_NUMERIC);
foreach(array_slice(array_keys($mostViewedAlbum),$limit1,$limit2) as $album)
{
$query = "SELECT *,a.title AS title FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = '$album' AND a.aid = '$album' ";
$result = cpg_db_query($query);
$rowsets[] = cpg_db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostViewedAlbum, 'albvie');
return $rowset;
break;
default : // Invalid meta album
Create:
galleryStats.php
<?php
define('IN_COPPERMINE', true);
require('include/init.inc.php');
pageheader("Gallery Statistics");
//Activity Graph Function
function activityGraph($cellName, $tableName, $title, $barTile, $notCtime=false)
{
global $CONFIG;
starttable("100%", $title, 25);
$query = "SELECT $cellName FROM $tableName";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
$uploadTimes = array();
$total = 0;
foreach($rowset as $row)
{
if($notCtime)
{
//Get hours from date/time string
$split1 = explode(' ', $row[0]);
$split2 = explode(':', $split1[1]);
$hour = $split2[0];
}
else
{
$hour = strftime("%H",$row[0]);
}
switch($hour)
{
case '00':
$index = 0;
break;
case '01':
$index = 1;
break;
case '02':
$index = 2;
break;
case '03':
$index = 3;
break;
case '04':
$index = 4;
break;
case '05':
$index = 5;
break;
case '06':
$index = 6;
break;
case '07':
$index = 7;
break;
case '08':
$index = 8;
break;
case '09':
$index = 9;
break;
default:
$index = $hour;
}
$uploadTimes[$index] = @$uploadTimes[$index] + 1;
$total++;
}
ksort($uploadTimes, SORT_NUMERIC);
print('<tr><td align="center" colspan="26"><b>Time of Day (GMT'.$CONFIG['time_offset'].')</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>');
for($i = '0'; $i <= '23'; $i++)
{
if(isset($uploadTimes[$i]))
{
print('<td height="100" width="4%" valign="bottom" align="center" style="font-size: 80%">'.round($uploadTimes[$i]/$total*'100',0).'%<br /><img src="'.$barTile.'" border="1" alt="" width="15" height="'.round($uploadTimes[$i]/$total*'200',0).'" /></td>');
}
else
{
print('<td height="100" width="4%"></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', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Most Commented
//Start Most Voted
display_thumbnails('mostvot', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Most Voted
//Start Most Viewed
display_thumbnails('topn', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Most Viewed
//Start User Most Commented
display_thumbnails('mostcomusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Commented
//Start User Most Voted
display_thumbnails('mostvotusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Voted
//Start User Most Viewed
display_thumbnails('mostvieusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Viewed
//Start User Most Commenting
display_thumbnails('topcom', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Commenting
//Start Album Most Commented
display_thumbnails('mostcomalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Commented
//Start Album Most Voted
display_thumbnails('mostvotalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Voted
//Start Album Most Viewed
display_thumbnails('mostviealb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Viewed
//Start Upload Activity By Time
activityGraph("ctime", $CONFIG['TABLE_PICTURES'], "Upload Activity By Time", "images/siteLayout/Contentpanel_Sidebar_05.gif");
//End Upload Activity By Time
//Start Comment Activity By Time
activityGraph("msg_date", $CONFIG['TABLE_COMMENTS'], "Comment Posting By Time", "images/siteLayout/Contentpanel_Sidebar_05.gif", true);
//End Comment Activity By Time
//Start Vote Activity By Time
activityGraph("vote_time", $CONFIG['TABLE_VOTES'], "Voting Activity By Time", "images/siteLayout/Contentpanel_Sidebar_05.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", "images/siteLayout/Contentpanel_Sidebar_05.gif");
}
//End Viewing Activity By Time
pagefooter();
$signature = 'Coppermine Photo Gallery ' . COPPERMINE_VERSION . ' ('. COPPERMINE_VERSION_STATUS . ')';
?>
-
You can add the following code in addition to the code in the last post to make the albums used on the galleryStats.php page availible on the front page. You add them to the front page the same way you would any other meta album ex: topn,2/mostcom,2/mostvot,2
index.php
Find:
case 'anycontent':
Replace With:
case 'mostcom':
display_thumbnails('mostcom', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostvot':
display_thumbnails('mostvot', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostcomusr':
display_thumbnails('mostcomusr', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostvotusr':
display_thumbnails('mostvotusr', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostvieusr':
display_thumbnails('mostvieusr', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'topcom':
display_thumbnails('topcom', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostcomalb':
display_thumbnails('mostcomalb', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostvotalb':
display_thumbnails('mostvotalb', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'mostviealb':
display_thumbnails('mostviealb', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'anycontent':
You can also add links in your gallery sub menu to the albums.
<a href="/thumbnails.php?album=exampleAlbum">Example Link</a>
-
Is there any chances that you write this mod for cpg 1.3.5? Is there a lot of codes to change?
-
Is there any chances that you write this mod for cpg 1.3.5? Is there a lot of codes to change?
I don't think there is much to change. I think all I have to do is rename cpg_db_query() to db_query().
I can try, but I don't have a great method of testing the script on 1.3.x, my testing setup only has one image...
If anyone from the dev team sees this can you tell me if there are any major differences in the way meta albums are handled between 1.3.x and 1.4.x?
-
Rewritten script:
All references to cpg_db_ were changed to db_
Let me know if you encounter any problems.
Code for index.php is the same for 1.3.x and can be found in reply #19
Demo here (http://www.lighting-gallery.net/galleryStats.php)
theme.php
Add:
$template_sub_menu = <<<EOT
{BUTTONS}$template_sys_menu_spacer
<a href="galleryStats.php">Gallery Statistics<font color="#FF0000">(NEW)</font></a>
EOT;
include/functions.inc.php
Find:
// Retrieve the data for a picture or a set of picture
function get_pic_data($album, &$count, &$album_name, $limit1=-1, $limit2=-1, $set_caption = true)
Replace With:
function build_caption(&$rowset,$must_have=array(), $custInfo=array(), $indexType='')
{
global $CONFIG, $THEME_DIR;
global $album_date_fmt, $lastcom_date_fmt, $lastup_date_fmt, $lasthit_date_fmt, $cat;
global $lang_get_pic_data, $lang_meta_album_names, $lang_errors;
foreach ($rowset as $key => $row)
{
$caption='';
$caption .= ($row['title']) ? '<span class="thumb_title">' . $row['title'] . '</span>' : '';
if ($CONFIG['views_in_thumbview'] || in_array('hits',$must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']).'</span>';
}
if ($CONFIG['caption_in_thumbview']){
$caption .= $row['caption'] ? "<span class=\"thumb_caption\">".strip_tags(bb_decode($row['caption']))."</span>" : '';
}
if ($CONFIG['display_comment_count']) {
$comments_nr = count_pic_comments($row['pid']);
if ($comments_nr > 0) {
$caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $comments_nr )."</span>";
}
}
if ($CONFIG['display_uploader'] /*&& !in_array($row['owner_id'],$CONFIG['ADMIN_USERS']) *|| ($CONFIG['display_admin_uploader'] && in_array($row['owner_id'],$CONFIG['ADMIN_USERS']))*/) {
$caption .= ($row['owner_id'] && $row['owner_name']) ? '<span class="thumb_title"><a href ="profile.php?uid='.$row['owner_id'].'">'.$row['owner_name'].'</a></span>' : '';
}
if (in_array('msg_date',$must_have)) {
$caption .= '<span class="thumb_caption">'.localised_date($row['msg_date'], $lastcom_date_fmt).'</span>';
}
if (in_array('msg_body',$must_have)) {
$msg_body = strip_tags(bb_decode($row['msg_body'])); // I didn't want to fully bb_decode the message where report to admin isn't available. -donnoman
$msg_body = utf_strlen($msg_body) > 50 ? utf_substr($msg_body,0,50).'...': $msg_body;
if ($CONFIG['enable_smilies']) $msg_body = process_smilies($msg_body);
if ($row['author_id']) {
$caption .= '<span class="thumb_caption"><a href ="profile.php?uid='.$row['author_id'].'"><font color="#000000" style="text-decoration:underline">'.$row['msg_author'].'</font></a>: '.$msg_body.'</span>';
} else {
$caption .= '<span class="thumb_caption">'.$row['msg_author'].': '.$msg_body.'</span>';
}
}
if (in_array('ctime',$must_have)) {
$caption .= '<span class="thumb_caption">'.localised_date($row['ctime'], $lastup_date_fmt).'</span>';
}
if (in_array('pic_rating',$must_have)) {
if (defined('THEME_HAS_RATING_GRAPHICS')) {
$prefix= $THEME_DIR;
} else {
$prefix= '';
}
$caption .= "<span class=\"thumb_caption\">".'<img src="'.$prefix.'images/rating'.round($row['pic_rating']/2000).'.gif" alt=""/>'.'<br />'.sprintf($lang_get_pic_data['n_votes'], $row['votes']).'</span>';
}
if (in_array('mtime',$must_have)) {
$caption .= "<span class=\"thumb_caption\">".localised_date($row['mtime'], $lasthit_date_fmt);
if (GALLERY_ADMIN_MODE) {
$caption .="<br/>".$row['lasthit_ip'];
}
$caption .='</span>';
}
if($custInfo != '')
{
switch($indexType)
{
case 'usrcom':
$index = $row['owner_id'];
$caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $custInfo[$index]);
$caption .='</span>';
break;
case 'usrvot':
$index = $row['owner_id'];
$caption .= "<span class=\"thumb_caption\">".sprintf($lang_get_pic_data['n_votes'], $custInfo[$index]);
$caption .='</span>';
break;
case 'usrvie':
$index = $row['owner_id'];
$caption .= "<span class=\"thumb_title\">".sprintf($lang_get_pic_data['n_views'], $custInfo[$index]);
$caption .='</span>';
break;
case 'albcom':
$index = $row['aid'];
$caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $custInfo[$index]);
$caption .='</span>';
break;
case 'albvot':
$index = $row['aid'];
$caption .= "<span class=\"thumb_caption\">".sprintf($lang_get_pic_data['n_votes'], $custInfo[$index]);
$caption .='</span>';
break;
case 'albvie':
$index = $row['aid'];
$caption .= "<span class=\"thumb_title\">".sprintf($lang_get_pic_data['n_views'], $custInfo[$index]);
$caption .='</span>';
break;
}
}
$rowset[$key]['caption_text'] = $caption;
}
}
// Retrieve the data for a picture or a set of picture
function get_pic_data($album, &$count, &$album_name, $limit1=-1, $limit2=-1, $set_caption = true)
Find:
default : // Invalid meta album
Replace with
case 'mostcom': //Most Commented Images
$album_name = "Most Commented Images";
$query = "SELECT pid FROM {$CONFIG['TABLE_COMMENTS']}";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$index = $row[0];
$mostCommented[$index] = @$mostCommented[$index] + 1;
}
$count = count($mostCommented);
arsort($mostCommented, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommented),$limit1,$limit2) as $image)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.pid = '$image' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
$preVal = $CONFIG['display_comment_count'];
$CONFIG['display_comment_count'] = 1;
if ($set_caption) build_caption($rowset,array('ctime'));
$CONFIG['display_comment_count'] = $preVal;
return $rowset;
break;
case 'mostvot': // Most Voted on Images
$album_name = "Most Voted on Images";
$query = "SELECT pid, votes FROM {$CONFIG['TABLE_PICTURES']}";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostVoted[$row[0]] = $row[1];
}
$count = count($mostVoted);
arsort($mostVoted, SORT_NUMERIC);
foreach(array_slice(array_keys($mostVoted),$limit1,$limit2) as $image)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.pid = '$image' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array('ctime', 'pic_rating'));
return $rowset;
break;
case 'mostcomusr': // Most Commented Users
$album_name = "Most Commented Users";
$query = "SELECT owner_id FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$mostCommentedUser[$row[0]] = @$mostCommentedUser[$row[0]] + 1;
}
$count = count($mostCommentedUser);
arsort($mostCommentedUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommentedUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostCommentedUser, 'usrcom');
return $rowset;
break;
case 'mostvotusr': // Most Voted on Users
$album_name = "Most Voted on Users";
$query = "SELECT owner_id, votes FROM {$CONFIG['TABLE_PICTURES']}";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostVotedUser[$row[0]] = @$mostVotedUser[$row[0]] + $row[1];
}
$count = count($mostVotedUser);
arsort($mostVotedUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostVotedUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostVotedUser, 'usrvot');
return $rowset;
break;
case 'mostvieusr': // Users With the Most Views
$album_name = "Users With the Most Views";
$query = "SELECT owner_id, hits FROM {$CONFIG['TABLE_PICTURES']}";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostViewedUser[$row[0]] = @$mostViewedUser[$row[0]] + $row[1];
}
$count = count($mostViewedUser);
arsort($mostViewedUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostViewedUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
$rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostViewedUser, 'usrvie');
return $rowset;
break;
case 'topcom': // Top Commenters
$album_name = "Top Commenters";
$query = "SELECT author_id FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$mostCommentingUser[$row[0]] = @$mostCommentingUser[$row[0]] + 1;
}
$count = count($mostCommentingUser);
arsort($mostCommentingUser, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommentingUser),$limit1,$limit2) as $user)
{
$query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$user' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostCommentingUser, 'usrcom');
return $rowset;
break;
case 'mostcomalb': // Most Commented Album
$album_name = "Most Commented Album";
$query = "SELECT aid FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
$mostCommentedAlbum[$row[0]] = @$mostCommentedAlbum[$row[0]] + 1;
}
$count = count($mostCommentedAlbum);
arsort($mostCommentedAlbum, SORT_NUMERIC);
foreach(array_slice(array_keys($mostCommentedAlbum),$limit1,$limit2) as $album)
{
$query = "SELECT *,a.title AS title FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = '$album' AND a.aid = '$album' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostCommentedAlbum, 'albcom');
return $rowset;
break;
case 'mostvotalb': // Most Voted on Album
$album_name = "Most Voted on Album";
$query = "SELECT aid, votes FROM {$CONFIG['TABLE_PICTURES']}";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostVotedAlbum[$row[0]] = @$mostVotedAlbum[$row[0]] + $row[1];
}
$count = count($mostVotedAlbum);
arsort($mostVotedAlbum, SORT_NUMERIC);
foreach(array_slice(array_keys($mostVotedAlbum),$limit1,$limit2) as $album)
{
$query = "SELECT *,a.title AS title FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = '$album' AND a.aid = '$album' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostVotedAlbum, 'albvot');
return $rowset;
break;
case 'mostviealb': // Most Viewed Album
$album_name = "Most Viewed Album";
$query = "SELECT aid, hits FROM {$CONFIG['TABLE_PICTURES']}";
$result = db_query($query);
$rowset = db_fetch_rowset($result);
mysql_free_result($result);
foreach($rowset as $row)
{
if($row[1] != 0) $mostViewedAlbum[$row[0]] = @$mostViewedAlbum[$row[0]] + $row[1];
}
$count = count($mostViewedAlbum);
arsort($mostViewedAlbum, SORT_NUMERIC);
foreach(array_slice(array_keys($mostViewedAlbum),$limit1,$limit2) as $album)
{
$query = "SELECT *,a.title AS title FROM {$CONFIG['TABLE_PICTURES']} as p, {$CONFIG['TABLE_ALBUMS']} as a WHERE p.aid = '$album' AND a.aid = '$album' ";
$result = db_query($query);
$rowsets[] = db_fetch_rowset($result);
mysql_free_result($result);
}
$rowset = array();
foreach($rowsets as $row)
{
if($row[0] != NULL) $rowset[] = $row[0];
}
if ($set_caption) build_caption($rowset,array(), $mostViewedAlbum, 'albvie');
return $rowset;
break;
default : // Invalid meta album
Extract galleryStats13X.zip into your main directory.
-
I cant find the first code to replace in include/functions.inc.php
Code: function build_caption(&$rowset,$must_have=array()) ???
I am using cpg 1.3.5
-
I have rewritten the code to be compatible with 1.3.x and it has been tested. You can find the working code in Reply #22.
-
Thanks it is working fine with cpg 1.3.5 ;D
I might have something I want to change. Can you give me a hint on how to do it? I have tried but I am not a programmer...
I would like to remove the picture views under the thumbnail in almost all sections:
Top Commenters
Most Voted on Album
Most Commented Album
Users With the Most Views
Most Voted on Users
Most Commented Users
Most Voted on Images
Most Commented Images
I would like to avoid some confusion with the album views or comments numbers (displayed lower). In fact, I would like to have it displayed as on your web site.
Thanks again for your work!
-
I might have something I want to change. Can you give me a hint on how to do it? I have tried but I am not a programmer...
I would like to remove the picture views under the thumbnail in almost all sections:
That should be an easy fix. I'll see what I can do.
-
For 1.3.X if you want to disable page views below thumbnails find the following code:
if ($CONFIG['views_in_thumbview'] || in_array('hits',$must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']).'</span>';
}
Comment it out:
/*
if ($CONFIG['views_in_thumbview'] || in_array('hits',$must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']).'</span>';
}
*/
-
Thanks a lot.
It is working great... ;D
-
Damn, I cant get it to work.
When I have done those changes, just an emphty page comes up, nothing else. Weird, and I just wanted to get the amoun of views of the files, amount of comments and so on.
Im using the newest version available, 1.4.3?
-
I don't know if there were any changes in 1.4.3 that would affect this. I use 1.4.2.
Try turning debug mode on and see if there are any errors or notices. I need a little more information to help you.
-
It`s impossible to put that in that debug mode. The site becomes just plank. There`s nothing.
Is there another way to just get the amount of views that visitors have done, amount of pictures and so on?
I have deactivated the category list so the normal stats have gone. And I dont want the damn category list back
-
I don't know what to tell you to do. I have not used the new version so I have no Idea whether something has been changed that would cause this mod not to work. I also don't have enough information from what you've told me to do anything. Try posting your source code or something so I can get a better idea of what you are talking about.
-
It`s impossible to put that in that debug mode. The site becomes just plank. There`s nothing.
Fix this issue first before applying the mod, it's a serious error if you can't enable debug_mode. Start a new thread on the proper board for this. When your gallery is fine again (and you can use debug_mode), return to this thread and try re-applying the mod. Usually, mods written for cpg1.4.2 can be used with cpg1.4.3, as cpg1.4.3 only fixes bugs that existed in cpg1.4.2 - it doesn't add new features.
-
GauGau is it even possible to get those normal stats - that come when you add the category list to the frontpage - to work without that category list.
(Notice. doesn`t have anything to do with this thread)
-
(Notice. doesn`t have anything to do with this thread)
Then don't clutter the thread with unrelated replies.
-
Is it possible that custom thumbnails are not displayed? I have a video with a custom thumb in the ''most voted'' stats and I see a red X instead of the thumb. The same thing apply to the video album which is in the ''most viewd album'' stats (this album only contains videos with custom thumb).
Otherwise, all those thumbs are displayed properly everywhere else (outside gallerystats.php).
Claude
I have the same problem. I am using version 1.4.3
-
Right click on the picture and get the URL of the image that is not showing up. Maybe I can be of some assistance but I need more information about the problem. Also keep in mind that this mod was never made to work with custom thumbnails, that's something you'll have to do yourself.
-
The URL of one of the images not showing is:
http://claudebriere.net/coppermine/displayimage.php?pos=-260
You can check the gallerystats here: http://claudebriere.net/coppermine/galleryStats.php
For videos, I want to have a custum thumb because I dont want the same ''Coppermine thumb'' for all videos.
So, I make a custom thumb (using Coppermine doc technique: http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#cust_thmb) and I put the image used to produce the custom thumb in a private album that is not available for public.
Let me know if you have any suggestions...
Thanks.
-
Are you using the latest version of this mod? I rewrote the mod to use the built-in functions for meta albums. If the custom thumbnails still do not display correctly then you will have to modify the code for displaying meta albums.
-
I downloaded the zip version this week-end for the first post of this thread. Is it the latest version?
-
No, see the one posted on: November 29, 2005, 04:43:20 AM (GMT-6)
-
Now that I have updated to cpg1.4.3 I would have the same request as here:
Thanks it is working fine with cpg 1.3.5 ;D
I might have something I want to change. Can you give me a hint on how to do it? I have tried but I am not a programmer...
I would like to remove the picture views under the thumbnail in almost all sections:
Top Commenters
Most Voted on Album
Most Commented Album
Users With the Most Views
Most Voted on Users
Most Commented Users
Most Voted on Images
Most Commented Images
I would like to avoid some confusion with the album views or comments numbers (displayed lower). In fact, I would like to have it displayed as on your web site.
Thanks again for your work!
I have tried the following (in function.inc) but it remove all pictures views from all pages.
For 1.3.X if you want to disable page views below thumbnails find the following code:
if ($CONFIG['views_in_thumbview'] || in_array('hits',$must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']).'</span>';
}
Comment it out:
/*
if ($CONFIG['views_in_thumbview'] || in_array('hits',$must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']).'</span>';
}
*/
Can you give me a hint?
Thanks
-
Try turning off the views in thumbnail caption setting.
-
to re-arange the order of the categories, do can I change the placement of
//Start Album Most Commented
display_thumbnails('mostcomalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Commented
? Or, is there another way? Thanks.
-
Yes, just move those around.
-
thank you!! ;)
-
I like this mod; and I also like the Top 10 mod too (http://forum.coppermine-gallery.net/index.php?topic=8405.0). I was wondering if someone is interested in adding the top 10 to this mod. I think it is better to have all stats on one single page. What is the general opinion on this?
-
I don't know the general opinion, but mine is that we should avoid thread drift, particularly on mod threads. This means: don't post questions on a mod's thread that refers to another mod. If you have modded those two mods into one, then start a new thread about your mini mod-pack. If you're not able to do so, then please don't clutter the mod threads.
-
I have this problem .. http://photos.pelhrim.cz/galleryStats.php
-
your page is slow. Don't clutter it with mods that eat a lot of resources - this mod is not meant for you. Ask a proper question, don't make us hunt for any issues you have.
-
NO, try it again. your reply is ???
-
last warning before ban! I mean it >:(
-
;D ;D ;D Are you crazy ?
-
yes, I am. Goodbye! Review your attitude. You have 10 days during which you will not be able to post. Next ban will be permanent.
-
Hello,
I have applied your mod to my current installation
CPG v. 1.4.3 (probably going to upgrade to the newest version in a few days)
But I make it work.
http://www.partynation.tv/coppermine/galleryStats.php
That's the adress.
Okay, the error usually apears when the file rights aren't set properly, but I checked it twice and they are exactly what they should be.
so that can't be the problem.
Do you have any idea what this could be?
Thanks for any hint how to fix this.
-
This looks like a server error, not an error with the mod.
-
CPG v. 1.4.3 (probably going to upgrade to the newest version in a few days)
It's mandatory to upgrade asap! Do not delay, your gallery is vulnerable if you don't. There's little point in fiddling with mods if you have huge security gaps wide open.
-
It's mandatory to upgrade asap! Do not delay, your gallery is vulnerable if you don't. There's little point in fiddling with mods if you have huge security gaps wide open.
Well, I'm going to, but you really need time to do that, at least 1 or 2 hours... and that's more that I currently have.
But thanks...
Mhh... and it seems that my webserver has some toubles with files rights.
Sorry for posting here, this is definetly not a cpg or mod prob.
-
I have a spanish 1.4.8 version
Will be have any problem I follow the steps of the #18 reply with not success
regards from Spain
-
I'm not sure what you're asking.
-
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
-
Turn on Debug Mode and post the text provided at the bottom of the page with the error.
-
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)
SELECT pid FROM {$CONFIG['TABLE_COMMENTS']}
2nd SQL: For every of the Top 5 commented pics, get more infos from the db:
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.
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.
-
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
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
$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
-
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.
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" />');
}
-
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 ;)
<?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%', $title, 26);
$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', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Most Commented
//Start Most Voted
display_thumbnails('mostvot', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Most Voted
//Start Most Viewed
display_thumbnails('topn', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Most Viewed
//Start User Most Commented
display_thumbnails('mostcomusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Commented
//Start User Most Voted
display_thumbnails('mostvotusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Voted
//Start User Most Viewed
display_thumbnails('mostvieusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Viewed
//Start User Most Commenting
display_thumbnails('topcom', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Commenting
//Start Album Most Commented
display_thumbnails('mostcomalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Commented
//Start Album Most Voted
display_thumbnails('mostvotalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Voted
//Start Album Most Viewed
display_thumbnails('mostviealb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//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 . ')';
?>
-
You need to change "sdate" to "FROM_UNIXTIME(sdate)"
-
Nibbler
thanks
that's works fine now!!
-
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 (http://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..?!
-
this is how my stats.php looks like.
sorry for the doublepost, never noticed that one cannot edit one's posting.
-
You would have to ask fotomaf to post his code. It looks like he obviously changed a few things.
-
Sorry for the delay Farsni
My code is
<?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í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%', $title, 26);
$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í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', $cat, 1, $CONFIG['thumbcols'], 4, true);
display_thumbnails('toprated', $cat, 1, $CONFIG['thumbcols'], 3, true);
display_thumbnails('topn', $cat, 1, $CONFIG['thumbcols'], 1, true);
display_thumbnails('lastup', $cat, 1, $CONFIG['thumbcols'], 3, true);
//Start Most Commented
display_thumbnails('mostcom', $cat, 1, $CONFIG['thumbcols'], 2, true);
//End Most Commented
//Start Most Voted
display_thumbnails('mostvot', $cat, 1, $CONFIG['thumbcols'], 2, true);
//End Most Voted
//Start Album Most Commented
display_thumbnails('mostcomalb', $cat, 1, $CONFIG['thumbcols'], 2, true);
//End Album Most Commented
//Start Album Most Voted
display_thumbnails('mostvotalb', $cat, 1, $CONFIG['thumbcols'], 2, true);
//End Album Most Voted
//Start Album Most Viewed
display_thumbnails('mostviealb', $cat, 1, $CONFIG['thumbcols'], 2, true);
//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 . ')';
?>
-
This is so great! thank you very much! :)
-
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
-
You probably failed to re-apply the modifications to include/functions.inc.php
-
ok,
forget my stupid question ;)
Thanks Nibber to the help
http://www.fotomaf.com/galleryStats.php works again fine ;)
Regards from Spain
-
My galleryStats.php dosn't work and i get this error (http://www.saugplatz.de/gallery/galleryStats.php) although the page is on my server. Anyone an idea why?
-
http://forum.coppermine-gallery.net/index.php?topic=23945.msg170221#msg170221
-
Sorry I forget to say that I already use this modified code, doesn't work anyway...
See attachment...
-
Comment out the calls to display_thumbnails() and activityGraph() until you find the statistic(s) that cause the problem.
-
these calls cause the problem:
//Start User Most Commented
//display_thumbnails('mostcomusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Commented
//Start User Most Voted
//display_thumbnails('mostvotusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Voted
//Start User Most Viewed
//display_thumbnails('mostvieusr', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Viewed
//Start User Most Commenting
//display_thumbnails('topcom', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End User Most Commenting
//Start Album Most Commented
//display_thumbnails('mostcomalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Commented
//Start Album Most Voted
//display_thumbnails('mostvotalb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Voted
//Start Album Most Viewed
//display_thumbnails('mostviealb', $cat, 1, $CONFIG['thumbcols'], 1, false);
//End Album Most Viewed
Under the Statistics there are the following notices:
Notices
/include/functions.inc.php
Notice line 1372: Undefined variable: mostCommented
Notice line 1372: Undefined index: 2
Notice line 1372: Undefined index: 5
Notice line 1372: Undefined index: 11
(...thousands of lines...)
Notice line 1372: Undefined index: 5643
... and there's line 1372 in /include/functions.inc.php
1369: foreach($rowset as $row)
1370: {
1371: $index = $row[0];
1372: $mostCommented[$index] = @$mostCommented[$index] + 1;
1373: }
What's wrong?
-
How can you modify the profile.php to display total number of comments made by the member of the profile you are viewing?
I think it would be in this area of the profile.php
$form_data = array('username' => $user_data['user_name'],
'reg_date' => localised_date($user_data['user_regdate'], $register_date_fmt),
'group' => $user_data['group_name'],
'user_profile1' => $user_data['user_profile1'],
'user_profile2' => $user_data['user_profile2'],
'user_profile3' => $user_data['user_profile3'],
'user_profile4' => $user_data['user_profile4'],
'user_profile5' => $user_data['user_profile5'],
'user_profile6' => bb_decode($user_data['user_profile6']),
'user_thumb' => $quick_jump,
'pic_count' => $pic_count,
);
But Im really not good at php yet, and have no idea what should go here.
Im just wanting it to add a Total Comments Made by this user line under total uploads, like
Username Bunny
Joined Feb 23, 2002
Location KY
Interests Drawing, painting, scrapping
Occupation retired
Files uploaded 100
Comments Given 100
-
This mod works very wel, but I want to modify it to show intermediate pictures only. And only on one of the 14 listed stats, the others will be removed so I am just left with one statistic..showing a list of internediate pictures.
How can this be done?
Regards
Wookie
-
very nice mod just one question.
I was looking at possibly adding the websites total hits at the very bottom of the stats page.
is this possible ???
-
Sorry for the stupid question, must be blond, but where do I view the stats?
Because if I go to the stats.php in my plugins folder I get this message "Not in Coppermine.."
-
This isn't related to this mod so I apologise beforehand for my post but I cant start a new thread. I've just installed a free Site Stat generator which is easy to implement on your server and integrate with coppermine, this will also provide you with very detailed stats for your site. You can check it out at: http://www.phpmyvisites.us/ (http://www.phpmyvisites.us/)
Once you have installed the site, enter the details of your coppermine gallery or website and the Stats will generate a small piece of Javascript which you can copy and insert into your template.html file. The SiteStats keeps track of all visitors, referrals, SE Keyword referrals, locations, etc. It doesn't take long to set-up so it is worth a look if you are wanting detailed stats for your gallery or site.
PS - Much apologies to the mods for posting here, is there any chance another thread can be set-up so users can list open source software they are using/implementing with Coppermine?
-
You indeed shouldn't have replied to this thread. You should/could have started a new thread on the support board instead - a moderator would have moved your thread if applicable. >:( Do not reply here with references to the page you're trying to promote.
-
Hi there, I have a weird problem
I have a Gallerystatistics running, accessable through a button, for everyone, but suddenly it doesnt anymore, if you click the button you get a blanc screen. Only when you login it works. But I didnt change anything..... Except that i changed to another fotoslider plugin function since that the previous also suddenly stopped in IE. Also the latest views are not shown.
The weird thing is also that the button also only shows when I state it in the theme.html AND in the config, while only stating it in the config should be enough.
I have checked everything, did the update to 1.4.20 but that didnt change anything.
I am at a loss here.....www.fotofantastic.nl
P.S. hitting the demopage showed in the first post also gives a blanc page
-
Hi there, I have a weird problem
I have a Gallerystatistics running, accessable through a button, for everyone, but suddenly it doesnt anymore, if you click the button you get a blanc screen. Only when you login it works. But I didnt change anything..... Except that i changed to another fotoslider plugin function since that the previous also suddenly stopped in IE. Also the latest views are not shown.
The weird thing is also that the button also only shows when I state it in the theme.html AND in the config, while only stating it in the config should be enough.
I have checked everything, did the update to 1.4.20 but that didnt change anything.
I am at a loss here.....www.fotofantastic.nl
P.S. hitting the demopage showed in the first post also gives a blanc page
Ok, I seem to have solved the thing by inserting the gallerystats.php from fotomaf, strange cause I already had done that once before, and also cleared the cache, but maybe I overlooked something else.