Merge branch 'lite_theme'

This commit is contained in:
Shish 2010-04-07 13:41:39 +01:00
commit 124fbc8f6f
9 changed files with 2270 additions and 0 deletions

View file

@ -0,0 +1,12 @@
<?php
class CustomCommentListTheme extends CommentListTheme {
protected function comment_to_html($comment, $trim=false) {
return $this->rr(parent::comment_to_html($comment, $trim));
}
protected function build_postbox($image_id) {
return $this->rr(parent::build_postbox($image_id));
}
}
?>

View file

@ -0,0 +1,9 @@
<?php
class CustomPage extends Page {
var $left_enabled = true;
public function disable_left() {
$this->left_enabled = false;
}
}
?>

View file

@ -0,0 +1,262 @@
<?php
/**
* Name: Lite Theme
* Author: Zach Hall <zach@sosguy.net>
* Link: http://seemslegit.com
* License: GPLv2
* Description: A mashup of Default, Danbooru, the interface on qwebirc, and
* some other sites, packaged in a light blue color.
*/
class Layout {
/**
* turns the Page into HTML
*/
public function display_page(Page $page) {
global $config, $user;
$theme_name = $config->get_string('theme', 'lite');
$site_name = $config->get_string('title');
$data_href = get_base_href();
$contact_link = $config->get_string('contact_link');
$header_html = "";
foreach($page->headers as $line) {
$header_html .= "\t\t$line\n";
}
$menu = "<div class='menu'>
<script type='text/javascript' src='$data_href/themes/$theme_name/wz_tooltip.js'></script>
<a href='".make_link()."' onmouseover='Tip(&#39;Home&#39;, BGCOLOR, &#39;#C3D2E0&#39;, FADEIN, 100)' onmouseout='UnTip()'><img src='$data_href/favicon.ico' style='position: relative; top: 3px;'></a>
<b>{$site_name}</b> ";
// Custom links: These appear on the menu.
$custom_links = "";
if($user->is_anonymous()) {
$custom_links .= $this->navlinks(make_link('user_admin/login'), "Account", array("user", "user_admin", "setup", "admin", "profile"));
} else {
$custom_links .= $this->navlinks(make_link('user'), "Account", array("user", "setup", "user_admin", "admin", "profile"));
}
$custom_links .= $this->navlinks(make_link('post/list'), "Posts", array("post", "view"));
$custom_links .= $this->navlinks(make_link('comment/list'), "Comments", array("comment"));
$custom_links .= $this->navlinks(make_link('tags'), "Tags", array("tags"));
$custom_links .= $this->navlinks(make_link('upload'), "Upload", array("upload"));
if(class_exists("Wiki")) {
$custom_links .= $this->navlinks(make_link('wiki/rules'), "Rules", array("wiki/rules"));
$custom_links .= $this->navlinks(make_link('wiki'), "Wiki", array("wiki"));
}
$menu .= "$custom_links</div>";
$left_block_html = "";
$main_block_html = "";
$sub_block_html = "";
$user_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;
case "user":
$user_block_html .= $block->body;
break;
case "subheading":
$sub_block_html .= $this->block_to_html($block, false, "main");
break;
default:
print "<p>error: {$block->header} using an unknown section ({$block->section})";
break;
}
}
$custom_sublinks = "<div class='sbar'>";
$cs = null;
// hack
global $user;
$username = url_escape($user->name);
// hack
$qp = _get_query_parts();
$hw = class_exists("Wiki");
// php sucks
switch($qp[0]) {
default:
$cs = $user_block_html;
break;
case "":
# FIXME: this assumes that the front page is
# post/list; in 99% of case it will either be
# post/list or home, and in the latter case
# the subnav links aren't shown, but it would
# be nice to be correct
case "post":
$cs .= "<a class='tab' href='".make_link('post/list')."'>All</a>";
$cs .= "<a class='tab' href='".make_link("post/list/favorited_by=$username/1")."'>My Favorites</a>";
$cs .= "<a class='tab' href='".make_link('rss/images')."'>Feed</a>";
if($hw) $cs .= "<a class='tab' href='".make_link("wiki/posts")."'>Help</a>";
break;
case "comment":
$cs .= "<a class='tab' href='".make_link('comment/list')."'>All</a>";
$cs .= "<a class='tab' href='".make_link('rss/comments')."'>Feed</a>";
$cs .= "<a class='tab' href='".make_link("ext_doc/comment")."'>Help</a>";
break;
case "pool":
$cs .= "<a class='tab' href='".make_link('pool/list')."'>List</a>";
$cs .= "<a class='tab' href='".make_link("pool/new")."'>Create</a>";
$cs .= "<a class='tab' href='".make_link("pool/updated")."'>Changes</a>";
$cs .= "<a class='tab' href='".make_link("ext_doc/pools")."'>Help</a>";
break;
case "wiki":
$cs .= "<a class='tab' href='".make_link('wiki')."'>Index</a>";
$cs .= "<a class='tab' href='".make_link("wiki/rules")."'>Rules</a>";
$cs .= "<a class='tab' href='".make_link("ext_doc/wiki")."'>Help</a>";
break;
case "tags":
case "alias":
$cs .= "<a class='tab' href='".make_link('tags/map')."'>Map</a>";
$cs .= "<a class='tab' href='".make_link('tags/alphabetic')."'>Alphabetic</a>";
$cs .= "<a class='tab' href='".make_link('tags/popularity')."'>Popularity</a>";
$cs .= "<a class='tab' href='".make_link('tags/categories')."'>Categories</a>";
$cs .= "<a class='tab' href='".make_link('alias/list')."'>Aliases</a>";
$cs .= "<a class='tab' href='".make_link("ext_doc/tag_edit")."'>Help</a>";
break;
case "upload":
if($hw) $cs .= "<a class='tab' href='".make_link("wiki/upload_guidelines")."'>Guidelines</a>";
break;
case "random":
$cs .= "<a class='tab' href='".make_link('random/view')."'>Shuffle</a>";
$cs .= "<a class='tab' href='".make_link('random/download')."'>Download</a>";
break;
case "featured":
$cs .= "<a class='tab' href='".make_link('featured/download')."'>Download</a>";
break;
}
if($cs == "") {$custom_sublinks = "";} else {
$custom_sublinks .= "$cs</div>";}
$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;"';
}
if($page->left_enabled==false) {
$left_block_html = "";
$main_block_html = "<div id='body_noleft'>$main_block_html</div>";
} else {
$left_block_html = "<div id='nav'>$left_block_html</div>";
$main_block_html = "<div id='body'>$main_block_html</div>";
}
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
</head>
<body>
$menu
$custom_sublinks
$sub_block_html
$left_block_html
$main_block_html
<div id="footer">
Images &copy; their respective owners,
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> &copy;
<a href="http://www.shishnet.org/">Shish</a> &amp; Co 2007-2010,
based on the Danbooru concept.<br />
Lite Theme by <a href="http://seemslegit.com">Zach</a>
$debug
$contact
</div>
</body>
</html>
EOD;
}
/**
* A handy function which does exactly what it says in the method name
*/
private function block_to_html($block, $hidable=false, $salt="") {
$h = $block->header;
$b = $block->body;
$html = "";
$i = str_replace(' ', '_', $h) . $salt;
if($hidable) $html .= "
<script><!--
$(document).ready(function() {
$(\"#$i-toggle\").click(function() {
$(\"#$i\").slideToggle(\"slow\", function() {
if($(\"#$i\").is(\":hidden\")) {
$.cookie(\"$i-hidden\", 'true', {path: '/'});
}
else {
$.cookie(\"$i-hidden\", 'false', {path: '/'});
}
});
});
if($.cookie(\"$i-hidden\") == 'true') {
$(\"#$i\").hide();
}
});
//--></script>
";
if(!is_null($h)) {
if($salt == "main") {
$html .= "<div class='maintop navside tab' id='$i-toggle'>$h</div>";
} else {
$html .= "<div class='navtop navside tab' id='$i-toggle'>$h</div>";
}
}
if(!is_null($b)) {
//if(strpos($b, "rrcontent")) {
if($salt =="main") {
$html .= "<div class='blockbody' id='$i'>$b</div>";
}
else {
$html .= "
<div class='navside tab' id='$i'>$b</div>
";
}
}
return $html;
}
private function navlinks($link, $desc, $pages_matched) {
/**
* Woo! We can actually SEE THE CURRENT PAGE!!
*/
$html = null;
$url = $_GET['q'];
$re1='.*?';
$re2='((?:[a-z][a-z]+))';
if ($c=preg_match_all ("/".$re1.$re2."/is", $url, $matches)) {
$url=$matches[1][0];
}
for($i=0;$i<count($pages_matched);$i++) {
if($url == $pages_matched[$i]) {
$html = "<a class='tab-selected' href='$link'>$desc</a>";
}
}
if(is_null($html)) {$html = "<a class='tab' href='$link'>$desc</a>";}
return $html;
}
}
?>

View file

@ -0,0 +1,37 @@
<?php
/**
* A customised version of the Setup theme
*/
class CustomSetupTheme extends SetupTheme {
protected function sb_to_html(SetupBlock $block) {
$h = $block->header;
$b = $block->body;
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
$html = "
<script><!--
$(document).ready(function() {
$(\"#$i-toggle\").click(function() {
$(\"#$i\").slideToggle(\"slow\", function() {
if($(\"#$i\").is(\":hidden\")) {
$.cookie(\"$i-hidden\", 'true', {path: '/'});
}
else {
$.cookie(\"$i-hidden\", 'false', {path: '/'});
}
});
});
if($.cookie(\"$i-hidden\") == 'true') {
$(\"#$i\").hide();
}
});
//--></script>
<div class='setupblock'>
<b id='$i-toggle'>$h</b>
<br><div id='$i'>$b</div>
</div>
";
return $this->rr($html);
}
}
?>

370
themes/lite/style.css Normal file
View file

@ -0,0 +1,370 @@
/**
* Some style elements borrowed from the QWebIRC project
* http://qwebirc.org/
*/
BODY {
background: #F0F7FF;
font-family: sans-serif;
font-size: 14px;
margin: 0px;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 menu bar *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
.menu {
border-bottom: 1px solid #C3D2E0;
margin-top: 0px;
margin-bottom: 0px;
padding: 4px;
background: #E3EFFA;
}
a.tab, a.tab:visited {
color:#000000;
text-decoration:none;
}
a.tab:hover, a.tab:active, .tab-selected {
color:#000000;
background-color:#FFFFFE;
text-decoration:none;
}
.tab, .tab-selected, .tframe, #tips {
-moz-border-radius:4px;
-webkit-border-radius:4px;
border:1px solid #C8D1DB;
padding:4px;
cursor:default;
margin-right:2px;
padding:2px;
}
.tframe {
margin:4px;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 secondary bars *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
.sbar {
border-bottom: 1px solid #C3D2E0;
margin-top: 0px;
margin-bottom: 16px;
padding: 4px;
background: #CEDFF0;
text-align: left;
}
.sfoot {
border-top: 1px solid #C3D2E0;
margin-top: 0px;
margin-bottom: 0px;
padding: 4px;
background: #CEDFF0;
text-align: right;
}
.navside {
background:none repeat scroll 0 0 #CEDFF0;
text-align:left;
padding:4px;
font-size:85%;
border:1px solid #C3D2E0;
margin-bottom:5px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
.highlighted {
background:none repeat scroll 0 0 #CEDFF0;
padding:4px;
border:1px solid #C3D2E0;
margin:5px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
.navtop, .maintop {
font-size:110%;
border-bottom:0 none;
margin:0 0 2px 0; /* top right bottom left */
padding:2px 10px;
position:relative;
left:0px;
width:50%;
}
.navtop {
top:7px;
}
.maintop {
top:0px;
margin-top:5px;
margin-bottom:5px;
}
#tips, #blotter1, #blotter2 {
margin-right:16px;
margin-left:16px;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 things common to all pages *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
H1 A {
color: black;
}
A, A:hover, A:active, A:visited {
color: #2860AD;
}
H3 {
text-align: center;
margin: 0px;
}
THEAD {
font-weight: bold;
}
TD {
vertical-align: top;
text-align: left;
}
CODE {
background: #DEDEDE;
font-size: 0.8em;
}
#subtitle {
width: 256px;
font-size: 0.75em;
margin: auto;
margin-top: -16px;
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>TEXTAREA {width: 100%;}
TD>SELECT {width: 100%;}
[onclick] {cursor:pointer;}
TABLE.zebra {border-spacing: 0px; border: 2px solid #C3D2E0;}
TABLE.zebra TD, TABLE.zebra TH {vertical-align: middle; padding: 4px;}
TABLE.zebra THEAD TD, TABLE.zebra THEAD TH {border-bottom: 2px solid #C3D2E0;}
TABLE.zebra TFOOT TD, TABLE.zebra TFOOT TH {border-top: 2px solid #C3D2E0;}
TABLE.zebra TR TD {border-bottom: 1px solid #C3D2E0;}
TABLE.zebra TR.odd {background: #CEDFF0;}
TABLE.zebra TR.even {background: #F0F7FF;}
INPUT, TEXTAREA {
-moz-border-radius:4px;
-webkit-border-radius:4px;
border:1px solid #C8D1DB;
padding:4px;
cursor:default;
margin-right:2px;
padding:2px;
}
INPUT:hover, TEXTAREA:hover {
background-color:#FFFFFF;
text-decoration:none;
}
#footer {
clear: both;
padding: 8px;
font-size: 0.7em;
text-align: right;
border-top: 1px solid #C3D2E0;
background: #E3EFFA;
}
*[onclick] {cursor: pointer;}
IMG {border: none;}
FORM {margin: 0px;}
A {text-decoration: none;}
A:hover {text-decoration: underline;}
BLOCKQUOTE {
border: 1px solid #C3D2E0;
padding: 8px;
background: #E3EFFA;
}
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: 190px;
}
#nav TD {
vertical-align: middle;
}
#nav INPUT {
width: 95%;
padding: 0px;
}
#nav SELECT {
width: 100%;
padding: 0px;
}
#comments P {
text-align: left;
width: 150px;
max-width: 150px;
overflow: hidden;
}
.comment {
text-align: left;
}
.more:after {
content: " >>>";
}
.tag_count:before {
content: "(";
}
.tag_count:after {
content: ")";
}
.paginator {
clear: both;
padding: 4px;
border-right: 1px solid #C3D2E0;
border-left: 1px solid #C3D2E0;
}
.paginator A {
-moz-border-radius:4px;
-webkit-border-radius:4px;
color: #000;
border:1px solid #C8D1DB;
padding:4px;
cursor:default;
margin-right:2px;
padding:2px;
}
.paginator A:hover {
background-color:#FFFFFF;
text-decoration:none;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* the main part of each page *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#body {
margin-left: 226px;
margin-right: 16px;
text-align: left;
height: 1%;
}
#body_noleft {
margin-left: 4px;
margin-right: 16px;
margin-bottom:16px;
padding-left:4px;
padding-right:4px;
text-align: left;
height: 1%;
}
#body TABLE {
width: 90%;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* specific page types *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#pagelist {
margin-top: 32px;
}
#tagmap A {
padding: 8px 4px 8px 4px;
}
/*.rr {text-align: left; background: #E3EFFA; 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; text-align: left;}
.hrr {text-align: left; background: #C3D2E0; margin: 8px;}
.hrrtop {background: url("circle-tl.png") no-repeat top left;}
.hrrtop div {background: url("circle-tr.png") no-repeat top right;}
.hrrbot {background: url("circle-bl.png") no-repeat bottom left;}
.hrrbot div {background: url("circle-br.png") no-repeat bottom right;}
.hrrtop, .hrrtop div, .hrrbot, .hrrbot div {height: 8px; width: 100%;}
.hrrcontent {margin: 0px 8px;}*/
.setupblock {
text-align: center;
width: 350px;
}
.setupblock TEXTAREA {
width: 300px;
font-size: 0.75em;
}
.helpable {
border-bottom: 1px dashed gray;
}
.ok {
background: #AFA;
}
.bad {
background: #FAA;
}
#nav .thumbblock {
float: none;
height: auto;
}
#nav .thumb {
margin-bottom: 0px;
}
.thumbblock {
width: 220px;
height: 220px;
display: inline-block;
float: left;
}
.thumb {
display: inline-block;
text-align: center;
margin-bottom: 32px;
}
#downtime #message, #downtime #login {
text-align: center;
}
#downtime H3 {
margin-top: 32px;
}
#downtime #login_table {
margin: auto;
}
.tooltip{
position:absolute;
top:0;
left:0;
z-index:3;
display:none;
}

