Link love. Add get_link(), get_link_to_edit(), add_link(), edit_link(), wp_insert_link(), wp_update_link(), wp_delete_link()
git-svn-id: http://svn.automattic.com/wordpress/trunk@2889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dccf85d6e1
commit
cd0db4edfa
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
|
||||
// Creates a new post from the "Write Post" form using $_POST information.
|
||||
function write_post() {
|
||||
global $user_ID;
|
||||
|
@ -15,7 +16,8 @@ function write_post() {
|
|||
|
||||
if (!empty ($_POST['post_author_override'])) {
|
||||
$_POST['$post_author'] = (int) $_POST['post_author_override'];
|
||||
} else if (! empty($_POST['post_author'])) {
|
||||
} else
|
||||
if (!empty ($_POST['post_author'])) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
|
@ -25,11 +27,16 @@ function write_post() {
|
|||
die(__('You cannot post as this user.'));
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ('' != $_POST['saveasdraft']) $_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['saveasprivate']) $_POST['post_status'] = 'private';
|
||||
if ('' != $_POST['publish']) $_POST['post_status'] = 'publish';
|
||||
if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['savepage']) $_POST['post_status'] = 'static';
|
||||
if ('' != $_POST['saveasdraft'])
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['saveasprivate'])
|
||||
$_POST['post_status'] = 'private';
|
||||
if ('' != $_POST['publish'])
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ('' != $_POST['advanced'])
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['savepage'])
|
||||
$_POST['post_status'] = 'static';
|
||||
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
@ -74,7 +81,8 @@ function edit_post() {
|
|||
|
||||
if (!empty ($_POST['post_author_override'])) {
|
||||
$_POST['$post_author'] = (int) $_POST['post_author_override'];
|
||||
} else if (! empty($_POST['post_author'])) {
|
||||
} else
|
||||
if (!empty ($_POST['post_author'])) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
|
@ -84,11 +92,16 @@ function edit_post() {
|
|||
die(__('You cannot post as this user.'));
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ('' != $_POST['saveasdraft']) $_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['saveasprivate']) $_POST['post_status'] = 'private';
|
||||
if ('' != $_POST['publish']) $_POST['post_status'] = 'publish';
|
||||
if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['savepage']) $_POST['post_status'] = 'static';
|
||||
if ('' != $_POST['saveasdraft'])
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['saveasprivate'])
|
||||
$_POST['post_status'] = 'private';
|
||||
if ('' != $_POST['publish'])
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ('' != $_POST['advanced'])
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ('' != $_POST['savepage'])
|
||||
$_POST['post_status'] = 'static';
|
||||
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
@ -117,15 +130,15 @@ function edit_post() {
|
|||
wp_update_post($_POST);
|
||||
|
||||
// Meta Stuff
|
||||
if ($_POST['meta']) :
|
||||
foreach ($_POST['meta'] as $key => $value) :
|
||||
update_meta($key, $value['key'], $value['value']);
|
||||
if ($_POST['meta'])
|
||||
: foreach ($_POST['meta'] as $key => $value)
|
||||
: update_meta($key, $value['key'], $value['value']);
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ($_POST['deletemeta']) :
|
||||
foreach ($_POST['deletemeta'] as $key => $value) :
|
||||
delete_meta($key);
|
||||
if ($_POST['deletemeta'])
|
||||
: foreach ($_POST['deletemeta'] as $key => $value)
|
||||
: delete_meta($key);
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
|
@ -320,13 +333,13 @@ function wp_create_category($cat_name) {
|
|||
return wp_insert_category($cat_array);
|
||||
}
|
||||
|
||||
|
||||
function wp_create_categories($categories, $post_id = '') {
|
||||
$cat_ids = array ();
|
||||
foreach ($categories as $category) {
|
||||
if ($id = category_exists($category))
|
||||
$cat_ids[] = $id;
|
||||
else if ( $id = wp_create_category($category) )
|
||||
else
|
||||
if ($id = wp_create_category($category))
|
||||
$cat_ids[] = $id;
|
||||
}
|
||||
|
||||
|
@ -347,10 +360,10 @@ function category_exists($cat_name) {
|
|||
// Creates a new user from the "Users" form using $_POST information.
|
||||
|
||||
function add_user() {
|
||||
return update_user();
|
||||
return edit_user();
|
||||
}
|
||||
|
||||
function update_user($user_id = 0) {
|
||||
function edit_user($user_id = 0) {
|
||||
|
||||
if ($user_id != 0) {
|
||||
$update = true;
|
||||
|
@ -424,7 +437,8 @@ function update_user($user_id = 0) {
|
|||
/* checking e-mail address */
|
||||
if (empty ($user->user_email)) {
|
||||
$errors['user_email'] = __("<strong>ERROR</strong>: please type an e-mail address");
|
||||
} else if (!is_email($user->user_email)) {
|
||||
} else
|
||||
if (!is_email($user->user_email)) {
|
||||
$errors['user_email'] = __("<strong>ERROR</strong>: the email address isn't correct");
|
||||
}
|
||||
|
||||
|
@ -478,6 +492,125 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
return true;
|
||||
}
|
||||
|
||||
function get_link($link_id, $output = OBJECT) {
|
||||
global $wpdb;
|
||||
|
||||
$link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
|
||||
|
||||
if ( $output == OBJECT ) {
|
||||
return $link;
|
||||
} elseif ( $output == ARRAY_A ) {
|
||||
return get_object_vars($link);
|
||||
} elseif ( $output == ARRAY_N ) {
|
||||
return array_values(get_object_vars($link));
|
||||
} else {
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
|
||||
function get_link_to_edit($link_id) {
|
||||
$link = get_link($link_id);
|
||||
|
||||
$link->link_url = wp_specialchars($link->link_url, 1);
|
||||
$link->link_name = wp_specialchars($link->link_name, 1);
|
||||
$link->link_description = wp_specialchars($link->link_description);
|
||||
$link->link_notes = wp_specialchars($link->link_notes);
|
||||
$link->link_rss = wp_specialchars($link->link_rss);
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
function add_link() {
|
||||
return edit_link();
|
||||
}
|
||||
|
||||
function edit_link($link_id = '') {
|
||||
if (!current_user_can('manage_links'))
|
||||
die(__("Cheatin' uh ?"));
|
||||
|
||||
$_POST['link_url'] = wp_specialchars($_POST['link_url']);
|
||||
//$link_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $link_url) ? $link_url : 'http://'.$link_url;
|
||||
$_POST['link_name'] = wp_specialchars($_POST['link_name']);
|
||||
$_POST['link_image'] = wp_specialchars($_POST['link_image']);
|
||||
$_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
|
||||
$auto_toggle = get_autotoggle($_POST['link_category']);
|
||||
|
||||
// if we are in an auto toggle category and this one is visible then we
|
||||
// need to make the others invisible before we add this new one.
|
||||
// FIXME Add category toggle func.
|
||||
//if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
|
||||
// $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
|
||||
//}
|
||||
|
||||
if ( !empty($link_id) ) {
|
||||
$_POST['link_id'] = $link_id;
|
||||
return wp_update_link($_POST);
|
||||
} else {
|
||||
return wp_insert_link($_POST);
|
||||
}
|
||||
}
|
||||
|
||||
function wp_insert_link($linkdata) {
|
||||
global $wpdb;
|
||||
|
||||
extract($linkdata);
|
||||
|
||||
$update = false;
|
||||
if ( !empty($link_id) )
|
||||
$update = true;
|
||||
|
||||
if ( empty($link_rating) )
|
||||
$link_rating = 0;
|
||||
|
||||
if ( empty($link_target) )
|
||||
$link_target = '';
|
||||
|
||||
if ( empty($link_visible) )
|
||||
$link_visible = 'Y';
|
||||
|
||||
if ( $update ) {
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
|
||||
link_name='$link_name', link_image='$link_image',
|
||||
link_target='$link_target', link_category='$link_category',
|
||||
link_visible='$link_visible', link_description='$link_description',
|
||||
link_rating='$link_rating', link_rel='$link_rel',
|
||||
link_notes='$link_notes', link_rss = '$link_rss'
|
||||
WHERE link_id='$link_id'");
|
||||
} else {
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
|
||||
$link_id = $wpdb->insert_id;
|
||||
}
|
||||
|
||||
if ( $update )
|
||||
do_action('edit_link', $link_id);
|
||||
else
|
||||
do_action('add_link', $link_id);
|
||||
|
||||
return $link_id;
|
||||
}
|
||||
|
||||
function wp_update_link($linkdata) {
|
||||
global $wpdb;
|
||||
|
||||
$link_id = (int) $linkdata['link_id'];
|
||||
|
||||
$link = get_link($link_id, ARRAY_A);
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$link = add_magic_quotes($link);
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$linkdata = array_merge($link, $linkdata);
|
||||
|
||||
return wp_insert_link($linkdata);
|
||||
}
|
||||
|
||||
function wp_delete_link($link_id) {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
|
||||
}
|
||||
|
||||
function post_exists($title, $content = '', $post_date = '') {
|
||||
global $wpdb;
|
||||
|
||||
|
@ -486,7 +619,8 @@ function post_exists($title, $content = '', $post_date = '') {
|
|||
|
||||
if (!empty ($title))
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
|
||||
else if ( ! empty($content) )
|
||||
else
|
||||
if (!empty ($content))
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
|
||||
|
||||
return 0;
|
||||
|
@ -510,11 +644,13 @@ function url_shorten ($url) {
|
|||
}
|
||||
|
||||
function selected($selected, $current) {
|
||||
if ($selected == $current) echo ' selected="selected"';
|
||||
if ($selected == $current)
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
|
||||
function checked($checked, $current) {
|
||||
if ($checked == $current) echo ' checked="checked"';
|
||||
if ($checked == $current)
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
|
||||
function return_categories_list($parent = 0) {
|
||||
|
@ -532,8 +668,7 @@ function get_nested_categories($default = 0, $parent = 0) {
|
|||
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID'
|
||||
");
|
||||
|
||||
if(count($checked_categories) == 0)
|
||||
{
|
||||
if (count($checked_categories) == 0) {
|
||||
// No selected categories, strange
|
||||
$checked_categories[] = $default;
|
||||
}
|
||||
|
@ -559,9 +694,7 @@ function get_nested_categories($default = 0, $parent = 0) {
|
|||
|
||||
function write_nested_categories($categories) {
|
||||
foreach ($categories as $category) {
|
||||
echo '<label for="category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'],
|
||||
'" type="checkbox" name="post_category[]" id="category-', $category['cat_ID'], '"',
|
||||
($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label>\n";
|
||||
echo '<label for="category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label>\n";
|
||||
|
||||
if (isset ($category['children'])) {
|
||||
echo "\n<span class='cat-nest'>\n";
|
||||
|
@ -613,7 +746,8 @@ function page_rows( $parent = 0, $level = 0, $pages = 0 ) {
|
|||
$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");
|
||||
|
||||
if ($pages) {
|
||||
foreach ($pages as $post) { start_wp();
|
||||
foreach ($pages as $post) {
|
||||
start_wp();
|
||||
if ($post->post_parent == $parent) {
|
||||
$post->post_title = wp_specialchars($post->post_title);
|
||||
$pad = str_repeat('— ', $level);
|
||||
|
@ -633,6 +767,7 @@ function page_rows( $parent = 0, $level = 0, $pages = 0 ) {
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
page_rows($id, $level +1, $pages);
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +782,8 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev
|
|||
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
|
||||
}
|
||||
if ($categories) {
|
||||
foreach ($categories as $category) { if ($currentcat != $category->cat_ID && $parent == $category->category_parent) {
|
||||
foreach ($categories as $category) {
|
||||
if ($currentcat != $category->cat_ID && $parent == $category->category_parent) {
|
||||
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
|
||||
$pad = str_repeat('– ', $level);
|
||||
$category->cat_name = wp_specialchars($category->cat_name);
|
||||
|
@ -656,7 +792,8 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev
|
|||
echo " selected='selected'";
|
||||
echo ">$pad$category->cat_name</option>";
|
||||
wp_dropdown_cats($currentcat, $currentparent, $category->cat_ID, $level +1, $categories);
|
||||
} }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -674,18 +811,22 @@ function wp_create_thumbnail($file, $max_side, $effect = '') {
|
|||
|
||||
if (!function_exists('imagegif') && $type[2] == 1) {
|
||||
$error = __('Filetype not supported. Thumbnail not created.');
|
||||
}elseif(!function_exists('imagejpeg') && $type[2] == 2) {
|
||||
}
|
||||
elseif (!function_exists('imagejpeg') && $type[2] == 2) {
|
||||
$error = __('Filetype not supported. Thumbnail not created.');
|
||||
}elseif(!function_exists('imagepng') && $type[2] == 3) {
|
||||
}
|
||||
elseif (!function_exists('imagepng') && $type[2] == 3) {
|
||||
$error = __('Filetype not supported. Thumbnail not created.');
|
||||
} else {
|
||||
|
||||
// create the initial copy from the original file
|
||||
if ($type[2] == 1) {
|
||||
$image = imagecreatefromgif($file);
|
||||
} elseif($type[2] == 2) {
|
||||
}
|
||||
elseif ($type[2] == 2) {
|
||||
$image = imagecreatefromjpeg($file);
|
||||
} elseif($type[2] == 3) {
|
||||
}
|
||||
elseif ($type[2] == 3) {
|
||||
$image = imagecreatefrompng($file);
|
||||
}
|
||||
|
||||
|
@ -726,11 +867,13 @@ function wp_create_thumbnail($file, $max_side, $effect = '') {
|
|||
if (!imagegif($thumbnail, $thumbpath)) {
|
||||
$error = __("Thumbnail path invalid");
|
||||
}
|
||||
} elseif($type[2] == 2) {
|
||||
}
|
||||
elseif ($type[2] == 2) {
|
||||
if (!imagejpeg($thumbnail, $thumbpath)) {
|
||||
$error = __("Thumbnail path invalid");
|
||||
}
|
||||
} elseif($type[2] == 3) {
|
||||
}
|
||||
elseif ($type[2] == 3) {
|
||||
if (!imagepng($thumbnail, $thumbpath)) {
|
||||
$error = __("Thumbnail path invalid");
|
||||
}
|
||||
|
@ -739,12 +882,9 @@ function wp_create_thumbnail($file, $max_side, $effect = '') {
|
|||
}
|
||||
}
|
||||
|
||||
if(!empty($error))
|
||||
{
|
||||
if (!empty ($error)) {
|
||||
return $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -764,7 +904,8 @@ function has_meta($postid) {
|
|||
function list_meta($meta) {
|
||||
global $post_ID;
|
||||
// Exit if no meta
|
||||
if (!$meta) return;
|
||||
if (!$meta)
|
||||
return;
|
||||
$count = 0;
|
||||
?>
|
||||
<table id='meta-list' cellpadding="3">
|
||||
|
@ -775,11 +916,15 @@ function list_meta($meta) {
|
|||
</tr>
|
||||
<?php
|
||||
|
||||
|
||||
foreach ($meta as $entry) {
|
||||
++ $count;
|
||||
if ( $count % 2 ) $style = 'alternate';
|
||||
else $style = '';
|
||||
if ( '_' == $entry['meta_key']{0} ) $style .= ' hidden';
|
||||
if ($count % 2)
|
||||
$style = 'alternate';
|
||||
else
|
||||
$style = '';
|
||||
if ('_' == $entry['meta_key'] { 0 })
|
||||
$style .= ' hidden';
|
||||
echo "
|
||||
<tr class='$style'>
|
||||
<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>
|
||||
|
@ -828,6 +973,7 @@ function meta_form() {
|
|||
<select id="metakeyselect" name="metakeyselect" tabindex="7">
|
||||
<option value="#NONE#"><?php _e('- Select -'); ?></option>
|
||||
<?php
|
||||
|
||||
foreach ($keys as $key) {
|
||||
echo "\n\t<option value='$key'>$key</option>";
|
||||
}
|
||||
|
@ -842,6 +988,7 @@ function meta_form() {
|
|||
</table>
|
||||
<p class="submit"><input type="submit" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field »') ?>" /></p>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function add_meta($post_ID) {
|
||||
|
@ -913,7 +1060,6 @@ function touch_time($edit = 1, $for_post = 1) {
|
|||
}
|
||||
echo ">".$month["$ii"]."</option>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<input type="text" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" />
|
||||
|
@ -923,6 +1069,7 @@ function touch_time($edit = 1, $for_post = 1) {
|
|||
<input type="hidden" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
|
||||
<?php _e('Existing timestamp'); ?>:
|
||||
<?php
|
||||
|
||||
// We might need to readjust to display proper existing timestamp
|
||||
if ($for_post && ('draft' == $post->post_status)) {
|
||||
$jj = mysql2date('d', $post_date);
|
||||
|
@ -932,9 +1079,11 @@ function touch_time($edit = 1, $for_post = 1) {
|
|||
$mn = mysql2date('i', $post_date);
|
||||
$ss = mysql2date('s', $post_date);
|
||||
}
|
||||
echo "{$month[$mm]} $jj, $aa @ $hh:$mn"; ?>
|
||||
echo "{$month[$mm]} $jj, $aa @ $hh:$mn";
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function check_admin_referer() {
|
||||
|
@ -963,11 +1112,15 @@ function insert_with_markers($filename, $marker, $insertion) {
|
|||
if ($markerdata) {
|
||||
$state = true;
|
||||
foreach ($markerdata as $markerline) {
|
||||
if (strstr($markerline, "# BEGIN {$marker}")) $state = false;
|
||||
if ($state) fwrite($f, "{$markerline}\n");
|
||||
if (strstr($markerline, "# BEGIN {$marker}"))
|
||||
$state = false;
|
||||
if ($state)
|
||||
fwrite($f, "{$markerline}\n");
|
||||
if (strstr($markerline, "# END {$marker}")) {
|
||||
fwrite($f, "# BEGIN {$marker}\n");
|
||||
if(is_array($insertion)) foreach($insertion as $insertline) fwrite($f, "{$insertline}\n");
|
||||
if (is_array($insertion))
|
||||
foreach ($insertion as $insertline)
|
||||
fwrite($f, "{$insertline}\n");
|
||||
fwrite($f, "# END {$marker}\n");
|
||||
$state = true;
|
||||
$foundit = true;
|
||||
|
@ -976,7 +1129,8 @@ function insert_with_markers($filename, $marker, $insertion) {
|
|||
}
|
||||
if (!$foundit) {
|
||||
fwrite($f, "# BEGIN {$marker}\n");
|
||||
foreach($insertion as $insertline) fwrite($f, "{$insertline}\n");
|
||||
foreach ($insertion as $insertline)
|
||||
fwrite($f, "{$insertline}\n");
|
||||
fwrite($f, "# END {$marker}\n");
|
||||
}
|
||||
fclose($f);
|
||||
|
@ -1000,9 +1154,12 @@ function extract_from_markers($filename, $marker) {
|
|||
{
|
||||
$state = false;
|
||||
foreach ($markerdata as $markerline) {
|
||||
if(strstr($markerline, "# END {$marker}")) $state = false;
|
||||
if($state) $result[] = $markerline;
|
||||
if(strstr($markerline, "# BEGIN {$marker}")) $state = true;
|
||||
if (strstr($markerline, "# END {$marker}"))
|
||||
$state = false;
|
||||
if ($state)
|
||||
$result[] = $markerline;
|
||||
if (strstr($markerline, "# BEGIN {$marker}"))
|
||||
$state = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1028,8 +1185,8 @@ function save_mod_rewrite_rules() {
|
|||
|
||||
function the_quicktags() {
|
||||
// Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
|
||||
if ( !strstr($_SERVER['HTTP_USER_AGENT'], 'Safari') ) :
|
||||
echo '
|
||||
if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari'))
|
||||
: echo '
|
||||
<div id="quicktags">
|
||||
<script src="../wp-includes/js/quicktags.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">edToolbar();</script>
|
||||
|
@ -1095,9 +1252,11 @@ function get_page_templates() {
|
|||
|
||||
function page_template_dropdown($default = '') {
|
||||
$templates = get_page_templates();
|
||||
foreach (array_keys($templates) as $template) :
|
||||
if ($default == $templates[$template]) $selected = " selected='selected'";
|
||||
else $selected = '';
|
||||
foreach (array_keys($templates) as $template)
|
||||
: if ($default == $templates[$template])
|
||||
$selected = " selected='selected'";
|
||||
else
|
||||
$selected = '';
|
||||
echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
|
||||
endforeach;
|
||||
}
|
||||
|
@ -1179,7 +1338,8 @@ function get_admin_page_title() {
|
|||
if ($menu_array[2] == $pagenow) {
|
||||
$title = $menu_array[3];
|
||||
return $menu_array[3];
|
||||
} else if (isset($plugin_page) && ($plugin_page == $menu_array[2])) {
|
||||
} else
|
||||
if (isset ($plugin_page) && ($plugin_page == $menu_array[2])) {
|
||||
$title = $menu_array[3];
|
||||
return $menu_array[3];
|
||||
}
|
||||
|
@ -1192,7 +1352,8 @@ function get_admin_page_title() {
|
|||
if ($submenu_array[2] == $pagenow) {
|
||||
$title = $submenu_array[3];
|
||||
return $submenu_array[3];
|
||||
} else if (isset($plugin_page) && ($plugin_page == $submenu_array[2])) {
|
||||
} else
|
||||
if (isset ($plugin_page) && ($plugin_page == $submenu_array[2])) {
|
||||
$title = $submenu_array[3];
|
||||
return $submenu_array[3];
|
||||
}
|
||||
|
@ -1229,7 +1390,8 @@ function get_admin_page_parent() {
|
|||
if ($submenu_array[2] == $pagenow) {
|
||||
$parent_file = $parent;
|
||||
return $parent;
|
||||
} else if (isset($plugin_page) && ($plugin_page == $submenu_array[2])) {
|
||||
} else
|
||||
if (isset ($plugin_page) && ($plugin_page == $submenu_array[2])) {
|
||||
$parent_file = $parent;
|
||||
return $parent;
|
||||
}
|
||||
|
@ -1296,7 +1458,6 @@ function add_theme_page($page_title, $menu_title, $access_level, $file, $functio
|
|||
return add_submenu_page('themes.php', $page_title, $menu_title, $access_level, $file, $function);
|
||||
}
|
||||
|
||||
|
||||
function validate_file($file, $allowed_files = '') {
|
||||
if (false !== strpos($file, './'))
|
||||
return 1;
|
||||
|
@ -1345,8 +1506,7 @@ function get_home_path() {
|
|||
}
|
||||
|
||||
function get_real_file_to_edit($file) {
|
||||
if ('index.php' == $file ||
|
||||
'.htaccess' == $file) {
|
||||
if ('index.php' == $file || '.htaccess' == $file) {
|
||||
$real_file = get_home_path().$file;
|
||||
} else {
|
||||
$real_file = ABSPATH.$file;
|
||||
|
@ -1355,35 +1515,17 @@ function get_real_file_to_edit($file) {
|
|||
return $real_file;
|
||||
}
|
||||
|
||||
$wp_file_descriptions =
|
||||
array(
|
||||
'index.php' => __('Main Index Template'),
|
||||
'style.css' => __('Stylesheet'),
|
||||
'comments.php' => __('Comments'),
|
||||
'comments-popup.php' => __('Popup Comments'),
|
||||
'footer.php' => __('Footer'),
|
||||
'header.php' => __('Header'),
|
||||
'sidebar.php' => __('Sidebar'),
|
||||
'archive.php' => __('Archives'),
|
||||
'category.php' => __('Category Template'),
|
||||
'page.php' => __('Page Template'),
|
||||
'search.php' => __('Search Results'),
|
||||
'single.php' => __('Single Post'),
|
||||
'404.php' => __('404 Template'),
|
||||
'my-hacks.php' => __('my-hacks.php (legacy hacks support)'),
|
||||
'.htaccess' => __('.htaccess (for rewrite rules)'),
|
||||
$wp_file_descriptions = array ('index.php' => __('Main Index Template'), 'style.css' => __('Stylesheet'), 'comments.php' => __('Comments'), 'comments-popup.php' => __('Popup Comments'), 'footer.php' => __('Footer'), 'header.php' => __('Header'), 'sidebar.php' => __('Sidebar'), 'archive.php' => __('Archives'), 'category.php' => __('Category Template'), 'page.php' => __('Page Template'), 'search.php' => __('Search Results'), 'single.php' => __('Single Post'), '404.php' => __('404 Template'), 'my-hacks.php' => __('my-hacks.php (legacy hacks support)'), '.htaccess' => __('.htaccess (for rewrite rules)'),
|
||||
// Deprecated files
|
||||
'wp-layout.css' => __('Stylesheet'),
|
||||
'wp-comments.php' => __('Comments Template'),
|
||||
'wp-comments-popup.php' => __('Popup Comments Template')
|
||||
);
|
||||
'wp-layout.css' => __('Stylesheet'), 'wp-comments.php' => __('Comments Template'), 'wp-comments-popup.php' => __('Popup Comments Template'));
|
||||
|
||||
function get_file_description($file) {
|
||||
global $wp_file_descriptions;
|
||||
|
||||
if (isset ($wp_file_descriptions[basename($file)])) {
|
||||
return $wp_file_descriptions[basename($file)];
|
||||
} elseif ( file_exists( ABSPATH . $file ) ) {
|
||||
}
|
||||
elseif (file_exists(ABSPATH.$file)) {
|
||||
$template_data = implode('', file(ABSPATH.$file));
|
||||
if (preg_match("|Template Name:(.*)|i", $template_data, $name))
|
||||
return $name[1];
|
||||
|
@ -1498,9 +1640,11 @@ function get_plugin_page_hookname($plugin_page, $parent_page) {
|
|||
if (empty ($parent_page) || 'admin.php' == $parent_page) {
|
||||
if (isset ($admin_page_hooks[$plugin_page]))
|
||||
$page_type = 'toplevel';
|
||||
else if ( isset($admin_page_hooks[$parent]) )
|
||||
else
|
||||
if (isset ($admin_page_hooks[$parent]))
|
||||
$page_type = $admin_page_hooks[$parent];
|
||||
} else if ( isset($admin_page_hooks[$parent_page]) ) {
|
||||
} else
|
||||
if (isset ($admin_page_hooks[$parent_page])) {
|
||||
$page_type = $admin_page_hooks[$parent_page];
|
||||
} else {
|
||||
$page_type = 'admin';
|
||||
|
@ -1561,5 +1705,4 @@ function current_theme_info() {
|
|||
$ct->author = $themes[$current_theme]['Author'];
|
||||
return $ct;
|
||||
}
|
||||
|
||||
?>
|
|
@ -75,19 +75,19 @@ require('admin-header.php');
|
|||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('URI:') ?></th>
|
||||
<td width="67%"><input type="text" name="linkurl" value="<?php echo wp_specialchars($_GET['linkurl'], 1); ?>" style="width: 95%;" /></td>
|
||||
<td width="67%"><input type="text" name="link_url" value="<?php echo wp_specialchars($_GET['linkurl'], 1); ?>" style="width: 95%;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Link Name:') ?></th>
|
||||
<td><input type="text" name="name" value="<?php echo wp_specialchars( urldecode($_GET['name']), 1 ); ?>" style="width: 95%" /></td>
|
||||
<td><input type="text" name="link_name" value="<?php echo wp_specialchars( urldecode($_GET['name']), 1 ); ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Short description:') ?></th>
|
||||
<td><input type="text" name="description" value="" style="width: 95%" /></td>
|
||||
<td><input type="text" name="link_description" value="" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Category:') ?></th>
|
||||
<td><?php category_dropdown('category'); ?></td>
|
||||
<td><?php category_dropdown('link_category'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
@ -99,7 +99,7 @@ require('admin-header.php');
|
|||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('rel:') ?></th>
|
||||
<td width="67%"><input type="text" name="rel" id="rel" size="50" value="<?php echo $link_rel; ?>" /></td>
|
||||
<td width="67%"><input type="text" name="link_rel" id="rel" size="50" value="<?php echo $link_rel; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
|
||||
|
@ -212,19 +212,19 @@ require('admin-header.php');
|
|||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('Image URI:') ?></th>
|
||||
<td width="67%"><input type="text" name="image" size="50" value="" style="width: 95%" /></td>
|
||||
<td width="67%"><input type="text" name="link_image" size="50" value="" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('RSS URI:') ?> </th>
|
||||
<td><input name="rss_uri" type="text" id="rss_uri" value="" size="50" style="width: 95%" /></td>
|
||||
<td><input name="link_rss" type="text" id="rss_uri" value="" size="50" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Notes:') ?></th>
|
||||
<td><textarea name="notes" cols="50" rows="10" style="width: 95%"></textarea></td>
|
||||
<td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Rating:') ?></th>
|
||||
<td><select name="rating" size="1">
|
||||
<td><select name="link_rating" size="1">
|
||||
<?php
|
||||
for ($r = 0; $r < 10; $r++) {
|
||||
echo(' <option value="'.$r.'">'.$r.'</option>');
|
||||
|
@ -236,22 +236,22 @@ require('admin-header.php');
|
|||
<tr>
|
||||
<th scope="row"><?php _e('Target') ?></th>
|
||||
<td><label>
|
||||
<input type="radio" name="target" value="_blank" />
|
||||
<input type="radio" name="link_target" value="_blank" />
|
||||
<code>_blank</code></label>
|
||||
<br />
|
||||
<label><input type="radio" name="target" value="_top" />
|
||||
<label><input type="radio" name="link_target" value="_top" />
|
||||
<code>_top</code></label>
|
||||
<br />
|
||||
<label><input type="radio" name="target" value="" checked="checked" />
|
||||
<label><input type="radio" name="link_target" value="" checked="checked" />
|
||||
<?php _e('none') ?></label>
|
||||
<?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Visible:') ?></th>
|
||||
<td><label>
|
||||
<input type="radio" name="visible" checked="checked" value="Y" />
|
||||
<input type="radio" name="link_visible" checked="checked" value="Y" />
|
||||
<?php _e('Yes') ?></label><br />
|
||||
<label><input type="radio" name="visible" value="N" /> <input type="hidden" name="action" value="Add" />
|
||||
<label><input type="radio" name="link_visible" value="N" /> <input type="hidden" name="action" value="Add" />
|
||||
<?php _e('No') ?></label></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -159,33 +159,7 @@ switch ($action) {
|
|||
{
|
||||
check_admin_referer();
|
||||
|
||||
$link_url = wp_specialchars($_POST['linkurl']);
|
||||
$link_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $link_url) ? $link_url : 'http://' . $link_url;
|
||||
$link_name = wp_specialchars($_POST['name']);
|
||||
$link_image = wp_specialchars($_POST['image']);
|
||||
$link_target = $_POST['target'];
|
||||
$link_category = $_POST['category'];
|
||||
$link_description = $_POST['description'];
|
||||
$link_visible = $_POST['visible'];
|
||||
$link_rating = $_POST['rating'];
|
||||
$link_rel = $_POST['rel'];
|
||||
$link_notes = $_POST['notes'];
|
||||
$link_rss_uri = wp_specialchars($_POST['rss_uri']);
|
||||
$auto_toggle = get_autotoggle($link_category);
|
||||
|
||||
if ( !current_user_can('manage_links') )
|
||||
die (__("Cheatin' uh ?"));
|
||||
|
||||
// if we are in an auto toggle category and this one is visible then we
|
||||
// need to make the others invisible before we add this new one.
|
||||
if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
|
||||
$wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
|
||||
}
|
||||
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) " .
|
||||
" VALUES('" . $link_url . "','"
|
||||
. $link_name . "', '"
|
||||
. $link_image . "', '$link_target', $link_category, '"
|
||||
. $link_description . "', '$link_visible', $user_ID, $link_rating, '" . $link_rel . "', '" . $link_notes . "', '$link_rss_uri')");
|
||||
add_link();
|
||||
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true');
|
||||
break;
|
||||
|
@ -193,7 +167,8 @@ switch ($action) {
|
|||
|
||||
case 'editlink':
|
||||
{
|
||||
if (isset($submit)) {
|
||||
|
||||
check_admin_referer();
|
||||
|
||||
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
|
||||
$cat_id = $links_show_cat_id;
|
||||
|
@ -204,42 +179,9 @@ switch ($action) {
|
|||
}
|
||||
$links_show_cat_id = $cat_id;
|
||||
|
||||
check_admin_referer();
|
||||
|
||||
$link_id = (int) $_POST['link_id'];
|
||||
$link_url = wp_specialchars($_POST['linkurl']);
|
||||
$link_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $link_url) ? $link_url : 'http://' . $link_url;
|
||||
$link_name = wp_specialchars($_POST['name']);
|
||||
$link_image = wp_specialchars($_POST['image']);
|
||||
$link_target = wp_specialchars($_POST['target']);
|
||||
$link_category = $_POST['category'];
|
||||
$link_description = $_POST['description'];
|
||||
$link_visible = $_POST['visible'];
|
||||
$link_rating = $_POST['rating'];
|
||||
$link_rel = $_POST['rel'];
|
||||
$link_notes = $_POST['notes'];
|
||||
$link_rss_uri = $_POST['rss_uri'];
|
||||
$auto_toggle = get_autotoggle($link_category);
|
||||
edit_link($link_id);
|
||||
|
||||
if ( !current_user_can('manage_links') )
|
||||
die (__("Cheatin' uh ?"));
|
||||
|
||||
// if we are in an auto toggle category and this one is visible then we
|
||||
// need to make the others invisible before we update this one.
|
||||
if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
|
||||
$wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
|
||||
}
|
||||
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_url='" . $link_url . "',
|
||||
link_name='" . $link_name . "',\n link_image='" . $link_image . "',
|
||||
link_target='$link_target',\n link_category=$link_category,
|
||||
link_visible='$link_visible',\n link_description='" . $link_description . "',
|
||||
link_rating=$link_rating,
|
||||
link_rel='" . $link_rel . "',
|
||||
link_notes='" . $link_notes . "',
|
||||
link_rss = '$link_rss_uri'
|
||||
WHERE link_id=$link_id");
|
||||
} // end if save
|
||||
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
|
||||
wp_redirect($this_file);
|
||||
break;
|
||||
|
@ -249,12 +191,12 @@ switch ($action) {
|
|||
{
|
||||
check_admin_referer();
|
||||
|
||||
$link_id = (int) $_GET['link_id'];
|
||||
|
||||
if ( !current_user_can('manage_links') )
|
||||
die (__("Cheatin' uh ?"));
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id");
|
||||
$link_id = (int) $_GET['link_id'];
|
||||
|
||||
wp_delete_link($link_id);
|
||||
|
||||
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
|
||||
$cat_id = $links_show_cat_id;
|
||||
|
@ -276,24 +218,9 @@ switch ($action) {
|
|||
die(__('You do not have sufficient permissions to edit the links for this blog.'));
|
||||
|
||||
$link_id = (int) $_GET['link_id'];
|
||||
$row = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = $link_id");
|
||||
|
||||
if ($row) {
|
||||
$link_url = wp_specialchars($row->link_url, 1);
|
||||
$link_name = wp_specialchars($row->link_name, 1);
|
||||
$link_image = $row->link_image;
|
||||
$link_target = $row->link_target;
|
||||
$link_category = $row->link_category;
|
||||
$link_description = wp_specialchars($row->link_description);
|
||||
$link_visible = $row->link_visible;
|
||||
$link_rating = $row->link_rating;
|
||||
$link_rel = $row->link_rel;
|
||||
$link_notes = wp_specialchars($row->link_notes);
|
||||
$link_rss_uri = wp_specialchars($row->link_rss);
|
||||
} else {
|
||||
if ( !$link = get_link_to_edit($link_id) )
|
||||
die( __('Link not found.') );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
|
@ -304,19 +231,19 @@ switch ($action) {
|
|||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('URI:') ?></th>
|
||||
<td width="67%"><input type="text" name="linkurl" value="<?php echo $link_url; ?>" style="width: 95%;" /></td>
|
||||
<td width="67%"><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Link Name:') ?></th>
|
||||
<td><input type="text" name="name" value="<?php echo $link_name; ?>" style="width: 95%" /></td>
|
||||
<td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Short description:') ?></th>
|
||||
<td><input type="text" name="description" value="<?php echo $link_description; ?>" style="width: 95%" /></td>
|
||||
<td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Category:') ?></th>
|
||||
<td><?php category_dropdown('category', $link_category); ?></td>
|
||||
<td><?php category_dropdown('link_category', $link->link_category); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
@ -328,7 +255,7 @@ switch ($action) {
|
|||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('rel:') ?></th>
|
||||
<td width="67%"><input type="text" name="rel" id="rel" size="50" value="<?php echo $link_rel; ?>" /></td>
|
||||
<td width="67%"><input type="text" name="link_rel" id="rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
|
||||
|
@ -441,23 +368,23 @@ switch ($action) {
|
|||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('Image URI:') ?></th>
|
||||
<td width="67%"><input type="text" name="image" size="50" value="<?php echo $link_image; ?>" style="width: 95%" /></td>
|
||||
<td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('RSS URI:') ?> </th>
|
||||
<td><input name="rss_uri" type="text" id="rss_uri" value="<?php echo $link_rss_uri; ?>" size="50" style="width: 95%" /></td>
|
||||
<td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Notes:') ?></th>
|
||||
<td><textarea name="notes" cols="50" rows="10" style="width: 95%"><?php echo $link_notes; ?></textarea></td>
|
||||
<td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Rating:') ?></th>
|
||||
<td><select name="rating" size="1">
|
||||
<td><select name="link_rating" size="1">
|
||||
<?php
|
||||
for ($r = 0; $r < 10; $r++) {
|
||||
echo(' <option value="'.$r.'" ');
|
||||
if ($link_rating == $r)
|
||||
if ($link->link_rating == $r)
|
||||
echo 'selected="selected"';
|
||||
echo('>'.$r.'</option>');
|
||||
}
|
||||
|
@ -468,22 +395,22 @@ switch ($action) {
|
|||
<tr>
|
||||
<th scope="row"><?php _e('Target') ?></th>
|
||||
<td><label>
|
||||
<input type="radio" name="target" value="_blank" <?php echo(($link_target == '_blank') ? 'checked="checked"' : ''); ?> />
|
||||
<input type="radio" name="target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
|
||||
<code>_blank</code></label><br />
|
||||
<label>
|
||||
<input type="radio" name="target" value="_top" <?php echo(($link_target == '_top') ? 'checked="checked"' : ''); ?> />
|
||||
<input type="radio" name="target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
|
||||
<code>_top</code></label><br />
|
||||
<label>
|
||||
<input type="radio" name="target" value="" <?php echo(($link_target == '') ? 'checked="checked"' : ''); ?> />
|
||||
<input type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
|
||||
<?php _e('none') ?></label><br />
|
||||
<?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Visible:') ?></th>
|
||||
<td><label>
|
||||
<input type="radio" name="visible" <?php if ($link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
|
||||
<input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
|
||||
<?php _e('Yes') ?></label><br /><label>
|
||||
<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked='checked'"; ?> value="N" />
|
||||
<input type="radio" name="visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
|
||||
<?php _e('No') ?></label></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -4,7 +4,7 @@ require_once('admin.php');
|
|||
|
||||
check_admin_referer();
|
||||
|
||||
$errors = update_user($user_ID);
|
||||
$errors = edit_user($user_ID);
|
||||
|
||||
if (count($errors) != 0) {
|
||||
foreach ($errors as $id => $error) {
|
||||
|
|
|
@ -37,7 +37,7 @@ $errors = array();
|
|||
if (!current_user_can('edit_users'))
|
||||
$errors['head'] = __('You do not have permission to edit this user.');
|
||||
else
|
||||
$errors = update_user($user_id);
|
||||
$errors = edit_user($user_id);
|
||||
|
||||
if(count($errors) == 0) {
|
||||
header("Location: user-edit.php?user_id=$user_id&updated=true");
|
||||
|
|
Loading…
Reference in New Issue