Browse code

e107 edit profile

Jimako authored on 2020/03/04 09:06:51
Showing 2 changed files
... ...
@@ -7,7 +7,10 @@ to restore from a failed bridge.
7 7
 This bridge can be used only for efiction installed as the subdirectory of e107 site
8 8
 
9 9
 1. add 
10
-`@ include_once(UN_FULLAPP_PATH."class2.php");`
10
+`@ include_once(_BASEDIR.UN_FULLAPP_PATH."class2.php");
11
+
12
+Note: Full path is important because modules, example:
13
+`define("UN_FULLAPP_PATH", "../");`
11 14
 
12 15
 after 
13 16
 `@ include_once(_BASEDIR."config.php");`
... ...
@@ -30,7 +33,17 @@ if your e107 use the same theme as efiction, user will not notice difference
30 33
 
31 34
 
32 35
 
36
+## Way how to load e107 theme
37
+(to have css in one place and use e107 caching)
38
+
39
+`$cssId =  "theme_css";`
40
+`$e_js->renderJs($cssId, false, 'css', false);`
41
+`$e_js->renderCached('css');`
33 42
 
43
+- removed all css from header.php
34 44
 
45
+## User Profile Settings
46
+- add panel with /user/settings 
47
+- use modified editbio.php to remove account related info (name, password, email)
35 48
 
36 49
 
37 50
new file mode 100644
... ...
@@ -0,0 +1,126 @@
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(!function_exists("random_char")) {
27
+
28
+function random_char($string)
29
+{
30
+	$length = strlen($string);
31
+	$position = mt_rand(0, $length - 1);
32
+	$output = ($string[$position]);
33
+	return $output;
34
+}
35
+
36
+function random_string ($charset_string, $length)
37
+{
38
+	$return_string = random_char($charset_string);
39
+	for ($x = 1; $x < $length; $x++)
40
+	$return_string .= random_char($charset_string);
41
+	return $return_string;
42
+}
43
+
44
+}
45
+	$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false;
46
+	if(!$uid) $uid = USERUID;
47
+
48
+	if((!isADMIN || uLEVEL > 2) && $uid != USERUID && $action == "editbio") $output .= write_error(_NOTAUTHORIZED);
49
+	if(isMEMBER) $output .= "<div id=\"pagetitle\">"._EDITPERSONAL."</div>";
50
+	else $output .= "<div id=\"pagetitle\">"._NEWACCOUNT."</div>";
51
+	if(!empty($_POST['submit'])) {
52
+ 
53
+ 
54
+/* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
55
+			$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
56
+			while($field = dbassoc($fields)) {
57
+				$uid = isset($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : false;
58
+				if(!$uid) continue;
59
+				$oldfield = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE field='".$field['field_id']."' AND uid = '".$uid."'");
60
+				if(dbnumrows($oldfield) > 0) {
61
+					$newinfo = isset($_POST["af_".$field['field_name']]) ? escapestring(descript($_POST["af_".$field['field_name']])) : false;
62
+					if(!empty($newinfo)) dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info='".$newinfo."' WHERE uid = '$uid' AND field = '".descript($field['field_id'])."'");
63
+					else dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid' AND field = '".$field['field_id']."'");
64
+				}
65
+				else if(!empty($_POST["af_".$field['field_name']])) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`, `field`) VALUES('$uid', '".escapestring($_POST["af_".$field['field_name']])."', '".$field['field_id']."');");
66
+			}
67
+/* End dynamic fields */
68
+		   
69
+			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT));
70
+	 
71
+	}
72
+	else {
73
+		if($action != "register") {
74
+			$result = dbquery("SELECT * FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
75
+			$user = dbassoc($result);
76
+			$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
77
+			while($field = dbassoc($result2)) {
78
+				$user["af_".$field['field']] = $field['info'];
79
+			}
80
+		}
81
+ 
82
+		$output .= "<div id='settingsform'>
83
+        <form method=\"POST\" id=\"editbio\" name=\"editbio\" enctype=\"multipart/form-data\" style='margin: 0 auto;' 
84
+        action=\"user.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
85
+		<div><label for='newpenname'>"._PENNAME.":</label>";
86
+		$output .= " ".$user['user_name'];
87
+		$output .= "</div>
88
+        <div><label for='realname'>"._REALNAME.": </label>";
89
+        $output .= " ".$user['user_realm'];
90
+        $output .= "</div>";
91
+ 		$output .= "<div><label for='realname'>"._EMAIL.": </label>";
92
+        $output .= " ".$user['user_email'];
93
+        $output .= "</div>";       
94
+ 		$output .= "<div><label for='realname'>"._BIO.": </label>";
95
+        $output .= " ".$user['user_email'];
96
+        $output .= "</div>"; 
97
+	 	 /* The section adds fields to the form from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
98
+		$authorfields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
99
+		while($field = dbassoc($authorfields)) {
100
+			if($field['field_type'] == 1 || $field['field_type'] == 4 || $field['field_type'] == 6) 
101
+				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n<input type='text' class='textbox' name='af_".$field['field_name']."'".(!empty($user["af_".$field['field_id']]) ? "value='".$user["af_".$field['field_id']]."'" : "").">\n</div>\n";
102
+			if($field['field_type'] == 2) {
103
+				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n
104
+						<select class='textbox' name='af_".$field['field_name']."'>\n";
105
+				$opts = explode("|#|", $field['field_options']);
106
+				foreach($opts as $opt) {
107
+					$output .= "<option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == $opt ? " selected" : "").">$opt</option>\n";
108
+				}
109
+				$output .= "</select>\n</div>\n";
110
+			}
111
+			if($field['field_type'] == 5) eval(stripslashes($field['field_code_in']));
112
+			if($field['field_type'] == 3) {
113
+				$output .= "<div class='fieldset'><span class='label'>".$field['field_title'].":</span>\n";
114
+				$output .= "<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._YES."' value='"._YES."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _YES ? "checked='checked'" : "")."> <label for='".$field['field_name']._YES."'>"._YES."</label>\n
115
+					<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._NO."' value='"._NO."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _NO ? "checked='checked'" : "")."> <label for='".$field['field_name']._NO."'>"._NO."</label></div>\n";
116
+			}
117
+		}
118
+/* End dynamic fields */
119
+ 	 	$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";
120
+	 	if(!isADMIN && $action != "register")
121
+	 	{
122
+			 	$output .= " [<a href=\"admin.php?action=members&delete=$uid\">"._DELETE."</a>]";
123
+	 	}
124
+	 	$output .= "</div></form></div>".write_message("<font color=\"red\">*</font> "._REQUIREDFIELDS);
125
+	}
126
+?>
0 127
\ No newline at end of file