0 ) { $permalink = $_POST['permalink']; if ( empty($permalink) ) delete_cat_permalink($_POST['cat_id'], isset($_POST['save']) ); else set_cat_permalink($_POST['cat_id'], $permalink, isset($_POST['save']) ); $selected_cat = array( $_POST['cat_id'] ); } elseif ( isset($_GET['delete_permanent']) ) { $query = ' DELETE FROM '.OLD_PERMALINKS_TABLE.' WHERE permalink="'.$_GET['delete_permanent'].'" LIMIT 1'; pwg_query($query); if (mysql_affected_rows()==0) array_push($page['errors'], 'Cannot delete the old permalink !'); } $template->set_filename('permalinks', 'admin/permalinks.tpl' ); $query = ' SELECT id, CONCAT(id, " - ", name, IF(permalink IS NULL, "", " √") ) AS name, uppercats, global_rank FROM '.CATEGORIES_TABLE; display_select_cat_wrapper( $query, $selected_cat, 'categories', false ); $query = ' SELECT id, name, permalink FROM '.CATEGORIES_TABLE.' WHERE permalink IS NOT NULL'; $result=pwg_query($query); while ( $row=mysql_fetch_assoc($result) ) { $display_name = get_cat_display_name( array($row) ); $template->assign_block_vars( 'permalink', array( 'CAT_ID' => $row['id'], 'CAT' => $display_name, 'PERMALINK' => $row['permalink'], ) ); } $url_del_base = get_root_url().'admin.php?page=permalinks'; $query = 'SELECT * FROM '.OLD_PERMALINKS_TABLE; $result = pwg_query($query); while ( $row=mysql_fetch_assoc($result) ) { $row['display_name'] = get_cat_display_name_cache($row['cat_id']); $row['U_DELETE'] = add_url_params( $url_del_base, array( 'delete_permanent'=> $row['permalink'] ) ); $template->assign_block_vars( 'deleted_permalink', $row ); } $template->assign_var('U_HELP', get_root_url().'popuphelp.php?page=permalinks'); $template->assign_var_from_handle('ADMIN_CONTENT', 'permalinks'); ?>