public function save() { $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); url::redirect("admin/g2_import"); } else { $form->configure_g2_import->embed_path->add_error("invalid", 1); } } $view = new Admin_View("admin.html"); $view->content = new View("admin_g2_import.html"); $view->content->form = $form; print $view; }
public function save() { access::verify_csrf(); g2_import::lower_error_reporting(); $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_init_error = g2_import::is_valid_embed_path($embed_path)) == "ok") { message::success(t("Gallery 2 path saved")); module::set_var("g2_import", "embed_path", $embed_path); url::redirect("admin/g2_import"); } else { $form->configure_g2_import->embed_path->add_error($g2_init_error, 1); } } $view = new Admin_View("admin.html"); $view->content = new View("admin_g2_import.html"); $view->content->form = $form; g2_import::restore_error_reporting(); print $view; }