diff --git a/ajax+json/test2.html b/ajax+json/test2.html new file mode 100644 index 0000000..250d76f --- /dev/null +++ b/ajax+json/test2.html @@ -0,0 +1,26 @@ + + + + test + + + + + + diff --git a/libs/c_personAdmin.php b/libs/c_personAdmin.php index 14b4efc..5a3cef4 100644 --- a/libs/c_personAdmin.php +++ b/libs/c_personAdmin.php @@ -50,7 +50,8 @@ class c_personAdmin extends c_picToolSavant unset ($this->dbHandle); } - private function getPersons () + //private function getPersons () + function getPersons () { $result = NULL; diff --git a/libs/c_xmlify.php b/libs/c_xmlify.php index fec102a..211d43c 100644 --- a/libs/c_xmlify.php +++ b/libs/c_xmlify.php @@ -14,10 +14,10 @@ function xmlToVar ($xr) ! ($xr->nodeType == 15 && $xr->name == 'variable')) { + print "[DEBUG:xmlToVar] " . $xr->nodeType . " / " . $xr->name . + " / " . $xr->value . "\n"; if ($xr->nodeType == 3 && $xr->hasValue == TRUE) - // der iconv is nur drin weil evolver ihre Seiten dummer weise - // als latin1 verschicken, aus der Datenbank aber utf-8 kommt. - $ret = iconv ("UTF-8", "ISO-8859-1", $xr->value); + $ret = $xr->value; } return $ret; @@ -34,6 +34,8 @@ function xmlToArray ($xr) ! ($xr->nodeType == 15 && $xr->name == 'array')) { + print "[DEBUG:xmlToArray/1] " . $xr->nodeType . " / " . $xr->name . + " / " . $xr->value . "\n"; if ($xr->nodeType == 1 && $xr->name == 'item') { @@ -43,6 +45,8 @@ function xmlToArray ($xr) ! ($xr->nodeType == 15 && $xr->name == 'item')) { + print "[DEBUG:xmlToArray/2] " . $xr->nodeType . " / " . $xr->name . + " / " . $xr->value . "\n"; if ($xr->nodeType == 1) { switch ($xr->name) diff --git a/libs/mutualExclusion.php b/libs/mutualExclusion.php index 413e867..e70c303 100644 --- a/libs/mutualExclusion.php +++ b/libs/mutualExclusion.php @@ -1,10 +1,54 @@ : Path and basename to the lockfile to use. + * $csId : Id of the critical section, will be part of filename. + * $msg : The message to be written to the lockfile. + * + * If $msg is NULL, a default message is created from session_id and time + * + * Returns: + * Array of lock information. + * [0] Filehandle to opened lockfile. + * [1] Resource id for semaphor + * [2] the old setting of ignore_user_abort. + */ +function acquireLock ($lockFile, $csId, $msg = NULL) { $fName = $lockFile . $csId . '.lck'; $lock = NULL; @@ -31,7 +75,9 @@ function acquireLock ($lockFile, $csId) } // Here one could write informations in the lockfile...time, pid, etc. - fwrite ($lockHandle, session_id () . '::' . time ()); + if ($msg === NULL) + $msg = session_id () . '::' . time (); + fwrite ($lockHandle, $msg . "\n"); fflush ($lockHandle); resetErrExceptionMapping (); @@ -40,6 +86,15 @@ function acquireLock ($lockFile, $csId) return array ($lockHandle, $lock, $userAbort); } +/** + * Release a lock previously acquired by acquireLock. + * + * Sideeffects: + * Sets ignore_user_abort to the value before acquireLock succeds. + * + * Arguments: + * $lock : The array returned by a successfull acquireLock call. + */ function releaseLock ($lock) { setErrExceptionMapping (); diff --git a/pvtest.php b/pvtest.php index ebb04f0..5427a08 100644 --- a/pvtest.php +++ b/pvtest.php @@ -7,8 +7,12 @@ require_once LIBDIR . 'mutualExclusion.php'; //session_start (); $lock = acquireLock ('lock/lock', '1'); +$handle = fopen ('lock/lock1.lck', 'r'); +print fgets ($handle); +fclose ($handle); + echo "Lock bekommen\n"; -sleep (2); +sleep (1); releaseLock ($lock);