Exemple #1
0
Fichier : qb.php Projet : scy/qb
/**
 * Test the installation.
 * This function checks some of the basic functionality of qb (for example class
 * autoloading) and shows the value of some internal constants as well as other
 * useful information like qbURL return values. It can be used to debug your qb
 * installation.
 * @return bool True if the function was executed to the end.
 */
function qb_test()
{
    header('Content-type: text/plain');
    echo "Hi. This is qb " . QB_VERSION . ", nice to meet you.\n";
    echo "If you can read this, you've included qb correctly and requested some tests.\n\n";
    echo "First of all, some basic settings and what they are set to:\n";
    echo "qb is installed in:   " . QB_LIBDIR . "\n";
    echo "Request origin:       " . QB_REQDIR . "\n";
    echo "Server document root: " . QB_DOCROOT . "\n";
    echo "Requested URI path:   " . QB_URIPATH . "\n\n";
    if (QB_OURAUTOLOAD) {
        echo "qb will take care of autoloading its own classes.\n";
        echo "If your application needs an __autoload() function, please define it\n";
        echo "before including qb and call qb_autoload(\$class) as a fallback.\n";
    } else {
        echo "You have defined your own class autoloader. If autoloading of qb's classes\n";
        echo "fails, make sure it is calling qb_autoload(\$class) as a fallback.\n";
    }
    echo "\nChecking class autoloading...\n";
    new qbException();
    echo "Class autoloading seems to be working.\n\n";
    echo "BaseDir is: " . qbURL::getBaseDir() . "\n";
    echo "BaseURL is: " . qbURL::getBaseURL() . "\n";
    echo "Thus, virtual file requested is: " . qbURL::getVFile() . "\n";
    echo "\nThis is the end of the automatic tests.\n";
    echo "Check out http://scytale.name/proj/qb/ if something doesn't work.\n";
    return true;
}
Exemple #2
0
<?php

/* Copyright 2007 Tim Weber <*****@*****.**>

   This file is part of qb <http://scytale.name/proj/qb/>.

   See the LICENSE file for legal stuff.
   */
// Include configuration file.
require_once 'qb-0.2.conf.php';
// Define MIME types for the different templates.
$mime = array('html' => 'text/html', 'atom10' => 'application/atom+xml');
// Assign the requested virtual file to $url, removing strange injection ideas.
$url = str_replace(array(':', '../'), '', qbURL::getVFile());
// Let $realpath be qb's source directory plus the requested file.
$realpath = QB_SRC . $url;
// Initialize the array of matches. It's two-dimensional. The first index is the
// "created" Unix timestamp, the second one is running from 0 to n-1, where n is
// the number of files created at that time. The actual value then is the file
// name without suffix.
$matches = array();
// TODO: Can this be rewritten to work without distinction between "single file"
// and "directory" case?
if (is_file($realpath . QB_SUF_SRC)) {
    // A single file has been requested. Add it to $matches.
    $matches[qb_created($url)][] = $url;
} elseif (is_dir($realpath)) {
    // A directory has been requested. Initialize $scanq with the directory name
    // and do a breadth first search.
    $scanq = array($realpath);
    while (count($scanq) > 0) {