2014-04-24 Alejandro Gallardo <alejandro.gallardo@artica.es>

* install.php: Now the user path backslashes are replaced
	with slashes.

	* extensions/files_repo.php,
	  extensions/files_repo/files_repo_form.php,
	  extensions/files_repo/files_repo_get_file.php,
	  extensions/files_repo/files_repo_list.php,
	  extensions/files_repo/functions_files_repo.php: Replaced
	the 'DIRECTORY_SEPARATOR' var with slashes. Removed the
	realpath functions.

	* include/config.inc.php: Replaced the "owndir" final slash
	with a 'DIRECTORY_SEPARATOR'.

	* include/functions_html.php: Replaced the "$working_dir"
	backslashes with slashes.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9809 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
alexhigh 2014-04-24 10:45:33 +00:00
parent 65d8dfba38
commit a5aa4031ed
9 changed files with 52 additions and 32 deletions

View File

@ -1,3 +1,22 @@
2014-04-24 Alejandro Gallardo <alejandro.gallardo@artica.es>
* install.php: Now the user path backslashes will be
replaced with slashes.
* extensions/files_repo.php,
extensions/files_repo/files_repo_form.php,
extensions/files_repo/files_repo_get_file.php,
extensions/files_repo/files_repo_list.php,
extensions/files_repo/functions_files_repo.php: Replaced
the 'DIRECTORY_SEPARATOR' var with slashes. Removed the
realpath functions.
* include/config.inc.php: Replaced the "owndir" final slash
with a 'DIRECTORY_SEPARATOR'.
* include/functions_html.php: Replaced the "$working_dir"
possible backslashes with slashes.
2014-04-24 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* operation/events/events.build_table.php: Fixed

View File

@ -24,8 +24,8 @@ function pandora_files_repo_install () {
}
}
$full_extensions_dir = $config['homedir'].DIRECTORY_SEPARATOR.EXTENSIONS_DIR.DIRECTORY_SEPARATOR;
$full_sql_dir = $full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR;
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
$full_sql_dir = $full_extensions_dir."files_repo/sql/";
/* SQL installation */
switch ($config['dbtype']) {
@ -81,7 +81,7 @@ function pandora_files_repo_uninstall () {
}
if (!empty($config['attachment_store']))
delete_dir($config['attachment_store'].DIRECTORY_SEPARATOR."files_repo");
delete_dir($config['attachment_store']."/files_repo");
}
function pandora_files_repo_godmode () {
@ -115,8 +115,8 @@ function pandora_files_repo_godmode () {
// Header
ui_print_page_header (__("Files repository manager"), "images/extensions.png", false, "", true, $onheader);
$full_extensions_dir = $config['homedir'].DIRECTORY_SEPARATOR.EXTENSIONS_DIR.DIRECTORY_SEPARATOR;
require_once ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."functions_files_repo.php");
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
require_once ($full_extensions_dir."files_repo/functions_files_repo.php");
// Directory files_repo check
if (!files_repo_check_directory(true)) {
@ -159,11 +159,11 @@ function pandora_files_repo_godmode () {
}
// FORM
require ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."files_repo_form.php");
require ($full_extensions_dir."files_repo/files_repo_form.php");
if (!$file_id) {
// LIST
$manage = true;
require ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."files_repo_list.php");
require ($full_extensions_dir."files_repo/files_repo_list.php");
}
}
@ -189,8 +189,8 @@ function pandora_files_repo_operation () {
// Header
ui_print_page_header (__("Files repository"), "images/extensions.png", false, "", false, $onheader);
$full_extensions_dir = $config['homedir'].DIRECTORY_SEPARATOR.EXTENSIONS_DIR.DIRECTORY_SEPARATOR;
require_once ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."functions_files_repo.php");
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
require_once ($full_extensions_dir."files_repo/functions_files_repo.php");
// Directory files_repo check
if (!files_repo_check_directory(true)) {
@ -198,8 +198,8 @@ function pandora_files_repo_operation () {
}
// LIST
$full_extensions_dir = $config['homedir'].DIRECTORY_SEPARATOR.EXTENSIONS_DIR.DIRECTORY_SEPARATOR;
require ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."files_repo_list.php");
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
require ($full_extensions_dir."files_repo/files_repo_list.php");
}
extensions_add_operation_menu_option(__('Files repository'), null, null, "v1r1");

View File

@ -17,8 +17,8 @@
global $config;
$full_extensions_dir = $config['homedir'].DIRECTORY_SEPARATOR.EXTENSIONS_DIR.DIRECTORY_SEPARATOR;
require_once ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."functions_files_repo.php");
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
require_once ($full_extensions_dir."files_repo/functions_files_repo.php");
$file = array();
$file['name'] = '';

View File

