Merge pull request #397 from jgen/develop
Manual Merge of More Linting #391
This commit is contained in:
commit
d247713311
@ -271,11 +271,13 @@ class Database {
|
||||
|
||||
/**
|
||||
* Meta info about the database engine
|
||||
* @var DBEngine
|
||||
*/
|
||||
private $engine = null;
|
||||
|
||||
/**
|
||||
* The currently active cache engine
|
||||
* @var CacheEngine
|
||||
*/
|
||||
public $cache = null;
|
||||
|
||||
|
@ -140,9 +140,9 @@ abstract class FormatterExtension extends Extension {
|
||||
*/
|
||||
abstract class DataHandlerExtension extends Extension {
|
||||
public function onDataUpload(DataUploadEvent $event) {
|
||||
global $user;
|
||||
|
||||
if(($supported_ext = $this->supported_ext($event->type)) && ($check_contents = $this->check_contents($event->tmpname))) {
|
||||
$supported_ext = $this->supported_ext($event->type);
|
||||
$check_contents = $this->check_contents($event->tmpname);
|
||||
if($supported_ext && $check_contents) {
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||
|
||||
|
@ -122,7 +122,7 @@ class Image {
|
||||
|
||||
if(SPEED_HAX) {
|
||||
if(!$user->can("big_search") and count($tags) > 3) {
|
||||
die("Anonymous users may only search for up to 3 tags at a time"); // FIXME: throw an exception?
|
||||
throw new SCoreException("Anonymous users may only search for up to 3 tags at a time");
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ class Image {
|
||||
* images table. Yes, MySQL does suck this much.
|
||||
*/
|
||||
private static function build_accurate_search_querylet($terms) {
|
||||
global $config, $database;
|
||||
global $database;
|
||||
|
||||
$tag_querylets = array();
|
||||
$img_querylets = array();
|
||||
@ -804,7 +804,7 @@ class Image {
|
||||
* build_accurate_search_querylet() for a full explanation
|
||||
*/
|
||||
private static function build_ugly_search_querylet($terms) {
|
||||
global $config, $database;
|
||||
global $database;
|
||||
|
||||
$tag_querylets = array();
|
||||
$img_querylets = array();
|
||||
@ -910,8 +910,6 @@ class Image {
|
||||
|
||||
// more than one positive tag, or more than zero negative tags
|
||||
else {
|
||||
$s_tag_array = array_map("sql_escape", $tag_search->variables);
|
||||
|
||||
$tag_id_array = array();
|
||||
$tags_ok = true;
|
||||
foreach($tag_search->variables as $tag) {
|
||||
@ -1113,7 +1111,6 @@ function move_upload_to_archive(DataUploadEvent $event) {
|
||||
if(!@copy($event->tmpname, $target)) {
|
||||
$errors = error_get_last(); // note: requires php 5.2
|
||||
throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target): {$errors['type']} / {$errors['message']}");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ class User {
|
||||
var $name;
|
||||
var $email;
|
||||
var $join_date;
|
||||
var $passhash;
|
||||
|
||||
/* @var UserClass */
|
||||
var $class;
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
@ -385,7 +385,13 @@ function make_http(/*string*/ $link) {
|
||||
/**
|
||||
* Make a form tag with relevant auth token and stuff
|
||||
*
|
||||
* @retval string
|
||||
* @param target string
|
||||
* @param method string
|
||||
* @param multipart boolean
|
||||
* @param form_id string
|
||||
* @param onsubmit string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") {
|
||||
global $user;
|
||||
@ -451,7 +457,7 @@ function captcha_get_html() {
|
||||
}
|
||||
else {
|
||||
session_start();
|
||||
$securimg = new Securimage();
|
||||
//$securimg = new Securimage();
|
||||
$base = get_base_href();
|
||||
$captcha = "<br/><img src='$base/lib/securimage/securimage_show.php?sid=". md5(uniqid(time())) ."'>".
|
||||
"<br/>CAPTCHA: <input type='text' name='code' value='' />";
|
||||
@ -1276,6 +1282,7 @@ function _sanitise_environment() {
|
||||
}
|
||||
|
||||
function _get_themelet_files($_theme) {
|
||||
$base_themelets = array();
|
||||
if(file_exists('themes/'.$_theme.'/custompage.class.php')) $base_themelets[] = 'themes/'.$_theme.'/custompage.class.php';
|
||||
$base_themelets[] = 'themes/'.$_theme.'/layout.class.php';
|
||||
$base_themelets[] = 'themes/'.$_theme.'/themelet.class.php';
|
||||
@ -1406,7 +1413,7 @@ function _decaret($str) {
|
||||
}
|
||||
|
||||
function _get_user() {
|
||||
global $config, $database;
|
||||
global $config;
|
||||
$user = null;
|
||||
if(get_prefixed_cookie("user") && get_prefixed_cookie("session")) {
|
||||
$tmp_user = User::by_session(get_prefixed_cookie("user"), get_prefixed_cookie("session"));
|
||||
|
@ -14,9 +14,9 @@ class AdminPageTheme extends Themelet {
|
||||
|
||||
protected function button(/*string*/ $name, /*string*/ $action, /*boolean*/ $protected=false) {
|
||||
$c_protected = $protected ? " protected" : "";
|
||||
$html = make_form(make_link("admin/$action"), "POST", false, false, false, "admin$c_protected");
|
||||
$html = make_form(make_link("admin/$action"), "POST", false, null, null, "admin$c_protected");
|
||||
if($protected) {
|
||||
$html .= "<input type='submit' id='$action' value='$name' disabled='true'>";
|
||||
$html .= "<input type='submit' id='$action' value='$name' disabled='disabled'>";
|
||||
$html .= "<input type='checkbox' onclick='$(\"#$action\").attr(\"disabled\", !$(this).is(\":checked\"))'>";
|
||||
}
|
||||
else {
|
||||
|
@ -143,7 +143,7 @@ class Artists extends Extension {
|
||||
}
|
||||
public function handle_commands($event)
|
||||
{
|
||||
global $config, $page, $user;
|
||||
global $page, $user;
|
||||
|
||||
if($event->page_matches("artist"))
|
||||
{
|
||||
|
@ -14,18 +14,10 @@ class ArtistsTheme extends Themelet {
|
||||
";
|
||||
}
|
||||
|
||||
public function display_artists(){
|
||||
global $page;
|
||||
|
||||
$page->set_title("Artists");
|
||||
$page->set_heading("Artists");
|
||||
$page->add_block(new Block("Artists", $html, "main", 10));
|
||||
|
||||
//$this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages);
|
||||
}
|
||||
|
||||
public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){
|
||||
global $page;
|
||||
global $page, $user;
|
||||
|
||||
$html = "";
|
||||
|
||||
if($mode == "neutral"){
|
||||
$html = "<form method='post' action='".make_link("artist/new_artist")."'>
|
||||
@ -72,11 +64,14 @@ class ArtistsTheme extends Themelet {
|
||||
<input type='hidden' name='artist_id' value='".$artistID."'>
|
||||
</form>";
|
||||
}
|
||||
$page->add_block(new Block("Manage Artists", $html, "left", 10));
|
||||
|
||||
if($html) $page->add_block(new Block("Manage Artists", $html, "left", 10));
|
||||
}
|
||||
|
||||
public function show_artist_editor($artist, $aliases, $members, $urls)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$artistName = $artist['name'];
|
||||
$artistNotes = $artist['notes'];
|
||||
$artistID = $artist['id'];
|
||||
@ -140,7 +135,7 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function new_artist_composer()
|
||||
{
|
||||
global $page;
|
||||
global $page, $user;
|
||||
|
||||
$html = "<form action=".make_link("artist/create")." method='POST'>
|
||||
".$user->get_auth_html()."
|
||||
@ -198,7 +193,7 @@ class ArtistsTheme extends Themelet {
|
||||
$artist['name'] = str_replace("_", " ", $artist['name']);
|
||||
|
||||
$elementLink = "<a href='".make_link("artist/view/".$artist['artist_id'])."'>".str_replace("_", " ", $artist['name'])."</a>";
|
||||
$artist_link = "<a href='".make_link("artist/view/".$artist['artist_id'])."'>".str_replace("_", " ", $artist['artist_name'])."</a>";
|
||||
//$artist_link = "<a href='".make_link("artist/view/".$artist['artist_id'])."'>".str_replace("_", " ", $artist['artist_name'])."</a>";
|
||||
$user_link = "<a href='".make_link("user/".$artist['user_name'])."'>".$artist['user_name']."</a>";
|
||||
$edit_link = "<a href='".make_link($editionLinkActionArray[$artist['type']].$artist['id'])."'>Edit</a>";
|
||||
$del_link = "<a href='".make_link($deletionLinkActionArray[$artist['type']].$artist['id'])."'>Delete</a>";
|
||||
@ -234,6 +229,8 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function show_new_alias_composer($artistID)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'<form method="POST" action='.make_link("artist/alias/add").'>
|
||||
'.$user->get_auth_html().'
|
||||
@ -250,6 +247,8 @@ class ArtistsTheme extends Themelet {
|
||||
}
|
||||
public function show_new_member_composer($artistID)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
' <form method="POST" action='.make_link("artist/member/add").'>
|
||||
'.$user->get_auth_html().'
|
||||
@ -267,6 +266,8 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function show_new_url_composer($artistID)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
' <form method="POST" action='.make_link("artist/url/add").'>
|
||||
'.$user->get_auth_html().'
|
||||
@ -284,6 +285,8 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function show_alias_editor($alias)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/alias/edited/".$alias['id']).'">
|
||||
@ -301,6 +304,8 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function show_url_editor($url)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/url/edited/".$url['id']).'">
|
||||
@ -318,6 +323,8 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function show_member_editor($member)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/member/edited/".$member['id']).'">
|
||||
@ -335,7 +342,7 @@ class ArtistsTheme extends Themelet {
|
||||
|
||||
public function show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin)
|
||||
{
|
||||
global $user, $event, $page;
|
||||
global $page;
|
||||
|
||||
$artist_link = "<a href='".make_link("post/list/".$artist['name']."/1")."'>".str_replace("_", " ", $artist['name'])."</a>";
|
||||
|
||||
@ -492,7 +499,6 @@ class ArtistsTheme extends Themelet {
|
||||
$page->set_heading("Artist");
|
||||
$page->add_block(new Block("Artist", $html, "main", 10));
|
||||
|
||||
|
||||
//we show the images for the artist
|
||||
$artist_images = "";
|
||||
foreach($images as $image) {
|
||||
|
@ -133,7 +133,7 @@ class BlotterTheme extends Themelet {
|
||||
// Reset variables:
|
||||
$i_open = "";
|
||||
$i_close = "";
|
||||
$id = $entries[$i]['id'];
|
||||
//$id = $entries[$i]['id'];
|
||||
$messy_date = $entries[$i]['entry_date'];
|
||||
$clean_date = date("m/d/y", strtotime($messy_date));
|
||||
$entry_text = $entries[$i]['entry_text'];
|
||||
@ -144,8 +144,6 @@ class BlotterTheme extends Themelet {
|
||||
$entries_list .= "<li>{$i_open}{$clean_date} - {$entry_text}{$i_close}</li>";
|
||||
}
|
||||
|
||||
$out_text = "";
|
||||
$in_text = "";
|
||||
$pos_break = "";
|
||||
$pos_align = "text-align: right; position: absolute; right: 0px;";
|
||||
|
||||
|
@ -53,6 +53,7 @@ class BulkAdd extends Extension {
|
||||
if(!array_key_exists('extension', $pathinfo)) {
|
||||
throw new UploadException("File has no extension");
|
||||
}
|
||||
$metadata = array();
|
||||
$metadata['filename'] = $pathinfo['basename'];
|
||||
$metadata['extension'] = $pathinfo['extension'];
|
||||
$metadata['tags'] = $tags;
|
||||
@ -65,8 +66,6 @@ class BulkAdd extends Extension {
|
||||
}
|
||||
|
||||
private function add_dir(/*string*/ $base, $subdir="") {
|
||||
global $page;
|
||||
|
||||
if(!is_dir($base)) {
|
||||
$this->theme->add_status("Error", "$base is not a directory");
|
||||
return;
|
||||
|
@ -62,6 +62,7 @@ class BulkAddCSV extends Extension {
|
||||
if(!array_key_exists('extension', $pathinfo)) {
|
||||
throw new UploadException("File has no extension");
|
||||
}
|
||||
$metadata = array();
|
||||
$metadata['filename'] = $pathinfo['basename'];
|
||||
$metadata['extension'] = $pathinfo['extension'];
|
||||
$metadata['tags'] = $tags;
|
||||
@ -82,8 +83,6 @@ class BulkAddCSV extends Extension {
|
||||
}
|
||||
|
||||
private function add_csv(/*string*/ $csvfile) {
|
||||
global $page;
|
||||
|
||||
if(!file_exists($csvfile)) {
|
||||
$this->theme->add_status("Error", "$csvfile not found");
|
||||
return;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
class BulkRemove extends Extension {
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $page, $user;
|
||||
global $user;
|
||||
if($event->page_matches("bulk_remove") && $user->is_admin() && $user->check_auth_token()) {
|
||||
if ($event->get_arg(0) == "confirm") $this->do_bulk_remove();
|
||||
else $this->show_confirm();
|
||||
@ -20,7 +20,7 @@ class BulkRemove extends Extension {
|
||||
}
|
||||
|
||||
public function onAdminBuilding(AdminBuildingEvent $event) {
|
||||
global $page, $user;
|
||||
global $page;
|
||||
$html = "<b>Be extremely careful when using this!</b><br>
|
||||
Once an image is removed there is no way to recover it so it is recommended that
|
||||
you first take when removing a large amount of images.<br>
|
||||
@ -83,10 +83,10 @@ class BulkRemove extends Extension {
|
||||
|
||||
|
||||
// if no images were found with the given info
|
||||
if (count($images_for_removal) == 0 && $html == "")
|
||||
if (count($images_for_removal) == 0)
|
||||
$error = "No images selected for removal";
|
||||
|
||||
var_dump($tags_arr);
|
||||
//var_dump($tags_arr);
|
||||
return array(
|
||||
"error" => $error,
|
||||
"images_for_removal" => $images_for_removal);
|
||||
@ -119,6 +119,7 @@ class BulkRemove extends Extension {
|
||||
|
||||
private function do_bulk_remove()
|
||||
{
|
||||
global $page;
|
||||
// display error if user didn't go through admin board
|
||||
if (!isset($_POST["bulk_remove_images"])) {
|
||||
$page->add_block(new Block("Bulk Remove Error",
|
||||
|
@ -13,7 +13,7 @@ class Chatbox extends Extension {
|
||||
global $page, $user;
|
||||
|
||||
// Adds header to enable chatbox
|
||||
$root = make_http();
|
||||
$root = get_base_href();
|
||||
$yPath = "$root/ext/chatbox/";
|
||||
$page->add_html_header("
|
||||
<script src=\"$root/ext/chatbox/js/jquery.js\" type=\"text/javascript\"></script>
|
||||
|
@ -244,7 +244,7 @@ class CommentListTheme extends Themelet {
|
||||
|
||||
$hb = ($comment->owner_class == "hellbanned" ? "hb" : "");
|
||||
if($trim) {
|
||||
return "
|
||||
$html = "
|
||||
<div class=\"comment $hb\">
|
||||
$h_userlink: $h_comment
|
||||
<a href=\"".make_link("post/view/$i_image_id#c$i_comment_id")."\">>>></a>
|
||||
@ -263,7 +263,7 @@ class CommentListTheme extends Themelet {
|
||||
$h_del = $user->can("delete_comment") ?
|
||||
' - <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>' : '';
|
||||
return "
|
||||
$html = "
|
||||
<div class=\"comment $hb\" id=\"c$i_comment_id\">
|
||||
<div class=\"info\">
|
||||
$h_avatar
|
||||
@ -273,7 +273,7 @@ class CommentListTheme extends Themelet {
|
||||
</div>
|
||||
";
|
||||
}
|
||||
return "";
|
||||
return $html;
|
||||
}
|
||||
|
||||
protected function build_postbox(/*int*/ $image_id) {
|
||||
|
@ -206,7 +206,7 @@ class CronUploader extends Extension {
|
||||
|
||||
/**
|
||||
* Returns amount of files & total size of dir.
|
||||
* @param unknown $path
|
||||
* @param $path string
|
||||
* @return multitype:number
|
||||
*/
|
||||
function scan_dir($path){
|
||||
@ -227,7 +227,7 @@ class CronUploader extends Extension {
|
||||
|
||||
/**
|
||||
* Uploads the image & handles everything
|
||||
* @param number $upload_count to upload a non-config amount of imgs
|
||||
* @param $upload_count int to upload a non-config amount of imgs
|
||||
* @return boolean returns true if the upload was successful
|
||||
*/
|
||||
public function process_upload($upload_count = 0) {
|
||||
@ -254,11 +254,11 @@ class CronUploader extends Extension {
|
||||
|
||||
try {
|
||||
$this->add_image($img[0], $img[1], $img[2]);
|
||||
$newPath = $this->move_uploaded($img[0], $img[1], false);
|
||||
$this->move_uploaded($img[0], $img[1], false);
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$newPath = $this->move_uploaded($img[0], $img[1], true);
|
||||
$this->move_uploaded($img[0], $img[1], true);
|
||||
}
|
||||
|
||||
// Remove img from queue array
|
||||
@ -295,37 +295,17 @@ class CronUploader extends Extension {
|
||||
$this->add_upload_info($info . "Image \"$filename\" moved from queue to \"$newPath\".");
|
||||
}
|
||||
|
||||
/**
|
||||
* moves a directory up or gets the directory of a file
|
||||
*
|
||||
* @param string $path Path to modify
|
||||
* @param int $depth Amount of directories to go up
|
||||
* @return unknown Path to correct Directory
|
||||
*/
|
||||
private function move_directory_up($path, $depth=1)
|
||||
{
|
||||
$path = str_replace("//", "/", $path);
|
||||
$array = explode("/", $path);
|
||||
|
||||
for ($i = 0; $i < $depth; $i++) {
|
||||
$to_remove = count($array) -1; // Gets number of element to remove
|
||||
unset($array[$to_remove]);
|
||||
}
|
||||
|
||||
return implode("/", $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the necessary DataUploadEvent for a given image and tags.
|
||||
*/
|
||||
private function add_image($tmpname, $filename, $tags) {
|
||||
global $user, $image;
|
||||
assert ( file_exists ( $tmpname ) );
|
||||
|
||||
$pathinfo = pathinfo ( $filename );
|
||||
if (! array_key_exists ( 'extension', $pathinfo )) {
|
||||
throw new UploadException ( "File has no extension" );
|
||||
}
|
||||
$metadata = array();
|
||||
$metadata ['filename'] = $pathinfo ['basename'];
|
||||
$metadata ['extension'] = $pathinfo ['extension'];
|
||||
$metadata ['tags'] = ""; // = $tags; doesn't work when not logged in here
|
||||
@ -343,12 +323,9 @@ class CronUploader extends Extension {
|
||||
// Set tags
|
||||
$img = Image::by_id($event->image_id);
|
||||
$img->set_tags($tags);
|
||||
|
||||
}
|
||||
|
||||
private function generate_image_queue($base = "", $subdir = "") {
|
||||
global $config;
|
||||
|
||||
if ($base == "")
|
||||
$base = $this->root_dir . "/queue";
|
||||
|
||||
@ -391,8 +368,9 @@ class CronUploader extends Extension {
|
||||
|
||||
/**
|
||||
* Adds a message to the info being published at the end
|
||||
* @param string $text
|
||||
* @param int $addon Enter a value to modify an existing value (enter value number)
|
||||
* @param $text string
|
||||
* @param $addon int Enter a value to modify an existing value (enter value number)
|
||||
* @return int
|
||||
*/
|
||||
private function add_upload_info($text, $addon = 0) {
|
||||
$info = $this->upload_info;
|
||||
@ -409,7 +387,7 @@ class CronUploader extends Extension {
|
||||
|
||||
// else if addon function is used, select the line & modify it
|
||||
$lines = substr($info, "\n"); // Seperate the string to array in lines
|
||||
$lines[$addon] = "$line[$addon] $text"; // Add the content to the line
|
||||
$lines[$addon] = "$lines[$addon] $text"; // Add the content to the line
|
||||
$this->upload_info = implode("\n", $lines); // Put string back together & update
|
||||
|
||||
return $addon; // Return line number
|
||||
@ -419,7 +397,7 @@ class CronUploader extends Extension {
|
||||
* This is run at the end to display & save the log.
|
||||
*/
|
||||
private function handle_log() {
|
||||
global $page, $config;
|
||||
global $page;
|
||||
|
||||
// Display message
|
||||
$page->set_mode("data");
|
||||
|
@ -106,9 +106,6 @@ class DanbooruApi extends Extension {
|
||||
|
||||
if($user->can("create_image"))
|
||||
{
|
||||
$file = null;
|
||||
$filename = "";
|
||||
$source = "";
|
||||
if(isset($_FILES['file']))
|
||||
{ // A file was POST'd in
|
||||
$file = $_FILES['file']['tmp_name'];
|
||||
|
@ -21,6 +21,7 @@ function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) {
|
||||
class ExtensionInfo {
|
||||
var $ext_name, $name, $link, $author, $email;
|
||||
var $description, $documentation, $version, $visibility;
|
||||
var $enabled;
|
||||
|
||||
function __construct($main) {
|
||||
$matches = array();
|
||||
@ -167,6 +168,7 @@ class ExtManager extends Extension {
|
||||
|
||||
private function set_things($settings) {
|
||||
$core = explode(",", CORE_EXTS);
|
||||
$extras = array();
|
||||
|
||||
foreach(glob("ext/*/main.php") as $main) {
|
||||
$matches = array();
|
||||
|
@ -35,7 +35,7 @@ class Favorites extends Extension {
|
||||
}
|
||||
|
||||
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) {
|
||||
global $database, $page, $user;
|
||||
global $database, $user;
|
||||
if(!$user->is_anonymous()) {
|
||||
$user_id = $user->id;
|
||||
$image_id = $event->image->id;
|
||||
@ -51,7 +51,7 @@ class Favorites extends Extension {
|
||||
public function onDisplayingImage(DisplayingImageEvent $event) {
|
||||
$people = $this->list_persons_who_have_favorited($event->image);
|
||||
if(count($people) > 0) {
|
||||
$html = $this->theme->display_people($people);
|
||||
$this->theme->display_people($people);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class Favorites extends Extension {
|
||||
in_array('favorite_action', $_POST) &&
|
||||
(($_POST['favorite_action'] == "set") || ($_POST['favorite_action'] == "unset"))
|
||||
) {
|
||||
send_event(new FavoriteSetEvent($event->image_id, $user, ($_POST['favorite_action'] == "set")));
|
||||
send_event(new FavoriteSetEvent($event->image->id, $user, ($_POST['favorite_action'] == "set")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,11 @@ class ArchiveFileHandler extends Extension {
|
||||
assert(file_exists($tmpname));
|
||||
|
||||
try {
|
||||
global $user;
|
||||
$pathinfo = pathinfo($filename);
|
||||
if(!array_key_exists('extension', $pathinfo)) {
|
||||
throw new UploadException("File has no extension");
|
||||
}
|
||||
$metadata = array();
|
||||
$metadata['filename'] = $pathinfo['basename'];
|
||||
$metadata['extension'] = $pathinfo['extension'];
|
||||
$metadata['tags'] = $tags;
|
||||
@ -69,8 +69,6 @@ class ArchiveFileHandler extends Extension {
|
||||
|
||||
// copied from bulk add extension
|
||||
private function add_dir($base, $subdir="") {
|
||||
global $page;
|
||||
|
||||
$list = "";
|
||||
|
||||
$dir = opendir("$base/$subdir");
|
||||
|
@ -17,8 +17,6 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||
}
|
||||
|
||||
protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
$image->filesize = $metadata['size'];
|
||||
@ -28,15 +26,8 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||
$image->tag_array = Tag::explode($metadata['tags']);
|
||||
$image->source = $metadata['source'];
|
||||
|
||||
// redundant, since getimagesize() works on SWF o_O
|
||||
// $rect = $this->swf_get_bounds($filename);
|
||||
// if(is_null($rect)) {
|
||||
// return $null;
|
||||
// }
|
||||
// $image->width = $rect[1];
|
||||
// $image->height = $rect[3];
|
||||
|
||||
if(!($info = getimagesize($filename))) return null;
|
||||
$info = getimagesize($filename);
|
||||
if(!$info) return null;
|
||||
|
||||
$image->width = $info[0];
|
||||
$image->height = $info[1];
|
||||
@ -45,61 +36,14 @@ class FlashFileHandler extends DataHandlerExtension {
|
||||
}
|
||||
|
||||
protected function check_contents(/*string*/ $file) {
|
||||
if(!file_exists($file)) return false;
|
||||
if (!file_exists($file)) return false;
|
||||
|
||||
$fp = fopen($file, "r");
|
||||
$head = fread($fp, 3);
|
||||
fclose($fp);
|
||||
if(!in_array($head, array("CWS", "FWS"))) return false;
|
||||
if (!in_array($head, array("CWS", "FWS"))) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function str_to_binarray(/*string*/ $string) {
|
||||
$binary = array();
|
||||
$length = strlen($string);
|
||||
for($j=0; $j<$length; $j++) {
|
||||
$c = ord($string[$j]);
|
||||
for($i=7; $i>=0; $i--) {
|
||||
$binary[] = ($c >> $i) & 0x01;
|
||||
}
|
||||
}
|
||||
return $binary;
|
||||
}
|
||||
|
||||
private function binarray_to_int($binarray, $start=0, $length=32) {
|
||||
$int = 0;
|
||||
for($i=$start; $i<$start + $length; $i++) {
|
||||
$int = $int << 1;
|
||||
$int = $int + ($binarray[$i] == "1" ? 1 : 0);
|
||||
}
|
||||
return $int;
|
||||
}
|
||||
|
||||
private function swf_get_bounds(/*string*/ $filename) {
|
||||
$fp = fopen($filename, "r");
|
||||
$head = fread($fp, 3);
|
||||
$version = fread($fp, 1);
|
||||
$length = fread($fp, 4);
|
||||
|
||||
if($head == "FWS") {
|
||||
$data = fread($fp, 16);
|
||||
}
|
||||
else if($head == "CWS") {
|
||||
$data = fread($fp, 128*1024);
|
||||
$data = gzuncompress($data);
|
||||
$data = substr($data, 0, 16);
|
||||
}
|
||||
|
||||
$bounds = array();
|
||||
$rect_bin = $this->str_to_binarray($data);
|
||||
$nbits = $this->binarray_to_int($rect_bin, 0, 5);
|
||||
$bounds[] = $this->binarray_to_int($rect_bin, 5 + 0 * $nbits, $nbits) / 20;
|
||||
$bounds[] = $this->binarray_to_int($rect_bin, 5 + 1 * $nbits, $nbits) / 20;
|
||||
$bounds[] = $this->binarray_to_int($rect_bin, 5 + 2 * $nbits, $nbits) / 20;
|
||||
$bounds[] = $this->binarray_to_int($rect_bin, 5 + 3 * $nbits, $nbits) / 20;
|
||||
|
||||
return $bounds;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -36,7 +36,7 @@ class IcoFileHandler extends Extension {
|
||||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $database, $page;
|
||||
global $page;
|
||||
if($event->page_matches("get_ico")) {
|
||||
$id = int_escape($event->get_arg(0));
|
||||
$image = Image::by_id($id);
|
||||
@ -56,11 +56,8 @@ class IcoFileHandler extends Extension {
|
||||
}
|
||||
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
$info = "";
|
||||
$fp = fopen($filename, "r");
|
||||
$header = unpack("snull/stype/scount", fread($fp, 6));
|
||||
|
||||
|
@ -6,8 +6,8 @@ class IcoHandlerTest extends ShimmieWebTestCase {
|
||||
$this->assert_response(302);
|
||||
$this->log_out();
|
||||
|
||||
$raw = $this->get_page("post/view/$image_id"); // test for no crash
|
||||
$raw = $this->get_page("get_ico/$image_id"); // test for no crash
|
||||
$this->get_page("post/view/$image_id"); // test for no crash
|
||||
$this->get_page("get_ico/$image_id"); // test for no crash
|
||||
|
||||
$this->log_in_as_admin();
|
||||
$this->delete_image($image_id);
|
||||
|
@ -14,12 +14,10 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||
}
|
||||
|
||||
protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
$info = "";
|
||||
if(!($info = getimagesize($filename))) return null;
|
||||
$info = getimagesize($filename);
|
||||
if(!$info) return null;
|
||||
|
||||
$image->width = $info[0];
|
||||
$image->height = $info[1];
|
||||
@ -52,9 +50,10 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||
}
|
||||
|
||||
protected function create_thumb_force(/*string*/ $hash) {
|
||||
global $config;
|
||||
|
||||
$inname = warehouse_path("images", $hash);
|
||||
$outname = warehouse_path("thumbs", $hash);
|
||||
global $config;
|
||||
|
||||
$ok = false;
|
||||
|
||||
@ -165,7 +164,7 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||
if($width > $height*5) $width = $height*5;
|
||||
if($height > $width*5) $height = $width*5;
|
||||
|
||||
$image = imagecreatefromstring($this->read_file($tmpname));
|
||||
$image = imagecreatefromstring(file_get_contents($tmpname));
|
||||
$tsize = get_thumbnail_size($width, $height);
|
||||
|
||||
$thumb = imagecreatetruecolor($tsize[0], $tsize[1]);
|
||||
@ -176,16 +175,6 @@ class PixelFileHandler extends DataHandlerExtension {
|
||||
return $thumb;
|
||||
}
|
||||
}
|
||||
|
||||
private function read_file(/*string*/ $fname) {
|
||||
$fp = fopen($fname, "r");
|
||||
if(!$fp) return false;
|
||||
|
||||
$data = fread($fp, filesize($fname));
|
||||
fclose($fp);
|
||||
|
||||
return $data;
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
?>
|
||||
|
@ -15,26 +15,26 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function zoom(zoom) {
|
||||
function zoom(zoom_type) {
|
||||
var img = $('.shm-main-image');
|
||||
if(zoom == "full") {
|
||||
if(zoom_type == "full") {
|
||||
img.css('max-width', img.data('width') + 'px');
|
||||
img.css('max-height', img.data('height') + 'px');
|
||||
}
|
||||
if(zoom == "width") {
|
||||
if(zoom_type == "width") {
|
||||
img.css('max-width', '95%');
|
||||
img.css('max-height', img.data('height') + 'px');
|
||||
}
|
||||
if(zoom == "height") {
|
||||
if(zoom_type == "height") {
|
||||
img.css('max-width', img.data('width') + 'px');
|
||||
img.css('max-height', (window.innerHeight * 0.95) + 'px');
|
||||
}
|
||||
if(zoom == "both") {
|
||||
if(zoom_type == "both") {
|
||||
img.css('max-width', '95%');
|
||||
img.css('max-height', (window.innerHeight * 0.95) + 'px');
|
||||
}
|
||||
|
||||
$(".shm-zoomer").val(zoom);
|
||||
$(".shm-zoomer").val(zoom_type);
|
||||
|
||||
$.cookie("ui-image-zoom", zoom, {path: '/', expires: 365});
|
||||
$.cookie("ui-image-zoom", zoom_type, {path: '/', expires: 365});
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ class SVGFileHandler extends Extension {
|
||||
public function onDataUpload(DataUploadEvent $event) {
|
||||
if($this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
if(!move_upload_to_archive($event)) return;
|
||||
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
|
||||
$image = $this->create_image_from_data(warehouse_path("images", $hash), $event->metadata);
|
||||
@ -27,7 +26,6 @@ class SVGFileHandler extends Extension {
|
||||
global $config;
|
||||
if($this->supported_ext($event->type)) {
|
||||
$hash = $event->hash;
|
||||
$ha = substr($hash, 0, 2);
|
||||
|
||||
copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash));
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ else {
|
||||
<source src='" . make_link("/image/" . $image->id) . "' type='video/webm' />
|
||||
</video>";
|
||||
}
|
||||
else {
|
||||
$html = "Video type '$ext' not recognised";
|
||||
}
|
||||
$page->add_block(new Block("Video", $html, "main", 10));
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class ImageAdditionEvent extends Event {
|
||||
* this new image.
|
||||
*
|
||||
* @sa TagSetEvent
|
||||
* @param $image The new image to add.
|
||||
* @param $image Image The new image to add.
|
||||
*/
|
||||
public function __construct(Image $image) {
|
||||
$this->image = $image;
|
||||
@ -46,7 +46,7 @@ class ImageDeletionEvent extends Event {
|
||||
* Used by things like tags and comments handlers to
|
||||
* clean out related rows in their tables.
|
||||
*
|
||||
* @param $image The image being deleted
|
||||
* @param $image Image The image being deleted
|
||||
*/
|
||||
public function __construct(Image $image) {
|
||||
$this->image = $image;
|
||||
@ -93,8 +93,9 @@ class ThumbnailGenerationEvent extends Event {
|
||||
/**
|
||||
* Request a thumbnail be made for an image object
|
||||
*
|
||||
* @param $hash The unique hash of the image
|
||||
* @param $type The type of the image
|
||||
* @param $hash string The unique hash of the image
|
||||
* @param $type string The type of the image
|
||||
* @param $force boolean Regenerate the thumbnail even if one already exists
|
||||
*/
|
||||
public function __construct($hash, $type, $force=false) {
|
||||
$this->hash = $hash;
|
||||
@ -223,9 +224,6 @@ class ImageIO extends Extension {
|
||||
}
|
||||
|
||||
public function onUserPageBuilding(UserPageBuildingEvent $event) {
|
||||
global $user;
|
||||
global $config;
|
||||
|
||||
$u_id = url_escape($event->display_user->id);
|
||||
$i_image_count = Image::count_images(array("user_id={$event->display_user->id}"));
|
||||
$i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1;
|
||||
@ -279,7 +277,7 @@ class ImageIO extends Extension {
|
||||
|
||||
|
||||
// add image {{{
|
||||
private function add_image($image) {
|
||||
private function add_image(Image $image) {
|
||||
global $page, $user, $database, $config;
|
||||
|
||||
/*
|
||||
@ -401,10 +399,7 @@ class ImageIO extends Extension {
|
||||
|
||||
// replace image {{{
|
||||
private function replace_image($id, $image) {
|
||||
global $page;
|
||||
global $user;
|
||||
global $database;
|
||||
global $config;
|
||||
|
||||
/* Check to make sure the image exists. */
|
||||
$existing = Image::by_id($id);
|
||||
|
@ -22,7 +22,6 @@ class ImageBanTheme extends Themelet {
|
||||
*/
|
||||
public function display_image_hash_bans(Page $page, $page_number, $page_count, $bans) {
|
||||
$h_bans = "";
|
||||
$n = 0;
|
||||
foreach($bans as $ban) {
|
||||
$h_bans .= "
|
||||
<tr>
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class IndexTheme extends Themelet {
|
||||
var $page_number, $total_pages, $search_terms;
|
||||
|
||||
public function set_page($page_number, $total_pages, $search_terms) {
|
||||
$this->page_number = $page_number;
|
||||
$this->total_pages = $total_pages;
|
||||
|
@ -14,7 +14,6 @@ class IPBanTheme extends Themelet {
|
||||
public function display_bans(Page $page, $bans) {
|
||||
global $database, $user;
|
||||
$h_bans = "";
|
||||
$n = 0;
|
||||
$prefix = ($database->get_driver_name() == "sqlite" ? "bans." : "");
|
||||
$prefix2 = ($database->get_driver_name() == "sqlite" ? "users." : "");
|
||||
foreach($bans as $ban) {
|
||||
|
@ -62,7 +62,7 @@ class LinkImageTheme extends Themelet {
|
||||
$text = "[url=".$url."]".$content."[/url]";
|
||||
break;
|
||||
default:
|
||||
$text = $link." - ".$content;
|
||||
$text = $url." - ".$content;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ class LiveFeed extends Extension {
|
||||
fwrite($fp, "$data\n");
|
||||
fclose($fp);
|
||||
} catch (Exception $e) {
|
||||
/* logging errors shouldn't break everything */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ class LogDatabaseTheme extends Themelet {
|
||||
</form>
|
||||
</thead>
|
||||
<tbody>\n";
|
||||
$n = 0;
|
||||
reset($events); // rewind to first element in array.
|
||||
|
||||
foreach($events as $event) {
|
||||
|
@ -42,6 +42,7 @@ class LogNet extends Extension {
|
||||
fwrite($fp, "$data\n");
|
||||
fclose($fp);
|
||||
} catch (Exception $e) {
|
||||
/* logging errors shouldn't break everything */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class NotATag extends Extension {
|
||||
}
|
||||
|
||||
private function scan(/*array*/ $tags_mixed) {
|
||||
global $config, $database;
|
||||
global $database;
|
||||
|
||||
$tags = array();
|
||||
foreach($tags_mixed as $tag) $tags[] = strtolower($tag);
|
||||
@ -53,12 +53,12 @@ class NotATag extends Extension {
|
||||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $database, $page, $user;
|
||||
global $database, $page, $user;
|
||||
|
||||
if($event->page_matches("untag")) {
|
||||
if($user->can("ban_image")) {
|
||||
if($event->get_arg(0) == "add") {
|
||||
$tag = isset($_POST["tag"]) ? $_POST["tag"] : $image->tag;
|
||||
$tag = $_POST["tag"];
|
||||
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : "DNP";
|
||||
|
||||
$database->Execute(
|
||||
|
@ -2,7 +2,6 @@
|
||||
class NotATagTheme extends Themelet {
|
||||
public function display_untags(Page $page, $page_number, $page_count, $bans) {
|
||||
$h_bans = "";
|
||||
$n = 0;
|
||||
foreach($bans as $ban) {
|
||||
$h_bans .= "
|
||||
<tr>
|
||||
|
@ -363,6 +363,8 @@ class Notes extends Extension {
|
||||
*/
|
||||
private function delete_note()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$imageID = int_escape($_POST["image_id"]);
|
||||
$noteID = int_escape($_POST["note_id"]);
|
||||
|
||||
@ -388,7 +390,7 @@ class Notes extends Extension {
|
||||
* HERE WE DELETE ALL NOTES FROM IMAGE
|
||||
*/
|
||||
private function nuke_notes() {
|
||||
global $database;
|
||||
global $database, $user;
|
||||
$image_id = int_escape($_POST["image_id"]);
|
||||
$database->execute("DELETE FROM notes WHERE image_id = ?", array($image_id));
|
||||
log_info("notes", "Notes deleted from {$image_id} by {$user->name}");
|
||||
@ -400,7 +402,7 @@ class Notes extends Extension {
|
||||
* HERE WE DELETE ALL REQUESTS FOR IMAGE
|
||||
*/
|
||||
private function nuke_requests() {
|
||||
global $database;
|
||||
global $database, $user;
|
||||
$image_id = int_escape($_POST["image_id"]);
|
||||
|
||||
$database->execute("DELETE FROM note_request WHERE image_id = ?", array($image_id));
|
||||
@ -588,7 +590,6 @@ class Notes extends Extension {
|
||||
$noteEnable = $history['note_enable'];
|
||||
$noteID = $history['note_id'];
|
||||
$imageID = $history['image_id'];
|
||||
$userID = $user->id;
|
||||
$noteX1 = $history['x1'];
|
||||
$noteY1 = $history['y1'];
|
||||
$noteHeight = $history['height'];
|
||||
|
@ -170,8 +170,8 @@ class NotesTheme extends Themelet {
|
||||
$page->add_block(new Block("Note Requests", $pool_images, "main", 20));
|
||||
}
|
||||
|
||||
public function display_histories($histories, $pageNumber, $totalPages) {
|
||||
global $user, $page;
|
||||
private function get_history($histories) {
|
||||
global $user;
|
||||
|
||||
$html = "<table id='poolsList' class='zebra'>".
|
||||
"<thead><tr>".
|
||||
@ -181,7 +181,6 @@ class NotesTheme extends Themelet {
|
||||
"<th>Updater</th>".
|
||||
"<th>Date</th>";
|
||||
|
||||
|
||||
if(!$user->is_anonymous()){
|
||||
$html .= "<th>Action</th>";
|
||||
}
|
||||
@ -189,7 +188,6 @@ class NotesTheme extends Themelet {
|
||||
$html .= "</tr></thead>".
|
||||
"<tbody>";
|
||||
|
||||
$n = 0;
|
||||
foreach($histories as $history) {
|
||||
$image_link = "<a href='".make_link("post/view/".$history['image_id'])."'>".$history['image_id']."</a>";
|
||||
$history_link = "<a href='".make_link("note/history/".$history['note_id'])."'>".$history['note_id'].".".$history['review_id']."</a>";
|
||||
@ -211,6 +209,14 @@ class NotesTheme extends Themelet {
|
||||
|
||||
$html .= "</tr></tbody></table>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function display_histories($histories, $pageNumber, $totalPages) {
|
||||
global $page;
|
||||
|
||||
$html = $this->get_history($histories);
|
||||
|
||||
$page->set_title("Note Updates");
|
||||
$page->set_heading("Note Updates");
|
||||
$page->add_block(new Block("Note Updates", $html, "main", 10));
|
||||
@ -219,45 +225,9 @@ class NotesTheme extends Themelet {
|
||||
}
|
||||
|
||||
public function display_history($histories, $pageNumber, $totalPages) {
|
||||
global $user, $page;
|
||||
global $page;
|
||||
|
||||
$html = "<table id='poolsList' class='zebra'>".
|
||||
"<thead><tr>".
|
||||
"<th>Image</th>".
|
||||
"<th>Note</th>".
|
||||
"<th>Body</th>".
|
||||
"<th>Updater</th>".
|
||||
"<th>Date</th>";
|
||||
|
||||
|
||||
if(!$user->is_anonymous()){
|
||||
$html .= "<th>Action</th>";
|
||||
}
|
||||
|
||||
$html .= "</tr></thead>".
|
||||
"<tbody>";
|
||||
|
||||
$n = 0;
|
||||
foreach($histories as $history) {
|
||||
$image_link = "<a href='".make_link("post/view/".$history['image_id'])."'>".$history['image_id']."</a>";
|
||||
$history_link = "<a href='".make_link("note/history/".$history['note_id'])."'>".$history['note_id'].".".$history['review_id']."</a>";
|
||||
$user_link = "<a href='".make_link("user/".$history['user_name'])."'>".$history['user_name']."</a>";
|
||||
$revert_link = "<a href='".make_link("note/revert/".$history['note_id']."/".$history['review_id'])."'>Revert</a>";
|
||||
|
||||
$html .= "<tr>".
|
||||
"<td>".$image_link."</td>".
|
||||
"<td>".$history_link."</td>".
|
||||
"<td style='text-align:left;'>".$history['note']."</td>".
|
||||
"<td>".$user_link."</td>".
|
||||
"<td>".autodate($history['date'])."</td>";
|
||||
|
||||
if(!$user->is_anonymous()){
|
||||
$html .= "<td>".$revert_link."</td>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$html .= "</tr></tbody></table>";
|
||||
$html = $this->get_history($histories);
|
||||
|
||||
$page->set_title("Note History");
|
||||
$page->set_heading("Note History");
|
||||
|
@ -28,6 +28,7 @@ class Oekaki extends Extension {
|
||||
throw new UploadException("File has no extension");
|
||||
}
|
||||
log_info("oekaki", "Processing file [{$pathinfo['filename']}]");
|
||||
$metadata = array();
|
||||
$metadata['filename'] = 'oekaki.png';
|
||||
$metadata['extension'] = $pathinfo['extension'];
|
||||
$metadata['tags'] = 'oekaki tagme';
|
||||
|
@ -9,7 +9,6 @@ class OekakiTheme extends Themelet {
|
||||
global $config, $page;
|
||||
|
||||
$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);
|
||||
|
@ -8,7 +8,6 @@ class PrivMsgTheme extends Themelet {
|
||||
<table id='pms' class='zebra sortable'>
|
||||
<thead><tr><th>R?</th><th>Subject</th><th>From</th><th>Date</th><th>Action</th></tr></thead>
|
||||
<tbody>";
|
||||
$n = 0;
|
||||
foreach($pms as $pm) {
|
||||
$h_subject = html_escape($pm->subject);
|
||||
if(strlen(trim($h_subject)) == 0) $h_subject = "(No subject)";
|
||||
|
@ -12,7 +12,6 @@ class PoolsTheme extends Themelet {
|
||||
}
|
||||
|
||||
public function get_adder_html(Image $image, /*array*/ $pools) {
|
||||
$editor = "";
|
||||
$h = "";
|
||||
foreach($pools as $pool) {
|
||||
$h .= "<option value='".$pool['id']."'>".html_escape($pool['title'])."</option>";
|
||||
@ -43,8 +42,6 @@ class PoolsTheme extends Themelet {
|
||||
<th>Public</th>
|
||||
</tr></thead><tbody>';
|
||||
|
||||
$n = 0;
|
||||
|
||||
// Build up the list of pools.
|
||||
foreach($pools as $pool) {
|
||||
$pool_link = '<a href="'.make_link("pool/view/".$pool['id']).'">'.html_escape($pool['title'])."</a>";
|
||||
@ -133,7 +130,6 @@ class PoolsTheme extends Themelet {
|
||||
<th class="left">Description</th>
|
||||
</tr></thead><tbody>';
|
||||
|
||||
$n = 0;
|
||||
foreach($pools as $pool) {
|
||||
$pool_info .= "<tr>".
|
||||
"<td class='left'>".html_escape($pool['title'])."</td>".
|
||||
@ -303,15 +299,15 @@ class PoolsTheme extends Themelet {
|
||||
$this->display_top($pools, "Sorting Pool");
|
||||
|
||||
$pool_images = "\n<form action='".make_link("pool/order")."' method='POST' name='checks'>";
|
||||
$n = 0;
|
||||
$i = 0;
|
||||
foreach($images as $pair) {
|
||||
$image = $pair[0];
|
||||
$thumb_html = $this->build_thumb_html($image);
|
||||
$pool_images .= '<span class="thumb">'."\n".$thumb_html."\n".
|
||||
'<br><input name="imgs['.$n.'][]" type="text" style="max-width:50px;" value="'.$image->image_order.'" />'.
|
||||
'<input name="imgs['.$n.'][]" type="hidden" value="'.$image->id.'" />'.
|
||||
'<br><input name="imgs['.$i.'][]" type="text" style="max-width:50px;" value="'.$image->image_order.'" />'.
|
||||
'<input name="imgs['.$i.'][]" type="hidden" value="'.$image->id.'" />'.
|
||||
'</span>';
|
||||
$n++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$pool_images .= "<br>".
|
||||
@ -382,7 +378,6 @@ class PoolsTheme extends Themelet {
|
||||
<th>Action</th>
|
||||
</tr></thead><tbody>';
|
||||
|
||||
$n = 0;
|
||||
foreach($histories as $history) {
|
||||
$pool_link = "<a href='".make_link("pool/view/".$history['pool_id'])."'>".html_escape($history['title'])."</a>";
|
||||
$user_link = "<a href='".make_link("user/".url_escape($history['user_name']))."'>".html_escape($history['user_name'])."</a>";
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
class RatingsTheme extends Themelet {
|
||||
public function get_rater_html(/*int*/ $image_id, /*string*/ $rating) {
|
||||
$i_image_id = int_escape($image_id);
|
||||
$s_checked = $rating == 's' ? " checked" : "";
|
||||
$q_checked = $rating == 'q' ? " checked" : "";
|
||||
$e_checked = $rating == 'e' ? " checked" : "";
|
||||
|
@ -15,7 +15,6 @@ class ReportImageTheme extends Themelet {
|
||||
global $config;
|
||||
|
||||
$h_reportedimages = "";
|
||||
$n = 0;
|
||||
foreach($reports as $report) {
|
||||
$image = $report['image'];
|
||||
$h_reason = format_text($report['reason']);
|
||||
|
@ -7,7 +7,6 @@ class ResizeImageTheme extends Themelet {
|
||||
public function get_resize_html(Image $image) {
|
||||
global $user, $config;
|
||||
|
||||
$i_image_id = int_escape($image->id);
|
||||
$default_width = $config->get_int('resize_default_width');
|
||||
$default_height = $config->get_int('resize_default_height');
|
||||
|
||||
|
@ -7,8 +7,6 @@ class RotateImageTheme extends Themelet {
|
||||
public function get_rotate_html(/*int*/ $image_id) {
|
||||
global $user, $config;
|
||||
|
||||
$i_image_id = int_escape($image_id);
|
||||
|
||||
$html = "
|
||||
".make_form(make_link('rotate/'.$image_id), 'POST')."
|
||||
<input type='hidden' name='image_id' value='$image_id'>
|
||||
|
@ -23,7 +23,6 @@ class SetupTheme extends Themelet {
|
||||
*/
|
||||
$setupblock_html = "";
|
||||
foreach($panel->blocks as $block) {
|
||||
$html = $this->sb_to_html($block);
|
||||
$setupblock_html .= $this->sb_to_html($block);
|
||||
}
|
||||
|
||||
@ -44,12 +43,10 @@ class SetupTheme extends Themelet {
|
||||
global $user;
|
||||
|
||||
$h_rows = "";
|
||||
$n = 0;
|
||||
ksort($options);
|
||||
foreach($options as $name => $value) {
|
||||
$h_name = html_escape($name);
|
||||
$h_value = html_escape($value);
|
||||
$len = strlen($h_value);
|
||||
|
||||
$h_box = "";
|
||||
if(strpos($value, "\n") > 0) {
|
||||
|
@ -63,7 +63,7 @@ class XMLSitemap extends Extension {
|
||||
{
|
||||
global $database, $config;
|
||||
// add index
|
||||
$index[0] = $base_href = $config->get_string("front_page");
|
||||
$index[0] = $config->get_string("front_page");
|
||||
$this->add_sitemap_queue($index, "weekly", "1");
|
||||
|
||||
/* --- Add 20 most used tags --- */
|
||||
|
@ -351,7 +351,7 @@ class Source_History extends Extension {
|
||||
}
|
||||
|
||||
// add a history entry
|
||||
$row = $database->execute("
|
||||
$database->execute("
|
||||
INSERT INTO source_histories(image_id, source, user_id, user_ip, date_set)
|
||||
VALUES (?, ?, ?, ?, now())",
|
||||
array($image->id, $new_source, $user->id, $_SERVER['REMOTE_ADDR']));
|
||||
|
@ -80,7 +80,6 @@ class TaggerXML extends Extension {
|
||||
$q_where = "WHERE {$match} {$hidden} AND count > 0";
|
||||
|
||||
// FROM based on return count
|
||||
$q_from = null;
|
||||
$count = $this->count($q_where,$values);
|
||||
if ($count > $max_rows) {
|
||||
$q_from = "FROM (SELECT * FROM `tags` {$q_where} ".
|
||||
@ -139,25 +138,5 @@ class TaggerXML extends Extension {
|
||||
return $database->Execute(
|
||||
"SELECT COUNT(*) FROM `tags` $query",$values)->fields['COUNT(*)'];
|
||||
}
|
||||
|
||||
private function image_tags ($image_id) {
|
||||
global $database;
|
||||
$list = "(";
|
||||
$i_tags = $database->Execute(
|
||||
"SELECT tag_id FROM `image_tags` WHERE image_id=?",
|
||||
array($image_id));
|
||||
|
||||
$b = false;
|
||||
foreach($i_tags as $tag) {
|
||||
if($b)
|
||||
$list .= ",";
|
||||
$b = true;
|
||||
$list .= $tag['tag_id'];
|
||||
|
||||
}
|
||||
$list .= ")";
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -65,7 +65,6 @@ class TipsTheme extends Themelet {
|
||||
|
||||
$html .= "</tr></thead>";
|
||||
|
||||
$n = 0;
|
||||
foreach ($tips as $tip) {
|
||||
$tip_enable = ($tip['enable'] == "Y") ? "Yes" : "No";
|
||||
$set_link = "<a href='".make_link("tips/status/".$tip['id'])."'>".$tip_enable."</a>";
|
||||
|
@ -39,7 +39,6 @@ class WikiTheme extends Themelet {
|
||||
|
||||
protected function create_edit_html(WikiPage $page) {
|
||||
$h_title = html_escape($page->title);
|
||||
$u_title = url_escape($page->title);
|
||||
$i_revision = int_escape($page->revision) + 1;
|
||||
|
||||
global $user;
|
||||
|
@ -21,7 +21,6 @@ class Themelet extends BaseThemelet {
|
||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||
$next = $current_page + 1;
|
||||
$prev = $current_page - 1;
|
||||
$rand = mt_rand(1, $total_pages);
|
||||
|
||||
$at_start = ($current_page <= 3 || $total_pages <= 3);
|
||||
$at_end = ($current_page >= $total_pages -2);
|
||||
|
@ -35,7 +35,6 @@ class CustomUserPageTheme extends UserPageTheme {
|
||||
}
|
||||
|
||||
public function display_user_block(Page $page, User $user, $parts) {
|
||||
$h_name = html_escape($user->name);
|
||||
$html = "";
|
||||
$blocked = array("Pools", "Pool Changes", "Alias Editor", "My Profile");
|
||||
foreach($parts as $part) {
|
||||
|
@ -21,7 +21,6 @@ class Themelet extends BaseThemelet {
|
||||
private function build_paginator($current_page, $total_pages, $base_url, $query) {
|
||||
$next = $current_page + 1;
|
||||
$prev = $current_page - 1;
|
||||
$rand = mt_rand(1, $total_pages);
|
||||
|
||||
$at_start = ($current_page <= 3 || $total_pages <= 3);
|
||||
$at_end = ($current_page >= $total_pages -2);
|
||||
|
@ -35,7 +35,6 @@ class CustomUserPageTheme extends UserPageTheme {
|
||||
}
|
||||
|
||||
public function display_user_block(Page $page, User $user, $parts) {
|
||||
$h_name = html_escape($user->name);
|
||||
$html = "";
|
||||
$blocked = array("Pools", "Pool Changes", "Alias Editor", "My Profile");
|
||||
foreach($parts as $part) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user