| ... | ... |
@@ -63,16 +63,15 @@ function storyform($stories, $preview = 0){
|
| 63 | 63 |
<div id='coauthorsDiv' name='coauthorsDiv' style='visibility: hidden;'></div> |
| 64 | 64 |
<iframe id='coauthorsshim' scr='' scrolling='no' frameborder='0' class='shim'></iframe> |
| 65 | 65 |
<div><label for='coauthorsSelected'>"._COAUTHORS.": <br /><select name='coauthorsSelected' id='coauthorsSelected' size='8' multiple='multiple' class='multiSelect' onclick='javascript: removeMember(\"coauthors\");'>"; |
| 66 |
- $array_couids = array() ; |
|
| 67 |
- $couids = ""; |
|
| 66 |
+ $couids = array() ; |
|
| 68 | 67 |
if(is_array($stories['coauthors']) && count($stories['coauthors'])) {
|
| 69 | 68 |
$coauths = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".implode(",", $stories['coauthors'])."') > 0");
|
| 70 | 69 |
while($c = dbassoc($coauths)) {
|
| 71 | 70 |
if($c['uid'] == $stories['uid']) continue; |
| 72 | 71 |
$output .= "<option label='".$c['penname']."' value='".$c['uid']."'>".$c['penname']."</option>"; |
| 73 |
- $array_couids[] = $c['uid']; |
|
| 72 |
+ $couids[] = $c['uid']; |
|
| 74 | 73 |
} |
| 75 |
- $couids = implode(",", $array_couids);
|
|
| 74 |
+ $couids = implode(",", $couids);
|
|
| 76 | 75 |
} |
| 77 | 76 |
$output .= "</select></label> |
| 78 | 77 |
<input type='hidden' name='coauthors' id='coauthors' value='$couids'></div>"; |
| ... | ... |
@@ -174,4 +173,4 @@ function chapterform($inorder, $notes, $endnotes, $storytext, $chaptertitle, $ui |
| 174 | 173 |
return $output; |
| 175 | 174 |
} |
| 176 | 175 |
// end chapterform |
| 177 |
-?> |
|
| 178 | 176 |
\ No newline at end of file |
| 177 |
+?> |
| ... | ... |
@@ -48,16 +48,16 @@ include("includes/storyform.php");
|
| 48 | 48 |
if($result) list($sid, $author) = dbrow($result); |
| 49 | 49 |
} |
| 50 | 50 |
if(isset($sid)) {
|
| 51 |
- $array_coauthors = array( ); |
|
| 51 |
+ $coauthors = array( ); |
|
| 52 | 52 |
$authorquery = dbquery("SELECT uid, rr, coauthors FROM ".TABLEPREFIX."fanfiction_stories WHERE sid='$sid' LIMIT 1");
|
| 53 | 53 |
$story = dbassoc($authorquery); |
| 54 | 54 |
if($story['coauthors']) {
|
| 55 | 55 |
$cQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$sid'");
|
| 56 | 56 |
while($c = dbassoc($cQuery)) {
|
| 57 |
- $array_coauthors[] = $c['uid']; |
|
| 57 |
+ $coauthors[] = $c['uid']; |
|
| 58 | 58 |
} |
| 59 | 59 |
} |
| 60 |
- if($story['uid'] != USERUID && (is_array($array_coauthors) && !in_array(USERUID, $array_coauthors)) && !$story['rr']) accessDenied( ); |
|
| 60 |
+ if($story['uid'] != USERUID && (is_array($coauthors) && !in_array(USERUID, $coauthors)) && !$story['rr']) accessDenied( ); |
|
| 61 | 61 |
} |
| 62 | 62 |
} |
| 63 | 63 |
else if(isADMIN && uLEVEL < 4 && isset($_GET['admin'])) {
|
| ... | ... |
@@ -139,7 +139,7 @@ function newstory( ) {
|
| 139 | 139 |
$storynotes = isset($_POST['storynotes']) ? descript(strip_tags($_POST['storynotes'], $allowed_tags)) : ""; |
| 140 | 140 |
$catid = isset($_POST['catid']) ? array_filter(explode(",", $_POST['catid']), "isNumber") : array( );
|
| 141 | 141 |
$charid = isset($_POST['charid']) ? array_filter($_POST['charid'], "isNumber") : array( ); |
| 142 |
- $array_coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
|
|
| 142 |
+ $coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
|
|
| 143 | 143 |
$classes = array( ); |
| 144 | 144 |
$classquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes");
|
| 145 | 145 |
while($type = dbassoc($classquery)) {
|
| ... | ... |
@@ -178,8 +178,8 @@ function newstory( ) {
|
| 178 | 178 |
$words_to_count = trim($words_to_count); |
| 179 | 179 |
$wordcount = count(explode(" ",$words_to_count));
|
| 180 | 180 |
$au[] = $uid; |
| 181 |
- if(count($array_coauthors)) {
|
|
| 182 |
- $au = array_merge($au, $array_coauthors); |
|
| 181 |
+ if(count($coauthors)) {
|
|
| 182 |
+ $au = array_merge($au, $coauthors); |
|
| 183 | 183 |
$coauthors = 1; |
| 184 | 184 |
} |
| 185 | 185 |
else $coauthors = 0; |
| ... | ... |
@@ -273,7 +273,7 @@ function newstory( ) {
|
| 273 | 273 |
else $output .= write_error(_FATALERROR." "._TRYAGAIN); |
| 274 | 274 |
} |
| 275 | 275 |
if(!$newchapter) {
|
| 276 |
- if(count($array_coauthors)) {
|
|
| 276 |
+ if(!is_array($coauthors)) {
|
|
| 277 | 277 |
foreach($au AS $c) {
|
| 278 | 278 |
if($c == $uid) continue; |
| 279 | 279 |
dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_coauthors(`sid`, `uid`) VALUES('$sid', '$c')");
|
| ... | ... |
@@ -635,7 +635,7 @@ function editstory($sid) {
|
| 635 | 635 |
$rid = isset($_POST['rid']) && isNumber($_POST['rid']) ? $_POST['rid'] : 0; |
| 636 | 636 |
$catid = isset($_POST['catid']) ? array_filter(explode(",", $_POST['catid']), "isNumber") : array( );
|
| 637 | 637 |
$charid = isset($_POST['charid']) ? array_filter($_POST['charid'], "isNumber") : array( ); |
| 638 |
- $array_coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
|
|
| 638 |
+ $coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
|
|
| 639 | 639 |
if(isset($_POST['uid']) && isNumber($_POST['uid'])) $uid = $_POST['uid']; |
| 640 | 640 |
else $uid = USERUID; |
| 641 | 641 |
$classes = array( ); |
| ... | ... |
@@ -648,8 +648,8 @@ function editstory($sid) {
|
| 648 | 648 |
} |
| 649 | 649 |
if(!$admin && $authorvalid && !$validated) $validated = 2; |
| 650 | 650 |
$au[] = $uid; |
| 651 |
- if(count($array_coauthors)) {
|
|
| 652 |
- $au = array_merge($au, $array_coauthors); |
|
| 651 |
+ if(count($coauthors)) {
|
|
| 652 |
+ $au = array_merge($au, $coauthors); |
|
| 653 | 653 |
$coauthors = 1; |
| 654 | 654 |
} |
| 655 | 655 |
else $coauthors = 0; |
| ... | ... |
@@ -50,21 +50,21 @@ if(empty($chapter)) $chapter = isset($_GET['chapter']) && isNumber($_GET['chapte |
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
if($storyinfo['coauthors'] > 0) {
|
| 53 |
- $array_coauthors = array(); |
|
| 53 |
+ $coauthors = array(); |
|
| 54 | 54 |
$coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$sid."'");
|
| 55 | 55 |
while($c = dbassoc($coauth)) {
|
| 56 |
- $array_coauthors[$c['uid']] = $c['penname']; |
|
| 56 |
+ $coauthors[$c['uid']] = $c['penname']; |
|
| 57 | 57 |
} |
| 58 |
- $storyinfo['coauthors_array'] = $array_coauthors; |
|
| 59 |
- unset($array_coauthors); |
|
| 58 |
+ $storyinfo['coauthors'] = $coauthors; |
|
| 59 |
+ unset($coauthors); |
|
| 60 | 60 |
} |
| 61 |
- else $storyinfo['coauthors_array'] = array(); |
|
| 61 |
+ else $storyinfo['coauthors'] = array(); |
|
| 62 | 62 |
|
| 63 | 63 |
|
| 64 | 64 |
// Check that the story is valid and that the visitor has permissions to read this story |
| 65 | 65 |
$warning = ""; |
| 66 | 66 |
if(!$storyinfo) $warning = _INVALIDSTORY; |
| 67 |
- if(!$storyinfo['valid'] && !isADMIN && ($storyinfo['uid'] != USERUID || !in_array(USERUID, $storyinfo['coauthors_array']))) $warning = _ACCESSDENIED; |
|
| 67 |
+ if(!$storyinfo['valid'] && !isADMIN && ($storyinfo['uid'] != USERUID || !in_array(USERUID, $storyinfo['coauthors']))) $warning = _ACCESSDENIED; |
|
| 68 | 68 |
if ($storyinfo['rid'] != 0 ) {
|
| 69 | 69 |
$ratingquery = dbquery("SELECT ratingwarning, warningtext FROM " . TABLEPREFIX . "fanfiction_ratings WHERE rid = '" . $storyinfo['rid'] . "' LIMIT 1");
|
| 70 | 70 |
$rating = dbassoc($ratingquery); |
| ... | ... |
@@ -160,7 +160,7 @@ if($action == "printable") {
|
| 160 | 160 |
$chapterinfo = dbquery("SELECT *, "._PENNAMEFIELD." as penname FROM (".TABLEPREFIX."fanfiction_chapters as c, "._AUTHORTABLE.") WHERE sid = '$sid' AND inorder = '$chapter' AND c.uid = "._UIDFIELD." LIMIT 1");
|
| 161 | 161 |
$c = dbassoc($chapterinfo); |
| 162 | 162 |
// if the *CHAPTER* hasn't been validated and the viewer isn't an admin or the author throw them a warning. |
| 163 |
- if(empty($c['validated']) && !isADMIN && USERUID != $c['uid'] && !in_array(USERUID, $stories['coauthors_array'])) {
|
|
| 163 |
+ if(empty($c['validated']) && !isADMIN && USERUID != $c['uid'] && !in_array(USERUID, $stories['coauthors'])) {
|
|
| 164 | 164 |
$warning = write_error(_ACCESSDENIED); |
| 165 | 165 |
$tpl->assign("archivedat", $warning);
|
| 166 | 166 |
$tpl->printToScreen( ); |
| ... | ... |
@@ -346,7 +346,7 @@ else {
|
| 346 | 346 |
$printicon = "<a href=\"viewstory.php?action=printable&sid=$sid&textsize=$textsize&chapter=1\" target=\"_blank\"><img src='".(isset($printer) ? $priner : "images/print.gif")."' border='0' alt='"._PRINTER."'></a>"; |
| 347 | 347 |
} |
| 348 | 348 |
// if the *CHAPTER* hasn't been validated and the viewer isn't an admin or the author throw them a warning. |
| 349 |
- if(!$valid && !isADMIN && USERUID != $chapterauthor && !in_array($chapterauthor, $storyinfo['coauthors_array'])) {
|
|
| 349 |
+ if(!$valid && !isADMIN && USERUID != $chapterauthor && !in_array($chapterauthor, $storyinfo['coauthors'])) {
|
|
| 350 | 350 |
$warning = accessDenied( ); |
| 351 | 351 |
} |
| 352 | 352 |
$stories = $storyinfo; |
| ... | ... |
@@ -357,7 +357,7 @@ else {
|
| 357 | 357 |
if(isADMIN && uLEVEL < 3) |
| 358 | 358 |
$adminlinks = "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> "._EDIT." - <a href=\"stories.php?action=editstory&sid=$sid&admin=1\">"._STORY."</a> "._OR." <a href=\"stories.php?action=editchapter&chapid=$chapid&admin=1\">"._CHAPTER."</a> | "._DELETE." - <a href=\"stories.php?action=delete&sid=$sid&admin=1\">"._STORY."</a> "._OR." <a href=\"stories.php?action=delete&chapid=$chapid&sid=$sid&admin=1\">"._CHAPTER."</a></div>"; |
| 359 | 359 |
if(isMEMBER && $favorites) {
|
| 360 |
- $jumpmenu2 .= "<option value=\"user.php?action=favst&add=1&sid=$sid\">"._ADDSTORY2FAVES."</option><option value=\"user.php?action=favau&add=1&author=".$stories['uid'].(count($storyinfo['coauthors_array']) ? ",".implode(",", array_keys($storyinfo['coauthors_array'])) : "")."\">"._ADDAUTHOR2FAVES."</option>";
|
|
| 360 |
+ $jumpmenu2 .= "<option value=\"user.php?action=favst&add=1&sid=$sid\">"._ADDSTORY2FAVES."</option><option value=\"user.php?action=favau&add=1&author=".$stories['uid'].(count($storyinfo['coauthors']) ? ",".implode(",", array_keys($storyinfo['coauthors'])) : "")."\">"._ADDAUTHOR2FAVES."</option>";
|
|
| 361 | 361 |
} |
| 362 | 362 |
if($reviewsallowed ) {
|
| 363 | 363 |
if(isMEMBER || $anonreviews) {
|