Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 295 lines (262 sloc) 11.175 kB
f65fb00 @singpolyma added buddydb
authored
1 <?php
2
e5835ea @singpolyma more latent changes
authored
3 require_once 'bad-behavior-generic.php';
4
f65fb00 @singpolyma added buddydb
authored
5 header('Content-Type: text/html;charset=utf-8');
6 require('db.php');
7
8 ?>
9 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
10 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
11 <head>
12 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
13 <title>Search the Social Web!</title>
a4eebcb @singpolyma Profile display improvements
authored
14 <link rel="stylesheet" type="text/css" href="/profile/main.css" />
15 <link rel="shortcut icon" href="/profile/img/user_green_magnify.png" type="image/png" />
f65fb00 @singpolyma added buddydb
authored
16 <style type="text/css">
1829652 @singpolyma styling
authored
17 #profile {
18 float: left;
19 }
20 #contacts {
21 float: right;
22 }
f65fb00 @singpolyma added buddydb
authored
23 #photos {
24 float:left;
25 margin-top: -0.5em;
26 margin-right: 1em;
27 }
28 #photos img {
29 display: block;
30 margin-bottom: 1em;
31 clear: left;
32 }
33 .fn {
34 display: inline;
35 }
36 #profiles {
37 margin-left: 80px;
38 }
39 #communicate {
83a2b18 @singpolyma major bug in verification fixed
authored
40 /* clear: left;*/
f65fb00 @singpolyma added buddydb
authored
41 }
42 img {
43 border-width: 0px;
44 }
1829652 @singpolyma styling
authored
45 ul, li {
46 list-style-type: none;
47 }
48 #contacts ul, #contacts li {
49 padding-left: 0px;
50 }
f65fb00 @singpolyma added buddydb
authored
51 </style>
52 </head>
53
54
55 <body>
56 <?php
57
58 require('header.php');
59
1829652 @singpolyma styling
authored
60 ob_flush();
61 flush();
62
f65fb00 @singpolyma added buddydb
authored
63 if($_GET['id']) {
64 $person_id = mysql_real_escape_string($_GET['id'],$db);
65 } else {
66 require('normalize_url.php');
67 $url = mysql_real_escape_string(normalize_url($_GET['url']),$db);
a4eebcb @singpolyma Profile display improvements
authored
68 if(!isset($_GET['nofetch'])) shell_exec("ruby fetch_profile.rb '$url' 2>&1");
f65fb00 @singpolyma added buddydb
authored
69 $person_id = @mysql_fetch_assoc(mysql_query("SELECT person_id FROM urls WHERE url='$url'",$db));
70 $person_id = $person_id['person_id'];
71 }//end if id
72
a4eebcb @singpolyma Profile display improvements
authored
73 if(!$person_id) die('No profile found!');
74
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
75 if(!isset($_GET['contacts'])) :
76
f65fb00 @singpolyma added buddydb
authored
77 $person = mysql_fetch_assoc(mysql_query("SELECT * FROM people WHERE person_id=$person_id",$db));
78
1829652 @singpolyma styling
authored
79 echo "\t\t".'<div id="profile" class="vcard">'."\n";
f65fb00 @singpolyma added buddydb
authored
80
81 $photos = mysql_query("SELECT value FROM fields WHERE type='photo' AND person_id=$person_id",$db);
82 if(mysql_num_rows($photos)) {
83 echo "\t\t\t<p id=\"photos\">";
84 while($photo = mysql_fetch_assoc($photos)) {
85 echo ' <img class="photo" src="'.htmlspecialchars($photo['value']).'" alt="Photo" style="max-width:100px;" /> ';
86 }
87 echo "</p>\n";
88 }
89
90 echo "\t\t\t<h1 class=\"fn\">".htmlspecialchars($person['fn'])."</h1>\n";
1829652 @singpolyma styling
authored
91
92 ob_flush();
93 flush();
f65fb00 @singpolyma added buddydb
authored
94
95 $url = mysql_fetch_assoc(mysql_query("SELECT url FROM urls WHERE verified=1 AND person_id=$person_id ORDER BY LENGTH(url) LIMIT 1",$db));
96 echo ' <script type="text/javascript" src="http://singpolyma.net/diso-contact-add.php?fn='.urlencode($person['fn']).'&amp;url='.urlencode($url['url']).'&amp;label=Add+Me&amp;image=http%3A%2F%2Fscrape.singpolyma.net%2Fprofile%2Fimg%2Fadd-me.png"></script> ';
97
98 echo "\t\t\t".' <p class="n"> ( <span class="given-name">'.htmlspecialchars($person['given-name']).'</span>'
99 . ' <span class="additional-name">'.htmlspecialchars($person['additional-name']).'</span>'
100 . ' <span class="family-name">'.htmlspecialchars($person['family-name']).'</span> ) </p>'."\n";
101
102 $nicknames = mysql_query("SELECT value FROM fields WHERE type='nickname' AND person_id=$person_id",$db);
103 if(mysql_num_rows($nicknames)) {
104 echo "\t\t\t<p>Nicknames: ";
105 $nn = array();
106 while($nickname = mysql_fetch_assoc($nicknames)) {
107 $nn[] = htmlspecialchars($nickname['value']);
108 }
109 echo implode(', ',$nn);
110 echo "</p>\n";
111 }
112
113 echo "\t\t\t<p>";
114 if($person['bday']) { echo 'Birthday: <span class="bday">'.date('Y-m-d',$person['bday']).'</span>'; }
f8fbd79 @singpolyma space between timezone and bday
authored
115 if($person['tz']) { echo ' Timezone: <span class="tz">'.$person['tz'].'</span>'; }
f65fb00 @singpolyma added buddydb
authored
116 echo "</p>\n";
117
118 $communicate = array();
119 $follow = array();
120 $urls = mysql_query("SELECT url FROM urls WHERE verified=1 AND person_id=$person_id ORDER BY LENGTH(url)",$db);
121 echo "\t\t\t<h2>Profiles</h2>\n\t\t\t<ul id=\"profiles\">";
122 while($url = mysql_fetch_assoc($urls)) {
123 if(preg_match('/twitter\.com\/([^\/]*?)(\/.*)?$/',$url['url'],$match)) {
124 if($communicate['Twitter@'.htmlspecialchars($match[1])]) continue;
125 $communicate['Twitter@'.htmlspecialchars($match[1])] = array(
126 'url' => htmlspecialchars($url['url']),
127 'fn' => '@'.htmlspecialchars($match[1]),
128 'logo' => 'img/twitter.png',
129 'org' => 'Twitter'
130 );
131 } elseif(preg_match('/pownce\.com\/([^\/]*?)(\/.*)?$/',$url['url'],$match)) {
132 if($communicate['Pownce!'.htmlspecialchars($match[1])]) continue;
133 $communicate['Pownce!'.htmlspecialchars($match[1])] = array(
134 'url' => htmlspecialchars($url['url']),
135 'fn' => '!'.htmlspecialchars($match[1]),
136 'logo' => 'img/pownce.png',
137 'org' => 'Pownce'
138 );
139 } elseif(preg_match('/identi\.ca\/([^\/]*?)(\/.*)?$/',$url['url'],$match)) {
140 if($communicate['identi.ca@'.htmlspecialchars($match[1])]) continue;
141 $communicate['identi.ca@'.htmlspecialchars($match[1])] = array(
142 'url' => htmlspecialchars($url['url']),
143 'fn' => '@'.htmlspecialchars($match[1]),
144 'logo' => 'img/identica.png',
145 'org' => 'identi.ca'
146 );
147 } elseif(preg_match('/ma\.gnolia\.com\/people\/([^\/]*?)\/?$/',$url['url'],$match)) {
148 if($communicate['ma.gnolia'.htmlspecialchars($match[1])]) continue;
149 $communicate['ma.gnolia'.htmlspecialchars($match[1])] = array(
150 'url' => htmlspecialchars($url['url']),
151 'fn' => htmlspecialchars($match[1]),
152 'logo' => 'img/magnolia.png',
153 'org' => 'ma.gnolia'
154 );
155 } elseif(preg_match('/flickr\.com\/(photos|people)\/([^\/]*?)\/?$/',$url['url'],$match)) {
156 if($communicate['Flickr'.htmlspecialchars($match[2])]) continue;
157 $communicate['Flickr'.htmlspecialchars($match[2])] = array(
158 'url' => htmlspecialchars($url['url']),
159 'fn' => htmlspecialchars($match[2]),
160 'logo' => 'img/flickr.png',
161 'org' => 'Flickr'
162 );
163 } elseif(preg_match('/digg\.com\/users\/([^\/]*?)\/?$/',$url['url'],$match)) {
164 if($follow['Digg'.htmlspecialchars($match[1])]) continue;
165 $follow['Digg'.htmlspecialchars($match[1])] = array(
166 'url' => htmlspecialchars($url['url']),
167 'fn' => htmlspecialchars($match[1]),
168 'logo' => 'img/digg.png',
169 'org' => 'Digg'
170 );
171 } elseif(preg_match('/last\.fm\/user\/([^\/]*?)\/?$/',$url['url'],$match)) {
172 if($follow['last.fm'.htmlspecialchars($match[1])]) continue;
173 $follow['last.fm'.htmlspecialchars($match[1])] = array(
174 'url' => htmlspecialchars($url['url']),
175 'fn' => htmlspecialchars($match[1]),
176 'logo' => 'img/lastfm.png',
177 'org' => 'last.fm'
178 );
179 } elseif(preg_match('/friendfeed\.com\/([^\/]*?)\/?$/',$url['url'],$match)) {
180 if($follow['FriendFeed'.htmlspecialchars($match[1])]) continue;
181 $follow['FriendFeed'.htmlspecialchars($match[1])] = array(
182 'url' => htmlspecialchars($url['url']),
183 'fn' => htmlspecialchars($match[1]),
184 'logo' => 'img/friendfeed.png',
185 'org' => 'FriendFeed'
186 );
187 } elseif(preg_match('/awriterz\.org\/p\/([^\/]*?)\/?$/',$url['url'],$match)) {
188 if($follow['Amateur Writerz'.htmlspecialchars($match[1])]) continue;
189 $follow['Amateur Writerz'.htmlspecialchars($match[1])] = array(
190 'url' => htmlspecialchars($url['url']),
191 'fn' => htmlspecialchars($match[1]),
192 'logo' => 'img/awriterz.ico',
193 'org' => 'Amateur Writerz'
194 );
195 } elseif(preg_match('/dopplr\.com\/traveller\/([^\/]*?)\/?$/',$url['url'],$match)) {
196 if($follow['Dopplr'.htmlspecialchars($match[1])]) continue;
197 $follow['Dopplr'.htmlspecialchars($match[1])] = array(
198 'url' => htmlspecialchars($url['url']),
199 'fn' => htmlspecialchars($match[1]),
200 'logo' => 'img/dopplr.png',
201 'org' => 'Dopplr'
202 );
203 } else {
1829652 @singpolyma styling
authored
204 echo "\t\t\t\t".'<li><a class="url" rel="me" href="'.htmlspecialchars($url['url']).'">'.htmlspecialchars(preg_replace('/^www\./','',preg_replace('/^http:\/\//','',$url['url'])))."</a></li>\n";
f65fb00 @singpolyma added buddydb
authored
205 }
206 }//end while url = fetch urls
207 echo "\t\t\t</ul>\n";
208
209 $emails = mysql_query("SELECT value FROM fields WHERE type='email' AND person_id=$person_id",$db);
210 if(count($communicate) || mysql_num_rows($emails))
211 echo "\t\t\t<h3>Communicate and Share</h3>\n";
212 if(count($communicate)) {
213 echo "\t\t\t<ul id=\"communicate\">\n";
214 foreach($communicate as $url) {
a4eebcb @singpolyma Profile display improvements
authored
215 echo "\t\t\t\t<li><img src=\"/profile/{$url['logo']}\" alt=\"{$url['org']}:\" /> <a class=\"url\" rel=\"me\" href=\"{$url['url']}\">{$url['fn']}</a></li>";
f65fb00 @singpolyma added buddydb
authored
216 }//end foreach communicate
217 echo "\t\t\t</ul>\n";
218 }//end if communicate
3ee52f4 @singpolyma im and names must be longer to update
authored
219
220 $ims = mysql_query("SELECT url FROM urls WHERE verified=2 AND person_id=$person_id ORDER BY LENGTH(url)",$db);
221 if(mysql_num_rows($ims)) {
222 echo "\t\t\t<h4>Instant Messaging</h4>\n";
223 echo "\t\t\t<ul>\n";
224 while($im = mysql_fetch_assoc($ims)) {
225 $t = explode(':',$im['url']);
226 $protocol = $t[0];
227 array_shift($t);
228 $fn = preg_split('/[=\?]/',implode(':',$t));
229 $fn = array_pop($fn);
230 echo "\t\t\t\t<li>";
231 echo '<img src="img/'.htmlspecialchars($protocol).'.png" alt="'.htmlspecialchars($protocol).':" /> <a class="url im" href="'.htmlspecialchars($im['url']).'">'.htmlspecialchars($fn).'</a>';
232 echo "</li>\n";
233 }
234 echo "\t\t\t</ul>\n";
235 }
236
f65fb00 @singpolyma added buddydb
authored
237 if(mysql_num_rows($emails)) {
238 echo "\t\t\t<p>Email: ";
239 $nn = array();
240 while($email = mysql_fetch_assoc($emails)) {
241 $nn[] = '<a class="email" href="mailto:'.htmlspecialchars($email['value']).'">'.htmlspecialchars($email['value']).'</a>';
242 }
243 echo implode(', ',$nn);
244 echo "</p>\n";
245 }
246
247 if(count($follow)) {
248 echo "<h3>Follow</h3>\t\t\t<ul>\n";
249 foreach($follow as $url) {
a4eebcb @singpolyma Profile display improvements
authored
250 echo "\t\t\t\t<li><img src=\"/profile/{$url['logo']}\" alt=\"{$url['org']}:\" /> <a class=\"url\" rel=\"me\" href=\"{$url['url']}\">{$url['fn']}</a></li>";
f65fb00 @singpolyma added buddydb
authored
251 }//end foreach follow
252 echo "\t\t\t</ul>\n";
253 }//end if follow
254
255 echo "\t\t</div>\n";
256
1829652 @singpolyma styling
authored
257 ob_flush();
258 flush();
259
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
260 endif; //!contacts
261
262 if(!isset($_GET['nocontacts'])) :
263
1829652 @singpolyma styling
authored
264 echo '<div id="contacts">';
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
265 $urls = mysql_query("SELECT people.person_id,people.fn,contacts.url FROM contacts,urls,people WHERE contacts.person_id=$person_id AND urls.url=contacts.url AND people.person_id=urls.person_id ORDER BY people.fn",$db);
f65fb00 @singpolyma added buddydb
authored
266 echo "\t\t<h2>Contacts</h2>\n\t\t<ul>";
267 $done = array();
268 while($url = mysql_fetch_assoc($urls)) {
269 if(!$url['fn']) continue;
270 if(in_array($url['person_id'],$done)) continue;
271 $done[] = $url['person_id'];
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
272 $fields = mysql_query('SELECT * FROM fields WHERE person_id='.$url['person_id']);
273 while($field = mysql_fetch_assoc($fields)) {
274 if(!$url['photo'] && $field['type'] == 'photo') $url['photo'] = $field['value'];
275 if($_GET['contacts'] == 'email' && !$url['email'] && $field['type'] == 'email') $url['email'] = $field['value'];
276 }
277 if($_GET['contacts'] == 'email' && !$url['email']) continue;
278 echo '<li class="vcard">';
279 echo '<a class="url uid" href="'.htmlspecialchars($url['url']).'">';
e5835ea @singpolyma more latent changes
authored
280 if($url['photo']) echo '<img class="photo" src="'.htmlspecialchars($url['photo']).'" alt="" style="max-width:1.5em;" />';
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
281 echo '</a> ';
282 echo '<a class="fn url" href="/profile/person.php?id='.htmlspecialchars($url['person_id']).'">'.htmlspecialchars($url['fn']).'</a>';
e5835ea @singpolyma more latent changes
authored
283 if($_GET['contacts'] == 'email') echo ' (<a class="email" href="mailto:'.htmlspecialchars($url['email']).'">'.htmlspecialchars($url['email']).'</a>)';
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
284 echo '</li>';
f65fb00 @singpolyma added buddydb
authored
285 }
1829652 @singpolyma styling
authored
286 echo "\t\t</ul>\n</div>";
1ec1b56 @singpolyma better email handling, avatars/emails in contacts list
authored
287
288 endif;//!nocontacts
e5835ea @singpolyma more latent changes
authored
289
290 mysql_close($db);
1829652 @singpolyma styling
authored
291
f65fb00 @singpolyma added buddydb
authored
292 ?>
293 </body>
294 </html>
Something went wrong with that request. Please try again.