User Profile
Site Infrastructure / User Profile

[show modes: view edit blog message]

[begin preamble]
if(title2id(_title) != _id)
	_bestlink = {id=[_id]}
else if(strcount(_title, "&"))
	_bestlink = {id=[_id]}
else
	_bestlink = urlencode(_title);

override_title(_title, info_display(_subtitle));

if(getv("avpath") == "") {[
	$relpath = {/avatars/[_author].jpg};
	if(not(file_exists($_globals.VROOT & $relpath))) {[
		em = getva("email", get_extended(_author));
		if(em != "")
			$avpath = {http://gravatar.com/avatar/[md5(lcase(trim(em)))].png?s=500&d=[urlencode("http://anthologi.ca/pictures/default-avatar.png")]}
		else
			$avpath = {/pictures/default-avatar.png};
	]} else $avpath = {/pictures[$relpath]};
	keep_date();
	mute putv("avpath", $avpath);
]};
[end preamble]

[begin mode post_bg][
$avpath = getv("avpath");

if(getv("big-avatar") == 1) if(substr($avpath, 0, 1) == "/") {<div class="profile_full_bg post_bg_[_id]" style="[if(getu("dark-theme") == 1) {opacity: 0.1} else {opacity: 0.15}]"><img style="visibility: hidden; width: 100%;" src="[$avpath]_blurred.jpg"> </div><style type="text/css">
#post_[_args.0] blockquote, #post_[_args.0] .mbox_parent {
[
	if(getu("dark-theme") == 1) {
		background: rgba(56, 56, 56, 0.5);
	} else {
		background: rgba(255, 255, 255, 0.5);
	} 
]
}
.post_bg_[_id] {
	background-size: 100%;
	background-repeat: repeat-x, no-repeat;
	background-position: bottom left, 0 0;
	background-size: 64px 256px, cover;
[
	if(getu("dark-theme") == 1) {
		background-image: url('/theme/dark-grad.png'), url('[$avpath]_blurred.jpg');
	} else {
		background-image: url('/theme/light-grad.png'), url('[$avpath]_blurred.jpg');
	}
]
}
</style>};
][end mode post_bg]

[begin mode message]
[if(_viewer.id == 0) return {Sorry! Please <a href="/registration.star">register</a> or <a href="/log_io.star">log in</a> first.};
msg_start()]
<b>Send Message</b>
<form method="post" action="/">
<input type="hidden" name="id" value="[_id]">
<input type="hidden" name="mode" value="message_submit">
<table style="width: 100%">
<tr><th>Subject:<td><input type="text" name="title" style="width: 100%">
<tr><th style="width: 100px">Message:<td><textarea name="msg" style="width: 100%"></textarea>
<tr><td><td><input type="submit" value="Send">
</table>
[msg_end()]
[end mode message]

[begin mode message_submit]
[
if(_viewer.id == 0) return {Sorry! Please <a href="/registration.star">register</a> or <a href="/log_io.star">log in</a> first.};

if(_params.msg != "") {[
	
	msg = _emoticons(_wiki_format("[b]Message from [http://anthologi.ca/?id=" &_viewer.profile_id & "|" & _viewer.name & "][/b]" & chr(10) & _params.msg, "no toc"), _viewer.id);
	recipient = _author;

	if(_post_message(recipient, msg, _viewer.id, $_params.title & " (" & now() & ")") == 1) msg({[refresh_to({./?Messages}, 1)]
		<b>Success</b>! Your message was sent to [uid2name(recipient)].
	}) else msg({
		<b>Failure</b>! Message could not be sent to [uid2name(recipient)].
	});
]

<p><a href="/?[_bestlink]">Return to [_title]</a><br>
<a href="/?Messages">Return to Messages</a></p>
};
]
[end mode message_submit]

[begin mode select][_author]<!>[_title]
[end mode select]

[begin mode update]
[
_date = _args[0];
]
[end mode update]


