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