Changeset 56
- Timestamp:
- 05/03/2008 01:16:23 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 edited
-
bp-messages.php (modified) (4 diffs)
-
bp-messages/bp-messages-classes.php (added)
-
bp-messages/bp-messages-cssjs.php (added)
-
bp-xprofile.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages.php
r36 r56 1 1 <?php 2 3 $bp_messages_table_name = $wpdb->base_prefix . 'bp_messages'; 4 $bp_messages_table_name_deleted = $bp_messages_table_name . '_deleted'; 5 $bp_messages_image_base = get_option('siteurl') . '/wp-content/mu-plugins/bp-messages/images'; 6 7 include_once( 'bp-messages/bp-messages-classes.php' ); 8 include_once( 'bp-messages/bp-messages-cssjs.php' ); 9 10 /* 11 include_once( 'bp-messages/bp-messages-admin.php' ); 12 include_once( 'bp-messages/bp-messages-templatetags.php' ); 13 */ 2 14 3 15 /************************************************************************** … … 7 19 **************************************************************************/ 8 20 9 function messages_install() 10 { 11 global $wpdb, $table_name; 12 13 $sql = "CREATE TABLE ". $table_name ." ( 14 id int(11) NOT NULL AUTO_INCREMENT, 15 sender_id int(11) NOT NULL, 16 recipient_id int(11) NOT NULL, 17 folder_id tinyint(1) NOT NULL DEFAULT 1, 18 subject varchar(200) NOT NULL, 19 message longtext NOT NULL, 20 is_read bool DEFAULT 0, 21 is_draft bool DEFAULT 0, 22 date_sent int(11) NOT NULL, 23 UNIQUE KEY id (id) 24 );"; 25 26 require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); 21 function messages_install() { 22 global $wpdb, $bp_messages_table_name, $bp_messages_table_name_deleted; 23 24 $sql[0] = "CREATE TABLE ". $bp_messages_table_name ." ( 25 id int(11) NOT NULL AUTO_INCREMENT, 26 sender_id int(11) NOT NULL, 27 recipient_id int(11) NOT NULL, 28 thread_id int(11) NOT NULL, 29 subject varchar(200) NOT NULL, 30 message longtext NOT NULL, 31 is_read bool DEFAULT 0, 32 date_sent int(11) NOT NULL, 33 PRIMARY KEY id (id) 34 );"; 35 36 $sql[1] = "CREATE TABLE ". $bp_messages_table_name_deleted ." ( 37 id int(11) NOT NULL AUTO_INCREMENT, 38 thread_id int(11) NOT NULL, 39 user_id int(11) NOT NULL, 40 is_deleted tinyint(1) NOT NULL DEFAULT 0, 41 PRIMARY KEY id (id) 42 );"; 43 44 require_once( ABSPATH . 'wp-admin/upgrade-functions.php' ); 27 45 dbDelta($sql); 28 46 } … … 36 54 **************************************************************************/ 37 55 38 function messages_add_menu() 39 { 40 global $wpdb, $table_name, $wpmuBaseTablePrefix, $bp_messages, $userdata; 41 $table_name = $wpmuBaseTablePrefix . "bp_messages"; 42 43 if($wpdb->blogid == $userdata->primary_blog) 44 { 45 /* Instantiate bp_Messages class to do the real work. */ 46 $bp_messages = new BP_Messages; 47 $bp_messages->bp_messages(); 48 49 $inbox_count = $bp_messages->get_inbox_count(); 50 51 add_menu_page("Messages", "Messages$inbox_count", 1, basename(__FILE__), "messages_write_new"); 52 add_submenu_page(basename(__FILE__), "Write New", "Write New", 1, basename(__FILE__), "messages_write_new"); 53 add_submenu_page(basename(__FILE__), "Inbox", "Inbox$inbox_count", 1, "messages_inbox", "messages_inbox"); 54 add_submenu_page(basename(__FILE__), "Sentbox", "Sentbox", 1, "messages_sentbox", "messages_sentbox"); 55 add_submenu_page(basename(__FILE__), "Drafts", "Drafts", 1, "messages_drafts", "messages_drafts"); 56 57 /* Add the administration tab under the "Site Admin" tab for site administrators */ 58 add_submenu_page('wpmu-admin.php', "Messages", "Messages", 1, basename(__FILE__), "messages_settings"); 59 56 function messages_add_menu() { 57 global $wpdb, $bp_messages_table_name, $bp_messages, $userdata; 58 59 if ( $wpdb->blogid == $userdata->primary_blog ) { 60 if ( $inbox_count = BP_Messages_Message::get_inbox_count() ) { 61 $count_indicator = ' <span id="awaiting-mod" class="count-1"><span class="message-count">' . $inbox_count . '</span></span>'; 62 } 63 64 add_menu_page ( __('Messages'), sprintf( __('Messages%s'), $count_indicator ), 1, basename(__FILE__), "messages_inbox" ); 65 add_submenu_page ( basename(__FILE__), __('Messages › Inbox'), __('Inbox'), 1, basename(__FILE__), "messages_inbox" ); 66 add_submenu_page ( basename(__FILE__), __('Messages › Sent Messages'), __('Sent Messages'), 1, "messages_sentbox", "messages_sentbox" ); 67 add_submenu_page ( basename(__FILE__), __('Messages › Compose'), __('Compose'), 1, "messages_write_new", "messages_write_new" ); 68 69 // Add the administration tab under the "Site Admin" tab for site administrators 70 add_submenu_page ( 'wpmu-admin.php', __('Messages'), __('Messages'), 1, basename(__FILE__), "messages_settings" ); 60 71 } 61 72 62 73 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 63 if ($wpdb->get_var("show tables like '%" . $table_name . "%'") == false) messages_install();64 } 65 add_action('admin_menu','messages_add_menu'); 66 67 68 /************************************************************************** 69 messages_write_new(), messages_inbox(), messages_sentbox(), 70 messages_ drafts(), messages_add_js(), messages_add_css()74 if ( $wpdb->get_var( "show tables like '%" . $bp_messages_table_name . "%'" ) == false ) 75 messages_install(); 76 } 77 add_action( 'admin_menu', 'messages_add_menu' ); 78 79 80 /************************************************************************** 81 messages_setup() 71 82 72 These are all wrapper functions used in Wordpress hooks to pass through to 73 correct functions within the bp_messages object. Seems the only way 74 Wordpress will handle this. 75 **************************************************************************/ 76 77 function messages_write_new() { global $bp_messages; $bp_messages->write_new($_POST['username'], $_POST['subject'], $_POST['message']); } 78 function messages_inbox() { global $bp_messages; $bp_messages->inbox(); } 79 function messages_sentbox() { global $bp_messages; $bp_messages->sentbox(); } 80 function messages_drafts() { global $bp_messages; $bp_messages->drafts(); } 81 function messages_add_js() { global $bp_messages; $bp_messages->add_js(); } 82 function messages_add_css() { global $bp_messages; $bp_messages->add_css(); } 83 84 85 /************************************************************************** 86 bp_Messages [Class] 83 Setup CSS, JS and other things needed for the messaging component. 84 **************************************************************************/ 85 86 function messages_setup() { 87 add_action( 'admin_head', 'messages_add_css' ); 88 add_action( 'admin_head', 'messages_add_js' ); 89 } 90 add_action( 'admin_menu', 'messages_setup' ); 91 92 93 /************************************************************************** 94 messages_write_new() 87 95 88 Where all the magic happens. 89 **************************************************************************/ 90 91 class BP_Messages 92 { 93 var $wpdb; 94 var $tableName; 95 var $basePrefix; 96 var $userdata; 97 var $imageBase; 98 var $inboxCount; 99 100 101 /************************************************************************** 102 bp_messages() 103 104 Contructor function. 105 **************************************************************************/ 106 function bp_messages() 107 { 108 global $wpdb, $wpmuBaseTablePrefix, $userdata, $table_name; 109 110 $this->wpdb = &$wpdb; 111 $this->userdata = &$userdata; 112 $this->basePrefix = $wpmuBaseTablePrefix; 113 $this->tableName = $table_name; // need a root prefix, not a wp_X_ prefix. 114 $this->imageBase = get_option('siteurl') . '/wp-content/mu-plugins/bp_messages/images/'; 115 116 /* Set up Constants */ 117 define("IS_DRAFT", 1); 118 define("INBOX", 1); 119 define("SENTBOX", 2); 120 121 /* Setup CSS and JS */ 122 add_action("admin_print_scripts", "messages_add_css"); 123 add_action("admin_print_scripts", "messages_add_js"); 124 } 125 126 127 /************************************************************************** 128 write_new() 129 130 Handles the generation of the write new message form, as well as handling 131 validation and directing saving to the DB to the correct function. 132 **************************************************************************/ 133 134 function write_new($username = '', $subject = '', $message = '', $alert_type = '', $alert_message = '') 135 { 136 if(isset($_GET['mode']) && isset($_POST['send']) && $_GET['mode'] == "send_message") 137 { 138 /* Validate submission */ 139 if($_POST['username'] == "" || $_POST['subject'] == "" || $_POST['message_input'] == "") 140 { 141 $alert_type = 'error'; 142 $alert_message = __("Please make sure you fill in all fields."); 143 } 144 else if(!bp_core_get_userid($_POST['username'])) 145 { 146 $alert_type = 'error'; 147 $alert_message = __("The username you gave was a member who doesn't exist, please check and make sure you entered it correctly."); 148 } 149 else 150 { 151 /* Send message - add to DB */ 152 $this->send($_POST['username'], $_POST['subject'], $_POST['message_input']); die; 153 } 154 } 155 else if(isset($_GET['mode']) && isset($_POST['send']) && $_GET['mode'] == "send_message") 156 { 157 158 if($_POST['subject'] == '') 159 { 160 $alert_type = 'error'; 161 $message = __("To save a draft you must at minimum enter a subject."); 162 } 163 else 164 { 165 /* Save message - add to DB */ 166 $this->send($_POST['username'], $_POST['subject'], $_POST['message_input'], IS_DRAFT); die; 167 } 168 } 96 Handle and display the write new messages screen. 97 **************************************************************************/ 98 99 function messages_write_new( $username = '', $subject = '', $content = '', $type = '', $message = '' ) { ?> 100 <div class="wrap"> 101 <h2><?php _e('Compose Message') ?></h2> 102 103 <?php 104 if ( $message != '' ) { 105 $type = ( $type == 'error' ) ? 'error' : 'updated'; 169 106 ?> 170 171 <div class="wrap">172 <h2><?php _e("Write New Message") ?></h2>173 174 <?php if($alert_type != '') { ?>175 <?php if($alert_type == 'error') { $type = "error"; } else { $type = "updated"; } ?>176 <div id="message" class="<?php echo $type; ?> fade">177 <p><?php echo $alert_message; ?></p>178 </div>179 <?php } ?>180 181 <form action="admin.php?page=bp-messages.php&mode=send_message" method="post" id="send_message_form">182 183 <p>184 <div id="usernamediv">185 <label for="username"><?php _e("Send To Username") ?></label>186 <div>187 <input type="text" name="username" id="username" value="<?php echo $username; ?>" style="width:30%" />188 </div>189 </div>190 </p>191 192 <p>193 <div id="subjectdiv">194 <label for="subject"><?php _e("Subject") ?></label>195 <div>196 <input type="text" name="subject" id="subject" value="<?php echo $subject; ?>" style="width: 75%" />197 </div>198 </div>199 </p>200 201 <p>202 <div id="messagediv">203 <label for="message_input"><?php _e("Message") ?></label>204 <div>205 <textarea name="message_input" id="message_input" rows="15" cols="40"><?php echo $message; ?></textarea>206 </div>207 </div>208 </p>209 210 211 <p class="submit">212 <input type="submit" value="<?php _e("Save as Draft"); ?>" name="save_as_draft" id="save_as_draft" />213 <input type="submit" value="<?php _e("Send") ?> »" name="send" id="send" style="font-weight: bold" />214 </p>215 216 </form>217 <script type="text/javascript">218 document.getElementById("username").focus();219 </script>220 221 </div>222 <?php223 }224 225 226 /**************************************************************************227 inbox()228 229 Displays the list of messages in the inbox as well as redirects to the230 edit, delete and view functions.231 **************************************************************************/232 233 function inbox($message = '', $type = 'error')234 {235 236 if(isset($_GET['mode']) && isset($_GET['id']) && $_GET['mode'] == "view")237 {238 if(bp_core_validate(bp_core_clean($_GET['id']))) {239 $this->view_message($_GET['id'], 'inbox'); die;240 }241 }242 else if(isset($_GET['mode']) && isset($_GET['id']) && $_GET['mode'] == "delete")243 {244 if(bp_core_validate(bp_core_clean($_GET['id']))) {245 $this->delete_message($_GET['id']); die;246 }247 }248 else if(isset($_GET['mode']) && isset($_POST['message_ids']) && $_GET['mode'] == "delete_bulk")249 {250 if(bp_core_validate(bp_core_clean($_POST['message_ids']))) {251 $this->delete_messages($_POST['message_ids']); die;252 }253 }254 else if(isset($_GET['mode']) && $_GET['mode'] == "send_response")255 {256 $this->validate_response($_GET['mid'], $_POST['is_forward'], $_POST['respond_forward_username'], $_POST['respond_reply_username'], $_POST['respond_subject'], $_POST['respond_message']); die;257 }258 ?>259 260 <div class="wrap">261 <h2><?php _e('Inbox'); ?></h2>262 <form action="admin.php?page=messages_inbox&mode=delete_bulk" method="post">263 264 <?php if($message != '') { ?>265 <?php if($type == 'error') { $type = "error"; } else { $type = "updated"; } ?>266 107 <div id="message" class="<?php echo $type; ?> fade"> 267 108 <p><?php echo $message; ?></p> 268 109 </div> 269 110 <?php } ?> 111 112 <form action="admin.php?page=bp-messages.php&mode=send" method="post" id="send_message_form"> 113 114 <p> 115 <div id="usernamediv"> 116 <label for="send_to"><?php _e("Send To Username") ?></label> 117 <div> 118 <input type="text" name="send_to" id="send_to" value="<?php echo $username; ?>" style="width:30%" /> 119 </div> 120 </div> 121 </p> 122 123 <p> 124 <div id="subjectdiv"> 125 <label for="subject"><?php _e("Subject") ?></label> 126 <div> 127 <input type="text" name="subject" id="subject" value="<?php echo $subject; ?>" style="width: 75%" /> 128 </div> 129 </div> 130 </p> 270 131 271 <table class="widefat"> 272 <thead> 273 <tr> 274 <th scope="col" width="1%"></th> 275 <th scope="col" width="15%">From</th> 276 <th scope="col">Subject</th> 277 <th scope="col" width="21%">Date Recieved</th> 278 <th scope="col" colspan="2" style="text-align:center;" width="15%">Action</th> 279 <th scope="col" width="1%"><input type="checkbox" id="check_all" onclick="checkAll();" name="check_all" /></th> 280 </tr> 281 </thead> 132 <p> 133 <div id="messagediv"> 134 <label for="content"><?php _e("Message") ?></label> 135 <div> 136 <textarea name="content" id="content" rows="15" cols="40"><?php echo $content; ?></textarea> 137 </div> 138 </div> 139 </p> 140 141 <p class="submit"> 142 <input type="submit" value="<?php _e("Send") ?> »" name="send" id="send" style="font-weight: bold" /> 143 </p> 144 145 <input type="hidden" name="thread_id" id="thread_id" value="<?php BP_Messages_Thread::get_new_thread_id() ?>" /> 146 147 </form> 148 <script type="text/javascript"> 149 $("username").focus(); 150 </script> 151 152 </div> 153 <?php 154 } 155 156 function messages_inbox() { 157 messages_box( 'inbox', __('Inbox') ); 158 } 159 160 function messages_sentbox() { 161 messages_box( 'sentbox', __('Sent Messages') ); 162 } 163 164 165 /************************************************************************** 166 messages_box() 167 168 Handles and displays the messages in a particular box for the current user. 169 **************************************************************************/ 170 171 function messages_box( $box = 'inbox', $display_name = 'Inbox', $message = '', $type = '' ) { 172 global $bp_messages_image_base, $userdata; 173 174 if ( isset($_GET['mode']) && isset($_GET['thread_id']) && $_GET['mode'] == 'view' ) { 175 messages_view_thread( $_GET['thread_id'], 'inbox' ); 176 } else if ( isset($_GET['mode']) && isset($_GET['thread_id']) && $_GET['mode'] == 'delete' ) { 177 messages_delete_thread( $_GET['thread_id'], $box, $display_name ); 178 } else if ( isset($_GET['mode']) && isset($_POST['thread_ids']) && $_GET['mode'] == 'delete_bulk' ) { 179 messages_delete_thread( $_POST['thread_ids'], $box, $display_name ); 180 } else if ( isset($_GET['mode']) && $_GET['mode'] == 'send' ) { 181 messages_send_message( $_POST['send_to'], $_POST['subject'], $_POST['content'], $_POST['thread_id'] ); 182 } else { 183 ?> 184 <div class="wrap"> 185 <h2><?php echo $display_name ?></h2> 186 <form action="admin.php?page=bp-messages.php&mode=delete_bulk" method="post"> 187 188 <?php 189 if ( $message != '' ) { 190 $type = ( $type == 'error' ) ? 'error' : 'updated'; 191 ?> 192 <div id="message" class="<?php echo $type; ?> fade"> 193 <p><?php echo $message; ?></p> 194 </div> 195 <?php } ?> 196 197 <table class="widefat" id="message-list" style="margin-top: 10px;"> 282 198 <tbody id="the-list"> 283 <?php 284 285 $messages = $this->get_messages('inbox'); 286 287 if(count($messages) > 0) 288 { 199 <?php 200 201 $threads = BP_Messages_Thread::get_threads_for_user( $box, $userdata->ID, false, $userdata->ID ); 202 203 if ( $threads && $threads['have_messages'] ) { 289 204 $counter = 0; 290 foreach($messages as $message) 291 { 292 if(!$message->is_read) 293 { 294 $is_read = '<img src="' . $this->imageBase .'email.gif" alt="New Message" />'; 295 $new = " unread"; 205 foreach ( $threads as $thread ) { 206 if ( $thread->messages ) { 207 if ( $thread->unread_count ) { 208 $is_read = '<img src="' . $bp_messages_image_base .'/email.gif" alt="New Message" />'; 209 $new = " unread"; 210 } else { 211 $is_read = '<img src="' . $bp_messages_image_base .'/email_open.gif" alt="Older Message" />'; 212 } 213 214 if ( $counter % 2 == 0 ) 215 $class = "alternate"; 216 ?> 217 <tr class="<?php echo $class . $new ?>" id="<?php echo $message->id ?>"> 218 <td class="is-read"><?php echo $is_read ?></td> 219 <td class="avatar"> 220 <?php if ( function_exists('xprofile_get_avatar') ) 221 echo xprofile_get_avatar($thread->creator_id, 1); 222 ?> 223 </td> 224 <td class="sender-details"> 225 <?php if ( $box == 'sentbox') { ?> 226 <h3>To: <?php echo $thread->recipients ?></h3> 227 <?php } else { ?> 228 <h3><?php echo bp_core_get_userlink($thread->creator_id) ?></h3> 229 <?php } ?> 230 <?php echo bp_format_time($thread->last_post_date) ?> 231 </td> 232 <td class="message-details"> 233 <h4><a href="admin.php?page=bp-messages.php&mode=view&thread_id=<?php echo $thread->thread_id ?>"><?php echo stripslashes($thread->subject) ?></a></h4> 234 <?php echo bp_create_excerpt($thread->message, 20); ?> 235 </td> 236 <td width="50"><a href="admin.php?page=bp-messages.php&mode=view&thread_id=<?php echo $thread->thread_id ?>">View</a></td> 237 <td width="50"><a href="admin.php?page=bp-messages.php&mode=delete&thread_id=<?php echo $thread->thread_id ?>">Delete</a></td> 238 <td width="25"><input type="checkbox" name="message_ids[]" value="<?php echo $thread->thread_id ?>" /></td> 239 </tr> 240 <?php 241 242 $counter++; 243 unset($class); 244 unset($new); 245 unset($is_read); 296 246 } 297 else { $is_read = '<img src="' . $this->imageBase .'email_open.gif" alt="Older Message" />'; }298 if($counter % 2 == 0) $class = "alternate";299 300 echo '301 <tr class="' . $class . $new . '">302 <td>' . $is_read . '</td>303 <td>' . bp_core_get_username($message->sender_id) . '</td>304 <td>' . stripslashes($message->subject) . '</td>305 <td>' . bp_format_time($message->date_sent) . '</td>306 <td><a class="edit" href="admin.php?page=messages_inbox&mode=view&id=' . $message->id . '">View</a></td>307 <td><a class="delete" href="admin.php?page=messages_inbox&mode=delete&id=' . $message->id . '">Delete</a></td>308 <td><input type="checkbox" name="message_ids[]" value="' . $message->id . '" /></td>309 </tr>310 ';311 312 $counter++;313 unset($class);314 unset($new);315 unset($is_read);316 247 } 317 318 319 } 320 else { 248 } else { 321 249 ?> 322 250 <tr class="alternate"> 323 251 <td colspan="7" style="text-align: center; padding: 15px 0;"> 324 You have no messages in your Inbox.252 <?php _e('You have no messages in your'); echo ' ' . $display_name . '.'; ?> 325 253 </td> 326 254 </tr> 327 255 <?php 328 256 } 329 330 257 echo ' 331 258 </tbody> … … 337 264 </div>'; 338 265 } 339 340 341 /************************************************************************** 342 sentbox() 343 344 Displays the list of messages in the sentbox as well as redirects to the 345 delete and view functions. 346 **************************************************************************/ 347 348 function sentbox($message = '', $type = 'error') 349 { 350 if($_GET['mode'] == "delete" && isset($_GET['id'])) 351 { 352 if(bp_core_validate(bp_core_clean($_GET['id']))) 353 { 354 $this->delete_message($_GET['id'], 'sentbox'); die; 266 } 267 268 /************************************************************************** 269 messages_send() 270 271 Send a message. 272 **************************************************************************/ 273 274 function messages_send_message($to_user, $subject, $content, $thread_id) { 275 global $userdata; 276 277 if ( is_numeric($to_user) ) { 278 $to_username = bp_core_get_username($to_user); 279 } else { 280 $to_username = $to_user; 281 $to_user = bp_core_get_userid($to_user); 282 } 283 284 if ( is_null($to_user) ) { 285 messages_write_new( '', $subject, $content, 'error', __('The username you provided was invalid.') ); 286 } else if ( $subject == '' || $content == '' || $thread_id == '' ) { 287 messages_write_new( $to_user, $subject, $content, 'error', __('Please make sure you fill in all the fields.') ); 288 } else { 289 $message = new BP_Messages_Message; 290 $message->recipient_id = $to_user; 291 $message->recipient_username = $to_username; 292 $message->subject = $subject; 293 $message->message = $content; 294 $message->is_read = 0; 295 $message->thread_id = $thread_id; 296 297 unset($_GET['mode']); 298 299 if ( !$message->send() ) { 300 // Could not send, try saving as draft. 301 messages_box( 'inbox', __('Inbox'), __('Message could not be sent, please try again.'), 'error' ); 302 } else { 303 messages_box( 'inbox', __('Inbox'), __('Message sent successfully!'), 'success' ); 304 } 305 } 306 } 307 308 /************************************************************************** 309 messages_delete_thread() 310 311 Handles the deletion of a single or multiple threads. 312 **************************************************************************/ 313 314 function messages_delete_thread( $thread_ids, $box, $display_name ) { 315 global $wpdb; 316 317 $type = 'success'; 318 319 if ( is_array($thread_ids) ) { 320 $message = __('Messages deleted successfully!'); 321 322 for ( $i = 0; $i < count($thread_ids); $i++ ) { 323 if ( !$status = BP_Messages_Thread::delete($thread_ids) ) { 324 $message = __('There was an error when deleting messages. Please try again.'); 325 $type = 'error'; 355 326 } 356 327 } 357 else if($_GET['mode'] == "view" && isset($_GET['id'])) 358 { 359 if(bp_core_validate(bp_core_clean($_GET['id']))) { 360 $this->view_message($_GET['id'], 'sentbox'); die; 361 } 362 } 363 else if(isset($_GET['mode']) && isset($_POST['message_ids']) && $_GET['mode'] == "delete_bulk") 364 { 365 if(bp_core_validate(bp_core_clean($_POST['message_ids']))) { 366 $this->delete_messages($_POST['message_ids'], 'sentbox'); die; 367 } 368 } 369 else if(isset($_GET['mode']) && $_GET['mode'] == "send_response") 370 { 371 $this->validate_response($_GET['mid'], $_POST['is_forward'], $_POST['respond_forward_username'], $_POST['respond_reply_username'], $_POST['respond_subject'], $_POST['respond_message']); die; 372 } 373 374 ?> 328 } else { 329 $message = __('Message deleted successfully!'); 330 331 if ( !$status = BP_Messages_Thread::delete($thread_ids) ) { 332 $message = __('There was an error when deleting that message. Please try again.'); 333 $type = 'error'; 334 } 335 } 336 337 unset($_GET['mode']); 338 messages_box( $box, $display_name, $message, $type ); 339 } 340 341 342 function messages_view_thread( $thread_id ) { 343 global $bp_messages_image_base, $userdata; 344 345 $thread = new BP_Messages_Thread($thread_id, true, null, 'all'); 346 347 if ( !$thread->has_access ) { 348 unset($_GET['mode']); 349 messages_inbox( __('There was an error viewing this message, please try again.'), 'error' ); 350 } else { 351 if ( $thread->messages ) { ?> 375 352 <div class="wrap"> 376 <h2><?php _e('Sentbox'); ?></h2> 377 <form action="admin.php?page=messages_sentbox&mode=delete_bulk" method="post"> 378 379 <table class="widefat"> 380 <thead> 353 <h2 id="message-subject"><?php echo $thread->subject; ?></h2> 354 <table class="form-table"> 355 <tbody> 381 356 <tr> 382 <t h scope="col" width="1%"></th>383 <th scope="col" width="15%">From</th>384 <th scope="col">Subject</th>385 <th scope="col" width="21%">Date Sent</th>386 <th scope="col" colspan="2" style="text-align:center;" width="15%">Action</th>387 < th scope="col" width="1%"><input type="checkbox" id="check_all" onclick="checkAll();" name="check_all" /></th>357 <td> 358 <img src="<?php echo $bp_messages_image_base ?>/email_open.gif" alt="Message" style="vertical-align: top;" /> 359 <?php _e('Sent by') ?> <?php echo bp_core_get_userlink($thread->creator_id) ?> 360 <?php _e('to') ?> <?php echo $thread->recipients ?>. 361 <?php _e('Started on') ?> <?php echo bp_format_time($thread->last_post_date) ?> 362 </td> 388 363 </tr> 389 </thead> 390 <tbody id="the-list"> 391 392 <?php if($message != '') { ?> 393 <?php if($type == 'error') { $type = "error"; } else { $type = "updated"; } ?> 394 <div id="message" class="<?php echo $type; ?> fade"> 395 <p><?php echo $message; ?></p> 364 </tbody> 365 </table> 366 <?php 367 foreach ( $thread->messages as $message ) { 368 $message->mark_as_read(); 369 ?> 370 <a name="<?php echo 'm-' . $message->id ?>"></a> 371 <div class="message-box"> 372 <div class="avatar-box"> 373 <?php if ( function_exists('xprofile_get_avatar') ) 374 echo xprofile_get_avatar($message->sender_id, 1); 375 ?> 376 377 <h3><?php echo bp_core_get_userlink($message->sender_id) ?></h3> 378 <small><?php echo bp_format_time($message->date_sent) ?></small> 379 </div> 380 <?php echo $message->message; ?> 381 <div class="clear"></div> 396 382 </div> 397 <?php } ?>398 399 <?php400 401 $messages = $this->get_messages('sentbox');402 403 if(count($messages) > 0)404 {405 $counter = 0;406 foreach($messages as $message)407 {408 if($counter % 2 == 0) $class = "alternate";409 410 echo '411 <tr class="' . $class . '">412 <td><img src="' . $this->imageBase . 'email_sent.gif" alt="Sent Message" /></td>413 <td>' . bp_core_get_username($message->sender_id) . '</td>414 <td>' . stripslashes($message->subject) . '</td>415 <td>' . bp_format_time($message->date_sent) . '</td>416 <td><a class="edit" href="admin.php?page=messages_sentbox&mode=view&id=' . $message->id . '">View</a></td>417 <td><a class="delete" href="admin.php?page=messages_sentbox&mode=delete&id=' . $message->id . '">Delete</a></td>418 <td><input type="checkbox" name="message_ids[]" value="' . $message->id . '" /></td>419 </tr>420 ';421 422 $counter++;423 unset($class);424 unset($new);425 unset($is_read);426 }427 428 }429 else {430 ?>431 <tr class="alternate">432 <td colspan="7" style="text-align: center; padding: 15px 0;">433 You have no messages in your Sentbox.434 </td>435 </tr>436 383 <?php 437 384 } 438 439 echo '440 </tbody>441 </table>442 <p class="submit">443 <input id="deletebookmarks" class="button" type="submit" onclick="return confirm(\'You are about to delete these messages permanently.\n[Cancel] to stop, [OK] to delete.\')" value="Delete Checked Messages »" name="deletebookmarks"/>444 </p>445 </form>446 </div>';447 }448 449 450 /**************************************************************************451 drafts()452 453 Displays the list of draft messages in the sentbox as well as redirects454 to the delete and view functions.455 **************************************************************************/456 457 function drafts($message = '', $type = 'error')458 {459 if($_GET['mode'] == "delete" && isset($_GET['id']))460 {461 if(bp_core_validate(bp_core_clean($_GET['id'])))462 {463 $this->delete_message($_GET['id'], 'drafts'); die;464 }465 }466 else if($_GET['mode'] == "view" && isset($_GET['id']))467 {468 if(bp_core_validate(bp_core_clean($_GET['id']))) {469 $this->view_message($_GET['id'], 'drafts'); die;470 }471 }472 else if(isset($_GET['mode']) && isset($_POST['message_ids']) && $_GET['mode'] == "delete_bulk")473 {474 if(bp_core_validate(bp_core_clean($_POST['message_ids']))) {475 $this->delete_messages($_POST['message_ids'], 'drafts'); die;476 }477 }478 else if(isset($_GET['mode']) && $_GET['mode'] == "send_response")479 {480 $this->validate_response($_GET['mid'], $_POST['is_forward'], $_POST['respond_forward_username'], $_POST['respond_reply_username'], $_POST['respond_subject'], $_POST['respond_message']); die;481 }482 385 483 386 ?> 484 <div class="wrap"> 485 <h2><?php _e('Drafts'); ?></h2> 486 <form action="admin.php?page=messages_drafts&mode=delete_bulk" method="post"> 487 488 <table class="widefat"> 489 <thead> 490 <tr> 491 <th scope="col" width="1%"></th> 492 <th scope="col" width="15%">From</th> 493 <th scope="col">Subject</th> 494 <th scope="col" width="21%">Date Created</th> 495 <th scope="col" colspan="2" style="text-align:center;" width="15%">Action</th> 496 <th scope="col" width="1%"><input type="checkbox" id="check_all" onclick="checkAll();" name="check_all" /></th> 497 </tr> 498 </thead> 499 <tbody id="the-list"> 387 <form id="send-reply" action="admin.php?page=bp-messages.php&mode=send" method="post"> 388 <div class="message-box"> 389 <div id="messagediv"> 390 <div class="avatar-box"> 391 <?php if ( function_exists('xprofile_get_avatar') ) 392 echo xprofile_get_avatar($userdata->ID, 1); 393 ?> 500 394 501 <?php if($message != '') { ?> 502 <?php if($type == 'error') { $type = "error"; } else { $type = "updated"; } ?> 503 <div id="message" class="<?php echo $type; ?> fade"> 504 <p><?php echo $message; ?></p> 505 </div> 506 <?php } ?> 507 508 <?php 509 510 $messages = $this->get_messages('drafts'); 511 512 if(count($messages) > 0) 513 { 514 $counter = 0; 515 foreach($messages as $message) 516 { 517 if(!$message->is_read) 518 { 519 $is_read = "(*)"; 520 $new = " unread"; 521 } 522 if($counter % 2 == 0) $class = "alternate"; 523 524 echo ' 525 <tr class="' . $class . '"> 526 <td><img src="' . $this->imageBase . 'email_draft.gif" alt="Draft Message" /></td> 527 <td>' . bp_core_get_username($message->sender_id) . '</td> 528 <td>' . stripslashes($message->subject) . '</td> 529 <td>' . bp_format_time($message->date_sent) . '</td> 530 <td><a class="edit" href="admin.php?page=messages_drafts&mode=edit&id=' . $message->id . '">Edit</a></td> 531 <td><a class="delete" href="admin.php?page=messages_drafts&mode=delete&id=' . $message->id . '">Delete</a></td> 532 <td><input type="checkbox" name="message_ids[]" value="' . $message->id . '" /></td> 533 </tr> 534 '; 535 536 $counter++; 537 unset($class); 538 unset($new); 539 unset($is_read); 540 } 541 542 } 543 else { 544 ?> 545 <tr class="alternate"> 546 <td colspan="7" style="text-align: center; padding: 15px 0;"> 547 You have no draft messages. 548 </td> 549 </tr> 550 <?php 551 } 552 553 echo ' 554 </tbody> 555 </table> 556 <p class="submit"> 557 <input id="deletebookmarks" class="button" type="submit" onclick="return confirm(\'You are about to delete these messages permanently.\n[Cancel] to stop, [OK] to delete.\')" value="Delete Checked Messages »" name="deletebookmarks"/> 558 </p> 559 </form> 560 </div>'; 561 } 562 563 564 /************************************************************************** 565 get_messages() 566 567 Gets an array of message objects based on the current box and returns it. 568 **************************************************************************/ 569 570 function get_messages($box = 'inbox') 571 { 572 if($box == "sentbox") { 573 $sql = "SELECT * FROM " . $this->tableName . " 574 WHERE folder_id = " . SENTBOX . " 575 AND sender_id = " . $this->userdata->ID . " 576 ORDER BY date_sent DESC"; 577 578 } else if($box == "drafts") { 579 $sql = "SELECT * FROM " . $this->tableName . " 580 WHERE is_draft = 1 581 AND sender_id = " . $this->userdata->ID . " 582 ORDER BY date_sent DESC"; 583 } 584 else { 585 $sql = "SELECT * FROM " . $this->tableName . " 586 WHERE folder_id = " . INBOX . " 587 AND recipient_id = " . $this->userdata->ID . " 588 ORDER BY date_sent DESC"; 589 } 590 591 $messages = $this->wpdb->get_results($sql); 592 593 return $messages; 594 } 595 596 597 /************************************************************************** 598 delete_message() 599 600 Removes a message from the database. 601 **************************************************************************/ 602 603 function delete_message($message_id, $redirect = 'inbox') 604 { 605 /** Check that user can access this message **/ 606 $sql = "SELECT id FROM " . $this->tableName . " 607 WHERE id = " . $message_id . " 608 AND (sender_id = " . $this->userdata->ID . " 609 OR recipient_id = " . $this->userdata->ID . ")"; 610 611 if(!$this->wpdb->get_var($sql)) 612 { 613 /** No access to this message **/ 614 unset($_GET['mode']); 615 $message = __("That was not a valid message."); 616 $this->callback($message, 'error', $redirect); 617 } 618 else 619 { 620 /** User has access to this message **/ 621 $sql = "DELETE FROM " . $this->tableName . " 622 WHERE id = " . $message_id . " 623 LIMIT 1"; 624 625 if(!$this->wpdb->query($sql)) 626 { 627 unset($_GET['mode']); 628 $message = __("There was a problem deleting that message. Please try again."); 629 $this->callback($message, 'error', $redirect); 630 } 631 else 632 { 633 unset($_GET['mode']); 634 $message = __("The message was deleted successfully!"); 635 $this->callback($message, 'success', $redirect); 636 } 637 638 } 639 } 640 641 642 /************************************************************************** 643 delete_messages() 644 645 Removes multiple messages from the database. 646 **************************************************************************/ 647 648 function delete_messages($message_ids, $redirect = 'inbox') 649 { 650 if(is_array($message_ids)) 651 { 652 for($i=0; $i<count($message_ids); $i++) 653 { 654 /** Check that user can access this message **/ 655 $sql = "SELECT id FROM " . $this->tableName . " 656 WHERE id = " . $message_ids[$i] . " 657 AND (sender_id = " . $this->userdata->ID . " 658 OR recipient_id = " . $this->userdata->ID . ")"; 659 660 if($this->wpdb->get_var($sql)) 661 { 662 /** User has access to this message **/ 663 $sql = "DELETE FROM " . $this->tableName . " 664 WHERE id = " . $message_ids[$i] . " 665 LIMIT 1"; 666 667 if(!$this->wpdb->query($sql)) 668 { 669 $errors = 1; 670 } 671 } 672 } 673 674 if($errors) 675 { 676 unset($_GET['mode']); 677 $message = __("Some messages were not deleted, please try again."); 678 $this->callback($message, 'error', $redirect); die; 679 } 680 681 unset($_GET['mode']); 682 $message = __("Messages were deleted successfully!"); 683 $this->callback($message, 'success', $redirect); die; 684 } 685 } 686 687 688 /************************************************************************** 689 addto_sentbox() 690 691 Duplicates a sent message into the senders sentbox. 692 **************************************************************************/ 693 694 function addto_sentbox($username, $subject, $message, $date_sent) 695 { 696 $sql = "INSERT INTO " . $this->tableName . " ( 697 sender_id, 698 recipient_id, 699 subject, 700 message, 701 folder_id, 702 date_sent 703 ) 704 VALUES ( 705 " . $this->userdata->ID . ", 706 " . bp_core_get_userid($username) . ", 707 '" . bp_core_clean($subject) . "', 708 '" . bp_core_clean($message) . "', 709 " . SENTBOX . ", 710 " . $date_sent . " 711 )"; 712 713 $this->wpdb->query($sql); 714 } 715 716 717 /************************************************************************** 718 send() 719 720 Insert a message into the database. 721 **************************************************************************/ 722 723 function send($username, $subject, $message, $is_draft = 0) 724 { 725 $date_sent = time(); 726 727 $sql = "INSERT INTO " . $this->tableName . " ( 728 sender_id, 729 recipient_id, 730 subject, 731 message, 732 is_draft, 733 date_sent 734 ) 735 VALUES ( 736 " . $this->userdata->ID . ", 737 " . bp_core_get_userid($username) . ", 738 '" . bp_core_clean($subject) . "', 739 '" . bp_core_clean($message) . "', 740 " . bp_core_clean($is_draft) . ", 741 " . $date_sent . " 742 )"; 743 744 if($this->wpdb->query($sql)) 745 { 746 if($is_draft) 747 { 748 unset($_POST['save_as_draft']); 749 $this->write_new('', '', '', 'success', __("Your message has been saved.")); 750 } 751 else 752 { 753 unset($_POST['send']); 754 $this->addto_sentbox($username, $subject, $message, $date_sent); 755 $this->write_new('', '', '', 'success', __("Your message was sent successfully!")); 756 } 757 } 758 else 759 { 760 if($is_draft) 761 { 762 unset($_POST['save_as_draft']); 763 $this->write_new($username, $subject, $message, 'error', __("There was a problem saving your message, please try again.")); 764 } 765 else 766 { 767 unset($_POST['send']); 768 $this->write_new($username, $subject, $message, 'error', __("There was a problem sending your message, please try again.")); 769 } 770 } 771 } 772 773 774 /************************************************************************** 775 validate_response() 776 777 Check to see if a reply or forward of a message is valid. Used in Inbox 778 Sentbox and Drafts, so needs to be extracted into its own function. 779 **************************************************************************/ 780 781 function validate_response($mid, $response_type, $forward_username, $reply_username, $subject, $message) 782 { 783 if($response_type == "1" ) { $response_type = "forward"; } else { $response_type = "reply"; } 784 $reply = array("subject" => $subject, "message" => $message, "type" => $response_type); 785 786 if($response_type == "forward") 787 { 788 if($subject == "" || $forward_username == "") 789 { 790 $this->view_message(bp_core_clean($mid), 'inbox', $response_type, $reply, __('Please fill in all fields')); die; 791 } 792 else if(!bp_core_get_userid($forward_username)) { 793 $this->view_message(bp_core_clean($mid), 'inbox', $response_type, $reply, __('That username was invalid')); die; 794 } 795 else { 796 //echo "sending"; die; 797 $this->send($forward_username, $subject, $message); die; 798 } 799 } 800 else 801 { 802 if($subject == "" || $reply_username == "") 803 { 804 805 $this->view_message(bp_core_clean($mid), 'inbox', $response_type, $reply, __('Please fill in all fields')); die; 806 } 807 else if(!bp_core_get_userid($reply_username)) { 808 $this->view_message(bp_core_clean($mid), 'inbox', $response_type, $reply, __('That username was invalid')); die; 809 } 810 else { 811 //echo "sending"; die; 812 $this->send($reply_username, $subject, $message); die; 813 } 814 815 } 816 } 817 818 819 820 /************************************************************************** 821 mark_as_read() 822 823 Marks a message as read, once it's been viewed. 824 **************************************************************************/ 825 826 function mark_as_read($mid) 827 { 828 $sql = "UPDATE " . $this->tableName . " 829 SET is_read = 1 830 WHERE id = " . $mid; 831 832 $this->wpdb->query($sql); 833 } 834 835 836 /************************************************************************** 837 get_message() 838 839 Select and return a message. 840 **************************************************************************/ 841 842 function get_message($mid) 843 { 844 $sql = "SELECT * FROM " . $this->tableName . " 845 WHERE id = " . $mid; 846 847 return $this->wpdb->get_row($sql); 848 } 849 850 851 /************************************************************************** 852 view_message() 853 854 Selects and displays a message and handles reply/forward form. 855 **************************************************************************/ 856 857 function view_message($mid, $redirect_to, $show_respond = false, $callback = null, $error_message = null) 858 { 859 860 /* Check if user can view. */ 861 $sql = "SELECT * FROM " . $this->tableName . " 862 WHERE id = " . $mid . " 863 AND (recipient_id = " . $this->userdata->ID . " 864 OR sender_id = " . $this->userdata->ID . ") 865 LIMIT 1"; 866 867 if(!$message = $this->wpdb->get_row($sql)) 868 { 869 unset($_GET['mode']); 870 $this->callback(__("There was a problem viewing that message, please try again."), 'error', $redirect_to); 871 } 872 else { 873 874 /* All good, now show the message */ 875 ?> 876 877 <div class="wrap"> 878 <h2 id="message_subject"><?php echo "\"" . $message->subject . "\""; ?></h2> 879 880 <ul> 881 <li><?php _e("From") ?>: <?php echo bp_core_get_username($message->sender_id) ?></li> 882 <li><?php _e("Subject") ?>: <strong><?php echo $message->subject ?></strong></li> 883 <li><?php _e("Date Sent") ?>: <?php echo bp_format_time($message->date_sent) ?></li> 884 <li><?php _e("To") ?>: <?php echo bp_core_get_username($message->recipient_id) ?></li> 885 </ul> 886 <hr /> 887 888 <div id="message_view"> 889 <?php echo $message->message; ?> 890 </div> 891 <hr /> 892 <p> 893 <a href="javascript:sendReply();">Reply</a> 894 <a href="javascript:forwardMessage();">Forward</a> 895 </p> 896 897 <?php if($error_message != '') { ?> 898 <div id="message" class="error fade"> 899 <p><?php echo $error_message; ?></p> 900 </div> 901 <?php } ?> 902 903 <div id="respond"<?php if(!$show_respond) { ?>style="display: none;"<?php } ?>> 904 <form action="admin.php?page=messages_<?php echo $redirect_to ?>&mode=send_response&mid=<?php echo $message->id; ?>" method="post" id="send_message_form"> 905 906 <input type="hidden" name="respond_reply_username" id="respond_reply_username" value="<?php echo bp_core_get_username($message->sender_id) ?>" /> 907 908 <div id="recipientdiv"<?php if($show_respond != "forward") { ?>style="display:none;"<?php } ?>> 909 <label for="respond_forward_username"><?php _e("Forward to Username:") ?></label> 910 <div> 911 <input type="text" name="respond_forward_username" id="respond_forward_username" style="width: 50%;" value="<?php if(isset($callback["forward_username"])) { echo $callback["forward_username"]; } ?>" /> 912 </div> 913 </div> 914 915 <div id="subjectdiv"> 916 <label for="respond_subject"><?php _e("Subject") ?></label> 917 <div> 918 <input type="text" name="respond_subject" id="respond_subject" value="<?php if(isset($callback["subject"])) { echo $callback["subject"]; } else { echo $subject; } ?>" /> 919 </div> 920 </fieldset> 921 922 <p> 923 <div id="messagediv"> 924 <label for="respond_message"><?php _e("Message") ?></label> 395 <h3><?php _e("Reply: ") ?></h3> 396 </div> 397 <label for="reply"></label> 925 398 <div> 926 <textarea name=" respond_message" id="respond_message" rows="15" cols="40"><?php if(isset($callback["message"])) { echo $callback["message"]; } else { ?><br /><br />-------- Original Message -------------------------------------<br /><br /><?php echo $message->message; ?></fieldset><?php }?></textarea>399 <textarea name="content" id="content" rows="15" cols="40"><?php echo $content; ?></textarea> 927 400 </div> 928 401 </div> 929 </p> 930 931 932 <p class="submit"> 933 <input type="submit" value="<?php _e("Save as Draft"); ?>" name="save_as_draft" id="save_as_draft" /> 934 <input type="submit" value="<?php _e("Send") ?> »" name="send" id="send" style="font-weight: bold" /> 935 </p> 936 937 <input type="hidden" name="is_forward" id="is_forward" value="<?php if($callback["type"] == "forward") { ?>1<?php }else{ ?>0<?php } ?>" /> 938 </form> 939 </div> 940 941 402 <p class="submit"> 403 <input type="submit" name="send" value="Send Reply »" id="send" /> 404 </p> 405 </div> 406 <input type="hidden" name="thread_id" id="thread_id" value="<?php echo $thread->thread_id ?>" /> 407 <input type="hidden" name="send_to" id="send_to" value="<?php echo $thread->creator_id ?>" /> 408 <input type="hidden" name="subject" id="subject" value="<?php _e('Re: '); echo $thread->subject; ?>" /> 409 </form> 942 410 </div> 943 944 411 <?php 945 946 /** Now mark this message as read. **/ 947 $this->mark_as_read($message->id); 948 949 } 950 } 951 952 953 /************************************************************************** 954 get_inbox_count() 955 956 Counts unread messages in Inbox, to display unread count on tab. 957 **************************************************************************/ 958 959 function get_inbox_count() 960 { 961 $sql = "SELECT count(id) FROM " . $this->tableName . " 962 WHERE recipient_id = " . $this->userdata->ID . " 963 AND folder_id = 1 964 AND is_read = 0"; 965 966 $count = $this->wpdb->get_var($sql); 967 968 if($count > 0) 969 { 970 return " <strong>(" . $count . ")</strong>"; 971 } 972 973 return false; 974 } 975 976 977 /************************************************************************** 978 callback() 979 980 Callback to specfic functions - this keeps correct tabs selected. 981 **************************************************************************/ 982 983 function callback($message, $type = 'error', $callback) 984 { 985 986 switch($callback) 987 { 988 case "inbox": 989 $this->inbox($message, $type); 990 break; 991 case "sentbox": 992 $this->sentbox($message, $type); 993 break; 994 case "drafts": 995 $this->drafts($message, $type); 996 break; 997 default: 998 $this->inbox($message, $type); 999 } 1000 } 1001 1002 /************************************************************************** 1003 add_js() 1004 1005 Inserts the TinyMCE Js that's needed for the WYSIWYG message editor. 1006 **************************************************************************/ 1007 1008 function add_js() 1009 { 1010 if(isset($_GET['page'])) 1011 { 1012 ?> 1013 <script type="text/javascript"> 1014 function checkAll() { 1015 var checkboxes = document.getElementsByTagName("input"); 1016 for(var i=0; i<checkboxes.length; i++) { 1017 if(checkboxes[i].type == "checkbox") { 1018 if(document.getElementById("check_all").checked == "") { 1019 checkboxes[i].checked = ""; 1020 } 1021 else { 1022 checkboxes[i].checked = "checked"; 1023 } 1024 } 1025 } 1026 } 1027 1028 function sendReply() { 1029 var subject = document.getElementById("message_subject").innerHTML; 1030 1031 document.getElementById("respond").style.display = "block"; 1032 document.getElementById("recipientdiv").style.display = "none"; 1033 document.getElementById("respond_subject").value = "Re: " + subject.substr(1).replace('"', ''); 1034 document.getElementById("respond_forward_username").value = ""; 1035 document.getElementById("is_forward").value = "0"; 1036 } 1037 1038 function forwardMessage() { 1039 var subject = document.getElementById("message_subject").innerHTML; 1040 1041 document.getElementById("respond").style.display = "block"; 1042 document.getElementById("recipientdiv").style.display = "block"; 1043 document.getElementById("respond_subject").value = "Fwd: " + subject.substr(1).replace('"', ''); 1044 document.getElementById("respond_forward_username").value = ""; 1045 document.getElementById("is_forward").value = "1"; 1046 } 1047 1048 </script> 1049 <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script> 1050 <script type="text/javascript"> 1051 <!-- 1052 tinyMCE.init({ 1053 theme : "advanced", 1054 theme : "advanced", 1055 language : "en", 1056 theme_advanced_toolbar_location : "top", 1057 theme_advanced_toolbar_align : "left", 1058 theme_advanced_path_location : "bottom", 1059 theme_advanced_resizing : true, 1060 theme_advanced_resize_horizontal : false, 1061 theme_advanced_buttons1 : "bold,italic,strikethrough,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,spellchecker,forecolor,fontsizeselect", 1062 theme_advanced_buttons2 : "", 1063 theme_advanced_buttons3 : "", 1064 content_css : "<?php echo get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css'; ?>", 1065 mode : "exact", 1066 elements : "message_input, respond_message", 1067 width : "99%", 1068 height : "200" 1069 }); 1070 --> 1071 </script> 1072 <?php 1073 } 1074 } 1075 1076 1077 /************************************************************************** 1078 add_css() 1079 1080 Inserts the CSS needed to style the messages pages. 1081 **************************************************************************/ 1082 1083 function add_css() 1084 { 1085 ?> 1086 <style type="text/css"> 1087 .unread td { 1088 font-weight: bold; 1089 background: #ffffec; 1090 } 1091 1092 #send_message_form fieldset input { 1093 width: 98%; 1094 font-size: 1.7em; 1095 padding: 4px 3px; 1096 } 1097 1098 1099 </style> 1100 <?php 1101 } 1102 1103 } // End Class 412 } 413 } 414 } 1104 415 1105 416 -
trunk/bp-xprofile.php
r53 r56 6 6 $bp_xprofile_table_name_data = $wpdb->base_prefix . 'bp_xprofile_data'; 7 7 8 $image_base = get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images';8 $image_base = get_option('siteurl') . '/wp-content/mu-plugins/bp-xprofile/images'; 9 9 10 10 require_once( 'bp-xprofile/bp-xprofile-classes.php' );
Note: See TracChangeset
for help on using the changeset viewer.