Пример #1
0
}
$database = new Database();
$user = new User();
$menu = new Menu();
$links = new Links();
$pages = new Page();
$category = new Category();
if (isset($_POST['pageId']) && $_POST['pageId'] != "" && isset($_POST['menuId']) && $_POST['menuId'] != "" && isset($_POST['isCategory']) && $_POST['isCategory'] == "false") {
    // add pages to the menu
    $menuId = $database->escapeString($_POST['menuId']);
    $appearName = $database->escapeString($_POST['appearName']);
    $links->setMenuId($menuId);
    $links->setCategoryId(0);
    $links->setIsCustomLink(0);
    $links->setHttp("");
    $startPos = $links->numByMenu($database) + 1;
    foreach ($_POST['pageId'] as $id) {
        if ($appearName == "") {
            $pages->setPageId($id);
            $pages->getById($database);
            $links->setAppearName($pages->getPageName());
        } else {
            $links->setAppearName($appearName);
        }
        $links->setPosition($startPos);
        $links->setPageId($id);
        $links->create($database);
        $startPos++;
    }
    echo "true";
} else {