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

📄 main.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 PHP
字号:
<?
################################################################################
# 投票调查                          Version 1.0                                 #
# Copyright 2006                   2006/01/16                                  #
################################################################################
# author:liurui                                                               #
# 
################################################################################

$GLOBALS["inAdmin"] = 1;

#-->> Including Files

require("../inc/init.php");
require("../inc/mysql.php");
require("../inc/functions.php");
require("../inc/pfunctions.php");

#-->> GET and POST Variables

$varnames = array("logoff", "phpQpasswd", "cs");

SetVars($varnames);

#-->> Logging In

//IsAdmin(1);
SetLanguage('', 'ADMIN');
$imgurl = $GLOBALS["phpQImageDir"];

# Perform some security checks to make sure users are taking care of themselves.
/**if (file_exists('../install.php')) {
	$GLOBALS['message'] = '<b>'.$phpQlang['SecurityAlert'].':</b> '.$phpQlang['SecurityInstall'];
}

if ($phpQAdmin["Passwd"] == 'password') {
	$GLOBALS['message'] = '<b>'.$phpQlang['SecurityAlert'].':</b> '.$phpQlang['SecurityPassword'];
}**/

#-->> Content

$overviewtitle = $phpQlang['OverviewTitle'];
$version = $GLOBALS["PHPQVERSION"];
$contents = <<<END
<script>
function DeleteSurvey (FileUrl) {
	if (confirm('你确定删除调查表吗?')) {
			location.href=FileUrl;
	}
	
}
function EditSurvey (FileUrl) {
	
	location.href=FileUrl;
	
}
function ActivateSurvey (action,FileUrl,dtime,etime,Active,now) {
	//document.choosesurvey.action.value = "activate";
	//document.choosesurvey.activateid.value = cvalue;
	if(dtime != "00000000000000" && etime > dtime && etime > now && etime != "00000000000000" || Active == "y")
	{
		if (action == "on") {
			FileUrl=FileUrl+"&activate=y";
		} else {
			FileUrl=FileUrl+"&activate=n";;
		}
		location.href=FileUrl;
	}else{
		alert("请输入正确的开始日期和结束日期,然后启动调查");
		return false;
	}
}
</script>
END;

$scriptloc = '';
if ($HTTP_HOST != '') {
	$scriptloc .= "http://$HTTP_HOST";
}
elseif ($HTTP_SERVER_VARS["HTTP_HOST"] != '') {
	$scriptloc .= 'http://'.$HTTP_SERVER_VARS["HTTP_HOST"];
}
$php_self = $PHP_SELF ? $PHP_SELF : $HTTP_SERVER_VARS["PHP_SELF"];
if (!$php_self && $HTTP_SERVER_VARS['REQUEST_URI']) {
	$php_self = $HTTP_SERVER_VARS['REQUEST_URI'];
}
$scriptloc .= $php_self;
$scriptloc = preg_replace("/(.*)\/.*/", "\\1", $scriptloc);
$scriptloc = preg_replace("/(.*)\/.*/", "\\1", $scriptloc);