[begin mode edit]
[
	$_title = $_owner.name;
]
	<form method="post" action="/" width="100%">
	    <input type="hidden" name="id" value="[$_id]">
	    <input type="hidden" name="mode" value="submit">
	<table width="100%">
<tr><th valign="top">Login Info:
	<td><a href="/lists.star?mode=edit_user&id=[_author]">Click here to change your username or password.</a> You will have to log in again afterwards.
<tr><th width="20%">Personal Title:</th><td>
	    <input type="text" class="textbox" name="subtitle" value="[edit_display($_subtitle);]" style="width: 100%"><br>
		<small>Limit 30 characters. Blame <a href="/?Nortaneous">Nortaneous</a>.</small>
	    </td></tr>
	<tr><th width="20%">Avatar:</th>
	<td>[page("icon", $_id)]<br><a href="./?id=[$_id]&mode=picture" target="_blank">Click here to update your avatar.</a><br>
<small><b>If you see an image but have not uploaded an avatar</b>, it was obtained from <a href="http://gravatar.com">Gravatar</a> using your e-mail address.</td></tr>
<tr><th valign="top">E-mail:
	<td><input type="text" name="email" value="[getva("email", get_extended(_author))]"><br>
	<small>This will not be shown publicly. See <a href="/?Settings">Settings</a> for information on setting up Reply-To for email notifications.</small>
<tr><th width="20%">Twitter:</th><td>
	    <input type="text" class="textbox" name="twitter" value="[edit_display(getv("twitter"));]" style="width: 100%">
	    </td></tr>
	    <tr><th>Synopsis:</th><td>
	    <textarea name="brief" rows="15" class="textbox">[edit_display(getv("brief"))]</textarea>
	    <tr><th>Biography:</th><td>
	    <textarea name="bio" rows="15" class="textbox">[edit_display(getv("bio"))]</textarea>
<tr><th valign="top">Blog Name:
	<td><input type="text" name="blog_title" value="[edit_display(getv("blog_title"))]"><br>
<tr><th valign="top">Blog URL:
	<td><input type="text" name="blog_url" value="[edit_display(getv("blog_url"))]"><br>
<tr><th valign="top">Blog RSS:
	<td><input type="text" name="blog_rss" value="[edit_display(getv("blog_rss"))]"><br>
	Input the URL to a blog's front page and RSS feed to use it for your profile. <a href="http://tumblr.com">Tumblr</a> and <a href="http://wordpress.com">Wordpress</a> blogs have been confirmed to work properly. If you prefer, however, you may leave this blank and use a built-in Cadre blog. A Cadre blog will let you automatically limit comments according to the site's controls, but a Tumblr or Wordpress blog may be better for sharing your work with others outside of our community.<br><br>If you provide a name for your blog, it will be used either way.
	<tbody id="extras" style="display: none;">
	    <tr><th>Big avatar:<td><input type="checkbox" name="big_avatar" value="1" [if(getv("big-avatar") == 1) {checked}] id="big_avatar"><label for="big_avatar">Enable user page decorations (blurred watermarks) for big (500x500) avatars.</label>
	</tbody>
<tr><th><td>
	    <span class="buttonbox"><input type="submit" value="Submit"></span> <span onclick="document.getElementById('extras').style.display='';" style="cursor: pointer">More</span>
	    </td></tr>
	    </table>
	</form>
[end mode edit]
[begin mode submit]
	[
	putv("twitter", $_params.twitter);
	putv("brief", $_params.brief);
	putv("bio", $_params.bio);
	putv("blog_title", $_params.blog_title);
	putv("blog_url", $_params.blog_url);
	putv("blog_rss", $_params.blog_rss);
	putv("big-avatar", $_params.big_avatar);

	ge = get_extended(_author);
	putva("email", $_params.email, ge);
	set_extended(_author, ge);

        $_subtitle = substr($_params.subtitle, 0, 30);

	putv("avpath", "");
	keep_date();

	refresh_to({./?[_bestlink]}, 1);
            msg_start()]
	    It's done! <a href="/?[_bestlink]">Go look</a>.
	[msg_end()]
