582 |
|
|
583 |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
584 |
|
|
|
if ($relDir == "") $relDir = "/"; |
|
|
|
|
585 |
$fsDir = $fsRoot.$relDir."/"; // current directory |
$fsDir = $fsRoot.$relDir."/"; // current directory |
586 |
|
|
587 |
if (!is_dir($fsDir)) Error("Dir not found",$relDir,1) ; |
if (!is_dir($fsDir)) Error("Dir not found",$relDir,1) ; |
902 |
global $html, $HTTP_SERVER_VARS; |
global $html, $HTTP_SERVER_VARS; |
903 |
|
|
904 |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
$self = $HTTP_SERVER_VARS["PHP_SELF"] ; |
|
if ($relDir == "") $relDir = "/" ; |
|
|
|
|
905 |
include("$html/UploadPage.html"); |
include("$html/UploadPage.html"); |
906 |
|
|
907 |
} // end function UploadPage |
} // end function UploadPage |
1371 |
}//init_trustee |
}//init_trustee |
1372 |
|
|
1373 |
function in_group($user,$group) { |
function in_group($user,$group) { |
1374 |
return in_array($groups[$group],$user); |
global $groups; |
1375 |
|
return in_array($user,$groups[$group]); |
1376 |
} |
} |
1377 |
|
|
1378 |
// helper function |
// helper function |
1379 |
function unroll_perm($u,$t,$user,$perm) { |
function unroll_perm($u,$t,$user,$perm) { |
1380 |
// check user |
|
1381 |
|
// check user FIX |
1382 |
if ($t & trmask_not && ($u==$user)) continue; |
if ($t & trmask_not && ($u==$user)) continue; |
1383 |
if (!($t & trmask_not) && ($u!=$user)) continue; |
if (!($t & trmask_not) && ($u!=$user)) continue; |
1384 |
|
|
1404 |
$path = "/"; |
$path = "/"; |
1405 |
while (count($path_arr)) { |
while (count($path_arr)) { |
1406 |
if (substr($path,strlen($path)-1,1) != "/") $path.="/"; |
if (substr($path,strlen($path)-1,1) != "/") $path.="/"; |
|
$path.=array_shift($path_arr); |
|
1407 |
$tr = $trustees[$path]; |
$tr = $trustees[$path]; |
|
|
|
1408 |
if (isset($tr)) { |
if (isset($tr)) { |
1409 |
// first apply trustee for all |
// first apply trustee for all |
1410 |
if (isset($tr['*'])) { |
if (isset($tr['*'])) { |
1412 |
unset($tr['*']); |
unset($tr['*']); |
1413 |
} |
} |
1414 |
// then apply group policies |
// then apply group policies |
1415 |
foreach ($tr as $u=>$t) { |
foreach ($tr as $g=>$t) { |
1416 |
if ($t & trmask_group && in_group($user,$u)) { |
if ($t & trmask_group && in_group($user,$g)) { |
1417 |
// resolv user |
// resolv user |
1418 |
$t = $t & ~trmask_group; |
$t = $t & ~trmask_group; |
1419 |
$u = $user; |
$perm = unroll_perm($user,$t,$user, $perm); |
1420 |
$perm = unroll_perm($u,$t,$user, $perm); |
unset($tr[$g]); |
|
unset($tr[$u]); |
|
1421 |
} |
} |
1422 |
} |
} |
1423 |
// then apply use policy |
// then apply user policy |
1424 |
if (isset($tr[$user])) { |
if (isset($tr[$user])) { |
1425 |
$perm = unroll_perm($user,$tr[$user],$user, $perm); |
$perm = unroll_perm($user,$tr[$user],$user, $perm); |
1426 |
unset($tr[$user]); |
unset($tr[$user]); |
1427 |
} |
} |
1428 |
|
$path.=array_shift($path_arr); |
1429 |
} |
} |
1430 |
|
|
1431 |
} |
} |
1441 |
|
|
1442 |
global $debug; |
global $debug; |
1443 |
$debug.="<br>check_perm: <tt>$path</tt> test perm ".display_trustee($perm)."<br>\n"; |
$debug.="<br>check_perm: <tt>$path</tt> test perm ".display_trustee($perm)."<br>\n"; |
1444 |
|
|
1445 |
$return = ! $HAVE_TRUSTEE; |
$return = ! $HAVE_TRUSTEE; |
1446 |
if ($HAVE_TRUSTEE) { |
if ($HAVE_TRUSTEE) { |
1447 |
$perm = check_trustee($gblLogin,$path); |
$perm = check_trustee($gblLogin,$path); |
1567 |
// get ACL informations |
// get ACL informations |
1568 |
$HAVE_TRUSTEE = init_trustee(); |
$HAVE_TRUSTEE = init_trustee(); |
1569 |
|
|
1570 |
|
// take additional login vars |
1571 |
|
$relogin = $HTTP_GET_VARS[relogin]; |
1572 |
|
$force_login = $HTTP_GET_VARS[force_login]; |
1573 |
|
|
1574 |
if (strtolower($gblLogin) == "anonymous" || !isset($gblPasswd)) { |
if (strtolower($gblLogin) == "anonymous" || !isset($gblPasswd)) { |
1575 |
$perm = check_trustee($gblLogin,$path); |
$perm = check_trustee("anonymous",$path); |
1576 |
// browsing must be explicitly allowed for root directory |
// browsing must be explicitly allowed for root directory |
1577 |
// of repository for anonymous user to work! |
// of repository for anonymous user to work! |
1578 |
if ($perm[allow] & trperm_b) { |
if ($perm[allow] & trperm_b) { |
1618 |
$relDir = $D; |
$relDir = $D; |
1619 |
} |
} |
1620 |
|
|
|
if ($relDir == "/") $relDir = "" ; |
|
|
|
|
1621 |
$relScriptDir = dirname($SCRIPT_NAME) ; |
$relScriptDir = dirname($SCRIPT_NAME) ; |
1622 |
// i.e. /docman |
// i.e. /docman |
1623 |
|
|
1626 |
// i.e. /home/httpd/repository |
// i.e. /home/httpd/repository |
1627 |
|
|
1628 |
$fsDir = $gblFsRoot . $relDir ; // current directory |
$fsDir = $gblFsRoot . $relDir ; // current directory |
1629 |
if ( !is_dir($fsDir) ) Error("Dir not found",$relDir,1) ; |
if ( !is_dir($fsDir) ) Error("Dir not found","Can't find <tt>$relDir</tt> which points to <tt>$fsDir</tt>",1) ; |
1630 |
|
|
1631 |
if (isset($HTTP_SERVER_VARS["HTTPS"]) && $HTTP_SERVER_VARS["HTTPS"] == "on") { |
if (isset($HTTP_SERVER_VARS["HTTPS"]) && $HTTP_SERVER_VARS["HTTPS"] == "on") { |
1632 |
$webRoot = "https://"; |
$webRoot = "https://"; |
1822 |
switch ($A) { |
switch ($A) { |
1823 |
case "U" : |
case "U" : |
1824 |
// upload to $relDir |
// upload to $relDir |
1825 |
|
if (! check_perm($relDir, trperm_w)) |
1826 |
|
Error("Write access denied","You don't have permission to write in <tt>$relDir</tt>"); |
1827 |
if (!is_writeable($gblFsRoot . $relDir)) |
if (!is_writeable($gblFsRoot . $relDir)) |
1828 |
Error("Write access denied",$relDir) ; |
Error("Write access denied","User <tt>$gblLogin</tt> has permission on <tt>$relDir</tt>, but directory is not writable",1); |
1829 |
$text = "Use this page to upload a single " ; |
$text = "Use this page to upload a single " ; |
1830 |
$text .= "file to <B>$realm</B>." ; |
$text .= "file to <B>$realm</B>." ; |
1831 |
StartHTML("(Upload Page)", $text) ; |
StartHTML("(Upload Page)", $text) ; |
1875 |
case "I" : |
case "I" : |
1876 |
if (! isset($F) || $F == "") |
if (! isset($F) || $F == "") |
1877 |
Error("Can't find file to include","Your request didn't specify file to include which should be in variable <tt>F</tt> like <tt>$HTTP_SERVER_VARS[REQUEST_URI]<b>&F=include_php_file</b></tt>",1); |
Error("Can't find file to include","Your request didn't specify file to include which should be in variable <tt>F</tt> like <tt>$HTTP_SERVER_VARS[REQUEST_URI]<b>&F=include_php_file</b></tt>",1); |
1878 |
if (file_exists("$gblIncDir/include_php/$F.php")) { |
$inc_file="$fsRealmDir/$realm".$realm_sep.$F.".php"; |
1879 |
$inc_file="$gblIncDir/include_php/${F}.php"; |
if (! file_exists($inc_file)) { |
1880 |
} elseif (file_exists("$fsRealmDir/$realm/$F.php")) { |
Error("Can't find file to include","Can't find include file <tt>$F.php</tt> in <tt>$fsRealmDir/$realm/</tt>. Meybe you should copy <tt>$gblIncDir/include_php/$F.php</tt> to <tt>$inc_file<tt> ?",1); |
|
$inc_file="$fsRealmDir/$realm/${F}.php"; |
|
|
} else { |
|
|
Error("Can't find file to include","Can't find include file <tt>$F.php</tt> in <tt>$gblIncDir/include_php/<tt> nor <tt>$fsRealmDir/$realm/</tt>",1); |
|
1881 |
} |
} |
1882 |
if (!is_readable($inc_file)) |
if (!is_readable($inc_file)) |
1883 |
Error("Read access to include file denied","Can't read PHP include file <tt>$inc_file</tt>. Fix permissions on it."); |
Error("Read access to include file denied","Can't read PHP include file <tt>$inc_file</tt>. Fix permissions on it.",1); |
1884 |
$text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; |
$text = "Your include file should define \$text variable which holds this text and \$title variable which is page title"; |
1885 |
$title = "You should define \$title variable with page title"; |
$title = "You should define \$title variable with page title"; |
1886 |
include($inc_file); |
include($inc_file); |