Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
notifier.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * docoments event pool notifier
9  * @author Anakeen
10  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
11  * @package FDL
12  */
13 
14 include_once ("WHAT/Lib.Common.php");
15 
16 function getNotifyHisto($date, $nextdelay = 5, $limit = 1000)
17 {
18  $c = @pg_pconnect(sprintf("service='%s'", getServiceFreedom()));
19  if ($c) {
20  $r["date"] = date("Y-m-d H:i:s");
21  $r["delay"] = $nextdelay;
22  if ($date && $date != "null") {
23  $sql = sprintf("select * from doclog where level=4 and date >= '%s' and date < '%s' limit %d", pg_escape_string($date) , pg_escape_string($r["date"]) , $limit);
24 
25  $r["sql"] = $sql;
26  $result = @pg_query($c, $sql);
27  if ($result) {
28  $nbrows = pg_numrows($result);
29  if ($nbrows > 0) {
30  $r["notifications"] = pg_fetch_all($result);
31  foreach ($r["notifications"] as $k => $v) if ($v["arg"]) $r["notifications"][$k]["arg"] = unserialize($v["arg"]);
32  }
33  } else {
34  $r["error"] = pg_last_error($c);
35  }
36  }
37  }
38  return json_encode($r);
39 }
40 //$_POST["date"]='2009-11-19';
41 $a = getNotifyHisto($_POST["date"], 10);
42 print ($a);
43 ?>
← centre documentaire © anakeen - published under CC License - Dynacase