[end mode submit]

[begin mode picture]
<form action="" method="post" enctype="multipart/form-data">
	<input type="file" name="ufile">
	<input type="hidden" name="id" value="[$_id]">
	<input type="hidden" name="mode" value="picture_submit">
	<input type="submit" value="Upload" name="button">
</form>
<p>Requirements:</p>
<ul>
<li>JPEG or PNG only.
<li>Files that are not 500x500 will be cropped and scaled to fit.
<li>Don't upload anything over a megabyte.
</ul>
[
$fn = {/avatars/[_author].jpg};
$fullfn = {[$_globals.VROOT][$fn]};

if(file_exists($fullfn)) {<p><a href="/?id=[_id]&mode=picture_delete">Click here to delete your avatar</a>.</p>};
]
[end mode picture]
[begin mode picture_delete]
[
$fn = {/avatars/[_author].jpg};
$fullfn = {[$_globals.VROOT][$fn]};

if(can_edit()) {[
	if(file_exists($fullfn & "_blurred.jpg")) rm($fullfn & "_blurred.jpg");
	if(file_exists($fullfn)) {[
		if(rm($fullfn)) {[
			putv("avpath", "")]
			Deleted! <a href="/?id=[_id]&mode=edit">Go back.</a>
		} else {
			Error! Check the notices below and contact an administrator. <a href="/?id=[_id]&mode=edit">Go back.</a>
		};
	]} else {
		Already gone! <a href="/?id=[_id]&mode=edit">Go back.</a>
	}
]} else {
	Not yours! <a href="/?id=[_id]&mode=edit">Go back.</a>
}
]
[end mode picture_delete]
[begin mode picture_submit]
[
$fn = {/avatars/[_author].jpg};
$fullfn = {[$_globals.VROOT][$fn]};

if(file_exists($fullfn)) rm($fullfn);
if(file_exists($fullfn & "_blurred.jpg")) rm($fullfn & "_blurred.jpg");

$na = file_upload("ufile", $fn, 1048576);
$fn = slice($na, 2, 1);
if($fn != "null") {
	[file_crop($fn, 500, 500);
	mv($fn, $fullfn);
	file_blur($fullfn, $fullfn & "_blurred.jpg", 10);
	putv("avpath", "");
	keep_date();
	]
	Done. Upload successful!

	[refresh_to({./?id=[$_id]&mode=edit}, 2)]
	<script type="javascript"><!--
		document.location = "./?id=[$_id]&mode=edit";
	--></script>
} else {
	File upload failed. Tried copying to "[$fullfn]" from "[$fn]".
	Why is anyone's guess. Maybe the file was really, really big?
	Contact <a href="mailto:[$_globals.ADMIN_EMAIL]">an 
	administrator</a> if you want it fixed.
};
]
[end mode picture_submit]

[begin mode external]
[suppress_template();
page("short", $_id);]
[end mode external]
[begin mode add_news]
[
	$p = new_page({Untitled Entry}, $_id);
	set_template($p, title2id("News Post"));
	set_permissions($p, "cadrec--r-c-dr-c--r-");
	page("edit", $p);
]
[end mode add_news]

[begin mode blog_title][if(getv("blog_title") != "") getv("blog_title") else $_title;][end mode blog_title]

