From: Don S. <ri...@us...> - 2004-03-29 04:18:13
|
Update of /cvsroot/phpwsbb/phpwsbb/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19853/class Modified Files: Forum.php Manager.php Message.php Thread.php Log Message: Changes for RFE #862993 and consolidated delete templates Index: Thread.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Thread.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Thread.php 23 Mar 2004 03:33:59 -0000 1.41 --- Thread.php 29 Mar 2004 04:06:47 -0000 1.42 *************** *** 284,313 **** // 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); } - - if (!$this->monitored && $_SESSION["OBJ_user"]->getUserVar("monitordefault", NULL, "phpwsbb")) - $this->_monitor(); } } --- 284,315 ---- // Send email to monitors for new messages if ($_SESSION["PHPWSBB_Manager"]->_allow_user_monitors) { ! if (!$_SESSION["OBJ_user"]->getUserVar("suspendmonitors", NULL, "phpwsbb")) { ! 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); ! } ! ! if (!$this->monitored && $_SESSION["OBJ_user"]->getUserVar("monitordefault", NULL, "phpwsbb")) ! $this->_monitor(); } } } *************** *** 324,328 **** } ! if (isset($_REQUEST["Thread_yes"])) { $this->kill(); --- 326,330 ---- } ! if (isset($_REQUEST["option_yes"])) { $this->kill(); *************** *** 340,344 **** $_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"); --- 342,346 ---- $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif (isset($_REQUEST["option_no"])) { $message = $_SESSION["translate"]->it("No topic was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); *************** *** 353,358 **** $form->add("PHPWSBB_THREAD_OP", "hidden", "delete"); ! $form->add("Thread_yes", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("Thread_no", "submit", $_SESSION["translate"]->it("No")); $tags = array(); --- 355,360 ---- $form->add("PHPWSBB_THREAD_OP", "hidden", "delete"); ! $form->add("option_yes", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("option_no", "submit", $_SESSION["translate"]->it("No")); $tags = array(); *************** *** 360,364 **** $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this topic?"); ! $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete_thread.tpl"); $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); } --- 362,366 ---- $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this topic?"); ! $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete.tpl"); $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); } Index: Message.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Message.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Message.php 18 Mar 2004 04:28:07 -0000 1.45 --- Message.php 29 Mar 2004 04:06:47 -0000 1.46 *************** *** 475,479 **** } ! if (isset($_REQUEST["Message_yes"])) { $this->kill(); --- 475,479 ---- } ! if (isset($_REQUEST["option_yes"])) { $this->kill(); *************** *** 488,492 **** $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif (isset($_REQUEST["Message_no"])) { $message = $_SESSION["translate"]->it("No message was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); --- 488,492 ---- $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif (isset($_REQUEST["option_no"])) { $message = $_SESSION["translate"]->it("No message was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); *************** *** 502,507 **** $form->add("PHPWSBB_MESSAGE_OP", "hidden", "delete"); ! $form->add("Message_yes", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("Message_no", "submit", $_SESSION["translate"]->it("No")); $tags = array(); --- 502,507 ---- $form->add("PHPWSBB_MESSAGE_OP", "hidden", "delete"); ! $form->add("option_yes", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("option_no", "submit", $_SESSION["translate"]->it("No")); $tags = array(); *************** *** 509,513 **** $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this message?"); ! $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete_message.tpl"); $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); } --- 509,513 ---- $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this message?"); ! $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete.tpl"); $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); } Index: Forum.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Forum.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Forum.php 18 Mar 2004 04:02:15 -0000 1.15 --- Forum.php 29 Mar 2004 04:06:47 -0000 1.16 *************** *** 272,276 **** } ! if(isset($_REQUEST["Forum_yes"])) { $this->kill(); --- 272,276 ---- } ! if(isset($_REQUEST["option_yes"])) { $this->kill(); *************** *** 291,295 **** $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif(isset($_REQUEST["Forum_no"])) { $message = $_SESSION["translate"]->it("No forum was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); --- 291,295 ---- $_SESSION["PHPWSBB_Manager"]->action(); ! } elseif(isset($_REQUEST["option_no"])) { $message = $_SESSION["translate"]->it("No forum was deleted from the database."); $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); *************** *** 304,309 **** $form->add("PHPWSBB_FORUM_OP", "hidden", "delete"); ! $form->add("Forum_yes", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("Forum_no", "submit", $_SESSION["translate"]->it("No")); $tags = array(); --- 304,309 ---- $form->add("PHPWSBB_FORUM_OP", "hidden", "delete"); ! $form->add("option_yes", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("option_no", "submit", $_SESSION["translate"]->it("No")); $tags = array(); *************** *** 311,315 **** $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this forum and all its threads and messages?"); ! $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete_forum.tpl"); $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); } --- 311,315 ---- $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this forum and all its threads and messages?"); ! $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete.tpl"); $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); } Index: Manager.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Manager.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Manager.php 23 Mar 2004 03:57:46 -0000 1.31 --- Manager.php 29 Mar 2004 04:06:47 -0000 1.32 *************** *** 514,517 **** --- 514,519 ---- $tags["SUSPENDMONITORS_TEXT"] = $_SESSION["translate"]->it("Suspend monitors"); $tags["SUSPENDMONITORS_HELP"] = CLS_help::show_link("phpwsbb", "suspend_monitors"); + $tags["REMOVEALLMONITORS"] = "<a href=\"./index.php?module=phpwsbb&PHPWSBB_MAN_OP=removeallmonitors\">" . $_SESSION["translate"]->it("Remove all monitors") . "</a>"; + $tags["REMOVEALLMONITORS_HELP"] = CLS_help::show_link("phpwsbb", "remove_all_monitors"); $title = $_SESSION["translate"]->it("phpwsBB User Settings"); *************** *** 735,739 **** --- 737,782 ---- }// END FUNC _saveSettings + + function _removeAllMonitors() { + + if (isset($_REQUEST["option_yes"])) { + + // do the deed here + $data = array(); + $data["user_id"] = $_SESSION["OBJ_user"]->user_id; + $GLOBALS["core"]->sqlDelete("mod_phpwsbb_monitors", $data); + + $message = $_SESSION["translate"]->it("Your monitors have been cleared."); + $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); + $_REQUEST["PHPWSBB_MAN_OP"] = "list"; + $_SESSION["PHPWSBB_Manager"]->action(); + + } elseif (isset($_REQUEST["option_no"])) { + $message = $_SESSION["translate"]->it("No monitors were cleared."); + $_SESSION["PHPWSBB_Manager"]->notice = new PHPWS_Message($message, "CNT_phpwsbb"); + $_REQUEST["PHPWSBB_MAN_OP"] = "list"; + $_SESSION["PHPWSBB_Manager"]->action(); + + } else { + $title = $_SESSION["translate"]->it("Clear Monitor Confirmation"); + + $form = new EZform("PHPWSBB_Message_delete"); + $form->add("module", "hidden", "phpwsbb"); + $form->add("PHPWSBB_MAN_OP", "hidden", "removeallmonitors"); + + $form->add("option_yes", "submit", $_SESSION["translate"]->it("Yes")); + $form->add("option_no", "submit", $_SESSION["translate"]->it("No")); + + $tags = array(); + $tags = $form->getTemplate(); + $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to clear ALL of your monitors?"); + + $content = PHPWS_Template::processTemplate($tags, "phpwsbb", "delete.tpl"); + $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_phpwsbb"); + } + + }// END FUNC _removeAllMonitors + function offline() { if($this->_bboffline) *************** *** 831,834 **** --- 874,881 ---- break; + case "removeallmonitors": + $this->_removeAllMonitors(); + break; + case "banusername": $this->_banUsername(); |