[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/postnuke/articles/ -> pnarticle.class.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: pnarticle.class.php,v 1.6 2004/10/20 20:06:49 opensides Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/postnuke/articles/pnarticle.class.php,v $
  20   *
  21   */
  22  
  23  class pnArticle {
  24    var $db ;
  25  
  26    var $id ;
  27  
  28    var $titre;
  29    var $body;
  30  
  31    function pnArticle($DB, $id=0) {
  32      $this->db = $DB;
  33      $this->id   = $id ;
  34    }  
  35  
  36    /*
  37     *
  38     *
  39     */
  40    function update($id, $user)
  41    {
  42  
  43      if (strlen($this->annee)==0)
  44        {
  45      $this->annee = 0;
  46        }
  47  
  48      $sql = "UPDATE ". PN_DB_NAME . "." . PN_TABLE_STORIES_NAME;
  49      $sql .= " SET pn_hometext = '" . nl2br(trim($this->body)) ."'";
  50      //$sql .= ", pn_title = '" . trim($this->titre) ."'";
  51  
  52  
  53      $sql .= " WHERE pn_sid = " . $id;
  54  
  55      if ( $this->db->query($sql) )
  56        {
  57      return 1;
  58        }
  59      else
  60        {
  61      print $this->db->error() . ' in ' . $sql;
  62        }
  63    }
  64    /*
  65     *
  66     *
  67     *
  68     */
  69    function fetch ($id) {
  70      
  71      $sql = "SELECT p.pn_sid, p.pn_title, p.pn_hometext FROM " . PN_DB_NAME . "." . PN_TABLE_STORIES_NAME . " as p";
  72  
  73      if ($id)
  74        {
  75      $sql .= " WHERE p.pn_sid = $id";
  76        }
  77  
  78      $result = $this->db->query($sql) ;
  79  
  80      if ( $result )
  81        {
  82      $result = $this->db->fetch_array();
  83  
  84      $this->id         = $result["pn_id"];
  85      $this->titre      = $result["pn_title"];
  86      $this->body       = $result["pn_hometext"];
  87  
  88      $this->db->free();
  89        }
  90      else
  91        {
  92      print $this->db->error();
  93        }
  94      
  95      return $result;
  96    }
  97  
  98  
  99    /*
 100     *
 101     *
 102     */
 103  
 104  
 105  }
 106  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics