fix indentation

This commit is contained in:
Shish 2014-04-06 20:47:01 +01:00
parent c8aa3327a1
commit f72bfbb050
18 changed files with 464 additions and 465 deletions

View file

@ -271,13 +271,13 @@ class Database {
/** /**
* Meta info about the database engine * Meta info about the database engine
* @var DBEngine * @var DBEngine
*/ */
private $engine = null; private $engine = null;
/** /**
* The currently active cache engine * The currently active cache engine
* @var CacheEngine * @var CacheEngine
*/ */
public $cache = null; public $cache = null;

View file

@ -140,8 +140,8 @@ abstract class FormatterExtension extends Extension {
*/ */
abstract class DataHandlerExtension extends Extension { abstract class DataHandlerExtension extends Extension {
public function onDataUpload(DataUploadEvent $event) { public function onDataUpload(DataUploadEvent $event) {
$supported_ext = $this->supported_ext($event->type); $supported_ext = $this->supported_ext($event->type);
$check_contents = $this->check_contents($event->tmpname); $check_contents = $this->check_contents($event->tmpname);
if($supported_ext && $check_contents) { if($supported_ext && $check_contents) {
if(!move_upload_to_archive($event)) return; if(!move_upload_to_archive($event)) return;
send_event(new ThumbnailGenerationEvent($event->hash, $event->type)); send_event(new ThumbnailGenerationEvent($event->hash, $event->type));

View file

@ -15,9 +15,9 @@ class User {
var $name; var $name;
var $email; var $email;
var $join_date; var $join_date;
var $passhash; var $passhash;
/* @var UserClass */ /* @var UserClass */
var $class; var $class;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

View file

@ -1282,7 +1282,7 @@ function _sanitise_environment() {
} }
function _get_themelet_files($_theme) { function _get_themelet_files($_theme) {
$base_themelets = array(); $base_themelets = array();
if(file_exists('themes/'.$_theme.'/custompage.class.php')) $base_themelets[] = 'themes/'.$_theme.'/custompage.class.php'; 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.'/layout.class.php';
$base_themelets[] = 'themes/'.$_theme.'/themelet.class.php'; $base_themelets[] = 'themes/'.$_theme.'/themelet.class.php';

View file

@ -17,7 +17,7 @@ class ArtistsTheme extends Themelet {
public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){ public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){
global $page, $user; global $page, $user;
$html = ""; $html = "";
if($mode == "neutral"){ if($mode == "neutral"){
$html = "<form method='post' action='".make_link("artist/new_artist")."'> $html = "<form method='post' action='".make_link("artist/new_artist")."'>
@ -65,51 +65,51 @@ class ArtistsTheme extends Themelet {
</form>"; </form>";
} }
if($html) $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) public function show_artist_editor($artist, $aliases, $members, $urls)
{ {
global $user; global $user;
$artistName = $artist['name']; $artistName = $artist['name'];
$artistNotes = $artist['notes']; $artistNotes = $artist['notes'];
$artistID = $artist['id']; $artistID = $artist['id'];
// aliases // aliases
$aliasesString = ""; $aliasesString = "";
$aliasesIDsString = ""; $aliasesIDsString = "";
foreach ($aliases as $alias) foreach ($aliases as $alias)
{ {
$aliasesString .= $alias["alias_name"]." "; $aliasesString .= $alias["alias_name"]." ";
$aliasesIDsString .= $alias["alias_id"]." "; $aliasesIDsString .= $alias["alias_id"]." ";
} }
$aliasesString = rtrim($aliasesString); $aliasesString = rtrim($aliasesString);
$aliasesIDsString = rtrim($aliasesIDsString); $aliasesIDsString = rtrim($aliasesIDsString);
// members // members
$membersString = ""; $membersString = "";
$membersIDsString = ""; $membersIDsString = "";
foreach ($members as $member) foreach ($members as $member)
{ {
$membersString .= $member["name"]." "; $membersString .= $member["name"]." ";
$membersIDsString .= $member["id"]." "; $membersIDsString .= $member["id"]." ";
} }
$membersString = rtrim($membersString); $membersString = rtrim($membersString);
$membersIDsString = rtrim($membersIDsString); $membersIDsString = rtrim($membersIDsString);
// urls // urls
$urlsString = ""; $urlsString = "";
$urlsIDsString = ""; $urlsIDsString = "";
foreach ($urls as $url) foreach ($urls as $url)
{ {
$urlsString .= $url["url"]."\n"; $urlsString .= $url["url"]."\n";
$urlsIDsString .= $url["id"]." "; $urlsIDsString .= $url["id"]." ";
} }
$urlsString = substr($urlsString, 0, strlen($urlsString) -1); $urlsString = substr($urlsString, 0, strlen($urlsString) -1);
$urlsIDsString = rtrim($urlsIDsString); $urlsIDsString = rtrim($urlsIDsString);
$html = $html =
' '
<form method="POST" action="'.make_link("artist/edited/".$artist['id']).'"> <form method="POST" action="'.make_link("artist/edited/".$artist['id']).'">
'.$user->get_auth_html().' '.$user->get_auth_html().'
@ -126,113 +126,113 @@ class ArtistsTheme extends Themelet {
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr> <tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
</table> </table>
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Edit artist", $html, "main", 10)); $page->add_block(new Block("Edit artist", $html, "main", 10));
} }
public function new_artist_composer() public function new_artist_composer()
{ {
global $page, $user; 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()." ".$user->get_auth_html()."
<table> <table>
<tr><td>Name:</td><td><input type='text' name='name' /></td></tr> <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>Aliases:</td><td><input type='text' name='aliases' /></td></tr>
<tr><td>Members:</td><td><input type='text' name='members' /></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>URLs:</td><td><textarea name='urls'></textarea></td></tr>
<tr><td>Notes:</td><td><textarea name='notes'></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> <tr><td colspan='2'><input type='submit' value='Submit' /></td></tr>
</table> </table>
"; ";
$page->set_title("Artists"); $page->set_title("Artists");
$page->set_heading("Artists"); $page->set_heading("Artists");
$page->add_block(new Block("Artists", $html, "main", 10)); $page->add_block(new Block("Artists", $html, "main", 10));
} }
public function list_artists($artists, $pageNumber, $totalPages) public function list_artists($artists, $pageNumber, $totalPages)
{ {
global $user, $page; global $user, $page;
$html = "<table id='poolsList' class='zebra'>". $html = "<table id='poolsList' class='zebra'>".
"<thead><tr>". "<thead><tr>".
"<th>Name</th>". "<th>Name</th>".
"<th>Type</th>". "<th>Type</th>".
"<th>Last updater</th>". "<th>Last updater</th>".
"<th>Posts</th>"; "<th>Posts</th>";
if(!$user->is_anonymous()) $html .= "<th colspan='2'>Action</th>"; // space for edit link if(!$user->is_anonymous()) $html .= "<th colspan='2'>Action</th>"; // space for edit link
$html .= "</tr></thead>"; $html .= "</tr></thead>";
$deletionLinkActionArray = $deletionLinkActionArray =
array('artist' => 'artist/nuke/' array('artist' => 'artist/nuke/'
, 'alias' => 'artist/alias/delete/' , 'alias' => 'artist/alias/delete/'
, 'member' => 'artist/member/delete/' , 'member' => 'artist/member/delete/'
); );
$editionLinkActionArray = $editionLinkActionArray =
array('artist' => 'artist/edit/' array('artist' => 'artist/edit/'
, 'alias' => 'artist/alias/edit/' , 'alias' => 'artist/alias/edit/'
, 'member' => 'artist/member/edit/' , 'member' => 'artist/member/edit/'
); );
$typeTextArray = $typeTextArray =
array('artist' => 'Artist' array('artist' => 'Artist'
, 'alias' => 'Alias' , 'alias' => 'Alias'
, 'member' => 'Member' , 'member' => 'Member'
); );
foreach ($artists as $artist) { foreach ($artists as $artist) {
if ($artist['type'] != 'artist') if ($artist['type'] != 'artist')
$artist['name'] = str_replace("_", " ", $artist['name']); $artist['name'] = str_replace("_", " ", $artist['name']);
$elementLink = "<a href='".make_link("artist/view/".$artist['artist_id'])."'>".str_replace("_", " ", $artist['name'])."</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>"; //$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>"; $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>"; $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>"; $del_link = "<a href='".make_link($deletionLinkActionArray[$artist['type']].$artist['id'])."'>Delete</a>";
$html .= "<tr>". $html .= "<tr>".
"<td class='left'>".$elementLink; "<td class='left'>".$elementLink;
//if ($artist['type'] == 'member') //if ($artist['type'] == 'member')
// $html .= " (member of ".$artist_link.")"; // $html .= " (member of ".$artist_link.")";
//if ($artist['type'] == 'alias') //if ($artist['type'] == 'alias')
// $html .= " (alias for ".$artist_link.")"; // $html .= " (alias for ".$artist_link.")";
$html .= "</td>". $html .= "</td>".
"<td>".$typeTextArray[$artist['type']]."</td>". "<td>".$typeTextArray[$artist['type']]."</td>".
"<td>".$user_link."</td>". "<td>".$user_link."</td>".
"<td>".$artist['posts']."</td>"; "<td>".$artist['posts']."</td>";
if(!$user->is_anonymous()) $html .= "<td>".$edit_link."</td>"; if(!$user->is_anonymous()) $html .= "<td>".$edit_link."</td>";
if($user->is_admin()) $html .= "<td>".$del_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_title("Artists");
$page->set_heading("Artists"); $page->set_heading("Artists");
$page->add_block(new Block("Artists", $html, "main", 10)); $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) public function show_new_alias_composer($artistID)
{ {
global $user; global $user;
$html = $html =
'<form method="POST" action='.make_link("artist/alias/add").'> '<form method="POST" action='.make_link("artist/alias/add").'>
'.$user->get_auth_html().' '.$user->get_auth_html().'
<table> <table>
<tr><td>Alias:</td><td><input type="text" name="aliases" /> <tr><td>Alias:</td><td><input type="text" name="aliases" />
@ -240,266 +240,265 @@ class ArtistsTheme extends Themelet {
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr> <tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
</table> </table>
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Artist Aliases", $html, "main", 20)); $page->add_block(new Block("Artist Aliases", $html, "main", 20));
} }
public function show_new_member_composer($artistID) public function show_new_member_composer($artistID)
{ {
global $user; global $user;
$html = $html =
' <form method="POST" action='.make_link("artist/member/add").'> ' <form method="POST" action='.make_link("artist/member/add").'>
'.$user->get_auth_html().' '.$user->get_auth_html().'
<table> <table>
<tr><td>Members:</td><td><input type="text" name="members" /> <tr><td>Members:</td><td><input type="text" name="members" />
<input type="hidden" name="artistID" value='.$artistID.' /></td></tr> <input type="hidden" name="artistID" value='.$artistID.' /></td></tr>
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr> <tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
</table> </table>
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Artist members", $html, "main", 30)); $page->add_block(new Block("Artist members", $html, "main", 30));
} }
public function show_new_url_composer($artistID) public function show_new_url_composer($artistID)
{ {
global $user; global $user;
$html = $html =
' <form method="POST" action='.make_link("artist/url/add").'> ' <form method="POST" action='.make_link("artist/url/add").'>
'.$user->get_auth_html().' '.$user->get_auth_html().'
<table> <table>
<tr><td>URL:</td><td><textarea name="urls"></textarea> <tr><td>URL:</td><td><textarea name="urls"></textarea>
<input type="hidden" name="artistID" value='.$artistID.' /></td></tr> <input type="hidden" name="artistID" value='.$artistID.' /></td></tr>
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr> <tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
</table> </table>
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Artist URLs", $html, "main", 40)); $page->add_block(new Block("Artist URLs", $html, "main", 40));
} }
public function show_alias_editor($alias) public function show_alias_editor($alias)
{ {
global $user; global $user;
$html = $html =
' '
<form method="POST" action="'.make_link("artist/alias/edited/".$alias['id']).'"> <form method="POST" action="'.make_link("artist/alias/edited/".$alias['id']).'">
'.$user->get_auth_html().' '.$user->get_auth_html().'
<label for="alias">Alias:</label> <label for="alias">Alias:</label>
<input type="text" name="alias" value="'.$alias['alias'].'" /> <input type="text" name="alias" value="'.$alias['alias'].'" />
<input type="hidden" name="aliasID" value="'.$alias['id'].'" /> <input type="hidden" name="aliasID" value="'.$alias['id'].'" />
<input type="submit" value="Submit" /> <input type="submit" value="Submit" />
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Edit Alias", $html, "main", 10)); $page->add_block(new Block("Edit Alias", $html, "main", 10));
} }
public function show_url_editor($url) public function show_url_editor($url)
{ {
global $user; global $user;
$html = $html =
' '
<form method="POST" action="'.make_link("artist/url/edited/".$url['id']).'"> <form method="POST" action="'.make_link("artist/url/edited/".$url['id']).'">
'.$user->get_auth_html().' '.$user->get_auth_html().'
<label for="url">URL:</label> <label for="url">URL:</label>
<input type="text" name="url" value="'.$url['url'].'" /> <input type="text" name="url" value="'.$url['url'].'" />
<input type="hidden" name="urlID" value="'.$url['id'].'" /> <input type="hidden" name="urlID" value="'.$url['id'].'" />
<input type="submit" value="Submit" /> <input type="submit" value="Submit" />
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Edit URL", $html, "main", 10)); $page->add_block(new Block("Edit URL", $html, "main", 10));
} }
public function show_member_editor($member) public function show_member_editor($member)
{ {
global $user; global $user;
$html = $html =
' '
<form method="POST" action="'.make_link("artist/member/edited/".$member['id']).'"> <form method="POST" action="'.make_link("artist/member/edited/".$member['id']).'">
'.$user->get_auth_html().' '.$user->get_auth_html().'
<label for="member">Member name:</label> <label for="member">Member name:</label>
<input type="text" name="name" value="'.$member['name'].'" /> <input type="text" name="name" value="'.$member['name'].'" />
<input type="hidden" name="memberID" value="'.$member['id'].'" /> <input type="hidden" name="memberID" value="'.$member['id'].'" />
<input type="submit" value="Submit" /> <input type="submit" value="Submit" />
</form> </form>
'; ';
global $page; global $page;
$page->add_block(new Block("Edit Member", $html, "main", 10)); $page->add_block(new Block("Edit Member", $html, "main", 10));
} }
public function show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin) public function show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin)
{ {
global $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>";
$html = "<table id='poolsList' class='zebra'> $html = "<table id='poolsList' class='zebra'>
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<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'>&nbsp;</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'>&nbsp;</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'>&nbsp;</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));
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'>&nbsp;</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'>&nbsp;</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'>&nbsp;</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 //we show the images for the artist
$artist_images = ""; $artist_images = "";
foreach($images as $image) { foreach($images as $image) {

View file

@ -30,7 +30,7 @@ class BulkAdd extends Extension {
public function onCommand(CommandEvent $event) { public function onCommand(CommandEvent $event) {
if($event->cmd == "help") { if($event->cmd == "help") {
print " bulk-add [directory]\n"; print " bulk-add [directory]\n";
print " Import this directory\n\n"; print " Import this directory\n\n";
} }
if($event->cmd == "bulk-add") { if($event->cmd == "bulk-add") {
if(count($event->args) == 1) { if(count($event->args) == 1) {
@ -53,7 +53,7 @@ class BulkAdd extends Extension {
if(!array_key_exists('extension', $pathinfo)) { if(!array_key_exists('extension', $pathinfo)) {
throw new UploadException("File has no extension"); throw new UploadException("File has no extension");
} }
$metadata = array(); $metadata = array();
$metadata['filename'] = $pathinfo['basename']; $metadata['filename'] = $pathinfo['basename'];
$metadata['extension'] = $pathinfo['extension']; $metadata['extension'] = $pathinfo['extension'];
$metadata['tags'] = $tags; $metadata['tags'] = $tags;

View file

@ -33,7 +33,7 @@ class BulkAddCSV extends Extension {
public function onCommand(CommandEvent $event) { public function onCommand(CommandEvent $event) {
if($event->cmd == "help") { if($event->cmd == "help") {
print " bulk-add-csv [/path/to.csv]\n"; 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") { if($event->cmd == "bulk-add-csv") {
global $user; global $user;
@ -62,7 +62,7 @@ class BulkAddCSV extends Extension {
if(!array_key_exists('extension', $pathinfo)) { if(!array_key_exists('extension', $pathinfo)) {
throw new UploadException("File has no extension"); throw new UploadException("File has no extension");
} }
$metadata = array(); $metadata = array();
$metadata['filename'] = $pathinfo['basename']; $metadata['filename'] = $pathinfo['basename'];
$metadata['extension'] = $pathinfo['extension']; $metadata['extension'] = $pathinfo['extension'];
$metadata['tags'] = $tags; $metadata['tags'] = $tags;

View file

@ -305,7 +305,7 @@ class CronUploader extends Extension {
if (! array_key_exists ( 'extension', $pathinfo )) { if (! array_key_exists ( 'extension', $pathinfo )) {
throw new UploadException ( "File has no extension" ); throw new UploadException ( "File has no extension" );
} }
$metadata = array(); $metadata = array();
$metadata ['filename'] = $pathinfo ['basename']; $metadata ['filename'] = $pathinfo ['basename'];
$metadata ['extension'] = $pathinfo ['extension']; $metadata ['extension'] = $pathinfo ['extension'];
$metadata ['tags'] = ""; // = $tags; doesn't work when not logged in here $metadata ['tags'] = ""; // = $tags; doesn't work when not logged in here
@ -370,7 +370,7 @@ class CronUploader extends Extension {
* Adds a message to the info being published at the end * Adds a message to the info being published at the end
* @param $text string * @param $text string
* @param $addon int Enter a value to modify an existing value (enter value number) * @param $addon int Enter a value to modify an existing value (enter value number)
* @return int * @return int
*/ */
private function add_upload_info($text, $addon = 0) { private function add_upload_info($text, $addon = 0) {
$info = $this->upload_info; $info = $this->upload_info;
@ -415,4 +415,4 @@ class CronUploader extends Extension {
file_put_contents ($log_path, $content); file_put_contents ($log_path, $content);
} }
} }
?> ?>

View file

@ -21,7 +21,7 @@ function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) {
class ExtensionInfo { class ExtensionInfo {
var $ext_name, $name, $link, $author, $email; var $ext_name, $name, $link, $author, $email;
var $description, $documentation, $version, $visibility; var $description, $documentation, $version, $visibility;
var $enabled; var $enabled;
function __construct($main) { function __construct($main) {
$matches = array(); $matches = array();
@ -132,7 +132,7 @@ class ExtManager extends Extension {
public function onCommand(CommandEvent $event) { public function onCommand(CommandEvent $event) {
if($event->cmd == "help") { if($event->cmd == "help") {
print " disable-all-ext\n"; print " disable-all-ext\n";
print " disable all extensions\n\n"; print " disable all extensions\n\n";
} }
if($event->cmd == "disable-all-ext") { if($event->cmd == "disable-all-ext") {
$this->write_config(array()); $this->write_config(array());
@ -168,7 +168,7 @@ class ExtManager extends Extension {
private function set_things($settings) { private function set_things($settings) {
$core = explode(",", CORE_EXTS); $core = explode(",", CORE_EXTS);
$extras = array(); $extras = array();
foreach(glob("ext/*/main.php") as $main) { foreach(glob("ext/*/main.php") as $main) {
$matches = array(); $matches = array();

View file

@ -54,7 +54,7 @@ class ArchiveFileHandler extends Extension {
if(!array_key_exists('extension', $pathinfo)) { if(!array_key_exists('extension', $pathinfo)) {
throw new UploadException("File has no extension"); throw new UploadException("File has no extension");
} }
$metadata = array(); $metadata = array();
$metadata['filename'] = $pathinfo['basename']; $metadata['filename'] = $pathinfo['basename'];
$metadata['extension'] = $pathinfo['extension']; $metadata['extension'] = $pathinfo['extension'];
$metadata['tags'] = $tags; $metadata['tags'] = $tags;

View file

@ -20,13 +20,13 @@ class FlashFileHandler extends DataHandlerExtension {
$image = new Image(); $image = new Image();
$image->filesize = $metadata['size']; $image->filesize = $metadata['size'];
$image->hash = $metadata['hash']; $image->hash = $metadata['hash'];
$image->filename = $metadata['filename']; $image->filename = $metadata['filename'];
$image->ext = $metadata['extension']; $image->ext = $metadata['extension'];
$image->tag_array = Tag::explode($metadata['tags']); $image->tag_array = Tag::explode($metadata['tags']);
$image->source = $metadata['source']; $image->source = $metadata['source'];
$info = getimagesize($filename); $info = getimagesize($filename);
if(!$info) return null; if(!$info) return null;
$image->width = $info[0]; $image->width = $info[0];
@ -36,14 +36,14 @@ class FlashFileHandler extends DataHandlerExtension {
} }
protected function check_contents(/*string*/ $file) { protected function check_contents(/*string*/ $file) {
if (!file_exists($file)) return false; if (!file_exists($file)) return false;
$fp = fopen($file, "r"); $fp = fopen($file, "r");
$head = fread($fp, 3); $head = fread($fp, 3);
fclose($fp); fclose($fp);
if (!in_array($head, array("CWS", "FWS"))) return false; if (!in_array($head, array("CWS", "FWS"))) return false;
return true; return true;
} }
} }
?> ?>

View file

@ -23,11 +23,11 @@ class PixelFileHandler extends DataHandlerExtension {
$image->height = $info[1]; $image->height = $info[1];
$image->filesize = $metadata['size']; $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->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->tag_array = Tag::explode($metadata['tags']);
$image->source = $metadata['source']; $image->source = $metadata['source'];
return $image; return $image;
} }
@ -50,7 +50,7 @@ class PixelFileHandler extends DataHandlerExtension {
} }
protected function create_thumb_force(/*string*/ $hash) { protected function create_thumb_force(/*string*/ $hash) {
global $config; global $config;
$inname = warehouse_path("images", $hash); $inname = warehouse_path("images", $hash);
$outname = warehouse_path("thumbs", $hash); $outname = warehouse_path("thumbs", $hash);

View file

@ -31,9 +31,9 @@ else {
<source src='" . make_link("/image/" . $image->id) . "' type='video/webm' /> <source src='" . make_link("/image/" . $image->id) . "' type='video/webm' />
</video>"; </video>";
} }
else { else {
$html = "Video type '$ext' not recognised"; $html = "Video type '$ext' not recognised";
} }
$page->add_block(new Block("Video", $html, "main", 10)); $page->add_block(new Block("Video", $html, "main", 10));
} }
} }

View file

@ -94,8 +94,8 @@ class ThumbnailGenerationEvent extends Event {
* Request a thumbnail be made for an image object * Request a thumbnail be made for an image object
* *
* @param $hash string The unique hash of the image * @param $hash string The unique hash of the image
* @param $type string The type of the image * @param $type string The type of the image
* @param $force boolean Regenerate the thumbnail even if one already exists * @param $force boolean Regenerate the thumbnail even if one already exists
*/ */
public function __construct($hash, $type, $force=false) { public function __construct($hash, $type, $force=false) {
$this->hash = $hash; $this->hash = $hash;

View file

@ -1,7 +1,7 @@
<?php <?php
class IndexTheme extends Themelet { class IndexTheme extends Themelet {
var $page_number, $total_pages, $search_terms; var $page_number, $total_pages, $search_terms;
public function set_page($page_number, $total_pages, $search_terms) { public function set_page($page_number, $total_pages, $search_terms) {
$this->page_number = $page_number; $this->page_number = $page_number;

View file

@ -42,7 +42,7 @@ class LogNet extends Extension {
fwrite($fp, "$data\n"); fwrite($fp, "$data\n");
fclose($fp); fclose($fp);
} catch (Exception $e) { } catch (Exception $e) {
/* logging errors shouldn't break everything */ /* logging errors shouldn't break everything */
} }
} }
} }

View file

@ -1,6 +1,6 @@
<?php <?php
class NotesTheme extends Themelet { class NotesTheme extends Themelet {
public function note_button($image_id) { public function note_button($image_id) {
return ' return '
<!-- <a href="#" id="addnotelink" >Add a note</a> --> <!-- <a href="#" id="addnotelink" >Add a note</a> -->
<form action="" method=""> <form action="" method="">
@ -39,32 +39,32 @@ class NotesTheme extends Themelet {
$page->set_title(html_escape("Search Note")); $page->set_title(html_escape("Search Note"));
$page->set_heading(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) public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions)
{ {
$to_json = array(); $to_json = array();
foreach($recovered_notes as $note) foreach($recovered_notes as $note)
{ {
$parsedNote = $note["note"]; $parsedNote = $note["note"];
$parsedNote = str_replace("\n", "\\n", $parsedNote); $parsedNote = str_replace("\n", "\\n", $parsedNote);
$parsedNote = str_replace("\r", "\\r", $parsedNote); $parsedNote = str_replace("\r", "\\r", $parsedNote);
$to_json[] = array( $to_json[] = array(
'x1' => $note["x1"], 'x1' => $note["x1"],
'y1' => $note["y1"], 'y1' => $note["y1"],
'height' => $note["height"], 'height' => $note["height"],
'width' => $note["width"], 'width' => $note["width"],
'note' => $parsedNote, 'note' => $parsedNote,
'note_id' => $note["id"], 'note_id' => $note["id"],
); );
} }
$html = "<script type='text/javascript'>"; $html = "<script type='text/javascript'>";
$html .= "notes = " . json_encode($to_json); $html .= "notes = " . json_encode($to_json);
$html .= "</script> $html .= "</script>
<div id='noteform'> <div id='noteform'>
".make_form(make_link("note/add_note"))." ".make_form(make_link("note/add_note"))."
@ -88,41 +88,41 @@ class NotesTheme extends Themelet {
</form> </form>
</div> </div>
<div id='noteEditForm'> <div id='noteEditForm'>
".make_form(make_link("note/edit_note"))." ".make_form(make_link("note/edit_note"))."
<input type='hidden' name='image_id' value='".$image_id."' /> <input type='hidden' name='image_id' value='".$image_id."' />
<input type='hidden' name='note_id' id='EditNoteID' value='' /> <input type='hidden' name='note_id' id='EditNoteID' value='' />
<input name='note_x1' type='hidden' value='' id='EditNoteX1' /> <input name='note_x1' type='hidden' value='' id='EditNoteX1' />
<input name='note_y1' type='hidden' value='' id='EditNoteY1' /> <input name='note_y1' type='hidden' value='' id='EditNoteY1' />
<input name='note_height' type='hidden' value='' id='EditNoteHeight' /> <input name='note_height' type='hidden' value='' id='EditNoteHeight' />
<input name='note_width' type='hidden' value='' id='EditNoteWidth' /> <input name='note_width' type='hidden' value='' id='EditNoteWidth' />
<table> <table>
<tr> <tr>
<td colspan='2'> <td colspan='2'>
<textarea name='note_text' id='EditNoteNote' ></textarea> <textarea name='note_text' id='EditNoteNote' ></textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><input type='submit' value='Save Note' /></td> <td><input type='submit' value='Save Note' /></td>
<td><input type='button' value='Cancel' id='EditCancelNote' /></td> <td><input type='button' value='Cancel' id='EditCancelNote' /></td>
</tr> </tr>
</table> </table>
</form>"; </form>";
if($adminOptions) if($adminOptions)
$html .= " $html .= "
".make_form(make_link("note/delete_note"))." ".make_form(make_link("note/delete_note"))."
<input type='hidden' name='image_id' value='".$image_id."' /> <input type='hidden' name='image_id' value='".$image_id."' />
<input type='hidden' name='note_id' value='' id='DeleteNoteNoteID' /> <input type='hidden' name='note_id' value='' id='DeleteNoteNoteID' />
<table> <table>
<tr> <tr>
<td><input type='submit' value='Delete note' /></td> <td><input type='submit' value='Delete note' /></td>
</tr> </tr>
</table> </table>
</form> </form>
"; ";
$html .= "</div>"; $html .= "</div>";
$page->add_block(new Block(null, $html, "main", 1)); $page->add_block(new Block(null, $html, "main", 1));
} }
@ -170,64 +170,64 @@ class NotesTheme extends Themelet {
$page->add_block(new Block("Note Requests", $pool_images, "main", 20)); $page->add_block(new Block("Note Requests", $pool_images, "main", 20));
} }
private function get_history($histories) { private function get_history($histories) {
global $user; global $user;
$html = "<table id='poolsList' class='zebra'>". $html = "<table id='poolsList' class='zebra'>".
"<thead><tr>". "<thead><tr>".
"<th>Image</th>". "<th>Image</th>".
"<th>Note</th>". "<th>Note</th>".
"<th>Body</th>". "<th>Body</th>".
"<th>Updater</th>". "<th>Updater</th>".
"<th>Date</th>"; "<th>Date</th>";
if(!$user->is_anonymous()){ if(!$user->is_anonymous()){
$html .= "<th>Action</th>"; $html .= "<th>Action</th>";
} }
$html .= "</tr></thead>". $html .= "</tr></thead>".
"<tbody>"; "<tbody>";
foreach($histories as $history) { foreach($histories as $history) {
$image_link = "<a href='".make_link("post/view/".$history['image_id'])."'>".$history['image_id']."</a>"; $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>"; $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>"; $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>"; $revert_link = "<a href='".make_link("note/revert/".$history['note_id']."/".$history['review_id'])."'>Revert</a>";
$html .= "<tr>". $html .= "<tr>".
"<td>".$image_link."</td>". "<td>".$image_link."</td>".
"<td>".$history_link."</td>". "<td>".$history_link."</td>".
"<td style='text-align:left;'>".$history['note']."</td>". "<td style='text-align:left;'>".$history['note']."</td>".
"<td>".$user_link."</td>". "<td>".$user_link."</td>".
"<td>".autodate($history['date'])."</td>"; "<td>".autodate($history['date'])."</td>";
if(!$user->is_anonymous()){ if(!$user->is_anonymous()){
$html .= "<td>".$revert_link."</td>"; $html .= "<td>".$revert_link."</td>";
} }
} }
$html .= "</tr></tbody></table>"; $html .= "</tr></tbody></table>";
return $html; return $html;
} }
public function display_histories($histories, $pageNumber, $totalPages) { public function display_histories($histories, $pageNumber, $totalPages) {
global $page; global $page;
$html = $this->get_history($histories); $html = $this->get_history($histories);
$page->set_title("Note Updates"); $page->set_title("Note Updates");
$page->set_heading("Note Updates"); $page->set_heading("Note Updates");
$page->add_block(new Block("Note Updates", $html, "main", 10)); $page->add_block(new Block("Note Updates", $html, "main", 10));
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
} }
public function display_history($histories, $pageNumber, $totalPages) { public function display_history($histories, $pageNumber, $totalPages) {
global $page; global $page;
$html = $this->get_history($histories); $html = $this->get_history($histories);
$page->set_title("Note History"); $page->set_title("Note History");
$page->set_heading("Note History"); $page->set_heading("Note History");
@ -235,5 +235,5 @@ class NotesTheme extends Themelet {
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
} }
} }
?> ?>

View file

@ -28,7 +28,7 @@ class Oekaki extends Extension {
throw new UploadException("File has no extension"); throw new UploadException("File has no extension");
} }
log_info("oekaki", "Processing file [{$pathinfo['filename']}]"); log_info("oekaki", "Processing file [{$pathinfo['filename']}]");
$metadata = array(); $metadata = array();
$metadata['filename'] = 'oekaki.png'; $metadata['filename'] = 'oekaki.png';
$metadata['extension'] = $pathinfo['extension']; $metadata['extension'] = $pathinfo['extension'];
$metadata['tags'] = 'oekaki tagme'; $metadata['tags'] = 'oekaki tagme';