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,76 @@
1
+<?php
2
+// Build the user's profile information
3
+if(!defined("_CHARSET")) exit( );
4
+if(file_exists("languages/{$language}_SMF.php")) include("languages/{$language}_SMF.php");
5
+else include("languages/en_SMF.php");
6
+
7
+$tpl->newBlock("profile");
8
+$result2 = dbquery("SELECT *, "._UIDFIELD." as uid FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
9
+$userinfo = dbassoc($result2);
10
+$nameinfo = "";
11
+if($userinfo['emailAddress']) {
12
+	list($allowGuestsContact) = dbrow(dbquery("SELECT panel_level FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_type = 'P' AND panel_name = 'contact' LIMIT 1"));
13
+	if($allowGuestsContact == "0") $nameinfo .= " [<a href=\"viewuser.php?action=contact&amp;uid=".$userinfo['uid']."\">"._CONTACT."</a>]";
14
+}
15
+if(isMEMBER) {
16
+	$nameinfo .= "[<a href='".PATHTOSMF."index.php?action=pm;sa=send;u=".$userinfo['uid']."'>"._PRIVATEMESSAGE."</a>]";
17
+}
18
+if(!empty($favorites) && isMEMBER && $userinfo['uid'] != USERUID) {
19
+	$fav = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'AU' AND item = '".$userinfo['uid']."'");
20
+	if(dbnumrows($fav) == 0) $nameinfo .= " [<a href=\"user.php?uid=USERUID&amp;action=favau&amp;author=".$userinfo['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
21
+}
22
+$tpl->assign("userpenname", $userinfo['memberName']." ".$nameinfo);
23
+$tpl->assign("membersince", date("$dateformat", $userinfo['dateRegistered']));
24
+if($userinfo['realName'])
25
+	$tpl->assign("realname", $userinfo['realName']);
26
+if(!empty($userinfo['avatar']))
27
+	$tpl->assign("image", "<img src=\"".$path_to_smf."avatars/".$userinfo['avatar']."\">");
28
+$tpl->assign("userlevel", isset($userinfo['level']) && $userinfo['level'] > 0 && $userinfo['level'] < 4 ? _ADMINISTRATOR.(isADMIN ? " - ".$userinfo['level'] : "") : _MEMBER);
29
+/* Dynamic authorinfo fields */
30
+$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
31
+if(!empty($userinfo['websiteUrl'])) 
32
+	$tpl->assign("website", "<a href='".$userinfo['websiteUrl']."'>".(!empty($userinfo['websiteTitle']) ? $userinfo['websiteTitle'] : $userinfo['websiteUrl'])."</a>");
33
+	$tpl->assign("aol", !empty($userinfo['AOL']) ? "<img src=\"http://big.oscar.aol.com/".$userinfo['AOL']."?on_url=$url/images/aim.gif&amp;off_url=$url/images/aim.gif\"> <a href=\"aim:goim?{aol}ScreenName=".$userinfo['AOL']."\">".$userinfo['AOL']."</a>" : "<img src=\"images/aim.gif\" alt=\""._AOL."\"> "._NONE);
34
+	$tpl->assign("icq", !empty($userinfo['ICQ']) ? "<img src=\"http://status.icq.com/online.gif?icq=$userinfo[ICQ]&amp;img=5\"> $userinfo[ICQ]" : "<img src=\"images/icq.gif\" alt=\""._ICQ."\"> "._NONE);
35
+	$tpl->assign("msn", "<img src=\"images/msntalk.gif\" alt=\""._MSN."\"> ".($userinfo['MSN'] ? $userinfo['MSN'] : _NONE));
36
+	$tpl->assign("yahoo", !empty($userinfo['YIM']) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$userinfo['YIM']."&amp;.src=pg\"><img border=\"0\" src=\"http://opi.yahoo.com/online?u=".$userinfo['YIM']."&amp;m=g&amp;t=1\"> ".$userinfo['YIM']."</a>" : "<img src=\"images/yim.gif\" alt=\""._YAHOO."\"> "._NONE);
37
+
38
+$dynamicfields = "";
39
+while($field = dbassoc($result2)) {
40
+	if($field['info'] == "") continue;
41
+	$fieldinfo = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '".$field['field']."' LIMIT 1"));
42
+	if($fieldinfo) {
43
+		$thisfield = "";
44
+		if($fieldinfo['field_on'] == 0) continue;
45
+		if($fieldinfo['field_type'] == 1) {
46
+			$thisfield =  preg_replace('/(\w+:\/\/)(\S+)/', '<a href="\\1\\2" target="_blank">\\1\\2</a>', $field['info']);
47
+			if(strpos($thisfield, "http://") == false) $thisfield = preg_replace('/(\S+\.)(\S+)/', '<a href="http://\\1\\2" target="_blank">\\1\\2</a>', $thisfield);
48
+		}
49
+		if($fieldinfo['field_type'] == 4) {
50
+			$thisfield = preg_replace("@\{info\}@", $field['info'], $fieldinfo['field_options']);
51
+			$thisfield =  preg_replace('/(\w+:\/\/)(\S+)/', '<a href="\\1\\2" target="_blank">'.$field['info'].'</a>', $thisfield);
52
+			if(strpos($thisfield, "http://") == false) $thisfield = preg_replace('/(\S+\.)(\S+)/', '<a href="http://\\1\\2" target="_blank">\\1\\2</a>', $thisfield);
53
+		}
54
+		if($fieldinfo['field_type'] == 2 || $fieldinfo['field_type'] == 6) {
55
+			$thisfield = stripslashes($field['info']);
56
+		}
57
+		if($fieldinfo['field_type'] == 3) {
58
+			$thisfield = !empty($field['info']) ? _YES : _NO;
59
+		}
60
+		else eval($fieldinfo['field_code_out']);
61
+		$tpl->assign($fieldinfo['field_name'], $thisfield);
62
+		$dynamicfields .= "<div class='authorfields'><span class='label'>".$fieldinfo['field_title'].":</span> ".$thisfield."</div>";
63
+	}
64
+}
65
+if(!empty($dynamicfields)) $tpl->assign("authorfields", $dynamicfields);
66
+$tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=viewuser.php?uid=".$uid."\">"._REPORTTHIS."</a>]");
67
+/* End dynamic fields */
68
+$adminopts = "";
69
+if(isADMIN && uLEVEL < 3) {
70
+	$adminopts .= "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"user.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
71
+	$adminopts .= " [<a href=\"admin.php?action=lock&amp;".($userinfo['level'] < 0 ? "unlock=".$userinfo['uid']."\" class=\"vuadmin\">"._UNLOCKMEM : "do=lock&amp;uid=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."</a>]";
72
+	$adminopts .= " [<a href=\"admin.php?action=admins&amp;".(isset($userinfo['level']) && $userinfo['level'] > 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."</a>] [<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=$uid\" class=\"vuadmin\">"._EDITADMIN : "do=new&amp;uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."</a>]</div>";
73
+	$tpl->assign("adminoptions", $adminopts);
74
+}
75
+$tpl->gotoBlock("_ROOT");
76
+?>
0 77
\ No newline at end of file