[ Index ]
 

Code source de CMS made simple 1.0.5

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

title

Body

[fermer]

/lib/classes/ -> class.globalcontent.inc.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004-6 by Ted Kulp (ted@cmsmadesimple.org)
   4  #This project's homepage is: http://cmsmadesimple.org
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #BUT withOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  #
  19  #$Id$
  20  
  21  /**
  22   * Generic html blob class. This can be used for any logged in blob or blob related function.
  23   *
  24   * @since        0.6
  25   * @package        CMS
  26   */
  27  class GlobalContent
  28  {
  29      var $id;
  30      var $name;
  31      var $content;
  32      var $owner;
  33      var $modified_date;
  34  
  35  	function GlobalContent()
  36      {
  37          $this->SetInitialValues();
  38      }
  39  
  40  	function SetInitialValues()
  41      {
  42          $this->id = -1;
  43          $this->name = '';
  44          $this->content = '';
  45          $this->owner = -1;
  46          $this->modified_date = -1;
  47      }
  48  
  49      function Id()
  50      {
  51          return $this->id;
  52      }
  53  
  54  	function Name()
  55      {
  56          return $this->name;
  57      }
  58  
  59  	function Save()
  60      {
  61          $result = false;
  62          
  63          global $gCms;
  64          $gcbops =& $gCms->GetGlobalContentOperations();
  65          
  66          if ($this->id > -1)
  67          {
  68              $result = $gcbops->UpdateHtmlBlob($this);
  69          }
  70          else
  71          {
  72              $newid = $gcbops->InsertHtmlBlob($this);
  73              if ($newid > -1)
  74              {
  75                  $this->id = $newid;
  76                  $result = true;
  77              }
  78  
  79          }
  80  
  81          return $result;
  82      }
  83  
  84  	function Delete()
  85      {
  86          $result = false;
  87          
  88          global $gCms;
  89          $gcbops =& $gCms->GetGlobalContentOperations();
  90  
  91          if ($this->id > -1)
  92          {
  93              $result = $gcbops->DeleteHtmlBlobByID($this->id);
  94              if ($result)
  95              {
  96                  $this->SetInitialValues();
  97              }
  98          }
  99  
 100          return $result;
 101      }
 102  
 103  	function IsOwner($user_id)
 104      {
 105          $result = false;
 106          
 107          global $gCms;
 108          $gcbops =& $gCms->GetGlobalContentOperations();
 109  
 110          if ($this->id > -1)
 111          {
 112              $result = $gcbops->CheckOwnership($this->id, $user_id);
 113          }
 114  
 115          return $result;
 116      }
 117  
 118  	function IsAuthor($user_id)
 119      {
 120          $result = false;
 121          
 122          global $gCms;
 123          $gcbops =& $gCms->GetGlobalContentOperations();
 124  
 125          if ($this->id > -1)
 126          {
 127              $result = $gcbops->CheckAuthorship($this->id, $user_id);
 128          }
 129  
 130          return $result;
 131      }
 132  
 133  	function ClearAuthors()
 134      {
 135          $result = false;
 136          
 137          global $gCms;
 138          $gcbops =& $gCms->GetGlobalContentOperations();
 139  
 140          if ($this->id > -1)
 141          {
 142              $gcbops->ClearAdditionalEditors($this->id);
 143              $result = true;
 144          }
 145  
 146          return $result;
 147      }
 148  
 149  	function AddAuthor($user_id)
 150      {
 151          $result = false;
 152          
 153          global $gCms;
 154          $gcbops =& $gCms->GetGlobalContentOperations();
 155  
 156          if ($this->id > -1)
 157          {
 158              $gcbops->InsertAdditionalEditors($this->id, $user_id);
 159              $result = true;
 160          }
 161  
 162          return $result;
 163      }
 164  }
 165  
 166  class HtmlBlob extends GlobalContent
 167  {
 168  }
 169  
 170  # vim:ts=4 sw=4 noet
 171  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7