PHPExcel
[ class tree: PHPExcel ] [ index: PHPExcel ] [ all elements ]

Source for file DocumentSecurity.php

Documentation is available at DocumentSecurity.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library 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 GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.5, 2009-01-05
  26.  */
  27.  
  28.  
  29. /** PHPExcel_Shared_PasswordHasher */
  30. require_once 'PHPExcel/Shared/PasswordHasher.php';
  31.  
  32.  
  33. /**
  34.  * PHPExcel_DocumentSecurity
  35.  *
  36.  * @category   PHPExcel
  37.  * @package    PHPExcel
  38.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  39.  */
  40. {
  41.     /**
  42.      * LockRevision
  43.      *
  44.      * @var boolean 
  45.      */
  46.     private $_lockRevision;
  47.     
  48.     /**
  49.      * LockStructure
  50.      *
  51.      * @var boolean 
  52.      */
  53.     private $_lockStructure;
  54.     
  55.     /**
  56.      * LockWindows
  57.      *
  58.      * @var boolean 
  59.      */
  60.     private $_lockWindows;
  61.     
  62.     /**
  63.      * RevisionsPassword
  64.      *
  65.      * @var string 
  66.      */
  67.     private $_revisionsPassword;
  68.     
  69.     /**
  70.      * WorkbookPassword
  71.      *
  72.      * @var string 
  73.      */
  74.     private $_workbookPassword;
  75.     
  76.     /**
  77.      * Create a new PHPExcel_DocumentSecurity
  78.      */
  79.     public function __construct()
  80.     {
  81.         // Initialise values
  82.         $this->_lockRevision        = false;
  83.         $this->_lockStructure        = false;
  84.         $this->_lockWindows            = false;
  85.         $this->_revisionsPassword    = '';
  86.         $this->_workbookPassword    = '';
  87.     }
  88.     
  89.     /**
  90.      * Is some sort of dcument security enabled?
  91.      *
  92.      * @return boolean 
  93.      */
  94.     function isSecurityEnabled({
  95.         return     $this->_lockRevision ||
  96.                 $this->_lockStructure ||
  97.                 $this->_lockWindows;
  98.     }
  99.     
  100.     /**
  101.      * Get LockRevision
  102.      *
  103.      * @return boolean 
  104.      */
  105.     function getLockRevision({
  106.         return $this->_lockRevision;
  107.     }
  108.     
  109.     /**
  110.      * Set LockRevision
  111.      *
  112.      * @param boolean $pValue 
  113.      */
  114.     function setLockRevision($pValue false{
  115.         $this->_lockRevision = $pValue;
  116.     }
  117.     
  118.     /**
  119.      * Get LockStructure
  120.      *
  121.      * @return boolean 
  122.      */
  123.     function getLockStructure({
  124.         return $this->_lockStructure;
  125.     }
  126.     
  127.     /**
  128.      * Set LockStructure
  129.      *
  130.      * @param boolean $pValue 
  131.      */
  132.     function setLockStructure($pValue false{
  133.         $this->_lockStructure = $pValue;
  134.     }
  135.     
  136.     /**
  137.      * Get LockWindows
  138.      *
  139.      * @return boolean 
  140.      */
  141.     function getLockWindows({
  142.         return $this->_lockWindows;
  143.     }
  144.     
  145.     /**
  146.      * Set LockWindows
  147.      *
  148.      * @param boolean $pValue 
  149.      */
  150.     function setLockWindows($pValue false{
  151.         $this->_lockWindows = $pValue;
  152.     }
  153.     
  154.     /**
  155.      * Get RevisionsPassword (hashed)
  156.      *
  157.      * @return string 
  158.      */
  159.     function getRevisionsPassword({
  160.         return $this->_revisionsPassword;
  161.     }
  162.     
  163.     /**
  164.      * Set RevisionsPassword
  165.      *
  166.      * @param string     $pValue 
  167.      * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
  168.      */
  169.     function setRevisionsPassword($pValue ''$pAlreadyHashed false{
  170.         if (!$pAlreadyHashed{
  171.             $pValue PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
  172.         }
  173.         $this->_revisionsPassword = $pValue;
  174.     }
  175.     
  176.     /**
  177.      * Get WorkbookPassword (hashed)
  178.      *
  179.      * @return string 
  180.      */
  181.     function getWorkbookPassword({
  182.         return $this->_workbookPassword;
  183.     }
  184.  
  185.     /**
  186.      * Set WorkbookPassword
  187.      *
  188.      * @param string     $pValue 
  189.      * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
  190.      */
  191.     function setWorkbookPassword($pValue ''$pAlreadyHashed false{
  192.         if (!$pAlreadyHashed{
  193.             $pValue PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
  194.         }
  195.         $this->_workbookPassword = $pValue;
  196.     }
  197.  
  198.     /**
  199.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  200.      */
  201.     public function __clone({
  202.         $vars get_object_vars($this);
  203.         foreach ($vars as $key => $value{
  204.             if (is_object($value)) {
  205.                 $this->$key clone $value;
  206.             else {
  207.                 $this->$key $value;
  208.             }
  209.         }
  210.     }
  211. }

Documentation generated on Mon, 05 Jan 2009 20:36:49 +0100 by phpDocumentor 1.4.1