Changeset 22


Ignore:
Timestamp:
Apr 11, 2007, 4:23:54 PM (12 years ago)
Author:
julian
Message:
  • topics.topicStatus => topics.topicIsClosed (also removed useless constants)
  • Creating pms works again
  • Continued refactoring (EditTopic?)
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/dbstructure.sql

    r15 r22  
    1 # SQLFront 3.2  (Build 14.11)
    2 
    3 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    4 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    5 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    6 /*!40101 SET NAMES latin1 */;
    7 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    8 /*!40103 SET TIME_ZONE='SYSTEM' */;
    9 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */;
    10 /*!40101 SET SQL_MODE='' */;
    11 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES */;
    12 /*!40103 SET SQL_NOTES='ON' */;
    13 
    14 
    15 # Host: localhost    Database: tbb2test
    16 # ------------------------------------------------------
    17 # Server version 4.1.14-nt
    18 
    19 DROP DATABASE IF EXISTS `tbb2test`;
    20 CREATE DATABASE `tbb2test` /*!40100 DEFAULT CHARACTER SET latin1 */;
     1/*!40100 SET CHARACTER SET latin1*/;
     2
     3
     4#
     5# Database structure for database 'tbb2test'
     6#
     7
     8CREATE DATABASE /*!32312 IF NOT EXISTS*/ `tbb2test`;
     9
    2110USE `tbb2test`;
    2211
    23 #
    24 # Table structure for table tbb2_avatars
    25 #
    26 
    27 CREATE TABLE `tbb2_avatars` (
     12
     13#
     14# Table structure for table 'tbb2_avatars'
     15#
     16
     17CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_avatars` (
    2818  `avatarID` smallint(5) unsigned NOT NULL auto_increment,
    2919  `avatarAddress` varchar(255) NOT NULL default '',
     
    3121) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    3222
    33 #
    34 # Table structure for table tbb2_cats
    35 #
    36 
    37 CREATE TABLE `tbb2_cats` (
     23
     24
     25#
     26# Table structure for table 'tbb2_cats'
     27#
     28
     29CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_cats` (
    3830  `catID` mediumint(5) unsigned NOT NULL auto_increment,
    3931  `catL` mediumint(5) NOT NULL default '0',
     
    4537) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    4638
    47 #
    48 # Table structure for table tbb2_config
    49 #
    50 
    51 CREATE TABLE `tbb2_config` (
     39
     40
     41#
     42# Table structure for table 'tbb2_config'
     43#
     44
     45CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_config` (
    5246  `ConfigName` varchar(255) NOT NULL default '',
    5347  `ConfigValue` varchar(255) NOT NULL default ''
    5448) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    5549
    56 #
    57 # Table structure for table tbb2_forums
    58 #
    59 
    60 CREATE TABLE `tbb2_forums` (
     50
     51
     52#
     53# Table structure for table 'tbb2_forums'
     54#
     55
     56CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_forums` (
    6157  `forumID` mediumint(8) unsigned NOT NULL auto_increment,
    6258  `catID` mediumint(8) unsigned NOT NULL default '0',
     
    8783) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    8884
    89 #
    90 # Table structure for table tbb2_forums_auth
    91 #
    92 
    93 CREATE TABLE `tbb2_forums_auth` (
     85
     86
     87#
     88# Table structure for table 'tbb2_forums_auth'
     89#
     90
     91CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_forums_auth` (
    9492  `forumID` mediumint(8) unsigned NOT NULL default '0',
    9593  `authType` tinyint(1) unsigned NOT NULL default '0',
     
    104102) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    105103
    106 #
    107 # Table structure for table tbb2_groups
    108 #
    109 
    110 CREATE TABLE `tbb2_groups` (
     104
     105
     106#
     107# Table structure for table 'tbb2_groups'
     108#
     109
     110CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_groups` (
    111111  `groupID` smallint(5) unsigned NOT NULL auto_increment,
    112112  `groupName` varchar(255) NOT NULL default '',
     
    114114) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    115115
    116 #
    117 # Table structure for table tbb2_groups_members
    118 #
    119 
    120 CREATE TABLE `tbb2_groups_members` (
     116
     117
     118#
     119# Table structure for table 'tbb2_groups_members'
     120#
     121
     122CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_groups_members` (
    121123  `GroupID` smallint(5) unsigned NOT NULL default '0',
    122124  `MemberID` mediumint(8) unsigned NOT NULL default '0',
     
    126128) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    127129
    128 #
    129 # Table structure for table tbb2_pms
    130 #
    131 
    132 CREATE TABLE `tbb2_pms` (
     130
     131
     132#
     133# Table structure for table 'tbb2_pms'
     134#
     135
     136CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_pms` (
    133137  `pmID` mediumint(8) unsigned NOT NULL auto_increment,
    134138  `folderID` smallint(5) unsigned NOT NULL default '0',
     
    153157) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    154158
    155 #
    156 # Table structure for table tbb2_pms_folders
    157 #
    158 
    159 CREATE TABLE `tbb2_pms_folders` (
     159
     160
     161#
     162# Table structure for table 'tbb2_pms_folders'
     163#
     164
     165CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_pms_folders` (
    160166  `folderID` smallint(5) unsigned NOT NULL default '0',
    161167  `userID` mediumint(8) unsigned NOT NULL default '0',
     
    165171) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    166172
    167 #
    168 # Table structure for table tbb2_polls
    169 #
    170 
    171 CREATE TABLE `tbb2_polls` (
     173
     174
     175#
     176# Table structure for table 'tbb2_polls'
     177#
     178
     179CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_polls` (
    172180  `poll_id` mediumint(8) unsigned NOT NULL auto_increment,
    173181  `topic_id` mediumint(8) unsigned NOT NULL default '0',
     
    183191) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    184192
    185 #
    186 # Table structure for table tbb2_polls_options
    187 #
    188 
    189 CREATE TABLE `tbb2_polls_options` (
     193
     194
     195#
     196# Table structure for table 'tbb2_polls_options'
     197#
     198
     199CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_polls_options` (
    190200  `poll_id` mediumint(8) unsigned NOT NULL default '0',
    191201  `option_id` smallint(5) unsigned NOT NULL default '0',
     
    196206) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    197207
    198 #
    199 # Table structure for table tbb2_polls_votes
    200 #
    201 
    202 CREATE TABLE `tbb2_polls_votes` (
     208
     209
     210#
     211# Table structure for table 'tbb2_polls_votes'
     212#
     213
     214CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_polls_votes` (
    203215  `poll_id` mediumint(8) unsigned NOT NULL default '0',
    204216  `voter_id` mediumint(8) unsigned NOT NULL default '0',
     
    207219) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    208220
    209 #
    210 # Table structure for table tbb2_posts
    211 #
    212 
    213 CREATE TABLE `tbb2_posts` (
     221
     222
     223#
     224# Table structure for table 'tbb2_posts'
     225#
     226
     227CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_posts` (
    214228  `postID` mediumint(8) unsigned NOT NULL auto_increment,
    215229  `topicID` mediumint(8) unsigned NOT NULL default '0',
     
    236250) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    237251
    238 #
    239 # Table structure for table tbb2_profile_fields
    240 #
    241 
    242 CREATE TABLE `tbb2_profile_fields` (
     252
     253
     254#
     255# Table structure for table 'tbb2_profile_fields'
     256#
     257
     258CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_profile_fields` (
    243259  `fieldID` smallint(5) unsigned NOT NULL auto_increment,
    244260  `fieldName` varchar(255) NOT NULL default '',
     
    253269) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    254270
    255 #
    256 # Table structure for table tbb2_profile_fields_data
    257 #
    258 
    259 CREATE TABLE `tbb2_profile_fields_data` (
    260   `FieldID` smallint(5) unsigned NOT NULL default '0',
    261   `UserID` mediumint(8) unsigned NOT NULL default '0',
    262   `FieldValue` text NOT NULL,
    263   KEY `field_id` (`FieldID`),
    264   KEY `user_id_field_id` (`UserID`,`FieldID`)
    265 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    266 
    267 #
    268 # Table structure for table tbb2_profile_notes
    269 #
    270 
    271 CREATE TABLE `tbb2_profile_notes` (
     271
     272
     273#
     274# Table structure for table 'tbb2_profile_fields_data'
     275#
     276
     277CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_profile_fields_data` (
     278  `fieldID` smallint(5) unsigned NOT NULL default '0',
     279  `userID` mediumint(8) unsigned NOT NULL default '0',
     280  `fieldValue` text NOT NULL,
     281  KEY `field_id` (`fieldID`),
     282  KEY `user_id_field_id` (`userID`,`fieldID`)
     283) ENGINE=MyISAM DEFAULT CHARSET=latin1;
     284
     285
     286
     287#
     288# Table structure for table 'tbb2_profile_notes'
     289#
     290
     291CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_profile_notes` (
    272292  `noteID` mediumint(8) unsigned NOT NULL auto_increment,
    273293  `userID` mediumint(8) unsigned NOT NULL default '0',
     
    280300) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    281301
    282 #
    283 # Table structure for table tbb2_ranks
    284 #
    285 
    286 CREATE TABLE `tbb2_ranks` (
     302
     303
     304#
     305# Table structure for table 'tbb2_ranks'
     306#
     307
     308CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_ranks` (
    287309  `rankID` smallint(5) unsigned NOT NULL auto_increment,
    288310  `rankType` tinyint(1) unsigned NOT NULL default '0',
     
    294316) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    295317
    296 #
    297 # Table structure for table tbb2_search_results
    298 #
    299 
    300 CREATE TABLE `tbb2_search_results` (
     318
     319
     320#
     321# Table structure for table 'tbb2_search_results'
     322#
     323
     324CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_search_results` (
    301325  `search_id` varchar(32) NOT NULL default '',
    302326  `session_id` varchar(32) NOT NULL default '',
     
    306330) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    307331
    308 #
    309 # Table structure for table tbb2_sessions
    310 #
    311 
    312 CREATE TABLE `tbb2_sessions` (
     332
     333
     334#
     335# Table structure for table 'tbb2_sessions'
     336#
     337
     338CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_sessions` (
    313339  `sessionID` varchar(32) NOT NULL default '',
    314340  `sessionLastUpdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
     
    321347) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    322348
    323 #
    324 # Table structure for table tbb2_smilies
    325 #
    326 
    327 CREATE TABLE `tbb2_smilies` (
     349
     350
     351#
     352# Table structure for table 'tbb2_smilies'
     353#
     354
     355CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_smilies` (
    328356  `SmileyID` smallint(5) unsigned NOT NULL auto_increment,
    329357  `SmileyType` tinyint(1) unsigned NOT NULL default '0',
     
    334362) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    335363
    336 #
    337 # Table structure for table tbb2_topics
    338 #
    339 
    340 CREATE TABLE `tbb2_topics` (
     364
     365
     366#
     367# Table structure for table 'tbb2_topics'
     368#
     369
     370CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_topics` (
    341371  `topicID` mediumint(8) unsigned NOT NULL auto_increment,
    342372  `forumID` mediumint(8) unsigned NOT NULL default '0',
    343373  `posterID` mediumint(8) unsigned NOT NULL default '0',
    344   `topicStatus` tinyint(1) unsigned NOT NULL default '0',
     374  `topicIsClosed` tinyint(1) unsigned NOT NULL default '0',
    345375  `topicIsPinned` tinyint(1) unsigned NOT NULL default '0',
    346376  `smileyID` smallint(5) unsigned NOT NULL default '0',
     
    351381  `topicLastPostID` mediumint(8) unsigned NOT NULL default '0',
    352382  `topicMovedID` mediumint(8) unsigned NOT NULL default '0',
    353   `topicPostTime` int(10) unsigned NOT NULL default '0',
     383  `topicMovedTimestamp` int(10) unsigned NOT NULL default '0',
     384  `topicPostTimestamp` int(10) unsigned NOT NULL default '0',
    354385  `topicTitle` varchar(255) NOT NULL default '',
    355386  `topicGuestNick` varchar(255) NOT NULL default '',
     
    360391) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    361392
    362 #
    363 # Table structure for table tbb2_topics_subscriptions
    364 #
    365 
    366 CREATE TABLE `tbb2_topics_subscriptions` (
    367   `TopicID` mediumint(8) unsigned NOT NULL default '0',
    368   `UserID` mediumint(8) unsigned NOT NULL default '0',
    369   KEY `topic_id` (`TopicID`),
    370   KEY `user_id_topic_id` (`UserID`,`TopicID`)
    371 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    372 
    373 #
    374 # Table structure for table tbb2_users
    375 #
    376 
    377 CREATE TABLE `tbb2_users` (
     393
     394
     395#
     396# Table structure for table 'tbb2_topics_subscriptions'
     397#
     398
     399CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_topics_subscriptions` (
     400  `topicID` mediumint(8) unsigned NOT NULL default '0',
     401  `userID` mediumint(8) unsigned NOT NULL default '0',
     402  KEY `topic_id` (`topicID`),
     403  KEY `user_id_topic_id` (`userID`,`topicID`)
     404) ENGINE=MyISAM DEFAULT CHARSET=latin1;
     405
     406
     407
     408#
     409# Table structure for table 'tbb2_users'
     410#
     411
     412CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_users` (
    378413  `userID` mediumint(8) unsigned NOT NULL auto_increment,
    379414  `userIsActivated` tinyint(1) unsigned NOT NULL default '0',
     
    406441) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    407442
    408 #
    409 # Table structure for table tbb2_users_locks
    410 #
    411 
    412 CREATE TABLE `tbb2_users_locks` (
     443
     444
     445#
     446# Table structure for table 'tbb2_users_locks'
     447#
     448
     449CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_users_locks` (
    413450  `user_id` mediumint(8) unsigned NOT NULL default '0',
    414451  `lock_type` tinyint(1) unsigned NOT NULL default '0',
     
    419456) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    420457
    421 #
    422 # Table structure for table tbb2_wio
    423 #
    424 
    425 CREATE TABLE `tbb2_wio` (
     458
     459
     460#
     461# Table structure for table 'tbb2_wio'
     462#
     463
     464CREATE TABLE /*!32312 IF NOT EXISTS*/ `tbb2_wio` (
    426465  `wio_session_id` varchar(32) NOT NULL default '',
    427466  `wio_user_id` mediumint(8) unsigned NOT NULL default '0',
     
    431470) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    432471
    433 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
    434 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    435 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
    436 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    437 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    438 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  • trunk/modules/Constants.class.php

    r19 r22  
    1212        define('AUTH_TYPE_USER',0);
    1313        define('AUTH_TYPE_GROUP',1);
    14 
    15         define('TOPIC_STATUS_OPEN',0);
    16         define('TOPIC_STATUS_CLOSED',1);
    1714
    1815        define('PROFILE_FIELD_TYPE_TEXT',0);
  • trunk/modules/EditTopic.class.php

    r21 r22  
    1717        if($this->modules['Auth']->isLoggedIn() != 1) die('Access denied: not logged in');
    1818        elseif(!$topicData = Functions::getTopicData($topicID)) die('Cannot load data: topic');
     19        elseif($topicData['topicMovedID'] != 0) die('Cannot edit topic: moved topic');
    1920        elseif(!$forumData = Functions::getForumData($topicData['forumID'])) die('Cannot load data: forum');
    2021
     
    7576        }
    7677        else {
    77             if($USER_DATA['user_is_admin'] != 1 && $auth_data['auth_is_mod'] != 1 && $USER_DATA['user_is_supermod'] != 1) die('Kein Zugriff!');
     78            if($this->modules['Auth']->getValue('userIsAdmin') != 1 && $authData['authIsMod'] != 1 && $this->modules['Auth']->getValue('userIsSupermod') != 1) die('Access denied: insufficient rights');
    7879            switch(@$_GET['mode']) {
    7980                case 'Pinn':
     
    9192
    9293                case 'OpenClose':
    93                     $new_topic_status = ($topicData['topic_status'] == 1) ? 0 : 1;
    94 
    95                     $DB->query("UPDATE ".TBLPFX."topics SET topic_status='$new_topic_status' WHERE topicID='$topicID'");
    96 
    97                     header("Location: index.php?action=viewtopic&topicID=$topicID&$MYSID"); exit;
     94                    $topicIsClosed = ($topicData['topicIsClosed'] == 1) ? 0 : 1;
     95
     96                    $this->modules['DB']->query("
     97                        UPDATE
     98                            ".TBLPFX."topics
     99                        SET
     100                            topicIsClosed='$topicIsClosed'
     101                        WHERE
     102                            topicID='$topicID'
     103                    ");
     104
     105                    Functions::myHeader(INDEXFILE."?action=ViewTopic&topicID=$topicID&".MYSID);
    98106                break;
    99107
    100108                case 'Delete':
    101109                    $topic_posts_ids = array();
    102                     $DB->query("SELECT post_id FROM ".TBLPFX."posts WHERE topicID='$topicID'");
    103                     while(list($akt_post_id) = $DB->fetch_array())
     110                    $this->modules['DB']->query("SELECT post_id FROM ".TBLPFX."posts WHERE topicID='$topicID'");
     111                    while(list($akt_post_id) = $this->modules['DB']->fetch_array())
    104112                        $topic_posts_ids[] = $akt_post_id;
    105113
    106114                    $topic_posts_counter = count($topic_posts_ids);
    107115
    108                     $DB->query("SELECT COUNT(*) AS poster_posts_counter, poster_id FROM ".TBLPFX."posts WHERE topicID='$topicID' GROUP BY poster_id");
    109                     $DB_data = $DB->raw2array();
     116                    $this->modules['DB']->query("SELECT COUNT(*) AS poster_posts_counter, poster_id FROM ".TBLPFX."posts WHERE topicID='$topicID' GROUP BY poster_id");
     117                    $DB_data = $this->modules['DB']->raw2array();
    110118                    while(list(,$akt_data) = each($DB_data)) {
    111                         $DB->query("UPDATE ".TBLPFX."users SET user_posts=user_posts-".$akt_data['poster_posts_counter']." WHERE user_id='".$akt_data['poster_id']."'");
    112                     }
    113 
    114                     $DB->query("UPDATE ".TBLPFX."forums SET forum_posts_counter=forum_posts_counter-$topic_posts_counter, forum_topics_counter=forum_topics_counter-1 WHERE forumID='$forumID'");
    115                     $DB->query("DELETE FROM ".TBLPFX."topics WHERE topicID='$topicID'");
    116                     $DB->query("DELETE FROM ".TBLPFX."posts WHERE post_id IN ('".implode("','",$topic_posts_ids)."')");
    117                     $DB->query("DELETE FROM ".TBLPFX."topics_subscriptions WHERE topicID='$topicID'");
     119                        $this->modules['DB']->query("UPDATE ".TBLPFX."users SET user_posts=user_posts-".$akt_data['poster_posts_counter']." WHERE user_id='".$akt_data['poster_id']."'");
     120                    }
     121
     122                    $this->modules['DB']->query("UPDATE ".TBLPFX."forums SET forum_posts_counter=forum_posts_counter-$topic_posts_counter, forum_topics_counter=forum_topics_counter-1 WHERE forumID='$forumID'");
     123                    $this->modules['DB']->query("DELETE FROM ".TBLPFX."topics WHERE topicID='$topicID'");
     124                    $this->modules['DB']->query("DELETE FROM ".TBLPFX."posts WHERE post_id IN ('".implode("','",$topic_posts_ids)."')");
     125                    $this->modules['DB']->query("DELETE FROM ".TBLPFX."topics_subscriptions WHERE topicID='$topicID'");
    118126
    119127                    if($topicData['topic_poll'] == 1) {
    120                         $DB->query("SELECT poll_id FROM ".TBLPFX."polls WHERE topicID='$topicID'");
    121                         if($DB->affected_rows == 1) {
    122                             list($topic_poll_id) = $DB->fetch_array();
    123 
    124                             $DB->query("DELETE FROM ".TBLPFX."polls WHERE poll_id='$topic_poll_id'");
    125                             $DB->query("DELETE FROM ".TBLPFX."polls_options WHERE poll_id='$topic_poll_id'");
    126                             $DB->query("DELETE FROM ".TBLPFX."polls_votes WHERE poll_id='$topic_poll_id'");
     128                        $this->modules['DB']->query("SELECT poll_id FROM ".TBLPFX."polls WHERE topicID='$topicID'");
     129                        if($this->modules['DB']->affected_rows == 1) {
     130                            list($topic_poll_id) = $this->modules['DB']->fetch_array();
     131
     132                            $this->modules['DB']->query("DELETE FROM ".TBLPFX."polls WHERE poll_id='$topic_poll_id'");
     133                            $this->modules['DB']->query("DELETE FROM ".TBLPFX."polls_options WHERE poll_id='$topic_poll_id'");
     134                            $this->modules['DB']->query("DELETE FROM ".TBLPFX."polls_votes WHERE poll_id='$topic_poll_id'");
    127135                        }
    128136                    }
     
    136144
    137145                case 'Move':
    138                     if($forumID == 0) die('Ankuendigungen verschieben? Wie soll das denn gehen...');
    139                     $p_target_forumID = isset($_POST['p_target_forumID']) ? $_POST['p_target_forumID'] : 0;
    140                     $p_create_reference = 1;
    141 
    142                     add_navbar_items(array($LNG['Move_topic'],''));
     146                    $p = Functions::getSGValues($_POST['p'],array('targetForumID'),0);
     147                    $c = Functions::getSGValues($_POST['c'],array('createReference'),1);
    143148
    144149                    $error = '';
    145150
    146151                    if(isset($_GET['doit'])) {
    147                         $p_create_reference = isset($_POST['p_create_reference']) ? 1 : 0;
    148 
    149                         if(!$target_forumData = get_forumData($p_target_forumID)) $error = $LNG['error_invalid_forum'];
     152                        if(!$targetForumData = getForumData($p['targetForumID'])) $error = $this->modules['Language']->getString('error_invalid_forum');
    150153                        else {
    151                             $DB->query("UPDATE ".TBLPFX."topics SET forumID='$p_target_forumID' WHERE topicID='$topicID'");
    152                             $DB->query("UPDATE ".TBLPFX."posts SET forumID='$p_target_forumID' WHERE topicID='$topicID'");
    153 
    154                             if($topicData['topic_poll'] != 0)
    155                                 $DB->query("UPDATE ".TBLPFX."polls SET forumID='$p_target_forumID' WHERE topicID='$topicID'");
    156 
    157                             $DB->query("SELECT COUNT(*) AS topic_posts_counter FROM ".TBLPFX."posts WHERE topicID='$topicID'");
    158                             list($topic_posts_counter) = $DB->fetch_array();
    159 
    160                             $DB->query("UPDATE ".TBLPFX."forums SET forum_topics_counter=forum_topics_counter-1, forum_posts_counter=forum_posts_counter-$topic_posts_counter WHERE forumID='$forumID'");
    161                             $DB->query("UPDATE ".TBLPFX."forums SET forum_topics_counter=forum_topics_counter+1, forum_posts_counter=forum_posts_counter+$topic_posts_counter WHERE forumID='$p_target_forumID'");
    162 
    163                             if($p_create_reference == 1)
    164                                 $DB->query("INSERT INTO ".TBLPFX."topics (forumID,poster_id,topic_status,topic_pic,topic_poll,topic_first_post_id,topic_last_post_id,topic_moved_id,topic_post_time,topic_title,topic_guest_nick) VALUES ('$forumID','".$topicData['poster_id']."','".$topicData['topic_status']."','".$topicData['topic_pic']."','".$topicData['topic_poll']."','".$topicData['topic_first_post_id']."','".$topicData['topic_first_post_id']."','$topicID','".$topicData['topic_post_time']."','".$topicData['topic_title']."','".$topicData['topic_guest_nick']."')");
    165 
    166                             update_forum_last_post($forumID);
    167                             update_forum_last_post($p_target_forumID);
     154                            $this->modules['DB']->query("UPDATE ".TBLPFX."topics SET forumID='".$p['targetForumID']."' WHERE topicID='$topicID'");
     155                            $this->modules['DB']->query("UPDATE ".TBLPFX."posts SET forumID='".$p['targetForumID']."' WHERE topicID='$topicID'");
     156
     157                            if($topicData['topicHasPoll'] == 1)
     158                                $this->modules['DB']->query("UPDATE ".TBLPFX."polls SET forumID='".$p['targetForumID']."' WHERE topicID='$topicID'");
     159
     160                            $this->modules['DB']->query("SELECT COUNT(*) AS topicPostsCounter FROM ".TBLPFX."posts WHERE topicID='$topicID'");
     161                            list($topicPostsCounter) = $this->modules['DB']->fetchArray();
     162
     163                            $this->modules['DB']->query("UPDATE ".TBLPFX."forums SET forumTopicsCounter=forumTopicsCounter-1, forumPostsCounter=forumPostsCounter-$topicPostsCounter WHERE forumID='$forumID'");
     164                            $this->modules['DB']->query("UPDATE ".TBLPFX."forums SET forumTopicsCounter=forumTopicsCounter+1, forumPostsCounter=forumPostsCounter+$topicPostsCounter WHERE forumID='".$p['targetForumID']."'");
     165
     166                            if($c['createReference'] == 1) {
     167                                $slashedTopicData = Functions::addSlashes($topicData);
     168                                $this->modules['DB']->query("
     169                                    INSERT INTO
     170                                        ".TBLPFX."topics
     171                                    SET
     172                                        forumID='$forumID',
     173                                        posterID='".$slashedTopicData['posterID']."',
     174                                        topicIsClosed='".$slashedTopicData['topicIsClosed']."',
     175                                        topicIsPinned='".$slashedTopicData['topicIsPinned']."',
     176                                        smileyID='".$slashedTopicData['smileyID']."',
     177                                        topicRepliesCounter='".$slashedTopicData['topicRepliesCounter']."',
     178                                        topicViewsCounter='".$slashedTopicData['topicViewsCounter']."',
     179                                        topicHasPoll='".$slashedTopicData['topicHasPoll']."',
     180                                        topicFirstPostID='".$slashedTopicData['topicFirstPostID']."',
     181                                        topicLastPostID='".$slashedTopicData['topicLastPostID']."',
     182                                        topicMovedID='".$slashedTopicData['topicMovedID']."',
     183                                        topicMovedTimestamp='".$slashedTopicData['topicMovedTimestamp']."',
     184                                        topicPostTimestamp='".$slashedTopicData['topicPostTimestamp']."',
     185                                        topicTitle='".$slashedTopicData['topicTitle']."',
     186                                        topicGuestNick='".$slashedTopicData['topicGuestNick']."'
     187                                ");
     188                            }
     189
     190
     191                            // TODO: Letzten Beitrag updaten
     192                            //update_forum_last_post($forumID);
     193                            //update_forum_last_post($p_target_forumID);
    168194
    169195                            include_once('pheader.php');
    170                                                 show_message($LNG['Topic_moved'],$LNG['message_topic_moved'].'<br />'.sprintf($LNG['click_here_moved_topic'],"<a href=\"index.php?action=viewtopic&amp;topicID=$topicID&amp;$MYSID\">",'</a>'));
     196                            show_message($LNG['Topic_moved'],$LNG['message_topic_moved'].'<br />'.sprintf($LNG['click_here_moved_topic'],"<a href=\"index.php?action=viewtopic&amp;topicID=$topicID&amp;$MYSID\">",'</a>'));
    171197                            include_once('ptail.php'); exit;
    172198                        }
     
    174200
    175201
    176                     $c = ' checked="checked"';
    177                     $checked['reference'] = ($p_create_reference == 1) ? $c : '';
    178 
    179 
    180                     //
    181                     // Template laden
    182                     //
    183                     $edittopic_tpl = new Template($TEMPLATE_PATH.'/'.$TCONFIG['templates']['edittopic_move']);
    184 
    185 
    186202                    //
    187203                    // Kategorie- und Forendaten laden
    188204                    //
    189205                    $cats_data = cats_get_cats_data();
    190                     $DB->query("SELECT forumID,forum_name,cat_id FROM ".TBLPFX."forums WHERE forumID<>'$forumID'");
    191                     $forums_data = $DB->raw2array();
     206                    $this->modules['DB']->query("SELECT forumID,forum_name,cat_id FROM ".TBLPFX."forums WHERE forumID<>'$forumID'");
     207                    $forums_data = $this->modules['DB']->raw2array();
    192208
    193209
  • trunk/modules/Posting.class.php

    r21 r22  
    3838
    3939        $authData = $this->_authenticateUser($mode,$forumData);
     40        if($mode == 'Reply' && $topicData['topicIsClosed'] == 1 && $authData['authIsMod'] != 1 && $this->modules['Auth']->getValue('userIsSuperadmin') && $this->modules['Auth']->getValue('userIsSupermod')) {
     41            // TODO: Richtige Meldung
     42            die('Kein Zugriff/Thema geschlossen');
     43        }
    4044
    4145        $error = '';
     
    6367
    6468        $c['pinTopic'] = ($mode == 'Reply') ? $topicData['topicIsPinned'] : 0;
    65         $c['closeTopic'] = ($mode == 'Reply') ? $topicData['topicStatus'] : 0;
     69        $c['closeTopic'] = ($mode == 'Reply') ? $topicData['topicIsClosed'] : 0;
    6670        $c['subscribeTopic'] = $subscriptionStatus;
    6771
     
    131135                                topicTitle='".$p['messageTitle']."',
    132136                                forumID='$forumID',
    133                                 topicStatus='".$c['closeTopic']."',
     137                                topicIsClosed='".$c['closeTopic']."',
    134138                                topicIsPinned='".$c['pinTopic']."',
    135139                                posterID='".USERID."',
     
    202206                    // Verschiedene Dinge updaten (Beitragszahl, erster/letzter Beitrag usw.)
    203207                    if($mode == 'Topic') $this->modules['DB']->query("UPDATE ".TBLPFX."topics SET topicFirstPostID='$postID', topicLastPostID='$postID' WHERE topicID='$topicID'");
    204                     else $this->modules['DB']->query("UPDATE ".TBLPFX."topics SET topicLastPostID='$postID', topicRepliesCounter=topicRepliesCounter+1, topicStatus='".$c['closeTopic']."', topicIsPinned='".$c['pinTopic']."' WHERE topicID='$topicID'");
     208                    else $this->modules['DB']->query("UPDATE ".TBLPFX."topics SET topicLastPostID='$postID', topicRepliesCounter=topicRepliesCounter+1, topicIsClosed='".$c['closeTopic']."', topicIsPinned='".$c['pinTopic']."' WHERE topicID='$topicID'");
    205209
    206210                    $this->modules['DB']->query("UPDATE ".TBLPFX."forums SET forumLastPostID='$postID', forumPostsCounter=forumPostsCounter+1, forumTopicsCounter=forumTopicsCounter+1 WHERE forumID='$forumID'");
  • trunk/modules/PrivateMessages.class.php

    r19 r22  
    197197                    $smiliesBox = Functions::getSmiliesBox();
    198198                }
    199                 $topicPicsBox = Functions :: getTopicPicsBox();
     199                $postPicsBox = Functions :: getPostPicsBox();
    200200
    201201                $this->modules['Template']->assign(array(
     
    203203                    'error'=>$error,
    204204                    'smiliesBox'=>$smiliesBox,
    205                     'topicPicsBox'=>$topicPicsBox,
     205                    'postPicsBox'=>$postPicsBox,
    206206                    'p'=>$p,
    207207                    'c'=>$c
     
    380380                        $smiliesBox = Functions::getSmiliesBox();
    381381                    }
    382                     $topicPicsBox = Functions :: getTopicPicsBox();
     382                    $postPicsBox = Functions::getPostPicsBox();
    383383
    384384                    $this->modules['Template']->assign(array(
     
    387387                        'smiliesBox'=>$smiliesBox,
    388388                        'p'=>$p,
    389                         'c'=>$c
     389                        'c'=>$c,
     390                        'postPicsBox'=>$postPicsBox
    390391                    ));
    391392                }
  • trunk/modules/ViewTopic.class.php

    r21 r22  
    8181        if($this->modules['Auth']->getValue('userIsAdmin') == 1 || $this->modules['Auth']->getValue('userIsSupermod') == 1 || $authData['authIsMod'] == 1) {
    8282            if($forumID != 0) $modTools[] = "<a href=\"".INDEXFILE."?action=edittopic&amp;mode=move&amp;topic_id=$topicID&amp;".MYSID."\">".$this->modules['Language']->getString('Move_topic').'</a>';
    83             $modTools[] = "<a href=\"".INDEXFILE."?action=edittopic&amp;mode=delete&amp;topic_id=$topicID&amp;".MYSID."\">".$this->modules['Language']->getString('Delete_topic').'</a>';
     83            $modTools[] = "<a href=\"".INDEXFILE."?action=EditTopic&amp;mode=Delete&amp;topicID=$topicID&amp;".MYSID."\">".$this->modules['Language']->getString('Delete_topic').'</a>';
    8484
    8585            $temp = ($topicData['topicIsPinned'] == 1) ? $this->modules['Language']->getString('Mark_topic_unimportant') : $this->modules['Language']->getString('Mark_topic_important');
    86             $modTools[] = "<a href=\"".INDEXFILE."?action=edittopic&amp;mode=pinn&amp;topic_id=$topicID&amp;".MYSID."\">".$temp.'</a>';
    87 
    88             $temp = ($topicData['topicStatus'] == TOPIC_STATUS_CLOSED) ? $this->modules['Language']->getString('Open_topic') : $this->modules['Language']->getString('Close_topic');
    89             $modTools[] = "<a href=\"".INDEXFILE."?action=edittopic&amp;mode=openclose&amp;topic_id=$topicID&amp;".MYSID."\">".$temp.'</a>';
     86            $modTools[] = '<a href="'.INDEXFILE."?action=EditTopic&amp;mode=Pinn&amp;topicID=$topicID&amp;".MYSID.'">'.$temp.'</a>';
     87
     88            $temp = ($topicData['topicIsClosed'] == 1) ? $this->modules['Language']->getString('Open_topic') : $this->modules['Language']->getString('Close_topic');
     89            $modTools[] = "<a href=\"".INDEXFILE."?action=EditTopic&amp;mode=OpenClose&amp;topicID=$topicID&amp;".MYSID."\">".$temp.'</a>';
    9090        }
    9191        $modTools = implode(' | ',$modTools);
Note: See TracChangeset for help on using the changeset viewer.