[begin mode blog]
[if(getv("blog_url") == "") {
	[
	override_title(getv("blog_title"), $_owner.name & "'s blog");
	override_parent({/?[_bestlink]}, $_title);
	$pagesize = 10;
	$q = query("news", $pagesize, "id DESC, title", "parent", $_id, "template", title2id("News Post"));

	query_view("abbr", $q, list("no_icon"));
	$qc = query_count($q);
	if($qc > $pagesize) {<center>[
		$np = next_page($q);
		$pp = previous_page($q);
		if($pp) {<br><br><a href="[$pp]">Previous</a> };
		if($np) { <a href="[$np]">Next</a><br>};
		page_list($q);
	]</center>};
	if(_viewer.id == _author) {<center><br>
		[untitled = search("link", "parent", _id, "title", "Untitled Entry");
		if(untitled != "")
			{<i>Please give <b>[untitled]</b> a real title before creating a new blog post.</i>}
		else
			{<a href="/?id=[$_id]&mode=add_news">Create blog post</a>}
		]
	</center>};	
	]
} else {
	[suppress_title()]
	Transferring you to <a href="[getv("blog_url")]">[getv("blog_title")]</a>...
	[refresh_to(getv("blog_url"), 1)]
}]
[end mode blog]

[begin mode short]

[msg_start({max-height: 500px; overflow: hidden; position: relative});
$avpath = getv("avpath");

if(getv("big-avatar") == 1) if(substr($avpath, 0, 1) == "/") {<div class="profile_short_bg psbg_[_id]" style="[if(getu("dark-theme") == 1) {opacity: 0.2} else {opacity: 0.2}]"><img style="visibility: hidden; width: 100%;" src="[$avpath]_blurred.jpg"> </div><style type="text/css">
.mbox_parent {
[
	if(getu("dark-theme") == 1) {
		background: rgba(56, 56, 56, 0.7);
	} else {
		background: rgba(255, 255, 255, 0.7);
	} 
]
}
.psbg_[_id] {
	background-size: 100%;
	background-repeat: repeat-x, no-repeat;
	background-position: bottom left, 0 0;
	background-size: 64px 256px, cover;
[
	if(getu("dark-theme") == 1) {
		background-image: url('/theme/dark-grad.png'), url('[$avpath]_blurred.jpg');
	} else {
		background-image: url('/theme/light-grad.png'), url('[$avpath]_blurred.jpg');
	}
]
}
</style>};

{<div style="z-index: 1; position: relative">};

$tweet = false;
if(getv("twitter") != "")
	$tweet = get_tweet(getv("twitter"));

if($tweet != false) {
<div style="float: right; width: 40%; border-left: 2px rgba(0,0,0,0.1) solid; bottom: 0px; padding: 10px; margin-left: 10px; background: rgba(255,255,255,0.05)" class="no_mobile">
<div id="tweet_[getv("twitter")]">
	[purify(info_display($tweet.body))]
	<span style="font-size: 70%; text-align: right; display: block;">[soft_age($tweet.date)] ago</span>
</div>
<a target="_blank" href="https://twitter.com/#!/[getv("twitter")]"><i style="opacity: 0.6">view [getv("twitter")] on twitter...</i></a>
</div>
};
]

<a href="/?[_bestlink]"><img src="[$avpath]" style="max-width: 150px; margin-right: 10px; float: left;">
<span style="font-size: 150%; font-family: 'Segoe UI', Verdana, sans-serif; font-weight: lighter;">[$_title]</span>[if($_subtitle != ""){<br>}]
<span style="font-size: 110%; font-family: 'Segoe UI', Verdana, sans-serif; font-weight: lighter;">[info_display($_subtitle)]</span></a><br>
[_emoticons(_wiki_format(getv("brief")), _author)]


<div style="clear: both; text-align: right">
</div>
</div>
[msg_end()]
[end mode short]

[begin mode icon][
$avpath = getv("avpath");
]
<a href="/?[_bestlink]"><img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=64&h=64&f=png" height="64px" title="[$_owner.name]" style="vertical-align: middle; border-radius: 5px;"></a>
[end mode icon]

[begin mode small_icon][
$avpath = getv("avpath");
]
<a href="/?[_bestlink]"><img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px" title="[$_owner.name]" style="vertical-align: middle; border-radius: 5px; margin: 3px;"></a>
[end mode small_icon]

