From: Don S. <ri...@us...> - 2004-03-16 04:01:18
|
Update of /cvsroot/phpwsbb/phpwsbb/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19406/class Modified Files: Manager.php Runtime.php Log Message: RFE #906879: Added offline mode Index: Manager.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Manager.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Manager.php 8 Mar 2004 03:05:15 -0000 1.27 --- Manager.php 16 Mar 2004 03:52:03 -0000 1.28 *************** *** 107,110 **** --- 107,118 ---- var $_maxlatestthreads; + /** + * Flag to take phpwsbb offline + * + * @var int + * @access private + */ + var $_bboffline; + /** *************** *** 151,154 **** --- 159,163 ---- $this->_forumsblocktitle = $result[0]["forumsblocktitle"]; $this->_maxlatestthreads = $result[0]["maxlatestthreads"]; + $this->_bboffline = $result[0]["bboffline"]; }// END FUNC PHPWSBB_Manager *************** *** 520,523 **** --- 529,537 ---- $tabs++; + $form->add("SETTINGS_bboffline", "checkbox"); + $form->setMatch("SETTINGS_bboffline", $this->_bboffline); + $form->setTab("SETTINGS_bboffline", $tabs); + $tabs++; + $form->add("SETTINGS_save", "submit", $_SESSION["translate"]->it("Save")); $form->setTab("SETTINGS_save", $tabs); *************** *** 532,539 **** --- 546,555 ---- $tags["ADMIN_EMAIL_TEXT"] = $_SESSION["translate"]->it("Bulletin Board Admin Email"); $tags["MONITOR_POSTS_TEXT"] = $_SESSION["translate"]->it("Monitor Posts"); + $tags["BBOFFLINE_TEXT"] = $_SESSION["translate"]->it("Take Bulletin Board Offline"); $tags["EMAIL_TEXT_TEXT"] = $_SESSION["translate"]->it("Email Notification Text"); $tags["ADMIN_EMAIL_HELP"] = CLS_help::show_link("phpwsbb", "admin_email"); $tags["EMAIL_TEXT_HELP"] = CLS_help::show_link("phpwsbb", "email_text"); $tags["MONITOR_POSTS_HELP"] = CLS_help::show_link("phpwsbb", "monitor_posts"); + $tags["BBOFFLINE_HELP"] = CLS_help::show_link("phpwsbb", "bboffline"); $tags["SHOWFORUMSBLOCK_TEXT"] = $_SESSION["translate"]->it("Show Forums Block"); $tags["FORUMSBLOCKTITLE_TEXT"] = $_SESSION["translate"]->it("Forums Block Title"); *************** *** 572,575 **** --- 588,596 ---- $this->_monitor_posts = 0; + if(isset($_REQUEST["SETTINGS_bboffline"])) + $this->_bboffline = 1; + else + $this->_bboffline = 0; + if(isset($_REQUEST["SETTINGS_showforumsblock"])) $this->_showforumsblock = 1; *************** *** 594,597 **** --- 615,619 ---- $data["email_text"] = $this->_email_text; $data["monitor_posts"] = $this->_monitor_posts; + $data["bboffline"] = $this->_bboffline; $data["showforumsblock"] = $this->_showforumsblock; $data["showlatestthreadsblock"] = $this->_showlatestthreadsblock; *************** *** 613,616 **** --- 635,646 ---- }// END FUNC _saveSettings + + function offline() { + if($this->_bboffline) + return TRUE; + else + return FALSE; + }// END FUNC offline + function action() { Index: Runtime.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Runtime.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Runtime.php 2 Mar 2004 02:40:48 -0000 1.6 --- Runtime.php 16 Mar 2004 03:52:03 -0000 1.7 *************** *** 28,49 **** $blocktitle = $result[0]["forumsblocktitle"]; $allow_anon_view = $result[0]["allow_anon_view"]; ! if(!$showforumsblock) ! return; ! ! if(!$allow_anon_view && !$_SESSION["OBJ_user"]->username) return; ! ! $block = NULL; ! $result = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_forums", NULL, NULL, "sortorder"); ! if($result) { ! foreach($result as $row) { ! $forum = new PHPWSBB_Forum($row); ! $block .= "<a href=\"index.php?module=phpwsbb&PHPWSBB_MAN_OP=viewforum&PHPWS_MAN_ITEMS[]=" . $forum->getId() . "\">" . $forum->getLabel() . "</a><br />"; } } - - $GLOBALS["CNT_phpwsbb_forumsblock"]["title"] = $blocktitle; - $GLOBALS["CNT_phpwsbb_forumsblock"]["content"] = $block; }// END FUNC showForumsBlock --- 28,54 ---- $blocktitle = $result[0]["forumsblocktitle"]; $allow_anon_view = $result[0]["allow_anon_view"]; + $bboffline = $result[0]["bboffline"]; ! if ($bboffline && !$_SESSION["OBJ_user"]->isDeity()) { return; ! } else { ! if(!$showforumsblock) ! return; ! ! if(!$allow_anon_view && !$_SESSION["OBJ_user"]->username) ! return; ! ! $block = NULL; ! $result = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_forums", NULL, NULL, "sortorder"); ! if($result) { ! foreach($result as $row) { ! $forum = new PHPWSBB_Forum($row); ! $block .= "<a href=\"index.php?module=phpwsbb&PHPWSBB_MAN_OP=viewforum&PHPWS_MAN_ITEMS[]=" . $forum->getId() . "\">" . $forum->getLabel() . "</a><br />"; ! } } + + $GLOBALS["CNT_phpwsbb_forumsblock"]["title"] = $blocktitle; + $GLOBALS["CNT_phpwsbb_forumsblock"]["content"] = $block; } }// END FUNC showForumsBlock *************** *** 61,91 **** $maxlatestthreads = $result[0]["maxlatestthreads"]; $allow_anon_view = $result[0]["allow_anon_view"]; ! if(!$showlatestthreadsblock) ! return; ! ! if(!$allow_anon_view && !$_SESSION["OBJ_user"]->username) return; ! ! $c=0; ! $block = NULL; ! $result = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_threads", NULL, NULL, "lastpost DESC"); ! if($result) { ! foreach($result as $row) { ! if($c > $maxlatestthreads) ! break; ! $thread = new PHPWSBB_Forum($row); ! $block .= "<a href=\"index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $thread->getId() . "\">"; ! if(strlen($thread->getLabel()) > 15) ! $block .= substr($thread->getLabel(),0,15) . " ..."; ! else ! $block .= $thread->getLabel(); ! $block .= "</a><br />"; ! $c++; } } - - $GLOBALS["CNT_phpwsbb_latestthreadsblock"]["title"] = $latestthreadsblocktitle; - $GLOBALS["CNT_phpwsbb_latestthreadsblock"]["content"] = $block; }// END FUNC showLatestThreadsBlock --- 66,101 ---- $maxlatestthreads = $result[0]["maxlatestthreads"]; $allow_anon_view = $result[0]["allow_anon_view"]; + $bboffline = $result[0]["bboffline"]; ! if ($bboffline && !$_SESSION["OBJ_user"]->isDeity()) { return; ! } else { ! if(!$showlatestthreadsblock) ! return; ! ! if(!$allow_anon_view && !$_SESSION["OBJ_user"]->username) ! return; ! ! $c=0; ! $block = NULL; ! $result = $GLOBALS["core"]->sqlSelect("mod_phpwsbb_threads", NULL, NULL, "lastpost DESC"); ! if($result) { ! foreach($result as $row) { ! if($c > $maxlatestthreads) ! break; ! $thread = new PHPWSBB_Forum($row); ! $block .= "<a href=\"index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=" . $thread->getId() . "\">"; ! if(strlen($thread->getLabel()) > 15) ! $block .= substr($thread->getLabel(),0,15) . " ..."; ! else ! $block .= $thread->getLabel(); ! $block .= "</a><br />"; ! $c++; ! } } + + $GLOBALS["CNT_phpwsbb_latestthreadsblock"]["title"] = $latestthreadsblocktitle; + $GLOBALS["CNT_phpwsbb_latestthreadsblock"]["content"] = $block; } }// END FUNC showLatestThreadsBlock |