'."\n". '.sort img.status {float: right; margin: 2px 0 0 4px; position: relative;}'."\n". ''."\n". ''. ''. ''; $blogroll = new blogroll($blog,DB_PREFIX); $action = !empty($_REQUEST['action']) ? $_REQUEST['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 = trim($_POST['l_label']); $l_title = trim($_POST['l_title']); $l_href = trim($_POST['l_href']); $l_lang = 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 = trim($_POST['c_title']); if ($c_title) { if ($blogroll->addCat($c_title) == false) { $err = $blogroll->con->error(); } else { header('Location: '.$url); exit; } } } # Suppression elseif ($action == 'delete' && !empty($_GET['id'])) { if ($blogroll->delEntry($_GET['id']) == false) { $err = $blogroll->con->error(); } else { 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('

'.__('Links manager').'

'); if ($err != '') { buffer::str( '

'.__('Error(s)').' :

'. '

'.$err.'

'. '
' ); } $strReq = 'SELECT link_id, label, href, title, lang, position '. 'FROM '.$blogroll->table.' '. 'ORDER BY position '; $rs = $con->select($strReq); buffer::str( '

'.__('Drag items to change their positions.').'

'. '
'. ''. '

'. '

'. '
' ); buffer::str( '
'. '
'.__('New link').''. '

'. ''. form::field('l_label',40,255,htmlspecialchars($l_label)).'

'. '

'. ''. form::field('l_href',40,255,htmlspecialchars($l_href)).'

'. '

'. ''. form::field('l_title',40,255,htmlspecialchars($l_title)).'

'. '

'. ''. form::field('l_lang',2,2,htmlspecialchars($l_lang)) . '

'. '

'.form::hidden('action','add_link'). '

'. '
'. '
' ); buffer::str( '
'. '
'.__('New rubric').''. '

'. ''. form::field('c_title',40,255,htmlspecialchars($c_title)).'

'. '

'.form::hidden('action','add_cat'). '

'. '
'. '
' ); buffer::str( '

'.__('Usage').'

'. '

'.__('To replace your static blogroll by this one, just put the '. 'following code in your template:').'

'. '
<?php dcBlogroll::linkList(); ?>
' ); } ?>