Source for file stats.inc.php
Documentation is available at stats.inc.php
* @author Matthias Reuter ($LastChangedBy: matthias $)
* @version $LastChangedDate: 2009-08-26 19:19:41 +0200 (Mi, 26 Aug 2009) $
* @copyright 2007-2010 IPBWI development team
* @link http://ipbwi.com/examples/stats.php
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
* @desc Loads and checks different vars when class is initiating
* @author Matthias Reuter
public function __construct($ipbwi){
* @desc Gets board statistics.
* @return array Board Statistics
* @author Matthias Reuter
* $ipbwi->stats->board();
if($cache = $this->ipbwi->cache->get('statsBoard', '1')){
$this->ipbwi->ips_wrapper->DB->query('SELECT cs_value FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'cache_store WHERE cs_key = "stats"');
$row = $this->ipbwi->ips_wrapper->DB->fetch();
$this->ipbwi->cache->save('statsBoard', 1, $stats);
* @desc Returns the active user count.
* @return array Active User Count
* @author Matthias Reuter
* $ipbwi->stats->activeCount();
if($cache = $this->ipbwi->cache->get('activeCount', '1')){
$count = array('total' => '0', 'anon' => '0', 'guests' => '0', 'members' => '0');
$cutoff = $this->ipbwi->ips_wrapper->vars['au_cutoff'] ? $this->ipbwi->ips_wrapper->vars['au_cutoff'] : '15';
$timecutoff = time() - ($cutoff * 60);
$this->ipbwi->ips_wrapper->DB->query('SELECT member_id, login_type FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'sessions WHERE running_time > "'. $timecutoff. '"');
// Let's cache so we don't screw ourselves over :)
// We need to make sure our man's in this count...
if($this->ipbwi->member->isLoggedIn()){
if(substr($this->ipbwi->member->myInfo['login_anonymous'],0, 1) == '1'){
$cached[$this->ipbwi->member->myInfo['member_id']] = 1;
while($row = $this->ipbwi->ips_wrapper->DB->fetch()){
$cached[$row['member_id']] = 1;
}elseif($row['member_id'] == '0'){
$cached[$row['member_id']] = 1;
$count['total'] = $count['anon'] + $count['guests'] + $count['members'];
$this->ipbwi->cache->save('activeCount', 'detail', $count);
* @desc Returns members born on the given day of a month.
* @param int $day Optional. Current day is used if left as an empty string or zero.
* @param int $month Optional. Current month is used if left as an empty string or zero.
* @return array Birthday Members
* @author Matthias Reuter
* $ipbwi->stats->birthdayMembers();
* $ipbwi->stats->birthdayMembers(22,7);
$this->ipbwi->ips_wrapper->DB->query('SELECT m.*, me.signature, me.avatar_size, me.avatar_location, me.avatar_type, me.vdirs, me.location, me.msnname, me.interests, me.yahoo, me.website, me.aim_name, me.icq_number, g.*, cf.* FROM '. $this->ipbwi->board['sql_tbl_prefix']. 'members m LEFT JOIN '. $this->ipbwi->board['sql_tbl_prefix']. 'groups g ON (m.mgroup=g.g_id) LEFT JOIN '. $this->ipbwi->board['sql_tbl_prefix']. 'pfields_content cf ON (cf.member_id=m.id) LEFT JOIN '. $this->ipbwi->board['sql_tbl_prefix']. 'member_extra me ON (m.id=me.id) WHERE m.bday_day="'. intval($day). '" AND m.bday_month="'. intval($month). '"');
while($row = $this->ipbwi->ips_wrapper->DB->fetch()){
$row['age'] = $thisyear - $row['bday_year'];
|