mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-09 22:49:13 -04:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user