photos patch

This commit is contained in:
Baptiste 2022-10-25 21:05:09 +02:00
parent 05ff9140d5
commit 822da2795d

View file

@ -33,7 +33,7 @@ function getActivePath()
function GetActiveFolder($path)
{
$dir = explode(DIRECTORY_SEPARATOR, $path);
return $dir[sizeof($dir) - 1]; // Last item after /
return ".".DIRECTORY_SEPARATOR.$dir[sizeof($dir) - 1]; // Last item after /
}
/**
@ -251,25 +251,9 @@ function generatePath($path)
//CAS
require_once("phpCAS-1.3.6/CAS.php");
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, "cas.insa-toulouse.fr", 443, 'cas', true);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
@ -313,12 +297,10 @@ if (isset($_REQUEST['logout'])) {
<?php endif; ?>
</ul>
<?php if (isAlbumAvailable(getActivePath())): ?>
<a download=""
href="photos_folders/photos<?php echo getActivePath() . DIRECTORY_SEPARATOR . GetActiveFolder(getActivePath()) ?>.zip"
id="downloadAlbum">
<span id="downloadText"><i class="fas fa-download"></i>Télécharger</span>
<a download="" href="photos_folders/photos<?php echo getActivePath().DIRECTORY_SEPARATOR.GetActiveFolder(getActivePath()); ?>.zip" id="downloadAlbum">
<span id="downloadText">Télécharger</span>
<span id="albumPhotoCount"><?php echo getPhotoCount(photoRoot . getActivePath()) ?> photos</span>
</a>
</a>
<?php endif; ?>
<?php if (getPhotoCount(photoRoot . getActivePath()) > 0): ?>
<div class="photos">
@ -331,7 +313,6 @@ if (isset($_REQUEST['logout'])) {
</div>
<br>
<?php
$infopage = ["", "Photos", ob_get_clean(), "", "photos"]; //relativepath, pagetitle, pagecontent, pagescript, pagename | cf structure/template.php ligne 2 à 6
include("structure/template.php");