new default theme
BIN
themes/default/b.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
themes/default/br.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
themes/default/circle-bl.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
themes/default/circle-br.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
themes/default/circle-tl.png
Normal file
After Width: | Height: | Size: 219 B |
BIN
themes/default/circle-tr.png
Normal file
After Width: | Height: | Size: 226 B |
BIN
themes/default/circle.png
Normal file
After Width: | Height: | Size: 326 B |
51
themes/default/comment.theme.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class CustomCommentListTheme extends CommentListTheme {
|
||||
public function add_comment_list(Page $page, Image $image, $comments, $position, $with_postbox) {
|
||||
$html = "<div style='text-align: left'>";
|
||||
$html .= "<div style='float: left; margin-right: 16px;'>" . $this->build_thumb_html($image) . "</div>";
|
||||
$html .= "<div style='margin-left: 228px;'>" . $this->comments_to_html($comments) . "</div>";
|
||||
$html .= "</div>";
|
||||
if($with_postbox) {
|
||||
$html .= "<div style='clear:both;'>".($this->build_postbox($image->id))."</div>";
|
||||
}
|
||||
else {
|
||||
// $html .= "<div style='clear:both;'><p><small>You need to create an account before you can comment</small></p></div>";
|
||||
$html .= "<div style='clear:both;'><p> </p></div>";
|
||||
}
|
||||
|
||||
$page->add_block(new Block("{$image->id}: ".($image->get_tag_list()), $html, "main", $position));
|
||||
}
|
||||
|
||||
protected function comment_to_html($comment, $trim=false) {
|
||||
global $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($comment->comment);
|
||||
send_event($tfe);
|
||||
|
||||
$i_uid = int_escape($comment->owner_id);
|
||||
$h_name = html_escape($comment->owner_name);
|
||||
$h_poster_ip = html_escape($comment->poster_ip);
|
||||
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
|
||||
$i_comment_id = int_escape($comment->comment_id);
|
||||
$i_image_id = int_escape($comment->image_id);
|
||||
|
||||
$h_userlink = "<a href='".make_link("user/$h_name")."'>$h_name</a>";
|
||||
$stripped_nonl = str_replace("\n", "\\n", $tfe->stripped);
|
||||
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
|
||||
$h_dellink = $user->is_admin() ?
|
||||
"<br>($h_poster_ip, <a ".
|
||||
"onclick=\"return confirm('Delete comment by $h_name:\\n$stripped_nonl');\" ".
|
||||
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del</a>)" : "";
|
||||
$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>>>></a>\n" : "";
|
||||
return "
|
||||
<div class='rr'>
|
||||
<div class='rrtop'><div></div></div>
|
||||
<div class='rrcontent'>
|
||||
$h_userlink: $h_comment $h_imagelink $h_dellink
|
||||
</div>
|
||||
<div class='rrbot'><div></div></div>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
?>
|
BIN
themes/default/dcircle-bl.png
Normal file
After Width: | Height: | Size: 224 B |
BIN
themes/default/dcircle-br.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
themes/default/dcircle-tl.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
themes/default/dcircle-tr.png
Normal file
After Width: | Height: | Size: 234 B |
112
themes/default/layout.class.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
class Layout {
|
||||
function display_page($page) {
|
||||
global $config;
|
||||
|
||||
$theme_name = $config->get_string('theme', 'default');
|
||||
$data_href = get_base_href();
|
||||
$contact_link = $config->get_string('contact_link');
|
||||
$version = "Shimmie-".VERSION;
|
||||
|
||||
$header_html = "";
|
||||
foreach($page->headers as $line) {
|
||||
$header_html .= "\t\t$line\n";
|
||||
}
|
||||
|
||||
$left_block_html = "";
|
||||
$main_block_html = "";
|
||||
|
||||
foreach($page->blocks as $block) {
|
||||
switch($block->section) {
|
||||
case "left":
|
||||
$left_block_html .= $this->block_to_html($block, true, "left");
|
||||
break;
|
||||
case "main":
|
||||
$main_block_html .= $this->block_to_html($block, false, "main");
|
||||
break;
|
||||
default:
|
||||
print "<p>error: {$block->header} using an unknown section ({$block->section})";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$debug = get_debug_info();
|
||||
|
||||
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
||||
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
||||
|
||||
$wrapper = "";
|
||||
if(strlen($page->heading) > 100) {
|
||||
$wrapper = ' style="height: 3em; overflow: auto;"';
|
||||
}
|
||||
|
||||
print <<<EOD
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>{$page->title}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
||||
$header_html
|
||||
<script src='$data_href/themes/$theme_name/sidebar.js' type='text/javascript'></script>
|
||||
<script src='$data_href/themes/$theme_name/script.js' type='text/javascript'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1$wrapper>{$page->heading}</h1>
|
||||
$subheading
|
||||
|
||||
<div id="nav">$left_block_html</div>
|
||||
<div id="body">$main_block_html</div>
|
||||
|
||||
<div id="footer">
|
||||
Images © their respective owners,
|
||||
<a href="http://code.shishnet.org/shimmie2/">$version</a> ©
|
||||
<a href="http://www.shishnet.org/">Shish</a> 2007-2009,
|
||||
based on the Danbooru concept.
|
||||
$debug
|
||||
$contact
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOD;
|
||||
}
|
||||
|
||||
function block_to_html($block, $hidable=false, $salt="") {
|
||||
$h = $block->header;
|
||||
$b = $block->body;
|
||||
$html = "";
|
||||
$i = str_replace(' ', '_', $h) . $salt;
|
||||
if($hidable) {
|
||||
$toggle = " onclick=\"toggle('$i')\"";
|
||||
}
|
||||
else {
|
||||
$toggle = "";
|
||||
}
|
||||
if(!is_null($h)) $html .= "
|
||||
<div class='hrr'>
|
||||
<div class='hrrtop'><div></div></div>
|
||||
<div class='hrrcontent'><h3 id='$i-toggle'$toggle>$h</h3></div>
|
||||
<div class='hrrbot'><div></div></div>
|
||||
</div>
|
||||
";
|
||||
if(!is_null($b)) {
|
||||
if(strpos($b, "rrcontent")) {
|
||||
$html .= "<div class='blockbody' id='$i'>$b</div>";
|
||||
}
|
||||
else {
|
||||
$html .= "
|
||||
<div class='rr'>
|
||||
<div class='rrtop'><div></div></div>
|
||||
<div class='rrcontent'><div class='blockbody' id='$i'>$b</div></div>
|
||||
<div class='rrbot'><div></div></div>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
?>
|
6
themes/default/page.class.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Page extends GenericPage {
|
||||
// no changes from default
|
||||
}
|
||||
?>
|
BIN
themes/default/r.png
Normal file
After Width: | Height: | Size: 225 B |
136
themes/default/script.js
Normal file
@ -0,0 +1,136 @@
|
||||
var defaultTexts = new Array();
|
||||
|
||||
window.onload = function(e) {
|
||||
var sections=get_sections();
|
||||
for(var i=0;i<sections.length;i++) toggle(sections[i]);
|
||||
|
||||
initGray("search_input", "Search");
|
||||
initGray("commentBox", "Comment");
|
||||
initGray("tagBox", "tagme");
|
||||
|
||||
// if we're going to show with JS, hide with JS first
|
||||
pass_confirm = byId("pass_confirm");
|
||||
if(pass_confirm) {
|
||||
pass_confirm.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initGray(boxname, text) {
|
||||
var box = byId(boxname);
|
||||
if(!box) return;
|
||||
|
||||
var clr = function () {cleargray(box, text);};
|
||||
var set = function () {setgray(box, text);};
|
||||
|
||||
addEvent(box, "focus", clr, false);
|
||||
addEvent(box, "blur", set, false);
|
||||
|
||||
if(box.value == text) {
|
||||
box.style.color = "#999";
|
||||
box.style.textAlign = "center";
|
||||
}
|
||||
else {
|
||||
box.style.color = "#000";
|
||||
box.style.textAlign = "left";
|
||||
}
|
||||
}
|
||||
|
||||
function cleargray(box, text) {
|
||||
if(box.value == text) {
|
||||
box.value = "";
|
||||
box.style.color = "#000";
|
||||
box.style.textAlign = "left";
|
||||
}
|
||||
}
|
||||
function setgray(box, text) {
|
||||
if(box.value == "") {
|
||||
box.style.textAlign = "center";
|
||||
box.style.color = "gray";
|
||||
box.value = text;
|
||||
}
|
||||
}
|
||||
|
||||
function showUp(elem) {
|
||||
e = document.getElementById(elem)
|
||||
if(!e) return;
|
||||
e.style.display = "";
|
||||
// alert(e.type+": "+e.value);
|
||||
if(e.value.match(/^http|^ftp/)) {
|
||||
e.type = "text";
|
||||
alert("Box is web upload");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* LibShish-JS *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function addEvent(obj, event, func, capture){
|
||||
if (obj.addEventListener){
|
||||
obj.addEventListener(event, func, capture);
|
||||
} else if (obj.attachEvent){
|
||||
obj.attachEvent("on"+event, func);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function byId(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
|
||||
function getHTTPObject() {
|
||||
if (window.XMLHttpRequest){
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
else if(window.ActiveXObject){
|
||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
}
|
||||
|
||||
function ajaxRequest(url, callback) {
|
||||
var http = getHTTPObject();
|
||||
http.open("GET", url, true);
|
||||
http.onreadystatechange = function() {
|
||||
if(http.readyState == 4) callback(http.responseText);
|
||||
}
|
||||
http.send(null);
|
||||
}
|
||||
|
||||
|
||||
/* get, set, and delete cookies */
|
||||
function getCookie( name ) {
|
||||
var start = document.cookie.indexOf( name + "=" );
|
||||
var len = start + name.length + 1;
|
||||
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
|
||||
return null;
|
||||
}
|
||||
if ( start == -1 ) return null;
|
||||
var end = document.cookie.indexOf( ";", len );
|
||||
if ( end == -1 ) end = document.cookie.length;
|
||||
return unescape( document.cookie.substring( len, end ) );
|
||||
}
|
||||
|
||||
function setCookie( name, value, expires, path, domain, secure ) {
|
||||
var today = new Date();
|
||||
today.setTime( today.getTime() );
|
||||
if ( expires ) {
|
||||
expires = expires * 1000 * 60 * 60 * 24;
|
||||
}
|
||||
var expires_date = new Date( today.getTime() + (expires) );
|
||||
document.cookie = name+"="+escape( value ) +
|
||||
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
|
||||
( ( path ) ? ";path=" + path : "" ) +
|
||||
( ( domain ) ? ";domain=" + domain : "" ) +
|
||||
( ( secure ) ? ";secure" : "" );
|
||||
}
|
||||
|
||||
function deleteCookie( name, path, domain ) {
|
||||
if ( getCookie( name ) ) document.cookie = name + "=" +
|
||||
( ( path ) ? ";path=" + path : "") +
|
||||
( ( domain ) ? ";domain=" + domain : "" ) +
|
||||
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
||||
}
|
||||
|
83
themes/default/sidebar.js
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This script shamelessly stolen from wakachan.org d(^_^)b
|
||||
*/
|
||||
|
||||
var cookie_name="shimmie_sidebar";
|
||||
var default_sections=["upload", "edit_tags"];
|
||||
|
||||
function toggle(id)
|
||||
{
|
||||
var e=document.getElementById(id);
|
||||
if(!e) return;
|
||||
if(e.style.display)
|
||||
{
|
||||
remove_section(id);
|
||||
e.style.display="";
|
||||
|
||||
var e2 = document.getElementById(id+"-toggle");
|
||||
if(e2) {
|
||||
e2.style.color = "#000";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add_section(id);
|
||||
e.style.display="none";
|
||||
|
||||
var e2 = document.getElementById(id+"-toggle");
|
||||
if(e2) {
|
||||
e2.style.color = "#AAA";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function add_section(id)
|
||||
{
|
||||
var sections=get_sections();
|
||||
for(var i=0;i<sections.length;i++) if(sections[i]==id) return;
|
||||
sections.push(id);
|
||||
set_sections(sections);
|
||||
}
|
||||
|
||||
function remove_section(id)
|
||||
{
|
||||
var sections=get_sections();
|
||||
var new_sections=new Array();
|
||||
for(var i=0;i<sections.length;i++) if(sections[i]!=id) new_sections.push(sections[i]);
|
||||
set_sections(new_sections);
|
||||
}
|
||||
|
||||
function get_sections()
|
||||
{
|
||||
var cookie=get_cookie(cookie_name);
|
||||
if(cookie) return cookie.split(/,/);
|
||||
else return default_sections;
|
||||
}
|
||||
|
||||
function set_sections(sections) { set_cookie(cookie_name,sections.join(","),365); }
|
||||
|
||||
function get_cookie(name)
|
||||
{
|
||||
with(document.cookie)
|
||||
{
|
||||
var index=indexOf(name+"=");
|
||||
if(index==-1) return '';
|
||||
index=indexOf("=",index)+1;
|
||||
var endstr=indexOf(";",index);
|
||||
if(endstr==-1) endstr=length;
|
||||
return unescape(substring(index,endstr));
|
||||
}
|
||||
};
|
||||
|
||||
function set_cookie(name,value,days)
|
||||
{
|
||||
if(days)
|
||||
{
|
||||
var date=new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
var expires="; expires="+date.toGMTString();
|
||||
}
|
||||
else expires="";
|
||||
document.cookie=name+"="+value+expires+"; path=/";
|
||||
}
|
||||
|
214
themes/default/style.css
Normal file
@ -0,0 +1,214 @@
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
3 things common to all pages *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
BODY {
|
||||
background: #EEE;
|
||||
font-family: "Arial", sans-serif;
|
||||
font-size: 14px;
|
||||
margin: 0px;
|
||||
}
|
||||
H1 {
|
||||
border-bottom: 1px solid black;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 16px;
|
||||
padding: 8px;
|
||||
background: #BBB;
|
||||
text-align: center;
|
||||
}
|
||||
H1 A {
|
||||
color: black;
|
||||
}
|
||||
H3 {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
}
|
||||
THEAD {
|
||||
font-weight: bold;
|
||||
}
|
||||
TD {
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
}
|
||||
CODE {
|
||||
background: #DEDEDE;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
#subtitle {
|
||||
width: 256px;
|
||||
font-size: 0.75em;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
border: 1px solid black;
|
||||
border-top: none;
|
||||
background: #DDD;
|
||||
}
|
||||
#body SELECT {width: 150px;}
|
||||
TD>INPUT[type="submit"] {width: 100%;}
|
||||
TD>INPUT[type="text"] {width: 100%;}
|
||||
TD>INPUT[type="password"] {width: 100%;}
|
||||
TD>SELECT {width: 100%;}
|
||||
|
||||
TABLE.zebra {border-spacing: 0px;}
|
||||
TABLE.zebra TD, TABLE.zebra TH {vertical-align: middle; padding: 4px;}
|
||||
TABLE.zebra THEAD TD, TABLE.zebra THEAD TH {border-bottom: 2px solid #CCC;}
|
||||
TABLE.zebra TFOOT TD, TABLE.zebra TFOOT TH {border-top: 2px solid #CCC;}
|
||||
TABLE.zebra TR {border-bottom: 1px solid #DDD;}
|
||||
TABLE.zebra TR.odd {background: #EFEFEF;}
|
||||
TABLE.zebra TR.even {background: #E0E0E0;}
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
padding: 8px;
|
||||
font-size: 0.7em;
|
||||
text-align: center;
|
||||
border-top: 1px solid black;
|
||||
background: #BBB;
|
||||
}
|
||||
|
||||
*[onclick] {cursor: pointer;}
|
||||
IMG {border: none;}
|
||||
FORM {margin: 0px;}
|
||||
A {text-decoration: none;}
|
||||
A:hover {text-decoration: underline;}
|
||||
|
||||
BLOCKQUOTE {
|
||||
border: 1px solid black;
|
||||
padding: 8px;
|
||||
background: #DDD;
|
||||
}
|
||||
|
||||
UL {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* the navigation bar, and all its blocks *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#nav {
|
||||
width: 200px;
|
||||
float: left;
|
||||
text-align: center;
|
||||
margin-left: 16px;
|
||||
}
|
||||
#nav .blockbody {
|
||||
font-size: 0.85em;
|
||||
text-align: center;
|
||||
}
|
||||
#nav TABLE {
|
||||
width: 150px;
|
||||
}
|
||||
#nav TD {
|
||||
vertical-align: middle;
|
||||
}
|
||||
#nav INPUT {
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
#nav SELECT {
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#comments P {
|
||||
text-align: left;
|
||||
width: 150px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.more:after {
|
||||
content: " >>>";
|
||||
}
|
||||
|
||||
.tag_count:before {
|
||||
content: "(";
|
||||
}
|
||||
.tag_count:after {
|
||||
content: ")";
|
||||
}
|
||||
|
||||
.paginator {
|
||||
clear: both;
|
||||
padding: 4px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* the main part of each page *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#body {
|
||||
margin-left: 226px;
|
||||
margin-right: 16px;
|
||||
text-align: center;
|
||||
height: 1%;
|
||||
}
|
||||
#body TABLE {
|
||||
width: 90%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* specific page types *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#pagelist {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
#tagmap A {
|
||||
padding: 8px 4px 8px 4px;
|
||||
}
|
||||
|
||||
.rr {text-align: left; background: #DDD; margin: 8px;}
|
||||
.rrtop {background: url("circle-tl.png") no-repeat top left;}
|
||||
.rrtop div {background: url("circle-tr.png") no-repeat top right;}
|
||||
.rrbot {background: url("circle-bl.png") no-repeat bottom left;}
|
||||
.rrbot div {background: url("circle-br.png") no-repeat bottom right;}
|
||||
.rrtop, .rrtop div, .rrbot, .rrbot div {height: 8px; width: 100%;}
|
||||
.rrcontent {margin: 0px 8px;}
|
||||
|
||||
.hrr {text-align: left; background: #CCC; margin: 8px;}
|
||||
.hrrtop {background: url("dcircle-tl.png") no-repeat top left;}
|
||||
.hrrtop div {background: url("dcircle-tr.png") no-repeat top right;}
|
||||
.hrrbot {background: url("dcircle-bl.png") no-repeat bottom left;}
|
||||
.hrrbot div {background: url("dcircle-br.png") no-repeat bottom right;}
|
||||
.hrrtop, .hrrtop div, .hrrbot, .hrrbot div {height: 8px; width: 100%;}
|
||||
.hrrcontent {margin: 0px 8px;}
|
||||
|
||||
.setupblock {
|
||||
border: 1px solid #AAA;
|
||||
padding: 8px;
|
||||
margin: 16px;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.helpable {
|
||||
border-bottom: 1px dashed gray;
|
||||
}
|
||||
|
||||
.ok {
|
||||
background: #AFA;
|
||||
}
|
||||
.bad {
|
||||
background: #FAA;
|
||||
}
|
||||
|
||||
.thumbblock {
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
.thumb {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
vertical-align: center;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
102
themes/default/themelet.class.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
class Themelet {
|
||||
/**
|
||||
* Generic error message display
|
||||
*/
|
||||
public function display_error($page, $title, $message) {
|
||||
$page->set_title($title);
|
||||
$page->set_heading($title);
|
||||
$page->add_block(new NavBlock());
|
||||
$page->add_block(new Block("Error", $message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A specific, common error message
|
||||
*/
|
||||
public function display_permission_denied($page) {
|
||||
header("HTTP/1.0 403 Permission Denied");
|
||||
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generic thumbnail code; returns HTML rather than adding
|
||||
* a block since thumbs tend to go inside blocks...
|
||||
*/
|
||||
public function build_thumb_html($image, $query=null) {
|
||||
global $config;
|
||||
$i_id = int_escape($image->id);
|
||||
$h_view_link = make_link("post/view/$i_id", $query);
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
$hm8 = $tsize[1]-8;
|
||||
$wm8 = $tsize[0]-8;
|
||||
return "
|
||||
<div class='thumbblock'>
|
||||
<div class='rr thumb'>
|
||||
<div class='rrtop'><div></div></div>
|
||||
<div class='rrcontent'>
|
||||
<a href='$h_view_link' style='position: relative; display: block; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
|
||||
<img id='$i_id' title='$h_tip' alt='$h_tip' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
|
||||
</a>
|
||||
</div>
|
||||
<div class='rrbot'><div></div></div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a generic paginator
|
||||
*/
|
||||
public function display_paginator($page, $base, $query, $page_number, $total_pages) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
$body = $this->build_paginator($page_number, $total_pages, $base, $query);
|
||||
$page->add_block(new Block(null, $body, "main", 90));
|
||||
}
|
||||
|
||||
private function gen_page_link($base_url, $query, $page, $name) {
|
||||
$link = make_link("$base_url/$page", $query);
|
||||
return "<a href='$link'>$name</a>";
|
||||
}
|
||||
|
||||
private function gen_page_link_block($base_url, $query, $page, $current_page, $name) {
|
||||
$paginator = "";
|
||||
if($page == $current_page) $paginator .= "<b>";
|
||||
$paginator .= $this->gen_page_link($base_url, $query, $page, $name);
|
||||
if($page == $current_page) $paginator .= "</b>";
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||
$next = $current_page + 1;
|
||||
$prev = $current_page - 1;
|
||||
$rand = rand(1, $total_pages);
|
||||
|
||||
$at_start = ($current_page <= 1 || $total_pages <= 1);
|
||||
$at_end = ($current_page >= $total_pages);
|
||||
|
||||
$first_html = $at_start ? "First" : $this->gen_page_link($base_url, $query, 1, "First");
|
||||
$prev_html = $at_start ? "Prev" : $this->gen_page_link($base_url, $query, $prev, "Prev");
|
||||
$random_html = $this->gen_page_link($base_url, $query, $rand, "Random");
|
||||
$next_html = $at_end ? "Next" : $this->gen_page_link($base_url, $query, $next, "Next");
|
||||
$last_html = $at_end ? "Last" : $this->gen_page_link($base_url, $query, $total_pages, "Last");
|
||||
|
||||
$start = $current_page-5 > 1 ? $current_page-5 : 1;
|
||||
$end = $start+10 < $total_pages ? $start+10 : $total_pages;
|
||||
|
||||
$pages = array();
|
||||
foreach(range($start, $end) as $i) {
|
||||
$pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, $i);
|
||||
}
|
||||
$pages_html = implode(" | ", $pages);
|
||||
|
||||
return "<p class='paginator'>$first_html | $prev_html | $random_html | $next_html | $last_html".
|
||||
"<br><< $pages_html >></p><!-- rrcontent -->";
|
||||
}
|
||||
}
|
||||
?>
|