Exemplo n.º 1
0
 include "{$THIS_BASEPATH}/include/class.update_hacks.php";
 if (isset($_POST["add_hack_folder"])) {
     $hack_folder = $_POST["add_hack_folder"];
 } elseif (isset($_GET["add_hack_folder"])) {
     $hack_folder = urldecode($_GET["add_hack_folder"]);
 }
 // used to define the current path (hack path)
 $CURRENT_FOLDER = "{$THIS_BASEPATH}/hacks/{$hack_folder}";
 // create object
 $newhack = new update_hacks();
 // we open the work definition file
 $hstring = $newhack->open_hack("{$THIS_BASEPATH}/hacks/{$hack_folder}/modification.xml");
 // all structure is now in an array
 $new_hack_array = $newhack->hack_to_array($hstring);
 // we will install the hack or we can just test if installation will run fine.
 if ($newhack->install_hack($new_hack_array, true)) {
     $admintpl->set("test_result", $newhack->file);
     $admintpl->set("test", true, true);
     $admintpl->set("test_ok", true, true);
     $admintpl->set("test_ok2", false, true);
 } else {
     $admintpl->set("test_result", $newhack->errors);
     $admintpl->set("test", true, true);
     $admintpl->set("test_ok", false, true);
     $admintpl->set("test_ok2", true, true);
     $admintpl->set("hack_manual_link", "index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=hacks&action=manual&folder=" . urlencode(base64_encode(str_replace("\\", "/", $CURRENT_FOLDER))));
 }
 $admintpl->set("language", $language);
 $admintpl->set("hack_folder", $hack_folder);
 $admintpl->set("hack_install", $language["HACK_INSTALL"]);
 $admintpl->set("hack_main_link", "index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=hacks&action=read");