function display()
{
    extract($_REQUEST);
    $sql = "SELECT * FROM cubit.documents WHERE id='{$id}'";
    $doc_rslt = db_exec($sql) or errDie("Unable to retrieve documents.");
    $doc_data = pg_fetch_array($doc_rslt);
    extract($doc_data);
    if (!empty($doc_type)) {
        $sql = "SELECT type_name FROM cubit.document_types WHERE id='{$doc_type}'";
        $type_rslt = db_exec($sql) or errDie("Unable to retrieve document type.");
        $type_name = pg_fetch_result($type_rslt, 0);
    } else {
        $type_name = "";
    }
    if (!empty($team_id)) {
        $sql = "SELECT team_name FROM cubit.teams WHERE id='{$team_id}'";
        $team_rslt = db_exec($sql) or errDie("Unable to retrieve team.");
        $team_name = pg_fetch_result($team_rslt, 0);
    } else {
        $team_name = "";
    }
    $OUTPUT = "<table " . TMPL_tblDflts . ">\n\t<tr><td valign='top'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Details</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Title</td>\n\t\t\t<td>{$title}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Project</td>\n\t\t\t<td>{$project}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Area</td>\n\t\t\t<td>{$area}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Discipline</td>\n\t\t\t<td>{$discipline}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Document Type</td>\n\t\t\t<td>{$type_name}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Revision</td>\n\t\t\t<td>{$revision}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Drawing Number</td>\n\t\t\t<td>{$drawing_num}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Sheet Number</td>\n\t\t\t<td>{$sheet_num}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>File Location</td>\n\t\t\t<td>{$location}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Contract</td>\n\t\t\t<td>{$contract}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Contractor</td>\n\t\t\t<td>{$contractor}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Code</td>\n\t\t\t<td>{$code}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Issue For</td>\n\t\t\t<td>{$issue_for}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Comments</td>\n\t\t\t<td>{$comments}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>QS</td>\n\t\t\t<td>{$qs}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Team Permissions</td>\n\t\t\t<td>{$team_name}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Status</td>\n\t\t\t<td>{$status}</td>\n\t\t</tr>\n\t</table>\n\t</td><td valign='top'>";
    $sql = "SELECT * FROM document_files WHERE doc_id='{$id}'";
    $df_rslt = db_exec($sql) or errDie("Unable to retrieve files.");
    $file_out = "";
    while ($df_data = pg_fetch_array($df_rslt)) {
        $file_out .= "<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='getfile.php?key=doc&id={$df_data['id']}'>{$df_data['filename']}</a></td>\n\t\t\t<td>" . getFilesize($df_data["size"]) . "</td>\n\t\t</tr>";
    }
    if (empty($file_out)) {
        $file_out = "<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'>No files found.</td>\n\t\t</tr>";
    }
    $OUTPUT .= "<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Files</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th>File</th>\n\t\t\t<th>Size</th>\n\t\t</tr>\n\t\t{$file_out}\n\t</table>\n\t</td></tr>\n\t</table>";
    return $OUTPUT;
}
function display()
{
    extract($_REQUEST);
    $sql = "SELECT * FROM cubit.documents WHERE docid='{$id}'";
    $doc_rslt = db_exec($sql) or errDie("Unable to retrieve documents.");
    $doc_data = pg_fetch_array($doc_rslt);
    // Check to see if we've actually got access to view this document
    $sql = "SELECT admin FROM cubit.users WHERE userid='" . USER_ID . "'";
    $admin_rslt = db_exec($sql) or errDie("Unable to check for admin.");
    $admin = pg_fetch_result($admin_rslt, 0);
    if ($doc_data["team_id"] && !$admin) {
        $sql = "SELECT * FROM crm.team_owners\n\t\tWHERE user_id='" . USER_ID . "' AND team_id='{$doc_data['team_id']}'";
        $team_rslt = db_exec($sql) or errDie("Unable to retrieve team.");
        // ok, no access...
        if (!pg_num_rows($team_rslt)) {
            return "<li class='err'>\n\t\t\t\tYou don't have sufficient permission to view this document.\n\t\t\t</li>";
        }
    }
    extract($doc_data);
    if (!empty($doc_type)) {
        $sql = "SELECT type_name FROM cubit.document_types WHERE id='{$doc_type}'";
        $type_rslt = db_exec($sql) or errDie("Unable to retrieve document type.");
        $type_name = pg_fetch_result($type_rslt, 0);
    } else {
        $type_name = "[None]";
    }
    if (!empty($team_id)) {
        $sql = "SELECT name FROM crm.teams WHERE id='{$team_id}'";
        $team_rslt = db_exec($sql) or errDie("Unable to retrieve team.");
        $team_name = pg_fetch_result($team_rslt, 0);
    } else {
        $team_name = "[None]";
    }
    $OUTPUT = "<table " . TMPL_tblDflts . ">\n\t<tr><td valign='top'>\n\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t<tr>\n\t\t\t<th colspan='2'>Details</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Title</td>\n\t\t\t<td>{$title}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Document Type</td>\n\t\t\t<td>{$type_name}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Revision</td>\n\t\t\t<td>{$revision}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>File Location</td>\n\t\t\t<td>{$location}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Comments</td>\n\t\t\t<td>{$comments}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Team Permissions</td>\n\t\t\t<td>{$team_name}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Status</td>\n\t\t\t<td>{$status}</td>\n\t\t</tr>\n\t</table>\n\t</td><td valign='top'>";
    $sql = "SELECT * FROM document_files WHERE doc_id='{$id}'";
    $df_rslt = db_exec($sql) or errDie("Unable to retrieve files.");
    $file_out = "";
    while ($df_data = pg_fetch_array($df_rslt)) {
        $file_out .= "<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='getfile.php?key=doc&id={$df_data['id']}'>{$df_data['filename']}</a></td>\n\t\t\t<td>" . getFilesize($df_data["size"]) . "</td>\n\t\t</tr>";
    }
    if (empty($file_out)) {
        $file_out = "<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'>No files found.</td>\n\t\t</tr>";
    }
    $OUTPUT .= "<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t<tr>\n\t\t\t<th colspan='2'>Files</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th>File</th>\n\t\t\t<th>Size</th>\n\t\t</tr>\n\t\t{$file_out}\n\t</table>\n\t</td></tr>\n\t</table>";
    return $OUTPUT;
}
Пример #3
0
               chdir($temp_dir);

               $zip->addFile($filename, basename($filename));
               $zip->close();
               unset($zip);
            } else {
               include_once('functions/error_functions.php');
               trigger_error('can not initiate ZIP class, please contact your system administrator',E_USER_WARNNG);
            }

            $params = array();
            $params['environment'] = $environment;
            $params['with_modifying_actions'] = true;
            $link = $class_factory->getClass(TEXT_VIEW,$params);
            unset($params);
            $link->setText('<a href="../'.$zipfile.'">Download</a> ('.getFilesize($zipfile).')');
            $page->addForm($link);
         }
      }

      // Display form
      else {
         $params = array();
         $params['environment'] = $environment;
         $params['with_modifying_actions'] = true;
         $form_view = $class_factory->getClass(FORM_VIEW,$params);
         unset($params);
         $form_view->setAction(curl($environment->getCurrentContextID(),$environment->getCurrentModule(),$environment->getCurrentFunction(),''));
         $form_view->setForm($form);
         $page->addForm($form_view);
      }
