'."\n". '.sort img.status {float: right; margin: 2px 0 0 4px; position: relative;}'."\n". ''."\n". jsHelpers::dragSort(). '' ; $blogroll = new blogroll($blog,DB_PREFIX); $action = !empty($_POST['action']) ? $_POST['action'] : NULL; $page = !empty($_REQUEST['page']) ? $_REQUEST['page'] : NULL; $err = ''; if ($page == 'edit_link' && !empty($_REQUEST['id'])) { include dirname(__FILE__).'/edit_link.php'; } elseif ($page == 'edit_cat' && !empty($_REQUEST['id'])) { include dirname(__FILE__).'/edit_cat.php'; } else { $l_label = $l_title = $l_href = $l_lang = ''; $c_title = ''; # Ajout d'un lien if ($action == 'add_link') { $l_label = strip_tags(trim($_POST['l_label'])); $l_title = strip_tags(trim($_POST['l_title'])); $l_href = strip_tags(trim($_POST['l_href'])); $l_lang = strip_tags(trim($_POST['l_lang'])); if (!$l_label || !$l_href) { $err = __('You must provide at least a label and an URL'); } else { if ($blogroll->addLink($l_label,$l_href,$l_title,$l_lang) == false) { $err = $blogroll->con->error(); } else { header('Location: '.$url); exit; } } } # Ajout d'un catégorie elseif ($action == 'add_cat') { $c_title = strip_tags(trim($_POST['c_title'])); if ($c_title) { if ($blogroll->addCat($c_title) == false) { $err = $blogroll->con->error(); } else { header('Location: '.$url); exit; } } } # Suppression elseif (!empty($_POST['delete']) && is_array($_POST['link_ids'])) { $ids = $_POST['link_ids']; foreach ($ids as $id) { if ($blogroll->delEntry((integer)$id) == false) { $err = $blogroll->con->error(); } } if (empty($err)) { header('Location: '.$url); exit; } } # Classic ord if (isset($_POST['linkOrd']) && is_array($_POST['linkOrd'])) { if ($blogroll->ordEntries($_POST['linkOrd']) === false) { $err = $blogroll->con->error(); } else { header('Location: '.$url); exit; } } # DragNdrop if (!empty($_POST['dndSort'])) { $linkOrd = array(); foreach (explode(';',$_POST['dndSort']) as $k => $v) { $linkOrd[substr($v,3)] = $k; } if ($blogroll->ordEntries($linkOrd) === false) { $err = $blogroll->con->error(); } else { header('Location: '.$url); exit; } } # Affichage --- buffer::str('
'.__('Error(s)').' :
'. ''.$err.'
'. ''.__('Drag items to change their positions.').'
'. '' ); buffer::str( ''.__('To replace your static blogroll by this one, just put the '. 'following code in your template:').'
'. '<?php dcBlogroll::linkList(); ?>' ); } ?>