]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/CasAuthentication/extlib/CAS/PGTStorage/pgt-main.php
Merge commit 'mainline/0.9.x' into 0.9.x
[quix0rs-gnu-social.git] / plugins / CasAuthentication / extlib / CAS / PGTStorage / pgt-main.php
1 <?php
2
3 /**
4  * @file CAS/PGTStorage/pgt-main.php
5  * Basic class for PGT storage
6  */
7
8 /**
9  * @class PGTStorage
10  * The PGTStorage class is a generic class for PGT storage. This class should
11  * not be instanciated itself but inherited by specific PGT storage classes.
12  *
13  * @author   Pascal Aubry <pascal.aubry at univ-rennes1.fr>
14  *
15  * @ingroup internalPGTStorage
16  */
17
18 class PGTStorage
19 {
20   /** 
21    * @addtogroup internalPGTStorage
22    * @{ 
23    */
24
25   // ########################################################################
26   //  CONSTRUCTOR
27   // ########################################################################
28   
29   /**
30    * The constructor of the class, should be called only by inherited classes.
31    *
32    * @param $cas_parent the CASclient instance that creates the current object.
33    *
34    * @protected
35    */
36   function PGTStorage($cas_parent)
37     {
38       phpCAS::traceBegin();
39       if ( !$cas_parent->isProxy() ) {
40         phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); 
41       }
42       phpCAS::traceEnd();
43     }
44
45   // ########################################################################
46   //  DEBUGGING
47   // ########################################################################
48   
49   /**
50    * This virtual method returns an informational string giving the type of storage
51    * used by the object (used for debugging purposes).
52    *
53    * @public
54    */
55   function getStorageType()
56     {
57       phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
58     }
59
60   /**
61    * This virtual method returns an informational string giving informations on the
62    * parameters of the storage.(used for debugging purposes).
63    *
64    * @public
65    */
66   function getStorageInfo()
67     {
68       phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
69     }
70
71   // ########################################################################
72   //  ERROR HANDLING
73   // ########################################################################
74   
75   /**
76    * string used to store an error message. Written by PGTStorage::setErrorMessage(),
77    * read by PGTStorage::getErrorMessage().
78    *
79    * @hideinitializer
80    * @private
81    * @deprecated not used.
82    */
83   var $_error_message=FALSE;
84
85   /**
86    * This method sets en error message, which can be read later by 
87    * PGTStorage::getErrorMessage().
88    *
89    * @param $error_message an error message
90    *
91    * @protected
92    * @deprecated not used.
93    */
94   function setErrorMessage($error_message)
95     {
96       $this->_error_message = $error_message;
97     }
98
99   /**
100    * This method returns an error message set by PGTStorage::setErrorMessage().
101    *
102    * @return an error message when set by PGTStorage::setErrorMessage(), FALSE
103    * otherwise.
104    *
105    * @public
106    * @deprecated not used.
107    */
108   function getErrorMessage()
109     {
110       return $this->_error_message;
111     }
112
113   // ########################################################################
114   //  INITIALIZATION
115   // ########################################################################
116
117   /**
118    * a boolean telling if the storage has already been initialized. Written by 
119    * PGTStorage::init(), read by PGTStorage::isInitialized().
120    *
121    * @hideinitializer
122    * @private
123    */
124   var $_initialized = FALSE;
125
126   /**
127    * This method tells if the storage has already been intialized.
128    *
129    * @return a boolean
130    *
131    * @protected
132    */
133   function isInitialized()
134     {
135       return $this->_initialized;
136     }
137
138   /**
139    * This virtual method initializes the object.
140    *
141    * @protected
142    */
143   function init()
144     {
145       $this->_initialized = TRUE;
146     }
147
148   // ########################################################################
149   //  PGT I/O
150   // ########################################################################
151
152   /**
153    * This virtual method stores a PGT and its corresponding PGT Iuo.
154    * @note Should never be called.
155    *
156    * @param $pgt the PGT
157    * @param $pgt_iou the PGT iou
158    *
159    * @protected
160    */
161   function write($pgt,$pgt_iou)
162     {
163       phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
164     }
165
166   /**
167    * This virtual method reads a PGT corresponding to a PGT Iou and deletes
168    * the corresponding storage entry.
169    * @note Should never be called.
170    *
171    * @param $pgt_iou the PGT iou
172    *
173    * @protected
174    */
175   function read($pgt_iou)
176     {
177       phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
178     }
179
180   /** @} */
181   
182
183
184 // include specific PGT storage classes
185 include_once(dirname(__FILE__).'/pgt-file.php'); 
186 include_once(dirname(__FILE__).'/pgt-db.php');
187   
188 ?>