View file

@ -0,0 +1,116 @@
<?php
/**
* A collection of common functions for theme parts
*/
class Themelet {
/**
* Generic error message display
*/
public function display_error(Page $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 $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 $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);
return "
<div class='thumbblock'>
<a href='$h_view_link' style='position: relative; display: block; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
<img id='thumb_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
</a>
</div>
";
}
/**
* Put something in a rounded rectangle box; specific to the default theme
*/
public function rr($html) {
return "
<div class='tframe'>
$html
</div>
";
}
/**
* Add a generic paginator
*/
public function display_paginator(Page $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_class=null) {
$link = make_link("$base_url/$page", $query);
return "<a class='$link_class' href='$link'>$name</a>";
}
private function gen_page_link_block($base_url, $query, $page, $current_page, $name) {
$paginator = "";
if($page == $current_page) {$link_class = "tab-selected";} else {$link_class = "";}
$paginator .= $this->gen_page_link($base_url, $query, $page, $name, $link_class);
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 ? "<span class='tab'>First</span>" : $this->gen_page_link($base_url, $query, 1, "First");
$prev_html = $at_start ? "<span class='tab'>Prev</span>" : $this->gen_page_link($base_url, $query, $prev, "Prev");
$random_html = $this->gen_page_link($base_url, $query, $rand, "Random");
$next_html = $at_end ? "<span class='tab'>Next</span>" : $this->gen_page_link($base_url, $query, $next, "Next");
$last_html = $at_end ? "<span class='tab'>Last</span>" : $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 "<div class='paginator sfoot'>
$first_html
$prev_html
$random_html
&lt;&lt; $pages_html &gt;&gt;
$next_html $last_html
</div>";
}
}
?>

