芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/status.pulsehost.co.uk/app/controllers/admin/AdminBlogPostCreate.php
where('url', $_POST['url'])->where('language', $_POST['language'])->has('blog_posts')) { Alerts::add_field_error('url', l('admin_blog.error_message.url_exists')); } $image_new_name = \Altum\Uploads::process_upload(null, 'blog', 'image', 'image_remove', null); /* If there are no errors, continue */ if(!Alerts::has_field_errors() && !Alerts::has_errors()) { /* Database query */ db()->insert('blog_posts', [ 'blog_posts_category_id' => $_POST['blog_posts_category_id'], 'url' => $_POST['url'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'keywords' => $_POST['keywords'], 'image' => $image_new_name ?? null, 'image_description' => $_POST['image_description'], 'editor' => $_POST['editor'], 'content' => $_POST['content'], 'language' => $_POST['language'], 'is_published' => $_POST['is_published'], 'datetime' => get_date(), ]); /* Set a nice success message */ Alerts::add_success(sprintf(l('global.success_message.create1'), '
' . $_POST['title'] . '
')); /* Clear the cache */ cache()->deleteItemsByTag('blog_posts'); redirect('admin/blog-posts'); } } /* Get the blog posts categories available */ $blog_posts_categories = db()->get('blog_posts_categories', null, ['blog_posts_category_id', 'title']); /* Set default values */ $values = [ 'blog_posts_category_id' => $_POST['blog_posts_category_id'] ?? '', 'title' => $_POST['title'] ?? '', 'url' => $_POST['url'] ?? '', 'description' => $_POST['description'] ?? '', 'image_description' => $_POST['image_description'] ?? '', 'keywords' => $_POST['keywords'] ?? '', 'editor' => $_POST['editor'] ?? 'blocks', 'content' => $_POST['content'] ?? '', 'language' => $_POST['language'] ?? '', 'is_published' => $_POST['is_published'] ?? '', ]; $data = [ 'values' => $values, 'blog_posts_categories' => $blog_posts_categories ]; /* Main View */ $view = new \Altum\View('admin/blog-post-create/index', (array) $this); $this->add_view_content('content', $view->run($data)); } }