summaryrefslogtreecommitdiff
path: root/edit_topic.php
diff options
context:
space:
mode:
authorwjames5 <will@tekimaki.com>2008-07-31 21:36:01 +0000
committerwjames5 <will@tekimaki.com>2008-07-31 21:36:01 +0000
commit87bc66a71b5c32d609c76f1829a26507cd4b62be (patch)
treefefe0dddb75418dc319cc1c6843ad4c1a8df27a0 /edit_topic.php
parent6ea065983e51705915ad00d1495d0ad891bc4b91 (diff)
downloadboards-87bc66a71b5c32d609c76f1829a26507cd4b62be.tar.gz
boards-87bc66a71b5c32d609c76f1829a26507cd4b62be.tar.bz2
boards-87bc66a71b5c32d609c76f1829a26507cd4b62be.zip
clean up all topic pref settings like sticky and notify - remove ajaxiness which just complicated things - for now we move this stuff to new edit_topic file to try to make things sane
Diffstat (limited to 'edit_topic.php')
-rw-r--r--edit_topic.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/edit_topic.php b/edit_topic.php
new file mode 100644
index 0000000..35cc856
--- /dev/null
+++ b/edit_topic.php
@@ -0,0 +1,50 @@
+<?php
+
+require_once( '../bit_setup_inc.php' );
+
+// Is package installed and enabled
+$gBitSystem->verifyPackage( 'boards' );
+
+// Look up Topic (lookup_inc is universal, gContent == BitBoardTopic)
+require_once( BOARDS_PKG_PATH.'lookup_inc.php' );
+
+// 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' );
+}
+
+// Check the user's ticket
+$gBitUser->verifyTicket();
+
+$rslt = false;
+// Edit calls
+if( isset($_REQUEST['is_locked']) || isset($_REQUEST['is_sticky']) ){
+ // Check permissions to edit this topic
+ $gContent->verifyEditPermission();
+
+ if ( isset($_REQUEST['is_locked']) && is_numeric($_REQUEST['is_locked']) ){
+ $rslt = $gContent->lock($_REQUEST['is_locked']);
+ } elseif ( isset($_REQUEST['is_sticky']) && is_numeric($_REQUEST['is_sticky']) ){
+ $rslt = $gContent->sticky($_REQUEST['is_sticky']);
+ }
+// User pref options on a topic - not really editing but this simplifies topic related processes putting it here
+}elseif( isset($_REQUEST['new']) || isset($_REQUEST['notify']) ){
+ // Check permissions to view this topic
+ $gContent->verifyViewPermission();
+
+ if( isset($_REQUEST['new']) && is_numeric($_REQUEST['new']) ){
+ $rslt = $gContent->readTopicSet($_REQUEST['new']);
+ }elseif( isset($_REQUEST['notify']) && is_numeric($_REQUEST['notify']) ){
+ $rslt = $gContent->notify($_REQUEST['notify']);
+ }
+}
+
+if($rslt){
+ // Return us to where we came from
+ header ("location: ".$_SERVER['HTTP_REFERER']);
+}else{
+ // @TODO put error into an alert
+ //trigger_error(var_export($gContent->mErrors,true ));
+}
+
+?>