18 include_once (
"FDL/Class.Doc.php");
19 include_once (
"FDL/freedom_util.php");
33 if (
$docid ==
"")
$action->exitError(_(
"no document reference"));
35 if (!
$doc->isAffected())
$action->exitError(sprintf(_(
"cannot see unknow reference %s") ,
$docid));
36 if (
$doc->locked == - 1) {
41 if (
$doc->Control(
"edit") !=
"" &&
$doc->Control(
"forum") !=
"")
$action->exitError(sprintf(_(
"you don't have privilege to edit forum for document %s") ,
$doc->title));
43 $doc->disableEditControl();
45 $forid = (
$doc->forumid =
"" ||
$doc->forumid < 1 ? -1 :
$doc->forumid);
47 $date = strftime(
"%d/%m/%y %H:%S", time());
52 $forum->disableEditControl();
53 $forum->setValue(
"forum_docid",
$doc->id);
54 $forum->setProfil(
$doc->profid);
56 $doc->forumid = $forum->id;
57 $doc->modify(
true, array(
87 if (!$forum->isAffected())
$action->exitError(sprintf(_(
"cannot see unknow forum reference %s") , $forid));
88 $forum->disableEditControl();
90 $t_id = $forum->getTValue(
"forum_d_id");
91 $t_lid = $forum->getTValue(
"forum_d_link");
92 $t_userid = $forum->getTValue(
"forum_d_userid");
93 $t_user = $forum->getTValue(
"forum_d_user");
94 $t_usermail = $forum->getTValue(
"forum_d_usermail");
95 $t_text = $forum->getTValue(
"forum_d_text");
96 $t_flag = $forum->getTValue(
"forum_d_flag");
97 $t_date = $forum->getTValue(
"forum_d_date");
99 $newentry = ($entrid == - 1 ?
true :
false);
100 $entrid = ($entrid == - 1 ? $forum->getEntryId() : $entrid);
105 foreach ($t_id as $k => $v) {
106 if ($linkid == $t_id[$k] && $linkid != - 1) {
109 if ($entrid == $v) $ventry = $k;
111 if (!$validlink) $linkid = - 1;
112 if ($ventry == - 1) $ventry = count($t_id);
116 $t_id[$ventry] = $entrid;
117 $t_lid[$ventry] = $linkid;
118 $t_userid[$ventry] =
$action->user->fid;
122 $t_text[$ventry] = $text;
123 $t_flag[$ventry] = $flag;
124 $t_date[$ventry] = $date;
127 $forum->setValue(
"forum_d_id", $t_id);
128 $forum->setValue(
"forum_d_link", $t_lid);
129 $forum->setValue(
"forum_d_userid", $t_userid);
130 $forum->setValue(
"forum_d_user", $t_user);
131 $forum->setValue(
"forum_d_usermail", $t_usermail);
132 $forum->setValue(
"forum_d_text", $t_text);
133 $forum->setValue(
"forum_d_flag", $t_flag);
134 $forum->setValue(
"forum_d_date", $t_date);
135 $err = $forum->Modify();
136 if (
$err !=
"")
$action->exitError(sprintf(_(
"cannot modify forum %s") , $forum->id));;
137 $err = $forum->postModify();
138 if (
$err !=
"")
$action->exitError(sprintf(_(
"cannot modify forum %s") , $forum->id));;
140 redirect(
$action,
"FDL",
"IMPCARD&sole=Y&zone=FDL:FORUM_VIEW:S&id=" . $forum->id .
"&start=" .
$start);