Example #1
0
function WebHelpDesk_Command($resource = '', $params = array(), $qualifier = null, $configName = CONFIG_Tech_Key)
{
    if (is_null($resource) || strlen($resource) == 0) {
        throw new \Exception('No request resource specified');
    }
    $config = testConfig($configName);
    if (is_array($config) && isset($config[CONFIG_base])) {
        $reqParams = array("login" => $config[CONFIG_user], "password" => $config[CONFIG_password]);
        if (is_array($params)) {
            $reqParams = array_merge($params, $reqParams);
        }
        $q = '';
        if (is_string($qualifier)) {
            $q = "&" . Qualifier_Operation::OP . "=" . $qualifier;
        }
        $url = $config[CONFIG_base] . "/ra/" . $resource . "?" . http_build_query($reqParams) . $q;
        echo $url . PHP_EOL;
        list($data, $headers) = performGET($url);
        if ($data != false) {
            $json = json_decode($data, true);
            if (json_last_error() != 0) {
                throw new \Exception(jsonErrorString(json_last_error()));
            }
            return array($json, $headers);
        }
    }
    throw new \Exception('Please update the configuration for ' . $configName);
}
/**
 * @return object
 * @param boolean $required
 * @param string  $title
 * @param string  $db
 * @param string  $message
*/
function &testSupportedDatabase($required, $title, $db = false, $message = '')
{
    global $lang_fn;
    $drivers = getSupportedDBDriver();
    //TODO?
    if ($db) {
        $serverInfo = $db->ServerInfo();
        $_test = testConfig('', 'dbms');
        if (!empty($_test->value)) {
            $dbms = $_test->value;
            list($minimum, $recommended) = getTestValues($drivers[$dbms] . '_version');
            $test = testVersionRange('', $title, $serverInfo['version'], $message, $minimum, $recommended, false);
            $test->opt = $serverInfo['description'];
            $test->res = 'green';
            getTestReturn($test, $required);
            return $test;
        }
        $test = new CmsInstallTest();
        $test->title = $title;
        if ($required) {
            $test->res = 'red';
        } else {
            $test->res = 'yellow';
        }
        getTestReturn($test, $required, $message);
        return $test;
    }
    //TODO
    $test = new CmsInstallTest();
    $test->title = $title;
    if (count($drivers) > 0) {
        $return = array();
        foreach ($drivers as $driver => $server) {
            if (extension_loaded_or($driver)) {
                $return[] = $driver;
            }
        }
        $test->value = implode(',', $return);
        $test->secondvalue = $return;
        if (count($return) > 0) {
            $test->res = 'green';
        } else {
            if ($required) {
                $test->res = 'red';
            } else {
                $test->res = 'yellow';
            }
        }
        getTestReturn($test, $required, $message, 'DB_driver_missing');
    } else {
        $test->res = 'red';
        getTestReturn($test, $required, $message, 'DB_driver_missing', $lang_fn('no_db_driver'));
    }
    return $test;
}
Example #3
0
<?php

