fixed header to use and added my debug constants along with my replacement for print_debug

This commit is contained in:
seek3r 2002-02-12 09:10:40 +00:00
parent 2ead51ae60
commit 2df5d74dd3
6 changed files with 61 additions and 103 deletions

View File

@ -21,9 +21,9 @@
define('PHPGW_SERVER_ROOT','{SERVER_ROOT}'); define('PHPGW_SERVER_ROOT','{SERVER_ROOT}');
define('PHPGW_INCLUDE_ROOT','{INCLUDE_ROOT}'); define('PHPGW_INCLUDE_ROOT','{INCLUDE_ROOT}');
$phpgw_info['server']['header_admin_password'] = '{HEADER_ADMIN_PASSWORD}'; $GLOBALS['phpgw_info']['server']['header_admin_password'] = '{HEADER_ADMIN_PASSWORD}';
$phpgw_domain['default'] = array ( $GLOBALS['phpgw_domain']['default'] = array (
'db_host' => '{DB_HOST}', 'db_host' => '{DB_HOST}',
'db_name' => '{DB_NAME}', 'db_name' => '{DB_NAME}',
'db_user' => '{DB_USER}', 'db_user' => '{DB_USER}',
@ -34,7 +34,7 @@
'config_passwd' => '{CONFIG_PASS}' 'config_passwd' => '{CONFIG_PASS}'
); );
$phpgw_info['server']['db_persistent'] = {DB_PERSISTENT}; $GLOBALS['phpgw_info']['server']['db_persistent'] = {DB_PERSISTENT};
/* /*
** phpGroupWare can handle session management using the database, but if ** phpGroupWare can handle session management using the database, but if
@ -50,15 +50,15 @@
** Note: This is only for virtual domian support, default domain users can login only using ** Note: This is only for virtual domian support, default domain users can login only using
** there loginid. ** there loginid.
*/ */
$phpgw_info['server']['show_domain_selectbox'] = {DOMAIN_SELECTBOX}; $GLOBALS['phpgw_info']['server']['show_domain_selectbox'] = {DOMAIN_SELECTBOX};
/* Select which login template set you want, most people will use default */ /* Select which login template set you want, most people will use default */
$phpgw_info['login_template_set'] = 'default'; $GLOBALS['phpgw_info']['login_template_set'] = 'default';
/* This is used to control mcrypt's use */ /* This is used to control mcrypt's use */
$phpgw_info['server']['mcrypt_enabled'] = {ENABLE_MCRYPT}; $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = {ENABLE_MCRYPT};
/* Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use. */ /* Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use. */
$phpgw_info['server']['versions']['mcrypt'] = '{MCRYPT_VERSION}'; $GLOBALS['phpgw_info']['server']['versions']['mcrypt'] = '{MCRYPT_VERSION}';
/* /*
** This is a random string used as the initilazation vector for mcrypt ** This is a random string used as the initilazation vector for mcrypt
@ -66,12 +66,12 @@
** but you must not change it after that point! ** but you must not change it after that point!
** It should be around 30 bytes in length. ** It should be around 30 bytes in length.
*/ */
$phpgw_info['server']['mcrypt_iv'] = '{MCRYPT_IV}'; $GLOBALS['phpgw_info']['server']['mcrypt_iv'] = '{MCRYPT_IV}';
/* Uncomment this out and use this for supporting different domains using this single install */ /* Uncomment this out and use this for supporting different domains using this single install */
/* (ignore if you are only supporting a single domain)*/ /* (ignore if you are only supporting a single domain)*/
/* /*
$phpgw_domain['domain2.com'] = array ( $GLOBALS['phpgw_domain']['domain2.com'] = array (
'db_host' => 'localhost', 'db_host' => 'localhost',
'db_name' => 'phpgw_domain2', 'db_name' => 'phpgw_domain2',
'db_user' => 'phpgroupware', 'db_user' => 'phpgroupware',
@ -83,23 +83,28 @@
/* If you want phpGroupWare to be cached by proxy servers, uncomment the following */ /* If you want phpGroupWare to be cached by proxy servers, uncomment the following */
/* This is NOT recommended, but phpGroupWare should still work fine. */ /* This is NOT recommended, but phpGroupWare should still work fine. */
if (!isset($phpgw_info['flags']['nocachecontrol']) || !$phpgw_info['flags']['nocachecontrol'] == True) if (!isset($GLOBALS['phpgw_info']['flags']['nocachecontrol']) || !$GLOBALS['phpgw_info']['flags']['nocachecontrol'] == True)
{ {
header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0 header('Pragma: no-cache'); // HTTP/1.0
} }
/* debugging settings */
define('DEBUG_APP', False);
define('DEBUG_API', False);
define('DEBUG_LEVEL', 3);
/**************************************************************************\ /**************************************************************************\
* Do not edit these lines * * Do not edit these lines *
\**************************************************************************/ \**************************************************************************/
define('PHPGW_API_INC',PHPGW_INCLUDE_ROOT.'/phpgwapi/inc'); define('PHPGW_API_INC',PHPGW_INCLUDE_ROOT.'/phpgwapi/inc');
include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php');
$phpgw_info["server"]["versions"]["phpgwapi"] = $setup_info['phpgwapi']['version']; $GLOBALS['phpgw_info']["server"]["versions"]["phpgwapi"] = $setup_info['phpgwapi']['version'];
$phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header']; $GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
unset($setup_info); unset($setup_info);
$phpgw_info['server']['versions']['header'] = '1.19'; $GLOBALS['phpgw_info']['server']['versions']['header'] = '1.20';
/* This is a fix for NT */ /* This is a fix for NT */
if (!isset($phpgw_info['flags']['noapi']) || !$phpgw_info['flags']['noapi'] == True) if (!isset($GLOBALS['phpgw_info']['flags']['noapi']) || !$GLOBALS['phpgw_info']['flags']['noapi'] == True)
{ {
include(PHPGW_API_INC . '/functions.inc.php'); include(PHPGW_API_INC . '/functions.inc.php');
include(PHPGW_API_INC . '/xml_functions.inc.php'); include(PHPGW_API_INC . '/xml_functions.inc.php');

View File

@ -1,5 +1,4 @@
<?php <?php
/* $GLOBALS['debugme'] = "on"; */
/**************************************************************************\ /**************************************************************************\
* phpGroupWare API - phpgwapi loader * * phpGroupWare API - phpgwapi loader *
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> * * This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
@ -44,6 +43,45 @@
@abstract Direct functions, which are not part of the API class because they are require to be availble at the lowest level. @abstract Direct functions, which are not part of the API class because they are require to be availble at the lowest level.
*/ */
/*!
@function print_debug
@abstract print debug data only when debugging mode is turned on.
@author seek3r
@discussion This function is used to debugging data.
@syntax print_debug('message', $somevar);
@example print_debug('this is some debugging data',$somevar);
*/
function print_debug($message,$var = 'messageonly',$part = 'app', $level = 3)
{
if (($part == 'app' && DEBUG_APP == True) || ($part == 'api' && DEBUG_API == True))
{
if ($level >= DEBUG_LEVEL)
{
if (!is_array($var))
{
if ($var != 'messageonly')
{
echo "$message is a ".gettype($var)."<br>\n";
}
else
{
echo "$message<br>\n";
}
}
else
{
echo "<pre>\n$message\n";
print_r($var);
while(list($key, $value) = each($var))
{
echo 'Array['.$key.'] is a '.gettype($var[$key])."\n";
}
echo "\n<pre>\n";
}
}
}
}
/*! /*!
@function sanitize @function sanitize
@abstract Validate data. @abstract Validate data.
@ -466,30 +504,10 @@
} }
} }
/* Just a wrapper to my new print_r() function I added to the php3 support file. Seek3r */
function _debug_array($array) function _debug_array($array)
{ {
if(floor(phpversion()) == 4) print_r($array);
{
ob_start();
echo '<pre>'; print_r($array); echo '</pre>';
$contents = ob_get_contents();
ob_end_clean();
echo $contents;
// return $contents;
}
else
{
echo '<pre>'; var_dump($array); echo '</pre>';
}
}
function print_debug($text='')
{
if (isset($GLOBALS['debugme']) &&
$GLOBALS['debugme'] == 'on')
{
echo 'debug: '.$text.'<br>';
}
} }
/*! /*!

View File

@ -15,7 +15,7 @@
$setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'phpgwapi';
$setup_info['phpgwapi']['version'] = '0.9.15.001'; $setup_info['phpgwapi']['version'] = '0.9.15.001';
$setup_info['phpgwapi']['versions']['current_header'] = '1.19'; $setup_info['phpgwapi']['versions']['current_header'] = '1.20';
$setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['enable'] = 3;
$setup_info['phpgwapi']['app_order'] = 1; $setup_info['phpgwapi']['app_order'] = 1;

View File

@ -38,65 +38,6 @@
$bodyheader .= ' topmargin="0" marginheight="0" marginwidth="0" leftmargin="0"'; $bodyheader .= ' topmargin="0" marginheight="0" marginwidth="0" leftmargin="0"';
} }
/*
@capability: page autorefresh
@discussion: I know of 3 ways to get a page to reload, 2 of those ways are pretty much the same
(1) the http header
Refresh: 5;
(2) the META http-equiv
<META HTTP-EQUIV="Refresh" CONTENT="5">
both 1 and 2 have the same effect as hitting the "reload" button, which in *many* browsers will
force a re-download of all the images on the page, i.e. the browser will NOT use the cached images
(3) java script combo of "window.setTimeout" with "window.location"
window.setTimeout('window.location="http://example.com/phpgw/email/index.php"; ',1800000);
method 3 is the only one I know of that will use the images from the cache.
also, 3 takes a reload value in miliseconds, so a value of 180000 is really 3 minutes
ALSO, use if..then code to only auto-refresh certain pages, such as email/index.php
@author Angles Nov 28, 2001
*/
$auto_refresh_enabled = True;
//$auto_refresh_enabled = False;
// initialize reload location to empty string
$reload_me = '';
if ($auto_refresh_enabled)
{
if ((stristr($GLOBALS['PHP_SELF'], '/email/index.php'))
|| ( ((isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
&& (stristr($GLOBALS['HTTP_GET_VARS']['menuaction'], 'email.uiindex.index')))
)
)
{
if ((isset($GLOBALS['phpgw_info']['flags']['email_refresh_uri']))
&& ($GLOBALS['phpgw_info']['flags']['email_refresh_uri'] != ''))
{
$reload_me = $GLOBALS['phpgw']->link('/index.php',$GLOBALS['phpgw_info']['flags']['email_refresh_uri']);
}
else
{
$reload_me = $GLOBALS['phpgw']->link('/email/index.php');
}
}
elseif (eregi("^.*\/home\.php.*$",$GLOBALS['PHP_SELF']))
{
$reload_me = $GLOBALS['phpgw']->link('/home.php');
}
}
// make the JS command string if necessary
if (($auto_refresh_enabled)
&& ($reload_me != ''))
{
// set refresh time in miliseconds (1000 = 1 sec) (180000 = 180 sec = 3 minutes)
// ( 240000 = 240 sec = 4 min) (300000 = 5 min) (600000 = 10 min)
$refresh_ms = '240000';
$email_reload_js =
'window.setTimeout('."'".'window.location="'
.$reload_me.'"; '."'".','.$refresh_ms.');';
}
else
{
$email_reload_js = '';
}
$tpl = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR); $tpl = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$tpl->set_unknowns('remove'); $tpl->set_unknowns('remove');
$tpl->set_file(array('head' => 'head.tpl')); $tpl->set_file(array('head' => 'head.tpl'));
@ -111,7 +52,6 @@
'css_alink' => $GLOBALS['phpgw_info']['theme']['alink'], 'css_alink' => $GLOBALS['phpgw_info']['theme']['alink'],
'css_vlink' => $GLOBALS['phpgw_info']['theme']['vlink'], 'css_vlink' => $GLOBALS['phpgw_info']['theme']['vlink'],
'css_hovlink' => $csshover, 'css_hovlink' => $csshover,
'email_reload_js' => $email_reload_js,
'app_css' => $app_css 'app_css' => $app_css
); );
$tpl->set_var($var); $tpl->set_var($var);

