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

This commit is contained in:
Shish 2012-06-26 20:24:58 +01:00
commit 19ca8b7b9f
7 changed files with 94 additions and 47 deletions

View File

@ -72,7 +72,7 @@ class Home extends Extension {
$main_links = '[url=site://post/list]Posts[/url] [url=site://comment/list]Comments[/url] [url=site://tags]Tags[/url]';
if(class_exists("Pools")) {$main_links .= ' [url=site://pools]Pools[/url]';}
if(class_exists("Wiki")) {$main_links .= ' [url=site://wiki]Wiki[/url]';}
$main_links .= ' [url=site://ext_doc]>>[/url]';
$main_links .= ' [url=site://ext_doc]Documentation[/url]';
}
$main_links = format_text($main_links);
$main_text = $config->get_string('home_text');

Binary file not shown.

View File

@ -10,12 +10,40 @@ class Oekaki extends Extension {
global $user, $page;
if($event->page_matches("oekaki")) {
if(!$user->can("create_image")) {
$this->theme->display_permission_denied();
}
if($user->can("create_image")) {
if($event->get_arg(0) == "create") {
$this->theme->display_page();
$this->theme->display_block();
}
if($event->get_arg(0) == "claim") {
// FIXME: move .chi to data/oekaki/$ha/$hash mirroring images and thumbs
// FIXME: .chi viewer?
// FIXME: clean out old unclaimed images?
$pattern = data_path('oekaki_unclaimed/' . $_SERVER['REMOTE_ADDR'] . ".*.png");
foreach(glob($pattern) as $tmpname) {
assert(file_exists($tmpname));
if($event->get_arg(0) == "create") {
$this->theme->display_page();
$pathinfo = pathinfo($tmpname);
if(!array_key_exists('extension', $pathinfo)) {
throw new UploadException("File has no extension");
}
log_info("oekaki", "Processing file [{$pathinfo['filename']}]");
$metadata['filename'] = 'oekaki.png';
$metadata['extension'] = $pathinfo['extension'];
$metadata['tags'] = 'oekaki tagme';
$metadata['source'] = null;
$event = new DataUploadEvent($user, $tmpname, $metadata);
send_event($event);
if($event->image_id == -1) {
throw new UploadException("File type not recognised");
}
else {
unlink($tmpname);
$page->set_mode("redirect");
$page->set_redirect(make_link("post/view/".$event->image_id));
}
}
}
}
if($event->get_arg(0) == "upload") {
// FIXME: this allows anyone to upload anything to /data ...
@ -47,43 +75,14 @@ class Oekaki extends Extension {
echo "CHIBIERROR No Data\n";
}
}
if($event->get_arg(0) == "claim") {
// FIXME: move .chi to data/oekaki/$ha/$hash mirroring images and thumbs
// FIXME: .chi viewer?
// FIXME: clean out old unclaimed images?
$pattern = data_path('oekaki_unclaimed/' . $_SERVER['REMOTE_ADDR'] . ".*.png");
foreach(glob($pattern) as $tmpname) {
assert(file_exists($tmpname));
$pathinfo = pathinfo($tmpname);
if(!array_key_exists('extension', $pathinfo)) {
throw new UploadException("File has no extension");
}
log_info("oekaki", "Processing file [{$pathinfo['filename']}]");
$metadata['filename'] = 'oekaki.png';
$metadata['extension'] = $pathinfo['extension'];
$metadata['tags'] = 'oekaki tagme';
$metadata['source'] = null;
$event = new DataUploadEvent($user, $tmpname, $metadata);
send_event($event);
if($event->image_id == -1) {
throw new UploadException("File type not recognised");
}
else {
unlink($tmpname);
$page->set_mode("redirect");
$page->set_redirect(make_link("post/view/".$event->image_id));
}
}
}
}
}
// FIXME: "edit this image" button on existing images?
function onPostListBuilding(PostListBuildingEvent $event) {
global $user, $page;
global $user;
if($user->can("create_image")) {
$this->theme->display_block($page);
$this->theme->display_block();
}
}
}

View File

