CODE STYLE class.webdav.php
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* class.webdav.php
|
* class.webdav.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes
|
* @package workflow.engine.classes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ require_once "System.php";
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @package workflow.engine.classes
|
* @package workflow.engine.classes
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||||
{
|
{
|
||||||
@@ -31,7 +33,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
function ServeRequest($base = false) {
|
function ServeRequest ($base = false)
|
||||||
|
{
|
||||||
//$this->base = '/';
|
//$this->base = '/';
|
||||||
$this->uriBase = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/';
|
$this->uriBase = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/';
|
||||||
|
|
||||||
@@ -75,7 +78,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathClasses ) );
|
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathClasses ) );
|
||||||
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
||||||
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
||||||
$files["files"][] = array ( 'path' => 'classes' , 'props' => $props);
|
$files["files"][] = array ('path' => 'classes','props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count( $paths ) > 0 && $paths[0] == 'classes' && is_dir( $pathClasses )) {
|
if (count( $paths ) > 0 && $paths[0] == 'classes' && is_dir( $pathClasses )) {
|
||||||
@@ -95,13 +99,15 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
||||||
$props[] = $this->mkprop( "getcontentlength", filesize( $pathClasses . $filename ) );
|
$props[] = $this->mkprop( "getcontentlength", filesize( $pathClasses . $filename ) );
|
||||||
if (count( $paths ) == 1 || (count( $paths ) == 2 && $paths[1] == $filename))
|
if (count( $paths ) == 1 || (count( $paths ) == 2 && $paths[1] == $filename))
|
||||||
$files["files"][] = array ( 'path' => "classes/$filename" , 'props' => $props);
|
$files["files"][] = array ('path' => "classes/$filename",'props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} //path classes
|
} //path classes
|
||||||
|
|
||||||
|
|
||||||
$pathProcesses = PATH_DB . SYS_SYS . PATH_SEP;
|
$pathProcesses = PATH_DB . SYS_SYS . PATH_SEP;
|
||||||
if (count( $paths ) == 0 && is_dir( $pathProcesses )) {
|
if (count( $paths ) == 0 && is_dir( $pathProcesses )) {
|
||||||
$props = array ();
|
$props = array ();
|
||||||
@@ -110,7 +116,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "getlastmodified", filemtime( $pathProcesses ) );
|
$props[] = $this->mkprop( "getlastmodified", filemtime( $pathProcesses ) );
|
||||||
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
||||||
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
||||||
$files["files"][] = array ( 'path' => 'processes' , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes','props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//list all active processes
|
//list all active processes
|
||||||
@@ -134,12 +141,14 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) );
|
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) );
|
||||||
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
||||||
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
||||||
$files["files"][] = array ( 'path' => "processes/". $aRow['PRO_UID'] , 'props' => $props);
|
$files["files"][] = array ('path' => "processes/" . $aRow['PRO_UID'],'props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
} //dir of processes
|
} //dir of processes
|
||||||
|
|
||||||
|
|
||||||
//content of any process ( the three major folders of Processes )
|
//content of any process ( the three major folders of Processes )
|
||||||
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP;
|
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP;
|
||||||
if (count( $paths ) == 2 && $paths[0] == 'processes' && is_dir( $pathProcesses )) {
|
if (count( $paths ) == 2 && $paths[0] == 'processes' && is_dir( $pathProcesses )) {
|
||||||
@@ -150,7 +159,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathXmlform ) );
|
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathXmlform ) );
|
||||||
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
||||||
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
||||||
$files["files"][] = array ( 'path' => 'processes/' . $paths[1] . '/xmlforms' , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes/' . $paths[1] . '/xmlforms','props' => $props
|
||||||
|
);
|
||||||
|
|
||||||
$props[] = $this->mkprop( "displayname", 'mailTemplates' );
|
$props[] = $this->mkprop( "displayname", 'mailTemplates' );
|
||||||
$props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) );
|
$props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) );
|
||||||
@@ -158,7 +168,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) );
|
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) );
|
||||||
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
||||||
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
||||||
$files["files"][] = array ( 'path' => 'processes/' . $paths[1] . '/mailTemplates' , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes/' . $paths[1] . '/mailTemplates','props' => $props
|
||||||
|
);
|
||||||
|
|
||||||
$props[] = $this->mkprop( "displayname", 'public_html' );
|
$props[] = $this->mkprop( "displayname", 'public_html' );
|
||||||
$props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) );
|
$props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) );
|
||||||
@@ -166,9 +177,11 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) );
|
$props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) );
|
||||||
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
$props[] = $this->mkprop( "resourcetype", 'collection' );
|
||||||
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
$props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' );
|
||||||
$files["files"][] = array ( 'path' => 'processes/' . $paths[1] . '/public_html' , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes/' . $paths[1] . '/public_html','props' => $props
|
||||||
|
);
|
||||||
} //content of any processes
|
} //content of any processes
|
||||||
|
|
||||||
|
|
||||||
//list available xmlforms
|
//list available xmlforms
|
||||||
if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'xmlforms' && is_dir( $pathXmlform )) {
|
if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'xmlforms' && is_dir( $pathXmlform )) {
|
||||||
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP;
|
$pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP;
|
||||||
@@ -188,12 +201,14 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
||||||
$props[] = $this->mkprop( "getcontentlength", filesize( $pathXmlform . $filename ) );
|
$props[] = $this->mkprop( "getcontentlength", filesize( $pathXmlform . $filename ) );
|
||||||
//if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) )
|
//if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) )
|
||||||
$files["files"][] = array ( 'path' => 'processes/' . $paths[1] . '/xmlforms/' . $filename , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes/' . $paths[1] . '/xmlforms/' . $filename,'props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //content of xmlforms
|
} //content of xmlforms
|
||||||
|
|
||||||
|
|
||||||
//list available mailTemplates
|
//list available mailTemplates
|
||||||
$pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP;
|
$pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP;
|
||||||
if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'mailTemplates' && is_dir( $pathTemplates )) {
|
if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'mailTemplates' && is_dir( $pathTemplates )) {
|
||||||
@@ -214,12 +229,14 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
||||||
$props[] = $this->mkprop( "getcontentlength", filesize( $pathTemplates . $filename ) );
|
$props[] = $this->mkprop( "getcontentlength", filesize( $pathTemplates . $filename ) );
|
||||||
//if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) )
|
//if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) )
|
||||||
$files["files"][] = array ( 'path' => 'processes/' . $paths[1] . '/mailTemplates/' . $filename , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes/' . $paths[1] . '/mailTemplates/' . $filename,'props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //content of mailTemplates
|
} //content of mailTemplates
|
||||||
|
|
||||||
|
|
||||||
//list available public_html files
|
//list available public_html files
|
||||||
$pathPublic = $pathProcesses . 'public' . PATH_SEP;
|
$pathPublic = $pathProcesses . 'public' . PATH_SEP;
|
||||||
if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'public_html' && is_dir( $pathTemplates )) {
|
if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'public_html' && is_dir( $pathTemplates )) {
|
||||||
@@ -240,12 +257,14 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
$props[] = $this->mkprop( "getcontenttype", 'text/plain' );
|
||||||
$props[] = $this->mkprop( "getcontentlength", filesize( $pathPublic . $filename ) );
|
$props[] = $this->mkprop( "getcontentlength", filesize( $pathPublic . $filename ) );
|
||||||
//if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) )
|
//if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) )
|
||||||
$files["files"][] = array ( 'path' => 'processes/' . $paths[1] . '/public_html/' . $filename , 'props' => $props);
|
$files["files"][] = array ('path' => 'processes/' . $paths[1] . '/public_html/' . $filename,'props' => $props
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //content of public_html files
|
} //content of public_html files
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ( 1 ) {
|
if ( 1 ) {
|
||||||
$props = array ();
|
$props = array ();
|
||||||
@@ -281,23 +300,28 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
// check method depends on operating system
|
// check method depends on operating system
|
||||||
if (! strncmp( PHP_OS, "WIN", 3 )) {
|
if (! strncmp( PHP_OS, "WIN", 3 )) {
|
||||||
// on Windows an appropriate COM or EXE file needs to exist
|
// on Windows an appropriate COM or EXE file needs to exist
|
||||||
$exts = array(".exe", ".com");
|
$exts = array (".exe",".com"
|
||||||
|
);
|
||||||
$check_fn = "file_exists";
|
$check_fn = "file_exists";
|
||||||
} else {
|
} else {
|
||||||
// anywhere else we look for an executable file of that name
|
// anywhere else we look for an executable file of that name
|
||||||
$exts = array("");
|
$exts = array (""
|
||||||
|
);
|
||||||
$check_fn = "is_executable";
|
$check_fn = "is_executable";
|
||||||
}
|
}
|
||||||
|
|
||||||
// now check the directories in the path for the program
|
// now check the directories in the path for the program
|
||||||
foreach (explode( PATH_SEPARATOR, $path ) as $dir) {
|
foreach (explode( PATH_SEPARATOR, $path ) as $dir) {
|
||||||
// skip invalid path entries
|
// skip invalid path entries
|
||||||
if (!file_exists($dir)) continue;
|
if (! file_exists( $dir ))
|
||||||
if (!is_dir($dir)) continue;
|
continue;
|
||||||
|
if (! is_dir( $dir ))
|
||||||
|
continue;
|
||||||
|
|
||||||
// and now look for the file
|
// and now look for the file
|
||||||
foreach ($exts as $ext) {
|
foreach ($exts as $ext) {
|
||||||
if ($check_fn("$dir/$name".$ext)) return true;
|
if ($check_fn( "$dir/$name" . $ext ))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,6 +353,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
// and find may not have mime support using "-i"
|
// and find may not have mime support using "-i"
|
||||||
// so we test the format of the returned string
|
// so we test the format of the returned string
|
||||||
|
|
||||||
|
|
||||||
// the reply begins with the requested filename
|
// the reply begins with the requested filename
|
||||||
if (! strncmp( $reply, "$fspath: ", strlen( $fspath ) + 2 )) {
|
if (! strncmp( $reply, "$fspath: ", strlen( $fspath ) + 2 )) {
|
||||||
$reply = substr( $reply, strlen( $fspath ) + 2 );
|
$reply = substr( $reply, strlen( $fspath ) + 2 );
|
||||||
@@ -378,7 +403,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
* @param array parameter passing array
|
* @param array parameter passing array
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
function GET(&$options) {
|
function GET (&$options)
|
||||||
|
{
|
||||||
$paths = $this->paths;
|
$paths = $this->paths;
|
||||||
|
|
||||||
$pathClasses = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
$pathClasses = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
||||||
@@ -450,7 +476,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$fspath = $this->base . $options["path"];
|
$fspath = $this->base . $options["path"];
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (!file_exists($fspath)) return false;
|
if (! file_exists( $fspath ))
|
||||||
|
return false;
|
||||||
|
|
||||||
// is this a collection?
|
// is this a collection?
|
||||||
if (is_dir( $fspath )) {
|
if (is_dir( $fspath )) {
|
||||||
@@ -494,35 +521,30 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
printf( $format, "Size", "Last modified", "Filename" );
|
printf( $format, "Size", "Last modified", "Filename" );
|
||||||
echo "<hr>";
|
echo "<hr>";
|
||||||
|
|
||||||
$pathRoot = array ( 'xmlforms', 'public_html', 'dir1', 'dir2' );
|
$pathRoot = array ('xmlforms','public_html','dir1','dir2'
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($pathRoot as $key => $val) {
|
foreach ($pathRoot as $key => $val) {
|
||||||
$fullpath = $fspath . "/" . $filename;
|
$fullpath = $fspath . "/" . $filename;
|
||||||
$name = htmlspecialchars( $val );
|
$name = htmlspecialchars( $val );
|
||||||
printf($format, number_format(filesize($fullpath)),
|
printf( $format, number_format( filesize( $fullpath ) ), strftime( "%Y-%m-%d %H:%M:%S", filemtime( $fullpath ) ), "<a href='$this->base_uri$path$name'>$name</a>" );
|
||||||
strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)),
|
|
||||||
"<a href='$this->base_uri$path$name'>$name</a>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</pre>";
|
echo "</pre>";
|
||||||
echo "</html>\n";
|
echo "</html>\n";
|
||||||
|
|
||||||
die;
|
die();
|
||||||
|
|
||||||
$handle = @opendir( $fspath );
|
$handle = @opendir( $fspath );
|
||||||
if (! $handle) {
|
if (! $handle) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while ($filename = readdir( $handle )) {
|
while ($filename = readdir( $handle )) {
|
||||||
if ($filename != "." && $filename != "..") {
|
if ($filename != "." && $filename != "..") {
|
||||||
$fullpath = $fspath . "/" . $filename;
|
$fullpath = $fspath . "/" . $filename;
|
||||||
$name = htmlspecialchars( $filename );
|
$name = htmlspecialchars( $filename );
|
||||||
printf($format,
|
printf( $format, number_format( filesize( $fullpath ) ), strftime( "%Y-%m-%d %H:%M:%S", filemtime( $fullpath ) ), "<a href='$this->base_uri$path$name'>$name</a>" );
|
||||||
number_format(filesize($fullpath)),
|
|
||||||
strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)),
|
|
||||||
"<a href='$this->base_uri$path$name'>$name</a>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +554,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
|
|
||||||
echo "</html>\n";
|
echo "</html>\n";
|
||||||
|
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -549,7 +571,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$path = $this->_slashify( $options["path"] );
|
$path = $this->_slashify( $options["path"] );
|
||||||
if ($path != $options["path"]) {
|
if ($path != $options["path"]) {
|
||||||
header( "Location: " . $this->base_uri . $path );
|
header( "Location: " . $this->base_uri . $path );
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// fixed width directory column format
|
// fixed width directory column format
|
||||||
@@ -572,10 +594,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
if ($filename != "." && $filename != "..") {
|
if ($filename != "." && $filename != "..") {
|
||||||
$fullpath = $fspath . "/" . $filename;
|
$fullpath = $fspath . "/" . $filename;
|
||||||
$name = htmlspecialchars( $filename );
|
$name = htmlspecialchars( $filename );
|
||||||
printf($format,
|
printf( $format, number_format( filesize( $fullpath ) ), strftime( "%Y-%m-%d %H:%M:%S", filemtime( $fullpath ) ), "<a href='$this->base_uri$path$name'>$name</a>" );
|
||||||
number_format(filesize($fullpath)),
|
|
||||||
strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)),
|
|
||||||
"<a href='$this->base_uri$path$name'>$name</a>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,7 +604,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
|
|
||||||
echo "</html>\n";
|
echo "</html>\n";
|
||||||
|
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -648,7 +667,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($paths[2] == 'public_html') {
|
if ($paths[2] == 'public_html') {
|
||||||
$pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP;
|
$pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP;
|
||||||
$fsFile = $pathPublic . $paths[3];
|
$fsFile = $pathPublic . $paths[3];
|
||||||
@@ -707,7 +725,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
return ("201 Created");
|
return ("201 Created");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DELETE method handler
|
* DELETE method handler
|
||||||
*
|
*
|
||||||
@@ -735,7 +752,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
return "204 No Content";
|
return "204 No Content";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MOVE method handler
|
* MOVE method handler
|
||||||
*
|
*
|
||||||
@@ -758,6 +774,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
{
|
{
|
||||||
// TODO Property updates still broken (Litmus should detect this?)
|
// TODO Property updates still broken (Litmus should detect this?)
|
||||||
|
|
||||||
|
|
||||||
if (! empty( $_SERVER["CONTENT_LENGTH"] )) { // no body parsing yet
|
if (! empty( $_SERVER["CONTENT_LENGTH"] )) { // no body parsing yet
|
||||||
return "415 Unsupported media type";
|
return "415 Unsupported media type";
|
||||||
}
|
}
|
||||||
@@ -768,7 +785,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
$source = $this->base . $options["path"];
|
$source = $this->base . $options["path"];
|
||||||
if (!file_exists($source)) return "404 Not found";
|
if (! file_exists( $source ))
|
||||||
|
return "404 Not found";
|
||||||
|
|
||||||
$dest = $this->base . $options["dest"];
|
$dest = $this->base . $options["dest"];
|
||||||
|
|
||||||
@@ -792,7 +810,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
|
|
||||||
if (! $new) {
|
if (! $new) {
|
||||||
if ($options["overwrite"]) {
|
if ($options["overwrite"]) {
|
||||||
$stat = $this->DELETE(array("path" => $options["dest"]));
|
$stat = $this->DELETE( array ("path" => $options["dest"]
|
||||||
|
) );
|
||||||
if (($stat{0} != "2") && (substr( $stat, 0, 3 ) != "404")) {
|
if (($stat{0} != "2") && (substr( $stat, 0, 3 ) != "404")) {
|
||||||
return $stat;
|
return $stat;
|
||||||
}
|
}
|
||||||
@@ -827,7 +846,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
$files = System::find( $source );
|
$files = System::find( $source );
|
||||||
$files = array_reverse( $files );
|
$files = array_reverse( $files );
|
||||||
} else {
|
} else {
|
||||||
$files = array($source);
|
$files = array ($source
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! is_array( $files ) || empty( $files )) {
|
if (! is_array( $files ) || empty( $files )) {
|
||||||
@@ -896,7 +916,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LOCK method handler
|
* LOCK method handler
|
||||||
*
|
*
|
||||||
@@ -919,6 +938,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
|
|
||||||
$options["timeout"] = time() + 300; // 5min. hardcoded
|
$options["timeout"] = time() + 300; // 5min. hardcoded
|
||||||
|
|
||||||
|
|
||||||
$query = "INSERT INTO locks
|
$query = "INSERT INTO locks
|
||||||
SET token = '$options[locktoken]'
|
SET token = '$options[locktoken]'
|
||||||
, path = '$options[path]'
|
, path = '$options[path]'
|
||||||
@@ -966,12 +986,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
mysql_free_result( $res );
|
mysql_free_result( $res );
|
||||||
|
|
||||||
if ($row) {
|
if ($row) {
|
||||||
$result = array( "type" => "write",
|
$result = array ("type" => "write","scope" => $row["exclusivelock"] ? "exclusive" : "shared","depth" => 0,"owner" => $row['owner'],"token" => $row['token'],"expires" => $row['expires']
|
||||||
"scope" => $row["exclusivelock"] ? "exclusive" : "shared",
|
|
||||||
"depth" => 0,
|
|
||||||
"owner" => $row['owner'],
|
|
||||||
"token" => $row['token'],
|
|
||||||
"expires" => $row['expires']
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -979,7 +994,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create database tables for property and lock storage
|
* create database tables for property and lock storage
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user