diff --git a/installer/index.php b/installer/index.php index 317f27b8..a11c0b02 100644 --- a/installer/index.php +++ b/installer/index.php @@ -30,10 +30,6 @@ require(DOCROOT . "installer/installer.php"); if (PHP_SAPI == "cli") { include("cli.php"); } else { - if (@$_GET["page"] == "check") { - include("check.html.php"); - } else { - include("web.php"); - } + include("web.php"); } diff --git a/installer/install.sql b/installer/install.sql index 1fe9b866..7da5fe68 100755 --- a/installer/install.sql +++ b/installer/install.sql @@ -32,6 +32,19 @@ CREATE TABLE {access_intents} ( ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; INSERT INTO {access_intents} VALUES (1,1,1,1,0,0,1,1,0,0); +DROP TABLE IF EXISTS {caches}; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE {caches} ( + `id` int(9) NOT NULL auto_increment, + `key` varchar(255) NOT NULL, + `tags` varchar(255) default NULL, + `expiration` int(9) NOT NULL, + `cache` longblob, + PRIMARY KEY (`id`), + KEY `tags` (`tags`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS {comments}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; @@ -208,7 +221,7 @@ CREATE TABLE {modules} ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO {modules} VALUES (1,1,'gallery',3),(2,1,'user',1),(3,1,'comment',2),(4,1,'organize',1),(5,1,'info',1),(6,1,'rss',1),(7,1,'search',1),(8,1,'slideshow',1),(9,1,'tag',1); +INSERT INTO {modules} VALUES (1,1,'gallery',6),(2,1,'user',1),(3,1,'comment',2),(4,1,'organize',1),(5,1,'info',1),(6,1,'rss',1),(7,1,'search',1),(8,1,'slideshow',1),(9,1,'tag',1); DROP TABLE IF EXISTS {outgoing_translations}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; diff --git a/installer/installer.php b/installer/installer.php index 9ba88bea..b0af561e 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -18,31 +18,6 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -// We know that we have either mysql or mysqli. By default we use mysql functions, so if they're -// not defined then do the simplest thing which will work: remap them to their mysqli -// counterparts. -if (!function_exists("mysql_query")) { - function mysql_connect($host, $user, $pass) { - installer::$mysqli = new mysqli($host, $user, $pass); - // http://php.net/manual/en/mysqli.connect.php says to use mysqli_connect_error() instead of - // $mysqli->connect_error because of bugs before PHP 5.2.9 - $error = mysqli_connect_error(); - return empty($error); - } - function mysql_query($query) { - return installer::$mysqli->query($query); - } - function mysql_num_rows($result) { - return $result->num_rows; - } - function mysql_error() { - return installer::$mysqli->error; - } - function mysql_select_db($db) { - return installer::$mysqli->select_db($db); - } -} - class installer { static $mysqli; @@ -92,7 +67,32 @@ class installer { } static function connect($config) { - return @mysql_connect($config["host"], $config["user"], $config["password"]); + // We know that we have either mysql or mysqli. By default we use mysql functions, so if + // they're not defined then do the simplest thing which will work: remap them to their mysqli + // counterparts. + if (!function_exists("mysql_query")) { + function mysql_connect($host, $user, $pass) { + installer::$mysqli = new mysqli($host, $user, $pass); + // http://php.net/manual/en/mysqli.connect.php says to use mysqli_connect_error() instead of + // $mysqli->connect_error because of bugs before PHP 5.2.9 + $error = mysqli_connect_error(); + return empty($error); + } + function mysql_query($query) { + return installer::$mysqli->query($query); + } + function mysql_num_rows($result) { + return $result->num_rows; + } + function mysql_error() { + return installer::$mysqli->error; + } + function mysql_select_db($db) { + return installer::$mysqli->select_db($db); + } + } + + return mysql_connect($config["host"], $config["user"], $config["password"]); } static function select_db($config) { diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js index b2895c23..8b271db9 100644 --- a/lib/gallery.show_full_size.js +++ b/lib/gallery.show_full_size.js @@ -26,10 +26,10 @@ var show_full_size = function(image_url, image_width, image_height) { // handle the case where the calculation is almost zero (2.14e-14) return { - top: ((windowHeight - imageHeight) / 2).toFixed(2), - left: ((windowWidth - imageWidth) / 2).toFixed(2), - width: imageWidth.toFixed(2), - height: imageHeight.toFixed(2) + top: Number((windowHeight - imageHeight) / 2), + left: Number((windowWidth - imageWidth) / 2), + width: Number(imageWidth), + height: Number(imageHeight) }; } diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index edaa19ae..af4d946e 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -2,7 +2,7 @@
-
- "
+
"
class="gAvatar"
alt="= p::clean($comment->author_name()) ?>"
width="40"
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php
index 854f9554..d9405e5f 100644
--- a/modules/comment/views/comments.html.php
+++ b/modules/comment/views/comments.html.php
@@ -10,7 +10,7 @@
"
+
"
class="gAvatar"
alt="= p::clean($comment->author_name()) ?>"
width="40"
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index c3c3543c..0e5d29b9 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -259,7 +259,7 @@ class gallery_installer {
module::set_var("gallery", "show_credits", 1);
// @todo this string needs to be picked up by l10n_scanner
module::set_var("gallery", "credits", "Powered by Gallery %version");
- module::set_version("gallery", 5);
+ module::set_version("gallery", 6);
}
static function upgrade($version) {
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index b6b24b27..0e3150bc 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -21,30 +21,12 @@ class gallery_theme_Core {
static function head($theme) {
$session = Session::instance();
$buf = "";
- $theme->script("lib/jquery.js");
- $theme->script("lib/jquery.form.js");
- $theme->script("lib/jquery-ui.js");
- $theme->script("lib/gallery.common.js");
- $theme->script("lib/gallery.dialog.js");
- $theme->script("lib/gallery.form.js");
- $theme->script("lib/superfish/js/superfish.js");
- if ($theme->page_type == 'photo') {
- $theme->script("lib/jquery.scrollTo.js");
- $theme->script("lib/jquery.localscroll.js");
- $theme->script("lib/gallery.show_full_size.js");
- }
- if ($theme->page_type == 'movie') {
- $theme->script("lib/flowplayer.js");
- }
- $theme->script($theme->url("js/ui.init.js", false, true));
if ($session->get("debug")) {
- $buf .= "";
+ $theme->css("modules/gallery/css/debug.css");
}
if (($theme->page_type == "album" || $theme->page_type == "photo")
&& access::can("edit", $theme->item())) {
- $buf .= "";
+ $theme->css("modules/gallery/css/quick.css");
$theme->script("modules/gallery/js/quick.js");
}
@@ -57,8 +39,7 @@ class gallery_theme_Core {
}
if ($session->get("l10n_mode", false)) {
- $buf .= "";
+ $theme->css("modules/gallery/css/l10n_client.css");
$theme->script("lib/jquery.cookie.js");
$theme->script("modules/gallery/js/l10n_client.js");
}
@@ -94,28 +75,15 @@ class gallery_theme_Core {
static function admin_head($theme) {
$session = Session::instance();
- $buf = "";
- $theme->script("lib/jquery.js");
- $theme->script("lib/jquery.form.js");
- $theme->script("lib/jquery-ui.js");
- $theme->script("lib/gallery.common.js");
- $theme->script("lib/gallery.dialog.js");
- $theme->script("lib/superfish/js/superfish.js");
- $theme->script($theme->url("js/jquery.dropshadow.js", false, true));
- $theme->script($theme->url("js/ui.init.js", false, true));
if ($session->get("debug")) {
- $buf .= "";
+ $theme->css("modules/gallery/css/debug.css");
}
if ($session->get("l10n_mode", false)) {
- $buf .= "";
+ $theme->css("modules/gallery/css/l10n_client.css");
$theme->script("lib/jquery.cookie.js");
$theme->script("modules/gallery/js/l10n_client.js");
}
-
- return $buf;
}
static function page_bottom($theme) {
diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php
index 7a7396eb..01496c0d 100644
--- a/modules/gallery/libraries/Admin_View.php
+++ b/modules/gallery/libraries/Admin_View.php
@@ -17,9 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Admin_View_Core extends View {
- private $theme_name = null;
-
+class Admin_View_Core extends Gallery_View {
/**
* Attempts to load a view and pre-load view data.
*
@@ -46,15 +44,6 @@ class Admin_View_Core extends View {
$this->set_global("user", user::active());
}
- public function url($path, $absolute_url=false) {
- $arg = "themes/{$this->theme_name}/$path";
- return $absolute_url ? url::abs_file($arg) : url::file($arg);
- }
-
- public function display($page_name, $view_class="View") {
- return new $view_class($page_name);
- }
-
public function admin_menu() {
$menu = Menu::factory("root");
gallery_menu::admin($menu, $this);
@@ -109,6 +98,10 @@ class Admin_View_Core extends View {
}
}
+ if ($function == "admin_head") {
+ array_unshift($blocks, $this->combine_script());
+ }
+
if (Session::instance()->get("debug")) {
if ($function != "admin_head") {
array_unshift(
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
new file mode 100644
index 00000000..7000d3de
--- /dev/null
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -0,0 +1,124 @@
+scripts[$file] = 1;
+ }
+
+ /**
+ * Add a script to the combined scripts list.
+ * @param $file the relative path to a script from the base of the active theme
+ * @param
+ */
+ public function theme_script($file) {
+ $file = "themes/{$this->theme_name}/$file";
+ $this->scripts[$file] = 1;
+ }
+
+ /**
+ * Provide a url to a resource within the current theme. This allows us to refer to theme
+ * resources without naming the theme itself which makes themes easier to copy.
+ */
+ public function theme_url($path, $absolute_url=false) {
+ $arg = "themes/{$this->theme_name}/$path";
+ return $absolute_url ? url::abs_file($arg) : url::file($arg);
+ }
+
+ /**
+ * Combine a series of Javascript files into a single one and cache it in the database, then
+ * return a single ";
+ }
+
+ /**
+ * Add a css file to the combined css list.
+ * @param $file the relative path to a script from the gallery3 directory
+ */
+ public function css($file, $theme_relative=false) {
+ $this->css[$file] = 1;
+ }
+
+ /**
+ * Add a css file to the combined css list.
+ * @param $file the relative path to a script from the base of the active theme
+ * @param
+ */
+ public function theme_css($file) {
+ $file = "themes/{$this->theme_name}/$file";
+ $this->css[$file] = 1;
+ }
+
+ /**
+ * Combine a series of Javascript files into a single one and cache it in the database, then
+ * return a single ";
- }
-
- /**
- * Combine a series of Javascript files into a single one and cache it in the database, then
- * return a single
+
user = $user->admin ? "admin" : "" ?>">
- "
+
"
title="= t("Drag user onto group below to add as a new member") ?>"
alt="= p::clean($user->name) ?>"
width="20"
diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php
index 1361ae33..2a231057 100644
--- a/themes/admin_default/views/admin.html.php
+++ b/themes/admin_default/views/admin.html.php
@@ -6,7 +6,26 @@
" src="= $theme->url("images/logo.png") ?>" />
+
" src="= $theme->theme_url("images/logo.png") ?>" />
endif ?>
diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php
index c74d4097..f6984958 100644
--- a/themes/default/views/page.html.php
+++ b/themes/default/views/page.html.php
@@ -23,18 +23,13 @@
endif ?>
endif ?>
- " type="image/x-icon" />
- "
- media="screen,print,projection" />
- "
- media="screen" />
- "
- media="screen,print,projection" />
- "
- media="screen,print,projection" />
+ " type="image/x-icon" />
+ = $theme->css("lib/yui/reset-fonts-grids.css") ?>
+ = $theme->css("lib/themeroller/ui.base.css") ?>
+ = $theme->css("lib/superfish/css/superfish.css") ?>
+ = $theme->theme_css("css/screen.css") ?>
if ($theme->page_type == 'album'): ?>
if ($thumb_proportion != 1): ?>
@@ -49,6 +44,24 @@
endif ?>
endif ?>
+ = $theme->script("lib/jquery.js") ?>
+ = $theme->script("lib/jquery.form.js") ?>
+ = $theme->script("lib/jquery-ui.js") ?>
+ = $theme->script("lib/gallery.common.js") ?>
+ = $theme->script("lib/gallery.dialog.js") ?>
+ = $theme->script("lib/gallery.form.js") ?>
+ = $theme->script("lib/superfish/js/superfish.js") ?>
+ = $theme->script("lib/jquery.localscroll.js") ?>
+ = $theme->theme_script("js/ui.init.js") ?>
+
+ /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
+ if ($theme->page_type == "photo"): ?>
+ = $theme->script("lib/jquery.scrollTo.js") ?>
+ = $theme->script("lib/gallery.show_full_size.js") ?>
+ elseif ($theme->page_type == "movie"): ?>
+ = $theme->script("lib/flowplayer.js") ?>
+ endif ?>
+
= $theme->head() ?>
@@ -57,7 +70,7 @@