Browse code

e107 bridge

Jimako authored on 2020/02/28 08:31:56
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,62 @@
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
+//                                                                             user_id
22
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
23
+// ----------------------------------------------------------------------
24
+
25
+if(!defined("_CHARSET")) exit( );
26
+
27
+//replace with e107 stuff  */
28
+
29
+if (USERID) {
30
+    // is log in e107, so it's member
31
+    define("isMEMBER", true);
32
+    define("USERUID", USERID);
33
+    define("USERPENNAME", USERNAME);
34
+    // check if it's author, so they are in author table 
35
+    $userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." 
36
+    LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".USERUID."'"));
37
+ 
38
+    if($userdata && $userdata['level'] != -1 ) {
39
+		define("USERUID", $userdata['uid']);
40
+		define("USERPENNAME", $userdata['penname']);
41
+		// the following line fixes missing authorpref rows
42
+		if(empty($userdata['userskin'] )) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".$userdata['uid']."', '$defaultskin', '$displayindex', '$defaultsort', '$tinyMCE')");
43
+		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
44
+		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
45
+		else $siteskin = $defaultskin;
46
+		define("uLEVEL", $userdata['level']);
47
+		define("isADMIN", uLEVEL > 0 ? true : false);
48
+		define("isMEMBER", true);
49
+		if(EMPTY($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $userdata['ageconsent'];
50
+		else $ageconsent = $_SESSION[$sitekey."_agecontsent"];
51
+	} 
52
+}
53
+ 
54
+if(!defined("USERUID")) define("USERUID", 0);
55
+if(!defined("USERPENNAME")) define("USERPENNAME", false);
56
+if(!defined("uLEVEL")) define("uLEVEL", 0);
57
+if(!defined("isMEMBER")) define("isMEMBER", false);
58
+if(!defined("isADMIN")) define("isADMIN", false);
59
+if(empty($siteskin)) $siteskin = $defaultskin;
60
+ 
61
+
62
+?>
0 63
\ No newline at end of file