Revision: 18520 http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18520 Author: johang Date: 2008-05-08 22:16:46 +0000 (Thu, 08 May 2008)
Log Message: ----------- Logging functionality, configurable session lifetime. Modified Paths: -------------- trunk/syncml/inc/class.sosession.inc.php trunk/syncml/inc/class.syncml_command_synchdr.inc.php trunk/syncml/inc/class.syncml_session.inc.php trunk/syncml/inc/constants.inc.php trunk/syncml/syncml.php Modified: trunk/syncml/inc/class.sosession.inc.php =================================================================== --- trunk/syncml/inc/class.sosession.inc.php 2008-05-08 22:14:26 UTC (rev 18519) +++ trunk/syncml/inc/class.sosession.inc.php 2008-05-08 22:16:46 UTC (rev 18520) @@ -24,7 +24,7 @@ DELETE FROM phpgw_syncml_sessions WHERE session_dla < %d', - time() - 10), + time() - SYNCML_SESSION_LIFETIME), __LINE__, __FILE__); } Modified: trunk/syncml/inc/class.syncml_command_synchdr.inc.php =================================================================== --- trunk/syncml/inc/class.syncml_command_synchdr.inc.php 2008-05-08 22:14:26 UTC (rev 18519) +++ trunk/syncml/inc/class.syncml_command_synchdr.inc.php 2008-05-08 22:16:46 UTC (rev 18520) @@ -89,6 +89,8 @@ case 'SyncML/1.1': break; default: + syncml_logger::get_instance()->log( + "bad verproto: " . $this->verproto); $this->handle_failure( SYNCML_STATUS_PROTOCOLVERSIONNOTSUPPORTED, $response, $session); @@ -102,6 +104,8 @@ $response->set_syncml_namespace_version($this->verdtd); break; default: + syncml_logger::get_instance()->log( + "bad verdtd: " . $this->verdtd); $this->handle_failure( SYNCML_STATUS_DTDCOLVERSIONNOTSUPPORTED, $response, $session); @@ -129,6 +133,8 @@ } else { + syncml_logger::get_instance()->log("failed to verify session"); + $tmp = $this->process_cred($session); // tmp is session string on success and @@ -136,11 +142,15 @@ if(is_string($tmp)) { + syncml_logger::get_instance()->log( + "credentials was OK"); $sosession->set_session_mapping($id, $tmp); $this->handle_success($response, $session); } else { + syncml_logger::get_instance()->log( + "bad credentials"); $this->handle_failure($tmp, $response, $session); } } @@ -156,6 +166,9 @@ $session->session_data = $GLOBALS['phpgw']->session->appsession( 'session_data', 'syncml'); + syncml_logger::get_instance()->log_data( + "loaded session data", $session->session_data); + $this->add_authentication_status( SYNCML_STATUS_AUTHENTICATIONACCEPTED, $response, $session); } Modified: trunk/syncml/inc/class.syncml_session.inc.php =================================================================== --- trunk/syncml/inc/class.syncml_session.inc.php 2008-05-08 22:14:26 UTC (rev 18519) +++ trunk/syncml/inc/class.syncml_session.inc.php 2008-05-08 22:16:46 UTC (rev 18520) @@ -244,6 +244,9 @@ */ function commit() { + syncml_logger::get_instance()->log_data( + "saved session data", $this->session_data); + $GLOBALS['phpgw']->session->appsession( 'session_data', 'syncml', $this->session_data); Modified: trunk/syncml/inc/constants.inc.php =================================================================== --- trunk/syncml/inc/constants.inc.php 2008-05-08 22:14:26 UTC (rev 18519) +++ trunk/syncml/inc/constants.inc.php 2008-05-08 22:16:46 UTC (rev 18520) @@ -11,6 +11,12 @@ */ /** + * Debug properties. + */ + define('SYNCML_DEBUG_MODE', true); + define('SYNCML_DEBUG_FILE', '/tmp/phpgw'); + + /** * DEVID string used by DEVINF response. */ define('SYNCML_DEVID', 'PHPGW-SYNCML-3492384238942'); @@ -20,6 +26,9 @@ /** * Session properties. */ + // session lifetime in seconds + define('SYNCML_SESSION_LIFETIME', 60); + // session states define('SYNCML_NOMOREMODIFICATIONS', 1); @@ -68,12 +77,12 @@ define('SYNCML_STATUS_NOTDELETED', 211); define('SYNCML_STATUS_AUTHENTICATIONACCEPTED', 212); define('SYNCML_STATUS_CHUNKEDITEMACCEPTEDANDBUFFERED', 213); - define('SYNCML_STATUS_UNSUPPORTEDMEDIATYPEORFORMAT', 215); define('SYNCML_STATUS_INVALIDCREDENTIALS', 401); define('SYNCML_STATUS_FORBIDDEN', 403); define('SYNCML_STATUS_NOTFOUND', 404); define('SYNCML_STATUS_MISSINGCREDENTIALS', 407); + define('SYNCML_STATUS_UNSUPPORTEDMEDIATYPEORFORMAT', 415); define('SYNCML_STATUS_SIZEMISMATCH', 424); define('SYNCML_STATUS_DTDVERSIONNOTSUPPORTED', 505); Modified: trunk/syncml/syncml.php =================================================================== --- trunk/syncml/syncml.php 2008-05-08 22:14:26 UTC (rev 18519) +++ trunk/syncml/syncml.php 2008-05-08 22:16:46 UTC (rev 18520) @@ -26,6 +26,8 @@ require('../header.inc.php'); + require_once 'inc/class.syncml_logger.inc.php'; + require_once 'inc/class.xml_parser.inc.php'; require_once 'inc/class.xml_offset_mapper.inc.php'; _______________________________________________ phpGroupWare-cvs mailing list phpGroupWare-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/phpgroupware-cvs