summaryrefslogtreecommitdiff
path: root/topic_move.php
diff options
context:
space:
mode:
authorwjames5 <will@tekimaki.com>2008-08-01 19:19:13 +0000
committerwjames5 <will@tekimaki.com>2008-08-01 19:19:13 +0000
commite5579142f25bdd4ac41b1a32304deb7746c34187 (patch)
tree8cf6c36e41077ee6bee408198226ced7b094f5e2 /topic_move.php
parent0f095875e2ef563cc07c04a0a5336ffc9548e292 (diff)
downloadboards-e5579142f25bdd4ac41b1a32304deb7746c34187.tar.gz
boards-e5579142f25bdd4ac41b1a32304deb7746c34187.tar.bz2
boards-e5579142f25bdd4ac41b1a32304deb7746c34187.zip
fix moving a topic - get rid of ajax too
Diffstat (limited to 'topic_move.php')
-rw-r--r--topic_move.php82
1 files changed, 45 insertions, 37 deletions
diff --git a/topic_move.php b/topic_move.php
index 20d4f7c..c98d602 100644
--- a/topic_move.php
+++ b/topic_move.php
@@ -9,54 +9,62 @@
*/
require_once( '../bit_setup_inc.php' );
-require_once( BOARDS_PKG_PATH.'BitBoard.php' );
-
// Is package installed and enabled
$gBitSystem->verifyPackage( 'boards' );
-// Now check permissions to access this page
-$gBitSystem->verifyPermission( 'p_boards_edit' );
-
+// Look up Topic (lookup_inc is universal, gContent == BitBoardTopic)
+require_once( BOARDS_PKG_PATH.'lookup_inc.php' );
-if( isset( $_REQUEST["confirm"] ) ) {
- require_once( BOARDS_PKG_PATH.'lookup_inc.php' );
- if( $gContent->moveTo($_REQUEST["target"]) ) {
- header ("location: ".$_REQUEST["ref"] );
- die;
- } else {
- $gBitSystem->fatalError( "There was an error moving the topic: ".vc( $gContent->mErrors ));
- }
+// Make sure topic exists since we only run through here for existing topics. New topics are created via comment system.
+if( !$gContent->isValid() ){
+ $gBitSystem->fatalError( 'No topic specified' );
}
+// Load up the Topic's board - we'll respect its permissions
+$board = new BitBoard( $gContent->mInfo['board_id'] );
+$board->load();
+$board->verifyAdminPermission();
+
if( isset( $_REQUEST["target"] ) ) {
- $_REQUEST["content_id"] = $_REQUEST["target"];
- require_once( BOARDS_PKG_PATH.'lookup_inc.php' );
- $bitThread = $gContent;
- unset($gContent);
- require_once( LIBERTY_PKG_PATH.'lookup_content_inc.php' );
- $bitBoard = $gContent;
+ // Check the user's ticket
+ $gBitUser->verifyTicket();
- $gBitSystem->setBrowserTitle( tra( 'Confirm moving' ).' "' .$bitThread->mInfo['title'] .'" '. tra("to Board"). ' "'.$bitBoard->mInfo['title'].'"');
- $formHash=array();
- if (empty($_REQUEST["ref"])) {
- $_REQUEST["ref"]=$_SERVER['HTTP_REFERER'];
- } elseif ($_REQUEST["ref"]=="-") {
- $_REQUEST["ref"]=$bitThread->getDisplayUrl();
+ $targetBoard = new BitBoard( null, $_REQUEST["target"] );
+ $targetBoard->load();
+ if( !$targetBoard->hasAdminPermission() ){
+ $gBitSystem->fatalError( 'You do not have permission to move topics to the Board' . $targetBoard->mInfo['title'] );
+ }
+
+ if( isset( $_REQUEST["confirm"] ) ) {
+ if( $gContent->moveTo($_REQUEST["target"]) ) {
+ header ("location: ".$_REQUEST["ref"] );
+ die;
+ } else {
+ $gBitSystem->fatalError( "There was an error moving the topic: ".vc( $gContent->mErrors ));
+ }
+ }else{
+ $gBitSystem->setBrowserTitle( tra( 'Confirm moving' ).' "' .$gContent->mInfo['title'] .'" '. tra("to Board"). ' "'.$targetBoard->mInfo['title'].'"');
+ $formHash=array();
+ if (empty($_REQUEST["ref"])) {
+ $_REQUEST["ref"]=$_SERVER['HTTP_REFERER'];
+ } elseif ($_REQUEST["ref"]=="-") {
+ $_REQUEST["ref"]=$gContent->getDisplayUrl();
+ }
+ $formHash["ref"]=$_REQUEST["ref"];
+ $formHash["target"]=$_REQUEST["target"];
+ $formHash["t"]=$_REQUEST["t"];
+ $msgHash = array(
+ 'label' => tra( "Move Thread" ).": ".$gContent->mInfo['title'] ,
+// 'confirm_item' => $gContent->mInfo['title'] ,
+ 'warning' => tra( "Move ".' "' .$gContent->mInfo['title'] .'" '. tra("to Board"). ' "'.$targetBoard->mInfo['title'].'"'."<br />This cannot be undone!" ),
+ );
+ $gBitSystem->confirmDialog( $formHash,$msgHash );
}
- $formHash["ref"]=$_REQUEST["ref"];
- $formHash["target"]=$_REQUEST["target"];
- $formHash["t"]=$_REQUEST["t"];
- $msgHash = array(
- 'label' => tra( "Move Thread" ).": ".$bitThread->mInfo['title'] ,
- 'confirm_item' => $bitThread->mInfo['title'] ,
- 'warning' => tra( "Move ".' "' .$bitThread->mInfo['title'] .'" '. tra("to Board"). ' "'.$bitBoard->mInfo['title'].'"'."<br />This cannot be undone!" ),
- );
- $gBitSystem->confirmDialog( $formHash,$msgHash );
}
-$board = new BitBoard();
-$gBitSmarty->assign_by_ref('boards', $board->getBoardSelectList());
-require_once( BOARDS_PKG_PATH .'lookup_inc.php' );
+// get list of boards we can move the topic to
+$boards = $board->getBoardSelectList();
+$gBitSmarty->assign_by_ref('boards', $boards);
$gBitSystem->display( 'bitpackage:boards/topic_move.tpl', tra('Category') , array( 'display_mode' => 'display' ));
?>