Пример #4
0
function getFilelist()
{
    global $pwd, $imgdir, $THIS_FILE, $p, $lnum, $recnum, $imgpath, $query, $file, $SERVER_SOFTWARE, $HTTP_COOKIE_VARS;
    if (!$pwd || strstr($pwd, "../../.")) {
        $pwd = "../";
    }
    $cellpx = "<TD WIDTH=1 BGCOLOR=EFEFEF NOWRAP><IMG SRC='{$imgdir}/blank.gif' WIDTH=1 HEIGHT=1></TD>";
    $cellpx1 = "<TD WIDTH=1 BGCOLOR=#848284 NOWRAP><IMG SRC='{$imgdir}/blank.gif' WIDTH=1 HEIGHT=1></TD>";
    $cellpx2 = "<TD WIDTH=1 BGCOLOR=WHITE NOWRAP><IMG SRC='{$imgdir}/blank.gif' WIDTH=1 HEIGHT=1></TD>";
    ?>

	<DIV ID='mk_file' STYLE="position:absolute;visibility:hidden;left:-500;top:105;"> 
	<TABLE WIDTH=300 CELLSPACING=1 CELLPADDING=0 BGCOLOR=C0C0C0>
	<FORM NAME='mk_dir_form' ACTION='<?php 
    echo $THIS_FILE;
    ?>
'>
	<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
    echo $pwd;
    ?>
"> 
	<INPUT TYPE=HIDDEN NAME=query VALUE='mk_file'>
	<TR>
	<TD WIDTH=100% HEIGHT=40 BGCOLOR=#D1D3F5>
	<TABLE CELLPADDING=5>
	<TR>
	<TD>
	<INPUT TYPE=TEXT NAME=file_name VALUE='새파일.php' style="border:1 solid c0c0c0;">
	<INPUT TYPE=IMAGE SRC='<?php 
    echo $imgdir;
    ?>
/mk_file.gif' BORDER=0 align=absmiddle>
	<A HREF='#' onclick="mklayer_view()"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>
	</TD>
	</TR>
	</TABLE>
	</TD>
	</TR>
	</FORM>
	</TABLE>
	</DIV>

	<DIV ID='mk_dir' STYLE="position:absolute;visibility:hidden;left:-500;top:105;"> 
	<TABLE WIDTH=280 CELLSPACING=1 CELLPADDING=0 BGCOLOR=C0C0C0>
	<FORM NAME='mk_dir_form' ACTION='<?php 
    echo $THIS_FILE;
    ?>
'>
	<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
    echo $pwd;
    ?>
"> 
	<INPUT TYPE=HIDDEN NAME=query VALUE='mk_dir'>
	<TR>
	<TD WIDTH=100% HEIGHT=40 BGCOLOR=#D1D3F5>
	<TABLE CELLPADDING=5>
	<TR>
	<TD>
	<INPUT TYPE=TEXT NAME=dir_name VALUE='새폴더' style="border:1 solid c0c0c0;">
	<INPUT TYPE=IMAGE SRC='<?php 
    echo $imgdir;
    ?>
/mk_dir1.gif' BORDER=0 align=absmiddle>
	<A HREF='#' onclick="mklayer_view()"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>
	</TD>
	</TR>
	</TABLE>
	</TD>
	</TR>
	</FORM>
	</TABLE>
	</DIV>

	<DIV ID='mk_up' STYLE="position:absolute;visibility:hidden;left:-500;top:105;"> 

	<script>
	function AddFile() {
		var objTbody, objRow, objCell,e_num,c_num;
		var minCount = 19; 
		if(AddFileForm.rows.length > minCount) { 
			alert("\n최대 20개까지 업로드할 수 있습니다.             \n"); 
			return false; 
		}
		e_num = AddFileForm.rows.length+1;
		if(e_num < 10) e_num = "0"+e_num;
		c_num = AddFileForm.rows.length+2;
		objTbody = document.getElementById("AddFileForm");
		objRow = objTbody.insertRow(objTbody.rows.length);
		objCell = objRow.insertCell(0);
		objCell.innerHTML+="<TABLE cellspacing=1 cellpadding=0><TR><TD>&nbsp;"+e_num+". <INPUT type='file' size=34 name='upfile[]' style='border:1 solid c0c0c0;'> </TD></TR></TABLE>";
	}
	function dellForm() { 
	   var minCount = 0; 
	   if(AddFileForm.rows.length == minCount+1) { 
		 alert("더이상 제거할 수 없습니다.       "); 
		 return false; 
	   } else { 
		 AddFileForm.deleteRow(); 
	   } 
	} 
	</script>

	<TABLE WIDTH=385 CELLSPACING=1 CELLPADDING=0 BGCOLOR=C0C0C0>
	<FORM NAME='mk_up_form' ACTION='<?php 
    echo $THIS_FILE;
    ?>
' method='post' enctype='multipart/form-data'>
	<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
    echo $pwd;
    ?>
"> 
	<INPUT TYPE=HIDDEN NAME=query VALUE='mk_up'>
	<TR>
	<TD WIDTH=100% HEIGHT=40 BGCOLOR=#D1D3F5>

	<TABLE CELLPADDING=1 cellspacing=0>
	<TR>
	<TD ALIGN=CENTER WIDTH=380 HEIGHT=40>
	&nbsp;&nbsp;&nbsp;
	<INPUT TYPE=IMAGE SRC='<?php 
    echo $imgdir;
    ?>
/mk_up.gif' BORDER=0 align=absmiddle>
	<A HREF='#' onclick="mklayer_view()"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>
	<A HREF='#' onclick="AddFile()"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_add.gif' BORDER=0 align=absmiddle></A>
	<A HREF='#' onclick='dellForm(); return false;'><IMG SRC='<?php 
    echo $imgdir;
    ?>
/del.gif' BORDER=0 align=absmiddle></A>
	* 최대20까지 업로드가능
	</TD>
	</TR>
	</TABLE>

	<TABLE CELLPADDING=1 cellspacing=0>
	<TR>
	<TD>
	&nbsp;01. <INPUT TYPE=FILE size=34 NAME='upfile[]' style="border:1 solid c0c0c0;">
	</TD>
	</TR>
	</TABLE>

	<TABLE cellspacing=0 cellpadding=1 id="AddFileForm">
	<TR>
	<TD></TD>
	</TR>
	</TABLE>
	<TABLE>
	<TR>
	<TD HEIGHT=10> </TD>
	</TR>
	</TABLE>
	</TD>
	</TR>
	</FORM>
	</TABLE>
	</DIV>

	<DIV ID='mk_perm' STYLE="position:absolute;visibility:hidden;left:-500;top:105;"> 
	<TABLE WIDTH=280 CELLSPACING=1 CELLPADDING=0 BGCOLOR=C0C0C0>
	<FORM NAME='mk_perm_form' ACTION='<?php 
    echo $THIS_FILE;
    ?>
'>
	<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
    echo $pwd;
    ?>
"> 
	<INPUT TYPE=HIDDEN NAME=query VALUE='mk_perm'>
	<TR>
	<TD WIDTH=100% HEIGHT=40 BGCOLOR=#D1D3F5>
	<TABLE CELLPADDING=5>
	<TR>
	<TD>
	chmod
	<INPUT TYPE=TEXT NAME=perm SIZE=5 VALUE='707' style="border:1 solid c0c0c0;text-align:center;">
	-R *
	<INPUT TYPE=IMAGE SRC='<?php 
    echo $imgdir;
    ?>
/mk_perm.gif' BORDER=0 align=absmiddle>
	<A HREF='#' onclick="mklayer_view()"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>

	</TD>
	</TR>
	</TABLE>
	</TD>
	</TR>
	</FORM>
	</TABLE>
	</DIV>

	<DIV ID='mk_user' STYLE="position:absolute;visibility:hidden;left:-500;top:105;"> 
	<TABLE WIDTH=320 CELLSPACING=1 CELLPADDING=0 BGCOLOR=C0C0C0>
	<FORM NAME='mk_user_form' ACTION='<?php 
    echo $THIS_FILE;
    ?>
'>
	<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
    echo $pwd;
    ?>
"> 
	<INPUT TYPE=HIDDEN NAME=query VALUE='mk_user'>
	<TR>
	<TD WIDTH=100% HEIGHT=40 BGCOLOR=#D1D3F5>
	<TABLE CELLPADDING=5>
	<TR>
	<TD>
	chown
	<INPUT TYPE=TEXT NAME=user SIZE=15 VALUE='<?php 
    echo getFileuser($pwd, 4);
    ?>
:<?php 
    echo getFileuser($pwd, 5);
    ?>
' style="border:1 solid c0c0c0;text-align:center;">
	-R *
	<INPUT TYPE=IMAGE SRC='<?php 
    echo $imgdir;
    ?>
/mk_user.gif' BORDER=0 align=absmiddle>
	<A HREF='#' onclick="mklayer_view()"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>

	</TD>
	</TR>
	</TABLE>
	</TD>
	</TR>
	</FORM>
	</TABLE>
	</DIV>


	<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0 BORDER=0>
	<TR HEIGHT=21 style='background:menu;text-align:center;'>
	<?php 
    echo $cellpx;
    echo $cellpx2;
    ?>
	<TD NOWRAP WIDTH=300 ALIGN=LEFT BACKGROUND='<?php 
    echo $imgdir;
    ?>
/tt_bg.gif'>&nbsp;Filename</TD>
	<?php 
    echo $cellpx1;
    echo $cellpx2;
    ?>
	<TD NOWRAP WIDTH=80 BACKGROUND='<?php 
    echo $imgdir;
    ?>
/tt_bg.gif'>Size</TD>
	<?php 
    echo $cellpx1;
    echo $cellpx2;
    ?>
	<TD NOWRAP WIDTH=80 BACKGROUND='<?php 
    echo $imgdir;
    ?>
/tt_bg.gif'>User</TD>
	<?php 
    echo $cellpx1;
    echo $cellpx2;
    ?>
	<TD NOWRAP WIDTH=80 BACKGROUND='<?php 
    echo $imgdir;
    ?>
/tt_bg.gif'>Group</TD>
	<?php 
    echo $cellpx1;
    echo $cellpx2;
    ?>
	<TD NOWRAP WIDTH=80 BACKGROUND='<?php 
    echo $imgdir;
    ?>
/tt_bg.gif'>Attrib</TD>
	<?php 
    echo $cellpx1;
    echo $cellpx2;
    ?>
	<TD NOWRAP WIDTH=130 BACKGROUND='<?php 
    echo $imgdir;
    ?>
/tt_bg.gif'>Date</TD>
	<?php 
    echo $cellpx2;
    echo $cellpx;
    ?>
	</TR>
	<TR>
	<TD COLSPAN=20 HEIGHT=1 BGCOLOR=WHITE> </TD>
	</TR>
	<TR>
	<?php 
    echo $cellpx;
    echo $cellpx;
    ?>
	<TD COLSPAN=16>
	
	<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0 BORDER=0>
	<TR HEIGHT=25 BGCOLOR='#D2F5D1'>
	<TD WIDTH=295 NOWRAP><IMG SRC='<?php 
    echo $imgdir;
    ?>
/blank.gif' WIDTH=9 HEIGHT=1>
<?php 
    if (substr($pwd, 0, 6) == '../../') {
        $gpwd = ".." . str_replace("../..", "", $pwd);
        echo "<A HREF='{$THIS_FILE}?pwd=" . getPrevdir($pwd) . "'>";
        echo "<IMG SRC='{$imgdir}/next_dir.gif' BORDER=0 align=absmiddle><IMG SRC='{$imgdir}/blank.gif' WIDTH=6 HIEGHT=1 border=0></A>";
        echo "<INPUT readonly TYPE=TEXT SIZE=35 VALUE='" . $gpwd . "' style='border:0;background:#D2F5D1;height:15;'>";
    } else {
        if (substr($pwd, 0, 3) == '../' && $pwd == '../') {
            $gpwd = "./" . getPredirname() . str_replace("..", "", $pwd);
            echo "<A HREF='{$THIS_FILE}?pwd=../../'>";
            echo "<IMG SRC='{$imgdir}/pre_dir.gif' BORDER=0><IMG SRC='{$imgdir}/blank.gif' WIDTH=6 HIEGHT=1 border=0></A>";
            echo "<INPUT readonly TYPE=TEXT SIZE=35 VALUE='" . $gpwd . "' style='border:0;background:#D2F5D1;height:15;'>";
        } else {
            $gpwd = "./" . getPredirname() . str_replace("..", "", $pwd);
            echo "<A HREF='{$THIS_FILE}?pwd=" . getPrevdir($pwd) . "'>";
            echo "<IMG SRC='{$imgdir}/pre_dir.gif' BORDER=0><IMG SRC='{$imgdir}/blank.gif' WIDTH=6 HIEGHT=1 border=0></A>";
            echo "<INPUT readonly TYPE=TEXT SIZE=35 VALUE='" . $gpwd . "' style='border:0;background:#D2F5D1;height:15;'>";
        }
    }
    ?>
	</TD>
	<TD ALIGN=RIGHT NOWRAP>
	<A style='cursor:pointer;' onclick="mklayer_view('mk_file')"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_file.gif' BORDER=0 align=absmiddle></A>
	<A style='cursor:pointer;' onclick="mklayer_view('mk_dir')"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_dir.gif' BORDER=0 align=absmiddle></A>
	<A style='cursor:pointer;' onclick="mklayer_view('mk_up')"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_up.gif' BORDER=0 align=absmiddle></A>
	
	<?php 
    if (strstr($SERVER_SOFTWARE, "Win")) {
        ?>

	<A style='cursor:pointer;' onclick="alert('\n윈도우에서는 디렉토리를 다운로드 받을 수 없습니다.      \n');"><IMG SRC='<?php 
        echo $imgdir;
        ?>
/mk_down.gif' BORDER=0 align=absmiddle></A>	
	<A style='cursor:pointer;' onclick="alert('\n윈도우에서는 사용하실 수 없습니다.            \n')"><IMG SRC='<?php 
        echo $imgdir;
        ?>
/mk_perm.gif' BORDER=0 align=absmiddle></A>
	<A style='cursor:pointer;' onclick="alert('\n윈도우에서는 사용하실 수 없습니다.            \n')"><IMG SRC='<?php 
        echo $imgdir;
        ?>
/mk_user.gif' BORDER=0 align=absmiddle></A>

	<?php 
    } else {
        ?>
	
	<A HREF='<?php 
        echo $THIS_FILE;
        ?>
?pwd=<?php 
        echo $pwd;
        ?>
&query=down&type=dir' TARGET='ftp_iframe'><IMG SRC='<?php 
        echo $imgdir;
        ?>
/mk_down.gif' BORDER=0 align=absmiddle></A>
	<A style='cursor:pointer;' onclick="mklayer_view('mk_perm')"><IMG SRC='<?php 
        echo $imgdir;
        ?>
/mk_perm.gif' BORDER=0 align=absmiddle></A>
	<A style='cursor:pointer;' onclick="mklayer_view('mk_user')"><IMG SRC='<?php 
        echo $imgdir;
        ?>
/mk_user.gif' BORDER=0 align=absmiddle></A>	
	
	<?php 
    }
    ?>
	
	<A style='cursor:pointer;' onclick="confirm_check('[<?php 
    echo $gpwd;
    ?>
]디렉토리내의 모든데이터가 삭제되며          \n\n삭제된 데이터는 복구가 불가능합니다.\n\n정말로 삭제하시겠습니까?','<?php 
    echo $THIS_FILE;
    ?>