$system_path = dirname(dirname(__FILE__));
if (realpath($system_path) !== FALSE) {
    $system_path = realpath($system_path) . DIRECTORY_SEPARATOR;
}
define('SYSTEM_PATH', str_replace("\\", DIRECTORY_SEPARATOR, $system_path));
require SYSTEM_PATH . 'Tests/_Base.php';
require SYSTEM_PATH . 'Tests/_Enums.php';
require SYSTEM_PATH . 'Tests/_Command.php';
//curl "https://localhost/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/1?username=admin&password=admin"
$config = testConfig(CONFIG_Client_Key);
if (is_array($config) && isset($config[CONFIG_base])) {
    $params = array("list" => "mine", "username" => $config[CONFIG_user], "password" => $config[CONFIG_password]);
    $resource = "Tickets";
    $url = $config["base"] . "/ra/" . $resource . "/?" . http_build_query($params);
    echo $url . PHP_EOL;
    $result = performGET($url);
    echo json_encode($result, JSON_PRETTY_PRINT) . PHP_EOL;
}
exit;
Example #4
0
$tmp[1]['root_url'] = testConfig('root_url', 'root_url');
$tmp[1]['ssl_url'] = testConfig('ssl_url', 'ssl_url');
$tmp[1]['root_path'] = testConfig('root_path', 'root_path', 'testDirWrite');
$tmp[1]['previews_path'] = testConfig('previews_path', 'previews_path', 'testDirWrite');
$tmp[1]['uploads_path'] = testConfig('uploads_path', 'uploads_path', 'testDirWrite');
$tmp[1]['uploads_url'] = testConfig('uploads_url', 'uploads_url');
$tmp[1]['image_uploads_path'] = testConfig('image_uploads_path', 'image_uploads_path', 'testDirWrite');
$tmp[1]['image_uploads_url'] = testConfig('image_uploads_url', 'image_uploads_url');
$tmp[1]['ssl_uploads_url'] = testConfig('ssl_uploads_url', 'ssl_uploads_url');
$tmp[1]['use_smarty_php_tags'] = testConfig('use_smarty_php_tags', 'use_smarty_php_tags');
$tmp[0]['image_manipulation_prog'] = testConfig('image_manipulation_prog', 'image_manipulation_prog');
$tmp[0]['auto_alias_content'] = testConfig('auto_alias_content', 'auto_alias_content');
$tmp[0]['locale'] = testConfig('locale', 'locale');
$tmp[0]['default_encoding'] = testConfig('default_encoding', 'default_encoding');
$tmp[0]['admin_encoding'] = testConfig('admin_encoding', 'admin_encoding');
$tmp[0]['set_names'] = testConfig('set_names', 'set_names');
$smarty->assign('count_config_info', count($tmp[0]));
$smarty->assign('config_info', $tmp);
/* PHP Information */
$tmp = array(0 => array(), 1 => array());
$safe_mode = ini_get('safe_mode');
$session_save_path = ini_get('session.save_path');
$open_basedir = ini_get('open_basedir');
list($minimum, $recommended) = getTestValues('php_version');
$tmp[0]['phpversion'] = testVersionRange(0, 'phpversion', phpversion(), '', $minimum, $recommended, false);
$tmp[0]['md5_function'] = testBoolean(0, 'md5_function', function_exists('md5'), '', false, false, 'Function_md5_disabled');
list($minimum, $recommended) = getTestValues('gd_version');
$tmp[0]['gd_version'] = testGDVersion(0, 'gd_version', $minimum, '', 'min_GD_version');
$tmp[0]['tempnam_function'] = testBoolean(0, 'tempnam_function', function_exists('tempnam'), '', false, false, 'Function_tempnam_disabled');
$tmp[0]['magic_quotes_runtime'] = testBoolean(0, 'magic_quotes_runtime', 'magic_quotes_runtime', lang('magic_quotes_runtime_on'), true, true, 'magic_quotes_runtime_On');
$tmp[0]['E_STRICT'] = testIntegerMask(0, lang('test_error_estrict'), 'error_reporting', E_STRICT, lang('test_estrict_failed'), true, true, false);
Example #5
0
// MY EDIT LINE: 800 - 812
// No Direct Access
defined('_BF2_ADMIN') or die('Restricted access');
// Build Data Table Array
$DataTables = array('army', 'awards', 'kills', 'kits', 'mapinfo', 'maps', 'player', 'player_history', 'round_history', 'servers', 'unlocks', 'vehicles', 'weapons', 'data', 'stats');
// Do Tasks
$task = $_POST['task'] ? $_POST['task'] : '';
switch ($task) {
    case "saveconfig":
        showHeader('Save Configuration');
        saveConfig();
        break;
    case "testconfig":
        showHeader('Test Configuration');
        testConfig();
        break;
    case "clanmanager":
        showHeader('Clan Manager');
        //processClanManager();
        break;
    case "changerank":
        showHeader('Edit Players');
        processChangeRank();
        break;
    case "banplayers":
        showHeader('Ban Players');
        processBanPlayers();
        break;
    case "unbanplayers":
        showHeader('Un-Ban Players');