Changeset 1197
- Timestamp:
- 04/28/2004 04:49:16 AM (22 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 4 edited
-
admin-functions.php (modified) (5 diffs)
-
edit-form-advanced.php (modified) (3 diffs)
-
post.php (modified) (5 diffs)
-
wp-admin.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r1195 r1197 233 233 <td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' value='{$entry['meta_key']}' /></td> 234 234 <td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='40'>{$entry['meta_value']}</textarea></td> 235 <td align='center'><input name='updatemeta' type='submit' id='updatemeta' tabindex='6' value='" . __('Update') ."' /></td>236 <td align='center'><input name='deletemeta[{$entry['meta_id']}]' type='submit' id='deletemeta' tabindex='6' value='" . __('Delete') ."' /></td>235 <td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='" . __('Update') ."' /></td> 236 <td align='center'><input name='deletemeta[{$entry['meta_id']}]' type='submit' class='deletemeta' tabindex='6' value='" . __('Delete') ."' /></td> 237 237 </tr> 238 238 "; … … 257 257 258 258 function meta_form() { 259 $keys = get_meta_keys(); 259 global $wpdb, $tablepostmeta; 260 $keys = $wpdb->get_col(" 261 SELECT meta_key 262 FROM $tablepostmeta 263 GROUP BY meta_key 264 ORDER BY meta_id DESC 265 LIMIT 10"); 260 266 ?> 261 <h3><?php _e('Add new custom datato this post:') ?></h3>267 <h3><?php _e('Add a new custom field to this post:') ?></h3> 262 268 <table width="100%" cellspacing="3" cellpadding="3"> 263 269 <tr> … … 280 286 281 287 </table> 282 <p class="submit"><input type="submit" id="save" name="save" value="<?php _e('Add Custom Fields»') ?>"></p>288 <p class="submit"><input type="submit" name="updatemeta" value="<?php _e('Add Custom Field »') ?>"></p> 283 289 <?php 284 290 } … … 309 315 } // add_meta 310 316 311 function del _meta($mid) {317 function delete_meta($mid) { 312 318 global $wpdb, $tablepostmeta; 313 319 … … 315 321 } 316 322 323 function update_meta($mid, $mkey, $mvalue) { 324 global $wpdb, $tablepostmeta; 325 326 return $wpdb->query("UPDATE $tablepostmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'"); 327 } 328 317 329 ?> -
trunk/wp-admin/edit-form-advanced.php
r1195 r1197 1 1 <?php 2 $messages[1] = __('Post updated'); 3 $messages[2] = __('Custom field updated'); 4 $messages[3] = __('Custom field deleted.'); 5 ?> 6 <?php if ($_GET['message']) : ?> 7 <div class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div> 8 <?php endif; ?> 2 9 <div class="wrap"> 3 10 <?php … … 48 55 <input type="hidden" name="action" value='<?php echo $form_action ?>' /> 49 56 <?php echo $form_extra ?> 50 57 <?php if (2 > $_GET['message']) : ?> 51 58 <script type="text/javascript"> 52 59 <!-- … … 58 65 //--> 59 66 </script> 60 67 <?php endif; ?> 61 68 <div id="poststuff"> 62 69 <fieldset id="titlediv"> -
trunk/wp-admin/post.php
r1187 r1197 5 5 6 6 function add_magic_quotes($array) { 7 foreach ($array as $k => $v) {8 if (is_array($v)) {9 $array[$k] = add_magic_quotes($v);10 } else {11 $array[$k] = addslashes($v);12 }13 }14 return $array;7 foreach ($array as $k => $v) { 8 if (is_array($v)) { 9 $array[$k] = add_magic_quotes($v); 10 } else { 11 $array[$k] = addslashes($v); 12 } 13 } 14 return $array; 15 15 } 16 16 17 17 if (!get_magic_quotes_gpc()) { 18 $_GET = add_magic_quotes($_GET);19 $_POST = add_magic_quotes($_POST);20 $_COOKIE = add_magic_quotes($_COOKIE);18 $_GET = add_magic_quotes($_GET); 19 $_POST = add_magic_quotes($_POST); 20 $_COOKIE = add_magic_quotes($_COOKIE); 21 21 } 22 22 … … 24 24 25 25 for ($i=0; $i<count($wpvarstoreset); $i += 1) { 26 $wpvar = $wpvarstoreset[$i];27 if (!isset($$wpvar)) {28 if (empty($_POST["$wpvar"])) {29 if (empty($_GET["$wpvar"])) {30 $$wpvar = '';31 } else {32 $$wpvar = $_GET["$wpvar"];33 }34 } else {35 $$wpvar = $_POST["$wpvar"];36 }37 }26 $wpvar = $wpvarstoreset[$i]; 27 if (!isset($$wpvar)) { 28 if (empty($_POST["$wpvar"])) { 29 if (empty($_GET["$wpvar"])) { 30 $$wpvar = ''; 31 } else { 32 $$wpvar = $_GET["$wpvar"]; 33 } 34 } else { 35 $$wpvar = $_POST["$wpvar"]; 36 } 37 } 38 38 } 39 39 40 40 switch($action) { 41 41 42 case 'deletemeta': 43 $standalone = 1; 44 require_once('./admin-header.php'); 45 46 $post_ID = intval($_GET['post']); 47 48 $location = "post.php?action=edit&post=$post_ID"; 42 43 case 'post': 44 45 $standalone = 1; 46 require_once('admin-header.php'); 47 48 $post_pingback = intval($_POST['post_pingback']); 49 $content = balanceTags($_POST['content']); 50 $content = format_to_post($content); 51 $excerpt = balanceTags($_POST['excerpt']); 52 $excerpt = format_to_post($excerpt); 53 $post_title = addslashes($_POST['post_title']); 54 $post_categories = $_POST['post_category']; 55 if(get_settings('use_geo_positions')) { 56 $latstr = $_POST['post_latf']; 57 $lonstr = $_POST['post_lonf']; 58 if((strlen($latstr) > 2) && (strlen($lonstr) > 2 ) ) { 59 $post_latf = floatval($_POST['post_latf']); 60 $post_lonf = floatval($_POST['post_lonf']); 61 } 62 } 63 $post_status = $_POST['post_status']; 64 if (empty($post_status)) $post_status = get_settings('default_post_status'); 65 $comment_status = $_POST['comment_status']; 66 if (empty($comment_status)) $comment_status = get_settings('default_comment_status'); 67 $ping_status = $_POST['ping_status']; 68 if (empty($ping_status)) $ping_status = get_settings('default_ping_status'); 69 $post_password = addslashes(stripslashes($_POST['post_password'])); 70 $post_name = sanitize_title($post_title); 71 $trackback = $_POST['trackback_url']; 72 // Format trackbacks 73 $trackback = preg_replace('|\s+|', '\n', $trackback); 74 75 if ($user_level == 0) 76 die (__('Cheatin’ uh?')); 77 78 if (($user_level > 4) && (!empty($_POST['edit_date']))) { 79 $aa = $_POST['aa']; 80 $mm = $_POST['mm']; 81 $jj = $_POST['jj']; 82 $hh = $_POST['hh']; 83 $mn = $_POST['mn']; 84 $ss = $_POST['ss']; 85 $jj = ($jj > 31) ? 31 : $jj; 86 $hh = ($hh > 23) ? $hh - 24 : $hh; 87 $mn = ($mn > 59) ? $mn - 60 : $mn; 88 $ss = ($ss > 59) ? $ss - 60 : $ss; 89 $now = date("$aa-$mm-$jj $hh:$mn:$ss"); 90 $now_gmt = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss"); 91 } else { 92 $now = current_time('mysql'); 93 $now_gmt = current_time('mysql', 1); 94 } 95 96 if (!empty($_POST['mode'])) { 97 switch($_POST['mode']) { 98 case 'bookmarklet': 99 $location = 'bookmarklet.php?a=b'; 100 break; 101 case 'sidebar': 102 $location = 'sidebar.php?a=b'; 103 break; 104 default: 105 $location = 'post.php'; 106 break; 107 } 108 } else { 109 $location = 'post.php'; 110 } 111 112 // What to do based on which button they pressed 113 if ('' != $_POST['saveasdraft']) $post_status = 'draft'; 114 if ('' != $_POST['saveasprivate']) $post_status = 'private'; 115 if ('' != $_POST['publish']) $post_status = 'publish'; 116 if ('' != $_POST['advanced']) $post_status = 'draft'; 117 118 119 if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) { 120 $postquery ="INSERT INTO $tableposts 121 (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt) 122 VALUES 123 ('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt') 124 "; 125 } else { 126 $postquery ="INSERT INTO $tableposts 127 (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt) 128 VALUES 129 ('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt') 130 "; 131 } 132 $postquery = 133 $result = $wpdb->query($postquery); 134 135 $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1"); 136 137 if ('' != $_POST['advanced']) 138 $location = "post.php?action=edit&post=$post_ID"; 139 140 141 // Insert categories 142 // Check to make sure there is a category, if not just set it to some default 143 if (!$post_categories) $post_categories[] = 1; 144 foreach ($post_categories as $post_category) { 145 // Double check it's not there already 146 $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category"); 147 148 if (!$exists && $result) { 149 $wpdb->query(" 150 INSERT INTO $tablepost2cat 151 (post_id, category_id) 152 VALUES 153 ($post_ID, $post_category) 154 "); 155 } 156 } 157 158 add_meta($post_ID); 49 159 50 del_meta($_GET['meta_id']); 51 52 header("Location: $location"); 53 54 break; 55 56 case 'post': 57 58 $standalone = 1; 59 require_once('admin-header.php'); 60 61 $post_pingback = intval($_POST['post_pingback']); 62 $content = balanceTags($_POST['content']); 63 $content = format_to_post($content); 64 $excerpt = balanceTags($_POST['excerpt']); 65 $excerpt = format_to_post($excerpt); 66 $post_title = addslashes($_POST['post_title']); 67 $post_categories = $_POST['post_category']; 68 if(get_settings('use_geo_positions')) { 69 $latstr = $_POST['post_latf']; 70 $lonstr = $_POST['post_lonf']; 71 if((strlen($latstr) > 2) && (strlen($lonstr) > 2 ) ) { 72 $post_latf = floatval($_POST['post_latf']); 73 $post_lonf = floatval($_POST['post_lonf']); 160 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 161 sleep($sleep_after_edit); 162 } 163 164 165 header("Location: $location"); 166 167 if ($post_status == 'publish') { 168 if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) { 169 pingGeoUrl($post_ID); 170 } 171 172 if ($post_pingback) { 173 pingback($content, $post_ID); 174 } 175 176 do_action('publish_post', $post_ID); 177 178 // Time for trackbacks 179 $to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"); 180 $pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID"); 181 $pinged = explode("\n", $pinged); 182 if ('' != $to_ping) { 183 if (strlen($excerpt) > 0) { 184 $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ; 185 } else { 186 $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 187 } 188 $excerpt = stripslashes($the_excerpt); 189 $to_pings = explode("\n", $to_ping); 190 foreach ($to_pings as $tb_ping) { 191 $tb_ping = trim($tb_ping); 192 if (!in_array($tb_ping, $pinged)) { 193 trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID); 74 194 } 75 195 } 76 $post_status = $_POST['post_status']; 77 if (empty($post_status)) $post_status = get_settings('default_post_status'); 78 $comment_status = $_POST['comment_status']; 79 if (empty($comment_status)) $comment_status = get_settings('default_comment_status'); 80 $ping_status = $_POST['ping_status']; 81 if (empty($ping_status)) $ping_status = get_settings('default_ping_status'); 82 $post_password = addslashes(stripslashes($_POST['post_password'])); 83 $post_name = sanitize_title($post_title); 84 $trackback = $_POST['trackback_url']; 85 // Format trackbacks 86 $trackback = preg_replace('|\s+|', '\n', $trackback); 87 88 if ($user_level == 0) 89 die (__('Cheatin’ uh?')); 90 91 if (($user_level > 4) && (!empty($_POST['edit_date']))) { 92 $aa = $_POST['aa']; 93 $mm = $_POST['mm']; 94 $jj = $_POST['jj']; 95 $hh = $_POST['hh']; 96 $mn = $_POST['mn']; 97 $ss = $_POST['ss']; 98 $jj = ($jj > 31) ? 31 : $jj; 99 $hh = ($hh > 23) ? $hh - 24 : $hh; 100 $mn = ($mn > 59) ? $mn - 60 : $mn; 101 $ss = ($ss > 59) ? $ss - 60 : $ss; 102 $now = date("$aa-$mm-$jj $hh:$mn:$ss"); 103 $now_gmt = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss"); 104 } else { 105 $now = current_time('mysql'); 106 $now_gmt = current_time('mysql', 1); 107 } 108 109 if (!empty($_POST['mode'])) { 110 switch($_POST['mode']) { 111 case 'bookmarklet': 112 $location = 'bookmarklet.php?a=b'; 113 break; 114 case 'sidebar': 115 $location = 'sidebar.php?a=b'; 116 break; 117 default: 118 $location = 'post.php'; 119 break; 196 } 197 198 } // end if publish 199 200 exit(); 201 break; 202 203 case 'edit': 204 $title = __('Edit'); 205 206 $standalone = 0; 207 require_once('admin-header.php'); 208 209 $post = $_GET['post']; 210 if ($user_level > 0) { 211 $postdata = get_postdata($post); 212 $authordata = get_userdata($postdata['Author_ID']); 213 if ($user_level < $authordata->user_level) 214 die ('You don’t have the right to edit <strong>'.$authordata[1].'</strong>’s posts.'); 215 216 $content = $postdata['Content']; 217 $content = format_to_edit($content); 218 $edited_lat = $postdata["Lat"]; 219 $edited_lon = $postdata["Lon"]; 220 $excerpt = $postdata['Excerpt']; 221 $excerpt = format_to_edit($excerpt); 222 $edited_post_title = format_to_edit($postdata['Title']); 223 $post_status = $postdata['post_status']; 224 $comment_status = $postdata['comment_status']; 225 $ping_status = $postdata['ping_status']; 226 $post_password = $postdata['post_password']; 227 $to_ping = $postdata['to_ping']; 228 $pinged = $postdata['pinged']; 229 $post_name = $postdata['post_name']; 230 231 include('edit-form-advanced.php'); 232 $p = $_GET['post']; 233 include(ABSPATH.'wp-blog-header.php'); 234 start_wp(); 235 ?> 236 <div id='preview' class='wrap'> 237 <h2><?php _e('Post Preview (updated when post is saved)'); ?></h2> 238 <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), the_title()); ?>"><?php the_title(); ?></a></h3> 239 <div class="meta"><?php printf(__("Filed under: %s"), the_category()); ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div> 240 241 <div class="storycontent"> 242 <?php the_content(); ?> 243 </div> 244 </div> 245 <?php 246 } else { 247 ?> 248 <p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br /> 249 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br /> 250 When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_settings('admin_email')); ?> 251 </p> 252 <?php 253 } 254 break; 255 256 case 'editpost': 257 //die(var_dump('<pre>', $_POST)); 258 $standalone = 1; 259 require_once('./admin-header.php'); 260 261 if ($user_level == 0) 262 die (__('Cheatin’ uh?')); 263 264 if (!isset($blog_ID)) { 265 $blog_ID = 1; 266 } 267 $post_ID = $_POST['post_ID']; 268 $post_categories = $_POST['post_category']; 269 if (!$post_categories) $post_categories[] = 1; 270 $post_autobr = intval($_POST['post_autobr']); 271 $content = balanceTags($_POST['content']); 272 $content = format_to_post($content); 273 $excerpt = balanceTags($_POST['excerpt']); 274 $excerpt = format_to_post($excerpt); 275 $post_title = addslashes($_POST['post_title']); 276 if(get_settings('use_geo_positions')) { 277 $latf = floatval($_POST["post_latf"]); 278 $lonf = floatval($_POST["post_lonf"]); 279 $latlonaddition = ""; 280 if( ($latf != null) && ($latf <= 90 ) && ($latf >= -90) && ($lonf != null) && ($lonf <= 360) && ($lonf >= -360) ) { 281 pingGeoUrl($post_ID); 282 $latlonaddition = " post_lat=".$latf.", post_lon =".$lonf.", "; 283 } else { 284 $latlonaddition = " post_lat=null, post_lon=null, "; 120 285 } 121 } else { 122 $location = 'post.php'; 123 } 124 125 // What to do based on which button they pressed 126 if ('' != $_POST['saveasdraft']) $post_status = 'draft'; 127 if ('' != $_POST['saveasprivate']) $post_status = 'private'; 128 if ('' != $_POST['publish']) $post_status = 'publish'; 129 if ('' != $_POST['advanced']) $post_status = 'draft'; 130 131 132 if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) { 133 $postquery ="INSERT INTO $tableposts 134 (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt) 135 VALUES 136 ('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt') 137 "; 138 } else { 139 $postquery ="INSERT INTO $tableposts 140 (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt) 141 VALUES 142 ('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt') 143 "; 144 } 145 $postquery = 146 $result = $wpdb->query($postquery); 147 148 $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1"); 149 150 if ('' != $_POST['advanced']) 151 $location = "post.php?action=edit&post=$post_ID"; 152 153 154 // Insert categories 155 // Check to make sure there is a category, if not just set it to some default 156 if (!$post_categories) $post_categories[] = 1; 157 foreach ($post_categories as $post_category) { 158 // Double check it's not there already 159 $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category"); 160 161 if (!$exists && $result) { 162 $wpdb->query(" 163 INSERT INTO $tablepost2cat 164 (post_id, category_id) 165 VALUES 166 ($post_ID, $post_category) 167 "); 286 } 287 $prev_status = $_POST['prev_status']; 288 $post_status = $_POST['post_status']; 289 $comment_status = $_POST['comment_status']; 290 if (empty($comment_status)) $comment_status = get_settings('default_comment_status'); 291 $ping_status = $_POST['ping_status']; 292 if (empty($ping_status)) $ping_status = get_settings('default_ping_status'); 293 $post_password = addslashes($_POST['post_password']); 294 $post_name = sanitize_title($_POST['post_name']); 295 if (empty($post_name)) $post_name = sanitize_title($post_title); 296 $trackback = $_POST['trackback_url']; 297 // Format trackbacks 298 $trackback = preg_replace('|\s+|', '\n', $trackback); 299 300 if ('' != $_POST['publish']) $post_status = 'publish'; 301 302 if (($user_level > 4) && (!empty($_POST['edit_date']))) { 303 $aa = $_POST['aa']; 304 $mm = $_POST['mm']; 305 $jj = $_POST['jj']; 306 $hh = $_POST['hh']; 307 $mn = $_POST['mn']; 308 $ss = $_POST['ss']; 309 $jj = ($jj > 31) ? 31 : $jj; 310 $hh = ($hh > 23) ? $hh - 24 : $hh; 311 $mn = ($mn > 59) ? $mn - 60 : $mn; 312 $ss = ($ss > 59) ? $ss - 60 : $ss; 313 $datemodif = ", post_date = '$aa-$mm-$jj $hh:$mn:$ss'"; 314 $datemodif_gmt = ", post_date = '".get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss")."'"; 315 } else { 316 $datemodif = ''; 317 $datemodif_gmt = ''; 318 } 319 320 $now = current_time('mysql'); 321 $now_gmt = current_time('mysql', 1); 322 323 $result = $wpdb->query(" 324 UPDATE $tableposts SET 325 post_content = '$content', 326 post_excerpt = '$excerpt', 327 post_title = '$post_title'" 328 .$datemodif."," 329 .$latlonaddition." 330 post_status = '$post_status', 331 comment_status = '$comment_status', 332 ping_status = '$ping_status', 333 post_password = '$post_password', 334 post_name = '$post_name', 335 to_ping = '$trackback', 336 post_modified = '$now', 337 post_modified_gmt = '$now_gmt' 338 WHERE ID = $post_ID "); 339 340 341 // Now it's category time! 342 // First the old categories 343 $old_categories = $wpdb->get_col("SELECT category_id FROM $tablepost2cat WHERE post_id = $post_ID"); 344 345 // Delete any? 346 foreach ($old_categories as $old_cat) { 347 if (!in_array($old_cat, $post_categories)) // If a category was there before but isn't now 348 $wpdb->query("DELETE FROM $tablepost2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1"); 349 } 350 351 // Add any? 352 foreach ($post_categories as $new_cat) { 353 if (!in_array($new_cat, $old_categories)) 354 $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_ID, $new_cat)"); 355 } 356 357 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 358 sleep($sleep_after_edit); 359 } 360 361 // are we going from draft/private to published? 362 if ((($prev_status == 'draft') || ($prev_status == 'private')) && ($post_status == 'publish')) { 363 } // end if moving from draft/private to published 364 if ($post_status == 'publish') { 365 do_action('publish_post', $post_ID); 366 // Trackback time. 367 $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID")); 368 $pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID")); 369 $pinged = explode("\n", $pinged); 370 if ('' != $to_ping) { 371 if (strlen($excerpt) > 0) { 372 $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ; 373 } else { 374 $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 168 375 } 169 } 170 171 add_meta($post_ID); 172 173 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 174 sleep($sleep_after_edit); 175 } 176 177 178 header("Location: $location"); 179 180 if ($post_status == 'publish') { 181 if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) { 182 pingGeoUrl($post_ID); 183 } 184 185 if ($post_pingback) { 186 pingback($content, $post_ID); 187 } 188 189 do_action('publish_post', $post_ID); 190 191 // Time for trackbacks 192 $to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"); 193 $pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID"); 194 $pinged = explode("\n", $pinged); 195 if ('' != $to_ping) { 196 if (strlen($excerpt) > 0) { 197 $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ; 198 } else { 199 $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 200 } 201 $excerpt = stripslashes($the_excerpt); 202 $to_pings = explode("\n", $to_ping); 203 foreach ($to_pings as $tb_ping) { 204 $tb_ping = trim($tb_ping); 205 if (!in_array($tb_ping, $pinged)) { 206 trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID); 207 } 376 $excerpt = stripslashes($the_excerpt); 377 $to_pings = explode("\n", $to_ping); 378 foreach ($to_pings as $tb_ping) { 379 $tb_ping = trim($tb_ping); 380 if (!in_array($tb_ping, $pinged)) { 381 trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID); 208 382 } 209 383 } 210 211 } // end if publish 212 213 exit(); 214 break; 215 216 case 'edit': 217 $title = __('Edit'); 218 219 $standalone = 0; 220 require_once('admin-header.php'); 221 222 $post = $_GET['post']; 223 if ($user_level > 0) { 224 $postdata = get_postdata($post); 225 $authordata = get_userdata($postdata['Author_ID']); 226 if ($user_level < $authordata->user_level) 227 die ('You don’t have the right to edit <strong>'.$authordata[1].'</strong>’s posts.'); 228 229 $content = $postdata['Content']; 230 $content = format_to_edit($content); 231 $edited_lat = $postdata["Lat"]; 232 $edited_lon = $postdata["Lon"]; 233 $excerpt = $postdata['Excerpt']; 234 $excerpt = format_to_edit($excerpt); 235 $edited_post_title = format_to_edit($postdata['Title']); 236 $post_status = $postdata['post_status']; 237 $comment_status = $postdata['comment_status']; 238 $ping_status = $postdata['ping_status']; 239 $post_password = $postdata['post_password']; 240 $to_ping = $postdata['to_ping']; 241 $pinged = $postdata['pinged']; 242 $post_name = $postdata['post_name']; 243 244 include('edit-form-advanced.php'); 245 $p = $_GET['post']; 246 include(ABSPATH.'wp-blog-header.php'); 247 start_wp(); 248 ?> 249 <div id='preview' class='wrap'> 250 <h2><?php _e('Post Preview (updated when post is saved)'); ?></h2> 251 <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), the_title()); ?>"><?php the_title(); ?></a></h3> 252 <div class="meta"><?php printf(__("Filed under: %s"), the_category()); ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div> 384 } 385 } // end if publish 386 387 // Meta Stuff 388 if ($_POST['meta']) : 389 foreach ($_POST['meta'] as $key => $value) : 390 update_meta($key, $value['key'], $value['value']); 391 endforeach; 392 endif; 393 394 if ($_POST['deletemeta']) : 395 foreach ($_POST['deletemeta'] as $key => $value) : 396 delete_meta($key); 397 endforeach; 398 endif; 399 400 add_meta($post_ID); 401 402 if ($_POST['save']) { 403 $location = $_SERVER['HTTP_REFERER']; 404 } elseif ($_POST['updatemeta']) { 405 $location = $_SERVER['HTTP_REFERER'] . '&message=2#postcustom'; 406 } elseif ($_POST['deletemeta']) { 407 $location = $_SERVER['HTTP_REFERER'] . '&message=3#postcustom'; 408 } else { 409 $location = 'post.php'; 410 } 411 header ('Location: ' . $location); 412 do_action('edit_post', $post_ID); 413 break; 414 415 case 'delete': 416 417 $standalone = 1; 418 require_once('./admin-header.php'); 419 420 if ($user_level == 0) 421 die ('Cheatin’ uh?'); 422 423 $post_id = intval($_GET['post']); 424 $postdata = get_postdata($post_id) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'post.php')); 425 $authordata = get_userdata($postdata['Author_ID']); 426 427 if ($user_level < $authordata->user_level) 428 die (sprintf(__('You don’t have the right to delete <strong>%s</strong>’s posts.'), $authordata[1])); 429 430 // send geoURL ping to "erase" from their DB 431 $query = "SELECT post_lat from $tableposts WHERE ID=$post_id"; 432 $rows = $wpdb->query($query); 433 $myrow = $rows[0]; 434 $latf = $myrow->post_lat; 435 if($latf != null ) { 436 pingGeoUrl($post); 437 } 438 439 $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post_id"); 440 if (!$result) 441 die(__('Error in deleting...')); 442 443 $result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID=$post_id"); 444 445 $categories = $wpdb->query("DELETE FROM $tablepost2cat WHERE post_id = $post_id"); 446 447 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 448 sleep($sleep_after_edit); 449 } 450 451 $sendback = $_SERVER['HTTP_REFERER']; 452 if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post.php'; 453 header ('Location: ' . $sendback); 454 do_action('delete_post', $post_ID); 455 break; 456 457 case 'editcomment': 458 $title = __('Edit Comment'); 459 $standalone = 0; 460 $parent_file = 'edit.php'; 461 require_once ('admin-header.php'); 462 463 get_currentuserinfo(); 464 465 if ($user_level == 0) { 466 die (__('Cheatin’ uh?')); 467 } 468 469 $comment = $_GET['comment']; 470 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 471 $content = $commentdata['comment_content']; 472 $content = format_to_edit($content); 473 474 include('edit-form-comment.php'); 475 476 break; 477 478 case 'confirmdeletecomment': 479 480 $standalone = 0; 481 require_once('./admin-header.php'); 482 483 if ($user_level == 0) 484 die (__('Cheatin’ uh?')); 485 486 $comment = $_GET['comment']; 487 $p = $_GET['p']; 488 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 489 490 echo "<div class=\"wrap\">\n"; 491 echo "<p><?php __('<strong>Caution:</strong> You are about to delete the following comment:'); ?></p>\n"; 492 echo "<table border=\"0\">\n"; 493 echo "<tr><td>" . __('Author:') . "</td><td>" . $commentdata["comment_author"] . "</td></tr>\n"; 494 echo "<tr><td>" . __('E-Mail:') . "</td><td>" . $commentdata["comment_author_email"] . "</td></tr>\n"; 495 echo "<tr><td>". __('URL:') . "</td><td>" . $commentdata["comment_author_url"] . "</td></tr>\n"; 496 echo "<tr><td>". __('Comment:') . "</td><td>" . stripslashes($commentdata["comment_content"]) . "</td></tr>\n"; 497 echo "</table>\n"; 498 echo "<p>" . __('Are you sure you want to do that?') . "</p>\n"; 499 500 echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n"; 501 echo "<input type=\"hidden\" name=\"action\" value=\"deletecomment\" />\n"; 502 echo "<input type=\"hidden\" name=\"p\" value=\"$p\" />\n"; 503 echo "<input type=\"hidden\" name=\"comment\" value=\"$comment\" />\n"; 504 echo "<input type=\"hidden\" name=\"noredir\" value=\"1\" />\n"; 505 echo "<input type=\"submit\" value=\"" . __('Yes') . "\" />"; 506 echo " "; 507 echo "<input type=\"button\" value=\"" . __('No') . "\" onClick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments';\" />\n"; 508 echo "</form>\n"; 509 echo "</div>\n"; 510 511 break; 512 513 case 'deletecomment': 514 515 $standalone = 1; 516 require_once('./admin-header.php'); 517 518 if ($user_level == 0) 519 die (__('Cheatin’ uh?')); 520 521 522 $comment = $_GET['comment']; 523 $p = $_GET['p']; 524 if (isset($_GET['noredir'])) { 525 $noredir = true; 526 } else { 527 $noredir = false; 528 } 529 530 $postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 531 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 532 533 $authordata = get_userdata($postdata['Author_ID']); 534 if ($user_level < $authordata->user_level) 535 die (sprintf(__('You don’t have the right to delete <strong>%1$s</strong>’s post comments. <a href="%2$s">Go back</a>!'), $authordata->user_nickname, 'post.php')); 536 537 wp_set_comment_status($comment, "delete"); 538 do_action('delete_comment', $comment); 539 540 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 541 header('Location: ' . $_SERVER['HTTP_REFERER']); 542 } else { 543 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 544 } 545 546 break; 547 548 case 'unapprovecomment': 549 550 $standalone = 1; 551 require_once('./admin-header.php'); 552 553 if ($user_level == 0) 554 die (__('Cheatin’ uh?')); 253 555 254 <div class="storycontent"> 255 <?php the_content(); ?> 256 </div> 257 </div> 258 <?php 259 } else { 260 ?> 261 <p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br /> 262 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br /> 263 When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_settings('admin_email')); ?> 264 </p> 265 <?php 266 } 267 break; 268 269 case 'editpost': 270 271 $standalone = 1; 272 require_once('./admin-header.php'); 273 274 if ($user_level == 0) 275 die (__('Cheatin’ uh?')); 276 277 if (!isset($blog_ID)) { 278 $blog_ID = 1; 279 } 280 $post_ID = $_POST['post_ID']; 281 $post_categories = $_POST['post_category']; 282 if (!$post_categories) $post_categories[] = 1; 283 $post_autobr = intval($_POST['post_autobr']); 284 $content = balanceTags($_POST['content']); 285 $content = format_to_post($content); 286 $excerpt = balanceTags($_POST['excerpt']); 287 $excerpt = format_to_post($excerpt); 288 $post_title = addslashes($_POST['post_title']); 289 if(get_settings('use_geo_positions')) { 290 $latf = floatval($_POST["post_latf"]); 291 $lonf = floatval($_POST["post_lonf"]); 292 $latlonaddition = ""; 293 if( ($latf != null) && ($latf <= 90 ) && ($latf >= -90) && ($lonf != null) && ($lonf <= 360) && ($lonf >= -360) ) { 294 pingGeoUrl($post_ID); 295 $latlonaddition = " post_lat=".$latf.", post_lon =".$lonf.", "; 296 } else { 297 $latlonaddition = " post_lat=null, post_lon=null, "; 298 } 299 } 300 $prev_status = $_POST['prev_status']; 301 $post_status = $_POST['post_status']; 302 $comment_status = $_POST['comment_status']; 303 if (empty($comment_status)) $comment_status = get_settings('default_comment_status'); 304 $ping_status = $_POST['ping_status']; 305 if (empty($ping_status)) $ping_status = get_settings('default_ping_status'); 306 $post_password = addslashes($_POST['post_password']); 307 $post_name = sanitize_title($_POST['post_name']); 308 if (empty($post_name)) $post_name = sanitize_title($post_title); 309 $trackback = $_POST['trackback_url']; 310 // Format trackbacks 311 $trackback = preg_replace('|\s+|', '\n', $trackback); 312 313 if ('' != $_POST['publish']) $post_status = 'publish'; 314 315 if (($user_level > 4) && (!empty($_POST['edit_date']))) { 316 $aa = $_POST['aa']; 317 $mm = $_POST['mm']; 318 $jj = $_POST['jj']; 319 $hh = $_POST['hh']; 320 $mn = $_POST['mn']; 321 $ss = $_POST['ss']; 322 $jj = ($jj > 31) ? 31 : $jj; 323 $hh = ($hh > 23) ? $hh - 24 : $hh; 324 $mn = ($mn > 59) ? $mn - 60 : $mn; 325 $ss = ($ss > 59) ? $ss - 60 : $ss; 326 $datemodif = ", post_date = '$aa-$mm-$jj $hh:$mn:$ss'"; 327 $datemodif_gmt = ", post_date = '".get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss")."'"; 328 } else { 329 $datemodif = ''; 330 $datemodif_gmt = ''; 331 } 556 $comment = $_GET['comment']; 557 $p = $_GET['p']; 558 if (isset($_GET['noredir'])) { 559 $noredir = true; 560 } else { 561 $noredir = false; 562 } 563 564 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 565 566 wp_set_comment_status($comment, "hold"); 567 568 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 569 header('Location: ' . $_SERVER['HTTP_REFERER']); 570 } else { 571 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 572 } 573 574 break; 575 576 case 'mailapprovecomment': 577 578 $standalone = 0; 579 require_once('./admin-header.php'); 580 581 if ($user_level == 0) 582 die (__('Cheatin’ uh?')); 583 584 $comment = $_GET['comment']; 585 $p = $_GET['p']; 586 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 587 588 wp_set_comment_status($comment, "approve"); 589 if (get_settings("comments_notify") == true) { 590 wp_notify_postauthor($comment); 591 } 592 593 echo "<div class=\"wrap\">\n"; 594 echo "<p>" . __('Comment has been approved.') . "</p>\n"; 595 596 echo "<form action=\"". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments\" method=\"get\">\n"; 597 echo "<input type=\"hidden\" name=\"p\" value=\"$p\" />\n"; 598 echo "<input type=\"hidden\" name=\"c\" value=\"1\" />\n"; 599 echo "<input type=\"submit\" value=\"" . __('Ok') . "\" />"; 600 echo "</form>\n"; 601 echo "</div>\n"; 602 603 break; 604 605 case 'approvecomment': 606 607 $standalone = 1; 608 require_once('./admin-header.php'); 609 610 if ($user_level == 0) 611 die (__('Cheatin’ uh?')); 332 612 333 $now = current_time('mysql'); 334 $now_gmt = current_time('mysql', 1); 335 336 $result = $wpdb->query(" 337 UPDATE $tableposts SET 338 post_content = '$content', 339 post_excerpt = '$excerpt', 340 post_title = '$post_title'" 341 .$datemodif."," 342 .$latlonaddition." 343 post_status = '$post_status', 344 comment_status = '$comment_status', 345 ping_status = '$ping_status', 346 post_password = '$post_password', 347 post_name = '$post_name', 348 to_ping = '$trackback', 349 post_modified = '$now', 350 post_modified_gmt = '$now_gmt' 351 WHERE ID = $post_ID "); 352 353 354 // Now it's category time! 355 // First the old categories 356 $old_categories = $wpdb->get_col("SELECT category_id FROM $tablepost2cat WHERE post_id = $post_ID"); 357 358 // Delete any? 359 foreach ($old_categories as $old_cat) { 360 if (!in_array($old_cat, $post_categories)) // If a category was there before but isn't now 361 $wpdb->query("DELETE FROM $tablepost2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1"); 362 } 363 364 // Add any? 365 foreach ($post_categories as $new_cat) { 366 if (!in_array($new_cat, $old_categories)) 367 $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_ID, $new_cat)"); 368 } 369 370 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 371 sleep($sleep_after_edit); 372 } 373 374 // are we going from draft/private to published? 375 if ((($prev_status == 'draft') || ($prev_status == 'private')) && ($post_status == 'publish')) { 376 } // end if moving from draft/private to published 377 if ($post_status == 'publish') { 378 do_action('publish_post', $post_ID); 379 // Trackback time. 380 $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID")); 381 $pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID")); 382 $pinged = explode("\n", $pinged); 383 if ('' != $to_ping) { 384 if (strlen($excerpt) > 0) { 385 $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ; 386 } else { 387 $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 388 } 389 $excerpt = stripslashes($the_excerpt); 390 $to_pings = explode("\n", $to_ping); 391 foreach ($to_pings as $tb_ping) { 392 $tb_ping = trim($tb_ping); 393 if (!in_array($tb_ping, $pinged)) { 394 trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID); 395 } 396 } 397 } 398 } // end if publish 399 400 add_meta($post_ID); 401 402 if ($_POST['save']) { 403 $location = $_SERVER['HTTP_REFERER']; 404 } else { 405 $location = 'post.php'; 406 } 407 header ('Location: ' . $location); 408 do_action('edit_post', $post_ID); 409 break; 410 411 case 'delete': 412 413 $standalone = 1; 414 require_once('./admin-header.php'); 415 416 if ($user_level == 0) 417 die ('Cheatin’ uh?'); 418 419 $post_id = intval($_GET['post']); 420 $postdata = get_postdata($post_id) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'post.php')); 421 $authordata = get_userdata($postdata['Author_ID']); 422 423 if ($user_level < $authordata->user_level) 424 die (sprintf(__('You don’t have the right to delete <strong>%s</strong>’s posts.'), $authordata[1])); 425 426 // send geoURL ping to "erase" from their DB 427 $query = "SELECT post_lat from $tableposts WHERE ID=$post_id"; 428 $rows = $wpdb->query($query); 429 $myrow = $rows[0]; 430 $latf = $myrow->post_lat; 431 if($latf != null ) { 432 pingGeoUrl($post); 433 } 434 435 $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post_id"); 436 if (!$result) 437 die(__('Error in deleting...')); 438 439 $result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID=$post_id"); 440 441 $categories = $wpdb->query("DELETE FROM $tablepost2cat WHERE post_id = $post_id"); 442 443 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { 444 sleep($sleep_after_edit); 445 } 446 447 $sendback = $_SERVER['HTTP_REFERER']; 448 if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post.php'; 449 header ('Location: ' . $sendback); 450 do_action('delete_post', $post_ID); 451 break; 452 453 case 'editcomment': 454 $title = __('Edit Comment'); 455 $standalone = 0; 456 $parent_file = 'edit.php'; 457 require_once ('admin-header.php'); 458 459 get_currentuserinfo(); 460 461 if ($user_level == 0) { 462 die (__('Cheatin’ uh?')); 463 } 464 465 $comment = $_GET['comment']; 466 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 467 $content = $commentdata['comment_content']; 468 $content = format_to_edit($content); 469 470 include('edit-form-comment.php'); 471 472 break; 473 474 case 'confirmdeletecomment': 475 476 $standalone = 0; 613 $comment = $_GET['comment']; 614 $p = $_GET['p']; 615 if (isset($_GET['noredir'])) { 616 $noredir = true; 617 } else { 618 $noredir = false; 619 } 620 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 621 622 wp_set_comment_status($comment, "approve"); 623 if (get_settings("comments_notify") == true) { 624 wp_notify_postauthor($comment); 625 } 626 627 628 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 629 header('Location: ' . $_SERVER['HTTP_REFERER']); 630 } else { 631 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 632 } 633 634 break; 635 636 case 'editedcomment': 637 638 $standalone = 1; 477 639 require_once('./admin-header.php'); 478 640 479 641 if ($user_level == 0) 480 642 die (__('Cheatin’ uh?')); 481 482 $comment = $_GET['comment']; 483 $p = $_GET['p']; 484 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 485 486 echo "<div class=\"wrap\">\n"; 487 echo "<p><?php __('<strong>Caution:</strong> You are about to delete the following comment:'); ?></p>\n"; 488 echo "<table border=\"0\">\n"; 489 echo "<tr><td>" . __('Author:') . "</td><td>" . $commentdata["comment_author"] . "</td></tr>\n"; 490 echo "<tr><td>" . __('E-Mail:') . "</td><td>" . $commentdata["comment_author_email"] . "</td></tr>\n"; 491 echo "<tr><td>". __('URL:') . "</td><td>" . $commentdata["comment_author_url"] . "</td></tr>\n"; 492 echo "<tr><td>". __('Comment:') . "</td><td>" . stripslashes($commentdata["comment_content"]) . "</td></tr>\n"; 493 echo "</table>\n"; 494 echo "<p>" . __('Are you sure you want to do that?') . "</p>\n"; 495 496 echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n"; 497 echo "<input type=\"hidden\" name=\"action\" value=\"deletecomment\" />\n"; 498 echo "<input type=\"hidden\" name=\"p\" value=\"$p\" />\n"; 499 echo "<input type=\"hidden\" name=\"comment\" value=\"$comment\" />\n"; 500 echo "<input type=\"hidden\" name=\"noredir\" value=\"1\" />\n"; 501 echo "<input type=\"submit\" value=\"" . __('Yes') . "\" />"; 502 echo " "; 503 echo "<input type=\"button\" value=\"" . __('No') . "\" onClick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments';\" />\n"; 504 echo "</form>\n"; 505 echo "</div>\n"; 506 643 644 $comment_ID = $_POST['comment_ID']; 645 $comment_post_ID = $_POST['comment_post_ID']; 646 $newcomment_author = $_POST['newcomment_author']; 647 $newcomment_author_email = $_POST['newcomment_author_email']; 648 $newcomment_author_url = $_POST['newcomment_author_url']; 649 $newcomment_author = addslashes($newcomment_author); 650 $newcomment_author_email = addslashes($newcomment_author_email); 651 $newcomment_author_url = addslashes($newcomment_author_url); 652 653 if (($user_level > 4) && (!empty($_POST['edit_date']))) { 654 $aa = $_POST['aa']; 655 $mm = $_POST['mm']; 656 $jj = $_POST['jj']; 657 $hh = $_POST['hh']; 658 $mn = $_POST['mn']; 659 $ss = $_POST['ss']; 660 $jj = ($jj > 31) ? 31 : $jj; 661 $hh = ($hh > 23) ? $hh - 24 : $hh; 662 $mn = ($mn > 59) ? $mn - 60 : $mn; 663 $ss = ($ss > 59) ? $ss - 60 : $ss; 664 $datemodif = ", comment_date = '$aa-$mm-$jj $hh:$mn:$ss'"; 665 } else { 666 $datemodif = ''; 667 } 668 $content = balanceTags($content); 669 $content = format_to_post($content); 670 671 $result = $wpdb->query(" 672 UPDATE $tablecomments SET 673 comment_content = '$content', 674 comment_author = '$newcomment_author', 675 comment_author_email = '$newcomment_author_email', 676 comment_author_url = '$newcomment_author_url'".$datemodif." 677 WHERE comment_ID = $comment_ID" 678 ); 679 680 $referredby = $_POST['referredby']; 681 if (!empty($referredby)) header('Location: ' . $referredby); 682 else header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 683 do_action('edit_comment', $comment_ID); 507 684 break; 508 685 509 case 'deletecomment': 510 511 $standalone = 1; 512 require_once('./admin-header.php'); 513 514 if ($user_level == 0) 515 die (__('Cheatin’ uh?')); 516 517 518 $comment = $_GET['comment']; 519 $p = $_GET['p']; 520 if (isset($_GET['noredir'])) { 521 $noredir = true; 522 } else { 523 $noredir = false; 524 } 525 526 $postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 527 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 528 529 $authordata = get_userdata($postdata['Author_ID']); 530 if ($user_level < $authordata->user_level) 531 die (sprintf(__('You don’t have the right to delete <strong>%1$s</strong>’s post comments. <a href="%2$s">Go back</a>!'), $authordata->user_nickname, 'post.php')); 532 533 wp_set_comment_status($comment, "delete"); 534 do_action('delete_comment', $comment); 535 536 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 537 header('Location: ' . $_SERVER['HTTP_REFERER']); 538 } else { 539 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 540 } 541 542 break; 543 544 case 'unapprovecomment': 545 546 $standalone = 1; 547 require_once('./admin-header.php'); 548 549 if ($user_level == 0) 550 die (__('Cheatin’ uh?')); 551 552 $comment = $_GET['comment']; 553 $p = $_GET['p']; 554 if (isset($_GET['noredir'])) { 555 $noredir = true; 556 } else { 557 $noredir = false; 558 } 559 560 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 561 562 wp_set_comment_status($comment, "hold"); 563 564 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 565 header('Location: ' . $_SERVER['HTTP_REFERER']); 566 } else { 567 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 568 } 569 570 break; 571 572 case 'mailapprovecomment': 573 686 default: 574 687 $standalone = 0; 575 require_once('./admin-header.php'); 576 577 if ($user_level == 0) 578 die (__('Cheatin’ uh?')); 579 580 $comment = $_GET['comment']; 581 $p = $_GET['p']; 582 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 583 584 wp_set_comment_status($comment, "approve"); 585 if (get_settings("comments_notify") == true) { 586 wp_notify_postauthor($comment); 587 } 588 589 echo "<div class=\"wrap\">\n"; 590 echo "<p>" . __('Comment has been approved.') . "</p>\n"; 591 592 echo "<form action=\"". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments\" method=\"get\">\n"; 593 echo "<input type=\"hidden\" name=\"p\" value=\"$p\" />\n"; 594 echo "<input type=\"hidden\" name=\"c\" value=\"1\" />\n"; 595 echo "<input type=\"submit\" value=\"" . __('Ok') . "\" />"; 596 echo "</form>\n"; 597 echo "</div>\n"; 598 599 break; 600 601 case 'approvecomment': 602 603 $standalone = 1; 604 require_once('./admin-header.php'); 605 606 if ($user_level == 0) 607 die (__('Cheatin’ uh?')); 608 609 $comment = $_GET['comment']; 610 $p = $_GET['p']; 611 if (isset($_GET['noredir'])) { 612 $noredir = true; 613 } else { 614 $noredir = false; 615 } 616 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 617 618 wp_set_comment_status($comment, "approve"); 619 if (get_settings("comments_notify") == true) { 620 wp_notify_postauthor($comment); 621 } 622 623 624 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 625 header('Location: ' . $_SERVER['HTTP_REFERER']); 626 } else { 627 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 628 } 629 630 break; 631 632 case 'editedcomment': 633 634 $standalone = 1; 635 require_once('./admin-header.php'); 636 637 if ($user_level == 0) 638 die (__('Cheatin’ uh?')); 639 640 $comment_ID = $_POST['comment_ID']; 641 $comment_post_ID = $_POST['comment_post_ID']; 642 $newcomment_author = $_POST['newcomment_author']; 643 $newcomment_author_email = $_POST['newcomment_author_email']; 644 $newcomment_author_url = $_POST['newcomment_author_url']; 645 $newcomment_author = addslashes($newcomment_author); 646 $newcomment_author_email = addslashes($newcomment_author_email); 647 $newcomment_author_url = addslashes($newcomment_author_url); 648 649 if (($user_level > 4) && (!empty($_POST['edit_date']))) { 650 $aa = $_POST['aa']; 651 $mm = $_POST['mm']; 652 $jj = $_POST['jj']; 653 $hh = $_POST['hh']; 654 $mn = $_POST['mn']; 655 $ss = $_POST['ss']; 656 $jj = ($jj > 31) ? 31 : $jj; 657 $hh = ($hh > 23) ? $hh - 24 : $hh; 658 $mn = ($mn > 59) ? $mn - 60 : $mn; 659 $ss = ($ss > 59) ? $ss - 60 : $ss; 660 $datemodif = ", comment_date = '$aa-$mm-$jj $hh:$mn:$ss'"; 661 } else { 662 $datemodif = ''; 663 } 664 $content = balanceTags($content); 665 $content = format_to_post($content); 666 667 $result = $wpdb->query(" 668 UPDATE $tablecomments SET 669 comment_content = '$content', 670 comment_author = '$newcomment_author', 671 comment_author_email = '$newcomment_author_email', 672 comment_author_url = '$newcomment_author_url'".$datemodif." 673 WHERE comment_ID = $comment_ID" 674 ); 675 676 $referredby = $_POST['referredby']; 677 if (!empty($referredby)) header('Location: ' . $referredby); 678 else header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 679 do_action('edit_comment', $comment_ID); 680 break; 681 682 default: 683 $standalone = 0; 684 $title = __('Create New Post'); 685 require_once ('./admin-header.php'); 686 687 if ($user_level > 0) { 688 if ((!$withcomments) && (!$single)) { 689 690 $action = 'post'; 691 get_currentuserinfo(); 692 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID"); 693 if ($drafts) { 694 ?> 695 <div class="wrap"> 696 <p><strong><?php _e('Your Drafts:') ?></strong> 697 <?php 698 $i = 0; 699 foreach ($drafts as $draft) { 700 if (0 != $i) 701 echo ', '; 702 $draft->post_title = stripslashes($draft->post_title); 703 if ($draft->post_title == '') 704 $draft->post_title = sprintf(__('Post # %s'), $draft->ID); 705 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 706 ++$i; 707 } 708 ?>.</p> 709 </div> 710 <?php 711 } 712 //set defaults 713 $post_status = get_settings('default_post_status'); 714 $comment_status = get_settings('default_comment_status'); 715 $ping_status = get_settings('default_ping_status'); 716 $post_pingback = get_settings('default_pingback_flag'); 717 $default_post_cat = get_settings('default_post_category'); 718 719 if (get_settings('advanced_edit')) { 720 include('edit-form-advanced.php'); 721 } else { 722 include('edit-form.php'); 723 } 724 } 688 $title = __('Create New Post'); 689 require_once ('./admin-header.php'); 690 691 if ($user_level > 0) { 692 if ((!$withcomments) && (!$single)) { 693 694 $action = 'post'; 695 get_currentuserinfo(); 696 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID"); 697 if ($drafts) { 698 ?> 699 <div class="wrap"> 700 <p><strong><?php _e('Your Drafts:') ?></strong> 701 <?php 702 $i = 0; 703 foreach ($drafts as $draft) { 704 if (0 != $i) 705 echo ', '; 706 $draft->post_title = stripslashes($draft->post_title); 707 if ($draft->post_title == '') 708 $draft->post_title = sprintf(__('Post # %s'), $draft->ID); 709 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 710 ++$i; 711 } 712 ?>.</p> 713 </div> 714 <?php 715 } 716 //set defaults 717 $post_status = get_settings('default_post_status'); 718 $comment_status = get_settings('default_comment_status'); 719 $ping_status = get_settings('default_ping_status'); 720 $post_pingback = get_settings('default_pingback_flag'); 721 $default_post_cat = get_settings('default_post_category'); 722 723 if (get_settings('advanced_edit')) { 724 include('edit-form-advanced.php'); 725 } else { 726 include('edit-form.php'); 727 } 728 } 725 729 ?> 726 730 <div class="wrap"> … … 734 738 if ($is_NS4 || $is_gecko) { 735 739 ?> 736 <a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}void(window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'<?php _e('WordPress bookmarklet') ?>','scrollbars=yes,width=600,height=460,left=100,top=150,status=yes'));"><?php printf(__('Press It - %s'), get_settings('blogname')); ?></a>737 <?php740 <a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}void(window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'<?php _e('WordPress bookmarklet') ?>','scrollbars=yes,width=600,height=460,left=100,top=150,status=yes'));"><?php printf(__('Press It - %s'), get_settings('blogname')); ?></a> 741 <?php 738 742 } else if ($is_winIE) { 739 743 ?> 740 <a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>741 <script type="text/javascript" language="JavaScript">744 <a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a> 745 <script type="text/javascript" language="JavaScript"> 742 746 <!-- 743 747 function oneclickbookmarklet(blah) { 744 window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");748 window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120"); 745 749 } 746 750 // --> 747 751 </script> 748 <br />749 <br />750 One-click bookmarklet:<br />751 <a href="javascript:oneclickbookmarklet(0);">click here</a>752 <?php752 <br /> 753 <br /> 754 One-click bookmarklet:<br /> 755 <a href="javascript:oneclickbookmarklet(0);">click here</a> 756 <?php 753 757 } else if ($is_opera) { 754 758 ?> 755 <a href="javascript:void(window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>756 <?php759 <a href="javascript:void(window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a> 760 <?php 757 761 } else if ($is_macIE) { 758 762 ?> 759 <a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>760 <?php763 <a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a> 764 <?php 761 765 } 762 766 ?> … … 764 768 </div> 765 769 <?php 766 } else {770 } else { 767 771 768 772 769 773 ?> 770 774 <div class="wrap"> 771 <?php printf(__('<p>Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post blog items.<br />775 <?php printf(__('<p>Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post blog items.<br /> 772 776 You can also <a href="mailto:%s?subject=Blog posting permission">e-mail the admin</a> to ask for a promotion.<br /> 773 777 When you’re promoted, just reload this page and you’ll be able to blog. :)</p>'), get_settings('admin_email')); ?> … … 775 779 <?php 776 780 777 }778 779 break;781 } 782 783 break; 780 784 } // end switch 781 785 /* </Edit> */ -
trunk/wp-admin/wp-admin.css
r1195 r1197 354 354 } 355 355 356 #postcustom #updatemeta, #postcustom #deletemeta {356 #postcustom .updatemeta, #postcustom .deletemeta { 357 357 width: 90%; 358 358 margin: auto;
Note: See TracChangeset
for help on using the changeset viewer.