reviews.php: forgotten coauthors revert
--- a/reviews.php
+++ b/reviews.php
@@ -182,10 +182,9 @@
$uidquery = dbquery("SELECT uid,title, coauthors FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$item'");
list($author, $title, $coauthors) = dbrow($uidquery);
if($coauthors) {
- $array_coauthors = array( );
$coQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$item'");
while($c = dbassoc($coQuery)) {
- $array_coauthors[] = $c['uid'];
+ $coauthors[] = $c['uid'];
}
}
}
@@ -204,7 +203,7 @@
}
}
if($review != "No Review" && $action == "add") {
- $mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $array_coauthors) : ""));
+ $mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $coauthors) : ""));
while($mail = dbassoc($mailquery)) {
if($mail['newreviews']) {
include_once("includes/emailer.php");
@@ -265,11 +264,10 @@
$story = dbassoc($storyquery);
$title = title_link($story);
$authoruid = ($story['uid']) ?? null;
- $array_coauthors = array();
if(!empty($story['coauthors'])) {
$colist = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$item'");
while($c = dbassoc($colist)) {
- $array_coauthors[] = $c['uid'];
+ $coauthors[] = $c['uid'];
}
}
}
@@ -398,7 +396,7 @@
$reviewer = $reviews['reviewer'];
$member = _ANONYMOUS;
}
- if(empty($reviews['respond']) && (USERUID == $authoruid || (isset($array_coauthors) && in_array(USERUID, $array_coauthors)))) $adminlink .= " [<a href=\"user.php?action=revres&reviewid=".$reviews['reviewid']."\">"._RESPOND."</a>]";
+ if(empty($reviews['respond']) && (USERUID == $authoruid || (isset($coauthors) && in_array(USERUID, $coauthors)))) $adminlink .= " [<a href=\"user.php?action=revres&reviewid=".$reviews['reviewid']."\">"._RESPOND."</a>]";
$tpl->newBlock("reviewsblock");
$tpl->assign("reviewer" , $reviewer );
$tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&url=reviews.php?reviewid=".$reviews['reviewid']."\">"._REPORTTHIS."</a>]");