2001-01-11 10:52:33 +01:00
|
|
|
<?php
|
2001-02-07 21:22:17 +01:00
|
|
|
/**************************************************************************\
|
2004-05-05 14:06:13 +02:00
|
|
|
* eGroupWare API - Core class and functions for eGroupWare *
|
2001-02-07 21:22:17 +01:00
|
|
|
* 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 *
|
2001-02-07 21:22:17 +01:00
|
|
|
* Copyright (C) 2000, 2001 Dan Kuykendall *
|
2003-08-28 16:31:11 +02:00
|
|
|
* Parts Copyright (C) 2003 Free Software Foundation *
|
2001-02-07 21:22:17 +01:00
|
|
|
* -------------------------------------------------------------------------*
|
2004-05-05 14:06:13 +02:00
|
|
|
* This library is part of the eGroupWare API *
|
|
|
|
* http://www.egroupware.org/api *
|
2001-02-07 21:22:17 +01:00
|
|
|
* ------------------------------------------------------------------------ *
|
|
|
|
* 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
|
|
|
|
|
|
|
/**
|
2001-05-10 09:59:48 +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>
|
2001-05-10 09:59:48 +02:00
|
|
|
* @copyright LGPL
|
2001-05-08 23:20:47 +02:00
|
|
|
* @package phpgwapi
|
2001-07-26 13:02:10 +02:00
|
|
|
* @access public
|
2001-02-13 11:53:18 +01:00
|
|
|
*/
|
2001-05-08 23:20:47 +02:00
|
|
|
|
2001-02-07 21:22:17 +01: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
|
|
|
*/
|
2001-02-07 21:22:17 +01:00
|
|
|
var $debug = 0; // This will turn on debugging information.
|
|
|
|
var $crypto;
|
|
|
|
var $categories;
|
|
|
|
var $common;
|
2001-05-20 03:20:20 +02:00
|
|
|
var $datetime;
|
2001-02-07 21:22:17 +01:00
|
|
|
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
|
2003-08-28 16:31:11 +02:00
|
|
|
* @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-02-07 21:22:17 +01:00
|
|
|
|
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
|
2003-08-28 16:31:11 +02:00
|
|
|
* @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 = '')
|
2001-02-07 21:22:17 +01:00
|
|
|
{
|
|
|
|
return $this->session->link($url, $extravars);
|
|
|
|
}
|
|
|
|
|
2003-03-31 18:50:49 +02:00
|
|
|
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
|
|
|
|
*/
|
2003-08-28 16:31:11 +02:00
|
|
|
function is_repost($display_error = False)
|
|
|
|
{
|
|
|
|
return $this->session->is_repost($display_error);
|
|
|
|
}
|
2003-10-25 13:37:36 +02:00
|
|
|
|
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
|
2003-08-28 16:31:11 +02:00
|
|
|
* @syntax redirect(key as string)
|
2001-07-26 13:02:10 +02:00
|
|
|
* @example None yet
|
|
|
|
*/
|
|
|
|
function redirect($url = '')
|
2001-02-07 21:22:17 +01:00
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
/* global $HTTP_ENV_VARS; */
|
2002-05-30 11:47:09 +02:00
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
$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'];
|
2001-02-07 21:22:17 +01:00
|
|
|
}
|
2004-01-26 04:31:56 +01:00
|
|
|
if($iis)
|
2001-07-26 13:02:10 +02:00
|
|
|
{
|
2001-02-07 21:22:17 +01: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>";
|
2003-08-28 16:31:11 +02:00
|
|
|
exit;
|
2001-07-26 13:02:10 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-02-07 21:22:17 +01:00
|
|
|
Header("Location: $url");
|
|
|
|
print("\n\n");
|
2003-08-28 16:31:11 +02:00
|
|
|
exit;
|
2001-02-07 21:22:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 = '')
|
2001-02-07 21:22:17 +01:00
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
/* global $phpgw; */
|
2001-02-07 21:22:17 +01:00
|
|
|
return $this->translation->translate($key);
|
|
|
|
}
|
2001-10-17 20:15:04 +02:00
|
|
|
} /* end of class */
|
2001-05-20 03:20:20 +02:00
|
|
|
?>
|