Version: , by tubedogg
Developer Last Online: Dec 2016
Version: 2.2.x
Rating:
Released: 06-02-2001
Last Update: Never
Installs: 161
No support by the author.
Thanks to Bane there has been a complete reworking of the installation/instructions for this hack. It is now up to date for 2.0.3 and the installer runs exactly like the vB install/upgrade scripts do.
There is no demo as I don't currently use stars on my board.
For version: 2.0.3
Files needed: stars.php
Files to edit: newthread.php, newreply.php, admin/misc.php, admin/index.php, admin/usergroup.php, register.php and possibly stars.php
Templates to edit: postbit
Instructions: Upload install_starshack.php and stars.php to your admin directory. Go to example.com/admin/install_starshack.php and login, then follow the on-screen instructions.
Upgrade information: If you have previously installed the stars hack, make sure you choose the "upgrade" option on the screen mentioned in the instructions. If you have previously installed this version (using install_starshack.php), you MUST STILL use the upgrade option even if you are reinstalling or you will get database errors.
if (!$threadinfo[visible]) {
$idname="thread";
eval("standarderror(\"".gettemplate("error_invalid id")."\");");
}
if (!$threadinfo[open]) {
if (!ismoderator($threadinfo[forumid],"canopenclose")) {
eval("standardredirect(\"".gettemplate("redirect_t hreadclosed")."\",\"showthread.php?s=$session[sessionhash]&threadid=$threadid\");");
exit;
}
}
$permissions=getpermissions($threadinfo[forumid]);
if (($bbuserinfo['userid']!=$threadinfo['postuserid'] or $bbuserinfo['userid']==0) and (!$permissions['canviewothers'] or !$permissions['canreplyothers'])) {
show_nopermission();
}
if (!$permissions['canview'] or (!$permissions['canreplyown'] and $bbuserinfo['userid']==$threadinfo['postuserid'])) {
show_nopermission();
}
updateuserforum($threadinfo['forumid']);
// ############################### start post reply ###############################
if ($HTTP_POST_VARS['action']=="postreply") {
// check for subject and message
$message=trim($message);
if ($message=="") {
eval("standarderror(\"".gettemplate("error_nosubje ct")."\");");
exit;
}
if (isset($username) and !isset($bbuserinfo['username'])) {
$username = trim($username);
$username = eregi_replace("( ){2,}", " ", $username);
if (!$username) {
eval("standarderror(\"".gettemplate("error_nousern ame")."\");");
}
if ($userinfo=$DB_site->query_first("
SELECT user.*,userfield.*
FROM user,userfield
WHERE (username='".addslashes(htmlspecialchars($username ))."' OR
username='".addslashes(eregi_replace("[^A-Za-z0-9]","",$username))."') AND
user.userid=userfield.userid")) {
if (!$password) {
eval("standarderror(\"".gettemplate("error_usernam etaken")."\");");
} elseif (md5($password)!=$userinfo['password']) {
eval("standarderror(\"".gettemplate("error_wrongpa ssword")."\");");
} else {
$bbuserinfo = $userinfo;
$postusername = $bbuserinfo['username'];
if ($user['cookieuser']==1) {
vbsetcookie("bbuserid",$user['userid']);
vbsetcookie("bbpassword",$user['password']);
}
$DB_site->query("UPDATE session SET userid='$bbuserinfo[userid]' WHERE sessionhash='".addslashes($session['dbsessionhash'])."'");
}
} else {
$postusername = htmlspecialchars($username);
}
} else {
$postusername = $bbuserinfo['username'];
}
if ($enablefloodcheck) {
if ($bbuserinfo[userid]!=0 and time()-$bbuserinfo[lastpost]<=$floodchecktime and !ismoderator($foruminfo[forumid])) {
eval("standarderror(\"".gettemplate("error_floodch eck")."\");");
exit;
}
}
// check max images
if ($maximages!=0) {
$parsedmessage=bbcodeparse($message,$forumid,$allo wsmilie);
if (countchar($parsedmessage,"<img")>$maximages) {
eval("standarderror(\"".gettemplate("error_toomany images")."\");");
exit;
}
}
if ($logip==1 or $logip==2) {
if ($temp = getenv("REMOTE_ADDR")) {
$ipaddress = $temp;
} else if ($temp = $REMOTE_ADDR) {
$ipaddress = $temp;
} else {
$ipaddress = $HTTP_HOST;
}
} else {
$ipaddress="";
}
if (!isset($iconid) or $iconid=="") {
$iconid=0;
}
$iconid = intval($iconid);
$permissions=getpermissions($threadinfo['forumid']);
if (($bbuserinfo['userid']!=$threadinfo['postuserid'] or $bbuserinfo['userid']==0) and (!$permissions['canviewothers'] or !$permissions['canreplyothers'])) {
show_nopermission();
}
if (!$permissions['canview'] or (!$permissions['canreplyown'] and $bbuserinfo['userid']==$threadinfo['postuserid'])) {
show_nopermission();
}
// sort attachement
if (is_array($HTTP_POST_FILES)) {
$attachment = $HTTP_POST_FILES['attachment']['tmp_name'];
$attachment_name = $HTTP_POST_FILES['attachment']['name'];
$attachment_size = $HTTP_POST_FILES['attachment']['size'];
}
if ($permissions[canpostattachment] and trim($attachment)!="none" and trim($attachment)!="" and trim($attachment_name)!="") {
$attachmentid=acceptupload($foruminfo[moderateattach]);
} else {
$attachmentid=0;
}
if ($email&&$bbuserinfo[userid]!=0) {
if (!$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$bbuserinfo[userid] AND threadid=$threadid")) {
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$bbuserinfo[userid],$threadid)");
}
}
// see if there has been a post identical to this in the last 5 mins. If so, update that one, as user has probably done a double post
$datecut=time()-300;
if ($prevpost=$DB_site->query_first("SELECT attachmentid,postid,visible FROM post WHERE threadid='$threadid' AND username='".addslashes($postusername)."' AND userid='$bbuserinfo[userid]' AND title='".addslashes(htmlspecialchars($title))."' AND dateline>$datecut AND pagetext='".addslashes($message)."'")) {
$postid=$prevpost[postid];
if ($prevpost[attachmentid]!=0) {
$DB_site->query("DELETE FROM attachment WHERE attachmentid = '$prevpost[attachmentid]'");
if ($attachmentid==0) {
$DB_site->query("UPDATE thread SET attach = attach - 1 WHERE threadid = '$threadid'");
}
}
$DB_site->query("UPDATE post SET title='".addslashes(htmlspecialchars($title))."',p agetext='".addslashes($message)."',allowsmilie='$a llowsmilie',showsignature='$signature',iconid='$ic onid',attachmentid='$attachmentid' WHERE postid='$postid'");
if ($attachmentid and !$foruminfo[moderateattach]) {
$DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid = '$threadid'");
}
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($ title))."','".addslashes($postusername)."','$bbuse rinfo[userid]','".time()."','$attachmentid','".addslashes($mess age)."','$allowsmilie','$signature','$ipaddress',' $iconid','$visible')");
$postid=$DB_site->insert_id();
indexpost($postid,0);
if ($visible) {
if ($threadinfo[replycount]%10==0) {
$replies=$DB_site->query_first("SELECT COUNT(*)-1 AS replies FROM post WHERE threadid='$threadid'");
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount='$replies[replies]',lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
} else {
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount=replycount+1,last poster='".addslashes($postusername)."' WHERE threadid='$threadid'");
}
}
if ($rating > 0 and $rating < 6 and $foruminfo['allowratings'] == 1) {
if ($permissions['canthreadrate']) {
$vote = intval($rating);
if ($ratingsel = $DB_site->query_first("SELECT vote, threadrateid
FROM threadrate
WHERE userid='$bbuserinfo[userid]'
AND threadid = '$threadid'")) {
if ($votechange) {
if ($vote != $ratingsel['vote']) {
$voteupdate = $vote - $ratingsel['vote'];
$DB_site->query("UPDATE threadrate SET vote='$vote'
WHERE threadrateid=$ratingsel[threadrateid]");
$DB_site->query("UPDATE thread SET votetotal=votetotal+$voteupdate
WHERE threadid='$threadid'");
}
}
} else {
$DB_site->query("INSERT INTO threadrate (threadid,userid,vote)
VALUES ('$threadid','$bbuserinfo[userid]','$vote')");
$DB_site->query("UPDATE thread SET votetotal=votetotal+$vote,votenum=votenum+1
WHERE threadid='$threadid'");
}
}
}
// update forum stuff
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',last poster='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
}
// update user stuff
$dotitle="";
if ($bbuserinfo[userid]!=0)
{
// StarsHack
if ($foruminfo[countposts]) {
$usergstars=$DB_site->query_first("SELECT starlevel,starimg FROM usergroup WHERE usergroupid='$bbuserinfo[usergroupid]'");
if ($usergstars[starlevel]=="") {
$getstars=$DB_site->query_first("SELECT starlevel,starimg FROM stars WHERE minposts<=$bbuserinfo[posts]+1 ORDER BY minposts DESC LIMIT 1");
$userstarlvl=$getstars[starlevel];
$userstarimg=$getstars[starimg];
} else {
$userstarlvl=$usergstars[starlevel];
$userstarimg=$usergstars[starimg];
}
$dostars=",starlevel='$userstarlvl',starimg='$user starimg'";
}
// StarsHack End
if ($bbuserinfo[customtitle]==0 && $foruminfo[countposts])
{
$usergroup=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid='$bbuserinfo[usergroupid]'");
if ($usergroup[usertitle]=="") {
$getprofilefield=$DB_site->query_first("SELECT profilefieldid from profilefield where 1 and title = 'Ranksystem' LIMIT 0, 1");
$gettitle=$DB_site->query_first("Select rankdetail.title from user left join userfield on user.userid = userfield.userid left join rankdetail on userfield.field" . $getprofilefield[profilefieldid] . " = rankdetail.rankid where user.userid= $bbuserinfo[userid] and rankdetail.minposts <= user.posts+1 ORDER BY rankdetail.minposts DESC LIMIT 1");
$usertitle=$gettitle[title];
} else {
$usertitle=$usergroup[usertitle];
}
$dotitle="usertitle='".addslashes($usertitle)."'," ;
}
// StarsHack
$DB_site->query("UPDATE user SET
".iif ($foruminfo[countposts],"posts=posts+1,","")."
$dotitle"."lastpost='".time()."'$dostars WHERE userid='$bbuserinfo[userid]'");
// StarsHack End
}
// send email to moderators
if ($enableemail) {
$moderators=$DB_site->query_first("SELECT newpostemail FROM forum WHERE forumid='$threadinfo[forumid]'");
$mods=$DB_site->query("SELECT DISTINCT user.email FROM moderator LEFT JOIN user USING (userid) WHERE moderator.forumid IN ($foruminfo[parentlist]) AND moderator.newpostemail=1");
while ($mod=$DB_site->fetch_array($mods)) {
$moderators[newpostemail].=' '.$mod[email];
}
$moderators[newpostemail]=trim($moderators[newpostemail]);
if ($moderators[newpostemail]!="") {
$bbuserinfo['username']=unhtmlspecialchars($bbuserinfo['username']); //for emails
$mods=explode(" ",$moderators[newpostemail]);
while (list($key,$val)=each($mods)) {
if (trim($val)!="") {
$subject=$threadtitle;
$toemail=$val;
if (($bbuserinfo[maxposts] != -1) and ($bbuserinfo[maxposts] != 0)) {
$maxposts = $bbuserinfo[maxposts];
}
$posts=$DB_site->query("
SELECT IF(post.userid=0,post.username,user.username) AS username,
post.pagetext,post.allowsmilie,post.userid FROM post
LEFT JOIN user ON user.userid=post.userid
WHERE post.visible=1 AND post.threadid='$threadid'
ORDER BY dateline DESC LIMIT " . ($maxposts+1)); // return +1 so that check later will still work
if ($bbuserinfo[userid]!=0 and !$previewpost) {
if ($bbuserinfo[signature]!="") {
$signaturechecked="CHECKED";
}
if ($bbuserinfo[emailnotification]!=0) {
$emailchecked="checked";
}
}
if ($foruminfo[allowicons]) {
$posticons=chooseicons($iconid);
} else {
$posticons="";
}
if (!isset($parseurl)) {
$parseurlchecked="CHECKED";
}
if ($permissions[canpostattachment] and (!$safeupload or function_exists("is_uploaded_file"))) {
eval("\$attachmentoption = \"".gettemplate("newpost_attachment")."\";");
} else {
$attachmentoption="";
}
We are running stars with 2.2.6. We have three usergroups (Admins, Mods, Platinum) that are all supposed to receive the special star
The "Star image shown" is set to platstar for all three usergroups. However, only Admins and Mods get this special star and the Platinum members wrongly get the regular star
Any suggestions on what is keeping the Platinum members form getting the special star that is set in the "Star image shown" field like the Admins and Mods?
Invalid SQL: Select rankdetail.title from user left join userfield on user.userid = userfield.userid left join rankdetail on userfield.field = rankdetail.rankid where user.userid= 460 and rankdetail.minposts <= user.posts+1 ORDER BY rankdetail.minposts DESC LIMIT 1
mysql error: Table 'ac2hqdb.rankdetail' doesn't exist