Overview

Packages

  • Kolab
    • FreeBusy

Classes

  • Horde_Kolab_FreeBusy
  • Horde_Kolab_FreeBusy_Cache
  • Horde_Kolab_FreeBusy_Cache_Base
  • Horde_Kolab_FreeBusy_Cache_DB
  • Horde_Kolab_FreeBusy_Cache_DB_acl
  • Horde_Kolab_FreeBusy_Cache_DB_xacl
  • Horde_Kolab_FreeBusy_Cache_File
  • Horde_Kolab_FreeBusy_Cache_File_acl
  • Horde_Kolab_FreeBusy_Cache_File_pvcal
  • Horde_Kolab_FreeBusy_Cache_File_vcal
  • Horde_Kolab_FreeBusy_Cache_File_xacl
  • Horde_Kolab_FreeBusy_Controller_Base
  • Horde_Kolab_FreeBusy_Controller_MatchDict
  • Horde_Kolab_FreeBusy_Controller_NotFound
  • Horde_Kolab_FreeBusy_Controller_RequestConfiguration
  • Horde_Kolab_FreeBusy_Driver_Base
  • Horde_Kolab_FreeBusy_Driver_Freebusy_Base
  • Horde_Kolab_FreeBusy_Driver_Freebusy_Kolab
  • Horde_Kolab_FreeBusy_Exception
  • Horde_Kolab_FreeBusy_Exception_NotFound
  • Horde_Kolab_FreeBusy_Exception_Unauthorized
  • Horde_Kolab_FreeBusy_Export_Freebusy_Backend_Kolab
  • Horde_Kolab_FreeBusy_Export_Freebusy_Base
  • Horde_Kolab_FreeBusy_Export_Freebusy_Decorator_Log
  • Horde_Kolab_FreeBusy_Factory_Base
  • Horde_Kolab_FreeBusy_Freebusy_Controller_Freebusy
  • Horde_Kolab_FreeBusy_Freebusy_Factory_Base
  • Horde_Kolab_FreeBusy_Freebusy_Factory_Kolab
  • Horde_Kolab_FreeBusy_Freebusy_Helper_Owa
  • Horde_Kolab_FreeBusy_Freebusy_Helper_StatusMap_Config
  • Horde_Kolab_FreeBusy_Freebusy_Helper_StatusMap_Default
  • Horde_Kolab_FreeBusy_Freebusy_Owner_Kolab
  • Horde_Kolab_FreeBusy_Freebusy_Params_Folder
  • Horde_Kolab_FreeBusy_Freebusy_UserDb_Kolab
  • Horde_Kolab_FreeBusy_Object_Event
  • Horde_Kolab_FreeBusy_Owner_Kolab
  • Horde_Kolab_FreeBusy_Params_Freebusy_Resource_Kolab
  • Horde_Kolab_FreeBusy_Params_User
  • Horde_Kolab_FreeBusy_Provider_Local
  • Horde_Kolab_FreeBusy_Provider_Remote
  • Horde_Kolab_FreeBusy_Provider_Remote_PassThrough
  • Horde_Kolab_FreeBusy_Provider_Remote_Redirect
  • Horde_Kolab_FreeBusy_Report
  • Horde_Kolab_FreeBusy_Resource_Decorator_Log
  • Horde_Kolab_FreeBusy_Resource_Decorator_Mcache
  • Horde_Kolab_FreeBusy_Resource_Event_Decorator_Log
  • Horde_Kolab_FreeBusy_Resource_Event_Decorator_Mcache
  • Horde_Kolab_FreeBusy_Resource_Event_Kolab
  • Horde_Kolab_FreeBusy_Resource_Event_Owa
  • Horde_Kolab_FreeBusy_Resource_Kolab
  • Horde_Kolab_FreeBusy_Translation
  • Horde_Kolab_FreeBusy_User_Anonymous
  • Horde_Kolab_FreeBusy_User_Decorator_Log
  • Horde_Kolab_FreeBusy_User_Kolab
  • Horde_Kolab_FreeBusy_UserDb_Kolab
  • Horde_Kolab_FreeBusy_UserDb_User_Kolab
  • Horde_Kolab_FreeBusy_View
  • Horde_Kolab_FreeBusy_View_error
  • Horde_Kolab_FreeBusy_View_vfb