[begin mode recent_icon][if(getva("hide-online", get_extended(_author)) != 1) if(date_diff(get_date(_id), now()) < 300) {[
$avpath = getv("avpath");
]
<a href="/?[_bestlink]"><img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px" title="[$_owner.name] ([soft_age(_date)] ago)" style="vertical-align: middle; border-radius: 5px; margin: 3px;"></a>
}][end mode recent_icon]

[begin mode today_icon][if(getva("hide-online", get_extended(_author)) != 1) if(date_diff(get_date(_id), now()) < 86400) if((date_diff(get_date(_id), now()) >= 300) || (getu("hide-5m")))  {[
$avpath = getv("avpath");
]
<a href="/?[_bestlink]"><img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px" title="[$_owner.name] ([soft_age(_date)] ago)" style="vertical-align: middle; border-radius: 5px; margin: 3px;"></a>
}][end mode today_icon]

[begin mode recent_abbr][if(getva("hide-online", get_extended(_author)) != 1) if(date_diff(get_date(_id), now()) < 300) {[
$avpath = getv("avpath");
]<a style="display: inline-block; margin: 2px; vertical-align: top; font-size: 80%;" href="/?[_bestlink]"><img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px" style="border-radius: 2px;" title="[$_owner.name]"></a>}][end mode recent_abbr]

[begin mode recent_link][if(getva("hide-online", get_extended(_author)) != 1) if(date_diff(get_date(_id), now()) < 300) {[
$avpath = getv("avpath");
]
<span class="hoverimg"><a new href="/?[_bestlink]">[$_owner.name]<img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px"></a>
</span>}][end mode recent_link]

[begin mode link][
$avpath = getv("avpath");
]<span class="hoverimg"><a new href="/?[_bestlink]">[$_owner.name]<img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px"></a></span>[end mode link]

[begin mode abbr][
$avpath = getv("avpath");
]
<a style="display: inline-block; margin: 2px;" href="/?[_bestlink]"><img src="/pictures/thumb.star?src=[urlencode($avpath)]&w=32&h=32&f=png" height="32px" style="vertical-align: middle; border-radius: 2px; margin-right: 4px">[$_owner.name]</a>
[end mode abbr]

[begin mode view]<div style="position: relative;"><style type="text/css">
	.sidetitle {
		margin-top: 40px;
		margin-bottom: 0px;
		padding-bottom: 0px;
	}
</style>[
$avpath = getv("avpath");

if(getv("big-avatar") == 1) if(substr($avpath, 0, 1) == "/") {<div class="profile_full_bg" style="[if(getu("dark-theme") == 1) {opacity: 0.2} else {opacity: 0.2}]"><img style="visibility: hidden; width: 100%;" src="[$avpath]_blurred.jpg"> </div><style type="text/css">
.mbox_parent {
[
	if(getu("dark-theme") == 1) {
		background: rgba(56, 56, 56, 0.7);
	} else {
		background: rgba(255, 255, 255, 0.7);
	} 
]
}
#footer {
[
	if(getu("dark-theme") == 1) {
		color: rgba(255, 255, 255, 0.18);
	} else {
		color: rgba(0, 0, 0, 0.19);
	} 
]
}
.profile_full_bg {
	background-size: 100%;
	background-repeat: repeat-x, no-repeat;
	background-position: bottom left, 0 0;
	background-size: 64px 256px, cover;
	background-image: url('/theme/[iif(getu("dark-theme"), {dark}, {light})]-grad.png'), url('[$avpath]_blurred.jpg');
}
.post_bg_[_id] {
	background-image: none !important;
}
h1 {
[
	if(getu("dark-theme") != 1) {
		text-shadow: 0px 0px 25px rgba(235, 235, 235, 1.0);
	}
]
}
</style>}]<div style="position: relative; z-index: 1;">
<table style="width: 100%; table-layout: fixed"><tr><td class="mobile_block" valign="top" style="padding-right: 10px; overflow: auto">
<style type="text/css">
#works th { text-align: right; padding-right: 10px; }
</style>

[
projects = search("table", "template", title2id("Universe"), "author", _author);
languages = search("table", "template", title2id("Language"), "author", _author);

if((projects != "") || (languages != "")) {[msg_start({margin-top: 0px;})]
	<table id="works">
	[
	if(projects != "") {<tr><th colspan="2" style="text-align: left">universes [projects]};
	if(languages != "") {<tr><th colspan="2" style="text-align: left">languages [languages]};
	]
	</table>
[msg_end()]};

]

[if(getv("blog_rss") == "") {
	[
		$q = query("blog", 3, "id desc, title", "parent", $_id, "template", title2id("News Post"));
		if(query_count($q) > 0) {
			<h1 class="sidetitle"><a href="/?id=[$_id]&mode=blog">[iif(getv("blog_title"), getv("blog_title"), [$_title] & "'s Blog")]</a></h1>
		};

		query_view("abbr", $q, list("no_icon"));

		if(_viewer.id == _author) {<center>
			[untitled = search("link", "parent", _id, "title", "Untitled Entry");
			if(untitled != "")
				{<i>Please give <b>[untitled]</b> a real title before creating a new blog post.</i>}
			else
				{<a href="/?id=[$_id]&mode=add_news">Create blog post</a>}
			]
		</center>};
	
		if(query_count($q) > 0) {<center>
			<a href="/?id=[$_id]&mode=blog">More...</a>
		</center>};
	]
} else {
	<h1 class="sidetitle"><a href="[getv("blog_url")]">[iif(getv("blog_title"), getv("blog_title"), [$_title] & "'s Blog")]</a></h1>

	[
		show("view", slice(get_rss(title2id("Tumblr Entry"),
			getv("blog_rss")
		), 0, 3))
	]

	<center>
		<a href="[getv("blog_url")]">More...</a>
	</center>
}]

[
q = query("forum_posts", 3, "id desc, title", "template", title2id("Linear Post"), "author", _author);
if(query_count(q) > 0) {<h1 class="sidetitle"><a href="/?id=[title2id("Search")]&q=&go=Search&author_restrict=1&author=[_author]&type_restrict=1&template=[title2id("Linear Post")]"><i>Ex foris</i></a></h1>};
query_run("abbr", q);
]
</div>

<td class="mobile_block" valign="top" style="width: 250px; font-size: 80%">

<div class="mbox_parent" style="margin: 0px;">
	<center><img src="[$avpath]" style="max-width: 200px;"><br>
	<span style="font-size: 180%">[_title]</span><br>
	[if(_subtitle != "") {<span style="font-size: 140%">[info_display(_subtitle)]</span><br>}]
	<span style="font-size: 90%">last seen: [soft_age(_date)] ago</span><br>
	<span style="font-size: 90%">posts: [int(getva("posts", get_extended(_author)))]</span><br>
	<span style="font-size: 90%" title="next rank: [

	score = getva("posts", get_extended(_author));
	if(score > 0) {[
		a = (2 ^ int(1 + log2(score)));
		if(a < 32) a = 32;
		if(a > 8192) {max level} else a;
	]} else 32;

]">[_postrank(getva("posts", get_extended(_author)), _owner)]</span><br>
	<span style="font-size: 90%; display: block"><br><a href="/?id=[_id]&mode=message">send message</a><br>
	<a href="/?id=[title2id("Search")]&q=&go=Search&author_restrict=1&author=[_author]&type_restrict=1&template=[title2id("Linear Post")]">find forum posts</a><br><br></span>
	</center>
	[_emoticons(_wiki_format(getv("bio")), _author)]
</div>
[if(can_edit()) {<center><a href="/?id=[_id]&mode=edit">edit profile</a></center>}]
</table>
</div>
</div>[end mode view]