?pwd=<?php 
    echo $pwd;
    ?>
&query=delete&type=dir&p=<?php 
    echo $p;
    ?>
','','');"><IMG SRC='<?php 
    echo $imgdir;
    ?>
/mk_del.gif' BORDER=0 align=absmiddle></A>
	&nbsp;
	</TD>
	</TR>
	<TR>
	<TD WIDTH=100% COLSPAN=2 HEIGHT=2 BGCOLOR=C0C0C0> </TD>
	</TR>
	<TR>
	<TD WIDTH=100% COLSPAN=2 HEIGHT=1 BGCOLOR=WHITE> </TD>
	</TR>
	</TABLE>	
	

	</TD>
	<?php 
    echo $cellpx;
    echo $cellpx;
    ?>
	</TR>
<?php 
    $dir_handle = opendir($pwd);
    while (false !== ($element = readdir($dir_handle))) {
        if (is_dir($pwd . $element)) {
            if ($element != '.' && $element != '..') {
                $element_file[] = $element . "|dir";
            }
        }
    }
    closedir($dir_handle);
    $dir_handle = opendir($pwd);
    while (false !== ($element = readdir($dir_handle))) {
        if (is_file($pwd . $element)) {
            $element_file[] = $element . "|file";
        }
    }
    closedir($dir_handle);
    $element_num = sizeof($element_file);
    $tpage = intval($element_num / $recnum) + 1;
    for ($i = ($p - 1) * $recnum; $i <= ($p - 1) * $recnum + $recnum - 1; $i++) {
        if ($element_file[$i]) {
            $element = explode('|', $element_file[$i]);
            ?>
		
		
		<TR HEIGHT=21 ALIGN=CENTER>
		<?php 
            echo $cellpx;
            echo $cellpx;
            ?>
		
<?php 
            if ($element[1] == 'file') {
                ?>
		<?php 
                if ($query == 'rename_f' && $file == $element[0]) {
                    ?>

		<FORM NAME=name_change ACTION='<?php 
                    echo $THIS_FILE;
                    ?>
'>
		<TD ALIGN=LEFT><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/blank.gif' WIDTH=9 HEIGHT=1 BORDER=0 ALIGN=ABSMIDDLE>
		<A HREF='<?php 
                    echo $pwd . $element[0];
                    ?>
' TARGET=_blank><IMG SRC='<?php 
                    echo getFileicon($element[0]);
                    ?>
' BORDER=0 alt='보기'></A>
		<INPUT TYPE=TEXT NAME=file_name SIZE=17 VALUE="<?php 
                    echo $element[0];
                    ?>
" style="border:1 solid dfdfdf;">
		<INPUT TYPE=IMAGE SRC="<?php 
                    echo $imgdir;
                    ?>
/name_modify.gif" BORDER=0 align=absmiddle onload="document.name_change.file_name.focus();">
		<A HREF='<?php 
                    echo $THIS_FILE;
                    ?>
?pwd=<?php 
                    echo $pwd;
                    ?>
'><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>
		<INPUT TYPE=HIDDEN NAME=query VALUE='rename'>
		<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
                    echo $pwd;
                    ?>
">
		<INPUT TYPE=HIDDEN NAME=file VALUE="<?php 
                    echo $element[0];
                    ?>
">
		<INPUT TYPE=HIDDEN NAME=type VALUE="file">
		<A NAME='<?php 
                    echo $element[0];
                    ?>
'></A>
		<?php 
                    getMenuprint("ftpmenu_layer_{$i}", $pwd, $element[0], "file");
                    ?>
</TD>
		</FORM>

		<?php 
                } else {
                    ?>

		<TD ALIGN=LEFT><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/blank.gif' WIDTH=9 HEIGHT=1 BORDER=0 ALIGN=ABSMIDDLE>
		<A HREF='<?php 
                    echo $pwd . $element[0];
                    ?>
' TARGET=_blank><IMG SRC='<?php 
                    echo getFileicon($element[0]);
                    ?>
' BORDER=0 alt='보기'></A> 
		<A HREF="#" onclick="kmenu_show('ftpmenu_layer_<?php 
                    echo $i;
                    ?>
',event);"><?php 
                    echo $element[0];
                    ?>
</A>
		<?php 
                    getMenuprint("ftpmenu_layer_{$i}", $pwd, $element[0], "file");
                    ?>
</TD>
		
		<?php 
                }
                ?>
	
		
		<?php 
                echo $cellpx;
                echo $cellpx;
                ?>
		<TD ALIGN=RIGHT><?php 
                echo getSizeFormat(getFilesize($pwd . $element[0]), 1);
                ?>
&nbsp;</TD>

<?php 
            } else {
                ?>
		<?php 
                if ($query == 'rename_f' && $file == $element[0]) {
                    ?>
		
		<FORM NAME=name_change ACTION='<?php 
                    echo $THIS_FILE;
                    ?>
'>
		<TD ALIGN=LEFT><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/blank.gif' WIDTH=9 HEIGHT=1>
		<A HREF='<?php 
                    echo $THIS_FILE;
                    ?>
?pwd=<?php 
                    echo $pwd . $element[0] . "/";
                    ?>
'><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/close_dir.gif' BORDER=0 alt='열기'></A> 
		<INPUT TYPE=TEXT NAME=file_name SIZE=17 VALUE="<?php 
                    echo $element[0];
                    ?>
" style="border:1 solid dfdfdf;">
		<INPUT TYPE=IMAGE SRC="<?php 
                    echo $imgdir;
                    ?>
/name_modify.gif" BORDER=0 align=absmiddle onload="document.name_change.file_name.focus();">
		<A HREF='<?php 
                    echo $THIS_FILE;
                    ?>
?pwd=<?php 
                    echo $pwd;
                    ?>
'><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/mk_close.gif' BORDER=0 align=absmiddle></A>
		<INPUT TYPE=HIDDEN NAME=query VALUE='rename'>
		<INPUT TYPE=HIDDEN NAME=pwd VALUE="<?php 
                    echo $pwd;
                    ?>
">
		<INPUT TYPE=HIDDEN NAME=file VALUE="<?php 
                    echo $element[0];
                    ?>
">
		<INPUT TYPE=HIDDEN NAME=type VALUE="file">
		<A NAME='<?php 
                    echo $element[0];
                    ?>
'></A>
		<?php 
                    getMenuprint("ftpmenu_layer_{$i}", $pwd, $element[0], "dir");
                    ?>
</TD>
		</FORM>

		<?php 
                } else {
                    ?>

		<TD ALIGN=LEFT><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/blank.gif' WIDTH=9 HEIGHT=1>
		<A HREF='<?php 
                    echo $THIS_FILE;
                    ?>
?pwd=<?php 
                    echo $pwd . $element[0] . "/";
                    ?>
'><IMG SRC='<?php 
                    echo $imgdir;
                    ?>
/close_dir.gif' BORDER=0 alt='열기'></A> <A  HREF="#" onclick="kmenu_show('ftpmenu_layer_<?php 
                    echo $i;
                    ?>
',event);"><?php 
                    echo $element[0];
                    ?>
</a>
		<?php 
                    getMenuprint("ftpmenu_layer_{$i}", $pwd, $element[0], "dir");
                    ?>
</TD>
	
		<?php 
                }
                ?>

		<?php 
                echo $cellpx;
                echo $cellpx;
                ?>
		<TD ALIGN=RIGHT> </TD>

<?php 
            }
            ?>

		<?php 
            echo $cellpx;
            echo $cellpx;
            ?>
		<TD><?php 
            echo getFileuser($pwd . $element[0], 4);
            ?>
</TD>
		<?php 
            echo $cellpx;
            echo $cellpx;
            ?>
		<TD><?php 
            echo getFileuser($pwd . $element[0], 5);
            ?>
</TD>
		<?php 
            echo $cellpx;
            echo $cellpx;
            ?>
		<TD><?php 
            echo getPerm($pwd . $element[0]);
            ?>
</TD>
		<?php 
            echo $cellpx;
            echo $cellpx;
            ?>
	
		<TD><?php 
            echo getFiledate($pwd . $element[0]);
            ?>
</TD>
		<?php 
            echo $cellpx;
            echo $cellpx;
            ?>
		
		</TR>

<?php 
        }
    }
    echo "</TABLE>";
    if ($tpage > 1) {
        echo "<CENTER><P><B>" . getPageLinkftp($lnum, $p, $tpage, "../bbs/lib/module/page/image") . "</B></CENTER>";
    }
}
Пример #5
0
/**
 * Affiche la liste des fichiers sur index.php
 * @param $treestructure L'array contenant la hiérarchie de fichiers
 * @param $filter Le filtre à utiliser (all ou video)
 * @param $editmode Prendre en compte l'editmode dans l'affichage
 * @param $father Un paramètre récursif qui permet de connaître le(s) parent(s) d'un dossier
 */