@ -1,6 +1,24 @@
ChibiPaint
Original version of ChibiPaint:
Copyright (c) 2006-2008 Marc Schefer
http://www.chibipaint.com/
Some icons taken from the GNU Image Manipulation Program.
Art contributors: http://git.gnome.org/browse/gimp/tree/AUTHORS
Lapo Calamandrei
Paul Davey
Alexia Death
Aurore Derriennic
Tuomas Kuosmanen
Karl La Rocca
Andreas Nilsson
Ville Pätsi
Mike Schaeffer
Carol Spears
Jakub Steiner
William Szilveszter
This file is part of ChibiPaint.
@ -66,7 +84,7 @@
The form data name for the png file is 'picture' and 'chibifile' for the multilayer file. The recommended extension
for chibifiles is '.chi'
The applet expects the server to answer with the single line reply "CHIBIOK" followed by a newline character.
"CHIBIERROR" followed by an error message on the same list is the planned way to report an error but currently the

View File

@ -1,4 +1,8 @@
<?php
// FIXME: Move all the stuff that handles size input to main.php
// FIXME: Move default canvas size to config file; changeable in board config
// While we're here, add maximum and minimum image sizes in config
// Maybe allow the resolution limiter extension to have a say in this
class OekakiTheme extends Themelet {
public function display_page() {
@ -7,29 +11,55 @@ class OekakiTheme extends Themelet {
$base_href = get_base_href();
$http_base = make_http($base_href);
$oekW = $config->get_int("oekaki_width", 400);
$oekH = $config->get_int("oekaki_height", 400);
if(isset($_POST['oekW']) && isset($_POST['oekH'])) {
$oekW = int_escape($_POST['oekW']);
$oekH = int_escape($_POST['oekH']);
}
$html = "
<applet archive='$base_href/ext/oekaki/chibipaint.jar' code='chibipaint.ChibiPaint.class' width='800' height='600'>
<param name='canvasWidth' value='400' />
<param name='canvasHeight' value='300' />
<param name='canvasWidth' value='".$oekW."' />
<param name='canvasHeight' value='".$oekH."' />
<param name='postUrl' value='".make_http(make_link("oekaki/upload"))."' />
<param name='exitUrl' value='".make_http(make_link("oekaki/claim"))."' />
<param name='exitUrlTarget' value='_self' />
JAVA NOT SUPPORTED! <!-- alternative content for users who don't have Java installed -->
JAVA NOT INSTALLED :(<!-- alternative content for users who don't have Java installed -->
</applet>
";
# <param name='loadImage' value='http://yourserver/oekaki/pictures/168.png' />
# <param name='loadChibiFile' value='http://yourserver/oekaki/pictures/168.chi' />
// FIXME: prevent oekaki block from collapsing on click in cerctain themes. This causes canvas reset
$page->set_title("Oekaki");
$page->set_heading("Oekiaki");
$page->set_heading("Oekaki");
$page->add_block(new NavBlock());
$page->add_block(new Block("Oekaki", $html, "main", 20));
}
public function display_block() {
global $page;
$page->add_block(new Block(null, "<a href='".make_link("oekaki/create")."'>Open Oekaki</a>", "left", 21)); // upload is 20
global $config, $page;
//FIXME: input field alignment could be done more elegantly, without inline styling
//FIXME: autocomplete='off' seems to be an invalid HTML tag
$oekW = $config->get_int("oekaki_width", 400);
$oekH = $config->get_int("oekaki_height", 400);
if(isset($_POST['oekW']) && isset($_POST['oekH'])) {
$oekW = int_escape($_POST['oekW']);
$oekH = int_escape($_POST['oekH']);
}
$page->add_block(new Block("Oekaki",
"
<form form enctype='multipart/form-data' action='".make_link("oekaki/create")."' method='POST'>
<input autocomplete='off' style='width: auto;' name='oekW' type='text' size='3' value='".$oekW."'/>".
"x".
"<input autocomplete='off' style='width: auto;' name='oekH' type='text' size='3' value='".$oekH."'/>".
"<input autocomplete='off' type='submit' value='Create!' />
</form>
"
, "left", 21)); // upload is 20
}
}
?>

View File

@ -13,7 +13,7 @@
-moz-column-break-inside: avoid;
-webkit-column-break-inside: avoid;
text-align: center;
width: 100%;
width: 90%;
}
.setupblock TEXTAREA {
width: 100%;

View File

@ -313,7 +313,7 @@ class UploadTheme extends Themelet {
for($i=0; $i<$upload_count; $i++) {
if($i == 0) $style = ""; // "style='display:visible'";
else $style = "style='display:none'";
$upload_list .= "<input id='data$i' name='data$i' $style onchange=\"$('#data".($i+1)."').show()\" type='file'>\n";
$upload_list .= "<input id='data$i' name='data$i' $style onchange=\"$('#data".($i+1)."').show()\" size='16' type='file'>\n";
}
$max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size);