From: Eloi G. <ada...@us...> - 2004-09-17 16:00:10
|
Update of /cvsroot/phpwsbb/phpwsbb/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25842/class Modified Files: Forum.php Message.php Thread.php Log Message: Enabled forum-specific moderators. Not finished. Deities and SuperModerators ("edit_forums"==true) are activated, but I still need to code an interface for selecting regular moderators. Index: Thread.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Thread.php,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Thread.php 15 Sep 2004 20:22:17 -0000 1.57 --- Thread.php 17 Sep 2004 15:59:59 -0000 1.58 *************** *** 114,120 **** var $forumlabel = FALSE; function PHPWSBB_Thread($THREAD_ID = NULL) { /* These variable are excluded when calling commit() */ ! $exclude = array('messages', 'monitored', 'forumlabel'); $this->addExclude($exclude); --- 114,129 ---- var $forumlabel = FALSE; + + /** + * Forum Moderator flag + * + * @var bool + * @access private + */ + var $isModerator = FALSE; + function PHPWSBB_Thread($THREAD_ID = NULL) { /* These variable are excluded when calling commit() */ ! $exclude = array('messages', 'monitored', 'forumlabel', 'isModerator'); $this->addExclude($exclude); *************** *** 123,145 **** /* 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 ' . $GLOBALS['core']->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'; ! $this->messages = $GLOBALS['core']->getCol($sql); ! ! // 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; ! } } } --- 132,160 ---- /* Populate this object if ID exists */ ! if (isset($THREAD_ID) && is_numeric($THREAD_ID)) { ! $this->setId($THREAD_ID); ! $this->init(); ! ! if (isset($this->_fid)) { ! $f = new PHPWSBB_Forum($this->_fid); ! $this->forumlabel = $f->getLabel(); ! $this->isModerator = $f->isModerator; ! $f = NULL; ! } ! ! $sql = 'SELECT id FROM ' . $GLOBALS['core']->tbl_prefix . 'mod_phpwsbb_messages WHERE tid=' . $this->getId(); ! if (!$_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_threads') && $this->isModerator) ! $sql .= ' AND hidden=0'; ! $sql .= ' ORDER BY created'; ! $this->messages = $GLOBALS['core']->getCol($sql); ! ! // 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; } } *************** *** 147,162 **** $this->init($THREAD_ID); } - - if (isset($this->_fid)) { - $f = new PHPWSBB_Forum($this->_fid); - $this->forumlabel = $f->getLabel(); - $f = NULL; - } - }// END FUNC PHPWSBB_Thread 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; --- 162,170 ---- $this->init($THREAD_ID); } }// END FUNC PHPWSBB_Thread function _view($ro = FALSE) { ! if ($this->isHidden() && !$_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_threads') && $this->isModerator) { $content = '<div class="errortext">' . $_SESSION['translate']->it('There is nothing here to see.') . '</div>'; return $content; *************** *** 165,169 **** 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; --- 173,177 ---- 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') && $this->isModerator) $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; *************** *** 188,192 **** if (!$ro) { $tags['REPLY'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=reply&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/reply_message.png" border="0" alt="' . $_SESSION['translate']->it('Reply') . '" title="' . $_SESSION['translate']->it('Reply') . '" /> ' . $_SESSION['translate']->it('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="./images/phpwsbb/unlocked.png" border="0" alt="' . $_SESSION['translate']->it('Unlock Topic') . '" title="' . $_SESSION['translate']->it('Unlock Topic') . '" /> ' . $_SESSION['translate']->it('Unlock Topic') . '</a>'; --- 196,200 ---- if (!$ro) { $tags['REPLY'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=reply&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/reply_message.png" border="0" alt="' . $_SESSION['translate']->it('Reply') . '" title="' . $_SESSION['translate']->it('Reply') . '" /> ' . $_SESSION['translate']->it('Reply') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'lock_threads') && $this->isModerator) { if ($this->_locked) $tags['LOCK'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unlock&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/unlocked.png" border="0" alt="' . $_SESSION['translate']->it('Unlock Topic') . '" title="' . $_SESSION['translate']->it('Unlock Topic') . '" /> ' . $_SESSION['translate']->it('Unlock Topic') . '</a>'; *************** *** 195,199 **** } ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'move_threads')) { // Need drop-down of forums $forums = array(); --- 203,207 ---- } ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'move_threads') && $this->isModerator) { // Need drop-down of forums $forums = array(); *************** *** 218,225 **** } ! 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="./images/phpwsbb/delete.png" border="0" alt="' . $_SESSION['translate']->it('Delete Topic') . '" title="' . $_SESSION['translate']->it('Delete Topic') . '" /> ' . $_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="./images/phpwsbb/hideshow.png" border="0" alt="' . $_SESSION['translate']->it('Show Topic') . '" title="' . $_SESSION['translate']->it('Show Topic') . '" /> ' . $_SESSION['translate']->it('Show Topic') . '</a>'; --- 226,233 ---- } ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'delete_threads') && $this->isModerator) $tags['DELETE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=delete&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/delete.png" border="0" alt="' . $_SESSION['translate']->it('Delete Topic') . '" title="' . $_SESSION['translate']->it('Delete Topic') . '" /> ' . $_SESSION['translate']->it('Delete Topic') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_threads') && $this->isModerator) { if ($this->isHidden()) $tags['HIDE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showthread&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/hideshow.png" border="0" alt="' . $_SESSION['translate']->it('Show Topic') . '" title="' . $_SESSION['translate']->it('Show Topic') . '" /> ' . $_SESSION['translate']->it('Show Topic') . '</a>'; *************** *** 228,232 **** } ! 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="./images/phpwsbb/sticky.png" border="0" alt="' . $_SESSION['translate']->it('Unstick Topic') . '" title="' . $_SESSION['translate']->it('Unstick Topic') . '" /> ' . $_SESSION['translate']->it('Unstick Topic') . '</a>'; --- 236,240 ---- } ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'sticky_threads') && $this->isModerator) { if ($this->_sticky) $tags['STICKY'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unstick&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/sticky.png" border="0" alt="' . $_SESSION['translate']->it('Unstick Topic') . '" title="' . $_SESSION['translate']->it('Unstick Topic') . '" /> ' . $_SESSION['translate']->it('Unstick Topic') . '</a>'; *************** *** 246,250 **** // Need to cycle through all messages and view foreach($this->messages as $mid) { ! $message = new PHPWSBB_Message($mid); PHPWS_WizardBag::toggle($bg, ' class="bg_light"'); $content .= $message->_view($bg); --- 254,258 ---- // Need to cycle through all messages and view foreach($this->messages as $mid) { ! $message = new PHPWSBB_Message($mid, $this->isModerator); PHPWS_WizardBag::toggle($bg, ' class="bg_light"'); $content .= $message->_view($bg); *************** *** 349,353 **** 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); --- 357,361 ---- function _delete() { ! if (!$_SESSION['OBJ_user']->allow_access('phpwsbb', 'delete_threads') && $this->isModerator) { $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); *************** *** 401,405 **** 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); --- 409,413 ---- function _lock($unlock = FALSE) { ! if (!$_SESSION['OBJ_user']->allow_access('phpwsbb', 'lock_threads') && $this->isModerator) { $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); *************** *** 443,447 **** 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); --- 451,455 ---- function _stick($unstick = FALSE) { ! if (!$_SESSION['OBJ_user']->allow_access('phpwsbb', 'sticky_threads') && $this->isModerator) { $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); Index: Message.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Message.php,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** Message.php 14 Sep 2004 04:13:46 -0000 1.63 --- Message.php 17 Sep 2004 15:59:59 -0000 1.64 *************** *** 79,82 **** --- 79,90 ---- var $_body = NULL; + /** + * Forum Moderator flag + * + * @var bool + * @access private + */ + var $isModerator = FALSE; + /** *************** *** 85,92 **** * @param int $MESSAGE_ID optional */ ! function PHPWSBB_Message($MESSAGE_ID = NULL) { /* These variable are excluded when calling commit() */ ! //$exclude = array('children'); ! //$this->addExclude($exclude); /* Set database table */ --- 93,100 ---- * @param int $MESSAGE_ID optional */ ! function PHPWSBB_Message($MESSAGE_ID = NULL, $isModerator=FALSE) { /* These variable are excluded when calling commit() */ ! $exclude = array('isModerator'); ! $this->addExclude($exclude); /* Set database table */ *************** *** 98,101 **** --- 106,110 ---- $this->init(); } + $this->isModerator = $isModerator; }// END FUNC PHPWSBB_Message *************** *** 151,158 **** $contact = new CONTACTS_Contact($results[0]); $poster = '<a href="index.php?module=phpwscontacts&CONTACTS_MAN_OP=view&PHPWS_MAN_ITEMS[]=' . $contact->getId() . '">' . $contact->getListFirstName() . ' ' . $contact->getListLastName() . '</a>'; - /*eloi:RFE-CONTACTS: This generates an extra query for every message shown -- not - good if you have a popular site on a shared server. phpwscontacts should allow - contacts to be linked to by username or userid, not an unknown identifier that - has to be queried for beforehand. */ } } --- 160,163 ---- *************** *** 166,176 **** $tags['EDITED'] = $_SESSION['translate']->it('Edited by [var1] on [var2]', $this->getEditor(), $this->getUpdated()); ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') || ($this->getOwner() && ($_SESSION['OBJ_user']->username == $this->getOwner()))) $tags['EDIT'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=edit&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/edit.png" border="0" alt="' . $_SESSION['translate']->it('Edit') . '" title="' . $_SESSION['translate']->it('Edit') . '" /> ' . $_SESSION['translate']->it('Edit') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'delete_messages') || ($this->getOwner() && ($_SESSION['OBJ_user']->username == $this->getOwner()))) $tags['DELETE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=deletemessage&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/delete.png" border="0" alt="' . $_SESSION['translate']->it('Delete') . '" title="' . $_SESSION['translate']->it('Delete') . '" /> ' . $_SESSION['translate']->it('Delete') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_messages')) { if ($this->isHidden()) $tags['HIDE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showmessage&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/hideshow.png" border="0" alt="' . $_SESSION['translate']->it('Show Message') . '" title="' . $_SESSION['translate']->it("Show Message") . '" /> ' . $_SESSION['translate']->it('Show Message') . '</a>'; --- 171,181 ---- $tags['EDITED'] = $_SESSION['translate']->it('Edited by [var1] on [var2]', $this->getEditor(), $this->getUpdated()); ! if (($_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && $this->isModerator) || ($this->getOwner() && ($_SESSION['OBJ_user']->username == $this->getOwner()))) $tags['EDIT'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=edit&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/edit.png" border="0" alt="' . $_SESSION['translate']->it('Edit') . '" title="' . $_SESSION['translate']->it('Edit') . '" /> ' . $_SESSION['translate']->it('Edit') . '</a>'; ! if (($_SESSION['OBJ_user']->allow_access('phpwsbb', 'delete_messages') && $this->isModerator) || ($this->getOwner() && ($_SESSION['OBJ_user']->username == $this->getOwner()))) $tags['DELETE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=deletemessage&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/delete.png" border="0" alt="' . $_SESSION['translate']->it('Delete') . '" title="' . $_SESSION['translate']->it('Delete') . '" /> ' . $_SESSION['translate']->it('Delete') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_messages') && $this->isModerator) { if ($this->isHidden()) $tags['HIDE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showmessage&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/hideshow.png" border="0" alt="' . $_SESSION['translate']->it('Show Message') . '" title="' . $_SESSION['translate']->it("Show Message") . '" /> ' . $_SESSION['translate']->it('Show Message') . '</a>'; *************** *** 180,192 **** ! 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() . '"><img src="./images/phpwsbb/fork.png" border="0" alt="' . $_SESSION['translate']->it('Fork') . '" title="' . $_SESSION['translate']->it('Fork') . '" /> ' . $_SESSION['translate']->it('Fork') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'view_ips')) { $tags['IP_TEXT'] = $_SESSION['translate']->it('IP Address'); $tags['IPADDR'] = $this->getIp(); } ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'ban')) { $match = array('ip'=>$this->getIp(),'username'=>$this->getOwner()); $results = $GLOBALS['core']->sqlSelect('mod_phpwsbb_banned',$match,NULL,NULL,NULL,'or'); --- 185,200 ---- ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'fork_messages') && $this->isModerator) $tags['FORK'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=fork&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/fork.png" border="0" alt="' . $_SESSION['translate']->it('Fork') . '" title="' . $_SESSION['translate']->it('Fork') . '" /> ' . $_SESSION['translate']->it('Fork') . '</a>'; ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'view_ips') && $this->isModerator) { $tags['IP_TEXT'] = $_SESSION['translate']->it('IP Address'); $tags['IPADDR'] = $this->getIp(); } ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_users')) ! $tags['EDIT_USER'] = ' <a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=usersettings&user=' . $this->_owner_id . '">' . $_SESSION['translate']->it('Edit [var1]', $this->getOwner()) . '</a>'; ! ! if ($_SESSION['OBJ_user']->allow_access('phpwsbb', 'ban') && $this->isModerator) { $match = array('ip'=>$this->getIp(),'username'=>$this->getOwner()); $results = $GLOBALS['core']->sqlSelect('mod_phpwsbb_banned',$match,NULL,NULL,NULL,'or'); *************** *** 202,218 **** if ($ib) ! $tags['BAN_IP'] = ' <a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unbanip&PHPWS_MAN_ITEMS[]=' . $this->getIp() . '"><img src="./images/phpwsbb/ok.png" border="0" alt="' . $_SESSION['translate']->it('Unban IP') . '" title="' . $_SESSION['translate']->it('Unban IP') . '" /> ' . $_SESSION['translate']->it('Allow [var1] (Banned)', $this->getIp()) . '</a>'; else ! $tags['BAN_IP'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banip&PHPWS_MAN_ITEMS[]=' . $this->getIp() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban IP') . '" title="' . $_SESSION['translate']->it('Ban IP') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getIp()) . '</a>'; if ($this->getOwner()) if ($ub) ! $tags['BAN_USERNAME'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unbanusername&PHPWS_MAN_ITEMS[]=' . $this->getOwner() . '"><img src="./images/phpwsbb/ok.png" border="0" alt="' . $_SESSION['translate']->it('Unban Poster') . '" title="' . $_SESSION['translate']->it('Unban Poster') . '" /> ' . $_SESSION['translate']->it('Allow [var1] (Banned)', $this->getOwner()) . '</a>'; else ! $tags['BAN_USERNAME'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banusername&PHPWS_MAN_ITEMS[]=' . $this->getOwner() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban Poster') . '" title="' . $_SESSION['translate']->it('Ban Poster') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getOwner()) . '</a>'; } else { ! $tags['BAN_IP'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banip&PHPWS_MAN_ITEMS[]=' . $this->getIp() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban IP') . '" title="' . $_SESSION['translate']->it('Ban IP') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getIp()) . '</a>'; if ($this->getOwner()) ! $tags['BAN_USERNAME'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banusername&PHPWS_MAN_ITEMS[]=' . $this->getOwner() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban Poster') . '" title="' . $_SESSION['translate']->it('Ban Poster') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getOwner()) . '</a>'; } } --- 210,227 ---- if ($ib) ! $tags['BAN_IP'] = ' <a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unbanip&PHPWS_MAN_ITEMS[]=' . $this->getIp() . '"><img src="./images/phpwsbb/ok.png" border="0" alt="' . $_SESSION['translate']->it('Unban this IP') . '" title="' . $_SESSION['translate']->it('Unban this IP') . '" /> ' . $_SESSION['translate']->it('Unban this IP') . '</a>'; else ! $tags['BAN_IP'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banip&PHPWS_MAN_ITEMS[]=' . $this->getIp() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban this IP') . '" title="' . $_SESSION['translate']->it('Ban this IP') . '" /> ' . $_SESSION['translate']->it('Ban this IP') . '</a>'; if ($this->getOwner()) if ($ub) ! $tags['BAN_USERNAME'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=unbanusername&PHPWS_MAN_ITEMS[]=' . $this->getOwner() . '"><img src="./images/phpwsbb/ok.png" border="0" alt="' . $_SESSION['translate']->it('Unban this Poster') . '" title="' . $_SESSION['translate']->it('Unban this Poster') . '" /> ' . $_SESSION['translate']->it('Allow [var1] (Banned)', $this->getOwner()) . '</a>'; else ! $opt .= '<option value="banusername"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban this Poster') . '" title="' . $_SESSION['translate']->it('Ban this Poster') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getOwner()).'</option>'; ! $tags['BAN_USERNAME'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banusername&PHPWS_MAN_ITEMS[]=' . $this->getOwner() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban this Poster') . '" title="' . $_SESSION['translate']->it('Ban this Poster') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getOwner()) . '</a>'; } else { ! $tags['BAN_IP'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banip&PHPWS_MAN_ITEMS[]=' . $this->getIp() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban this IP') . '" title="' . $_SESSION['translate']->it('Ban this IP') . '" /> ' . $_SESSION['translate']->it('Ban this IP') . '</a>'; if ($this->getOwner()) ! $tags['BAN_USERNAME'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=banusername&PHPWS_MAN_ITEMS[]=' . $this->getOwner() . '"><img src="./images/phpwsbb/ban.png" border="0" alt="' . $_SESSION['translate']->it('Ban this Poster') . '" title="' . $_SESSION['translate']->it('Ban this Poster') . '" /> ' . $_SESSION['translate']->it('Ban [var1]', $this->getOwner()) . '</a>'; } } *************** *** 227,231 **** */ function _edit() { ! if (!empty($this->_id) && !$_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to edit message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Message::_edit()', $message, 'exit', 1); --- 236,240 ---- */ function _edit() { ! if (!empty($this->_id) && !($_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && $this->isModerator) && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to edit message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Message::_edit()', $message, 'exit', 1); *************** *** 295,303 **** // If this is a reply to a specific message, quote it if (isset($_REQUEST['reply_to']) && is_numeric($_REQUEST['reply_to'])) { ! $result = $GLOBALS['core']->quickFetch('SELECT owner,guestname,body FROM mod_phpwsbb_messages WHERE id='.$_REQUEST['reply_to'], true); ! $poster = $result['owner']; ! if (is_null($poster)) ! $poster = $result['guestname'] . ' (' . $_SESSION['translate']->it('GUEST') . ')'; ! $this->_body = '
[quote="'.$poster.'"]'.trim($result['body']).'
[/quote]

'; } $form->add('Message_body', 'textarea', $this->_body); --- 304,312 ---- // If this is a reply to a specific message, quote it if (isset($_REQUEST['reply_to']) && is_numeric($_REQUEST['reply_to'])) { ! $result = $GLOBALS['core']->quickFetch('SELECT owner,guestname,body FROM mod_phpwsbb_messages WHERE id='.$_REQUEST['reply_to'], true); ! $poster = $result['owner']; ! if (is_null($poster)) ! $poster = $result['guestname'] . ' (' . $_SESSION['translate']->it('GUEST') . ')'; ! $this->_body = '
[quote="'.$poster.'"]'.trim($result['body']).'
[/quote]

'; } $form->add('Message_body', 'textarea', $this->_body); *************** *** 350,354 **** */ function _save() { ! if (!empty($this->_id) && !$_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to save message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Manager::_accessDenied()', $message, 'exit', 1); --- 359,363 ---- */ function _save() { ! if (!empty($this->_id) && !($_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && $this->isModerator) && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to save message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Manager::_accessDenied()', $message, 'exit', 1); *************** *** 481,485 **** */ function _fork() { ! if (!empty($this->_id) && !$_SESSION['OBJ_user']->allow_access('phpwsbb', 'fork_messages')) { $message = $_SESSION['translate']->it('Access to fork message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Manager::_accessDenied()', $message, 'exit', 1); --- 490,494 ---- */ function _fork() { ! if (!empty($this->_id) && !($_SESSION['OBJ_user']->allow_access('phpwsbb', 'fork_messages') && $this->isModerator)) { $message = $_SESSION['translate']->it('Access to fork message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Manager::_accessDenied()', $message, 'exit', 1); *************** *** 527,531 **** */ function _delete() { ! if (!$_SESSION['OBJ_user']->allow_access('phpwsbb', 'delete_messages') && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to delete this message was denied due to lack of proper permissions.'); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Message::_delete()', $message, 'exit', 1); --- 536,540 ---- */ function _delete() { ! if (!($_SESSION['OBJ_user']->allow_access('phpwsbb', 'delete_messages') && $this->isModerator) && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to delete this message was denied due to lack of proper permissions.'); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Message::_delete()', $message, 'exit', 1); Index: Forum.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/class/Forum.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Forum.php 13 Sep 2004 21:41:55 -0000 1.28 --- Forum.php 17 Sep 2004 15:59:59 -0000 1.29 *************** *** 103,110 **** var $_lastpost_post_id; function PHPWSBB_Forum($FORUM_ID = NULL) { /* These variable are excluded when calling commit() */ ! //$exclude = array('threads'); ! //$this->addExclude($exclude); /* Set database table */ --- 103,126 ---- var $_lastpost_post_id; + /** + * IDs of this forum's moderators (separated by commas) + * + * @var string + * @access private + */ + var $_moderators; + + /** + * Forum Moderator flag + * + * @var bool + * @access public + */ + var $isModerator = FALSE; + function PHPWSBB_Forum($FORUM_ID = NULL) { /* These variable are excluded when calling commit() */ ! $exclude = array('isModerator'); ! $this->addExclude($exclude); /* Set database table */ *************** *** 120,123 **** --- 136,145 ---- $this->init($FORUM_ID); } + + // $tmp = $GLOBALS['core']->getCol('SELECT username FROM mod_users WHERE user_id IN ('.$this->_moderators.')', TRUE); + // $this->moderator_names = implode(',', $moderator_names); + /* To perform a moderation action, user must either be a moderator of this forum or be able to edit forums (supermoderator) */ + $this->isModerator = $_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_forums') + || ($_SESSION['OBJ_user']->user_id && !empty($this->_moderators) && in_array($_SESSION['OBJ_user']->user_id, explode(',', $this->_moderators))); }// END FUNC PHPWSBB_Forum *************** *** 164,168 **** $tags['DELETE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=deleteforum&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/delete.png" border="0" alt="' . $_SESSION['translate']->it('Delete Forum') . '" title="' . $_SESSION['translate']->it('Delete Forum') . '" /> ' . $_SESSION['translate']->it('Delete Forum') . '</a>'; ! if($_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_threads')) { if($this->isHidden()) $tags['HIDE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showforum&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/hideshow.png" border="0" alt="' . $_SESSION['translate']->it('Show Forum') . '" title="' . $_SESSION['translate']->it('Show Forum') . '" /> ' . $_SESSION['translate']->it('Show Forum') . '</a>'; --- 186,190 ---- $tags['DELETE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=deleteforum&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/delete.png" border="0" alt="' . $_SESSION['translate']->it('Delete Forum') . '" title="' . $_SESSION['translate']->it('Delete Forum') . '" /> ' . $_SESSION['translate']->it('Delete Forum') . '</a>'; ! if($_SESSION['OBJ_user']->allow_access('phpwsbb', 'hide_threads') && $this->isModerator) { if($this->isHidden()) $tags['HIDE'] = '<a href="./index.php?module=phpwsbb&PHPWSBB_MAN_OP=showforum&PHPWS_MAN_ITEMS[]=' . $this->getId() . '"><img src="./images/phpwsbb/hideshow.png" border="0" alt="' . $_SESSION['translate']->it('Show Forum') . '" title="' . $_SESSION['translate']->it('Show Forum') . '" /> ' . $_SESSION['translate']->it('Show Forum') . '</a>'; *************** *** 247,251 **** function _save() { ! if(!empty($this->_id) && !$_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to save message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Manager::_accessDenied()', $message, 'exit', 1); --- 269,273 ---- function _save() { ! if(!empty($this->_id) && !($_SESSION['OBJ_user']->allow_access('phpwsbb', 'edit_messages') && $this->isModerator) && ($_SESSION['OBJ_user']->username != $this->getOwner())) { $message = $_SESSION['translate']->it('Access to save message [var1] was denied due to lack of proper permissions.', $this->_id); $error = new PHPWS_Error('phpwsbb', 'PHPWSBB_Manager::_accessDenied()', $message, 'exit', 1); *************** *** 445,448 **** }// END FUNC getLastPost - }// END CLASS PHPWSBB_Forum --- 467,469 ---- |