@ -15,8 +15,7 @@
// GNU General Public License for more details.
$ds = DIRECTORY_SEPARATOR;
require_once ("..".$ds."..".$ds."include".$ds."config.php");
require_once ("../../include/config.php");
$file_hash = (string) get_parameter('file');
@ -45,15 +44,14 @@ if (!$check_hash) {
}
// Get the location
$files_repo_path = $config['attachment_store'].$ds."files_repo";
$location = $files_repo_path.$ds.$file['id']."_".$file['name'];
$files_repo_path = $config['attachment_store']."/files_repo";
$location = $files_repo_path."/".$file['id']."_".$file['name'];
if (!file_exists($location) || !is_readable($location) || !is_file($location)) {
throw_error(5); // ERROR
}
// All checks are fine. Download the file!
header('Content-type: aplication/octet-stream;');
header('Content-type: ' . mime_content_type($location) . ';');
header("Content-Length: " . filesize($location));
header('Content-Disposition: attachment; filename="' . $file['name'] . '"');
readfile($location);

View File

@ -17,8 +17,8 @@
global $config;
$full_extensions_dir = $config['homedir'].DIRECTORY_SEPARATOR.EXTENSIONS_DIR.DIRECTORY_SEPARATOR;
require_once ($full_extensions_dir."files_repo".DIRECTORY_SEPARATOR."functions_files_repo.php");
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
require_once ($full_extensions_dir."files_repo/functions_files_repo.php");
$offset = (int) get_parameter('offset');
$filter = array();

View File

@ -18,8 +18,8 @@
function files_repo_check_directory ($print_messages = false) {
global $config;
$attachment_path = realpath($config['attachment_store']);
$files_repo_path = $attachment_path.DIRECTORY_SEPARATOR."files_repo";
$attachment_path = $config['attachment_store'];
$files_repo_path = $attachment_path."/files_repo";
$result = false;
$messages = "";
@ -127,7 +127,7 @@ function files_repo_get_files ($filter = false, $count = false) {
global $config;
// Don't use the realpath for the download links!
$files_repo_path = $config['attachment_store'].DIRECTORY_SEPARATOR."files_repo";
$files_repo_path = $config['attachment_store']."/files_repo";
$sql = "SELECT * FROM tfiles_repo " . db_format_array_where_clause_sql($filter, "AND", "WHERE");
$files = db_get_all_rows_sql($sql);
@ -149,7 +149,7 @@ function files_repo_get_files ($filter = false, $count = false) {
$data = array();
$data['name'] = $file['name'];
$data['description'] = $file['description'];
$data['location'] = $files_repo_path.DIRECTORY_SEPARATOR.$file['id']."_".$data['name'];
$data['location'] = $files_repo_path."/".$file['id']."_".$data['name'];
// Size in bytes
$data['size'] = filesize($data['location']);
// Last modification time in unix timestamp
@ -169,8 +169,8 @@ function files_repo_get_files ($filter = false, $count = false) {
function files_repo_add_file ($file_input_name = "upfile", $description = "", $groups = array(), $public = false) {
global $config;
$attachment_path = realpath($config['attachment_store']);
$files_repo_path = $attachment_path.DIRECTORY_SEPARATOR."files_repo";
$attachment_path = $config['attachment_store'];
$files_repo_path = $attachment_path."/"."files_repo";
$result = array();
$result["status"] = false;
@ -205,7 +205,7 @@ function files_repo_add_file ($file_input_name = "upfile", $description = "", $g
if ($file_id) {
$file_tmp = $_FILES[$file_input_name]['tmp_name'];
$destination = $files_repo_path.DIRECTORY_SEPARATOR.$file_id."_".$filename;
$destination = $files_repo_path."/".$file_id."_".$filename;
if (move_uploaded_file($file_tmp, $destination)) {
@ -283,9 +283,9 @@ function files_repo_delete_file ($file_id) {
$filename = db_get_value("name", "tfiles_repo", "id", $file_id);
if ($filename) {
$attachment_path = realpath($config['attachment_store']);
$files_repo_path = $attachment_path.DIRECTORY_SEPARATOR."files_repo";
$location = $files_repo_path.DIRECTORY_SEPARATOR.$file_id."_".$filename;
$attachment_path = $config['attachment_store'];
$files_repo_path = $attachment_path."/files_repo";
$location = $files_repo_path."/".$file_id."_".$filename;
if (file_exists($location)) {
$result = false;

View File

@ -38,6 +38,6 @@ error_reporting(E_ALL);
// Display ALL errors
// error_reporting(E_ERROR);
$ownDir = dirname(__FILE__) . '/';
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
include ($ownDir . "config_process.php");
?>

View File

@ -21,6 +21,7 @@
if (!isset($config)) {
$working_dir = getcwd();
$working_dir = str_replace("\\", "/", $working_dir); // Windows compatibility
$levels = substr_count($working_dir, '/');
for ($i = 0; $i < $levels; $i++) {

View File

@ -698,8 +698,10 @@ function install_step4() {
$url = $_POST["url"];
else
$url = "http://localhost";
if (isset($_POST["path"]))
if (isset($_POST["path"])) {
$path = $_POST["path"];
$path = str_replace("\\", "/", $path); // Windows compatibility
}
else
$path = "/var/www";
}