Merge branch 'master' of git://github.com/shish/shimmie2

This commit is contained in:
NaGeL
2012-01-22 16:30:12 +01:00
29 changed files with 236 additions and 182 deletions

View File

@@ -43,8 +43,8 @@ class Artists implements Extension {
if ($event instanceof PageRequestEvent)
$this->handle_commands($event);
if($event instanceof SearchTermParseEvent) {
if ($event instanceof SearchTermParseEvent) {
$matches = array();
if(preg_match("/^author=(.*)$/", $event->term, $matches)) {
$char = $matches[1];

View File

@@ -36,7 +36,6 @@ class BrowserSearch implements Extension {
// First, we need to build all the variables we'll need
$search_title = $config->get_string('title');
//$search_form_url = $config->get_string('base_href'); //make_link('post/list');
$search_form_url = make_link('post/list/{searchTerms}');
$suggenton_url = make_link('browser_search/')."{searchTerms}";
$icon_b64 = base64_encode(file_get_contents("favicon.ico"));

View File

@@ -83,8 +83,6 @@ class ForumTheme extends Themelet {
global $config, $page/*, $user*/;
$theme_name = $config->get_string('theme');
$data_href = $config->get_string('base_href');
$base_href = $config->get_string('base_href');
$html = "";
$n = 0;

View File

@@ -9,6 +9,7 @@ class FlashFileHandlerTheme extends Themelet {
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'
height='{$image->height}'
width='{$image->width}'
wmode='opaque'
>
<param name='movie' value='$ilink'/>
<param name='quality' value='high' />
@@ -16,6 +17,7 @@ class FlashFileHandlerTheme extends Themelet {
pluginspage='http://www.macromedia.com/go/getflashplayer'
height='{$image->height}'
width='{$image->width}'
wmode='opaque'
type='application/x-shockwave-flash'></embed>
</object>";
$page->add_block(new Block("Flash Animation", $html, "main", 0));

33
contrib/holiday/main.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
/**
* Name: Holiday Theme
* Author: DakuTree <thedakutree@codeanimu.net>
* Link: http://www.codeanimu.net
* License: GPLv2
* Description: Use an additional stylesheet on certain holidays.
*/
class Holiday extends SimpleExtension {
public function onInitExt(Event $event) {
global $config;
$config->set_default_bool("holiday_aprilfools", false);
}
public function onSetupBuilding(Event $event) {
global $config;
$sb = new SetupBlock("Holiday Theme");
$sb->add_bool_option("holiday_aprilfools", "Enable April Fools");
$event->panel->add_block($sb);
}
public function onPageRequest(Event $event) {
global $config;
$date = /*date('d/m') == '01/01' ||date('d/m') == '14/02' || */date('d/m') == '01/04'/* || date('d/m') == '24/12' || date('d/m') == '25/12' || date('d/m') == '31/12'*/;
if($date){
if($config->get_bool("holiday_aprilfools")){
$this->theme->display_holiday($date);
}
}
}
}
?>

View File

@@ -0,0 +1,11 @@
BODY {
/* It's a bit crazy but, april fools is supposed to be crazy.
This flips the entire page upside down.
TODO: Add a way for the user to disable this */
-webkit-transform: rotate(-180deg); /*Safari*/
-moz-transform: rotate(-180deg); /*Firefox*/
-o-transform: rotate(-180deg); /*Opera*/
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); /*IE6*/
ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; /*IE7+?*/
}

20
contrib/holiday/theme.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
class HolidayTheme extends Themelet {
public function display_holiday($date) {
global $page;
if($date){
$csssheet = "<link rel='stylesheet' href='".get_base_href()."/contrib/holiday/stylesheets/";
// April Fools
// Flips the entire page upside down!
// TODO: Make it possible for the user to turn this off!
if(date('d/m') == '01/04'){
$csssheet .= "aprilfools.css";
}
$csssheet .= "' type='text/css'>";
$page->add_html_header("$csssheet");
}
}
}
?>

View File

@@ -28,14 +28,13 @@ class Home extends SimpleExtension {
public function onPageRequest(PageRequestEvent $event) {
global $config, $page;
if($event->page_matches("home")) {
$base_href = $config->get_string('base_href');
$data_href = get_base_href();
$base_href = get_base_href();
$sitename = $config->get_string('title');
$theme_name = $config->get_string('theme');
$body = $this->get_body();
$this->theme->display_page($page, $sitename, $data_href, $theme_name, $body);
$this->theme->display_page($page, $sitename, $base_href, $theme_name, $body);
}
}
@@ -58,8 +57,7 @@ class Home extends SimpleExtension {
// returns just the contents of the body
global $database;
global $config;
$base_href = $config->get_string('base_href');
$data_href = get_base_href();
$base_href = get_base_href();
$sitename = $config->get_string('title');
$contact_link = $config->get_string('contact_link');
$counter_dir = $config->get_string('home_counter', 'default');
@@ -71,7 +69,7 @@ class Home extends SimpleExtension {
$counter_text = "";
for($n=0; $n<strlen($strtotal); $n++) {
$cur = $strtotal[$n];
$counter_text .= " <img alt='$cur' src='$data_href/ext/home/counters/$counter_dir/$cur.gif' /> ";
$counter_text .= " <img alt='$cur' src='$base_href/ext/home/counters/$counter_dir/$cur.gif' /> ";
}
// get the homelinks and process them

View File

@@ -1,14 +1,14 @@
<?php
class HomeTheme extends Themelet {
public function display_page(Page $page, $sitename, $data_href, $theme_name, $body) {
public function display_page(Page $page, $sitename, $base_href, $theme_name, $body) {
$page->set_mode("data");
$page->set_data(<<<EOD
<html>
<head>
<title>$sitename</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'>
<link rel='stylesheet' href='$base_href/themes/$theme_name/style.css' type='text/css'>
</head>
<style>
div#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none; box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none;}

View File

@@ -64,7 +64,7 @@ class Ratings implements Extension {
}
if($event instanceof RatingSetEvent) {
$this->set_rating($event->image->id, $event->rating);
$this->set_rating($event->image->id, $event->rating, $event->image->rating);
}
if($event instanceof ImageInfoBoxBuildingEvent) {
@@ -205,9 +205,12 @@ class Ratings implements Extension {
}
}
private function set_rating($image_id, $rating) {
private function set_rating($image_id, $rating, $old_rating) {
global $database;
$database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id));
if($old_rating != $rating){
$database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id));
log_info("core-image", "Rating for Image #{$image_id} set to: ".$this->theme->rating_to_name($rating));
}
}
}
add_event_listener(new Ratings());

View File

@@ -55,7 +55,7 @@ class RSS_Comments extends SimpleExtension {
}
$title = $config->get_string('title');
$base_href = make_http($config->get_string('base_href'));
$base_href = make_http(get_base_href());
$version = $config->get_string('version');
$xml = <<<EOD
<?xml version="1.0" encoding="utf-8" ?>

View File

@@ -66,7 +66,7 @@ class RSS_Images extends SimpleExtension {
}
$title = $config->get_string('title');
$base_href = make_http($config->get_string('base_href'));
$base_href = make_http(get_base_href());
$search = "";
if(count($search_terms) > 0) {
$search = url_escape(implode(" ", $search_terms)) . "/";

View File

@@ -9,7 +9,7 @@ class taggerTheme extends Themelet {
public function build_tagger (Page $page, $event) {
global $config;
// Initialization code
$base_href = $config->get_string('base_href');
$base_href = get_base_href();
// TODO: AJAX test and fallback.
$page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null,