[ Index ]
 

Code source de Dotclear 1.2.5

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

title

Body

[fermer]

/ecrire/ -> poster.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  
  25  $auth->check(1);
  26  
  27  include dirname(__FILE__).'/inc/connexion.php';
  28  
  29  # Tableau des mois de l'année
  30  for ($i=1;$i<=12;$i++) {
  31      $m = sprintf('%02d',$i);
  32      $arry_dt_m[dt::str('%B',strtotime('2000-'.$m.'-01'))] = $m;
  33  }
  34  
  35  # Les catégories du blog
  36  $cat_id = (!empty($_GET['cat_id'])) ? $_GET['cat_id'] : '';
  37  
  38  $rsCat = $blog->getCat();
  39  while (!$rsCat->EOF())
  40  {
  41      $arry_cat[$rsCat->f('cat_libelle')] = $rsCat->f('cat_id');
  42      $rsCat->moveNext();
  43  }
  44  
  45  # Valeurs par défaut
  46  $err = '';
  47  $titre = '';
  48  $titre_url = '';
  49  $cat_id = $_SESSION['sess_user_pref_cat'];
  50  $dt_m = $dt_d = $dt_y = '';
  51  $chapo = $preview_chapo = '';
  52  $content = $preview_content = '';
  53  $notes = '';
  54  $is_editable = true;
  55  $format = $_SESSION['sess_user_format'];
  56  $etat = $_SESSION['sess_user_post_pub'];
  57  $open_comment = 1;
  58  $open_tb = 1;
  59  $lang = DC_LANG;
  60  $selected = 0;
  61  $return_link = 'index.php';
  62  $do_trackbacks = false;
  63  
  64  $objWiki = new wiki2xhtml();
  65  if (dc_encoding != 'UTF-8') {
  66      $objWiki->setOpt('active_fix_word_entities',1);
  67  }
  68  
  69  # Billet existant
  70  if (!empty($_REQUEST['post_id']))
  71  {
  72      $post = $blog->getPostById($_REQUEST['post_id']);
  73      if (!$post->isEmpty())
  74      {
  75          $post_id = $post->f('post_id');
  76          $titre = $post->f('post_titre');
  77          $titre_url = $post->f('post_titre_url');
  78          $cat_id = $post->f('cat_id');
  79          $format = $post->getFormat();
  80          $etat = (integer) $post->f('post_pub');
  81          $open_comment = (integer) $post->f('post_open_comment');
  82          $open_tb = (integer) $post->f('post_open_tb');
  83          $lang = $post->f('post_lang');
  84          $selected = $post->f('post_selected');
  85          $chapo = ($post->f('post_chapo_wiki') != '') ? $post->f('post_chapo_wiki') : $post->f('post_chapo');
  86          $preview_chapo = $post->f('post_chapo');
  87          $content = ($post->f('post_content_wiki') != '') ? $post->f('post_content_wiki') : $post->f('post_content');
  88          $notes = $post->f('post_notes');
  89          $preview_content = $post->f('post_content');
  90          $return_link = 'index.php?m='.$post->f('postyear').$post->f('postmonth').'#p'.$post_id;
  91          $post_ts = $post->getTS();
  92          $post_perm_url =  $post->getPermURL();
  93          $dt_y = date('Y',$post_ts);
  94          $dt_m = date('m',$post_ts);
  95          $dt_d = date('d',$post_ts);
  96          $dt_h = (string) date('H',$post_ts);
  97          $dt_i = (string) date('i',$post_ts);
  98          $dt_s = (string) date('s',$post_ts);
  99          
 100          $objWiki->setOpt('note_prefix','pnote-'.$post_id);
 101          
 102          $comments = $blog->getComments($post_id);
 103          
 104          # Le post n'est éditable que par un admin ou son rédacteur,
 105          # qu'on se le dise !
 106          if ($post->f('user_id') != $_SESSION['sess_user_id'] && $_SESSION['sess_user_level'] < 9) {
 107              $is_editable = false;
 108          }
 109          
 110          # Changement du status ou suppression d'un commentaire
 111          if (!empty($_GET['comment_id']))
 112          {
 113              if ($is_editable) {
 114                  if (!empty($_GET['comment_del'])) {
 115                      if ($blog->delComment($_GET['comment_id']) !== false) {
 116                          header('Location: poster.php?post_id='.$post_id.'#comments');
 117                          exit;
 118                      } else {
 119                          $err = $blog->error(1);
 120                      }
 121                  } else {                
 122                      if ($blog->statusComment($_GET['comment_id']) !== false) {
 123                          header('Location: poster.php?post_id='.$post_id.'#c'.$_GET['comment_id']);
 124                          exit;
 125                      } else {
 126                          $err = $blog->error(1);
 127                      }
 128                  }
 129              } else {
 130                  $err = '<ul><li>'.__('You are not allowed to edit a comment').'</li></ul>';
 131              }
 132          }
 133          
 134          # Ajout d'un commentaire
 135          if (!empty($_POST['add_comment']))
 136          {
 137                 if ($blog->addComment($post_id,$_POST['com_nom'],
 138              $_POST['com_email'],$_POST['com_web'],$_POST['com_content']) !== false) {
 139                  header('Location: poster.php?post_id='.$post_id.'#comments');
 140                  exit;
 141              } else {
 142                  $err = $blog->error(1);
 143              }
 144          }
 145          
 146          # Changement du status d'un billet
 147          if (!empty($_GET['cancel']) && $is_editable)
 148          {
 149              if ($blog->statusPost($post_id) !== false) {
 150                  header('Location: '.$return_link);
 151                  exit;
 152              } else {
 153                  $err = $blog->error(1);
 154              }
 155          }
 156          
 157          # Suppression d'un billet
 158          if (!empty($_POST['delete']) && $is_editable)
 159          {
 160              if ($blog->delPost($post_id) !== false) {
 161                  $msg = __('Entry successfully removed');
 162                  header('Location: index.php?msg='.urlencode($msg));
 163                  exit;
 164              } else {
 165                  $err = $blog->error(1);
 166              }
 167          }
 168      }
 169  }
 170  
 171  # Valeurs pour la prévisualisation, la création ou la modification d'un billet
 172  if (!empty($_POST['preview']) || !empty($_POST['publish']) || !empty($_POST['transform']))
 173  {
 174      $titre = $_POST['p_titre'];
 175      $titre_url = $_POST['p_titre_url'];
 176      $cat_id = $_POST['p_cat'];
 177      $format = $_POST['p_format'];
 178      $etat = $_POST['p_etat'];
 179      $open_comment = $_POST['p_open_comment'];
 180      $open_tb = $_POST['p_open_tb'];
 181      $lang = $_POST['p_lang'];
 182      $selected = $_POST['p_selected'];
 183      $content = $_POST['p_content'];
 184      $notes = $_POST['p_notes'];
 185      $chapo = $_POST['p_chapo'];
 186      $do_trackbacks = !empty($_POST['p_do_trackbacks']) ? true : false;
 187      
 188      if (!empty($post_id))
 189      {
 190          $dt_y = (string) sprintf('%04d',$_POST['p_dt_y']);
 191          $dt_m = (string) sprintf('%02d',$_POST['p_dt_m']);
 192          $dt_d = (string) sprintf('%02d',$_POST['p_dt_d']);
 193          $dt_h = (string) sprintf('%02d',$_POST['p_dt_h']);
 194          $dt_i = (string) sprintf('%02d',$_POST['p_dt_i']);
 195          $dt_s = (string) sprintf('%02d',$_POST['p_dt_s']);
 196          
 197          # Corrections jour & heure
 198          if ($dt_d > 31 || $dt_d < 1) { $dt_d = '01'; }
 199          if ($dt_h > 23 || $dt_h < 0) { $dt_h = '00'; }
 200          if ($dt_i > 59 || $dt_i < 0) { $dt_i = '00'; }
 201          if ($dt_s > 59 || $dt_s < 0) { $dt_s = '00'; }
 202          
 203          $new_date = strtotime($dt_y.'-'.$dt_m.'-'.$dt_d.' '.$dt_h.':'.$dt_i.':'.$dt_s);
 204      }
 205      
 206      if (strpos($lang,'fr') === 0) {
 207          $objWiki->setOpt('active_fr_syntax',1);
 208      }
 209      
 210      if (!empty($_POST['transform'])) {
 211          $format = 'html';
 212          $content = $objWiki->transform($content);
 213          $chapo = $objWiki->transform($chapo);
 214      }
 215      
 216      if ($format == 'wiki') {
 217          $preview_content = $objWiki->transform($content);
 218          $preview_chapo = $objWiki->transform($chapo);
 219      } else {
 220          $preview_content = $content;
 221          $preview_chapo = $chapo;
 222      }
 223  }
 224  
 225  # Insertion ou modification d'un billet
 226  if (!empty($_POST['publish']))
 227  {
 228      # Insertion
 229      if (empty($post_id))
 230      {
 231          if (($post_id = $blog->addPost($_SESSION['sess_user_id'],$titre,$titre_url,$chapo,$content,
 232          $notes,$cat_id,$format,$etat,$open_comment,$open_tb,$lang,$selected,
 233          $_SESSION['sess_user_delta'])) !== false) {
 234              if ($do_trackbacks) {
 235                  $return_link = 'trackback.php?post_id='.$post_id.'&auto=1';
 236              } else {
 237                  $return_link = 'poster.php?post_id='.$post_id;
 238              }
 239              header('Location: '.$return_link);
 240              exit;
 241          } else {
 242              $err = $blog->error(1);
 243          }
 244      }
 245      else
 246      {
 247          if ($is_editable) {
 248              if ($blog->updPost($post_id,$titre,$titre_url,$chapo,$content,$notes,$cat_id,
 249              $format,$etat,$open_comment,$open_tb,$new_date,$lang,$selected,
 250              $_SESSION['sess_user_delta']) !== false ) {
 251                  if ($do_trackbacks) {
 252                      $return_link = 'trackback.php?post_id='.$post_id.'&auto=1';
 253                  } else {
 254                      $return_link = 'poster.php?post_id='.$post_id;
 255                  }
 256                  header('Location: '.$return_link);
 257                  exit;
 258              } else {
 259                  $err = $blog->error(1);
 260              }
 261          }
 262      }
 263  }
 264  
 265  # Création du sous-menu
 266  $mySubMenu->addItem(__('Back to list of entries'),$return_link,'images/ico_retour.png',false);
 267  
 268  if (!empty($content) && !empty($post_id) && 
 269  empty($_POST['preview']) && empty($_POST['publish']) && $is_editable)
 270  {
 271      $mySubMenu->addItem(
 272      __('New entry'),array('poster.php','accesskey="n"'),
 273      'images/ico_edit.png',false);
 274      
 275      $mySubMenu->addItem(
 276          __('XHTML validation'),
 277          array('validpost.php?post_id='.$post_id,'onclick="popup(this.href); return false;"'),
 278          'images/ico_ok.png',false);
 279      
 280      $mySubMenu->addItem(
 281          __('Trackbacks'),
 282          'trackback.php?post_id='.$post_id,
 283          'images/ico_link.png',false);
 284      
 285      $mySubMenu->addItem(
 286          __('View entry'),$post_perm_url,
 287          'images/ico_goto.png',false);
 288  }
 289  
 290  
 291  openPage(__('Entry'),
 292  '<script type="text/javascript" src="js/form.js"></script>'."\n".
 293  '<script type="text/javascript">'."\n".
 294  "window.onload = function() {\n".
 295  " openCloseOptions('moreOptions','dc_options');\n".
 296  " getCurrentForms(); addFormsEvent();\n".
 297  " closePagePrompt = '".str_replace("'","\'",__('You have unsaved changes.'))."';\n".
 298  "}\n".
 299  "window.onbeforeunload = confirmCloseForms;\n".
 300  "</script>\n"
 301  );
 302  
 303  if ($err != '')
 304  {
 305      echo '<div class="erreur"><p><strong>'.__('Error(s)').' :</strong></p>'.
 306          $err.'</div>';
 307  }
 308  
 309  echo '<h2>'.__('Entry').'</h2>';
 310  
 311  /* Entry preview
 312  -------------------------------------------------------- */
 313  if (!empty($content) && dc_show_previews)
 314  {
 315      if (!empty($_POST['preview'])) {
 316          $preview_titre = htmlspecialchars($titre);
 317      } else {
 318          $preview_titre = $titre;
 319      }
 320      
 321      echo '<div class="cadre preview clear">'.
 322          '<h3>'.$titre.'</h3>'.
 323          ((trim($preview_chapo) != '') ? $preview_chapo.'<hr class="thin" />' : '').
 324          $preview_content.'</div>';
 325      
 326      if (!empty($post_perm_url)) {
 327          echo '<p class="clear"><strong>'.
 328          __('Permanent link').'</strong>&nbsp;: '.
 329          util::getPageURL($post_perm_url).'</p>';
 330      }
 331  }
 332  
 333  if (!empty($_POST['preview'])) {
 334      $titre = htmlspecialchars($titre);
 335  }
 336  
 337  /* Valeurs pouvant être passées en URL par un bookmarklet
 338  -------------------------------------------------------- */
 339  if (!empty($_GET['dcb']))
 340  {
 341      $purl = !empty($_GET['purl']) ? $_GET['purl'] : '';
 342      $ptitle = !empty($_GET['ptitle']) ? $_GET['ptitle'] : '';
 343      $ptext = !empty($_GET['ptext']) ? $_GET['ptext'] : '';
 344      
 345      $titre = $ptitle;
 346      
 347      if ($format == 'wiki') {
 348          $content = '['.$ptitle.'|'.$purl."]\n\n".$ptext;
 349      } else {
 350          $content = '<a href="'.$purl.'">'.$ptitle."</a>\n\n<p>".$ptext.'</p>';
 351      }
 352      
 353  }
 354  
 355  
 356  /* Entry form
 357  -------------------------------------------------------- */
 358  if ($is_editable)
 359  {
 360      echo '<form action="poster.php" method="post" id="formPost">';
 361      
 362      echo '<table class="clear post-entry-info">';
 363      echo
 364      '<tr><td><label for="p_cat">'.
 365      __('Category').' '.helpLink('entry','category').'</label></td> '.
 366      '<td>'.form::combo('p_cat',$arry_cat,$cat_id,'','',1).'</td>';
 367      
 368      echo
 369      '<td><label for="p_format">'.
 370      __('Format').' '.helpLink('entry','format').'</label></td> '.
 371      '<td>'.form::combo('p_format',array('HTML'=>'html','Wiki'=>'wiki'),$format,'','',2).'</td>';
 372      
 373      echo
 374      '<td><label for="p_etat">'.
 375      __('Status').' '.helpLink('entry','status').'</label></td> '.
 376      '<td>'.form::combo('p_etat',array(__('Online')=>'1',__('Offline')=>'0'),$etat,'','',3).'</td></tr>';
 377      
 378      echo '</table>';
 379      
 380      echo
 381      '<p><label for="p_titre"><strong>'.__('Title').'</strong> '.
 382      helpLink('entry','title').'</label> '.
 383      form::field('p_titre',30,255,$titre,4,'class="max"').'</p>';
 384      
 385      echo
 386      '<p><label for="p_chapo">'.__('Abstract').' ('.__('optional').') '.
 387      helpLink('entry','abstract').'</label> '.
 388      form::textArea('p_chapo',60,4,htmlspecialchars($chapo),5,'class="max"').'</p>';
 389      
 390      echo
 391      '<p>'.
 392      '<label for="p_content"><strong>'.__('Entry').' '.helpLink('entry','entry').'</strong>'.
 393      ' - '.helpLink('wiki2xhtml','',__('Wiki formatting rules')).'</label>'.
 394      '</p>'.
 395      
 396      '<p>'.form::textArea('p_content',60,$_SESSION['sess_user_edit_size'],
 397      htmlspecialchars($content),6,'class="max"').'</p>';
 398      
 399      # Toolbar
 400      echo
 401      '<script type="text/javascript" src="js/toolbar.js"></script>'.
 402      '<script type="text/javascript">'.
 403      "if (document.getElementById) {
 404          var tb = new dcToolBar(document.getElementById('p_content'),
 405          document.getElementById('p_format'),'images/');
 406          
 407          tb.btStrong('".str_replace("'","\'",__('Strong emphasis'))."');
 408          tb.btEm('".str_replace("'","\'",__('Emphasis'))."');
 409          tb.btIns('".str_replace("'","\'",__('Inserted'))."');
 410          tb.btDel('".str_replace("'","\'",__('Deleted'))."');
 411          tb.btQ('".str_replace("'","\'",__('Inline quote'))."');
 412          tb.btCode('".str_replace("'","\'",__('Code'))."');
 413          tb.addSpace(10);
 414          tb.btBr('".str_replace("'","\'",__('Line break'))."');
 415          tb.addSpace(10);
 416          tb.btBquote('".str_replace("'","\'",__('Blockquote'))."');
 417          tb.btPre('".str_replace("'","\'",__('Preformated text'))."');
 418          tb.btList('".str_replace("'","\'",__('Unordered list'))."','ul');
 419          tb.btList('".str_replace("'","\'",__('Ordered list'))."','ol');
 420          tb.addSpace(10);
 421          tb.btLink('".str_replace("'","\'",__('Link'))."',
 422              '".str_replace("'","\'",__('URL?'))."',
 423              '".str_replace("'","\'",__('Language?'))."',
 424              '".DC_LANG."');
 425          tb.btImgLink('".str_replace("'","\'",__('External image'))."',
 426              '".str_replace("'","\'",__('URL?'))."');
 427          tb.addSpace(10);
 428          tb.btImg('".str_replace("'","\'",__('Internal image'))."','images-popup.php');
 429          tb.draw('".str_replace("'","\'",__('You can use the following shortcuts to refine your layout.'))."');
 430      }
 431      </script>";
 432      # Fin toolbar
 433      
 434      echo
 435      '<h3 class="moreOptions">'.
 436      '<a href="#" onclick="openCloseOptions(\'moreOptions\',\'dc_options\',0); return false;">'.
 437      '<img src="images/plus.png" id="img_moreOptions" '.
 438      'alt="" /></a>'.
 439      ' <a href="#" onclick="openCloseOptions(\'moreOptions\',\'dc_options\',0); return false;">'.
 440      __('More options').'</a></h3>';
 441      
 442      echo
 443      '<div id="moreOptions" class="moreOptions">'.
 444      '<p><label for="p_notes">'.__('Notepad').' '.helpLink('entry','notepad').'</label>'.
 445      form::textArea('p_notes',30,6,htmlspecialchars($notes),7,'class="max"').'</p>';
 446      
 447      echo
 448      '<p><label for="p_titre_url">'.__('URLed title').' '.
 449      helpLink('entry','title_url').
 450      ' <a href="#" '.
 451      'onclick="document.forms[0].p_titre_url.value=str2url(document.forms[0].p_titre.value,\''.dc_encoding.'\'); return false;">'.
 452      __('Use').'</a></label> '.
 453      form::field('p_titre_url',30,255,htmlspecialchars($titre_url),8,'class="max"').'</p>';
 454      
 455      if (!empty($post_id))
 456      {
 457          echo
 458          '<p><label class="inline" for="p_dt_d">'.__('Date').'</label> '.
 459          form::field('p_dt_d',2,2,$dt_d,9).' '.
 460          form::combo('p_dt_m',$arry_dt_m,$dt_m,'','',10).' '.
 461          form::field('p_dt_y',4,4,$dt_y,11).' '.
 462          '<label class="inline" for="p_dt_h">'.__('Hour').'</label> '.
 463          form::field('p_dt_h',2,2,$dt_h,12).':'.
 464          form::field('p_dt_i',2,2,$dt_i,13).':'.
 465          form::field('p_dt_s',2,2,$dt_s,14).' '.
 466          "<a href=\"#\" onclick=\"setNow(); return false;\">".__('now').'</a> '.
 467          helpLink('entry','datetime').
 468          '</p>';
 469      }
 470      
 471      echo '<table class="clear post-entry-info">';
 472      
 473      echo
 474      '<tr><td><label for="p_lang">'.
 475      __('Language').' '.helpLink('entry','language').'</label></td> '.
 476      '<td>'.form::field('p_lang',5,5,$lang,15).'</td>';
 477      
 478      echo
 479      '<td><label for="p_selected">'.
 480      __('Selection').' '.helplink('entry','selected').'</label></td>'.
 481      '<td>'.form::combo('p_selected',array(__('yes')=>1,__('no')=>0),$selected,'','',16).'</td></tr>';
 482      
 483      echo
 484      '<tr><td><label for="p_open_comment">'.
 485      __('Comments').' '.helpLink('entry','comment').'</label></td> '.
 486      '<td>'.form::combo('p_open_comment',array(__('Open')=>'1',__('Closed')=>'0'),$open_comment,'','',17).'</td>';
 487      
 488      echo
 489      '<td><label for="p_open_tb">'.
 490      __('Trackbacks').' '.helpLink('entry','trackback').'</label></td>'.
 491      '<td>'.form::combo('p_open_tb',array(__('Open')=>'1',__('Closed')=>'0'),$open_tb,'','',18).'</td></tr>';
 492      echo '</table>';
 493      
 494      echo '</div>';
 495      
 496      $p_tb_checked = ($do_trackbacks) ? ' checked="checked"' : '';
 497      echo
 498      '<p><input type="checkbox" name="p_do_trackbacks" id="p_do_trackbacks" '.
 499      $p_tb_checked.' /> '.
 500      '<label class="inline" for="p_do_trackbacks">'.__('Ping URLs').'</label></p>';
 501      
 502      echo
 503      '<p>'.
 504      '<input name="preview" type="submit" class="submit" '.
 505      'value="'.__('preview').' [v]" accesskey="v" tabindex="20" />&nbsp; '.
 506      '<input name="publish" type="submit" class="submit" '.
 507      'value="'.__('save').' [s]" accesskey="s" tabindex="21" />';
 508      
 509      if (!empty($post_id) && $format == 'wiki') {
 510          echo
 511          '&nbsp;<input name="transform" type="submit" class="submit" '.
 512          'value="'.__('convert into XHTML').'" tabindex="22" />';
 513      }
 514      
 515      if (!empty($post_id)) {
 516          echo
 517          '&nbsp;<input name="delete" type="submit" class="submit" tabindex="23" '.
 518          'value="'.__('delete').'" onclick="return '.
 519          'window.confirm(\''.__('Are you sure you want to delete this entry?').'\')" />'.
 520          form::hidden('post_id',$post_id);
 521      }
 522      
 523      echo '</p>';
 524      echo '</form>';
 525  }
 526  
 527  /* Comments
 528  -------------------------------------------------------- */
 529  if (!empty($post_id))
 530  {
 531      echo '<h2>'.__('Comments').'</h2>';
 532      
 533      if (isset($comments)) {
 534          $trackbacks = $comments->extractTrackbacks();
 535      }
 536      
 537      if (isset($trackbacks))
 538      {
 539          echo '<h3 id="trackbacks">'.__('Trackbacks list').'</h3>';
 540          if (!$trackbacks->isEmpty()) {
 541              showComments($trackbacks);
 542          } else {
 543              echo __('No trackback');
 544          }
 545      }
 546      
 547      if (isset($comments))
 548      {
 549          echo '<h3 id="comments">'.__('Comments list').'</h3>';
 550          if (!$comments->isEmpty()) {
 551              showComments($comments);
 552          } else {
 553              echo __('No comment');
 554          }
 555      }
 556      
 557      echo
 558      '<h3>'.__('Post a comment').'</h3>'.
 559      '<form action="poster.php" method="post">'.
 560      '<p class="field"><label class="float" for="com_nom"><strong>'.
 561      __('Name').'&nbsp;:</strong></label> '.
 562      form::field('com_nom',30,255,htmlspecialchars($_SESSION['sess_user_cn'])).
 563      '</p>';
 564      
 565      echo
 566      '<p class="field"><label class="float" for="com_email">'.
 567      __('Email').' ('.__('optional').')&nbsp;:</label> '.
 568      form::field('com_email',30,255,htmlspecialchars($_SESSION['sess_user_email'])).
 569      '</p>';
 570      
 571      echo
 572      '<p class="field"><label class="float" for="com_web">'.
 573      __('Site').' ('.__('optional').')&nbsp;:</label> '.
 574      form::field('com_web',30,255,'http://').'</p>';
 575      
 576      echo
 577      '<p class="field"><label for="com_content"><strong>'.
 578      __('Comment').'&nbsp;:</strong></label> '.
 579      form::textArea('com_content',40,10,'&lt;p&gt;&lt;/p&gt;','','class="max"').'</p>';
 580      
 581      echo
 582      '<p class="field"><input type="submit" class="submit" name="add_comment"
 583      value="'.__('save').'" />'.
 584      '<input type="hidden" name="post_id" value="'.$post_id.'" /></p>';
 585      
 586      echo '</form>';
 587      
 588      echo '<p><strong>'.__('Notice').'</strong> : '.__('This comment has to be in HTML format').'.</p>';
 589  }
 590  
 591  # Affichage de commentaires ou trackbacks
 592  function showComments(&$rs)
 593  {
 594      global $is_editable, $post_id;
 595      
 596      while(!$rs->EOF())
 597      {
 598          if ($rs->f('comment_pub')) {
 599              $com_style = '';
 600              $com_cancel = __('set offline');
 601          } else {
 602              $com_style = 'style="color:#999;"';
 603              $com_cancel = __('set online');
 604          }
 605          
 606          echo '<div class="ligne" '.$com_style.' id="c'.$rs->f('comment_id').'">';
 607          
 608          echo
 609          '<p>'.(($rs->f('comment_trackback')==1) ? '<strong>'.__('Trackback').'</strong><br />' : '').
 610          __('From').'&nbsp;: '.$rs->f('comment_auteur').'<br />'.
 611          dt::str(__('On %A %e %B %Y, %I:%M %p'),$rs->getTS()).'<br />'.
 612          __('Email').'&nbsp;: '.$rs->f('comment_email').'<br />'.
 613          __('Site').'&nbsp;: '.(($rs->f('comment_site')) ? 'http://'.$rs->f('comment_site') : '').'<br />'.
 614          '@IP : '.$rs->f('comment_ip').'</p>'.
 615          '<div>'.$rs->getContent().'</div>';
 616          
 617          if($is_editable)
 618          {
 619              echo
 620              '<p style="text-align:right">'.
 621              '<a href="poster.php?post_id='.$post_id.
 622              '&amp;comment_id='.$rs->f('comment_id').'">'.$com_cancel.'</a>'.
 623              ' - <a href="comment.php?comment_id='.$rs->f('comment_id').'">'.__('edit').'</a>'.
 624              ' - <a href="poster.php?post_id='.$post_id.
 625              '&amp;comment_id='.$rs->f('comment_id').'&amp;comment_del=1" '.
 626              'onclick="return window.confirm(\''.__('Are you sure you want to delete this comment?').'\');">'.__('delete').'</a>'.
 627              '</p>';
 628          }
 629          
 630          echo '</div>';
 631          
 632          $rs->moveNext();
 633      }
 634  }
 635  
 636  closePage();
 637  ?>


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