View File

@ -22,7 +22,6 @@
</STYLE> </STYLE>
<script language="JavaScript"> <script language="JavaScript">
<!-- <!--
{email_reload_js}
function MM_preloadImages() function MM_preloadImages()
{ {
if (document.images) if (document.images)

View File

@ -51,14 +51,12 @@
while ($app = each($GLOBALS['phpgw_info']['navbar'])) while ($app = each($GLOBALS['phpgw_info']['navbar']))
{ {
if ($app[1]['title'] != 'Home' && $app[1]['title'] != 'preferences' && !ereg('About',$app[1]['title']) && $app[1]['title'] != 'Logout') if ($app[1]['title'] != 'Home' && $app[1]['title'] != 'preferences' && !ereg('About',$app[1]['title']) && $app[1]['title'] != 'Logout')
// if ($app[1]['title'] != 'Home' && $app[1]['title'] != 'preferences' && $app[1]['title'] != 'About' && $app[1]['title'] != 'Logout')
{ {
$title = '<img src="' . $app[1]['icon'] . '" alt="' . $app[1]['title'] . '" title="' $title = '<img src="' . $app[1]['icon'] . '" alt="' . $app[1]['title'] . '" title="'
. lang($app[1]['title']) . '" border="0" name="' . str_replace('-','_',$app[0]) . '">'; . lang($app[1]['title']) . '" border="0" name="' . str_replace('-','_',$app[0]) . '">';
$img_src_over = $app[1]['icon_hover']; $img_src_over = $app[1]['icon_hover'];
$img_src_out = $app[1]['icon']; $img_src_out = $app[1]['icon'];
// onMouseOver="two.src='rollover/admin_over.gif'" onMouseOut="two.src='images/admin.gif'"><img src="images/admin.gif" border="0" name="two"
$applications .= '<tr><td><a href="' . $app[1]['url'] . '"'; $applications .= '<tr><td><a href="' . $app[1]['url'] . '"';
if (isset($GLOBALS['phpgw_info']['flags']['navbar_target'])) if (isset($GLOBALS['phpgw_info']['flags']['navbar_target']))
{ {
@ -176,8 +174,6 @@
$var['user_info_date'] = $var['user_info_date'] =
lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' ' lang($GLOBALS['phpgw']->common->show_date($now,'l')) . ' '
. $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); . $GLOBALS['phpgw']->common->show_date($now,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
// . lang($GLOBALS['phpgw']->common->show_date($now,'F')) . ' '
// . $GLOBALS['phpgw']->common->show_date($now,'d, Y');
$var['user_info'] = $var['user_info_name'] .' - ' .$var['user_info_date']; $var['user_info'] = $var['user_info_name'] .' - ' .$var['user_info_date'];
$var['user_info_size'] = '2'; $var['user_info_size'] = '2';
$var['user_info_color'] = '#000000'; $var['user_info_color'] = '#000000';