[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.Template.inc.php,1.24,1.25 cl
From: |
Dan Kuykendall <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.Template.inc.php,1.24,1.25 class.Template_experimental.inc.php,1.1,1.2 class.common.inc.php,1.141,1.142 class.phpgw.inc.php,1.43,1.44 class.sessions_db.inc.php,1.5,1.6 class.sessions_php4.inc.php,1.8,1.9 common_functions.inc.php,1.9,1.10 functions.inc.php,1.138,1.139 |
Date: |
Thu, 30 May 2002 05:44:41 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv19238/phpgwapi/inc
Modified Files:
class.Template.inc.php class.Template_experimental.inc.php
class.common.inc.php class.phpgw.inc.php
class.sessions_db.inc.php class.sessions_php4.inc.php
common_functions.inc.php functions.inc.php
Log Message:
massive and sweeping change to the link() function, the way the app loads up,
to a single templates class instance, to a new template set structure which
automaticly handles frames support. We will have much cleanup to do to get apps
working again and have them following the new guidelines
Index: class.Template.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.Template.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** class.Template.inc.php 27 May 2002 08:22:12 -0000 1.24
--- class.Template.inc.php 30 May 2002 09:44:38 -0000 1.25
***************
*** 27,30 ****
--- 27,31 ----
/* relative filenames are relative to this pathname */
var $root = '';
+ var $oldroot = '';
/* $varkeys[key] = 'key'; $varvals[key] = 'value'; */
***************
*** 56,79 ****
$this->print = True;
}
- /* This covers loading up the common tpl file and CSS
data */
- if(defined('PHPGW_TEMPLATE_DIR'))
- {
- $this->set_root(PHPGW_TEMPLATE_DIR);
- $this->set_file('common', 'common.tpl');
- }
- else
- {
-
$this->set_root(PHPGW_INCLUDE_ROOT.'/phpgwapi/templates/default');
- $this->set_file('common', 'common.tpl');
- }
-
- /* This covers setting the theme values so that each
app doesnt have to */
- $theme_data = $GLOBALS['phpgw_info']['theme'];
- unset($theme_data['css']);
- $this->set_var($theme_data);
- unset($theme_data);
- $this->update_css();
-
- /* Now move on to loading up the requested template set
*/
$this->set_root($root);
$this->set_unknowns($unknowns);
--- 57,60 ----
***************
*** 97,100 ****
--- 78,98 ----
}
+ function update_preload_images()
+ {
+
if(@is_array($GLOBALS['phpgw_info']['flags']['preload_images']))
+ {
+ $preload_image_string = '';
+
reset($GLOBALS['phpgw_info']['flags']['preload_images']);
+ //$css_string = '<STYLE type="text/css">'."\n";
+ while(list($key,$value) =
each($GLOBALS['phpgw_info']['flags']['preload_images']))
+ {
+ $css_string .= "\n\t$key { $value } ";
+ }
+ $css_string .= "\n";
+ //$css_string .= '</STYLE>'."\n";
+ $this->set_var('phpgw_css',$css_string);
+ }
+ }
+
/* public: setroot(pathname $root)
* root: new template directory.
***************
*** 105,112 ****
{
$this->halt("set_root: $root is not a
directory.");
! return false;
}
$this->root = $root;
! return true;
}
--- 103,116 ----
{
$this->halt("set_root: $root is not a
directory.");
! return False;
}
+ $this->oldroot = $this->root;
$this->root = $root;
! return True;
! }
!
! function reset_root()
! {
! $this->root = $this->oldroot;
}
***************
*** 134,138 ****
{
$this->halt("set_file: For handle
$handle filename is empty.");
! return false;
}
$this->file[$handle] =
$this->filename($filename);
--- 138,142 ----
{
$this->halt("set_file: For handle
$handle filename is empty.");
! return False;
}
$this->file[$handle] =
$this->filename($filename);
***************
*** 157,162 ****
{
$this->halt("subst: unable to load $parent.");
! return false;
}
if ($name == '')
{
--- 161,167 ----
{
$this->halt("subst: unable to load $parent.");
! return False;
}
+
if ($name == '')
{
***************
*** 166,172 ****
$reg = "/<!--\s+BEGIN $handle\s+-->(.*)\n\s*<!--\s+END
$handle\s+-->/sm";
preg_match_all($reg, $str, $m);
! $str = preg_replace($reg, '{' . "$name}", $str);
! $this->set_var($handle, $m[1][0]);
! $this->set_var($parent, $str);
}
--- 171,175 ----
$reg = "/<!--\s+BEGIN $handle\s+-->(.*)\n\s*<!--\s+END
$handle\s+-->/sm";
preg_match_all($reg, $str, $m);
! $this->set_var($name, $m[1][0]);
}
***************
*** 178,182 ****
* value: value of that variable
*/
! function set_var($varname, $value = '')
{
if (!is_array($varname))
--- 181,185 ----
* value: value of that variable
*/
! function set_var($varname, $value = '', $append=False)
{
if (!is_array($varname))
***************
*** 189,193 ****
}
$this->varkeys[$varname] =
$this->varname($varname);
! $this->varvals[$varname] = $value;
}
}
--- 192,204 ----
}
$this->varkeys[$varname] =
$this->varname($varname);
!
! if ($append)
! {
! $this->varvals[$varname] =
$this->get_var($varname).$value;
! }
! else
! {
! $this->varvals[$varname] =
$value;
! }
}
}
***************
*** 204,208 ****
}
$this->varkeys[$k] =
$this->varname($k);
! $this->varvals[$k] = $v;
}
}
--- 215,228 ----
}
$this->varkeys[$k] =
$this->varname($k);
!
! if ($append)
! {
! $this->varvals[$k] =
$this->get_var($k).$v;
! }
! else
! {
! $this->varvals[$k] = $v;
! }
!
}
}
***************
*** 218,222 ****
{
$this->halt("subst: unable to load $handle.");
! return false;
}
--- 238,242 ----
{
$this->halt("subst: unable to load $handle.");
! return False;
}
***************
*** 236,240 ****
{
print $this->subst($handle);
! return false;
}
--- 256,260 ----
{
print $this->subst($handle);
! return False;
}
***************
*** 245,261 ****
* append: append to target handle
*/
! function parse($target, $handle, $append = false)
{
if (!is_array($handle))
{
$str = $this->subst($handle);
! if ($append)
! {
! $this->set_var($target,
$this->get_var($target) . $str);
! }
! else
! {
! $this->set_var($target, $str);
! }
}
else
--- 265,274 ----
* append: append to target handle
*/
! function parse($target, $handle, $append = False)
{
if (!is_array($handle))
{
$str = $this->subst($handle);
! $this->set_var($target, $str, $append);
}
else
***************
*** 271,278 ****
}
! function pparse($target, $handle, $append = false)
{
print $this->parse($target, $handle, $append);
! return false;
}
--- 284,291 ----
}
! function pparse($target, $handle, $append = False)
{
print $this->parse($target, $handle, $append);
! return False;
}
***************
*** 332,336 ****
{
$this->halt("get_undefined: unable to load
$handle.");
! return false;
}
--- 345,349 ----
{
$this->halt("get_undefined: unable to load
$handle.");
! return False;
}
***************
*** 339,343 ****
if (!is_array($m))
{
! return false;
}
reset($m);
--- 352,356 ----
if (!is_array($m))
{
! return False;
}
reset($m);
***************
*** 356,360 ****
else
{
! return false;
}
}
--- 369,373 ----
else
{
! return False;
}
}
***************
*** 465,474 ****
if (isset($this->varkeys[$handle]) and
!empty($this->varvals[$handle]))
{
! return true;
}
if (!isset($this->file[$handle]))
{
$this->halt("loadfile: $handle is not a valid
handle.");
! return false;
}
$filename = $this->file[$handle];
--- 478,487 ----
if (isset($this->varkeys[$handle]) and
!empty($this->varvals[$handle]))
{
! return True;
}
if (!isset($this->file[$handle]))
{
$this->halt("loadfile: $handle is not a valid
handle.");
! return False;
}
$filename = $this->file[$handle];
***************
*** 478,486 ****
{
$this->halt("loadfile: While loading $handle,
$filename does not exist or is empty.");
! return false;
}
$this->set_var($handle, $str);
! return true;
}
--- 491,499 ----
{
$this->halt("loadfile: While loading $handle,
$filename does not exist or is empty.");
! return False;
}
$this->set_var($handle, $str);
! return True;
}
***************
*** 503,507 ****
}
! $GLOBALS['phpgw']->common->phpgw_exit(True);
}
--- 516,520 ----
}
! $GLOBALS['phpgw']->common->phpgw_exit();
}
Index: class.Template_experimental.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware/phpgwapi/inc/class.Template_experimental.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.Template_experimental.inc.php 2 Jan 2002 14:37:15 -0000 1.1
--- class.Template_experimental.inc.php 30 May 2002 09:44:38 -0000 1.2
***************
*** 441,446 ****
if (!isset($this->file[$handle]))
{
! $this->halt("loadfile: $handle is not a valid
handle.");
! return false;
}
$filename = $this->file[$handle];
--- 441,454 ----
if (!isset($this->file[$handle]))
{
! if(isset($this->varvals[$handle])
! {
! return True;
! }
! else
! {
! $this->halt("loadfile: $handle is not a
valid handle.");
! return false;
! }
!
}
$filename = $this->file[$handle];
Index: class.common.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.common.inc.php,v
retrieving revision 1.141
retrieving revision 1.142
diff -C2 -r1.141 -r1.142
*** class.common.inc.php 26 May 2002 19:57:35 -0000 1.141
--- class.common.inc.php 30 May 2002 09:44:38 -0000 1.142
***************
*** 983,986 ****
--- 983,995 ----
function msgbox($text='',$type=True,$output='return')
{
+ if($output != 'return')
+ {
+ $return_result = False;
+ }
+ else
+ {
+ $return_result = True;
+ $output = 'phpgw_msgbox';
+ }
if ($text=='' &&
@isset($GLOBALS['phpgw_info']['flags']['msgbox_data']))
{
***************
*** 992,999 ****
return;
}
!
$GLOBALS['phpgw']->template->set_block('common','msgbox_start');
!
$GLOBALS['phpgw']->template->set_block('common','msgbox_row');
!
$GLOBALS['phpgw']->template->set_block('common','msgbox_end');
!
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_start');
if (is_array($text))
--- 1001,1008 ----
return;
}
!
$GLOBALS['phpgw']->template->set_block('msgbox','msgbox_start');
!
$GLOBALS['phpgw']->template->set_block('msgbox','msgbox_row');
!
$GLOBALS['phpgw']->template->set_block('msgbox','msgbox_end');
! $GLOBALS['phpgw']->template->fp($output,'msgbox_start');
if (is_array($text))
***************
*** 1025,1029 ****
$GLOBALS['phpgw']->template->set_var('msgbox_img_alt','ERROR');
}
!
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_row',True);
}
}
--- 1034,1038 ----
$GLOBALS['phpgw']->template->set_var('msgbox_img_alt','ERROR');
}
!
$GLOBALS['phpgw']->template->fp($output,'msgbox_row',True);
}
}
***************
*** 1042,1057 ****
$GLOBALS['phpgw']->template->set_var('msgbox_img_alt','ERROR');
}
!
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_row',True);
}
!
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_end',True);
! if($output == 'out')
! {
! $GLOBALS['phpgw']->template->pfp('out',
'msgbox');
! return;
! }
! else /* covers the default of 'return' */
{
! return
$GLOBALS['phpgw']->template->varvals['msgbox'];
}
}
--- 1051,1061 ----
$GLOBALS['phpgw']->template->set_var('msgbox_img_alt','ERROR');
}
!
$GLOBALS['phpgw']->template->fp($output,'msgbox_row',True);
}
!
$GLOBALS['phpgw']->template->fp($output,'msgbox_end',True);
! if($return_result)
{
! return
$GLOBALS['phpgw']->template->varvals[$output];
}
}
***************
*** 1144,1158 ****
$GLOBALS['phpgw_info']['navbar']['logout']['icon'] =
$this->image('phpgwapi',Array('logout','nonav'));
$GLOBALS['phpgw_info']['navbar']['logout']['icon_hover'] =
$this->image_on('phpgwapi',Array('logout','nonav'),'-over');
-
-
/*************************************************************************\
- * If they are using frames, we need to set some
variables *
-
\*************************************************************************/
-
if(((isset($GLOBALS['phpgw_info']['user']['preferences']['common']['useframes'])
&&
-
$GLOBALS['phpgw_info']['user']['preferences']['common']['useframes']) &&
- $GLOBALS['phpgw_info']['server']['useframes']
== 'allowed') ||
- ($GLOBALS['phpgw_info']['server']['useframes']
== 'always'))
- {
-
$GLOBALS['phpgw_info']['flags']['navbar_target'] = 'phpgw_body';
- }
}
--- 1148,1151 ----
***************
*** 1163,1166 ****
--- 1156,1160 ----
function phpgw_header($forceheader = True, $forcenavbar = True)
{
+ /*
if($forceheader)
{
***************
*** 1174,1187 ****
if (address@hidden'phpgw_info']['flags']['noheader'])
{
! include(PHPGW_INCLUDE_ROOT .
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set'] .
'/head.inc.php');
}
if(!function_exists('parse_navbar'))
{
$this->navbar(False);
! include(PHPGW_INCLUDE_ROOT .
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set'] .
'/navbar.inc.php');
}
if (address@hidden'phpgw_info']['flags']['nonavbar'] &&
address@hidden'phpgw_info']['flags']['navbar_target'])
{
parse_navbar();
}
//elseif
(address@hidden'phpgw_info']['flags']['noheader'] &&
function_exists('parse_nonavbar'))
--- 1168,1187 ----
if (address@hidden'phpgw_info']['flags']['noheader'])
{
!
$GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
! include(PHPGW_TEMPLATE_DIR.'/head.inc.php');
! $GLOBALS['phpgw']->template->reset_root();
}
if(!function_exists('parse_navbar'))
{
+
$GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
$this->navbar(False);
! include(PHPGW_TEMPLATE_DIR.'/navbar.inc.php');
! $GLOBALS['phpgw']->template->reset_root();
}
if (address@hidden'phpgw_info']['flags']['nonavbar'] &&
address@hidden'phpgw_info']['flags']['navbar_target'])
{
+
$GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
parse_navbar();
+ $GLOBALS['phpgw']->template->reset_root();
}
//elseif
(address@hidden'phpgw_info']['flags']['noheader'] &&
function_exists('parse_nonavbar'))
***************
*** 1191,1197 ****
if (address@hidden'phpgw_info']['flags']['noheader'] &&
address@hidden'phpgw_info']['flags']['nonavbar'])
{
- $this->msgbox('',False,'out');
$GLOBALS['phpgw']->hooks->process('after_navbar');
}
}
--- 1191,1197 ----
if (address@hidden'phpgw_info']['flags']['noheader'] &&
address@hidden'phpgw_info']['flags']['nonavbar'])
{
$GLOBALS['phpgw']->hooks->process('after_navbar');
}
+ */
}
***************
*** 1215,1259 ****
}
}
function phpgw_footer()
{
global $HTMLCOMPLIANT;
!
! if (!isset($GLOBALS['phpgw_info']['flags']['nofooter'])
|| !$GLOBALS['phpgw_info']['flags']['nofooter'])
{
! if((file_exists(PHPGW_APP_INC .
'/footer.inc.php') || MENUACTION) &&
!
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
!
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'login' &&
!
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'logout' &&
!
address@hidden'phpgw_info']['flags']['noappfooter'])
{
! if(MENUACTION)
! {
! list($app,$class,$method) =
explode('.',MENUACTION);
!
if(is_array($GLOBALS[$class]->public_functions) &&
$GLOBALS[$class]->public_functions['footer'])
! {
! // eval("\$GLOBALS[$class]->footer();");
!
$GLOBALS[$class]->footer();
! }
!
elseif(file_exists(PHPGW_APP_INC.'/footer.inc.php'))
! {
! include(PHPGW_APP_INC .
'/footer.inc.php');
! }
! }
!
elseif(file_exists(PHPGW_APP_INC.'/footer.inc.php'))
{
! include(PHPGW_APP_INC .
'/footer.inc.php');
}
}
- $GLOBALS['phpgw']->db->disconnect();
- parse_navbar_end();
- }
! /* Clean up mcrypt */
! if (@is_object($GLOBALS['phpgw']->crypto))
! {
! $GLOBALS['phpgw']->crypto->cleanup();
! unset($GLOBALS['phpgw']->crypto);
}
}
--- 1215,1282 ----
}
}
+ /*!
+ @function phpgw_appfooter
+ @abstract load footer.inc.php for an application
+ */
+ function phpgw_appfooter()
+ {
+ if (!is_array(MENUACTION))
+ {
+ list($app,$class,$method) =
explode('.',MENUACTION);
+ if
(is_array($GLOBALS[$class]->public_functions) &&
$GLOBALS[$class]->public_functions['footer'])
+ {
+ $GLOBALS[$class]->footer();
+ }
+ }
+ elseif (file_exists(PHPGW_APP_INC . '/footer.inc.php'))
+ {
+ include(PHPGW_APP_INC . '/footer.inc.php');
+ }
+ }
function phpgw_footer()
{
global $HTMLCOMPLIANT;
! if(!defined('PHPGW_FOOTER_RAN'))
{
! define('PHPGW_FOOTER_RAN',True);
! if
(!isset($GLOBALS['phpgw_info']['flags']['nofooter']) ||
!$GLOBALS['phpgw_info']['flags']['nofooter'])
{
!
if($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
!
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'login' &&
!
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'logout' &&
!
address@hidden'phpgw_info']['flags']['noappfooter'])
{
! $this->phpgw_appfooter();
}
+ $GLOBALS['phpgw']->db->disconnect();
+ $this->msgbox('',False,'phpgw_msgbox');
+
$GLOBALS['phpgw']->template->pfp('out','phpgw_main');
+ /*
+
+
$GLOBALS['phpgw']->template->p('phpgw_head');
+
$GLOBALS['phpgw']->template->p('phpgw_navbar_start');
+ $this->msgbox('',False);
+
$GLOBALS['phpgw']->template->fp('phpgw_msgbox');
+
$GLOBALS['phpgw']->template->p('phpgw_appspace');
+
$GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
+ parse_navbar_end();
+
$GLOBALS['phpgw']->template->reset_root();
+
$GLOBALS['phpgw']->hooks->process('navbar_end');
+
$GLOBALS['phpgw']->template->p('phpgw_navbar_end');
+
$GLOBALS['phpgw']->template->p('phpgw_footer');
+
$GLOBALS['phpgw']->template->parse('phpgw_main_body','login_form');
+
$GLOBALS['phpgw']->template->pfp('out','phpgw_main');
+ */
}
! /* Clean up mcrypt */
! if (@is_object($GLOBALS['phpgw']->crypto))
! {
! $GLOBALS['phpgw']->crypto->cleanup();
! unset($GLOBALS['phpgw']->crypto);
! }
}
+ // echo 'an app is trying to run the phpgw_footer() more
than once<br>';
}
Index: class.phpgw.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.phpgw.inc.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** class.phpgw.inc.php 29 Jan 2002 00:48:03 -0000 1.43
--- class.phpgw.inc.php 30 May 2002 09:44:38 -0000 1.44
***************
*** 117,126 ****
{
$iis =
@strpos($GLOBALS['HTTP_ENV_VARS']['SERVER_SOFTWARE'], 'IIS', 0);
!
! if ( !$url )
{
$url = $GLOBALS['PHP_SELF'];
}
! if ( $iis )
{
echo "\n<HTML>\n<HEAD>\n<TITLE>Redirecting to
$url</TITLE>";
--- 117,137 ----
{
$iis =
@strpos($GLOBALS['HTTP_ENV_VARS']['SERVER_SOFTWARE'], 'IIS', 0);
!
! if (!$url)
{
$url = $GLOBALS['PHP_SELF'];
}
!
if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) &&
$GLOBALS['phpgw_info']['server']['enforce_ssl'] &&
!$GLOBALS['HTTP_SERVER_VARS']['HTTPS'])
! {
! if(substr($url ,0,4) != 'http')
! {
! $url =
'https://'.$GLOBALS['phpgw_info']['server']['hostname'].$url;
! }
! else
! {
! $url = str_replace ( 'http:', 'https:',
$url);
! }
! }
! if ($iis)
{
echo "\n<HTML>\n<HEAD>\n<TITLE>Redirecting to
$url</TITLE>";
Index: class.sessions_db.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.sessions_db.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.sessions_db.inc.php 30 Apr 2002 03:35:52 -0000 1.5
--- class.sessions_db.inc.php 30 May 2002 09:44:38 -0000 1.6
***************
*** 879,993 ****
function link($url, $extravars = '')
{
! $kp3 = get_var('kp3',Array('COOKIE','GET'));
! if (! $kp3)
{
! $kp3 = $GLOBALS['phpgw_info']['user']['kp3'];
}
! // Explicit hack to work around problems with php
running as CGI on windows
! // please let us know if this doesn't work for you!
!
! // I am not sure how my changes will affect the
following.
! // Could someone with access to a Windows install check
it ? (jengo)
!
! /* if (! $url && (PHP_OS == 'Windows' || PHP_OS == 'OS/2'
|| PHP_OS == 'WIN32' || PHP_OS == 'WIN16'))
{
! $exe = strpos($GLOBALS['PHP_SELF'],'php.exe');
! if ($exe != false) {
! $exe += 7; // strlen('php.exe')
! $url_root = split ('/',
$GLOBALS['phpgw_info']['server']['webserver_url']);
! $url = (strlen($url_root[0])?
$url_root[0].'//':'') . $url_root[2];
! $url .=
substr($PHP_SELF,$exe,strlen($GLOBALS['PHP_SELF'])-$exe);
}
}
- */
-
- $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $url;
-
- // This needs to be tested as well. (jengo)
-
- /* if (! $url)
- {
- $url_root = split ('/',
$GLOBALS['phpgw_info']['server']['webserver_url']);
- // Some hosting providers have their paths
screwy.
- // If the value from $PHP_SELF is not
what you expect, you can use this to patch it
- // It will need to be adjusted to your
specific problem tho.
- //
- //$patched_php_self =
str_replace('/php4/php/phpgroupware', '/phpgroupware', $GLOBALS['PHP_SELF']);
- $patched_php_self = $GLOBALS['PHP_SELF'];
- $url = (strlen($url_root[0])?
$url_root[0].'//':'') . $url_root[2] . $patched_php_self;
- }
- */
-
- // build the extravars string from a array
! if (is_array($extravars))
{
! while(list($key,$value) = each($extravars))
{
! if (!empty($new_extravars))
! {
! $new_extravars .= '&';
! }
! $new_extravars .= "$key=$value";
}
! // This needs to be explictly reset to a string
variable type for PHP3
! settype($extravars,'string');
! $extravars = $new_extravars;
! }
!
! if
(isset($GLOBALS['phpgw_info']['server']['usecookies']) &&
$GLOBALS['phpgw_info']['server']['usecookies'])
! {
! if ($extravars)
{
! $url .= '?' . $extravars;
}
}
! else
{
! $sessionID = 'sessionid=' .
@$GLOBALS['phpgw_info']['user']['sessionid'];
! $sessionID .= '&kp3=' . $kp3;
! $sessionID .= '&domain=' .
@$GLOBALS['phpgw_info']['user']['domain'];
! // This doesn't belong in the API.
! // Its up to the app to pass this value. (jengo)
! // Putting it into the app requires a massive
number of updates in email app.
! // Until that happens this needs to stay here
(seek3r)
! if
(isset($GLOBALS['phpgw_info']['flags']['newsmode']) &&
!
$GLOBALS['phpgw_info']['flags']['newsmode'])
{
! $url .= '&newsmode=on';
}
!
! if ($extravars)
{
! $url .= '?' . $extravars . '&' .
$sessionID;
}
! else
{
! $url .= '?' . $sessionID;
}
}
! /* $url = str_replace('/?', '/index.php?', $url);
! $webserver_url_count =
strlen($GLOBALS['phpgw_info']['server']['webserver_url']);
! $slash_check = strtolower(substr($url ,0,1));
! if (substr($url ,0,$webserver_url_count) !=
$GLOBALS['phpgw_info']['server']['webserver_url'])
{
! $app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! if ($slash_check == '/')
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $url;
}
! elseif ($app == 'home' || $app == 'logout' ||
$app == 'login')
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$url;
}
! else
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$app.'/'.$url;
}
! } */
! //echo "$url\n";
return $url;
}
--- 879,985 ----
function link($url, $extravars = '')
{
! /* first we process the $url to build the full
scriptname */
! $full_scriptname = True;
! $url_firstchar = substr($url ,0,1);
! if ($url_firstchar == '/' &&
$GLOBALS['phpgw_info']['server']['webserver_url'] == '/')
{
! $full_scriptname = False;
}
! if ($url_firstchar != '/')
{
! $app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! if ($app != 'home' && $app != 'login' && $app
!= 'logout')
! {
! $url = $app.'/'.$url;
}
}
! if($full_scriptname)
{
! $webserver_url_count =
strlen($GLOBALS['phpgw_info']['server']['webserver_url'])-1;
!
if(substr($GLOBALS['phpgw_info']['server']['webserver_url']
,$webserver_url_count,1) != '/' && $url_firstchar != '/')
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] .'/'. $url;
}
! else
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $url;
}
}
!
!
if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) &&
$GLOBALS['phpgw_info']['server']['enforce_ssl'] &&
!$GLOBALS['HTTP_SERVER_VARS']['HTTPS'])
{
! if(substr($url ,0,4) != 'http')
{
! $url =
'https://'.$GLOBALS['phpgw_info']['server']['hostname'].$url;
}
! else
{
! $url = str_replace ( 'http:', 'https:',
$url);
}
! }
!
! /* Now we process the extravars into a proper url
format */
! /* if its not an array, then we turn it into one */
! /* We do this to help prevent any duplicates from being
sent. */
! if (!is_array($extravars) && $extravars != '')
! {
! $a = explode('&', $extravars);
! $i = 0;
! while ($i < count($a))
{
! $b = split('=', $a[$i]);
! $new_extravars[$b[0]] = $b[1];
! $i++;
}
+ $extravars = $new_extravars;
+ unset($new_extravars);
}
! /* if using frames we make sure there is a framepart */
! if(@defined('PHPGW_USE_FRAMES') && PHPGW_USE_FRAMES)
{
! if (!isset($extravars['framepart']))
{
! $extravars['framepart']='body';
}
! }
!
! /* add session params if not using cookies */
! if (@!$GLOBALS['phpgw_info']['server']['usecookies'])
! {
! $kp3 = get_var('kp3',Array('COOKIE','GET'));
! if (!$kp3)
{
! $kp3 =
$GLOBALS['phpgw_info']['user']['kp3'];
}
!
! $extravars['sessionid'] =
@$GLOBALS['phpgw_info']['user']['sessionid'];
! $extravars['kp3'] = $kp3;
! $extravars['domain'] =
@$GLOBALS['phpgw_info']['user']['domain'];
! }
!
! /* if we end up with any extravars then we generate the
url friendly string */
! /* and return the result */
! if (is_array($extravars))
! {
! reset($extravars);
! while(list($key,$value) = each($extravars))
{
! if (!empty($new_extravars))
! {
! $new_extravars .= '&';
! }
! $new_extravars .=
$key.'='.htmlentities(urlencode($value));
}
! /* This needs to be explictly reset to a string
variable type for PHP3 */
! settype($extravars,'string');
! $extravars = $new_extravars;
! unset($new_extravars);
! return $url .= '?' . $extravars;
! }
! /* if no extravars then we return the cleaned up
url/scriptname */
return $url;
}
Index: class.sessions_php4.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.sessions_php4.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.sessions_php4.inc.php 30 Apr 2002 03:35:52 -0000 1.8
--- class.sessions_php4.inc.php 30 May 2002 09:44:38 -0000 1.9
***************
*** 842,956 ****
function link($url, $extravars = '')
{
! $kp3 = get_var('kp3',Array('COOKIE','GET'));
! if (! $kp3)
{
! $kp3 = $GLOBALS['phpgw_info']['user']['kp3'];
}
! // Explicit hack to work around problems with php
running as CGI on windows
! // please let us know if this doesn't work for you!
!
! // I am not sure how my changes will affect the
following.
! // Could someone with access to a Windows install check
it ? (jengo)
!
! /* if (! $url && (PHP_OS == 'Windows' || PHP_OS == 'OS/2'
|| PHP_OS == 'WIN32' || PHP_OS == 'WIN16'))
{
! $exe = strpos($GLOBALS['PHP_SELF'],'php.exe');
! if ($exe != false) {
! $exe += 7; // strlen('php.exe')
! $url_root = split ('/',
$GLOBALS['phpgw_info']['server']['webserver_url']);
! $url = (strlen($url_root[0])?
$url_root[0].'//':'') . $url_root[2];
! $url .=
substr($PHP_SELF,$exe,strlen($GLOBALS['PHP_SELF'])-$exe);
}
}
- */
-
- $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $url;
-
- // This needs to be tested as well. (jengo)
-
- /* if (! $url)
- {
- $url_root = split ('/',
$GLOBALS['phpgw_info']['server']['webserver_url']);
- // Some hosting providers have their paths
screwy.
- // If the value from $PHP_SELF is not
what you expect, you can use this to patch it
- // It will need to be adjusted to your
specific problem tho.
- //
- //$patched_php_self =
str_replace('/php4/php/phpgroupware', '/phpgroupware', $GLOBALS['PHP_SELF']);
- $patched_php_self = $GLOBALS['PHP_SELF'];
- $url = (strlen($url_root[0])?
$url_root[0].'//':'') . $url_root[2] . $patched_php_self;
- }
- */
-
- // build the extravars string from a array
! if (is_array($extravars))
{
! while(list($key,$value) = each($extravars))
{
! if (!empty($new_extravars))
! {
! $new_extravars .= '&';
! }
! $new_extravars .= "$key=$value";
}
! // This needs to be explictly reset to a string
variable type for PHP3
! settype($extravars,'string');
! $extravars = $new_extravars;
! }
!
! if
(isset($GLOBALS['phpgw_info']['server']['usecookies']) &&
$GLOBALS['phpgw_info']['server']['usecookies'])
! {
! if ($extravars)
{
! $url .= '?' . $extravars;
}
}
! else
{
! $sessionID = 'sessionid=' .
@$GLOBALS['phpgw_info']['user']['sessionid'];
! $sessionID .= '&kp3=' . $kp3;
! $sessionID .= '&domain=' .
@$GLOBALS['phpgw_info']['user']['domain'];
! // This doesn't belong in the API.
! // Its up to the app to pass this value. (jengo)
! // Putting it into the app requires a massive
number of updates in email app.
! // Until that happens this needs to stay here
(seek3r)
! if
(isset($GLOBALS['phpgw_info']['flags']['newsmode']) &&
!
$GLOBALS['phpgw_info']['flags']['newsmode'])
{
! $url .= '&newsmode=on';
}
!
! if ($extravars)
{
! $url .= '?' . $extravars . '&' .
$sessionID;
}
! else
{
! $url .= '?' . $sessionID;
}
}
! /* $url = str_replace('/?', '/index.php?', $url);
! $webserver_url_count =
strlen($GLOBALS['phpgw_info']['server']['webserver_url']);
! $slash_check = strtolower(substr($url ,0,1));
! if (substr($url ,0,$webserver_url_count) !=
$GLOBALS['phpgw_info']['server']['webserver_url'])
{
! $app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! if ($slash_check == '/')
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $url;
}
! elseif ($app == 'home' || $app == 'logout' ||
$app == 'login')
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$url;
}
! else
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$app.'/'.$url;
}
! } */
! //echo "$url\n";
return $url;
}
--- 842,948 ----
function link($url, $extravars = '')
{
! /* first we process the $url to build the full
scriptname */
! $full_scriptname = True;
! $url_firstchar = substr($url ,0,1);
! if ($url_firstchar == '/' &&
$GLOBALS['phpgw_info']['server']['webserver_url'] == '/')
{
! $full_scriptname = False;
}
! if ($url_firstchar != '/')
{
! $app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
! if ($app != 'home' && $app != 'login' && $app
!= 'logout')
! {
! $url = $app.'/'.$url;
}
}
! if($full_scriptname)
{
! $webserver_url_count =
strlen($GLOBALS['phpgw_info']['server']['webserver_url'])-1;
!
if(substr($GLOBALS['phpgw_info']['server']['webserver_url']
,$webserver_url_count,1) != '/' && $url_firstchar != '/')
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] .'/'. $url;
}
! else
{
! $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $url;
}
}
!
!
if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) &&
$GLOBALS['phpgw_info']['server']['enforce_ssl'] &&
!$GLOBALS['HTTP_SERVER_VARS']['HTTPS'])
{
! if(substr($url ,0,4) != 'http')
{
! $url =
'https://'.$GLOBALS['phpgw_info']['server']['hostname'].$url;
}
! else
{
! $url = str_replace ( 'http:', 'https:',
$url);
}
! }
!
! /* Now we process the extravars into a proper url
format */
! /* if its not an array, then we turn it into one */
! /* We do this to help prevent any duplicates from being
sent. */
! if (!is_array($extravars) && $extravars != '')
! {
! $a = explode('&', $extravars);
! $i = 0;
! while ($i < count($a))
{
! $b = split('=', $a[$i]);
! $new_extravars[$b[0]] = $b[1];
! $i++;
}
+ $extravars = $new_extravars;
+ unset($new_extravars);
}
! /* if using frames we make sure there is a framepart */
! if(@defined('PHPGW_USE_FRAMES') && PHPGW_USE_FRAMES)
{
! if (!isset($extravars['framepart']))
{
! $extravars['framepart']='body';
}
! }
!
! /* add session params if not using cookies */
! if (@!$GLOBALS['phpgw_info']['server']['usecookies'])
! {
! $kp3 = get_var('kp3',Array('COOKIE','GET'));
! if (!$kp3)
{
! $kp3 =
$GLOBALS['phpgw_info']['user']['kp3'];
}
!
! $extravars['sessionid'] =
@$GLOBALS['phpgw_info']['user']['sessionid'];
! $extravars['kp3'] = $kp3;
! $extravars['domain'] =
@$GLOBALS['phpgw_info']['user']['domain'];
! }
!
! /* if we end up with any extravars then we generate the
url friendly string */
! /* and return the result */
! if (is_array($extravars))
! {
! reset($extravars);
! while(list($key,$value) = each($extravars))
{
! if (!empty($new_extravars))
! {
! $new_extravars .= '&';
! }
! $new_extravars .=
$key.'='.htmlentities(urlencode($value));
}
! /* This needs to be explictly reset to a string
variable type for PHP3 */
! settype($extravars,'string');
! $extravars = $new_extravars;
! unset($new_extravars);
! return $url .= '?' . $extravars;
! }
! /* if no extravars then we return the cleaned up
url/scriptname */
return $url;
}
Index: common_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/common_functions.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** common_functions.inc.php 27 May 2002 03:13:28 -0000 1.9
--- common_functions.inc.php 30 May 2002 09:44:38 -0000 1.10
***************
*** 341,425 ****
}
! function registervar($varname, $valuetype = 'alpha', $posttype =
'post', $allowblank = True)
{
! switch ($posttype)
{
! case 'get':
! $posttype = 'HTTP_GET_VARS';
! break;
! case 'cookie':
! $posttype = 'HTTP_COOKIE_VARS';
! break;
! default :
! $posttype = 'HTTP_POST_VARS';
}
! if (isset($GLOBALS[$posttype][$varname]))
{
! if (!is_array($GLOBALS[$posttype][$varname]))
{
! if ($allowblank == True &&
$GLOBALS[$posttype][$varname] == '')
{
!
$GLOBALS['phpgw_info'][$GLOBALS['phpgw_info']['flags']['currentapp']][$varname]
= $GLOBALS[$posttype][$varname];
! return 'Post';
}
else
{
! if
(sanitize($GLOBALS[$posttype][$varname],$valuetype) == 1)
{
!
$GLOBALS['phpgw_info'][$GLOBALS['phpgw_info']['flags']['currentapp']][$varname]
= $GLOBALS[$posttype][$varname];
! return 'Post';
}
else
{
! return False;
}
! }
! return False;
! }
! else
! {
! if (is_array($valuetype))
! {
! reset($GLOBALS[$posttype][$varname]);
! $isvalid = True;
! while(list($key, $value) =
each($GLOBALS[$posttype][$varname]))
{
! if ($allowblank == True &&
$GLOBALS[$posttype][$varname][$key] == '')
{
}
else
{
! if
(sanitize($GLOBALS[$posttype][$varname][$key],$valuetype[$key]) == 1)
! {
! }
! else
! {
! $isvalid =
False;
! }
}
}
- if ($isvalid)
- {
-
$GLOBALS['phpgw_info'][$GLOBALS['phpgw_info']['flags']['currentapp']][$varname]
= $GLOBALS[$posttype][$varname];
- return 'Post';
- }
- else
- {
- return 'Session';
- }
- return False;
}
}
- return False;
}
! elseif (count($GLOBALS[$posttype]) == 0)
{
! return 'Session';
! }
! else
! {
! return False;
}
}
--- 341,484 ----
}
! function reg_var($varname, $method = 'any', $valuetype =
'alphanumeric',$default_value='',$register=True)
{
! if($method == 'any')
{
! $method =
Array('POST','GET','COOKIE','SERVER','GLOBAL','DEFAULT');
}
+ elseif(!is_array($method))
+ {
+ $method = Array($method);
+ }
+ $cnt = count($method);
+ for($i=0;$i<$cnt;$i++)
+ {
! switch(strtoupper($method[$i]))
! {
! case 'DEFAULT':
! if($default_value)
! {
! $value = $default_value;
! $i = $cnt+1; /* Found what we
were looking for, now we end the loop */
! }
! break;
! case 'GLOBAL':
! if(@isset($GLOBALS[$varname]))
! {
! $value = $GLOBALS[$varname];
! $i = $cnt+1;
! }
! break;
! case 'POST':
! case 'GET':
! case 'COOKIE':
! case 'SERVER':
! if(phpversion() >= '4.2.0')
! {
! $meth =
'_'.strtoupper($method[$i]);
! }
! else
! {
! $meth =
'HTTP_'.strtoupper($method[$i]).'_VARS';
! }
! if(@isset($GLOBALS[$meth][$varname]))
! {
! $value =
$GLOBALS[$meth][$varname];
! $i = $cnt+1;
! }
! break;
! default:
!
if(@isset($GLOBALS[strtoupper($method[$i])][$varname]))
! {
! $value =
$GLOBALS[strtoupper($method[$i])][$varname];
! $i = $cnt+1;
! }
! break;
! }
! }
!
! if (@!isset($value))
! {
! $value = $default_value;
! }
!
! if (@!is_array($value))
! {
! if ($value == '')
! {
! $result = $value;
! }
! else
! {
! if (sanitize($value,$valuetype) == 1)
! {
! $result = $value;
! }
! else
! {
! $result = $default_value;
! }
! }
! }
! else
{
! reset($value);
! while(list($k, $v) = each($value))
{
! if ($v == '')
{
! $result[$k] = $v;
}
else
{
! if (is_array($valuetype))
{
! $vt = $valuetype[$k];
}
else
{
! $vt = $valuetype;
}
!
! if (sanitize($v,$vt) == 1)
{
! $result[$k] = $v;
! }
! else
! {
! if (is_array($default_value))
{
+ $result[$k] =
$default_value[$k];
}
else
{
! $result[$k] =
$default_value;
}
}
}
}
}
! if($register)
{
!
$GLOBALS['phpgw_info'][$GLOBALS['phpgw_info']['flags']['currentapp']][$varname]
= $result;
}
+ return $result;
+ }
+
+ /*!
+ @function get_var
+ @abstract retrieve a value from either a POST, GET, COOKIE, SERVER or
from a class variable.
+ @author skeeter
+ @discussion This function is used to retrieve a value from a user
defined order of methods.
+ @syntax
get_var('id',array('HTTP_POST_VARS'||'POST','HTTP_GET_VARS'||'GET','HTTP_COOKIE_VARS'||'COOKIE','GLOBAL','DEFAULT'));
+ @example $this->id =
get_var('id',array('HTTP_POST_VARS'||'POST','HTTP_GET_VARS'||'GET','HTTP_COOKIE_VARS'||'COOKIE','GLOBAL','DEFAULT'));
+ @param $variable name
+ @param $method ordered array of methods to search for supplied variable
+ @param $default_value (optional)
+ */
+ function get_var($variable,$method='any',$default_value='')
+ {
+ return reg_var($variable,$method,'any',$default_value,False);
}
***************
*** 441,501 ****
include(PHPGW_SERVER_ROOT.'/phpgwapi/inc/class.'.$included_class.'.inc.php');
}
- }
-
- /*!
- @function get_var
- @abstract retrieve a value from either a POST, GET, COOKIE, SERVER or
from a class variable.
- @author skeeter
- @discussion This function is used to retrieve a value from a user
defined order of methods.
- @syntax
get_var('id',array('HTTP_POST_VARS'||'POST','HTTP_GET_VARS'||'GET','HTTP_COOKIE_VARS'||'COOKIE','GLOBAL','DEFAULT'));
- @example $this->id =
get_var('id',array('HTTP_POST_VARS'||'POST','HTTP_GET_VARS'||'GET','HTTP_COOKIE_VARS'||'COOKIE','GLOBAL','DEFAULT'));
- @param $variable name
- @param $method ordered array of methods to search for supplied variable
- @param $default_value (optional)
- */
- function get_var($variable,$method,$default_value='')
- {
- for($i=0;$i<count($method);$i++)
- {
- switch(strtoupper($method[$i]))
- {
- case 'DEFAULT':
- if($default_value)
- {
- $var = $default_value;
- }
- break;
- case 'GLOBAL':
- if(@isset($GLOBALS[$variable]))
- {
- $var = $GLOBALS[$variable];
- }
- break;
- case 'POST':
- case 'GET':
- case 'COOKIE':
- case 'SERVER':
- if(phpversion() >= '4.2.0')
- {
- $meth =
'_'.strtoupper($method[$i]);
- }
- else
- {
- $meth =
'HTTP_'.strtoupper($method[$i]).'_VARS';
- }
- if(@isset($GLOBALS[$meth][$variable]))
- {
- $var =
$GLOBALS[$meth][$variable];
- }
- break;
- default:
-
if(@isset($GLOBALS[strtoupper($method[$i])][$variable]))
- {
- $var =
$GLOBALS[strtoupper($method[$i])][$variable];
- }
- break;
- }
- }
- return (@$var?$var:'');
}
--- 500,503 ----
Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -r1.138 -r1.139
*** functions.inc.php 24 May 2002 19:15:24 -0000 1.138
--- functions.inc.php 30 May 2002 09:44:38 -0000 1.139
***************
*** 80,88 ****
if (!isset($GLOBALS['phpgw_info']['flags']['currentapp']))
{
! /* This object does not exist yet. */
! /* $GLOBALS['phpgw']->log->write(array('text'=>'W-MissingFlags,
currentapp flag not set'));*/
!
! echo '<b>!!! YOU DO NOT HAVE YOUR
$GLOBALS[\'phpgw_info\'][\'flags\'][\'currentapp\'] SET !!!';
! echo '<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>';
}
--- 80,85 ----
if (!isset($GLOBALS['phpgw_info']['flags']['currentapp']))
{
! $msgstring = '<b>!!! YOU DO NOT HAVE YOUR
$GLOBALS[\'phpgw_info\'][\'flags\'][\'currentapp\'] SET !!!<br>!!! PLEASE
CORRECT THIS SITUATION !!!</b>';
!
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$msgstring]=False;
}
***************
*** 233,241 ****
unset($cache_query);
unset($server_info_cache);
- if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) && !$HTTPS)
- {
- Header('Location: https://' .
$GLOBALS['phpgw_info']['server']['hostname'] .
$GLOBALS['phpgw_info']['server']['webserver_url'] . $REQUEST_URI);
- exit;
- }
/************************************************************************\
--- 230,233 ----
***************
*** 283,286 ****
--- 275,283 ----
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'login')
{
+
if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) &&
$GLOBALS['phpgw_info']['server']['enforce_ssl'] &&
!$GLOBALS['HTTP_SERVER_VARS']['HTTPS'])
+ {
+ Header('Location:
https://'.$GLOBALS['phpgw_info']['server']['hostname'].$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']);
+ exit;
+ }
if (@$login != '')
{
***************
*** 302,306 ****
if (! $GLOBALS['phpgw']->session->verify())
{
! Header('Location: ' .
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->session->link('/login.php','cd=10')));
exit;
}
--- 299,303 ----
if (! $GLOBALS['phpgw']->session->verify())
{
! Header('Location: ' .
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->session->link('/login.php','code=10')));
exit;
}
***************
*** 309,312 ****
--- 306,311 ----
/* A few hacker resistant constants that will be used throught
the program */
+
+ $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] =
'default';
define('PHPGW_TEMPLATE_DIR',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
define('PHPGW_IMAGES_DIR',
ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
***************
*** 318,321 ****
--- 317,419 ----
define('PHPGW_APP_IMAGES_DIR',
ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
+
/*************************************************************************\
+ * These lines load up the templates class and set some default
values *
+
\*************************************************************************/
+ $GLOBALS['phpgw']->template =
CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
+ $GLOBALS['phpgw']->template->set_file('common', 'common.tpl');
+ $GLOBALS['phpgw']->template->set_file('phpgw', 'phpgw.tpl');
+ $GLOBALS['phpgw']->template->set_file('msgbox', 'msgbox.tpl');
+
+ /* This will bring in the template sets parts definitions */
+ if (file_exists(PHPGW_TEMPLATE_DIR . '/parts.inc.php'))
+ {
+ include(PHPGW_TEMPLATE_DIR . '/parts.inc.php');
+ }
+ $val = $GLOBALS['phpgw']->template->get_var('phpgw_top_height');
+ if (empty($val))
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_top_height','10');
+ }
+ $val = $GLOBALS['phpgw']->template->get_var('phpgw_left_width');
+ if (empty($val))
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_left_width','10');
+ }
+ $val =
$GLOBALS['phpgw']->template->get_var('phpgw_right_width');
+ if (empty($val))
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_right_width','10');
+ }
+ $val =
$GLOBALS['phpgw']->template->get_var('phpgw_bottom_height');
+ if (empty($val))
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_bottom_height','10');
+ }
+
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_charset',lang('charset'));
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_description','phpGroupWare');
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_keywords','phpGroupWare');
+
+ if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) &&
$GLOBALS['phpgw_info']['server']['enforce_ssl'] &&
!$GLOBALS['HTTP_SERVER_VARS']['HTTPS'])
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_base','https://'.$GLOBALS['phpgw_info']['server']['hostname'].$GLOBALS['phpgw_info']['server']['webserver_url'].'/');
+ }
+ else
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_base',$GLOBALS['phpgw_info']['server']['webserver_url'].'/');
+ }
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_browser_ico','favicon.ico');
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_website_title',
$GLOBALS['phpgw_info']['server']['site_title']);
+
+
/*************************************************************************\
+ * If they are using frames, we need to set some variables
*
+
\*************************************************************************/
+ if(@isset($GLOBALS['HTTP_GET_VARS']['framepart']) &&
+ ( $GLOBALS['HTTP_GET_VARS']['framepart'] ==
'unsupported' ||
+ $GLOBALS['HTTP_GET_VARS']['framepart'] == 'top'
||
+ $GLOBALS['HTTP_GET_VARS']['framepart'] ==
'left' ||
+ $GLOBALS['HTTP_GET_VARS']['framepart'] ==
'body' ||
+ $GLOBALS['HTTP_GET_VARS']['framepart'] ==
'right' ||
+ $GLOBALS['HTTP_GET_VARS']['framepart'] ==
'bottom'
+ ))
+ {
+
define('PHPGW_FRAME_PART',$GLOBALS['HTTP_GET_VARS']['framepart']);
+ }
+ else
+ {
+ define('PHPGW_FRAME_PART','start');
+ }
+
+ //$GLOBALS['phpgw_info']['server']['useframes'] = 'always';
+
if(((isset($GLOBALS['phpgw_info']['user']['preferences']['common']['useframes'])
&&
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['useframes'] &&
+ $GLOBALS['phpgw_info']['server']['useframes'] ==
'allowed') ||
+ $GLOBALS['phpgw_info']['server']['useframes'] ==
'always') &&
+ PHPGW_FRAME_PART != 'unsupported')
+ {
+ define('PHPGW_USE_FRAMES',True);
+ define('PHPGW_NAVBAR_TARGET','body');
+ if (PHPGW_FRAME_PART == 'start')
+ {
+
$GLOBALS['phpgw']->template->set_var('phpgw_top_link',$GLOBALS['phpgw']->session->link('home.php','framepart=top'));
+
$GLOBALS['phpgw']->template->set_var('phpgw_right_link',$GLOBALS['phpgw']->session->link('home.php','framepart=right'));
+
$GLOBALS['phpgw']->template->set_var('phpgw_body_link',$GLOBALS['phpgw']->session->link('home.php','framepart=body'));
+
$GLOBALS['phpgw']->template->set_var('phpgw_left_link',$GLOBALS['phpgw']->session->link('home.php','framepart=left'));
+
$GLOBALS['phpgw']->template->set_var('phpgw_bottom_link',$GLOBALS['phpgw']->session->link('home.php','framepart=bottom'));
+
$GLOBALS['phpgw']->template->set_block('phpgw','phpgw_main_frames','phpgw_main');
+ }
+ else
+ {
+
$GLOBALS['phpgw']->template->set_block('phpgw','phpgw_main_basic','phpgw_main');
+ }
+ }
+ else
+ {
+ define('PHPGW_USE_FRAMES',False);
+ define('PHPGW_NAVBAR_TARGET','_self');
+
$GLOBALS['phpgw']->template->set_block('phpgw','phpgw_main_tables','phpgw_main');
+ }
+
$GLOBALS['phpgw']->template->set_var('phpgw_head_target',PHPGW_NAVBAR_TARGET);
+
/* define('PHPGW_APP_IMAGES_DIR',
$GLOBALS['phpgw']->common->get_image_dir()); */
***************
*** 395,400 ****
echo '<body bgcolor="FFFFFF">';
$GLOBALS['phpgw']->log->write(array('text'=>'F-Abort,
No themes found'));
-
- exit;
}
--- 493,496 ----
***************
*** 418,470 ****
include(PHPGW_APP_TPL . '/css.inc.php');
}
!
! unset($theme_to_load);
/*************************************************************************\
! * These lines load up the templates class
*
\*************************************************************************/
!
if(address@hidden'phpgw_info']['flags']['disable_Template_class'])
{
! $GLOBALS['phpgw']->template =
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
}
-
/*************************************************************************\
! * Verify that the users session is still active otherwise kick
them out *
\*************************************************************************/
! if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
! $GLOBALS['phpgw_info']['flags']['currentapp'] !=
'preferences' &&
! $GLOBALS['phpgw_info']['flags']['currentapp'] !=
'about')
! {
! // This will need to use ACL in the future
! if (!
$GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]
||
! (@$GLOBALS['phpgw_info']['flags']['admin_only']
&&
! !
$GLOBALS['phpgw_info']['user']['apps']['admin']))
! {
!
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
!
!
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Access not permitted']=False;
! $GLOBALS['phpgw']->common->phpgw_header();
! $GLOBALS['phpgw']->common->phpgw_exit(True);
}
}
-
/*************************************************************************\
! * Load the header unless the developer turns it off
*
\*************************************************************************/
! $GLOBALS['phpgw']->common->phpgw_header(False, False);
!
/*************************************************************************\
! * Load the app include files if the exists
*
\*************************************************************************/
! /* Then the include file */
! if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) &&
file_exists(PHPGW_APP_INC . '/functions.inc.php') && !MENUACTION)
{
! include(PHPGW_APP_INC . '/functions.inc.php');
}
!
! if (address@hidden'phpgw_info']['flags']['noappheader'])
{
! $GLOBALS['phpgw']->common->phpgw_appheader();
}
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
--- 514,653 ----
include(PHPGW_APP_TPL . '/css.inc.php');
}
!
! /* This covers setting the theme values so that each app doesnt
have to */
! $theme_data = $GLOBALS['phpgw_info']['theme'];
! unset($theme_data['css']);
! $GLOBALS['phpgw']->template->set_var($theme_data);
! unset($theme_data);
! $GLOBALS['phpgw']->template->update_css();
!
! // if(!PHPGW_USE_FRAMES || (PHPGW_USE_FRAMES &&
PHPGW_NAVBAR_TARGET != 'body'))
! // {
! $GLOBALS['phpgw']->common->navbar();
! // }
/*************************************************************************\
! * load up top part if appropriate
*
\*************************************************************************/
! if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'top')
{
! if(!PHPGW_USE_FRAMES)
! {
! $output = 'phpgw_top';
! }
! else
! {
! $output = 'phpgw_body';
! }
! if(function_exists('parse_toppart'))
! {
! parse_toppart($output);
! }
! if(PHPGW_USE_FRAMES)
! {
! $GLOBALS['phpgw']->common->phpgw_footer();
! }
}
/*************************************************************************\
! * load up left part if appropriate
*
\*************************************************************************/
! if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'left')
! {
! if(!PHPGW_USE_FRAMES)
! {
! $output = 'phpgw_left';
! }
! else
! {
! $output = 'phpgw_body';
! }
! if(function_exists('parse_leftpart'))
! {
! parse_leftpart($output);
! }
! if(PHPGW_USE_FRAMES)
! {
! $GLOBALS['phpgw']->common->phpgw_footer();
}
}
/*************************************************************************\
! * load up right part if appropriate
*
\*************************************************************************/
! if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'right')
! {
! if(!PHPGW_USE_FRAMES)
! {
! $output = 'phpgw_right';
! }
! else
! {
! $output = 'phpgw_body';
! }
! if(function_exists('parse_rightpart'))
! {
! parse_rightpart($output);
! }
! if(PHPGW_USE_FRAMES)
! {
! $GLOBALS['phpgw']->common->phpgw_footer();
! }
! }
/*************************************************************************\
! * load up bottom part if appropriate
*
\*************************************************************************/
! if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'bottom')
{
! if(!PHPGW_USE_FRAMES)
! {
! $output = 'phpgw_bottom';
! }
! else
! {
! $output = 'phpgw_body';
! }
! if(function_exists('parse_bottompart'))
! {
! parse_bottompart($output);
! }
! if(PHPGW_USE_FRAMES)
! {
! // $GLOBALS['phpgw']->common->phpgw_footer();
! }
}
!
!
/*************************************************************************\
! * load up body/appspace if appropriate
*
!
\*************************************************************************/
! if(!PHPGW_USE_FRAMES || PHPGW_FRAME_PART == 'body')
{
! /* Verify that user has rights to the currentapp */
! $continue_app_data = True;
! if ($GLOBALS['phpgw_info']['flags']['currentapp'] !=
'home' &&
! $GLOBALS['phpgw_info']['flags']['currentapp']
!= 'preferences' &&
! $GLOBALS['phpgw_info']['flags']['currentapp']
!= 'about')
! {
! // This will need to use ACL in the future
! if (!
$GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']]
||
!
(@$GLOBALS['phpgw_info']['flags']['admin_only'] &&
! !
$GLOBALS['phpgw_info']['user']['apps']['admin']))
! {
!
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
!
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Access not permitted']=False;
! $continue_app_data = False;
!
$GLOBALS['phpgw']->template->set_var('phpgw_body',"user has no rights to this
app!!!<br>\n");
!
//$GLOBALS['phpgw']->common->phpgw_display();
!
//$GLOBALS['phpgw']->common->phpgw_exit(True);
! }
! }
! if($continue_app_data)
! {
!
$GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
! if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC)
&& file_exists(PHPGW_APP_INC . '/functions.inc.php') && !MENUACTION)
! {
! include(PHPGW_APP_INC .
'/functions.inc.php');
! }
! }
}
}
+
error_reporting(E_ERROR | E_WARNING | E_PARSE);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.Template.inc.php,1.24,1.25 class.Template_experimental.inc.php,1.1,1.2 class.common.inc.php,1.141,1.142 class.phpgw.inc.php,1.43,1.44 class.sessions_db.inc.php,1.5,1.6 class.sessions_php4.inc.php,1.8,1.9 common_functions.inc.php,1.9,1.10 functions.inc.php,1.138,1.139,
Dan Kuykendall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: phpgwapi/templates/default msgbox.tpl,NONE,1.1 parts.inc.php,NONE,1.1 phpgw.tpl,NONE,1.1 login.tpl,1.12,1.13 footer.tpl,1.4,NONE frames.tpl,1.1,NONE frames_body.tpl,1.1,NONE frames_navbar.tpl,1.1,NONE head.inc.php,1.12,NONE head.tpl,1.7,NONE login_denylogin.tpl,1.3,NONE login_selectdomain.tpl,1.9,NONE navbar.inc.php,1.29,NONE navbar.tpl,1.6,NONE navbar_app.tpl,1.2,NONE
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/templates/default parts.tpl,NONE,1.1
- Previous by thread:
[Phpgroupware-cvs] CVS: phpgwapi/templates/default msgbox.tpl,NONE,1.1 parts.inc.php,NONE,1.1 phpgw.tpl,NONE,1.1 login.tpl,1.12,1.13 footer.tpl,1.4,NONE frames.tpl,1.1,NONE frames_body.tpl,1.1,NONE frames_navbar.tpl,1.1,NONE head.inc.php,1.12,NONE head.tpl,1.7,NONE login_denylogin.tpl,1.3,NONE login_selectdomain.tpl,1.9,NONE navbar.inc.php,1.29,NONE navbar.tpl,1.6,NONE navbar_app.tpl,1.2,NONE
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/templates/default parts.tpl,NONE,1.1
- Index(es):