diff --git a/Dockerfile b/Dockerfile index 3dd5c9d49078663a2fadec93fd8f9500f594f05f..ac3bc2bfd0031f60568ae11756e212d0d9f36d91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN apt-get update && \ WORKDIR /var/www/html COPY ./index.php . +COPY ./php.ini /usr/local/etc/php/conf.d/init.ini COPY ./.htaccess . RUN a2enmod rewrite diff --git a/docker-compose.yml b/docker-compose.yml index d4c50cdad79816269afd2120763def4371b35e3f..4899aad1f4b3a1c09356ad59da897a7b574a1ccc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,7 @@ services: - .env volumes: - ./mysql:/var/lib/mysql + - ./php.ini:/usr/local/etc/php/conf.d/init.ini - ./migration/init.sql:/docker-entrypoint-initdb.d/init.sql podcastify-app-phpmyadmin: diff --git a/php.ini b/php.ini new file mode 100644 index 0000000000000000000000000000000000000000..39eae5df0ab67798d000a4769046c855fdf82405 --- /dev/null +++ b/php.ini @@ -0,0 +1,2 @@ +post_max_size=32M +upload_max_filesize=32M \ No newline at end of file diff --git a/src/app/controllers/UserController.php b/src/app/controllers/UserController.php index a3b157314b9fd36c00833d5e68911d382c8cf371..cdd792a60b281903a7780e8f98559328e8031739 100644 --- a/src/app/controllers/UserController.php +++ b/src/app/controllers/UserController.php @@ -12,8 +12,6 @@ class UserController extends BaseController { switch ($_SERVER['REQUEST_METHOD']) { case "GET": - Middleware::checkIsAdmin(); - if ($userId !== null) { $userId = filter_var($userId, FILTER_SANITIZE_NUMBER_INT); @@ -235,7 +233,7 @@ class UserController extends BaseController { $authService = new AuthService(); $authService->logout(); - + RedirectHelper::redirectHome(); break; default: diff --git a/src/config/config.php b/src/config/config.php index c154297df32e76a6761a5d5f1f448c4519dc7163..514b09f7fae44d363d78bd953c34b22493dc3dbe 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -25,7 +25,7 @@ define("CSS_DIR", "/src/public/css/"); define("JS_DIR", "/src/public/js/"); // File -define('MAX_SIZE', 16 * 1024 * 1024); // 16 mb +define('MAX_SIZE', 8 * 1024 * 1024); // 8 mb define('ALLOWED_AUDIOS', [ 'audio/mpeg' => '.mp3', 'audio/aac' => '.aac', diff --git a/src/public/js/episode/media_player.js b/src/public/js/episode/media_player.js index 623852bd56a63f5fbb5bca35dc753d89f507a3d9..cf266efff230ca941e3c42eb911bbe5a015ff8b8 100644 --- a/src/public/js/episode/media_player.js +++ b/src/public/js/episode/media_player.js @@ -55,39 +55,30 @@ const playAudio = () => { audioPlayer.src = audioFile; - if (!localStorage.getItem("totalPlayed")) { - localStorage.setItem("totalPlayed", 0); + if (!sessionStorage.getItem("totalPlayed")) { + sessionStorage.setItem("totalPlayed", 0); } - var totalPlayed = parseInt(localStorage.getItem("totalPlayed")); + var totalPlayed = parseInt(sessionStorage.getItem("totalPlayed")); - if (totalPlayed >= 3) { - showNotificationDanger("Please login to listen more"); + let xhr = new XMLHttpRequest(); + xhr.open("GET", "/episode/validate/" + totalPlayed); + xhr.send(); - setTimeout(() => { - location.replace("/login"); - }, 3000); - return; - } else { - let xhr = new XMLHttpRequest(); - xhr.open("GET", "/episode/validate/" + totalPlayed); - xhr.send(); - - xhr.onload(() => { - const response = JSON.parse(xhr.responseText); - if (!response.success) { - showNotificationDanger("Please login to listen more"); - - setTimeout(() => { - location.replace("/login"); - }, 3000); - return; - } - }); - } + xhr.onload = () => { + const response = JSON.parse(xhr.responseText); + if (!response.success) { + showNotificationDanger("Please login to listen more"); + + setTimeout(() => { + location.replace("/login"); + }, 3000); + return; + } + }; if (playButton.classList.contains("audio-active")) { - localStorage.setItem("totalPlayed", totalPlayed + 1); + sessionStorage.setItem("totalPlayed", totalPlayed + 1); playButton.classList.remove("audio-active"); audioPlayer.play(); audioPlayer.currentTime = storedTime; diff --git a/src/public/js/user/profile.js b/src/public/js/user/profile.js index 8733d41ae0d5d302534a2a1915984524fed592df..b56c7b4710d96921cb8a3398f76a5721ccb46449 100644 --- a/src/public/js/user/profile.js +++ b/src/public/js/user/profile.js @@ -88,11 +88,14 @@ const submitUpdateForm = async (e, elementForm, modalId) => { xhr.onload = function () { const response = JSON.parse(xhr.responseText); + console.log(response); + if (xhr.status === 200) { if (response.success) { + showNotificationSuccess(response.status_message); + closeModal(modalId, true); updateProfileUser(formData); - showNotificationSuccess(response.status_message); } } else { showNotificationDanger(response.error_message); @@ -362,8 +365,9 @@ const submitChangePasswordForm = async (e, elementForm, modalId) => { const response = JSON.parse(xhr.responseText); if (xhr.status === 200) { if (response.success) { - closeModal(modalId, true); showNotificationSuccess(response.status_message); + + closeModal(modalId, true); } } else { showNotificationDanger(response.error_message);