Changeset 607181
- Timestamp:
- 10/02/2012 08:46:05 PM (13 years ago)
- Location:
- wp-bulletin-board
- Files:
-
- 52 edited
- 1 copied
-
tags/1.0.2 (copied) (copied from wp-bulletin-board/trunk)
-
tags/1.0.2/css/wpbb-dark-style.css (modified) (5 diffs)
-
tags/1.0.2/css/wpbb-light-style.css (modified) (6 diffs)
-
tags/1.0.2/php/admin/wpbb-admin-categories.php (modified) (5 diffs)
-
tags/1.0.2/php/admin/wpbb-admin-faq-support.php (modified) (3 diffs)
-
tags/1.0.2/php/admin/wpbb-admin-settings.php (modified) (5 diffs)
-
tags/1.0.2/php/facebook/wpbb-facebook.php (modified) (3 diffs)
-
tags/1.0.2/php/twitter/wpbb-twitter.php (modified) (1 diff)
-
tags/1.0.2/php/wpbb-all-messages.php (modified) (4 diffs)
-
tags/1.0.2/php/wpbb-create-topic.php (modified) (1 diff)
-
tags/1.0.2/php/wpbb-delete-topic.php (modified) (3 diffs)
-
tags/1.0.2/php/wpbb-edit-topic.php (modified) (4 diffs)
-
tags/1.0.2/php/wpbb-forum.php (modified) (12 diffs)
-
tags/1.0.2/php/wpbb-functions.php (modified) (5 diffs)
-
tags/1.0.2/php/wpbb-index.php (modified) (7 diffs)
-
tags/1.0.2/php/wpbb-message-user.php (modified) (1 diff)
-
tags/1.0.2/php/wpbb-reply-topic.php (modified) (2 diffs)
-
tags/1.0.2/php/wpbb-unanswered-topics.php (modified) (4 diffs)
-
tags/1.0.2/php/wpbb-unread-topics.php (modified) (6 diffs)
-
tags/1.0.2/php/wpbb-view-forum-topic.php (modified) (6 diffs)
-
tags/1.0.2/php/wpbb-view-forum.php (modified) (3 diffs)
-
tags/1.0.2/php/wpbb-view-message.php (modified) (2 diffs)
-
tags/1.0.2/php/wpbb-view-profile.php (modified) (4 diffs)
-
tags/1.0.2/php/wpbb-view-subforum-topic.php (modified) (5 diffs)
-
tags/1.0.2/php/wpbb-view-subforum.php (modified) (3 diffs)
-
tags/1.0.2/readme.txt (modified) (2 diffs)
-
tags/1.0.2/wp-bb.php (modified) (7 diffs)
-
trunk/css/wpbb-dark-style.css (modified) (5 diffs)
-
trunk/css/wpbb-light-style.css (modified) (6 diffs)
-
trunk/php/admin/wpbb-admin-categories.php (modified) (5 diffs)
-
trunk/php/admin/wpbb-admin-faq-support.php (modified) (3 diffs)
-
trunk/php/admin/wpbb-admin-settings.php (modified) (5 diffs)
-
trunk/php/facebook/wpbb-facebook.php (modified) (3 diffs)
-
trunk/php/twitter/wpbb-twitter.php (modified) (1 diff)
-
trunk/php/wpbb-all-messages.php (modified) (4 diffs)
-
trunk/php/wpbb-create-topic.php (modified) (1 diff)
-
trunk/php/wpbb-delete-topic.php (modified) (3 diffs)
-
trunk/php/wpbb-edit-topic.php (modified) (4 diffs)
-
trunk/php/wpbb-forum.php (modified) (12 diffs)
-
trunk/php/wpbb-functions.php (modified) (5 diffs)
-
trunk/php/wpbb-index.php (modified) (7 diffs)
-
trunk/php/wpbb-message-user.php (modified) (1 diff)
-
trunk/php/wpbb-reply-topic.php (modified) (2 diffs)
-
trunk/php/wpbb-unanswered-topics.php (modified) (4 diffs)
-
trunk/php/wpbb-unread-topics.php (modified) (6 diffs)
-
trunk/php/wpbb-view-forum-topic.php (modified) (6 diffs)
-
trunk/php/wpbb-view-forum.php (modified) (3 diffs)
-
trunk/php/wpbb-view-message.php (modified) (2 diffs)
-
trunk/php/wpbb-view-profile.php (modified) (4 diffs)
-
trunk/php/wpbb-view-subforum-topic.php (modified) (5 diffs)
-
trunk/php/wpbb-view-subforum.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-bb.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-bulletin-board/tags/1.0.2/css/wpbb-dark-style.css
r604652 r607181 14 14 /* Used for most messages */ 15 15 16 /* <h1> heading 1 */ 17 #wpbb-h-1 { 18 font-size:24px; 19 } 20 16 21 /* Centers text */ 17 22 .wpbb-centered { … … 48 53 #wpbb-search { 49 54 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;62 55 } 63 56 … … 137 130 /* Credit to http://css.dzone.com/news/css-message-boxes-different-me /* 138 131 /* Layout for the success and failure messages */ 139 .wpbb-message-success, .wpbb-message-failure {132 .wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning { 140 133 border: 1px solid; 141 134 margin: 10px 0px; … … 159 152 } 160 153 154 /* Warning message background and font color */ 155 .wpbb-message-warning { 156 color: #9F6000; 157 background-color: #FEEFB3; 158 text-align:center; 159 } 160 161 161 /* The create/reply buttons when viewing a forum/subforum/topic */ 162 162 .wpbb-topic-buttons { … … 195 195 } 196 196 197 /* The quick reply ona topic */197 /* The quick reply div at bottom of a topic */ 198 198 .wpbb-quick-reply { 199 199 margin-left:auto; 200 200 margin-right:auto; 201 width:50%;202 201 margin-bottom:100px; 203 202 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; 204 209 } 205 210 -
wp-bulletin-board/tags/1.0.2/css/wpbb-light-style.css
r604862 r607181 9 9 /* Used for most messages */ 10 10 11 /* <h1> heading 1 */ 12 #wpbb-h-1 { 13 font-size:24px; 14 } 15 11 16 /* Centers text */ 12 17 .wpbb-centered { … … 42 47 } 43 48 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 56 49 /* Defines the layout of all tables displayed on the front end */ 57 50 /* 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 */ 58 51 .wpbb-table { 59 width:100%;52 width:100%; 60 53 border: solid 0.1em; 61 54 border-color: #9E9E9E; … … 123 116 margin-left:auto; 124 117 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; 126 126 } 127 127 128 128 /* Credit to http://css.dzone.com/news/css-message-boxes-different-me /* 129 129 /* Layout for the success and failure messages */ 130 .wpbb-message-success, .wpbb-message-failure {130 .wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning { 131 131 border: 1px solid; 132 132 margin: 10px 0px; … … 150 150 } 151 151 152 /* Warning message background and font color */ 153 .wpbb-message-warning { 154 color: #9F6000; 155 background-color: #FEEFB3; 156 text-align:center; 157 } 158 152 159 /* Search Bar */ 153 160 #wpbb-search { … … 183 190 margin-top:auto; 184 191 border: 0; 185 width: 80%;192 width: auto; 186 193 } 187 194 … … 191 198 } 192 199 193 /* The quick reply textareaat bottom of a topic */200 /* The quick reply div at bottom of a topic */ 194 201 .wpbb-quick-reply { 195 202 margin-left:auto; 196 203 margin-right:auto; 197 width:50%;198 204 margin-bottom:100px; 199 205 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; 200 218 } 201 219 -
wp-bulletin-board/tags/1.0.2/php/admin/wpbb-admin-categories.php
r603518 r607181 103 103 foreach ($roles as $role) { 104 104 105 if ( $_POST['wpbbadvancedpermissionstable'.$role.'view']) {105 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'view'])) { 106 106 107 107 $permissions['view'][] = $role; 108 108 } 109 109 110 if ( $_POST['wpbbadvancedpermissionstable'.$role.'read']) {110 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'read'])) { 111 111 112 112 $permissions['read'][] = $role; 113 113 } 114 114 115 if ( $_POST['wpbbadvancedpermissionstable'.$role.'post']) {115 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'post'])) { 116 116 117 117 $permissions['post'][] = $role; 118 118 } 119 119 120 if ( $_POST['wpbbadvancedpermissionstable'.$role.'reply']) {120 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'reply'])) { 121 121 122 122 $permissions['reply'][] = $role; 123 123 } 124 124 125 if ( $_POST['wpbbadvancedpermissionstable'.$role.'edit']) {125 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'edit'])) { 126 126 127 127 $permissions['edit'][] = $role; 128 128 } 129 129 130 if ( $_POST['wpbbadvancedpermissionstable'.$role.'lock']) {130 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'lock'])) { 131 131 132 132 $permissions['lock'][] = $role; 133 133 } 134 134 135 if ( $_POST['wpbbadvancedpermissionstable'.$role.'delete']) {135 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'delete'])) { 136 136 137 137 $permissions['delete'][] = $role; 138 138 } 139 139 140 if ( $_POST['wpbbadvancedpermissionstable'.$role.'sticky']) {140 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'sticky'])) { 141 141 142 142 $permissions['sticky'][] = $role; 143 143 } 144 144 } 145 146 // This is a category 147 $forum_id = 0; 148 $subforum_id = 0; 145 149 146 150 $view_permissions = implode(",", $permissions['view']); … … 155 159 $data = array( 156 160 'name' => $name, 157 'forum' => 0,158 'subforum' => 0,161 'forum' => $forum_id, 162 'subforum' => $subforum_id, 159 163 'view' => $view_permissions, 160 164 'read' => $read_permissions, … … 173 177 174 178 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 181 184 } 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 187 190 } 188 191 } … … 198 201 199 202 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 206 208 } 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 212 214 } 213 215 … … 226 228 $id = absint($_GET['id']); 227 229 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 240 242 return; 241 243 } -
wp-bulletin-board/tags/1.0.2/php/admin/wpbb-admin-faq-support.php
r603518 r607181 57 57 <dl> 58 58 <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> 60 60 <dt><b><?php _e('Author Email', 'wp-bb'); ?></b></dt> 61 61 <dd>[email protected]</dd> … … 63 63 <b> 64 64 <?php 65 $options = get_option('wpbb_options');66 65 _e('Your version', 'wp-bb'); 67 66 ?> … … 70 69 <dd> 71 70 <?php 72 if (isset($options['version'])) { 73 $options['version']; 74 } else { 75 _e('Unknown version', 'wp-bb'); 76 } 71 echo WPBB_VERSION; 77 72 ?> 78 73 </dd> -
wp-bulletin-board/tags/1.0.2/php/admin/wpbb-admin-settings.php
r603518 r607181 80 80 81 81 (string) $facebook_state = wp_strip_all_tags($_POST['wpbbfacebookstate']); 82 82 83 $faceboook_default_role = strtolower(wp_strip_all_tags($_POST['wpbbfacebookdefaultrole'])); 84 83 85 $new_facebook_options = array( 84 86 'allow_facebook' => $facebook_support, … … 86 88 'facebook_app_secret_key' => $facebook_app_secret_key, 87 89 'facebook_redirect_uri' => $facebook_redirect_uri, 88 'facebook_state' => $facebook_state 90 'facebook_state' => $facebook_state, 91 'facebook_default_role' => $faceboook_default_role 89 92 ); 90 93 … … 303 306 </th> 304 307 <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 ?> 328 320 <input type='text' name='wpbbfacebookappid' value="<?php echo $facebook_app_id_value; ?>"/> 329 321 </td> … … 342 334 </th> 343 335 <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; ?>"/> 345 337 </td> 346 338 </tr> … … 350 342 </th> 351 343 <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> 357 356 <td><input type="submit" name="wpbb-facebook-settings-submit" class="button-primary" value="<?php _e('Save Changes', 'wp-bb'); ?>" /></td> 358 357 </tr> -
wp-bulletin-board/tags/1.0.2/php/facebook/wpbb-facebook.php
r603518 r607181 30 30 31 31 } 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 <?php48 }49 32 50 33 // Registering for a Wordpress account through Facebook 51 34 if ((isset($_GET['register'])) && (isset($_GET['method'])) && (count($_GET) == 2)) { 52 35 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 53 50 ?> 54 55 51 <h2 class="wpbb-centered-bold"> 56 52 … … 106 102 107 103 if ($facebook_user['id'] != 0) { // User is logged into Facebook 108 109 104 $logged_into_facebook = true; 110 111 105 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(); 114 114 } 115 116 115 $email_exists = email_exists($facebook_user['email']); 117 118 116 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 } 123 126 ?> 124 125 127 <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 ?> 162 148 </div> 163 149 <?php 164 165 150 } else { 166 167 151 _e('Please login to Facebook', 'wp-bb'); 168 169 152 } 170 153 } 171 154 } 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(); 175 163 } 176 164 } 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(); 179 173 } 180 174 } … … 221 215 $password = $data['registration']['password']; 222 216 $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)); 225 222 226 223 if (is_wp_error($create_user)) { 227 228 224 $errors = $create_user->get_error_messages(); 229 230 var_dump($errors);231 232 225 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(); 238 236 } 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(); 244 250 } 245 251 } -
wp-bulletin-board/tags/1.0.2/php/twitter/wpbb-twitter.php
r603518 r607181 4 4 Displays Twitter Follow button if twitter is enabled 5 5 */ 6 6 7 8 $twitter_username = "http://api.twitter.com/1/users/show.xml?screen_name=".$wpbb_twitter_options['twitter_account']; 9 10 if (!@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 7 18 8 19 if (count($_GET) == 0) { -
wp-bulletin-board/tags/1.0.2/php/wpbb-all-messages.php
r604868 r607181 1 1 <?php 2 2 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(); 18 4 19 5 global $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 20 19 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 20 if ($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> 73 53 <?php 74 54 foreach ($msgs as $msg) { … … 83 63 84 64 <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()); ?>'> 86 66 <?php printf(__('%s'), $msg->subject); ?> 87 67 </a> … … 94 74 </td> 95 75 <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()); ?>'> 97 77 <?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'); ?> 98 81 </a> 99 82 </td … … 105 88 <?php 106 89 } else { 90 wpbb_goback1('all-messages', NULL); 107 91 ?> 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())); ?> 110 94 </div> 111 95 <?php 112 96 } 113 }114 }115 116 117 // Deleting a message118 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 <?php137 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 <?php149 97 } 150 }151 152 153 98 ?> -
wp-bulletin-board/tags/1.0.2/php/wpbb-create-topic.php
r604652 r607181 4 4 5 5 $forum_id = absint($_GET['forum']); 6 7 wpbb_check_exists('forum', $forum_id); 6 8 7 9 if ((isset($_GET['forum'])) && (!isset($_GET['subforum']))) { -
wp-bulletin-board/tags/1.0.2/php/wpbb-delete-topic.php
r603518 r607181 1 1 <?php 2 wpbb_goback1(); 2 3 3 4 // Check user has permissions to delete topics or posts in this forum … … 65 66 ?> 66 67 <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 ?> 68 71 </div> 69 72 <?php … … 75 78 if ($changed_mind !== true && $success !== true) { 76 79 ?> 77 <h 2 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); ?> 80 83 </div> 81 84 <form method='POST' action='#' style='text-align:center;'> -
wp-bulletin-board/tags/1.0.2/php/wpbb-edit-topic.php
r604652 r607181 1 1 <?php 2 2 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 4 wpbb_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']); 13 if (isset($_GET['post'])) { 14 $post_id = absint($_GET['post']); 15 } 16 17 $view_permissions = wpbb_user_has_permission($user_id, $forum_id); 18 if ($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 58 if ($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) { 41 88 ?> 42 89 <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'); ?> 44 91 </div> 45 92 <?php 46 93 wpbb_exit(); 47 94 } 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) { 56 101 ?> 57 102 <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'); ?> 59 104 </div> 60 105 <?php 61 106 wpbb_exit(); 62 107 } 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); 193 156 ?> 194 157 <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> 195 167 <th><?php _e('Author', 'wp-bb'); ?></th> 196 168 <td> … … 209 181 <?php 210 182 } 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; 216 185 // Forums 217 186 ?> … … 280 249 <th><?php _e('Status', 'wp-bb'); ?></th> 281 250 <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'); ?> 284 253 </td> 285 254 <tr> … … 292 261 ?> 293 262 </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> 294 383 </table> 295 384 <?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 } 431 394 ?> -
wp-bulletin-board/tags/1.0.2/php/wpbb-forum.php
r604652 r607181 4 4 Checks if the plugin is deactivated 5 5 */ 6 6 7 7 8 // Since we're not in the admin area we must require the plugin.php file … … 16 17 ?> 17 18 <div style="text-align:center;font-weight:bold;color:red;"> 18 <?php 19 <?php 19 20 _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB', 'wp-bb'); 20 21 wpbb_exit(); … … 23 24 <?php 24 25 } 25 26 26 27 // Load WPBB Options 27 28 $wpbb_options = get_option('wpbb_options'); … … 63 64 && (!isset($_GET['method'])) 64 65 && (!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'); 65 70 ?> 66 71 <div class="wpbb-centered-bold"> 67 72 <?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(); 69 74 ?> 70 75 </div> 71 76 <?php 72 // Load facebook functionality if facebook is enabled73 if ($wpbb_facebook_options['allow_facebook'] == 'yes') {74 require_once('facebook/wpbb-facebook.php');75 }76 exit();77 77 } 78 78 … … 80 80 if (current_user_can('manage_options')) { 81 81 ?> 82 <div id="wpbb-admin-maintenance-reminder">82 <div class="wpbb-message-warning"> 83 83 <?php _e('The board is currently in maintenance mode. To turn it off change Maintenance Mode in Settings -> WPBB Settings to "Off"', 'wp-bb'); ?> 84 84 </div> … … 86 86 } else { 87 87 ?> 88 <div id="wpbb-maintenance-message">88 <div class="wpbb-message-warning"> 89 89 <?php echo $wpbb_options['maintenance_message']; ?> 90 90 </div> 91 91 <?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(); 92 97 wpbb_exit(); 93 98 } 94 99 } 95 100 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 105 require_once('wpbb-functions.php'); 106 107 /* 108 Checks a page supplied exists 109 */ 110 111 wpbb_page_exists(); 130 112 131 113 /* … … 137 119 } 138 120 121 139 122 /* 140 123 Twitter … … 147 130 } 148 131 149 /*150 Load all Functions151 */152 153 require_once('wpbb-functions.php');154 132 155 133 … … 246 224 } 247 225 248 249 /* 250 Viewing All Messages (& Delete) 226 /* 227 Viewing All Messages 251 228 */ 252 229 253 230 if ((isset($_GET['messages'])) 254 231 && (isset($_GET['page_id'])) 255 && (isset($_GET['current_page'])) 256 && ( $_GET['messages'] == 'all')) {232 && (isset($_GET['current_page'])) 233 && (count($_GET) == 3)) { 257 234 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'); 258 246 } 259 247 … … 479 467 480 468 /* 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 484 483 if ((isset($_GET['messages'])) 485 484 && ($_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 } 491 489 /* 492 490 Viewing Individual Message … … 495 493 if ((isset($_GET['messages'])) 496 494 && ($_GET['messages'] == 'all') 497 && ((isset($_GET['view'])) && ($_GET['view']))498 && (count($_GET) == 2)) {495 && ((isset($_GET['view'])) 496 && (count($_GET) == 2))) { 499 497 require_once('wpbb-view-message.php'); 500 498 } … … 624 622 } 625 623 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 } 624 wpbb_footer(); 625 634 626 ?> -
wp-bulletin-board/tags/1.0.2/php/wpbb-functions.php
r604652 r607181 86 86 * 87 87 * 88 * @since 1.0. 188 * @since 1.0.2 89 89 * 90 90 * @param int $forum_id The ID of the forum … … 100 100 $forum_id = isset($_GET['forum']) ? $_GET['forum'] : NULL; 101 101 $subforum_id = isset($_GET['subforum']) ? $_GET['subforum'] : NULL; 102 $topic_id = isset($_GET['topic']) ? $_GET['topic'] : NULL; 102 103 $query_args = array('forum' => $forum_id, 'subforum' => $subforum_id, 'topic' => $topic_id, 'current_page' => 1); 103 104 $count = array(); … … 113 114 } 114 115 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; 115 123 default: 116 124 ?> … … 348 356 349 357 if (empty($user_roles)) { 358 wpbb_goback1('forum-index', NULL); 350 359 ?> 351 360 <div class="wpbb-message-failure"> … … 755 764 } 756 765 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 */ 776 function 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 */ 813 function 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 */ 851 function 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 */ 870 function 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 } 757 891 758 892 ?> -
wp-bulletin-board/tags/1.0.2/php/wpbb-index.php
r604652 r607181 5 5 6 6 $user_id = get_current_user_id(); 7 7 8 8 if (isset($_POST['wpbb-search-submit'])) { 9 9 10 wpbb_goback1('search_results', NULL); 11 10 if (!$user_id) { 11 wpbb_is_user_logged_in(); 12 wpbb_exit(); 13 } 14 12 15 $search_criteria = wp_strip_all_tags($_POST['wpbb-search']); 13 16 … … 15 18 16 19 if ($wpdb->num_rows === 0) { 20 wpbb_goback1('search-results', NULL); 17 21 ?> 18 22 <div class="wpbb-message-failure"> … … 57 61 $delete_topic_link = sprintf(__('<a href="%s">Delete</a>'), add_query_arg(array('forum' => $found->forum, 'topic' => $found->id, 'action' => 'delete'), get_permalink())); 58 62 59 $status = wpbb_get_topic_status_buttons($ topic->status);63 $status = wpbb_get_topic_status_buttons($found->status); 60 64 61 65 ?> … … 105 109 ?> 106 110 <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> 111 115 </p> 112 116 … … 127 131 128 132 // 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`;"); 130 134 if ($categories) { 131 135 // Create our table … … 141 145 <?php 142 146 // 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`;"); 144 148 if (!$forums) { 145 149 ?> <tr><td></td><td></td><td></td><td></td></tr><?php … … 159 163 // Grab all subforums which belong to the current forum 160 164 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`;"); 162 166 if ($subforums) { 163 167 _e('Subforums: ', 'wp-bb'); -
wp-bulletin-board/tags/1.0.2/php/wpbb-message-user.php
r604862 r607181 1 1 <?php 2 2 3 wpbb_goback1( 'message-user', NULL);3 wpbb_goback1(); 4 4 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);5 if (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 } 14 14 15 $check_id_exists = get_user_by('id', $to_id);15 $check_id_exists = get_user_by('id', $to_id); 16 16 17 if ($check_id_exists === false) { 17 if ($check_id_exists === false) { 18 ?> 19 <div class="wpbb-message-failure"> 20 <?php 18 21 _e("Sorry, that user doesn't exist. Please try again", "wp-bb"); 19 exit(); 20 } 22 ?> 23 </div> 24 <?php 25 wpbb_exit(); 26 } 21 27 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 52 55 } 53 56 } 57 } 58 59 $message_id = absint($_GET['message']); 60 61 if ($message_id != 'to') { 54 62 55 63 $message_id = absint($_GET['message']); 64 } 65 66 ?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php 56 67 57 if ($message_id != 'to') { 68 $message_username = wpbb_parse_author_name($message_id); 58 69 59 $message_id = absint($_GET['message']);60 }61 62 ?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php63 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 <?php96 }97 98 70 ?> 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 1 1 <?php 2 2 3 4 $user_id = get_current_user_id(); 3 $user_id = get_current_user_id(); 5 4 6 5 $subforum = false; 7 6 8 7 $subforum_id = NULL; 8 9 wpbb_goback1('reply-topic', NULL); 9 10 10 11 … … 25 26 $topic_id = absint($_GET['topic']); 26 27 27 wpbb_goback($forum_id, $subforum_id, $topic_id); 28 28 29 29 30 // Check forum permissions -
wp-bulletin-board/tags/1.0.2/php/wpbb-unanswered-topics.php
r604652 r607181 1 1 <?php 2 2 3 wpbb_goback1('unanswered_topics', NULL); 4 5 $user_id = get_current_user_id(); 3 $user_id = wpbb_is_user_logged_in(); 6 4 7 if ($user_id != 0) {8 5 $options = get_option('wpbb_options'); 9 6 $topics_per_page = $options['topics_per_page']; … … 25 22 $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE created = last_reply;"); 26 23 $topics = false; 27 if ( $total_topics > 0) {24 if (($total_topics > 0) && ($total_topics > $topics_per_page)) { 28 25 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 { 29 28 $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE created = last_reply ORDER by created DESC LIMIT $start, $limit;"); 30 29 } 31 30 if ($topics) { 31 wpbb_goback1('unanswered_topics', NULL); 32 32 ?> 33 <h 3 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> 34 34 <table class="wpbb-table"> 35 35 <th><?php _e('Status', 'wp-bb'); ?></th> … … 108 108 ?> </table> <?php 109 109 } else { 110 wpbb_goback1('unanswered_topics', NULL); 110 111 ?> 111 <div class="wpbb- centered-bold">112 <div class="wpbb-message-failure"> 112 113 <?php _e('There are no unanswered topics at this time.', 'wp-bb'); ?> 113 114 </div> … … 115 116 } 116 117 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 <?php123 }124 118 ?> -
wp-bulletin-board/tags/1.0.2/php/wpbb-unread-topics.php
r604652 r607181 1 1 <?php 2 // Display go back link3 wpbb_goback1('unread-topics', NULL);4 2 5 3 // Returns user ID 6 $user_id = get_current_user_id();4 $user_id = wpbb_is_user_logged_in(); 7 5 8 if ($user_id != 0) {9 6 10 7 $user_lastvisit = get_user_meta($user_id, 'wpbb_lastvisit', true); … … 30 27 } 31 28 } 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;"); 33 30 34 31 $topics = false; 35 32 36 if ( $total_topics > 0) {33 if (($total_topics > 0) && ($total_topics > $topics_per_page)) { 37 34 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;"); 39 38 } 40 39 41 40 if ($topics) { 41 wpbb_goback1('unread-topics', NULL); 42 42 ?> 43 <h 3class="wpbb-centered-bold">43 <h1 id="wpbb-h-1" class="wpbb-centered-bold"> 44 44 <?php _e('Unread Topics Since Last Visit', 'wp-bb'); ?> 45 </h 3>45 </h1> 46 46 <table class="wpbb-table"> 47 47 <th><?php _e('Status', 'wp-bb'); ?></th> … … 98 98 $status = wpbb_get_topic_status_buttons($topic->status); 99 99 100 100 $freshness = wpbb_get_topic_freshness($topic_last_post); 101 101 102 102 ?> … … 105 105 106 106 <td> 107 <?php 107 <?php 108 echo $freshness; 108 109 if ($status['locked'] != "") { 109 110 echo $status['locked']; … … 132 133 <?php 133 134 } else { 135 wpbb_goback1('unread-topics', NULL); 134 136 ?> 135 <div class="wpbb- centered-bold">137 <div class="wpbb-message-failure"> 136 138 <?php _e('There are no unread topics at this time', 'wp-bb'); ?> 137 139 </div> … … 139 141 } 140 142 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 148 144 ?> -
wp-bulletin-board/tags/1.0.2/php/wpbb-view-forum-topic.php
r604652 r607181 1 1 <?php 2 2 3 $topic_id = absint($_GET['topic']); 4 5 wpbb_check_exists('topic', $topic_id); 6 3 7 $user_id = get_current_user_id(); 8 4 9 $forum = absint($_GET['forum']); 5 10 … … 27 32 } 28 33 29 $topic_id = absint($_GET['topic']);34 30 35 31 36 $topic_status = wpbb_get_topic_status($topic_id); … … 174 179 $topic_id = absint($_GET['topic']); 175 180 $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 } 177 184 wpbb_buttons($forum, NULL, $topic_id, 'forum_topic'); 178 185 $user_posts = get_user_meta($topic->author, 'wpbb_posts', true); … … 227 234 <hr> 228 235 <p class="wpbb-topic-and-post-signature"> 229 <?php echo $signature; ?>236 <?php echo convert_smilies($signature); ?> 230 237 </p> 231 238 </td> … … 269 276 <hr> 270 277 <p class="wpbb-topic-and-post-signature"</p> 271 <?php echo $signature; ?>278 <?php echo convert_smilies($signature); ?> 272 279 </td> 273 280 </tr> … … 286 293 <div class="wpbb-quick-reply"> 287 294 <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> 298 304 </form> 299 305 </div> -
wp-bulletin-board/tags/1.0.2/php/wpbb-view-forum.php
r604652 r607181 2 2 3 3 $forum = absint($_GET['forum']); 4 5 wpbb_check_exists('forum', $forum); 4 6 5 7 $user_id = get_current_user_id(); … … 8 10 $view_permissions = wpbb_user_has_permission($user_id, $forum); 9 11 if ($view_permissions === false) { 10 wpbb_goback1('forum _denied', NULL);12 wpbb_goback1('forum-index', NULL); 11 13 ?> 12 14 <div class="wpbb-message-failure"> … … 79 81 $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE forum = $forum;"); 80 82 $topics = false; 81 if ( $total_topics > 0) {83 if (($total_topics > 0) && ($total_topics > $topics_per_page)) { 82 84 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;");84 85 } 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;"); 85 87 wpbb_buttons($forum, NULL, NULL, 'forum'); 86 88 // 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 14 14 ?> 15 15 <table class="wpbb-table"> 16 <?php 16 <th><?php _e('From', 'wp-bb'); ?></th> 17 <th><?php _e('Message', 'wp-bb'); ?></th> 18 <?php 17 19 foreach ($get_message as $message) { 18 20 // Mark message as read … … 21 23 } 22 24 $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>"; 23 29 ?> 24 30 <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> 39 52 </tr> 40 53 <?php -
wp-bulletin-board/tags/1.0.2/php/wpbb-view-profile.php
r604652 r607181 1 1 <?php 2 3 4 $user_id = wpbb_is_user_logged_in(); 5 2 6 3 7 /* 4 8 Viewing a Profile 5 9 */ 6 7 wpbb_goback1('view-profile', NULL);8 10 9 11 $profile_id = absint($_GET['profile']); … … 15 17 ?> 16 18 <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')); ?> 18 20 </div> 19 21 <?php … … 21 23 } 22 24 23 if ($profile_id == get_current_user_id()) { 25 wpbb_goback1(); 26 27 28 if ($profile_id == $user_id) { 24 29 ?> 25 <h 3class="wpbb-centered-bold">30 <h1 id="wpbb-h-1" class="wpbb-centered-bold"> 26 31 <?php _e('My Profile', 'wp-bb'); ?> 27 </h 3>32 </h1> 28 33 <?php 29 34 } else { 30 35 ?> 31 <h 3class="wpbb-centered-bold">36 <h1 id="wpbb-h-1" class="wpbb-centered-bold"> 32 37 <?php printf(__('Viewing %s\'s Profile'), $user->display_name); ?> 33 </h 3>38 </h1> 34 39 <?php 35 40 } … … 126 131 127 132 <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> 139 144 </form> 140 </ table>145 </div> 141 146 <?php 142 147 } -
wp-bulletin-board/tags/1.0.2/php/wpbb-view-subforum-topic.php
r604652 r607181 2 2 3 3 $topic_id = absint($_GET['topic']); 4 5 wpbb_check_exists('topic', $topic_id); 4 6 5 7 // Third parameter is 'view' by default … … 161 163 $forum = absint($_GET['forum']); 162 164 $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 } 164 168 wpbb_buttons($forum, $subforum, $topic_id, 'subforum_topic'); 165 169 if ($current_page == 1) { … … 181 185 <hr> 182 186 <p class="wpbb-topic-and-post-signature"> 183 <?php echo $signature; ?>187 <?php echo convert_smilies($signature); ?> 184 188 </p> 185 189 </td> … … 213 217 <hr> 214 218 <p class="wpbb-topic-and-post-signature"> 215 <?php echo $signature; ?>219 <?php echo convert_smilies($signature); ?> 216 220 </p> 217 221 </td> … … 231 235 <div class="wpbb-quick-reply"> 232 236 <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> 243 246 </form> 244 247 </div> -
wp-bulletin-board/tags/1.0.2/php/wpbb-view-subforum.php
r604652 r607181 4 4 5 5 $forum = absint($_GET['forum']); 6 7 $subforum = absint($_GET['subforum']); 8 9 wpbb_check_exists('subforum', $subforum); 10 11 12 6 13 $view_permissions = wpbb_user_has_permission($user_id, $forum); 7 14 if ($view_permissions === false) { … … 14 21 wpbb_exit(); 15 22 } else { 16 $subforum = absint($_GET['subforum']);17 23 $view_permissions = wpbb_user_has_permission($user_id, $subforum); 18 24 if ($view_permissions === false) { … … 54 60 } 55 61 $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);57 62 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 } 59 66 $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE subforum = $subforum ORDER BY created DESC LIMIT $start, $limit;"); 60 67 if ($topics) { -
wp-bulletin-board/tags/1.0.2/readme.txt
r604655 r607181 5 5 Requires at least: 3.3 6 6 Tested up to: 3.4.2 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 68 68 == Changelog == 69 69 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 70 87 = 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 71 91 * Fixed broken link in message which is displayed to logged out users 72 92 * 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 1 1 <?php 2 2 /* 3 Plugin Name: wp-bb4 Plugin URI: http:// codebycarter.com3 Plugin Name: WPBB 4 Plugin URI: http://wordpress.org/extend/plugins/wp-bulletin-board/ 5 5 Description: An easy to use Bulletin board for Wordpress with Facebook and Twitter integration. 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: Jay Carter 8 8 Author URI: http://codebycarter.com … … 45 45 define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages'); 46 46 // Define current version 47 define('WPBB_VERSION', 'v1.0.0'); 47 define('WPBB_VERSION', 'v1.0.2'); 48 // Define plugin url (wp plugin page) 49 define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board'); 48 50 49 51 /* … … 69 71 add_action('switch_theme', 'wpbb_create_template_file'); 70 72 add_action('wp_enqueue_scripts', 'wpbb_register_styles'); 73 /*add_action('init', 'wpbb_setup_rewrite_rules'); 74 add_action('init', 'wpbb_setup_rewrite_tags'); 75 76 function wpbb_setup_rewrite_rules() { 77 add_rewrite_rule('forum(/([^\d]+))?', 'index.php/forums/?forum=$1', 'top'); 78 } 79 function wpbb_setup_rewrite_tags() { 80 global $wp; 81 $wp->add_query_var('forum'); 82 }*/ 83 84 /* 85 Could've used this, overwritten _http_build_query to set the value seperator to / aswell, but its not pluggable or hookable. 86 */ 87 //var_dump(_http_build_query(array('forum', 'page'), null, '/', '/', false)); 88 89 function wpbb_setup_rewrite_rules() { 90 91 //add_rewrite_rule('carpage(/([^/]+))?(/([^/]+))?/?','index.php?pagename=carpage&var1=$matches[2]&var2=$matches[4]','top'); 92 } 93 94 add_action('init', 'wpbb_setup_rewrite_rules'); 95 71 96 72 97 /* … … 232 257 'post_cutoff' => 15, 233 258 'post_to_forum' => 'yes', 234 'show_footer' => 'no', 235 'version' => WPBB_VERSION 259 'show_footer' => 'no' 236 260 ); 237 261 $add_wpbb_options = add_option('wpbb_options', $options); … … 249 273 $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb'); 250 274 $facebook_state = __('Enter a long random string', 'wp-bb'); 275 $facebook_role = __('Enter the default role for new facebook registrations'); 251 276 $facebook_options = array( 252 'allow_facebook' => ' yes',277 'allow_facebook' => 'no', 253 278 'facebook_app_id' => $facebook_app_id, 254 279 'facebook_app_secret_key' => $facebook_app_secret_key, 255 280 'facebook_redirect_uri' => $facebook_redirect_uri, 256 'facebook_state' => $facebook_state 281 'facebook_state' => $facebook_state, 282 'facebook_default_role' => $facebook_role 257 283 ); 258 284 $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options); … … 263 289 $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb'); 264 290 $twitter_options = array( 265 'allow_twitter' => ' yes',291 'allow_twitter' => 'no', 266 292 'twitter_account' => $twitter_account 267 293 ); … … 332 358 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';"); 333 359 if ($post_id == NULL) { 334 $wpbb_page_title = __('Forum ', 'wp-bb');360 $wpbb_page_title = __('Forums', 'wp-bb'); 335 361 $link = site_url().'/'.strtolower($wpbb_page_title); 336 362 $page = array( -
wp-bulletin-board/trunk/css/wpbb-dark-style.css
r604652 r607181 14 14 /* Used for most messages */ 15 15 16 /* <h1> heading 1 */ 17 #wpbb-h-1 { 18 font-size:24px; 19 } 20 16 21 /* Centers text */ 17 22 .wpbb-centered { … … 48 53 #wpbb-search { 49 54 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;62 55 } 63 56 … … 137 130 /* Credit to http://css.dzone.com/news/css-message-boxes-different-me /* 138 131 /* Layout for the success and failure messages */ 139 .wpbb-message-success, .wpbb-message-failure {132 .wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning { 140 133 border: 1px solid; 141 134 margin: 10px 0px; … … 159 152 } 160 153 154 /* Warning message background and font color */ 155 .wpbb-message-warning { 156 color: #9F6000; 157 background-color: #FEEFB3; 158 text-align:center; 159 } 160 161 161 /* The create/reply buttons when viewing a forum/subforum/topic */ 162 162 .wpbb-topic-buttons { … … 195 195 } 196 196 197 /* The quick reply ona topic */197 /* The quick reply div at bottom of a topic */ 198 198 .wpbb-quick-reply { 199 199 margin-left:auto; 200 200 margin-right:auto; 201 width:50%;202 201 margin-bottom:100px; 203 202 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; 204 209 } 205 210 -
wp-bulletin-board/trunk/css/wpbb-light-style.css
r604862 r607181 9 9 /* Used for most messages */ 10 10 11 /* <h1> heading 1 */ 12 #wpbb-h-1 { 13 font-size:24px; 14 } 15 11 16 /* Centers text */ 12 17 .wpbb-centered { … … 42 47 } 43 48 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 56 49 /* Defines the layout of all tables displayed on the front end */ 57 50 /* 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 */ 58 51 .wpbb-table { 59 width:100%;52 width:100%; 60 53 border: solid 0.1em; 61 54 border-color: #9E9E9E; … … 123 116 margin-left:auto; 124 117 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; 126 126 } 127 127 128 128 /* Credit to http://css.dzone.com/news/css-message-boxes-different-me /* 129 129 /* Layout for the success and failure messages */ 130 .wpbb-message-success, .wpbb-message-failure {130 .wpbb-message-success, .wpbb-message-failure, .wpbb-message-warning { 131 131 border: 1px solid; 132 132 margin: 10px 0px; … … 150 150 } 151 151 152 /* Warning message background and font color */ 153 .wpbb-message-warning { 154 color: #9F6000; 155 background-color: #FEEFB3; 156 text-align:center; 157 } 158 152 159 /* Search Bar */ 153 160 #wpbb-search { … … 183 190 margin-top:auto; 184 191 border: 0; 185 width: 80%;192 width: auto; 186 193 } 187 194 … … 191 198 } 192 199 193 /* The quick reply textareaat bottom of a topic */200 /* The quick reply div at bottom of a topic */ 194 201 .wpbb-quick-reply { 195 202 margin-left:auto; 196 203 margin-right:auto; 197 width:50%;198 204 margin-bottom:100px; 199 205 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; 200 218 } 201 219 -
wp-bulletin-board/trunk/php/admin/wpbb-admin-categories.php
r603518 r607181 103 103 foreach ($roles as $role) { 104 104 105 if ( $_POST['wpbbadvancedpermissionstable'.$role.'view']) {105 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'view'])) { 106 106 107 107 $permissions['view'][] = $role; 108 108 } 109 109 110 if ( $_POST['wpbbadvancedpermissionstable'.$role.'read']) {110 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'read'])) { 111 111 112 112 $permissions['read'][] = $role; 113 113 } 114 114 115 if ( $_POST['wpbbadvancedpermissionstable'.$role.'post']) {115 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'post'])) { 116 116 117 117 $permissions['post'][] = $role; 118 118 } 119 119 120 if ( $_POST['wpbbadvancedpermissionstable'.$role.'reply']) {120 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'reply'])) { 121 121 122 122 $permissions['reply'][] = $role; 123 123 } 124 124 125 if ( $_POST['wpbbadvancedpermissionstable'.$role.'edit']) {125 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'edit'])) { 126 126 127 127 $permissions['edit'][] = $role; 128 128 } 129 129 130 if ( $_POST['wpbbadvancedpermissionstable'.$role.'lock']) {130 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'lock'])) { 131 131 132 132 $permissions['lock'][] = $role; 133 133 } 134 134 135 if ( $_POST['wpbbadvancedpermissionstable'.$role.'delete']) {135 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'delete'])) { 136 136 137 137 $permissions['delete'][] = $role; 138 138 } 139 139 140 if ( $_POST['wpbbadvancedpermissionstable'.$role.'sticky']) {140 if (isset($_POST['wpbbadvancedpermissionstable'.$role.'sticky'])) { 141 141 142 142 $permissions['sticky'][] = $role; 143 143 } 144 144 } 145 146 // This is a category 147 $forum_id = 0; 148 $subforum_id = 0; 145 149 146 150 $view_permissions = implode(",", $permissions['view']); … … 155 159 $data = array( 156 160 'name' => $name, 157 'forum' => 0,158 'subforum' => 0,161 'forum' => $forum_id, 162 'subforum' => $subforum_id, 159 163 'view' => $view_permissions, 160 164 'read' => $read_permissions, … … 173 177 174 178 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 181 184 } 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 187 190 } 188 191 } … … 198 201 199 202 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 206 208 } 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 212 214 } 213 215 … … 226 228 $id = absint($_GET['id']); 227 229 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 240 242 return; 241 243 } -
wp-bulletin-board/trunk/php/admin/wpbb-admin-faq-support.php
r603518 r607181 57 57 <dl> 58 58 <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> 60 60 <dt><b><?php _e('Author Email', 'wp-bb'); ?></b></dt> 61 61 <dd>[email protected]</dd> … … 63 63 <b> 64 64 <?php 65 $options = get_option('wpbb_options');66 65 _e('Your version', 'wp-bb'); 67 66 ?> … … 70 69 <dd> 71 70 <?php 72 if (isset($options['version'])) { 73 $options['version']; 74 } else { 75 _e('Unknown version', 'wp-bb'); 76 } 71 echo WPBB_VERSION; 77 72 ?> 78 73 </dd> -
wp-bulletin-board/trunk/php/admin/wpbb-admin-settings.php
r603518 r607181 80 80 81 81 (string) $facebook_state = wp_strip_all_tags($_POST['wpbbfacebookstate']); 82 82 83 $faceboook_default_role = strtolower(wp_strip_all_tags($_POST['wpbbfacebookdefaultrole'])); 84 83 85 $new_facebook_options = array( 84 86 'allow_facebook' => $facebook_support, … … 86 88 'facebook_app_secret_key' => $facebook_app_secret_key, 87 89 'facebook_redirect_uri' => $facebook_redirect_uri, 88 'facebook_state' => $facebook_state 90 'facebook_state' => $facebook_state, 91 'facebook_default_role' => $faceboook_default_role 89 92 ); 90 93 … … 303 306 </th> 304 307 <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 ?> 328 320 <input type='text' name='wpbbfacebookappid' value="<?php echo $facebook_app_id_value; ?>"/> 329 321 </td> … … 342 334 </th> 343 335 <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; ?>"/> 345 337 </td> 346 338 </tr> … … 350 342 </th> 351 343 <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> 357 356 <td><input type="submit" name="wpbb-facebook-settings-submit" class="button-primary" value="<?php _e('Save Changes', 'wp-bb'); ?>" /></td> 358 357 </tr> -
wp-bulletin-board/trunk/php/facebook/wpbb-facebook.php
r603518 r607181 30 30 31 31 } 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 <?php48 }49 32 50 33 // Registering for a Wordpress account through Facebook 51 34 if ((isset($_GET['register'])) && (isset($_GET['method'])) && (count($_GET) == 2)) { 52 35 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 53 50 ?> 54 55 51 <h2 class="wpbb-centered-bold"> 56 52 … … 106 102 107 103 if ($facebook_user['id'] != 0) { // User is logged into Facebook 108 109 104 $logged_into_facebook = true; 110 111 105 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(); 114 114 } 115 116 115 $email_exists = email_exists($facebook_user['email']); 117 118 116 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 } 123 126 ?> 124 125 127 <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 ?> 162 148 </div> 163 149 <?php 164 165 150 } else { 166 167 151 _e('Please login to Facebook', 'wp-bb'); 168 169 152 } 170 153 } 171 154 } 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(); 175 163 } 176 164 } 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(); 179 173 } 180 174 } … … 221 215 $password = $data['registration']['password']; 222 216 $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)); 225 222 226 223 if (is_wp_error($create_user)) { 227 228 224 $errors = $create_user->get_error_messages(); 229 230 var_dump($errors);231 232 225 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(); 238 236 } 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(); 244 250 } 245 251 } -
wp-bulletin-board/trunk/php/twitter/wpbb-twitter.php
r603518 r607181 4 4 Displays Twitter Follow button if twitter is enabled 5 5 */ 6 6 7 8 $twitter_username = "http://api.twitter.com/1/users/show.xml?screen_name=".$wpbb_twitter_options['twitter_account']; 9 10 if (!@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 7 18 8 19 if (count($_GET) == 0) { -
wp-bulletin-board/trunk/php/wpbb-all-messages.php
r604868 r607181 1 1 <?php 2 2 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(); 18 4 19 5 global $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 20 19 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 20 if ($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> 73 53 <?php 74 54 foreach ($msgs as $msg) { … … 83 63 84 64 <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()); ?>'> 86 66 <?php printf(__('%s'), $msg->subject); ?> 87 67 </a> … … 94 74 </td> 95 75 <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()); ?>'> 97 77 <?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'); ?> 98 81 </a> 99 82 </td … … 105 88 <?php 106 89 } else { 90 wpbb_goback1('all-messages', NULL); 107 91 ?> 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())); ?> 110 94 </div> 111 95 <?php 112 96 } 113 }114 }115 116 117 // Deleting a message118 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 <?php137 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 <?php149 97 } 150 }151 152 153 98 ?> -
wp-bulletin-board/trunk/php/wpbb-create-topic.php
r604652 r607181 4 4 5 5 $forum_id = absint($_GET['forum']); 6 7 wpbb_check_exists('forum', $forum_id); 6 8 7 9 if ((isset($_GET['forum'])) && (!isset($_GET['subforum']))) { -
wp-bulletin-board/trunk/php/wpbb-delete-topic.php
r603518 r607181 1 1 <?php 2 wpbb_goback1(); 2 3 3 4 // Check user has permissions to delete topics or posts in this forum … … 65 66 ?> 66 67 <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 ?> 68 71 </div> 69 72 <?php … … 75 78 if ($changed_mind !== true && $success !== true) { 76 79 ?> 77 <h 2 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); ?> 80 83 </div> 81 84 <form method='POST' action='#' style='text-align:center;'> -
wp-bulletin-board/trunk/php/wpbb-edit-topic.php
r604652 r607181 1 1 <?php 2 2 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 4 wpbb_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']); 13 if (isset($_GET['post'])) { 14 $post_id = absint($_GET['post']); 15 } 16 17 $view_permissions = wpbb_user_has_permission($user_id, $forum_id); 18 if ($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 58 if ($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) { 41 88 ?> 42 89 <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'); ?> 44 91 </div> 45 92 <?php 46 93 wpbb_exit(); 47 94 } 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) { 56 101 ?> 57 102 <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'); ?> 59 104 </div> 60 105 <?php 61 106 wpbb_exit(); 62 107 } 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); 193 156 ?> 194 157 <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> 195 167 <th><?php _e('Author', 'wp-bb'); ?></th> 196 168 <td> … … 209 181 <?php 210 182 } 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; 216 185 // Forums 217 186 ?> … … 280 249 <th><?php _e('Status', 'wp-bb'); ?></th> 281 250 <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'); ?> 284 253 </td> 285 254 <tr> … … 292 261 ?> 293 262 </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> 294 383 </table> 295 384 <?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 } 431 394 ?> -
wp-bulletin-board/trunk/php/wpbb-forum.php
r604652 r607181 4 4 Checks if the plugin is deactivated 5 5 */ 6 6 7 7 8 // Since we're not in the admin area we must require the plugin.php file … … 16 17 ?> 17 18 <div style="text-align:center;font-weight:bold;color:red;"> 18 <?php 19 <?php 19 20 _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB', 'wp-bb'); 20 21 wpbb_exit(); … … 23 24 <?php 24 25 } 25 26 26 27 // Load WPBB Options 27 28 $wpbb_options = get_option('wpbb_options'); … … 63 64 && (!isset($_GET['method'])) 64 65 && (!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'); 65 70 ?> 66 71 <div class="wpbb-centered-bold"> 67 72 <?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(); 69 74 ?> 70 75 </div> 71 76 <?php 72 // Load facebook functionality if facebook is enabled73 if ($wpbb_facebook_options['allow_facebook'] == 'yes') {74 require_once('facebook/wpbb-facebook.php');75 }76 exit();77 77 } 78 78 … … 80 80 if (current_user_can('manage_options')) { 81 81 ?> 82 <div id="wpbb-admin-maintenance-reminder">82 <div class="wpbb-message-warning"> 83 83 <?php _e('The board is currently in maintenance mode. To turn it off change Maintenance Mode in Settings -> WPBB Settings to "Off"', 'wp-bb'); ?> 84 84 </div> … … 86 86 } else { 87 87 ?> 88 <div id="wpbb-maintenance-message">88 <div class="wpbb-message-warning"> 89 89 <?php echo $wpbb_options['maintenance_message']; ?> 90 90 </div> 91 91 <?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(); 92 97 wpbb_exit(); 93 98 } 94 99 } 95 100 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 105 require_once('wpbb-functions.php'); 106 107 /* 108 Checks a page supplied exists 109 */ 110 111 wpbb_page_exists(); 130 112 131 113 /* … … 137 119 } 138 120 121 139 122 /* 140 123 Twitter … … 147 130 } 148 131 149 /*150 Load all Functions151 */152 153 require_once('wpbb-functions.php');154 132 155 133 … … 246 224 } 247 225 248 249 /* 250 Viewing All Messages (& Delete) 226 /* 227 Viewing All Messages 251 228 */ 252 229 253 230 if ((isset($_GET['messages'])) 254 231 && (isset($_GET['page_id'])) 255 && (isset($_GET['current_page'])) 256 && ( $_GET['messages'] == 'all')) {232 && (isset($_GET['current_page'])) 233 && (count($_GET) == 3)) { 257 234 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'); 258 246 } 259 247 … … 479 467 480 468 /* 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 484 483 if ((isset($_GET['messages'])) 485 484 && ($_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 } 491 489 /* 492 490 Viewing Individual Message … … 495 493 if ((isset($_GET['messages'])) 496 494 && ($_GET['messages'] == 'all') 497 && ((isset($_GET['view'])) && ($_GET['view']))498 && (count($_GET) == 2)) {495 && ((isset($_GET['view'])) 496 && (count($_GET) == 2))) { 499 497 require_once('wpbb-view-message.php'); 500 498 } … … 624 622 } 625 623 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 } 624 wpbb_footer(); 625 634 626 ?> -
wp-bulletin-board/trunk/php/wpbb-functions.php
r604652 r607181 86 86 * 87 87 * 88 * @since 1.0. 188 * @since 1.0.2 89 89 * 90 90 * @param int $forum_id The ID of the forum … … 100 100 $forum_id = isset($_GET['forum']) ? $_GET['forum'] : NULL; 101 101 $subforum_id = isset($_GET['subforum']) ? $_GET['subforum'] : NULL; 102 $topic_id = isset($_GET['topic']) ? $_GET['topic'] : NULL; 102 103 $query_args = array('forum' => $forum_id, 'subforum' => $subforum_id, 'topic' => $topic_id, 'current_page' => 1); 103 104 $count = array(); … … 113 114 } 114 115 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; 115 123 default: 116 124 ?> … … 348 356 349 357 if (empty($user_roles)) { 358 wpbb_goback1('forum-index', NULL); 350 359 ?> 351 360 <div class="wpbb-message-failure"> … … 755 764 } 756 765 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 */ 776 function 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 */ 813 function 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 */ 851 function 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 */ 870 function 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 } 757 891 758 892 ?> -
wp-bulletin-board/trunk/php/wpbb-index.php
r604652 r607181 5 5 6 6 $user_id = get_current_user_id(); 7 7 8 8 if (isset($_POST['wpbb-search-submit'])) { 9 9 10 wpbb_goback1('search_results', NULL); 11 10 if (!$user_id) { 11 wpbb_is_user_logged_in(); 12 wpbb_exit(); 13 } 14 12 15 $search_criteria = wp_strip_all_tags($_POST['wpbb-search']); 13 16 … … 15 18 16 19 if ($wpdb->num_rows === 0) { 20 wpbb_goback1('search-results', NULL); 17 21 ?> 18 22 <div class="wpbb-message-failure"> … … 57 61 $delete_topic_link = sprintf(__('<a href="%s">Delete</a>'), add_query_arg(array('forum' => $found->forum, 'topic' => $found->id, 'action' => 'delete'), get_permalink())); 58 62 59 $status = wpbb_get_topic_status_buttons($ topic->status);63 $status = wpbb_get_topic_status_buttons($found->status); 60 64 61 65 ?> … … 105 109 ?> 106 110 <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> 111 115 </p> 112 116 … … 127 131 128 132 // 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`;"); 130 134 if ($categories) { 131 135 // Create our table … … 141 145 <?php 142 146 // 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`;"); 144 148 if (!$forums) { 145 149 ?> <tr><td></td><td></td><td></td><td></td></tr><?php … … 159 163 // Grab all subforums which belong to the current forum 160 164 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`;"); 162 166 if ($subforums) { 163 167 _e('Subforums: ', 'wp-bb'); -
wp-bulletin-board/trunk/php/wpbb-message-user.php
r604862 r607181 1 1 <?php 2 2 3 wpbb_goback1( 'message-user', NULL);3 wpbb_goback1(); 4 4 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);5 if (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 } 14 14 15 $check_id_exists = get_user_by('id', $to_id);15 $check_id_exists = get_user_by('id', $to_id); 16 16 17 if ($check_id_exists === false) { 17 if ($check_id_exists === false) { 18 ?> 19 <div class="wpbb-message-failure"> 20 <?php 18 21 _e("Sorry, that user doesn't exist. Please try again", "wp-bb"); 19 exit(); 20 } 22 ?> 23 </div> 24 <?php 25 wpbb_exit(); 26 } 21 27 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 52 55 } 53 56 } 57 } 58 59 $message_id = absint($_GET['message']); 60 61 if ($message_id != 'to') { 54 62 55 63 $message_id = absint($_GET['message']); 64 } 65 66 ?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php 56 67 57 if ($message_id != 'to') { 68 $message_username = wpbb_parse_author_name($message_id); 58 69 59 $message_id = absint($_GET['message']);60 }61 62 ?> <h2 class="wpbb-centered-bold"><?php _e('Compose Message', 'wp-bb'); ?></h2> <?php63 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 <?php96 }97 98 70 ?> 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 1 1 <?php 2 2 3 4 $user_id = get_current_user_id(); 3 $user_id = get_current_user_id(); 5 4 6 5 $subforum = false; 7 6 8 7 $subforum_id = NULL; 8 9 wpbb_goback1('reply-topic', NULL); 9 10 10 11 … … 25 26 $topic_id = absint($_GET['topic']); 26 27 27 wpbb_goback($forum_id, $subforum_id, $topic_id); 28 28 29 29 30 // Check forum permissions -
wp-bulletin-board/trunk/php/wpbb-unanswered-topics.php
r604652 r607181 1 1 <?php 2 2 3 wpbb_goback1('unanswered_topics', NULL); 4 5 $user_id = get_current_user_id(); 3 $user_id = wpbb_is_user_logged_in(); 6 4 7 if ($user_id != 0) {8 5 $options = get_option('wpbb_options'); 9 6 $topics_per_page = $options['topics_per_page']; … … 25 22 $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE created = last_reply;"); 26 23 $topics = false; 27 if ( $total_topics > 0) {24 if (($total_topics > 0) && ($total_topics > $topics_per_page)) { 28 25 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 { 29 28 $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE created = last_reply ORDER by created DESC LIMIT $start, $limit;"); 30 29 } 31 30 if ($topics) { 31 wpbb_goback1('unanswered_topics', NULL); 32 32 ?> 33 <h 3 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> 34 34 <table class="wpbb-table"> 35 35 <th><?php _e('Status', 'wp-bb'); ?></th> … … 108 108 ?> </table> <?php 109 109 } else { 110 wpbb_goback1('unanswered_topics', NULL); 110 111 ?> 111 <div class="wpbb- centered-bold">112 <div class="wpbb-message-failure"> 112 113 <?php _e('There are no unanswered topics at this time.', 'wp-bb'); ?> 113 114 </div> … … 115 116 } 116 117 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 <?php123 }124 118 ?> -
wp-bulletin-board/trunk/php/wpbb-unread-topics.php
r604652 r607181 1 1 <?php 2 // Display go back link3 wpbb_goback1('unread-topics', NULL);4 2 5 3 // Returns user ID 6 $user_id = get_current_user_id();4 $user_id = wpbb_is_user_logged_in(); 7 5 8 if ($user_id != 0) {9 6 10 7 $user_lastvisit = get_user_meta($user_id, 'wpbb_lastvisit', true); … … 30 27 } 31 28 } 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;"); 33 30 34 31 $topics = false; 35 32 36 if ( $total_topics > 0) {33 if (($total_topics > 0) && ($total_topics > $topics_per_page)) { 37 34 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;"); 39 38 } 40 39 41 40 if ($topics) { 41 wpbb_goback1('unread-topics', NULL); 42 42 ?> 43 <h 3class="wpbb-centered-bold">43 <h1 id="wpbb-h-1" class="wpbb-centered-bold"> 44 44 <?php _e('Unread Topics Since Last Visit', 'wp-bb'); ?> 45 </h 3>45 </h1> 46 46 <table class="wpbb-table"> 47 47 <th><?php _e('Status', 'wp-bb'); ?></th> … … 98 98 $status = wpbb_get_topic_status_buttons($topic->status); 99 99 100 100 $freshness = wpbb_get_topic_freshness($topic_last_post); 101 101 102 102 ?> … … 105 105 106 106 <td> 107 <?php 107 <?php 108 echo $freshness; 108 109 if ($status['locked'] != "") { 109 110 echo $status['locked']; … … 132 133 <?php 133 134 } else { 135 wpbb_goback1('unread-topics', NULL); 134 136 ?> 135 <div class="wpbb- centered-bold">137 <div class="wpbb-message-failure"> 136 138 <?php _e('There are no unread topics at this time', 'wp-bb'); ?> 137 139 </div> … … 139 141 } 140 142 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 148 144 ?> -
wp-bulletin-board/trunk/php/wpbb-view-forum-topic.php
r604652 r607181 1 1 <?php 2 2 3 $topic_id = absint($_GET['topic']); 4 5 wpbb_check_exists('topic', $topic_id); 6 3 7 $user_id = get_current_user_id(); 8 4 9 $forum = absint($_GET['forum']); 5 10 … … 27 32 } 28 33 29 $topic_id = absint($_GET['topic']);34 30 35 31 36 $topic_status = wpbb_get_topic_status($topic_id); … … 174 179 $topic_id = absint($_GET['topic']); 175 180 $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 } 177 184 wpbb_buttons($forum, NULL, $topic_id, 'forum_topic'); 178 185 $user_posts = get_user_meta($topic->author, 'wpbb_posts', true); … … 227 234 <hr> 228 235 <p class="wpbb-topic-and-post-signature"> 229 <?php echo $signature; ?>236 <?php echo convert_smilies($signature); ?> 230 237 </p> 231 238 </td> … … 269 276 <hr> 270 277 <p class="wpbb-topic-and-post-signature"</p> 271 <?php echo $signature; ?>278 <?php echo convert_smilies($signature); ?> 272 279 </td> 273 280 </tr> … … 286 293 <div class="wpbb-quick-reply"> 287 294 <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> 298 304 </form> 299 305 </div> -
wp-bulletin-board/trunk/php/wpbb-view-forum.php
r604652 r607181 2 2 3 3 $forum = absint($_GET['forum']); 4 5 wpbb_check_exists('forum', $forum); 4 6 5 7 $user_id = get_current_user_id(); … … 8 10 $view_permissions = wpbb_user_has_permission($user_id, $forum); 9 11 if ($view_permissions === false) { 10 wpbb_goback1('forum _denied', NULL);12 wpbb_goback1('forum-index', NULL); 11 13 ?> 12 14 <div class="wpbb-message-failure"> … … 79 81 $total_topics = $wpdb->get_var("SELECT COUNT(*) as 'Topics' FROM ".TOPIC_TABLE." WHERE forum = $forum;"); 80 82 $topics = false; 81 if ( $total_topics > 0) {83 if (($total_topics > 0) && ($total_topics > $topics_per_page)) { 82 84 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;");84 85 } 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;"); 85 87 wpbb_buttons($forum, NULL, NULL, 'forum'); 86 88 // 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 14 14 ?> 15 15 <table class="wpbb-table"> 16 <?php 16 <th><?php _e('From', 'wp-bb'); ?></th> 17 <th><?php _e('Message', 'wp-bb'); ?></th> 18 <?php 17 19 foreach ($get_message as $message) { 18 20 // Mark message as read … … 21 23 } 22 24 $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>"; 23 29 ?> 24 30 <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> 39 52 </tr> 40 53 <?php -
wp-bulletin-board/trunk/php/wpbb-view-profile.php
r604652 r607181 1 1 <?php 2 3 4 $user_id = wpbb_is_user_logged_in(); 5 2 6 3 7 /* 4 8 Viewing a Profile 5 9 */ 6 7 wpbb_goback1('view-profile', NULL);8 10 9 11 $profile_id = absint($_GET['profile']); … … 15 17 ?> 16 18 <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')); ?> 18 20 </div> 19 21 <?php … … 21 23 } 22 24 23 if ($profile_id == get_current_user_id()) { 25 wpbb_goback1(); 26 27 28 if ($profile_id == $user_id) { 24 29 ?> 25 <h 3class="wpbb-centered-bold">30 <h1 id="wpbb-h-1" class="wpbb-centered-bold"> 26 31 <?php _e('My Profile', 'wp-bb'); ?> 27 </h 3>32 </h1> 28 33 <?php 29 34 } else { 30 35 ?> 31 <h 3class="wpbb-centered-bold">36 <h1 id="wpbb-h-1" class="wpbb-centered-bold"> 32 37 <?php printf(__('Viewing %s\'s Profile'), $user->display_name); ?> 33 </h 3>38 </h1> 34 39 <?php 35 40 } … … 126 131 127 132 <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> 139 144 </form> 140 </ table>145 </div> 141 146 <?php 142 147 } -
wp-bulletin-board/trunk/php/wpbb-view-subforum-topic.php
r604652 r607181 2 2 3 3 $topic_id = absint($_GET['topic']); 4 5 wpbb_check_exists('topic', $topic_id); 4 6 5 7 // Third parameter is 'view' by default … … 161 163 $forum = absint($_GET['forum']); 162 164 $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 } 164 168 wpbb_buttons($forum, $subforum, $topic_id, 'subforum_topic'); 165 169 if ($current_page == 1) { … … 181 185 <hr> 182 186 <p class="wpbb-topic-and-post-signature"> 183 <?php echo $signature; ?>187 <?php echo convert_smilies($signature); ?> 184 188 </p> 185 189 </td> … … 213 217 <hr> 214 218 <p class="wpbb-topic-and-post-signature"> 215 <?php echo $signature; ?>219 <?php echo convert_smilies($signature); ?> 216 220 </p> 217 221 </td> … … 231 235 <div class="wpbb-quick-reply"> 232 236 <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> 243 246 </form> 244 247 </div> -
wp-bulletin-board/trunk/php/wpbb-view-subforum.php
r604652 r607181 4 4 5 5 $forum = absint($_GET['forum']); 6 7 $subforum = absint($_GET['subforum']); 8 9 wpbb_check_exists('subforum', $subforum); 10 11 12 6 13 $view_permissions = wpbb_user_has_permission($user_id, $forum); 7 14 if ($view_permissions === false) { … … 14 21 wpbb_exit(); 15 22 } else { 16 $subforum = absint($_GET['subforum']);17 23 $view_permissions = wpbb_user_has_permission($user_id, $subforum); 18 24 if ($view_permissions === false) { … … 54 60 } 55 61 $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);57 62 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 } 59 66 $topics = $wpdb->get_results("SELECT * FROM ".TOPIC_TABLE." WHERE subforum = $subforum ORDER BY created DESC LIMIT $start, $limit;"); 60 67 if ($topics) { -
wp-bulletin-board/trunk/readme.txt
r604655 r607181 5 5 Requires at least: 3.3 6 6 Tested up to: 3.4.2 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 68 68 == Changelog == 69 69 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 70 87 = 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 71 91 * Fixed broken link in message which is displayed to logged out users 72 92 * 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 1 1 <?php 2 2 /* 3 Plugin Name: wp-bb4 Plugin URI: http:// codebycarter.com3 Plugin Name: WPBB 4 Plugin URI: http://wordpress.org/extend/plugins/wp-bulletin-board/ 5 5 Description: An easy to use Bulletin board for Wordpress with Facebook and Twitter integration. 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: Jay Carter 8 8 Author URI: http://codebycarter.com … … 45 45 define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages'); 46 46 // Define current version 47 define('WPBB_VERSION', 'v1.0.0'); 47 define('WPBB_VERSION', 'v1.0.2'); 48 // Define plugin url (wp plugin page) 49 define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board'); 48 50 49 51 /* … … 69 71 add_action('switch_theme', 'wpbb_create_template_file'); 70 72 add_action('wp_enqueue_scripts', 'wpbb_register_styles'); 73 /*add_action('init', 'wpbb_setup_rewrite_rules'); 74 add_action('init', 'wpbb_setup_rewrite_tags'); 75 76 function wpbb_setup_rewrite_rules() { 77 add_rewrite_rule('forum(/([^\d]+))?', 'index.php/forums/?forum=$1', 'top'); 78 } 79 function wpbb_setup_rewrite_tags() { 80 global $wp; 81 $wp->add_query_var('forum'); 82 }*/ 83 84 /* 85 Could've used this, overwritten _http_build_query to set the value seperator to / aswell, but its not pluggable or hookable. 86 */ 87 //var_dump(_http_build_query(array('forum', 'page'), null, '/', '/', false)); 88 89 function wpbb_setup_rewrite_rules() { 90 91 //add_rewrite_rule('carpage(/([^/]+))?(/([^/]+))?/?','index.php?pagename=carpage&var1=$matches[2]&var2=$matches[4]','top'); 92 } 93 94 add_action('init', 'wpbb_setup_rewrite_rules'); 95 71 96 72 97 /* … … 232 257 'post_cutoff' => 15, 233 258 'post_to_forum' => 'yes', 234 'show_footer' => 'no', 235 'version' => WPBB_VERSION 259 'show_footer' => 'no' 236 260 ); 237 261 $add_wpbb_options = add_option('wpbb_options', $options); … … 249 273 $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb'); 250 274 $facebook_state = __('Enter a long random string', 'wp-bb'); 275 $facebook_role = __('Enter the default role for new facebook registrations'); 251 276 $facebook_options = array( 252 'allow_facebook' => ' yes',277 'allow_facebook' => 'no', 253 278 'facebook_app_id' => $facebook_app_id, 254 279 'facebook_app_secret_key' => $facebook_app_secret_key, 255 280 'facebook_redirect_uri' => $facebook_redirect_uri, 256 'facebook_state' => $facebook_state 281 'facebook_state' => $facebook_state, 282 'facebook_default_role' => $facebook_role 257 283 ); 258 284 $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options); … … 263 289 $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb'); 264 290 $twitter_options = array( 265 'allow_twitter' => ' yes',291 'allow_twitter' => 'no', 266 292 'twitter_account' => $twitter_account 267 293 ); … … 332 358 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';"); 333 359 if ($post_id == NULL) { 334 $wpbb_page_title = __('Forum ', 'wp-bb');360 $wpbb_page_title = __('Forums', 'wp-bb'); 335 361 $link = site_url().'/'.strtolower($wpbb_page_title); 336 362 $page = array(
Note: See TracChangeset
for help on using the changeset viewer.