Scoop -- the swiss army chainsaw of content management
Front Page Everything News Code Help! Wishlist Project Scoop Sites Dev Notes Latest CVS changes Development Activities
Scoop Box Exchange - Show Box: activity_box 1.00

Author: hurstdog [Info]

Description:

This will show a few cached activity stats. It will show more later. Set it up so that it is on its own page, for best results. Scoop.k5 users /activity for it

Box Code:

# displays some cached site activity info

# a "few" variables to use
my $stat_hash = {
title => '',
sid => '',
sid_count => 0,
top_uid => 0,
uid_count => 0,
diary_count => 0,
story_count => 0,
comment_count => 0 };

# refresh every 101
my $refresh = $S->cache->{CACHE}->{activity_stats_num} || 1001;

if( $refresh > 1000 ) {
$S->cache->{CACHE}->{activity_stats_num} = 1;
$S->cache->{CACHE}->{activity_stats} = {};

# get the top sid for the past week
my ($rv,$sth) = $S->db_select({
FROM => 'comments',
WHAT => 'sid,count(*) as c',
WHERE => "TO_DAYS(NOW()) - 7 <= TO_DAYS(date)",
GROUP_BY => 'sid',
ORDER_BY => 'c desc',
LIMIT => 1,
});

return $S->{DBH}->errstr() unless( $rv );
my $tmphash = $sth->fetchrow_hashref;
$sth->finish();
$stat_hash->{sid} = $tmphash->{sid};
$stat_hash->{sid_count} = $tmphash->{c};

# now get the title
($rv,$sth) = $S->db_select({
FROM => 'stories',
WHAT => 'title',
WHERE => "sid='$stat_hash->{sid}'",
});

return $S->{DBH}->errstr() unless $rv;
$tmphash = $sth->fetchrow_hashref;
$stat_hash->{title} = $tmphash->{title};
$sth->finish();

# get top uid, and the number in the past week
($rv,$sth) = $S->db_select({
FROM => 'users',
WHAT => 'uid',
WHERE => 'TO_DAYS(NOW()) - 7 <= TO_DAYS(creation_time)',
ORDER_BY => 'uid desc',
});

return $S->{DBH}->errstr() unless( $rv );
my $tmp_arr = $sth->fetchall_arrayref();
$sth->finish();
$stat_hash->{uid_count} = scalar( @{$tmp_arr} );
my $tmptmp_arr = shift @$tmp_arr;
$stat_hash->{top_uid} = $tmptmp_arr->[0];

# Comment count for past week
my ($rv,$sth) = $S->db_select({
FROM => 'comments',
WHAT => 'count(*) as c',
WHERE => "TO_DAYS(NOW()) - 7 <= TO_DAYS(date)",
});

return $S->{DBH}->errstr() unless( $rv );
$tmphash = $sth->fetchrow_hashref;
$sth->finish();
$stat_hash->{comment_count} = $tmphash->{c};

# now get story count for past week
($rv,$sth) = $S->db_select({
FROM => 'stories',
WHAT => 'count(*) as c',
WHERE => "section != 'Diary' and TO_DAYS(NOW()) - 7 <= TO_DAYS(time)",
});

return $S->{DBH}->errstr() unless $rv;
$tmphash = $sth->fetchrow_hashref;
$stat_hash->{story_count} = $tmphash->{c};
$sth->finish();

# now get diary count for past week
($rv,$sth) = $S->db_select({
FROM => 'stories',
WHAT => 'count(*) as c',
WHERE => "section = 'Diary' and TO_DAYS(NOW()) - 7 <= TO_DAYS(time)",
});

return $S->{DBH}->errstr() unless $rv;
$tmphash = $sth->fetchrow_hashref;
$stat_hash->{diary_count} = $tmphash->{c};
$sth->finish();


# just in case the top story is a poll
($rv,$sth) = $S->db_select({
FROM => 'pollquestions',
WHAT => 'qid,question',
WHERE => "qid='$stat_hash->{sid}'",
});
return $S->{DBH}->errstr() unless $rv;

$tmphash = $sth->fetchrow_hashref;
if( $tmphash->{qid} eq $stat_hash->{sid} ) {
$stat_hash->{title} = $tmphash->{question};
}
$sth->finish();

# store it in the cache now
$S->cache->{CACHE}->{activity_stats} = $stat_hash;

} else {
$stat_hash = $S->cache->{CACHE}->{activity_stats};
$S->cache->{CACHE}->{activity_stats_num} += 1;
}

