|
...
|
...
|
@@ -50,11 +50,11 @@ function deleteStory($story) {
|
|
50
|
50
|
dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_reviews WHERE item = '$sid' AND type = 'ST'");
|
|
51
|
51
|
dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_favorites WHERE item = '$sid' AND type = 'ST'");
|
|
52
|
52
|
// get the coauthors list before we delete the coauthors info.
|
|
53
|
|
- $array_coauthors = array();
|
|
|
53
|
+ $coauthors = array();
|
|
54
|
54
|
if($story['coauthors'] == 1) {
|
|
55
|
55
|
$coauth = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$sid'");
|
|
56
|
56
|
while($c = dbassoc($coauth)) {
|
|
57
|
|
- $array_coauthors[] = $c['uid'];
|
|
|
57
|
+ $coauthors[] = $c['uid'];
|
|
58
|
58
|
|
|
59
|
59
|
}
|
|
60
|
60
|
}
|
|
...
|
...
|
@@ -74,9 +74,9 @@ function deleteStory($story) {
|
|
74
|
74
|
}
|
|
75
|
75
|
if($story['validated'] > 0) {
|
|
76
|
76
|
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = stories - 1");
|
|
77
|
|
- if(!empty($array_coauthors)) {
|
|
78
|
|
- $array_coauthors[] = $story['uid'];
|
|
79
|
|
- dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = stories - 1 WHERE FIND_IN_SET(uid, '".implode(",", $array_coauthors)."') > 0");
|
|
|
77
|
+ if(!empty($coauthors)) {
|
|
|
78
|
+ $coauthors[] = $story['uid'];
|
|
|
79
|
+ dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = stories - 1 WHERE FIND_IN_SET(uid, '".implode(",", $coauthors)."') > 0");
|
|
80
|
80
|
}
|
|
81
|
81
|
else dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = stories - 1 WHERE uid = '".$story['uid']."' LIMIT 1");
|
|
82
|
82
|
list($chapters, $words) = dbrow(dbquery("SELECT COUNT(chapid), SUM(wordcount) FROM ".TABLEPREFIX."fanfiction_chapters WHERE validated > 0"));
|
|
...
|
...
|
@@ -101,13 +101,13 @@ function deleteUser($uid) {
|
|
101
|
101
|
else { // Co-authors found...give the story a new author.
|
|
102
|
102
|
$cQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '".$story['sid']."' LIMIT 1");
|
|
103
|
103
|
$newauthor = 0; $coauthors = 0;
|
|
104
|
|
- $array_coauthors = array();
|
|
|
104
|
+ $coauthors = array();
|
|
105
|
105
|
while($cRes= dbassoc($cQuery)) {
|
|
106
|
106
|
if(!$newauthor) $newauthor = $cRes['uid'];
|
|
107
|
|
- else $array_coauthors[] = $cRes['uid'];
|
|
|
107
|
+ else $coauthors[] = $cRes['uid'];
|
|
108
|
108
|
}
|
|
109
|
109
|
if(!empty($newauthor)) {
|
|
110
|
|
- $coauthors = count($array_coauthors) > 0 ? 1 : 0;
|
|
|
110
|
+ $coauthors = count($coauthors) > 0 ? 1 : 0;
|
|
111
|
111
|
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET uid = '$newauthor', coauthors = '$coauthors' WHERE sid = '".$story['sid']."' LIMIT 1");
|
|
112
|
112
|
$chapters = dbquery("SELECT chapid FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$story['sid']."' AND uid = '$uid'");
|
|
113
|
113
|
while($chap = dbassoc($chapters)) {
|