Dotclear

source: admin/blog.php @ 1615:d04ee39c7146

Revision 1615:d04ee39c7146, 3.2 KB checked in by Anne Kozlika <kozlika@…>, 11 years ago (diff)

blog_pref.php: English correction.
blog.php: Warning alert not needed while creating new blog.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
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
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::checkSuper();
16
17$blog_id = '';
18$blog_url = '';
19$blog_name = '';
20$blog_desc = '';
21
22# Create a blog
23if (!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
62if (!empty($_REQUEST['id']))
63{
64     $edit_blog_mode = true;
65     include dirname(__FILE__).'/blog_pref.php';
66}
67else
68{
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     );
77     
78     echo
79     '<form action="blog.php" method="post" id="blog-form">'.
80     
81     '<div>'.$core->formNonce().'</div>'.
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>'.
84     '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p> ';
85
86     if ($blog_id) {
87          echo
88          '<p class="form-note warn">'.__('Please note that changing your blog ID may require changes in your public index.php file.').'</p>';
89     }
90     
91     echo
92     '<p><label class="required" for="blog_name"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog name:').'</label> '.
93     form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</p>'.
94     
95     '<p><label class="required" for="blog_url"><abbr title="'.__('Required field').'">*</abbr> '.__('Blog URL:').'</label> '.
96     form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</p>'.
97     
98     '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label> '.
99     form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'.
100     
101     '<p><input type="submit" accesskey="s" value="'.__('Create').'" /></p>'.
102     '</form>';
103
104     dcPage::close();
105}
106?>
Note: See TracBrowser for help on using the repository browser.

Sites map