Example #1
0
    global $QUERY_STRING;
    global $_SERVER;
    if (isset($_SERVER['QUERY_STRING'])) {
        $t_qs = $_SERVER['QUERY_STRING'];
    } elseif (isset($GLOBALS['QUERY_STRING'])) {
        $t_qs = $GLOBALS['QUERY_STRING'];
    } elseif (isset($QUERY_STRING) && $QUERY_STRING != '') {
        $t_qs = $QUERY_STRING;
    }
    if (isset($t_qs) && ereg('wsdl', $t_qs)) {
        return false;
    } elseif ($p_data == '' && $p_service->wsdl) {
        return false;
    } else {
        return true;
    }
}
# pass incoming (posted) data
if (isset($HTTP_RAW_POST_DATA)) {
    $t_input = $HTTP_RAW_POST_DATA;
} else {
    $t_input = implode("\r\n", file('php://input'));
}
# only include the Mantis / MantisConnect related files, if the current
# request is a webservice call (rather than webservice documentation request,
# eg: WSDL).
if (mci_is_webservice_call($l_oServer, $t_input)) {
    require_once $t_current_dir . 'mc_core.php';
}
# Execute whatever is requested from the webservice.
$l_oServer->service($t_input);
Example #2
0
        if (isset($GLOBALS['QUERY_STRING'])) {
            $t_qs = $GLOBALS['QUERY_STRING'];
        }
    }
    if (isset($t_qs) && preg_match('/wsdl/', $t_qs)) {
        return false;
    } else {
        return true;
    }
}
# If SOAP extension is not enabled, error out.
if (!extension_loaded('soap')) {
    echo 'PHP SOAP extension is not enabled.';
    exit;
}
if (!mci_is_webservice_call()) {
    # if we have a documentation request, do some tidy up to prevent lame bot loops e.g. /mantisconnect.php/mc_enum_etas/mc_project_get_versions/
    $t_parts = explode('mantisconnect.php/', strtolower($_SERVER['SCRIPT_NAME']), 2);
    if (isset($t_parts[1]) && strlen($t_parts[1]) > 0) {
        echo 'This is not a SOAP webservice request, for documentation, see ' . $t_parts[0] . 'mantisconnect.php';
        exit;
    }
    header('Content-Type: text/xml');
    $t_wsdl = file_get_contents('mantisconnect.wsdl');
    $t_wsdl = str_replace('http://www.mantisbt.org/bugs/api/soap/mantisconnect.php', config_get('path') . 'api/soap/mantisconnect.php', $t_wsdl);
    echo $t_wsdl;
    exit;
}
require_once 'mc_core.php';
$t_server = new SoapServer('mantisconnect.wsdl', array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS));
$t_server->addFunction(SOAP_FUNCTIONS_ALL);