Plugin Directory

Changeset 607181


Ignore:
Timestamp:
10/02/2012 08:46:05 PM (13 years ago)
Author:
codebycarter
Message:

Tagging version 1.0.2

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

Legend:

Unmodified
Added
Removed
  • wp-bulletin-board/tags/1.0.2/css/wpbb-dark-style.css

    r604652 r607181  
    1414/* Used for most messages */
    1515
     16/* <h1> heading 1 */
     17#wpbb-h-1 {
     18    font-size:24px;
     19}
     20
    1621/* Centers text */
    1722.wpbb-centered {
     
    4853#wpbb-search {
    4954    float:right;
    50 }
    51 
    52 /* This is a message displayed to an admin to remind them the board is in maintenance mode */
    53 #wpbb-admin-maintenance-reminder {
    54     text-align:center;
    55     background-color: yellow;
    56 }
    57 
    58 /* This is the message displayed to users when the board is in maintenance mode (excludes admins unless logged out) */
    59 #wpbb-maintenance-message {
    60     text-align:center;
    61     font-weight:bold;
    6255}
    6356
     
    137130/* Credit to http://css.dzone.com/news/css-message-boxes-different-me /*
    138131/* Layout for the success and failure messages */
    139 .wpbb-message-success, .wpbb-message-failure {
     132.wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning {
    140133    border: 1px solid;
    141134    margin: 10px 0px;
     
    159152}
    160153
     154/* Warning message background and font color */
     155.wpbb-message-warning {
     156    color: #9F6000;
     157    background-color: #FEEFB3;
     158    text-align:center;
     159}
     160
    161161/* The create/reply buttons when viewing a forum/subforum/topic */
    162162.wpbb-topic-buttons {
     
    195195}
    196196
    197 /* The quick reply on a topic */
     197/* The quick reply div at bottom of a topic */
    198198.wpbb-quick-reply {
    199199    margin-left:auto;
    200200    margin-right:auto;
    201     width:50%;
    202201    margin-bottom:100px;
    203202    text-align:center;
     203}
     204 
     205/* The textarea element used for the quick reply content - determines its width/height*/
     206.wpbb-quick-reply textarea {
     207    min-width: 400px;
     208    min-height: 100px;
    204209}
    205210
  • wp-bulletin-board/tags/1.0.2/css/wpbb-light-style.css

    r604862 r607181  
    99/* Used for most messages */
    1010
     11/* <h1> heading 1 */
     12#wpbb-h-1 {
     13    font-size:24px;
     14}
     15
    1116/* Centers text */
    1217.wpbb-centered {
     
    4247}
    4348
    44 /* This is a message displayed to an admin to remind them the board is in maintenance mode */
    45 #wpbb-admin-maintenance-reminder {
    46     text-align:center;
    47     background-color: yellow;
    48 }
    49 
    50 /* This is the message displayed to users when the board is in maintenance mode (excludes admins unless logged out) */
    51 #wpbb-maintenance-message {
    52     text-align:center;
    53     font-weight:bold;
    54 }
    55 
    5649/* Defines the layout of all tables displayed on the front end */
    5750/* Credit to twentyelevens entry-content table as I used that as my table class when developing the plugin and and may use some styling or bare resemblance to it */
    5851.wpbb-table {
    59     width: 100%;
     52    width:100%;
    6053    border: solid 0.1em;
    6154    border-color: #9E9E9E;
     
    123116    margin-left:auto;
    124117    margin-right:auto;
    125     width:50%;
     118    text-align:center;
     119}
     120
     121#wpbb-profile-signature textarea {
     122    min-width:400px;
     123    min-height:100px;
     124    max-width: 400px;
     125    max-height: 100px;
    126126}
    127127
    128128/* Credit to http://css.dzone.com/news/css-message-boxes-different-me /*
    129129/* Layout for the success and failure messages */
    130 .wpbb-message-success, .wpbb-message-failure {
     130.wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning {
    131131    border: 1px solid;
    132132    margin: 10px 0px;
     
    150150}
    151151
     152/* Warning message background and font color */
     153.wpbb-message-warning {
     154    color: #9F6000;
     155    background-color: #FEEFB3;
     156    text-align:center;
     157}
     158
    152159/* Search Bar */
    153160#wpbb-search {
     
    183190    margin-top:auto;
    184191    border: 0;
    185     width: 80%;
     192    width: auto;
    186193}
    187194
     
    191198}
    192199
    193 /* The quick reply textarea at bottom of a topic */
     200/* The quick reply div at bottom of a topic */
    194201.wpbb-quick-reply {
    195202    margin-left:auto;
    196203    margin-right:auto;
    197     width:50%;
    198204    margin-bottom:100px;
    199205    text-align:center;
     206}
     207 
     208/* The textarea element used for the quick reply content - determines its width/height*/
     209.wpbb-quick-reply textarea {
     210    min-width:400px;
     211    min-height:100px;
     212    max-width: 400px;
     213    max-height: 100px;
     214}
     215
     216#wpbb-message-subject-date {
     217    float:left;
    200218}
    201219
  • wp-bulletin-board/tags/1.0.2/php/admin/wpbb-admin-categories.php

    r603518 r607181  
    103103        foreach ($roles as $role) {
    104104           
    105             if ($_POST['wpbbadvancedpermissionstable'.$role.'view']) {
     105            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'view'])) {
    106106               
    107107                $permissions['view'][] = $role;
    108108            }
    109109           
    110             if ($_POST['wpbbadvancedpermissionstable'.$role.'read']) {
     110            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'read'])) {
    111111               
    112112                $permissions['read'][] = $role;
    113113            }
    114114           
    115             if ($_POST['wpbbadvancedpermissionstable'.$role.'post']) {
     115            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'post'])) {
    116116               
    117117                $permissions['post'][] = $role;
    118118            }
    119119           
    120             if ($_POST['wpbbadvancedpermissionstable'.$role.'reply']) {
     120            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'reply'])) {
    121121               
    122122                $permissions['reply'][] = $role;
    123123            }
    124124           
    125             if ($_POST['wpbbadvancedpermissionstable'.$role.'edit']) {
     125            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'edit'])) {
    126126               
    127127                $permissions['edit'][] = $role;
    128128            }
    129129           
    130             if ($_POST['wpbbadvancedpermissionstable'.$role.'lock']) {
     130            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'lock'])) {
    131131               
    132132                $permissions['lock'][] = $role;
    133133            }
    134134           
    135             if ($_POST['wpbbadvancedpermissionstable'.$role.'delete']) {
     135            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'delete'])) {
    136136               
    137137                $permissions['delete'][] = $role;
    138138            }
    139139           
    140             if ($_POST['wpbbadvancedpermissionstable'.$role.'sticky']) {
     140            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'sticky'])) {
    141141               
    142142                $permissions['sticky'][] = $role;
    143143            }
    144144        }
     145       
     146        // This is a category
     147        $forum_id = 0;
     148        $subforum_id = 0;
    145149       
    146150        $view_permissions = implode(",", $permissions['view']);
     
    155159        $data = array(
    156160            'name' => $name,
    157             'forum' => 0,
    158             'subforum' => 0,
     161            'forum' => $forum_id,
     162            'subforum' => $subforum_id,
    159163            'view' => $view_permissions,
    160164            'read' => $read_permissions,
     
    173177       
    174178        if ($update_forum) {
    175            
    176             //echo "<div id='message' class='updated'>Category ID ".$id." updated succesfully </div>";
    177             echo "<div id='message' class='updated'>";
    178             printf(__('Category ID %d updated successfully', 'wp-bb'), $id);
    179             echo "</div>";
    180        
     179            ?>
     180            <div id='message' class='updated'>
     181                <?php printf(__('Category ID %d updated successfully', 'wp-bb'), $id); ?>
     182            </div>
     183            <?php
    181184        } else {
    182        
    183             //echo "<div id='message' class='error'>Error updating Category ID ".$id."</div>";
    184             echo "<div id='message' class='error'>";
    185             printf(__('Error updating Category ID %d', 'wp-bb'), $id);
    186             echo "</div>";
     185            ?>
     186            <div id='message' class='error'>
     187                <?php printf(__('Error updating Category ID %d', 'wp-bb'), $id); ?>
     188            </div>
     189            <?php
    187190        }
    188191    }
     
    198201       
    199202        if ($delete === false) {
    200            
    201             //echo "<div id='message' class='error'>There was an error deleting Category ID ".$id." from the database.</div>";
    202             echo "<div id='message' class='error'>";
    203             printf(__('There was an error deleting Category ID %d, please try again.', 'wp-bb'), $id);
    204             echo "</div>";
    205            
     203            ?>
     204            <div id='message' class='error'>
     205                <?php printf(__('There was an error deleting Category ID %d, please try again.', 'wp-bb'), $id); ?>
     206            </div>
     207            <?php
    206208        } else {
    207        
    208             echo "<div id='message' class='updated'>";
    209             //echo "<div id='message' class='updated'>Category ID ".$id." deleted successfully.</div>";
    210             printf(__('Category ID %d deleted successfully.', 'wp-bb'), $id);
    211             echo "</div>";
     209            ?>
     210            <div id='message' class='updated'>
     211                <?php printf(__('Category ID %d deleted successfully.', 'wp-bb'), $id); ?>
     212            </div>
     213            <?php
    212214        }
    213215   
     
    226228    $id = absint($_GET['id']);
    227229
    228     echo "<h3>".__('Confirm Delete Request', 'wp-bb')."</h3>";
    229 
    230     //echo "Are you sure you want to delete Category ID ".$id."?";
    231     printf(__('Are you sure you want to delete Category ID %d?', 'wp-bb'), $id);
    232    
    233     echo "<form method='POST' action='#'>";
    234     echo "<input type='radio' name='wpbb-confirm-delete' value='yes' checked='no' /> ".__('Yes', 'wp-bb');
    235     echo "<input type='radio' name='wpbb-confirm-delete' value='no' checked='no' /> ".__('No', 'wp-bb');
    236     echo "<input type='hidden' name='wpbb-confirm-delete-id' value='".$id."' />";
    237     echo "<input type='submit' name='wpbb-confirm-delete-submit' value='".__('Confirm', 'wp-bb')."' />";
    238     echo "</form>";
    239    
     230    ?>
     231    <h3><?php _e('Confirm Delete Request', 'wp-bb'); ?></h3>
     232
     233    <?php printf(__('Are you sure you want to delete Category ID %d?', 'wp-bb'), $id); ?>
     234   
     235    <form method='POST' action='#'>
     236        <input type='radio' name='wpbb-confirm-delete' value='yes' checked='no' /> <?php _e('Yes', 'wp-bb'); ?>
     237        <input type='radio' name='wpbb-confirm-delete' value='no' checked='no' /> <?php _e('No', 'wp-bb'); ?>
     238        <input type='hidden' name='wpbb-confirm-delete-id' value='<?php echo $id; ?>' />
     239        <input type='submit' name='wpbb-confirm-delete-submit' value='<?php _e('Confirm', 'wp-bb'); ?>' />
     240    </form>
     241    <?php
    240242    return;
    241243}
  • wp-bulletin-board/tags/1.0.2/php/admin/wpbb-admin-faq-support.php

    r603518 r607181  
    5757        <dl>
    5858            <dt><b><?php _e('Support Forums', 'wp-bb'); ?></b></dt>
    59             <dd>http://codebycarter.com/wpbb/forums</dd>
     59            <dd>http://wordpress.org/support/plugin/wp-bulletin-board</dd>
    6060            <dt><b><?php _e('Author Email', 'wp-bb'); ?></b></dt>
    6161            <dd>[email protected]</dd>
     
    6363                <b>
    6464                    <?php
    65                         $options = get_option('wpbb_options');
    6665                        _e('Your version', 'wp-bb');
    6766                    ?>
     
    7069            <dd>
    7170                <?php
    72                 if (isset($options['version'])) {
    73                     $options['version'];
    74                 } else {
    75                     _e('Unknown version', 'wp-bb');
    76                 }
     71                    echo WPBB_VERSION;
    7772                ?>
    7873            </dd>
  • wp-bulletin-board/tags/1.0.2/php/admin/wpbb-admin-settings.php

    r603518 r607181  
    8080       
    8181    (string) $facebook_state = wp_strip_all_tags($_POST['wpbbfacebookstate']);
    82        
     82   
     83    $faceboook_default_role = strtolower(wp_strip_all_tags($_POST['wpbbfacebookdefaultrole']));
     84   
    8385    $new_facebook_options = array(
    8486        'allow_facebook' => $facebook_support,
     
    8688        'facebook_app_secret_key' => $facebook_app_secret_key,
    8789        'facebook_redirect_uri' => $facebook_redirect_uri,
    88         'facebook_state' => $facebook_state
     90        'facebook_state' => $facebook_state,
     91        'facebook_default_role' => $faceboook_default_role
    8992    );
    9093       
     
    303306                </th>
    304307                <td>
    305                 <?php
    306                     if (isset($facebook_options['facebook_app_id'])) {
    307                         $facebook_app_id_value = $facebook_options['facebook_app_id'];
    308                     } else {
    309                         $facebook_app_id_value = "Enter your App ID / API Key";
    310                     }
    311                    
    312                     if (isset($facebook_options['facebook_app_secret_key'])) {
    313                         $facebook_app_secret_key_value = $facebook_options['facebook_app_secret_key'];
    314                     } else {
    315                         $facebook_app_secret_key_value = "Enter your App Secret Key";
    316                     }
    317                    
    318                     if (isset($facebook_options['facebook_redirect_uri'])) {
    319                         $facebook_redirect_uri_value = $facebook_options['facebook_redirect_uri'];
    320                     } else {
    321                         $facebook_redirect_uri_value = "http://www.yoursite.com";
    322                     }
    323                    
    324                     if (isset($facebook_options['facebook_state'])) {
    325                         $facebook_state_value = $facebook_options['facebook_state'];
    326                     }
    327                 ?>
     308                    <?php
     309                    // App ID
     310                    $facebook_app_id_value = (isset($facebook_options['facebook_app_id'])) ? $facebook_options['facebook_app_id'] : "Enter your App ID / API Key";
     311                    // App secret key
     312                    $facebook_app_secret_key_value = (isset($facebook_options['facebook_app_secret_key'])) ? $facebook_options['facebook_app_secret_key'] : "Enter your App Secret Key";
     313                    // Redirect URL
     314                    $facebook_redirect_uri_value = (isset($facebook_options['facebook_redirect_uri'])) ? $facebook_options['facebook_redirect_uri'] : "http://www.yoursite.com";
     315                    // Facebook state
     316                    $facebook_state_value = (isset($facebook_options['facebook_state'])) ? $facebook_options['facebook_state'] : 'Enter a unique string (letters and numbers only';
     317                    // Facebook default role
     318                    $facebook_default_role = (isset($facebook_options['facebook_default_role'])) ? $facebook_options['facebook_default_role'] : 'Enter a default role for new Facebook registrations';
     319                    ?>
    328320                    <input type='text' name='wpbbfacebookappid' value="<?php echo $facebook_app_id_value; ?>"/>
    329321                </td>
     
    342334                </th>
    343335                <td>
    344                     <input type='text' name='wpbbfacebookredirecturi' value="<?php echo $facebook_redirect_uri_value; ?>"/>
     336                    <input type='text' name="wpbbfacebookredirecturi" value="<?php echo $facebook_redirect_uri_value; ?>"/>
    345337                </td>
    346338            </tr>
     
    350342                </th>
    351343                <td>
    352                     <input type='text' name='wpbbfacebookstate' value="<?php echo $facebook_state_value; ?>" />
    353                 </td>
    354             </tr>
    355             <tr>
    356            
     344                    <input type="text" name="wpbbfacebookstate" value="<?php echo $facebook_state_value; ?>" />
     345                </td>
     346            </tr>
     347            <tr>
     348                <th>
     349                    <label for="wpbbfacebookdefaultrole"><?php _e('Default Role', 'wp-bb'); ?></label>
     350                </th>
     351                <td>
     352                    <input type="text" name="wpbbfacebookdefaultrole" value="<?php echo strtolower($facebook_default_role); ?>"/>
     353                </td>
     354            </tr>
     355            <tr>
    357356                <td><input type="submit" name="wpbb-facebook-settings-submit" class="button-primary" value="<?php _e('Save Changes', 'wp-bb'); ?>" /></td>
    358357            </tr>
  • wp-bulletin-board/tags/1.0.2/php/facebook/wpbb-facebook.php

    r603518 r607181  
    3030   
    3131} else { // User is not logged in
    32 
    33     if (!isset($_GET['state']) && !isset($_GET['code'])) {
    34    
    35         ?>
    36        
    37         <div class="wpbb-centered-bold">
    38        
    39             <a href='<?php echo wpbb_get_facebook_login(); ?>'><?php _e('Login using Facebook', 'wp-bb'); ?></a>
    40            
    41             <?php _e('or', 'wp-bb'); ?>
    42            
    43             <a href='<?php echo add_query_arg(array('register' => '', 'method' => 'facebook'), get_permalink()); ?>'><?php _e('Register using Facebook', 'wp-bb'); ?></a>
    44            
    45         </div>
    46 
    47         <?php
    48     }
    4932   
    5033    // Registering for a Wordpress account through Facebook
    5134    if ((isset($_GET['register'])) && (isset($_GET['method'])) && (count($_GET) == 2)) {
    5235   
     36        $registration_enabled = get_option('users_can_register');
     37       
     38        if (!$registration_enabled) {
     39            ?>
     40            <div class="wpbb-centered">
     41                <?php
     42                    _e('Sorry, the administrator has disabled user registrations.', 'wp-bb');
     43                    wpbb_exit();
     44                   
     45                ?>
     46            </div>
     47            <?php
     48        }
     49   
    5350        ?>
    54        
    5551        <h2 class="wpbb-centered-bold">
    5652       
     
    106102               
    107103                    if ($facebook_user['id'] != 0) { // User is logged into Facebook
    108                    
    109104                        $logged_into_facebook = true;
    110                    
    111105                        if (!isset($facebook_user['email'])) {
    112                             _e('Could not log you in using Facebook. You must authorize the app to allow it to use your email address for validation', 'wp-bb');
    113                             exit();
     106                            ?>
     107                            <div class="wpbb-message-failure">
     108                                <?php
     109                                _e('Could not log you in using Facebook. You must authorize the app to allow it to use your email address for validation', 'wp-bb');
     110                                ?>
     111                            </div>
     112                            <?php
     113                            wpbb_exit();
    114114                        }
    115                        
    116115                        $email_exists = email_exists($facebook_user['email']);
    117                        
    118116                        if ($email_exists === false) {
    119                             _e('You must register for an account using Wordpress or Facebook before logging in.', 'wp-bb');
    120                             exit();
    121                         }
    122                        
     117                            ?>
     118                            <div class="wpbb-message-failure">
     119                                <?php
     120                                _e('You must register for an account using Wordpress or Facebook before logging in.', 'wp-bb');
     121                                ?>
     122                            </div>
     123                            <?php
     124                            wpbb_exit();
     125                        }
    123126                        ?>
    124                        
    125127                        <h2 class="wpbb-centered-bold">
    126                        
    127                         <?php _e('Login to Wordpress', 'wp-bb'); ?>
    128                        
    129                         </h2><br />
    130                        
    131                         <div class="wpbb-centered">     
    132                        
    133                         <?php printf(__('Thankyou for logging in to Facebook, %s!'), $facebook_user['name']); ?>
    134                            
    135                         <br /><br />
    136                            
    137                         <?php _e('Please now enter the password for your Wordpress account you registered using Facebook.', 'wp-bb'); ?>
    138                        
    139                         <br /><br />
    140                        
    141                         <?php
    142                        
    143                         $forum_page_url = get_page($forum_page);
    144                        
    145                         $args = array(
    146                             'echo' => true,
    147                             'redirect' => $forum_page_url->guid,
    148                             'remember' => true,
    149                             'value_username' => $facebook_user['name'],
    150                             'value_remember' => 1
    151                         );
    152                        
    153                         $user = get_user_by('email', $facebook_user['email']);
    154                        
    155                         $access_token = wp_strip_all_tags($para['access_token']);
    156                        
    157                         $add_user_facebook_meta = update_user_meta($user->ID, 'wpbb_facebook_access_token', $access_token);
    158                                                
    159                         wp_login_form($args);
    160 
    161                         ?>
     128                            <?php _e('Login to Wordpress', 'wp-bb'); ?>
     129                        </h2>
     130                        <br />
     131                        <div class="wpbb-centered">
     132                            <?php printf(__('Thankyou for logging in to Facebook, %s!'), $facebook_user['name']); ?>
     133                            <br /><br />
     134                            <?php _e('Please now enter the password for your Wordpress account you registered using Facebook.', 'wp-bb'); ?><br /><br /><?php
     135                            $forum_page_url = get_page($forum_page);
     136                            $args = array(
     137                                'echo' => true,
     138                                'redirect' => $forum_page_url->guid,
     139                                'remember' => true,
     140                                'value_username' => $facebook_user['name'],
     141                                'value_remember' => 1
     142                            );
     143                            $user = get_user_by('email', $facebook_user['email']);
     144                            $access_token = wp_strip_all_tags($para['access_token']);
     145                            $add_user_facebook_meta = update_user_meta($user->ID, 'wpbb_facebook_access_token', $access_token);             
     146                            wp_login_form($args);
     147                            ?>
    162148                        </div>
    163149                        <?php
    164                        
    165150                    } else {
    166                    
    167151                        _e('Please login to Facebook', 'wp-bb');
    168                
    169152                    }               
    170153                }
    171154            } else { // Possible CSRF victim
    172    
    173                 _e('There was an error logging you into Facebook. Please try again', 'wp-bb');
    174                 exit();
     155                ?>
     156                <div class="wpbb-message-failure">
     157                    <?php
     158                    _e('There was an error logging you into Facebook. Please try again', 'wp-bb');
     159                    ?>
     160                </div>
     161                <?php
     162                wpbb_exit();
    175163            }
    176164        } else { // State was not provided
    177             _e('You must provide a state (a random string of variable length) in your Facebook Settings');
    178             exit();
     165            ?>
     166            <div class="wpbb-message-failure">
     167                <?php
     168                _e('You must provide a state (a random string of variable length) in your Facebook Settings');
     169                ?>
     170            </div>
     171            <?php
     172            wpbb_exit();
    179173        }
    180174    }
     
    221215    $password = $data['registration']['password'];
    222216    $email = $data['registration']['email'];
    223    
    224     $create_user = wp_create_user($username, $password, $email);
     217    $facebook_options = get_option('wpbb_facebook_options');
     218    $role = $facebook_options['facebook_default_role'];
     219   
     220    //$create_user = wp_create_user($username, $password, $email);
     221    $create_user = wp_insert_user(array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'role' => $role));
    225222   
    226223    if (is_wp_error($create_user)) {
    227    
    228224        $errors = $create_user->get_error_messages();
    229        
    230         var_dump($errors);
    231    
    232225        foreach ($errors as $err) {
    233             echo $err;
    234         }
    235        
    236         exit();
    237        
     226            wpbb_goback1('facebook-register-uname-exists', NULL);
     227            ?>
     228            <div class="wpbb-message-failure">
     229                <?php
     230                echo $err;
     231                ?>
     232            </div>
     233            <?php
     234        }
     235        wpbb_exit();
    238236    } else {
    239    
    240         _e('Thankyou for registering. Please login with your Facebook username and password you just created', 'wp-bb');
    241         // Display login form
    242         wp_login_form();
    243        
     237        ?>
     238        <div class="wpbb-message-success">
     239            <?php
     240            _e('Thankyou for registering. Please login with your Facebook username and password you just created', 'wp-bb');
     241            ?>
     242        </div>
     243        <div class="wpbb-centered">
     244            <?php
     245            wp_login_form();
     246            ?>
     247        </div>
     248        <?php
     249        wpbb_exit();
    244250    }
    245251}
  • wp-bulletin-board/tags/1.0.2/php/twitter/wpbb-twitter.php

    r603518 r607181  
    44    Displays Twitter Follow button if twitter is enabled
    55*/
    6    
     6
     7
     8$twitter_username = "http://api.twitter.com/1/users/show.xml?screen_name=".$wpbb_twitter_options['twitter_account'];
     9
     10if (!@fopen($twitter_username, 'r')) {
     11    ?>
     12    <div class="wpbb-message-failure">
     13        <p>Invalid twitter username supplied. Please enter a correct username or disable twitter support.</p>
     14    </div>
     15    <?php
     16}
     17
    718
    819if (count($_GET) == 0) {
  • wp-bulletin-board/tags/1.0.2/php/wpbb-all-messages.php

    r604868 r607181  
    11<?php
    22
    3 wpbb_goback1('all-messages', NULL);
    4 
    5 $user_id = get_current_user_id();
    6 
    7 if ($user_id == 0) {
    8     ?>
    9     <div class="wpbb-centered-bold">
    10         <?php
    11             _e('Please register or login to view this page', 'wp-bb');
    12             wpbb_exit();
    13         ?>
    14        
    15     </div>
    16     <?php
    17 }
     3$user_id = wpbb_is_user_logged_in();
    184
    195global $wpdb;
     6   
     7?>
     8<h1 id="wpbb-h-1" class="wpbb-centered-bold">
     9    <?php _e('My Messages', 'wp-bb'); ?>
     10</h1>
     11   
     12<a href='<?php echo add_query_arg(array('message' => 'to'), wpbb_permalink()); ?>'>
     13    <p class="wpbb-centered">
     14            <?php _e('Compose Message', 'wp-bb'); ?>
     15    </p>
     16</a>
     17   
     18<?php
    2019
    21 // Viewing all messages
    22 if ((isset($_GET['messages']))
    23     && ($_GET['messages'] == 'all')
    24     && (count($_GET) == 1 || count($_GET) == 2)) {
    25    
    26     ?>
    27     <h2 class="wpbb-centered-bold">
    28         <?php _e('My Messages', 'wp-bb'); ?>
    29     </h2>
    30    
    31     <a href='<?php echo add_query_arg(array('message' => 'to'), get_permalink()); ?>'>
    32         <p class="wpbb-centered">
    33             <?php _e('Compose Message', 'wp-bb'); ?>
    34         </p>
    35     </a>
    36    
    37     <?php
    38    
    39         if ($user_id != 0) {
    40             $options = get_option('wpbb_options');
    41             $topics_per_page = $options['topics_per_page'];
    42             if (isset($_GET['current_page'])) {
    43                 if ($_GET['current_page'] == 0) {
    44                     $current_page = 1;
    45                     $start = 0;
    46                     $limit = $topics_per_page;
    47                 } else if ($_GET['current_page'] == 1) {
    48                     $current_page = 1;
    49                     $start = 0;
    50                     $limit = $topics_per_page;
    51                 } else {
    52                     $current_page = $_GET['current_page'];
    53                     $start = $current_page * $topics_per_page - $topics_per_page;
    54                     $limit = $start + $topics_per_page;
    55                 }
    56             }
    57             $total_msgs = $wpdb->get_var("SELECT COUNT(*) as 'Messages' FROM ".MESSAGES_TABLE." WHERE `to` = $user_id;");
    58             $msgs = false;
    59             if ($total_msgs > 0) {
    60                 wpbb_pagination(NULL, $current_page, $start, $limit, $total_msgs, $topics_per_page, true, 'messages');
    61                 $msgs = $wpdb->get_results("SELECT * FROM ".MESSAGES_TABLE." WHERE `to` = $user_id ORDER BY sent DESC LIMIT $start, $limit;");
    62             }
    63             if ($msgs) {
    64                 ?>
    65                 <table class="wpbb-table">
    66        
    67                 <th><?php _e('From', 'wp-bb'); ?></th>
    68                 <th><?php _e('Subject', 'wp-bb'); ?></th>
    69                 <th><?php _e('Read', 'wp-bb'); ?></th>
    70                 <th><?php _e('Sent', 'wp-bb'); ?></th>
    71                 <th><?php _e('Action', 'wp-bb'); ?></th>
    72                
     20if ($user_id != 0) {
     21    $options = get_option('wpbb_options');
     22    $topics_per_page = $options['topics_per_page'];
     23    if (isset($_GET['current_page'])) {
     24        if ($_GET['current_page'] == 0) {
     25            $current_page = 1;
     26            $start = 0;
     27            $limit = $topics_per_page;
     28        } else if ($_GET['current_page'] == 1) {
     29            $current_page = 1;
     30            $start = 0;
     31            $limit = $topics_per_page;
     32        } else {
     33            $current_page = $_GET['current_page'];
     34            $start = $current_page * $topics_per_page - $topics_per_page;
     35            $limit = $start + $topics_per_page;
     36        }
     37    }
     38    $total_msgs = $wpdb->get_var("SELECT COUNT(*) as 'Messages' FROM ".MESSAGES_TABLE." WHERE `to` = $user_id;");
     39    $msgs = false;
     40    if (($total_msgs > 0) && ($total_msgs > $topics_per_page)) {
     41        wpbb_pagination(NULL, $current_page, $start, $limit, $total_msgs, $topics_per_page, true, 'messages');
     42        $msgs = $wpdb->get_results("SELECT * FROM ".MESSAGES_TABLE." WHERE `to` = $user_id ORDER BY sent DESC LIMIT $start, $limit;");
     43    }
     44    if ($msgs) {
     45        wpbb_goback1('all-messages', NULL);
     46        ?>
     47        <table class="wpbb-table">
     48            <th><?php _e('From', 'wp-bb'); ?></th>
     49            <th><?php _e('Subject', 'wp-bb'); ?></th>
     50            <th><?php _e('Read', 'wp-bb'); ?></th>
     51            <th><?php _e('Sent', 'wp-bb'); ?></th>
     52            <th><?php _e('Action', 'wp-bb'); ?></th>
    7353                <?php
    7454                foreach ($msgs as $msg) {
     
    8363               
    8464                        <td>
    85                             <a href='<?php echo add_query_arg(array('messages' => 'all', 'view' => $msg->id)); ?>'>
     65                            <a href='<?php echo add_query_arg(array('messages' => 'all', 'view' => $msg->id), wpbb_permalink()); ?>'>
    8666                                <?php printf(__('%s'), $msg->subject); ?>
    8767                            </a>
     
    9474                        </td>
    9575                        <td>
    96                             <a href='<?php echo add_query_arg(array('delete_msg' => $msg->id)); ?>'>
     76                            <a href='<?php echo add_query_arg(array('messages' => 'all', 'delete_msg' => $msg->id), wpbb_permalink()); ?>'>
    9777                                <?php _e('Delete', 'wp-bb'); ?>
     78                            </a>
     79                            <a href="<?php echo add_query_arg(array('message' => $msg->from), wpbb_permalink()); ?>">
     80                                <?php _e('Reply', 'wp-bb'); ?>
    9881                            </a>
    9982                        </td
     
    10588            <?php
    10689        } else {
     90            wpbb_goback1('all-messages', NULL);
    10791            ?>
    108             <div class="wpbb-centered-bold">
    109                 <?php _e('You do not have any messages', 'wp-bb'); ?>
     92            <div class="wpbb-message-failure">
     93                <?php printf(__('You do not have any messages. <a href="%s">Compose one?</a>'), add_query_arg(array('message' => 'to'), wpbb_permalink())); ?>
    11094            </div>
    11195        <?php
    11296        }
    113     }   
    114 }
    115 
    116 
    117 // Deleting a message
    118 if ((isset($_GET['delete_msg']))
    119     && (isset($_GET['messages']))
    120     && (count($_GET) === 2)) {
    121    
    122     $id = absint($_GET['delete_msg']);
    123        
    124     $delete_message = $wpdb->query("DELETE FROM ".MESSAGES_TABLE." WHERE id = $id;");
    125    
    126     if ($delete_message === false) {
    127    
    128         ?>
    129        
    130         <div class="wpbb-centered-bold">
    131        
    132             <?php _e('Error deleting message. Please try again', 'wp-bb'); ?>
    133        
    134         </div>
    135        
    136         <?php
    137        
    138     } else {
    139    
    140         ?>
    141        
    142         <div class="wpbb-centered-bold">
    143    
    144         <?php _e('Thankyou. That message has been deleted successfully.', 'wp-bb'); ?>
    145        
    146         </div>
    147        
    148         <?php
    14997    }
    150 }
    151 
    152 
    15398?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-create-topic.php

    r604652 r607181  
    44   
    55    $forum_id = absint($_GET['forum']);
     6   
     7    wpbb_check_exists('forum', $forum_id);
    68   
    79    if ((isset($_GET['forum'])) && (!isset($_GET['subforum']))) {
  • wp-bulletin-board/tags/1.0.2/php/wpbb-delete-topic.php

    r603518 r607181  
    11<?php
     2    wpbb_goback1();
    23
    34    // Check user has permissions to delete topics or posts in this forum
     
    6566                ?>
    6667                <div class="wpbb-centered-bold">
    67                     <?php printf(__('You decided not to delete topic ID %s. You will be redirected'), $topic_id); ?>
     68                    <?php
     69                        printf(__('You decided not to delete topic ID %s. Click "Go back" to return to the topic.'), $topic_id);
     70                    ?>
    6871                </div>
    6972                <?php
     
    7578        if ($changed_mind !== true && $success !== true) {
    7679            ?>
    77             <h2 class="wpbb-centered-bold"><?php _e('Confirm Topic Delete Request', 'wp-bb'); ?></h2>
    78             <div class="wpbb-centered-bold">
    79                 <?php printf(__('Are you sure you want to delete topic ID %s ? (WARNING: All posts in this topic will be deleted. This proccess cannot be undone!)'), $topic_id); ?>
     80            <h1 id="wpbb-h-1" class="wpbb-centered-bold"><?php _e('Confirm Topic Delete Request', 'wp-bb'); ?></h1>
     81            <div class="wpbb-message-warning">
     82                <?php printf(__('Are you sure you want to delete topic ID %s? WARNING: All posts in this topic will be deleted. This proccess cannot be undone!'), $topic_id); ?>
    8083            </div>
    8184            <form method='POST' action='#' style='text-align:center;'>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-edit-topic.php

    r604652 r607181  
    11<?php
    22
    3     if ((isset($_GET['topic'])) && (!isset($_GET['post']))) {
    4         $is_topic = true;
    5         $is_post = false;
    6     }
    7     if ((isset($_GET['post'])) && (isset($_GET['topic']))) {
    8         $is_post = true;
    9         $is_topic = false;
    10     }
    11    
    12     $forum_id = absint($_GET['forum']);
    13    
    14     $user_id = get_current_user_id();
    15    
    16     $topic_id = absint($_GET['topic']);
    17     if (isset($_GET['post'])) {
    18         $post_id = absint($_GET['post']);
    19     }
    20    
    21     $view_permissions = wpbb_user_has_permission($user_id, $forum_id);
    22     if ($view_permissions === false) {
    23         wpbb_goback1('edit-topic-denied', NULL);
    24         ?>
    25         <div class="wpbb-message-failure">
    26             <?php _e('You do not have the required permissions to view this forum!', 'wp-bb'); ?>
    27         </div>
    28         <?php
    29         wpbb_exit();
    30     } else {
    31    
    32         $edit_permissions = wpbb_user_has_permission($user_id, $forum_id, 'edit');
    33        
    34         if ($is_topic === true) {
    35        
    36             $editing_own_topic = $wpdb->get_var("SELECT id FROM ".TOPIC_TABLE." WHERE id = $topic_id AND author = $user_id;");
    37            
    38             // If user does not have edit permissions and is not editing own topic then they are trying to edit someone elses topic!
    39             if (($edit_permissions === false) && (!$editing_own_topic)) {
    40                 wpbb_goback1('edit-other-topic-denied', NULL);
     3// Display a "Go back" link
     4wpbb_goback1();
     5
     6$is_post = isset($_GET['post']) ? true : false;
     7   
     8$forum_id = absint($_GET['forum']);
     9   
     10$user_id = get_current_user_id();
     11   
     12$topic_id = absint($_GET['topic']);
     13if (isset($_GET['post'])) {
     14    $post_id = absint($_GET['post']);
     15}
     16   
     17$view_permissions = wpbb_user_has_permission($user_id, $forum_id);
     18if ($view_permissions === false) {
     19    ?>
     20    <div class="wpbb-message-failure">
     21        <?php _e('You do not have the required permissions to view this forum!', 'wp-bb'); ?>
     22    </div>
     23    <?php
     24    wpbb_exit();
     25} else {
     26   
     27    $edit_permissions = wpbb_user_has_permission($user_id, $forum_id, 'edit');
     28       
     29    if ($is_post === false) {
     30       
     31        $editing_own_topic = $wpdb->get_var("SELECT id FROM ".TOPIC_TABLE." WHERE id = $topic_id AND author = $user_id;");
     32           
     33        // If user does not have edit permissions and is not editing own topic then they are trying to edit someone elses topic!
     34        if (($edit_permissions === false) && (!$editing_own_topic)) {
     35            ?>
     36            <div class="wpbb-message-failure">
     37                <?php _e('You do not have the required permissions to edit other peoples topics in this forum!', 'wp-bb'); ?>
     38            </div>
     39            <?php
     40            wpbb_exit();
     41        }
     42    } else if ($is_post === true) {
     43       
     44        $editing_own_post = $wpdb->get_var("SELECT id FROM ".POST_TABLE." WHERE id = $post_id AND author = $user_id;");
     45           
     46        // If user does not have edit permissions and is not editing own post then they are trying to edit someone elses topic!
     47        if (($edit_permissions === false) && (!$editing_own_post)) {
     48            ?>
     49            <div class="wpbb-message-failure">
     50                <?php _e('You do not have the required permissions to edit other peoples posts in this forum!', 'wp-bb'); ?>
     51            </div>
     52            <?php
     53            wpbb_exit();
     54        }
     55    }
     56}
     57
     58if ($is_post === false) {
     59    // Form submission
     60    if (isset($_POST['wpbbtopiceditsubmit'])) {
     61        if (empty($_POST['wpbbtopiccontent']) || empty($_POST['wpbbtopicname'])) {
     62            ?>
     63            <div class="wpbb-message-failure">
     64                <?php _e('You must enter a title and some content for your topic', 'wp-bb'); ?>
     65            </div>
     66            <?php
     67            wpbb_exit();   
     68        }
     69           
     70        // Sanitize topic title
     71        $topic_name = wp_strip_all_tags($_POST['wpbbtopicname']);
     72           
     73        if (is_numeric($_POST['wpbbauthorname'])) { // ID supplied
     74            $topic_author = absint($_POST['wpbbauthorname']);
     75
     76        } else if (is_string($_POST['wpbbauthorname'])) { // Name supplied
     77            $topic_author_name = wp_strip_all_tags($_POST['wpbbauthorname']);
     78            $topic_author = wpbb_parse_author_name(NULL, $topic_author_name);
     79        }
     80       
     81        $topic_content = wpbb_strip_tags($_POST['wpbbtopiccontent']);
     82       
     83        if (($_POST['wpbbtopicforum'] == 'yes') && ($_POST['wpbbtopicsubforum'] == 'no')) {
     84            $topic_forum = absint($_POST['wpbbtopicforumname']);
     85            // Check category exists otherwise do not allow submission to proceed
     86            $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_forum;");
     87            if ($exists === false) {
    4188                ?>
    4289                <div class="wpbb-message-failure">
    43                     <?php _e('You do not have the required permissions to edit other peoples topics in this forum!', 'wp-bb'); ?>
     90                    <?php _e('That category does not exist. Please make sure you choose a valid category.', 'wp-bb'); ?>
    4491                </div>
    4592                <?php
    4693                wpbb_exit();
    4794            }
    48            
    49         } else if ($is_post === true) {
    50        
    51             $editing_own_post = $wpdb->get_var("SELECT id FROM ".POST_TABLE." WHERE id = $post_id AND author = $user_id;");
    52            
    53             // If user does not have edit permissions and is not editing own post then they are trying to edit someone elses topic!
    54             if (($edit_permissions === false) && (!$editing_own_post)) {
    55                 wpbb_goback1('edit-other-post-denied', NULL);
     95            $topic_subforum = 0;
     96        } else if (($_POST['wpbbtopicsubforum'] == 'yes') && ($_POST['wpbbtopicforum'] == 'no')) {
     97            $topic_subforum = absint($_POST['wpbbtopicsubforumname']);
     98            // Check forum exists otherwise do not allow submission to proceed
     99            $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_subforum;");
     100            if ($exists === false) {
    56101                ?>
    57102                <div class="wpbb-message-failure">
    58                     <?php _e('You do not have the required permissions to edit other peoples posts in this forum!', 'wp-bb'); ?>
     103                    <?php _e('That forum does not exist. Please make sure you choose a valid forum.', 'wp-bb'); ?>
    59104                </div>
    60105                <?php
    61106                wpbb_exit();
    62107            }
    63         }
    64     }
    65    
    66     //if (isset($_GET['topic']) && (!isset($_GET['post']))) { // It's a topic
    67     if ($is_topic === true) {
    68        
    69        
    70         // Form submission
    71         if (isset($_POST['wpbbtopiceditsubmit'])) {
    72            
    73             if (empty($_POST['wpbbtopiccontent']) || empty($_POST['wpbbtopicname'])) {
    74                 wpbb_goback1('edit-topic-submit-error', NULL);
    75                 ?>
    76                 <div class="wpbb-message-failure">
    77                     <?php _e('You must enter a title and some content for your topic', 'wp-bb'); ?>
    78                 </div>
    79                 <?php
    80                 wpbb_exit();
    81                
    82             }
    83            
    84             // Sanitize topic title
    85             $topic_name = wp_strip_all_tags($_POST['wpbbtopicname']);
    86            
    87             // Sanitize author name
    88             $topic_author_name = wp_strip_all_tags($_POST['wpbbauthorname']);
    89            
    90             // Get ID back from the sanitized author name
    91             $topic_author = wpbb_parse_author_name(NULL, $topic_author_name);
    92            
    93             $topic_content = wpbb_strip_tags($_POST['wpbbtopiccontent']);
    94            
    95             if (($_POST['wpbbtopicforum'] == 'yes') && ($_POST['wpbbtopicsubforum'] == 'no')) {
    96                 $topic_forum = absint($_POST['wpbbtopicforumname']);
    97                 // Check category exists otherwise do not allow submission to proceed
    98                 $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_forum;");
    99                 if ($exists === false) {
    100                     wpbb_goback1('edit-topic-cat-exists-error', NULL);
    101                     ?>
    102                     <div class="wpbb-message-failure">
    103                         <?php _e('That category does not exist. Please make sure you choose a valid category.', 'wp-bb'); ?>
    104                     </div>
    105                     <?php
    106                     wpbb_exit();
    107                 }
    108                 $topic_subforum = 0;
    109             } else if (($_POST['wpbbtopicsubforum'] == 'yes') && ($_POST['wpbbtopicforum'] == 'no')) {
    110                 $topic_subforum = absint($_POST['wpbbtopicsubforumname']);
    111                 // Check forum exists otherwise do not allow submission to proceed
    112                 $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_subforum;");
    113                 if ($exists === false) {
    114                     wpbb_goback1('edit-topic-forum-exists-error', NULL);
    115                     ?>
    116                     <div class="wpbb-message-failure">
    117                         <?php _e('That forum does not exist. Please make sure you choose a valid forum.', 'wp-bb'); ?>
    118                     </div>
    119                     <?php
    120                     wpbb_exit();
    121                 }
    122                 $topic_forum = 0;
    123             } else if (($_POST['wpbbtopicforum'] == 'no') && ($_POST['wpbbtopicsubforum'] == 'no')) {
    124                 wpbb_goback1('edit-topic-select-cat-error', NULL);
    125                 ?>
    126                 <div class="wpbb-message-failure">
    127                     <?php _e('You must select a category or forum for the topic to be posted in.', 'wp-bb'); ?>
    128                 </div>
    129                 <?php
    130                 wpbb_exit();
    131             }
    132            
    133             if (isset($_POST['wpbbtopicstatus'])) {
    134                 $topic_status = implode(",", (array) $_POST['wpbbtopicstatus']);
    135             } else {
    136                 $topic_status = "";
    137             }
    138            
    139             $data = array(
    140                 'name' => $topic_name,
    141                 'author' => $topic_author,
    142                 'content' => $topic_content,
    143                 'forum' => $topic_forum,
    144                 'subforum' => $topic_subforum,
    145                 'status' => $topic_status
    146             );
    147            
    148             $save_topic = $wpdb->update(TOPIC_TABLE, $data, array('id' => $topic_id));
    149            
    150             if ($save_topic !== false) {
    151                 wpbb_goback1('edit-topic-success', NULL);
    152                 ?>
    153                 <div class="wpbb-message-success">
    154                     <?php printf(__('Topic ID %s edited successfully'), $topic_id); ?>
    155                 </div>
    156                 <?php
    157             } else {
    158                 wpbb_goback1('edit-topic-error', NULL);
    159                 ?>
    160                 <div class="wpbb-message-failure">
    161                     <?php printf(__('There was an error editing topic ID %s'), $topic_id); ?>
    162                 </div>
    163                 <?php
    164             }
    165         }
    166        
    167         // End Form Submission
    168        
    169         $get_topic = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE id = $topic_id;");
    170        
    171         if ($get_topic !== false) {
    172             ?>
    173             <table class="wpbb-table">
    174                 <form method='POST' action='#'>
    175             <?php
    176             foreach ($get_topic as $topic) {
    177            
    178                 if (strpos($topic->status, 'locked') !== false) $locked = true; else $locked = false;
    179                 if (strpos($topic->status, 'sticky') !== false) $sticky = true; else $sticky = false;
    180                 if (strpos($topic->status, 'poll') !== false) $poll = true; else $poll = false;
    181                
    182                 $topic_author_name = wpbb_parse_author_name($topic->author);
    183                
    184                 ?>
    185                 <tr>
    186                     <th><?php _e('Name', 'wp-bb'); ?></th>
    187                     <td>
    188                         <input name='wpbbtopicname' maxlength='45' size='25' value='<?php echo $topic->name; ?>' />
    189                     </td>
    190                 </tr>
    191                 <?php
    192                 if (current_user_can('manage_options')) {
     108            $topic_forum = 0;
     109        } else if (($_POST['wpbbtopicforum'] == 'no') && ($_POST['wpbbtopicsubforum'] == 'no')) {
     110            ?>
     111            <div class="wpbb-message-failure">
     112                <?php _e('You must select a category or forum for the topic to be posted in.', 'wp-bb'); ?>
     113            </div>
     114            <?php
     115            wpbb_exit();
     116        }
     117        if (isset($_POST['wpbbtopicstatus'])) {
     118            $topic_status = implode(",", (array) $_POST['wpbbtopicstatus']);
     119        } else {
     120            $topic_status = "";
     121        }
     122        $data = array(
     123            'name' => $topic_name,
     124            'author' => $topic_author,
     125            'content' => $topic_content,
     126            'forum' => $topic_forum,
     127            'subforum' => $topic_subforum,
     128            'status' => $topic_status
     129        );
     130        $save_topic = $wpdb->update(TOPIC_TABLE, $data, array('id' => $topic_id));
     131        if ($save_topic !== false) {
     132            ?>
     133            <div class="wpbb-message-success">
     134                <?php printf(__('Topic ID %s edited successfully'), $topic_id); ?>
     135            </div>
     136            <?php
     137        } else {
     138            ?>
     139            <div class="wpbb-message-failure">
     140                <?php printf(__('There was an error editing topic ID %s'), $topic_id); ?>
     141            </div>
     142            <?php
     143        }
     144    }
     145    // End Form Submission
     146    $get_topic = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE id = $topic_id;");
     147    if ($get_topic !== false) {
     148        ?>
     149        <table class="wpbb-table">
     150            <form method='POST' action='#'>
     151                <?php
     152                foreach ($get_topic as $topic) {
     153                    $sticky = (strpos($topic->status, 'sticky') !== false) ? true : false;
     154                    $locked = (strpos($topic->status, 'locked') !== false) ? true : false;
     155                    $topic_author_name = wpbb_parse_author_name($topic->author);
    193156                    ?>
    194157                    <tr>
     158                        <th><?php _e('Name', 'wp-bb'); ?></th>
     159                        <td>
     160                            <input name='wpbbtopicname' maxlength='45' size='25' value='<?php echo $topic->name; ?>' />
     161                        </td>
     162                    </tr>
     163                    <?php
     164                    if (current_user_can('manage_options')) {
     165                        ?>
     166                        <tr>
    195167                        <th><?php _e('Author', 'wp-bb'); ?></th>
    196168                        <td>
     
    209181                    <?php
    210182                }
    211                
    212                 if ($topic->forum > 0) $is_forum = true; else $is_forum = false;
    213                
    214                 if ($topic->subforum > 0) $is_subforum = true; else $is_subforum = false;
    215                
     183                $is_forum = ($topic->forum > 0) ? true: false;
     184                $is_subforum = ($topic->subforum > 0) ? true : false;
    216185                // Forums
    217186                ?>
     
    280249                    <th><?php _e('Status', 'wp-bb'); ?></th>
    281250                    <td>
    282                         <input type='checkbox' name='wpbbtopicstatus[]' value='locked' ".checked($locked, true, false)."/> <?php _e('Locked', 'wp-bb'); ?>
    283                         <input type='checkbox' name='wpbbtopicstatus[]' value='sticky' ".checked($sticky, true, false)."/> <?php _e('Sticky', 'wp-bb'); ?>
     251                        <input type='checkbox' name='wpbbtopicstatus[]' value='locked' <?php echo checked($locked, true, false); ?>/> <?php _e('Locked', 'wp-bb'); ?>
     252                        <input type='checkbox' name='wpbbtopicstatus[]' value='sticky' <?php echo checked($sticky, true, false); ?>/> <?php _e('Sticky', 'wp-bb'); ?>
    284253                    </td>
    285254                <tr>
     
    292261        ?>
    293262        </form>
     263    </table>
     264    <?php
     265    } else {
     266        ?>
     267        <div style='text-align:center; font-color:red;'>
     268            <?php printf(__('There was an error fetching topic ID %s. Please try again.'), $topic_id); ?>
     269        </div>
     270        <?php
     271        wpbb_exit();
     272    }
     273} else if ($is_post === true) { // It's a post 
     274    // Post edit submission
     275    if (isset($_POST['wpbbeditpostsubmit'])) {
     276       
     277        $post_id = absint($_GET['post']);
     278           
     279        // If a topic wasn't chosen or content wasn't entered produce an error
     280        if (empty($_POST['wpbbposttopic']) || empty($_POST['wpbbpostcontent'])) {
     281            ?>
     282            <div class="wpbb-message-failure">
     283                <?php _e('You must choose a topic for the post and content must not be empty!', 'wp-bb'); ?>
     284            </div>
     285            <?php
     286            wpbb_exit();
     287        }
     288           
     289        if (is_numeric($_POST['wpbbpostauthor'])) {
     290            // Strip all tags from the authors name
     291            $post_author_name = wp_strip_all_tags($_POST['wpbbpostauthor']);
     292            // Retrieve ID back from username
     293            $post_author = wpbb_parse_author_name(NULL, $post_author_name);
     294        } else {
     295            $post_author = absnt($_POST['wpbbpostauthor']);
     296        }
     297           
     298        $post_content = wpbb_strip_tags($_POST['wpbbpostcontent']);
     299       
     300        $post_topic = absint($_POST['wpbbposttopic']);
     301           
     302        $data = array(
     303            'author' => $post_author,
     304            'topic' => $post_topic,
     305            'text' => $post_content
     306        );
     307           
     308        $update_post = $wpdb->update(POST_TABLE, $data, array('id' => $post_id));
     309           
     310        $wpdb->show_errors();
     311               
     312        if ($update_post === false) { // Db error
     313            ?>
     314            <div class="wpbb-message-failure">
     315                <?php _e('There was an error attempting to save your post, please try again.', 'wp-bb'); ?>
     316            </div>
     317            <?php
     318        } else { // Success
     319            ?>
     320            <div class="wpbb-message-success">
     321                <?php _e('Thankyou, your post has been saved successfully', 'wp-bb'); ?>
     322            </div>
     323            <?php
     324        }
     325    }
     326    // End post edit submission
     327       
     328    // Attempt to retrieve the post from the db
     329    $get_post = $wpdb->get_results("SELECT * FROM ".POST_TABLE." WHERE id = $post_id;");
     330       
     331    // If there wasn't an error...
     332    if ($get_post !== false) {
     333        ?>
     334        <table class="wpbb-table">
     335            <form method='POST' action='#'>
     336                <?php
     337                foreach ($get_post as $post) {
     338               
     339                $post_author_name = wpbb_parse_author_name($post->author);
     340               
     341                if (current_user_can('manage_options')) {
     342                    ?>
     343                    <tr>
     344                        <th><?php _e('Author', 'wp-bb'); ?></th>
     345                        <td>
     346                            <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' />
     347                        </td>
     348                    </tr>
     349                    <?php
     350                } else {
     351                    ?>
     352                    <tr>
     353                        <th><?php _e('Author', 'wp-bb'); ?></th>
     354                        <td>
     355                            <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' disabled='disabled' />
     356                        </td>
     357                    </tr>
     358                    <?php
     359                }
     360                ?>
     361                <tr>
     362                    <th><?php _e('Topic', 'wp-bb'); ?></th>
     363                    <td>
     364                        <input name='wpbbposttopic' maxlength='45' size='24' value='<?php echo $post->topic; ?>' />
     365                    </td>
     366                </tr>
     367                <tr>
     368                    <th><?php _e('Content', 'wp-bb'); ?></th>
     369                    <td>
     370                        <?php wp_editor($post->text, 'wpbbpostcontent'); ?>
     371                    </td>
     372                </tr>
     373                <tr>
     374                    <th></th>
     375                    <td>
     376                        <input type='submit' name='wpbbeditpostsubmit' value='<?php _e('Save Changes', 'wp-bb'); ?>' />
     377                    </td>
     378                </tr>
     379                <?php
     380            }
     381            ?>
     382            </form>
    294383        </table>
    295384        <?php
    296         } else {
    297             wpbb_goback1('edit-get-topic-error', NULL);
    298             ?>
    299             <div style='text-align:center; font-color:red;'>
    300                 <?php printf(__('There was an error fetching topic ID %s. Please try again.'), $topic_id); ?>
    301             </div>
    302             <?php
    303             wpbb_exit();
    304         }
    305     } else if ($is_post === true) { // It's a post
    306            
    307         // Post edit submission
    308         if (isset($_POST['wpbbeditpostsubmit'])) {
    309        
    310             $post_id = absint($_GET['post']);
    311            
    312             // If a topic wasn't chosen or content wasn't entered produce an error
    313             if (empty($_POST['wpbbposttopic']) || empty($_POST['wpbbpostcontent'])) {
    314                 wpbb_goback1('edit-post-empty-error', NULL);
    315                 ?>
    316                 <div class="wpbb-message-failure">
    317                     <?php _e('You must choose a topic for the post and content must not be empty!', 'wp-bb'); ?>
    318                 </div>
    319                 <?php
    320                 wpbb_exit();
    321             }
    322            
    323             // Strip all tags from the authors name
    324             $post_author_name = wp_strip_all_tags($_POST['wpbbpostauthor']);
    325            
    326             // Use the sanitized authors name to retrive the ID of the author to then add to the DB
    327             $post_author = wpbb_parse_author_name(NULL, $post_author_name);
    328            
    329             // This function uses the strip_tags function only difference being you have to edit the tags you want to skip once.
    330             $post_content = wpbb_strip_tags($_POST['wpbbpostcontent']);
    331            
    332             $post_topic = absint($_POST['wpbbposttopic']);
    333            
    334             $data = array(
    335                 'author' => $post_author,
    336                 'topic' => $post_topic,
    337                 'text' => $post_content
    338             );
    339            
    340             $update_post = $wpdb->update(POST_TABLE, $data, array('id' => $post_id));
    341            
    342             $wpdb->show_errors();
    343                
    344             if ($update_post === false) { // Db error
    345                 wpbb_goback1('edit-post-submit-error', NULL);
    346                 ?>
    347                 <div class="wpbb-message-failure">
    348                     <?php _e('There was an error attempting to save your post, please try again.', 'wp-bb'); ?>
    349                 </div>
    350                 <?php
    351             } else { // Success
    352                 wpbb_goback1('edit-post-submit-success', NULL);
    353                 ?>
    354                 <div class="wpbb-message-success">
    355                     <?php _e('Thankyou, your post has been saved successfully', 'wp-bb'); ?>
    356                 </div>
    357                 <?php
    358             }
    359         }
    360         // End post edit submission
    361        
    362         // Attempt to retrieve the post from the db
    363         $get_post = $wpdb->get_results("SELECT * FROM ".POST_TABLE." WHERE id = $post_id;");
    364        
    365         // If there wasn't an error...
    366         if ($get_post !== false) {
    367             ?>
    368             <table class="wpbb-table">
    369                 <form method='POST' action='#'>
    370                     <?php
    371                     foreach ($get_post as $post) {
    372                
    373                     $post_author_name = wpbb_parse_author_name($post->author);
    374                
    375                     if (current_user_can('manage_options')) {
    376                         ?>
    377                         <tr>
    378                             <th><?php _e('Author', 'wp-bb'); ?></th>
    379                             <td>
    380                                 <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' />
    381                             </td>
    382                         </tr>
    383                         <?php
    384                     } else {
    385                         ?>
    386                         <tr>
    387                             <th><?php _e('Author', 'wp-bb'); ?></th>
    388                             <td>
    389                                 <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' disabled='disabled' />
    390                             </td>
    391                         </tr>
    392                         <?php
    393                     }
    394                     ?>
    395                     <tr>
    396                         <th><?php _e('Topic', 'wp-bb'); ?></th>
    397                         <td>
    398                             <input name='wpbbposttopic' maxlength='45' size='24' value='<?php echo $post->topic; ?>' />
    399                         </td>
    400                     </tr>
    401                     <tr>
    402                         <th><?php _e('Content', 'wp-bb'); ?></th>
    403                         <td>
    404                             <?php wp_editor($post->text, 'wpbbpostcontent'); ?>
    405                         </td>
    406                     </tr>
    407                     <tr>
    408                         <th></th>
    409                         <td>
    410                             <input type='submit' name='wpbbeditpostsubmit' value='<?php _e('Save Changes', 'wp-bb'); ?>' />
    411                         </td>
    412                     </tr>
    413                     <?php
    414                 }
    415                 ?>
    416                 </form>
    417             </table>
    418             <?php
    419             } else { // Error
    420                 wpbb_goback1('edit-post-get-error', NULL);
    421                 ?>
    422                 <div class="wpbb-message-failure">
    423                     <?php _e('There was an error retrieving the post. Please try again.', 'wp-bb'); ?>
    424                 </div>
    425                 <?php
    426                 wpbb_exit();
    427             }
    428         }
    429    
    430 
     385        } else { // Error
     386            ?>
     387            <div class="wpbb-message-failure">
     388                <?php _e('There was an error retrieving the post. Please try again.', 'wp-bb'); ?>
     389            </div>
     390            <?php
     391            wpbb_exit();
     392        }
     393    }
    431394?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-forum.php

    r604652 r607181  
    44    Checks if the plugin is deactivated
    55*/
     6
    67
    78// Since we're not in the admin area we must require the plugin.php file
     
    1617    ?>
    1718    <div style="text-align:center;font-weight:bold;color:red;">
    18         <?php 
     19        <?php
    1920            _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB', 'wp-bb');
    2021            wpbb_exit();
     
    2324    <?php
    2425}
    25 
     26   
    2627// Load WPBB Options
    2728$wpbb_options = get_option('wpbb_options');
     
    6364    && (!isset($_GET['method']))
    6465    && (!isset($_GET['state']))) {
     66    if ($wpbb_facebook_options['allow_facebook'] == 'yes') {
     67        require_once('facebook/wpbb-facebook.php');
     68    }
     69    require_once('wpbb-functions.php');
    6570    ?>
    6671    <div class="wpbb-centered-bold">
    6772        <?php
    68             printf(__('You must <a href="%s">Login</a> or <a href="%s">Register</a> to be able to view the forum!'), wp_login_url(), site_url('wp-login.php?action=register'));
     73            wpbb_is_user_logged_in();
    6974        ?>
    7075    </div>
    7176    <?php
    72     // Load facebook functionality if facebook is enabled
    73     if ($wpbb_facebook_options['allow_facebook'] == 'yes') {
    74         require_once('facebook/wpbb-facebook.php');
    75     }
    76     exit();
    7777}
    7878
     
    8080    if (current_user_can('manage_options')) {
    8181        ?>
    82         <div id="wpbb-admin-maintenance-reminder">
     82        <div class="wpbb-message-warning">
    8383        <?php _e('The board is currently in maintenance mode. To turn it off change Maintenance Mode in Settings -> WPBB Settings to "Off"', 'wp-bb'); ?>
    8484        </div>
     
    8686    } else {
    8787        ?>
    88         <div id="wpbb-maintenance-message">
     88        <div class="wpbb-message-warning">
    8989            <?php echo $wpbb_options['maintenance_message']; ?>
    9090        </div>
    9191        <?php
     92        if ($wpbb_facebook_options['allow_facebook'] == 'yes') {
     93            require_once('facebook/wpbb-facebook.php');
     94        }
     95        require_once('wpbb-functions.php');
     96        wpbb_footer();
    9297        wpbb_exit();
    9398    }
    9499}
    95100
    96 // Simple snippet to disallow any unrecognized get key/values
    97 $allowed_get_values = array(
    98     'forum',
    99     'subforum',
    100     'topic',
    101     'post',
    102     'current_page',
    103     'action',
    104     'create',
    105     'profile',
    106     'unread_topics',
    107     'unanswered_topics',
    108     'message',
    109     'messages',
    110     'view',
    111     'code',
    112     'state',
    113     'register',
    114     'method',
    115     'login',
    116     'delete_msg',
    117     'page_id'
    118 );
    119 
    120 foreach ($_GET as $get => $value) {
    121     if (!in_array($get, $allowed_get_values)) {
    122         ?>
    123         <div class="wpbb-centered-bold">
    124             <?php _e('Sorry the page you requested could not be found. Please try again.', 'wp-bb'); ?>
    125         </div>
    126         <?php
    127         wpbb_exit();
    128     }
    129 }
     101/*
     102    Loads all functions
     103*/
     104
     105require_once('wpbb-functions.php');
     106
     107/*
     108    Checks a page supplied exists
     109*/
     110
     111wpbb_page_exists();
    130112
    131113/*
     
    137119}
    138120
     121
    139122/*
    140123    Twitter
     
    147130}
    148131
    149 /*
    150     Load all Functions
    151 */
    152 
    153 require_once('wpbb-functions.php');
    154132
    155133
     
    246224    }
    247225
    248 
    249     /*
    250         Viewing All Messages (& Delete)
     226    /*
     227        Viewing All Messages
    251228    */
    252229
    253230    if ((isset($_GET['messages']))
    254231        && (isset($_GET['page_id']))
    255         && (isset($_GET['current_page'])) 
    256         && ($_GET['messages'] == 'all')) {
     232        && (isset($_GET['current_page']))
     233        && (count($_GET) == 3)) {
    257234        require_once('wpbb-all-messages.php');
     235    }
     236   
     237    /*
     238        Deleting a message
     239    */
     240   
     241    if ((isset($_GET['messages']) && $_GET['messages'] == 'all')
     242        && (isset($_GET['delete_msg']))
     243        && (isset($_GET['page_id']))
     244        && (count($_GET) > 1 && count($_GET) <= 3)) {
     245        require_once('wpbb-delete-message.php');
    258246    }
    259247
     
    479467
    480468    /*
    481         Viewing All Messages (& Delete)
    482     */
    483 
     469        Viewing All Messages
     470    */
     471
     472    if ((isset($_GET['messages']))
     473        && ($_GET['messages'] == 'all')
     474        && (isset($_GET['current_page']))
     475        && (count($_GET) == 2 || count($_GET) == 3)) {
     476        require_once('wpbb-all-messages.php');
     477    }
     478   
     479    /*
     480        Deleting a message
     481    */
     482   
    484483    if ((isset($_GET['messages']))
    485484        && ($_GET['messages'] == 'all')
    486         && (isset($_GET['current_page']))
    487         && (count($_GET) == 2)) {
    488         require_once('wpbb-all-messages.php');
    489     }
    490 
     485        && (isset($_GET['delete_msg']))
     486        && (count($_GET) > 1 && count($_GET) <= 2)) {
     487        require_once('wpbb-delete-message.php');
     488    }
    491489    /*
    492490        Viewing Individual Message
     
    495493    if ((isset($_GET['messages']))
    496494        && ($_GET['messages'] == 'all')
    497         && ((isset($_GET['view'])) && ($_GET['view']))
    498         && (count($_GET) == 2)) {
     495        && ((isset($_GET['view']))
     496        && (count($_GET) == 2))) {
    499497        require_once('wpbb-view-message.php');
    500498    }
     
    624622}
    625623
    626 // Displays the wpbb powered by footer if it is enabled
    627 if ($wpbb_options['show_footer'] == 'yes') {
    628     ?>
    629     <div class="wpbb-forum-footer">
    630         Powered by <a href="<?php echo WPBB_PLUGIN_URL; ?>">WPBB</a> <?php if (isset($wpbb_options['version'])) echo $wpbb_options['version']; ?>
    631     </div>
    632     <?php
    633 }
     624wpbb_footer();
     625
    634626?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-functions.php

    r604652 r607181  
    8686 *
    8787 *
    88  * @since 1.0.1
     88 * @since 1.0.2
    8989 *
    9090 * @param    int        $forum_id       The ID of the forum
     
    100100    $forum_id = isset($_GET['forum']) ? $_GET['forum'] : NULL;
    101101    $subforum_id = isset($_GET['subforum']) ? $_GET['subforum'] : NULL;
     102    $topic_id = isset($_GET['topic']) ? $_GET['topic'] : NULL;
    102103    $query_args = array('forum' => $forum_id, 'subforum' => $subforum_id, 'topic' => $topic_id, 'current_page' => 1);
    103104    $count = array();
     
    113114    }
    114115    switch ($where) {
     116        case 'forum-index':
     117        ?>
     118        <div class="wpbb-centered-bold">
     119            <a href="<?php echo $permalink; ?>">Go back</a>
     120        </div>
     121        <?php
     122        break;
    115123        default:
    116124        ?>
     
    348356   
    349357    if (empty($user_roles)) {
     358        wpbb_goback1('forum-index', NULL);
    350359        ?>
    351360        <div class="wpbb-message-failure">
     
    755764}
    756765
     766/**
     767 * WPBB version of is_user_logged_in(). Displays error message or returns user ID
     768 *
     769 * Displays a login/register (wordpress/facebook) message if no user ID is found otherwise returns the user ID
     770 *
     771 * @since 1.0.2
     772 *
     773 * @return  int  $user_id   Returns the user ID if the current user is logged in
     774 *                     
     775 */
     776function wpbb_is_user_logged_in() {
     777    $options = get_option('wpbb_options');
     778    $facebook_options = get_option('wpbb_facebook_options');
     779    $user_id = get_current_user_id();
     780    if ($user_id === NULL || $user_id === 0) {
     781        if ($facebook_options['allow_facebook'] == 'yes') {
     782            $facebook_register_url = add_query_arg(array('register' => '', 'method' => 'facebook'), wpbb_permalink());
     783            $facebook_login_url = wpbb_get_facebook_login();
     784            ?>
     785            <div class="wpbb-centered-bold">
     786                <a href="<?php echo $facebook_login_url; ?>"><?php _e('Login using Facebook', 'wp-bb'); ?></a>
     787                <?php _e('or', 'wp-bb'); ?>
     788                <a href="<?php echo $facebook_register_url; ?>"><?php _e('Register using Facebook', 'wp-bb'); ?></a>
     789            </div>
     790            <?php
     791        }
     792        ?>
     793        <div class="wpbb-centered-bold">
     794            <?php printf(__('You must <a href="%s">Login</a> or <a href="%s">Register</a> to be able to view the forum!'), wp_login_url(), site_url('wp-login.php?action=register')); ?>
     795        </div>
     796        <?php
     797        wpbb_exit();
     798    } else {
     799        return $user_id;
     800    }
     801}
     802/**
     803 * Checks whether a forum, subforum or topic exists depending on arguments provided
     804 *
     805 *
     806 * @since 1.0.2
     807 *
     808 * @param   string  $what       Must be one of three: 'forum', 'subforum' or 'topic' - refers to what you are checking exists. Default is forum.
     809 * @param   int     $what_id    Must be set and an integer otherwise won't return anything
     810 * @return  int     $user_id    Returns the user ID if the current user is logged in
     811 *                     
     812 */
     813function wpbb_check_exists($what = 'forum', $what_id) {
     814    if ((isset($what)) && (is_numeric($what_id))) {
     815        global $wpdb;
     816        if ($what == 'topic') {
     817            $topic_exists = $wpdb->get_var("SELECT id FROM ".TOPIC_TABLE." WHERE id = $what_id;");
     818            if ($topic_exists === NULL) {
     819                wpbb_goback1('forum-index');
     820                ?>
     821                <div class="wpbb-message-failure">
     822                    <?php _e('Sorry, that topic doesn\'t exist. Please try again.', 'wp-bb'); ?>
     823                </div>
     824                <?php
     825                wpbb_exit();
     826            }
     827        } else if ($what == 'forum' || $what == 'subforum') {
     828            $exists = $wpdb->get_var("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $what_id;");
     829            if ($exists === NULL) {
     830                wpbb_goback1();
     831                $type = ($what == 'subforum') ? 'subforum' : 'forum';
     832                ?>
     833                <div class="wpbb-message-failure">
     834                    <?php _e('Sorry, that '.$type.' doesn\'t exist. Please try again.', 'wp-bb'); ?>
     835                </div>
     836                <?php
     837                wpbb_exit('forum-index');
     838            }
     839        }
     840    }
     841}
     842
     843/**
     844 * Displays the WPBB powered by footer if it is enabled in settings
     845 *
     846 *
     847 * @since 1.0.2
     848 *
     849 *
     850 */
     851function wpbb_footer() {
     852    $options = get_option('wpbb_options');
     853    if ($options['show_footer'] == 'yes') {
     854        ?>
     855        <div class="wpbb-forum-footer">
     856            <p>Powered by <a href="<?php echo WPBB_PLUGIN_URL; ?>">WPBB</a> <?php echo WPBB_VERSION; ?></p>
     857        </div>
     858        <?php
     859    }
     860}
     861
     862/**
     863 * Checks whether the $_GET key/value pair(s) (page) exists
     864 *
     865 *
     866 * @since 1.0.2
     867 *
     868 *
     869 */
     870function wpbb_page_exists() {   
     871    $allowed_get_values = array(
     872        'forum', 'subforum', 'topic', 'post', 'current_page', 'action', 'create',
     873        'profile', 'unread_topics', 'unanswered_topics',
     874        'message', 'messages', 'view', 'delete_msg',
     875        'code', 'state', 'register', 'method', 'login',
     876        'page_id'
     877    );
     878
     879    foreach ($_GET as $get => $value) {
     880        if (!in_array($get, $allowed_get_values)) {
     881            wpbb_goback1();
     882            ?>
     883            <div class="wpbb-message-failure">
     884                <?php _e('Sorry the page you requested could not be found. Please try again.', 'wp-bb'); ?>
     885            </div>
     886            <?php
     887            wpbb_exit();
     888        }
     889    }
     890}
    757891
    758892?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-index.php

    r604652 r607181  
    55   
    66$user_id = get_current_user_id();
    7    
     7
    88if (isset($_POST['wpbb-search-submit'])) {
    99
    10     wpbb_goback1('search_results', NULL);
    11            
     10    if (!$user_id) {
     11        wpbb_is_user_logged_in();
     12        wpbb_exit();
     13    }
     14       
    1215    $search_criteria = wp_strip_all_tags($_POST['wpbb-search']);
    1316       
     
    1518   
    1619    if ($wpdb->num_rows === 0) {
     20        wpbb_goback1('search-results', NULL);
    1721        ?>
    1822        <div class="wpbb-message-failure">
     
    5761            $delete_topic_link = sprintf(__('<a href="%s">Delete</a>'), add_query_arg(array('forum' => $found->forum, 'topic' => $found->id, 'action' => 'delete'), get_permalink()));
    5862           
    59             $status = wpbb_get_topic_status_buttons($topic->status);
     63            $status = wpbb_get_topic_status_buttons($found->status);
    6064           
    6165            ?>
     
    105109    ?>
    106110    <p class="wpbb-centered">
    107         <a href='<?php echo add_query_arg(array('profile' => $user_id), wpbb_permalink()); ?>'><?php _e('My Profile', 'wp-bb'); ?></a> |
    108         <a href='<?php echo add_query_arg(array('unread_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unread Topics', 'wp-bb'); ?></a> |
    109         <a href='<?php echo add_query_arg(array('unanswered_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unanswered Topics', 'wp-bb'); ?></a> |
    110         <a href='<?php echo add_query_arg(array('messages' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('My Messages', 'wp-bb'); ?></a>
     111        <a href='<?php echo add_query_arg(array('profile' => $user_id), wpbb_permalink()); ?>'><?php _e('My Profile', 'wp-bb'); ?></a>
     112        | <a href='<?php echo add_query_arg(array('unread_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unread Topics', 'wp-bb'); ?></a>
     113        | <a href='<?php echo add_query_arg(array('unanswered_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unanswered Topics', 'wp-bb'); ?></a>
     114        | <a href='<?php echo add_query_arg(array('messages' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('My Messages', 'wp-bb'); ?></a>
    111115    </p>
    112116   
     
    127131   
    128132    // Grab all categories from the database
    129     $categories = $wpdb->get_results("SELECT * FROM ".CATEGORIES_TABLE." WHERE forum = 0 AND subforum = 0 ORDER BY `order`;");
     133    $categories = $wpdb->get_results("SELECT `id`, `name`, `order` FROM ".CATEGORIES_TABLE." WHERE forum = 0 AND subforum = 0 ORDER BY `order`;");
    130134    if ($categories) {
    131135        // Create our table
     
    141145            <?php
    142146            // Grab all forums which belong to the current category
    143             $forums = $wpdb->get_results("SELECT * FROM ".CATEGORIES_TABLE." WHERE forum = $category->id ORDER BY `order`;");
     147            $forums = $wpdb->get_results("SELECT `id`, `name`, `description`, `order` FROM ".CATEGORIES_TABLE." WHERE forum = $category->id ORDER BY `order`;");
    144148            if (!$forums) {
    145149                ?> <tr><td></td><td></td><td></td><td></td></tr><?php
     
    159163                        // Grab all subforums which belong to the current forum
    160164                        if ($options['allow_subforums'] == 'yes') {
    161                             $subforums = $wpdb->get_results("SELECT * FROM ".CATEGORIES_TABLE." WHERE subforum = $forum->id ORDER BY `order`;");
     165                            $subforums = $wpdb->get_results("SELECT `id`, `name`, `description`, `order` FROM ".CATEGORIES_TABLE." WHERE subforum = $forum->id ORDER BY `order`;");
    162166                            if ($subforums) {
    163167                                _e('Subforums: ', 'wp-bb');
  • wp-bulletin-board/tags/1.0.2/php/wpbb-message-user.php

    r604862 r607181  
    11<?php
    22
    3 wpbb_goback1('message-user', NULL);
     3wpbb_goback1();
    44
    5 if ((isset($_GET['message']))
    6     && (count($_GET) === 1)) {
    7    
    8     if (isset($_POST['wpbb-message-submit'])) {
    9        
    10         if (isset($_POST['wpbb-message-to'])) {
    11             $to_name_stripped = wp_strip_all_tags($_POST['wpbb-message-to']);
    12        
    13             $to_id = wpbb_parse_author_name(NULL, $to_name_stripped);
     5if (isset($_POST['wpbb-message-submit'])) {
     6    if (isset($_POST['wpbb-message-to'])) {
     7        if (is_numeric($_POST['wpbb-message-to'])) {
     8            $to_id = absint($_POST['wpbb-message-to']);
     9            $to_name = wpbb_parse_author_name($to_id);
     10        } else {
     11            $to_name = wp_strip_all_tags($_POST['wpbb-message-to']);
     12            $to_id = wpbb_parse_author_name(NULL, $to_name);
     13        }
    1414           
    15             $check_id_exists = get_user_by('id', $to_id);
     15        $check_id_exists = get_user_by('id', $to_id);
    1616           
    17             if ($check_id_exists === false) {
     17        if ($check_id_exists === false) {
     18            ?>
     19            <div class="wpbb-message-failure">
     20                <?php
    1821                _e("Sorry, that user doesn't exist. Please try again", "wp-bb");
    19                 exit();
    20             }
     22                ?>
     23            </div>
     24            <?php
     25            wpbb_exit();
     26        }
    2127           
    22             $from = get_current_user_id();
    23            
    24             // Stops an empty title from being submitted which isn't openable by the recipient without manually modifying the URL
    25             /**
    26             * @todo ... 1. Allow blank subjects, perhaps replacing it with another character. 2. Delay between messages     
    27             */
    28             if (empty($_POST['wpbb-message-subject'])) {
    29                 _e("You must enter a subject for your message", "wp-bb");
    30                 exit();
    31             } else {
    32                 $subject = wp_strip_all_tags($_POST['wpbb-message-subject']);
    33             }
    34            
    35             $content = wpbb_strip_tags($_POST['wpbb-message-content']);
    36             $sent = date("Y-m-d H:i:s");
    37             $data = array('to' => $to_id, 'from' => $from, 'subject' => $subject, 'content' => $content, 'sent' => $sent);
    38             $send_message = $wpdb->insert(MESSAGES_TABLE, $data);
    39             if ($send_message === false) {
    40                 ?>
    41                 <div class="wpbb-message-failure">
    42                     <?php _e('There was an error sending the message. Please try again', 'wp-bb'); ?>
    43                 </div>
    44                 <?php
    45             } else {
    46                 ?>
    47                 <div class="wpbb-message-success">
    48                     <?php printf(__('Message to %s (%s) sent successfully.'), $to_name_stripped, $to_id); ?>
    49                 </div>
    50                 <?php
    51             }
     28        $from = get_current_user_id();
     29        if (empty($_POST['wpbb-message-subject'])) {
     30            ?>
     31            <div class="wpbb-message-failure">
     32                <?php _e("You must enter a subject for your message", "wp-bb"); ?>
     33            </div>
     34            <?php
     35            wpbb_exit();
     36        } else {
     37            $subject = wp_strip_all_tags($_POST['wpbb-message-subject']);
     38        }
     39        $content = wpbb_strip_tags($_POST['wpbb-message-content']);
     40        $sent = date("Y-m-d H:i:s");
     41        $data = array('to' => $to_id, 'from' => $from, 'subject' => $subject, 'content' => $content, 'sent' => $sent);
     42        $send_message = $wpdb->insert(MESSAGES_TABLE, $data);
     43        if ($send_message === false) {
     44            ?>
     45            <div class="wpbb-message-failure">
     46                <?php _e('There was an error sending the message. Please try again', 'wp-bb'); ?>
     47            </div>
     48            <?php
     49        } else {
     50            ?>
     51            <div class="wpbb-message-success">
     52                <?php printf(__('Message to %s (%s) sent successfully.'), $to_name, $to_id); ?>
     53            </div>
     54            <?php
    5255        }
    5356    }
     57}
     58   
     59$message_id = absint($_GET['message']);
     60
     61if ($message_id != 'to') {
    5462   
    5563    $message_id = absint($_GET['message']);
     64}
     65   
     66?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php
    5667
    57     if ($message_id != 'to') {
     68$message_username = wpbb_parse_author_name($message_id);
    5869   
    59         $message_id = absint($_GET['message']);
    60     }
    61    
    62     ?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php
    63 
    64     $message_username = wpbb_parse_author_name($message_id);
    65    
    66     ?>
    67     <table class="wpbb-table">
    68         <form method='POST' action='#'>
    69             <tr>
    70                 <th><?php _e('To', 'wp-bb'); ?></th>
    71                 <td>
    72                     <input type='text' name='wpbb-message-to' value='<?php echo $message_username; ?>' />
    73                 </td>
    74             </tr>
    75             <tr>
    76                 <th><?php _e('Subject', 'wp-bb'); ?></th>
    77                 <td>
    78                     <input type='text' name='wpbb-message-subject' value='' />
    79                 </td>
    80             </tr>
    81             <tr>
    82                 <th><?php _e('Content', 'wp-bb'); ?></th>
    83                 <td>
    84                      <?php wp_editor(" ", 'wpbb-message-content'); ?>
    85                 </td>
    86             </tr>
    87             <tr>
    88                 <th></th>
    89                 <td>
    90                     <input type='submit' name='wpbb-message-submit' value='<?php _e('Send Message', 'wp-bb'); ?>' />
    91                 </td>
    92             </tr>
    93         </form>
    94     </table>
    95     <?php
    96 }
    97 
    9870?>
     71<table class="wpbb-table">
     72    <form method='POST' action='#'>
     73        <tr>
     74            <th><?php _e('To', 'wp-bb'); ?></th>
     75            <td>
     76                <input type='text' name='wpbb-message-to' value='<?php echo $message_username; ?>' />
     77            </td>
     78        </tr>
     79        <tr>
     80            <th><?php _e('Subject', 'wp-bb'); ?></th>
     81            <td>
     82                <input type='text' name='wpbb-message-subject' value='' />
     83            </td>
     84        </tr>
     85        <tr>
     86            <th><?php _e('Content', 'wp-bb'); ?></th>
     87            <td>
     88                    <?php wp_editor("", 'wpbb-message-content'); ?>
     89            </td>
     90        </tr>
     91        <tr>
     92            <th></th>
     93            <td>
     94                <input type='submit' name='wpbb-message-submit' value='<?php _e('Send Message', 'wp-bb'); ?>' />
     95            </td>
     96        </tr>
     97    </form>
     98</table>
     99<?php
     100?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-reply-topic.php

    r604652 r607181  
    11<?php
    22
    3 
    4 $user_id = get_current_user_id();
     3$user_id = get_current_user_id();
    54
    65$subforum = false;
    76
    87$subforum_id = NULL;
     8
     9wpbb_goback1('reply-topic', NULL);
    910
    1011
     
    2526$topic_id = absint($_GET['topic']);
    2627   
    27 wpbb_goback($forum_id, $subforum_id, $topic_id);   
     28
    2829   
    2930// Check forum permissions
  • wp-bulletin-board/tags/1.0.2/php/wpbb-unanswered-topics.php

    r604652 r607181  
    11<?php
    22
    3     wpbb_goback1('unanswered_topics', NULL);
    4 
    5     $user_id = get_current_user_id();
     3    $user_id = wpbb_is_user_logged_in();
    64   
    7     if ($user_id != 0) {
    85    $options = get_option('wpbb_options');
    96    $topics_per_page = $options['topics_per_page'];
     
    2522    $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE created = last_reply;");
    2623    $topics = false;
    27     if ($total_topics > 0) {
     24    if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
    2825        wpbb_pagination(NULL, $current_page, $start, $limit, $total_topics, $topics_per_page);
     26        $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE created = last_reply ORDER by created DESC LIMIT $start, $limit;");
     27    } else {
    2928        $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE created = last_reply ORDER by created DESC LIMIT $start, $limit;");
    3029    }
    3130    if ($topics) {
     31        wpbb_goback1('unanswered_topics', NULL);
    3232        ?>
    33         <h3 class="wpbb-centered-bold"><?php _e('Unanswered Topics', 'wp-bb'); ?></h3>
     33        <h1 id="wpbb-h-1" class="wpbb-centered-bold"><?php _e('Unanswered Topics', 'wp-bb'); ?></h1>
    3434        <table class="wpbb-table">
    3535            <th><?php _e('Status', 'wp-bb'); ?></th>
     
    108108            ?> </table> <?php
    109109        } else {
     110            wpbb_goback1('unanswered_topics', NULL);
    110111            ?>
    111             <div class="wpbb-centered-bold">
     112            <div class="wpbb-message-failure">
    112113                <?php _e('There are no unanswered topics at this time.', 'wp-bb'); ?>
    113114            </div>
     
    115116        }
    116117   
    117         } else {
    118             ?>
    119             <div class="wpbb-centered-bold">
    120                 <?php _e('Please register or login to view this page', 'wp-bb'); ?>
    121             </div>
    122             <?php
    123         }
    124118?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-unread-topics.php

    r604652 r607181  
    11<?php
    2     // Display go back link
    3      wpbb_goback1('unread-topics', NULL);
    42
    53     // Returns user ID
    6      $user_id = get_current_user_id();
     4     $user_id = wpbb_is_user_logged_in();
    75     
    8      if ($user_id != 0) {
    96   
    107        $user_lastvisit = get_user_meta($user_id, 'wpbb_lastvisit', true);
     
    3027            }
    3128        }
    32         $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE last_reply = '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0;");
     29        $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE last_reply > '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0;");
    3330       
    3431        $topics = false;
    3532       
    36         if ($total_topics > 0) {
     33        if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
    3734            wpbb_pagination(NULL, $current_page, $start, $limit, $total_topics, $topics_per_page);
    38             $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE last_reply = '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0 ORDER by last_reply DESC LIMIT $start, $limit;");
     35            $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE last_reply > '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0 ORDER by last_reply DESC LIMIT $start, $limit;");
     36        } else {
     37            $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE last_reply > '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0 ORDER by last_reply DESC LIMIT $start, $limit;");
    3938        }
    4039
    4140        if ($topics) {
     41            wpbb_goback1('unread-topics', NULL);
    4242            ?>
    43             <h3 class="wpbb-centered-bold">
     43            <h1 id="wpbb-h-1" class="wpbb-centered-bold">
    4444                <?php _e('Unread Topics Since Last Visit', 'wp-bb'); ?>
    45             </h3>
     45            </h1>
    4646            <table class="wpbb-table">
    4747                <th><?php _e('Status', 'wp-bb'); ?></th>
     
    9898                    $status = wpbb_get_topic_status_buttons($topic->status);
    9999                   
    100                    
     100                    $freshness = wpbb_get_topic_freshness($topic_last_post);
    101101
    102102                    ?>
     
    105105       
    106106                        <td>
    107                             <?php
     107                            <?php
     108                            echo $freshness;
    108109                            if ($status['locked'] != "") {
    109110                                echo $status['locked'];
     
    132133            <?php
    133134        } else {
     135            wpbb_goback1('unread-topics', NULL);
    134136            ?>
    135             <div class="wpbb-centered-bold">
     137            <div class="wpbb-message-failure">
    136138                <?php _e('There are no unread topics at this time', 'wp-bb'); ?>
    137139            </div>
     
    139141        }
    140142   
    141     } else {
    142         ?>
    143         <div class="wpbb-centered-bold">
    144             <?php _e('Please register or login to view this page', 'wp-bb'); ?>
    145         </div>
    146         <?php
    147     }
     143   
    148144?>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-view-forum-topic.php

    r604652 r607181  
    11<?php
    22
     3    $topic_id = absint($_GET['topic']);
     4   
     5    wpbb_check_exists('topic', $topic_id);
     6   
    37    $user_id = get_current_user_id();
     8   
    49    $forum = absint($_GET['forum']);
    510   
     
    2732    }
    2833
    29     $topic_id = absint($_GET['topic']);
     34   
    3035   
    3136    $topic_status = wpbb_get_topic_status($topic_id);
     
    174179            $topic_id = absint($_GET['topic']);
    175180            $total_posts = $wpdb->get_var("SELECT COUNT(*) as 'Posts' FROM ".POST_TABLE." WHERE topic = $topic->id;");
    176             wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     181            if (($total_posts > 0) && ($total_posts > $posts_per_page)) {
     182                wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     183            }
    177184            wpbb_buttons($forum, NULL, $topic_id, 'forum_topic');
    178185            $user_posts = get_user_meta($topic->author, 'wpbb_posts', true);
     
    227234                            <hr>
    228235                            <p class="wpbb-topic-and-post-signature">
    229                                 <?php echo $signature; ?>
     236                                <?php echo convert_smilies($signature); ?>
    230237                            </p>
    231238                        </td>
     
    269276                            <hr>
    270277                            <p class="wpbb-topic-and-post-signature"</p>
    271                             <?php echo $signature; ?>
     278                            <?php echo convert_smilies($signature); ?>
    272279                        </td>
    273280                    </tr>
     
    286293            <div class="wpbb-quick-reply">
    287294                <form action='#' method='POST'>
    288                     <tr>
    289                         <th><?php _e('Content', 'wp-bb'); ?></th>
    290                         <td><textarea name='wpbb-quick-reply-content'></textarea></td>
    291                     </tr>
    292                     <tr>
    293                         <th></th>
    294                         <td>
    295                             <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
    296                         </td>
    297                     </tr>
     295                    <div>
     296                        <?php _e('Content', 'wp-bb'); ?>
     297                    </div>
     298                    <div>
     299                        <textarea name='wpbb-quick-reply-content'></textarea>
     300                    </div>
     301                    <div>
     302                        <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
     303                    </div>
    298304                </form>
    299305            </div>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-view-forum.php

    r604652 r607181  
    22
    33    $forum = absint($_GET['forum']);
     4   
     5    wpbb_check_exists('forum', $forum);
    46   
    57    $user_id = get_current_user_id();
     
    810    $view_permissions = wpbb_user_has_permission($user_id, $forum);
    911    if ($view_permissions === false) {
    10         wpbb_goback1('forum_denied', NULL);
     12        wpbb_goback1('forum-index', NULL);
    1113        ?>
    1214        <div class="wpbb-message-failure">
     
    7981    $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE forum = $forum;");
    8082    $topics = false;
    81     if ($total_topics > 0) {
     83    if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
    8284        wpbb_pagination($forum, $current_page, $start, $limit, $total_topics, $topics_per_page);
    83         $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE."  WHERE forum = $forum ORDER BY FIELD(status, 'sticky', 'locked,sticky') DESC, last_reply DESC LIMIT $start, $limit;");
    8485    }
     86    $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE."  WHERE forum = $forum ORDER BY FIELD(status, 'sticky', 'locked,sticky') DESC, last_reply DESC LIMIT $start, $limit;");
    8587    wpbb_buttons($forum, NULL, NULL, 'forum');
    8688    // If 'sticky' is found in the set field, order by that first otherwise order by last_reply descending.
  • wp-bulletin-board/tags/1.0.2/php/wpbb-view-message.php

    r604862 r607181  
    1414    ?>
    1515    <table class="wpbb-table">
    16     <?php
     16        <th><?php _e('From', 'wp-bb'); ?></th>
     17        <th><?php _e('Message', 'wp-bb'); ?></th>
     18        <?php
    1719        foreach ($get_message as $message) {
    1820            // Mark message as read
     
    2123            }   
    2224            $message_from_name = wpbb_parse_author_name($message->from);
     25            $message_from_avatar = get_avatar($message->from);
     26            $signature = get_user_meta($message->from, 'wpbb_signature', true);
     27            $reply_to_message = "<a href=".add_query_arg(array('message' => $message->from), wpbb_permalink()).">".__('Reply', 'wp-bb')."</a>";
     28            $delete_message = "<a href=".add_query_arg(array('messages' => 'all', 'delete_msg' => $message->id), wpbb_permalink()).">".__('Delete', 'wp-bb')."</a>";
    2329            ?>
    2430            <tr>
    25                 <th><?php _e('From', 'wp-bb'); ?></th>
    26                 <td><?php echo $message_from_name; ?></td>
    27             </tr>   
    28             <tr>
    29                 <th><?php _e('Sent', 'wp-bb'); ?></th>
    30                 <td><?php echo $message->sent; ?></td>
    31             </tr>
    32             <tr>
    33                 <th><?php _e('Subject', 'wp-bb'); ?></th>
    34                 <td><?php echo $message->subject; ?></td>
    35             </tr>
    36             <tr>
    37                 <th><?php _e('Content', 'wp-bb'); ?></th>
    38                 <td><?php echo $message->content; ?></td>
     31                <td class="wpbb-topic-profile">
     32                    <a href='<?php echo add_query_arg(array('profile' => $message->from), wpbb_permalink()); ?>'>
     33                        <?php echo $message_from_name; ?>
     34                    </a>
     35                    <br /><?php echo $message_from_avatar; ?>
     36                </td>
     37                <td>
     38                    <p class="wpbb-message-subject-date">
     39                        <strong><?php printf(__('( Subject: %s )'), $message->subject); ?></strong>
     40                        <?php echo  $message->sent . " " . $reply_to_message . " " . $delete_message; ?>
     41                    </p>
     42                   
     43                    <p class="wpbb-topic-and-post-content">
     44                       
     45                        <?php echo convert_smilies($message->content); ?>
     46                    </p>
     47                    <hr>
     48                    <p class="wpbb-topic-and-post-signature">
     49                        <?php echo convert_smilies($signature); ?>
     50                    </p>
     51                </td>
    3952            </tr>
    4053            <?php
  • wp-bulletin-board/tags/1.0.2/php/wpbb-view-profile.php

    r604652 r607181  
    11<?php
     2
     3
     4$user_id = wpbb_is_user_logged_in();
     5
    26
    37/*
    48    Viewing a Profile
    59*/
    6    
    7     wpbb_goback1('view-profile', NULL);
    810   
    911    $profile_id = absint($_GET['profile']);
     
    1517        ?>
    1618        <div class="wpbb-centered-bold">
    17             <?php _e('Please register or login to access this page', 'wp-bb'); ?>
     19            <?php printf(__('You must <a href="%s">Login</a> or <a href="%s">Register</a> to be able to view the forum!'), wp_login_url(), site_url('wp-login.php?action=register')); ?>
    1820        </div>
    1921        <?php
     
    2123    }
    2224   
    23     if ($profile_id == get_current_user_id()) {
     25    wpbb_goback1();
     26   
     27   
     28    if ($profile_id == $user_id) {
    2429        ?>
    25         <h3 class="wpbb-centered-bold">
     30        <h1 id="wpbb-h-1" class="wpbb-centered-bold">
    2631            <?php _e('My Profile', 'wp-bb'); ?>
    27         </h3>
     32        </h1>
    2833        <?php
    2934    } else {
    3035        ?>
    31         <h3 class="wpbb-centered-bold">
     36        <h1 id="wpbb-h-1" class="wpbb-centered-bold">
    3237            <?php printf(__('Viewing %s\'s Profile'), $user->display_name); ?>
    33         </h3>
     38        </h1>
    3439        <?php
    3540    }
     
    126131       
    127132        <div class="clear"></div>
    128        
    129         <table id="wpbb-profile-signature">
    130        
    131             <form method='POST' action='#'>
    132        
    133                 <th><h2><?php _e('Signature', 'wp-bb'); ?></h2></th>
    134        
    135                 <tr><td><textarea name='wpbb-signature'><?php echo $signature; ?></textarea></td></tr>
    136        
    137                 <tr><td><input type='submit' name='wpbb-signature-submit' value='<?php _e('Save Signature', 'wp-bb'); ?>' />
    138        
     133        <div id="wpbb-profile-signature">
     134            <form method="POST" action="#">
     135                <div>
     136                    <h2><?php _e('Signature', 'wp-bb'); ?></h2>
     137                </div>
     138                <div>
     139                    <textarea name="wpbb-signature"><?php echo $signature; ?></textarea>
     140                </div>
     141                <div>
     142                    <input type="submit" name="wpbb-signature-submit" value="<?php _e('Save Signature', 'wp-bb'); ?>" />
     143                </div>
    139144            </form>
    140         </table>
     145        </div>
    141146        <?php
    142147    }
  • wp-bulletin-board/tags/1.0.2/php/wpbb-view-subforum-topic.php

    r604652 r607181  
    22
    33    $topic_id = absint($_GET['topic']);
     4   
     5    wpbb_check_exists('topic', $topic_id);
    46   
    57    // Third parameter is 'view' by default
     
    161163                $forum = absint($_GET['forum']);
    162164                $total_posts = $wpdb->get_var("SELECT COUNT(*) as 'Posts' FROM ".POST_TABLE." WHERE topic = $topic->id;");
    163                 wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     165                if (($total_posts > 0) && ($total_posts > $posts_per_page)) {
     166                    wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     167                }
    164168                wpbb_buttons($forum, $subforum, $topic_id, 'subforum_topic');
    165169                if ($current_page == 1) {
     
    181185                            <hr>
    182186                            <p class="wpbb-topic-and-post-signature">
    183                                 <?php echo $signature; ?>
     187                                <?php echo convert_smilies($signature); ?>
    184188                            </p>
    185189                        </td>
     
    213217                                <hr>
    214218                                <p class="wpbb-topic-and-post-signature">
    215                                     <?php echo $signature; ?>
     219                                    <?php echo convert_smilies($signature); ?>
    216220                                </p>
    217221                            </td>
     
    231235            <div class="wpbb-quick-reply">
    232236                <form action='#' method='POST'>
    233                     <tr>
    234                         <th><?php _e('Content', 'wp-bb'); ?></th>
    235                         <td><textarea name='wpbb-quick-reply-content'></textarea></td>
    236                     </tr>
    237                     <tr>
    238                         <th></th>
    239                         <td>
    240                             <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
    241                         </td>
    242                     </tr>
     237                    <div>
     238                        <?php _e('Content', 'wp-bb'); ?>
     239                    </div>
     240                    <div>
     241                        <textarea name='wpbb-quick-reply-content'></textarea>
     242                    </div>
     243                    <div>
     244                        <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
     245                    </div>
    243246                </form>
    244247            </div>
  • wp-bulletin-board/tags/1.0.2/php/wpbb-view-subforum.php

    r604652 r607181  
    44
    55    $forum = absint($_GET['forum']);
     6   
     7    $subforum = absint($_GET['subforum']);
     8   
     9    wpbb_check_exists('subforum', $subforum);
     10   
     11   
     12   
    613    $view_permissions = wpbb_user_has_permission($user_id, $forum);
    714    if ($view_permissions === false) {
     
    1421        wpbb_exit();
    1522    } else {
    16         $subforum = absint($_GET['subforum']);
    1723        $view_permissions = wpbb_user_has_permission($user_id, $subforum);
    1824        if ($view_permissions === false) {
     
    5460    }
    5561    $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE subforum = $subforum;");
    56     wpbb_pagination($subforum, $current_page, $start, $limit, $total_topics, $topics_per_page);
    5762    wpbb_buttons($forum, $subforum, NULL, 'subforum');
    58     // End of pagination
     63    if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
     64        wpbb_pagination($subforum, $current_page, $start, $limit, $total_topics, $topics_per_page);
     65    }
    5966    $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE subforum = $subforum ORDER BY created DESC LIMIT $start, $limit;");
    6067    if ($topics) {
  • wp-bulletin-board/tags/1.0.2/readme.txt

    r604655 r607181  
    55Requires at least: 3.3
    66Tested up to: 3.4.2
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6868== Changelog ==
    6969
     70= 1.0.2 =
     71* Fixed pagination from displaying when there is only 1 page
     72* Fixed being able to view or post to non-existent forums/subforums/topics
     73* View message layout now resembles view topic / post layout with some adjustments
     74* Ability to reply to a message from the view message page
     75* Fixed smilies from not displaying correctly in topic, post, profile and messages signature
     76* Signature textarea is now more consistent across different themes
     77* Fixed topics status from displaying incorrectly when editing a topic
     78* Facebook and Twitter are disabled by default to prevent error messages
     79* Fixed compose message link under default permalinks
     80* Fixed delete message link
     81* Fixed inability to use ID when editing topic, post author and when composing a message.
     82* Improved maintenance message and reminder styling.
     83* Updated links on FAQ & Support
     84* You can now choose the default role a new facebook registration has in your settings
     85* Fixed registering facebook accounts if registration is disabled
     86
    7087= 1.0.1 =
     88* Minor bug fixes
     89* Fixed broken view message link
     90* Fixed table layout when a category doesn't have any forums
    7191* Fixed broken link in message which is displayed to logged out users
    7292* Fixed some layout issues due to CSS files not loading early enough, also added some css options for links and changed default visited link colour to blue
  • wp-bulletin-board/tags/1.0.2/wp-bb.php

    r604665 r607181  
    11<?php
    22/*
    3     Plugin Name: wp-bb
    4     Plugin URI: http://codebycarter.com
     3    Plugin Name: WPBB
     4    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.1
     6    Version: 1.0.2
    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.0');
     47define('WPBB_VERSION', 'v1.0.2');
     48// Define plugin url (wp plugin page)
     49define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board');
    4850
    4951/*
     
    6971add_action('switch_theme', 'wpbb_create_template_file');
    7072add_action('wp_enqueue_scripts', 'wpbb_register_styles');
     73/*add_action('init', 'wpbb_setup_rewrite_rules');
     74add_action('init', 'wpbb_setup_rewrite_tags');
     75
     76function wpbb_setup_rewrite_rules() {
     77    add_rewrite_rule('forum(/([^\d]+))?', 'index.php/forums/?forum=$1', 'top');
     78}
     79function 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
     89function wpbb_setup_rewrite_rules() {
     90
     91    //add_rewrite_rule('carpage(/([^/]+))?(/([^/]+))?/?','index.php?pagename=carpage&var1=$matches[2]&var2=$matches[4]','top');
     92}
     93
     94add_action('init', 'wpbb_setup_rewrite_rules');
     95
    7196
    7297/*
     
    232257            'post_cutoff' => 15,
    233258            'post_to_forum' => 'yes',
    234             'show_footer' => 'no',
    235             'version' => WPBB_VERSION
     259            'show_footer' => 'no'
    236260        );
    237261        $add_wpbb_options = add_option('wpbb_options', $options);
     
    249273        $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb');
    250274        $facebook_state = __('Enter a long random string', 'wp-bb');
     275        $facebook_role = __('Enter the default role for new facebook registrations');
    251276        $facebook_options = array(
    252             'allow_facebook' => 'yes',
     277            'allow_facebook' => 'no',
    253278            'facebook_app_id' => $facebook_app_id,
    254279            'facebook_app_secret_key' => $facebook_app_secret_key,
    255280            'facebook_redirect_uri' => $facebook_redirect_uri,
    256             'facebook_state' => $facebook_state
     281            'facebook_state' => $facebook_state,
     282            'facebook_default_role' => $facebook_role
    257283        );
    258284        $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options);
     
    263289        $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb');
    264290        $twitter_options = array(
    265             'allow_twitter' => 'yes',
     291            'allow_twitter' => 'no',
    266292            'twitter_account' => $twitter_account
    267293        );
     
    332358    $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';");
    333359    if ($post_id == NULL) {
    334         $wpbb_page_title = __('Forum', 'wp-bb');
     360        $wpbb_page_title = __('Forums', 'wp-bb');
    335361        $link = site_url().'/'.strtolower($wpbb_page_title);
    336362        $page = array(
  • wp-bulletin-board/trunk/css/wpbb-dark-style.css

    r604652 r607181  
    1414/* Used for most messages */
    1515
     16/* <h1> heading 1 */
     17#wpbb-h-1 {
     18    font-size:24px;
     19}
     20
    1621/* Centers text */
    1722.wpbb-centered {
     
    4853#wpbb-search {
    4954    float:right;
    50 }
    51 
    52 /* This is a message displayed to an admin to remind them the board is in maintenance mode */
    53 #wpbb-admin-maintenance-reminder {
    54     text-align:center;
    55     background-color: yellow;
    56 }
    57 
    58 /* This is the message displayed to users when the board is in maintenance mode (excludes admins unless logged out) */
    59 #wpbb-maintenance-message {
    60     text-align:center;
    61     font-weight:bold;
    6255}
    6356
     
    137130/* Credit to http://css.dzone.com/news/css-message-boxes-different-me /*
    138131/* Layout for the success and failure messages */
    139 .wpbb-message-success, .wpbb-message-failure {
     132.wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning {
    140133    border: 1px solid;
    141134    margin: 10px 0px;
     
    159152}
    160153
     154/* Warning message background and font color */
     155.wpbb-message-warning {
     156    color: #9F6000;
     157    background-color: #FEEFB3;
     158    text-align:center;
     159}
     160
    161161/* The create/reply buttons when viewing a forum/subforum/topic */
    162162.wpbb-topic-buttons {
     
    195195}
    196196
    197 /* The quick reply on a topic */
     197/* The quick reply div at bottom of a topic */
    198198.wpbb-quick-reply {
    199199    margin-left:auto;
    200200    margin-right:auto;
    201     width:50%;
    202201    margin-bottom:100px;
    203202    text-align:center;
     203}
     204 
     205/* The textarea element used for the quick reply content - determines its width/height*/
     206.wpbb-quick-reply textarea {
     207    min-width: 400px;
     208    min-height: 100px;
    204209}
    205210
  • wp-bulletin-board/trunk/css/wpbb-light-style.css

    r604862 r607181  
    99/* Used for most messages */
    1010
     11/* <h1> heading 1 */
     12#wpbb-h-1 {
     13    font-size:24px;
     14}
     15
    1116/* Centers text */
    1217.wpbb-centered {
     
    4247}
    4348
    44 /* This is a message displayed to an admin to remind them the board is in maintenance mode */
    45 #wpbb-admin-maintenance-reminder {
    46     text-align:center;
    47     background-color: yellow;
    48 }
    49 
    50 /* This is the message displayed to users when the board is in maintenance mode (excludes admins unless logged out) */
    51 #wpbb-maintenance-message {
    52     text-align:center;
    53     font-weight:bold;
    54 }
    55 
    5649/* Defines the layout of all tables displayed on the front end */
    5750/* Credit to twentyelevens entry-content table as I used that as my table class when developing the plugin and and may use some styling or bare resemblance to it */
    5851.wpbb-table {
    59     width: 100%;
     52    width:100%;
    6053    border: solid 0.1em;
    6154    border-color: #9E9E9E;
     
    123116    margin-left:auto;
    124117    margin-right:auto;
    125     width:50%;
     118    text-align:center;
     119}
     120
     121#wpbb-profile-signature textarea {
     122    min-width:400px;
     123    min-height:100px;
     124    max-width: 400px;
     125    max-height: 100px;
    126126}
    127127
    128128/* Credit to http://css.dzone.com/news/css-message-boxes-different-me /*
    129129/* Layout for the success and failure messages */
    130 .wpbb-message-success, .wpbb-message-failure {
     130.wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning {
    131131    border: 1px solid;
    132132    margin: 10px 0px;
     
    150150}
    151151
     152/* Warning message background and font color */
     153.wpbb-message-warning {
     154    color: #9F6000;
     155    background-color: #FEEFB3;
     156    text-align:center;
     157}
     158
    152159/* Search Bar */
    153160#wpbb-search {
     
    183190    margin-top:auto;
    184191    border: 0;
    185     width: 80%;
     192    width: auto;
    186193}
    187194
     
    191198}
    192199
    193 /* The quick reply textarea at bottom of a topic */
     200/* The quick reply div at bottom of a topic */
    194201.wpbb-quick-reply {
    195202    margin-left:auto;
    196203    margin-right:auto;
    197     width:50%;
    198204    margin-bottom:100px;
    199205    text-align:center;
     206}
     207 
     208/* The textarea element used for the quick reply content - determines its width/height*/
     209.wpbb-quick-reply textarea {
     210    min-width:400px;
     211    min-height:100px;
     212    max-width: 400px;
     213    max-height: 100px;
     214}
     215
     216#wpbb-message-subject-date {
     217    float:left;
    200218}
    201219
  • wp-bulletin-board/trunk/php/admin/wpbb-admin-categories.php

    r603518 r607181  
    103103        foreach ($roles as $role) {
    104104           
    105             if ($_POST['wpbbadvancedpermissionstable'.$role.'view']) {
     105            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'view'])) {
    106106               
    107107                $permissions['view'][] = $role;
    108108            }
    109109           
    110             if ($_POST['wpbbadvancedpermissionstable'.$role.'read']) {
     110            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'read'])) {
    111111               
    112112                $permissions['read'][] = $role;
    113113            }
    114114           
    115             if ($_POST['wpbbadvancedpermissionstable'.$role.'post']) {
     115            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'post'])) {
    116116               
    117117                $permissions['post'][] = $role;
    118118            }
    119119           
    120             if ($_POST['wpbbadvancedpermissionstable'.$role.'reply']) {
     120            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'reply'])) {
    121121               
    122122                $permissions['reply'][] = $role;
    123123            }
    124124           
    125             if ($_POST['wpbbadvancedpermissionstable'.$role.'edit']) {
     125            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'edit'])) {
    126126               
    127127                $permissions['edit'][] = $role;
    128128            }
    129129           
    130             if ($_POST['wpbbadvancedpermissionstable'.$role.'lock']) {
     130            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'lock'])) {
    131131               
    132132                $permissions['lock'][] = $role;
    133133            }
    134134           
    135             if ($_POST['wpbbadvancedpermissionstable'.$role.'delete']) {
     135            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'delete'])) {
    136136               
    137137                $permissions['delete'][] = $role;
    138138            }
    139139           
    140             if ($_POST['wpbbadvancedpermissionstable'.$role.'sticky']) {
     140            if (isset($_POST['wpbbadvancedpermissionstable'.$role.'sticky'])) {
    141141               
    142142                $permissions['sticky'][] = $role;
    143143            }
    144144        }
     145       
     146        // This is a category
     147        $forum_id = 0;
     148        $subforum_id = 0;
    145149       
    146150        $view_permissions = implode(",", $permissions['view']);
     
    155159        $data = array(
    156160            'name' => $name,
    157             'forum' => 0,
    158             'subforum' => 0,
     161            'forum' => $forum_id,
     162            'subforum' => $subforum_id,
    159163            'view' => $view_permissions,
    160164            'read' => $read_permissions,
     
    173177       
    174178        if ($update_forum) {
    175            
    176             //echo "<div id='message' class='updated'>Category ID ".$id." updated succesfully </div>";
    177             echo "<div id='message' class='updated'>";
    178             printf(__('Category ID %d updated successfully', 'wp-bb'), $id);
    179             echo "</div>";
    180        
     179            ?>
     180            <div id='message' class='updated'>
     181                <?php printf(__('Category ID %d updated successfully', 'wp-bb'), $id); ?>
     182            </div>
     183            <?php
    181184        } else {
    182        
    183             //echo "<div id='message' class='error'>Error updating Category ID ".$id."</div>";
    184             echo "<div id='message' class='error'>";
    185             printf(__('Error updating Category ID %d', 'wp-bb'), $id);
    186             echo "</div>";
     185            ?>
     186            <div id='message' class='error'>
     187                <?php printf(__('Error updating Category ID %d', 'wp-bb'), $id); ?>
     188            </div>
     189            <?php
    187190        }
    188191    }
     
    198201       
    199202        if ($delete === false) {
    200            
    201             //echo "<div id='message' class='error'>There was an error deleting Category ID ".$id." from the database.</div>";
    202             echo "<div id='message' class='error'>";
    203             printf(__('There was an error deleting Category ID %d, please try again.', 'wp-bb'), $id);
    204             echo "</div>";
    205            
     203            ?>
     204            <div id='message' class='error'>
     205                <?php printf(__('There was an error deleting Category ID %d, please try again.', 'wp-bb'), $id); ?>
     206            </div>
     207            <?php
    206208        } else {
    207        
    208             echo "<div id='message' class='updated'>";
    209             //echo "<div id='message' class='updated'>Category ID ".$id." deleted successfully.</div>";
    210             printf(__('Category ID %d deleted successfully.', 'wp-bb'), $id);
    211             echo "</div>";
     209            ?>
     210            <div id='message' class='updated'>
     211                <?php printf(__('Category ID %d deleted successfully.', 'wp-bb'), $id); ?>
     212            </div>
     213            <?php
    212214        }
    213215   
     
    226228    $id = absint($_GET['id']);
    227229
    228     echo "<h3>".__('Confirm Delete Request', 'wp-bb')."</h3>";
    229 
    230     //echo "Are you sure you want to delete Category ID ".$id."?";
    231     printf(__('Are you sure you want to delete Category ID %d?', 'wp-bb'), $id);
    232    
    233     echo "<form method='POST' action='#'>";
    234     echo "<input type='radio' name='wpbb-confirm-delete' value='yes' checked='no' /> ".__('Yes', 'wp-bb');
    235     echo "<input type='radio' name='wpbb-confirm-delete' value='no' checked='no' /> ".__('No', 'wp-bb');
    236     echo "<input type='hidden' name='wpbb-confirm-delete-id' value='".$id."' />";
    237     echo "<input type='submit' name='wpbb-confirm-delete-submit' value='".__('Confirm', 'wp-bb')."' />";
    238     echo "</form>";
    239    
     230    ?>
     231    <h3><?php _e('Confirm Delete Request', 'wp-bb'); ?></h3>
     232
     233    <?php printf(__('Are you sure you want to delete Category ID %d?', 'wp-bb'), $id); ?>
     234   
     235    <form method='POST' action='#'>
     236        <input type='radio' name='wpbb-confirm-delete' value='yes' checked='no' /> <?php _e('Yes', 'wp-bb'); ?>
     237        <input type='radio' name='wpbb-confirm-delete' value='no' checked='no' /> <?php _e('No', 'wp-bb'); ?>
     238        <input type='hidden' name='wpbb-confirm-delete-id' value='<?php echo $id; ?>' />
     239        <input type='submit' name='wpbb-confirm-delete-submit' value='<?php _e('Confirm', 'wp-bb'); ?>' />
     240    </form>
     241    <?php
    240242    return;
    241243}
  • wp-bulletin-board/trunk/php/admin/wpbb-admin-faq-support.php

    r603518 r607181  
    5757        <dl>
    5858            <dt><b><?php _e('Support Forums', 'wp-bb'); ?></b></dt>
    59             <dd>http://codebycarter.com/wpbb/forums</dd>
     59            <dd>http://wordpress.org/support/plugin/wp-bulletin-board</dd>
    6060            <dt><b><?php _e('Author Email', 'wp-bb'); ?></b></dt>
    6161            <dd>[email protected]</dd>
     
    6363                <b>
    6464                    <?php
    65                         $options = get_option('wpbb_options');
    6665                        _e('Your version', 'wp-bb');
    6766                    ?>
     
    7069            <dd>
    7170                <?php
    72                 if (isset($options['version'])) {
    73                     $options['version'];
    74                 } else {
    75                     _e('Unknown version', 'wp-bb');
    76                 }
     71                    echo WPBB_VERSION;
    7772                ?>
    7873            </dd>
  • wp-bulletin-board/trunk/php/admin/wpbb-admin-settings.php

    r603518 r607181  
    8080       
    8181    (string) $facebook_state = wp_strip_all_tags($_POST['wpbbfacebookstate']);
    82        
     82   
     83    $faceboook_default_role = strtolower(wp_strip_all_tags($_POST['wpbbfacebookdefaultrole']));
     84   
    8385    $new_facebook_options = array(
    8486        'allow_facebook' => $facebook_support,
     
    8688        'facebook_app_secret_key' => $facebook_app_secret_key,
    8789        'facebook_redirect_uri' => $facebook_redirect_uri,
    88         'facebook_state' => $facebook_state
     90        'facebook_state' => $facebook_state,
     91        'facebook_default_role' => $faceboook_default_role
    8992    );
    9093       
     
    303306                </th>
    304307                <td>
    305                 <?php
    306                     if (isset($facebook_options['facebook_app_id'])) {
    307                         $facebook_app_id_value = $facebook_options['facebook_app_id'];
    308                     } else {
    309                         $facebook_app_id_value = "Enter your App ID / API Key";
    310                     }
    311                    
    312                     if (isset($facebook_options['facebook_app_secret_key'])) {
    313                         $facebook_app_secret_key_value = $facebook_options['facebook_app_secret_key'];
    314                     } else {
    315                         $facebook_app_secret_key_value = "Enter your App Secret Key";
    316                     }
    317                    
    318                     if (isset($facebook_options['facebook_redirect_uri'])) {
    319                         $facebook_redirect_uri_value = $facebook_options['facebook_redirect_uri'];
    320                     } else {
    321                         $facebook_redirect_uri_value = "http://www.yoursite.com";
    322                     }
    323                    
    324                     if (isset($facebook_options['facebook_state'])) {
    325                         $facebook_state_value = $facebook_options['facebook_state'];
    326                     }
    327                 ?>
     308                    <?php
     309                    // App ID
     310                    $facebook_app_id_value = (isset($facebook_options['facebook_app_id'])) ? $facebook_options['facebook_app_id'] : "Enter your App ID / API Key";
     311                    // App secret key
     312                    $facebook_app_secret_key_value = (isset($facebook_options['facebook_app_secret_key'])) ? $facebook_options['facebook_app_secret_key'] : "Enter your App Secret Key";
     313                    // Redirect URL
     314                    $facebook_redirect_uri_value = (isset($facebook_options['facebook_redirect_uri'])) ? $facebook_options['facebook_redirect_uri'] : "http://www.yoursite.com";
     315                    // Facebook state
     316                    $facebook_state_value = (isset($facebook_options['facebook_state'])) ? $facebook_options['facebook_state'] : 'Enter a unique string (letters and numbers only';
     317                    // Facebook default role
     318                    $facebook_default_role = (isset($facebook_options['facebook_default_role'])) ? $facebook_options['facebook_default_role'] : 'Enter a default role for new Facebook registrations';
     319                    ?>
    328320                    <input type='text' name='wpbbfacebookappid' value="<?php echo $facebook_app_id_value; ?>"/>
    329321                </td>
     
    342334                </th>
    343335                <td>
    344                     <input type='text' name='wpbbfacebookredirecturi' value="<?php echo $facebook_redirect_uri_value; ?>"/>
     336                    <input type='text' name="wpbbfacebookredirecturi" value="<?php echo $facebook_redirect_uri_value; ?>"/>
    345337                </td>
    346338            </tr>
     
    350342                </th>
    351343                <td>
    352                     <input type='text' name='wpbbfacebookstate' value="<?php echo $facebook_state_value; ?>" />
    353                 </td>
    354             </tr>
    355             <tr>
    356            
     344                    <input type="text" name="wpbbfacebookstate" value="<?php echo $facebook_state_value; ?>" />
     345                </td>
     346            </tr>
     347            <tr>
     348                <th>
     349                    <label for="wpbbfacebookdefaultrole"><?php _e('Default Role', 'wp-bb'); ?></label>
     350                </th>
     351                <td>
     352                    <input type="text" name="wpbbfacebookdefaultrole" value="<?php echo strtolower($facebook_default_role); ?>"/>
     353                </td>
     354            </tr>
     355            <tr>
    357356                <td><input type="submit" name="wpbb-facebook-settings-submit" class="button-primary" value="<?php _e('Save Changes', 'wp-bb'); ?>" /></td>
    358357            </tr>
  • wp-bulletin-board/trunk/php/facebook/wpbb-facebook.php

    r603518 r607181  
    3030   
    3131} else { // User is not logged in
    32 
    33     if (!isset($_GET['state']) && !isset($_GET['code'])) {
    34    
    35         ?>
    36        
    37         <div class="wpbb-centered-bold">
    38        
    39             <a href='<?php echo wpbb_get_facebook_login(); ?>'><?php _e('Login using Facebook', 'wp-bb'); ?></a>
    40            
    41             <?php _e('or', 'wp-bb'); ?>
    42            
    43             <a href='<?php echo add_query_arg(array('register' => '', 'method' => 'facebook'), get_permalink()); ?>'><?php _e('Register using Facebook', 'wp-bb'); ?></a>
    44            
    45         </div>
    46 
    47         <?php
    48     }
    4932   
    5033    // Registering for a Wordpress account through Facebook
    5134    if ((isset($_GET['register'])) && (isset($_GET['method'])) && (count($_GET) == 2)) {
    5235   
     36        $registration_enabled = get_option('users_can_register');
     37       
     38        if (!$registration_enabled) {
     39            ?>
     40            <div class="wpbb-centered">
     41                <?php
     42                    _e('Sorry, the administrator has disabled user registrations.', 'wp-bb');
     43                    wpbb_exit();
     44                   
     45                ?>
     46            </div>
     47            <?php
     48        }
     49   
    5350        ?>
    54        
    5551        <h2 class="wpbb-centered-bold">
    5652       
     
    106102               
    107103                    if ($facebook_user['id'] != 0) { // User is logged into Facebook
    108                    
    109104                        $logged_into_facebook = true;
    110                    
    111105                        if (!isset($facebook_user['email'])) {
    112                             _e('Could not log you in using Facebook. You must authorize the app to allow it to use your email address for validation', 'wp-bb');
    113                             exit();
     106                            ?>
     107                            <div class="wpbb-message-failure">
     108                                <?php
     109                                _e('Could not log you in using Facebook. You must authorize the app to allow it to use your email address for validation', 'wp-bb');
     110                                ?>
     111                            </div>
     112                            <?php
     113                            wpbb_exit();
    114114                        }
    115                        
    116115                        $email_exists = email_exists($facebook_user['email']);
    117                        
    118116                        if ($email_exists === false) {
    119                             _e('You must register for an account using Wordpress or Facebook before logging in.', 'wp-bb');
    120                             exit();
    121                         }
    122                        
     117                            ?>
     118                            <div class="wpbb-message-failure">
     119                                <?php
     120                                _e('You must register for an account using Wordpress or Facebook before logging in.', 'wp-bb');
     121                                ?>
     122                            </div>
     123                            <?php
     124                            wpbb_exit();
     125                        }
    123126                        ?>
    124                        
    125127                        <h2 class="wpbb-centered-bold">
    126                        
    127                         <?php _e('Login to Wordpress', 'wp-bb'); ?>
    128                        
    129                         </h2><br />
    130                        
    131                         <div class="wpbb-centered">     
    132                        
    133                         <?php printf(__('Thankyou for logging in to Facebook, %s!'), $facebook_user['name']); ?>
    134                            
    135                         <br /><br />
    136                            
    137                         <?php _e('Please now enter the password for your Wordpress account you registered using Facebook.', 'wp-bb'); ?>
    138                        
    139                         <br /><br />
    140                        
    141                         <?php
    142                        
    143                         $forum_page_url = get_page($forum_page);
    144                        
    145                         $args = array(
    146                             'echo' => true,
    147                             'redirect' => $forum_page_url->guid,
    148                             'remember' => true,
    149                             'value_username' => $facebook_user['name'],
    150                             'value_remember' => 1
    151                         );
    152                        
    153                         $user = get_user_by('email', $facebook_user['email']);
    154                        
    155                         $access_token = wp_strip_all_tags($para['access_token']);
    156                        
    157                         $add_user_facebook_meta = update_user_meta($user->ID, 'wpbb_facebook_access_token', $access_token);
    158                                                
    159                         wp_login_form($args);
    160 
    161                         ?>
     128                            <?php _e('Login to Wordpress', 'wp-bb'); ?>
     129                        </h2>
     130                        <br />
     131                        <div class="wpbb-centered">
     132                            <?php printf(__('Thankyou for logging in to Facebook, %s!'), $facebook_user['name']); ?>
     133                            <br /><br />
     134                            <?php _e('Please now enter the password for your Wordpress account you registered using Facebook.', 'wp-bb'); ?><br /><br /><?php
     135                            $forum_page_url = get_page($forum_page);
     136                            $args = array(
     137                                'echo' => true,
     138                                'redirect' => $forum_page_url->guid,
     139                                'remember' => true,
     140                                'value_username' => $facebook_user['name'],
     141                                'value_remember' => 1
     142                            );
     143                            $user = get_user_by('email', $facebook_user['email']);
     144                            $access_token = wp_strip_all_tags($para['access_token']);
     145                            $add_user_facebook_meta = update_user_meta($user->ID, 'wpbb_facebook_access_token', $access_token);             
     146                            wp_login_form($args);
     147                            ?>
    162148                        </div>
    163149                        <?php
    164                        
    165150                    } else {
    166                    
    167151                        _e('Please login to Facebook', 'wp-bb');
    168                
    169152                    }               
    170153                }
    171154            } else { // Possible CSRF victim
    172    
    173                 _e('There was an error logging you into Facebook. Please try again', 'wp-bb');
    174                 exit();
     155                ?>
     156                <div class="wpbb-message-failure">
     157                    <?php
     158                    _e('There was an error logging you into Facebook. Please try again', 'wp-bb');
     159                    ?>
     160                </div>
     161                <?php
     162                wpbb_exit();
    175163            }
    176164        } else { // State was not provided
    177             _e('You must provide a state (a random string of variable length) in your Facebook Settings');
    178             exit();
     165            ?>
     166            <div class="wpbb-message-failure">
     167                <?php
     168                _e('You must provide a state (a random string of variable length) in your Facebook Settings');
     169                ?>
     170            </div>
     171            <?php
     172            wpbb_exit();
    179173        }
    180174    }
     
    221215    $password = $data['registration']['password'];
    222216    $email = $data['registration']['email'];
    223    
    224     $create_user = wp_create_user($username, $password, $email);
     217    $facebook_options = get_option('wpbb_facebook_options');
     218    $role = $facebook_options['facebook_default_role'];
     219   
     220    //$create_user = wp_create_user($username, $password, $email);
     221    $create_user = wp_insert_user(array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'role' => $role));
    225222   
    226223    if (is_wp_error($create_user)) {
    227    
    228224        $errors = $create_user->get_error_messages();
    229        
    230         var_dump($errors);
    231    
    232225        foreach ($errors as $err) {
    233             echo $err;
    234         }
    235        
    236         exit();
    237        
     226            wpbb_goback1('facebook-register-uname-exists', NULL);
     227            ?>
     228            <div class="wpbb-message-failure">
     229                <?php
     230                echo $err;
     231                ?>
     232            </div>
     233            <?php
     234        }
     235        wpbb_exit();
    238236    } else {
    239    
    240         _e('Thankyou for registering. Please login with your Facebook username and password you just created', 'wp-bb');
    241         // Display login form
    242         wp_login_form();
    243        
     237        ?>
     238        <div class="wpbb-message-success">
     239            <?php
     240            _e('Thankyou for registering. Please login with your Facebook username and password you just created', 'wp-bb');
     241            ?>
     242        </div>
     243        <div class="wpbb-centered">
     244            <?php
     245            wp_login_form();
     246            ?>
     247        </div>
     248        <?php
     249        wpbb_exit();
    244250    }
    245251}
  • wp-bulletin-board/trunk/php/twitter/wpbb-twitter.php

    r603518 r607181  
    44    Displays Twitter Follow button if twitter is enabled
    55*/
    6    
     6
     7
     8$twitter_username = "http://api.twitter.com/1/users/show.xml?screen_name=".$wpbb_twitter_options['twitter_account'];
     9
     10if (!@fopen($twitter_username, 'r')) {
     11    ?>
     12    <div class="wpbb-message-failure">
     13        <p>Invalid twitter username supplied. Please enter a correct username or disable twitter support.</p>
     14    </div>
     15    <?php
     16}
     17
    718
    819if (count($_GET) == 0) {
  • wp-bulletin-board/trunk/php/wpbb-all-messages.php

    r604868 r607181  
    11<?php
    22
    3 wpbb_goback1('all-messages', NULL);
    4 
    5 $user_id = get_current_user_id();
    6 
    7 if ($user_id == 0) {
    8     ?>
    9     <div class="wpbb-centered-bold">
    10         <?php
    11             _e('Please register or login to view this page', 'wp-bb');
    12             wpbb_exit();
    13         ?>
    14        
    15     </div>
    16     <?php
    17 }
     3$user_id = wpbb_is_user_logged_in();
    184
    195global $wpdb;
     6   
     7?>
     8<h1 id="wpbb-h-1" class="wpbb-centered-bold">
     9    <?php _e('My Messages', 'wp-bb'); ?>
     10</h1>
     11   
     12<a href='<?php echo add_query_arg(array('message' => 'to'), wpbb_permalink()); ?>'>
     13    <p class="wpbb-centered">
     14            <?php _e('Compose Message', 'wp-bb'); ?>
     15    </p>
     16</a>
     17   
     18<?php
    2019
    21 // Viewing all messages
    22 if ((isset($_GET['messages']))
    23     && ($_GET['messages'] == 'all')
    24     && (count($_GET) == 1 || count($_GET) == 2)) {
    25    
    26     ?>
    27     <h2 class="wpbb-centered-bold">
    28         <?php _e('My Messages', 'wp-bb'); ?>
    29     </h2>
    30    
    31     <a href='<?php echo add_query_arg(array('message' => 'to'), get_permalink()); ?>'>
    32         <p class="wpbb-centered">
    33             <?php _e('Compose Message', 'wp-bb'); ?>
    34         </p>
    35     </a>
    36    
    37     <?php
    38    
    39         if ($user_id != 0) {
    40             $options = get_option('wpbb_options');
    41             $topics_per_page = $options['topics_per_page'];
    42             if (isset($_GET['current_page'])) {
    43                 if ($_GET['current_page'] == 0) {
    44                     $current_page = 1;
    45                     $start = 0;
    46                     $limit = $topics_per_page;
    47                 } else if ($_GET['current_page'] == 1) {
    48                     $current_page = 1;
    49                     $start = 0;
    50                     $limit = $topics_per_page;
    51                 } else {
    52                     $current_page = $_GET['current_page'];
    53                     $start = $current_page * $topics_per_page - $topics_per_page;
    54                     $limit = $start + $topics_per_page;
    55                 }
    56             }
    57             $total_msgs = $wpdb->get_var("SELECT COUNT(*) as 'Messages' FROM ".MESSAGES_TABLE." WHERE `to` = $user_id;");
    58             $msgs = false;
    59             if ($total_msgs > 0) {
    60                 wpbb_pagination(NULL, $current_page, $start, $limit, $total_msgs, $topics_per_page, true, 'messages');
    61                 $msgs = $wpdb->get_results("SELECT * FROM ".MESSAGES_TABLE." WHERE `to` = $user_id ORDER BY sent DESC LIMIT $start, $limit;");
    62             }
    63             if ($msgs) {
    64                 ?>
    65                 <table class="wpbb-table">
    66        
    67                 <th><?php _e('From', 'wp-bb'); ?></th>
    68                 <th><?php _e('Subject', 'wp-bb'); ?></th>
    69                 <th><?php _e('Read', 'wp-bb'); ?></th>
    70                 <th><?php _e('Sent', 'wp-bb'); ?></th>
    71                 <th><?php _e('Action', 'wp-bb'); ?></th>
    72                
     20if ($user_id != 0) {
     21    $options = get_option('wpbb_options');
     22    $topics_per_page = $options['topics_per_page'];
     23    if (isset($_GET['current_page'])) {
     24        if ($_GET['current_page'] == 0) {
     25            $current_page = 1;
     26            $start = 0;
     27            $limit = $topics_per_page;
     28        } else if ($_GET['current_page'] == 1) {
     29            $current_page = 1;
     30            $start = 0;
     31            $limit = $topics_per_page;
     32        } else {
     33            $current_page = $_GET['current_page'];
     34            $start = $current_page * $topics_per_page - $topics_per_page;
     35            $limit = $start + $topics_per_page;
     36        }
     37    }
     38    $total_msgs = $wpdb->get_var("SELECT COUNT(*) as 'Messages' FROM ".MESSAGES_TABLE." WHERE `to` = $user_id;");
     39    $msgs = false;
     40    if (($total_msgs > 0) && ($total_msgs > $topics_per_page)) {
     41        wpbb_pagination(NULL, $current_page, $start, $limit, $total_msgs, $topics_per_page, true, 'messages');
     42        $msgs = $wpdb->get_results("SELECT * FROM ".MESSAGES_TABLE." WHERE `to` = $user_id ORDER BY sent DESC LIMIT $start, $limit;");
     43    }
     44    if ($msgs) {
     45        wpbb_goback1('all-messages', NULL);
     46        ?>
     47        <table class="wpbb-table">
     48            <th><?php _e('From', 'wp-bb'); ?></th>
     49            <th><?php _e('Subject', 'wp-bb'); ?></th>
     50            <th><?php _e('Read', 'wp-bb'); ?></th>
     51            <th><?php _e('Sent', 'wp-bb'); ?></th>
     52            <th><?php _e('Action', 'wp-bb'); ?></th>
    7353                <?php
    7454                foreach ($msgs as $msg) {
     
    8363               
    8464                        <td>
    85                             <a href='<?php echo add_query_arg(array('messages' => 'all', 'view' => $msg->id)); ?>'>
     65                            <a href='<?php echo add_query_arg(array('messages' => 'all', 'view' => $msg->id), wpbb_permalink()); ?>'>
    8666                                <?php printf(__('%s'), $msg->subject); ?>
    8767                            </a>
     
    9474                        </td>
    9575                        <td>
    96                             <a href='<?php echo add_query_arg(array('delete_msg' => $msg->id)); ?>'>
     76                            <a href='<?php echo add_query_arg(array('messages' => 'all', 'delete_msg' => $msg->id), wpbb_permalink()); ?>'>
    9777                                <?php _e('Delete', 'wp-bb'); ?>
     78                            </a>
     79                            <a href="<?php echo add_query_arg(array('message' => $msg->from), wpbb_permalink()); ?>">
     80                                <?php _e('Reply', 'wp-bb'); ?>
    9881                            </a>
    9982                        </td
     
    10588            <?php
    10689        } else {
     90            wpbb_goback1('all-messages', NULL);
    10791            ?>
    108             <div class="wpbb-centered-bold">
    109                 <?php _e('You do not have any messages', 'wp-bb'); ?>
     92            <div class="wpbb-message-failure">
     93                <?php printf(__('You do not have any messages. <a href="%s">Compose one?</a>'), add_query_arg(array('message' => 'to'), wpbb_permalink())); ?>
    11094            </div>
    11195        <?php
    11296        }
    113     }   
    114 }
    115 
    116 
    117 // Deleting a message
    118 if ((isset($_GET['delete_msg']))
    119     && (isset($_GET['messages']))
    120     && (count($_GET) === 2)) {
    121    
    122     $id = absint($_GET['delete_msg']);
    123        
    124     $delete_message = $wpdb->query("DELETE FROM ".MESSAGES_TABLE." WHERE id = $id;");
    125    
    126     if ($delete_message === false) {
    127    
    128         ?>
    129        
    130         <div class="wpbb-centered-bold">
    131        
    132             <?php _e('Error deleting message. Please try again', 'wp-bb'); ?>
    133        
    134         </div>
    135        
    136         <?php
    137        
    138     } else {
    139    
    140         ?>
    141        
    142         <div class="wpbb-centered-bold">
    143    
    144         <?php _e('Thankyou. That message has been deleted successfully.', 'wp-bb'); ?>
    145        
    146         </div>
    147        
    148         <?php
    14997    }
    150 }
    151 
    152 
    15398?>
  • wp-bulletin-board/trunk/php/wpbb-create-topic.php

    r604652 r607181  
    44   
    55    $forum_id = absint($_GET['forum']);
     6   
     7    wpbb_check_exists('forum', $forum_id);
    68   
    79    if ((isset($_GET['forum'])) && (!isset($_GET['subforum']))) {
  • wp-bulletin-board/trunk/php/wpbb-delete-topic.php

    r603518 r607181  
    11<?php
     2    wpbb_goback1();
    23
    34    // Check user has permissions to delete topics or posts in this forum
     
    6566                ?>
    6667                <div class="wpbb-centered-bold">
    67                     <?php printf(__('You decided not to delete topic ID %s. You will be redirected'), $topic_id); ?>
     68                    <?php
     69                        printf(__('You decided not to delete topic ID %s. Click "Go back" to return to the topic.'), $topic_id);
     70                    ?>
    6871                </div>
    6972                <?php
     
    7578        if ($changed_mind !== true && $success !== true) {
    7679            ?>
    77             <h2 class="wpbb-centered-bold"><?php _e('Confirm Topic Delete Request', 'wp-bb'); ?></h2>
    78             <div class="wpbb-centered-bold">
    79                 <?php printf(__('Are you sure you want to delete topic ID %s ? (WARNING: All posts in this topic will be deleted. This proccess cannot be undone!)'), $topic_id); ?>
     80            <h1 id="wpbb-h-1" class="wpbb-centered-bold"><?php _e('Confirm Topic Delete Request', 'wp-bb'); ?></h1>
     81            <div class="wpbb-message-warning">
     82                <?php printf(__('Are you sure you want to delete topic ID %s? WARNING: All posts in this topic will be deleted. This proccess cannot be undone!'), $topic_id); ?>
    8083            </div>
    8184            <form method='POST' action='#' style='text-align:center;'>
  • wp-bulletin-board/trunk/php/wpbb-edit-topic.php

    r604652 r607181  
    11<?php
    22
    3     if ((isset($_GET['topic'])) && (!isset($_GET['post']))) {
    4         $is_topic = true;
    5         $is_post = false;
    6     }
    7     if ((isset($_GET['post'])) && (isset($_GET['topic']))) {
    8         $is_post = true;
    9         $is_topic = false;
    10     }
    11    
    12     $forum_id = absint($_GET['forum']);
    13    
    14     $user_id = get_current_user_id();
    15    
    16     $topic_id = absint($_GET['topic']);
    17     if (isset($_GET['post'])) {
    18         $post_id = absint($_GET['post']);
    19     }
    20    
    21     $view_permissions = wpbb_user_has_permission($user_id, $forum_id);
    22     if ($view_permissions === false) {
    23         wpbb_goback1('edit-topic-denied', NULL);
    24         ?>
    25         <div class="wpbb-message-failure">
    26             <?php _e('You do not have the required permissions to view this forum!', 'wp-bb'); ?>
    27         </div>
    28         <?php
    29         wpbb_exit();
    30     } else {
    31    
    32         $edit_permissions = wpbb_user_has_permission($user_id, $forum_id, 'edit');
    33        
    34         if ($is_topic === true) {
    35        
    36             $editing_own_topic = $wpdb->get_var("SELECT id FROM ".TOPIC_TABLE." WHERE id = $topic_id AND author = $user_id;");
    37            
    38             // If user does not have edit permissions and is not editing own topic then they are trying to edit someone elses topic!
    39             if (($edit_permissions === false) && (!$editing_own_topic)) {
    40                 wpbb_goback1('edit-other-topic-denied', NULL);
     3// Display a "Go back" link
     4wpbb_goback1();
     5
     6$is_post = isset($_GET['post']) ? true : false;
     7   
     8$forum_id = absint($_GET['forum']);
     9   
     10$user_id = get_current_user_id();
     11   
     12$topic_id = absint($_GET['topic']);
     13if (isset($_GET['post'])) {
     14    $post_id = absint($_GET['post']);
     15}
     16   
     17$view_permissions = wpbb_user_has_permission($user_id, $forum_id);
     18if ($view_permissions === false) {
     19    ?>
     20    <div class="wpbb-message-failure">
     21        <?php _e('You do not have the required permissions to view this forum!', 'wp-bb'); ?>
     22    </div>
     23    <?php
     24    wpbb_exit();
     25} else {
     26   
     27    $edit_permissions = wpbb_user_has_permission($user_id, $forum_id, 'edit');
     28       
     29    if ($is_post === false) {
     30       
     31        $editing_own_topic = $wpdb->get_var("SELECT id FROM ".TOPIC_TABLE." WHERE id = $topic_id AND author = $user_id;");
     32           
     33        // If user does not have edit permissions and is not editing own topic then they are trying to edit someone elses topic!
     34        if (($edit_permissions === false) && (!$editing_own_topic)) {
     35            ?>
     36            <div class="wpbb-message-failure">
     37                <?php _e('You do not have the required permissions to edit other peoples topics in this forum!', 'wp-bb'); ?>
     38            </div>
     39            <?php
     40            wpbb_exit();
     41        }
     42    } else if ($is_post === true) {
     43       
     44        $editing_own_post = $wpdb->get_var("SELECT id FROM ".POST_TABLE." WHERE id = $post_id AND author = $user_id;");
     45           
     46        // If user does not have edit permissions and is not editing own post then they are trying to edit someone elses topic!
     47        if (($edit_permissions === false) && (!$editing_own_post)) {
     48            ?>
     49            <div class="wpbb-message-failure">
     50                <?php _e('You do not have the required permissions to edit other peoples posts in this forum!', 'wp-bb'); ?>
     51            </div>
     52            <?php
     53            wpbb_exit();
     54        }
     55    }
     56}
     57
     58if ($is_post === false) {
     59    // Form submission
     60    if (isset($_POST['wpbbtopiceditsubmit'])) {
     61        if (empty($_POST['wpbbtopiccontent']) || empty($_POST['wpbbtopicname'])) {
     62            ?>
     63            <div class="wpbb-message-failure">
     64                <?php _e('You must enter a title and some content for your topic', 'wp-bb'); ?>
     65            </div>
     66            <?php
     67            wpbb_exit();   
     68        }
     69           
     70        // Sanitize topic title
     71        $topic_name = wp_strip_all_tags($_POST['wpbbtopicname']);
     72           
     73        if (is_numeric($_POST['wpbbauthorname'])) { // ID supplied
     74            $topic_author = absint($_POST['wpbbauthorname']);
     75
     76        } else if (is_string($_POST['wpbbauthorname'])) { // Name supplied
     77            $topic_author_name = wp_strip_all_tags($_POST['wpbbauthorname']);
     78            $topic_author = wpbb_parse_author_name(NULL, $topic_author_name);
     79        }
     80       
     81        $topic_content = wpbb_strip_tags($_POST['wpbbtopiccontent']);
     82       
     83        if (($_POST['wpbbtopicforum'] == 'yes') && ($_POST['wpbbtopicsubforum'] == 'no')) {
     84            $topic_forum = absint($_POST['wpbbtopicforumname']);
     85            // Check category exists otherwise do not allow submission to proceed
     86            $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_forum;");
     87            if ($exists === false) {
    4188                ?>
    4289                <div class="wpbb-message-failure">
    43                     <?php _e('You do not have the required permissions to edit other peoples topics in this forum!', 'wp-bb'); ?>
     90                    <?php _e('That category does not exist. Please make sure you choose a valid category.', 'wp-bb'); ?>
    4491                </div>
    4592                <?php
    4693                wpbb_exit();
    4794            }
    48            
    49         } else if ($is_post === true) {
    50        
    51             $editing_own_post = $wpdb->get_var("SELECT id FROM ".POST_TABLE." WHERE id = $post_id AND author = $user_id;");
    52            
    53             // If user does not have edit permissions and is not editing own post then they are trying to edit someone elses topic!
    54             if (($edit_permissions === false) && (!$editing_own_post)) {
    55                 wpbb_goback1('edit-other-post-denied', NULL);
     95            $topic_subforum = 0;
     96        } else if (($_POST['wpbbtopicsubforum'] == 'yes') && ($_POST['wpbbtopicforum'] == 'no')) {
     97            $topic_subforum = absint($_POST['wpbbtopicsubforumname']);
     98            // Check forum exists otherwise do not allow submission to proceed
     99            $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_subforum;");
     100            if ($exists === false) {
    56101                ?>
    57102                <div class="wpbb-message-failure">
    58                     <?php _e('You do not have the required permissions to edit other peoples posts in this forum!', 'wp-bb'); ?>
     103                    <?php _e('That forum does not exist. Please make sure you choose a valid forum.', 'wp-bb'); ?>
    59104                </div>
    60105                <?php
    61106                wpbb_exit();
    62107            }
    63         }
    64     }
    65    
    66     //if (isset($_GET['topic']) && (!isset($_GET['post']))) { // It's a topic
    67     if ($is_topic === true) {
    68        
    69        
    70         // Form submission
    71         if (isset($_POST['wpbbtopiceditsubmit'])) {
    72            
    73             if (empty($_POST['wpbbtopiccontent']) || empty($_POST['wpbbtopicname'])) {
    74                 wpbb_goback1('edit-topic-submit-error', NULL);
    75                 ?>
    76                 <div class="wpbb-message-failure">
    77                     <?php _e('You must enter a title and some content for your topic', 'wp-bb'); ?>
    78                 </div>
    79                 <?php
    80                 wpbb_exit();
    81                
    82             }
    83            
    84             // Sanitize topic title
    85             $topic_name = wp_strip_all_tags($_POST['wpbbtopicname']);
    86            
    87             // Sanitize author name
    88             $topic_author_name = wp_strip_all_tags($_POST['wpbbauthorname']);
    89            
    90             // Get ID back from the sanitized author name
    91             $topic_author = wpbb_parse_author_name(NULL, $topic_author_name);
    92            
    93             $topic_content = wpbb_strip_tags($_POST['wpbbtopiccontent']);
    94            
    95             if (($_POST['wpbbtopicforum'] == 'yes') && ($_POST['wpbbtopicsubforum'] == 'no')) {
    96                 $topic_forum = absint($_POST['wpbbtopicforumname']);
    97                 // Check category exists otherwise do not allow submission to proceed
    98                 $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_forum;");
    99                 if ($exists === false) {
    100                     wpbb_goback1('edit-topic-cat-exists-error', NULL);
    101                     ?>
    102                     <div class="wpbb-message-failure">
    103                         <?php _e('That category does not exist. Please make sure you choose a valid category.', 'wp-bb'); ?>
    104                     </div>
    105                     <?php
    106                     wpbb_exit();
    107                 }
    108                 $topic_subforum = 0;
    109             } else if (($_POST['wpbbtopicsubforum'] == 'yes') && ($_POST['wpbbtopicforum'] == 'no')) {
    110                 $topic_subforum = absint($_POST['wpbbtopicsubforumname']);
    111                 // Check forum exists otherwise do not allow submission to proceed
    112                 $exists = $wpdb->query("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $topic_subforum;");
    113                 if ($exists === false) {
    114                     wpbb_goback1('edit-topic-forum-exists-error', NULL);
    115                     ?>
    116                     <div class="wpbb-message-failure">
    117                         <?php _e('That forum does not exist. Please make sure you choose a valid forum.', 'wp-bb'); ?>
    118                     </div>
    119                     <?php
    120                     wpbb_exit();
    121                 }
    122                 $topic_forum = 0;
    123             } else if (($_POST['wpbbtopicforum'] == 'no') && ($_POST['wpbbtopicsubforum'] == 'no')) {
    124                 wpbb_goback1('edit-topic-select-cat-error', NULL);
    125                 ?>
    126                 <div class="wpbb-message-failure">
    127                     <?php _e('You must select a category or forum for the topic to be posted in.', 'wp-bb'); ?>
    128                 </div>
    129                 <?php
    130                 wpbb_exit();
    131             }
    132            
    133             if (isset($_POST['wpbbtopicstatus'])) {
    134                 $topic_status = implode(",", (array) $_POST['wpbbtopicstatus']);
    135             } else {
    136                 $topic_status = "";
    137             }
    138            
    139             $data = array(
    140                 'name' => $topic_name,
    141                 'author' => $topic_author,
    142                 'content' => $topic_content,
    143                 'forum' => $topic_forum,
    144                 'subforum' => $topic_subforum,
    145                 'status' => $topic_status
    146             );
    147            
    148             $save_topic = $wpdb->update(TOPIC_TABLE, $data, array('id' => $topic_id));
    149            
    150             if ($save_topic !== false) {
    151                 wpbb_goback1('edit-topic-success', NULL);
    152                 ?>
    153                 <div class="wpbb-message-success">
    154                     <?php printf(__('Topic ID %s edited successfully'), $topic_id); ?>
    155                 </div>
    156                 <?php
    157             } else {
    158                 wpbb_goback1('edit-topic-error', NULL);
    159                 ?>
    160                 <div class="wpbb-message-failure">
    161                     <?php printf(__('There was an error editing topic ID %s'), $topic_id); ?>
    162                 </div>
    163                 <?php
    164             }
    165         }
    166        
    167         // End Form Submission
    168        
    169         $get_topic = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE id = $topic_id;");
    170        
    171         if ($get_topic !== false) {
    172             ?>
    173             <table class="wpbb-table">
    174                 <form method='POST' action='#'>
    175             <?php
    176             foreach ($get_topic as $topic) {
    177            
    178                 if (strpos($topic->status, 'locked') !== false) $locked = true; else $locked = false;
    179                 if (strpos($topic->status, 'sticky') !== false) $sticky = true; else $sticky = false;
    180                 if (strpos($topic->status, 'poll') !== false) $poll = true; else $poll = false;
    181                
    182                 $topic_author_name = wpbb_parse_author_name($topic->author);
    183                
    184                 ?>
    185                 <tr>
    186                     <th><?php _e('Name', 'wp-bb'); ?></th>
    187                     <td>
    188                         <input name='wpbbtopicname' maxlength='45' size='25' value='<?php echo $topic->name; ?>' />
    189                     </td>
    190                 </tr>
    191                 <?php
    192                 if (current_user_can('manage_options')) {
     108            $topic_forum = 0;
     109        } else if (($_POST['wpbbtopicforum'] == 'no') && ($_POST['wpbbtopicsubforum'] == 'no')) {
     110            ?>
     111            <div class="wpbb-message-failure">
     112                <?php _e('You must select a category or forum for the topic to be posted in.', 'wp-bb'); ?>
     113            </div>
     114            <?php
     115            wpbb_exit();
     116        }
     117        if (isset($_POST['wpbbtopicstatus'])) {
     118            $topic_status = implode(",", (array) $_POST['wpbbtopicstatus']);
     119        } else {
     120            $topic_status = "";
     121        }
     122        $data = array(
     123            'name' => $topic_name,
     124            'author' => $topic_author,
     125            'content' => $topic_content,
     126            'forum' => $topic_forum,
     127            'subforum' => $topic_subforum,
     128            'status' => $topic_status
     129        );
     130        $save_topic = $wpdb->update(TOPIC_TABLE, $data, array('id' => $topic_id));
     131        if ($save_topic !== false) {
     132            ?>
     133            <div class="wpbb-message-success">
     134                <?php printf(__('Topic ID %s edited successfully'), $topic_id); ?>
     135            </div>
     136            <?php
     137        } else {
     138            ?>
     139            <div class="wpbb-message-failure">
     140                <?php printf(__('There was an error editing topic ID %s'), $topic_id); ?>
     141            </div>
     142            <?php
     143        }
     144    }
     145    // End Form Submission
     146    $get_topic = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE id = $topic_id;");
     147    if ($get_topic !== false) {
     148        ?>
     149        <table class="wpbb-table">
     150            <form method='POST' action='#'>
     151                <?php
     152                foreach ($get_topic as $topic) {
     153                    $sticky = (strpos($topic->status, 'sticky') !== false) ? true : false;
     154                    $locked = (strpos($topic->status, 'locked') !== false) ? true : false;
     155                    $topic_author_name = wpbb_parse_author_name($topic->author);
    193156                    ?>
    194157                    <tr>
     158                        <th><?php _e('Name', 'wp-bb'); ?></th>
     159                        <td>
     160                            <input name='wpbbtopicname' maxlength='45' size='25' value='<?php echo $topic->name; ?>' />
     161                        </td>
     162                    </tr>
     163                    <?php
     164                    if (current_user_can('manage_options')) {
     165                        ?>
     166                        <tr>
    195167                        <th><?php _e('Author', 'wp-bb'); ?></th>
    196168                        <td>
     
    209181                    <?php
    210182                }
    211                
    212                 if ($topic->forum > 0) $is_forum = true; else $is_forum = false;
    213                
    214                 if ($topic->subforum > 0) $is_subforum = true; else $is_subforum = false;
    215                
     183                $is_forum = ($topic->forum > 0) ? true: false;
     184                $is_subforum = ($topic->subforum > 0) ? true : false;
    216185                // Forums
    217186                ?>
     
    280249                    <th><?php _e('Status', 'wp-bb'); ?></th>
    281250                    <td>
    282                         <input type='checkbox' name='wpbbtopicstatus[]' value='locked' ".checked($locked, true, false)."/> <?php _e('Locked', 'wp-bb'); ?>
    283                         <input type='checkbox' name='wpbbtopicstatus[]' value='sticky' ".checked($sticky, true, false)."/> <?php _e('Sticky', 'wp-bb'); ?>
     251                        <input type='checkbox' name='wpbbtopicstatus[]' value='locked' <?php echo checked($locked, true, false); ?>/> <?php _e('Locked', 'wp-bb'); ?>
     252                        <input type='checkbox' name='wpbbtopicstatus[]' value='sticky' <?php echo checked($sticky, true, false); ?>/> <?php _e('Sticky', 'wp-bb'); ?>
    284253                    </td>
    285254                <tr>
     
    292261        ?>
    293262        </form>
     263    </table>
     264    <?php
     265    } else {
     266        ?>
     267        <div style='text-align:center; font-color:red;'>
     268            <?php printf(__('There was an error fetching topic ID %s. Please try again.'), $topic_id); ?>
     269        </div>
     270        <?php
     271        wpbb_exit();
     272    }
     273} else if ($is_post === true) { // It's a post 
     274    // Post edit submission
     275    if (isset($_POST['wpbbeditpostsubmit'])) {
     276       
     277        $post_id = absint($_GET['post']);
     278           
     279        // If a topic wasn't chosen or content wasn't entered produce an error
     280        if (empty($_POST['wpbbposttopic']) || empty($_POST['wpbbpostcontent'])) {
     281            ?>
     282            <div class="wpbb-message-failure">
     283                <?php _e('You must choose a topic for the post and content must not be empty!', 'wp-bb'); ?>
     284            </div>
     285            <?php
     286            wpbb_exit();
     287        }
     288           
     289        if (is_numeric($_POST['wpbbpostauthor'])) {
     290            // Strip all tags from the authors name
     291            $post_author_name = wp_strip_all_tags($_POST['wpbbpostauthor']);
     292            // Retrieve ID back from username
     293            $post_author = wpbb_parse_author_name(NULL, $post_author_name);
     294        } else {
     295            $post_author = absnt($_POST['wpbbpostauthor']);
     296        }
     297           
     298        $post_content = wpbb_strip_tags($_POST['wpbbpostcontent']);
     299       
     300        $post_topic = absint($_POST['wpbbposttopic']);
     301           
     302        $data = array(
     303            'author' => $post_author,
     304            'topic' => $post_topic,
     305            'text' => $post_content
     306        );
     307           
     308        $update_post = $wpdb->update(POST_TABLE, $data, array('id' => $post_id));
     309           
     310        $wpdb->show_errors();
     311               
     312        if ($update_post === false) { // Db error
     313            ?>
     314            <div class="wpbb-message-failure">
     315                <?php _e('There was an error attempting to save your post, please try again.', 'wp-bb'); ?>
     316            </div>
     317            <?php
     318        } else { // Success
     319            ?>
     320            <div class="wpbb-message-success">
     321                <?php _e('Thankyou, your post has been saved successfully', 'wp-bb'); ?>
     322            </div>
     323            <?php
     324        }
     325    }
     326    // End post edit submission
     327       
     328    // Attempt to retrieve the post from the db
     329    $get_post = $wpdb->get_results("SELECT * FROM ".POST_TABLE." WHERE id = $post_id;");
     330       
     331    // If there wasn't an error...
     332    if ($get_post !== false) {
     333        ?>
     334        <table class="wpbb-table">
     335            <form method='POST' action='#'>
     336                <?php
     337                foreach ($get_post as $post) {
     338               
     339                $post_author_name = wpbb_parse_author_name($post->author);
     340               
     341                if (current_user_can('manage_options')) {
     342                    ?>
     343                    <tr>
     344                        <th><?php _e('Author', 'wp-bb'); ?></th>
     345                        <td>
     346                            <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' />
     347                        </td>
     348                    </tr>
     349                    <?php
     350                } else {
     351                    ?>
     352                    <tr>
     353                        <th><?php _e('Author', 'wp-bb'); ?></th>
     354                        <td>
     355                            <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' disabled='disabled' />
     356                        </td>
     357                    </tr>
     358                    <?php
     359                }
     360                ?>
     361                <tr>
     362                    <th><?php _e('Topic', 'wp-bb'); ?></th>
     363                    <td>
     364                        <input name='wpbbposttopic' maxlength='45' size='24' value='<?php echo $post->topic; ?>' />
     365                    </td>
     366                </tr>
     367                <tr>
     368                    <th><?php _e('Content', 'wp-bb'); ?></th>
     369                    <td>
     370                        <?php wp_editor($post->text, 'wpbbpostcontent'); ?>
     371                    </td>
     372                </tr>
     373                <tr>
     374                    <th></th>
     375                    <td>
     376                        <input type='submit' name='wpbbeditpostsubmit' value='<?php _e('Save Changes', 'wp-bb'); ?>' />
     377                    </td>
     378                </tr>
     379                <?php
     380            }
     381            ?>
     382            </form>
    294383        </table>
    295384        <?php
    296         } else {
    297             wpbb_goback1('edit-get-topic-error', NULL);
    298             ?>
    299             <div style='text-align:center; font-color:red;'>
    300                 <?php printf(__('There was an error fetching topic ID %s. Please try again.'), $topic_id); ?>
    301             </div>
    302             <?php
    303             wpbb_exit();
    304         }
    305     } else if ($is_post === true) { // It's a post
    306            
    307         // Post edit submission
    308         if (isset($_POST['wpbbeditpostsubmit'])) {
    309        
    310             $post_id = absint($_GET['post']);
    311            
    312             // If a topic wasn't chosen or content wasn't entered produce an error
    313             if (empty($_POST['wpbbposttopic']) || empty($_POST['wpbbpostcontent'])) {
    314                 wpbb_goback1('edit-post-empty-error', NULL);
    315                 ?>
    316                 <div class="wpbb-message-failure">
    317                     <?php _e('You must choose a topic for the post and content must not be empty!', 'wp-bb'); ?>
    318                 </div>
    319                 <?php
    320                 wpbb_exit();
    321             }
    322            
    323             // Strip all tags from the authors name
    324             $post_author_name = wp_strip_all_tags($_POST['wpbbpostauthor']);
    325            
    326             // Use the sanitized authors name to retrive the ID of the author to then add to the DB
    327             $post_author = wpbb_parse_author_name(NULL, $post_author_name);
    328            
    329             // This function uses the strip_tags function only difference being you have to edit the tags you want to skip once.
    330             $post_content = wpbb_strip_tags($_POST['wpbbpostcontent']);
    331            
    332             $post_topic = absint($_POST['wpbbposttopic']);
    333            
    334             $data = array(
    335                 'author' => $post_author,
    336                 'topic' => $post_topic,
    337                 'text' => $post_content
    338             );
    339            
    340             $update_post = $wpdb->update(POST_TABLE, $data, array('id' => $post_id));
    341            
    342             $wpdb->show_errors();
    343                
    344             if ($update_post === false) { // Db error
    345                 wpbb_goback1('edit-post-submit-error', NULL);
    346                 ?>
    347                 <div class="wpbb-message-failure">
    348                     <?php _e('There was an error attempting to save your post, please try again.', 'wp-bb'); ?>
    349                 </div>
    350                 <?php
    351             } else { // Success
    352                 wpbb_goback1('edit-post-submit-success', NULL);
    353                 ?>
    354                 <div class="wpbb-message-success">
    355                     <?php _e('Thankyou, your post has been saved successfully', 'wp-bb'); ?>
    356                 </div>
    357                 <?php
    358             }
    359         }
    360         // End post edit submission
    361        
    362         // Attempt to retrieve the post from the db
    363         $get_post = $wpdb->get_results("SELECT * FROM ".POST_TABLE." WHERE id = $post_id;");
    364        
    365         // If there wasn't an error...
    366         if ($get_post !== false) {
    367             ?>
    368             <table class="wpbb-table">
    369                 <form method='POST' action='#'>
    370                     <?php
    371                     foreach ($get_post as $post) {
    372                
    373                     $post_author_name = wpbb_parse_author_name($post->author);
    374                
    375                     if (current_user_can('manage_options')) {
    376                         ?>
    377                         <tr>
    378                             <th><?php _e('Author', 'wp-bb'); ?></th>
    379                             <td>
    380                                 <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' />
    381                             </td>
    382                         </tr>
    383                         <?php
    384                     } else {
    385                         ?>
    386                         <tr>
    387                             <th><?php _e('Author', 'wp-bb'); ?></th>
    388                             <td>
    389                                 <input name='wpbbpostauthor' maxlength='45' size='25' value='<?php echo $post_author_name; ?>' disabled='disabled' />
    390                             </td>
    391                         </tr>
    392                         <?php
    393                     }
    394                     ?>
    395                     <tr>
    396                         <th><?php _e('Topic', 'wp-bb'); ?></th>
    397                         <td>
    398                             <input name='wpbbposttopic' maxlength='45' size='24' value='<?php echo $post->topic; ?>' />
    399                         </td>
    400                     </tr>
    401                     <tr>
    402                         <th><?php _e('Content', 'wp-bb'); ?></th>
    403                         <td>
    404                             <?php wp_editor($post->text, 'wpbbpostcontent'); ?>
    405                         </td>
    406                     </tr>
    407                     <tr>
    408                         <th></th>
    409                         <td>
    410                             <input type='submit' name='wpbbeditpostsubmit' value='<?php _e('Save Changes', 'wp-bb'); ?>' />
    411                         </td>
    412                     </tr>
    413                     <?php
    414                 }
    415                 ?>
    416                 </form>
    417             </table>
    418             <?php
    419             } else { // Error
    420                 wpbb_goback1('edit-post-get-error', NULL);
    421                 ?>
    422                 <div class="wpbb-message-failure">
    423                     <?php _e('There was an error retrieving the post. Please try again.', 'wp-bb'); ?>
    424                 </div>
    425                 <?php
    426                 wpbb_exit();
    427             }
    428         }
    429    
    430 
     385        } else { // Error
     386            ?>
     387            <div class="wpbb-message-failure">
     388                <?php _e('There was an error retrieving the post. Please try again.', 'wp-bb'); ?>
     389            </div>
     390            <?php
     391            wpbb_exit();
     392        }
     393    }
    431394?>
  • wp-bulletin-board/trunk/php/wpbb-forum.php

    r604652 r607181  
    44    Checks if the plugin is deactivated
    55*/
     6
    67
    78// Since we're not in the admin area we must require the plugin.php file
     
    1617    ?>
    1718    <div style="text-align:center;font-weight:bold;color:red;">
    18         <?php 
     19        <?php
    1920            _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB', 'wp-bb');
    2021            wpbb_exit();
     
    2324    <?php
    2425}
    25 
     26   
    2627// Load WPBB Options
    2728$wpbb_options = get_option('wpbb_options');
     
    6364    && (!isset($_GET['method']))
    6465    && (!isset($_GET['state']))) {
     66    if ($wpbb_facebook_options['allow_facebook'] == 'yes') {
     67        require_once('facebook/wpbb-facebook.php');
     68    }
     69    require_once('wpbb-functions.php');
    6570    ?>
    6671    <div class="wpbb-centered-bold">
    6772        <?php
    68             printf(__('You must <a href="%s">Login</a> or <a href="%s">Register</a> to be able to view the forum!'), wp_login_url(), site_url('wp-login.php?action=register'));
     73            wpbb_is_user_logged_in();
    6974        ?>
    7075    </div>
    7176    <?php
    72     // Load facebook functionality if facebook is enabled
    73     if ($wpbb_facebook_options['allow_facebook'] == 'yes') {
    74         require_once('facebook/wpbb-facebook.php');
    75     }
    76     exit();
    7777}
    7878
     
    8080    if (current_user_can('manage_options')) {
    8181        ?>
    82         <div id="wpbb-admin-maintenance-reminder">
     82        <div class="wpbb-message-warning">
    8383        <?php _e('The board is currently in maintenance mode. To turn it off change Maintenance Mode in Settings -> WPBB Settings to "Off"', 'wp-bb'); ?>
    8484        </div>
     
    8686    } else {
    8787        ?>
    88         <div id="wpbb-maintenance-message">
     88        <div class="wpbb-message-warning">
    8989            <?php echo $wpbb_options['maintenance_message']; ?>
    9090        </div>
    9191        <?php
     92        if ($wpbb_facebook_options['allow_facebook'] == 'yes') {
     93            require_once('facebook/wpbb-facebook.php');
     94        }
     95        require_once('wpbb-functions.php');
     96        wpbb_footer();
    9297        wpbb_exit();
    9398    }
    9499}
    95100
    96 // Simple snippet to disallow any unrecognized get key/values
    97 $allowed_get_values = array(
    98     'forum',
    99     'subforum',
    100     'topic',
    101     'post',
    102     'current_page',
    103     'action',
    104     'create',
    105     'profile',
    106     'unread_topics',
    107     'unanswered_topics',
    108     'message',
    109     'messages',
    110     'view',
    111     'code',
    112     'state',
    113     'register',
    114     'method',
    115     'login',
    116     'delete_msg',
    117     'page_id'
    118 );
    119 
    120 foreach ($_GET as $get => $value) {
    121     if (!in_array($get, $allowed_get_values)) {
    122         ?>
    123         <div class="wpbb-centered-bold">
    124             <?php _e('Sorry the page you requested could not be found. Please try again.', 'wp-bb'); ?>
    125         </div>
    126         <?php
    127         wpbb_exit();
    128     }
    129 }
     101/*
     102    Loads all functions
     103*/
     104
     105require_once('wpbb-functions.php');
     106
     107/*
     108    Checks a page supplied exists
     109*/
     110
     111wpbb_page_exists();
    130112
    131113/*
     
    137119}
    138120
     121
    139122/*
    140123    Twitter
     
    147130}
    148131
    149 /*
    150     Load all Functions
    151 */
    152 
    153 require_once('wpbb-functions.php');
    154132
    155133
     
    246224    }
    247225
    248 
    249     /*
    250         Viewing All Messages (& Delete)
     226    /*
     227        Viewing All Messages
    251228    */
    252229
    253230    if ((isset($_GET['messages']))
    254231        && (isset($_GET['page_id']))
    255         && (isset($_GET['current_page'])) 
    256         && ($_GET['messages'] == 'all')) {
     232        && (isset($_GET['current_page']))
     233        && (count($_GET) == 3)) {
    257234        require_once('wpbb-all-messages.php');
     235    }
     236   
     237    /*
     238        Deleting a message
     239    */
     240   
     241    if ((isset($_GET['messages']) && $_GET['messages'] == 'all')
     242        && (isset($_GET['delete_msg']))
     243        && (isset($_GET['page_id']))
     244        && (count($_GET) > 1 && count($_GET) <= 3)) {
     245        require_once('wpbb-delete-message.php');
    258246    }
    259247
     
    479467
    480468    /*
    481         Viewing All Messages (& Delete)
    482     */
    483 
     469        Viewing All Messages
     470    */
     471
     472    if ((isset($_GET['messages']))
     473        && ($_GET['messages'] == 'all')
     474        && (isset($_GET['current_page']))
     475        && (count($_GET) == 2 || count($_GET) == 3)) {
     476        require_once('wpbb-all-messages.php');
     477    }
     478   
     479    /*
     480        Deleting a message
     481    */
     482   
    484483    if ((isset($_GET['messages']))
    485484        && ($_GET['messages'] == 'all')
    486         && (isset($_GET['current_page']))
    487         && (count($_GET) == 2)) {
    488         require_once('wpbb-all-messages.php');
    489     }
    490 
     485        && (isset($_GET['delete_msg']))
     486        && (count($_GET) > 1 && count($_GET) <= 2)) {
     487        require_once('wpbb-delete-message.php');
     488    }
    491489    /*
    492490        Viewing Individual Message
     
    495493    if ((isset($_GET['messages']))
    496494        && ($_GET['messages'] == 'all')
    497         && ((isset($_GET['view'])) && ($_GET['view']))
    498         && (count($_GET) == 2)) {
     495        && ((isset($_GET['view']))
     496        && (count($_GET) == 2))) {
    499497        require_once('wpbb-view-message.php');
    500498    }
     
    624622}
    625623
    626 // Displays the wpbb powered by footer if it is enabled
    627 if ($wpbb_options['show_footer'] == 'yes') {
    628     ?>
    629     <div class="wpbb-forum-footer">
    630         Powered by <a href="<?php echo WPBB_PLUGIN_URL; ?>">WPBB</a> <?php if (isset($wpbb_options['version'])) echo $wpbb_options['version']; ?>
    631     </div>
    632     <?php
    633 }
     624wpbb_footer();
     625
    634626?>
  • wp-bulletin-board/trunk/php/wpbb-functions.php

    r604652 r607181  
    8686 *
    8787 *
    88  * @since 1.0.1
     88 * @since 1.0.2
    8989 *
    9090 * @param    int        $forum_id       The ID of the forum
     
    100100    $forum_id = isset($_GET['forum']) ? $_GET['forum'] : NULL;
    101101    $subforum_id = isset($_GET['subforum']) ? $_GET['subforum'] : NULL;
     102    $topic_id = isset($_GET['topic']) ? $_GET['topic'] : NULL;
    102103    $query_args = array('forum' => $forum_id, 'subforum' => $subforum_id, 'topic' => $topic_id, 'current_page' => 1);
    103104    $count = array();
     
    113114    }
    114115    switch ($where) {
     116        case 'forum-index':
     117        ?>
     118        <div class="wpbb-centered-bold">
     119            <a href="<?php echo $permalink; ?>">Go back</a>
     120        </div>
     121        <?php
     122        break;
    115123        default:
    116124        ?>
     
    348356   
    349357    if (empty($user_roles)) {
     358        wpbb_goback1('forum-index', NULL);
    350359        ?>
    351360        <div class="wpbb-message-failure">
     
    755764}
    756765
     766/**
     767 * WPBB version of is_user_logged_in(). Displays error message or returns user ID
     768 *
     769 * Displays a login/register (wordpress/facebook) message if no user ID is found otherwise returns the user ID
     770 *
     771 * @since 1.0.2
     772 *
     773 * @return  int  $user_id   Returns the user ID if the current user is logged in
     774 *                     
     775 */
     776function wpbb_is_user_logged_in() {
     777    $options = get_option('wpbb_options');
     778    $facebook_options = get_option('wpbb_facebook_options');
     779    $user_id = get_current_user_id();
     780    if ($user_id === NULL || $user_id === 0) {
     781        if ($facebook_options['allow_facebook'] == 'yes') {
     782            $facebook_register_url = add_query_arg(array('register' => '', 'method' => 'facebook'), wpbb_permalink());
     783            $facebook_login_url = wpbb_get_facebook_login();
     784            ?>
     785            <div class="wpbb-centered-bold">
     786                <a href="<?php echo $facebook_login_url; ?>"><?php _e('Login using Facebook', 'wp-bb'); ?></a>
     787                <?php _e('or', 'wp-bb'); ?>
     788                <a href="<?php echo $facebook_register_url; ?>"><?php _e('Register using Facebook', 'wp-bb'); ?></a>
     789            </div>
     790            <?php
     791        }
     792        ?>
     793        <div class="wpbb-centered-bold">
     794            <?php printf(__('You must <a href="%s">Login</a> or <a href="%s">Register</a> to be able to view the forum!'), wp_login_url(), site_url('wp-login.php?action=register')); ?>
     795        </div>
     796        <?php
     797        wpbb_exit();
     798    } else {
     799        return $user_id;
     800    }
     801}
     802/**
     803 * Checks whether a forum, subforum or topic exists depending on arguments provided
     804 *
     805 *
     806 * @since 1.0.2
     807 *
     808 * @param   string  $what       Must be one of three: 'forum', 'subforum' or 'topic' - refers to what you are checking exists. Default is forum.
     809 * @param   int     $what_id    Must be set and an integer otherwise won't return anything
     810 * @return  int     $user_id    Returns the user ID if the current user is logged in
     811 *                     
     812 */
     813function wpbb_check_exists($what = 'forum', $what_id) {
     814    if ((isset($what)) && (is_numeric($what_id))) {
     815        global $wpdb;
     816        if ($what == 'topic') {
     817            $topic_exists = $wpdb->get_var("SELECT id FROM ".TOPIC_TABLE." WHERE id = $what_id;");
     818            if ($topic_exists === NULL) {
     819                wpbb_goback1('forum-index');
     820                ?>
     821                <div class="wpbb-message-failure">
     822                    <?php _e('Sorry, that topic doesn\'t exist. Please try again.', 'wp-bb'); ?>
     823                </div>
     824                <?php
     825                wpbb_exit();
     826            }
     827        } else if ($what == 'forum' || $what == 'subforum') {
     828            $exists = $wpdb->get_var("SELECT id FROM ".CATEGORY_TABLE." WHERE id = $what_id;");
     829            if ($exists === NULL) {
     830                wpbb_goback1();
     831                $type = ($what == 'subforum') ? 'subforum' : 'forum';
     832                ?>
     833                <div class="wpbb-message-failure">
     834                    <?php _e('Sorry, that '.$type.' doesn\'t exist. Please try again.', 'wp-bb'); ?>
     835                </div>
     836                <?php
     837                wpbb_exit('forum-index');
     838            }
     839        }
     840    }
     841}
     842
     843/**
     844 * Displays the WPBB powered by footer if it is enabled in settings
     845 *
     846 *
     847 * @since 1.0.2
     848 *
     849 *
     850 */
     851function wpbb_footer() {
     852    $options = get_option('wpbb_options');
     853    if ($options['show_footer'] == 'yes') {
     854        ?>
     855        <div class="wpbb-forum-footer">
     856            <p>Powered by <a href="<?php echo WPBB_PLUGIN_URL; ?>">WPBB</a> <?php echo WPBB_VERSION; ?></p>
     857        </div>
     858        <?php
     859    }
     860}
     861
     862/**
     863 * Checks whether the $_GET key/value pair(s) (page) exists
     864 *
     865 *
     866 * @since 1.0.2
     867 *
     868 *
     869 */
     870function wpbb_page_exists() {   
     871    $allowed_get_values = array(
     872        'forum', 'subforum', 'topic', 'post', 'current_page', 'action', 'create',
     873        'profile', 'unread_topics', 'unanswered_topics',
     874        'message', 'messages', 'view', 'delete_msg',
     875        'code', 'state', 'register', 'method', 'login',
     876        'page_id'
     877    );
     878
     879    foreach ($_GET as $get => $value) {
     880        if (!in_array($get, $allowed_get_values)) {
     881            wpbb_goback1();
     882            ?>
     883            <div class="wpbb-message-failure">
     884                <?php _e('Sorry the page you requested could not be found. Please try again.', 'wp-bb'); ?>
     885            </div>
     886            <?php
     887            wpbb_exit();
     888        }
     889    }
     890}
    757891
    758892?>
  • wp-bulletin-board/trunk/php/wpbb-index.php

    r604652 r607181  
    55   
    66$user_id = get_current_user_id();
    7    
     7
    88if (isset($_POST['wpbb-search-submit'])) {
    99
    10     wpbb_goback1('search_results', NULL);
    11            
     10    if (!$user_id) {
     11        wpbb_is_user_logged_in();
     12        wpbb_exit();
     13    }
     14       
    1215    $search_criteria = wp_strip_all_tags($_POST['wpbb-search']);
    1316       
     
    1518   
    1619    if ($wpdb->num_rows === 0) {
     20        wpbb_goback1('search-results', NULL);
    1721        ?>
    1822        <div class="wpbb-message-failure">
     
    5761            $delete_topic_link = sprintf(__('<a href="%s">Delete</a>'), add_query_arg(array('forum' => $found->forum, 'topic' => $found->id, 'action' => 'delete'), get_permalink()));
    5862           
    59             $status = wpbb_get_topic_status_buttons($topic->status);
     63            $status = wpbb_get_topic_status_buttons($found->status);
    6064           
    6165            ?>
     
    105109    ?>
    106110    <p class="wpbb-centered">
    107         <a href='<?php echo add_query_arg(array('profile' => $user_id), wpbb_permalink()); ?>'><?php _e('My Profile', 'wp-bb'); ?></a> |
    108         <a href='<?php echo add_query_arg(array('unread_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unread Topics', 'wp-bb'); ?></a> |
    109         <a href='<?php echo add_query_arg(array('unanswered_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unanswered Topics', 'wp-bb'); ?></a> |
    110         <a href='<?php echo add_query_arg(array('messages' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('My Messages', 'wp-bb'); ?></a>
     111        <a href='<?php echo add_query_arg(array('profile' => $user_id), wpbb_permalink()); ?>'><?php _e('My Profile', 'wp-bb'); ?></a>
     112        | <a href='<?php echo add_query_arg(array('unread_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unread Topics', 'wp-bb'); ?></a>
     113        | <a href='<?php echo add_query_arg(array('unanswered_topics' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('Unanswered Topics', 'wp-bb'); ?></a>
     114        | <a href='<?php echo add_query_arg(array('messages' => 'all', 'current_page' => 1), wpbb_permalink()); ?>'><?php _e('My Messages', 'wp-bb'); ?></a>
    111115    </p>
    112116   
     
    127131   
    128132    // Grab all categories from the database
    129     $categories = $wpdb->get_results("SELECT * FROM ".CATEGORIES_TABLE." WHERE forum = 0 AND subforum = 0 ORDER BY `order`;");
     133    $categories = $wpdb->get_results("SELECT `id`, `name`, `order` FROM ".CATEGORIES_TABLE." WHERE forum = 0 AND subforum = 0 ORDER BY `order`;");
    130134    if ($categories) {
    131135        // Create our table
     
    141145            <?php
    142146            // Grab all forums which belong to the current category
    143             $forums = $wpdb->get_results("SELECT * FROM ".CATEGORIES_TABLE." WHERE forum = $category->id ORDER BY `order`;");
     147            $forums = $wpdb->get_results("SELECT `id`, `name`, `description`, `order` FROM ".CATEGORIES_TABLE." WHERE forum = $category->id ORDER BY `order`;");
    144148            if (!$forums) {
    145149                ?> <tr><td></td><td></td><td></td><td></td></tr><?php
     
    159163                        // Grab all subforums which belong to the current forum
    160164                        if ($options['allow_subforums'] == 'yes') {
    161                             $subforums = $wpdb->get_results("SELECT * FROM ".CATEGORIES_TABLE." WHERE subforum = $forum->id ORDER BY `order`;");
     165                            $subforums = $wpdb->get_results("SELECT `id`, `name`, `description`, `order` FROM ".CATEGORIES_TABLE." WHERE subforum = $forum->id ORDER BY `order`;");
    162166                            if ($subforums) {
    163167                                _e('Subforums: ', 'wp-bb');
  • wp-bulletin-board/trunk/php/wpbb-message-user.php

    r604862 r607181  
    11<?php
    22
    3 wpbb_goback1('message-user', NULL);
     3wpbb_goback1();
    44
    5 if ((isset($_GET['message']))
    6     && (count($_GET) === 1)) {
    7    
    8     if (isset($_POST['wpbb-message-submit'])) {
    9        
    10         if (isset($_POST['wpbb-message-to'])) {
    11             $to_name_stripped = wp_strip_all_tags($_POST['wpbb-message-to']);
    12        
    13             $to_id = wpbb_parse_author_name(NULL, $to_name_stripped);
     5if (isset($_POST['wpbb-message-submit'])) {
     6    if (isset($_POST['wpbb-message-to'])) {
     7        if (is_numeric($_POST['wpbb-message-to'])) {
     8            $to_id = absint($_POST['wpbb-message-to']);
     9            $to_name = wpbb_parse_author_name($to_id);
     10        } else {
     11            $to_name = wp_strip_all_tags($_POST['wpbb-message-to']);
     12            $to_id = wpbb_parse_author_name(NULL, $to_name);
     13        }
    1414           
    15             $check_id_exists = get_user_by('id', $to_id);
     15        $check_id_exists = get_user_by('id', $to_id);
    1616           
    17             if ($check_id_exists === false) {
     17        if ($check_id_exists === false) {
     18            ?>
     19            <div class="wpbb-message-failure">
     20                <?php
    1821                _e("Sorry, that user doesn't exist. Please try again", "wp-bb");
    19                 exit();
    20             }
     22                ?>
     23            </div>
     24            <?php
     25            wpbb_exit();
     26        }
    2127           
    22             $from = get_current_user_id();
    23            
    24             // Stops an empty title from being submitted which isn't openable by the recipient without manually modifying the URL
    25             /**
    26             * @todo ... 1. Allow blank subjects, perhaps replacing it with another character. 2. Delay between messages     
    27             */
    28             if (empty($_POST['wpbb-message-subject'])) {
    29                 _e("You must enter a subject for your message", "wp-bb");
    30                 exit();
    31             } else {
    32                 $subject = wp_strip_all_tags($_POST['wpbb-message-subject']);
    33             }
    34            
    35             $content = wpbb_strip_tags($_POST['wpbb-message-content']);
    36             $sent = date("Y-m-d H:i:s");
    37             $data = array('to' => $to_id, 'from' => $from, 'subject' => $subject, 'content' => $content, 'sent' => $sent);
    38             $send_message = $wpdb->insert(MESSAGES_TABLE, $data);
    39             if ($send_message === false) {
    40                 ?>
    41                 <div class="wpbb-message-failure">
    42                     <?php _e('There was an error sending the message. Please try again', 'wp-bb'); ?>
    43                 </div>
    44                 <?php
    45             } else {
    46                 ?>
    47                 <div class="wpbb-message-success">
    48                     <?php printf(__('Message to %s (%s) sent successfully.'), $to_name_stripped, $to_id); ?>
    49                 </div>
    50                 <?php
    51             }
     28        $from = get_current_user_id();
     29        if (empty($_POST['wpbb-message-subject'])) {
     30            ?>
     31            <div class="wpbb-message-failure">
     32                <?php _e("You must enter a subject for your message", "wp-bb"); ?>
     33            </div>
     34            <?php
     35            wpbb_exit();
     36        } else {
     37            $subject = wp_strip_all_tags($_POST['wpbb-message-subject']);
     38        }
     39        $content = wpbb_strip_tags($_POST['wpbb-message-content']);
     40        $sent = date("Y-m-d H:i:s");
     41        $data = array('to' => $to_id, 'from' => $from, 'subject' => $subject, 'content' => $content, 'sent' => $sent);
     42        $send_message = $wpdb->insert(MESSAGES_TABLE, $data);
     43        if ($send_message === false) {
     44            ?>
     45            <div class="wpbb-message-failure">
     46                <?php _e('There was an error sending the message. Please try again', 'wp-bb'); ?>
     47            </div>
     48            <?php
     49        } else {
     50            ?>
     51            <div class="wpbb-message-success">
     52                <?php printf(__('Message to %s (%s) sent successfully.'), $to_name, $to_id); ?>
     53            </div>
     54            <?php
    5255        }
    5356    }
     57}
     58   
     59$message_id = absint($_GET['message']);
     60
     61if ($message_id != 'to') {
    5462   
    5563    $message_id = absint($_GET['message']);
     64}
     65   
     66?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php
    5667
    57     if ($message_id != 'to') {
     68$message_username = wpbb_parse_author_name($message_id);
    5869   
    59         $message_id = absint($_GET['message']);
    60     }
    61    
    62     ?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php
    63 
    64     $message_username = wpbb_parse_author_name($message_id);
    65    
    66     ?>
    67     <table class="wpbb-table">
    68         <form method='POST' action='#'>
    69             <tr>
    70                 <th><?php _e('To', 'wp-bb'); ?></th>
    71                 <td>
    72                     <input type='text' name='wpbb-message-to' value='<?php echo $message_username; ?>' />
    73                 </td>
    74             </tr>
    75             <tr>
    76                 <th><?php _e('Subject', 'wp-bb'); ?></th>
    77                 <td>
    78                     <input type='text' name='wpbb-message-subject' value='' />
    79                 </td>
    80             </tr>
    81             <tr>
    82                 <th><?php _e('Content', 'wp-bb'); ?></th>
    83                 <td>
    84                      <?php wp_editor(" ", 'wpbb-message-content'); ?>
    85                 </td>
    86             </tr>
    87             <tr>
    88                 <th></th>
    89                 <td>
    90                     <input type='submit' name='wpbb-message-submit' value='<?php _e('Send Message', 'wp-bb'); ?>' />
    91                 </td>
    92             </tr>
    93         </form>
    94     </table>
    95     <?php
    96 }
    97 
    9870?>
     71<table class="wpbb-table">
     72    <form method='POST' action='#'>
     73        <tr>
     74            <th><?php _e('To', 'wp-bb'); ?></th>
     75            <td>
     76                <input type='text' name='wpbb-message-to' value='<?php echo $message_username; ?>' />
     77            </td>
     78        </tr>
     79        <tr>
     80            <th><?php _e('Subject', 'wp-bb'); ?></th>
     81            <td>
     82                <input type='text' name='wpbb-message-subject' value='' />
     83            </td>
     84        </tr>
     85        <tr>
     86            <th><?php _e('Content', 'wp-bb'); ?></th>
     87            <td>
     88                    <?php wp_editor("", 'wpbb-message-content'); ?>
     89            </td>
     90        </tr>
     91        <tr>
     92            <th></th>
     93            <td>
     94                <input type='submit' name='wpbb-message-submit' value='<?php _e('Send Message', 'wp-bb'); ?>' />
     95            </td>
     96        </tr>
     97    </form>
     98</table>
     99<?php
     100?>
  • wp-bulletin-board/trunk/php/wpbb-reply-topic.php

    r604652 r607181  
    11<?php
    22
    3 
    4 $user_id = get_current_user_id();
     3$user_id = get_current_user_id();
    54
    65$subforum = false;
    76
    87$subforum_id = NULL;
     8
     9wpbb_goback1('reply-topic', NULL);
    910
    1011
     
    2526$topic_id = absint($_GET['topic']);
    2627   
    27 wpbb_goback($forum_id, $subforum_id, $topic_id);   
     28
    2829   
    2930// Check forum permissions
  • wp-bulletin-board/trunk/php/wpbb-unanswered-topics.php

    r604652 r607181  
    11<?php
    22
    3     wpbb_goback1('unanswered_topics', NULL);
    4 
    5     $user_id = get_current_user_id();
     3    $user_id = wpbb_is_user_logged_in();
    64   
    7     if ($user_id != 0) {
    85    $options = get_option('wpbb_options');
    96    $topics_per_page = $options['topics_per_page'];
     
    2522    $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE created = last_reply;");
    2623    $topics = false;
    27     if ($total_topics > 0) {
     24    if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
    2825        wpbb_pagination(NULL, $current_page, $start, $limit, $total_topics, $topics_per_page);
     26        $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE created = last_reply ORDER by created DESC LIMIT $start, $limit;");
     27    } else {
    2928        $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE created = last_reply ORDER by created DESC LIMIT $start, $limit;");
    3029    }
    3130    if ($topics) {
     31        wpbb_goback1('unanswered_topics', NULL);
    3232        ?>
    33         <h3 class="wpbb-centered-bold"><?php _e('Unanswered Topics', 'wp-bb'); ?></h3>
     33        <h1 id="wpbb-h-1" class="wpbb-centered-bold"><?php _e('Unanswered Topics', 'wp-bb'); ?></h1>
    3434        <table class="wpbb-table">
    3535            <th><?php _e('Status', 'wp-bb'); ?></th>
     
    108108            ?> </table> <?php
    109109        } else {
     110            wpbb_goback1('unanswered_topics', NULL);
    110111            ?>
    111             <div class="wpbb-centered-bold">
     112            <div class="wpbb-message-failure">
    112113                <?php _e('There are no unanswered topics at this time.', 'wp-bb'); ?>
    113114            </div>
     
    115116        }
    116117   
    117         } else {
    118             ?>
    119             <div class="wpbb-centered-bold">
    120                 <?php _e('Please register or login to view this page', 'wp-bb'); ?>
    121             </div>
    122             <?php
    123         }
    124118?>
  • wp-bulletin-board/trunk/php/wpbb-unread-topics.php

    r604652 r607181  
    11<?php
    2     // Display go back link
    3      wpbb_goback1('unread-topics', NULL);
    42
    53     // Returns user ID
    6      $user_id = get_current_user_id();
     4     $user_id = wpbb_is_user_logged_in();
    75     
    8      if ($user_id != 0) {
    96   
    107        $user_lastvisit = get_user_meta($user_id, 'wpbb_lastvisit', true);
     
    3027            }
    3128        }
    32         $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE last_reply = '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0;");
     29        $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE last_reply > '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0;");
    3330       
    3431        $topics = false;
    3532       
    36         if ($total_topics > 0) {
     33        if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
    3734            wpbb_pagination(NULL, $current_page, $start, $limit, $total_topics, $topics_per_page);
    38             $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE last_reply = '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0 ORDER by last_reply DESC LIMIT $start, $limit;");
     35            $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE last_reply > '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0 ORDER by last_reply DESC LIMIT $start, $limit;");
     36        } else {
     37            $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE last_reply > '$user_lastvisit' AND last_reply < '$user_currentvisit' AND `read` = 0 ORDER by last_reply DESC LIMIT $start, $limit;");
    3938        }
    4039
    4140        if ($topics) {
     41            wpbb_goback1('unread-topics', NULL);
    4242            ?>
    43             <h3 class="wpbb-centered-bold">
     43            <h1 id="wpbb-h-1" class="wpbb-centered-bold">
    4444                <?php _e('Unread Topics Since Last Visit', 'wp-bb'); ?>
    45             </h3>
     45            </h1>
    4646            <table class="wpbb-table">
    4747                <th><?php _e('Status', 'wp-bb'); ?></th>
     
    9898                    $status = wpbb_get_topic_status_buttons($topic->status);
    9999                   
    100                    
     100                    $freshness = wpbb_get_topic_freshness($topic_last_post);
    101101
    102102                    ?>
     
    105105       
    106106                        <td>
    107                             <?php
     107                            <?php
     108                            echo $freshness;
    108109                            if ($status['locked'] != "") {
    109110                                echo $status['locked'];
     
    132133            <?php
    133134        } else {
     135            wpbb_goback1('unread-topics', NULL);
    134136            ?>
    135             <div class="wpbb-centered-bold">
     137            <div class="wpbb-message-failure">
    136138                <?php _e('There are no unread topics at this time', 'wp-bb'); ?>
    137139            </div>
     
    139141        }
    140142   
    141     } else {
    142         ?>
    143         <div class="wpbb-centered-bold">
    144             <?php _e('Please register or login to view this page', 'wp-bb'); ?>
    145         </div>
    146         <?php
    147     }
     143   
    148144?>
  • wp-bulletin-board/trunk/php/wpbb-view-forum-topic.php

    r604652 r607181  
    11<?php
    22
     3    $topic_id = absint($_GET['topic']);
     4   
     5    wpbb_check_exists('topic', $topic_id);
     6   
    37    $user_id = get_current_user_id();
     8   
    49    $forum = absint($_GET['forum']);
    510   
     
    2732    }
    2833
    29     $topic_id = absint($_GET['topic']);
     34   
    3035   
    3136    $topic_status = wpbb_get_topic_status($topic_id);
     
    174179            $topic_id = absint($_GET['topic']);
    175180            $total_posts = $wpdb->get_var("SELECT COUNT(*) as 'Posts' FROM ".POST_TABLE." WHERE topic = $topic->id;");
    176             wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     181            if (($total_posts > 0) && ($total_posts > $posts_per_page)) {
     182                wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     183            }
    177184            wpbb_buttons($forum, NULL, $topic_id, 'forum_topic');
    178185            $user_posts = get_user_meta($topic->author, 'wpbb_posts', true);
     
    227234                            <hr>
    228235                            <p class="wpbb-topic-and-post-signature">
    229                                 <?php echo $signature; ?>
     236                                <?php echo convert_smilies($signature); ?>
    230237                            </p>
    231238                        </td>
     
    269276                            <hr>
    270277                            <p class="wpbb-topic-and-post-signature"</p>
    271                             <?php echo $signature; ?>
     278                            <?php echo convert_smilies($signature); ?>
    272279                        </td>
    273280                    </tr>
     
    286293            <div class="wpbb-quick-reply">
    287294                <form action='#' method='POST'>
    288                     <tr>
    289                         <th><?php _e('Content', 'wp-bb'); ?></th>
    290                         <td><textarea name='wpbb-quick-reply-content'></textarea></td>
    291                     </tr>
    292                     <tr>
    293                         <th></th>
    294                         <td>
    295                             <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
    296                         </td>
    297                     </tr>
     295                    <div>
     296                        <?php _e('Content', 'wp-bb'); ?>
     297                    </div>
     298                    <div>
     299                        <textarea name='wpbb-quick-reply-content'></textarea>
     300                    </div>
     301                    <div>
     302                        <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
     303                    </div>
    298304                </form>
    299305            </div>
  • wp-bulletin-board/trunk/php/wpbb-view-forum.php

    r604652 r607181  
    22
    33    $forum = absint($_GET['forum']);
     4   
     5    wpbb_check_exists('forum', $forum);
    46   
    57    $user_id = get_current_user_id();
     
    810    $view_permissions = wpbb_user_has_permission($user_id, $forum);
    911    if ($view_permissions === false) {
    10         wpbb_goback1('forum_denied', NULL);
     12        wpbb_goback1('forum-index', NULL);
    1113        ?>
    1214        <div class="wpbb-message-failure">
     
    7981    $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE forum = $forum;");
    8082    $topics = false;
    81     if ($total_topics > 0) {
     83    if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
    8284        wpbb_pagination($forum, $current_page, $start, $limit, $total_topics, $topics_per_page);
    83         $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE."  WHERE forum = $forum ORDER BY FIELD(status, 'sticky', 'locked,sticky') DESC, last_reply DESC LIMIT $start, $limit;");
    8485    }
     86    $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE."  WHERE forum = $forum ORDER BY FIELD(status, 'sticky', 'locked,sticky') DESC, last_reply DESC LIMIT $start, $limit;");
    8587    wpbb_buttons($forum, NULL, NULL, 'forum');
    8688    // If 'sticky' is found in the set field, order by that first otherwise order by last_reply descending.
  • wp-bulletin-board/trunk/php/wpbb-view-message.php

    r604862 r607181  
    1414    ?>
    1515    <table class="wpbb-table">
    16     <?php
     16        <th><?php _e('From', 'wp-bb'); ?></th>
     17        <th><?php _e('Message', 'wp-bb'); ?></th>
     18        <?php
    1719        foreach ($get_message as $message) {
    1820            // Mark message as read
     
    2123            }   
    2224            $message_from_name = wpbb_parse_author_name($message->from);
     25            $message_from_avatar = get_avatar($message->from);
     26            $signature = get_user_meta($message->from, 'wpbb_signature', true);
     27            $reply_to_message = "<a href=".add_query_arg(array('message' => $message->from), wpbb_permalink()).">".__('Reply', 'wp-bb')."</a>";
     28            $delete_message = "<a href=".add_query_arg(array('messages' => 'all', 'delete_msg' => $message->id), wpbb_permalink()).">".__('Delete', 'wp-bb')."</a>";
    2329            ?>
    2430            <tr>
    25                 <th><?php _e('From', 'wp-bb'); ?></th>
    26                 <td><?php echo $message_from_name; ?></td>
    27             </tr>   
    28             <tr>
    29                 <th><?php _e('Sent', 'wp-bb'); ?></th>
    30                 <td><?php echo $message->sent; ?></td>
    31             </tr>
    32             <tr>
    33                 <th><?php _e('Subject', 'wp-bb'); ?></th>
    34                 <td><?php echo $message->subject; ?></td>
    35             </tr>
    36             <tr>
    37                 <th><?php _e('Content', 'wp-bb'); ?></th>
    38                 <td><?php echo $message->content; ?></td>
     31                <td class="wpbb-topic-profile">
     32                    <a href='<?php echo add_query_arg(array('profile' => $message->from), wpbb_permalink()); ?>'>
     33                        <?php echo $message_from_name; ?>
     34                    </a>
     35                    <br /><?php echo $message_from_avatar; ?>
     36                </td>
     37                <td>
     38                    <p class="wpbb-message-subject-date">
     39                        <strong><?php printf(__('( Subject: %s )'), $message->subject); ?></strong>
     40                        <?php echo  $message->sent . " " . $reply_to_message . " " . $delete_message; ?>
     41                    </p>
     42                   
     43                    <p class="wpbb-topic-and-post-content">
     44                       
     45                        <?php echo convert_smilies($message->content); ?>
     46                    </p>
     47                    <hr>
     48                    <p class="wpbb-topic-and-post-signature">
     49                        <?php echo convert_smilies($signature); ?>
     50                    </p>
     51                </td>
    3952            </tr>
    4053            <?php
  • wp-bulletin-board/trunk/php/wpbb-view-profile.php

    r604652 r607181  
    11<?php
     2
     3
     4$user_id = wpbb_is_user_logged_in();
     5
    26
    37/*
    48    Viewing a Profile
    59*/
    6    
    7     wpbb_goback1('view-profile', NULL);
    810   
    911    $profile_id = absint($_GET['profile']);
     
    1517        ?>
    1618        <div class="wpbb-centered-bold">
    17             <?php _e('Please register or login to access this page', 'wp-bb'); ?>
     19            <?php printf(__('You must <a href="%s">Login</a> or <a href="%s">Register</a> to be able to view the forum!'), wp_login_url(), site_url('wp-login.php?action=register')); ?>
    1820        </div>
    1921        <?php
     
    2123    }
    2224   
    23     if ($profile_id == get_current_user_id()) {
     25    wpbb_goback1();
     26   
     27   
     28    if ($profile_id == $user_id) {
    2429        ?>
    25         <h3 class="wpbb-centered-bold">
     30        <h1 id="wpbb-h-1" class="wpbb-centered-bold">
    2631            <?php _e('My Profile', 'wp-bb'); ?>
    27         </h3>
     32        </h1>
    2833        <?php
    2934    } else {
    3035        ?>
    31         <h3 class="wpbb-centered-bold">
     36        <h1 id="wpbb-h-1" class="wpbb-centered-bold">
    3237            <?php printf(__('Viewing %s\'s Profile'), $user->display_name); ?>
    33         </h3>
     38        </h1>
    3439        <?php
    3540    }
     
    126131       
    127132        <div class="clear"></div>
    128        
    129         <table id="wpbb-profile-signature">
    130        
    131             <form method='POST' action='#'>
    132        
    133                 <th><h2><?php _e('Signature', 'wp-bb'); ?></h2></th>
    134        
    135                 <tr><td><textarea name='wpbb-signature'><?php echo $signature; ?></textarea></td></tr>
    136        
    137                 <tr><td><input type='submit' name='wpbb-signature-submit' value='<?php _e('Save Signature', 'wp-bb'); ?>' />
    138        
     133        <div id="wpbb-profile-signature">
     134            <form method="POST" action="#">
     135                <div>
     136                    <h2><?php _e('Signature', 'wp-bb'); ?></h2>
     137                </div>
     138                <div>
     139                    <textarea name="wpbb-signature"><?php echo $signature; ?></textarea>
     140                </div>
     141                <div>
     142                    <input type="submit" name="wpbb-signature-submit" value="<?php _e('Save Signature', 'wp-bb'); ?>" />
     143                </div>
    139144            </form>
    140         </table>
     145        </div>
    141146        <?php
    142147    }
  • wp-bulletin-board/trunk/php/wpbb-view-subforum-topic.php

    r604652 r607181  
    22
    33    $topic_id = absint($_GET['topic']);
     4   
     5    wpbb_check_exists('topic', $topic_id);
    46   
    57    // Third parameter is 'view' by default
     
    161163                $forum = absint($_GET['forum']);
    162164                $total_posts = $wpdb->get_var("SELECT COUNT(*) as 'Posts' FROM ".POST_TABLE." WHERE topic = $topic->id;");
    163                 wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     165                if (($total_posts > 0) && ($total_posts > $posts_per_page)) {
     166                    wpbb_pagination($forum, $current_page, $start, $limit, $total_posts, $posts_per_page, false);
     167                }
    164168                wpbb_buttons($forum, $subforum, $topic_id, 'subforum_topic');
    165169                if ($current_page == 1) {
     
    181185                            <hr>
    182186                            <p class="wpbb-topic-and-post-signature">
    183                                 <?php echo $signature; ?>
     187                                <?php echo convert_smilies($signature); ?>
    184188                            </p>
    185189                        </td>
     
    213217                                <hr>
    214218                                <p class="wpbb-topic-and-post-signature">
    215                                     <?php echo $signature; ?>
     219                                    <?php echo convert_smilies($signature); ?>
    216220                                </p>
    217221                            </td>
     
    231235            <div class="wpbb-quick-reply">
    232236                <form action='#' method='POST'>
    233                     <tr>
    234                         <th><?php _e('Content', 'wp-bb'); ?></th>
    235                         <td><textarea name='wpbb-quick-reply-content'></textarea></td>
    236                     </tr>
    237                     <tr>
    238                         <th></th>
    239                         <td>
    240                             <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
    241                         </td>
    242                     </tr>
     237                    <div>
     238                        <?php _e('Content', 'wp-bb'); ?>
     239                    </div>
     240                    <div>
     241                        <textarea name='wpbb-quick-reply-content'></textarea>
     242                    </div>
     243                    <div>
     244                        <input type='submit' name='wpbb-quick-reply-submit' value='<?php _e('Quick Reply', 'wp-bb'); ?>' />
     245                    </div>
    243246                </form>
    244247            </div>
  • wp-bulletin-board/trunk/php/wpbb-view-subforum.php

    r604652 r607181  
    44
    55    $forum = absint($_GET['forum']);
     6   
     7    $subforum = absint($_GET['subforum']);
     8   
     9    wpbb_check_exists('subforum', $subforum);
     10   
     11   
     12   
    613    $view_permissions = wpbb_user_has_permission($user_id, $forum);
    714    if ($view_permissions === false) {
     
    1421        wpbb_exit();
    1522    } else {
    16         $subforum = absint($_GET['subforum']);
    1723        $view_permissions = wpbb_user_has_permission($user_id, $subforum);
    1824        if ($view_permissions === false) {
     
    5460    }
    5561    $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE subforum = $subforum;");
    56     wpbb_pagination($subforum, $current_page, $start, $limit, $total_topics, $topics_per_page);
    5762    wpbb_buttons($forum, $subforum, NULL, 'subforum');
    58     // End of pagination
     63    if (($total_topics > 0) && ($total_topics > $topics_per_page)) {
     64        wpbb_pagination($subforum, $current_page, $start, $limit, $total_topics, $topics_per_page);
     65    }
    5966    $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE subforum = $subforum ORDER BY created DESC LIMIT $start, $limit;");
    6067    if ($topics) {
  • wp-bulletin-board/trunk/readme.txt

    r604655 r607181  
    55Requires at least: 3.3
    66Tested up to: 3.4.2
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6868== Changelog ==
    6969
     70= 1.0.2 =
     71* Fixed pagination from displaying when there is only 1 page
     72* Fixed being able to view or post to non-existent forums/subforums/topics
     73* View message layout now resembles view topic / post layout with some adjustments
     74* Ability to reply to a message from the view message page
     75* Fixed smilies from not displaying correctly in topic, post, profile and messages signature
     76* Signature textarea is now more consistent across different themes
     77* Fixed topics status from displaying incorrectly when editing a topic
     78* Facebook and Twitter are disabled by default to prevent error messages
     79* Fixed compose message link under default permalinks
     80* Fixed delete message link
     81* Fixed inability to use ID when editing topic, post author and when composing a message.
     82* Improved maintenance message and reminder styling.
     83* Updated links on FAQ & Support
     84* You can now choose the default role a new facebook registration has in your settings
     85* Fixed registering facebook accounts if registration is disabled
     86
    7087= 1.0.1 =
     88* Minor bug fixes
     89* Fixed broken view message link
     90* Fixed table layout when a category doesn't have any forums
    7191* Fixed broken link in message which is displayed to logged out users
    7292* Fixed some layout issues due to CSS files not loading early enough, also added some css options for links and changed default visited link colour to blue
  • wp-bulletin-board/trunk/wp-bb.php

    r604665 r607181  
    11<?php
    22/*
    3     Plugin Name: wp-bb
    4     Plugin URI: http://codebycarter.com
     3    Plugin Name: WPBB
     4    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.1
     6    Version: 1.0.2
    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.0');
     47define('WPBB_VERSION', 'v1.0.2');
     48// Define plugin url (wp plugin page)
     49define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board');
    4850
    4951/*
     
    6971add_action('switch_theme', 'wpbb_create_template_file');
    7072add_action('wp_enqueue_scripts', 'wpbb_register_styles');
     73/*add_action('init', 'wpbb_setup_rewrite_rules');
     74add_action('init', 'wpbb_setup_rewrite_tags');
     75
     76function wpbb_setup_rewrite_rules() {
     77    add_rewrite_rule('forum(/([^\d]+))?', 'index.php/forums/?forum=$1', 'top');
     78}
     79function 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
     89function wpbb_setup_rewrite_rules() {
     90
     91    //add_rewrite_rule('carpage(/([^/]+))?(/([^/]+))?/?','index.php?pagename=carpage&var1=$matches[2]&var2=$matches[4]','top');
     92}
     93
     94add_action('init', 'wpbb_setup_rewrite_rules');
     95
    7196
    7297/*
     
    232257            'post_cutoff' => 15,
    233258            'post_to_forum' => 'yes',
    234             'show_footer' => 'no',
    235             'version' => WPBB_VERSION
     259            'show_footer' => 'no'
    236260        );
    237261        $add_wpbb_options = add_option('wpbb_options', $options);
     
    249273        $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb');
    250274        $facebook_state = __('Enter a long random string', 'wp-bb');
     275        $facebook_role = __('Enter the default role for new facebook registrations');
    251276        $facebook_options = array(
    252             'allow_facebook' => 'yes',
     277            'allow_facebook' => 'no',
    253278            'facebook_app_id' => $facebook_app_id,
    254279            'facebook_app_secret_key' => $facebook_app_secret_key,
    255280            'facebook_redirect_uri' => $facebook_redirect_uri,
    256             'facebook_state' => $facebook_state
     281            'facebook_state' => $facebook_state,
     282            'facebook_default_role' => $facebook_role
    257283        );
    258284        $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options);
     
    263289        $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb');
    264290        $twitter_options = array(
    265             'allow_twitter' => 'yes',
     291            'allow_twitter' => 'no',
    266292            'twitter_account' => $twitter_account
    267293        );
     
    332358    $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';");
    333359    if ($post_id == NULL) {
    334         $wpbb_page_title = __('Forum', 'wp-bb');
     360        $wpbb_page_title = __('Forums', 'wp-bb');
    335361        $link = site_url().'/'.strtolower($wpbb_page_title);
    336362        $page = array(
Note: See TracChangeset for help on using the changeset viewer.