[ Index ]
 

Code source de Dotclear 1.2.5

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

title

Body

[fermer]

/ecrire/ -> validpost.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2004 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/prepend.php';
  24  require dirname(__FILE__).'/../inc/incutio/class.httpClient.php';
  25  require dirname(__FILE__).'/../inc/libs/lib.validator.php';
  26  
  27  $auth->check(1);
  28  
  29  include dirname(__FILE__).'/inc/connexion.php';
  30  
  31  openPopup(__('Entry validation'));
  32  
  33  $post_id = (!empty($_GET['post_id'])) ? $_GET['post_id'] : '';
  34  $co_id = (!empty($_GET['co_id'])) ? $_GET['co_id'] : '';
  35  
  36  $is_post = $is_comment = false;
  37  
  38  if ($post_id != '')
  39  {
  40      $post = $blog->getPostByID($post_id);
  41      $is_post = true;
  42      echo '<h2>'.__('Entry validation').'</h2>';
  43  }
  44  elseif ($co_id != '')
  45  {
  46      $comment = $blog->getComment($co_id);
  47      $is_comment = true;
  48      echo '<h2>'.__('Comment validation').'</h2>';
  49  }
  50  
  51  
  52  
  53  if ((empty($post) || $post->isEmpty()) && (empty($comment) || $comment->isEmpty()))
  54  {
  55      echo
  56      '<div class="erreur"><p><strong>'.__('Error(s)').' :</strong></p>'.
  57      '<p>'.($is_post ? __('No entry') : __('No comment')).'</p></div>';
  58  }
  59  else
  60  {
  61      flush();
  62      
  63      if ($post_id != '') {
  64          $content = $post->f('post_chapo')."\n".$post->f('post_content');
  65      } else {
  66          $content = $comment->f('comment_content');
  67      }
  68      
  69      if (($valid = validator::xhtml($content)) === false)
  70      {
  71          echo '<p>'.__('Cannot connect to server.').'</p>';
  72      }
  73      elseif ($valid['valid'] == true)
  74      {
  75          echo '<h3>'.($is_post ? __('Valid entry') : __('Valid comment')).'</h3>';
  76      }
  77      elseif ($valid['valid'] == false)
  78      {
  79          echo '<h3>'.($is_post ? __('Invalid entry') : __('Invalid comment')).'</h3>';
  80          
  81          if ($valid['errors'] != '')
  82          {
  83              echo '<p>'.__('Errors list').'&nbsp;:</p>';
  84              echo $valid['errors'];
  85          }
  86      }
  87      
  88      echo '<p class="small">'.sprintf(__('Validation done with %s'),'WDG HTML Validator').'<br />'.
  89      'http://www.htmlhelp.com/tools/validator/</p>';
  90      echo '<p><img src="images/wdglogo-small.gif" alt="" /></p>';
  91  }
  92  
  93  closePopup();
  94  ?>


Généré le : Fri Feb 23 21:40:15 2007 par Balluche grâce à PHPXref 0.7