119
themes/lite/user.theme.php Normal file
View file

@ -0,0 +1,119 @@
<?php
class CustomUserPageTheme extends UserPageTheme {
public function display_login_page($page) {
global $config;
$page->set_title("Login");
$page->set_heading("Login");
$page->disable_left();
$html = "
<form action='".make_link("user_admin/login")."' method='POST'>
<table summary='Login Form'>
<tr>
<td width='70'><label for='user'>Name</label></td>
<td width='70'><input id='user' type='text' name='user'></td>
</tr>
<tr>
<td><label for='pass'>Password</label></td>
<td><input id='pass' type='password' name='pass'></td>
</tr>
<tr><td colspan='2'><input type='submit' value='Log In'></td></tr>
</table>
</form>
";
if($config->get_bool("login_signup_enabled")) {
$html .= "<small><a href='".make_link("user_admin/create")."'>Create Account</a></small>";
}
$page->add_block(new Block("Login", $html, "main", 90));
}
public function display_user_links($page, $user, $parts) {
// no block in this theme
}
public function display_login_block(Page $page) {
// no block in this theme
}
public function display_user_block($page, $user, $parts) {
$h_name = html_escape($user->name);
$html = "";
$blocked = array("Pools", "Pool Changes", "Alias Editor", "My Profile");
foreach($parts as $part) {
if(in_array($part["name"], $blocked)) continue;
$html .= "<a href='{$part["link"]}' class='tab'>{$part["name"]}</a>";
}
$page->add_block(new Block("User Links", $html, "user", 90));
}
public function display_signup_page($page) {
global $config;
$tac = $config->get_string("login_tac", "");
$tfe = new TextFormattingEvent($tac);
send_event($tfe);
$tac = $tfe->formatted;
if(empty($tac)) {$html = "";}
else {$html = "<p>$tac</p>";}
$html .= "
<form action='".make_link("user_admin/create")."' method='POST'>
<table style='width: 300px;'>
<tr><td>Name</td><td><input type='text' name='name'></td></tr>
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
<tr><td>Email (Optional)</td><td><input type='text' name='email'></td></tr>
<tr><td colspan='2'><input type='Submit' value='Create Account'></td></tr>
</table>
</form>
";
$page->set_title("Create Account");
$page->set_heading("Create Account");
$page->disable_left();
$page->add_block(new Block("Signup", $html));
}
public function display_ip_list($page, $uploads, $comments) {
$html = "<table id='ip-history' style='width: 400px;'>";
$html .= "<tr><td>Uploaded from: ";
foreach($uploads as $ip => $count) {
$html .= "<br>$ip ($count)";
}
$html .= "</td><td>Commented from:";
foreach($comments as $ip => $count) {
$html .= "<br>$ip ($count)";
}
$html .= "</td></tr>";
$html .= "<tr><td colspan='2'>(Most recent at top)</td></tr></table>";
$page->add_block(new Block("IPs", $html));
}
public function display_user_page(User $duser, $stats) {
global $page;
$page->disable_left();
parent::display_user_page($duser, $stats);
}
protected function build_options($duser) {
global $database;
global $config;
$html = "";
$html .= "
<form action='".make_link("user_admin/change_pass")."' method='POST'>
<input type='hidden' name='name' value='{$duser->name}'>
<input type='hidden' name='id' value='{$duser->id}'>
<table style='width: 300px;'>
<tr><td colspan='2'>Change Password</td></tr>
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
<tr><td colspan='2'><input type='Submit' value='Change Password'></td></tr>
</table>
</form>
";
return $html;
}
}
?>

