[ Index ]
 

Code source de Dotclear 2.0-beta6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/admin/ -> blog.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2005 Olivier Meunier and contributors. All rights
   5  # reserved.
   6  #
   7  # DotClear is free software; you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation; either version 2 of the License, or
  10  # (at your option) any later version.
  11  # 
  12  # DotClear is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  # 
  17  # You should have received a copy of the GNU General Public License
  18  # along with DotClear; if not, write to the Free Software
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  #
  21  # ***** END LICENSE BLOCK *****
  22  
  23  require dirname(__FILE__).'/../inc/admin/prepend.php';
  24  
  25  dcPage::checkSuper();
  26  
  27  $blog_id = '';
  28  $blog_url = '';
  29  $blog_name = '';
  30  $blog_desc = '';
  31  
  32  # Create a blog
  33  if (!isset($_POST['id']) && !empty($_POST['blog_id']))
  34  {
  35      $cur = $core->con->openCursor($core->prefix.'blog');
  36      $blog_id = $cur->blog_id = $_POST['blog_id'];
  37      $blog_url = $cur->blog_url = $_POST['blog_url'];
  38      $blog_name = $cur->blog_name = $_POST['blog_name'];
  39      $blog_desc = $cur->blog_desc = $_POST['blog_desc'];
  40      
  41      try {
  42          $core->addBlog($cur);
  43          
  44          # Default settings and override some
  45          $core->blogDefaults($cur->blog_id);
  46          $blog_settings = new dcSettings($core,$cur->blog_id);
  47          $blog_settings->setNameSpace('system');
  48          $blog_settings->put('lang',$core->auth->getInfo('user_lang'));
  49          $blog_settings->put('blog_timezone',$core->auth->getInfo('user_tz'));
  50          
  51          if (substr($blog_url,-1) == '?') {
  52              $blog_settings->put('url_scan','query_string');
  53          } else {
  54              $blog_settings->put('url_scan','path_info');
  55          }
  56          
  57          http::redirect('blog.php?id='.$cur->blog_id.'&add=1');
  58      } catch (Exception $e) {
  59          $core->error->add($e->getMessage());
  60      }
  61  }
  62  
  63  if (!empty($_REQUEST['id']))
  64  {
  65      $edit_blog_mode = true;
  66      include dirname(__FILE__).'/blog_pref.php';
  67  }
  68  else
  69  {
  70      dcPage::open(__('New blog'),dcPage::jsConfirmClose('blog-form'));
  71      
  72      echo
  73      '<h2><a href="blogs.php">'.__('Blogs').'</a> &gt; '.__('New blog').'</h2>'.
  74      
  75      '<form action="blog.php" method="post" id="blog-form">'.
  76      
  77      '<fieldset><legend>'.__('Blog details').'</legend>'.
  78      '<p><label class="required" title="'.__('Required field').'">'.__('Blog ID:').' '.
  79      form::field('blog_id',30,32,html::escapeHTML($blog_id)).'</label></p>'.
  80      '<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p>'.
  81      
  82      '<p><label class="required" title="'.__('Required field').'">'.__('Blog name:').' '.
  83      form::field('blog_name',30,255,html::escapeHTML($blog_name)).'</label></p>'.
  84      
  85      '<p><label class="required" title="'.__('Required field').'">'.__('Blog URL:').' '.
  86      form::field('blog_url',30,255,html::escapeHTML($blog_url)).'</label></p>'.
  87      
  88      '<p class="area"><label for="blog_desc">'.__('Blog description:').'</label> '.
  89      form::textarea('blog_desc',60,5,html::escapeHTML($blog_desc)).'</p>'.
  90      '</fieldset>'.
  91      
  92      '<p><input type="submit" accesskey="s" value="'.__('save').'" /></p>'.
  93      '</form>';
  94      
  95      dcPage::close();
  96  }
  97  ?>


Généré le : Fri Feb 23 22:16:06 2007 par Balluche grâce à PHPXref 0.7