芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/status.pulsehost.co.uk/app/controllers/admin/AdminPageCreate.php
where('url', $_POST['url'])->where('language', $_POST['language'])->has('pages')) { Alerts::add_field_error('url', l('admin_resources.error_message.url_exists')); } /* If there are no errors, continue */ if(!Alerts::has_field_errors() && !Alerts::has_errors()) { /* Database query */ db()->insert('pages', [ 'pages_category_id' => $_POST['pages_category_id'], 'url' => $_POST['url'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'icon' => $_POST['icon'], 'keywords' => $_POST['keywords'], 'editor' => $_POST['editor'], 'content' => $_POST['content'], 'type' => $_POST['type'], 'position' => $_POST['position'], 'language' => $_POST['language'], 'open_in_new_tab' => $_POST['open_in_new_tab'], 'order' => $_POST['order'], 'is_published' => $_POST['is_published'], 'datetime' => get_date(), 'last_datetime' => get_date(), ]); /* Clear the cache */ cache()->deleteItem('pages_' . $_POST['position']); cache()->deleteItemsByTag('pages'); /* Set a nice success message */ Alerts::add_success(sprintf(l('global.success_message.create1'), '
' . $_POST['title'] . '
')); redirect('admin/pages'); } } /* Get the pages categories available */ $pages_categories = db()->get('pages_categories', null, ['pages_category_id', 'title']); /* Set default values */ $values = [ 'pages_category_id' => $_POST['pages_category_id'] ?? '', 'title' => $_POST['title'] ?? '', 'url' => $_POST['url'] ?? '', 'description' => $_POST['description'] ?? '', 'keywords' => $_POST['keywords'] ?? '', 'editor' => $_POST['editor'] ?? 'blocks', 'content' => $_POST['content'] ?? '', 'type' => $_POST['type'] ?? 'internal', 'position' => $_POST['position'] ?? 'top', 'language' => $_POST['language'] ?? '', 'icon' => $_POST['icon'] ?? '', 'order' => $_POST['order'] ?? 0, 'open_in_new_tab' => $_POST['open_in_new_tab'] ?? 1, 'is_published' => $_POST['is_published'] ?? 1, ]; $data = [ 'values' => $values, 'pages_categories' => $pages_categories ]; /* Main View */ $view = new \Altum\View('admin/page-create/index', (array) $this); $this->add_view_content('content', $view->run($data)); } }