diff --git a/home.php b/home.php new file mode 100755 index 0000000000..48d3d156dd --- /dev/null +++ b/home.php @@ -0,0 +1,204 @@ + * + * -------------------------------------------- * + * 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. * + \**************************************************************************/ + + /* $Id$ */ + + if (!is_file('header.inc.php')) + { + echo '
It appears that phpGroupWare is not setup yet, please click ' + . 'here.
'; + exit; + } + + if (!isset($sessionid) || !$sessionid) + { + Header('Location: login.php'); + exit; + } + + $phpgw_info['flags'] = array( + 'noheader' => True, + 'nonavbar' => True, + 'currentapp' => 'home', + 'enable_network_class' => True, + 'enable_contacts_class' => True, + 'enable_nextmatchs_class' => True + ); + include('header.inc.php'); + // Note: I need to add checks to make sure these apps are installed. + + if ($phpgw_forward) + { + // Why again? + if ($phpgw_forward) + { + while (list($name,$value) = each($HTTP_GET_VARS)) + { + if (ereg('phpgw_',$name)) + { + $extra_vars .= '&' . $name . '=' . urlencode($value); + } + } + } + $phpgw->redirect($phpgw->link($phpgw_forward,$extra_vars)); + } + + if ($phpgw_info['server']['force_default_app'] && $phpgw_info['server']['force_default_app'] != 'user_choice') + { + $phpgw_info['user']['preferences']['common']['default_app'] = $phpgw_info['server']['force_default_app']; + } + + if (($phpgw_info['user']['preferences']['common']['useframes'] && + $phpgw_info['server']['useframes'] == 'allowed') || + ($phpgw_info['server']['useframes'] == 'always')) + { + if ($cd == 'yes') + { + if (! $navbarframe && ! $framebody) + { + $tpl = new Template(PHPGW_TEMPLATE_DIR); + $tpl->set_file(array( + 'frames' => 'frames.tpl', + 'frame_body' => 'frames_body.tpl', + 'frame_navbar' => 'frames_navbar.tpl' + )); + $tpl->set_var('navbar_link',$phpgw->link('index.php','navbarframe=True&cd=yes')); + if ($forward) + { + $tpl->set_var('body_link',$phpgw->link($forward)); + } + else + { + $tpl->set_var('body_link',$phpgw->link('index.php','framebody=True&cd=yes')); + } + + if ($phpgw_info['user']['preferences']['common']['frame_navbar_location'] == 'bottom') + { + $tpl->set_var('frame_size','*,60'); + $tpl->parse('frames_','frame_body',True); + $tpl->parse('frames_','frame_navbar',True); + } + else + { + $tpl->set_var('frame_size','60,*'); + $tpl->parse('frames_','frame_navbar',True); + $tpl->parse('frames_','frame_body',True); + } + $tpl->pparse('out','frames'); + } + if ($navbarframe) + { + $phpgw->common->phpgw_header(); + echo parse_navbar(); + } + } + } + elseif ($cd=='yes' && $phpgw_info['user']['preferences']['common']['default_app'] + && $phpgw_info['user']['apps'][$phpgw_info['user']['preferences']['common']['default_app']]) + { + $phpgw->redirect($phpgw->link('/' . $phpgw_info['user']['preferences']['common']['default_app'] . '/' . 'index.php')); + $phpgw->common->phpgw_exit(); + } + else + { + $phpgw->common->phpgw_header(); + echo parse_navbar(); + } + + // $phpgw->hooks->proccess("location","mainscreen"); + // $phpgw->preferences->read_preferences("addressbook"); + // $phpgw->preferences->read_preferences("email"); + // $phpgw->preferences->read_preferences("calendar"); + // $phpgw->preferences->read_preferences("stocks"); + + $phpgw->db->query("select app_version from phpgw_applications where app_name='phpgwapi'",__LINE__,__FILE__); + if($phpgw->db->next_record()) + { + $apiversion = $phpgw->db->f('app_version'); + } + else + { + $phpgw->db->query("select app_version from phpgw_applications where app_name='admin'",__LINE__,__FILE__); + $phpgw->db->next_record(); + $apiversion = $phpgw->db->f('app_version'); + } + + if ($phpgw_info['server']['versions']['phpgwapi'] > $apiversion) + { + echo '

' . lang('You are running a newer version of phpGroupWare than your database is setup for') . '.' + . '
' . lang('It is recommended that you run setup to upgrade your tables to the current version') . '.' + . '
'; + } + + $phpgw->translation->add_app('mainscreen'); + if (lang('mainscreen_message') != 'mainscreen_message*') + { + echo '

' . stripslashes(lang('mainscreen_message')) . '
'; + } + + if ((isset($phpgw_info['user']['apps']['admin']) && + $phpgw_info['user']['apps']['admin']) && + (isset($phpgw_info['server']['checkfornewversion']) && + $phpgw_info['server']['checkfornewversion'])) + { + $phpgw->network->set_addcrlf(False); + $lines = $phpgw->network->gethttpsocketfile('http://www.phpgroupware.org/currentversion'); + for ($i=0; $icommon->cmp_version($phpgw_info['server']['versions']['phpgwapi'],$line_found[1])) + { + echo '

There is a new version of phpGroupWare available. http://www.phpgroupware.org'; + } + } +?> + + +'; + //Uncomment the next line to enable the notify window. It will not work until a notifywindow app is added. + echo '' . lang('Open notify window') . ''; + + $phpgw->common->hook('home',array('email','calendar','news','addressbook')); + + //$phpgw->common->debug_phpgw_info(); + //$phpgw->common->debug_list_core_functions(); +?> + +
+common->phpgw_footer(); +?> diff --git a/index.php b/index.php index 48d3d156dd..276a4c9246 100755 --- a/index.php +++ b/index.php @@ -1,204 +1,60 @@ * - * -------------------------------------------- * - * 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. * - \**************************************************************************/ + /**************************************************************************\ + * phpGroupWare - Messenger * + * http://www.phpgroupware.org * + * This application written by Joseph Engo * + * -------------------------------------------- * + * Funding for this program was provided by http://www.checkwithmom.com * + * -------------------------------------------- * + * 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. * + \**************************************************************************/ - /* $Id$ */ + /* $Id$ */ - if (!is_file('header.inc.php')) + /* + This is the preliminary menuaction driver for the new multi-layered design + */ + if ($menuaction) { - echo '

It appears that phpGroupWare is not setup yet, please click ' - . 'here.
'; - exit; + list($app,$class,$method) = explode('.',$menuaction); + if (! $app || ! $class || ! $method) + { + $invalid_data = True; + } } - - if (!isset($sessionid) || !$sessionid) + else { - Header('Location: login.php'); - exit; + $app = 'home'; + $invalid_data = True; } $phpgw_info['flags'] = array( - 'noheader' => True, - 'nonavbar' => True, - 'currentapp' => 'home', - 'enable_network_class' => True, - 'enable_contacts_class' => True, - 'enable_nextmatchs_class' => True + 'noheader' => True, + 'nonavbar' => True, + 'currentapp' => $app ); - include('header.inc.php'); - // Note: I need to add checks to make sure these apps are installed. + include('./header.inc.php'); - if ($phpgw_forward) + if ($app == 'home') { - // Why again? - if ($phpgw_forward) - { - while (list($name,$value) = each($HTTP_GET_VARS)) - { - if (ereg('phpgw_',$name)) - { - $extra_vars .= '&' . $name . '=' . urlencode($value); - } - } - } - $phpgw->redirect($phpgw->link($phpgw_forward,$extra_vars)); + Header('Location: ' . $phpgw->link('/home.php')); } - if ($phpgw_info['server']['force_default_app'] && $phpgw_info['server']['force_default_app'] != 'user_choice') + $obj = CreateObject(sprintf('%s.%s',$app,$class)); + if ((is_array($obj->public_functions) && $obj->public_functions[$method]) && ! $invalid_data) { - $phpgw_info['user']['preferences']['common']['default_app'] = $phpgw_info['server']['force_default_app']; + eval("\$obj->$method();"); + } + else + { + Header('Location: ' . $phpgw->link('/home.php')); + /* + $_obj = CreateObject('home.home'); + $_obj->get_list(); + */ } - if (($phpgw_info['user']['preferences']['common']['useframes'] && - $phpgw_info['server']['useframes'] == 'allowed') || - ($phpgw_info['server']['useframes'] == 'always')) - { - if ($cd == 'yes') - { - if (! $navbarframe && ! $framebody) - { - $tpl = new Template(PHPGW_TEMPLATE_DIR); - $tpl->set_file(array( - 'frames' => 'frames.tpl', - 'frame_body' => 'frames_body.tpl', - 'frame_navbar' => 'frames_navbar.tpl' - )); - $tpl->set_var('navbar_link',$phpgw->link('index.php','navbarframe=True&cd=yes')); - if ($forward) - { - $tpl->set_var('body_link',$phpgw->link($forward)); - } - else - { - $tpl->set_var('body_link',$phpgw->link('index.php','framebody=True&cd=yes')); - } - - if ($phpgw_info['user']['preferences']['common']['frame_navbar_location'] == 'bottom') - { - $tpl->set_var('frame_size','*,60'); - $tpl->parse('frames_','frame_body',True); - $tpl->parse('frames_','frame_navbar',True); - } - else - { - $tpl->set_var('frame_size','60,*'); - $tpl->parse('frames_','frame_navbar',True); - $tpl->parse('frames_','frame_body',True); - } - $tpl->pparse('out','frames'); - } - if ($navbarframe) - { - $phpgw->common->phpgw_header(); - echo parse_navbar(); - } - } - } - elseif ($cd=='yes' && $phpgw_info['user']['preferences']['common']['default_app'] - && $phpgw_info['user']['apps'][$phpgw_info['user']['preferences']['common']['default_app']]) - { - $phpgw->redirect($phpgw->link('/' . $phpgw_info['user']['preferences']['common']['default_app'] . '/' . 'index.php')); - $phpgw->common->phpgw_exit(); - } - else - { - $phpgw->common->phpgw_header(); - echo parse_navbar(); - } - - // $phpgw->hooks->proccess("location","mainscreen"); - // $phpgw->preferences->read_preferences("addressbook"); - // $phpgw->preferences->read_preferences("email"); - // $phpgw->preferences->read_preferences("calendar"); - // $phpgw->preferences->read_preferences("stocks"); - - $phpgw->db->query("select app_version from phpgw_applications where app_name='phpgwapi'",__LINE__,__FILE__); - if($phpgw->db->next_record()) - { - $apiversion = $phpgw->db->f('app_version'); - } - else - { - $phpgw->db->query("select app_version from phpgw_applications where app_name='admin'",__LINE__,__FILE__); - $phpgw->db->next_record(); - $apiversion = $phpgw->db->f('app_version'); - } - - if ($phpgw_info['server']['versions']['phpgwapi'] > $apiversion) - { - echo '

' . lang('You are running a newer version of phpGroupWare than your database is setup for') . '.' - . '
' . lang('It is recommended that you run setup to upgrade your tables to the current version') . '.' - . '
'; - } - - $phpgw->translation->add_app('mainscreen'); - if (lang('mainscreen_message') != 'mainscreen_message*') - { - echo '

' . stripslashes(lang('mainscreen_message')) . '
'; - } - - if ((isset($phpgw_info['user']['apps']['admin']) && - $phpgw_info['user']['apps']['admin']) && - (isset($phpgw_info['server']['checkfornewversion']) && - $phpgw_info['server']['checkfornewversion'])) - { - $phpgw->network->set_addcrlf(False); - $lines = $phpgw->network->gethttpsocketfile('http://www.phpgroupware.org/currentversion'); - for ($i=0; $icommon->cmp_version($phpgw_info['server']['versions']['phpgwapi'],$line_found[1])) - { - echo '

There is a new version of phpGroupWare available. http://www.phpgroupware.org'; - } - } -?> - - -'; - //Uncomment the next line to enable the notify window. It will not work until a notifywindow app is added. - echo '' . lang('Open notify window') . ''; - - $phpgw->common->hook('home',array('email','calendar','news','addressbook')); - - //$phpgw->common->debug_phpgw_info(); - //$phpgw->common->debug_list_core_functions(); -?> - -
-common->phpgw_footer(); -?>