Plugin Directory

Changeset 610390


Ignore:
Timestamp:
10/10/2012 02:53:28 PM (13 years ago)
Author:
codebycarter
Message:

Tagging version 1.0.3

Location:
wp-bulletin-board
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-bulletin-board/tags/1.0.3/readme.txt

    r607181 r610390  
    22Contributors: codebycarter
    33Donate link: http://codebycarter.x10.mx/wp/donate/
    4 Tags: forum, bulletin board, twitter, facebook, discussion, discussion board, messaging, private message, topic, post, pagination, profile
     4Tags: forum, bulletin board, twitter, facebook, discussion, discussion board, messaging, private message, topic, post, pagination, profile, subforum, wpbb
    55Requires at least: 3.3
    66Tested up to: 3.4.2
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5656None whatsoever. When you deactivate the plugin, WPBB will stop working and will notify you that the plugin is deactivated. This can be disabled by deleting or editing the page that WPBB creates for you. When you reactivate the plugin, WPBB resumes as normal. If you do decide to delete the plugin, everything is removed for you, so do take care that you don't remove the plugin by accident.
    5757
     58= Something doesn't work, what should I do? =
     59
     60Firstly always download the plugin again as the plugin is constantly updated. It is likely the problem you're having has been fixed already. If that doesn't work, create a topic here: http://wordpress.org/support/plugin/wp-bulletin-board
     61
    5862== Screenshots ==
    5963
     
    6771
    6872== Changelog ==
     73
     74= 1.0.3 =
     75* Fixed duplicate go back link when replying to a topic
     76* Fixed being able to reply to a locked topic, now only excludes admins and lock permission granted users
     77* Users now have the option to lock or sticky a topic when creating a reply (if they have required permissions)
     78* Fixed being able to choose topic status regardless of permission when creating a topic
     79* Fixed being able to edit another users signature from the view profile page
     80* Fixed bug where you couldn't delete a forum or subforum via the admin area
     81* Now when deleting a category it affects everything inside it so if deleting a category you delete all forums/subforums/topics/posts within that category, if a subforum only that subforum, topics and posts etc.
     82* Creating a topic and posting a reply now correctly checks the user has waited the required delay between posting
     83* If enabled you will be able to set permissions for guests for forums and the posting delay works for guests as well
     84* Moderator links e.g. edit, lock, delete etc are now only displayed if you have the required permissions.
     85* Permissions should now work. Now checks users roles against all WP roles.
     86* Other, minor bug fixes
    6987
    7088= 1.0.2 =
  • wp-bulletin-board/tags/1.0.3/wp-bb.php

    r607181 r610390  
    44    Plugin URI: http://wordpress.org/extend/plugins/wp-bulletin-board/
    55    Description: An easy to use Bulletin board for Wordpress with Facebook and Twitter integration.
    6     Version: 1.0.2
     6    Version: 1.0.3
    77    Author: Jay Carter
    88    Author URI: http://codebycarter.com
     
    4545define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages');
    4646// Define current version
    47 define('WPBB_VERSION', 'v1.0.2');
     47define('WPBB_VERSION', 'v1.0.3');
    4848// Define plugin url (wp plugin page)
    4949define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board');
     
    7171add_action('switch_theme', 'wpbb_create_template_file');
    7272add_action('wp_enqueue_scripts', 'wpbb_register_styles');
    73 /*add_action('init', 'wpbb_setup_rewrite_rules');
    74 add_action('init', 'wpbb_setup_rewrite_tags');
    75 
    76 function wpbb_setup_rewrite_rules() {
    77     add_rewrite_rule('forum(/([^\d]+))?', 'index.php/forums/?forum=$1', 'top');
    78 }
    79 function wpbb_setup_rewrite_tags() {
    80     global $wp;
    81     $wp->add_query_var('forum');
    82 }*/
    83 
    84 /*
    85     Could've used this, overwritten _http_build_query to set the value seperator to / aswell, but its not pluggable or hookable.
    86 */
    87 //var_dump(_http_build_query(array('forum', 'page'), null, '/', '/', false));
    88 
    89 function wpbb_setup_rewrite_rules() {
    90 
    91     //add_rewrite_rule('carpage(/([^/]+))?(/([^/]+))?/?','index.php?pagename=carpage&var1=$matches[2]&var2=$matches[4]','top');
    92 }
    93 
    94 add_action('init', 'wpbb_setup_rewrite_rules');
    95 
    9673
    9774/*
     
    10885
    10986function wpbb_activate() {
    110     // Create table 'wpbb'
     87    // Create all neccessary database tables
    11188    wpbb_create_db_table();
    11289    // Create options in DB for our settings
     
    132109    // Delete twitter options
    133110    delete_option('wpbb_twitter_options');
     111    // Delete guest options
     112    delete_option('wpbb_guest_options');
    134113    // Delete the user meta
    135114    wpbb_delete_user_meta();
     
    164143
    165144    global $wpdb;
    166 
    167     $roles = wpbb_admin_get_all_roles('string', true);
    168    
    169     $perms = "SET($roles) NOT NULL";
    170    
    171     $create_category_query = "CREATE TABLE IF NOT EXISTS ".CATEGORY_TABLE." (
    172         `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT,
    173         `name` VARCHAR(25) NOT NULL,
    174         `description` VARCHAR(200) NOT NULL,
    175         `forum` TINYINT(1) NOT NULL,
    176         `subforum` TINYINT(1) NOT NULL,
    177         `view` $perms,
    178         `read` $perms,
    179         `post` $perms,
    180         `reply` $perms,
    181         `edit` $perms,
    182         `lock` $perms,
    183         `delete` $perms,
    184         `sticky` $perms,
    185         `order` TINYINT(1) UNSIGNED NOT NULL,
    186         PRIMARY KEY  (`id`)
    187         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    188     ";
    189     $create_topic_query = "CREATE TABLE IF NOT EXISTS ".TOPICS_TABLE." (
    190         `id` INT(1) NOT NULL AUTO_INCREMENT,
    191         `author` SMALLINT(1) NOT NULL,
    192         `name` VARCHAR(25) NOT NULL,
    193         `content` TEXT NULL,
    194         `forum` TINYINT(1) NOT NULL,
    195         `subforum` TINYINT(1) NOT NULL,
    196         `status` SET('locked', 'sticky') NOT NULL,
    197         `created` DATETIME NOT NULL,
    198         `last_reply` DATETIME NOT NULL,
    199         `read` TINYINT(1) NOT NULL DEFAULT '0',
    200         PRIMARY KEY  (`id`)
    201         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    202     ";
    203     $create_post_query = "CREATE TABLE IF NOT EXISTS ".POSTS_TABLE." (
    204         `id` INT(1) NOT NULL AUTO_INCREMENT,
    205         `author` SMALLINT(1) NOT NULL,
    206         `topic` INT(1) NOT NULL,
    207         `text` TEXT NOT NULL,
    208         `created` TIMESTAMP NOT NULL,
    209         PRIMARY KEY  (`id`)
    210         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    211     ";
     145   
     146    $options = get_option('wpbb_options');
     147   
     148    // This is not being activated the first time
     149    //if (isset($options['version']) && $options['version'] != WPBB_VERSION) {
     150    if ($options) {
     151   
     152        wpbb_refresh_roles();
     153       
     154    } else {
     155       
     156        $roles = wpbb_admin_get_all_roles('string', true);
     157   
     158        $perms = "SET($roles) NOT NULL";
     159       
     160        $create_category_query = "CREATE TABLE ".CATEGORY_TABLE." (
     161            `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT,
     162            `name` VARCHAR(25) NOT NULL,
     163            `description` VARCHAR(200) NOT NULL,
     164            `forum` TINYINT(1) NOT NULL,
     165            `subforum` TINYINT(1) NOT NULL,
     166            `view` $perms,
     167            `read` $perms,
     168            `post` $perms,
     169            `reply` $perms,
     170            `edit` $perms,
     171            `lock` $perms,
     172            `delete` $perms,
     173            `sticky` $perms,
     174            `order` TINYINT(1) UNSIGNED NOT NULL,
     175            PRIMARY KEY  (`id`)
     176            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     177        ";
    212178   
    213     $create_messages_query = "CREATE TABLE IF NOT EXISTS ".MESSAGE_TABLE." (
    214         `id` INT(1) NOT NULL AUTO_INCREMENT,
    215         `to` INT(1) NOT NULL,
    216         `from` INT(1) NOT NULL,
    217         `subject` TINYTEXT NOT NULL,
    218         `content` TEXT NOT NULL,
    219         `read` TINYINT(1) NOT NULL,
    220         `sent` DATETIME NOT NULL,
    221         PRIMARY KEY  (`id`)
    222         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    223     ";
     179        $create_topic_query = "CREATE TABLE ".TOPICS_TABLE." (
     180            `id` INT(1) NOT NULL AUTO_INCREMENT,
     181            `author` SMALLINT(1) NOT NULL,
     182            `name` VARCHAR(25) NOT NULL,
     183            `content` TEXT NULL,
     184            `forum` TINYINT(1) NOT NULL,
     185            `subforum` TINYINT(1) NOT NULL,
     186            `status` SET('locked', 'sticky') NOT NULL,
     187            `created` DATETIME NOT NULL,
     188            `last_reply` DATETIME NOT NULL,
     189            `read` TINYINT(1) NOT NULL DEFAULT '0',
     190            PRIMARY KEY  (`id`)
     191            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     192        ";
     193        $create_post_query = "CREATE TABLE ".POSTS_TABLE." (
     194            `id` INT(1) NOT NULL AUTO_INCREMENT,
     195            `author` SMALLINT(1) NOT NULL,
     196            `topic` INT(1) NOT NULL,
     197            `text` TEXT NOT NULL,
     198            `created` TIMESTAMP NOT NULL,
     199            PRIMARY KEY  (`id`)
     200            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     201        ";
     202   
     203        $create_messages_query = "CREATE TABLE ".MESSAGE_TABLE." (
     204            `id` INT(1) NOT NULL AUTO_INCREMENT,
     205            `to` INT(1) NOT NULL,
     206            `from` INT(1) NOT NULL,
     207            `subject` TINYTEXT NOT NULL,
     208            `content` TEXT NOT NULL,
     209            `read` TINYINT(1) NOT NULL,
     210            `sent` DATETIME NOT NULL,
     211            PRIMARY KEY  (`id`)
     212            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     213        ";
    224214     
    225     $create_category_table = $wpdb->query($create_category_query);
    226     $create_topic_table = $wpdb->query($create_topic_query);
    227     $create_post_table = $wpdb->query($create_post_query);
    228     $create_message_table = $wpdb->query($create_messages_query);
     215        $create_category_table = $wpdb->query($create_category_query);
     216        $create_topic_table = $wpdb->query($create_topic_query);
     217        $create_post_table = $wpdb->query($create_post_query);
     218        $create_message_table = $wpdb->query($create_messages_query);
    229219   
    230     if ($create_category_table === false || $create_topic_table === false || $create_post_table === false || $create_message_table === false) {
    231         printf(__('There was an error creating the required WPBB tables. The error was: %s'), $wpdb->print_error());   
    232     }
     220        if ($create_category_table === false) {
     221            $create_category_table_err = __('There was an error creating the table wpbb_categorie', 'wp-bb');
     222            error_log($create_category_table_err);
     223        }
     224        if ($create_topic_table === false) {
     225            $create_topic_table_err = __('There was an error creating the table wpbb_topics', 'wp-bb');
     226            error_log($create_topic_table_err);
     227        }
     228        if ($create_post_table === false) {
     229            $create_post_table_err = __('There was an error creating the table wpbb_posts', 'wp-bb');
     230            error_log($create_post_table_err);
     231        }
     232        if ($create_message_table === false) {
     233            $create_message_table_err = __('There was an error creating the table wpbb_messages', 'wp-bb');
     234            error_log($create_message_table_err);
     235        }
     236    }
    233237}
    234238
     
    257261            'post_cutoff' => 15,
    258262            'post_to_forum' => 'yes',
    259             'show_footer' => 'no'
     263            'show_footer' => 'no',
     264            'version' => WPBB_VERSION
    260265        );
    261266        $add_wpbb_options = add_option('wpbb_options', $options);
     267    } else {
     268        if (!isset($old_options['version'])) {
     269            // Attempting to update a key in the options value will remove all the other keys so we must
     270            // set all the other keys as well
     271            $options = array(
     272                'maintenance_mode' => $old_options['maintenance_mode'],
     273                'maintenance_message' => $old_options['maintenance_message'],
     274                'forum_name' => $old_options['forum_name'],
     275                'forum_prefix' => $old_options['forum_prefix'],
     276                'allow_guests' => $old_options['allow_guests'],
     277                'allow_subforums' => $old_options['allow_subforums'],
     278                'enable_quick_reply' => $old_options['enable_quick_reply'],
     279                'topics_per_page' => $old_options['topics_per_page'],
     280                'posts_per_page' => $old_options['posts_per_page'],
     281                'topic_cutoff' => $old_options['topic_cutoff'],
     282                'post_cutoff' => $old_options['post_cutoff'],
     283                'post_to_forum' => $old_options['post_to_forum'],
     284                'show_footer' => $old_options['show_footer'],
     285                'version' => WPBB_VERSION
     286            );
     287            update_option('wpbb_options', $options);
     288        }
    262289    }
    263290    /* Theme Options */
     
    294321        $add_wpbb_twitter_options = add_option('wpbb_twitter_options', $twitter_options);
    295322    }
     323    $old_guest_options = get_option('wpbb_guest_options');
     324    if (!$old_guest_options) {
     325        $guest_options = array(
     326            'guest_last_post' => '0000-00-00 00:00:00'
     327        );
     328        $add_wpbb_guest_options = add_option('wpbb_guest_options', $guest_options);
     329    }
    296330}
    297331
     
    306340    $create_subforum = __('Create Subforum', 'wp-bb');
    307341    $create_topic = __('Create Topic', 'wp-bb');
     342    $create_tools = __('Tools', 'wp-bb');
    308343    $faq_support = __('FAQ & Support', 'wp-bb');
    309344    $settings = __('WPBB Settings', 'wp-bb');
     
    323358    // Create/Edit Topics
    324359    add_submenu_page('wpbb_admin', 'WPBB Topics', $create_topic, 'manage_options', 'wpbb_admin_topics', 'wpbb_admin_topics');
     360   
     361    // Create Tools page
     362    add_submenu_page('wpbb_admin', 'WPBB Tools', $create_tools, 'manage_options', 'wpbb_admin_tools', 'wpbb_admin_tools');
    325363   
    326364    // FAQ / First Installation Page
     
    428466}
    429467
     468/*
     469    Tools page
     470*/
     471
     472function wpbb_admin_tools() {
     473    require_once('php/admin/wpbb-admin-tools.php');
     474}
     475
    430476/*
    431477    FAQ / Support page
  • wp-bulletin-board/trunk/readme.txt

    r607181 r610390  
    22Contributors: codebycarter
    33Donate link: http://codebycarter.x10.mx/wp/donate/
    4 Tags: forum, bulletin board, twitter, facebook, discussion, discussion board, messaging, private message, topic, post, pagination, profile
     4Tags: forum, bulletin board, twitter, facebook, discussion, discussion board, messaging, private message, topic, post, pagination, profile, subforum, wpbb
    55Requires at least: 3.3
    66Tested up to: 3.4.2
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5656None whatsoever. When you deactivate the plugin, WPBB will stop working and will notify you that the plugin is deactivated. This can be disabled by deleting or editing the page that WPBB creates for you. When you reactivate the plugin, WPBB resumes as normal. If you do decide to delete the plugin, everything is removed for you, so do take care that you don't remove the plugin by accident.
    5757
     58= Something doesn't work, what should I do? =
     59
     60Firstly always download the plugin again as the plugin is constantly updated. It is likely the problem you're having has been fixed already. If that doesn't work, create a topic here: http://wordpress.org/support/plugin/wp-bulletin-board
     61
    5862== Screenshots ==
    5963
     
    6771
    6872== Changelog ==
     73
     74= 1.0.3 =
     75* Fixed duplicate go back link when replying to a topic
     76* Fixed being able to reply to a locked topic, now only excludes admins and lock permission granted users
     77* Users now have the option to lock or sticky a topic when creating a reply (if they have required permissions)
     78* Fixed being able to choose topic status regardless of permission when creating a topic
     79* Fixed being able to edit another users signature from the view profile page
     80* Fixed bug where you couldn't delete a forum or subforum via the admin area
     81* Now when deleting a category it affects everything inside it so if deleting a category you delete all forums/subforums/topics/posts within that category, if a subforum only that subforum, topics and posts etc.
     82* Creating a topic and posting a reply now correctly checks the user has waited the required delay between posting
     83* If enabled you will be able to set permissions for guests for forums and the posting delay works for guests as well
     84* Moderator links e.g. edit, lock, delete etc are now only displayed if you have the required permissions.
     85* Permissions should now work. Now checks users roles against all WP roles.
     86* Other, minor bug fixes
    6987
    7088= 1.0.2 =
  • wp-bulletin-board/trunk/wp-bb.php

    r607181 r610390  
    44    Plugin URI: http://wordpress.org/extend/plugins/wp-bulletin-board/
    55    Description: An easy to use Bulletin board for Wordpress with Facebook and Twitter integration.
    6     Version: 1.0.2
     6    Version: 1.0.3
    77    Author: Jay Carter
    88    Author URI: http://codebycarter.com
     
    4545define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages');
    4646// Define current version
    47 define('WPBB_VERSION', 'v1.0.2');
     47define('WPBB_VERSION', 'v1.0.3');
    4848// Define plugin url (wp plugin page)
    4949define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board');
     
    7171add_action('switch_theme', 'wpbb_create_template_file');
    7272add_action('wp_enqueue_scripts', 'wpbb_register_styles');
    73 /*add_action('init', 'wpbb_setup_rewrite_rules');
    74 add_action('init', 'wpbb_setup_rewrite_tags');
    75 
    76 function wpbb_setup_rewrite_rules() {
    77     add_rewrite_rule('forum(/([^\d]+))?', 'index.php/forums/?forum=$1', 'top');
    78 }
    79 function wpbb_setup_rewrite_tags() {
    80     global $wp;
    81     $wp->add_query_var('forum');
    82 }*/
    83 
    84 /*
    85     Could've used this, overwritten _http_build_query to set the value seperator to / aswell, but its not pluggable or hookable.
    86 */
    87 //var_dump(_http_build_query(array('forum', 'page'), null, '/', '/', false));
    88 
    89 function wpbb_setup_rewrite_rules() {
    90 
    91     //add_rewrite_rule('carpage(/([^/]+))?(/([^/]+))?/?','index.php?pagename=carpage&var1=$matches[2]&var2=$matches[4]','top');
    92 }
    93 
    94 add_action('init', 'wpbb_setup_rewrite_rules');
    95 
    9673
    9774/*
     
    10885
    10986function wpbb_activate() {
    110     // Create table 'wpbb'
     87    // Create all neccessary database tables
    11188    wpbb_create_db_table();
    11289    // Create options in DB for our settings
     
    132109    // Delete twitter options
    133110    delete_option('wpbb_twitter_options');
     111    // Delete guest options
     112    delete_option('wpbb_guest_options');
    134113    // Delete the user meta
    135114    wpbb_delete_user_meta();
     
    164143
    165144    global $wpdb;
    166 
    167     $roles = wpbb_admin_get_all_roles('string', true);
    168    
    169     $perms = "SET($roles) NOT NULL";
    170    
    171     $create_category_query = "CREATE TABLE IF NOT EXISTS ".CATEGORY_TABLE." (
    172         `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT,
    173         `name` VARCHAR(25) NOT NULL,
    174         `description` VARCHAR(200) NOT NULL,
    175         `forum` TINYINT(1) NOT NULL,
    176         `subforum` TINYINT(1) NOT NULL,
    177         `view` $perms,
    178         `read` $perms,
    179         `post` $perms,
    180         `reply` $perms,
    181         `edit` $perms,
    182         `lock` $perms,
    183         `delete` $perms,
    184         `sticky` $perms,
    185         `order` TINYINT(1) UNSIGNED NOT NULL,
    186         PRIMARY KEY  (`id`)
    187         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    188     ";
    189     $create_topic_query = "CREATE TABLE IF NOT EXISTS ".TOPICS_TABLE." (
    190         `id` INT(1) NOT NULL AUTO_INCREMENT,
    191         `author` SMALLINT(1) NOT NULL,
    192         `name` VARCHAR(25) NOT NULL,
    193         `content` TEXT NULL,
    194         `forum` TINYINT(1) NOT NULL,
    195         `subforum` TINYINT(1) NOT NULL,
    196         `status` SET('locked', 'sticky') NOT NULL,
    197         `created` DATETIME NOT NULL,
    198         `last_reply` DATETIME NOT NULL,
    199         `read` TINYINT(1) NOT NULL DEFAULT '0',
    200         PRIMARY KEY  (`id`)
    201         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    202     ";
    203     $create_post_query = "CREATE TABLE IF NOT EXISTS ".POSTS_TABLE." (
    204         `id` INT(1) NOT NULL AUTO_INCREMENT,
    205         `author` SMALLINT(1) NOT NULL,
    206         `topic` INT(1) NOT NULL,
    207         `text` TEXT NOT NULL,
    208         `created` TIMESTAMP NOT NULL,
    209         PRIMARY KEY  (`id`)
    210         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    211     ";
     145   
     146    $options = get_option('wpbb_options');
     147   
     148    // This is not being activated the first time
     149    //if (isset($options['version']) && $options['version'] != WPBB_VERSION) {
     150    if ($options) {
     151   
     152        wpbb_refresh_roles();
     153       
     154    } else {
     155       
     156        $roles = wpbb_admin_get_all_roles('string', true);
     157   
     158        $perms = "SET($roles) NOT NULL";
     159       
     160        $create_category_query = "CREATE TABLE ".CATEGORY_TABLE." (
     161            `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT,
     162            `name` VARCHAR(25) NOT NULL,
     163            `description` VARCHAR(200) NOT NULL,
     164            `forum` TINYINT(1) NOT NULL,
     165            `subforum` TINYINT(1) NOT NULL,
     166            `view` $perms,
     167            `read` $perms,
     168            `post` $perms,
     169            `reply` $perms,
     170            `edit` $perms,
     171            `lock` $perms,
     172            `delete` $perms,
     173            `sticky` $perms,
     174            `order` TINYINT(1) UNSIGNED NOT NULL,
     175            PRIMARY KEY  (`id`)
     176            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     177        ";
    212178   
    213     $create_messages_query = "CREATE TABLE IF NOT EXISTS ".MESSAGE_TABLE." (
    214         `id` INT(1) NOT NULL AUTO_INCREMENT,
    215         `to` INT(1) NOT NULL,
    216         `from` INT(1) NOT NULL,
    217         `subject` TINYTEXT NOT NULL,
    218         `content` TEXT NOT NULL,
    219         `read` TINYINT(1) NOT NULL,
    220         `sent` DATETIME NOT NULL,
    221         PRIMARY KEY  (`id`)
    222         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    223     ";
     179        $create_topic_query = "CREATE TABLE ".TOPICS_TABLE." (
     180            `id` INT(1) NOT NULL AUTO_INCREMENT,
     181            `author` SMALLINT(1) NOT NULL,
     182            `name` VARCHAR(25) NOT NULL,
     183            `content` TEXT NULL,
     184            `forum` TINYINT(1) NOT NULL,
     185            `subforum` TINYINT(1) NOT NULL,
     186            `status` SET('locked', 'sticky') NOT NULL,
     187            `created` DATETIME NOT NULL,
     188            `last_reply` DATETIME NOT NULL,
     189            `read` TINYINT(1) NOT NULL DEFAULT '0',
     190            PRIMARY KEY  (`id`)
     191            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     192        ";
     193        $create_post_query = "CREATE TABLE ".POSTS_TABLE." (
     194            `id` INT(1) NOT NULL AUTO_INCREMENT,
     195            `author` SMALLINT(1) NOT NULL,
     196            `topic` INT(1) NOT NULL,
     197            `text` TEXT NOT NULL,
     198            `created` TIMESTAMP NOT NULL,
     199            PRIMARY KEY  (`id`)
     200            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     201        ";
     202   
     203        $create_messages_query = "CREATE TABLE ".MESSAGE_TABLE." (
     204            `id` INT(1) NOT NULL AUTO_INCREMENT,
     205            `to` INT(1) NOT NULL,
     206            `from` INT(1) NOT NULL,
     207            `subject` TINYTEXT NOT NULL,
     208            `content` TEXT NOT NULL,
     209            `read` TINYINT(1) NOT NULL,
     210            `sent` DATETIME NOT NULL,
     211            PRIMARY KEY  (`id`)
     212            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
     213        ";
    224214     
    225     $create_category_table = $wpdb->query($create_category_query);
    226     $create_topic_table = $wpdb->query($create_topic_query);
    227     $create_post_table = $wpdb->query($create_post_query);
    228     $create_message_table = $wpdb->query($create_messages_query);
     215        $create_category_table = $wpdb->query($create_category_query);
     216        $create_topic_table = $wpdb->query($create_topic_query);
     217        $create_post_table = $wpdb->query($create_post_query);
     218        $create_message_table = $wpdb->query($create_messages_query);
    229219   
    230     if ($create_category_table === false || $create_topic_table === false || $create_post_table === false || $create_message_table === false) {
    231         printf(__('There was an error creating the required WPBB tables. The error was: %s'), $wpdb->print_error());   
    232     }
     220        if ($create_category_table === false) {
     221            $create_category_table_err = __('There was an error creating the table wpbb_categorie', 'wp-bb');
     222            error_log($create_category_table_err);
     223        }
     224        if ($create_topic_table === false) {
     225            $create_topic_table_err = __('There was an error creating the table wpbb_topics', 'wp-bb');
     226            error_log($create_topic_table_err);
     227        }
     228        if ($create_post_table === false) {
     229            $create_post_table_err = __('There was an error creating the table wpbb_posts', 'wp-bb');
     230            error_log($create_post_table_err);
     231        }
     232        if ($create_message_table === false) {
     233            $create_message_table_err = __('There was an error creating the table wpbb_messages', 'wp-bb');
     234            error_log($create_message_table_err);
     235        }
     236    }
    233237}
    234238
     
    257261            'post_cutoff' => 15,
    258262            'post_to_forum' => 'yes',
    259             'show_footer' => 'no'
     263            'show_footer' => 'no',
     264            'version' => WPBB_VERSION
    260265        );
    261266        $add_wpbb_options = add_option('wpbb_options', $options);
     267    } else {
     268        if (!isset($old_options['version'])) {
     269            // Attempting to update a key in the options value will remove all the other keys so we must
     270            // set all the other keys as well
     271            $options = array(
     272                'maintenance_mode' => $old_options['maintenance_mode'],
     273                'maintenance_message' => $old_options['maintenance_message'],
     274                'forum_name' => $old_options['forum_name'],
     275                'forum_prefix' => $old_options['forum_prefix'],
     276                'allow_guests' => $old_options['allow_guests'],
     277                'allow_subforums' => $old_options['allow_subforums'],
     278                'enable_quick_reply' => $old_options['enable_quick_reply'],
     279                'topics_per_page' => $old_options['topics_per_page'],
     280                'posts_per_page' => $old_options['posts_per_page'],
     281                'topic_cutoff' => $old_options['topic_cutoff'],
     282                'post_cutoff' => $old_options['post_cutoff'],
     283                'post_to_forum' => $old_options['post_to_forum'],
     284                'show_footer' => $old_options['show_footer'],
     285                'version' => WPBB_VERSION
     286            );
     287            update_option('wpbb_options', $options);
     288        }
    262289    }
    263290    /* Theme Options */
     
    294321        $add_wpbb_twitter_options = add_option('wpbb_twitter_options', $twitter_options);
    295322    }
     323    $old_guest_options = get_option('wpbb_guest_options');
     324    if (!$old_guest_options) {
     325        $guest_options = array(
     326            'guest_last_post' => '0000-00-00 00:00:00'
     327        );
     328        $add_wpbb_guest_options = add_option('wpbb_guest_options', $guest_options);
     329    }
    296330}
    297331
     
    306340    $create_subforum = __('Create Subforum', 'wp-bb');
    307341    $create_topic = __('Create Topic', 'wp-bb');
     342    $create_tools = __('Tools', 'wp-bb');
    308343    $faq_support = __('FAQ & Support', 'wp-bb');
    309344    $settings = __('WPBB Settings', 'wp-bb');
     
    323358    // Create/Edit Topics
    324359    add_submenu_page('wpbb_admin', 'WPBB Topics', $create_topic, 'manage_options', 'wpbb_admin_topics', 'wpbb_admin_topics');
     360   
     361    // Create Tools page
     362    add_submenu_page('wpbb_admin', 'WPBB Tools', $create_tools, 'manage_options', 'wpbb_admin_tools', 'wpbb_admin_tools');
    325363   
    326364    // FAQ / First Installation Page
     
    428466}
    429467
     468/*
     469    Tools page
     470*/
     471
     472function wpbb_admin_tools() {
     473    require_once('php/admin/wpbb-admin-tools.php');
     474}
     475
    430476/*
    431477    FAQ / Support page
Note: See TracChangeset for help on using the changeset viewer.