예제 #1
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/api/common/dbcon.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/api/common/curlcheck.php";
$appid = $_POST["appid"];
$appkey = $_POST["appkey"];
$app = curl_check($appid, $appkey);
echo $app["appname"];
exit;
예제 #2
0
function perform_checks()
{
    $check_passed = 0;
    $check_failed = 0;
    echo '<h3>Performing Basic Checks</h3>';
    // perform checks - each check should echo a success or failure string, and return true if successful
    // $check_passed and $check_failed increment accordingly. perform_checks returns true if all checks pass
    // check mysql connections
    if (verify_mysql(REASON_DB, 'REASON_DB', 'reason_settings.php', 'entity')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (verify_mysql(THOR_FORM_DB_CONN, 'THOR_FORM_DB_CONN', 'thor_settings.php', false)) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (http_host_check()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (tidy_check()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (curl_check()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (graphicslib_check()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    echo '<h3>Performing Directory and File Checks</h3>';
    echo '<h4>Write checks</h4>';
    if (data_dir_writable(WEB_PATH, 'WEB_PATH')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(REASON_CSV_DIR, 'REASON_CSV_DIR')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(REASON_LOG_DIR, 'REASON_LOG_DIR')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(ASSET_PATH, 'ASSET_PATH')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(PHOTOSTOCK, 'PHOTOSTOCK')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(REASON_TEMP_DIR, 'REASON_TEMP_DIR')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(REASON_CACHE_DIR, 'REASON_CACHE_DIR')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    // In our default config if this path is not writable then uploads should fail. Probably it would be better to distribute the package with
    // the /www/tmp directory being an alias to the file system location of REASON_TEMP_DIR. Until this is done, we are leaving it like this.
    // We may want to do something to check the validity of those aliases, such as writing a file then trying to access it via curl. The same
    // thing could be done for assets.
    if (data_dir_writable(rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . WEB_TEMP, 'WEB_TEMP')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (data_dir_writable(REASON_DATA_DIR . 'geocodes/', 'Geocode data directory')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    echo '<h4>Read checks</h4>';
    if (check_directory_readable(THOR_INC, 'THOR_INC')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_directory_readable(LOKI_2_INC, 'LOKI_2_INC')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_directory_readable(MAGPIERSS_INC, 'MAGPIERSS_INC')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_file_readable(APACHE_MIME_TYPES, 'APACHE_MIME_TYPES', ' Also make sure APACHE_MIME_TYPES constant in reason_settings is set to the full path of the mime.types file (include the filename).')) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    echo '<h3>Performing HTTP Access Checks</h3>';
    echo '<p><em>Note these are rather naive checks that just make sure some known file in the directory is web accessible and contains expected content. 
			  A pass here does not necessarily indicate the reason package components are configured and fully functional, but it does mean that the
			  basic paths defined in reason_package are setup correctly, and that reason can use curl to request files over http.</em></p>';
    if (check_reason_package_http_base_path()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_thor_accessible_over_http()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_loki_accessible_over_http()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_jquery_accessible_over_http()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_flvplayer_accessible_over_http()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    if (check_datepicker_accessible_over_http()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    echo '<h3>Checking for Apache mod_rewrite support</h3>';
    if (mod_rewrite_check()) {
        $check_passed++;
    } else {
        $check_failed++;
    }
    echo '<h3>Summary</h3>';
    echo '<ul>';
    echo '<li class="success">' . $check_passed . ' checks were successful</li>';
    echo '<li class="error">' . $check_failed . ' checks failed</li>';
    echo '</ul>';
    if ($check_failed == 0) {
        return true;
    } else {
        return false;
    }
}