コード例 #1
0
ファイル: extension_check.php プロジェクト: sheldon/dejavu
 */
// This will prevent common.php from loading the extension library.
define('PHORUM_ADMIN', 1);
// Try to load the Phorum PHP extension. Wrap this in output buffering,
// so problems here won't wreck the outputted image code.
ob_start();
if (!extension_loaded('phorum')) {
    @dl('phorum.so');
}
// Load the common Phorum code.
define('phorum_page', 'extension_check');
include_once "./common.php";
// Flush any output so far.
phorum_ob_clean();
// Check if the extension version matches this Phorum version.
if (function_exists('phorum_ext_version')) {
    if (phorum_ext_version() == PHORUM_EXTENSION_VERSION) {
        // All looks okay. Print a green block.
        header("Content-Type: image/gif");
        foreach (array(0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0xf, 0x0, 0xb, 0x0, 0x80, 0x2, 0x0, 0x0, 0x0, 0x0, 0x35, 0xf4, 0x21, 0x21, 0xfe, 0xa, 0x50, 0x68, 0x6f, 0x72, 0x75, 0x6d, 0x2e, 0x6f, 0x72, 0x67, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0xf, 0x0, 0xb, 0x0, 0x0, 0x2, 0x14, 0x8c, 0x8f, 0xa9, 0xcb, 0x9d, 0x0, 0x2, 0x74, 0x73, 0xba, 0x2b, 0x57, 0x54, 0xfb, 0x74, 0xe, 0x59, 0xd8, 0xc8, 0x14, 0x0, 0x3b) as $byte) {
            print chr($byte);
        }
        exit;
    }
}
// Something went wrong. Print a red block.
header("Content-Type: image/gif");
foreach (array(0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0xf, 0x0, 0xb, 0x0, 0xa1, 0x2, 0x0, 0xbc, 0x12, 0x12, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x21, 0xfe, 0xa, 0x50, 0x68, 0x6f, 0x72, 0x75, 0x6d, 0x2e, 0x6f, 0x72, 0x67, 0x0, 0x21, 0xf9, 0x4, 0x1, 0xa, 0x0, 0x2, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0xf, 0x0, 0xb, 0x0, 0x0, 0x2, 0x14, 0x84, 0x8f, 0xa9, 0xcb, 0x9d, 0x11, 0x0, 0x74, 0x73, 0xba, 0x7b, 0xa0, 0x6e, 0x11, 0xf5, 0xb7, 0x7c, 0xd8, 0x98, 0x14, 0x0, 0x3b) as $byte) {
    print chr($byte);
}
exit;
コード例 #2
0
ファイル: common.php プロジェクト: sheldon/dejavu
// Load the caching-layer. You can specify a different one in the settings.
// One caching layer *needs* to be loaded.
$PHORUM['cache_layer'] = basename($PHORUM['cache_layer']);
require_once "./include/cache/{$PHORUM['cache_layer']}.php";
// Try to load the Phorum PHP extension, if has been enabled in the admin.
// As a precaution, never load it from the admin code (so the extension
// support can be disabled at all time if something unexpected happens).
if (!defined('PHORUM_ADMIN') && !empty($PHORUM["php_phorum_extension"])) {
    // Load the extension library.
    if (!extension_loaded('phorum')) {
        @dl('phorum.so');
    }
    // Check if the version of the PHP extension matches the
    // one required by the Phorum installation.
    if (extension_loaded('phorum')) {
        $ext_ver = phorum_ext_version();
        if ($ext_ver != PHORUM_EXTENSION_VERSION) {
            // The version does not match. Disable the extension support.
            phorum_db_update_settings(array("php_phorum_extension" => 0));
            print "<html><head><title>Phorum Extension Error</title></head><body>";
            print "<h1>Phorum Extension Error</h1>" . "The Phorum PHP extension was loaded, but its version<br/>" . "does not match the Phorum version. Therefore, the<br/>" . "extension has now be disabled. Reload this page to continue.";
            print "</body></html>";
            exit(0);
        }
    }
}
// Setup phorum_get_url(): this function is used for generating all Phorum
// related URL's. It is loaded conditionally, to make it possible to override
// it from the phorum PHP extension.
if (!function_exists('phorum_get_url')) {
    require_once "./include/phorum_get_url.php";