예제 #1
0
파일: navbar.php 프로젝트: flyysr/emlog
        emDirect("./navbar.php?error_b=1");
    }
}
if ($action == 'add') {
    $taxis = isset($_POST['taxis']) ? intval(trim($_POST['taxis'])) : 0;
    $naviname = isset($_POST['naviname']) ? addslashes(trim($_POST['naviname'])) : '';
    $url = isset($_POST['url']) ? addslashes(trim($_POST['url'])) : '';
    $pid = isset($_POST['pid']) ? intval($_POST['pid']) : 0;
    $newtab = isset($_POST['newtab']) ? addslashes(trim($_POST['newtab'])) : 'n';
    if ($naviname == '' || $url == '') {
        emDirect("./navbar.php?error_a=1");
    }
    if (!preg_match("/^(http|https|ftp):\\/\\/.*\$/i", $url)) {
        emDirect("./navbar.php?error_f=1");
    }
    $Navi_Model->addNavi($naviname, $url, $taxis, $pid, $newtab);
    $CACHE->updateCache('navi');
    emDirect("./navbar.php?active_add=1");
}
if ($action == 'add_sort') {
    $sort_ids = isset($_POST['sort_ids']) ? $_POST['sort_ids'] : array();
    $sorts = $CACHE->readCache('sort');
    if (empty($sort_ids)) {
        emDirect("./navbar.php?error_d=1");
    }
    foreach ($sort_ids as $val) {
        $sort_id = intval($val);
        $Navi_Model->addNavi(addslashes($sorts[$sort_id]['sortname']), '', 0, 0, 'n', Navi_Model::navitype_sort, $sort_id);
    }
    $CACHE->updateCache('navi');
    emDirect("./navbar.php?active_add=1");