egroupware/phpgwapi/inc/class.phpgw.inc.php

187 lines
5.8 KiB
PHP
Raw Normal View History

<?php
/**************************************************************************\
2004-05-05 14:06:13 +02:00
* eGroupWare API - Core class and functions for eGroupWare *
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
* and Joseph Engo <jengo@phpgroupware.org> *
2004-05-05 14:06:13 +02:00
* This is the central class for the eGroupWare API *
* Copyright (C) 2000, 2001 Dan Kuykendall *
* Parts Copyright (C) 2003 Free Software Foundation *
* -------------------------------------------------------------------------*
2004-05-05 14:06:13 +02:00
* This library is part of the eGroupWare API *
* http://www.egroupware.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;
2004-01-26 04:31:56 +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
2004-01-26 04:31:56 +01:00
*/
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
*
2004-01-26 04:31:56 +01:00
* Used as a shortcut for stripping out html special chars.
2001-07-26 13:02:10 +02:00
*
* @access public
* @param $s string The string to have its html special chars stripped out.
2001-07-26 13:02:10 +02:00
* @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
2001-07-26 13:02:10 +02:00
* @return string The full url after processing
* @see session->link()
* @syntax link($string, $extravars)
* @example None yet
*/
function link($url = '', $extravars = '')
{
return $this->session->link($url, $extravars);
}
function redirect_link($url = '',$extravars='')
{
$this->redirect($this->session->link($url, $extravars));
}
2004-01-26 04:31:56 +01:00
/**
* Repost Prevention Detection
*
* Used as a shortcut. Wrapper to session->is_repost()
*
* @access public
* @param bool $display_error Use common error handler? - not yet implemented
* @return bool True if called previously, else False - call ok
* @see session->is_repost()
* @syntax is_post()
* @example $repost = $GLOBALS['phpgwapi']->is_repost();
* @author Dave Hall
*/
function is_repost($display_error = False)
{
return $this->session->is_repost($display_error);
}
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
2003-10-15 15:18:13 +02:00
* @param string The url ro redirect to
* @syntax redirect(key as string)
2001-07-26 13:02:10 +02:00
* @example None yet
*/
function redirect($url = '')
{
/* global $HTTP_ENV_VARS; */
$iis = @strpos($GLOBALS['HTTP_ENV_VARS']['SERVER_SOFTWARE'], 'IIS', 0);
2004-01-26 04:31:56 +01:00
if(!$url)
2001-07-26 13:02:10 +02:00
{
2003-10-15 15:18:13 +02:00
$url = $_SERVER['PHP_SELF'];
}
2004-01-26 04:31:56 +01:00
if($iis)
2001-07-26 13:02:10 +02:00
{
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()
*/
2004-01-26 04:31:56 +01:00
function lang($key, $m1 = '', $m2 = '', $m3 = '', $m4 = '')
{
/* global $phpgw; */
return $this->translation->translate($key);
}
2001-10-17 20:15:04 +02:00
} /* end of class */
?>