C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\heimam\tcpro\index.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
/**
 * index.php
 * 
 * Initial TeamCal Pro page
 * 
 * @package TeamCalPro
 * @version 3.3.001 
 * @author George Lewe
 * @copyright Copyright (c) 2004-2010 by George Lewe
 * @link http://www.lewe.com
 * @license http://www.lewe.com/tcpro/doc/license.txt Extended GNU Public License
 */

//echo "<script type=\"text/javascript\">alert(\"Debug: \");</script>";

/**
 * Set parent flag to control access to child scripts 
 */
define'_VALID_TCPRO');

/**
 * Installation check 
 */
if ( !file_exists("config.tcpro.php")) {
   if ( 
file_exists("installation.php")) {
      
header'Location: installation.php' );
   }
   else {
      
$err_short  "Installation Corrupted";
      
$err_long   "The configuration file 'config.tcpro.php' and the installation 'installation.php' " .
                    
"could not be found. Either one must exist for a complete TeamCal Pro installation. " .
                    
"Try recovering 'installation.php' from the archive and try again.";
      
$err_module "index.php";
      
$err_html_header=true;
      include(
"error.php");
      die();
   }
}

/**
 * Get all $_REQUEST and $_POST parameters into $CONF['options'][]
 * and overwrite defaults accordingly.
 */
require ("config.tcpro.php");
require_once (
"includes/functions.tcpro.php");
getOptions();
if (
strlen($CONF['options']['lang'])) require ("includes/lang/" $CONF['options']['lang'] . ".tcpro.php");
else                                  require (
"includes/lang/english.tcpro.php");

/**
 * Includes 
 */
require_once ("includes/showmonth.function.php");
require_once (
"includes/tcannouncement.class.php" );
require_once (
"includes/tcconfig.class.php");
require_once (
"includes/tclogin.class.php");
require_once (
"includes/tclog.class.php");
require_once (
"includes/tcuser.class.php");
require_once (
"includes/tcuseroption.class.php");

$AN = new tcAnnouncement;
$C = new tcConfig;
$L = new tcLogin;
$LOG = new tcLog;
$U = new tcUser;
$UA = new tcUser;
$UO = new tcUserOption;

if ( !isset(
$_REQUEST['sort']) ) $sort="ASC";
else 
$sort $_REQUEST['sort'];

$logged_out false;
if (isset (
$_REQUEST['action'])) 
{
   switch (
$_REQUEST['action']) 
   {
      case 
'logout' :
      
/**
       * Log this event
       */
      
$LOG->log("logLogin"$L->checkLogin(), "Logout");
      
$L->logout();
      
$logged_out true;
      break;
   }
}

/**
 * Show HTML header
 * Use this file to adjust your meta tags and such
 */
require("includes/header.html.inc.php");

/**
 * Body Tag
 * The following <div> tag is necessary for overLIB tool tips
 */
echo "<body>\r\n";
echo 
"<div id=\"overDiv\" style=\"position:absolute; visibility:hidden; z-index:1000;\"></div>";

/**
 * Show application header
 * This is the file to change in order to put different images at the top
 * of the main page.
 */
require("includes/header.application.inc.php");

/**
 * Show menu
 * This is the file containing the TeamCal menu
 */
require("includes/menu.inc.php");

/**
 * If logged in and authorized go ahead and show the calendar
 */
if (!$logged_out && checkAuth("openCalendar")) {

   
$monthnames $CONF['monthnames'];
   
$groupfilter intval($CONF['options']['groupfilter']);
   
$month_id intval($CONF['options']['month_id']);
   
$year_id intval($CONF['options']['year_id']);
   
$show_id intval($CONF['options']['show_id']);
   
$region $CONF['options']['region'];
   
   for (
$i 1$i <= $show_id$i++) {
      echo 
showMonth(strval($year_id), $monthnames[$month_id], $groupfilter$sort);
      if (
$month_id == 12) {
         
$year_id += 1;
         
$month_id 1;
      } else {
         
$month_id += 1;
      }
   }
   
   
/**
    * Now check for popup announcements for the logged in user
    */
   
if ($user=$L->checkLogin()) {
      
$query1 "SELECT ats FROM ".$AN->uatable." WHERE username='".$user."'";
      
$result1 $AN->db->db_query($query1);
      
$foundpopup=false;
      while ( 
$row1 $AN->db->db_fetch_array($result1,MYSQL_ASSOC) ) {
         
$AN->read($row1['ats']);
         if (
$AN->popup) { $foundpopup=true; break; }
      }
      if (
$foundpopup) {
         
/**
          * Found popup announcements. Open popup if not more than 20 seconds
          * have passed since login. (Otherwise the popup is shown everytime
          * the calendar is displayed.)
          */
         
$UA->findByName($user);
         
$nowstamp date("YmdHis");
         
$pos strrpos($UA->last_login," ");
         
$userstamp=substr($UA->last_login,0,$pos);
         
$userstamp=str_replace("-",'',$userstamp);
         
$userstamp=str_replace(" ",'',$userstamp);
         
$userstamp=str_replace(":",'',$userstamp);
         
//echo "<script type=\"text/javascript\">alert(\"Debug: ".$nowstamp."|".$userstamp."\");</script>";
         
if ( (floatval($nowstamp)-20) < floatval($userstamp)) {
         
?>
         <script type="text/javascript">
            <!--
            this.blur();
            openPopup('popup.php?uname=<?php echo $user?>','popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,titlebar=0,resizable=0,dependent=1,width=500,height=400');
            -->
         </script>
         <?php
         
}
      }
   }
}

/**
 * Show HTML page footer
 */
require("includes/footer.html.inc.php");
?>