Changeset 865
- Timestamp:
- 01/24/07 12:40:34 (2 years ago)
- Files:
-
- trunk/app.php (added)
- trunk/wp-admin/admin-functions.php (modified) (3 diffs)
- trunk/wp-admin/edit-form-advanced.php (modified) (2 diffs)
- trunk/wp-admin/edit-page-form.php (modified) (1 diff)
- trunk/wp-admin/users.php (modified) (1 diff)
- trunk/wp-admin/wp-admin.css (modified) (24 diffs)
- trunk/wp-includes/category-template.php (modified) (5 diffs)
- trunk/wp-includes/deprecated.php (modified) (15 diffs)
- trunk/wp-includes/version.php (modified) (1 diff)
- trunk/xmlrpc.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-functions.php
r860 r865 1283 1283 if ( $items ) { 1284 1284 foreach ( $items as $item ) { 1285 // A page cannot be it 's own parent.1285 // A page cannot be its own parent. 1286 1286 if (!empty ( $post_ID ) ) { 1287 1287 if ( $item->ID == $post_ID ) { … … 2204 2204 $thumbpath = str_replace( basename( $file ), $thumb, $file ); 2205 2205 2206 // move the thumbnail to it 's final destination2206 // move the thumbnail to its final destination 2207 2207 if ( $type[2] == 1 ) { 2208 2208 if (!imagegif( $thumbnail, $thumbpath ) ) { … … 2229 2229 return $error; 2230 2230 } else { 2231 apply_filters( 'wp_create_thumbnail', $thumbpath ); 2232 return $thumbpath; 2231 return apply_filters( 'wp_create_thumbnail', $thumbpath ); 2233 2232 } 2234 2233 } trunk/wp-admin/edit-form-advanced.php
r860 r865 108 108 <?php if ( current_user_can('edit_posts') ) : ?> 109 109 <fieldset id="posttimestampdiv" class="dbx-box"> 110 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?> :</h3>110 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?></h3> 111 111 <div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div> 112 112 </fieldset> … … 118 118 ?> 119 119 <fieldset id="authordiv" class="dbx-box"> 120 <h3 class="dbx-handle"><?php _e('Post Author'); ?> :</h3>120 <h3 class="dbx-handle"><?php _e('Post Author'); ?></h3> 121 121 <div class="dbx-content"> 122 122 <select name="post_author_override" id="post_author_override"> trunk/wp-admin/edit-page-form.php
r851 r865 99 99 <?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?> 100 100 <fieldset id="authordiv" class="dbx-box"> 101 <h3 class="dbx-handle"><?php _e('Page Author'); ?> :</h3>101 <h3 class="dbx-handle"><?php _e('Page Author'); ?></h3> 102 102 <div class="dbx-content"> 103 103 <select name="post_author_override" id="post_author_override"> trunk/wp-admin/users.php
r828 r865 469 469 470 470 <form action="" method="get" name="search" id="search"> 471 <p><input type="text" name="usersearch" id="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" /> <input type="submit" value="<?php _e('Search users »'); ?>" class="button" /></p>471 <p><input type="text" name="usersearch" id="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" /> <input type="submit" value="<?php _e('Search Users »'); ?>" class="button" /></p> 472 472 </form> 473 473 trunk/wp-admin/wp-admin.css
r861 r865 202 202 border: 1px solid #b2b2b2; 203 203 color: #000; 204 font: 13px Verdana, Arial, Helvetica, sans-serif;204 font: 13px Verdana, Arial, Helvetica, sans-serif; 205 205 margin: 1px; 206 206 padding: 3px; … … 209 209 #uploading { 210 210 border-style: none; 211 padding: 0 px;211 padding: 0; 212 212 margin-bottom: 16px; 213 213 height: 18em; … … 460 460 } 461 461 462 463 462 #adminmenu .current, #submenu .current { 464 463 font-weight: bold; … … 530 529 } 531 530 532 533 531 #categorydiv input, #poststatusdiv input, #commentstatusdiv input, #pingstatusdiv input { 534 532 border: none; … … 537 535 #postdiv, #titlediv, #guiddiv { 538 536 margin: 0 8px 0 0; 539 padding: 0 px;537 padding: 0; 540 538 } 541 539 542 540 #postdivrich { 543 margin: 0 px;544 padding: 0 px;541 margin: 0; 542 padding: 0; 545 543 } 546 544 547 545 #content { 548 margin: 0 0 0 0;546 margin: 0; 549 547 width: 100%; 550 548 } … … 556 554 557 555 #titlediv input, #guiddiv input { 558 margin: 0 px;556 margin: 0; 559 557 width: 100%; 560 558 } … … 580 578 #postdivrich #quicktags { 581 579 background: #f0f0ee; 582 padding: 0 px;580 padding: 0; 583 581 border: 1px solid #ccc; 584 582 border-bottom: none; … … 594 592 595 593 #quicktags #ed_toolbar { 596 padding: 0 px2px;594 padding: 0 2px; 597 595 } 598 596 599 597 #ed_toolbar input { 600 background: #fff url( images/fade-butt.png ) repeat-x 0 px-2px;598 background: #fff url( images/fade-butt.png ) repeat-x 0 -2px; 601 599 margin: 3px 2px 2px; 602 600 } … … 644 642 645 643 #excerpt, .attachmentlinks { 646 margin: 0 px;644 margin: 0; 647 645 height: 4em; 648 646 width: 100%; … … 815 813 #postcustom table { 816 814 border: 1px solid #ccc; 817 margin: 0 px;815 margin: 0; 818 816 width: 100%; 819 817 } … … 836 834 837 835 * html #template div { 838 margin-right: 0 px;836 margin-right: 0; 839 837 } 840 838 … … 968 966 set display:none; */ 969 967 .zerosize { 970 height: 0 px;971 width: 0 px;972 margin: 0 px;973 border: 0 px;974 padding: 0 px;968 height: 0; 969 width: 0; 970 margin: 0; 971 border: 0; 972 padding: 0; 975 973 overflow: hidden; 976 974 position: absolute; … … 979 977 /* Box stuff */ 980 978 .dbx-clone { 981 position: absolute;982 visibility: hidden;979 position: absolute; 980 visibility: hidden; 983 981 } 984 982 .dbx-clone, .dbx-clone .dbx-handle-cursor { 985 cursor: move !important;983 cursor: move !important; 986 984 } 987 985 .dbx-dummy { 988 display: block;989 width: 0;990 height: 0;991 overflow: hidden;986 display: block; 987 width: 0; 988 height: 0; 989 overflow: hidden; 992 990 } 993 991 .dbx-group, .dbx-box, .dbx-handle { 994 position: relative;995 display: block;992 position: relative; 993 display: block; 996 994 } 997 995 … … 1001 999 1002 1000 * html #themeselect { 1003 padding: 0 px3px;1001 padding: 0 3px; 1004 1002 height: 22px; 1005 1003 } … … 1011 1009 *****************************************************************/ 1012 1010 .dbx-box { 1013 margin: 0;1014 padding: 0;1015 border: none;1011 margin: 0; 1012 padding: 0; 1013 border: none; 1016 1014 } 1017 1015 … … 1021 1019 } 1022 1020 #moremeta fieldset div { 1023 margin: 2px 0 0 0 px;1021 margin: 2px 0 0 0; 1024 1022 padding: 7px; 1025 1023 } … … 1084 1082 } 1085 1083 1086 #your-profile fieldset input {1084 #your-profile fieldset input { 1087 1085 width: 100%; 1088 1086 font-size: 20px; … … 1123 1121 /* handles */ 1124 1122 1125 .dbx-handle {1123 .dbx-handle { 1126 1124 background: #2685af; 1127 1125 padding: 6px 1em 2px; … … 1158 1156 margin-left: 8px; 1159 1157 background: url(images/box-bg-right.gif) repeat-y right; 1160 padding: 10px 10px 15px 0 px;1158 padding: 10px 10px 15px 0; 1161 1159 } 1162 1160 … … 1191 1189 } 1192 1190 1193 1194 1191 /* handle cursors */ 1195 1192 .dbx-handle-cursor { … … 1199 1196 /* toggle images */ 1200 1197 a.dbx-toggle, a.dbx-toggle:visited { 1201 display: block;1198 display: block; 1202 1199 overflow: hidden; 1203 1200 background-image: url( images/toggle.gif ); 1204 1201 position: absolute; 1205 top: 0 px;1206 right: 0 px;1202 top: 0; 1203 right: 0; 1207 1204 background-repeat: no-repeat; 1208 border: 0 px;1209 margin: 0 px;1210 padding: 0 px;1205 border: 0; 1206 margin: 0; 1207 padding: 0; 1211 1208 } 1212 1209 … … 1214 1211 height: 25px; 1215 1212 width: 27px; 1216 background-position: 0 0 px;1213 background-position: 0 0; 1217 1214 } 1218 1215 … … 1297 1294 1298 1295 #edButtons input, #edButtons input:active { 1299 margin: 0 px2px -1px;1296 margin: 0 2px -1px; 1300 1297 } 1301 1298 … … 1306 1303 1307 1304 #edButtons input.edButtonBack, #edButtons input.edButtonBack:active { 1308 background: #fff url( images/fade-butt.png ) repeat-x 0 px15px;1305 background: #fff url( images/fade-butt.png ) repeat-x 0 15px; 1309 1306 border-bottom: 1px solid #ccc; 1310 1307 } trunk/wp-includes/category-template.php
r854 r865 89 89 90 90 function get_the_category_list($separator = '', $parents='') { 91 global $wp_rewrite; 91 92 $categories = get_the_category(); 92 93 if (empty($categories)) 93 94 return apply_filters('the_category', __('Uncategorized'), $separator, $parents); 95 96 $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; 94 97 95 98 $thelist = ''; … … 102 105 if ($category->category_parent) 103 106 $thelist .= get_category_parents($category->category_parent, TRUE); 104 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';107 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" ' . $rel . '>' . $category->cat_name.'</a></li>'; 105 108 break; 106 109 case 'single': 107 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">';110 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" ' . $rel . '>'; 108 111 if ($category->category_parent) 109 112 $thelist .= get_category_parents($category->category_parent, FALSE); … … 112 115 case '': 113 116 default: 114 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';117 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" ' . $rel . '>' . $category->cat_name.'</a></li>'; 115 118 } 116 119 } … … 125 128 if ( $category->category_parent ) 126 129 $thelist .= get_category_parents($category->category_parent, TRUE); 127 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';130 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" ' . $rel . '>' . $category->cat_name.'</a>'; 128 131 break; 129 132 case 'single': 130 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';133 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" ' . $rel . '>'; 131 134 if ( $category->category_parent ) 132 135 $thelist .= get_category_parents($category->category_parent, FALSE); … … 135 138 case '': 136 139 default: 137 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';140 $thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" ' . $rel . '>' . $category->cat_name.'</a>'; 138 141 } 139 142 ++$i; trunk/wp-includes/deprecated.php
r849 r865 2 2 3 3 /* 4 * Deprecated global variables.4 * Deprecated global variables. 5 5 */ 6 6 7 7 $tableposts = $wpdb->posts; 8 8 $tableusers = $wpdb->users; … … 16 16 17 17 /* 18 * Deprecated functio s come here to die.18 * Deprecated functions come here to die. 19 19 */ 20 20 21 // Deprecated.Use get_post().21 // Use get_post(). 22 22 function get_postdata($postid) { 23 23 $post = &get_post($postid); … … 44 44 } 45 45 46 // Deprecated.Use the new post loop.46 // Use the new post loop. 47 47 function start_wp() { 48 48 global $wp_query, $post; … … 54 54 } 55 55 56 // Deprecated.57 56 function the_category_ID($echo = true) { 58 57 // Grab the first cat in the list. … … 66 65 } 67 66 68 // Deprecated.69 67 function the_category_head($before='', $after='') { 70 68 global $currentcat, $previouscat; … … 80 78 } 81 79 82 // Deprecated.Use previous_post_link().80 // Use previous_post_link(). 83 81 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 84 82 … … 101 99 } 102 100 103 // Deprecated.Use next_post_link().101 // Use next_post_link(). 104 102 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 105 103 … … 123 121 124 122 // 125 // These are deprecated. Use current_user_can().123 // Use current_user_can() for these. 126 124 // 127 125 … … 245 243 $args = add_query_arg('category', $cat_id, $args); 246 244 wp_get_links($args); 247 } // end wp_get_linksbyname245 } 248 246 249 247 /** function get_linkobjectsbyname() … … 422 420 } 423 421 422 // Use wp_list_cats(). 424 423 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) { 425 424 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', … … 470 469 } 471 470 472 // Deprecated. Use wp_print_scripts() or WP_Scripts instead.471 // Use wp_print_scripts() or WP_Scripts. 473 472 function tinymce_include() { 474 wp_print_script( 'wp_tiny_mce');473 wp_print_script('wp_tiny_mce'); 475 474 } 476 475 … … 488 487 } 489 488 489 // Use wp_get_archives(). 490 490 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 491 491 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); … … 493 493 } 494 494 495 // Deprecated.Use get_author_posts_url().495 // Use get_author_posts_url(). 496 496 function get_author_link($echo = false, $author_id, $author_nicename = '') { 497 497 $link = get_author_posts_url($author_id, $author_nicename); … … 502 502 } 503 503 504 // Use wp_link_pages(). 504 505 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { 505 506 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); … … 507 508 } 508 509 510 // Use get_option(). 509 511 function get_settings($option) { 510 512 return get_option($option); trunk/wp-includes/version.php
r854 r865 3 3 // This holds the version number in a separate file so we can bump it without cluttering the SVN 4 4 5 $wp_version = 'wordpress-mu-1. 0'; // Let's just avoid confusion5 $wp_version = 'wordpress-mu-1.2'; // Let's just avoid confusion 6 6 $wp_db_version = 4772; 7 7 trunk/xmlrpc.php
r839 r865 68 68 function wp_xmlrpc_server() { 69 69 $this->methods = array( 70 // WordPress API 71 'wp.getPage' => 'this:wp_getPage', 72 'wp.getPages' => 'this:wp_getPages', 73 'wp.newPage' => 'this:wp_newPage', 74 'wp.deletePage' => 'this:wp_deletePage', 75 'wp.editPage' => 'this:wp_editPage', 76 'wp.getPageList' => 'this:wp_getPageList', 77 'wp.getAuthors' => 'this:wp_getAuthors', 78 'wp.getCategories' => 'this:mw_getCategories', // Alias 79 'wp.newCategory' => 'this:wp_newCategory', 80 'wp.suggestCategories' => 'this:wp_suggestCategories', 81 70 82 // Blogger API 71 83 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', … … 147 159 } 148 160 161 /** 162 * WordPress XML-RPC API 163 * wp_getPage 164 */ 165 function wp_getPage($args) { 166 $this->escape($args); 167 168 $blog_id = $args[0]; 169 $page_id = $args[1]; 170 $username = $args[2]; 171 $password = $args[3]; 172 173 if(!$this->login_pass_ok($username, $password)) { 174 return($this->error); 175 } 176 177 // Lookup page info. 178 $page = get_page($page_id); 179 180 // If we found the page then format the data. 181 if($page->ID && ($page->post_type == "page")) { 182 // Get all of the page content and link. 183 $full_page = get_extended($page->post_content); 184 $link = post_permalink($page->ID); 185 186 // Determine comment and ping settings. 187 $allow_comments = ("open" == $page->comment_status) ? 1 : 0; 188 $allow_pings = ("open" == $page->ping_status) ? 1 : 0; 189 190 // Format page date. 191 $page_date = mysql2date("Ymd\TH:i:s", $page->post_date); 192 193 // Pull the categories info together. 194 $categories = array(); 195 foreach(wp_get_post_categories($page->ID) as $cat_id) { 196 $categories[] = get_cat_name($cat_id); 197 } 198 199 // Get the users nicename. 200 $nicename = get_profile("user_nicename", $username); 201 202 $page_struct = array( 203 "dateCreated" => new IXR_Date($page_date), 204 "userid" => $page->post_author, 205 "page_id" => $page->ID, 206 "description" => $full_page["main"], 207 "title" => $page->post_title, 208 "link" => $link, 209 "permaLink" => $link, 210 "categories" => $categories, 211 "excerpt" => $page->post_excerpt, 212 "text_more" => $full_page["extended"], 213 "mt_allow_comments" => $allow_comments, 214 "mt_allow_pings" => $allow_pings, 215 "wp_slug" => $page->post_name, 216 "wp_password" => $page->post_password, 217 "wp_author" => $nicename, 218 "wp_page_parent_id" => $page->post_parent, 219 "wp_page_order" => $page->menu_order 220 ); 221 222 return($page_struct); 223 } 224 // If the page doesn't exist indicate that. 225 else { 226 return(new IXR_Error(404, "Sorry, no such page.")); 227 } 228 } 229 230 /** 231 * WordPress XML-RPC API 232 * wp_getPages 233 */ 234 function wp_getPages($args) { 235 $this->escape($args); 236 237 $blog_id = $args[0]; 238 $username = $args[1]; 239 $password = $args[2]; 240 241 if(!$this->login_pass_ok($username, $password)) { 242 return($this->error); 243 } 244 245 // Lookup info on pages. 246 $pages = array(); 247 $pages = get_pages(); 248 $num_pages = count($pages); 249 250 // If we have pages, put together their info. 251 if($num_pages >= 1) { 252 $pages_struct = array(); 253 254 for($i = 0; $i < $num_pages; $i++) { 255 $page = wp_xmlrpc_server::wp_getPage(array( 256 $blog_id, $pages[$i]->ID, $username, $password 257 )); 258 $pages_struct[] = $page; 259 } 260 261 return($pages_struct); 262 } 263 // If no pages were found return an error. 264 else { 265 return(new IXR_Error(404, "Sorry, no pages were found.")); 266 } 267 } 268 269 /** 270 * WordPress XML-RPC API 271 * wp_newPage 272 */ 273 function wp_newPage($args) { 274 $this->escape($args); 275 276 $blog_id = $args[0]; 277 $username = $args[1]; 278 $password = $args[2]; 279 $page = $args[3]; 280 $publish = $args[4]; 281 282 if(!$this->login_pass_ok($username, $password)) { 283 return($this->error); 284 } 285 286 // Set the user context and check if they are allowed 287 // to add new pages. 288 $user = set_current_user(0, $username); 289 if(!current_user_can("publish_pages")) { 290 return(new IXR_Error(401, "Sorry, you can not add new pages.")); 291 } 292 293 // Mark this as content for a page. 294 $args[3]["post_type"] = "page"; 295 296 // Let mw_newPost do all of the heavy lifting. 297 return($this->mw_newPost($args)); 298 } 299 300 /** 301 * WordPress XML-RPC API 302 * wp_deletePage 303 */ 304 function wp_deletePage($args) { 305 $this->escape($args); 306 307 $blog_id = $args[0]; 308 $username = $args[1]; 309 $password = $args[2]; 310 $page_id = $args[3]; 311 312 if(!$this->login_pass_ok($username, $password)) { 313 return($this->error); 314 } 315 316 // Get the current page based on the page_id and 317 // make sure it is a page and not a post. 318 $actual_page = wp_get_single_post($page_id, ARRAY_A); 319 if( 320 !$actual_page 321 || ($actual_page["post_type"] != "page") 322 ) { 323 return(new IXR_Error(404, "Sorry, no such page.")); 324 } 325 326 // Set the user context and make sure they can delete pages. 327 set_current_user(0, $username); 328 if(!current_user_can("delete_page", $page_id)) { 329 return(new IXR_Error(401, "Sorry, you do not have the right to delete this page.")); 330 } 331 332 // Attempt to delete the page. 333 $result = wp_delete_post($page_id); 334 if(!$result) { 335 return(new IXR_Error(500, "Failed to delete the page.")); 336 } 337 338 return(true); 339 } 340 341 /** 342 * WordPress XML-RPC API 343 * wp_editPage 344 */ 345 function wp_editPage($args) { 346 $this->escape($args); 347 348 $blog_id = $args[0]; 349 $page_id = $args[1]; 350 $username = $args[2]; 351 $password = $args[3]; 352 $content = $args[4]; 353 $publish = $args[5]; 354 355 if(!$this->login_pass_ok($username, $password)) { 356 return($this->error); 357 } 358 359 // Get the page data and make sure it is a page. 360 $actual_page = wp_get_single_post($page_id, ARRAY_A); 361 if( 362 !$actual_page 363 || ($actual_page["post_type"] != "page") 364 ) { 365 return(new IXR_Error(404, "Sorry, no such page.")); 366 } 367 368 // Set the user context and make sure they are allowed to edit pages. 369 set_current_user(0, $username); 370 if(!current_user_can("edit_page", $page_id)) { 371 return(new IXR_Error(401, "Sorry, you do not have the right to edit this page.")); 372 } 373 374 // Mark this as content for a page. 375 $content["post_type"] = "page"; 376 377 // Arrange args in the way mw_editPost understands. 378 $args = array( 379 $page_id, 380 $username, 381 $password, 382 $content, 383 $publish 384 ); 385 386 // Let mw_editPost do all of the heavy lifting. 387 return($this->mw_editPost($args)); 388 } 389 390 /** 391 * WordPress XML-RPC API 392 * wp_getPageList 393 */ 394 function wp_getPageList($args) { 395 global $wpdb; 396 397 $this->escape($args); 398 399 $blog_id = $args[0]; 400 $username = $args[1]; 401 $password = $args[2]; 402 403 if(!$this->login_pass_ok($username, $password)) { 404 return($this->error); 405 } 406 407 // Get list of pages ids and titles 408 $page_list = $wpdb->get_results(" 409 SELECT ID page_id, 410 post_title page_title 411 FROM {$wpdb->posts} 412 WHERE post_type = 'page' 413 ORDER BY ID 414 "); 415 416 return($page_list); 417 } 418 419 /** 420 * WordPress XML-RPC API 421 * wp_getAuthors 422 */ 423 function wp_getAuthors($args) { 424 global $wpdb; 425 426 $this->escape($args); 427 428 $blog_id = $args[0]; 429 $username = $args[1]; 430 $password = $args[2]; 431 432 if(!$this->login_pass_ok($username, $password)) { 433 return($this->error); 434 } 435 436 // Get basic info on all users. 437 $all_users = $wpdb->get_results(" 438 SELECT u.ID id, 439 u.user_login username 440 FROM {$wpdb->users} u 441 ORDER BY u.user_login 442 "); 443 444 return($all_users); 445 } 446 447 /** 448 * WordPress XML-RPC API 449 * wp_newCategory 450 */ 451 function wp_newCategory($args) { 452 $this->escape($args); 453 454 $blog_id = $args[0]; 455 $username = $args[1]; 456 $password = $args[2]; 457 $category = $args[3]; 458 459 if(!$this->login_pass_ok($username, $password)) { 460 return($this->error); 461 } 462 463 // Set the user context and make sure they are 464 // allowed to add a category. 465 set_current_user(0, $username); 466 if(!current_user_can("manage_categories", $page_id)) { 467 return(new IXR_Error(401, "Sorry, you do not have the right to add a category.")); 468 } 469 470 // We need this to make use of the wp_insert_category() 471 // funciton. 472 require_once(ABSPATH . "wp-admin/admin-db.php"); 473 474 // If no slug was provided make it empty so that 475 // WordPress will generate one. 476 if(empty($category["slug"])) { 477 $category["slug"] = ""; 478 } 479 480 // If no parent_id was provided make it empty 481 // so that it will be a top level page (no parent). 482 if(empty($category["parent_id"])) { 483 $category["parent_id"] = ""; 484 } 485 486 // If no description was provided make it empty. 487 if(empty($category["description"])) { 488 $category["description"] = ""; 489 } 490 491 $new_category = array( 492 "cat_name" => $category["name"], 493 "category_nicename" => $category["slug"], 494 "category_parent" => $category["parent_id"], 495 "category_description" => $category["description"] 496 ); 497 498 $cat_id = wp_insert_category($new_category); 499 if(!$cat_id) { 500 return(new IXR_Error(500, "Sorry, the new category failed.")); 501 } 502 503 return($cat_id); 504 } 505 506 /** 507 * WordPress XML-RPC API 508 * wp_suggestCategories 509 */ 510 function wp_suggestCategories($args) { 511 global $wpdb; 512 513
