Merge branch 'develop' of git://github.com/shish/shimmie2 into hotfix/downtime_theme_edits
This commit is contained in:
commit
505a3e5233
101 changed files with 920 additions and 898 deletions
84
.gitignore
vendored
84
.gitignore
vendored
|
@ -3,4 +3,88 @@ data
|
|||
images
|
||||
thumbs
|
||||
!lib/images
|
||||
|
||||
|
||||
# Created by http://www.gitignore.io
|
||||
|
||||
### Windows ###
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
### OSX ###
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must ends with two \r.
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
|
||||
### vim ###
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
||||
|
||||
### PhpStorm ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
||||
|
||||
## Directory-based project format
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore user-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# and these sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
|
||||
## File-based project format
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
|
||||
## Additional for IntelliJ
|
||||
out/
|
||||
|
||||
# generated by mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# generated by JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# generated by Crashlytics plugin (for Android Studio and Intellij)
|
||||
com_crashlytics_export_strings.xml
|
||||
|
|
6
.scrutinizer.yml
Normal file
6
.scrutinizer.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
imports:
|
||||
- javascript
|
||||
- php
|
||||
|
||||
filter:
|
||||
excluded_paths: [lib/*,ext/chatbox/js/jquery.js]
|
|
@ -39,19 +39,19 @@ class BaseThemelet {
|
|||
*/
|
||||
public function build_thumb_html(Image $image) {
|
||||
global $config;
|
||||
|
||||
$i_id = (int) $image->id;
|
||||
$h_view_link = make_link('post/view/'.$i_id);
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$h_tags = strtolower($image->get_tag_list());
|
||||
$ext = strtolower($image->ext);
|
||||
|
||||
// If the file doesn't support thumbnail generation, show it at max size.
|
||||
if($ext === 'swf' || $ext === 'svg' || $ext === 'mp4' || $ext === 'ogv' || $ext === 'webm' || $ext === 'flv'){
|
||||
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
|
||||
}
|
||||
else{
|
||||
|
||||
$extArr = array_flip(array('swf', 'svg', 'mp4', 'ogv', 'webm', 'flv')); //List of thumbless filetypes
|
||||
if(!isset($extArr[$image->ext])){
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
}else{
|
||||
//Use max thumbnail size if using thumbless filetype
|
||||
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
|
||||
}
|
||||
|
||||
$custom_classes = "";
|
||||
|
|
|
@ -181,7 +181,7 @@ class DatabaseConfig extends BaseConfig {
|
|||
/*
|
||||
* Load the config table from a database
|
||||
*/
|
||||
public function DatabaseConfig(Database $database) {
|
||||
public function __construct(Database $database) {
|
||||
$this->database = $database;
|
||||
|
||||
$cached = $this->database->cache->get("config");
|
||||
|
|
|
@ -5,7 +5,7 @@ class Querylet {
|
|||
var $sql;
|
||||
var $variables;
|
||||
|
||||
public function Querylet($sql, $variables=array()) {
|
||||
public function __construct($sql, $variables=array()) {
|
||||
$this->sql = $sql;
|
||||
$this->variables = $variables;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class TagQuerylet {
|
|||
var $tag;
|
||||
var $positive;
|
||||
|
||||
public function TagQuerylet($tag, $positive) {
|
||||
public function __construct($tag, $positive) {
|
||||
$this->tag = $tag;
|
||||
$this->positive = $positive;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class ImgQuerylet {
|
|||
var $qlet;
|
||||
var $positive;
|
||||
|
||||
public function ImgQuerylet($qlet, $positive) {
|
||||
public function __construct($qlet, $positive) {
|
||||
$this->qlet = $qlet;
|
||||
$this->positive = $positive;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -290,7 +292,7 @@ class Database {
|
|||
* need it. There are some pages where all the data is in cache, so the
|
||||
* DB connection is on-demand.
|
||||
*/
|
||||
public function Database() {
|
||||
public function __construct() {
|
||||
$this->connect_cache();
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class Image {
|
|||
* One will very rarely construct an image directly, more common
|
||||
* would be to use Image::by_id, Image::by_hash, etc
|
||||
*/
|
||||
public function Image($row=null) {
|
||||
public function __construct($row=null) {
|
||||
if(!is_null($row)) {
|
||||
foreach($row as $name => $value) {
|
||||
// some databases use table.name rather than name
|
||||
|
@ -73,7 +73,6 @@ class Image {
|
|||
public static function by_id(/*int*/ $id) {
|
||||
assert(is_numeric($id));
|
||||
global $database;
|
||||
$image = null;
|
||||
$row = $database->get_row("SELECT * FROM images WHERE images.id=:id", array("id"=>$id));
|
||||
return ($row ? new Image($row) : null);
|
||||
}
|
||||
|
@ -86,7 +85,6 @@ class Image {
|
|||
public static function by_hash(/*string*/ $hash) {
|
||||
assert(is_string($hash));
|
||||
global $database;
|
||||
$image = null;
|
||||
$row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", array("hash"=>$hash));
|
||||
return ($row ? new Image($row) : null);
|
||||
}
|
||||
|
@ -124,12 +122,12 @@ 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");
|
||||
}
|
||||
}
|
||||
|
||||
$querylet = Image::build_search_querylet($tags);
|
||||
$querylet->append(new Querylet(" ORDER BY images.".($order_sql ?: $config->get_string("index_order"))));
|
||||
$querylet->append(new Querylet(" ORDER BY ".($order_sql ?: "images.".$config->get_string("index_order"))));
|
||||
$querylet->append(new Querylet(" LIMIT :limit OFFSET :offset", array("limit"=>$limit, "offset"=>$start)));
|
||||
#var_dump($querylet->sql); var_dump($querylet->variables);
|
||||
$result = $database->execute($querylet->sql, $querylet->variables);
|
||||
|
@ -646,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();
|
||||
|
@ -806,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();
|
||||
|
@ -912,9 +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);
|
||||
$s_tag_list = join(', ', $s_tag_array);
|
||||
|
||||
$tag_id_array = array();
|
||||
$tags_ok = true;
|
||||
foreach($tag_search->variables as $tag) {
|
||||
|
@ -1058,7 +1053,7 @@ class Tag {
|
|||
else {
|
||||
global $database;
|
||||
$db_wild_tag = str_replace("%", "\%", $tag);
|
||||
$db_wild_tag = str_replace("*", "%", $tag);
|
||||
$db_wild_tag = str_replace("*", "%", $db_wild_tag);
|
||||
$newtags = $database->get_col($database->scoreql_to_sql("SELECT tag FROM tags WHERE SCORE_STRNORM(tag) LIKE SCORE_STRNORM(?)"), array($db_wild_tag));
|
||||
if(count($newtags) > 0) {
|
||||
$resolved = $newtags;
|
||||
|
@ -1116,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;
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
@ -30,7 +33,7 @@ class User {
|
|||
* One will very rarely construct a user directly, more common
|
||||
* would be to use User::by_id, User::by_session, etc
|
||||
*/
|
||||
public function User($row) {
|
||||
public function __construct($row) {
|
||||
global $_user_classes;
|
||||
|
||||
$this->id = int_escape($row['id']);
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
class AdminBuildingEvent extends Event {
|
||||
var $page;
|
||||
public function AdminBuildingEvent(Page $page) {
|
||||
public function __construct(Page $page) {
|
||||
$this->page = $page;
|
||||
}
|
||||
}
|
||||
|
@ -182,14 +182,18 @@ class AdminPage extends Extension {
|
|||
case 'sqlite':
|
||||
$cmd = "sqlite3 $database .dump";
|
||||
break;
|
||||
default:
|
||||
$cmd = false;
|
||||
}
|
||||
|
||||
//FIXME: .SQL dump is empty if cmd doesn't exist
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/x-unknown");
|
||||
$page->set_filename('shimmie-'.date('Ymd').'.sql');
|
||||
$page->set_data(shell_exec($cmd));
|
||||
if($cmd) {
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/x-unknown");
|
||||
$page->set_filename('shimmie-'.date('Ymd').'.sql');
|
||||
$page->set_data(shell_exec($cmd));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -14,7 +14,7 @@ class AddAliasEvent extends Event {
|
|||
var $oldtag;
|
||||
var $newtag;
|
||||
|
||||
public function AddAliasEvent($oldtag, $newtag) {
|
||||
public function __construct($oldtag, $newtag) {
|
||||
$this->oldtag = trim($oldtag);
|
||||
$this->newtag = trim($newtag);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ class AliasEditorTheme extends Themelet {
|
|||
}
|
||||
|
||||
$h_aliases = "";
|
||||
$n = 0;
|
||||
foreach($aliases as $old => $new) {
|
||||
$h_old = html_escape($old);
|
||||
$h_new = "<a href='".make_link("post/list/".url_escape($new)."/1")."'>".html_escape($new)."</a>";
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class AuthorSetEvent extends Event {
|
||||
var $image, $user, $author;
|
||||
|
||||
public function AuthorSetEvent(Image $image, User $user, /*string*/ $author)
|
||||
public function __construct(Image $image, User $user, /*string*/ $author)
|
||||
{
|
||||
$this->image = $image;
|
||||
$this->user = $user;
|
||||
|
@ -59,8 +59,8 @@ class Artists extends Extension {
|
|||
id SCORE_AIPK,
|
||||
user_id INTEGER NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created DATETIME NOT NULL,
|
||||
updated DATETIME NOT NULL,
|
||||
created SCORE_DATETIME NOT NULL,
|
||||
updated SCORE_DATETIME NOT NULL,
|
||||
notes TEXT,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
@ -70,8 +70,8 @@ class Artists extends Extension {
|
|||
artist_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created DATETIME NOT NULL,
|
||||
updated DATETIME NOT NULL,
|
||||
created SCORE_DATETIME NOT NULL,
|
||||
updated SCORE_DATETIME NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
@ -79,8 +79,8 @@ class Artists extends Extension {
|
|||
id SCORE_AIPK,
|
||||
artist_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
created DATETIME,
|
||||
updated DATETIME,
|
||||
created SCORE_DATETIME,
|
||||
updated SCORE_DATETIME,
|
||||
alias VARCHAR(255),
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
@ -89,8 +89,8 @@ class Artists extends Extension {
|
|||
id SCORE_AIPK,
|
||||
artist_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
created DATETIME NOT NULL,
|
||||
updated DATETIME NOT NULL,
|
||||
created SCORE_DATETIME NOT NULL,
|
||||
updated SCORE_DATETIME NOT NULL,
|
||||
url VARCHAR(1000) NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (artist_id) REFERENCES artists (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
@ -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,19 +14,11 @@ 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")."'>
|
||||
".$user->get_auth_html()."
|
||||
|
@ -72,49 +64,52 @@ 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)
|
||||
{
|
||||
$artistName = $artist['name'];
|
||||
$artistNotes = $artist['notes'];
|
||||
$artistID = $artist['id'];
|
||||
public function show_artist_editor($artist, $aliases, $members, $urls)
|
||||
{
|
||||
global $user;
|
||||
|
||||
// aliases
|
||||
$aliasesString = "";
|
||||
$aliasesIDsString = "";
|
||||
foreach ($aliases as $alias)
|
||||
{
|
||||
$aliasesString .= $alias["alias_name"]." ";
|
||||
$aliasesIDsString .= $alias["alias_id"]." ";
|
||||
}
|
||||
$aliasesString = rtrim($aliasesString);
|
||||
$aliasesIDsString = rtrim($aliasesIDsString);
|
||||
$artistName = $artist['name'];
|
||||
$artistNotes = $artist['notes'];
|
||||
$artistID = $artist['id'];
|
||||
|
||||
// members
|
||||
$membersString = "";
|
||||
$membersIDsString = "";
|
||||
foreach ($members as $member)
|
||||
{
|
||||
$membersString .= $member["name"]." ";
|
||||
$membersIDsString .= $member["id"]." ";
|
||||
}
|
||||
$membersString = rtrim($membersString);
|
||||
$membersIDsString = rtrim($membersIDsString);
|
||||
// aliases
|
||||
$aliasesString = "";
|
||||
$aliasesIDsString = "";
|
||||
foreach ($aliases as $alias)
|
||||
{
|
||||
$aliasesString .= $alias["alias_name"]." ";
|
||||
$aliasesIDsString .= $alias["alias_id"]." ";
|
||||
}
|
||||
$aliasesString = rtrim($aliasesString);
|
||||
$aliasesIDsString = rtrim($aliasesIDsString);
|
||||
|
||||
// urls
|
||||
$urlsString = "";
|
||||
$urlsIDsString = "";
|
||||
foreach ($urls as $url)
|
||||
{
|
||||
$urlsString .= $url["url"]."\n";
|
||||
$urlsIDsString .= $url["id"]." ";
|
||||
}
|
||||
$urlsString = substr($urlsString, 0, strlen($urlsString) -1);
|
||||
$urlsIDsString = rtrim($urlsIDsString);
|
||||
// members
|
||||
$membersString = "";
|
||||
$membersIDsString = "";
|
||||
foreach ($members as $member)
|
||||
{
|
||||
$membersString .= $member["name"]." ";
|
||||
$membersIDsString .= $member["id"]." ";
|
||||
}
|
||||
$membersString = rtrim($membersString);
|
||||
$membersIDsString = rtrim($membersIDsString);
|
||||
|
||||
$html =
|
||||
// urls
|
||||
$urlsString = "";
|
||||
$urlsIDsString = "";
|
||||
foreach ($urls as $url)
|
||||
{
|
||||
$urlsString .= $url["url"]."\n";
|
||||
$urlsIDsString .= $url["id"]." ";
|
||||
}
|
||||
$urlsString = substr($urlsString, 0, strlen($urlsString) -1);
|
||||
$urlsIDsString = rtrim($urlsIDsString);
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/edited/".$artist['id']).'">
|
||||
'.$user->get_auth_html().'
|
||||
|
@ -131,112 +126,113 @@ class ArtistsTheme extends Themelet {
|
|||
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit artist", $html, "main", 10));
|
||||
}
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit artist", $html, "main", 10));
|
||||
}
|
||||
|
||||
public function new_artist_composer()
|
||||
{
|
||||
global $page;
|
||||
{
|
||||
global $page, $user;
|
||||
|
||||
$html = "<form action=".make_link("artist/create")." method='POST'>
|
||||
$html = "<form action=".make_link("artist/create")." method='POST'>
|
||||
".$user->get_auth_html()."
|
||||
<table>
|
||||
<tr><td>Name:</td><td><input type='text' name='name' /></td></tr>
|
||||
<tr><td>Aliases:</td><td><input type='text' name='aliases' /></td></tr>
|
||||
<tr><td>Members:</td><td><input type='text' name='members' /></td></tr>
|
||||
<tr><td>URLs:</td><td><textarea name='urls'></textarea></td></tr>
|
||||
<table>
|
||||
<tr><td>Name:</td><td><input type='text' name='name' /></td></tr>
|
||||
<tr><td>Aliases:</td><td><input type='text' name='aliases' /></td></tr>
|
||||
<tr><td>Members:</td><td><input type='text' name='members' /></td></tr>
|
||||
<tr><td>URLs:</td><td><textarea name='urls'></textarea></td></tr>
|
||||
<tr><td>Notes:</td><td><textarea name='notes'></textarea></td></tr>
|
||||
<tr><td colspan='2'><input type='submit' value='Submit' /></td></tr>
|
||||
</table>
|
||||
";
|
||||
<tr><td colspan='2'><input type='submit' value='Submit' /></td></tr>
|
||||
</table>
|
||||
";
|
||||
|
||||
$page->set_title("Artists");
|
||||
$page->set_heading("Artists");
|
||||
$page->add_block(new Block("Artists", $html, "main", 10));
|
||||
$page->set_title("Artists");
|
||||
$page->set_heading("Artists");
|
||||
$page->add_block(new Block("Artists", $html, "main", 10));
|
||||
}
|
||||
|
||||
public function list_artists($artists, $pageNumber, $totalPages)
|
||||
{
|
||||
global $user, $page;
|
||||
{
|
||||
global $user, $page;
|
||||
|
||||
$html = "<table id='poolsList' class='zebra'>".
|
||||
"<thead><tr>".
|
||||
"<th>Name</th>".
|
||||
"<th>Type</th>".
|
||||
"<th>Last updater</th>".
|
||||
"<th>Posts</th>";
|
||||
$html = "<table id='poolsList' class='zebra'>".
|
||||
"<thead><tr>".
|
||||
"<th>Name</th>".
|
||||
"<th>Type</th>".
|
||||
"<th>Last updater</th>".
|
||||
"<th>Posts</th>";
|
||||
|
||||
|
||||
if(!$user->is_anonymous()) $html .= "<th colspan='2'>Action</th>"; // space for edit link
|
||||
|
||||
$html .= "</tr></thead>";
|
||||
if(!$user->is_anonymous()) $html .= "<th colspan='2'>Action</th>"; // space for edit link
|
||||
|
||||
$html .= "</tr></thead>";
|
||||
|
||||
$n = 0;
|
||||
$deletionLinkActionArray =
|
||||
array('artist' => 'artist/nuke/'
|
||||
, 'alias' => 'artist/alias/delete/'
|
||||
, 'member' => 'artist/member/delete/'
|
||||
);
|
||||
$deletionLinkActionArray =
|
||||
array('artist' => 'artist/nuke/'
|
||||
, 'alias' => 'artist/alias/delete/'
|
||||
, 'member' => 'artist/member/delete/'
|
||||
);
|
||||
|
||||
$editionLinkActionArray =
|
||||
array('artist' => 'artist/edit/'
|
||||
, 'alias' => 'artist/alias/edit/'
|
||||
, 'member' => 'artist/member/edit/'
|
||||
);
|
||||
$editionLinkActionArray =
|
||||
array('artist' => 'artist/edit/'
|
||||
, 'alias' => 'artist/alias/edit/'
|
||||
, 'member' => 'artist/member/edit/'
|
||||
);
|
||||
|
||||
$typeTextArray =
|
||||
array('artist' => 'Artist'
|
||||
, 'alias' => 'Alias'
|
||||
, 'member' => 'Member'
|
||||
);
|
||||
$typeTextArray =
|
||||
array('artist' => 'Artist'
|
||||
, 'alias' => 'Alias'
|
||||
, 'member' => 'Member'
|
||||
);
|
||||
|
||||
foreach ($artists as $artist) {
|
||||
if ($artist['type'] != 'artist')
|
||||
$artist['name'] = str_replace("_", " ", $artist['name']);
|
||||
foreach ($artists as $artist) {
|
||||
if ($artist['type'] != 'artist')
|
||||
$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>";
|
||||
$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>";
|
||||
$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>";
|
||||
$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>";
|
||||
|
||||
$html .= "<tr>".
|
||||
"<td class='left'>".$elementLink;
|
||||
$html .= "<tr>".
|
||||
"<td class='left'>".$elementLink;
|
||||
|
||||
//if ($artist['type'] == 'member')
|
||||
// $html .= " (member of ".$artist_link.")";
|
||||
//if ($artist['type'] == 'member')
|
||||
// $html .= " (member of ".$artist_link.")";
|
||||
|
||||
//if ($artist['type'] == 'alias')
|
||||
// $html .= " (alias for ".$artist_link.")";
|
||||
//if ($artist['type'] == 'alias')
|
||||
// $html .= " (alias for ".$artist_link.")";
|
||||
|
||||
$html .= "</td>".
|
||||
"<td>".$typeTextArray[$artist['type']]."</td>".
|
||||
"<td>".$user_link."</td>".
|
||||
"<td>".$artist['posts']."</td>";
|
||||
$html .= "</td>".
|
||||
"<td>".$typeTextArray[$artist['type']]."</td>".
|
||||
"<td>".$user_link."</td>".
|
||||
"<td>".$artist['posts']."</td>";
|
||||
|
||||
if(!$user->is_anonymous()) $html .= "<td>".$edit_link."</td>";
|
||||
if($user->is_admin()) $html .= "<td>".$del_link."</td>";
|
||||
if(!$user->is_anonymous()) $html .= "<td>".$edit_link."</td>";
|
||||
if($user->is_admin()) $html .= "<td>".$del_link."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
$html .= "</tr>";
|
||||
}
|
||||
|
||||
$html .= "</tbody></table>";
|
||||
$html .= "</tbody></table>";
|
||||
|
||||
$page->set_title("Artists");
|
||||
$page->set_heading("Artists");
|
||||
$page->add_block(new Block("Artists", $html, "main", 10));
|
||||
$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);
|
||||
$this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages);
|
||||
}
|
||||
|
||||
public function show_new_alias_composer($artistID)
|
||||
{
|
||||
$html =
|
||||
'<form method="POST" action='.make_link("artist/alias/add").'>
|
||||
public function show_new_alias_composer($artistID)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'<form method="POST" action='.make_link("artist/alias/add").'>
|
||||
'.$user->get_auth_html().'
|
||||
<table>
|
||||
<tr><td>Alias:</td><td><input type="text" name="aliases" />
|
||||
|
@ -244,258 +240,265 @@ class ArtistsTheme extends Themelet {
|
|||
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
';
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Artist Aliases", $html, "main", 20));
|
||||
}
|
||||
public function show_new_member_composer($artistID)
|
||||
{
|
||||
$html =
|
||||
' <form method="POST" action='.make_link("artist/member/add").'>
|
||||
global $page;
|
||||
$page->add_block(new Block("Artist Aliases", $html, "main", 20));
|
||||
}
|
||||
public function show_new_member_composer($artistID)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
' <form method="POST" action='.make_link("artist/member/add").'>
|
||||
'.$user->get_auth_html().'
|
||||
<table>
|
||||
<tr><td>Members:</td><td><input type="text" name="members" />
|
||||
<input type="hidden" name="artistID" value='.$artistID.' /></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
';
|
||||
</form>
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Artist members", $html, "main", 30));
|
||||
}
|
||||
global $page;
|
||||
$page->add_block(new Block("Artist members", $html, "main", 30));
|
||||
}
|
||||
|
||||
public function show_new_url_composer($artistID)
|
||||
{
|
||||
$html =
|
||||
' <form method="POST" action='.make_link("artist/url/add").'>
|
||||
public function show_new_url_composer($artistID)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
' <form method="POST" action='.make_link("artist/url/add").'>
|
||||
'.$user->get_auth_html().'
|
||||
<table>
|
||||
<tr><td>URL:</td><td><textarea name="urls"></textarea>
|
||||
<input type="hidden" name="artistID" value='.$artistID.' /></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
';
|
||||
</form>
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Artist URLs", $html, "main", 40));
|
||||
}
|
||||
global $page;
|
||||
$page->add_block(new Block("Artist URLs", $html, "main", 40));
|
||||
}
|
||||
|
||||
public function show_alias_editor($alias)
|
||||
{
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/alias/edited/".$alias['id']).'">
|
||||
public function show_alias_editor($alias)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/alias/edited/".$alias['id']).'">
|
||||
'.$user->get_auth_html().'
|
||||
<label for="alias">Alias:</label>
|
||||
<input type="text" name="alias" value="'.$alias['alias'].'" />
|
||||
<input type="hidden" name="aliasID" value="'.$alias['id'].'" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
';
|
||||
<label for="alias">Alias:</label>
|
||||
<input type="text" name="alias" value="'.$alias['alias'].'" />
|
||||
<input type="hidden" name="aliasID" value="'.$alias['id'].'" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit Alias", $html, "main", 10));
|
||||
}
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit Alias", $html, "main", 10));
|
||||
}
|
||||
|
||||
public function show_url_editor($url)
|
||||
{
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/url/edited/".$url['id']).'">
|
||||
public function show_url_editor($url)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/url/edited/".$url['id']).'">
|
||||
'.$user->get_auth_html().'
|
||||
<label for="url">URL:</label>
|
||||
<input type="text" name="url" value="'.$url['url'].'" />
|
||||
<input type="hidden" name="urlID" value="'.$url['id'].'" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
';
|
||||
<label for="url">URL:</label>
|
||||
<input type="text" name="url" value="'.$url['url'].'" />
|
||||
<input type="hidden" name="urlID" value="'.$url['id'].'" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit URL", $html, "main", 10));
|
||||
}
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit URL", $html, "main", 10));
|
||||
}
|
||||
|
||||
public function show_member_editor($member)
|
||||
{
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/member/edited/".$member['id']).'">
|
||||
public function show_member_editor($member)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$html =
|
||||
'
|
||||
<form method="POST" action="'.make_link("artist/member/edited/".$member['id']).'">
|
||||
'.$user->get_auth_html().'
|
||||
<label for="member">Member name:</label>
|
||||
<input type="text" name="name" value="'.$member['name'].'" />
|
||||
<input type="hidden" name="memberID" value="'.$member['id'].'" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
';
|
||||
<label for="member">Member name:</label>
|
||||
<input type="text" name="name" value="'.$member['name'].'" />
|
||||
<input type="hidden" name="memberID" value="'.$member['id'].'" />
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
';
|
||||
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit Member", $html, "main", 10));
|
||||
}
|
||||
global $page;
|
||||
$page->add_block(new Block("Edit Member", $html, "main", 10));
|
||||
}
|
||||
|
||||
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>";
|
||||
$artist_link = "<a href='".make_link("post/list/".$artist['name']."/1")."'>".str_replace("_", " ", $artist['name'])."</a>";
|
||||
|
||||
$n = 0;
|
||||
|
||||
$html = "<table id='poolsList' class='zebra'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>";
|
||||
|
||||
if ($userIsLogged)
|
||||
$html .= "<th></th>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<th></th>";
|
||||
|
||||
$html .= " <tr>
|
||||
</thead>
|
||||
|
||||
<tr>
|
||||
<td class='left'>Name:</td>
|
||||
<td class='left'>".$artist_link."</td>";
|
||||
if ($userIsLogged) $html .= "<td></td>";
|
||||
if ($userIsAdmin) $html .= "<td></td>";
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($aliases) > 0)
|
||||
{
|
||||
$aliasViewLink = str_replace("_", " ", $aliases[0]['alias_name']); // no link anymore
|
||||
$aliasEditLink = "<a href='".make_link("artist/alias/edit/".$aliases[0]['alias_id'])."'>Edit</a>";
|
||||
$aliasDeleteLink = "<a href='".make_link("artist/alias/delete/".$aliases[0]['alias_id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'>Aliases:</td>
|
||||
<td class='left'>".$aliasViewLink."</td>";
|
||||
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$aliasEditLink."</td>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$aliasDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($aliases) > 1)
|
||||
{
|
||||
for ($i = 1; $i < count($aliases); $i++)
|
||||
{
|
||||
$aliasViewLink = str_replace("_", " ", $aliases[$i]['alias_name']); // no link anymore
|
||||
$aliasEditLink = "<a href='".make_link("artist/alias/edit/".$aliases[$i]['alias_id'])."'>Edit</a>";
|
||||
$aliasDeleteLink = "<a href='".make_link("artist/alias/delete/".$aliases[$i]['alias_id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'> </td>
|
||||
<td class='left'>".$aliasViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$aliasEditLink."</td>";
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$aliasDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($members) > 0)
|
||||
{
|
||||
$memberViewLink = str_replace("_", " ", $members[0]['name']); // no link anymore
|
||||
$memberEditLink = "<a href='".make_link("artist/member/edit/".$members[0]['id'])."'>Edit</a>";
|
||||
$memberDeleteLink = "<a href='".make_link("artist/member/delete/".$members[0]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'>Members:</td>
|
||||
<td class='left'>".$memberViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$memberEditLink."</td>";
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$memberDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($members) > 1)
|
||||
{
|
||||
for ($i = 1; $i < count($members); $i++)
|
||||
{
|
||||
$memberViewLink = str_replace("_", " ", $members[$i]['name']); // no link anymore
|
||||
$memberEditLink = "<a href='".make_link("artist/member/edit/".$members[$i]['id'])."'>Edit</a>";
|
||||
$memberDeleteLink = "<a href='".make_link("artist/member/delete/".$members[$i]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'> </td>
|
||||
<td class='left'>".$memberViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$memberEditLink."</td>";
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$memberDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($urls) > 0)
|
||||
{
|
||||
$urlViewLink = "<a href='".str_replace("_", " ", $urls[0]['url'])."' target='_blank'>".str_replace("_", " ", $urls[0]['url'])."</a>";
|
||||
$urlEditLink = "<a href='".make_link("artist/url/edit/".$urls[0]['id'])."'>Edit</a>";
|
||||
$urlDeleteLink = "<a href='".make_link("artist/url/delete/".$urls[0]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'>URLs:</td>
|
||||
<td class='left'>".$urlViewLink."</td>";
|
||||
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$urlEditLink."</td>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$urlDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($urls) > 1)
|
||||
{
|
||||
for ($i = 1; $i < count($urls); $i++)
|
||||
{
|
||||
$urlViewLink = "<a href='".str_replace("_", " ", $urls[$i]['url'])."' target='_blank'>".str_replace("_", " ", $urls[$i]['url'])."</a>";
|
||||
$urlEditLink = "<a href='".make_link("artist/url/edit/".$urls[$i]['id'])."'>Edit</a>";
|
||||
$urlDeleteLink = "<a href='".make_link("artist/url/delete/".$urls[$i]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'> </td>
|
||||
<td class='left'>".$urlViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$urlEditLink."</td>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$urlDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html .=
|
||||
"<tr>
|
||||
<td class='left'>Notes:</td>
|
||||
<td class='left'>".$artist["notes"]."</td>";
|
||||
if ($userIsLogged) $html .= "<td></td>";
|
||||
if ($userIsAdmin) $html .= "<td></td>";
|
||||
//TODO how will notes be edited? On edit artist? (should there be an editartist?) or on a editnotes?
|
||||
//same question for deletion
|
||||
$html .= "</tr>
|
||||
</table>";
|
||||
|
||||
$page->set_title("Artist");
|
||||
$page->set_heading("Artist");
|
||||
$page->add_block(new Block("Artist", $html, "main", 10));
|
||||
|
||||
$html = "<table id='poolsList' class='zebra'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>";
|
||||
|
||||
if ($userIsLogged)
|
||||
$html .= "<th></th>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<th></th>";
|
||||
|
||||
$html .= " <tr>
|
||||
</thead>
|
||||
|
||||
<tr>
|
||||
<td class='left'>Name:</td>
|
||||
<td class='left'>".$artist_link."</td>";
|
||||
if ($userIsLogged) $html .= "<td></td>";
|
||||
if ($userIsAdmin) $html .= "<td></td>";
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($aliases) > 0)
|
||||
{
|
||||
$aliasViewLink = str_replace("_", " ", $aliases[0]['alias_name']); // no link anymore
|
||||
$aliasEditLink = "<a href='".make_link("artist/alias/edit/".$aliases[0]['alias_id'])."'>Edit</a>";
|
||||
$aliasDeleteLink = "<a href='".make_link("artist/alias/delete/".$aliases[0]['alias_id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'>Aliases:</td>
|
||||
<td class='left'>".$aliasViewLink."</td>";
|
||||
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$aliasEditLink."</td>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$aliasDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($aliases) > 1)
|
||||
{
|
||||
for ($i = 1; $i < count($aliases); $i++)
|
||||
{
|
||||
$aliasViewLink = str_replace("_", " ", $aliases[$i]['alias_name']); // no link anymore
|
||||
$aliasEditLink = "<a href='".make_link("artist/alias/edit/".$aliases[$i]['alias_id'])."'>Edit</a>";
|
||||
$aliasDeleteLink = "<a href='".make_link("artist/alias/delete/".$aliases[$i]['alias_id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'> </td>
|
||||
<td class='left'>".$aliasViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$aliasEditLink."</td>";
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$aliasDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($members) > 0)
|
||||
{
|
||||
$memberViewLink = str_replace("_", " ", $members[0]['name']); // no link anymore
|
||||
$memberEditLink = "<a href='".make_link("artist/member/edit/".$members[0]['id'])."'>Edit</a>";
|
||||
$memberDeleteLink = "<a href='".make_link("artist/member/delete/".$members[0]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'>Members:</td>
|
||||
<td class='left'>".$memberViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$memberEditLink."</td>";
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$memberDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($members) > 1)
|
||||
{
|
||||
for ($i = 1; $i < count($members); $i++)
|
||||
{
|
||||
$memberViewLink = str_replace("_", " ", $members[$i]['name']); // no link anymore
|
||||
$memberEditLink = "<a href='".make_link("artist/member/edit/".$members[$i]['id'])."'>Edit</a>";
|
||||
$memberDeleteLink = "<a href='".make_link("artist/member/delete/".$members[$i]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'> </td>
|
||||
<td class='left'>".$memberViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$memberEditLink."</td>";
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$memberDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($urls) > 0)
|
||||
{
|
||||
$urlViewLink = "<a href='".str_replace("_", " ", $urls[0]['url'])."' target='_blank'>".str_replace("_", " ", $urls[0]['url'])."</a>";
|
||||
$urlEditLink = "<a href='".make_link("artist/url/edit/".$urls[0]['id'])."'>Edit</a>";
|
||||
$urlDeleteLink = "<a href='".make_link("artist/url/delete/".$urls[0]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'>URLs:</td>
|
||||
<td class='left'>".$urlViewLink."</td>";
|
||||
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$urlEditLink."</td>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$urlDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
|
||||
if (count($urls) > 1)
|
||||
{
|
||||
for ($i = 1; $i < count($urls); $i++)
|
||||
{
|
||||
$urlViewLink = "<a href='".str_replace("_", " ", $urls[$i]['url'])."' target='_blank'>".str_replace("_", " ", $urls[$i]['url'])."</a>";
|
||||
$urlEditLink = "<a href='".make_link("artist/url/edit/".$urls[$i]['id'])."'>Edit</a>";
|
||||
$urlDeleteLink = "<a href='".make_link("artist/url/delete/".$urls[$i]['id'])."'>Delete</a>";
|
||||
|
||||
$html .= "<tr>
|
||||
<td class='left'> </td>
|
||||
<td class='left'>".$urlViewLink."</td>";
|
||||
if ($userIsLogged)
|
||||
$html .= "<td class='left'>".$urlEditLink."</td>";
|
||||
|
||||
if ($userIsAdmin)
|
||||
$html .= "<td class='left'>".$urlDeleteLink."</td>";
|
||||
|
||||
$html .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html .=
|
||||
"<tr>
|
||||
<td class='left'>Notes:</td>
|
||||
<td class='left'>".$artist["notes"]."</td>";
|
||||
if ($userIsLogged) $html .= "<td></td>";
|
||||
if ($userIsAdmin) $html .= "<td></td>";
|
||||
//TODO how will notes be edited? On edit artist? (should there be an editartist?) or on a editnotes?
|
||||
//same question for deletion
|
||||
$html .= "</tr>
|
||||
</table>";
|
||||
|
||||
$page->set_title("Artist");
|
||||
$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) {
|
||||
|
|
|
@ -31,7 +31,6 @@ class BlotterTheme extends Themelet {
|
|||
* Long function name, but at least I won't confuse it with something else ^_^
|
||||
*/
|
||||
|
||||
$html = "";
|
||||
// Add_new stuff goes here.
|
||||
$table_header = "
|
||||
<tr>
|
||||
|
@ -134,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'];
|
||||
|
@ -145,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;";
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class BulkAdd extends Extension {
|
|||
public function onCommand(CommandEvent $event) {
|
||||
if($event->cmd == "help") {
|
||||
print " bulk-add [directory]\n";
|
||||
print " Import this directory\n\n";
|
||||
print " Import this directory\n\n";
|
||||
}
|
||||
if($event->cmd == "bulk-add") {
|
||||
if(count($event->args) == 1) {
|
||||
|
@ -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;
|
||||
|
|
|
@ -33,7 +33,7 @@ class BulkAddCSV extends Extension {
|
|||
public function onCommand(CommandEvent $event) {
|
||||
if($event->cmd == "help") {
|
||||
print " bulk-add-csv [/path/to.csv]\n";
|
||||
print " Import this .csv file (refer to documentation)\n\n";
|
||||
print " Import this .csv file (refer to documentation)\n\n";
|
||||
}
|
||||
if($event->cmd == "bulk-add-csv") {
|
||||
global $user;
|
||||
|
@ -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>
|
||||
|
|
|
@ -14,7 +14,7 @@ require_once "lib/akismet.class.php";
|
|||
class CommentPostingEvent extends Event {
|
||||
var $image_id, $user, $comment;
|
||||
|
||||
public function CommentPostingEvent($image_id, $user, $comment) {
|
||||
public function __construct($image_id, $user, $comment) {
|
||||
$this->image_id = $image_id;
|
||||
$this->user = $user;
|
||||
$this->comment = $comment;
|
||||
|
@ -29,7 +29,7 @@ class CommentPostingEvent extends Event {
|
|||
class CommentDeletionEvent extends Event {
|
||||
var $comment_id;
|
||||
|
||||
public function CommentDeletionEvent($comment_id) {
|
||||
public function __construct($comment_id) {
|
||||
$this->comment_id = $comment_id;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,11 @@ class CommentDeletionEvent extends Event {
|
|||
class CommentPostingException extends SCoreException {}
|
||||
|
||||
class Comment {
|
||||
public function Comment($row) {
|
||||
var $owner, $owner_id, $owner_name, $owner_email, $owner_class;
|
||||
var $comment, $comment_id;
|
||||
var $image_id, $poster_ip, $posted;
|
||||
|
||||
public function __construct($row) {
|
||||
$this->owner = null;
|
||||
$this->owner_id = $row['user_id'];
|
||||
$this->owner_name = $row['user_name'];
|
||||
|
|
|
@ -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");
|
||||
|
@ -437,4 +415,4 @@ class CronUploader extends Extension {
|
|||
file_put_contents ($log_path, $content);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -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,8 +21,9 @@ function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) {
|
|||
class ExtensionInfo {
|
||||
var $ext_name, $name, $link, $author, $email;
|
||||
var $description, $documentation, $version, $visibility;
|
||||
var $enabled;
|
||||
|
||||
function ExtensionInfo($main) {
|
||||
function __construct($main) {
|
||||
$matches = array();
|
||||
$lines = file($main);
|
||||
$number_of_lines = count($lines);
|
||||
|
@ -131,7 +132,7 @@ class ExtManager extends Extension {
|
|||
public function onCommand(CommandEvent $event) {
|
||||
if($event->cmd == "help") {
|
||||
print " disable-all-ext\n";
|
||||
print " disable all extensions\n\n";
|
||||
print " disable all extensions\n\n";
|
||||
}
|
||||
if($event->cmd == "disable-all-ext") {
|
||||
$this->write_config(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();
|
||||
|
|
|
@ -17,7 +17,6 @@ class ExtManagerTheme extends Themelet {
|
|||
</thead>
|
||||
<tbody>
|
||||
";
|
||||
$n = 0;
|
||||
foreach($extensions as $extension) {
|
||||
if(!$editable && $extension->visibility == "admin") continue;
|
||||
|
||||
|
@ -53,7 +52,6 @@ class ExtManagerTheme extends Themelet {
|
|||
/*
|
||||
public function display_blocks(Page $page, $extensions) {
|
||||
global $user;
|
||||
$n = 0;
|
||||
$col_1 = "";
|
||||
$col_2 = "";
|
||||
foreach($extensions as $extension) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
class FavoriteSetEvent extends Event {
|
||||
var $image_id, $user, $do_set;
|
||||
|
||||
public function FavoriteSetEvent(/*int*/ $image_id, User $user, /*boolean*/ $do_set) {
|
||||
public function __construct(/*int*/ $image_id, User $user, /*boolean*/ $do_set) {
|
||||
assert(is_numeric($image_id));
|
||||
assert(is_bool($do_set));
|
||||
|
||||
|
@ -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")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,16 +148,14 @@ class Favorites extends Extension {
|
|||
if($config->get_int("ext_favorites_version") < 1) {
|
||||
$database->Execute("ALTER TABLE images ADD COLUMN favorites INTEGER NOT NULL DEFAULT 0");
|
||||
$database->Execute("CREATE INDEX images__favorites ON images(favorites)");
|
||||
$database->Execute("
|
||||
CREATE TABLE user_favorites (
|
||||
$database->create_table("user_favorites", "
|
||||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
created_at SCORE_DATETIME NOT NULL,
|
||||
UNIQUE(image_id, user_id),
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||
)
|
||||
");
|
||||
");
|
||||
$database->execute("CREATE INDEX user_favorites_image_id_idx ON user_favorites(image_id)", array());
|
||||
$config->set_int("ext_favorites_version", 1);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ class Forum extends Extension {
|
|||
sticky SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date DATETIME NOT NULL,
|
||||
uptodate DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
uptodate SCORE_DATETIME NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT
|
||||
");
|
||||
$database->execute("CREATE INDEX forum_threads_date_idx ON forum_threads(date)", array());
|
||||
|
@ -37,7 +37,7 @@ class Forum extends Extension {
|
|||
id SCORE_AIPK,
|
||||
thread_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
message TEXT,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
FOREIGN KEY (thread_id) REFERENCES forum_threads (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
@ -330,7 +330,7 @@ class Forum extends Extension {
|
|||
private function save_new_thread($user)
|
||||
{
|
||||
$title = html_escape($_POST["title"]);
|
||||
$sticky = html_escape($_POST["sticky"]);
|
||||
$sticky = !empty($_POST["sticky"]) ? html_escape($_POST["sticky"]) : "N";
|
||||
|
||||
if($sticky == ""){
|
||||
$sticky = "N";
|
||||
|
@ -344,11 +344,11 @@ class Forum extends Extension {
|
|||
(?, ?, ?, now(), now())",
|
||||
array($title, $sticky, $user->id));
|
||||
|
||||
$result = $database->get_row("SELECT LAST_INSERT_ID() AS threadID", array());
|
||||
$threadID = $database->get_last_insert_id("forum_threads_id_seq");
|
||||
|
||||
log_info("forum", "Thread {$result["threadID"]} created by {$user->name}");
|
||||
log_info("forum", "Thread {$threadID} created by {$user->name}");
|
||||
|
||||
return $result["threadID"];
|
||||
return $threadID;
|
||||
}
|
||||
|
||||
private function save_new_post($threadID, $user)
|
||||
|
@ -367,9 +367,9 @@ class Forum extends Extension {
|
|||
(?, ?, now(), ?)"
|
||||
, array($threadID, $userID, $message));
|
||||
|
||||
$result = $database->get_row("SELECT LAST_INSERT_ID() AS postID", array());
|
||||
$postID = $database->get_last_insert_id("forum_posts_id_seq");
|
||||
|
||||
log_info("forum", "Post {$result["postID"]} created by {$user->name}");
|
||||
log_info("forum", "Post {$postID} created by {$user->name}");
|
||||
|
||||
$database->execute("UPDATE forum_threads SET uptodate=now() WHERE id=?", array ($threadID));
|
||||
}
|
||||
|
|
|
@ -83,9 +83,7 @@ class ForumTheme extends Themelet {
|
|||
global $config, $page/*, $user*/;
|
||||
|
||||
$posts_per_page = $config->get_int('forumPostsPerPage');
|
||||
$theme_name = $config->get_string('theme');
|
||||
|
||||
$html = "";
|
||||
$current_post = 0;
|
||||
|
||||
$html =
|
||||
|
|
|
@ -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,26 +17,17 @@ class FlashFileHandler extends DataHandlerExtension {
|
|||
}
|
||||
|
||||
protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
$image->filesize = $metadata['size'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->filename = $metadata['filename'];
|
||||
$image->ext = $metadata['extension'];
|
||||
$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,22 +14,20 @@ 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];
|
||||
|
||||
$image->filesize = $metadata['size'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->hash = $metadata['hash'];
|
||||
$image->filename = (($pos = strpos($metadata['filename'],'?')) !== false) ? substr($metadata['filename'],0,$pos) : $metadata['filename'];
|
||||
$image->ext = (($pos = strpos($metadata['extension'],'?')) !== false) ? substr($metadata['extension'],0,$pos) : $metadata['extension'];
|
||||
$image->ext = (($pos = strpos($metadata['extension'],'?')) !== false) ? substr($metadata['extension'],0,$pos) : $metadata['extension'];
|
||||
$image->tag_array = Tag::explode($metadata['tags']);
|
||||
$image->source = $metadata['source'];
|
||||
$image->source = $metadata['source'];
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -88,7 +86,7 @@ class SVGFileHandler extends Extension {
|
|||
class MiniSVGParser {
|
||||
var $valid=false, $width=0, $height=0;
|
||||
|
||||
function MiniSVGParser($file) {
|
||||
function __construct($file) {
|
||||
$xml_parser = xml_parser_create();
|
||||
xml_set_element_handler($xml_parser, array($this, "startElement"), array($this, "endElement"));
|
||||
$this->valid = xml_parse($xml_parser, file_get_contents($file), true);
|
||||
|
|
|
@ -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,9 +20,9 @@ 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 ImageAdditionEvent(Image $image) {
|
||||
public function __construct(Image $image) {
|
||||
$this->image = $image;
|
||||
}
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ 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 ImageDeletionEvent(Image $image) {
|
||||
public function __construct(Image $image) {
|
||||
$this->image = $image;
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class ImageReplaceEvent extends Event {
|
|||
* @param $image
|
||||
* The image object of the new image to use
|
||||
*/
|
||||
public function ImageReplaceEvent(/*int*/ $id, Image $image) {
|
||||
public function __construct(/*int*/ $id, Image $image) {
|
||||
$this->id = $id;
|
||||
$this->image = $image;
|
||||
}
|
||||
|
@ -93,10 +93,11 @@ 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 ThumbnailGenerationEvent($hash, $type, $force=false) {
|
||||
public function __construct($hash, $type, $force=false) {
|
||||
$this->hash = $hash;
|
||||
$this->type = $type;
|
||||
$this->force = $force;
|
||||
|
@ -113,7 +114,7 @@ class ThumbnailGenerationEvent extends Event {
|
|||
class ParseLinkTemplateEvent extends Event {
|
||||
var $link, $original, $image;
|
||||
|
||||
public function ParseLinkTemplateEvent($link, Image $image) {
|
||||
public function __construct($link, Image $image) {
|
||||
$this->link = $link;
|
||||
$this->original = $link;
|
||||
$this->image = $image;
|
||||
|
@ -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;
|
||||
|
||||
/*
|
||||
|
@ -325,7 +323,7 @@ class ImageIO extends Extension {
|
|||
)",
|
||||
array(
|
||||
"owner_id"=>$user->id, "owner_ip"=>$_SERVER['REMOTE_ADDR'], "filename"=>substr($image->filename, 0, 60), "filesize"=>$image->filesize,
|
||||
"hash"=>$image->hash, "ext"=>$image->ext, "width"=>$image->width, "height"=>$image->height, "source"=>$image->source
|
||||
"hash"=>$image->hash, "ext"=>strtolower($image->ext), "width"=>$image->width, "height"=>$image->height, "source"=>$image->source
|
||||
)
|
||||
);
|
||||
$image->id = $database->get_last_insert_id('images_id_seq');
|
||||
|
@ -401,11 +399,8 @@ 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);
|
||||
|
||||
|
@ -435,7 +430,7 @@ class ImageIO extends Extension {
|
|||
",
|
||||
array(
|
||||
"filename"=>$image->filename, "filesize"=>$image->filesize, "hash"=>$image->hash,
|
||||
"ext"=>$image->ext, "width"=>$image->width, "height"=>$image->height, "source"=>$image->source,
|
||||
"ext"=>strtolower($image->ext), "width"=>$image->width, "height"=>$image->height, "source"=>$image->source,
|
||||
"id"=>$id
|
||||
)
|
||||
);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class RemoveImageHashBanEvent extends Event {
|
||||
var $hash;
|
||||
|
||||
public function RemoveImageHashBanEvent($hash) {
|
||||
public function __construct($hash) {
|
||||
$this->hash = $hash;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class AddImageHashBanEvent extends Event {
|
|||
var $hash;
|
||||
var $reason;
|
||||
|
||||
public function AddImageHashBanEvent($hash, $reason) {
|
||||
public function __construct($hash, $reason) {
|
||||
$this->hash = $hash;
|
||||
$this->reason = $reason;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class ImageBan extends Extension {
|
|||
$database->create_table("image_bans", "
|
||||
id SCORE_AIPK,
|
||||
hash CHAR(32) NOT NULL,
|
||||
date DATETIME DEFAULT SCORE_NOW,
|
||||
date SCORE_DATETIME DEFAULT SCORE_NOW,
|
||||
reason TEXT NOT NULL
|
||||
");
|
||||
$config->set_int("ext_imageban_version", 1);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -94,6 +94,10 @@
|
|||
* <li>order=width -- find all images sorted from highest > lowest width
|
||||
* <li>order=filesize_asc -- find all images sorted from lowest > highest filesize
|
||||
* </ul>
|
||||
* <li>order=random_####, eg
|
||||
* <ul>
|
||||
* <li>order=random_8547 -- find all images sorted randomly using 8547 as a seed
|
||||
* </ul>
|
||||
* </ul>
|
||||
* <p>Search items can be combined to search for images which match both,
|
||||
* or you can stick "-" in front of an item to search for things that don't
|
||||
|
@ -159,7 +163,7 @@ class SearchTermParseEvent extends Event {
|
|||
var $context = null;
|
||||
var $querylets = array();
|
||||
|
||||
public function SearchTermParseEvent($term, $context) {
|
||||
public function __construct($term, $context) {
|
||||
$this->term = $term;
|
||||
$this->context = $context;
|
||||
}
|
||||
|
@ -362,7 +366,15 @@ class Index extends Extension {
|
|||
$ord = strtolower($matches[1]);
|
||||
$default_order_for_column = preg_match("/^(id|filename)$/", $matches[1]) ? "ASC" : "DESC";
|
||||
$sort = isset($matches[2]) ? strtoupper($matches[2]) : $default_order_for_column;
|
||||
$order_sql = "$ord $sort";
|
||||
$order_sql = "images.$ord $sort";
|
||||
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
|
||||
}
|
||||
else if(preg_match("/^order[=|:]random[_]([0-9]{1,4})$/i", $event->term, $matches)){
|
||||
global $order_sql;
|
||||
//order[=|:]random requires a seed to avoid duplicates
|
||||
//since the tag can't be changed during the parseevent, we instead generate the seed during submit using js
|
||||
$seed = $matches[1];
|
||||
$order_sql = "RAND($seed)";
|
||||
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,18 @@ $(function() {
|
|||
function() {$('.shm-image-list').show();}
|
||||
);
|
||||
}
|
||||
|
||||
//Generate a random seed when using order:random
|
||||
$('form > input[placeholder="Search"]').parent().submit(function(e){
|
||||
var input = $('form > input[placeholder="Search"]');
|
||||
var tagArr = input.val().split(" ");
|
||||
|
||||
var rand = (($.inArray("order:random", tagArr) + 1) || ($.inArray("order=random", tagArr) + 1)) - 1;
|
||||
if(rand !== -1){
|
||||
tagArr[rand] = "order:random_"+Math.floor((Math.random()*9999)+1);
|
||||
input.val(tagArr.join(" "));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function select_blocked_tags() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
class RemoveIPBanEvent extends Event {
|
||||
var $id;
|
||||
|
||||
public function RemoveIPBanEvent($id) {
|
||||
public function __construct($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class AddIPBanEvent extends Event {
|
|||
var $reason;
|
||||
var $end;
|
||||
|
||||
public function AddIPBanEvent(/*string(ip)*/ $ip, /*string*/ $reason, /*string*/ $end) {
|
||||
public function __construct(/*string(ip)*/ $ip, /*string*/ $reason, /*string*/ $end) {
|
||||
$this->ip = trim($ip);
|
||||
$this->reason = trim($reason);
|
||||
$this->end = trim($end);
|
||||
|
@ -130,8 +130,8 @@ class IPBan extends Extension {
|
|||
$database->Execute("CREATE TABLE bans (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ip char(15) default NULL,
|
||||
date datetime default NULL,
|
||||
end datetime default NULL,
|
||||
date SCORE_DATETIME default NULL,
|
||||
end SCORE_DATETIME default NULL,
|
||||
reason varchar(255) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
)");
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ class MassTagger extends Extension {
|
|||
}
|
||||
|
||||
$page->set_mode("redirect");
|
||||
if(!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = make_link();
|
||||
$page->set_redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -20,7 +20,7 @@ class Notes extends Extension {
|
|||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
user_ip CHAR(15) NOT NULL,
|
||||
date DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
x1 INTEGER NOT NULL,
|
||||
y1 INTEGER NOT NULL,
|
||||
height INTEGER NOT NULL,
|
||||
|
@ -35,7 +35,7 @@ class Notes extends Extension {
|
|||
id SCORE_AIPK,
|
||||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
date DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||
");
|
||||
|
@ -49,7 +49,7 @@ class Notes extends Extension {
|
|||
image_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
user_ip CHAR(15) NOT NULL,
|
||||
date DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
x1 INTEGER NOT NULL,
|
||||
y1 INTEGER NOT NULL,
|
||||
height INTEGER NOT NULL,
|
||||
|
@ -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'];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
class NotesTheme extends Themelet {
|
||||
public function note_button($image_id) {
|
||||
public function note_button($image_id) {
|
||||
return '
|
||||
<!-- <a href="#" id="addnotelink" >Add a note</a> -->
|
||||
<form action="" method="">
|
||||
|
@ -39,32 +39,32 @@ class NotesTheme extends Themelet {
|
|||
|
||||
$page->set_title(html_escape("Search Note"));
|
||||
$page->set_heading(html_escape("Search Note"));
|
||||
$page->add_block(new Block("Search Note", $html, "main", 10));
|
||||
$page->add_block(new Block("Search Note", $html, "main", 10));
|
||||
}
|
||||
|
||||
// check action POST on form
|
||||
// check action POST on form
|
||||
public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions)
|
||||
{
|
||||
$to_json = array();
|
||||
foreach($recovered_notes as $note)
|
||||
{
|
||||
$parsedNote = $note["note"];
|
||||
$parsedNote = str_replace("\n", "\\n", $parsedNote);
|
||||
$parsedNote = str_replace("\r", "\\r", $parsedNote);
|
||||
foreach($recovered_notes as $note)
|
||||
{
|
||||
$parsedNote = $note["note"];
|
||||
$parsedNote = str_replace("\n", "\\n", $parsedNote);
|
||||
$parsedNote = str_replace("\r", "\\r", $parsedNote);
|
||||
|
||||
$to_json[] = array(
|
||||
$to_json[] = array(
|
||||
'x1' => $note["x1"],
|
||||
'y1' => $note["y1"],
|
||||
'height' => $note["height"],
|
||||
'width' => $note["width"],
|
||||
'note' => $parsedNote,
|
||||
'note_id' => $note["id"],
|
||||
'y1' => $note["y1"],
|
||||
'height' => $note["height"],
|
||||
'width' => $note["width"],
|
||||
'note' => $parsedNote,
|
||||
'note_id' => $note["id"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$html = "<script type='text/javascript'>";
|
||||
$html .= "notes = " . json_encode($to_json);
|
||||
$html .= "</script>
|
||||
$html .= "</script>
|
||||
|
||||
<div id='noteform'>
|
||||
".make_form(make_link("note/add_note"))."
|
||||
|
@ -88,41 +88,41 @@ class NotesTheme extends Themelet {
|
|||
|
||||
</form>
|
||||
</div>
|
||||
<div id='noteEditForm'>
|
||||
<div id='noteEditForm'>
|
||||
".make_form(make_link("note/edit_note"))."
|
||||
<input type='hidden' name='image_id' value='".$image_id."' />
|
||||
<input type='hidden' name='note_id' id='EditNoteID' value='' />
|
||||
<input name='note_x1' type='hidden' value='' id='EditNoteX1' />
|
||||
<input name='note_y1' type='hidden' value='' id='EditNoteY1' />
|
||||
<input name='note_height' type='hidden' value='' id='EditNoteHeight' />
|
||||
<input name='note_width' type='hidden' value='' id='EditNoteWidth' />
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<textarea name='note_text' id='EditNoteNote' ></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type='submit' value='Save Note' /></td>
|
||||
<td><input type='button' value='Cancel' id='EditCancelNote' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>";
|
||||
<input type='hidden' name='image_id' value='".$image_id."' />
|
||||
<input type='hidden' name='note_id' id='EditNoteID' value='' />
|
||||
<input name='note_x1' type='hidden' value='' id='EditNoteX1' />
|
||||
<input name='note_y1' type='hidden' value='' id='EditNoteY1' />
|
||||
<input name='note_height' type='hidden' value='' id='EditNoteHeight' />
|
||||
<input name='note_width' type='hidden' value='' id='EditNoteWidth' />
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<textarea name='note_text' id='EditNoteNote' ></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type='submit' value='Save Note' /></td>
|
||||
<td><input type='button' value='Cancel' id='EditCancelNote' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>";
|
||||
|
||||
if($adminOptions)
|
||||
$html .= "
|
||||
if($adminOptions)
|
||||
$html .= "
|
||||
".make_form(make_link("note/delete_note"))."
|
||||
<input type='hidden' name='image_id' value='".$image_id."' />
|
||||
<input type='hidden' name='note_id' value='' id='DeleteNoteNoteID' />
|
||||
<table>
|
||||
<tr>
|
||||
<td><input type='submit' value='Delete note' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<input type='hidden' name='image_id' value='".$image_id."' />
|
||||
<input type='hidden' name='note_id' value='' id='DeleteNoteNoteID' />
|
||||
<table>
|
||||
<tr>
|
||||
<td><input type='submit' value='Delete note' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
";
|
||||
|
||||
$html .= "</div>";
|
||||
$html .= "</div>";
|
||||
|
||||
$page->add_block(new Block(null, $html, "main", 1));
|
||||
}
|
||||
|
@ -169,101 +169,71 @@ class NotesTheme extends Themelet {
|
|||
$page->set_heading("Note Requests");
|
||||
$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>".
|
||||
"<th>Image</th>".
|
||||
"<th>Note</th>".
|
||||
"<th>Body</th>".
|
||||
"<th>Updater</th>".
|
||||
"<th>Date</th>";
|
||||
|
||||
|
||||
"<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;
|
||||
"<tbody>";
|
||||
|
||||
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>";
|
||||
|
||||
"<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>";
|
||||
|
||||
|
||||
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));
|
||||
|
||||
|
||||
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
|
||||
}
|
||||
|
||||
public function display_history($histories, $pageNumber, $totalPages) {
|
||||
global $user, $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>";
|
||||
|
||||
global $page;
|
||||
|
||||
$html = $this->get_history($histories);
|
||||
|
||||
$page->set_title("Note History");
|
||||
$page->set_heading("Note History");
|
||||
$page->add_block(new Block("Note History", $html, "main", 10));
|
||||
|
||||
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class NumericScoreSetEvent extends Event {
|
||||
var $image_id, $user, $score;
|
||||
|
||||
public function NumericScoreSetEvent(/*int*/ $image_id, User $user, /*int*/ $score) {
|
||||
public function __construct(/*int*/ $image_id, User $user, /*int*/ $score) {
|
||||
$this->image_id = $image_id;
|
||||
$this->user = $user;
|
||||
$this->score = $score;
|
||||
|
@ -237,7 +237,7 @@ class NumericScore extends Extension {
|
|||
global $order_sql;
|
||||
$default_order_for_column = "DESC";
|
||||
$sort = isset($matches[3]) ? strtoupper($matches[3]) : $default_order_for_column;
|
||||
$order_sql = "numeric_score $sort";
|
||||
$order_sql = "images.numeric_score $sort";
|
||||
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -387,9 +387,11 @@ class OuroborosAPI extends Extension
|
|||
// @TODO Should move the validation logic into OuroborosPost instead?
|
||||
if ($user->can("create_image")) {
|
||||
$post = array(
|
||||
'tags' => !empty($_REQUEST['post']['tags']) ? filter_var(
|
||||
urldecode($_REQUEST['post']['tags']),
|
||||
FILTER_SANITIZE_STRING
|
||||
'tags' => !empty($_REQUEST['post']['tags']) ? Tag::implode(
|
||||
array_map(
|
||||
array('Tag', 'sanitise'),
|
||||
Tag::explode(urldecode($_REQUEST['post']['tags']))
|
||||
)
|
||||
) : 'tagme',
|
||||
'file' => !empty($_REQUEST['post']['file']) ? filter_var(
|
||||
$_REQUEST['post']['file'],
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
*/
|
||||
|
||||
class SendPMEvent extends Event {
|
||||
var $pm;
|
||||
|
||||
public function __construct(PM $pm) {
|
||||
$this->pm = $pm;
|
||||
}
|
||||
}
|
||||
|
||||
class PM {
|
||||
var $id, $from_id, $from_ip, $to_id, $sent_date, $subject, $message, $is_read;
|
||||
|
||||
public function __construct($from_id=0, $from_ip="0.0.0.0", $to_id=0, $subject="A Message", $message="Some Text", $read=False) {
|
||||
# PHP: the P stands for "really", the H stands for "awful" and the other P stands for "language"
|
||||
if(is_array($from_id)) {
|
||||
|
@ -53,7 +57,7 @@ class PrivMsg extends Extension {
|
|||
from_id INTEGER NOT NULL,
|
||||
from_ip SCORE_INET NOT NULL,
|
||||
to_id INTEGER NOT NULL,
|
||||
sent_date DATETIME NOT NULL,
|
||||
sent_date SCORE_DATETIME NOT NULL,
|
||||
subject VARCHAR(64) NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
is_read SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
|
|
|
@ -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)";
|
||||
|
|
|
@ -33,7 +33,7 @@ class Pools extends Extension {
|
|||
public SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
description TEXT,
|
||||
date DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
posts INTEGER NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
@ -51,7 +51,7 @@ class Pools extends Extension {
|
|||
action INTEGER NOT NULL,
|
||||
images TEXT,
|
||||
count INTEGER NOT NULL DEFAULT 0,
|
||||
date DATETIME NOT NULL,
|
||||
date SCORE_DATETIME NOT NULL,
|
||||
FOREIGN KEY (pool_id) REFERENCES pools(id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
");
|
||||
|
|
|
@ -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>";
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
class RatingSetEvent extends Event {
|
||||
var $image, $rating;
|
||||
|
||||
public function RatingSetEvent(Image $image, /*char*/ $rating) {
|
||||
public function __construct(Image $image, /*char*/ $rating) {
|
||||
assert(in_array($rating, array("s", "q", "e", "u")));
|
||||
$this->image = $image;
|
||||
$this->rating = $rating;
|
||||
|
|
|
@ -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" : "";
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class RemoveReportedImageEvent extends Event {
|
||||
var $id;
|
||||
|
||||
public function RemoveReportedImageEvent($id) {
|
||||
public function __construct($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class AddReportedImageEvent extends Event {
|
|||
var $image_id;
|
||||
var $reason;
|
||||
|
||||
public function AddReportedImageEvent($image_id, $reporter_id, $reason) {
|
||||
public function __construct($image_id, $reporter_id, $reason) {
|
||||
$this->reporter_id = $reporter_id;
|
||||
$this->image_id = $image_id;
|
||||
$this->reason = $reason;
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -84,7 +84,7 @@ class ResizeImage extends Extension {
|
|||
}
|
||||
if($isanigif == 0){
|
||||
try {
|
||||
$this->resize_image($event->image_id, $width, $height);
|
||||
$this->resize_image($image_obj, $width, $height);
|
||||
} catch (ImageResizeException $e) {
|
||||
$this->theme->display_resize_error($page, "Error Resizing", $e->error);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class ResizeImage extends Extension {
|
|||
// Try to get the image ID
|
||||
$image_id = int_escape($event->get_arg(0));
|
||||
if (empty($image_id)) {
|
||||
$image_id = isset($_POST['image_id']) ? $_POST['image_id'] : null;
|
||||
$image_id = isset($_POST['image_id']) ? int_escape($_POST['image_id']) : null;
|
||||
}
|
||||
if (empty($image_id)) {
|
||||
throw new ImageResizeException("Can not resize Image: No valid Image ID given.");
|
||||
|
@ -134,7 +134,7 @@ class ResizeImage extends Extension {
|
|||
|
||||
/* Attempt to resize the image */
|
||||
try {
|
||||
$this->resize_image($image_id, $width, $height);
|
||||
$this->resize_image($image, $width, $height);
|
||||
|
||||
//$this->theme->display_resize_page($page, $image_id);
|
||||
|
||||
|
@ -157,19 +157,14 @@ class ResizeImage extends Extension {
|
|||
This function could be made much smaller by using the ImageReplaceEvent
|
||||
ie: Pretend that we are replacing the image with a resized copy.
|
||||
*/
|
||||
private function resize_image(/*int*/ $image_id, /*int*/ $width, /*int*/ $height) {
|
||||
private function resize_image(Image $image_obj, /*int*/ $width, /*int*/ $height) {
|
||||
global $config, $user, $page, $database;
|
||||
|
||||
if ( ($height <= 0) && ($width <= 0) ) {
|
||||
throw new ImageResizeException("Invalid options for height and width. ($width x $height)");
|
||||
}
|
||||
|
||||
$image_obj = Image::by_id($image_id);
|
||||
$hash = $image_obj->hash;
|
||||
if (is_null($hash)) {
|
||||
throw new ImageResizeException("Image does not have a hash associated with it.");
|
||||
}
|
||||
|
||||
$image_filename = warehouse_path("images", $hash);
|
||||
$info = getimagesize($image_filename);
|
||||
/* Get the image file type */
|
||||
|
@ -177,7 +172,7 @@ class ResizeImage extends Extension {
|
|||
$filetype = strtolower($pathinfo['extension']);
|
||||
|
||||
if (($image_obj->width != $info[0] ) || ($image_obj->height != $info[1])) {
|
||||
throw new ImageResizeException("The image size does not match what is in the database! - Aborting Resize.");
|
||||
throw new ImageResizeException("The current image size does not match what is set in the database! - Aborting Resize.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -192,7 +187,18 @@ class ResizeImage extends Extension {
|
|||
The factor of 2.5 is simply a rough guideline.
|
||||
http://stackoverflow.com/questions/527532/reasonable-php-memory-limit-for-image-resize
|
||||
*/
|
||||
$memory_use = ($info[0] * $info[1] * ($info['bits'] / 8) * $info['channels'] * 2.5) / 1024;
|
||||
|
||||
if (isset($info['bits']) && isset($info['channels']))
|
||||
{
|
||||
$memory_use = ($info[0] * $info[1] * ($info['bits'] / 8) * $info['channels'] * 2.5) / 1024;
|
||||
} else {
|
||||
//
|
||||
// If we don't have bits and channel info from the image then assume default values
|
||||
// of 8 bits per color and 4 channels (R,G,B,A) -- ie: regular 24-bit color
|
||||
//
|
||||
$memory_use = ($info[0] * $info[1] * 1 * 4 * 2.5) / 1024;
|
||||
}
|
||||
|
||||
$memory_limit = get_memory_limit();
|
||||
|
||||
if ($memory_use > $memory_limit) {
|
||||
|
@ -219,28 +225,41 @@ class ResizeImage extends Extension {
|
|||
case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($image_filename); break;
|
||||
case IMAGETYPE_PNG: $image = imagecreatefrompng($image_filename); break;
|
||||
default:
|
||||
throw new ImageResizeException("Unsupported image type.");
|
||||
throw new ImageResizeException("Unsupported image type (Only GIF, JPEG, and PNG are supported).");
|
||||
}
|
||||
|
||||
/* Resize and resample the image */
|
||||
// Handle transparent images
|
||||
|
||||
$image_resized = imagecreatetruecolor( $new_width, $new_height );
|
||||
|
||||
if ( ($info[2] == IMAGETYPE_GIF) || ($info[2] == IMAGETYPE_PNG) ) {
|
||||
$transparency = imagecolortransparent($image);
|
||||
if ($info[2] == IMAGETYPE_GIF) {
|
||||
$transparency = imagecolortransparent($image);
|
||||
|
||||
if ($transparency >= 0) {
|
||||
$transparent_color = imagecolorsforindex($image, $trnprt_indx);
|
||||
$transparency = imagecolorallocate($image_resized, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']);
|
||||
imagefill($image_resized, 0, 0, $transparency);
|
||||
imagecolortransparent($image_resized, $transparency);
|
||||
}
|
||||
elseif ($info[2] == IMAGETYPE_PNG) {
|
||||
// If we have a specific transparent color
|
||||
if ($transparency >= 0) {
|
||||
// Get the original image's transparent color's RGB values
|
||||
$transparent_color = imagecolorsforindex($image, $transparency);
|
||||
|
||||
// Allocate the same color in the new image resource
|
||||
$transparency = imagecolorallocate($image_resized, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
|
||||
|
||||
// Completely fill the background of the new image with allocated color.
|
||||
imagefill($image_resized, 0, 0, $transparency);
|
||||
|
||||
// Set the background color for new image to transparent
|
||||
imagecolortransparent($image_resized, $transparency);
|
||||
}
|
||||
} elseif ($info[2] == IMAGETYPE_PNG) {
|
||||
//
|
||||
// More info here: http://stackoverflow.com/questions/279236/how-do-i-resize-pngs-with-transparency-in-php
|
||||
//
|
||||
imagealphablending($image_resized, false);
|
||||
$color = imagecolorallocatealpha($image_resized, 0, 0, 0, 127);
|
||||
imagefill($image_resized, 0, 0, $color);
|
||||
imagesavealpha($image_resized, true);
|
||||
}
|
||||
$transparent_color = imagecolorallocatealpha($image_resized, 255, 255, 255, 127);
|
||||
imagefilledrectangle($image_resized, 0, 0, $new_width, $new_height, $transparent_color);
|
||||
}
|
||||
|
||||
// Actually resize the image.
|
||||
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $image_obj->width, $image_obj->height);
|
||||
|
||||
/* Temp storage while we resize */
|
||||
|
@ -255,7 +274,7 @@ class ResizeImage extends Extension {
|
|||
case IMAGETYPE_JPEG: imagejpeg($image_resized, $tmp_filename); break;
|
||||
case IMAGETYPE_PNG: imagepng($image_resized, $tmp_filename); break;
|
||||
default:
|
||||
throw new ImageResizeException("Unsupported image type.");
|
||||
throw new ImageResizeException("Failed to save the new image - Unsupported image type.");
|
||||
}
|
||||
|
||||
/* Move the new image into the main storage location */
|
||||
|
@ -286,11 +305,11 @@ class ResizeImage extends Extension {
|
|||
",
|
||||
array(
|
||||
"filename"=>$new_filename, "filesize"=>$new_size, "hash"=>$new_hash,
|
||||
"width"=>$new_width, "height"=>$new_height, "id"=>$image_id
|
||||
"width"=>$new_width, "height"=>$new_height, "id"=>$image_obj->id
|
||||
)
|
||||
);
|
||||
|
||||
log_info("resize", "Resized Image #{$image_id} - New hash: {$new_hash}");
|
||||
log_info("resize", "Resized Image #{$image_obj->id} - New hash: {$new_hash}");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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'>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
class ConfigSaveEvent extends Event {
|
||||
var $config;
|
||||
|
||||
public function ConfigSaveEvent(Config $config) {
|
||||
public function __construct(Config $config) {
|
||||
$this->config = $config;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class ConfigSaveEvent extends Event {
|
|||
class SetupBuildingEvent extends Event {
|
||||
var $panel;
|
||||
|
||||
public function SetupBuildingEvent(SetupPanel $panel) {
|
||||
public function __construct(SetupPanel $panel) {
|
||||
$this->panel = $panel;
|
||||
}
|
||||
}
|
||||
|
@ -49,10 +49,11 @@ class SetupBlock extends Block {
|
|||
var $header;
|
||||
var $body;
|
||||
|
||||
public function SetupBlock($title) {
|
||||
public function __construct($title) {
|
||||
$this->header = $title;
|
||||
$this->section = "main";
|
||||
$this->position = 50;
|
||||
$this->body = "";
|
||||
}
|
||||
|
||||
public function add_label($text) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -207,7 +207,7 @@ class ShimmieWebTestCase extends SCoreWebTestCase {
|
|||
|
||||
/** @private */
|
||||
class TestFinder extends TestSuite {
|
||||
function TestFinder($hint) {
|
||||
function __construct($hint) {
|
||||
if(strpos($hint, "..") !== FALSE) return;
|
||||
|
||||
// Select the test cases for "All" extensions.
|
||||
|
|
|
@ -10,7 +10,7 @@ class SCoreWebReporter extends HtmlReporter {
|
|||
var $fails;
|
||||
var $exceptions;
|
||||
|
||||
public function SCoreReporter(Page $page) {
|
||||
public function __construct(Page $page) {
|
||||
$this->page = $page;
|
||||
$this->fails = 0;
|
||||
$this->exceptions = 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 --- */
|
||||
|
@ -162,4 +162,4 @@ class XMLSitemap extends Extension {
|
|||
$page->set_data($xml);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -93,7 +93,7 @@ class Source_History extends Extension {
|
|||
user_id INTEGER NOT NULL,
|
||||
user_ip SCORE_INET NOT NULL,
|
||||
source TEXT NOT NULL,
|
||||
date_set DATETIME NOT NULL,
|
||||
date_set SCORE_DATETIME NOT NULL,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
");
|
||||
|
@ -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']));
|
||||
|
|
|
@ -48,6 +48,30 @@ class TagCategories extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
public function onSearchTermParse(SearchTermParseEvent $event) {
|
||||
$matches = array();
|
||||
|
||||
if(preg_match("/^(.+)tags([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9]+)$/i", $event->term, $matches)) {
|
||||
global $database;
|
||||
$type = $matches[1];
|
||||
$cmp = ltrim($matches[2], ":") ?: "=";
|
||||
$count = $matches[3];
|
||||
|
||||
$types = $database->get_col('SELECT category FROM image_tag_categories');
|
||||
if(in_array($type, $types)) {
|
||||
$event->add_querylet(
|
||||
new Querylet("EXISTS (
|
||||
SELECT 1
|
||||
FROM image_tags it
|
||||
LEFT JOIN tags t ON it.tag_id = t.id
|
||||
WHERE images.id = it.image_id
|
||||
GROUP BY image_id
|
||||
HAVING SUM(CASE WHEN t.tag LIKE '$type:%' THEN 1 ELSE 0 END) $cmp $count
|
||||
)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getDict() {
|
||||
global $database;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class OwnerSetEvent extends Event {
|
|||
var $image;
|
||||
var $owner;
|
||||
|
||||
public function OwnerSetEvent(Image $image, User $owner) {
|
||||
public function __construct(Image $image, User $owner) {
|
||||
$this->image = $image;
|
||||
$this->owner = $owner;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class SourceSetEvent extends Event {
|
|||
var $image;
|
||||
var $source;
|
||||
|
||||
public function SourceSetEvent(Image $image, $source) {
|
||||
public function __construct(Image $image, $source) {
|
||||
$this->image = $image;
|
||||
$this->source = $source;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class TagSetEvent extends Event {
|
|||
var $image;
|
||||
var $tags;
|
||||
|
||||
public function TagSetEvent(Image $image, $tags) {
|
||||
public function __construct(Image $image, $tags) {
|
||||
$this->image = $image;
|
||||
$this->tags = Tag::explode($tags);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class LockSetEvent extends Event {
|
|||
var $image;
|
||||
var $locked;
|
||||
|
||||
public function LockSetEvent(Image $image, $locked) {
|
||||
public function __construct(Image $image, $locked) {
|
||||
assert(is_bool($locked));
|
||||
$this->image = $image;
|
||||
$this->locked = $locked;
|
||||
|
@ -109,7 +109,7 @@ class TagTermParseEvent extends Event {
|
|||
var $id = null;
|
||||
var $metatag = false;
|
||||
|
||||
public function TagTermParseEvent($term, $id) {
|
||||
public function __construct($term, $id) {
|
||||
$this->term = $term;
|
||||
$this->id = $id;
|
||||
}
|
||||
|
@ -243,8 +243,8 @@ class TagEdit extends Extension {
|
|||
global $database;
|
||||
global $config;
|
||||
|
||||
$search_set = Tag::explode(strtolower($search));
|
||||
$replace_set = Tag::explode(strtolower($replace));
|
||||
$search_set = Tag::explode(strtolower($search), false);
|
||||
$replace_set = Tag::explode(strtolower($replace), false);
|
||||
|
||||
log_info("tag_edit", "Mass editing tags: '$search' -> '$replace'");
|
||||
|
||||
|
@ -266,17 +266,19 @@ class TagEdit extends Extension {
|
|||
// search returns high-ids first, so we want to look
|
||||
// at images with lower IDs than the previous.
|
||||
$search_forward = $search_set;
|
||||
if($last_id >= 0) $search_forward[] = "id<$last_id";
|
||||
$search_forward[] = "order=id_desc"; //Default order can be changed, so make sure we order high > low ID
|
||||
if($last_id >= 0){
|
||||
$search_forward[] = "id<$last_id";
|
||||
}
|
||||
|
||||
$images = Image::find_images(0, 100, $search_forward);
|
||||
if(count($images) == 0) break;
|
||||
|
||||
foreach($images as $image) {
|
||||
// remove the search'ed tags
|
||||
$before = $image->get_tag_array();
|
||||
$before = array_map('strtolower', $image->get_tag_array());
|
||||
$after = array();
|
||||
foreach($before as $tag) {
|
||||
$tag = strtolower($tag);
|
||||
if(!in_array($tag, $search_set)) {
|
||||
$after[] = $tag;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,9 @@ class TagEditCloud extends Extension {
|
|||
array("tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count));
|
||||
break;
|
||||
case 'r':
|
||||
$relevant_tags = implode(",",array_map(array($database,"escape"),array_diff($image->get_tag_array(),$ignore_tags)));
|
||||
$relevant_tags = array_diff($image->get_tag_array(),$ignore_tags);
|
||||
if(count($relevant_tags) > 0) {
|
||||
$relevant_tags = implode(",",array_map(array($database,"escape"),$relevant_tags));
|
||||
$tag_data = $database->get_all("SELECT t2.tag AS tag, COUNT(image_id) AS count, FLOOR(LN(LN(COUNT(image_id) - :tag_min1 + 1)+1)*150)/200 AS scaled
|
||||
FROM image_tags it1 JOIN image_tags it2 USING(image_id) JOIN tags t1 ON it1.tag_id = t1.id JOIN tags t2 ON it2.tag_id = t2.id
|
||||
WHERE t1.count >= :tag_min2 AND t1.tag IN($relevant_tags) GROUP BY t2.tag ORDER BY count DESC LIMIT :limit",
|
||||
|
|
|
@ -93,7 +93,7 @@ class Tag_History extends Extension {
|
|||
user_id INTEGER NOT NULL,
|
||||
user_ip SCORE_INET NOT NULL,
|
||||
tags TEXT NOT NULL,
|
||||
date_set DATETIME NOT NULL,
|
||||
date_set SCORE_DATETIME NOT NULL,
|
||||
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
");
|
||||
|
@ -103,7 +103,7 @@ class Tag_History extends Extension {
|
|||
|
||||
if($config->get_int("ext_tag_history_version") == 1) {
|
||||
$database->Execute("ALTER TABLE tag_histories ADD COLUMN user_id INTEGER NOT NULL");
|
||||
$database->Execute("ALTER TABLE tag_histories ADD COLUMN date_set DATETIME NOT NULL");
|
||||
$database->Execute($database->scoreql_to_sql("ALTER TABLE tag_histories ADD COLUMN date_set SCORE_DATETIME NOT NULL"));
|
||||
$config->set_int("ext_tag_history_version", 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,16 +45,19 @@ class TagList extends Extension {
|
|||
}
|
||||
$this->theme->display_page($page);
|
||||
}
|
||||
|
||||
if($event->page_matches("api/internal/tag_list/complete")) {
|
||||
else if($event->page_matches("api/internal/tag_list/complete")) {
|
||||
if(!isset($_GET["s"])) return;
|
||||
|
||||
$all = $database->get_all(
|
||||
"SELECT tag FROM tags WHERE tag LIKE :search AND count > 0 LIMIT 10",
|
||||
array("search"=>$_GET["s"]."%"));
|
||||
$limit = 0;
|
||||
$limitSQL = "";
|
||||
$SQLarr = array("search"=>$_GET["s"]."%");
|
||||
if(isset($_GET["limit"]) && $_GET["limit"] !== 0){
|
||||
$limitSQL = "LIMIT :limit";
|
||||
$SQLarr['limit'] = $_GET["limit"];
|
||||
}
|
||||
|
||||
$res = array();
|
||||
foreach($all as $row) {$res[] = $row["tag"];}
|
||||
$res = $database->get_col(
|
||||
"SELECT tag FROM tags WHERE tag LIKE :search AND count > 0 $limitSQL", $SQLarr);
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("text/plain");
|
||||
|
|
|
@ -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>";
|
||||
|
|
|
@ -75,6 +75,22 @@ class Upgrade extends Extension {
|
|||
log_info("upgrade", "Database at version 11");
|
||||
$config->set_bool("in_upgrade", false);
|
||||
}
|
||||
|
||||
if($config->get_int("db_version") < 12) {
|
||||
$config->set_bool("in_upgrade", true);
|
||||
$config->set_int("db_version", 12);
|
||||
|
||||
if($database->get_driver_name() == 'pgsql') {
|
||||
log_info("upgrade", "Changing ext column to VARCHAR");
|
||||
$database->execute("ALTER TABLE images ALTER COLUMN ext SET DATA TYPE VARCHAR(4)");
|
||||
}
|
||||
|
||||
log_info("upgrade", "Lowering case of all exts");
|
||||
$database->execute("UPDATE images SET ext = LOWER(ext)");
|
||||
|
||||
log_info("upgrade", "Database at version 12");
|
||||
$config->set_bool("in_upgrade", false);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_priority() {return 5;}
|
||||
|
|
|
@ -19,7 +19,7 @@ class DataUploadEvent extends Event {
|
|||
* @param $tmpname The temporary file used for upload.
|
||||
* @param $metadata Info about the file, should contain at least "filename", "extension", "tags" and "source".
|
||||
*/
|
||||
public function DataUploadEvent(/*string*/ $tmpname, /*array*/ $metadata) {
|
||||
public function __construct(/*string*/ $tmpname, /*array*/ $metadata) {
|
||||
assert(file_exists($tmpname));
|
||||
|
||||
$this->tmpname = $tmpname;
|
||||
|
@ -49,6 +49,7 @@ class Upload extends Extension {
|
|||
global $config;
|
||||
$config->set_default_int('upload_count', 3);
|
||||
$config->set_default_int('upload_size', '1MB');
|
||||
$config->set_default_bool('upload_tlsource', TRUE);
|
||||
|
||||
// SHIT: fucking PHP "security" measures -_-;;;
|
||||
$free_num = @disk_free_space(realpath("./images/"));
|
||||
|
@ -90,6 +91,7 @@ class Upload extends Extension {
|
|||
$sb->add_shorthand_int_option("upload_size", "<br/>Max size per file: ");
|
||||
$sb->add_label("<i>PHP Limit = ".ini_get('upload_max_filesize')."</i>");
|
||||
$sb->add_choice_option("transload_engine", $tes, "<br/>Transload: ");
|
||||
$sb->add_bool_option("upload_tlsource", "<br/>Use transloaded URL as source if none is provided: ");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
|
@ -350,7 +352,7 @@ class Upload extends Extension {
|
|||
$metadata['filename'] = $filename;
|
||||
$metadata['extension'] = getExtension($headers['Content-Type']) ?: $pathinfo['extension'];
|
||||
$metadata['tags'] = $tags;
|
||||
$metadata['source'] = $source;
|
||||
$metadata['source'] = (($url == $source) && !$config->get_bool('upload_tlsource') ? "" : $source);
|
||||
|
||||
/* check for locked > adds to metadata if it has */
|
||||
if(!empty($locked)){
|
||||
|
|
|
@ -31,7 +31,7 @@ class ImageInfoBoxBuildingEvent extends Event {
|
|||
var $image;
|
||||
var $user;
|
||||
|
||||
public function ImageInfoBoxBuildingEvent(Image $image, User $user) {
|
||||
public function __construct(Image $image, User $user) {
|
||||
$this->image = $image;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class ImageInfoBoxBuildingEvent extends Event {
|
|||
class ImageInfoSetEvent extends Event {
|
||||
var $image;
|
||||
|
||||
public function ImageInfoSetEvent(Image $image) {
|
||||
public function __construct(Image $image) {
|
||||
$this->image = $image;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class ImageAdminBlockBuildingEvent extends Event {
|
|||
var $image = null;
|
||||
var $user = null;
|
||||
|
||||
public function ImageAdminBlockBuildingEvent(Image $image, User $user) {
|
||||
public function __construct(Image $image, User $user) {
|
||||
$this->image = $image;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
@ -70,11 +70,7 @@ class ViewImage extends Extension {
|
|||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $page, $user;
|
||||
|
||||
if(
|
||||
$event->page_matches("post/prev") ||
|
||||
$event->page_matches("post/next")
|
||||
) {
|
||||
|
||||
if($event->page_matches("post/prev") || $event->page_matches("post/next")) {
|
||||
$image_id = int_escape($event->get_arg(0));
|
||||
|
||||
if(isset($_GET['search'])) {
|
||||
|
@ -107,8 +103,7 @@ class ViewImage extends Extension {
|
|||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/{$image->id}", $query));
|
||||
}
|
||||
|
||||
if($event->page_matches("post/view")) {
|
||||
else if($event->page_matches("post/view")) {
|
||||
$image_id = int_escape($event->get_arg(0));
|
||||
|
||||
$image = Image::by_id($image_id);
|
||||
|
@ -124,8 +119,7 @@ class ViewImage extends Extension {
|
|||
$this->theme->display_error(404, "Image not found", "No image in the database has the ID #$image_id");
|
||||
}
|
||||
}
|
||||
|
||||
if($event->page_matches("post/set")) {
|
||||
else if($event->page_matches("post/set")) {
|
||||
if(!isset($_POST['image_id'])) return;
|
||||
|
||||
$image_id = int_escape($_POST['image_id']);
|
||||
|
|
|
@ -12,7 +12,7 @@ class WikiUpdateEvent extends Event {
|
|||
var $user;
|
||||
var $wikipage;
|
||||
|
||||
public function WikiUpdateEvent(User $user, WikiPage $wikipage) {
|
||||
public function __construct(User $user, WikiPage $wikipage) {
|
||||
$this->user = $user;
|
||||
$this->wikipage = $wikipage;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class WikiPage {
|
|||
var $locked;
|
||||
var $body;
|
||||
|
||||
public function WikiPage($row) {
|
||||
public function __construct($row) {
|
||||
assert(!empty($row));
|
||||
|
||||
$this->id = $row['id'];
|
||||
|
@ -63,7 +63,7 @@ class Wiki extends Extension {
|
|||
id SCORE_AIPK,
|
||||
owner_id INTEGER NOT NULL,
|
||||
owner_ip SCORE_INET NOT NULL,
|
||||
date DATETIME DEFAULT NULL,
|
||||
date SCORE_DATETIME DEFAULT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
revision INTEGER NOT NULL DEFAULT 1,
|
||||
locked SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
|
@ -157,7 +157,7 @@ class Wiki extends Extension {
|
|||
global $database;
|
||||
$wpage = $event->wikipage;
|
||||
try {
|
||||
$row = $database->Execute("
|
||||
$database->Execute("
|
||||
INSERT INTO wiki_pages(owner_id, owner_ip, date, title, revision, locked, body)
|
||||
VALUES (?, ?, now(), ?, ?, ?, ?)", array($event->user->id, $_SERVER['REMOTE_ADDR'],
|
||||
$wpage->title, $wpage->rev, $wpage->locked?'Y':'N', $wpage->body));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -8,17 +8,20 @@ $(document).ready(function() {
|
|||
//TODO: Possibly move to using TextExtJS for autocomplete? - http://textextjs.com/
|
||||
// Also use autocomplete in tag box?
|
||||
$('.autocomplete_tags').autocomplete(base_href + '/api/internal/tag_list/complete', {
|
||||
width: 320,
|
||||
max: 15,
|
||||
highlight: false,
|
||||
multiple: true,
|
||||
multipleSeparator: ' ',
|
||||
scroll: true,
|
||||
scrollHeight: 300,
|
||||
selectFirst: false,
|
||||
//extraParams: {limit: 10},
|
||||
queryParamName: 's',
|
||||
delay: 150,
|
||||
minChars: 1
|
||||
minChars: 1,
|
||||
delay: 0,
|
||||
useCache: true,
|
||||
maxCacheLength: 10,
|
||||
matchInside: false,
|
||||
selectFirst: true,
|
||||
selectOnly: false,
|
||||
preventDefaultReturn: 1,
|
||||
preventDefaultTab: 1,
|
||||
useDelimiter: true,
|
||||
delimiterChar : " ",
|
||||
delimiterKeyCode : 48
|
||||
});
|
||||
|
||||
$("TABLE.sortable").tablesorter();
|
||||
|
|
|
@ -231,8 +231,8 @@ $header_html
|
|||
Images © their respective owners,
|
||||
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
||||
<a href="http://www.shishnet.org/">Shish</a> &
|
||||
<a href="https://github.com/shish/shimmie2/contributors">The Team</a>
|
||||
2007-2012,
|
||||
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
||||
2007-2014,
|
||||
based on the Danbooru concept.
|
||||
$debug
|
||||
$contact
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -254,11 +254,11 @@ $header_html
|
|||
</article>
|
||||
<footer><div>
|
||||
Running Shimmie –
|
||||
Images © their respective owners –
|
||||
Images © their respective owners,
|
||||
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
||||
<a href="http://www.shishnet.org/">Shish</a> &
|
||||
<a href="https://github.com/shish/shimmie2/contributors">The Team</a>
|
||||
2007-2012,
|
||||
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
||||
2007-2014,
|
||||
based on the Danbooru concept<br />
|
||||
$debug
|
||||
$contact
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -83,8 +83,8 @@ $header_html
|
|||
Images © their respective owners,
|
||||
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
||||
<a href="http://www.shishnet.org/">Shish</a> &
|
||||
<a href="https://github.com/shish/shimmie2/contributors">The Team</a>
|
||||
2007-2012,
|
||||
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
||||
2007-2014,
|
||||
based on the Danbooru concept.
|
||||
$debug
|
||||
$contact
|
||||
|
|
|
@ -56,7 +56,7 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||
}
|
||||
|
||||
|
||||
protected function comment_to_html(Comment $comment, $trim=false) {
|
||||
protected function comment_to_html($comment, $trim=false) {
|
||||
$inner_id = $this->inner_id; // because custom themes can't add params, because PHP
|
||||
global $user;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Layout {
|
||||
function display_page($page) {
|
||||
function display_page(Page $page) {
|
||||
global $config;
|
||||
|
||||
$theme_name = $config->get_string('theme', 'default');
|
||||
|
@ -90,8 +90,8 @@ $header_html
|
|||
Images © their respective owners,
|
||||
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
||||
<a href="http://www.shishnet.org/">Shish</a> &
|
||||
<a href="https://github.com/shish/shimmie2/contributors">The Team</a>
|
||||
2007-2012,
|
||||
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
||||
2007-2014,
|
||||
based on the Danbooru concept.
|
||||
<br>Futaba theme based on 4chan's layout and CSS :3
|
||||
$debug
|
||||
|
|
|
@ -75,7 +75,6 @@ class Layout {
|
|||
}
|
||||
|
||||
$custom_sublinks = "<div class='sbar'>";
|
||||
$cs = null;
|
||||
// hack
|
||||
global $user;
|
||||
$username = url_escape($user->name);
|
||||
|
@ -190,8 +189,8 @@ class Layout {
|
|||
Images © their respective owners,
|
||||
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
||||
<a href="http://www.shishnet.org/">Shish</a> &
|
||||
<a href="https://github.com/shish/shimmie2/contributors">The Team</a>
|
||||
2007-2012,
|
||||
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
||||
2007-2014,
|
||||
based on the Danbooru concept.<br />
|
||||
Lite Theme by <a href="http://seemslegit.com">Zach</a>
|
||||
$debug
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class CustomUserPageTheme extends UserPageTheme {
|
||||
public function display_login_page($page) {
|
||||
public function display_login_page(Page $page) {
|
||||
global $config;
|
||||
$page->set_title("Login");
|
||||
$page->set_heading("Login");
|
||||
|
@ -27,14 +27,14 @@ class CustomUserPageTheme extends UserPageTheme {
|
|||
$page->add_block(new Block("Login", $html, "main", 90));
|
||||
}
|
||||
|
||||
public function display_user_links($page, $user, $parts) {
|
||||
public function display_user_links(Page $page, User $user, $parts) {
|
||||
// no block in this theme
|
||||
}
|
||||
public function display_login_block(Page $page) {
|
||||
// no block in this theme
|
||||
}
|
||||
|
||||
public function display_user_block($page, $user, $parts) {
|
||||
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");
|
||||
|
@ -45,7 +45,7 @@ class CustomUserPageTheme extends UserPageTheme {
|
|||
$page->add_block(new Block("User Links", $html, "user", 90));
|
||||
}
|
||||
|
||||
public function display_signup_page($page) {
|
||||
public function display_signup_page(Page $page) {
|
||||
global $config;
|
||||
$tac = $config->get_string("login_tac", "");
|
||||
|
||||
|
@ -74,7 +74,7 @@ class CustomUserPageTheme extends UserPageTheme {
|
|||
$page->add_block(new Block("Signup", $html));
|
||||
}
|
||||
|
||||
public function display_ip_list($page, $uploads, $comments) {
|
||||
public function display_ip_list(Page $page, $uploads, $comments) {
|
||||
$html = "<table id='ip-history' style='width: 400px;'>";
|
||||
$html .= "<tr><td>Uploaded from: ";
|
||||
foreach($uploads as $ip => $count) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class CustomViewImageTheme extends ViewImageTheme {
|
||||
public function display_page($image, $editor_parts) {
|
||||
public function display_page(Image $image, $editor_parts) {
|
||||
global $page;
|
||||
$metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
|
||||
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
|
||||
|
@ -17,7 +17,7 @@ class CustomViewImageTheme extends ViewImageTheme {
|
|||
$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
|
||||
}
|
||||
|
||||
private function build_stats($image) {
|
||||
private function build_stats(Image $image) {
|
||||
$h_owner = html_escape($image->get_owner()->name);
|
||||
$h_ownerlink = "<a href='".make_link("user/$h_owner")."'>$h_owner</a>";
|
||||
$h_ip = html_escape($image->owner_ip);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue