⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 header.php

📁 Internet Task Management System可以让用户分配和管理一个组织内的任务。ITMS可以发送任务管理通知
💻 PHP
字号:
<?php/* * ITMS ValleyData source file version 1.0 May 11, 2001 *  * This is included on every ITMS page, defines the contents of the top portion of each page * Expected input: *    $title * * * Internet Task Management System: An online system used for recording information about and assigning tasks and processes. * Copyright (C) 2001  ValleyData Programming Group * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * See file named "gpl.txt" included with source code or * visit http://www.gnu.org/copyleft/gpl.txt on the internet. */header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past//header ("Expires: ". gmdate("D, d M Y H:i:s") . " GMT", time() + 20);     // Date now plus 20 secheader ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");                                                           // always modifiedheader ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1header ("Pragma: no-cache");                          // HTTP/1.0include("config.php");include("toolbox.php");include("error_handler.php");include("db_tools.php");include("login.php");$PAGE = strrchr($PHP_SELF, "/");$PAGE = strtok($PAGE, "?");$PAGE = substr($PAGE, 1);if(isset($save)) //to update the status table immediately{    setcookie("num_pending");    unset($num_pending);    setcookie("num_assigned");    unset($num_assigned);    $assignedBy_email = get_user_email($user_id);    db_open();    db_use();    $query = "SELECT to_char(PT.date_assigned, 'YYYY-MM-DD HH24:MI:SS') DATE_ASSIGNED, PT.period, PT.period_unit, ". 			 "to_char(PT.due_date, 'YYYY-MM-DD HH24:MI:SS') DUE_DATE, PT.tid, PT.title, PT.notify, PT.info, ".		     "U1.name AS assigner, U2.name AS assignedTo, U1.email, U1.html FROM pending_tasks PT, ".		     "users U1, users U2 WHERE PT.user_id = '$user_id' AND PT.assigner = U1.user_id AND PT.user_id = U2.user_id";    $result = db_query($query);    while($row = db_fetch_row($result))    {        $tid = $row["TID"];         $cbdone = "done$tid";        if(isset($$cbdone))        {            if($row["NOTIFY"] == 1)            {                //send notification				if(isset($row["EMAIL"]))				{					notifyComplete(							$row["TITLE"], 							$row["EMAIL"], 							$row["ASSIGNEDTO"],							$assignedBy_email,							$row["INFO"],                            $row["DUE_DATE"],						    get_priority_string($row["PRIORITY"]),							$row["HTML"]); 				}            }			if($row["PERIOD"] != "0" && $row["PERIOD"] != "") 			{				$due_date = $row["DUE_DATE"];//sample: 2001-03-11 18:59:56 				$due_year = substr($due_date, 0, 4);				$due_month = substr($due_date, 5, 2);				$due_day = substr($due_date, 8, 2);				$due_hour = substr($due_date, 11, 2);				$due_min = substr($due_date, 14, 2);				$assigned_day = substr($row["DATE_ASSIGNED"], 8, 2);								switch($row["PERIOD_UNIT"])				{					case "0"://days						$due_day += $row["PERIOD"];						break;					case "1"://weeks						$due_day += ($row["PERIOD"] * 7);						break;					case "2"://months						$month_num = $due_month + $row["PERIOD"];						$days_to_add = get_days_in_month(mktime($due_hour, $due_min, 0, $due_month, $due_day, $due_year));						/*						$next_month_days = get_days_in_month(mktime($due_hour, $due_min, 0, $due_month + 1, 1, $due_year));						if($days_to_add > $next_month_days)							$days_to_add = $next_month_days;						*/						($assigned_day > $due_day) ? $max_day = $assigned_day : $max_day = $due_day;						for($i = $due_month+1; $i <= $month_num; $i++)						{							$curr_day = date('d', mktime($due_hour, $due_min, 0, $month_num-1, $days_to_add, $due_year));							$next_month_days = get_days_in_month(mktime($due_hour, $due_min, 0, $i, 1, $due_year));							if($max_day > $curr_day)							{								$curr_day = $max_day;							}							if($curr_day > $next_month_days)							{								$curr_day = $next_month_days;							}							$days_to_add += $curr_day;						}						$due_day = $days_to_add;						break;				}				$new_due = mktime($due_hour, $due_min, 0, $due_month, $due_day, $due_year);				$new_due = date('Y-m-d H:i:s', $new_due);				$query = "UPDATE pending_tasks SET date_assigned=to_date('$due_date', 'YYYY-MM-DD HH24:MI:SS'), ".					     "due_date=to_date('$new_due', 'YYYY-MM-DD HH24:MI:SS') WHERE tid='$tid'";			}			else			{				$query = "DELETE FROM pending_tasks WHERE tid='$tid'";            }			db_query($query);        }    }}else if(isset($unassign)) //to update the status table immediately{    setcookie("NUM_PENDING");    unset($num_pending);    setcookie("NUM_ASSIGNED");    unset($num_assigned);    $assignedBy_email = get_user_email($user_id);    db_open();    db_use();    $query = "SELECT to_char(PT.date_assigned, 'YYYY-MM-DD HH24:MI:SS') DATE_ASSIGNED , PT.period, PT.period_unit, " .	         "to_char(PT.due_date, 'YYYY-MM-DD HH24:MI:SS') DUE_DATE, PT.tid, PT.title, PT.notify, PT.info, ".		     "U1.name AS assignedTo, U2.name AS assigner, U1.email, U1.html FROM pending_tasks PT, ".		     "users U1, users U2 WHERE PT.user_id=U1.user_id AND PT.assigner=U2.user_id";    $result = db_query($query);	    while($row = db_fetch_row($result))    {        $tid = $row["TID"];        $cbunassign = "unassign$tid";        if(isset($$cbunassign))        {            //send notification            notifyUnassigned(                    $row["TITLE"],                     $row["EMAIL"],                     $row["ASSIGNEDTO"],                    $user,                    $assignedBy_email,                    $row["INFO"],                    $row["DUE_DATE"],                    get_priority_string($row["PRIORITY"]),                    $row["HTML"]);			$query = "DELETE FROM pending_tasks WHERE tid='$tid'";			db_query($query);        }    }}if(isset($password_change)) //if they are making a password change (in myprefs.php){    $oldpassword = make_clean($oldpassword);    $newpassword = make_clean($newpassword);	$newconfirm_password = make_clean($newconfirm_password);    if($ENABLE_LDAP == "true")    {        if(!ldap_is_user($user, $oldpassword))        {            message_box("Invalid Current Password, try again", "error");        }        else if($newpassword != $newconfirm_password)        {            message_box("Your two new passwords didn't match, try again", "warning");        }        else        {			//set new cookies so that the user doesn't have to re-login with new password			($SECURE_COOKIES == "true")? $SSL=1: $SSL=0;			setcookie("user", $user, 0, "", "", $SSL); 			setcookie("pass", $newpassword, 0, "", "", $SSL);			setcookie("isAdmin", $isAdmin, 0, "", "", $SSL);			setcookie("user_id", $user_id, 0, "", "", $SSL);			setcookie("hash", md5($user.$user_id.$isAdmin.$newpassword."alk4d"), 0, "", "", $SSL);			$pass = $newpassword;			$hash = md5($user.$user_id.$isAdmin.$newpassword."alk4d");            ldap_update_password($user, $newpassword); //update password in ldap        }    }//end if($ENABLE_LDAP == "true")    else //if LDAP is disabled    {        if(!db_is_user($user, $oldpassword))        {            message_box("Invalid Current Password, try again", "error");        }        else if($newpassword != $newconfirm_password)        {            message_box("Your two new passwords didn't match, try again", "warning");        }        else        {			//set new cookies so that the user doesn't have to re-login with new password			($SECURE_COOKIES == "true")? $SSL=1: $SSL=0;			setcookie("user", $user, 0, "", "", $SSL); 			setcookie("pass", $newpassword, 0, "", "", $SSL);			setcookie("isAdmin", $isAdmin, 0, "", "", $SSL);			setcookie("user_id", $user_id, 0, "", "", $SSL);			setcookie("hash", md5($user.$user_id.$isAdmin.$newpassword."alk4d"), 0, "", "", $SSL);       			$pass = $newpassword;			$hash = md5($user.$user_id.$isAdmin.$newpassword."alk4d");            db_update_password($user, $newpassword); //update password in DB        }    }//end else if($ENABLE_LDAP == "false")}//end if(isset($password_change))if(isset($num_pending)){    setcookie("num_pending", $num_pending);}if(isset($num_assigned)){    setcookie("num_assigned", $num_assigned);}?><html><head>    <title><?php print($title); ?></title>    <META HTTP-EQUIV="Refresh" content="<?php print($EXPIRE_INTERVAL) ?>;URL=logout.php">    <link rel="stylesheet" type="text/css" href="itms.css" title="Default">    <META NAME="description" CONTENT="This site was created with ITMS.">    <META NAME="author" CONTENT="ValleyData Programming Group">	<?php print_js(); ?></head><body><table><tr>    <FORM>    <td colspan="2">    <IMG src="images/itms_header.jpg" WIDTH="<?php print($LOGO_WIDTH_HEADER); ?>" HEIGHT="<?php print($LOGO_HEIGHT_HEADER); ?>" border=0 alt="ITMS">    </td>    <td valign="top" align="left">        <TABLE border="0" cellpadding="0" cellspacing="0">        <TR>            <TD class="table-separator-odd">                <?php                //tell the user who they are logged in as                print("Welcome to ITMS: $user");                ?>            </TD>        </TR>        <TR>            <TD class="table-separator-even"><?php                //tell the user which groups they belong to                $groups = get_user_groups($user_id);                $size = count($groups);				if($size == 0)					print("You belong to no");				else					print("You are in the ");                $curr = 0;                foreach($groups as $group)                {                    $curr++;                    if($size == 1)                        print(get_group_name($group["GID"]));                    else if($curr == $size)                        print("and " . get_group_name($group["GID"]));                    else                        print(get_group_name($group["GID"]) . ", ");                }                print(" groups.");                ?>                </TD>        </TR>        <TR>            <TD class="table-separator-odd"><?php                //tell the user how many tasks they have been assigned                if(!isset($num_pending))                {                    $num_pending = 0;                    db_open();                    db_use();                    $query = "SELECT * FROM pending_tasks WHERE user_id = '$user_id' ORDER BY due_date";                    $result = db_query($query);                    while($row = db_fetch_row($result))                    {                        $num_pending++;                    }                }                print("You have $num_pending Pending Tasks.");                ?>                </TD>        </TR>        <TR>            <TD class="table-separator-even"><?php                //tell the user how many tasks have been assigned to them                if(!isset($num_assigned))                {                    $num_assigned = 0;                    db_open();                    db_use();                    $query = "SELECT * FROM pending_tasks WHERE assigner = '$user_id' ORDER BY due_date";                    $result = db_query($query);                    while($row = db_fetch_row($result))                    {                        $num_assigned++;                    }                }                print("You have $num_assigned Assigned Tasks.");                ?>                </TD>        </TR>        </TABLE>    </td>    <td valign="top" align="left">    <iframe HEIGHT="<?php print($LOGO_HEIGHT_HEADER); ?>" WIDTH="300" frameborder="1" src="help.php<?php print("#" . $PAGE); ?>" name="instant_help">    <B>Click the Help button for help on using ITMS</B>    </iframe>    </td>    <td valign="top" align="left">    <INPUT TYPE="button" value="Help" onClick="window.open('help_system.php?topic=<?php print($PAGE); ?>', 'help', 'height=400,innerHeight=400,width=400,innerWidth=400')">    </td>    </FORM></tr><tr>   <td valign="top"><?php include("menu.php") ?></td>   <td valign="top" colspan="4">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -