コード例 #1
0
ファイル: database.php プロジェクト: jehon/database_patch
 * Initialize the connection
 */
// $myconfig = array();
// $myconfig['database'] = array();
// $myconfig['database_patch'] = array();
function myinclude($f)
{
    global $myconfig;
    if (file_exists(__DIR__ . "/" . $f)) {
        echo "\nLoading configuration " . realpath(__DIR__ . "/{$f}") . "\n";
        include __DIR__ . "/" . $f;
        return true;
    }
    return false;
}
myinclude("config.php") || myinclude("../config.php") || myinclude("../../config.php") || myinclude("../../../config.php") || (print "No config file imported");
// 	|| die("No config.php found in current directory, or any 3 parent directories");
if (!is_array($myconfig['database'])) {
    die("database config is not an array");
}
if (!array_key_exists('pdo', $myconfig['database'])) {
    die("database config does not have a pdo key");
}
if (!array_key_exists('username', $myconfig['database'])) {
    die("database config does not have a username key");
}
if (!array_key_exists('password', $myconfig['database'])) {
    die('database config does not have a password key');
}
if (!array_key_exists('options', $myconfig['database'])) {
    die('database config does not have a options key. Options key could be an empty array');
コード例 #2
0
ファイル: home.php プロジェクト: mstrutt/helpbuntu
    echo '<ul class="sub-sections">';
    for ($i = 0; $i < sizeof($subpages); $i++) {
        if ($subpages[$i]["url"] == $sub || sizeof($subpages) == 1 || $sub == "" && $i == 0) {
            echo '<li class="selected"><h2>' . $subpages[$i]["name"] . '</h2></li>';
        } else {
            echo '<li><a href="/' . $page . "/" . $subpages[$i]["url"] . '">' . $subpages[$i]["name"] . '</a></li>';
        }
    }
    echo '</ul>';
    if ($sub != "") {
        myinclude("_content/" . $page . "/" . $sub . ".php");
    } else {
        myinclude("_content/" . $page . "/" . $subpages[0]["url"] . ".php");
    }
} else {
    myinclude("_content/" . $page . "/index.php");
}
?>
			</div>
			<footer>
				<p>Copy Right Michael Strutt 2007 - <?php 
echo date('Y');
?>
 &copy; | all rights reserved</p>
			</footer>
		</div>
			<!-- Start of StatCounter Code -->
				<script type="text/javascript">
					var sc_project=3543012; 
					var sc_invisible=1; 
					var sc_security="fe8900d5";