<?php global $smarty, $tables, $current_language, $config; $clean_urls_data =& cw_session_register('clean_urls_data', array()); $top_message =& cw_session_register('top_message'); // history list tab if ($mode == "history") { if ($h_action == "delete" && !empty($history_url)) { foreach ($history_url as $history_url_id => $_v) { cw_clean_url_delete_url_by_id($history_url_id); } } $smarty->assign('h_sort_field', ""); $smarty->assign('h_sort_direction', 0); $orderby = "ORDER BY h.ctime"; if (!empty($sort_field)) { $orderby = "ORDER BY " . $sort_field; $smarty->assign('h_sort_field', $sort_field); } if ($sort_direction != "") { if (!empty($orderby)) { $orderby .= $sort_direction ? " ASC" : " DESC"; } $smarty->assign('h_sort_direction', abs($sort_direction - 1)); } $clean_urls_history_list = cw_clean_url_get_clean_urls_history_list_data($orderby); $smarty->assign('clean_urls_history_list', $clean_urls_history_list); } else { $page = !empty($page) ? $page : 1; // edit clean url if ($action == "edit") {
function cw_clean_url_delete_url_by_id_and_get_data($url_id) { global $tables; $result = array('item_id' => 0, 'item_type' => ''); if (!empty($url_id)) { $data = cw_query_first("SELECT item_id, item_type\n\t\t\tFROM {$tables['clean_urls_history']}\n\t\t\tWHERE id = '{$url_id}'"); if (!empty($data)) { $result['item_id'] = $data['item_id']; $result['item_type'] = $data['item_type']; } cw_clean_url_delete_url_by_id($url_id); } return $result; }