It is currently Sun Jul 20, 2008 11:00 am
Moderator: Websmurf




lordsiris wrote:As for the site template it's called "Macphoria" and is available at www.mambodev.com.



<?php
/**
* @version $Id: xmlrpc.server.php,v 1.6 2005/07/11 01:16:19 johanjanssens Exp $
* @package Mambo
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** Set flag that this is a parent file */
define( "_VALID_MOS", 1 );
// crank up mambo
require_once( 'configuration.php' );
if (!$mosConfig_xmlrpc_server) {
die( 'XML-RPC server not enabled.' );
}
require_once( $mosConfig_absolute_path . '/includes/mambo.php' );
$mainframe = new mosMainFrame( $database, '' );
$mainframe->initSession();
/**
* CUSTOM HANDLER FOR METHOD NOT FOUND
*/
function domXmlRpcFault( &$server, $methodName, &$params ) {
// error code according to http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
$server->serverError = -32601;
$server->serverErrorString = 'I don\'t know about ' . $methodName;
return $server->raiseFault();
} //faultExample
function domXmlRpcAuthError( &$server) {
$server->serverError = 0;
$server->serverErrorString = 'Incorrect username or password';
$server->respond($server->raiseFault());
}
// Includes the required class file for the XML-RPC Server
require_once( $mosConfig_absolute_path . '/includes/domit/dom_xmlrpc_server.php' );
require_once( DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_fault.php' );
$_LANG = mosFactory::getLanguage();
$_LANG->debug( $mosConfig_debug );
$xmlrpcServer =& new dom_xmlrpc_server();
$xmlrpcServer->setMethodNotFoundHandler( 'domXmlRpcFault' );
// authenticate xmlrpc client
// using basic auth method
// fore more information see http://www.ietf.org/rfc/rfc2617.txt
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="'.$mosConfig_sitename.' Realm"');
header('HTTP/1.0 401 Unauthorized');
exit;
}
if(!$mainframe->login($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])){
domXmlRpcAuthError($xmlrpcServer);
exit();
}
/** get the information about the current user from the sessions table */
$GLOBALS['my'] =& $mainframe->getUser();
// load all available remote calls
$_MAMBOTS->loadBotGroup( 'xmlrpc' );
$allCalls = $_MAMBOTS->trigger( 'onGetWebServices' );
// add all calls to the connector object
foreach ($allCalls as $calls) {
foreach ($calls as $call) {
$xmlrpcServer->addMethod( new dom_xmlrpc_method( $call ) );
}
}
// pass individual arguments to the called method
$xmlrpcServer->tokenizeParams( true );
// process the call
$xmlrpcServer->receive();
?> /**
* Sends data through the client connection
* @param string The message to be sent
* @return string The http response
*/
function &send($message) {
$conn =& $this->connection;
if ($conn->isOpen()) {
//build header info
$request = $this->requestMethod . ' ' . $this->requestPath . ' ' . $this->protocol .
'/' . $this->protocolVersion . CRLF;
$request .= $this->headers->toString() . CRLF;
$request .= $message;
//init variables
$response = $headers = $body = '';
$readState = HTTP_READ_STATE_BEGIN;
$this->fireEvent('onRequest', $request);
//send request
$connResource =& $conn->connection;
fputs ($connResource, $request);
//read response
$this->response->message ='';
$this->response->headers = '';
while (!feof($connResource)) {
$data = fgets($connResource, 4096);
$this->fireEvent('onRead', $data);
switch ($readState) {
case HTTP_READ_STATE_BEGIN:
$this->response->statusLine = $data;
$readState = HTTP_READ_STATE_HEADERS;
break;
case HTTP_READ_STATE_HEADERS:
if (trim($data) == '') { //end of headers is signalled by a blank line
$readState = HTTP_READ_STATE_BODY;
}
else {
if ($this->responseHeadersAsObject) {
$this->response->setUnformattedHeader($data);
}
else {
$this->response->headers .= $data;
}
}
break;
case HTTP_READ_STATE_BODY:
$this->response->message .= $data;
break;
}
}
$this->normalizeResponseIfChunked();
$headerString = is_object($this->response->headers) ?
$this->response->headers->toString() : $this->response->headers;
$this->fireEvent('onResponseHeaders', $headerString);
$this->fireEvent('onResponseBody', $this->response->message);
$this->fireEvent('onResponse', $this->response->headers . $this->response->message);
return $this->response;
}
else {
HTTPExceptions::raiseException(HTTP_SOCKET_CONNECTION_ERR, ('HTTP Transport Error - Unable to establish connection to host ' .
$conn->host));
}
} //send /**
* Specifies a user name and password for basic authentication
* @param string The user name
* @param string The password
*/
function setAuthorization($user, $password) {
$encodedChallengeResponse = 'Basic ' . base64_encode($user . ':' . $password);
$this->setHeader('Authorization', $encodedChallengeResponse);
} //setAuthorization
} //php_http_request 









lordsiris wrote:Webweever...glad you like the program!! Now as far as the HTML editor after all my work to figure out how to getting it working you want it turned off? Just kidding, I understand!! It initially was only plain text but I wanted HTML so I just kept at it until I figured it out. Anyway the next version will include support for turning off the HTML editor. I will also include support for the intro text and main text as well. I would like to have a selection that expands the interface if the user wants to use the main text box, but we will see how that turns out. The only reason for this is that I was trying to keep the program interface as small as possible and still be usefull, in other words I don't want to just recreate the Joomla! create news item in Java.


When will you cancel this limitation?

Return to Open Source Products for Joomla!
Users browsing this forum: amarketzone, MSN [Bot] and 3 guests