Пример #1
0
     $hack_id = 0;
 }
 $ui_hack = get_result("SELECT folder FROM {$TABLE_PREFIX}hacks WHERE id={$hack_id}", true);
 if (count($ui_hack) > 0) {
     include "{$THIS_BASEPATH}/include/class.update_hacks.php";
     $hack_folder = unesc($ui_hack[0]["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->uninstall_hack($new_hack_array, true)) {
         $admintpl->set("test_result", $newhack->file);
         $admintpl->set("test", true, true);
         $admintpl->set("test_ok", true, true);
     } else {
         $admintpl->set("test_result", $newhack->errors);
         $admintpl->set("test", true, true);
         $admintpl->set("test_ok", false, true);
     }
     $admintpl->set("language", $language);
     $admintpl->set("hack_folder", $hack_folder);
     $admintpl->set("hack_install", $language["HACK_UNINSTALL"]);
     $admintpl->set("hack_main_link", "index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=hacks&action=read");
     $admintpl->set("form_action", "index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=hacks&action=uninstall_ok&id={$hack_id}");
     $admintpl->set("hack_title_action", "<b>" . $language["HACK_UNINSTALL"] . ":&nbsp;" . $new_hack_array[0]["title"] . "</b>");
 } else {
Пример #2
0
//      and/or other materials provided with the distribution.
//   3. The name of the author may not be used to endorse or promote products
//      derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
////////////////////////////////////////////////////////////////////////////////////
// test file to see how it work...
require "../../include/class.update_hacks.php";
$CURRENT_FOLDER = dirname(__FILE__);
// create object
$newhack = new update_hacks();
// we open the work definition file
$hstring = $newhack->open_hack(dirname(__FILE__) . "/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, in this case we just test.
if ($newhack->uninstall_hack($new_hack_array)) {
    print_r($newhack->file);
} else {
    print_r($newhack->errors);
}