Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,114 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Copyright (c) 2007 by Tammy Keefer
4
+// Based on eFiction 1.1
5
+// Copyright (C) 2003 by Rebecca Smallwood.
6
+// http://efiction.sourceforge.net/
7
+// ----------------------------------------------------------------------
8
+// LICENSE
9
+//
10
+// This program is free software; you can redistribute it and/or
11
+// modify it under the terms of the GNU General Public License (GPL)
12
+// as published by the Free Software Foundation; either version 2
13
+// of the License, or (at your option) any later version.
14
+//
15
+// This program is distributed in the hope that it will be useful,
16
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+// GNU General Public License for more details.
19
+//
20
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
+// ----------------------------------------------------------------------
22
+
23
+
24
+/* 
25
+This file does some of the setup of the common elements of the pages within your site. 
26
+It also checks the common $_GET variables and cleans them up to prevent hacking and attacks.
27
+*/
28
+
29
+if(!defined("_CHARSET")) exit( );
30
+
31
+$favtypes = array("SE" => "series", "ST" => "stories", "AU" =>"authors");
32
+$revtypes = array("SE" => "series", "ST" => "stories");
33
+
34
+$catlist = array( );
35
+$catresults = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_categories ORDER BY leveldown, displayorder");
36
+while($cat = dbassoc($catresults)) {
37
+	$catlist[$cat['catid']] = array("name" => stripslashes($cat['category']), "pid" => $cat['parentcatid'], "order" => $cat['displayorder'], "locked" => $cat['locked'], "leveldown" => $cat['leveldown']);
38
+}
39
+$charlist = array( );
40
+$result = dbquery("SELECT charname, catid, charid FROM ".TABLEPREFIX."fanfiction_characters ORDER BY charname");
41
+while($char = dbassoc($result)) {
42
+	$charlist[$char['charid']] = array("name" => stripslashes($char['charname']), "catid" => $char['catid']);
43
+}
44
+$classlist = array( );
45
+$classresults = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classes ORDER BY class_name");
46
+while($class = dbassoc($classresults)) {
47
+	$classlist[$class['class_id']] = array("type" => $class['class_type'], "name" => stripslashes($class['class_name']));
48
+}
49
+$classtypelist = array( );
50
+$classtyperesults = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes ORDER BY classtype_name");
51
+while($type = dbassoc($classtyperesults)) {
52
+	$classtypelist[$type['classtype_id']] = array("name" => $type['classtype_name'], "title" => stripslashes($type['classtype_title']));
53
+}
54
+$ratlist = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_ratings");
55
+while($rate = dbassoc($ratlist)) {
56
+	$ratingslist[$rate['rid']] = array("name" => $rate['rating'], "ratingwarning" => $rate['ratingwarning'], "warningtext" => $rate['warningtext']);
57
+}
58
+unset($catresult, $result, $classresults, $classtyperesults, $ratlist, $type, $rate, $class, $char, $cat);
59
+$action = escapestring($action);
60
+// Set up the page template
61
+
62
+if($action != "printable") {
63
+	$tpl->assignInclude( "header", "./$skindir/header.tpl" );
64
+	$tpl->assignInclude( "footer", "./$skindir/footer.tpl" );
65
+}
66
+$tpl->prepare( );
67
+// End page template setup
68
+
69
+if(file_exists("$skindir/variables.php")) include("$skindir/variables.php");
70
+
71
+// If they weren't set in variables.php, set the defaults for these 
72
+if(!isset($up)) $up = "<img src=\"images/arrowup.gif\" border=\"0\" width=\"13\" height=\"18\" align=\"left\" alt=\""._UP."\">";
73
+if(!isset($down)) $down = "<img src=\"images/arrowdown.gif\" border=\"0\" width=\"13\" height=\"18\" align=\"right\" alt=\""._DOWN."\">";
74
+
75
+$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks ORDER BY link_access ASC");
76
+if(!isset($current)) $current = "";
77
+
78
+while($link = dbassoc($linkquery)) {
79
+	if($link['link_access'] && !isMEMBER) continue;
80
+	if($link['link_access'] == 2 && uLEVEL < 1) continue;
81
+	if($link['link_name'] == "register" && isMEMBER) continue;
82
+	if(strpos($link['link_url'], "http://") === false && strpos($link['link_url'], "https://") === false) $link['link_url'] = _BASEDIR.$link['link_url'];
83
+	$tpl->assignGlobal($link['link_name'], "<a href=\"".$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").(!empty($link['link_key']) ? " accesskey='".$link['link_key']."'" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
84
+	$pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => $link['link_url'], "key" => $link['link_key'], "link" => "<a href=\"".$link['link_url']."\" title=\"".$link['link_text']."\"".(!empty($link['link_key']) ? " accesskey='".$link['link_key']."'" : "").($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
85
+}
86
+
87
+if($action != "printable") $tpl->newBlock("header");
88
+$tpl->assignGlobal("sitename", $sitename);
89
+$tpl->assignGlobal("slogan", $slogan);
90
+$tpl->assignGlobal("page_id", $current);
91
+$tpl->assignGlobal("basedir", _BASEDIR);
92
+$tpl->assignGlobal("skindir", $skindir);	
93
+$tpl->assignGlobal("rss", "<a href='"._BASEDIR.$pagelinks['rss']['url']."'><img src='"._BASEDIR."images/xml.gif' alt='RSS' title = 'RSS' border='0'></a>");
94
+if(isset($pagelinks['rss'])) $tpl->assignGlobal("columns", $displaycolumns);
95
+if($action != "printable") {
96
+	$tpl->newBlock("footer");
97
+	$copy = dbquery("SELECT message_text FROM ".TABLEPREFIX."fanfiction_messages WHERE message_name = 'copyright' LIMIT 1");
98
+	if($copy) list($copyright) = dbrow($copy);
99
+	$tpl->assign( "footer", $copyright);
100
+	$tpl->gotoBlock( "_ROOT" );
101
+}
102
+foreach($blocks as $block=>$value) {
103
+	if(empty($value['status']) || ($value['status'] == 2 && $current != "home")) continue;
104
+	if(empty($value['file'])) continue;
105
+	if($value['status'] && file_exists(_BASEDIR."blocks/".$value['file'])) {
106
+		$content = "";
107
+		$tpl->assignGlobal($block."_title", !empty($value['title']) ? stripslashes($value['title']) : "");
108
+		if(file_exists(_BASEDIR."blocks/".$value['file'])) include(_BASEDIR."blocks/".$value['file']);
109
+		$tpl->assignGlobal($block."_content", $content);
110
+	}
111
+}
112
+
113
+$tpl->gotoBlock( "_ROOT" );
114
+?>
0 115
\ No newline at end of file