Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
forum_entry.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  * Add forum entry
9  *
10  * @author Anakeen 2008
11  * @version $Id: forum_entry.php,v 1.6 2008/03/12 09:59:24 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 include_once ("FDL/Class.Doc.php");
19 function forum_entry(&$action)
20 {
21 
22  $dbaccess = GetParam("FREEDOM_DB");
23 
24  $fid = GetHttpVars("fid", "");
25  $eid = GetHttpVars("eid", -1);
26  if ($fid == "") $action->exitError(_("no document reference"));
27 
28  $forum = new_Doc($dbaccess, $fid);
29  if (!$forum->isAffected()) $action->exitError(sprintf(_("cannot see unknow forum reference %s") , $fid));
30 
31  $entries = $forum->getentries();
32  if ($eid == - 1 || !is_array($entries[$eid])) {
33  $show = false;
34  } else {
35  $show = true;
36 
37  $action->lay->set("who", $entries[$eid]["who"]);
38  $action->lay->set("mail", $entries[$eid]["mail"]);
39  $action->lay->set("havemail", $entries[$eid]["havemail"]);
40  $action->lay->set("docid", $entries[$eid]["docid"]);
41  $action->lay->set("lid", $entries[$eid]["prev"]);
42  $action->lay->set("date", $entries[$eid]["date"]);
43  $action->lay->set("editable", $entries[$eid]["editable"]);
44  $action->lay->set("opened", $entries[$eid]["opened"]);
45  $action->lay->set("content", $entries[$eid]["content"]);
46  $action->lay->set("rcount", count($entries[$eid]["next"]));
47  $action->lay->set("hasresponse", (count($entries[$eid]["next"]) > 0 ? true : false));
48  $action->lay->set("candelete", ($action->user->id == 1 && $forum->locked != - 1 ? true : false));
49 
50  if (count($entries[$eid]["next"]) == 0) {
51  $rlist = null;
52  } else {
53  foreach ($entries[$eid]["next"] as $kr => $vr) {
54  $rlist[] = array(
55  "fid" => $fid,
56  "eid" => $vr
57  );
58  }
59  }
60  $action->lay->setBlockData("forum_answer", $rlist);
61  }
62 
63  $action->lay->set("fid", $fid);
64  $action->lay->set("eid", $eid);
65  $action->lay->set("show", $show);
66 }
67 ?>
← centre documentaire © anakeen - published under CC License - Dynacase