forked from kohler/peteramati
-
Notifications
You must be signed in to change notification settings - Fork 0
/
face.php
63 lines (55 loc) · 2.22 KB
/
face.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
// face.php -- Peteramati face page
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// Distributed under an MIT-like license; see LICENSE
require_once("src/initweb.php");
ContactView::set_path_request(array("/u"));
if ($Me->is_empty())
$Me->escape();
global $User, $Pset, $Info;
$User = $Me;
if (isset($_REQUEST["u"]))
$User = ContactView::prepare_user($_REQUEST["u"]);
if (isset($_REQUEST["imageid"])) {
if ($User
&& ($User === $Me || $Me->isPC)
&& $_REQUEST["imageid"]
&& ($result = Dbl::qe("select mimetype, `data` from ContactImage where contactId=? and contactImageId=?", $User->contactId, $_REQUEST["imageid"]))
&& ($row = edb_row($result))) {
header("Content-Type: $row[0]");
header("Cache-Control: public, max-age=31557600");
header("Expires: " . gmdate("D, d M Y H:i:s", $Now + 31557600) . " GMT");
if (!$zlib_output_compression)
header("Content-Length: " . strlen($row[1]));
print $row[1];
} else {
header("Content-Type: image/gif");
if (!$zlib_output_compression)
header("Content-Length: 43");
print "GIF89a\001\0\001\0\x80\0\0\0\0\0\0\0\0\x21\xf9\x04\x01\0\0\0\0\x2c\0\0\0\0\x01\0\x01\0\0\x02\x02\x44\x01\0\x3b";
}
exit;
}
if (!$Me->isPC)
$Me->escape();
function output($User) {
global $Me;
$u = $Me->user_linkpart($User);
echo '<div class="facebook61">',
'<a href="', hoturl("index", ["u" => $u]), '">',
'<img class="bigface61" src="' . hoturl("face", ["u" => $u, "imageid" => $User->contactImageId ? : 0]) . '" border="0" />',
'</a>',
'<h2 class="infacebook61"><a class="q" href="', hoturl("index", ["u" => $u]), '">', htmlspecialchars($u), '</a>';
if ($Me->privChair)
echo " ", become_user_link($User);
echo '</h2>';
if ($User !== $Me)
echo '<h3 class="infacebook61">', Text::user_html($User), '</h3>';
echo '</div>';
}
$Conf->header("Thefacebook", "face");
$u = Dbl::qe("select contactId, email, firstName, lastName, seascode_username, contactImageId from ContactInfo where roles=0");
while (($user = edb_orow($u)))
output($user);
echo "<div class='clear'></div>\n";
$Conf->footer();