-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
152 lines (136 loc) · 4.58 KB
/
index.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
///////////////////////////////////////////
// Originally written by kitallis. //
// Un-failed and featurized by nirbheek. //
///////////////////////////////////////////
$hacker_links = array(
"beachbrake" => "http://www.priyakuber.in/",
"devilsadvocate" => "http://blog.chintal.in/",
"Ford_Prefect" => "http://arunraghavan.net",
"GeneralMaximus" => "http://uncool.in",
"Gurpartap" => "http://gurpartap.com",
"ideamonk" => "http://ideamonk.in/",
"iwikiwi" => "http://blog.vdavuluri.info/",
"jai" => "http://www.retroficial.org/",
"kitallis" => "http://code.scrapcrap.org",
"kstar" => "http://kstars.wordpress.com/",
"lifeeth" => "http://lifeeth.in",
"lut4rp" => "http://pratul.in",
"nikkar" => "http://github.com/Gurpartap/nikkar/",
"nirbheek" => "http://bheekly.blogspot.com",
"sid0" => "http://monogatari.doukut.su",
"Stattrav" => "http://suryajith.in/",
"Sup3rkiddo" => "http://sudharsh.wordpress.com/",
"t3rmin4t0r" => "http://notmysock.org",
"YuviPanda" => "http://yuvi.in",
"shadeslayer" => "http://kshadeslayer.wordpress.com/",
);
$hacker_alts = array("Gurpartap" => "balle balle?",
"nirbheek" => "did your mom.",
"lut4rp" => "The Quintessential Nice Guy ®");
$known_pic_types = array("gif", "jpg", "png", "svg");
// We use a comma because that isn't allowed in OFTC nicks
$default_avatar_dir = "default,";
// no. of columns to divide the nicks into; must exist in CSS
$num_cols = 3;
$hacker_nicks = array_keys($hacker_links);
shuffle($hacker_nicks);
function get_default_avatar($nick) {
global $default_avatar_dir;
// Prevent infinite recursion
if ($nick != $default_avatar_dir)
get_avatar($default_avatar_dir);
return;
}
function get_avatar($nick) {
global $known_pic_types;
$dir = "avatars/";
$avatar_dir = $dir.$nick."/";
if (!is_dir($avatar_dir)) {
// lolwat no avatar dir, try default dir
get_default_avatar($nick);
return;
}
$avatars = scandir($avatar_dir);
shuffle($avatars);
// Avatars list contains '.' and '..'
if (count($avatars) === 2) {
// lolwat empty avatar dir, try default dir
get_default_avatar($nick);
return;
}
foreach ($avatars as $avatar) {
if (in_array(substr($avatar, -3), $known_pic_types)) {
echo $avatar_dir.$avatar;
return;
}
}
}
function get_blurb($nick) {
$file_path = "blurbs/".$nick;
if (file_exists($file_path)) {
$b = file($file_path);
echo array_rand(array_flip($b), 1);
} else {
echo "Description-less nub this person is.";
}
}
function get_nick_with_link($nick) {
global $hacker_links;
if (array_key_exists($nick, $hacker_links))
echo '<a href="'.$hacker_links[$nick].'">'.$nick.'</a>';
}
function get_nick_url($nick) {
global $hacker_links;
if (array_key_exists($nick, $hacker_links))
echo '<a href="'.$hacker_links[$nick].'">';
}
function get_title($nick) {
global $hacker_alts;
if (array_key_exists($nick, $hacker_alts))
echo $hacker_alts[$nick];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="style.css" type="text/css"/>
<link href="favicon.ico" rel="icon" type="image/x-icon" />
<title>Hackers India • Indian F/OSS Hackers Collective</title>
</head>
<body>
<div id="wrapper">
<div id="header">
<a href=""><img src="images/hi.png" title="#hackers-india"/></a>
</div>
<div id="content">
<?php for($n = 1; $n < $num_cols+1; $n++) { ?>
<div id="col<?php echo $n; ?>">
<?php
foreach($hacker_nicks as $i => $nick) {
if ((($i+1) % $num_cols) != ($n % $num_cols))
continue; // distribute nicks equally amongst the columns
?>
<h4><?php get_nick_with_link($nick); ?></h4>
<p>
<?php get_nick_url($nick); ?>
<img align="left" src="<?php get_avatar($nick); ?>" title="<?php get_title($nick) ?>"/>
</a><br/>
<?php get_blurb($nick); ?>
</p>
<!-- end of a hacker -->
<?php } ?>
</div>
<?php } ?>
</div>
<div id="footer">
<h3><a href="http://ha.ckers.in/rules.html">The Constitution of hackers-india lies here.</a></h3><br/><br/>
<p>Warning: The climate of Hackers India may unknowingly vary from geek to sexist to silence to foo. Lifeforms unaccustomed to sudden change and unforseen levels of behaviour might be permanently affected.</p><br/>
<p>All rights reserved till the end of Time — #hackers-india @ irc.oftc.net</p><br/>
<p>Design by ideamonk, code by kitallis and nirbheek.</p>
</div>
</div>
</body>
</html>