[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | |
---|
| 13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
| 14 | |
---|
| 15 | dcPage::checkSuper(); |
---|
| 16 | |
---|
| 17 | $blog_id = ''; |
---|
| 18 | $blog_url = ''; |
---|
| 19 | $blog_name = ''; |
---|
| 20 | $blog_desc = ''; |
---|
| 21 | |
---|
| 22 | # Create a blog |
---|
| 23 | if (!isset($_POST['id']) && !empty($_POST['blog_id'])) |
---|
| 24 | { |
---|
| 25 | $cur = $core->con->openCursor($core->prefix.'blog'); |
---|
| 26 | $blog_id = $cur->blog_id = $_POST['blog_id']; |
---|
| 27 | $blog_url = $cur->blog_url = $_POST['blog_url']; |
---|
| 28 | $blog_name = $cur->blog_name = $_POST['blog_name']; |
---|
| 29 | $blog_desc = $cur->blog_desc = $_POST['blog_desc']; |
---|
| 30 | |
---|
| 31 | try |
---|
| 32 | { |
---|
| 33 | # --BEHAVIOR-- adminBeforeBlogCreate |
---|
| 34 | $core->callBehavior('adminBeforeBlogCreate',$cur,$blog_id); |
---|
| 35 | |
---|
| 36 | $core->addBlog($cur); |
---|
| 37 | |
---|
| 38 | # Default settings and override some |
---|
| 39 | $core->blogDefaults($cur->blog_id); |
---|
| 40 | $blog_settings = new dcSettings($core,$cur->blog_id); |
---|
| 41 | $blog_settings->addNamespace('system'); |
---|
| 42 | $blog_settings->system->put('lang',$core->auth->getInfo('user_lang')); |
---|
| 43 | $blog_settings->system->put('blog_timezone',$core->auth->getInfo('user_tz')); |
---|
| 44 | |
---|
| 45 | if (substr($blog_url,-1) == '?') { |
---|
| 46 | $blog_settings->system->put('url_scan','query_string'); |
---|
| 47 | } else { |
---|
| 48 | $blog_settings->system->put('url_scan','path_info'); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | # --BEHAVIOR-- adminAfterBlogCreate |
---|
| 52 | $core->callBehavior('adminAfterBlogCreate',$cur,$blog_id,$blog_settings); |
---|
| 53 | |
---|
| 54 | http::redirect('blog.php?id='.$cur->blog_id.'&add=1'); |
---|
| 55 | } |
---|
| 56 | catch (Exception $e) |
---|
| 57 | { |
---|
| 58 | $core->error->add($e->getMessage()); |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | if (!empty($_REQUEST['id'])) |
---|
| 63 | { |
---|
| 64 | $edit_blog_mode = true; |
---|
| 65 | include dirname(__FILE__).'/blog_pref.php'; |
---|
| 66 | } |
---|
| 67 | else |
---|
| 68 | { |
---|
[1358] | 69 | dcPage::open(__('New blog'),dcPage::jsConfirmClose('blog-form'), |
---|
| 70 | dcPage::breadcrumb( |
---|
| 71 | array( |
---|
| 72 | __('System') => '', |
---|
| 73 | __('Blogs') => 'blogs.php', |
---|
| 74 | '<span class="page-title">'.__('New blog').'</span>' => '' |
---|
| 75 | )) |
---|
| 76 | ); |
---|
[1328] | 77 | |
---|
[0] | 78 | echo |
---|
[1399] | 79 | '<form action="blog.php" method="post" id="blog-form">'. |
---|
[0] | 80 | |
---|
[1482] | 81 | '<div>'.$core->formNonce().'</div>'. |
---|
[1399] | 82 | '<p><label class="required" for="blog_id"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog ID:').'</label> '. |
---|
| 83 | form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</p>'. |
---|
[133] | 84 | '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> '. |
---|
| 85 | '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>'. |
---|
[0] | 86 | |
---|
[1399] | 87 | '<p><label class="required" for="blog_name"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label> '. |
---|
| 88 | form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>'. |
---|
[0] | 89 | |
---|
[1399] | 90 | '<p><label class="required" for="blog_url"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label> '. |
---|
| 91 | form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</p>'. |
---|
[0] | 92 | |
---|
| 93 | '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label> '. |
---|
| 94 | form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'. |
---|
| 95 | |
---|
[1280] | 96 | '<p><input type="submit" accesskey="s" value="'.__('Create').'" /></p>'. |
---|
[0] | 97 | '</form>'; |
---|
[12] | 98 | |
---|
[0] | 99 | dcPage::close(); |
---|
| 100 | } |
---|
| 101 | ?> |
---|