commit
6da4da8060
35 changed files with 81 additions and 77 deletions
|
@ -137,7 +137,7 @@ class AdminPage extends Extension {
|
||||||
$database->Execute("DELETE FROM tags WHERE count=0");
|
$database->Execute("DELETE FROM tags WHERE count=0");
|
||||||
}
|
}
|
||||||
|
|
||||||
private function dbdump($page) {
|
private function dbdump(Page $page) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", DATABASE_DSN, $matches);
|
preg_match("#(\w+)://(\w+):(\w+)@([\w\.\-]+)/([\w_]+)(\?.*)?#", DATABASE_DSN, $matches);
|
||||||
$software = $matches[1];
|
$software = $matches[1];
|
||||||
|
@ -146,6 +146,7 @@ class AdminPage extends Extension {
|
||||||
$hostname = $matches[4];
|
$hostname = $matches[4];
|
||||||
$database = $matches[5];
|
$database = $matches[5];
|
||||||
|
|
||||||
|
// TODO: Support more than just MySQL..
|
||||||
switch($software) {
|
switch($software) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$cmd = "mysqldump -h$hostname -u$username -p$password $database";
|
$cmd = "mysqldump -h$hostname -u$username -p$password $database";
|
||||||
|
@ -222,7 +223,7 @@ class AdminPage extends Extension {
|
||||||
$database->execute("ALTER TABLE images AUTO_INCREMENT=".$count);
|
$database->execute("ALTER TABLE images AUTO_INCREMENT=".$count);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function imgdump($page) {
|
private function imgdump(Page $page) {
|
||||||
global $database;
|
global $database;
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$images = $database->get_all("SELECT * FROM images");
|
$images = $database->get_all("SELECT * FROM images");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class ArtistsTheme extends Themelet {
|
class ArtistsTheme extends Themelet {
|
||||||
|
|
||||||
public function get_author_editor_html($author) {
|
public function get_author_editor_html(/*string*/ $author) {
|
||||||
$h_author = html_escape($author);
|
$h_author = html_escape($author);
|
||||||
return "<tr><td>Author</td><td><input class='editor_author' type='text' name='tag_edit__author' value='$h_author'></td></tr>";
|
return "<tr><td>Author</td><td><input class='editor_author' type='text' name='tag_edit__author' value='$h_author'></td></tr>";
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class ArtistsTheme extends Themelet {
|
||||||
//$this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages);
|
//$this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sidebar_options($mode, $artistID=NULL, $is_admin=FALSE){
|
public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){
|
||||||
global $page;
|
global $page;
|
||||||
|
|
||||||
if($mode == "neutral"){
|
if($mode == "neutral"){
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: Generic Blocks
|
* Name: Generic Blocks
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Add HTML to some space
|
* Description: Add HTML to some space
|
||||||
* Documentation:
|
* Documentation:
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* Name: Bookmarks
|
* Name: Bookmarks
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Allow users to bookmark searches
|
* Description: Allow users to bookmark searches
|
||||||
*/
|
*/
|
||||||
|
@ -59,7 +60,7 @@ class Bookmarks extends Extension {
|
||||||
else {return array();}
|
else {return array();}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_bookmark($url, $title) {
|
private function add_bookmark(/*string*/ $url, /*string*/ $title) {
|
||||||
global $database;
|
global $database;
|
||||||
$sql = "INSERT INTO bookmark(owner_id, url, title) VALUES (?, ?, ?)";
|
$sql = "INSERT INTO bookmark(owner_id, url, title) VALUES (?, ?, ?)";
|
||||||
$database->Execute($sql, array($user->id, $url, $title));
|
$database->Execute($sql, array($user->id, $url, $title));
|
||||||
|
|
|
@ -53,7 +53,7 @@ class BulkAdd extends Extension {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_dir($base, $subdir="") {
|
private function add_dir(/*string*/ $base, $subdir="") {
|
||||||
global $page;
|
global $page;
|
||||||
|
|
||||||
if(!is_dir($base)) {
|
if(!is_dir($base)) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: Downtime
|
* Name: Downtime
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Show a "down for maintenance" page
|
* Description: Show a "down for maintenance" page
|
||||||
* Documentation:
|
* Documentation:
|
||||||
|
@ -14,14 +15,14 @@
|
||||||
class Downtime extends Extension {
|
class Downtime extends Extension {
|
||||||
public function get_priority() {return 10;}
|
public function get_priority() {return 10;}
|
||||||
|
|
||||||
public function onSetupBuilding($event) {
|
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||||
$sb = new SetupBlock("Downtime");
|
$sb = new SetupBlock("Downtime");
|
||||||
$sb->add_bool_option("downtime", "Disable non-admin access: ");
|
$sb->add_bool_option("downtime", "Disable non-admin access: ");
|
||||||
$sb->add_longtext_option("downtime_message", "<br>");
|
$sb->add_longtext_option("downtime_message", "<br>");
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onPageRequest($event) {
|
public function onPageRequest(PageRequestEvent $event) {
|
||||||
global $config, $page, $user;
|
global $config, $page, $user;
|
||||||
|
|
||||||
if($config->get_bool("downtime")) {
|
if($config->get_bool("downtime")) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class DowntimeTheme extends Themelet {
|
||||||
/**
|
/**
|
||||||
* Display $message and exit
|
* Display $message and exit
|
||||||
*/
|
*/
|
||||||
public function display_message($message) {
|
public function display_message(/*string*/ $message) {
|
||||||
global $config, $user;
|
global $config, $user;
|
||||||
$theme_name = $config->get_string('theme');
|
$theme_name = $config->get_string('theme');
|
||||||
$data_href = get_base_href();
|
$data_href = get_base_href();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: Emoticon Filter
|
* Name: Emoticon Filter
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Lets users use graphical smilies
|
* Description: Lets users use graphical smilies
|
||||||
* Documentation:
|
* Documentation:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class EmoticonListTheme extends Themelet {
|
class EmoticonListTheme extends Themelet {
|
||||||
public function display_emotes($list) {
|
public function display_emotes(/*array*/ $list) {
|
||||||
global $page;
|
global $page;
|
||||||
$data_href = get_base_href();
|
$data_href = get_base_href();
|
||||||
$html = "<html><head><title>Emoticon list</title></head><body>";
|
$html = "<html><head><title>Emoticon list</title></head><body>";
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Favorites extends Extension {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add_vote($image_id, $user_id, $do_set) {
|
private function add_vote(/*int*/ $image_id, /*int*/ $user_id, /*bool*/ $do_set) {
|
||||||
global $database;
|
global $database;
|
||||||
if ($do_set) {
|
if ($do_set) {
|
||||||
$database->Execute(
|
$database->Execute(
|
||||||
|
|
|
@ -8,7 +8,7 @@ class FeaturedTheme extends Themelet {
|
||||||
$page->add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3));
|
$page->add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_buttons_html($image_id) {
|
public function get_buttons_html(/*int*/ $image_id) {
|
||||||
global $user;
|
global $user;
|
||||||
return "
|
return "
|
||||||
".make_form(make_link("featured_image/set"))."
|
".make_form(make_link("featured_image/set"))."
|
||||||
|
|
|
@ -173,7 +173,7 @@ class Forum extends Extension {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_total_pages_for_thread($threadID)
|
private function get_total_pages_for_thread(/*int*/ $threadID)
|
||||||
{
|
{
|
||||||
global $database, $config;
|
global $database, $config;
|
||||||
$result = $database->get_row("SELECT COUNT(1) AS count FROM forum_posts WHERE thread_id = ?", array($threadID));
|
$result = $database->get_row("SELECT COUNT(1) AS count FROM forum_posts WHERE thread_id = ?", array($threadID));
|
||||||
|
|
|
@ -16,7 +16,7 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||||
return in_array(strtolower($ext), $exts);
|
return in_array(strtolower($ext), $exts);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_image_from_data($filename, $metadata) {
|
protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
|
@ -44,7 +44,7 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function check_contents($file) {
|
protected function check_contents(/*string*/ $file) {
|
||||||
if(!file_exists($file)) return false;
|
if(!file_exists($file)) return false;
|
||||||
|
|
||||||
$fp = fopen($file, "r");
|
$fp = fopen($file, "r");
|
||||||
|
@ -55,7 +55,7 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function str_to_binarray($string) {
|
private function str_to_binarray(/*string*/ $string) {
|
||||||
$binary = array();
|
$binary = array();
|
||||||
$length = strlen($string);
|
$length = strlen($string);
|
||||||
for($j=0; $j<$length; $j++) {
|
for($j=0; $j<$length; $j++) {
|
||||||
|
@ -76,7 +76,7 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||||
return $int;
|
return $int;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function swf_get_bounds($filename) {
|
private function swf_get_bounds(/*string*/ $filename) {
|
||||||
$fp = fopen($filename, "r");
|
$fp = fopen($filename, "r");
|
||||||
$head = fread($fp, 3);
|
$head = fread($fp, 3);
|
||||||
$version = fread($fp, 1);
|
$version = fread($fp, 1);
|
||||||
|
|
|
@ -25,7 +25,7 @@ EOD
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text) {
|
public function build_body(/*string*/ $sitename, /*string*/ $main_links, /*string*/ $main_text, /*string*/ $contact_link, $num_comma, /*string*/ $counter_text) {
|
||||||
$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>";
|
$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>";
|
||||||
$message_html = empty($main_text) ? "" : "<div class='space' id='message'>$main_text</div>";
|
$message_html = empty($main_text) ? "" : "<div class='space' id='message'>$main_text</div>";
|
||||||
$counter_html = empty($counter_text) ? "" : "<div class='space' id='counter'>$counter_text</div>";
|
$counter_html = empty($counter_text) ? "" : "<div class='space' id='counter'>$counter_text</div>";
|
||||||
|
|
|
@ -21,7 +21,7 @@ class LinkImage extends Extension {
|
||||||
$config->set_default_string("ext_link-img_text-link_format", '$title - $id ($ext $size $filesize)');
|
$config->set_default_string("ext_link-img_text-link_format", '$title - $id ($ext $size $filesize)');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function hostify($str) {
|
private function hostify(/*string*/ $str) {
|
||||||
$str = str_replace(" ", "%20", $str);
|
$str = str_replace(" ", "%20", $str);
|
||||||
if(strpos($str, "ttp://") > 0) {
|
if(strpos($str, "ttp://") > 0) {
|
||||||
return $str;
|
return $str;
|
||||||
|
|
|
@ -51,7 +51,7 @@ class LinkImageTheme extends Themelet {
|
||||||
50));
|
50));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function url ($url,$content,$type) {
|
protected function url (/*string*/ $url, /*string*/ $content, /*string*/ $type) {
|
||||||
if ($content == NULL) {$content=$url;}
|
if ($content == NULL) {$content=$url;}
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
@ -67,7 +67,7 @@ class LinkImageTheme extends Themelet {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function img ($src,$type) {
|
protected function img (/*string*/ $src, /*string*/ $type) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case "html":
|
case "html":
|
||||||
$text = "<img src=\"$src\" />";
|
$text = "<img src=\"$src\" />";
|
||||||
|
@ -81,7 +81,7 @@ class LinkImageTheme extends Themelet {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function link_code($label,$content,$id=NULL) {
|
protected function link_code(/*string*/ $label, /*string*/ $content, $id=NULL) {
|
||||||
return "
|
return "
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for='".$id."' title='Click to select the textbox'>$label</label></td>
|
<td><label for='".$id."' title='Click to select the textbox'>$label</label></td>
|
||||||
|
|
|
@ -31,7 +31,7 @@ class MassTagger extends Extension {
|
||||||
if($event->get_arg(0) == "tag") $this->_apply_mass_tags( $config, $page, $user, $event );
|
if($event->get_arg(0) == "tag") $this->_apply_mass_tags( $config, $page, $user, $event );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _apply_mass_tags( $config, $page, $user, $event ) {
|
private function _apply_mass_tags( $config, Page $page, $user, $event ) {
|
||||||
if( !isset($_POST['ids']) or !isset($_POST['tag']) ) return;
|
if( !isset($_POST['ids']) or !isset($_POST['tag']) ) return;
|
||||||
|
|
||||||
$tag = $_POST['tag'];
|
$tag = $_POST['tag'];
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Ratings extends Extension {
|
||||||
return $sqes;
|
return $sqes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function privs_to_sql($sqes) {
|
public static function privs_to_sql(/*string*/ $sqes) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$length = strlen($sqes);
|
$length = strlen($sqes);
|
||||||
for($i=0; $i<$length; $i++) {
|
for($i=0; $i<$length; $i++) {
|
||||||
|
@ -177,7 +177,7 @@ class Ratings extends Extension {
|
||||||
return $set;
|
return $set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rating_to_human($rating) {
|
public static function rating_to_human(/*string*/ $rating) {
|
||||||
switch($rating) {
|
switch($rating) {
|
||||||
case "s": return "Safe";
|
case "s": return "Safe";
|
||||||
case "q": return "Questionable";
|
case "q": return "Questionable";
|
||||||
|
@ -225,7 +225,7 @@ class Ratings extends Extension {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_rating($image_id, $rating, $old_rating) {
|
private function set_rating(/*int*/ $image_id, /*string*/ $rating, /*string*/ $old_rating) {
|
||||||
global $database;
|
global $database;
|
||||||
if($old_rating != $rating){
|
if($old_rating != $rating){
|
||||||
$database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id));
|
$database->Execute("UPDATE images SET rating=? WHERE id=?", array($rating, $image_id));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class RatingsTheme extends Themelet {
|
class RatingsTheme extends Themelet {
|
||||||
public function get_rater_html($image_id, $rating) {
|
public function get_rater_html(/*int*/ $image_id, /*string*/ $rating) {
|
||||||
$i_image_id = int_escape($image_id);
|
$i_image_id = int_escape($image_id);
|
||||||
$s_checked = $rating == 's' ? " checked" : "";
|
$s_checked = $rating == 's' ? " checked" : "";
|
||||||
$q_checked = $rating == 'q' ? " checked" : "";
|
$q_checked = $rating == 'q' ? " checked" : "";
|
||||||
|
@ -50,7 +50,7 @@ class RatingsTheme extends Themelet {
|
||||||
$page->add_block(new Block("Bulk Rating", $html));
|
$page->add_block(new Block("Bulk Rating", $html));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rating_to_name($rating) {
|
public function rating_to_name(/*string*/ $rating) {
|
||||||
switch($rating) {
|
switch($rating) {
|
||||||
case 's': return "Safe";
|
case 's': return "Safe";
|
||||||
case 'q': return "Questionable";
|
case 'q': return "Questionable";
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: Resolution Limiter
|
* Name: Resolution Limiter
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Allows the admin to set min / max image dimentions
|
* Description: Allows the admin to set min / max image dimentions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -143,16 +143,14 @@ class ResizeImage extends Extension {
|
||||||
|
|
||||||
|
|
||||||
// Private functions
|
// Private functions
|
||||||
|
/* ----------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function could be made much smaller by using the ImageReplaceEvent
|
This function could be made much smaller by using the ImageReplaceEvent
|
||||||
ie: Pretend that we are replacing the image with a resized copy.
|
ie: Pretend that we are replacing the image with a resized copy.
|
||||||
*/
|
*/
|
||||||
private function resize_image($image_id, $width, $height) {
|
private function resize_image(/*int*/ $image_id, /*int*/ $width, /*int*/ $height) {
|
||||||
global $config;
|
global $config, $user, $page, $database;
|
||||||
global $user;
|
|
||||||
global $page;
|
|
||||||
global $database;
|
|
||||||
|
|
||||||
if ( ($height <= 0) && ($width <= 0) ) {
|
if ( ($height <= 0) && ($width <= 0) ) {
|
||||||
throw new ImageResizeException("Invalid options for height and width. ($width x $height)");
|
throw new ImageResizeException("Invalid options for height and width. ($width x $height)");
|
||||||
|
|
|
@ -4,9 +4,8 @@ class ResizeImageTheme extends Themelet {
|
||||||
/*
|
/*
|
||||||
* Display a link to resize an image
|
* Display a link to resize an image
|
||||||
*/
|
*/
|
||||||
public function get_resize_html($image_id) {
|
public function get_resize_html(/*int*/ $image_id) {
|
||||||
global $user;
|
global $user, $config;
|
||||||
global $config;
|
|
||||||
|
|
||||||
$i_image_id = int_escape($image_id);
|
$i_image_id = int_escape($image_id);
|
||||||
|
|
||||||
|
@ -20,14 +19,14 @@ class ResizeImageTheme extends Themelet {
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_resize_error(Page $page, $title, $message) {
|
public function display_resize_error(Page $page, /*string*/ $title, /*string*/ $message) {
|
||||||
$page->set_title("Resize Image");
|
$page->set_title("Resize Image");
|
||||||
$page->set_heading("Resize Image");
|
$page->set_heading("Resize Image");
|
||||||
$page->add_block(new NavBlock());
|
$page->add_block(new NavBlock());
|
||||||
$page->add_block(new Block($title, $message));
|
$page->add_block(new Block($title, $message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_resize_page(Page $page, $image_id) {
|
public function display_resize_page(Page $page, /*int*/ $image_id) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$default_width = $config->get_int('resize_default_width');
|
$default_width = $config->get_int('resize_default_width');
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: RSS for Comments
|
* Name: RSS for Comments
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Self explanatory
|
* Description: Self explanatory
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: RSS for Images
|
* Name: RSS for Images
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Self explanatory
|
* Description: Self explanatory
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +34,7 @@ class RSS_Images extends Extension {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function do_rss($images, $search_terms, $page_number) {
|
private function do_rss($images, $search_terms, /*int*/ $page_number) {
|
||||||
global $page;
|
global $page;
|
||||||
global $config;
|
global $config;
|
||||||
$page->set_mode("data");
|
$page->set_mode("data");
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: SimpleTest integration
|
* Name: SimpleTest integration
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: adds unit testing to SCore
|
* Description: adds unit testing to SCore
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
class Tag_HistoryTheme extends Themelet {
|
class Tag_HistoryTheme extends Themelet {
|
||||||
var $messages = array();
|
var $messages = array();
|
||||||
|
|
||||||
public function display_history_page(Page $page, $image_id, $history) {
|
public function display_history_page(Page $page, /*int*/ $image_id, /*array*/ $history) {
|
||||||
global $user;
|
global $user;
|
||||||
$start_string = "
|
$start_string = "
|
||||||
<div style='text-align: left'>
|
<div style='text-align: left'>
|
||||||
|
@ -50,7 +50,7 @@ class Tag_HistoryTheme extends Themelet {
|
||||||
$page->add_block(new Block("Tag History", $history_html, "main", 10));
|
$page->add_block(new Block("Tag History", $history_html, "main", 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_global_page(Page $page, $history) {
|
public function display_global_page(Page $page, /*array*/ $history) {
|
||||||
$start_string = "
|
$start_string = "
|
||||||
<div style='text-align: left'>
|
<div style='text-align: left'>
|
||||||
".make_form(make_link("tag_history/revert"))."
|
".make_form(make_link("tag_history/revert"))."
|
||||||
|
@ -91,7 +91,7 @@ class Tag_HistoryTheme extends Themelet {
|
||||||
$page->add_block(new Block("Tag History", $history_html, "main", 10));
|
$page->add_block(new Block("Tag History", $history_html, "main", 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_history_link(Page $page, $image_id) {
|
public function display_history_link(Page $page, /*int*/ $image_id) {
|
||||||
$link = '<a href="'.make_link('tag_history/'.$image_id).'">Tag History</a>';
|
$link = '<a href="'.make_link('tag_history/'.$image_id).'">Tag History</a>';
|
||||||
$page->add_block(new Block(null, $link, "main", 5));
|
$page->add_block(new Block(null, $link, "main", 5));
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class Tag_HistoryTheme extends Themelet {
|
||||||
/*
|
/*
|
||||||
* Add a section to the admin page.
|
* Add a section to the admin page.
|
||||||
*/
|
*/
|
||||||
public function display_admin_block($validation_msg='') {
|
public function display_admin_block(/*string*/ $validation_msg='') {
|
||||||
global $page;
|
global $page;
|
||||||
|
|
||||||
if (!empty($validation_msg)) {
|
if (!empty($validation_msg)) {
|
||||||
|
@ -130,7 +130,7 @@ class Tag_HistoryTheme extends Themelet {
|
||||||
$page->add_block(new Block("Revert by IP", $html));
|
$page->add_block(new Block("Revert by IP", $html));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_status($title, $body) {
|
public function add_status(/*string*/ $title, /*string*/ $body) {
|
||||||
$this->messages[] = '<p><b>'. $title .'</b><br>'. $body .'</p>';
|
$this->messages[] = '<p><b>'. $title .'</b><br>'. $body .'</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: Tweet!
|
* Name: Tweet!
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Show a twitter feed with the Sea of Clouds script
|
* Description: Show a twitter feed with the Sea of Clouds script
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,7 +4,7 @@ class TwitterSocTheme extends Themelet {
|
||||||
/*
|
/*
|
||||||
* Show $text on the $page
|
* Show $text on the $page
|
||||||
*/
|
*/
|
||||||
public function display_feed(Page $page, $username) {
|
public function display_feed(Page $page, /*string*/ $username) {
|
||||||
$page->add_block(new Block("Tweets", '
|
$page->add_block(new Block("Tweets", '
|
||||||
<div class="tweet_soc"></div>
|
<div class="tweet_soc"></div>
|
||||||
<p><a href="http://twitter.com/'.url_escape($username).'">Follow us on Twitter</a>
|
<p><a href="http://twitter.com/'.url_escape($username).'">Follow us on Twitter</a>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: Word Filter
|
* Name: Word Filter
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* License: GPLv2
|
* License: GPLv2
|
||||||
* Description: Simple search and replace
|
* Description: Simple search and replace
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +23,7 @@ class WordFilter extends Extension {
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function filter($text) {
|
private function filter(/*string*/ $text) {
|
||||||
$map = $this->get_map();
|
$map = $this->get_map();
|
||||||
foreach($map as $search => $replace) {
|
foreach($map as $search => $replace) {
|
||||||
$search = trim($search);
|
$search = trim($search);
|
||||||
|
|
|
@ -671,16 +671,16 @@ define("SCORE_LOG_NOTSET", 0);
|
||||||
/**
|
/**
|
||||||
* A shorthand way to send a LogEvent
|
* A shorthand way to send a LogEvent
|
||||||
*/
|
*/
|
||||||
function log_msg($section, $priority, $message) {
|
function log_msg(/*string*/ $section, /*int*/ $priority, /*string*/ $message) {
|
||||||
send_event(new LogEvent($section, $priority, $message));
|
send_event(new LogEvent($section, $priority, $message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// More shorthand ways of logging
|
// More shorthand ways of logging
|
||||||
function log_debug($section, $message) {log_msg($section, SCORE_LOG_DEBUG, $message);}
|
function log_debug(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_DEBUG, $message);}
|
||||||
function log_info($section, $message) {log_msg($section, SCORE_LOG_INFO, $message);}
|
function log_info(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_INFO, $message);}
|
||||||
function log_warning($section, $message) {log_msg($section, SCORE_LOG_WARNING, $message);}
|
function log_warning(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_WARNING, $message);}
|
||||||
function log_error($section, $message) {log_msg($section, SCORE_LOG_ERROR, $message);}
|
function log_error(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_ERROR, $message);}
|
||||||
function log_critical($section, $message) {log_msg($section, SCORE_LOG_CRITICAL, $message);}
|
function log_critical(/*string*/ $section, /*string*/ $message) {log_msg($section, SCORE_LOG_CRITICAL, $message);}
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ExtManagerTheme extends Themelet {
|
class ExtManagerTheme extends Themelet {
|
||||||
public function display_table(Page $page, $extensions, $editable) {
|
public function display_table(Page $page, /*array*/ $extensions, /*bool*/ $editable) {
|
||||||
global $user;
|
global $user;
|
||||||
$en = $editable ? "<th>Enabled</th>" : "";
|
$en = $editable ? "<th>Enabled</th>" : "";
|
||||||
$html = "
|
$html = "
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* Name: Handle Pixel
|
* Name: Handle Pixel
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* Description: Handle JPEG, PNG, GIF, etc files
|
* Description: Handle JPEG, PNG, GIF, etc files
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
return in_array(strtolower($ext), $exts);
|
return in_array(strtolower($ext), $exts);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_image_from_data($filename, $metadata) {
|
protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
|
@ -38,7 +39,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function check_contents($file) {
|
protected function check_contents(/*string*/ $file) {
|
||||||
$valid = Array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG);
|
$valid = Array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG);
|
||||||
if(!file_exists($file)) return false;
|
if(!file_exists($file)) return false;
|
||||||
$info = getimagesize($file);
|
$info = getimagesize($file);
|
||||||
|
@ -47,7 +48,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_thumb($hash) {
|
protected function create_thumb(/*string*/ $hash) {
|
||||||
$outname = warehouse_path("thumbs", $hash);
|
$outname = warehouse_path("thumbs", $hash);
|
||||||
if(file_exists($outname)) {
|
if(file_exists($outname)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -55,7 +56,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
return $this->create_thumb_force($hash);
|
return $this->create_thumb_force($hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_thumb_force($hash) {
|
protected function create_thumb_force(/*string*/ $hash) {
|
||||||
$inname = warehouse_path("images", $hash);
|
$inname = warehouse_path("images", $hash);
|
||||||
$outname = warehouse_path("thumbs", $hash);
|
$outname = warehouse_path("thumbs", $hash);
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -76,7 +77,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IM thumber {{{
|
// IM thumber {{{
|
||||||
private function make_thumb_convert($inname, $outname) {
|
private function make_thumb_convert(/*string*/ $inname, /*string*/ $outname) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$w = $config->get_int("thumb_width");
|
$w = $config->get_int("thumb_width");
|
||||||
|
@ -113,7 +114,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
// epeg thumber {{{
|
// epeg thumber {{{
|
||||||
private function make_thumb_epeg($inname, $outname) {
|
private function make_thumb_epeg(/*string*/ $inname, /*string*/ $outname) {
|
||||||
global $config;
|
global $config;
|
||||||
$w = $config->get_int("thumb_width");
|
$w = $config->get_int("thumb_width");
|
||||||
exec("epeg $inname -c 'Created by EPEG' --max $w $outname");
|
exec("epeg $inname -c 'Created by EPEG' --max $w $outname");
|
||||||
|
@ -121,7 +122,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
// GD thumber {{{
|
// GD thumber {{{
|
||||||
private function make_thumb_gd($inname, $outname) {
|
private function make_thumb_gd(/*string*/ $inname, /*string*/ $outname) {
|
||||||
global $config;
|
global $config;
|
||||||
$thumb = $this->get_thumb($inname);
|
$thumb = $this->get_thumb($inname);
|
||||||
$ok = imagejpeg($thumb, $outname, $config->get_int('thumb_quality'));
|
$ok = imagejpeg($thumb, $outname, $config->get_int('thumb_quality'));
|
||||||
|
@ -129,7 +130,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
return $ok;
|
return $ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_thumb($tmpname) {
|
private function get_thumb(/*string*/ $tmpname) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$info = getimagesize($tmpname);
|
$info = getimagesize($tmpname);
|
||||||
|
@ -165,7 +166,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function read_file($fname) {
|
private function read_file(/*string*/ $fname) {
|
||||||
$fp = fopen($fname, "r");
|
$fp = fopen($fname, "r");
|
||||||
if(!$fp) return false;
|
if(!$fp) return false;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* Name: Image Manager
|
* Name: Image Manager
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
* Modified by: jgen <jgen.tech@gmail.com>
|
* Modified by: jgen <jgen.tech@gmail.com>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* Description: Handle the image database
|
* Description: Handle the image database
|
||||||
* Visibility: admin
|
* Visibility: admin
|
||||||
*/
|
*/
|
||||||
|
@ -280,10 +281,7 @@ class ImageIO extends Extension {
|
||||||
|
|
||||||
// add image {{{
|
// add image {{{
|
||||||
private function add_image($image) {
|
private function add_image($image) {
|
||||||
global $page;
|
global $page, $user, $database, $config;
|
||||||
global $user;
|
|
||||||
global $database;
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate things
|
* Validate things
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Name: Uploader
|
* Name: Uploader
|
||||||
* Author: Shish
|
* Author: Shish <webmaster@shishnet.org>
|
||||||
|
* Link: http://code.shishnet.org/shimmie2/
|
||||||
* Description: Allows people to upload files to the website
|
* Description: Allows people to upload files to the website
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ class DataUploadEvent extends Event {
|
||||||
* @param $tmpname The temporary file used for upload.
|
* @param $tmpname The temporary file used for upload.
|
||||||
* @param $metadata Info about the file, should contain at least "filename", "extension", "tags" and "source".
|
* @param $metadata Info about the file, should contain at least "filename", "extension", "tags" and "source".
|
||||||
*/
|
*/
|
||||||
public function DataUploadEvent(User $user, $tmpname, $metadata) {
|
public function DataUploadEvent(User $user, /*string*/ $tmpname, /*array*/ $metadata) {
|
||||||
assert(file_exists($tmpname));
|
assert(file_exists($tmpname));
|
||||||
|
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
@ -272,9 +273,7 @@ class Upload extends Extension {
|
||||||
* @retval bool TRUE on upload successful.
|
* @retval bool TRUE on upload successful.
|
||||||
*/
|
*/
|
||||||
private function try_upload($file, $tags, $source, $replace='') {
|
private function try_upload($file, $tags, $source, $replace='') {
|
||||||
global $page;
|
global $page, $config, $user;
|
||||||
global $config;
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
if(empty($source)) $source = null;
|
if(empty($source)) $source = null;
|
||||||
|
|
||||||
|
@ -322,9 +321,7 @@ class Upload extends Extension {
|
||||||
* @retval bool TRUE on transload successful.
|
* @retval bool TRUE on transload successful.
|
||||||
*/
|
*/
|
||||||
private function try_transload($url, $tags, $source, $replace='') {
|
private function try_transload($url, $tags, $source, $replace='') {
|
||||||
global $page;
|
global $page, $config, $user;
|
||||||
global $config;
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
$ok = true;
|
$ok = true;
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ class UploadTheme extends Themelet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only allows 1 file to be uploaded - for replacing another image file */
|
/* only allows 1 file to be uploaded - for replacing another image file */
|
||||||
public function display_replace_page(Page $page, $image_id) {
|
public function display_replace_page(Page $page, /*int*/ $image_id) {
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
$page->add_html_header("<link rel='stylesheet' href='".get_base_href()."/ext/upload/_style.css' type='text/css'>");
|
$page->add_html_header("<link rel='stylesheet' href='".get_base_href()."/ext/upload/_style.css' type='text/css'>");
|
||||||
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
|
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
|
||||||
|
@ -211,7 +211,7 @@ class UploadTheme extends Themelet {
|
||||||
$page->add_block(new Block("Upload Replacement Image", $html, "main", 20));
|
$page->add_block(new Block("Upload Replacement Image", $html, "main", 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_upload_status(Page $page, $ok) {
|
public function display_upload_status(Page $page, /*bool*/ $ok) {
|
||||||
if($ok) {
|
if($ok) {
|
||||||
$page->set_mode("redirect");
|
$page->set_mode("redirect");
|
||||||
$page->set_redirect(make_link());
|
$page->set_redirect(make_link());
|
||||||
|
@ -223,7 +223,7 @@ class UploadTheme extends Themelet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_upload_error(Page $page, $title, $message) {
|
public function display_upload_error(Page $page, /*string*/ $title, /*string*/ $message) {
|
||||||
$page->add_block(new Block($title, $message));
|
$page->add_block(new Block($title, $message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue