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: MOD: Upload Activity By Time  (Read 9884 times)

0 Members and 2 Guests are viewing this topic.

pslawinski

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • Lighting-Gallery.net
MOD: Upload Activity By Time
« on: November 20, 2005, 08:16:30 pm »

I got bored, so I wrote up a little script that will make a graph showing upload activity by time on the profile page for any  user.


profile.php

Find:
Code: [Select]
        pagefooter();
        ob_end_flush();
        break;
}

Replace with:
Note: Replace all references to images/siteLayout/Contentpanel_Sidebar_11.gif with your own image
Code: [Select]
//Upload Activity By Time
starttable(705, "Upload Activity By Time", 1);
$query = "SELECT ctime as uploadTime FROM {$CONFIG['TABLE_PICTURES']} as p WHERE p.owner_id = '$uid'";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
$uploadTimes = array();
$total = 0;
foreach($rowset as $row)
{
switch(strftime("%H",$row[0]))
{
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 = strftime("%H",$row[0]);
}
$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/siteLayout/Contentpanel_Sidebar_11.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="images/siteLayout/Contentpanel_Sidebar_05.gif" 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/siteLayout/Contentpanel_Sidebar_11.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++)
{
#if(isset($uploadTimes[$i]))
#{
# print('<td width="15">'.$i.' ('.round($uploadTimes[$i]/$total*'200',0).'%)</td>');
#}
#else
#{
print('<td width="4%" align="center">'.$i.'</td>');
#}
}
print('<td></td></tr>');

endtable();

        pagefooter();
        ob_end_flush();
        break;
}

I've attached a grab from the site:
« Last Edit: May 05, 2006, 03:39:04 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: MOD: Upload Activity By Time
« Reply #1 on: November 20, 2005, 09:48:44 pm »

Thanks for your contrib. What coppermine version did you write/test this mod for?
Logged

pslawinski

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • Lighting-Gallery.net
Re: MOD: Upload Activity By Time
« Reply #2 on: November 20, 2005, 10:00:57 pm »

I wrote and tested this with 1.4.x.  I believe it should work with previous versions if cpg_db_query() and cpg_db_fetch_rowset() are changed to db_query() and db_fetch_rowset() respectively.  Perhaps someone else can test this?  I no longer have a working version of 1.3.x on my server.
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.