2001-07-09 19:33:19 +02:00
|
|
|
<?php
|
2001-12-05 17:00:39 +01:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* The file written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
2001-07-09 19:33:19 +02:00
|
|
|
|
2001-12-05 17:00:39 +01:00
|
|
|
/* $Id$ */
|
2001-07-09 19:33:19 +02:00
|
|
|
|
2001-12-05 17:00:39 +01:00
|
|
|
$phpgw_info = array();
|
2001-07-09 19:33:19 +02:00
|
|
|
if (!is_file('header.inc.php'))
|
|
|
|
{
|
|
|
|
echo '<center>It appears that phpGroupWare is not setup yet, please click <a href="setup/index.php">'
|
|
|
|
. 'here</a>.</center>';
|
|
|
|
exit;
|
|
|
|
}
|
2001-12-05 17:00:39 +01:00
|
|
|
|
2001-08-21 20:34:56 +02:00
|
|
|
$GLOBALS['sessionid'] = $GLOBALS['HTTP_GET_VARS']['sessionid'] ? $GLOBALS['HTTP_GET_VARS']['sessionid'] : $GLOBALS['HTTP_COOKIE_VARS']['sessionid'];
|
|
|
|
if (!isset($GLOBALS['sessionid']) || !$GLOBALS['sessionid'])
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
|
|
|
Header('Location: login.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2002-10-25 18:44:35 +02:00
|
|
|
$GLOBALS['phpgw_info']['flags'] = array
|
|
|
|
(
|
2001-07-09 19:33:19 +02:00
|
|
|
'noheader' => True,
|
|
|
|
'nonavbar' => True,
|
|
|
|
'currentapp' => 'home',
|
|
|
|
'enable_network_class' => True,
|
|
|
|
'enable_contacts_class' => True,
|
|
|
|
'enable_nextmatchs_class' => True
|
|
|
|
);
|
|
|
|
include('header.inc.php');
|
|
|
|
|
2001-08-21 20:34:56 +02:00
|
|
|
if ($GLOBALS['phpgw_forward'])
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-12-31 20:38:05 +01:00
|
|
|
while (list($name,$value) = each($GLOBALS['HTTP_GET_VARS']))
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-07-14 11:26:43 +02:00
|
|
|
if (ereg('phpgw_',$name))
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-07-14 11:26:43 +02:00
|
|
|
$extra_vars .= '&' . $name . '=' . urlencode($value);
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
|
|
|
}
|
2001-08-21 20:34:56 +02:00
|
|
|
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link($GLOBALS['phpgw_forward'],$extra_vars));
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
|
|
|
|
2001-08-21 20:34:56 +02:00
|
|
|
if ($GLOBALS['phpgw_info']['server']['force_default_app'] && $GLOBALS['phpgw_info']['server']['force_default_app'] != 'user_choice')
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-08-21 20:34:56 +02:00
|
|
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['phpgw_info']['server']['force_default_app'];
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
|
|
|
|
2002-05-31 11:25:52 +02:00
|
|
|
if ($GLOBALS['HTTP_GET_VARS']['cd']=='yes' && $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']
|
2001-08-21 20:34:56 +02:00
|
|
|
&& $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']])
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-12-05 03:29:51 +01:00
|
|
|
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/' . 'index.php'));
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
|
|
|
|
2001-08-21 20:34:56 +02:00
|
|
|
$GLOBALS['phpgw']->translation->add_app('mainscreen');
|
2002-05-31 11:25:52 +02:00
|
|
|
if (lang('mainscreen_message') != 'mainscreen_message'.lang_char())
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
|
|
|
echo '<center>' . stripslashes(lang('mainscreen_message')) . '</center>';
|
|
|
|
}
|
|
|
|
|
2001-08-21 20:34:56 +02:00
|
|
|
if ((isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
|
2001-10-06 09:56:34 +02:00
|
|
|
$GLOBALS['phpgw_info']['user']['apps']['admin']) &&
|
2001-08-21 20:34:56 +02:00
|
|
|
(isset($GLOBALS['phpgw_info']['server']['checkfornewversion']) &&
|
|
|
|
$GLOBALS['phpgw_info']['server']['checkfornewversion']))
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-08-21 20:34:56 +02:00
|
|
|
$GLOBALS['phpgw']->network->set_addcrlf(False);
|
|
|
|
$lines = $GLOBALS['phpgw']->network->gethttpsocketfile('http://www.phpgroupware.org/currentversion');
|
2001-07-09 19:33:19 +02:00
|
|
|
for ($i=0; $i<count($lines); $i++)
|
|
|
|
{
|
2002-02-20 04:45:35 +01:00
|
|
|
if(@ereg('currentversion',$lines[$i]))
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2001-09-08 18:02:59 +02:00
|
|
|
$line_found = explode(':',chop($lines[$i]));
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
|
|
|
}
|
2001-08-21 20:34:56 +02:00
|
|
|
if($GLOBALS['phpgw']->common->cmp_version($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],$line_found[1]))
|
2001-07-09 19:33:19 +02:00
|
|
|
{
|
2002-05-31 11:25:52 +02:00
|
|
|
$message = '<p>There is a new version of phpGroupWare available. <a href="'
|
2001-07-09 19:33:19 +02:00
|
|
|
. 'http://www.phpgroupware.org">http://www.phpgroupware.org</a>';
|
2002-05-31 11:25:52 +02:00
|
|
|
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$message]=True;
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
2001-09-08 18:02:59 +02:00
|
|
|
|
|
|
|
$_found = False;
|
|
|
|
$GLOBALS['phpgw']->db->query("select app_name,app_version from phpgw_applications",__LINE__,__FILE__);
|
|
|
|
while($GLOBALS['phpgw']->db->next_record())
|
|
|
|
{
|
|
|
|
$_db_version = $GLOBALS['phpgw']->db->f('app_version');
|
|
|
|
$_app_name = $GLOBALS['phpgw']->db->f('app_name');
|
|
|
|
$_versionfile = $GLOBALS['phpgw']->common->get_app_dir($_app_name) . '/setup/setup.inc.php';
|
|
|
|
if(file_exists($_versionfile))
|
|
|
|
{
|
|
|
|
include($_versionfile);
|
|
|
|
$_file_version = $setup_info[$_app_name]['version'];
|
|
|
|
$_app_title = $setup_info[$_app_name]['title'];
|
|
|
|
unset($setup_info);
|
|
|
|
|
|
|
|
if($GLOBALS['phpgw']->common->cmp_version_long($_db_version,$_file_version))
|
|
|
|
{
|
2001-09-08 18:07:05 +02:00
|
|
|
$_found = True;
|
2001-09-08 18:02:59 +02:00
|
|
|
$_app_string .= '<br>' . lang($_app_title);
|
|
|
|
}
|
|
|
|
unset($_file_version);
|
|
|
|
unset($_app_title);
|
|
|
|
}
|
|
|
|
unset($_db_version);
|
|
|
|
unset($_versionfile);
|
|
|
|
}
|
|
|
|
if($_found)
|
|
|
|
{
|
2002-05-31 11:25:52 +02:00
|
|
|
$message = '<br>' . lang('The following applications require upgrades') . ':' . "\n";
|
|
|
|
$message .= $_app_string . "\n";
|
|
|
|
$message .= '<br>' . lang('Please run setup to become current') . '.' . "\n";
|
|
|
|
|
|
|
|
$GLOBALS['phpgw_info']['flags']['msgbox_data'][$message]=False;
|
|
|
|
unset($message);
|
2001-09-08 18:02:59 +02:00
|
|
|
unset($_app_string);
|
|
|
|
}
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
2001-10-06 09:56:34 +02:00
|
|
|
|
|
|
|
if (isset($GLOBALS['phpgw_info']['user']['apps']['notifywindow']) &&
|
2001-11-23 20:43:55 +01:00
|
|
|
$GLOBALS['phpgw_info']['user']['apps']['notifywindow'])
|
|
|
|
{
|
2002-05-31 11:25:52 +02:00
|
|
|
/* need to figure out how to implement this properly
|
2001-07-09 19:33:19 +02:00
|
|
|
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
|
|
|
|
var NotifyWindow;
|
|
|
|
|
|
|
|
function opennotifywindow()
|
|
|
|
{
|
|
|
|
if (NotifyWindow)
|
|
|
|
{
|
|
|
|
if (NotifyWindow.closed)
|
|
|
|
{
|
2001-09-12 02:07:01 +02:00
|
|
|
NotifyWindow.stop;
|
|
|
|
NotifyWindow.close;
|
2001-07-09 19:33:19 +02:00
|
|
|
}
|
|
|
|
}
|
2001-08-21 20:34:56 +02:00
|
|
|
NotifyWindow = window.open("<?php echo $GLOBALS['phpgw']->link('/notify.php')?>", "NotifyWindow", "width=300,height=35,location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status=yes");
|
2001-07-09 19:33:19 +02:00
|
|
|
if (NotifyWindow.opener == null)
|
|
|
|
{
|
|
|
|
NotifyWindow.opener = window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</SCRIPT>
|
|
|
|
|
2001-10-06 09:56:34 +02:00
|
|
|
echo '<a href="javascript:opennotifywindow()">' . lang('Open notify window') . '</a>';
|
2002-05-31 11:25:52 +02:00
|
|
|
*/
|
2001-10-06 09:56:34 +02:00
|
|
|
}
|
2001-07-09 19:33:19 +02:00
|
|
|
|
2001-10-21 12:49:29 +02:00
|
|
|
/* This initializes the users portal_order preference if it does not exist. */
|
2001-11-04 05:08:17 +01:00
|
|
|
if(!is_array($GLOBALS['phpgw_info']['user']['preferences']['portal_order']) && $GLOBALS['phpgw_info']['apps'])
|
2001-10-21 12:49:29 +02:00
|
|
|
{
|
|
|
|
$GLOBALS['phpgw']->preferences->delete('portal_order');
|
|
|
|
@reset($GLOBALS['phpgw_info']['apps']);
|
|
|
|
$order = 0;
|
|
|
|
while (list(,$p) = each($GLOBALS['phpgw_info']['apps']))
|
|
|
|
{
|
|
|
|
if($GLOBALS['phpgw_info']['user']['apps'][$p['name']])
|
|
|
|
{
|
|
|
|
$GLOBALS['phpgw']->preferences->add('portal_order',$order++,$p['id']);
|
|
|
|
}
|
|
|
|
}
|
2001-11-23 20:43:55 +01:00
|
|
|
$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->save_repository();
|
2001-10-21 12:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(is_array($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
|
|
|
|
{
|
|
|
|
$app_check = Array();
|
|
|
|
@ksort($GLOBALS['phpgw_info']['user']['preferences']['portal_order']);
|
|
|
|
while(list($order,$app) = each($GLOBALS['phpgw_info']['user']['preferences']['portal_order']))
|
|
|
|
{
|
|
|
|
if(!isset($app_check[intval($app)]) || !$app_check[intval($app)])
|
|
|
|
{
|
|
|
|
$app_check[intval($app)] = True;
|
|
|
|
$sorted_apps[] = $GLOBALS['phpgw']->applications->id2name(intval($app));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-25 18:44:35 +02:00
|
|
|
$sorted_apps = Array
|
|
|
|
(
|
2001-10-21 12:49:29 +02:00
|
|
|
'email',
|
|
|
|
'calendar',
|
|
|
|
'news',
|
|
|
|
'addressbook',
|
|
|
|
'squirrelmail'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@reset($sorted_apps);
|
2002-10-25 18:44:35 +02:00
|
|
|
|
|
|
|
$GLOBALS['phpgw']->portalbox = CreateObject('phpgwapi.listbox');
|
|
|
|
|
2002-01-02 15:33:05 +01:00
|
|
|
$GLOBALS['phpgw']->hooks->process('home',$sorted_apps);
|
2001-10-21 12:49:29 +02:00
|
|
|
|
2001-11-04 05:08:17 +01:00
|
|
|
if($GLOBALS['portal_order'])
|
2001-10-21 12:49:29 +02:00
|
|
|
{
|
2001-11-04 05:08:17 +01:00
|
|
|
$GLOBALS['phpgw']->preferences->delete('portal_order');
|
|
|
|
@reset($GLOBALS['portal_order']);
|
|
|
|
while(list($app_order,$app_id) = each($GLOBALS['portal_order']))
|
|
|
|
{
|
|
|
|
$GLOBALS['phpgw']->preferences->add('portal_order',$app_order,$app_id);
|
|
|
|
}
|
|
|
|
$GLOBALS['phpgw']->preferences->save_repository();
|
2001-10-21 12:49:29 +02:00
|
|
|
}
|
2002-10-25 05:04:28 +02:00
|
|
|
|
2002-10-25 18:44:35 +02:00
|
|
|
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',$GLOBALS['phpgw']->portalbox->output,True);
|
2001-07-09 19:33:19 +02:00
|
|
|
?>
|