$qstring = "select *, ";
$qstring .= "date_format(StartDate, '".$phpQlang['MySQLDateFormat']."') as FStartDate, ";
$qstring .= "date_format(EndDate, '".$phpQlang['MySQLDateFormat']."') as FEndDate, ";
$qstring .= "(now() < StartDate) as Pending, (now() > EndDate) as Expired ";
$qstring .= "from phpQSurvey where ";
$qstring .= " (InStr(DEPT_ID,'".$_SESSION["LOGIN_DEPT_ID"]."') or DEPT_ID = 'ALL_DEPT')";
$qstring .= " or CREATOR = '".$_SESSION["LOGIN_USER_ID"]."' order by Active,AddDate desc";
$mqsurvey = mysql_query($qstring);
$FLOW_COUNT=0;
$FLOW_COUNT1=0;
$FLOW_COUNT2=0;
while ($masurvey = mysql_fetch_array($mqsurvey)) {
	$FLOW_COUNT++;
	$mqresponse = mysql_query("select count(*) as ct from phpQUser where SID = \"".ProtectMySQL($masurvey["SID"])."\"");
	$responsect = 0;
	if ($maresponse = mysql_fetch_array($mqresponse)) {
		$responsect = $maresponse["ct"];
	}
    
	$responsemsg = ($responsect == 1) ? $phpQlang["response"] : $phpQlang["responses"];
	$responsemsg = sprintf($responsemsg, $responsect);

	$responseloc = " (<A HREF=\"choose.php?cs=".$masurvey["SID"]."\" CLASS=link>$responsemsg</A>)";

    unset($editloc);
	if($_SESSION["LOGIN_USER_ID"] == $masurvey["CREATOR"])
	{
		$editloc = "<A HREF=\"survey.php?cs=".$masurvey["SID"]."\" ";
		$editloc .= ">编辑</A>";
	}
	
	unset($editsurveyloc);
	if($_SESSION["LOGIN_USER_ID"] == $masurvey["CREATOR"])
	{
		$editsurveyloc = "<a href='#' onclick=\"EditSurvey('question.php?cs=".$masurvey["SID"]."')\">设置调查项</a>";
	}

	$previewloc = "<A HREF=\"".$scriptloc."/fillsurvey.php?sid=".$masurvey["SID"]."&action=preview\" CLASS=link ";
	$previewloc .= "TARGET=_new >预览</A>";
    
	unset($deleteloc);
	if($_SESSION["LOGIN_USER_ID"] == $masurvey["CREATOR"])
	{
		$deleteloc = "<a HREF='#' onclick=\"DeleteSurvey('survey.php?cs=".$masurvey["SID"]."&action=delete&deleteid=".$masurvey["SID"]."')\">删除</a>";
	}

	$active = ($masurvey["Active"] == "y") ? $phpQlang['Deactivate'] : $phpQlang['Activate'];
    $activate = ($masurvey["Active"] == "y") ? "off" : "on";

	unset($activeloc);
	if($_SESSION["LOGIN_USER_ID"] == $masurvey["CREATOR"])
	{
		//处理开始日期
		$dtime	= substr($masurvey["StartDate"],0,19);
		$dtime	= str_replace(" ", "", $dtime);
		$dtime	= str_replace("-", "", $dtime);
		$dtime	= str_replace(":", "", $dtime);

		//处理结束日期
		$etime	= substr($masurvey["EndDate"],0,19);
		$etime	= str_replace(" ", "", $etime);
		$etime	= str_replace("-", "", $etime);
		$etime	= str_replace(":", "", $etime);
		$now	= date("YmdHis");

		$activeloc = "<a href='#' ONCLICK=\"ActivateSurvey('".$activate."','survey.php?activateid=".$masurvey["SID"]."&action=activate','".$dtime."','".$etime."','".$masurvey["Active"]."','".$now."')\">".$active."</a>";
	}
	$svname = (strlen($masurvey["Name"]) > 30) ? substr($masurvey["Name"],0,30)."..." : $masurvey["Name"];

	$surveyloc = $scriptloc."/fillsurvey.php?sid=".$masurvey["SID"];

	if ($masurvey["Active"]=="y") {
		if ($masurvey["Pending"] && substr($masurvey["StartDate"],0,10) != "0000-00-00") {
			$activeimg = "<IMG SRC=\"/images/email_close.gif\"  ALT=\"".$phpQlang['Pending']."\">";
			$activebtn = "<IMG SRC=\"$imgurl/buttonpending.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
		elseif ($masurvey["Expired"] && substr($masurvey["EndDate"],0,10) != "0000-00-00") {
			$activeimg = "<IMG SRC=\"/images/tablemanage.gif\"  ALT=\"".$phpQlang['Expired']."\" width=17 height=15>";
			$activebtn = "<IMG SRC=\"$imgurl/buttonpending.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
		else {
			$activeimg = "<IMG SRC=\"/images/email_close.gif\"  ALT=\"".$phpQlang['Active']."\">";
			$activebtn = "<IMG SRC=\"$imgurl/buttonactive.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
	} else {
		$activeimg = "<IMG SRC=\"/images/email_open.gif\"  ALT=\"".$phpQlang['NotActive']."\">";
		$activebtn = "<IMG SRC=\"$imgurl/buttondeactive.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
	}

	$editorloc = "<A HREF=\"$surveyloc\" CLASS=link TARGET=_new>";
	$editorloc .= $svname."</A>";
	if ($masurvey["Active"] == "y"){
       $STATUS="<img src='/images/email_close.gif' alt='生效' align='absmiddle'> <b>已生效的调查表</b>";
	   $FLOW_COUNT1++; 
	}
	else {
	   $STATUS="<img src='/images/email_open.gif' alt='无效' align='absmiddle'> <b>未生效的调查表</b>";
	   $FLOW_COUNT2++;
	}
	
	if ($FLOW_COUNT == 1 || $FLOW_COUNT2 == 1){
	  $contents .= "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 width=100%>";
	  if ($FLOW_COUNT2 == 1){
       $contents .= "<tr height=\"10\"><td colspan=3></td><tr>";
	  }
	  //echo $FLOW_COUNT2;
	  $contents .= "<tr><td colspan=3>".$STATUS."</td></tr>";
	  $contents .= "<tr><td colspan=\"3\">";
	  $contents .="<TABLE CELLPADDING=3 CELLSPACING=1 BORDER=0 width=100% class=small>";
	  $contents .= "<tr class=TableHeader>
      <td width=5%>状态</td>
      <td width=60%>调查表名称</td>
      <td>操作</td>
      </tr>";
   }
	
	
    if($FLOW_COUNT%2==1)
       $TableLine="TableLine1";
    else
       $TableLine="TableLine2";
	
	$contents .= "<TR class=".$TableLine.">";
	$contents .= "<TD>$activeimg</TD>";
	$contents .= "<TD><NOBR>$editorloc</NOBR>$responseloc</TD>";
	$contents .= "<TD WIDTH=100%>$editloc&nbsp;&nbsp;&nbsp;$editsurveyloc&nbsp;&nbsp;&nbsp;";
	$contents .= " $previewloc&nbsp;&nbsp;&nbsp;$deleteloc&nbsp;&nbsp;&nbsp;$activeloc</TD>";
	$contents .= "</TR>";
	$sdtest = (substr($masurvey["StartDate"],0,10) != "0000-00-00") ? true : false;
	$edtest = (substr($masurvey["EndDate"],0,10) != "0000-00-00") ? true : false;
	if ($masurvey["Active"]=="y" && ($sdtest || $edtest)) {
		$contents .= "<TR>";
		$contents .= "<TD></TD>";
		$contents .= "<TD COLSPAN=2><B><NOBR>".$phpQlang['ActiveDates']."</B>:</NOBR>";
		if ($sdtest && !$edtest) {
			$contents .= "".sprintf($phpQlang['StartsOn'], $masurvey["StartDate"])."";
		}
		elseif (!$sdtest && $edtest) {
			$contents .= "".sprintf($phpQlang['EndsOn'], $masurvey["EndDate"])."";
		}
		else {
			$contents .= "".sprintf($phpQlang['RunsBetween'], $masurvey["StartDate"], $masurvey["EndDate"])."";
		}
		$contents .= "</TD></TR>";
	}
    
	if ($masurvey["Active"]=="y") {
		

		if ($masurvey["SurveyResults"]) {
			$statsloc = $scriptloc."/stats.php?sid=".$masurvey["SID"];
	 		$contents .= "<TR>";
	 		$contents .= "<TD COLSPAN=2 ALIGN=right><NOBR><B>".$phpQlang['PublicResults']."</B>:</NOBR></TD>";
	 		$contents .= "<TD><A HREF=\"$statsloc\" TARGET=_new CLASS=link>$statsloc</A></TD>";
	 		$contents .= "</TR>";
		}
	}
    //$contents .= "</table></td></tr>";
	//$contents .= "<TR><TD COLSPAN=3>";
	//$contents .= "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>";
	//$contents .= "<TD BACKGROUND=\"images/border.gif\"><IMG SRC=\"images/invdot.gif\" WIDTH=100 HEIGHT=1 ALT=\"\"></TD>";
	//$contents .= "</TR></TABLE>";
	//$contents .= "</TD></TR>\n";
}

$contents .= <<<END
   </table>
	</td></tr>
	</TABLE>
	

END;

#-->> Output Page

CreatePage("main", $phpQlang['AdminTitle'].' :: '.$phpQlang['OverviewTitle'], $contents, true, "");

?>

⌨️ 快捷键说明

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