egroupware_official/phpgwapi/inc/class.phpgw.inc.php

164 lines
5.2 KiB
PHP
Raw Normal View History

<?php
/**************************************************************************\
* phpGroupWare API - Core class and functions for phpGroupWare *
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
* and Joseph Engo <jengo@phpgroupware.org> *
* This is the central class for the phpGroupWare API *
* Copyright (C) 2000, 2001 Dan Kuykendall *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
2001-05-08 23:20:47 +02:00
/**
* Parent class for the phpgwAPI
* Parent class. Has a few functions but is more importantly used as a parent class for everything else.
2001-07-26 13:02:10 +02:00
* @author Dan Kuykendall <dan@kuykendall.org>
* @copyright LGPL
2001-05-08 23:20:47 +02:00
* @package phpgwapi
2001-07-26 13:02:10 +02:00
* @access public
*/
2001-05-08 23:20:47 +02:00
class phpgw
{
var $accounts;
var $applications;
var $acl;
var $auth;
2001-03-07 01:14:48 +01:00
var $db;
2001-07-26 13:02:10 +02:00
/**
* Turn on debug mode. Will output additional data for debugging purposes.
* @var string $debug
* @access public
*/
var $debug = 0; // This will turn on debugging information.
var $crypto;
var $categories;
var $common;
var $datetime;
var $hooks;
var $network;
var $nextmatchs;
var $preferences;
var $session;
var $send;
var $template;
var $translation;
var $utilities;
var $vfs;
var $calendar;
var $msg;
var $addressbook;
var $todo;
/**************************************************************************\
* Core functions *
\**************************************************************************/
2001-02-09 04:11:59 +01:00
2001-07-26 13:02:10 +02:00
/**
* Strips out html chars
*
* Used as a shortcut for stripping out html special chars.
*
* @access public
* @param $s string The string to have its html special chars stripped out.
* @return string The string with html special characters removed
* @syntax strip_html($string)
* @example $reg_string = strip_html($urlencode_string);
*/
function strip_html($s)
{
return htmlspecialchars(stripslashes($s));
}
2001-07-26 13:02:10 +02:00
/**
* Link url generator
*
* Used for backwards compatibility and as a shortcut. If no url is passed, it will use PHP_SELF. Wrapper to session->link()
*
* @access public
* @param string $string The url the link is for
* @param string $extravars Extra params to be passed to the url
* @return string The full url after processing
* @see session->link()
* @syntax link($string, $extravars)
* @example None yet
*/
function link($url = '', $extravars = '')
{
2001-10-17 20:15:04 +02:00
/* global $phpgw, $phpgw_info, $usercookie, $kp3, $PHP_SELF; */
return $this->session->link($url, $extravars);
}
2001-07-26 13:02:10 +02:00
/**
* Handles redirects under iis and apache
*
* This function handles redirects under iis and apache it assumes that $phpgw->link() has already been called
*
* @access public
* @param string The url ro redirect to
* @syntax redirect(key as string)
* @example None yet
*/
function redirect($url = '')
{
2001-10-17 20:15:04 +02:00
/* global $HTTP_ENV_VARS; */
2001-10-17 20:15:04 +02:00
$iis = @strpos($GLOBALS['HTTP_ENV_VARS']['SERVER_SOFTWARE'], 'IIS', 0);
2001-07-26 13:02:10 +02:00
if ( !$url )
{
$url = $PHP_SELF;
}
2001-07-26 13:02:10 +02:00
if ( $iis )
{
echo "\n<HTML>\n<HEAD>\n<TITLE>Redirecting to $url</TITLE>";
echo "\n<META HTTP-EQUIV=REFRESH CONTENT=\"0; URL=$url\">";
echo "\n</HEAD><BODY>";
echo "<H3>Please continue to <a href=\"$url\">this page</a></H3>";
echo "\n</BODY></HTML>";
exit;
2001-07-26 13:02:10 +02:00
}
else
{
Header("Location: $url");
print("\n\n");
exit;
}
}
2001-07-26 13:02:10 +02:00
/**
2001-10-17 20:15:04 +02:00
* Shortcut to translation class
2001-07-26 13:02:10 +02:00
*
* This function is a basic wrapper to translation->translate()
*
* @access public
* @param string The key for the phrase
* @param string the first additional param
* @param string the second additional param
* @param string the thrid additional param
* @param string the fourth additional param
* @see translation->translate()
*/
function lang($key, $m1 = '', $m2 = '', $m3 = '', $m4 = '')
{
2001-10-17 20:15:04 +02:00
/* global $phpgw; */
return $this->translation->translate($key);
}
2001-10-17 20:15:04 +02:00
} /* end of class */
?>