egroupware/index.php

177 lines
8.2 KiB
PHP
Raw Normal View History

<?php
2000-08-18 05:24:22 +02: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. *
\**************************************************************************/
/* $Id$ */
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;
}
2000-11-09 14:21:36 +01:00
if (!isset($sessionid) || !$sessionid) {
2000-08-18 05:24:22 +02:00
Header("Location: login.php");
exit;
2000-08-18 05:24:22 +02:00
}
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home",
2000-12-26 21:13:34 +01:00
"enable_network_class" => True, "enable_todo_class" => True,
2001-01-10 06:01:36 +01:00
"enable_addressbook_class" => True, "enable_nextmatchs_class" => True
);
2000-08-18 05:24:22 +02:00
include("header.inc.php");
// Note: I need to add checks to make sure these apps are installed.
if ($phpgw_forward) {
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_info["server"]["webserver_url"] . $phpgw_forward,$extra_vars));
}
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_info["server"]["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($phpgw_info["server"]["webserver_url"] . $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();
}
}
2000-12-27 23:28:12 +01:00
} elseif ($cd=="yes" && $phpgw_info["user"]["preferences"]["common"]["default_app"]
2000-10-12 19:56:44 +02:00
&& $phpgw_info["user"]["apps"][$phpgw_info["user"]["preferences"]["common"]["default_app"]]) {
$phpgw->redirect($phpgw->link($phpgw_info["server"]["webserver_url"] . "/"
. $phpgw_info["user"]["preferences"]["common"]["default_app"] . "/"
. ($phpgw_info["user"]["preferences"]["common"]["default_app"]=="calendar"?$phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"]:"index.php")));
$phpgw->common->phpgw_exit();
2000-12-27 23:28:12 +01:00
} else {
$phpgw->common->phpgw_header();
echo parse_navbar();
2000-08-18 05:24:22 +02:00
}
2000-12-27 23:28:12 +01:00
//$phpgw->hooks->proccess("location","mainscreen");
2001-01-06 09:06:22 +01:00
// $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 applications where app_name='admin'",__LINE__,__FILE__);
$phpgw->db->next_record();
if ($phpgw_info["server"]["versions"]["phpgwapi"] > $phpgw->db->f("app_version")) {
2000-11-02 00:37:10 +01:00
echo "<p><b>" . lang("Your are running a newer version of phpGroupWare then your database is setup for")
. "<br>" . lang("It is recommend that you run setup to upgrade your tables to the current version")
. "</b>";
}
$phpgw->translation->add_app("mainscreen");
if (lang("mainscreen_message") != "mainscreen_message*") {
echo "<center>" . stripslashes(lang("mainscreen_message")) . "</center>";
}
2000-08-18 05:24:22 +02:00
2000-11-09 14:21:36 +01:00
if ((isset($phpgw_info["user"]["apps"]["admin"]) &&
$phpgw_info["user"]["apps"]["admin"]) &&
(isset($phpgw_info["server"]["checkfornewversion"]) &&
$phpgw_info["server"]["checkfornewversion"])) {
2000-08-26 03:05:04 +02:00
$phpgw->network->set_addcrlf(False);
$lines = $phpgw->network->gethttpsocketfile("http://www.phpgroupware.org/currentversion");
2000-08-18 05:24:22 +02:00
for ($i=0; $i<count($lines); $i++) {
if (ereg("currentversion",$lines[$i])) {
$line_found = explode(":",chop($lines[$i]));
}
}
if ($line_found[1] > $phpgw_info["server"]["versions"]["phpgwapi"]) {
2000-08-18 05:24:22 +02:00
echo "<p>There is a new version of phpGroupWare avaiable. <a href=\""
. "http://www.phpgroupware.org\">http://www.phpgroupware.org</a>";
}
}
?>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
2000-08-18 05:24:22 +02:00
function opennotifywindow()
{
window.open("<?php echo $phpgw->link("notify.php")?>", "phpGroupWare", "width=150,height=25,location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status=yes");
}
</SCRIPT>
2000-08-18 05:24:22 +02:00
<?php
2001-01-08 05:35:04 +01:00
echo '<p><table border="0" width="100%" align="center">';
2000-08-18 05:24:22 +02:00
//echo '<a href="javascript:opennotifywindow()">Open notify window</a>';
2000-11-11 08:10:24 +01:00
if ($phpgw_info["user"]["apps"]["stocks"] && $phpgw_info["user"]["preferences"]["stocks"]["enabled"]) {
include($phpgw_info["server"]["server_root"] . "/stocks/inc/functions.inc.php");
echo '<tr><td align="right">' . return_quotes($quotes) . '</td></tr>';
}
2001-01-01 19:49:28 +01:00
$phpgw->common->hook("",array("email","calendar"));
2000-10-23 21:16:20 +02:00
if ($phpgw_info["user"]["apps"]["addressbook"]
&& $phpgw_info["user"]["preferences"]["addressbook"]["mainscreen_showbirthdays"]) {
2000-08-18 05:24:22 +02:00
echo "<!-- Birthday info -->\n";
$phpgw->db->query("select a.owner,a.n_given,a.n_family,b.contact_name,b.contact_value from phpgw_addressbook as a, phpgw_addressbook_extra as b where "
. "b.contact_name='bday' and b.contact_value like '" . $phpgw->common->show_date(time(),"n/d")
. "/%' and (a.owner='" . $phpgw_info["user"]["account_id"] . "' or b.contact_name='access' and b.contact_value ='"
2000-12-20 08:37:49 +01:00
. "public')",__LINE__,__FILE__);
2000-08-18 05:24:22 +02:00
while ($phpgw->db->next_record()) {
echo "<tr><td>" . lang("Today is x's birthday!", $phpgw->db->f("ab_firstname") . " "
. $phpgw->db->f("ab_lastname")) . "</td></tr>\n";
2000-08-18 05:24:22 +02:00
}
$tomorrow = $phpgw->common->show_date(mktime(0,0,0,
$phpgw->common->show_date(time(),"m"),
$phpgw->common->show_date(time(),"d")+1,
$phpgw->common->show_date(time(),"Y")),"n/d" );
$phpgw->db->query("select a.owner,a.n_given,a.n_family,b.contact_name,b.contact_value from phpgw_addressbook as a, phpgw_addressbook_extra as b where "
. "b.contact_name='bday' and b.contact_value like '$tomorrow/%' and (a.owner='"
. $phpgw_info["user"]["account_id"] . "' or b.contact_name='access' and b.contact_value='public')",__LINE__,__FILE__);
2000-08-18 05:24:22 +02:00
while ($phpgw->db->next_record()) {
echo "<tr><td>" . lang("Tomorrow is x's birthday.", $phpgw->db->f("ab_firstname") . " "
2000-10-23 21:16:20 +02:00
. $phpgw->db->f("ab_lastname")) . "</td></tr>\n";
2000-08-18 05:24:22 +02:00
}
echo "<!-- Birthday info -->\n";
}
2000-11-17 18:00:17 +01:00
//$phpgw->common->debug_phpgw_info();
2000-11-06 01:57:16 +01:00
//$phpgw->common->debug_list_core_functions();
2000-08-18 05:24:22 +02:00
?>
<TR><TD></TD></TR>
</TABLE>
<?php
2001-01-08 02:23:29 +01:00
$phpgw->common->phpgw_footer();
2001-01-10 06:01:36 +01:00
?>