From: <dts...@us...> - 2003-06-04 15:38:08
|
Update of /cvsroot/phpwebsite-comm/modules/phpwsbb/class In directory sc8-pr-cvs1:/tmp/cvs-serv12007/class Modified Files: Manager.php Message.php Thread.php Log Message: Cleanup and thread locking complete Index: Manager.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsbb/class/Manager.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Manager.php 3 Jun 2003 22:21:03 -0000 1.14 --- Manager.php 4 Jun 2003 15:38:03 -0000 1.15 *************** *** 132,135 **** --- 132,137 ---- $this->notice->display(); + $this->managerAction(); + switch($_REQUEST["PHPWSBB_MAN_OP"]) { case "new": Index: Message.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsbb/class/Message.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Message.php 3 Jun 2003 22:18:31 -0000 1.14 --- Message.php 4 Jun 2003 15:38:03 -0000 1.15 *************** *** 99,102 **** --- 99,113 ---- } + + if($this->_tid) { + // Need to see if thread is locked + $thread = new PHPWSBB_Thread($this->_tid); + if($thread->_locked) { + $message = "<div class=\"errortext\">" . $_SESSION["translate"]->it("This thread has been locked.") . "</div>"; + $GLOBALS["CNT_phpwsbb"]["content"] .= $message; + return; + } + } + /* Variable to set tab order */ *************** *** 234,238 **** $_REQUEST["PHPWSBB_MAN_OP"] = "list"; $_SESSION["PHPWSBB_Manager"]->action(); - $_SESSION["PHPWSBB_Manager"]->managerAction(); } elseif(isset($_REQUEST["Message_no"])) { --- 245,248 ---- *************** *** 242,246 **** $_REQUEST["PHPWSBB_MAN_OP"] = "list"; $_SESSION["PHPWSBB_Manager"]->action(); - $_SESSION["PHPWSBB_Manager"]->managerAction(); } else { --- 252,255 ---- Index: Thread.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsbb/class/Thread.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Thread.php 3 Jun 2003 22:18:31 -0000 1.5 --- Thread.php 4 Jun 2003 15:38:03 -0000 1.6 *************** *** 77,80 **** --- 77,83 ---- //$content = $GLOBALS["core"]->processTemplate($tags, "phpwsbb", "view_thread.tpl"); + if($this->_locked) + $content .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("This thread has been locked.") . "</div>"; + foreach($this->messages as $mid) { $message = new PHPWSBB_Message($mid); *************** *** 125,129 **** $_REQUEST["PHPWSBB_MAN_OP"] = "list"; $_SESSION["PHPWSBB_Manager"]->action(); - $_SESSION["PHPWSBB_Manager"]->managerAction(); } elseif(isset($_REQUEST["Thread_no"])) { --- 128,131 ---- *************** *** 132,136 **** $_REQUEST["PHPWSBB_MAN_OP"] = "list"; $_SESSION["PHPWSBB_Manager"]->action(); - $_SESSION["PHPWSBB_Manager"]->managerAction(); } else { --- 134,137 ---- *************** *** 156,159 **** --- 157,198 ---- + function _lock() { + if(!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "lock_threads")) { + $message = $_SESSION["translate"]->it("Access to lock this thread was denied due to lack of proper permissions."); + $error = new PHWPS_Error("phpwsbb", "PHPWSBB_Thread::_lock()", $message, "exit", 1); + $error->message(); + return FALSE; + } + + $lockstr = "[" . $_SESSION["translate"]->it("LOCKED") . "] "; + if($this->_locked) { + $strlen = strlen($lockstr); + $this->_label = substr_replace($this->_label, NULL, 0, $strlen); + $this->_locked = 0; + } else { + $this->_label = $lockstr . $this->getLabel(); + $this->_locked = 1; + } + + $error = $this->commit(); + if(PHPWS_Error::isError($error)) { + $message = $_SESSION["translate"]->it("The thread could not be saved to the database."); + $error = new PHPWS_Error("phpwsbb", $message, "continue", 0); + $error->message("CNT_phpwsbb"); + + $_REQUEST["PHPWSBB_THREAD_OP"] = "view"; + $this->action(); + return; + } else { + $GLOBALS["CNT_phpwsbb"]["content"] .= $_SESSION["translate"]->it("The thread was successfully locked.") . "<br />\n"; + + $_REQUEST["PHPWSBB_THREAD_OP"] = "view"; + $this->action(); + } + + }// END FUNC _lock + + + function action() { switch($_REQUEST["PHPWSBB_THREAD_OP"]) { *************** *** 169,172 **** --- 208,215 ---- case "lock": + $this->_lock(); + break; + + case "stick": default: $title = "NO OP"; |