2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function getPnoteById ($id, $cols = "*")
6 return sqlQuery("select $cols from pnotes where id='$id' order by date DESC limit 0,1");
9 function getPnotesByDate ($date, $activity = "1", $cols = "*", $pid = "%", $limit="all", $start=0)
15 $sql = "select $cols from pnotes where date like '%$date%' and pid like '$pid' ";
16 if ($activity != "all")
17 $sql .= "and activity = '$activity' ";
18 $sql .= "order by date DESC";
22 $sql = "select $cols from pnotes where date like '%$date%' and pid like '$pid' ";
23 if ($activity != "all")
24 $sql .= "and activity = '$activity' ";
25 $sql .= "order by date DESC LIMIT $start, $limit";
28 $res = sqlStatement($sql);
30 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
35 function getPnotesByPid ($pid, $activity = "1", $cols = "*", $limit=10, $start=0)
37 $res = sqlStatement("select $cols from pnotes where pid like '$pid' and activity = '$activity' order by date DESC LIMIT $start,$limit");
38 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
43 function addPnote($pid, $body, $authorized = "0", $activity = "1")
45 $body = mysql_escape_string($body);
46 return sqlInsert("insert into pnotes (date, body, pid, user, groupname, authorized, activity) values (NOW(), '$body','$pid', '" . $_SESSION['authUser'] . "', '". $_SESSION['authProvider'] ."', '$authorized', '$activity')");
49 function authorizePnote($id, $authorized = "1")
51 sqlQuery("update pnotes set authorized = '$authorized' where id = '$id'");
54 function disappearPnote($id)
56 sqlStatement("update pnotes set activity = '0' where id='$id'");
60 function reappearPnote ($id)
62 sqlStatement("update pnotes set activity = '1' where id='$id'");