summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorjhilden <jakobhilden@gmail.com>2009-06-04 21:32:45 -0400
committerjhilden <jakobhilden@gmail.com>2009-06-04 21:32:45 -0400
commit81d20c79b6c17a3c395d74da9aa995b24fd06810 (patch)
treec722b6514e4adca2a8ac6efd285a1d89bcc66c82 /modules
parent8933a19f1fb56378c1be68bd82c91a577fece87d (diff)
parent5158a6f4339ee85b928e6bd33a937a24f91f8bc2 (diff)
fixed another bug with the filesize unit and added a better error message
Merge branch 'master' of git@github.com:gallery/gallery3 Conflicts: modules/gallery/views/simple_uploader.html.php
Diffstat (limited to 'modules')
-rw-r--r--modules/akismet/helpers/akismet_menu.php6
-rw-r--r--modules/gallery/helpers/MY_num.php40
-rw-r--r--modules/gallery/helpers/gallery_menu.php10
-rw-r--r--modules/gallery/views/simple_uploader.html.php13
4 files changed, 51 insertions, 18 deletions
diff --git a/modules/akismet/helpers/akismet_menu.php b/modules/akismet/helpers/akismet_menu.php
index ebd948d6..2862fd40 100644
--- a/modules/akismet/helpers/akismet_menu.php
+++ b/modules/akismet/helpers/akismet_menu.php
@@ -26,6 +26,12 @@ class akismet_menu_Core {
->url(url::site("admin/akismet")));
if (module::get_var("akismet", "api_key")) {
+ if (!$statistics_menu = $menu->get("statistics_menu")) {
+ $menu->append(Menu::factory("submenu")
+ ->id("statistics_menu")
+ ->label(t("Statistics")));
+ }
+
$menu->get("statistics_menu")
->append(Menu::factory("link")
->id("akismet")
diff --git a/modules/gallery/helpers/MY_num.php b/modules/gallery/helpers/MY_num.php
new file mode 100644
index 00000000..613b99df
--- /dev/null
+++ b/modules/gallery/helpers/MY_num.php
@@ -0,0 +1,40 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class num extends num_Core {
+ /**
+ * Convert a size value as accepted by PHP's shorthand to bytes.
+ * ref: http://us2.php.net/manual/en/function.ini-get.php
+ * ref: http://us2.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
+ */
+ static function convert_to_bytes($val) {
+ $val = trim($val);
+ $last = strtolower($val[strlen($val)-1]);
+ switch($last) {
+ case 'g':
+ $val *= 1024;
+ case 'm':
+ $val *= 1024;
+ case 'k':
+ $val *= 1024;
+ }
+
+ return $val;
+ }
+}
diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php
index d28e71c9..2a9e193b 100644
--- a/modules/gallery/helpers/gallery_menu.php
+++ b/modules/gallery/helpers/gallery_menu.php
@@ -30,14 +30,14 @@ class gallery_menu_Core {
$can_edit = $item && access::can("edit", $item) || $is_admin;
$can_add = $item && (access::can("add", $item) || $is_admin);
-
+
if ($can_add) {
$menu->append(Menu::factory("dialog")
->id("add_photos_item")
->label(t("Add photos"))
->url(url::site("simple_uploader/app/$item->id")));
}
-
+
if ($item && $can_edit || $can_add) {
$menu->append($options_menu = Menu::factory("submenu")
->id("options_menu")
@@ -156,10 +156,6 @@ class gallery_menu_Core {
->append(Menu::factory("link")
->id("maintenance")
->label(t("Maintenance"))
- ->url(url::site("admin/maintenance")))
- ->append(Menu::factory("submenu")
- ->id("statistics_menu")
- ->label(t("Statistics"))
- ->url("#"));
+ ->url(url::site("admin/maintenance")));
}
}
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php
index 873129d5..81e8c437 100644
--- a/modules/gallery/views/simple_uploader.html.php
+++ b/modules/gallery/views/simple_uploader.html.php
@@ -80,12 +80,7 @@
"user_agent": "<?= Input::instance()->server("HTTP_USER_AGENT") ?>",
"csrf": "<?= $csrf ?>"
},
- <?
- $file_size_limit = ini_get('upload_max_filesize');
- if ($file_size_limit == "") $file_size_limit = "100";
- else $file_size_limit = substr($file_size_limit, 0, strlen($file_size_limit)-1); // strip trailing "M"
- ?>
- file_size_limit : "<?= $file_size_limit ?>MB",
+ file_size_limit : "<?= ini_get("upload_max_filesize") ? num::convert_to_bytes(ini_get("upload_max_filesize"))."B" : "100MB" ?>",
file_types : "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4",
file_types_description : "<?= t("Photos and Movies") ?>",
file_upload_limit : 1000,
@@ -155,11 +150,7 @@
switch (error_code) {
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
fp.title.html(file.name);
- fp.set_status("error", "<strong><?= t("File is too big.") ?></strong>
- <?= t("A likely error source is a too low value for
- <em>upload_max_filesize</em> (".ini_get('upload_max_filesize').")
- and/or <em>max_post_size</em> (".ini_get('max_post_size').")
- in you php.ini.") ?>");
+ fp.set_status("error", "<strong><?= t("File is too big.") ?></strong> <?= t("A likely error source is a too low value for") ?> <br /> <em>upload_max_filesize</em> (<?= ini_get('upload_max_filesize') ?>) <?= t("in your") ?> <em>php.ini</em>.");
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
fp.title.html(file.name);