-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
102 lines (98 loc) · 2.87 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
<?php
require 'inc/include.php';
// Hello world.
$id = false;
$source = false;
$base_class_str = '_Image';
// TODO: Insert into a controller.
$key = new key();
if (isset($_GET['id'])) {
$id = alphaID($_GET['id'], false);
}
if (isset($_COOKIE['source'])) {
$source = $_COOKIE['source'];
} else {
$source = 'imgur';
}
if (isset($_GET['s'])) {
setcookie('source', $_GET['s']);
$source = $_GET['s'];
}
if($source) {
$class = ucfirst($source).$base_class_str;
$image = new $class();
unset($class);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RandImg</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px;
}
footer {
color: #888;
padding-top: 6px;
}
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a>
<a class="brand" href="#">RandImg</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active">
<a href="index.php">Random</a>
</li>
<?php
echo '<li><a href="index.php?id=' . alphaID($image->get_hash(), true) . '">Permalink</a></li>';
?>
</ul>
<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Source<b class="caret"></b></a>
<ul class="dropdown-menu">
<li<?php if ($source != 'screensnapr') { echo ' class="active"'; } ?>>
<a href="index.php?s=imgur">Imgur</a>
</li>
<li<?php if ($source == 'screensnapr') { echo ' class="active"'; } ?>>
<a href="index.php?s=screensnapr">Screensnapr <span class="badge badge-error">Rarely Works</span></a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span12">
<div class="thumbnail">
<?php
echo '<img src="' . $image->get_image() . '" /><br>';
?>
</div>
</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script defer src="js/bootstrap.min.js"></script>
</body>
</html>