From: Don S. <ri...@us...> - 2004-03-18 04:37:43
|
Update of /cvsroot/phpwsbb/phpwsbb/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27984/class Modified Files: Manager.php Message.php Thread.php Log Message: RFE 86265 Added 'Allow User Monitors' Setting Index: Thread.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Thread.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Thread.php 18 Mar 2004 04:02:15 -0000 1.39 --- Thread.php 18 Mar 2004 04:28:07 -0000 1.40 *************** *** 102,111 **** /* Populate this object if ID exists */ ! if(is_numeric($THREAD_ID)) { ! if(isset($THREAD_ID)) { $this->setId($THREAD_ID); $this->init(); $sql = "SELECT id FROM " . PHPWS_TBL_PREFIX . "mod_phpwsbb_messages WHERE tid=" . $this->getId(); ! if(!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "hide_threads")) $sql .= " AND hidden=0"; $sql .= " ORDER BY created"; --- 102,111 ---- /* Populate this object if ID exists */ ! if (is_numeric($THREAD_ID)) { ! if (isset($THREAD_ID)) { $this->setId($THREAD_ID); $this->init(); $sql = "SELECT id FROM " . PHPWS_TBL_PREFIX . "mod_phpwsbb_messages WHERE tid=" . $this->getId(); ! if (!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "hide_threads")) $sql .= " AND hidden=0"; $sql .= " ORDER BY created"; *************** *** 113,122 **** // Monitor stuff ! if(!empty($_SESSION["OBJ_user"]->user_id)) { ! $data = array(); ! $data["thread_id"] = $this->getId(); ! $data["user_id"] = $_SESSION["OBJ_user"]->user_id; ! if($test_sql = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_monitors",$data)) ! $this->monitored = TRUE; } } --- 113,124 ---- // Monitor stuff ! if ($_SESSION["PHPWSBB_Manager"]->_allow_user_monitors) { ! if (!empty($_SESSION["OBJ_user"]->user_id)) { ! $data = array(); ! $data["thread_id"] = $this->getId(); ! $data["user_id"] = $_SESSION["OBJ_user"]->user_id; ! if ($test_sql = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_monitors",$data)) ! $this->monitored = TRUE; ! } } } *************** *** 125,129 **** } ! if(isset($this->_fid)) { $f = new PHPWSBB_Forum($this->_fid); $this->forumlabel = $f->getLabel(); --- 127,131 ---- } ! if (isset($this->_fid)) { $f = new PHPWSBB_Forum($this->_fid); $this->forumlabel = $f->getLabel(); *************** *** 135,146 **** function _view($ro = FALSE) { ! if($this->isHidden() && !$_SESSION["OBJ_user"]->allow_access("phpwsbb", "hide_threads")) { $content = "<div class=\"errortext\">" . $_SESSION["translate"]->it("There is nothing here to see.") . "</div>"; return $content; } ! if(count($this->messages) == 0) { $content = "<div class=\"errortext\">" . $_SESSION["translate"]->it("This topic has no messages.") . "</div>"; ! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_threads")) $content .= "<br /><a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=delete&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Delete Topic") . "</a>"; return $content; --- 137,148 ---- function _view($ro = FALSE) { ! if ($this->isHidden() && !$_SESSION["OBJ_user"]->allow_access("phpwsbb", "hide_threads")) { $content = "<div class=\"errortext\">" . $_SESSION["translate"]->it("There is nothing here to see.") . "</div>"; return $content; } ! if (count($this->messages) == 0) { $content = "<div class=\"errortext\">" . $_SESSION["translate"]->it("This topic has no messages.") . "</div>"; ! if ($_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_threads")) $content .= "<br /><a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=delete&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Delete Topic") . "</a>"; return $content; *************** *** 148,152 **** // Not sure if we want this ! if($_SESSION["OBJ_fatcat"]) $_SESSION["OBJ_fatcat"]->whatsRelated($this->_fid); --- 150,154 ---- // Not sure if we want this ! if ($_SESSION["OBJ_fatcat"]) $_SESSION["OBJ_fatcat"]->whatsRelated($this->_fid); *************** *** 163,170 **** ! if(!$ro) { $tags["REPLY"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=reply&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/reply_message.png\" border=\"0\">" . $_SESSION["translate"]->it("Post Reply") . "</a>"; ! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "lock_threads")) { ! if($this->_locked) $tags["LOCK"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unlock&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/unlocked.png\" border=\"0\">" . $_SESSION["translate"]->it("Unlock Topic") . "</a>"; else --- 165,172 ---- ! if (!$ro) { $tags["REPLY"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=reply&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/reply_message.png\" border=\"0\">" . $_SESSION["translate"]->it("Post Reply") . "</a>"; ! if ($_SESSION["OBJ_user"]->allow_access("phpwsbb", "lock_threads")) { ! if ($this->_locked) $tags["LOCK"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unlock&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/unlocked.png\" border=\"0\">" . $_SESSION["translate"]->it("Unlock Topic") . "</a>"; else *************** *** 172,180 **** } ! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "move_threads")) { // Need drop-down of forums $forums = array(); $results = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_forums",NULL,NULL,"sortorder"); ! if($results) foreach($results as $rec) $forums[$rec["id"]] = $rec["label"]; --- 174,182 ---- } ! if ($_SESSION["OBJ_user"]->allow_access("phpwsbb", "move_threads")) { // Need drop-down of forums $forums = array(); $results = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_forums",NULL,NULL,"sortorder"); ! if ($results) foreach($results as $rec) $forums[$rec["id"]] = $rec["label"]; *************** *** 195,203 **** } ! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_threads")) $tags["DELETE"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=delete&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/delete.png\" border=\"0\">" . $_SESSION["translate"]->it("Delete Topic") . "</a>"; ! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "hide_threads")) { ! if($this->isHidden()) $tags["HIDE"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showthread&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/hideshow.png\" border=\"0\">" . $_SESSION["translate"]->it("Show Topic") . "</a>"; else --- 197,205 ---- } ! if ($_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_threads")) $tags["DELETE"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=delete&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/delete.png\" border=\"0\">" . $_SESSION["translate"]->it("Delete Topic") . "</a>"; ! if ($_SESSION["OBJ_user"]->allow_access("phpwsbb", "hide_threads")) { ! if ($this->isHidden()) $tags["HIDE"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showthread&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/hideshow.png\" border=\"0\">" . $_SESSION["translate"]->it("Show Topic") . "</a>"; else *************** *** 205,210 **** } ! if($_SESSION["OBJ_user"]->allow_access("phpwsbb", "sticky_threads")) { ! if($this->_sticky) $tags["STICKY"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unstick&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/sticky.png\" border=\"0\">" . $_SESSION["translate"]->it("Unstick Topic") . "</a>"; else --- 207,212 ---- } ! if ($_SESSION["OBJ_user"]->allow_access("phpwsbb", "sticky_threads")) { ! if ($this->_sticky) $tags["STICKY"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unstick&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/sticky.png\" border=\"0\">" . $_SESSION["translate"]->it("Unstick Topic") . "</a>"; else *************** *** 213,220 **** } ! if($this->monitored) ! $tags["MONITOR"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unmonitor&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/unmonitor.png\" border=\"0\">" . $_SESSION["translate"]->it("Stop Monitor") . "</a>"; ! else ! $tags["MONITOR"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=monitor&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/monitor.png\" border=\"0\">" . $_SESSION["translate"]->it("Monitor") . "</a>"; $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "view_thread.tpl"); --- 215,224 ---- } ! if ($_SESSION["PHPWSBB_Manager"]->_allow_user_monitors) { ! if ($this->monitored) ! $tags["MONITOR"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unmonitor&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/unmonitor.png\" border=\"0\">" . $_SESSION["translate"]->it("Stop Monitor") . "</a>"; ! else ! $tags["MONITOR"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=monitor&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\"><img src=\"./mod/phpwsbb/img/monitor.png\" border=\"0\">" . $_SESSION["translate"]->it("Monitor") . "</a>"; ! } $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "view_thread.tpl"); *************** *** 235,243 **** function updateThread($new = FALSE) { ! if(!empty($this->_id)) { $sql = "SELECT id FROM " . PHPWS_TBL_PREFIX . "mod_phpwsbb_messages WHERE tid=" . $this->getId() . " ORDER BY created;"; $this->messages = $GLOBALS["core"]->getCol($sql); $this->_replies = count($this->messages) - 1; ! if($this->_replies < 0) { /* * This means the only message in the thread was deleted via --- 239,247 ---- function updateThread($new = FALSE) { ! if (!empty($this->_id)) { $sql = "SELECT id FROM " . PHPWS_TBL_PREFIX . "mod_phpwsbb_messages WHERE tid=" . $this->getId() . " ORDER BY created;"; $this->messages = $GLOBALS["core"]->getCol($sql); $this->_replies = count($this->messages) - 1; ! if ($this->_replies < 0) { /* * This means the only message in the thread was deleted via *************** *** 266,271 **** // Update owner to guestname of root message if empty // This is a backport for a fix that was implemented in 0.3.1 ! if($this->getOwner() == "") ! if(!empty($message->_guestname)) $this->_owner = $message->_guestname; --- 270,275 ---- // Update owner to guestname of root message if empty // This is a backport for a fix that was implemented in 0.3.1 ! if ($this->getOwner() == "") ! if (!empty($message->_guestname)) $this->_owner = $message->_guestname; *************** *** 279,309 **** // Send email to monitors for new messages ! if($new) { ! $sql = "SELECT email FROM " . PHPWS_TBL_PREFIX . "mod_phpwsbb_monitors a," . $GLOBALS["core"]->tbl_prefix . "mod_users b WHERE a.thread_id=" . $this->getId() . " AND b.user_id=a.user_id"; ! $emails = $GLOBALS["core"]->getCol($sql); ! ! $admin_email = $_SESSION["PHPWSBB_Manager"]->_admin_email; ! if(empty($admin_email)) { ! extract(PHPWS_User::getSettings()); ! $admin_email = $user_contact; ! } ! $from = "\"" . $_SESSION["translate"]->it("Bulletin Board Admin") . "\" <$admin_email>"; ! $subject = $_SESSION["translate"]->it("Reply to \"[var1]\"", $this->getLabel()); ! $message = $_SESSION["PHPWSBB_Manager"]->_email_text; ! // Replace [name] and [url] in $message ! $message = str_replace("[name]", "\"" . $this->getLabel() . "\"", $message); ! $message = str_replace("[url]", "http://" . PHPWS_HOME_HTTP . "index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $this->getId(), $message); ! ! foreach ($emails as $email) { ! $mail_object =& Mail::factory('mail'); ! $headers['From'] = $from; ! $headers['Subject'] = $subject; ! // $headers['To'] = $email; ! $mail_object->send($email, $headers, $message); } - - /* Removed for RFE 862965 */ - //if(!$this->monitored && !empty($_SESSION["OBJ_user"]->user_id)) - //$this->_monitor(); } --- 283,315 ---- // Send email to monitors for new messages ! if ($_SESSION["PHPWSBB_Manager"]->_allow_user_monitors) { ! if ($new) { ! $sql = "SELECT email FROM " . PHPWS_TBL_PREFIX . "mod_phpwsbb_monitors a," . $GLOBALS["core"]->tbl_prefix . "mod_users b WHERE a.thread_id=" . $this->getId() . " AND b.user_id=a.user_id"; ! $emails = $GLOBALS["core"]->getCol($sql); ! ! $admin_email = $_SESSION["PHPWSBB_Manager"]->_admin_email; ! if (empty($admin_email)) { ! extract(PHPWS_User::getSettings()); ! $admin_email = $user_contact; ! } ! $from = "\"" . $_SESSION["translate"]->it("Bulletin Board Admin") . "\" <$admin_email>"; ! $subject = $_SESSION["translate"]->it("Reply to \"[var1]\"", $this->getLabel()); ! $message = $_SESSION["PHPWSBB_Manager"]->_email_text; ! // Replace [name] and [url] in $message ! $message = str_replace("[name]", "\"" . $this->getLabel() . "\"", $message); ! $message = str_replace("[url]", "http://" . PHPWS_HOME_HTTP . "index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $this->getId(), $message); ! ! foreach ($emails as $email) { ! $mail_object =& Mail::factory('mail'); ! $headers['From'] = $from; ! $headers['Subject'] = $subject; ! // $headers['To'] = $email; ! $mail_object->send($email, $headers, $message); ! } ! ! /* Removed for RFE 862965 */ ! //if (!$this->monitored && !empty($_SESSION["OBJ_user"]->user_id)) ! //$this->_monitor(); } } *************** *** 312,316 **** function _delete() { ! if(!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_threads")) { $message = $_SESSION["translate"]->it("Access to delete this topic was denied due to lack of proper permissions."); $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Thread::_delete()", $message, "exit", 1); --- 318,322 ---- function _delete() { ! if (!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "delete_threads")) { $message = $_SESSION["translate"]->it("Access to delete this topic was denied due to lack of proper permissions."); $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Thread::_delete()", $message, "exit", 1); *************** *** 319,323 **** } ! if(isset($_REQUEST["Thread_yes"])) { $this->kill(); --- 325,329 ---- } ! if (isset($_REQUEST["Thread_yes"])) { $this->kill(); *************** *** 335,339 **** $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif(isset($_REQUEST["Thread_no"])) { $message = $_SESSION["translate"]->it("No topic was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); --- 341,345 ---- $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif (isset($_REQUEST["Thread_no"])) { $message = $_SESSION["translate"]->it("No topic was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); *************** *** 364,368 **** function _lock($unlock = FALSE) { ! if(!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "lock_threads")) { $message = $_SESSION["translate"]->it("Access to lock this topic was denied due to lack of proper permissions."); $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Thread::_lock()", $message, "exit", 1); --- 370,374 ---- function _lock($unlock = FALSE) { ! if (!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "lock_threads")) { $message = $_SESSION["translate"]->it("Access to lock this topic was denied due to lack of proper permissions."); $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Thread::_lock()", $message, "exit", 1); *************** *** 371,380 **** } ! if($unlock && $this->_locked) $this->_locked = 0; ! elseif(!$unlock && !$this->_locked) $this->_locked = 1; else { ! if($this->_locked) $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("This topic is already locked.") . "</div><br />\n"; else --- 377,386 ---- } ! if ($unlock && $this->_locked) $this->_locked = 0; ! elseif (!$unlock && !$this->_locked) $this->_locked = 1; else { ! if ($this->_locked) $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("This topic is already locked.") . "</div><br />\n"; else *************** *** 387,391 **** $error = $this->commit(); ! if(PHPWS_Error::isError($error)) { $message = $_SESSION["translate"]->it("The topic could not be saved to the database."); $error = new PHPWS_Error("phpwsbb", $message, "continue", 0); --- 393,397 ---- $error = $this->commit(); ! if (PHPWS_Error::isError($error)) { $message = $_SESSION["translate"]->it("The topic could not be saved to the database."); $error = new PHPWS_Error("phpwsbb", $message, "continue", 0); *************** *** 406,410 **** function _stick($unstick = FALSE) { ! if(!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "sticky_threads")) { $message = $_SESSION["translate"]->it("Access to stick this topic was denied due to lack of proper permissions."); $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Thread::_stock()", $message, "exit", 1); --- 412,416 ---- function _stick($unstick = FALSE) { ! if (!$_SESSION["OBJ_user"]->allow_access("phpwsbb", "sticky_threads")) { $message = $_SESSION["translate"]->it("Access to stick this topic was denied due to lack of proper permissions."); $error = new PHPWS_Error("phpwsbb", "PHPWSBB_Thread::_stock()", $message, "exit", 1); *************** *** 413,422 **** } ! if($unstick && $this->_sticky) $this->_sticky = 0; ! elseif(!$unstick && !$this->_sticky) $this->_sticky = 1; else { ! if($this->_sticky) $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("This topic is already sticky.") . "</div><br />\n"; else --- 419,428 ---- } ! if ($unstick && $this->_sticky) $this->_sticky = 0; ! elseif (!$unstick && !$this->_sticky) $this->_sticky = 1; else { ! if ($this->_sticky) $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("This topic is already sticky.") . "</div><br />\n"; else *************** *** 429,433 **** $error = $this->commit(); ! if(PHPWS_Error::isError($error)) { $message = $_SESSION["translate"]->it("The topic could not be saved to the database."); $error = new PHPWS_Error("phpwsbb", $message, "continue", 0); --- 435,439 ---- $error = $this->commit(); ! if (PHPWS_Error::isError($error)) { $message = $_SESSION["translate"]->it("The topic could not be saved to the database."); $error = new PHPWS_Error("phpwsbb", $message, "continue", 0); *************** *** 448,483 **** function _monitor() { ! if(empty($_SESSION["OBJ_user"]->user_id)) { ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("You must be a registered user and logged in to monitor topics.") . "</div>"; ! } else { ! $data = array(); ! $data["thread_id"] = $this->getId(); ! $data["user_id"] = $_SESSION["OBJ_user"]->user_id; ! if($GLOBALS["core"]->sqlInsert($data, "mod_phpwsbb_monitors", TRUE, FALSE, FALSE, FALSE)) { ! $GLOBALS["CNT_phpwsbb"]["content"] .= $_SESSION["translate"]->it("You are now monitoring the topic \"[var1]\" and will be emailed when there is a new reply.", $this->getLabel()); ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<br /><a href=\"http://" . PHPWS_HOME_HTTP . "index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Back to the topic.") . "</a>"; ! $this->monitored = TRUE; } else { ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("There was a problem adding the monitor entry. Please try again or contact the system administrator.") . "</div>"; } } - - //$_REQUEST["PHPWSBB_THREAD_OP"] = "view"; - //$this->action(); }// END FUNC _monitor function _unmonitor() { ! $data = array(); ! $data["thread_id"] = $this->getId(); ! $data["user_id"] = $_SESSION["OBJ_user"]->user_id; ! if($GLOBALS["core"]->sqlDelete("mod_phpwsbb_monitors", $data)) { ! $GLOBALS["CNT_phpwsbb"]["content"] .= $_SESSION["translate"]->it("Monitor successfully removed."); ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<br /><a href=\"http://" . PHPWS_HOME_HTTP . "index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Back to the topic.") . "</a>"; ! $this->monitored = FALSE; ! } else { ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("There was a problem removing the monitor entry. Please try again or contact the system administrator.") . "</div>"; } - }// END FUNC _unmonitor --- 454,492 ---- function _monitor() { ! if ($_SESSION["PHPWSBB_Manager"]->_allow_user_monitors) { ! if (empty($_SESSION["OBJ_user"]->user_id)) { ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("You must be a registered user and logged in to monitor topics.") . "</div>"; } else { ! $data = array(); ! $data["thread_id"] = $this->getId(); ! $data["user_id"] = $_SESSION["OBJ_user"]->user_id; ! if ($GLOBALS["core"]->sqlInsert($data, "mod_phpwsbb_monitors", TRUE, FALSE, FALSE, FALSE)) { ! $GLOBALS["CNT_phpwsbb"]["content"] .= $_SESSION["translate"]->it("You are now monitoring the topic \"[var1]\" and will be emailed when there is a new reply.", $this->getLabel()); ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<br /><a href=\"http://" . PHPWS_HOME_HTTP . "index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Back to the topic.") . "</a>"; ! $this->monitored = TRUE; ! } else { ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("There was a problem adding the monitor entry. Please try again or contact the system administrator.") . "</div>"; ! } } + + //$_REQUEST["PHPWSBB_THREAD_OP"] = "view"; + //$this->action(); } }// END FUNC _monitor function _unmonitor() { ! if ($_SESSION["PHPWSBB_Manager"]->_allow_user_monitors) { ! $data = array(); ! $data["thread_id"] = $this->getId(); ! $data["user_id"] = $_SESSION["OBJ_user"]->user_id; ! if ($GLOBALS["core"]->sqlDelete("mod_phpwsbb_monitors", $data)) { ! $GLOBALS["CNT_phpwsbb"]["content"] .= $_SESSION["translate"]->it("Monitor successfully removed."); ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<br /><a href=\"http://" . PHPWS_HOME_HTTP . "index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $this->getId() . "\">" . $_SESSION["translate"]->it("Back to the topic.") . "</a>"; ! $this->monitored = FALSE; ! } else { ! $GLOBALS["CNT_phpwsbb"]["content"] .= "<div class=\"errortext\">" . $_SESSION["translate"]->it("There was a problem removing the monitor entry. Please try again or contact the system administrator.") . "</div>"; ! } } }// END FUNC _unmonitor *************** *** 486,490 **** $oldfid = $this->_fid; $this->_fid = $_REQUEST["Thread_fid"]; ! if($oldfid == $this->_fid) return $_SESSION["translate"]->it("You tried to move it to current forum."); $this->commit(); --- 495,499 ---- $oldfid = $this->_fid; $this->_fid = $_REQUEST["Thread_fid"]; ! if ($oldfid == $this->_fid) return $_SESSION["translate"]->it("You tried to move it to current forum."); $this->commit(); *************** *** 546,550 **** } ! if(isset($content)) { $GLOBALS["CNT_phpwsbb"]["title"] = $title; $GLOBALS["CNT_phpwsbb"]["content"] .= $content; --- 555,559 ---- } ! if (isset($content)) { $GLOBALS["CNT_phpwsbb"]["title"] = $title; $GLOBALS["CNT_phpwsbb"]["content"] .= $content; *************** *** 555,564 **** function getLabel($prefix = TRUE) { $lab = parent::getLabel(); ! if($prefix) { ! if($this->isHidden()) $lab = "<img src=\"./mod/phpwsbb/img/hideshow.png\" border=\"0\"> " . $lab; ! if($this->_locked) $lab = "<img src=\"./mod/phpwsbb/img/locked.png\" border=\"0\"> " . $lab; ! if($this->_sticky) $lab = "<img src=\"./mod/phpwsbb/img/sticky.png\" border=\"0\"> " . $lab; } --- 564,573 ---- function getLabel($prefix = TRUE) { $lab = parent::getLabel(); ! if ($prefix) { ! if ($this->isHidden()) $lab = "<img src=\"./mod/phpwsbb/img/hideshow.png\" border=\"0\"> " . $lab; ! if ($this->_locked) $lab = "<img src=\"./mod/phpwsbb/img/locked.png\" border=\"0\"> " . $lab; ! if ($this->_sticky) $lab = "<img src=\"./mod/phpwsbb/img/sticky.png\" border=\"0\"> " . $lab; } *************** *** 568,572 **** function getLastPost() { ! if($this->_lastpost) return date(PHPWS_DATE_FORMAT . " " . PHPWS_TIME_FORMAT, $this->_lastpost); else return NULL; }// END FUNC getLastPost --- 577,581 ---- function getLastPost() { ! if ($this->_lastpost) return date(PHPWS_DATE_FORMAT . " " . PHPWS_TIME_FORMAT, $this->_lastpost); else return NULL; }// END FUNC getLastPost *************** *** 575,579 **** function getForumLabel($link=FALSE) { $ret = $this->forumlabel; ! if($link) { $ret = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=viewforum&PHPWS_MAN_ITEMS[]=" . $this->_fid . "\">$ret</a>"; } --- 584,588 ---- function getForumLabel($link=FALSE) { $ret = $this->forumlabel; ! if ($link) { $ret = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=viewforum&PHPWS_MAN_ITEMS[]=" . $this->_fid . "\">$ret</a>"; } Index: Message.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Message.php,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Message.php 18 Mar 2004 04:02:15 -0000 1.44 --- Message.php 18 Mar 2004 04:28:07 -0000 1.45 *************** *** 386,389 **** --- 386,390 ---- $thread->updateThread($new); + // 2004/03/17 DTS: Should this just be done in updateThread()? if ($_SESSION["PHPWSBB_Manager"]->_monitor_posts) { include_once("Mail.php"); Index: Manager.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Manager.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Manager.php 16 Mar 2004 03:52:03 -0000 1.28 --- Manager.php 18 Mar 2004 04:28:07 -0000 1.29 *************** *** 68,71 **** --- 68,79 ---- /** + * Flag to enable/disable user monitors site-wide + * + * @var int + * @access private + */ + var $_allow_user_monitors; + + /** * Flag to have show forums block * *************** *** 154,157 **** --- 162,166 ---- $this->_email_text = $result[0]["email_text"]; $this->_monitor_posts = $result[0]["monitor_posts"]; + $this->_allow_user_monitors = $result[0]["allow_user_monitors"]; $this->_showforumsblock = $result[0]["showforumsblock"]; $this->_showlatestthreadsblock = $result[0]["showlatestthreadsblock"]; *************** *** 500,503 **** --- 509,517 ---- $tabs++; + $form->add("SETTINGS_allow_user_monitors", "checkbox"); + $form->setMatch("SETTINGS_allow_user_monitors", $this->_allow_user_monitors); + $form->setTab("SETTINGS_allow_user_monitors", $tabs); + $tabs++; + $form->add("SETTINGS_email_text", "textarea", $this->_email_text); $form->setCols("SETTINGS_email_text", 40); *************** *** 546,549 **** --- 560,564 ---- $tags["ADMIN_EMAIL_TEXT"] = $_SESSION["translate"]->it("Bulletin Board Admin Email"); $tags["MONITOR_POSTS_TEXT"] = $_SESSION["translate"]->it("Monitor Posts"); + $tags["ALLOW_USER_MONITORS_TEXT"] = $_SESSION["translate"]->it("Allow User Monitors"); $tags["BBOFFLINE_TEXT"] = $_SESSION["translate"]->it("Take Bulletin Board Offline"); $tags["EMAIL_TEXT_TEXT"] = $_SESSION["translate"]->it("Email Notification Text"); *************** *** 588,591 **** --- 603,611 ---- $this->_monitor_posts = 0; + if(isset($_REQUEST["SETTINGS_allow_user_monitors"])) + $this->_allow_user_monitors = 1; + else + $this->_allow_user_monitors = 0; + if(isset($_REQUEST["SETTINGS_bboffline"])) $this->_bboffline = 1; *************** *** 615,618 **** --- 635,639 ---- $data["email_text"] = $this->_email_text; $data["monitor_posts"] = $this->_monitor_posts; + $data["allow_user_monitors"] = $this->_allow_user_monitors; $data["bboffline"] = $this->_bboffline; $data["showforumsblock"] = $this->_showforumsblock; |