source: trunk/phpgwapi/inc/class.phpgw.inc.php @ 2

Revision 2, 5.8 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare API - Core class and functions for eGroupWare                 *
4        * This file written by Dan Kuykendall <seek3r@phpgroupware.org>            *
5        * and Joseph Engo <jengo@phpgroupware.org>                                 *
6        * This is the central class for the eGroupWare API                         *
7        * Copyright (C) 2000, 2001 Dan Kuykendall                                  *
8        * Parts Copyright (C) 2003 Free Software Foundation                        *
9        * -------------------------------------------------------------------------*
10        * This library is part of the eGroupWare API                               *
11        * http://www.egroupware.org/api                                            *
12        * ------------------------------------------------------------------------ *
13        * This library is free software; you can redistribute it and/or modify it  *
14        * under the terms of the GNU Lesser General Public License as published by *
15        * the Free Software Foundation; either version 2.1 of the License,         *
16        * or any later version.                                                    *
17        * This library is distributed in the hope that it will be useful, but      *
18        * WITHOUT ANY WARRANTY; without even the implied warranty of               *
19        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
20        * See the GNU Lesser General Public License for more details.              *
21        * You should have received a copy of the GNU Lesser General Public License *
22        * along with this library; if not, write to the Free Software Foundation,  *
23        * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
24        \**************************************************************************/
25
26
27        /**
28        * Parent class for the phpgwAPI
29        * Parent class. Has a few functions but is more importantly used as a parent class for everything else.
30        * @author       Dan Kuykendall <dan@kuykendall.org>
31        * @copyright LGPL
32        * @package phpgwapi
33        * @access       public
34        */
35
36        class phpgw
37        {
38                var $accounts;
39                var $applications;
40                var $acl;
41                var $auth;
42                var $db;
43                /**
44                 * Turn on debug mode. Will output additional data for debugging purposes.
45                 * @var string  $debug
46                 * @access      public
47                 */
48                var $debug = 0;         // This will turn on debugging information.
49                var $crypto;
50                var $categories;
51                var $common;
52                var $datetime;
53                var $hooks;
54                var $network;
55                var $nextmatchs;
56                var $preferences;
57                var $session;
58                var $send;
59                var $template;
60                var $translation;
61                var $utilities;
62                var $vfs;
63                var $calendar;
64                var $msg;
65                var $addressbook;
66                var $todo;
67
68                /**************************************************************************\
69                * Core functions                                                           *
70                \**************************************************************************/
71
72                /**
73                 * Strips out html chars
74                 *
75                 * Used as a shortcut for stripping out html special chars.
76                 *
77                 * @access      public
78                 * @param $s string  The string to have its html special chars stripped out.
79                 * @return string  The string with html special characters removed
80                 * @syntax strip_html($string)
81                 * @example $reg_string = strip_html($urlencode_string);
82                 */
83                function strip_html($s)
84                {
85                        return htmlspecialchars(stripslashes($s));
86                }
87
88                /**
89                 * Link url generator
90                 *
91                 * Used for backwards compatibility and as a shortcut. If no url is passed, it will use PHP_SELF. Wrapper to session->link()
92                 *
93                 * @access      public
94                 * @param       string  $string The url the link is for
95                 * @param  string       $extravars      Extra params to be passed to the url
96                 * @return string       The full url after processing
97                 * @see session->link()
98                 * @syntax link($string, $extravars)
99                 * @example None yet
100                 */
101                function link($url = '', $extravars = '')
102                {
103                        return $this->session->link($url, $extravars);
104                }
105
106                function redirect_link($url = '',$extravars='')
107                {
108                        $this->redirect($this->session->link($url, $extravars));
109                }
110
111                /**
112                * Repost Prevention Detection
113                *
114                * Used as a shortcut. Wrapper to session->is_repost()
115                *
116                * @access       public
117                * @param        bool    $display_error  Use common error handler? - not yet implemented
118                * @return bool  True if called previously, else False - call ok
119                * @see  session->is_repost()
120                * @syntax is_post()
121                * @example $repost = $GLOBALS['phpgwapi']->is_repost();
122                * @author       Dave Hall
123                */
124                function is_repost($display_error = False)
125                {
126                        return $this->session->is_repost($display_error);
127                }
128
129                /**
130                 * Handles redirects under iis and apache
131                 *
132                 * This function handles redirects under iis and apache it assumes that $phpgw->link() has already been called
133                 *
134                 * @access      public
135                 * @param  string The url ro redirect to
136                 * @syntax redirect(key as string)
137                 * @example None yet
138                 */
139                function redirect($url = '')
140                {
141                        /* global $HTTP_ENV_VARS; */
142
143                        $iis = @strpos($GLOBALS['HTTP_ENV_VARS']['SERVER_SOFTWARE'], 'IIS', 0);
144
145                        if(!$url)
146                        {
147                                $url = $_SERVER['PHP_SELF'];
148                        }
149                        if($iis)
150                        {
151                                echo "\n<HTML>\n<HEAD>\n<TITLE>Redirecting to $url</TITLE>";
152                                echo "\n<META HTTP-EQUIV=REFRESH CONTENT=\"0; URL=$url\">";
153                                echo "\n</HEAD><BODY>";
154                                echo "<H3>Please continue to <a href=\"$url\">this page</a></H3>";
155                                echo "\n</BODY></HTML>";
156                                exit;
157                        }
158                        else
159                        {
160                                Header("Location: $url");
161                                print("\n\n");
162                                exit;
163                        }
164                }
165
166                /**
167                 * Shortcut to translation class
168                 *
169                 * This function is a basic wrapper to translation->translate()
170                 *
171                 * @access      public
172                 *      @param  string  The key for the phrase
173                 *      @param  string  the first additional param
174                 *      @param  string  the second additional param
175                 *      @param  string  the thrid additional param
176                 *      @param  string  the fourth additional param
177                 * @see translation->translate()
178                 */
179                function lang($key, $m1 = '', $m2 = '', $m3 = '', $m4 = '')
180                {
181                        /* global $phpgw; */
182                        return $this->translation->translate($key);
183                }
184        } /* end of class */
185?>
Note: See TracBrowser for help on using the repository browser.