-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
94 lines (86 loc) · 3.47 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
<?php
/**
* Main index page.
*
* If we're on the homepage, then we enable all of the AJAX features. If
* displaying a single image, then we disable the info panel and previous/next
* links, instead displaying the shot info. However the EXIF panel will still
* load.
*
* If the user has clicked the 'Random' page, then we automatically redirect
* to a random page.
*
* @package Reflection
*/
// Code for grabbing a random post from the database if necessary; we then redirect to the page.
if ($_GET['do'] == 'random') {
$random_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_type = 'post' AND post_password = '' AND post_status = 'publish' ORDER BY RAND() LIMIT 1");
wp_redirect(get_permalink($random_id));
}
// Grab header.
get_header();
// Begin post loop.
if (have_posts()) : while (have_posts()) : the_post();
// Grab next/previous post IDs if they exist. Odd syntax is hack for PHP4.
$next_post = is_object($npobj = get_next_post()) ? $npobj->ID : 0;
$prev_post = is_object($ppobj = get_previous_post()) ? $ppobj->ID : 0;
$next_post_perm = get_permalink($next_post);
$prev_post_perm = get_permalink($prev_post);
?>
<?php if (is_home() || is_single()):?>
<script type="text/javascript">
Site.nextPostID = <?=$next_post?>;
Site.prevPostID = <?=$prev_post?>;
</script>
<?php endif;?>
<div id="topcontent" style="width:<?=im_dim()?>px;">
<div id="title">
<div id="titlebits">
<ul>
<?php if (is_home()):?>
<li>
<a id="prevPostLink" href="<?=$prev_post ? $prev_post_perm.'">«' : '">';?></a> |
<a id="nextPostLink" href="<?=$next_post ? $next_post_perm.'">»' : '">';?></a>
</li>
<?php endif;?>
<li><a id="comment" href="<?php comments_link();?>"><?php comments_number(__('0 comments',TD),__('1 comment',TD),__('% comments',TD));?></a></li>
<li><a class="panel" id="exif" href=""><?_e('exif',TD);?></a></li>
<li><a <?=is_home() ? 'class="panel" ' : ''?>id="info" href="<?the_permalink();?>#notes"><?_e('info',TD);?></a></li>
</ul>
</div>
<h3 id="texttitle">
<a href="<?php the_permalink();?>"><?php the_title();?></a>
<span id="inlinedate"><?php the_date('jS F Y');?></span>
</h3>
</div>
<div id="imageholder">
<div id="panel_exif" class="overlay" style="right:0;top:0;">
<?echo get_exif();?>
</div>
<?php if (is_home()): // Only enable overlays for homepage navigation. ?>
<div id="panel_info" class="overlay bottomPanel" style="bottom:0;left:0;right:0;z-index:6">
<?php the_content(__('Read more...')); ?>
</div>
<div id="panel_overlay" class="overlay" style="left:0;top:0;z-index:100">
</div>
<?php endif; ?>
<div id="overlaynav">
<a href="<?=$prev_post ? $prev_post_perm.'"' : '" style="display:none"'?> id="overPrevLink"></a>
<a href="<?=$next_post ? $next_post_perm.'"' : '" style="display:none"'?> id="overNextLink"></a>
</div>
<img id="mainimage" src="<?=get_thumbnail();?>" alt="image" />
</div>
</div>
<div id="reflectionholder"></div>
<?php if (is_single() && !is_home()): ?>
<div id="content">
<a name="info" id="notes"></a>
<h3>Shot Notes</h3>
<?php the_content(); ?>
</div>
<div id="comments">
<?php comments_template(); ?>
</div>
<?php endif;?>
<?php break; endwhile; endif;?>
<?php require(TEMPLATEPATH . '/footer.php'); ?>