| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,110 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// eFiction 3.2 |
|
| 4 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 5 |
+// Valid HTML 4.01 Transitional |
|
| 6 |
+// Based on eFiction 1.1 |
|
| 7 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 8 |
+// http://efiction.sourceforge.net/ |
|
| 9 |
+// ---------------------------------------------------------------------- |
|
| 10 |
+// LICENSE |
|
| 11 |
+// |
|
| 12 |
+// This program is free software; you can redistribute it and/or |
|
| 13 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 14 |
+// as published by the Free Software Foundation; either version 2 |
|
| 15 |
+// of the License, or (at your option) any later version. |
|
| 16 |
+// |
|
| 17 |
+// This program is distributed in the hope that it will be useful, |
|
| 18 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 |
+// GNU General Public License for more details. |
|
| 21 |
+// |
|
| 22 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 23 |
+// ---------------------------------------------------------------------- |
|
| 24 |
+ |
|
| 25 |
+if(!defined("_CHARSET")) exit( );
|
|
| 26 |
+if(empty($favorites)) accessDenied( ); |
|
| 27 |
+ |
|
| 28 |
+ if(empty($uid)) {
|
|
| 29 |
+ $uid = USERUID; |
|
| 30 |
+ $output .= "<div id='pagetitle'>"._YOURSTATS."</div>"; |
|
| 31 |
+ } |
|
| 32 |
+ $add = isset($_GET['add']) && isNumber($_GET['add']) ? $add = $_GET['add'] : false; |
|
| 33 |
+ $edit = isset($_GET['edit']) && isNumber($_GET['edit']) ? $_GET['edit'] : false; |
|
| 34 |
+ $author = isset($_GET['author']) && isNumber($_GET['author']) ? $_GET['author'] : false; |
|
| 35 |
+ $delete = isset($_GET['delete']) && isNumber($_GET['delete']) ? $_GET['delete'] : false; |
|
| 36 |
+ if(($add || $edit || $delete) && !isMEMBER) accessDenied( ); |
|
| 37 |
+ |
|
| 38 |
+ $output .= "<div class='sectionheader'>"._FAVORITESERIES."</div>"; |
|
| 39 |
+ if($delete) {
|
|
| 40 |
+ $result = dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND item = '$delete' AND type = 'SE' LIMIT 1");
|
|
| 41 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 42 |
+ else $output .= write_error(_ERROR); |
|
| 43 |
+ } |
|
| 44 |
+ else if($add && isset($_POST['submit'])) {
|
|
| 45 |
+ $result = false; |
|
| 46 |
+ $check = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND item = '$seriesid' AND type = 'SE' LIMIT 1");
|
|
| 47 |
+ if(dbnumrows($check) == 0) |
|
| 48 |
+ $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_favorites(uid, item, type, comments) VALUES ('".USERUID."', '$seriesid', 'SE', '".escapestring(descript(strip_tags(replace_naughty($_POST['comments']), $allowed_tags)))."')");
|
|
| 49 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL." "._BACK2ACCT); |
|
| 50 |
+ } |
|
| 51 |
+ else if($edit && isset($_POST['submit'])) {
|
|
| 52 |
+ $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_favorites SET comments = '".escapestring(descript(strip_tags(replace_naughty($_POST['comments']), $allowed_tags)))."' WHERE uid = '".USERUID."' AND item = '$edit' AND type = 'SE'");
|
|
| 53 |
+ if($result) $output .= write_message(_ACTIONSUCCESSFUL." "._BACK2ACCT); |
|
| 54 |
+ else $output .= write_error(_ERROR); |
|
| 55 |
+ } |
|
| 56 |
+ else if(($add || $edit) && !isset($_POST['submit'])) {
|
|
| 57 |
+ $stories = dbassoc(dbquery("SELECT series.*, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_series as series, "._AUTHORTABLE." WHERE series.uid = "._UIDFIELD." AND seriesid = '".($add ? $add : $edit)."' LIMIT 1"));
|
|
| 58 |
+ $tpl->newBlock("listings");
|
|
| 59 |
+ include("includes/seriesblock.php");
|
|
| 60 |
+ $tpl->gotoBlock("listings");
|
|
| 61 |
+ |
|
| 62 |
+ if($add) {
|
|
| 63 |
+ $check = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND item = '$add' AND type = 'SE' LIMIT 1");
|
|
| 64 |
+ if(dbnumrows($check)) {
|
|
| 65 |
+ $edit = $add; |
|
| 66 |
+ $add = false; |
|
| 67 |
+ } |
|
| 68 |
+ } |
|
| 69 |
+ if($edit) {
|
|
| 70 |
+ $query = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'SE' AND item = '$edit' LIMIT 1");
|
|
| 71 |
+ $info = dbassoc($query); |
|
| 72 |
+ } |
|
| 73 |
+ $tpl->assign("pagelinks", "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=favse&add=1&seriesid=".($add ? $add : $edit)."\">\n
|
|
| 74 |
+ <div style=\"width: 350px; margin: 0 auto; text-align: left;\"><label for=\"comments\">"._COMMENTS.":</label><br /> |
|
| 75 |
+ <textarea class=\"textbox\" name=\"comments\" id=\"comments\" cols=\"40\" rows=\"5\">".(isset($info['comments']) ? $info['comments'] : "")."</textarea><br /> |
|
| 76 |
+ <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form>"); |
|
| 77 |
+ $tpl->gotoBlock("_ROOT");
|
|
| 78 |
+ |
|
| 79 |
+ } |
|
| 80 |
+ else {
|
|
| 81 |
+ $storyquery = "SELECT series.*, "._PENNAMEFIELD." as penname, fav.comments as comments FROM ".TABLEPREFIX."fanfiction_series as series, ".TABLEPREFIX."fanfiction_favorites as fav, "._AUTHORTABLE." WHERE fav.uid = '$uid' AND fav.type = 'SE' AND series.uid = "._UIDFIELD." AND fav.item = series.seriesid ORDER BY series.title"; |
|
| 82 |
+ $countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid' AND type = 'SE' GROUP BY uid");
|
|
| 83 |
+ list($seriescount) = dbrow($countquery); |
|
| 84 |
+ if($seriescount) {
|
|
| 85 |
+ $tpl->newBlock("listings");
|
|
| 86 |
+ $list = dbquery($storyquery." LIMIT $offset, $itemsperpage"); |
|
| 87 |
+ $count = 0; |
|
| 88 |
+ while($stories = dbassoc($list)) {
|
|
| 89 |
+ include("includes/seriesblock.php");
|
|
| 90 |
+ if(file_exists("./$skindir/favcomment.tpl")) $cmt = new TemplatePower( "./$skindir/favcomment.tpl" );
|
|
| 91 |
+ else $cmt = new TemplatePower( "./default_tpls/favcomment.tpl" ); |
|
| 92 |
+ $cmt->prepare( ); |
|
| 93 |
+ $cmt->newBlock("comment");
|
|
| 94 |
+ $cmt->assign("comment", $stories['comments'] ? "<div class='comments'><span class='label'>"._COMMENTS.": </span>".strip_tags($stories['comments'])."</div>" : "");
|
|
| 95 |
+ if(USERUID == $uid) |
|
| 96 |
+ $cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"user.php?action=favse&edit=".$stories['seriesid']."\">"._EDIT."</a> | <a href=\"user.php?action=favse&delete=".$stories['seriesid']."\">"._REMOVEFAV."</a></div>");
|
|
| 97 |
+ $cmt->assign("oddeven", ($count % 2 ? "odd" : "even"));
|
|
| 98 |
+ $tpl->assign("comment", $cmt->getOutputContent( ));
|
|
| 99 |
+ $count++; |
|
| 100 |
+ } |
|
| 101 |
+ if($seriescount > $itemsperpage) {
|
|
| 102 |
+ $tpl->gotoBlock("listings");
|
|
| 103 |
+ $tpl->assign("pagelinks", build_pagelinks(basename($_SERVER['PHP_SELF'])."?action=favse&uid=$uid&", $seriescount, $offset));
|
|
| 104 |
+ } |
|
| 105 |
+ |
|
| 106 |
+ } |
|
| 107 |
+ else $output .= write_message(_NORESULTS); |
|
| 108 |
+ } |
|
| 109 |
+ $tpl->gotoBlock( "_ROOT" ); |
|
| 110 |
+?> |