# Now print neatly
my $content .= qq[<br><FONT FACE="verdana, arial, helvetica, sans-serif" SIZE="2"><b>Top Story of the past Week</b>:<br>         <a href="/?op=displaystory;sid=$stat_hash->{sid}">$stat_hash->{title}</a> with <b>$stat_hash->{sid_count}</b> comments in the past week.<br><br>\n];
$content .= qq[Numbers for the past week:
<ul><li> <b>$stat_hash->{story_count}</b> stories <li><b>$stat_hash->{diary_count}</b> diaries <li><b>$stat_hash->{comment_count}</b> comments</ul>
<br>\n];
$content .= qq[Welcome the <b>$stat_hash->{uid_count}</b> users that have joined in the past week, which gives us <b>$stat_hash->{top_uid}</b> users total!</FONT><br>\n];

return {content => $content};
Display: Sort:
l Tag Heuer sports watch (none / 0) (#1)
by scalett on Sat Mar 12, 2016 at 01:24:36 AM PST

In acquirement to own this aces replica watches from the aboriginal manufacturers you ability accept to carapace out an absolute which may able-bodied cover up to agree your bulk accumulation of a lifetime! Top end does appear at a price. Nevertheless, it charge not be so baby a value. If you are a faddy aficionado with a accountable spending budget, Tag Heuer replique montres replicas will be the smartest choice. These replicas appear at actual reasonable bulk and are a accomplished alternating to the aboriginal watches. You can get abundant advice from the affidavit such as the authenticity, the components' nature, artful data etc. It may yield you a little money to yield this certificate. Yet it is all-important for you to get it if you do wish to get a replica rolex absolute one. It will acquaint you the answer.



Wholesaler of mulberry replica uk designer items (none / 0) (#2)
by joeychen on Sun Oct 16, 2016 at 10:35:13 PM PST

The online shopping market has a lot to offer when it comes to reliable online retailer and wholesaler of mulberry replica uk designer items. You can try Google and other search engines and just key in your specific designer label or brand and the type of commodity you are looking for and in just a click and a tap, a vast range of options are being laid down for you to partake and choose from. With a lot of choices at hand, you may get confused and bewildered. Try the ones that are proven time and time again to be efficient, trustworthy and reliable by its many followers. Online shopping for items has simply never been this easy. Now that you are considering online shopping for items such as Chanel, Balenciaga Bags, Prada purses, and so on, be also aware that the net is a haven fraught of predatory individuals. Here are quick helpful tips for you to remember when indulging yourself when online shopping for designer items: Buy only from securely encrypted online store. Check for an http. An before the website address is even much better. Note all the contact details of cheap ralph lauren the company you wish to purchase to, e.g., e-mail address, offsite address, phone number, fax number, and contact person. Save a copy of your order form complete with the payment receipt and confirmation from the subject seller. Set up a hard-to-break password (if there is a need for any) when paying online. Make sure to double check your bank account after purchasing an item online. With these in mind, you are now all set to a whole new dimension of shopping experience! Not only are they easily accessible and has a limitless supply in the market, they are also best priced in such a way that will put all the fashion houses to shame. Who says that fashion has to be high maintenance has thoroughly not come in contact with the wondrous world of bags, wallets, handbags, purses, shoes, clothes and other items. With countless waitlist experiences that never get through, a new world of vast possibilities open for you. Enjoy the same luxury, the same use, and the same personal satisfaction but with just one-eighth of the cost of authentic designer items. Enjoy shopping that is practical, cost-effective and economical yet highly satisfying and mood enlightening. This collection will be playful, bright and limited edition. We love Stephen Sprouse. Beautiful tote bags and shoulder bags, as well as travel bags have been the hottest subject for years, as this brand continues to develop more and more fantastic purses and hobos. Also the online LV sales (handbag sale) is the occasion that gathers lots on attention as everybody wants some discount Louis Vuitton handbags and purses. It is foreseeable that fashionistas will fight for longchamp outlet uk a bag from the purse sale.



Mellanni Coupon (none / 0) (#3)
by promoocodes0 on Fri Sep 21, 2018 at 01:05:03 AM PST

Quite informative blog have shared by you thanks for this it was very helpful to me thanks for sharing this Mellanni Coupon



job vacancies (none / 0) (#4)
by alikhatri on Mon Jan 07, 2019 at 08:16:09 AM PST

First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. job vacancies



job vacancies (none / 0) (#5)
by alikhatri on Mon Jan 07, 2019 at 08:16:48 AM PST

First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. job vacancies



oney spells (none / 0) (#6)
by alikhatri on Wed Jan 09, 2019 at 03:47:51 AM PST

I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! money spells



SSDSDSD (none / 0) (#7)
by alikhatri on Thu Jan 10, 2019 at 02:15:14 AM PST

This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Relationship



Feasibility Study of Projects. (none / 0) (#8)
by alikhatri on Thu Jan 10, 2019 at 08:45:31 AM PST

Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. Feasibility Study of Projects.



dedicated hosting, (none / 0) (#9)
by alikhatri on Sat Jan 12, 2019 at 10:54:10 AM PST

I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! dedicated hosting,



fake australian id (none / 0) (#10)
by alikhatri on Mon Jan 14, 2019 at 04:48:04 AM PST

Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers. fake australian id



internet marketing (none / 0) (#11)
by alikhatri on Mon Jan 14, 2019 at 06:09:59 AM PST

Your work is very good and I appreciate you and hopping for some more informative posts internet marketing



Ongoing Maintenance Plan (none / 0) (#12)
by alikhatri on Sat Jan 19, 2019 at 04:32:35 AM PST

This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Ongoing Maintenance Plan



Please review my website (none / 0) (#14)
by andymark on Mon Jan 28, 2019 at 03:09:54 AM PST

Great informative site. I'm really impressed after reading this blog post. I really appreciate the time and effort you spend to share this with us! I do hope to read more updates from you. Thanks Visit games.lol for Puzzle Games



Accommodation in springs south Africa (none / 0) (#15)
by alikhatri on Sat Feb 02, 2019 at 01:51:11 AM PST

Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. Accommodation in springs south Africa



Thanks (none / 0) (#16)
by enable12 on Tue Feb 12, 2019 at 01:20:11 PM PST

This content is written very well. Your use of formatting when making your points makes Shoreline Amphitheatre tickets your observations very clear and easy to understand. Thank you.



chess pieces (none / 0) (#17)
by sheeraz on Tue Feb 19, 2019 at 02:43:47 PM PST

Super site! I am Loving it!! Will return once more, Im taking your food additionally, Thanks. chess pieces



chess pieces (none / 0) (#18)
by sheeraz on Tue Feb 19, 2019 at 02:44:05 PM PST

Super site! I am Loving it!! Will return once more, Im taking your food additionally, Thanks. chess pieces



Accountants Tunbridge Wells (none / 0) (#19)
by sheeraz on Thu Mar 14, 2019 at 06:33:45 AM PST

I have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively. Accountants Tunbridge Wells



Telebrand Pakistan (none / 0) (#20)
by sheeraz on Fri Mar 15, 2019 at 07:35:42 AM PST

You actually make it look so easy with your performance but I find this matter to be actually something which I think I would never comprehend. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I'll try to get the hang of it! Telebrand Pakistan



altoextractpdf (none / 0) (#21)
by AnaMattice on Mon Jan 13, 2020 at 01:05:17 AM PST

I can assure you that the best available pdf extraction tool is the altoextractpdf as it gives users a lot of functionality. You can just go to their website and see how the tool works.



JNVST Bihar 6th Waiting List 2020 (none / 0) (#22)
by AnaMattice on Tue Jan 28, 2020 at 04:22:45 AM PST

Jawahar Navodaya Vidyalaya Selection Test (JNVST) officials are going to release the JNVST Exam Key for class 6. At the end of the page, we had given a direct link to download the JNVST Bihar 6th Waiting List 2020 Test Solved Key. Besides, the officials will release the Navodaya Vidyalaya Selection Test Answer Key tentatively in the 3rd Week Of January 2020. Moreover, the officials had conducted the Exam for Phase 1 on 11th January 2020. However, keep checking our page to get the latest updates of the Jawahar Navodaya Vidyalaya Answer Key.



Menu
create account
faq
search
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Smokedot
It's 4:19... do you know where your bong is?

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest 1999 The Management

create account | faq | search