The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Comments |
#2
|
||||
|
||||
Excactly what links do you mean? If you mean the CP intergration with vbstats, that is *not* installed automatically. that is one of the optional hacks.
|
#3
|
||||
|
||||
i got it now, i ment like in the admin cp....how the admin/index.php was coded a lil bit different know what i mean?
|
#4
|
||||
|
||||
I wonder if there's any mercy soul who can help me in the optimization of the frontpage vbstats code.
Everything is working fine ( http://www.risikodigital.it/forum ) but, since I'm a totally newbie in php and mysql programming, I'm quite sure there's a fastest way to obtain the same figures shown in my forum HP. I'm publishing below 1) index.php 2) vbstats_forumhome template I beg your pardon if i post in the wrong area. Sorry, and forgive me. Thanks much to people who can help me. 1) index.php Code:
<?php error_reporting(7); $templatesused='forumhome_birthdaybit,error_nopermission,forumhome_pmloggedin,forumhome_welcometext,forumhome_logoutcode,forumhome_newposts,forumhome_todayposts,forumhome_logincode,forumhome_loggedinuser,forumhome_loggedinusers,forumhome_lastpostby,forumhome_moderator,forumhome_forumbit_level1_nopost,forumhome_forumbit_level1_post,forumhome_forumbit_level2_nopost,forumhome_forumbit_level2_post,forumhome,forumhome_unregmessage'; $loadbirthdays=1; $loadmaxusers=1; require('./global.php'); $permissions=getpermissions(); if (!$permissions['canview']) { show_nopermission(); } //check usergroup of user to see if they can use PMs //$permissions=getpermissions($forumid); if ($enablepms==1 and $permissions['canusepm'] and $bbuserinfo['receivepm']) { $ignoreusers=""; if (trim($bbuserinfo['ignorelist'])!="") { $ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ', trim($bbuserinfo['ignorelist']))); } $allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers"); $newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers"); $unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers"); if ($newpm['messages']==0) { $lightbulb='space'; } else { $lightbulb='sirena'; } eval("\$pminfo = \"".gettemplate('forumhome_pmloggedin')."\";"); } else { $pminfo=''; } // How Many? $numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user'); $numbermembers=number_format(($numbersmembers['users']), 0, ',', '.'); $snonposters=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user WHERE posts=0'); $nonposters=number_format(($snonposters['users']), 0, ',', '.'); $activemembers=number_format((($numbersmembers['users'])-$nonposters), 0, ',', '.'); $activityrate=number_format(($activemembers/$numbermembers/10), 2, ',', '.'); // Equate [Added Post 230.b to resolve Active Users issues] // $activemembers=number_format($activemembers); // $nonposters=number_format($nonposters); // PM Totals $totalpms = $DB_site->query_first("SELECT count(*) as pmcount FROM privatemessage"); $totalpm = number_format(($totalpms[pmcount]), 0, ',', '.'); // Staff $anum = mysql_num_rows(mysql_query("select * from user WHERE usergroupid=5 or usergroupid=6 or usergroupid=7")); // get total posts & threads $countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post'); $totalposts=number_format(($countposts['posts']), 0, ',', '.'); $countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread'); $totalthreads=number_format(($countthreads['threads']), 0, ',', '.'); // thread Most Viewed $top3d1=$DB_site->query("SELECT threadid, title, views FROM thread GROUP BY threadid ORDER BY views DESC LIMIT 1"); while ($top3d=$DB_site->fetch_array($top3d1)) { $top3d1views = number_format(($top3d[views]), 0, ',', '.'); $top3d1id =($top3d[threadid]); $top3d1title =($top3d[title]); $maxchars='20'; // title lenght if (strlen($top3d1title) > $maxchars) { $top3d1title = substr($top3d1title, 0, $maxchars-2) . '...'; } } // get total views $boardviews = $DB_site->query_first("SELECT SUM(views) AS threadviews FROM thread"); $totalviews = number_format(($boardviews[threadviews]), 0, ',', '.'); // get newest member $getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]"); $newusername=$getnewestusers['username']; $newuserid=$getnewestusers['userid']; // if user is know, then welcome if ($bbuserinfo['userid']!=0) { $username=$bbuserinfo['username']; eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";"); eval("\$logincode = \"".gettemplate('forumhome_logoutcode')."\";"); eval("\$newposts = \"".gettemplate('forumhome_newposts')."\";"); } else { $welcometext = ""; eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";"); eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";"); } $birthdaybits=""; if ($showbirthdays) { $birthdays = gettemplate('birthdays',0,0); $btoday = explode('|||',$birthdays); $today = vbdate("Y-m-d",time()); if (($today != $btoday[0] and $today != $btoday[1]) or empty($birthdays)) { // Need to update! if (empty($birthdays)) { $DB_site->query("INSERT INTO template (templateid, templatesetid, title, template) VALUES (NULL, '-2', 'birthdays', '')"); } getbirthdays(); $birthdays = $DB_site->query_first("SELECT template FROM template WHERE title='birthdays' and templatesetid = -2"); $birthdays = $birthdays[template]; $btoday = explode('|||',$birthdays); } if ($today == $btoday[0]) { $birthdays = $btoday[2]; } elseif ($today == $btoday[1]) { $birthdays = $btoday[3]; } if ($birthdays) { eval("\$birthdaybits = \"".gettemplate("forumhome_birthdaybit")."\";"); } } //Forum info $forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'); while ($forum=$DB_site->fetch_array($forums)) { $iforumcache["$forum[parentid]"]["$forum[displayorder]"]["$forum[forumid]"] = $forum; } $DB_site->free_result($forums); unset($forum); //Forum perms $forumperms=$DB_site->query("SELECT forumid,canview,canpostnew FROM forumpermission WHERE usergroupid='$bbuserinfo[usergroupid]'"); while ($forumperm=$DB_site->fetch_array($forumperms)) { $ipermcache["$forumperm[forumid]"] = $forumperm; } $DB_site->free_result($forumperms); unset($forumperm); $accesscache = array(); if ($bbuserinfo['userid']!=0 AND $enableaccess) { //Access table perms $accessperms=$DB_site->query("SELECT forumid,accessmask FROM access WHERE userid='$bbuserinfo[userid]'"); while ($accessperm=$DB_site->fetch_array($accessperms)) { $accesscache["$accessperm[forumid]"] = $accessperm; } $DB_site->free_result($accessperms); unset($accessperm); // usergroup defaults $usergroupdef['canview'] = $permissions['canview']; $usergroupdef['canpostnew'] = $permissions['canpostnew']; // array for accessmask=0 $noperms['canview'] = 0; $noperms['canpostnew'] = 0; } $imodcache = array(); $mod = array(); $forummoderators=$DB_site->query('SELECT user.userid,user.username,moderator.forumid FROM moderator LEFT JOIN user ON (moderator.userid=user.userid) ORDER BY user.username'); while ($moderator=$DB_site->fetch_array($forummoderators)) { $imodcache["$moderator[forumid]"][] = $moderator; $mod["$moderator[userid]"] = 1; } $DB_site->free_result($forummoderators); unset($moderator); $activeusers = ""; $loggedinusers = ""; if ($displayloggedin) { $datecut=time()-$cookietimeout; $loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE userid=0 AND lastactivity>$datecut"); $numberguest=$loggedins['sessions']; $numbervisible=0; $numberregistered=0; $loggedins=$DB_site->query("SELECT DISTINCT session.userid,username,invisible,usergroupid FROM session LEFT JOIN user ON (user.userid=session.userid) WHERE session.userid>0 AND session.lastactivity>$datecut ORDER BY invisible ASC, username ASC"); if ($loggedin=$DB_site->fetch_array($loggedins)) { $numberregistered++; if ($loggedin['invisible']==0 or $bbuserinfo['usergroupid']==6) { $numbervisible++; $userid = $loggedin['userid']; if ($loggedin['invisible'] == 1) { // Invisible User but show to Admin $invisibleuser = '*'; } else { $invisibleuser = ''; } if ($loggedin['usergroupid'] == 6 and $highlightadmin) { $username = "<b><i>$loggedin[username]</i></b>"; } else if (($mod["$userid"] or $loggedin['usergroupid'] == 5) and $highlightadmin) { $username = "<b>$loggedin[username]</b>"; } else { $username = $loggedin['username']; } eval("\$activeusers = \"".gettemplate('forumhome_loggedinuser')."\";"); } while ($loggedin=$DB_site->fetch_array($loggedins)) { $numberregistered++; $invisibleuser = ''; if ($loggedin['invisible']==1 and $bbuserinfo['usergroupid']!=6) { continue; } $numbervisible++; $userid=$loggedin['userid']; if ($loggedin['invisible'] == 1) { // Invisible User but show to Admin $invisibleuser = '*'; } if ($loggedin['usergroupid'] == 6 and $highlightadmin) { $username = "<b><i>$loggedin[username]</i></b>"; } else if (($mod["$userid"] or $loggedin['usergroupid'] == 5) and $highlightadmin) { $username = "<b>$loggedin[username]</b>"; } else { $username = $loggedin['username']; } eval("\$activeusers .= \", ".gettemplate('forumhome_loggedinuser')."\";"); } } $DB_site->free_result($loggedins); $totalonline=$numberregistered+$numberguest; $numberinvisible=$numberregistered-$numbervisible; $maxusers=explode(" ", gettemplate('maxloggedin',0,0)); if ((int)$maxusers[0] <= $totalonline) { $time = time(); $maxloggedin = "$totalonline " . $time; $DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'"); $maxusers[0] = $totalonline; $maxusers[1] = $time; } $recordusers = $maxusers[0]; $recorddate = vbdate($dateformat,$maxusers[1]); $recordtime = vbdate($timeformat,$maxusers[1]); eval("\$loggedinusers = \"".gettemplate('forumhome_loggedinusers')."\";"); } // Start makeforumbit function makeforumbit($forumid,$depth=1,$permissions='') { global $DB_site,$bbuserinfo,$iforumcache,$ipermcache,$imodcache,$session,$accesscache,$usergroupdef,$noperms; global $showlocks,$hideprivateforums,$showforumdescription,$forumhomedepth,$dateformat,$timeformat,$enableaccess; if ( !isset($iforumcache["$forumid"]) ) { return; } $forumbits = ''; while ( list($key1,$val1)=each($iforumcache["$forumid"]) ) { while ( list($key2,$forum)=each($val1) ) { // Permissions if ( $enableaccess and is_array($accesscache["$forum[forumid]"]) ) { if ($accesscache["$forum[forumid]"]['accessmask']==1) { $forumperms = $usergroupdef; } else { $forumperms = $noperms; } } else if ( is_array($ipermcache["$forum[forumid]"]) ) { $forumperms = $ipermcache["$forum[forumid]"]; } else { $forumperms = $permissions; } $trueperm['canview'] = $forumperms['canview']; if (!$hideprivateforums) { $forumperms['canview']=1; } if (!$forumperms['canview']) { continue; } else { $forumshown=1; // do light bulb if ($bbuserinfo['lastvisitdate']=='Never') { $forum['onoff']='on'; } else { if (($fview = get_bbarraycookie('forumview', $forum['forumid'])) > $bbuserinfo['lastvisit']) { $userlastvisit=$fview; } else { $userlastvisit=$bbuserinfo['lastvisit']; } if ($userlastvisit<$forum['lastpost']) { $forum['onoff']='on'; } else { $forum['onoff']='off'; } } if ((!$forumperms['canpostnew'] and $showlocks) or $forum['allowposting']==0) { $forum['onoff'].='lock'; } // prepare template vars if (!$showforumdescription) { $forum['description']=''; } // dates if ($forum['lastpost']>0) { $maxchars='30'; // title lenght if($trueperm['canview']) { $forum['lastthread']=unhtmlspecialchars($forum['lastthread']); if (strlen($forum['lastthread']) > $maxchars) { $forum['lastthread'] = substr($forum['lastthread'], 0, $maxchars-2) . '...'; } } $forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']); $forum['lastposttime']=vbdate($timeformat,$forum['lastpost']); eval("\$forum['lastpostinfo'] = \"".gettemplate('forumhome_lastpostby')."\";"); } else { $forum['lastpostinfo']='Never'; } $listexploded=explode(",", $forum['parentlist']); while ( list($mkey1,$mval1)=each($listexploded) ) { if ( !isset($imodcache["$mval1"]) ) { continue; } reset($imodcache["$mval1"]); while ( list($mkey2,$moderator)=each($imodcache["$mval1"]) ) { if ( !isset($forum['moderators']) ) { eval("\$forum['moderators'] = \"".gettemplate('forumhome_moderator')."\";"); } else { eval("\$forum['moderators'] .= \", ".gettemplate('forumhome_moderator')."\";"); } } } if ( !isset($forum['moderators']) ) { $forum['moderators'] = ' '; } if ($forum['cancontainthreads']==1) { $tempext = '_post'; } else { $tempext = '_nopost'; } eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";"); if ($depth<$forumhomedepth) { $forumbits.=makeforumbit($forum['forumid'],$depth+1,$forumperms); } } // END if can view } // END while ( list($key2,$forum)=each($val1) ) { } // END while ( list($key1,$val1)=each($iforumcache["$forumid"]) ) { unset($iforumcache["$forumid"]); return $forumbits; } if (!isset($forumid) or $forumid==0 or $forumid=='') { $forumid=-1; } else { // need to get permissions for this specific forum $permissions=getpermissions(intval($forumid)); } $forumbits=makeforumbit(intval($forumid), 1, $permissions); /* vbStats [forumhome] #########################################*/ // Today post and threads [FireFly] $tltoday=time()-(86400); $getpoststoday=$DB_site->query_first("SELECT count(*) AS count FROM post WHERE dateline>='$tltoday'"); $poststoday=number_format(($getpoststoday[count]), 0, ',', '.'); $getthreadstoday=$DB_site->query_first("SELECT count(*) AS count FROM thread WHERE dateline>='$tltoday'"); $threadstoday=number_format(($getthreadstoday[count]), 0, ',', '.'); // Today Views $tltoday=time()-(86400); $todayboardviews = $DB_site->query_first("SELECT SUM(views) AS threadviews FROM thread WHERE dateline>='$tltoday'"); $todayviews = number_format(($todayboardviews[threadviews]), 0, ',', '.'); // ########## New Users Today $tltoday=time()-(86400); $getnewusertoday=$DB_site->query_first("SELECT count(*) AS count FROM user WHERE joindate>='$tltoday'"); $newusertoday=number_format(($getnewusertoday[count]), 0, ',', '.'); // PM Today $tltoday=time()-(86400); $todaypms = $DB_site->query_first("SELECT count(*) as pmcount FROM privatemessage WHERE dateline>='$tltoday'"); $todaypm = number_format(($todaypms[pmcount]), 0, ',', '.'); // 24 Hours $datecut3=time()-(86400); $toppost3=$DB_site->query("SELECT COUNT(post.userid) as posts, user.username, user.userid FROM post, user WHERE post.userid=user.userid AND post.dateline>=$datecut3 GROUP BY user.userid ORDER BY posts DESC LIMIT 1"); while ($user3=$DB_site->fetch_array($toppost3)) { $numbertopposts=number_format($user3[posts]); $topposter=($user3[username]); $topposterid=($user3[userid]); } eval("\$vbstats = \"".gettemplate('vbstats_forumhome')."\";"); // vbStats [forumhome] END $unregwelcomemessage=''; if ($bbuserinfo['userid']==0) { eval("\$unregwelcomemessage = \"".gettemplate('forumhome_unregmessage')."\";"); } eval("dooutput(\"".gettemplate('forumhome')."\");"); ?> Code:
<table align="left" border=0 cellpadding="0" cellspacing="0" valign="top"> <tr height="3"> <td></td> </tr> <tr align="left"> <td width="120"><smallfont><a href="memberlist.php?s=$session[sessionhash]">Iscritti</a>: <b>$numbermembers</b> </smallfont></td> <td><smallfont> Nuovi Iscritti: <b>$newusertoday</b> </smallfont></td> <td><smallfont> <a href="showgroups.php?s=$session[sessionhash]">Staff</a>: <b>$anum</b> </smallfont></td> <td><smallfont> Attivi: <b>$activemembers</b> </smallfont></td> <td><smallfont> Non Attivi: <b>$nonposters</b> </smallfont></td> <td colspan="2"><smallfont> % Attivi: <b>$activityrate<b><smallfont>%</b></smallfont></b> </smallfont></td></tr> <tr> <td><smallfont> Stat. totali: </smallfont></td> <td><smallfont> Discussioni: <b>$totalthreads</b> </smallfont></td> <td><smallfont> MP: <b>$totalpm</b> </smallfont></td> <td><smallfont> Post: <b>$totalposts</b> </smallfont></td> <td><smallfont> Visite: <b>$totalviews</b> </smallfont></td> <td><smallfont>Top Disc.: <b> <a href=showthread.php?threadid=$top3d1id>$top3d1title</a></b> </smallfont></td> <td><smallfont>($top3d1views Visite) </smallfont></td></tr> <tr> <td><smallfont> Stat. ultime 24 ore: </smallfont></td> <td><smallfont> Discussioni: <b>$threadstoday</b> </smallfont></td> <td><smallfont> <a href='private.php?s=$session[sessionhash]'>MP</a>: <b>$todaypm</b> </smallfont></td> <td><smallfont> <a href='search.php?action=getdaily'>Post</a>: <b>$poststoday</b> </smallfont></td> <td><smallfont> Visite: <b>$todayviews</b> </smallfont></td> <td><smallfont>Top Poster: <b><a href=member.php?action=getinfo&userid=$topposterid">$topposter</a></b> </smallfont></td> <td><smallfont>($numbertopposts Post) </smallfont></td></tr> </table> </td></tr> 3) here the screenshot: |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|