From: <lin...@us...> - 2010-01-13 11:11:48
|
Revision: 3296 http://web-erp.svn.sourceforge.net/web-erp/?rev=3296&view=rev Author: lindsayh Date: 2010-01-13 11:11:39 +0000 (Wed, 13 Jan 2010) Log Message: ----------- Added logout method to API to destroy session and erase storage. Modified Paths: -------------- trunk/api/api_login.php trunk/api/api_xml-rpc.php trunk/doc/Change.log.html Modified: trunk/api/api_login.php =================================================================== --- trunk/api/api_login.php 2010-01-13 09:39:23 UTC (rev 3295) +++ trunk/api/api_login.php 2010-01-13 11:11:39 UTC (rev 3296) @@ -19,9 +19,9 @@ include('../includes/ConnectDB.inc'); // Need to ensure we have a connection. if (!isset($db)) { - $RetCode[0] = NoAuthorisation; - $RetCode[1] = UL_CONFIGERR; - return $RetCode; + $RetCode[0] = NoAuthorisation; + $RetCode[1] = UL_CONFIGERR; + return $RetCode; } $_SESSION['db'] = $db; // Set in above include } @@ -43,8 +43,25 @@ } return $RetCode; } -// ALSO NEED A userLogout FUNCTION + +// Logout function destroys the session data, and that's about it. + +function LogoutAPI() { + + // Is this user logged in? + if (isset ($_SESSION['db']) ) { + // Cleanup is about all there is to do. + session_unset(); + session_destroy(); + $RetCode = 0; + } else { + $RetCode = NoAuthorisation; + } + + return $RetCode; +} + /* * Function to return an error message (hopefully in the user's language) * from the supplied error codes. This is not really related to login/out, Modified: trunk/api/api_xml-rpc.php =================================================================== --- trunk/api/api_xml-rpc.php 2010-01-13 09:39:23 UTC (rev 3295) +++ trunk/api/api_xml-rpc.php 2010-01-13 11:11:39 UTC (rev 3296) @@ -31,6 +31,20 @@ unset($Parameter); unset($ReturnValue); + $Description = _('This function is used to logout from the API methods.'); + $ReturnValue[0] = _('This function returns an integer. '). + _('Zero means the function was successful. '). + _('Otherwise an error code is returned. '); + + $Logout_sig = array(array($xmlrpcStruct)); + $Logout_doc = apiBuildDocHTML( $Description, $Parameter, $ReturnValue ); + + function xmlrpc_Logout($xmlrpcmsg) { + return new xmlrpcresp(php_xmlrpc_encode(LogoutAPI())); + } + + unset($Parameter); + unset($ReturnValue); $Description = _('This function is used to insert a new customer into the webERP database.'); $Parameter[0]['name'] = _('Customer Details'); $Parameter[0]['description'] = _('A set of key/value pairs where the key must be identical to the name of the field to be updated. ') @@ -1369,6 +1383,10 @@ "function" => "xmlrpc_Login", "signature" => $Login_sig, "docstring" => $Login_doc), + "weberp.xmlrpc_Logout" => array( + "function" => "xmlrpc_Logout", + "signature" => $Logout_sig, + "docstring" => $Logout_doc), "weberp.xmlrpc_InsertCustomer" => array( "function" => "xmlrpc_InsertCustomer", "signature" => $InsertCustomer_sig, Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-01-13 09:39:23 UTC (rev 3295) +++ trunk/doc/Change.log.html 2010-01-13 11:11:39 UTC (rev 3296) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> -<p>12/01/13 Lindsay: API changes: added method to turn error number to string; clean up api_xml-rpc.php and corrected some method descriptions.<p> +<p>13/01/10 Lindsay: api_login.php, api_xml-rpc.php: Added logout method to API.<p> +<p>13/01/10 Lindsay: API changes: added method to turn error number to string; clean up api_xml-rpc.php and corrected some method descriptions.<p> <p>12/01/10 Pak Ricard: Z_ChangeStockCategory.php - New script to change a stock category code</p> <p>12/01/10 Chris Franks: PDFGrn.php - Show the date in the correct format</p> <p>12/01/10 Tim: Z_ChangeStockCode.php - Check thast mrpplannedorders table exists before trying to alter it</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |