$linkRecord->setVar('link_id', $link_id); $linkRecord->setVar('link_url', $link_url); $linkRecord->setVar('link_name', $link_name); $linkRecord->setVar('link_image', $link_image); $linkRecord->setVar('link_target', $link_target); $linkRecord->setVar('link_category', $link_category); $linkRecord->setVar('link_description', $link_description); $linkRecord->setVar('link_visible', $link_visible); $linkRecord->setVar('link_rating', $link_rating); $linkRecord->setVar('link_rel', $link_rel); $linkRecord->setVar('link_notes', $link_notes); $linkRecord->setVar('link_rss', $link_rss); $linkHandler->insert($linkRecord); // 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. $auto_toggle = get_autotoggle($link_category); if ($auto_toggle == 'Y' && $link_visible == 'Y') { $criteria = new Criteria('link_category', $link_category); $linkHandler->updateAll('link_visible', 'N', $criteria); } } header('Location: ' . $this_file); break; case 'confirmdelete': $title = 'Delete Link'; $standalone = 0; require_once 'admin-header.php'; init_param('GET', 'link_id', 'integer', NO_DEFAULT_PARAM, true); $delete_confirm = array('action' => 'Delete', 'link_id' => $link_id); $delete_confirm += $xoopsWPTicket->getTicketArray(__LINE__); $msg = _LANG_P_CONFIRM_DELETE;
function edit_link($link_id = '') { if (!current_user_can('manage_links')) { die(__("Cheatin' uh ?")); } $_POST['link_url'] = wp_specialchars($_POST['link_url']); $_POST['link_url'] = clean_url($_POST['link_url']); $_POST['link_name'] = wp_specialchars($_POST['link_name']); $_POST['link_image'] = wp_specialchars($_POST['link_image']); $_POST['link_rss'] = clean_url($_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); } }