mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-18 16:06:53 +02:00
Cleaned up how link() works, it should work with different styles of webserver_url now
This commit is contained in:
parent
2df1e99322
commit
6deda7f240
@ -448,12 +448,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_image_path($appname = ''){
|
function get_image_path($appname = '')
|
||||||
|
{
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
if ($appname == '') {
|
|
||||||
|
if ($appname == '')
|
||||||
|
{
|
||||||
$appname = $phpgw_info['flags']['currentapp'];
|
$appname = $phpgw_info['flags']['currentapp'];
|
||||||
}
|
}
|
||||||
if (empty($phpgw_info['server']['template_set'])) {
|
|
||||||
|
if (empty($phpgw_info['server']['template_set']))
|
||||||
|
{
|
||||||
$phpgw_info['server']['template_set'] = 'default';
|
$phpgw_info['server']['template_set'] = 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,13 +466,20 @@
|
|||||||
$imagedir_default = PHPGW_SERVER_ROOT . '/'.$appname.'/templates/default/images';
|
$imagedir_default = PHPGW_SERVER_ROOT . '/'.$appname.'/templates/default/images';
|
||||||
$imagedir_olddefault = PHPGW_SERVER_ROOT . '/'.$appname.'/images';
|
$imagedir_olddefault = PHPGW_SERVER_ROOT . '/'.$appname.'/images';
|
||||||
|
|
||||||
if (is_dir ($imagedir)){
|
if (is_dir ($imagedir))
|
||||||
|
{
|
||||||
return $phpgw_info['server']['webserver_url'].'/'.$appname.'/templates/'.$phpgw_info['server']['template_set'].'/images';
|
return $phpgw_info['server']['webserver_url'].'/'.$appname.'/templates/'.$phpgw_info['server']['template_set'].'/images';
|
||||||
}elseif (is_dir ($imagedir_default)){
|
}
|
||||||
|
elseif (is_dir ($imagedir_default))
|
||||||
|
{
|
||||||
return $phpgw_info['server']['webserver_url'].'/'.$appname.'/templates/default/images';
|
return $phpgw_info['server']['webserver_url'].'/'.$appname.'/templates/default/images';
|
||||||
}elseif (is_dir ($imagedir_olddefault)){
|
}
|
||||||
|
elseif (is_dir ($imagedir_olddefault))
|
||||||
|
{
|
||||||
return $phpgw_info['server']['webserver_url'].'/'.$appname.'/images';
|
return $phpgw_info['server']['webserver_url'].'/'.$appname.'/images';
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -477,48 +489,59 @@
|
|||||||
global $phpgw_info, $phpgw;
|
global $phpgw_info, $phpgw;
|
||||||
|
|
||||||
$phpgw_info['navbar']['home']['title'] = 'Home';
|
$phpgw_info['navbar']['home']['title'] = 'Home';
|
||||||
$phpgw_info['navbar']['home']['url'] = $phpgw->link($phpgw_info['server']['webserver_url'] . '/index.php');
|
$phpgw_info['navbar']['home']['url'] = $phpgw->link('/index.php');
|
||||||
$phpgw_info['navbar']['home']['icon'] = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/'
|
$phpgw_info['navbar']['home']['icon'] = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/'
|
||||||
. $phpgw_info['server']['template_set'] . '/images/home.gif';
|
. $phpgw_info['server']['template_set'] . '/images/home.gif';
|
||||||
|
|
||||||
reset($phpgw_info['user']['apps']);
|
reset($phpgw_info['user']['apps']);
|
||||||
while ($permission = each($phpgw_info['user']['apps'])) {
|
while ($permission = each($phpgw_info['user']['apps']))
|
||||||
if (is_long($permission[0])) { continue; }
|
{
|
||||||
if ($phpgw_info['apps'][$permission[0]]['status'] != 2) {
|
if (is_long($permission[0]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($phpgw_info['apps'][$permission[0]]['status'] != 2)
|
||||||
|
{
|
||||||
$phpgw_info['navbar'][$permission[0]]['title'] = $phpgw_info['apps'][$permission[0]]['title'];
|
$phpgw_info['navbar'][$permission[0]]['title'] = $phpgw_info['apps'][$permission[0]]['title'];
|
||||||
$phpgw_info['navbar'][$permission[0]]['url'] = $phpgw->link($phpgw_info['server']['webserver_url']
|
$phpgw_info['navbar'][$permission[0]]['url'] = $phpgw->link('/' . $permission[0] . '/index.php');
|
||||||
. '/' . $permission[0] . '/index.php');
|
|
||||||
$icon_file = PHPGW_SERVER_ROOT . '/'.$permission[0] . '/templates/'. $phpgw_info['server']['template_set']. '/images/navbar.gif';
|
$icon_file = PHPGW_SERVER_ROOT . '/'.$permission[0] . '/templates/'. $phpgw_info['server']['template_set']. '/images/navbar.gif';
|
||||||
if (file_exists($icon_file)){
|
|
||||||
|
if (file_exists($icon_file))
|
||||||
|
{
|
||||||
$phpgw_info['navbar'][$permission[0]]['icon'] = $phpgw_info['server']['webserver_url'] . '/'
|
$phpgw_info['navbar'][$permission[0]]['icon'] = $phpgw_info['server']['webserver_url'] . '/'
|
||||||
. $permission[0] . '/templates/' . $phpgw_info['server']['template_set'] . '/images/navbar.gif';
|
. $permission[0] . '/templates/' . $phpgw_info['server']['template_set'] . '/images/navbar.gif';
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$phpgw_info['navbar'][$permission[0]]['icon'] = $phpgw_info['server']['webserver_url'] . '/'
|
$phpgw_info['navbar'][$permission[0]]['icon'] = $phpgw_info['server']['webserver_url'] . '/'
|
||||||
. $permission[0] . '/templates/default/images/navbar.gif';
|
. $permission[0] . '/templates/default/images/navbar.gif';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$phpgw_info['navbar']['preferences']['title'] = 'preferences';
|
$phpgw_info['navbar']['preferences']['title'] = 'preferences';
|
||||||
$phpgw_info['navbar']['preferences']['url'] = $phpgw->link($phpgw_info['server']['webserver_url']
|
$phpgw_info['navbar']['preferences']['url'] = $phpgw->link('/preferences/index.php');
|
||||||
. '/preferences/index.php');
|
|
||||||
$phpgw_info['navbar']['preferences']['icon'] = $phpgw_info['server']['webserver_url'] . '/preferences/templates/'
|
$phpgw_info['navbar']['preferences']['icon'] = $phpgw_info['server']['webserver_url'] . '/preferences/templates/'
|
||||||
. $phpgw_info['server']['template_set'] . '/images/navbar.gif';
|
. $phpgw_info['server']['template_set'] . '/images/navbar.gif';
|
||||||
|
|
||||||
if ($phpgw_info['flags']['currentapp'] == 'home' || $phpgw_info['flags']['currentapp'] == 'preferences' || $phpgw_info['flags']['currentapp'] == 'about') {
|
if ($phpgw_info['flags']['currentapp'] == 'home' || $phpgw_info['flags']['currentapp'] == 'preferences' || $phpgw_info['flags']['currentapp'] == 'about')
|
||||||
|
{
|
||||||
$app = 'phpGroupWare';
|
$app = 'phpGroupWare';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$app = $phpgw_info['flags']['currentapp'];
|
$app = $phpgw_info['flags']['currentapp'];
|
||||||
}
|
}
|
||||||
$phpgw_info['navbar']['about']['title'] = lang('About x',$app); // We handle this here
|
|
||||||
// becuase its special
|
// We handle this here becuase its special
|
||||||
$phpgw_info['navbar']['about']['url'] = $phpgw->link($phpgw_info['server']['webserver_url']
|
$phpgw_info['navbar']['about']['title'] = lang('About x',$app);
|
||||||
. '/about.php','app='.$app);
|
|
||||||
|
$phpgw_info['navbar']['about']['url'] = $phpgw->link('/about.php','app='.$app);
|
||||||
$phpgw_info['navbar']['about']['icon'] = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/'
|
$phpgw_info['navbar']['about']['icon'] = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/'
|
||||||
. $phpgw_info['server']['template_set'] . '/images/about.gif';
|
. $phpgw_info['server']['template_set'] . '/images/about.gif';
|
||||||
|
|
||||||
$phpgw_info['navbar']['logout']['title'] = 'Logout';
|
$phpgw_info['navbar']['logout']['title'] = 'Logout';
|
||||||
$phpgw_info['navbar']['logout']['url'] = $phpgw->link($phpgw_info['server']['webserver_url']
|
$phpgw_info['navbar']['logout']['url'] = $phpgw->link('/logout.php');
|
||||||
. '/logout.php');
|
|
||||||
$phpgw_info['navbar']['logout']['icon'] = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/'
|
$phpgw_info['navbar']['logout']['icon'] = $phpgw_info['server']['webserver_url'] . '/phpgwapi/templates/'
|
||||||
. $phpgw_info['server']['template_set'] . '/images/logout.gif';
|
. $phpgw_info['server']['template_set'] . '/images/logout.gif';
|
||||||
}
|
}
|
||||||
@ -526,12 +549,14 @@
|
|||||||
|
|
||||||
function app_header()
|
function app_header()
|
||||||
{
|
{
|
||||||
if (file_exists(PHPGW_APP_INC . '/header.inc.php')) {
|
if (file_exists(PHPGW_APP_INC . '/header.inc.php'))
|
||||||
|
{
|
||||||
include(PHPGW_APP_INC . '/header.inc.php');
|
include(PHPGW_APP_INC . '/header.inc.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function phpgw_header() {
|
function phpgw_header()
|
||||||
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
include(PHPGW_INCLUDE_ROOT . '/phpgwapi/templates/' . $phpgw_info['server']['template_set']
|
include(PHPGW_INCLUDE_ROOT . '/phpgwapi/templates/' . $phpgw_info['server']['template_set']
|
||||||
@ -539,7 +564,8 @@
|
|||||||
$this->navbar(False);
|
$this->navbar(False);
|
||||||
include(PHPGW_INCLUDE_ROOT . '/phpgwapi/templates/' . $phpgw_info['server']['template_set']
|
include(PHPGW_INCLUDE_ROOT . '/phpgwapi/templates/' . $phpgw_info['server']['template_set']
|
||||||
. '/navbar.inc.php');
|
. '/navbar.inc.php');
|
||||||
if ((! isset($phpgw_info['flags']['nonavbar']) || ! $phpgw_info['flags']['nonavbar']) && ! $phpgw_info['flags']['navbar_target']) {
|
if ((! isset($phpgw_info['flags']['nonavbar']) || ! $phpgw_info['flags']['nonavbar']) && ! $phpgw_info['flags']['navbar_target'])
|
||||||
|
{
|
||||||
echo parse_navbar();
|
echo parse_navbar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,12 +574,14 @@
|
|||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info, $HTMLCOMPLAINT;
|
global $phpgw, $phpgw_info, $HTMLCOMPLAINT;
|
||||||
|
|
||||||
if (!isset($phpgw_info['flags']['nofooter']) || !$phpgw_info['flags']['nofooter']) {
|
if (!isset($phpgw_info['flags']['nofooter']) || !$phpgw_info['flags']['nofooter'])
|
||||||
|
{
|
||||||
include(PHPGW_API_INC . '/footer.inc.php');
|
include(PHPGW_API_INC . '/footer.inc.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up mcrypt
|
// Clean up mcrypt
|
||||||
if (is_object($this->crypto)) {
|
if (is_object($this->crypto))
|
||||||
|
{
|
||||||
$this->crypto->cleanup();
|
$this->crypto->cleanup();
|
||||||
unset($this->crypto);
|
unset($this->crypto);
|
||||||
}
|
}
|
||||||
@ -565,14 +593,16 @@
|
|||||||
return pack('H' . $len, $data);
|
return pack('H' . $len, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function encrypt($data) {
|
function encrypt($data)
|
||||||
|
{
|
||||||
global $phpgw_info, $phpgw;
|
global $phpgw_info, $phpgw;
|
||||||
|
|
||||||
$data = serialize($data);
|
$data = serialize($data);
|
||||||
return $phpgw->crypto->encrypt($data);
|
return $phpgw->crypto->encrypt($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function decrypt($data) {
|
function decrypt($data)
|
||||||
|
{
|
||||||
global $phpgw_info, $phpgw;
|
global $phpgw_info, $phpgw;
|
||||||
|
|
||||||
$data = $phpgw->crypto->decrypt($data);
|
$data = $phpgw->crypto->decrypt($data);
|
||||||
@ -581,9 +611,9 @@
|
|||||||
|
|
||||||
function des_cryptpasswd($userpass, $random)
|
function des_cryptpasswd($userpass, $random)
|
||||||
{
|
{
|
||||||
$lcrypt = "{crypt}";
|
$lcrypt = '{crypt}';
|
||||||
$password = crypt($userpass);
|
$password = crypt($userpass);
|
||||||
$ldappassword = sprintf("%s%s", $lcrypt, $password);
|
$ldappassword = sprintf('%s%s', $lcrypt, $password);
|
||||||
|
|
||||||
return $ldappassword;
|
return $ldappassword;
|
||||||
}
|
}
|
||||||
|
@ -490,16 +490,10 @@
|
|||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
* Function to handle session support via url or cookies *
|
* Function to handle session support via url or cookies *
|
||||||
\*************************************************************************/
|
\*************************************************************************/
|
||||||
function link($url = '', $extravars = '')
|
function link($url, $extravars = '')
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info, $usercookie, $kp3, $PHP_SELF;
|
global $phpgw, $phpgw_info, $usercookie, $kp3, $PHP_SELF;
|
||||||
|
|
||||||
/* Fix problems when PHP_SELF if used as the param */
|
|
||||||
if ($url == $PHP_SELF)
|
|
||||||
{
|
|
||||||
$url = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $kp3)
|
if (! $kp3)
|
||||||
{
|
{
|
||||||
$kp3 = $phpgw_info['user']['kp3'];
|
$kp3 = $phpgw_info['user']['kp3'];
|
||||||
@ -507,7 +501,11 @@
|
|||||||
|
|
||||||
// Explicit hack to work around problems with php running as CGI on windows
|
// Explicit hack to work around problems with php running as CGI on windows
|
||||||
// please let us know if this doesn't work for you!
|
// please let us know if this doesn't work for you!
|
||||||
if (! $url && (PHP_OS == 'Windows' || PHP_OS == 'OS/2' || PHP_OS == 'WIN32' || PHP_OS == 'WIN16'))
|
|
||||||
|
// 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($PHP_SELF,'php.exe');
|
$exe = strpos($PHP_SELF,'php.exe');
|
||||||
if ($exe != false) {
|
if ($exe != false) {
|
||||||
@ -517,17 +515,24 @@
|
|||||||
$url .= substr($PHP_SELF,$exe,strlen($PHP_SELF)-$exe);
|
$url .= substr($PHP_SELF,$exe,strlen($PHP_SELF)-$exe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $url)
|
*/
|
||||||
|
|
||||||
|
$url = $phpgw_info['server']['webserver_url'] . $url;
|
||||||
|
|
||||||
|
// This needs to be tested as well. (jengo)
|
||||||
|
|
||||||
|
/* if (! $url)
|
||||||
{
|
{
|
||||||
$url_root = split ('/', $phpgw_info['server']['webserver_url']);
|
$url_root = split ('/', $phpgw_info['server']['webserver_url']);
|
||||||
/* Some hosting providers have their paths screwy.
|
// 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
|
// 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.
|
// It will need to be adjusted to your specific problem tho.
|
||||||
*/
|
//
|
||||||
//$patched_php_self = str_replace('/php4/php/phpgroupware', '/phpgroupware', $PHP_SELF);
|
//$patched_php_self = str_replace('/php4/php/phpgroupware', '/phpgroupware', $PHP_SELF);
|
||||||
$patched_php_self = $PHP_SELF;
|
$patched_php_self = $PHP_SELF;
|
||||||
$url = (strlen($url_root[0])? $url_root[0].'//':'') . $url_root[2] . $patched_php_self;
|
$url = (strlen($url_root[0])? $url_root[0].'//':'') . $url_root[2] . $patched_php_self;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (isset($phpgw_info['server']['usecookies']) && $phpgw_info['server']['usecookies'])
|
if (isset($phpgw_info['server']['usecookies']) && $phpgw_info['server']['usecookies'])
|
||||||
{
|
{
|
||||||
@ -549,13 +554,14 @@
|
|||||||
{
|
{
|
||||||
$url .= '&newsmode=on';
|
$url .= '&newsmode=on';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($extravars)
|
if ($extravars)
|
||||||
{
|
{
|
||||||
$url .= "&$extravars";
|
$url .= '&' . $extravars;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = str_replace('/?', '/index.php?', $url);
|
/* $url = str_replace('/?', '/index.php?', $url);
|
||||||
$webserver_url_count = strlen($phpgw_info['server']['webserver_url']);
|
$webserver_url_count = strlen($phpgw_info['server']['webserver_url']);
|
||||||
$slash_check = strtolower(substr($url ,0,1));
|
$slash_check = strtolower(substr($url ,0,1));
|
||||||
if (substr($url ,0,$webserver_url_count) != $phpgw_info['server']['webserver_url'])
|
if (substr($url ,0,$webserver_url_count) != $phpgw_info['server']['webserver_url'])
|
||||||
@ -573,7 +579,7 @@
|
|||||||
{
|
{
|
||||||
$url = $phpgw_info['server']['webserver_url'].'/'.$app.'/'.$url;
|
$url = $phpgw_info['server']['webserver_url'].'/'.$app.'/'.$url;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user