Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c1c3fbc241 | ||
|
d4efdc4f6b | ||
|
b03869c59d | ||
|
9898df3e11 | ||
|
467bb635c4 | ||
|
eccd9f590a | ||
|
7fb5b5973f | ||
|
8a99bf5e53 | ||
|
c3fa6a605c | ||
|
ff7796e670 | ||
|
77e21ad011 | ||
|
a71485fec8 | ||
|
a8e619b6a2 | ||
|
657d607a9d | ||
|
30c9e4a589 | ||
|
43418fd287 | ||
|
6a4a79edda | ||
|
cb7e84a346 | ||
|
187de18322 | ||
|
0d788d9d61 | ||
|
a090d45ce0 | ||
|
e0e774a420 | ||
|
605a8c206e | ||
|
5d6927c975 | ||
|
ab42847cf8 | ||
|
8d44a83fad | ||
|
f056d31e26 | ||
|
3914c99d08 | ||
|
8c792556e6 | ||
|
936d2ab48d | ||
|
63dd7d8e54 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.svn
|
||||
.htaccess
|
||||
config.php
|
||||
images
|
||||
thumbs
|
32
README.txt
32
README.txt
@ -6,12 +6,22 @@
|
||||
/_______ /|___| /__|__|_| /__|_| /__|\___ >_______ \
|
||||
\/ \/ \/ \/ \/ \/
|
||||
|
||||
Shimmie2 Release Candidate
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Okay, so maybe my estimate of "it should be done within the week" was a bit
|
||||
optimistic... I did get the first 3.5k lines of code done in a week, then
|
||||
another 1k of extensions in another week, but making it all work *properly*
|
||||
took 3 months...
|
||||
Shimmie2 -- 2.0.X Series
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Changes in 2.0.2:
|
||||
* $page->add_header() function pulled from development, as it's small,
|
||||
and allows people to use development extensions (eg RSS)
|
||||
* minor SQL tweak, huge speedup in several (but not all) cases
|
||||
* ability to disable anonymous tag editing
|
||||
* various internal fixes
|
||||
|
||||
Changes in 2.0.1:
|
||||
* Disabling anonymous comments doesn't break things
|
||||
* When Shimmie is in downtime mode, there's a big notice in the sidebar
|
||||
* A short opening tag (<?) was replaced with a long one (<?php), so people
|
||||
with short tags disabled no longer see random PHP code
|
||||
* Metadata searching was improved (see wiki -> user guide -> searching)
|
||||
* Misc minor code cleanups
|
||||
|
||||
|
||||
Requirements
|
||||
@ -54,7 +64,7 @@ Upgrade process:
|
||||
3) Create a new, blank database, separate from the old one
|
||||
4) Unzip shimmie2 into a different folder than shimmie1
|
||||
5) Visit the URL of shimmie2
|
||||
6) Full in the old database location, the new database location, and the full
|
||||
6) Fill in the old database location, the new database location, and the full
|
||||
path to the old installation folder (the folder where the old "images" and
|
||||
"thumbs" can be found)
|
||||
7) Click "upgrade"
|
||||
@ -75,4 +85,12 @@ Shish on Freenode -- IRC
|
||||
|
||||
|
||||
|
||||
Old News
|
||||
~~~~~~~~
|
||||
|
||||
Shimmie2 Release Candidate
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Okay, so maybe my estimate of "it should be done within the week" was a bit
|
||||
optimistic... I did get the first 3.5k lines of code done in a week, then
|
||||
another 1k of extensions in another week, but making it all work *properly*
|
||||
took 3 months...
|
||||
|
@ -25,6 +25,7 @@ class Config {
|
||||
'view_scale' => false, # view
|
||||
'tags_default' => 'map', # (ignored)
|
||||
'tags_min' => '2', # tags
|
||||
'tag_edit_anon' => true, # tags
|
||||
'upload_count' => 3, # upload
|
||||
'upload_size' => '256KB', # upload
|
||||
'upload_anon' => true, # upload
|
||||
|
@ -92,41 +92,22 @@ class Database {
|
||||
|
||||
$term = $this->resolve_alias($term);
|
||||
|
||||
if(substr($term, 0, 5) == "size=") {
|
||||
$dim = substr($term, 5);
|
||||
$parts = explode('x', $dim);
|
||||
$args = array(int_escape($parts[0]), int_escape($parts[1]));
|
||||
$img_search->append(new Querylet("AND (width = ? AND height = ?)", $args));
|
||||
$matches = array();
|
||||
if(preg_match("/size(<|>|<=|>=|=)(\d+)x(\d+)/", $term, $matches)) {
|
||||
$cmp = $matches[1];
|
||||
$args = array(int_escape($matches[2]), int_escape($matches[3]));
|
||||
$img_search->append(new Querylet("AND (width $cmp ? AND height $cmp ?)", $args));
|
||||
}
|
||||
else if(substr($term, 0, 5) == "size>") {
|
||||
$dim = substr($term, 5);
|
||||
$parts = explode('x', $dim);
|
||||
$args = array(int_escape($parts[0]), int_escape($parts[1]));
|
||||
$img_search->append(new Querylet("AND (width > ? AND height > ?)", $args));
|
||||
else if(preg_match("/ratio(<|>|<=|>=|=)(\d+):(\d+)/", $term, $matches)) {
|
||||
$cmp = $matches[1];
|
||||
$args = array(int_escape($matches[2]), int_escape($matches[3]));
|
||||
$img_search->append(new Querylet("AND (width / height $cmp ? / ?)", $args));
|
||||
}
|
||||
else if(substr($term, 0, 5) == "size<") {
|
||||
$dim = substr($term, 5);
|
||||
$parts = explode('x', $dim);
|
||||
$args = array(int_escape($parts[0]), int_escape($parts[1]));
|
||||
$img_search->append(new Querylet("AND (width < ? AND height < ?)", $args));
|
||||
}
|
||||
else if(substr($term, 0, 6) == "ratio=") {
|
||||
$dim = substr($term, 6);
|
||||
$parts = explode(':', $dim);
|
||||
$args = array(int_escape($parts[0]), int_escape($parts[1]));
|
||||
$img_search->append(new Querylet("AND (width / height = ? / ?)", $args));
|
||||
}
|
||||
else if(substr($term, 0, 3) == "id<") {
|
||||
$img_search->append(new Querylet("AND (id < ?)", array(int_escape(substr($term, 3)))));
|
||||
}
|
||||
else if(substr($term, 0, 3) == "id>") {
|
||||
$img_search->append(new Querylet("AND (id > ?)", array(int_escape(substr($term, 3)))));
|
||||
}
|
||||
else if(substr($term, 0, 9) == "filesize<") {
|
||||
$img_search->append(new Querylet("AND (filesize < ?)", array(parse_shorthand_int(substr($term, 9)))));
|
||||
}
|
||||
else if(substr($term, 0, 9) == "filesize>") {
|
||||
$img_search->append(new Querylet("AND (filesize > ?)", array(parse_shorthand_int(substr($term, 9)))));
|
||||
else if(preg_match("/(filesize|id)(<|>|<=|>=|=)([\dKMGB]+)/i", $term, $matches)) {
|
||||
$col = $matches[1];
|
||||
$cmp = $matches[2];
|
||||
$val = parse_shorthand_int($matches[3]);
|
||||
$img_search->append(new Querylet("AND ($col $cmp $val)"));
|
||||
}
|
||||
else {
|
||||
$term = str_replace("*", "%", $term);
|
||||
@ -140,12 +121,30 @@ class Database {
|
||||
$database_fails = false; // MySQL 4.0 fails at subqueries
|
||||
if(count($tag_search->variables) == 0 || $database_fails) {
|
||||
$query = new Querylet("SELECT * FROM images ");
|
||||
|
||||
if(strlen($img_search->sql) > 0) {
|
||||
$query->append_sql("WHERE 1=1 ");
|
||||
$query->append($img_search);
|
||||
}
|
||||
}
|
||||
else if(count($tag_search->variables) == 1 && $positive_tag_count == 1) {
|
||||
$query = new Querylet(
|
||||
"SELECT *,UNIX_TIMESTAMP(posted) AS posted_timestamp FROM tags, images WHERE tag LIKE ? AND tags.image_id = images.id ",
|
||||
$tag_search->variables);
|
||||
|
||||
if(strlen($img_search->sql) > 0) {
|
||||
$query->append($img_search);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$s_tag_array = array_map("sql_escape", $tag_search->variables);
|
||||
$s_tag_list = join(', ', $s_tag_array);
|
||||
|
||||
$subquery = new Querylet("
|
||||
SELECT *, SUM({$tag_search->sql}) AS score
|
||||
FROM images
|
||||
LEFT JOIN tags ON tags.image_id = images.id
|
||||
WHERE tags.tag IN ({$s_tag_list})
|
||||
GROUP BY images.id
|
||||
HAVING score = ?",
|
||||
array_merge(
|
||||
@ -154,74 +153,16 @@ class Database {
|
||||
)
|
||||
);
|
||||
$query = new Querylet("SELECT * FROM ({$subquery->sql}) AS images ", $subquery->variables);
|
||||
}
|
||||
|
||||
if(count($img_search->variables) > 0) {
|
||||
$query->append_sql("WHERE 1=1 ");
|
||||
$query->append($img_search);
|
||||
if(strlen($img_search->sql) > 0) {
|
||||
$query->append_sql("WHERE 1=1 ");
|
||||
$query->append($img_search);
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
private function build_search_querylet_old($tags) { // {{{
|
||||
$querylet = new Querylet("SELECT images.*, SUM(");
|
||||
|
||||
$tnum = 0;
|
||||
foreach($tags as $tag) {
|
||||
if(($tag != "") && ($tag[0] == '-')) continue;
|
||||
$querylet->append_sql($tnum == 0 ? "(" : " OR ");
|
||||
$querylet->append($this->term_to_querylet($tag));
|
||||
$tnum++;
|
||||
}
|
||||
$min_score = $tnum;
|
||||
if($tnum > 0) $querylet->append_sql(")");
|
||||
|
||||
$tnum = 0;
|
||||
foreach($tags as $tag) {
|
||||
if(($tag == "") || ($tag[0] != '-')) continue;
|
||||
$querylet->append_sql($tnum == 0 ? "-(" : " OR ");
|
||||
$querylet->append($this->term_to_querylet(substr($tag, 1)));
|
||||
$tnum++;
|
||||
}
|
||||
if($tnum > 0) $querylet->append_sql(")");
|
||||
|
||||
$querylet->append_sql(") AS score
|
||||
FROM tags
|
||||
LEFT JOIN images ON image_id=images.id
|
||||
GROUP BY images.id
|
||||
HAVING score >= ?
|
||||
");
|
||||
$querylet->add_variable($min_score);
|
||||
|
||||
return $querylet;
|
||||
}
|
||||
|
||||
private function term_to_querylet($term) {
|
||||
$term = $this->resolve_alias($term);
|
||||
|
||||
if(substr($term, 0, 5) == "size:") {
|
||||
$dim = substr($term, 5);
|
||||
$parts = explode('x', $dim);
|
||||
return new Querylet("(width = ? AND height = ?)", array(int_escape($parts[0]), int_escape($parts[1])));
|
||||
}
|
||||
else if(substr($term, 0, 9) == "size-min:") {
|
||||
$dim = substr($term, 9);
|
||||
$parts = explode('x', $dim);
|
||||
return new Querylet("(width >= ? AND height >= ?)", array(int_escape($parts[0]), int_escape($parts[1])));
|
||||
}
|
||||
else if(substr($term, 0, 9) == "size-max:") {
|
||||
$dim = substr($term, 9);
|
||||
$parts = explode('x', $dim);
|
||||
return new Querylet("(width <= ? AND height <= ?)", array(int_escape($parts[0]), int_escape($parts[1])));
|
||||
}
|
||||
else {
|
||||
$term = str_replace("*", "%", $term);
|
||||
$term = str_replace("?", "_", $term);
|
||||
return new Querylet("(tag LIKE ?)", array($term));
|
||||
}
|
||||
} // }}}
|
||||
|
||||
public function delete_tags_from_image($image_id) {
|
||||
$this->db->Execute("DELETE FROM tags WHERE image_id=?", array($image_id));
|
||||
}
|
||||
@ -231,7 +172,7 @@ class Database {
|
||||
|
||||
$tags = array_map(array($this, 'resolve_alias'), $tags);
|
||||
$tags = array_map(array($this, 'sanitise'), $tags);
|
||||
$tags = array_unique($tags); // remove any duplicate tags
|
||||
$tags = array_iunique($tags); // remove any duplicate tags
|
||||
|
||||
// delete old
|
||||
$this->delete_tags_from_image($image_id);
|
||||
@ -278,13 +219,13 @@ class Database {
|
||||
}
|
||||
|
||||
if(count($tags) == 0) {
|
||||
$row = $this->db->GetRow("SELECT * FROM images WHERE id $gtlt ? ORDER BY id $dir", array((int)$id));
|
||||
$row = $this->db->GetRow("SELECT * FROM images WHERE id $gtlt ? ORDER BY id $dir LIMIT 1", array((int)$id));
|
||||
}
|
||||
else {
|
||||
$tags[] = ($next ? "id<$id" : "id>$id");
|
||||
$dir = ($next ? "DESC" : "ASC");
|
||||
$querylet = $this->build_search_querylet($tags);
|
||||
$querylet->append_sql("ORDER BY id $dir");
|
||||
$querylet->append_sql("ORDER BY id $dir LIMIT 1");
|
||||
$row = $this->db->GetRow($querylet->sql, $querylet->variables);
|
||||
}
|
||||
|
||||
@ -306,7 +247,7 @@ class Database {
|
||||
}
|
||||
// }}}
|
||||
// users {{{
|
||||
var $SELECT_USER = "SELECT *,time_to_sec(timediff(now(), joindate))/(60*60*24) AS days_old FROM users ";
|
||||
var $SELECT_USER = "SELECT *,(unix_timestamp(now()) - unix_timestamp(joindate))/(60*60*24) AS days_old FROM users ";
|
||||
|
||||
public function get_user($a=false, $b=false) {
|
||||
if($b == false) {
|
||||
|
@ -44,11 +44,11 @@ class ImageIO extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_string("thumb_engine", $_POST['thumb_engine']);
|
||||
$event->config->set_int("thumb_width", $_POST['thumb_width']);
|
||||
$event->config->set_int("thumb_height", $_POST['thumb_height']);
|
||||
$event->config->set_int("thumb_quality", $_POST['thumb_quality']);
|
||||
$event->config->set_int("thumb_gd_mem_limit", $_POST['thumb_gd_mem_limit']);
|
||||
$event->config->set_string_from_post("thumb_engine");
|
||||
$event->config->set_int_from_post("thumb_width");
|
||||
$event->config->set_int_from_post("thumb_height");
|
||||
$event->config->set_int_from_post("thumb_quality");
|
||||
$event->config->set_int_from_post("thumb_gd_mem_limit");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
@ -94,7 +94,7 @@ class ImageIO extends Extension {
|
||||
$h = $config->get_int("thumb_height");
|
||||
$q = $config->get_int("thumb_quality");
|
||||
|
||||
exec("convert $inname -geometry {$w}x{$h} -quality {$q} $outname");
|
||||
exec("convert {$inname}[0] -geometry {$w}x{$h} -quality {$q} jpg:$outname");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -106,28 +106,6 @@ class ImageIO extends Extension {
|
||||
return imagejpeg($thumb, $outname, $config->get_int('thumb_quality'));
|
||||
}
|
||||
|
||||
private function get_memory_limit() {
|
||||
global $config;
|
||||
|
||||
// thumbnail generation requires lots of memory
|
||||
$default_limit = 8*1024*1024;
|
||||
$shimmie_limit = parse_shorthand_int($config->get_int("thumb_gd_mem_limit"));
|
||||
if($shimmie_limit < 3*1024*1024) {
|
||||
// we aren't going to fit, override
|
||||
$shimmie_limit = $default_limit;
|
||||
}
|
||||
|
||||
ini_set("memory_limit", $shimmie_limit);
|
||||
$memory = parse_shorthand_int(ini_get("memory_limit"));
|
||||
|
||||
// changing of memory limit is disabled / failed
|
||||
if($memory == -1) {
|
||||
$memory = $default_limit;
|
||||
}
|
||||
|
||||
return $memory;
|
||||
}
|
||||
|
||||
private function get_thumb($tmpname) {
|
||||
global $config;
|
||||
|
||||
@ -139,7 +117,7 @@ class ImageIO extends Extension {
|
||||
$max_height = $config->get_int('thumb_height');
|
||||
|
||||
$memory_use = (filesize($tmpname)*2) + ($width*$height*4) + (4*1024*1024);
|
||||
$memory_limit = $this->get_memory_limit();
|
||||
$memory_limit = get_memory_limit();
|
||||
|
||||
if($memory_use > $memory_limit) {
|
||||
$thumb = imagecreatetruecolor($max_width, min($max_height, 64));
|
||||
|
@ -4,57 +4,53 @@ class Index extends Extension {
|
||||
// event handling {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) {
|
||||
if($event->get_arg(0) == 'rss') {
|
||||
$this->do_rss();
|
||||
$search_terms = array();
|
||||
$page_number = 1;
|
||||
|
||||
if($event->count_args() > 0) {
|
||||
$page_number = int_escape($event->get_arg(0));
|
||||
if($page_number == 0) $page_number = 1; // invalid -> 0
|
||||
}
|
||||
|
||||
if(isset($_GET['search'])) {
|
||||
$search_terms = explode(' ', $_GET['search']);
|
||||
$query = "search=".html_escape($_GET['search']);
|
||||
}
|
||||
else {
|
||||
$search_terms = array();
|
||||
$page_number = 1;
|
||||
|
||||
if($event->count_args() > 0) {
|
||||
$page_number = int_escape($event->get_arg(0));
|
||||
}
|
||||
|
||||
if(isset($_GET['search'])) {
|
||||
$search_terms = explode(' ', $_GET['search']);
|
||||
$query = "search=".html_escape($_GET['search']);
|
||||
}
|
||||
else {
|
||||
$query = null;
|
||||
}
|
||||
|
||||
global $page;
|
||||
global $config;
|
||||
global $database;
|
||||
|
||||
$total_pages = $database->count_pages($search_terms);
|
||||
$count = $config->get_int('index_width') * $config->get_int('index_height');
|
||||
$images = $database->get_images(($page_number-1)*$count, $count, $search_terms);
|
||||
|
||||
if(count($search_terms) == 0) {
|
||||
$page_title = $config->get_string('title');
|
||||
}
|
||||
else {
|
||||
$page_title = html_escape($_GET['search']);
|
||||
/*
|
||||
$page_title = "";
|
||||
foreach($search_terms as $term) {
|
||||
$h_term = html_escape($term);
|
||||
$page_title .= "<a href='".make_link("post/list", "search=$h_term")."'>$h_term</a>";
|
||||
}
|
||||
*/
|
||||
$page->set_subheading("Page $page_number / $total_pages");
|
||||
}
|
||||
if($page_number > 1 || count($search_terms) > 0) {
|
||||
// $page_title .= " / $page_number";
|
||||
}
|
||||
|
||||
$page->set_title($page_title);
|
||||
$page->set_heading($page_title);
|
||||
$page->add_side_block(new Block("Navigation", $this->build_navigation($page_number, $total_pages, $search_terms)), 0);
|
||||
$page->add_main_block(new Block("Images", $this->build_table($images, $query)), 10);
|
||||
$page->add_main_block(new Paginator("index", $query, $page_number, $total_pages), 90);
|
||||
$query = null;
|
||||
}
|
||||
|
||||
global $page;
|
||||
global $config;
|
||||
global $database;
|
||||
|
||||
$total_pages = $database->count_pages($search_terms);
|
||||
$count = $config->get_int('index_width') * $config->get_int('index_height');
|
||||
$images = $database->get_images(($page_number-1)*$count, $count, $search_terms);
|
||||
|
||||
if(count($search_terms) == 0) {
|
||||
$page_title = $config->get_string('title');
|
||||
}
|
||||
else {
|
||||
$page_title = html_escape($_GET['search']);
|
||||
/*
|
||||
$page_title = "";
|
||||
foreach($search_terms as $term) {
|
||||
$h_term = html_escape($term);
|
||||
$page_title .= "<a href='".make_link("post/list", "search=$h_term")."'>$h_term</a>";
|
||||
}
|
||||
*/
|
||||
$page->set_subheading("Page $page_number / $total_pages");
|
||||
}
|
||||
if($page_number > 1 || count($search_terms) > 0) {
|
||||
// $page_title .= " / $page_number";
|
||||
}
|
||||
|
||||
$page->set_title($page_title);
|
||||
$page->set_heading($page_title);
|
||||
$page->add_side_block(new Block("Navigation", $this->build_navigation($page_number, $total_pages, $search_terms)), 0);
|
||||
$page->add_main_block(new Block("Images", $this->build_table($images, $query)), 10);
|
||||
$page->add_main_block(new Paginator("index", $query, $page_number, $total_pages), 90);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
@ -72,9 +68,9 @@ class Index extends Extension {
|
||||
$event->panel->add_main_block($sb, 20);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_int("index_width", $_POST['index_width']);
|
||||
$event->config->set_int("index_height", $_POST['index_height']);
|
||||
$event->config->set_string("image_tip", $_POST['image_tip']);
|
||||
$event->config->set_int_from_post("index_width");
|
||||
$event->config->set_int_from_post("index_height");
|
||||
$event->config->set_string_from_post("image_tip");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
@ -137,11 +133,6 @@ class Index extends Extension {
|
||||
return "<td><a href='$h_view_link'><img title='$h_tip' alt='$h_tip' src='$h_thumb_link'></a></td>\n";
|
||||
}
|
||||
// }}}
|
||||
// rss {{{
|
||||
private function do_rss() {
|
||||
// TODO: this function
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
add_event_listener(new Index());
|
||||
?>
|
||||
|
@ -138,12 +138,12 @@ class Setup extends Extension {
|
||||
$event->panel->add_main_block($sb, 0);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_string("title", $_POST['title']);
|
||||
$event->config->set_string("base_href", $_POST['base_href']);
|
||||
$event->config->set_string("data_href", $_POST['data_href']);
|
||||
$event->config->set_string("contact_link", $_POST['contact_link']);
|
||||
$event->config->set_string("theme", $_POST['theme']);
|
||||
$event->config->set_int("anon_id", $_POST['anon_id']);
|
||||
$event->config->set_string_from_post("title");
|
||||
$event->config->set_string_from_post("base_href");
|
||||
$event->config->set_string_from_post("data_href");
|
||||
$event->config->set_string_from_post("contact_link");
|
||||
$event->config->set_string_from_post("theme");
|
||||
$event->config->set_int_from_post("anon_id");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
@ -3,15 +3,23 @@
|
||||
class TagEdit extends Extension {
|
||||
// event handling {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page == "tags")) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page == "tag_edit")) {
|
||||
global $page;
|
||||
if($event->get_arg(0) == "set") {
|
||||
global $database;
|
||||
$i_image_id = int_escape($_POST['image_id']);
|
||||
$query = $_POST['query'];
|
||||
$database->set_tags($i_image_id, $_POST['tags']);
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/$i_image_id", $query));
|
||||
if($this->can_tag()) {
|
||||
global $database;
|
||||
$i_image_id = int_escape($_POST['image_id']);
|
||||
$query = $_POST['query'];
|
||||
$database->set_tags($i_image_id, $_POST['tags']);
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/$i_image_id", $query));
|
||||
}
|
||||
else {
|
||||
$page->set_title("Tag Edit Denied");
|
||||
$page->set_heading("Tag Edit Denied");
|
||||
$page->add_side_block(new NavBlock());
|
||||
$page->add_main_block(new Block("Error", "Anonymous tag editing is disabled"));
|
||||
}
|
||||
}
|
||||
else if($event->get_arg(0) == "replace") {
|
||||
global $user;
|
||||
@ -48,6 +56,22 @@ class TagEdit extends Extension {
|
||||
if(is_a($event, 'AddAliasEvent')) {
|
||||
$this->mass_tag_edit($event->oldtag, $event->newtag);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Tag Editing");
|
||||
$sb->add_label("Allow anonymous editing: ");
|
||||
$sb->add_bool_option("tag_edit_anon");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_bool_from_post("tag_edit_anon");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
// do things {{{
|
||||
private function can_tag() {
|
||||
global $config, $user;
|
||||
return $config->get_bool("tag_edit_anon") || !$user->is_anonymous();
|
||||
}
|
||||
// }}}
|
||||
// edit {{{
|
||||
@ -72,7 +96,7 @@ class TagEdit extends Extension {
|
||||
$i_image_id = int_escape($image->id);
|
||||
|
||||
return "
|
||||
<p><form action='".make_link("tags/set")."' method='POST'>
|
||||
<p><form action='".make_link("tag_edit/set")."' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image_id'>
|
||||
<input type='hidden' name='query' value='$h_query'>
|
||||
<input type='text' size='50' name='tags' value='$h_tags'>
|
||||
@ -82,7 +106,7 @@ class TagEdit extends Extension {
|
||||
}
|
||||
private function build_mass_tag_edit() {
|
||||
return "
|
||||
<form action='".make_link("tags/replace")."' method='POST'>
|
||||
<form action='".make_link("tag_edit/replace")."' method='POST'>
|
||||
<table border='1' style='width: 200px;'>
|
||||
<tr><td>Search</td><td><input type='text' name='search'></tr>
|
||||
<tr><td>Replace</td><td><input type='text' name='replace'></td></tr>
|
||||
|
@ -40,9 +40,9 @@ class Upload extends Extension {
|
||||
$event->panel->add_main_block($sb, 10);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_int("upload_count", $_POST['upload_count']);
|
||||
$event->config->set_int("upload_size", $_POST['upload_size']);
|
||||
$event->config->set_bool("upload_anon", $_POST['upload_anon']);
|
||||
$event->config->set_int_from_post("upload_count");
|
||||
$event->config->set_int_from_post("upload_size");
|
||||
$event->config->set_bool_from_post("upload_anon");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
@ -66,9 +66,9 @@ class UserPage extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_int("login_memory", $_POST['login_memory']);
|
||||
$event->config->set_bool("login_signup_enabled", $_POST['login_signup_enabled']);
|
||||
$event->config->set_string("login_tac", $_POST['login_tac']);
|
||||
$event->config->set_int_from_post("login_memory");
|
||||
$event->config->set_bool_from_post("login_signup_enabled");
|
||||
$event->config->set_string_from_post("login_tac");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
@ -41,15 +41,12 @@ class ViewImage extends Extension {
|
||||
$sb->add_text_option("image_slink");
|
||||
$sb->add_label("<br>Thumbnail link ");
|
||||
$sb->add_text_option("image_tlink");
|
||||
//$sb->add_label("<br>Zoom by default");
|
||||
//$sb->add_bool_option("view_scale");
|
||||
$event->panel->add_main_block($sb, 30);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_string("image_ilink", $_POST['image_ilink']);
|
||||
$event->config->set_string("image_slink", $_POST['image_slink']);
|
||||
$event->config->set_string("image_tlink", $_POST['image_tlink']);
|
||||
//$event->config->set_bool("view_scale", $_POST['view_scale']);
|
||||
$event->config->set_string_from_post("image_ilink");
|
||||
$event->config->set_string_from_post("image_slink");
|
||||
$event->config->set_string_from_post("image_tlink");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
@ -39,6 +39,7 @@ class Page {
|
||||
var $heading = "";
|
||||
var $subheading = "";
|
||||
var $quicknav = "";
|
||||
var $headers = array();
|
||||
var $sideblocks = array();
|
||||
var $mainblocks = array();
|
||||
|
||||
@ -54,6 +55,11 @@ class Page {
|
||||
$this->subheading = $subheading;
|
||||
}
|
||||
|
||||
public function add_header($line, $position=50) {
|
||||
while(isset($this->headers[$position])) $position++;
|
||||
$this->headers[$position] = $line;
|
||||
}
|
||||
|
||||
public function add_side_block($block, $position=50) {
|
||||
while(isset($this->sideblocks[$position])) $position++;
|
||||
$this->sideblocks[$position] = $block;
|
||||
|
@ -65,6 +65,28 @@ function to_shorthand_int($int) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_memory_limit() {
|
||||
global $config;
|
||||
|
||||
// thumbnail generation requires lots of memory
|
||||
$default_limit = 8*1024*1024;
|
||||
$shimmie_limit = parse_shorthand_int($config->get_int("thumb_gd_mem_limit"));
|
||||
if($shimmie_limit < 3*1024*1024) {
|
||||
// we aren't going to fit, override
|
||||
$shimmie_limit = $default_limit;
|
||||
}
|
||||
|
||||
ini_set("memory_limit", $shimmie_limit);
|
||||
$memory = parse_shorthand_int(ini_get("memory_limit"));
|
||||
|
||||
// changing of memory limit is disabled / failed
|
||||
if($memory == -1) {
|
||||
$memory = $default_limit;
|
||||
}
|
||||
|
||||
return $memory;
|
||||
}
|
||||
|
||||
function bbcode2html($text) {
|
||||
$text = trim($text);
|
||||
$text = html_escape($text);
|
||||
@ -101,8 +123,22 @@ function tag_explode($tags) {
|
||||
return $tag_array;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// case insensetive uniqueness
|
||||
function array_iunique($array) {
|
||||
$ok = array();
|
||||
foreach($array as $element) {
|
||||
$found = false;
|
||||
foreach($ok as $existing) {
|
||||
if(strtolower($element) == strtolower($existing)) {
|
||||
$found = true; break;
|
||||
}
|
||||
}
|
||||
if(!$found) {
|
||||
$ok[] = $element;
|
||||
}
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
|
||||
# $db is the connection object
|
||||
@ -134,7 +170,9 @@ function add_event_listener($block, $pos=50) {
|
||||
|
||||
function send_event($event) {
|
||||
global $_event_listeners;
|
||||
foreach($_event_listeners as $listener) {
|
||||
$my_event_listeners = $_event_listeners;
|
||||
ksort($my_event_listeners);
|
||||
foreach($my_event_listeners as $listener) {
|
||||
$listener->receive_event($event);
|
||||
}
|
||||
}
|
||||
|
@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
class AutoComplete extends Extension {
|
||||
// event handling {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page == "index" || $event->page == "view")) {
|
||||
global $page;
|
||||
$page->add_side_block(new Block(null, $this->build_autocomplete_script()));
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page == "autocomplete")) {
|
||||
global $page;
|
||||
$page->set_mode("data");
|
||||
$page->set_type("text/plain");
|
||||
$page->set_data($this->get_completions($event->get_arg(0)));
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
// do things {{{
|
||||
private function get_completions($start) {
|
||||
global $database;
|
||||
$tags = $database->db->GetCol("SELECT tag,count(image_id) AS count FROM tags WHERE tag LIKE ? GROUP BY tag ORDER BY count DESC", array($start.'%'));
|
||||
return implode("\n", $tags);
|
||||
}
|
||||
// }}}
|
||||
// html {{{
|
||||
private function build_autocomplete_script() {
|
||||
global $database;
|
||||
$ac_url = html_escape(make_link("autocomplete"));
|
||||
|
||||
return <<<EOD
|
||||
<script>
|
||||
//completion_cache = new array();
|
||||
|
||||
input = byId("search_input");
|
||||
output = byId("search_completions");
|
||||
|
||||
function get_cached_completions(start) {
|
||||
// if(completion_cache[start]) {
|
||||
// return completion_cache[start];
|
||||
// }
|
||||
// else {
|
||||
return null;
|
||||
// }
|
||||
}
|
||||
function get_completions(start) {
|
||||
cached = get_cached_completions(start);
|
||||
if(cached) {
|
||||
output.innerHTML = cached;
|
||||
}
|
||||
else {
|
||||
ajaxRequest("$ac_url/"+start, function(data) {set_completions(start, data);});
|
||||
}
|
||||
}
|
||||
function set_completions(start, data) {
|
||||
// completion_cache[start] = data;
|
||||
output.innerHTML = data;
|
||||
}
|
||||
|
||||
input.onkeyup = function() {
|
||||
if(input.value.length < 3) {
|
||||
output.innerHTML = "";
|
||||
}
|
||||
else {
|
||||
get_completions(input.value);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
EOD;
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
add_event_listener(new AutoComplete());
|
||||
?>
|
@ -122,11 +122,11 @@ class CommentList extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_bool("comment_anon", $_POST['comment_anon']);
|
||||
$event->config->set_int("comment_limit", $_POST['comment_limit']);
|
||||
$event->config->set_int("comment_window", $_POST['comment_window']);
|
||||
$event->config->set_int("comment_count", $_POST['comment_count']);
|
||||
$event->config->set_string("comment_wordpress_key", $_POST['comment_wordpress_key']);
|
||||
$event->config->set_bool_from_post("comment_anon");
|
||||
$event->config->set_int_from_post("comment_limit");
|
||||
$event->config->set_int_from_post("comment_window");
|
||||
$event->config->set_int_from_post("comment_count");
|
||||
$event->config->set_string_from_post("comment_wordpress_key");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
@ -335,6 +335,7 @@ class CommentList extends Extension {
|
||||
|
||||
private function can_comment() {
|
||||
global $config;
|
||||
global $user;
|
||||
return ($config->get_bool('comment_anon') || !$user->is_anonymous());
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,16 @@ class Downtime extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_bool("downtime", $_POST['downtime']);
|
||||
$event->config->set_string("downtime_message", $_POST['downtime_message']);
|
||||
$event->config->set_bool_from_post("downtime");
|
||||
$event->config->set_string_from_post("downtime_message");
|
||||
}
|
||||
if(is_a($event, 'PageRequestEvent')) {
|
||||
global $config;
|
||||
if($config->get_bool("downtime")) {
|
||||
global $page;
|
||||
|
||||
$page->add_side_block(new Block("Downtime", "<span style='font-size: 1.5em'><b>DOWNTIME MODE IS ON!</b></span>"), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
@ -15,7 +15,7 @@ class News extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_string("news_text", $_POST['news_text']);
|
||||
$event->config->set_string_from_post("news_text");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Notes extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
global $config;
|
||||
if($config->get_int("ext_notes_version") < 1) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'DisplayingImageEvent')) {
|
||||
global $page;
|
||||
$page->add_main_block(new Block(null, $this->make_notes($event->image->id)));
|
||||
}
|
||||
}
|
||||
|
||||
protected function install() {
|
||||
global $database;
|
||||
global $config;
|
||||
$database->db->Execute("CREATE TABLE `image_notes` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`image_id` int(11) NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`owner_ip` char(15) NOT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
`version` int(11) DEFAULT 1 NOT NULL,
|
||||
`is_active` enum('Y', 'N') DEFAULT 'Y' NOT NULL,
|
||||
`x` int(11) NOT NULL,
|
||||
`y` int(11) NOT NULL,
|
||||
`w` int(11) NOT NULL,
|
||||
`h` int(11) NOT NULL,
|
||||
`body` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
)");
|
||||
$config->set_int("ext_notes_version", 1);
|
||||
}
|
||||
|
||||
private function make_notes($image_id) {
|
||||
global $database;
|
||||
$notes = $database->db->GetAll("SELECT * FROM image_notes WHERE image_id = ?", array($image_id));
|
||||
|
||||
return <<<EOD
|
||||
<script type="text/javascript">
|
||||
img = byId("main_image");
|
||||
</script>
|
||||
EOD;
|
||||
}
|
||||
}
|
||||
add_event_listener(new Notes());
|
||||
?>
|
@ -1,130 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Ratings extends Extension {
|
||||
// event handler {{{
|
||||
public function receive_event($event) {
|
||||
if(is_a($event, 'InitExtEvent')) {
|
||||
global $config;
|
||||
if($config->get_int("ext_ratings_version") < 1) {
|
||||
$this->install();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(is_a($event, 'ImageDeletionEvent')) {
|
||||
$this->delete_comments($event->image->id);
|
||||
}
|
||||
if(is_a($event, 'CommentDeletionEvent')) {
|
||||
$this->delete_comment($event->comment_id);
|
||||
}
|
||||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Comment Options");
|
||||
$sb->add_label("Allow anonymous comments ");
|
||||
$sb->add_bool_option("comment_anon");
|
||||
$sb->add_label("<br>Limit to ");
|
||||
$sb->add_int_option("comment_limit", 1, 60);
|
||||
$sb->add_label(" comments per ");
|
||||
$sb->add_int_option("comment_window", 1, 60);
|
||||
$sb->add_label(" minutes");
|
||||
$sb->add_label("<br>Show ");
|
||||
$sb->add_int_option("comment_count", 0, 100);
|
||||
$sb->add_label(" recent comments on the index");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_bool("comment_anon", $_POST['comment_anon']);
|
||||
$event->config->set_int("comment_limit", $_POST['comment_limit']);
|
||||
$event->config->set_int("comment_window", $_POST['comment_window']);
|
||||
$event->config->set_int("comment_count", $_POST['comment_count']);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private function can_comment() {
|
||||
global $config, $user;
|
||||
return $config->get_bool("rate_anon") || ($user->id != $config->get_int("anon_id"));
|
||||
}
|
||||
// }}}
|
||||
// installer {{{
|
||||
protected function install() {
|
||||
global $database;
|
||||
global $config;
|
||||
$database->db->Execute("CREATE TABLE `image_voters` (
|
||||
`image_id` int(11) NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`vote` tinyint(4) NOT NULL,
|
||||
`voted` datetime NOT NULL,
|
||||
PRIMARY KEY (`image_id`,`user_id`)
|
||||
)");
|
||||
$config->set_int("ext_ratings_version", 1);
|
||||
}
|
||||
// }}}
|
||||
// page building {{{
|
||||
|
||||
private function build_image_rating($image_id) {
|
||||
global $config;
|
||||
$i_image_id = int_escape($image_id);
|
||||
return $this->query_to_html("
|
||||
SELECT
|
||||
users.id as user_id, users.name as user_name,
|
||||
comments.comment as comment, comments.id as comment_id,
|
||||
comments.image_id as image_id, comments.owner_ip as poster_ip
|
||||
FROM comments
|
||||
LEFT JOIN users ON comments.owner_id=users.id
|
||||
WHERE comments.image_id=?
|
||||
ORDER BY comments.id ASC
|
||||
LIMIT ?
|
||||
", array($i_image_id, $config->get_int('recent_count')));
|
||||
}
|
||||
|
||||
private function build_rater($image_id) {
|
||||
if($this->can_comment()) {
|
||||
$i_image_id = int_escape($image_id);
|
||||
return "
|
||||
<form action='".make_link("rating/vote_up")."' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||
<input type='submit' value='Vote Up' />
|
||||
</form>
|
||||
<form action='".make_link("rating/vote_down")."' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||
<input type='submit' value='Vote Down' />
|
||||
</form>
|
||||
";
|
||||
}
|
||||
else {
|
||||
return "You need to create an account before you can rate";
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
// add / remove / edit comments {{{
|
||||
private function add_rating($image_id, $rating) {
|
||||
global $user;
|
||||
global $database;
|
||||
global $config;
|
||||
global $page;
|
||||
|
||||
$page->set_title("Error");
|
||||
$page->set_heading("Error");
|
||||
if(!$config->get_bool('rating_anon') && $user->is_anonymous()) {
|
||||
$page->add_main_block(new Block("Permission Denied", "Anonymous rating has been disabled"));
|
||||
}
|
||||
else {
|
||||
$i_rating = int_escape($rating);
|
||||
$database->db->Execute(
|
||||
"INSERT INTO image_ratings(image_id, user_id, rating, rated) ".
|
||||
"VALUES(?, ?, ?, now())",
|
||||
array($image_id, $user->id, $i_rating));
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("post/view/".int_escape($image_id)));
|
||||
}
|
||||
}
|
||||
|
||||
private function delete_ratings($image_id) {
|
||||
global $database;
|
||||
$database->db->Execute("DELETE FROM image_voters WHERE image_id=?", array($image_id));
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
add_event_listener(new Ratings());
|
||||
?>
|
@ -38,7 +38,7 @@ class RegenThumb extends Extension {
|
||||
switch($program) {
|
||||
case 'convert':
|
||||
unlink($f_thumb);
|
||||
exec("convert $f_image -geometry {$w}x{$h} -quality {$q} $f_thumb");
|
||||
exec("convert {$f_image}[0] -geometry {$w}x{$h} -quality {$q} jpg:$f_thumb");
|
||||
break;
|
||||
case 'gd':
|
||||
$this->make_thumb_gd($f_image, $f_thumb);
|
||||
@ -83,28 +83,6 @@ class RegenThumb extends Extension {
|
||||
return imagejpeg($thumb, $outname, $config->get_int('thumb_quality'));
|
||||
}
|
||||
|
||||
private function get_memory_limit() {
|
||||
global $config;
|
||||
|
||||
// thumbnail generation requires lots of memory
|
||||
$default_limit = 8*1024*1024;
|
||||
$shimmie_limit = parse_shorthand_int($config->get_int("thumb_gd_mem_limit"));
|
||||
if($shimmie_limit < 3*1024*1024) {
|
||||
// we aren't going to fit, override
|
||||
$shimmie_limit = $default_limit;
|
||||
}
|
||||
|
||||
ini_set("memory_limit", $shimmie_limit);
|
||||
$memory = parse_shorthand_int(ini_get("memory_limit"));
|
||||
|
||||
// changing of memory limit is disabled / failed
|
||||
if($memory == -1) {
|
||||
$memory = $default_limit;
|
||||
}
|
||||
|
||||
return $memory;
|
||||
}
|
||||
|
||||
private function get_thumb($tmpname) {
|
||||
global $config;
|
||||
|
||||
@ -116,7 +94,7 @@ class RegenThumb extends Extension {
|
||||
$max_height = $config->get_int('thumb_height');
|
||||
|
||||
$memory_use = (filesize($tmpname)*2) + ($width*$height*4) + (4*1024*1024);
|
||||
$memory_limit = $this->get_memory_limit();
|
||||
$memory_limit = get_memory_limit();
|
||||
|
||||
if($memory_use > $memory_limit) {
|
||||
$thumb = imagecreatetruecolor($max_width, min($max_height, 64));
|
||||
|
@ -54,10 +54,10 @@ class TagList extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_int("tags_min", $_POST['tags_min']);
|
||||
$event->config->set_int_from_post("tags_min");
|
||||
|
||||
$event->config->set_int("popular_count", $_POST['popular_count']);
|
||||
$event->config->set_string("info_link", $_POST['info_link']);
|
||||
$event->config->set_int_from_post("popular_count");
|
||||
$event->config->set_string_from_post("info_link");
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
@ -14,7 +14,7 @@ class Zoom extends Extension {
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
$event->config->set_bool("image_zoom", $_POST['image_zoom']);
|
||||
$event->config->set_bool_from_post("image_zoom");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,6 +248,13 @@ function insert_defaults($dsn, $admin_name, $admin_pass) { // {{{
|
||||
|
||||
$admin_pass = md5(strtolower($admin_name).$admin_pass);
|
||||
$db->Execute($user_insert, Array($admin_name, $admin_pass, 'Y'));
|
||||
|
||||
if(!ini_get('safe_mode')) {
|
||||
$convert_check = exec("convert");
|
||||
if(!empty($convert_check)) {
|
||||
$db->Execute($config_insert, Array('thumb_engine', 'convert'));
|
||||
}
|
||||
}
|
||||
|
||||
$db->Close();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
global $config;
|
||||
$base_href = $config->get_string('base_href');
|
||||
$data_href = $config->get_string('data_href');
|
||||
@ -14,6 +14,11 @@ function block_to_html($block) {
|
||||
return $html;
|
||||
}
|
||||
|
||||
$header_html = "";
|
||||
foreach($this->headers as $line) {
|
||||
$header_html .= "\t\t$line";
|
||||
}
|
||||
|
||||
$sideblock_html = "";
|
||||
foreach($this->sideblocks as $block) {
|
||||
$sideblock_html .= block_to_html($block);
|
||||
@ -73,6 +78,7 @@ print <<<EOD
|
||||
<head>
|
||||
<title>{$this->title}</title>
|
||||
<link rel="stylesheet" href="$data_href/themes/default/style.css" type="text/css">
|
||||
$header_html
|
||||
<script src='$data_href/themes/default/sidebar.js' type='text/javascript'></script>
|
||||
$script_html
|
||||
</head>
|
||||
|
Loading…
x
Reference in New Issue
Block a user