-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
120 lines (101 loc) · 3.82 KB
/
index.php
File metadata and controls
120 lines (101 loc) · 3.82 KB
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
<?php
@include_once ('Connector.php');
$error = true;
$tag = '';
$maxresults = 5;
if (isset($_GET["bname"])) {
$tag = htmlspecialchars($_GET["bname"]);
$error = false;
}
if (isset($_GET["maxresults"])) {
if ((int)$_GET["maxresults"] >= 0) {
$maxresults = $_GET["maxresults"];
} else {
//TODO: or just fall-back to default?
$error = true;
}
}
if ($error) {
die('Invalid parameters');
}
/**
$url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search';
$url.= '&api_key='.Api_Key;
$url.= '&tags='.$tag;
$url.= '&per_page='.$maxresults;
$url.= '&format=json';
$url.= '&nojsoncallback=1';
$response = json_decode(file_get_contents($url));
*/
$curl = new Connector();
$response = $curl -> get('https://api.flickr.com/services/rest/', array('method' => 'flickr.photos.search', 'api_key' => Api_Key, 'tags' => $tag, 'per_page' => $maxresults, 'format' => 'json', 'nojsoncallback' => '1'));
$photo_array = $response -> photos -> photo;
//print ("<pre>");
//print_r($response);
//print ("</pre>");
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>WIRRA | GovHack</title>
<link rel="stylesheet" href="../css/normalize.min.css">
<link rel="stylesheet" href="../css/main.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/grids-responsive-old-ie-min.css">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/grids-responsive-min.css">
<!--<![endif]-->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<script src="../js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">Your browser is slightly outdated. You can <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="header">
<div class="home-menu pure-menu pure-menu-open pure-menu-horizontal pure-menu-fixed">
<a class="pure-menu-heading" href="">What grows here?</a>
<ul>
<li></li>
</ul>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<h2 class="content-head is-center"><?php echo "Search Terms: " . $tag; ?></h2>
<div class="pure-g circles">
<?php
foreach($photo_array as $single_photo){
$farm_id = $single_photo->farm;
$server_id = $single_photo->server;
$photo_id = $single_photo->id;
$secret_id = $single_photo->secret;
$size = 'm';
$title = $single_photo->title;
$photo_url = 'http://farm'.$farm_id.'.staticflickr.com/'.$server_id.'/'.$photo_id.'_'.$secret_id.'_'.$size.'.'.'jpg';
?>
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-4 circle">
<h3 class="content-subhead"><?php echo $title; ?></h3>
<img class="pure-img-responsive FlickrImage" alt="<?php echo $title; ?>" src="<?php echo $photo_url; ?>" data-owner="<?php echo $single_photo -> owner; ?>">
</div>
<?php } ?>
</div> <!-- .pure-g -->
</div> <!-- .content -->
</div> <!-- .content -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../js/vendor/jquery-1.11.0.min.js"><\/script>')
</script>
<script src="../js/plugins.js"></script>
<script src="../js/main.js"></script>
</body>
</html>