From b10e6e6448c4c4697c6fa3afd20a6b3f4c23155b Mon Sep 17 00:00:00 2001 From: Andreas Brachold Date: Fri, 9 May 2008 20:43:07 +0000 Subject: * 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' --- contrib/popularity/t10.php | 66 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'contrib/popularity/t10.php') 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 -- cgit v1.2.3