function print_tree_structure($treestructure, $editmode = FALSE, $father = "")
{
    global $lang;
    if (empty($treestructure)) {
        echo '<div style="margin-bottom:5px;" class="onefile" id="div-' . htmlspecialchars($file) . '">';
        echo $lang[LOCAL_LANG]['empty_dir'];
        echo '</div>';
        return;
    }
    foreach ($treestructure as $key => $file) {
        // Si on est sur un dossier
        if (is_array($file)) {
            $fullkey = $key;
            $key = addslashes(basename($key));
            echo '<div class="onedir">';
            if ($editmode) {
                echo '<input name="Files[]" id="Files" type="checkbox" value="' . $father . htmlspecialchars($key) . '" onclick="CheckLikes(this);" />';
            }
            echo '
      	  <img src="ressources/' . showLastAddFolder($fullkey) . '" class="pointerLink imgfolder" onclick="showhidedir(\'' . $key . '\'); return false;" />
          <span class="pointerLink" onclick="showhidedir(\'' . $key . '\'); return false;">' . stripslashes($key) . '</span></div>
          <div id="' . stripslashes($key) . '" class="dirInList" style="display:none;">
          ';
            print_tree_structure($file, $editmode, $father . htmlspecialchars($key) . "/");
            echo '</div>';
        } else {
            $pathInfo = pathinfo($file);
            echo '<div style="margin-bottom:5px;" class="onefile" id="div-' . htmlspecialchars($file) . '">';
            // La checkbox de l'editmode
            if ($editmode) {
                echo '<input name="Files[]" id="Files" type="checkbox" value="' . htmlspecialchars($file) . '"/>';
            }
            // Affichage des images à gauche du titre (Direct Download + Watch)
            echo '<a href="' . DOWNLOAD_LINK . $file . '" download="' . $pathInfo['basename'] . '">';
            echo '<img src="ressources/download.png" title="Download this file" /> &nbsp;';
            echo '</a>';
            echo '<a href="watch.php?file=' . urlencode($file) . '">';
            echo '<img src="' . get_file_icon($file) . '" title="Stream or download this file" /> &nbsp;';
            echo '</a>';
            showLastAdd($file);
            if (SEEN_MODE_ENABLE && file_exists("data/" . $pathInfo['basename'])) {
                // Affichage du titre (soulignement si marqué comme vu)
                echo SEEN_SPAN;
                echo basename(htmlspecialchars($file));
                echo '</span>';
            } else {
                echo basename(htmlspecialchars($file));
            }
            // Création de l'infobulle
            echo '<a href="#" class="tooltip">&nbsp;(?)
      		<span>
              ' . $lang[LOCAL_LANG]['size'] . ' : ' . getFilesize($file) . '<br/>
              ' . $lang[LOCAL_LANG]['last_update'] . ' : ' . date("d F Y, H:i", filemtime($file)) . '<br/>
              ' . $lang[LOCAL_LANG]['last_access'] . ' : ' . date("d F Y, H:i", fileatime($file)) . '<br/>
            </span>
            </a>';
            echo '</div>';
        }
    }
}
Пример #6
0
function getFileSpecifications($directories, $filelist, $filetypes)
{
    global $localdirectory, $localpackdirectory;
    foreach ($directories as $dir) {
        foreach ($filelist as $file) {
            foreach ($filetypes as $filetype) {
                $name = $file['file'] . $dir . '.' . $filetype;
                $plain = $localdirectory . $dir . '/' . $name;
                $pack = $localpackdirectory . $dir . '/' . $name . '.bz2';
                if (is_file($plain) && is_file($pack)) {
                    //error_log('getting specs for ' . $name . ' and ' . $name . '.bz2');
                    $resultarray[$name] = array('lines' => getFileLines($plain), 'filesize' => getFilesize($plain), 'bzip2' => getFilesize($pack));
                } else {
                    //error_log('WARNING: cannot get specs for ' . $plain . ' and ' . $pack);
                }
            }
        }
    }
    return $resultarray;
}