X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=f9de838915f3441450a6106d2d54681845d95d21;hb=4fc44e9a6f4f15b3d86cfb378d7a8d73cffe0844;hp=56dedce54a08732e0e7f8fdb2e88287ec09ea08c;hpb=8f8ed3f6c2ed084af707e3546ecdcb4b49e101a9;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 56dedce..f9de838 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -160,6 +160,33 @@ $G_room_about= '
Copyright 2006-2008 Matteo Nastasi (aka mop)

'; +function csplitter($in, $sep) +{ + $st = 0; + $id = 0; + $out = array(); + + for ($i = 0 ; $i < strlen($in) ; $i++) { + if ($st == 0) { + if ($in{$i} == '\\') + $st = 1; + else if ($in{$i} == $sep) { + $id++; + } + else { + $out[$id] .= $in{$i}; + } + } + else if ($st == 1) { + $out[$id] .= $in{$i}; + $st = 0; + } + } + + return ($out); +} + + function xcape($s) { $from = array ( '\\', '@', '|' ); @@ -2460,7 +2487,7 @@ class Warrant { return (FALSE); } if (sem_acquire($res)) { - log_lock("LOCK room"); + log_lock("LOCK warrant"); return ($res); } else @@ -2471,11 +2498,40 @@ class Warrant { { GLOBAL $sess; - log_lock("UNLOCK room"); + log_lock("UNLOCK warrant"); return (sem_release($res)); } +} +class Poll { + function lock_data() + { + GLOBAL $sess; + + if (($tok = @ftok(FTOK_PATH."/poll", "B")) == -1) { + return (FALSE); + } + // echo "FTOK ".$tok."
"; + if (($res = sem_get($tok)) == FALSE) { + return (FALSE); + } + if (sem_acquire($res)) { + log_lock("LOCK poll"); + return ($res); + } + else + return (FALSE); + } + function unlock_data($res) + { + GLOBAL $sess; + + log_lock("UNLOCK poll"); + + return (sem_release($res)); + } } + ?>