View file

@ -0,0 +1,44 @@
<?php
class CustomViewImageTheme extends ViewImageTheme {
public function display_page($page, $image, $editor_parts) {
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
$page->set_heading(html_escape($image->get_tag_list()));
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10));
$page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10));
$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
$page->add_block(new Block(null, "hello world", "subheading", 0));
}
private function build_stats($image) {
$h_owner = html_escape($image->get_owner()->name);
$h_ownerlink = "<a href='".make_link("user/$h_owner")."'>$h_owner</a>";
$h_ip = html_escape($image->owner_ip);
$h_date = autodate($image->posted);
$h_filesize = to_shorthand_int($image->filesize);
global $user;
if($user->is_admin()) {
$h_ownerlink .= " ($h_ip)";
}
$html = "
Id: {$image->id}
<br>Posted: $h_date by $h_ownerlink
<br>Size: {$image->width}x{$image->height}
<br>Filesize: $h_filesize
";
if(!is_null($image->source)) {
$h_source = html_escape($image->source);
if(substr($image->source, 0, 7) != "http://") {
$h_source = "http://" . $h_source;
}
$html .= "<br>Source: <a href='$h_source'>link</a>";
}
return $html;
}
}
?>

1301
themes/lite/wz_tooltip.js Normal file

File diff suppressed because it is too large Load diff