$info .= lng('WRITE_FAIL') . ' ( ' . MCR_ROOT . 'config.php )'; } } $game_lver = sqlConfigGet('launcher-version'); $game_build = sqlConfigGet('latest-game-build'); $cat_list = '<option value="-1">' . lng('NEWS_LAST') . '</option>'; $cat_list .= CategoryManager::GetList($config['game_news']); include View::Get('game.html', $st_subdir); break; case 'category': $name = Filter::input('name'); $priority = Filter::input('lvl', 'post', 'int'); $desc = Filter::input('desc'); if (!$id and $name) { $new_category = new Category(); if ($new_category->Create($name, $priority, $desc)) { $info .= lng('CAT_COMPLITE'); } else { $info .= lng('CAT_EXIST'); } } elseif ($id and $name and Filter::input('edit', 'post', 'bool')) { $category = new Category($id); if ($category->Edit($name, $priority, $desc)) { $info .= lng('CAT_UPDATED'); } else { $info .= lng('CAT_EXIST'); } } elseif ($id and Filter::input('delete', 'post', 'bool')) { $category = new Category($id); if ($category->Delete()) { $info .= lng('CAT_DELETED');
$message = null; /************************** Handle create category form **************************/ if (isset($_POST['submitted_add'])) { try { // Validate title if (empty($_POST['cat_name']) || ctype_space($_POST['cat_name'])) { throw new Exception('Invalid category name. Please try again.'); } $data['slug'] = Functions::CreateSlug(trim($_POST['cat_name'])); $data['cat_name'] = htmlspecialchars(trim($_POST['cat_name'])); if (Category::Exist(array('slug' => $data['slug']))) { throw new Exception('Category name or slug already exists. Please note that in the slug special characters are replaced by hyphens.'); } Category::Create($data); $message = $data['cat_name'] . ' was successfully created.'; $message_type = 'success'; unset($data); } catch (Exception $e) { $errors['cat_name'] = true; $message = $e->getMessage(); $message_type = 'error'; } } /******************************* Handle move/delete category form *******************************/ if (isset($_POST['submitted_edit'])) { // Validate move category if (isset($_POST['move']) && is_numeric($_POST['move']) && Category::Exist(array('cat_id' => $_POST['move']))) {