diff --git a/README.txt b/README.txt
index 622d90a9..b419b692 100644
--- a/README.txt
+++ b/README.txt
@@ -1,10 +1,13 @@
- _________.__ .__ .__ ________
- / _____/| |__ |__| _____ _____ |__| ____ \_____ \
- \_____ \ | | \| |/ \ / \| |/ __ \ / ____/
- / \| Y \ | Y Y \ Y Y \ \ ___// \
- /_______ /|___| /__|__|_| /__|_| /__|\___ >_______ \
- \/ \/ \/ \/ \/ \/
+ _________.__ .__ .__ ________
+ / _____/| |__ |__| _____ _____ |__| ____ \_____ \
+ \_____ \ | | \ | | / \ / \ | |_/ __ \ / ____/
+ / \| Y \| || Y Y \| Y Y \| |\ ___/ / \
+ /_______ /|___| /|__||__|_| /|__|_| /|__| \___ >\_______ \
+ \/ \/ \/ \/ \/ \/
+
+_________________________________________________________________________
+
Shimmie Alpha
~~~~~~~~~~~~~
@@ -58,6 +61,15 @@ database and file formats haven't changed *completely*, it's different
enough to be a pain.
+Custom Configuration
+~~~~~~~~~~~~~~~~~~~~
+
+Various aspects of Shimmie can be configured to suit your site specific
+needs via the file "config.php" (created after installation).
+Take a look at "core/default_config.inc.php" for the available options
+that can used.
+
+
Development Info
~~~~~~~~~~~~~~~~
http://shimmie.shishnet.org/doc/
@@ -70,7 +82,7 @@ Contact
~~~~~~~
#shimmie on Freenode -- IRC
webmaster at shishnet.org -- email
-https://github.com/shish/shimmie2 -- bug tracker
+https://github.com/shish/shimmie2/issues -- bug tracker
Licence
diff --git a/contrib/resize/main.php b/contrib/resize/main.php
index 51b1bf24..bb5b423b 100644
--- a/contrib/resize/main.php
+++ b/contrib/resize/main.php
@@ -172,8 +172,19 @@ class ResizeImage extends Extension {
throw new ImageResizeException("The image size does not match what is in the database! - Aborting Resize.");
}
- /* Check memory usage limits */
- $memory_use = (filesize($image_filename)*2) + ($width*$height*4) + (4*1024*1024);
+ /*
+ Check Memory usage limits
+
+ Old check: $memory_use = (filesize($image_filename)*2) + ($width*$height*4) + (4*1024*1024);
+ New check: memory_use = width * height * (bits per channel) * channels * 2.5
+
+ It didn't make sense to compute the memory usage based on the NEW size for the image. ($width*$height*4)
+ We need to consider the size that we are GOING TO instead.
+
+ 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;
$memory_limit = get_memory_limit();
if ($memory_use > $memory_limit) {
@@ -191,7 +202,7 @@ class ResizeImage extends Extension {
else $factor = min( $width / $image_obj->width, $height / $image_obj->height );
$new_width = round( $image_obj->width * $factor );
- $new_height = round( $image_obj->height * $factor );
+ $new_height = round( $image_obj->height * $factor );
}
/* Attempt to load the image */
diff --git a/core/default_config.inc.php b/core/default_config.inc.php
index 2f3003ca..c6a44b57 100644
--- a/core/default_config.inc.php
+++ b/core/default_config.inc.php
@@ -1,4 +1,16 @@
diff --git a/core/util.inc.php b/core/util.inc.php
index 04fb2b65..158d1f2e 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -547,24 +547,48 @@ function get_memory_limit() {
global $config;
// thumbnail generation requires lots of memory
- $default_limit = 8*1024*1024;
+ $default_limit = 8*1024*1024; // 8 MB of memory is PHP's default.
$shimmie_limit = parse_shorthand_int($config->get_int("thumb_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);
+
+ /*
+ Get PHP's configured memory limit.
+ Note that this is set to -1 for NO memory limit.
+
+ http://ca2.php.net/manual/en/ini.core.php#ini.memory-limit
+ */
$memory = parse_shorthand_int(ini_get("memory_limit"));
-
- // changing of memory limit is disabled / failed
- if($memory == -1) {
- $memory = $default_limit;
+
+ if ($memory == -1) {
+ // No memory limit.
+
+ // Return the larger of the set limits.
+ if ($shimmie_limit > $default_limit) {
+ return $shimmie_limit;
+ } else {
+ return $default_limit; // return the default memory limit
+ }
+ } else {
+ // PHP has a memory limit set.
+
+ if ($shimmie_limit > $memory) {
+ // Shimmie wants more memory than what PHP is currently set for.
+
+ // Attempt to set PHP's memory limit.
+ if ( ini_set("memory_limit", $shimmie_limit) === FALSE ) {
+ /* We can't change PHP's limit, oh well, return whatever its currently set to */
+ return $memory;
+ }
+ $memory = parse_shorthand_int(ini_get("memory_limit"));
+ }
+
+ // PHP's memory limit is more than Shimmie needs.
+ return $memory; // return the current setting
}
-
- assert($memory > 0);
-
- return $memory;
}
/**
diff --git a/ext/alias_editor/theme.php b/ext/alias_editor/theme.php
index 7b6bfb49..dfb24f44 100644
--- a/ext/alias_editor/theme.php
+++ b/ext/alias_editor/theme.php
@@ -12,8 +12,8 @@ class AliasEditorTheme extends Themelet {
$can_manage = $user->can("manage_alias_list");
if($can_manage) {
- $action = "
Action | ";
- $add = "
+ $h_action = "Action | ";
+ $h_add = "
".make_form(make_link("alias/add"))."
|
@@ -24,8 +24,8 @@ class AliasEditorTheme extends Themelet {
";
}
else {
- $action = "";
- $add = "";
+ $h_action = "";
+ $h_add = "";
}
$h_aliases = "";
@@ -49,15 +49,10 @@ class AliasEditorTheme extends Themelet {
$h_aliases .= "
";
}
$html = "
-
-
- From | To | $action
+
+ From | To | $h_action
$h_aliases
- $add
+ $h_add
Download as CSV
";
diff --git a/ext/comment/theme.php b/ext/comment/theme.php
index acdabed2..0da3f240 100644
--- a/ext/comment/theme.php
+++ b/ext/comment/theme.php
@@ -167,7 +167,6 @@ class CommentListTheme extends Themelet {
if($i_uid == $config->get_int("anon_id")) {
$anoncode = "";
- $style = "";
$anoncode2 = "";
if($this->show_anon_id) {
$anoncode = ''.$this->anon_id.'';
@@ -181,7 +180,7 @@ class CommentListTheme extends Themelet {
}
}
}
- $h_userlink = "" . $h_name . $anoncode . $anoncode2 . "";
+ $h_userlink = "" . $h_name . $anoncode . $anoncode2 . "";
$this->anon_id++;
}
else {
@@ -197,10 +196,10 @@ class CommentListTheme extends Themelet {
';
}
else {
- $avatar = "";
+ $h_avatar = "";
if(!empty($comment->owner_email)) {
$hash = md5(strtolower($comment->owner_email));
- $avatar = "
";
+ $h_avatar = "
";
}
$h_reply = " - Reply";
$h_ip = $user->can("view_ip") ? "
".show_ip($comment->poster_ip, "Comment posted {$comment->posted}") : "";
@@ -211,7 +210,7 @@ class CommentListTheme extends Themelet {
@@ -135,8 +135,8 @@ class UserPageTheme extends Themelet {
assert(is_array($stats));
$stats[] = 'User ID: '.$duser->id;
- $page->set_title($duser->name."'s Page");
- $page->set_heading($duser->name."'s Page");
+ $page->set_title(html_escape($duser->name)."'s Page");
+ $page->set_heading(html_escape($duser->name)."'s Page");
$page->add_block(new NavBlock());
$page->add_block(new Block("Stats", join("
", $stats), "main", 0));
diff --git a/ext/view/theme.php b/ext/view/theme.php
index 7e0bd8b9..4bce845d 100644
--- a/ext/view/theme.php
+++ b/ext/view/theme.php
@@ -7,11 +7,11 @@ class ViewImageTheme extends Themelet {
public function display_page(Image $image, $editor_parts) {
global $page;
- $metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
+ $h_metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
- $page->add_html_header("");
- $page->add_html_header("");
+ $page->add_html_header("");
+ $page->add_html_header("");
$page->add_html_header("");
$page->add_html_header("get_thumb_link())."\">");
$page->add_html_header("id}"))."\">");
'; diff --git a/ext/ext_manager/theme.php b/ext/ext_manager/theme.php index 7dd74d5c..879380cb 100644 --- a/ext/ext_manager/theme.php +++ b/ext/ext_manager/theme.php @@ -3,7 +3,7 @@ class ExtManagerTheme extends Themelet { public function display_table(Page $page, /*array*/ $extensions, /*bool*/ $editable) { global $user; - $en = $editable ? "
'.$tac.'
';} - $reca = "