diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2008-05-09 20:43:07 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2008-05-09 20:43:07 +0000 |
| commit | b10e6e6448c4c4697c6fa3afd20a6b3f4c23155b (patch) | |
| tree | 7ed82f2eb47dd417695942a16ea7ebc32a33567e /contrib/popularity/t10.php | |
| parent | f7448ba2d65171abad4ee4c4f9c2d6d99ecd30e6 (diff) | |
| download | xxv-b10e6e6448c4c4697c6fa3afd20a6b3f4c23155b.tar.gz xxv-b10e6e6448c4c4697c6fa3afd20a6b3f4c23155b.tar.bz2 | |
* SHARE: Submit event data delayed and transmit data as block
* SHARE: use persist random id
* UTF-8: Reorder defines
* UTF-8: Replace 'SET NAMES' with 'set character set'
* alist: Move generation of channels name from template to perl code
* skins: header add generator meta-tag with version
* RECORDS: Replace character by Hexnibble
* HTTPD: Speedup lookup find skins
* HTTPD: Build options for start page delayed, avoid wrong UTF8 translation
* CHRONICLE: add cgi-parameter start/limit for paging query
* EPG: now: add cgi-parameter __cgrp=all to get all data
* CHRONICLE: Add message to console by delete entry
* OUTPUT/Ajax: optimize callback 'questions'
Diffstat (limited to 'contrib/popularity/t10.php')
| -rw-r--r-- | contrib/popularity/t10.php | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/contrib/popularity/t10.php b/contrib/popularity/t10.php index 2fb5066..61f432e 100644 --- a/contrib/popularity/t10.php +++ b/contrib/popularity/t10.php @@ -150,11 +150,75 @@ function setEventLevel($k,$e,$l,$s) { $database->setQuery( $query ); if (!$database->query()) { die($database->stderr(true)); - return 1; + return 0; } return 1; } + + +//////////////////////////////////////////////////////////////////////////////// +// Register the method to expose +$server->register('setEventArray', // method name + array('k' => 'xsd:string', // user key +// 'u' => 'tns:u' + ), + array('return' => 'xsd:int'), // output parameters + 'urn:t10', // namespace + 'urn:t10#setEventArray', // soapaction + 'rpc', // style + 'encoded', // use + 'Set a level to event.' // documentation +); +// Set a level to event. +function setEventArray($k,$u) { + + $c = count($u); + if($c <= 0 || $c > 25) { + return -1; + } + + $database = opendatabase(); + for ( $i = 0; $i < $c; $i += 1) { + if( count($u[$i]) != 3) { + return -2; + } + $e = (int)$u[$i][0]; + $l = (int)$u[$i][1]; + $s = (int)$u[$i][2]; + + if($e <= 0) { + return -3; + } + + if($l <= 0) { + return -4; + } else { + if($l >= 10) { + return -5; + } + } + + if($s <= 0) { + return -6; + } + + $query = "REPLACE INTO #__popularity" + . " (user, id, level, stoptime)" + . " VALUES ( " . $database->Quote( $k ) . ", " + . $e . ", " + . $l . ", " + . " FROM_UNIXTIME( " . $s . " )" + . " )" + ; + $database->setQuery( $query ); + if (!$database->query()) { + die($database->stderr(true)); + return 0; + } + } + return 1; +} //////////////////////////////////////////////////////////////////////////////// // Register the method to expose $server->register('deleteEvent', // method name |
