예제 #1
0
/**
 * Returns an array of QInstallationValidationResult objects, or if all
 * instructions / installation requirements were already satisfied, returns
 * an empty array.
 */
function ValidateInstall()
{
    $result = array();
    $docrootOnlyPath = __DOCROOT__ . $_SERVER['PHP_SELF'];
    $docrootWithSubdirPath = __DOCROOT__ . __DEVTOOLS__ . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/"));
    $root = substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF']));
    $part1 = substr($_SERVER['PHP_SELF'], 1, strpos($_SERVER['PHP_SELF'], "/", 1) - 1);
    $part2 = substr($root, strrpos($root, "/") + 1);
    /*
    	// Debugging stuff - there until this code stabilizes across multiple platforms. 
    	
    	print("DOCROOT = " . __DOCROOT__ . "<br>");
    	print("SUBDIR = " . __SUBDIRECTORY__ . "<br>");
    	print("DEVTOOLS = " . __DEVTOOLS__ . "<br>"); 
    		
    	print("PHP_SELF = " . $_SERVER['PHP_SELF'] . "<br>");
    	print("SCRIPT_FILENAME = " . $_SERVER['SCRIPT_FILENAME'] . "<br>");
    
    	print("root = " . $root . "<br>");
    	print("part1 = " . $part1 . "<br>");
    	print("part2 = " . $part2 . "<br>");
    */
    if (!file_exists($docrootOnlyPath)) {
        $obj = new stdClass();
        $obj->strMessage = 'Set the __DOCROOT__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "' . $root . '"';
        $result[] = $obj;
        // At this point, we cannot proceed with any more checks - basic config
        // is not set up. Just exit.
        return $result;
    }
    if (!file_exists($docrootWithSubdirPath)) {
        $obj = new stdClass();
        $obj->strMessage = 'Set the __SUBDIRECTORY__ constant in ' . '/includes/configuration/configuration.inc.php. ' . 'Most likely value: "/' . $part1 . '"';
        $result[] = $obj;
        // At this point, we cannot proceed with any more checks - basic config
        // is not set up. Just exit.
        return $result;
    }
    if (!file_exists(__INCLUDES__)) {
        // Did the user move the __INCLUDES__ directory out of the docroot?
        $obj = new stdClass();
        $obj->strMessage = 'Set the __INCLUDES__ constant in ' . 'includes/configuration/configuration.inc.php. ';
        $result[] = $obj;
        // At this point, we cannot proceed with any more checks - basic config
        // is not set up. Just exit.
        return $result;
    }
    // Now that we know that the basic config is correct, we can actually
    // initialize the full QCubed framework.
    require __CONFIGURATION__ . '/prepend.inc.php';
    $qappValidationResults = QInstallationValidator::Validate();
    $result = array_merge($result, $qappValidationResults);
    return $result;
}
예제 #2
0
<?php

$__CONFIG_ONLY__ = true;
require '../qcubed.inc.php';
require __QCUBED_CORE__ . '/framework/QInstallationValidator.class.php';
$arrInstallationMessages = QInstallationValidator::Validate();
if (sizeof($arrInstallationMessages) == 0) {
    header("Location: start_page.php");
} else {
    $strPageTitle = 'QCubed Configuration Wizard';
    require __CONFIGURATION__ . '/header.inc.php';
    ?>
	<h1>Welcome to QCubed!</h1>
	<h2>PHP5 Model-View-Controller framework</h2>
	<p>
		This simple wizard will help you configure QCubed for first use.
		It'll take you just a couple minutes. If you have any questions along the way, feel free to ping us on the 
		<a target='_blank' href='http://qcu.be/forums/qcubed-framework/help'> support forums</a>, a vibrant community
		is there to help you all the time. There's also a <a target='_blank' href='http://qcu.be/chat'>chat room</a>
		where you can get help right away.
	</p>
	<p>Here's what you need to do:</p>
	<ol>
<?php 
    // Output commands that can help fix these issues
    $commands = "";
    foreach ($arrInstallationMessages as $objResult) {
        if (isset($objResult->strCommandToFix) && strlen($objResult->strCommandToFix) > 0) {
            $commands .= $objResult->strCommandToFix . "\n";
        }
        echo "<li>" . $objResult->strMessage . "</li>\n";
 /**
  * For development purposes, this static method outputs all the Application static variables
  *
  * @return void
  */
 public static function VarDump()
 {
     _p('<div class="var-dump"><strong>QCubed Settings</strong><ul>', false);
     $arrValidationErrors = QInstallationValidator::Validate();
     foreach ($arrValidationErrors as $objResult) {
         printf('<li><strong class="warning">WARNING:</strong> %s</li>', $objResult->strMessage);
     }
     printf('<li>QCUBED_VERSION = "%s"</li>', QCUBED_VERSION);
     printf('<li>jQuery version = "%s"</li>', __JQUERY_CORE_VERSION__);
     printf('<li>jQuery UI version = "%s"</li>', __JQUERY_UI_VERSION__);
     printf('<li>__SUBDIRECTORY__ = "%s"</li>', __SUBDIRECTORY__);
     printf('<li>__VIRTUAL_DIRECTORY__ = "%s"</li>', __VIRTUAL_DIRECTORY__);
     printf('<li>__INCLUDES__ = "%s"</li>', __INCLUDES__);
     printf('<li>__QCUBED_CORE__ = "%s"</li>', __QCUBED_CORE__);
     printf('<li>ERROR_PAGE_PATH = "%s"</li>', ERROR_PAGE_PATH);
     printf('<li>PHP Include Path = "%s"</li>', get_include_path());
     printf('<li>QApplication::$DocumentRoot = "%s"</li>', QApplication::$DocumentRoot);
     printf('<li>QApplication::$EncodingType = "%s"</li>', QApplication::$EncodingType);
     printf('<li>QApplication::$PathInfo = "%s"</li>', QApplication::$PathInfo);
     printf('<li>QApplication::$QueryString = "%s"</li>', QApplication::$QueryString);
     printf('<li>QApplication::$RequestUri = "%s"</li>', QApplication::$RequestUri);
     printf('<li>QApplication::$ScriptFilename = "%s"</li>', QApplication::$ScriptFilename);
     printf('<li>QApplication::$ScriptName = "%s"</li>', QApplication::$ScriptName);
     printf('<li>QApplication::$ServerAddress = "%s"</li>', QApplication::$ServerAddress);
     if (QApplication::$Database) {
         foreach (QApplication::$Database as $intKey => $objObject) {
             printf('<li>QApplication::$Database[%s] settings:</li>', $intKey);
             _p("<ul>", false);
             foreach (unserialize(constant('DB_CONNECTION_' . $intKey)) as $key => $value) {
                 if ($key == "password") {
                     $value = "hidden for security purposes";
                 }
                 _p("<li>" . $key . " = " . var_export($value, true) . "</li>", false);
             }
             _p("</ul>", false);
         }
     }
     _p('</ul></div>', false);
 }