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

📄 index.php

📁 groupoffice
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/*   Copyright Intermesh 2003   Author: Merijn Schering <mschering@intermesh.nl>   Version: 1.0 Release date: 08 July 2003   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. */$popup_feedback = '';$mode = isset ($mode) ? $mode : 'normal';function access_denied_box($file) {	global $strAccessDenied;	$string = "<script type=\"text/javascript\" language=\"javascript\">\n";	$string .= "alert('".$strAccessDenied.": ".basename($file)."');\n";	$string .= "</script>\n";	return $string;}function feedback($text) {	$string = "<script type=\"text/javascript\" language=\"javascript\">\n";	$string .= 'alert("'.$text.'");';	$string .= "</script>\n";	return $string;}//set umask to 000 and remember the old umaks to reset it below//umask must be 000 to create 777 files and folders$old_umask = umask(000);//basic group-office authenticationif (!defined('GO_LOADED')) {	require_once ("../../Group-Office.php");}$GO_SECURITY->authenticate();$GO_MODULES->authenticate('filesystem');require_once ($GO_LANGUAGE->get_language_file('filesystem'));$email_module = $GO_MODULES->get_module('email');if (!$email_module || (!$GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_read']) && !$GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_write']))) {	$email_module = false;}$GO_HANDLER = isset ($GO_HANDLER) ? $GO_HANDLER : 'download.php';$GO_MULTI_SELECT = isset ($GO_MULTI_SELECT) ? $GO_MULTI_SELECT : true;$target_frame = isset ($target_frame) ? $target_frame : '_self';//set path to browse$home_path = $GO_CONFIG->file_storage_path.'users/'.$_SESSION['GO_SESSION']['username'];if (!isset ($_SESSION['GO_FILESYSTEM_PATH'])) {	if (file_exists($home_path) || mkdir_recursive($home_path, $GO_CONFIG->create_mode)) {		$_SESSION['GO_FILESYSTEM_PATH'] = $home_path;	} else {		die('Failed creating home directory. Check server configuration. See if "'.$GO_CONFIG->file_storage_path.'" exists and is writable for the webserver.');	}}require($GO_MODULES->modules['filesystem']['class_path'].'filesystem_view.class.inc');$fv = new filesystem_view('fs_list',  $_SESSION['GO_FILESYSTEM_PATH'], $GO_HANDLER, true);if(isset($_REQUEST['path'])){	$fv->set_path(smart_stripslashes($_REQUEST['path']));}$urlencoded_path = urlencode($fv->path);$return_to_path = isset ($_REQUEST['return_to_path']) ? smart_stripslashes($_REQUEST['return_to_path']) : $fv->path;//create filesystem  objectrequire_once ($GO_CONFIG->class_path.'filesystem.class.inc');$fs = new filesystem();//define task to peform$task = isset ($_REQUEST['task']) ? $_REQUEST['task'] : '';$_SESSION['cut_files'] = isset ($_SESSION['cut_files']) ? $_SESSION['cut_files'] : array ();$_SESSION['copy_files'] = isset ($_SESSION['copy_files']) ? $_SESSION['copy_files'] : array ();//vars used to remember files that are to be overwritten or not$overwrite_destination_path = isset ($_POST['overwrite_destination_path']) ? smart_stripslashes($_POST['overwrite_destination_path']) : '';$overwrite_source_path = isset ($_POST['overwrite_source_path']) ? smart_stripslashes($_POST['overwrite_source_path']) : '';$overwrite_all = (isset ($_POST['overwrite_all']) && $_POST['overwrite_all'] == 'true') ? 'true' : 'false';$overwrite = isset ($_POST['overwrite']) ? $_POST['overwrite'] : $overwrite_all;//check read permissions and remember last browsed path$read_permission = $fs->has_read_permission($GO_SECURITY->user_id, $fv->path);$write_permission = $fs->has_write_permission($GO_SECURITY->user_id, $fv->path);if (!$read_permission && !$write_permission) {	$_SESSION['GO_FILESYSTEM_PATH'] = $home_path; 	$task = 'access_denied';} else {	$_SESSION['GO_FILESYSTEM_PATH'] = $fv->path;}//cut paste or copy before output has startedswitch ($task) {	case 'cut' :		$_SESSION['cut_files'] = isset ($fv->fsl->selected) ? $fv->fsl->selected : array ();		$_SESSION['copy_files'] = array ();		break;	case 'copy' :		$_SESSION['copy_files'] = isset ($fv->fsl->selected) ? $fv->fsl->selected : array ();		$_SESSION['cut_files'] = array ();		break;	case 'paste' :		while ($file = smart_stripslashes(array_shift($_SESSION['cut_files']))) {			if ($file != $fv->path.'/'.basename($file)) {				if (!$fs->has_write_permission($GO_SECURITY->user_id, $file)) {					$popup_feedback .= access_denied_box($file);					break;				}				elseif (!$fs->has_write_permission($GO_SECURITY->user_id, $fv->path)) {					$popup_feedback .= access_denied_box($fv->path);					break;				}				elseif (file_exists($fv->path.'/'.basename($file))) {					if ($overwrite_destination_path == $fv->path.'/'.basename($file) || $overwrite_all == 'true') {						if ($overwrite == "true") {														$fs->move($file, $fv->path.'/'.basename($file));						}					} else {						array_unshift($_SESSION['cut_files'], $file);						$overwrite_source_path = $file;						$overwrite_destination_path = $fv->path.'/'.basename($file);						$task = 'overwrite';						break;					}				} else {									if(!$fs->move($file, $fv->path.'/'.basename($file)))					{						$feedback = $fs_inssufficient_diskspace;					}									}			}		}		while ($file = smart_stripslashes(array_shift($_SESSION['copy_files']))) {			if ($file != $fv->path.'/'.basename($file)) {				if (!$fs->has_read_permission($GO_SECURITY->user_id, $file)) {					$popup_feedback .= access_denied_box($file);					break;				}				elseif (!$fs->has_write_permission($GO_SECURITY->user_id, $fv->path)) {					$popup_feedback .= access_denied_box($fv->path);					break;				}				elseif (file_exists($fv->path.'/'.basename($file))) {					if ($overwrite_destination_path == $fv->path.'/'.basename($file) || $overwrite_all == 'true') {						if ($overwrite == "true") {							if(!$fs->copy($file, $fv->path.'/'.basename($file)))							{								$feedback = $fs_inssufficient_diskspace;							}						}					} else {						array_unshift($_SESSION['copy_files'], $file);						$overwrite_source_path = $file;						$overwrite_destination_path = $fv->path.'/'.basename($file);						$task = 'overwrite';						break;					}				} else {					if(!$fs->copy($file, $fv->path.'/'.basename($file)))					{						$feedback = $fs_inssufficient_diskspace;					}				}			}		}				if(!isset($feedback)  && isset($_REQUEST['return_to']) && $task != 'overwrite')		{			header('Location: '.$_REQUEST['return_to']);		}	break;		case 'post_upload' :		if ($_SERVER['REQUEST_METHOD'] == 'POST') {			$task = 'list';			if (isset ($_FILES['file'])) {				$_SESSION['cut_files'] = array ();				$_SESSION['copy_files'] = array ();								//get share users for email notify				$share= $fs->find_share($fv->path);				$users = $GO_SECURITY->get_authorized_users_in_acl($share['acl_read']);																$write_users = $GO_SECURITY->get_authorized_users_in_acl($share['acl_write']);				while($user_id = array_shift($write_users))				{					if(!in_array($user_id, $users))					{						$users[]=$user_id;					}				}												for ($i = 0; $i < count($_FILES['file']['tmp_name']); $i ++) {					if (is_uploaded_file($_FILES['file']['tmp_name'][$i])) {						$destination =$GO_CONFIG->tmpdir.$_FILES['file']['name'][$i];						if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $destination)) {							$_SESSION['cut_files'][] = $destination;								if($share)								{																					foreach($users as $user_id)									{										if($user_id != $GO_SECURITY->user_id)										{											$user = $GO_USERS->get_user($user_id);											$subject = sprintf($fs_new_file_uploaded, $_FILES['file']['name'][$i]);																						$link = new hyperlink($GO_CONFIG->full_url.'index.php?return_to='.urlencode($GO_MODULES->url.'index.php?path='.urlencode($fv->path)),$fs_open_containing_folder);											$link->set_attribute('target','_blank');											$link->set_attribute('class','blue');																						$body = sprintf($fs_file_put_in, $_FILES['file']['name'][$i], str_replace($GO_CONFIG->file_storage_path.'users','', $fv->path)).'<br>'.$link->get_html();																						sendmail($user['email'], $_SESSION['GO_SESSION']['email'], $_SESSION['GO_SESSION']['name'], $subject, $body, '3', 'text/HTML');										}									}								}						}					}				}				$link = $GO_LINKS->get_active_link();								while ($file = smart_stripslashes(array_shift($_SESSION['cut_files']))) {					$new_path = $fv->path.'/'.basename($file);					if (!$fs->has_write_permission($GO_SECURITY->user_id, $fv->path)) {						$popup_feedback .= access_denied_box($fv->path);						break;					}					elseif (file_exists($new_path)) {						if ($overwrite_destination_path == $new_path && $overwrite_all != 'true') {							if ($overwrite == "true") {								if(!$file_uploaded = $fs->move(addslashes($file), $new_path))								{									$task = 'upload';									$feedback = $fs_inssufficient_diskspace;								}else								{									if($link)									{										$file_link_id = $fs->get_link_id($new_path);														$GO_LINKS->add_link($link['id'], $link['type'], $file_link_id, 6);																				}								}							}						}else{							array_unshift($_SESSION['cut_files'], $file);							$overwrite_source_path = $file;							$overwrite_destination_path = $new_path;							$task = 'overwrite';							break;						}					} else {						if(!$file_uploaded = $fs->move(addslashes($file), $fv->path.'/'.basename($file)))						{							$task = 'upload';							$feedback = $fs_inssufficient_diskspace;						}else						{							if($link)							{								$file_link_id = $fs->get_link_id($new_path);												$GO_LINKS->add_link($link['id'], $link['type'], $file_link_id, 6);																	}						}					}								}					if(!isset($feedback)  && isset($_REQUEST['return_to']) && $task != 'overwrite')				{					if($link)					{						$GO_LINKS->deactivate_linking();						header('Location: '.$link['return_to']);					}else					{						header('Location: '.$_REQUEST['return_to']);					}					exit();				}										} else {				$task = 'upload';				$feedback = $fbNoFile.' '.format_size($GO_CONFIG->max_file_size);

⌨️ 快捷键说明

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