|
From: <dts...@us...> - 2003-06-04 16:40:34
|
Update of /cvsroot/phpwebsite-comm/modules/phpwsbb/class
In directory sc8-pr-cvs1:/tmp/cvs-serv15796/class
Modified Files:
Message.php
Log Message:
Message forking is done
Index: Message.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/phpwsbb/class/Message.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Message.php 4 Jun 2003 15:38:03 -0000 1.15
--- Message.php 4 Jun 2003 15:45:12 -0000 1.16
***************
*** 79,86 ****
$tags["POSTED"] = $_SESSION["translate"]->it("Posted by [var1] on [var2]", $poster, $this->getCreated());
! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "edit_messages") || ($_SESSION["OBJ_user"]->username == $this->getOwner())) {
$tags["EDIT"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=edit&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Edit") . "</a>";
$tags["DELETE"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=deletemessage&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Delete") . "</a>";
! }
return $GLOBALS["core"]->processTemplate($tags, "phpwsbb", "view.tpl");
--- 79,90 ----
$tags["POSTED"] = $_SESSION["translate"]->it("Posted by [var1] on [var2]", $poster, $this->getCreated());
! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "edit_messages") || ($_SESSION["OBJ_user"]->username == $this->getOwner()))
$tags["EDIT"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=edit&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Edit") . "</a>";
+
+ if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_messages") || ($_SESSION["OBJ_user"]->username == $this->getOwner()))
$tags["DELETE"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=deletemessage&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Delete") . "</a>";
!
! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "fork_messages"))
! $tags["FORK"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=fork&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Fork") . "</a>";
return $GLOBALS["core"]->processTemplate($tags, "phpwsbb", "view.tpl");
***************
*** 225,228 ****
--- 229,272 ----
+ function _fork() {
+ if(!empty($this->_id) && !$_SESSION["OBJ_user"]->allow_access("phpwsbb", "fork_messages")) {
+ $message = $_SESSION["translate"]->it("Access to save message $this->_id was denied due to lack of proper permissions.");
+ $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Manager::_accessDenied()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+
+ // Need to create thread
+ $oldtid = $this->_tid;
+ $thread = new PHPWSBB_Thread;
+ $thread->setLabel($this->getLabel());
+ $thread->commit();
+ $this->_tid = $thread->getId();
+
+ $error = $this->commit();
+ if(PHPWS_Error::isError($error)) {
+ $message = $_SESSION["translate"]->it("The message could not be saved to the database.");
+ $error = new PHPWS_Error("phpwsbb", $message, "continue", 0);
+ $error->message("CNT_phpwsbb");
+
+ $_REQUEST["PHPWSBB_MESSAGE_OP"] = "edit";
+ $this->action();
+ return;
+ } else {
+ $GLOBALS["CNT_phpwsbb"]["content"] .= $_SESSION["translate"]->it("Your message was successfully saved.") . "<br />\n";
+
+ // Update old and new thread objects with new statistics
+ $thread = new PHPWSBB_Thread($oldtid);
+ $thread->updateThread();
+ $thread = new PHPWSBB_Thread($this->_tid);
+ $thread->updateThread();
+
+ $_REQUEST["PHPWSBB_THREAD_OP"] = "view";
+ $thread->action();
+ }
+ }// END FUNC _fork
+
+
function _delete() {
if(!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_messages") && ($_SESSION["OBJ_user"]->username != $this->getOwner())) {
***************
*** 287,291 ****
break;
case "save":
! $this->_save($this->_tid);
break;
case "view":
--- 331,335 ----
break;
case "save":
! $this->_save();
break;
case "view":
***************
*** 294,300 ****
break;
case "delete":
! $this->_delete($this->_tid);
break;
case "fork":
default:
$title = "NO OP";
--- 338,346 ----
break;
case "delete":
! $this->_delete();
break;
case "fork":
+ $this->_fork();
+ break;
default:
$title = "NO OP";
|