예제 #1
0
         stderr($language["ERROR"], join("<br />\n", $newhack->errors));
     }
     break;
 case 'test':
     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&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=hacks&amp;action=manual&folder=" . urlencode(base64_encode(str_replace("\\", "/", $CURRENT_FOLDER))));
     }
예제 #2
0
파일: test.php 프로젝트: wilian32/xbtit
//      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);
}