diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-05-12 21:48:29 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-12 21:48:29 +0000 |
commit | 7c6276adb95ef664307d22a13c6ec7d024c8a00a (patch) | |
tree | 22a1c577ecf495bf71ee47bb6f6a67518db38fa0 /modules | |
parent | b1ea27a1b9c221aef1b40a864576d6376270b884 (diff) |
Deal with the user-entered g2 embed.php path a little more sanely so that if the user enters the path to G2 itself, we find the embed.php path from there.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/controllers/admin_g2_import.php | 4 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index 501051f1..04432866 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -42,6 +42,10 @@ class Admin_g2_import_Controller extends Admin_Controller { $form = $this->_get_import_form(); if ($form->validate()) { $embed_path = $form->configure_g2_import->embed_path->value; + if (!is_file($embed_path) && file_exists("$embed_path/embed.php")) { + $embed_path = "$embed_path/embed.php"; + } + if (g2_import::is_valid_embed_path($embed_path)) { message::success("Gallery 2 path saved."); module::set_var("g2_import", "embed_path", $embed_path); diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index ef8065ad..7eb7724f 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -52,6 +52,10 @@ class g2_import_Core { * Initialize the embedded Gallery2 instance. Call this before any other Gallery2 calls. */ static function init_embed($embed_path) { + if (!is_file($embed_path)) { + return false; + } + require($embed_path); if (!class_exists("GalleryEmbed")) { return false; |