コード例 #1
0
ファイル: plugin.php プロジェクト: Kheros/MMOver
if ($_POST['do'] == 'productimport') {
    $vbulletin->input->clean_array_gpc('p', array('serverfile' => TYPE_STR, 'allowoverwrite' => TYPE_BOOL));
    $vbulletin->input->clean_array_gpc('f', array('productfile' => TYPE_FILE));
    if (file_exists($vbulletin->GPC['productfile']['tmp_name'])) {
        // got an uploaded file?
        $xml = file_read($vbulletin->GPC['productfile']['tmp_name']);
    } else {
        if (file_exists($vbulletin->GPC['serverfile'])) {
            // no uploaded file - got a local file?
            $xml = file_read($vbulletin->GPC['serverfile']);
        } else {
            print_stop_message('no_file_uploaded_and_no_local_file_found');
        }
    }
    try {
        $info = install_product($xml, $vbulletin->GPC['allowoverwrite']);
    } catch (vB_Exception_AdminStopMessage $e) {
        //move print_stop_message calls from install_product so we
        //can use it places where said calls aren't appropriate.
        call_user_func_array('print_stop_message', $e->getParams());
    }
    /*
    	Figure out what we want to do in the end.
    	What we'd like to do is
    		1. If don't need a merge, print the stop message which redirects to either the defined redirect
    			for the product or the default redirect (aka the products admin page)
    		2. If we do, then redirect to the merge page which will redirect to the proper redirect page
    			when finished.
    
    	As always users complicate things.  Some products want to display errors which get unreadable when
    	the page automatically redirects.  We have a DISABLE_PRODUCT_REDIRECT flag which is supposed to
コード例 #2
0
ファイル: upgradecore.php プロジェクト: hungnv0789/vhtm
function upgrade_product_step($productid)
{
	global $vbulletin;
	global $upgrade_phrases;

	$product_file = DIR . "/includes/xml/product-$productid.xml";
	$exists = file_exists($product_file);
	if (!$exists)
	{
		$upgrade_phrases['finalupgrade.php']['product_not_found'];
		return false;
	}

	require_once(DIR . "/includes/adminfunctions_plugin.php");
	require_once(DIR . "/includes/adminfunctions_template.php");
	require_once(DIR . '/includes/class_bootstrap_framework.php');
	vB_Bootstrap_Framework::init();

	echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['installing_product'] . "</p>");
	$xml = file_read($product_file);

	try
	{
		install_product($xml, true);
	}
	catch(vB_Exception_AdminStopMessage $e)
	{
		$args = $e->getParams();
		$message = fetch_phrase($args[0], 'error', '', false);

		if (sizeof($args) > 1)
		{
			$args[0] = $message;
			$message = call_user_func_array('construct_phrase', $args);
		}

		echo "<p>$message</p>\n";
		echo "<p>" . $upgrade_phrases['finalupgrade.php']['product_not_installed'] . "</p>";
		return false;
	}

	echo_flush("<p>" . $upgrade_phrases['finalupgrade.php']['product_installed'] . "</p>");
	return true;
}