From 2df5d74dd39244b5ff8e5cc9d21b726acc13bd61 Mon Sep 17 00:00:00 2001 From: seek3r Date: Tue, 12 Feb 2002 09:10:40 +0000 Subject: [PATCH] fixed header to use and added my debug constants along with my replacement for print_debug --- header.inc.php.template | 33 ++++++----- phpgwapi/inc/functions.inc.php | 64 +++++++++++++-------- phpgwapi/setup/setup.inc.php | 2 +- phpgwapi/templates/idsociety/head.inc.php | 60 ------------------- phpgwapi/templates/idsociety/head.tpl | 1 - phpgwapi/templates/idsociety/navbar.inc.php | 4 -- 6 files changed, 61 insertions(+), 103 deletions(-) diff --git a/header.inc.php.template b/header.inc.php.template index 37a8f79613..96ba1209a4 100644 --- a/header.inc.php.template +++ b/header.inc.php.template @@ -21,9 +21,9 @@ define('PHPGW_SERVER_ROOT','{SERVER_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_name' => '{DB_NAME}', 'db_user' => '{DB_USER}', @@ -34,7 +34,7 @@ '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 @@ -50,15 +50,15 @@ ** Note: This is only for virtual domian support, default domain users can login only using ** 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 */ - $phpgw_info['login_template_set'] = 'default'; + $GLOBALS['phpgw_info']['login_template_set'] = 'default'; /* 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. */ - $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 @@ -66,12 +66,12 @@ ** but you must not change it after that point! ** 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 */ /* (ignore if you are only supporting a single domain)*/ /* - $phpgw_domain['domain2.com'] = array ( + $GLOBALS['phpgw_domain']['domain2.com'] = array ( 'db_host' => 'localhost', 'db_name' => 'phpgw_domain2', 'db_user' => 'phpgroupware', @@ -83,23 +83,28 @@ /* If you want phpGroupWare to be cached by proxy servers, uncomment the following */ /* 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('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 * \**************************************************************************/ define('PHPGW_API_INC',PHPGW_INCLUDE_ROOT.'/phpgwapi/inc'); include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); - $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"]["phpgwapi"] = $setup_info['phpgwapi']['version']; + $GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header']; unset($setup_info); - $phpgw_info['server']['versions']['header'] = '1.19'; + $GLOBALS['phpgw_info']['server']['versions']['header'] = '1.20'; /* 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 . '/xml_functions.inc.php'); diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 01d38031eb..f7f2d25355 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -1,5 +1,4 @@ * @@ -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. */ + /*! + @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)."
\n"; + } + else + { + echo "$message
\n"; + } + } + else + { + echo "
\n$message\n";
+					print_r($var);
+					while(list($key, $value) = each($var))
+					{
+						echo 'Array['.$key.'] is a '.gettype($var[$key])."\n";
+					}
+					echo "\n
\n";
+				}
+			}
+		}
+	}
+	
 	/*!
 	 @function sanitize
 	 @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)
 	{
-		if(floor(phpversion()) == 4)
-		{
-			ob_start(); 
-			echo '
'; print_r($array); echo '
'; - $contents = ob_get_contents(); - ob_end_clean(); - echo $contents; -// return $contents; - } - else - { - echo '
'; var_dump($array); echo '
'; - } - } - - function print_debug($text='') - { - if (isset($GLOBALS['debugme']) && - $GLOBALS['debugme'] == 'on') - { - echo 'debug: '.$text.'
'; - } + print_r($array); } /*! diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index ba103853c3..ab34602656 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -15,7 +15,7 @@ $setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'phpgwapi'; $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']['app_order'] = 1; diff --git a/phpgwapi/templates/idsociety/head.inc.php b/phpgwapi/templates/idsociety/head.inc.php index 0b00346c9d..2bc7e5f971 100644 --- a/phpgwapi/templates/idsociety/head.inc.php +++ b/phpgwapi/templates/idsociety/head.inc.php @@ -37,65 +37,6 @@ { $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 - - 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->set_unknowns('remove'); @@ -111,7 +52,6 @@ 'css_alink' => $GLOBALS['phpgw_info']['theme']['alink'], 'css_vlink' => $GLOBALS['phpgw_info']['theme']['vlink'], 'css_hovlink' => $csshover, - 'email_reload_js' => $email_reload_js, 'app_css' => $app_css ); $tpl->set_var($var); diff --git a/phpgwapi/templates/idsociety/head.tpl b/phpgwapi/templates/idsociety/head.tpl index 2198314ba9..77b329e632 100644 --- a/phpgwapi/templates/idsociety/head.tpl +++ b/phpgwapi/templates/idsociety/head.tpl @@ -22,7 +22,6 @@