Interfaces

  • Horde_Kolab_FreeBusy_Driver_Freebusy_Interface
  • Horde_Kolab_FreeBusy_Driver_Interface
  • Horde_Kolab_FreeBusy_Export_Freebusy
  • Horde_Kolab_FreeBusy_Export_Freebusy_Backend
  • Horde_Kolab_FreeBusy_Factory
  • Horde_Kolab_FreeBusy_Freebusy_Helper_StatusMap
  • Horde_Kolab_FreeBusy_Freebusy_Owner
  • Horde_Kolab_FreeBusy_Owner
  • Horde_Kolab_FreeBusy_Params_Owner
  • Horde_Kolab_FreeBusy_Params_Resource
  • Horde_Kolab_FreeBusy_Provider
  • Horde_Kolab_FreeBusy_Resource
  • Horde_Kolab_FreeBusy_Resource_Event
  • Horde_Kolab_FreeBusy_User
  • Horde_Kolab_FreeBusy_UserDb
  • Horde_Kolab_FreeBusy_UserDb_User
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Provides simple views.
  4:  *
  5:  * @package Kolab_FreeBusy
  6:  */
  7: 
  8: /**
  9:  * The Horde_Kolab_FreeBusy_View:: class renders data.
 10:  *
 11:  * Copyright 2004-2008 Klarälvdalens Datakonsult AB
 12:  *
 13:  * See the enclosed file COPYING for license information (LGPL). If you
 14:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 15:  *
 16:  * @author  Gunnar Wrobel <p@rdus.de>
 17:  * @author  Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
 18:  * @package Kolab_FreeBusy
 19:  */
 20: class Horde_Kolab_FreeBusy_View {
 21: 
 22:     /**
 23:      * The data that should get rendered.
 24:      *
 25:      * @var array
 26:      */
 27:     var $_data;
 28: 
 29:     /**
 30:      * Constructor.
 31:      *
 32:      * @param array $data The data to display
 33:      */
 34:     function Horde_Kolab_FreeBusy_View(&$data)
 35:     {
 36:         $this->_data = $data;
 37:     }
 38: 
 39:     /**
 40:      * Render the data.
 41:      */
 42:     function render()
 43:     {
 44:         echo 'Not implemented!';
 45:     }
 46: }
 47: 
 48: /**
 49:  * The Horde_Kolab_FreeBusy_View_vfb:: class renders free/busy data.
 50:  *
 51:  * Copyright 2004-2008 Klarälvdalens Datakonsult AB
 52:  *
 53:  * See the enclosed file COPYING for license information (LGPL). If you
 54:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 55:  *
 56:  * @author  Gunnar Wrobel <p@rdus.de>
 57:  * @author  Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
 58:  * @package Kolab_FreeBusy
 59:  */
 60: class Horde_Kolab_FreeBusy_View_vfb extends Horde_Kolab_FreeBusy_View {
 61: 
 62:     /**
 63:      * The free/busy data that should be displayed.
 64:      *
 65:      * @var Horde_Icalendar
 66:      */
 67:     var $_vfb;
 68: 
 69:     /**
 70:      * Current timestamp.
 71:      *
 72:      * @var int
 73:      */
 74:     var $_ts;
 75: 
 76:     /**
 77:      * Constructor.
 78:      *
 79:      * @param Horde_Icalendar $vfb The free/busy data to display.
 80:      */
 81:     function Horde_Kolab_FreeBusy_View_vfb(&$data)
 82:     {
 83: 
 84:         $data['vfb'] = $data['fb']->exportvCalendar();
 85: 
 86:         $ts = time();
 87: 
 88:         $components = &$data['fb']->getComponents();
 89:         foreach ($components as $component) {
 90:             if ($component->getType() == 'vFreebusy') {
 91:                 $attr = $component->getAttribute('DTSTAMP');
 92:                 if (!empty($attr) && !is_a($attr, 'PEAR_Error')) {
 93:                     $ts = $attr;
 94:                     break;
 95:                 }
 96:             }
 97:         }
 98: 
 99:         $data['ts'] = $ts;
100: 
101:         Horde_Kolab_FreeBusy_View::Horde_Kolab_FreeBusy_View($data);
102:     }
103: 
104:     /**
105:      * Display the free/busy information.
106:      *
107:      * @param string $content File name of the offered file.
108:      */
109:     function render()
110:     {
111:         global $conf;
112: 
113:         if (!empty($conf['fb']['send_content_type'])) {
114:             $send_content_type = $conf['fb']['send_content_type'];
115:         } else {
116:             $send_content_type = false;
117:         }
118: 
119:         if (!empty($conf['fb']['send_content_length'])) {
120:             $send_content_length = $conf['fb']['send_content_length'];
121:         } else {
122:             $send_content_length = false;
123:         }
124: 
125:         if (!empty($conf['fb']['send_content_disposition'])) {
126:             $send_content_disposition = $conf['fb']['send_content_disposition'];
127:         } else {
128:             $send_content_disposition = false;
129:         }
130: 
131:         /* Ensure that the data doesn't get cached along the way */
132:         header('Cache-Control: no-store, no-cache, must-revalidate');
133:         header('Cache-Control: post-check=0, pre-check=0', false);
134:         header('Pragma: no-cache');
135:         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
136:         header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $this->_data['ts']) . ' GMT');
137:         header('Pragma: public');
138:         header('Content-Transfer-Encoding: none');
139:         if ($send_content_type) {
140:             header('Content-Type: text/calendar');
141:         }
142:         if ($send_content_length) {
143:             header('Content-Length: ' . strlen($this->_data['vfb']));
144:         }
145:         if ($send_content_disposition) {
146:             header('Content-Disposition: attachment; filename="' . $this->_data['name'] . '"');
147:         }
148: 
149:         echo $this->_data['vfb'];
150: 
151:         exit(0);
152:     }
153: }
154: 
155: /** Error types */
156: define('FREEBUSY_ERROR_NOTFOUND', 0);
157: define('FREEBUSY_ERROR_UNAUTHORIZED', 1);
158: define('FREEBUSY_ERROR_SERVER', 2);
159: 
160: /**
161:  * The Horde_Kolab_FreeBusy_View_error:: class provides error pages for the
162:  * Kolab free/busy system.
163:  *
164:  * Copyright 2004-2008 Klarälvdalens Datakonsult AB
165:  *
166:  * See the enclosed file COPYING for license information (LGPL). If you
167:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
168:  *
169:  * @author  Gunnar Wrobel <wrobel@pardus.de>
170:  * @author  Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
171:  * @package Kolab_FreeBusy
172:  */
173: class Horde_Kolab_FreeBusy_View_error extends Horde_Kolab_FreeBusy_View {
174: 
175:     /**
176:      * Display the error information.
177:      */
178:     function render()
179:     {
180:         switch ($this->_data['type']) {
181:         case FREEBUSY_ERROR_NOTFOUND:
182:             $this->notFound($this->_data['error']);
183:             exit(1);
184:         case FREEBUSY_ERROR_UNAUTHORIZED:
185:             $this->unauthorized($this->_data['error']);
186:             exit(1);
187:         case FREEBUSY_ERROR_SERVER:
188:             $this->serverError($this->_data['error']);
189:             exit(1);
190:         }
191:     }
192: 
193:     /**
194:      * Deliver a "Not Found" page
195:      *
196:      * @param PEAR_Error $error    The error.
197:      */
198:     function notFound($error)
199:     {
200:         $headers = array('HTTP/1.0 404 Not Found');
201:         if (isset($_SERVER['REQUEST_URI'])) {
202:             $url = htmlentities($_SERVER['REQUEST_URI']);
203:         } else {
204:             $url = '/';
205:         }
206:         $message = sprintf(Horde_Kolab_FreeBusy_Translation::t("The requested URL %s was not found on this server."), $url);
207: 
208:         $this->_errorPage($error, $headers, Horde_Kolab_FreeBusy_Translation::t("404 Not Found"), Horde_Kolab_FreeBusy_Translation::t("Not found"), $message);
209:     }
210: 
211:     /**
212:      * Deliver a "Unauthorized" page
213:      *
214:      * @param PEAR_Error $error    The error.
215:      */
216:     function unauthorized($error)
217:     {
218:         global $conf;
219: 
220:         if (!empty($conf['kolab']['imap']['maildomain'])) {
221:             $email_domain = $conf['kolab']['imap']['maildomain'];
222:         } else {
223:             $email_domain = 'localhost';
224:         }
225: 
226:         $headers = array('WWW-Authenticate: Basic realm="freebusy-' . $email_domain . '"',
227:                          'HTTP/1.0 401 Unauthorized');
228: 
229:         $this->_errorPage($error, $headers, Horde_Kolab_FreeBusy_Translation::t("401 Unauthorized"), Horde_Kolab_FreeBusy_Translation::t("Unauthorized"),
230:                   Horde_Kolab_FreeBusy_Translation::t("You are not authorized to access the requested URL."));
231:     }
232: 
233:     /**
234:      * Deliver a "Server Error" page
235:      *
236:      * @param PEAR_Error $error    The error.
237:      */
238:     function serverError($error)
239:     {
240:         $headers = array('HTTP/1.0 500 Server Error');
241:         if (isset($_SERVER['REQUEST_URI'])) {
242:             $url = htmlentities($_SERVER['REQUEST_URI']);
243:         } else {
244:             $url = '/';
245:         }
246:         $this->_errorPage($error, $headers, Horde_Kolab_FreeBusy_Translation::t("500 Server Error"), Horde_Kolab_FreeBusy_Translation::t("Error"),
247:                   htmlentities($$url));
248:     }
249: 
250:     /**
251:      * Deliver an error page
252:      *
253:      * @param PEAR_Error $error    The error.
254:      * @param array      $headers  The HTTP headers to deliver with the response
255:      * @param string     $title    The page title
256:      * @param string     $headline The headline of the page
257:      * @param string     $body     The message to display on the page
258:      */
259:     function _errorPage($error, $headers, $title, $headline, $body)
260:     {
261:         global $conf;
262: 
263:         /* Print the headers */
264:         foreach ($headers as $line) {
265:             header($line);
266:         }
267: 
268:         /* Print the page */
269:         echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n";
270:         echo "<html><head><title>" . $title . "</title></head>\n";
271:         echo "<body>\n";
272:         echo "<h1>" . $headline . "</h1>\n";
273:         echo "<p>" . $body . "</p>\n";
274:         if (!empty($error)) {
275:             echo "<hr><pre>" . $error->getMessage() . "</pre>\n";
276:             Horde::logMessage($error, 'ERR');
277:         }
278:         echo "<hr>\n";
279:         echo isset($_SERVER['SERVER_SIGNATURE'])?$_SERVER['SERVER_SIGNATURE']:'' . "\n";
280:         echo "</body></html>\n";
281:     }
282: }
283: 
284: 
API documentation generated by ApiGen