assign("FIC_SEPARATOR", $fic_separator); // Fic info $query = "SELECT * FROM $stories_table WHERE id = '$story_id'"; $result = mysql_query($query); $story = mysql_fetch_array($result); $template->assign("FIC_TITLE", stripslashes($story['fic_title'])); $template->assign("BY", $lang['by']); $template->assign("AUTHOR", stripslashes($story['author'])); $template->assign("USER_ID", $story['user_id']); // Categories $cats = format_story_info($story['cat_id'], "cats.php?cat_id=", "&action=cat", "cats"); $template->assign("CATEGORY", $cats); // Pairing? if ($story['pairing']) { $pairing_list = format_story_info($story['pairing'], "search.php?action=search&field=pairing&value=", "&type=like", "pairings"); $template->assign("PAIRING", $pairing_list); $template->assign_if("pairing", "1"); } // Characters? if ($story['characters']) { $characters = format_story_info($story['characters'], "search.php?action=search&field=characters&value=", "&type=like", "char"); $template->assign("CHARACTERS", $characters); $template->assign_if("characters", "1"); } // Genres $genres = get_option_names("genre", $story['genre'], 'link'); $template->assign("GENRES", $genres); // Rating $rating = get_option_names("rating", $story['rating'], 'link'); $template->assign("RATING", $rating); // Warnings if ($story['warnings']) { $warnings = get_option_names("warnings", $story['warnings'], 'link'); $template->assign("WARNINGS", $warnings); $template->assign_if("warning", "1"); } // Spoilers if ($story['spoilers'] AND !preg_match("/[nN]o(ne)?$/", $story['spoilers'])) { $template->assign("SPOILERS", $story['spoilers']); $template->assign_if("spoilers", "1"); } // Fic summary if (!empty($story['summary'])) { $summary_text = format_text($story['summary']); $template->assign("SUMMARY", $summary_text); $template->assign("SUMMARY_LABEL", $lang['summary']); $template->assign_if("summary", "1"); } // Story notes if (!empty($story['notes'])) { $notes = format_text($story['notes']); $template->assign_if("notes", "1"); $template->assign("AUTHOR_NOTES", $notes); $template->assign("AUTHOR_NOTES_LABEL", stripslashes($lang['notes'])); } // Is a response to a challenge from the challenges page? if ($story['challenge'] != "00000") { $challenge_id = $story['challenge']; $query_challenge = "SELECT title FROM $challenges_table WHERE id = '$challenge_id'"; $challenge_query = mysql_query($query_challenge) or die("challenge_query error: ".mysql_error()); $challenge = mysql_fetch_array($challenge_query); $template->assign_if("challenge", "1"); $template->assign("CHALLENGE", rtrim(ltrim($story['challenge'], '0'), '.')); $template->assign("CHALLENGE_LABEL", stripslashes($lang['challenge_answer'])); $template->assign("CHALLENGE_TEXT", stripslashes($lang['challenge'])); $template->assign("CHALLENGE_TITLE", $challenge['title']); } // Chapters $query_chapter = "SELECT id, story_id, chapter_num, chapter_title, summary, notes, DATE_FORMAT(date, '$date_format') AS date FROM $chapters_table WHERE story_id = '$story_id'"; $result_chapters = mysql_query($query_chapter); while ($chapter = mysql_fetch_array($result_chapters)) { $t_chapter = new Template(); $t_chapter->assign("CHAPTER_TITLE", $chapter['chapter_title']); $t_chapter->assign("CHAPTER", $chapter['chapter_num']); // Date $t_chapter->assign("DATE", $chapter['date']); // Summary $summary = format_text($chapter['summary']); $t_chapter->assign("SUMMARY", $summary); // Link $t_chapter->assign("STORY_ID", $story_id); $chapters .= $t_chapter->parse("layout/chapter_list.tmpl"); } $template->assign("CHAPTERS", $chapters); if ($story['complete'] == "Yes") { $template->assign("STATUS", $lang['story_completed']); $template->assign_if("complete", "1"); } else { $template->assign("STATUS", $lang['story_not_completed']); } // Process template $template->assign("FICS", $fics); $page_title = " ".$page_title_separator." ".$lang['chapters']." ".$page_title_separator." ".$story['fic_title']; $template->assign("PAGE_TITLE", $page_title); $template->pparse("layout/chapters.tmpl"); ////////////////// endconnect(); ?>