diff --git a/.gitignore b/.gitignore
index 3102eaa..72f1563 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-# Ignore the dev_files directory
-_NEW
+._*
\ No newline at end of file
diff --git a/README.md b/README.md
index 439a290..2260032 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,7 @@
-# web-learning-manager
+# Netcloud Learning Manager
+The Netcloud learning manager is a webtool, which was developed for all employees of the company Netcloud AG, in order to educate themselves independently and personally with licensed videos from LinkedIn Learning and the Linuxacademy.
+
+The application can be accessed at the following URL: https://learning-manager.apps.netcloud.local/
+
+The password is in our internal wiki.
\ No newline at end of file
diff --git a/assets/css/login.css b/assets/css/login.css
new file mode 100644
index 0000000..c9f1a9d
--- /dev/null
+++ b/assets/css/login.css
@@ -0,0 +1,306 @@
+*,
+*:before,
+*:after {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+}
+
+html,
+body {
+ font-size: 62.5%;
+ height: 100%;
+ overflow: hidden;
+}
+
+@media (max-width: 768px) {
+
+ html,
+ body {
+ font-size: 50%;
+ }
+}
+
+svg {
+ display: inline-block;
+ width: 2rem;
+ height: 2rem;
+ overflow: visible;
+}
+
+.svg-icon {
+ cursor: pointer;
+}
+
+.svg-icon path {
+ stroke: rgba(255, 255, 255, 0.9);
+ fill: none;
+ stroke-width: 1;
+}
+
+input,
+button {
+ outline: none;
+ border: none;
+}
+
+.netcloud-logo {
+ background-image: url("../../assets/images/Netcloud-Logo_Weiss.png");
+ width: 104px;
+ height: 60px;
+ background-size: contain;
+ margin-top: 30px;
+ background-repeat: no-repeat;
+}
+
+.container {
+ position: relative;
+ height: 100%;
+ background-image: url("../../assets/images/background.jpg");
+ background-size: cover;
+ overflow: auto;
+ font-family: "Open Sans", Helvetica, Arial, sans-serif;
+}
+
+.row {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-left: -15rem;
+ margin-top: -26.5rem;
+ width: 30rem;
+ height: 53rem;
+ overflow: hidden;
+}
+
+.login {
+ position: relative;
+ height: 100%;
+ background: -webkit-linear-gradient(top, rgba(113, 113, 113, 0.8) 0%, rgba(0, 0, 0, 0.6) 100%);
+ background: linear-gradient(to bottom, rgb(96 121 148 / 80%) 0%, rgb(2 24 47 / 65%) 100%);
+ -webkit-transition: opacity 0.1s, -webkit-transform 0.3s cubic-bezier(0.17, -0.65, 0.665, 1.25);
+ transition: opacity 0.1s, -webkit-transform 0.3s cubic-bezier(0.17, -0.65, 0.665, 1.25);
+ transition: opacity 0.1s, transform 0.3s cubic-bezier(0.17, -0.65, 0.665, 1.25);
+ transition: opacity 0.1s, transform 0.3s cubic-bezier(0.17, -0.65, 0.665, 1.25), -webkit-transform 0.3s cubic-bezier(0.17, -0.65, 0.665, 1.25);
+ -webkit-transform: scale(1);
+ transform: scale(1);
+}
+
+.login.inactive {
+ opacity: 0;
+ -webkit-transform: scale(1.1);
+ transform: scale(1.1);
+}
+
+.login__lock {
+ position: absolute;
+ /*top: 8rem;*/
+ left: 10rem;
+ width: 14rem;
+ height: 2.8rem;
+ font-size: 128px;
+
+}
+
+@media screen and (min-width: 769px) {
+ .login__lock {
+ font-size: 152px;
+ }
+}
+
+.login__check {
+ position: absolute;
+ top: 16rem;
+ left: 13.5rem;
+ width: 14rem;
+ height: 2.8rem;
+ background: #fff;
+ -webkit-transform-origin: 0 100%;
+ transform-origin: 0 100%;
+ -webkit-transform: rotate(-45deg);
+ transform: rotate(-45deg);
+}
+
+.login__check:before {
+ content: "";
+ position: absolute;
+ left: 0;
+ bottom: 100%;
+ width: 2.8rem;
+ height: 5.2rem;
+ background: #fff;
+ box-shadow: inset -0.2rem -2rem 2rem rgba(0, 0, 0, 0.2);
+}
+
+.login__form {
+ position: absolute;
+ top: 50%;
+ left: 0;
+ width: 100%;
+ height: 50%;
+ padding: 1.5rem 2.5rem;
+ text-align: center;
+}
+
+.login__row {
+ height: 5rem;
+ padding-top: 1rem;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+.login__icon {
+ margin-bottom: -0.4rem;
+ margin-right: 0.5rem;
+}
+
+.login__icon.name path {
+ stroke-dasharray: 73.50196075439453;
+ stroke-dashoffset: 73.50196075439453;
+ -webkit-animation: animatePath 2s 0.5s forwards;
+ animation: animatePath 2s 0.5s forwards;
+}
+
+.login__icon.pass path {
+ stroke-dasharray: 92.10662841796875;
+ stroke-dashoffset: 92.10662841796875;
+ -webkit-animation: animatePath 2s 0.5s forwards;
+ animation: animatePath 2s 0.5s forwards;
+}
+
+.login__input {
+ display: inline-block;
+ width: 22rem;
+ height: 100%;
+ padding-left: 1.5rem;
+ font-size: 1.5rem;
+ background: transparent;
+ color: #FDFCFD;
+}
+
+.login__submit {
+ position: relative;
+ width: 100%;
+ height: 4rem;
+ margin: 5rem 0 2.2rem;
+ color: rgba(255, 255, 255, 0.8);
+ background: #383838;
+ font-size: 1.5rem;
+ border-radius: 3rem;
+ cursor: pointer;
+ overflow: hidden;
+ -webkit-transition: width 0.3s 0.15s, font-size 0.1s 0.15s;
+ transition: width 0.3s 0.15s, font-size 0.1s 0.15s;
+}
+
+.login__submit:after {
+ content: "";
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-left: -1.5rem;
+ margin-top: -1.5rem;
+ width: 3rem;
+ height: 3rem;
+ border: 2px dotted #fff;
+ border-radius: 50%;
+ border-left: none;
+ border-bottom: none;
+ -webkit-transition: opacity 0.1s 0.4s;
+ transition: opacity 0.1s 0.4s;
+ opacity: 0;
+}
+
+.login__submit.processing {
+ width: 4rem;
+ font-size: 0;
+}
+
+.login__submit.processing:after {
+ opacity: 1;
+ -webkit-animation: rotate 0.5s 0.4s infinite linear;
+ animation: rotate 0.5s 0.4s infinite linear;
+}
+
+.login__submit.success {
+ -webkit-transition: opacity 0.1s 0.3s, background-color 0.1s 0.3s, -webkit-transform 0.3s 0.1s ease-out;
+ transition: opacity 0.1s 0.3s, background-color 0.1s 0.3s, -webkit-transform 0.3s 0.1s ease-out;
+ transition: transform 0.3s 0.1s ease-out, opacity 0.1s 0.3s, background-color 0.1s 0.3s;
+ transition: transform 0.3s 0.1s ease-out, opacity 0.1s 0.3s, background-color 0.1s 0.3s, -webkit-transform 0.3s 0.1s ease-out;
+ -webkit-transform: scale(30);
+ transform: scale(30);
+ opacity: 0.9;
+}
+
+.login__submit.success:after {
+ -webkit-transition: opacity 0.1s 0s;
+ transition: opacity 0.1s 0s;
+ opacity: 0;
+ -webkit-animation: none;
+ animation: none;
+}
+
+.login__signup {
+ font-size: 1.2rem;
+ color: #ABA8AE;
+}
+
+.login__signup a {
+ color: #fff;
+ cursor: pointer;
+}
+
+.ripple {
+ position: absolute;
+ width: 15rem;
+ height: 15rem;
+ margin-left: -7.5rem;
+ margin-top: -7.5rem;
+ background: rgba(0, 0, 0, 0.4);
+ -webkit-transform: scale(0);
+ transform: scale(0);
+ -webkit-animation: animRipple 0.4s;
+ animation: animRipple 0.4s;
+ border-radius: 50%;
+}
+
+@-webkit-keyframes animRipple {
+ to {
+ -webkit-transform: scale(3.5);
+ transform: scale(3.5);
+ opacity: 0;
+ }
+}
+
+@keyframes animRipple {
+ to {
+ -webkit-transform: scale(3.5);
+ transform: scale(3.5);
+ opacity: 0;
+ }
+}
+
+@-webkit-keyframes rotate {
+ to {
+ -webkit-transform: rotate(360deg);
+ transform: rotate(360deg);
+ }
+}
+
+@keyframes rotate {
+ to {
+ -webkit-transform: rotate(360deg);
+ transform: rotate(360deg);
+ }
+}
+
+@-webkit-keyframes animatePath {
+ to {
+ stroke-dashoffset: 0;
+ }
+}
+
+@keyframes animatePath {
+ to {
+ stroke-dashoffset: 0;
+ }
+}
\ No newline at end of file
diff --git a/assets/css/styles.css b/assets/css/styles.css
index 56e1228..18b17d1 100644
--- a/assets/css/styles.css
+++ b/assets/css/styles.css
@@ -1,32 +1,43 @@
@charset "utf-8";
-
-
/*-------------------------
Simple reset
--------------------------*/
-*{
- margin:0;
- padding:0;
+* {
+ margin: 0;
+ padding: 0;
font-family: system-ui;
}
-html {
- /* Full height */
- height: 100%;
+html {
+ /* Full height */
+ height: 100%;
/* The image used */
- background-image: url("../../images/background.jpg");
-
- background-color: #373743;
- /* Center and scale the image nicely */
- background-position: center center;
- background-size: cover;
-
+ background-image: url("../../assets/images/background.jpg");
+ background-color: #373743;
+ /* Center and scale the image nicely */
+ background-position: center center;
+ background-size: cover;
font: 14px normal Arial, Helvetica, sans-serif;
z-index: -4;
overflow-y: scroll;
+ /*Fix for moving page because of scrole baar*/
+}
+
+.netcloud-logo {
+ background-image: url("../../assets/images/michu-it_logo_weiss.png");
+ width: 132px;
+ height: 60px;
+ float: right;
+ background-size: contain;
+ margin-top: 46px;
+ background-repeat: no-repeat;
+ margin-right: 8px;
}
+.compensate-for-scrollbar {
+ margin-right: inherit !important;
+}
/*-------------------------
File manager
@@ -34,9 +45,11 @@ html {
.filemanager {
width: 95%;
- max-width:1340px;
+ max-width: 1340px;
+ min-height: 500px;
position: relative;
margin: 30px auto 50px;
+ background-color: rgb(0 0 0 / 40%);
}
@media all and (max-width: 965px) {
@@ -49,24 +62,93 @@ html {
.filemanager .header {
font-size: large;
height: 30px;
- background-color: beige;
+ background-color: #002751!important;
text-align: center;
padding-top: 5px;
+ color: white;
+ font-weight: 700;
}
+
#nowWatched {
display: none;
}
.fancybox-slide {
- padding: 20px 50px !important;
+ padding: 20px 50px !important;
+}
+
+/*-------------------------
+ Page loader
+-------------------------*/
+
+.loader,
+.loader:before,
+.loader:after {
+ background: #ffffff;
+ -webkit-animation: load1 1s infinite ease-in-out;
+ animation: load1 1s infinite ease-in-out;
+ width: 1em;
+ height: 4em;
+}
+
+.loader {
+ color: #ffffff;
+ text-indent: -9999em;
+ margin: 88px auto;
+ position: relative;
+ font-size: 11px;
+ -webkit-transform: translateZ(0);
+ -ms-transform: translateZ(0);
+ transform: translateZ(0);
+ -webkit-animation-delay: -0.16s;
+ animation-delay: -0.16s;
+}
+.loader:before,
+.loader:after {
+ position: absolute;
+ top: 0;
+ content: '';
+}
+.loader:before {
+ left: -1.5em;
+ -webkit-animation-delay: -0.32s;
+ animation-delay: -0.32s;
+}
+.loader:after {
+ left: 1.5em;
+}
+@-webkit-keyframes load1 {
+ 0%,
+ 80%,
+ 100% {
+ box-shadow: 0 0;
+ height: 4em;
+ }
+ 40% {
+ box-shadow: 0 -2em;
+ height: 5em;
+ }
+}
+@keyframes load1 {
+ 0%,
+ 80%,
+ 100% {
+ box-shadow: 0 0;
+ height: 4em;
+ }
+ 40% {
+ box-shadow: 0 -2em;
+ height: 5em;
+ }
}
+
/*-------------------------
Breadcrumps
-------------------------*/
.filemanager .breadcrumbs {
color: #ffffff;
- margin-left:20px;
+ margin-left: 20px;
font-size: 13px;
font-weight: 700;
line-height: 35px;
@@ -82,13 +164,12 @@ html {
}
.filemanager .breadcrumbs .arrow {
- color: #6a6a72;
+ color: #6a6a72;
font-size: 13px;
font-weight: 700;
line-height: 20px;
}
-
/*-------------------------
Search box
-------------------------*/
@@ -104,12 +185,13 @@ html {
width: 40px;
height: 40px;
margin-top: 6px;
+ margin-right: 15px;
}
.filemanager .search:before {
content: '';
position: absolute;
- margin-top:12px;
+ margin-top: 12px;
width: 10px;
height: 11px;
border-radius: 50%;
@@ -149,21 +231,27 @@ html {
-webkit-appearance: none;
}
-::-webkit-input-placeholder { /* WebKit browsers */
- color: #4d535e;
-}
-:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
- color: #4d535e;
- opacity: 1;
+::-webkit-input-placeholder {
+ /* WebKit browsers */
+ color: #4d535e;
}
-::-moz-placeholder { /* Mozilla Firefox 19+ */
- color: #4d535e;
- opacity: 1;
+
+:-moz-placeholder {
+ /* Mozilla Firefox 4 to 18 */
+ color: #4d535e;
+ opacity: 1;
}
-:-ms-input-placeholder { /* Internet Explorer 10+ */
- color: #4d535e;
+
+::-moz-placeholder {
+ /* Mozilla Firefox 19+ */
+ color: #4d535e;
+ opacity: 1;
}
+:-ms-input-placeholder {
+ /* Internet Explorer 10+ */
+ color: #4d535e;
+}
/*-------------------------
Content area
@@ -175,8 +263,10 @@ html {
}
.filemanager .data.animated {
- -webkit-animation: showSlowlyElement 700ms; /* Chrome, Safari, Opera */
- animation: showSlowlyElement 700ms; /* Standard syntax */
+ -webkit-animation: showSlowlyElement 700ms;
+ /* Chrome, Safari, Opera */
+ animation: showSlowlyElement 700ms;
+ /* Standard syntax */
}
.filemanager .data li {
@@ -252,20 +342,23 @@ html {
margin: 0 auto;
display: none;
font-family: Arial;
- -webkit-animation: showSlowlyElement 700ms; /* Chrome, Safari, Opera */
- animation: showSlowlyElement 700ms; /* Standard syntax */
+ -webkit-animation: showSlowlyElement 700ms;
+ /* Chrome, Safari, Opera */
+ animation: showSlowlyElement 700ms;
+ /* Standard syntax */
}
.filemanager .nothingfound .nofiles {
margin: 30px auto;
top: 3em;
border-radius: 50%;
- position:relative;
+ position: relative;
background-color: #d72f6e;
width: 11em;
height: 11em;
line-height: 11.4em;
}
+
.filemanager .nothingfound .nofiles:after {
content: '×';
position: absolute;
@@ -287,27 +380,38 @@ html {
}
@media all and (max-width:965px) {
-
.filemanager .data li {
width: 100%;
margin: 5px 0;
}
-
}
/* Chrome, Safari, Opera */
+
@-webkit-keyframes showSlowlyElement {
- 100% { transform: scale(1); opacity: 1; }
- 0% { transform: scale(1.2); opacity: 0; }
+ 100% {
+ transform: scale(1);
+ opacity: 1;
+ }
+ 0% {
+ transform: scale(1.2);
+ opacity: 0;
+ }
}
/* Standard syntax */
+
@keyframes showSlowlyElement {
- 100% { transform: scale(1); opacity: 1; }
- 0% { transform: scale(1.2); opacity: 0; }
+ 100% {
+ transform: scale(1);
+ opacity: 1;
+ }
+ 0% {
+ transform: scale(1.2);
+ opacity: 0;
+ }
}
-
/*-------------------------
Icons
-------------------------*/
@@ -315,42 +419,41 @@ html {
.icon {
font-size: 23px;
}
+
.icon.folder {
display: inline-block;
margin: 1em 0.3em 0em 1em;
background-color: transparent;
overflow: hidden;
}
+
.icon.folder:before {
content: '';
float: left;
- background-color: #7ba1ad;
-
+ background-color: #002751!important;
width: 1.5em;
height: 0.45em;
-
margin-left: 0.07em;
margin-bottom: -0.07em;
-
border-top-left-radius: 0.1em;
border-top-right-radius: 0.1em;
-
- box-shadow: 1.25em 0.25em 0 0em #7ba1ad;
+ box-shadow: 1.25em 0.25em 0 0em #002751!important;
}
+
.icon.folder:after {
content: '';
float: left;
clear: left;
-
- background-color: #a0d4e4;
+ background-color: #01356d!important;
width: 3em;
height: 2.25em;
-
border-radius: 0.1em;
}
+
.icon.folder.full:before {
height: 0.55em;
}
+
.icon.folder.full:after {
height: 2.15em;
box-shadow: 0 -0.12em 0 0 #ffffff;
@@ -369,10 +472,12 @@ html {
overflow: hidden;
box-shadow: 1.74em -2.1em 0 0 #A4A7AC inset;
}
+
.icon.file:first-line {
font-size: 13px;
font-weight: 700;
}
+
.icon.file:after {
content: '';
position: absolute;
@@ -384,129 +489,75 @@ html {
right: -4px;
}
-.icon.file.f-avi,
-.icon.file.f-flv,
-.icon.file.f-mkv,
-.icon.file.f-mov,
-.icon.file.f-mpeg,
-.icon.file.f-mpg,
-.icon.file.f-mp4,
-.icon.file.f-m4v,
-.icon.file.f-wmv {
+.icon.file.f-avi, .icon.file.f-flv, .icon.file.f-mkv, .icon.file.f-mov, .icon.file.f-mpeg, .icon.file.f-mpg, .icon.file.f-mp4, .icon.file.f-m4v, .icon.file.f-wmv {
box-shadow: 1.74em -2.1em 0 0 #7e70ee inset;
}
-.icon.file.f-avi:after,
-.icon.file.f-flv:after,
-.icon.file.f-mkv:after,
-.icon.file.f-mov:after,
-.icon.file.f-mpeg:after,
-.icon.file.f-mpg:after,
-.icon.file.f-mp4:after,
-.icon.file.f-m4v:after,
-.icon.file.f-wmv:after {
+
+.icon.file.f-avi:after, .icon.file.f-flv:after, .icon.file.f-mkv:after, .icon.file.f-mov:after, .icon.file.f-mpeg:after, .icon.file.f-mpg:after, .icon.file.f-mp4:after, .icon.file.f-m4v:after, .icon.file.f-wmv:after {
border-bottom-color: #5649c1;
}
-.icon.file.f-mp2,
-.icon.file.f-mp3,
-.icon.file.f-m3u,
-.icon.file.f-wma,
-.icon.file.f-xls,
-.icon.file.f-xlsx {
+.icon.file.f-mp2, .icon.file.f-mp3, .icon.file.f-m3u, .icon.file.f-wma, .icon.file.f-xls, .icon.file.f-xlsx {
box-shadow: 1.74em -2.1em 0 0 #5bab6e inset;
}
-.icon.file.f-mp2:after,
-.icon.file.f-mp3:after,
-.icon.file.f-m3u:after,
-.icon.file.f-wma:after,
-.icon.file.f-xls:after,
-.icon.file.f-xlsx:after {
+
+.icon.file.f-mp2:after, .icon.file.f-mp3:after, .icon.file.f-m3u:after, .icon.file.f-wma:after, .icon.file.f-xls:after, .icon.file.f-xlsx:after {
border-bottom-color: #448353;
}
-.icon.file.f-doc,
-.icon.file.f-docx,
-.icon.file.f-psd{
+.icon.file.f-doc, .icon.file.f-docx, .icon.file.f-psd {
box-shadow: 1.74em -2.1em 0 0 #03689b inset;
}
-.icon.file.f-doc:after,
-.icon.file.f-docx:after,
-.icon.file.f-psd:after {
+.icon.file.f-doc:after, .icon.file.f-docx:after, .icon.file.f-psd:after {
border-bottom-color: #2980b9;
}
-.icon.file.f-gif,
-.icon.file.f-jpg,
-.icon.file.f-jpeg,
-.icon.file.f-pdf,
-.icon.file.f-png {
+.icon.file.f-gif, .icon.file.f-jpg, .icon.file.f-jpeg, .icon.file.f-pdf, .icon.file.f-png {
box-shadow: 1.74em -2.1em 0 0 #e15955 inset;
}
-.icon.file.f-gif:after,
-.icon.file.f-jpg:after,
-.icon.file.f-jpeg:after,
-.icon.file.f-pdf:after,
-.icon.file.f-png:after {
+
+.icon.file.f-gif:after, .icon.file.f-jpg:after, .icon.file.f-jpeg:after, .icon.file.f-pdf:after, .icon.file.f-png:after {
border-bottom-color: #c6393f;
}
-.icon.file.f-deb,
-.icon.file.f-dmg,
-.icon.file.f-gz,
-.icon.file.f-rar,
-.icon.file.f-zip,
-.icon.file.f-7z {
+.icon.file.f-deb, .icon.file.f-dmg, .icon.file.f-gz, .icon.file.f-rar, .icon.file.f-zip, .icon.file.f-7z {
box-shadow: 1.74em -2.1em 0 0 #867c75 inset;
}
-.icon.file.f-deb:after,
-.icon.file.f-dmg:after,
-.icon.file.f-gz:after,
-.icon.file.f-rar:after,
-.icon.file.f-zip:after,
-.icon.file.f-7z:after {
+
+.icon.file.f-deb:after, .icon.file.f-dmg:after, .icon.file.f-gz:after, .icon.file.f-rar:after, .icon.file.f-zip:after, .icon.file.f-7z:after {
border-bottom-color: #685f58;
}
-.icon.file.f-html,
-.icon.file.f-rtf,
-.icon.file.f-xml,
-.icon.file.f-xhtml {
+.icon.file.f-html, .icon.file.f-rtf, .icon.file.f-xml, .icon.file.f-xhtml {
box-shadow: 1.74em -2.1em 0 0 #a94bb7 inset;
}
-.icon.file.f-html:after,
-.icon.file.f-rtf:after,
-.icon.file.f-xml:after,
-.icon.file.f-xhtml:after {
+
+.icon.file.f-html:after, .icon.file.f-rtf:after, .icon.file.f-xml:after, .icon.file.f-xhtml:after {
border-bottom-color: #d65de8;
}
.icon.file.f-js {
box-shadow: 1.74em -2.1em 0 0 #d0c54d inset;
}
+
.icon.file.f-js:after {
border-bottom-color: #a69f4e;
}
-.icon.file.f-css,
-.icon.file.f-saas,
-.icon.file.f-scss {
+.icon.file.f-css, .icon.file.f-saas, .icon.file.f-scss {
box-shadow: 1.74em -2.1em 0 0 #44afa6 inset;
}
-.icon.file.f-css:after,
-.icon.file.f-saas:after,
-.icon.file.f-scss:after {
+
+.icon.file.f-css:after, .icon.file.f-saas:after, .icon.file.f-scss:after {
border-bottom-color: #30837c;
}
-
/*----------------------------
The Demo Footer
-----------------------------*/
-
footer {
-
width: 770px;
font: normal 16px Arial, Helvetica, sans-serif;
padding: 15px 35px;
@@ -514,28 +565,26 @@ footer {
bottom: 0;
left: 50%;
margin-left: -420px;
-
- background-color:#1f1f1f;
- background-image:linear-gradient(to bottom, #1f1f1f, #101010);
-
- border-radius:2px 2px 0 0;
- box-shadow: 0 -1px 4px rgba(0,0,0,0.4);
- z-index:1;
+ background-color: #1f1f1f;
+ background-image: linear-gradient(to bottom, #1f1f1f, #101010);
+ border-radius: 2px 2px 0 0;
+ box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.4);
+ z-index: 1;
}
-footer a.tz{
- font-weight:normal;
- font-size:16px !important;
- text-decoration:none !important;
- display:block;
+footer a.tz {
+ font-weight: normal;
+ font-size: 16px !important;
+ text-decoration: none !important;
+ display: block;
margin-right: 300px;
- text-overflow:ellipsis;
+ text-overflow: ellipsis;
white-space: nowrap;
- color:#bfbfbf !important;
- z-index:1;
+ color: #bfbfbf !important;
+ z-index: 1;
}
-footer a.tz:before{
+footer a.tz:before {
content: '';
width: 138px;
height: 20px;
@@ -544,17 +593,17 @@ footer a.tz:before{
bottom: -3px;
}
-footer .close{
+footer .close {
position: absolute;
cursor: pointer;
width: 8px;
height: 8px;
- top:10px;
- right:10px;
+ top: 10px;
+ right: 10px;
z-index: 3;
}
-footer #tzine-actions{
+footer #tzine-actions {
position: absolute;
top: 8px;
width: 500px;
@@ -564,7 +613,7 @@ footer #tzine-actions{
z-index: 2;
}
-footer #tzine-actions iframe{
+footer #tzine-actions iframe {
display: inline-block;
height: 21px;
width: 95px;
@@ -574,84 +623,95 @@ footer #tzine-actions iframe{
}
@media (max-width: 1024px) {
- #bsaHolder, footer{ display:none;}
+ #bsaHolder, footer {
+ display: none;
+ }
}
-
-
-
/* Popup Test */
.popup {
- position: relative;
- display: inline-block;
- cursor: pointer;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
+ position: relative;
+ display: inline-block;
+ cursor: pointer;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
}
/* The actual popup */
+
.popup .popuptext {
- visibility: hidden;
- width: 160px;
- background-color: #555;
- color: #fff;
- text-align: center;
- border-radius: 6px;
- padding: 8px 0;
- position: absolute;
- z-index: 1;
- bottom: 125%;
- left: 50%;
- margin-left: -80px;
+ visibility: hidden;
+ width: 160px;
+ background-color: #555;
+ color: #fff;
+ text-align: center;
+ border-radius: 6px;
+ padding: 8px 0;
+ position: absolute;
+ z-index: 1;
+ bottom: 125%;
+ left: 50%;
+ margin-left: -80px;
}
/* Popup arrow */
+
.popup .popuptext::after {
- content: "";
- position: absolute;
- top: 100%;
- left: 50%;
- margin-left: -5px;
- border-width: 5px;
- border-style: solid;
- border-color: #555 transparent transparent transparent;
+ content: "";
+ position: absolute;
+ top: 100%;
+ left: 50%;
+ margin-left: -5px;
+ border-width: 5px;
+ border-style: solid;
+ border-color: #555 transparent transparent transparent;
}
/* Toggle this class - hide and show the popup */
+
.popup .show {
- visibility: visible;
- -webkit-animation: fadeIn 1s;
- animation: fadeIn 1s;
+ visibility: visible;
+ -webkit-animation: fadeIn 1s;
+ animation: fadeIn 1s;
}
/* Add animation (fade in the popup) */
+
@-webkit-keyframes fadeIn {
- from {opacity: 0;}
- to {opacity: 1;}
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
}
@keyframes fadeIn {
- from {opacity: 0;}
- to {opacity:1 ;}
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
}
.button {
- background-color: #373743;
- border: none;
- color: white;
- padding: 15px 32px;
- margin-left: 10px;
- margin-top:40px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- width: 200px;
- font-size: 16px;
- cursor: pointer;
- border-radius: 3px;
+ background-color: #373743;
+ border: none;
+ color: white;
+ padding: 15px 32px;
+ margin-left: 10px;
+ margin-top: 40px;
+ text-align: center;
+ text-decoration: none;
+ display: inline-block;
+ width: 200px;
+ font-size: 16px;
+ cursor: pointer;
+ border-radius: 3px;
cursor: pointer;
box-sizing: border-box;
transition: 0.3s background-color;
@@ -665,16 +725,48 @@ footer #tzine-actions iframe{
min-height: 700px;
}
-/* michu naming fixes:*/
+/* naming fixes:*/
.filemanager .data li .name {
- width: 194px;
- top: 22px;
- white-space: inherit;
- margin-left: 12px;
+ width: 194px;
+ top: 22px;
+ white-space: inherit;
+ margin-left: 12px;
}
.icon.file {
- margin: 0.9em 0.6em 0.8em 0.6em;
+ margin: 0.9em 0.6em 0.8em 0.6em;
/*margin: 5px 0px 0px -60px;*/
}
+
+.fancybox-slide > div:nth-child(2) {
+ display: block !important;
+}
+
+.fancybox-is-sliding .fancybox-slide, .fancybox-slide--current, .fancybox-slide--next, .fancybox-slide--previous {
+ display: flex !important;
+}
+
+.speedControl {
+ width: 2em !important;
+ padding: 2px !important;
+ border: 1px inset silver !important;
+ box-sizing: border-box !important;
+ background: black !important;
+ align-self: stretch !important;
+ margin: 0 0 0 0.5em !important;
+ border-radius: 4px !important;
+ overflow: hidden !important;
+}
+
+.indicator {
+ user-select: none;
+ color: white;
+ height: 25%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background-image: linear-gradient( to left top, #002751, #b3b3b3);
+ font-size: 0.7em;
+ font-family: sans-serif;
+}
\ No newline at end of file
diff --git a/images/background.jpg b/assets/images/background.jpg
similarity index 100%
rename from images/background.jpg
rename to assets/images/background.jpg
diff --git a/assets/images/michu-it_logo_weiss.png b/assets/images/michu-it_logo_weiss.png
new file mode 100644
index 0000000..5dc01bb
Binary files /dev/null and b/assets/images/michu-it_logo_weiss.png differ
diff --git a/assets/js/script.js b/assets/js/script.js
index 94ef303..322916f 100644
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -1,11 +1,11 @@
-$(function(){
+$(function () {
var filemanager = $('.filemanager'),
breadcrumbs = $('.breadcrumbs'),
fileList = filemanager.find('.data');
// Start by fetching the file data from scan.php with an AJAX request
- $.get('scan.php', function(data) {
+ $.get('scan.php', function (data) {
var response = [data],
currentPath = '',
@@ -17,7 +17,7 @@ $(function(){
// This event listener monitors changes on the URL. We use it to
// capture back/forward navigation in the browser.
- $(window).on('hashchange', function(){
+ $(window).on('hashchange', function () {
goto(window.location.hash);
@@ -26,9 +26,8 @@ $(function(){
}).trigger('hashchange');
-
// Hiding and showing the search box
- filemanager.find('.search').click(function(){
+ filemanager.find('.search').click(function () {
var search = $(this);
@@ -36,19 +35,18 @@ $(function(){
search.find('input[type=search]').show().focus();
});
-
// Listening for keyboard input on the search field.
// We are using the "input" event which detects cut and paste
// in addition to keyboard input.
- filemanager.find('input').on('input', function(e){
+ filemanager.find('input').on('input', function (e) {
folders = [];
files = [];
var value = this.value.trim();
- if(value.length) {
+ if (value.length) {
filemanager.addClass('searching');
@@ -60,21 +58,21 @@ $(function(){
window.location.hash = encodeURIComponent(currentPath);
}
- }).on('keyup', function(e){
+ }).on('keyup', function (e) {
// Clicking 'ESC' button triggers focusout and cancels the search
var search = $(this);
- if(e.keyCode == 27) {
+ if (e.keyCode == 27) {
search.trigger('focusout');
}
- }).focusout(function(e){
+ }).focusout(function (e) {
// Cancel the search
var search = $(this);
- if(!search.val().trim().length) {
+ if (!search.val().trim().length) {
window.location.hash = encodeURIComponent(currentPath);
search.hide();
@@ -82,14 +80,13 @@ $(function(){
}
});
-
// Clicking on folders
- fileList.on('click', 'li.folders', function(e){
+ fileList.on('click', 'li.folders', function (e) {
e.preventDefault();
var nextDir = $(this).find('a.folders').attr('href');
- if(filemanager.hasClass('searching')) {
+ if (filemanager.hasClass('searching')) {
// Building the breadcrumbs
breadcrumbsUrls = generateBreadcrumbs(nextDir);
@@ -106,9 +103,8 @@ $(function(){
currentPath = nextDir;
});
-
// Clicking on breadcrumbs
- breadcrumbs.on('click', 'a', function(e){
+ breadcrumbs.on('click', 'a', function (e) {
e.preventDefault();
var index = breadcrumbs.find('a').index($(this)),
@@ -121,19 +117,19 @@ $(function(){
});
function getCookie(cname) {
- var name = cname + "=";
- var decodedCookie = decodeURIComponent(document.cookie);
- var ca = decodedCookie.split(';');
- for(var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') {
- c = c.substring(1);
- }
- if (c.indexOf(name) == 0) {
- return c.substring(name.length, c.length);
+ var name = cname + "=";
+ var decodedCookie = decodeURIComponent(document.cookie);
+ var ca = decodedCookie.split(';');
+ for (var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == ' ') {
+ c = c.substring(1);
+ }
+ if (c.indexOf(name) == 0) {
+ return c.substring(name.length, c.length);
+ }
}
- }
- return "";
+ return "";
}
// Navigates to the given hash (path)
@@ -187,10 +183,10 @@ $(function(){
}
// Splits a file path and turns it into clickable breadcrumbs
- function generateBreadcrumbs(nextDir){
+ function generateBreadcrumbs(nextDir) {
var path = nextDir.split('/').slice(0);
- for(var i=1;i Otherwise delete!!!
-// icon = '',
-// iconpath = 'images/icons/' + f.path + '.png';
-
-
-// function imageExists(image_url){
-
-// var http = new XMLHttpRequest();
-
-// http.open('HEAD', image_url, false);
-// http.send();
-//
-// return http.status != 404;
-// }
-
-// if (imageExists(iconpath)) {
-// icon = '';
-// } else if(itemsLength) {
-// icon = '';
-// }
-
- if(itemsLength) {
+ // Function need to checked by MR! -> Otherwise delete!!!
+ // icon = '',
+ // iconpath = 'images/icons/' + f.path + '.png';
+
+
+ // function imageExists(image_url){
+
+ // var http = new XMLHttpRequest();
+
+ // http.open('HEAD', image_url, false);
+ // http.send();
+ //
+ // return http.status != 404;
+ // }
+
+ // if (imageExists(iconpath)) {
+ // icon = '';
+ // } else if(itemsLength) {
+ // icon = '';
+ // }
+
+ if (itemsLength) {
icon = '';
- }
+ }
- if(itemsLength == 1) {
+ if (itemsLength == 1) {
itemsLength += ' item';
}
- else if(itemsLength > 1) {
+ else if (itemsLength > 1) {
itemsLength += ' items';
}
else {
itemsLength = 'Empty';
}
-
- var folder = $(''+icon+'' + name + ' ' + itemsLength + '');
+
+ var folder = $('' + icon + '' + name + ' ' + itemsLength + '');
fileList.append(folder)
-
+
});
}
- if(scannedFiles.length) {
+ if (scannedFiles.length) {
- scannedFiles.forEach(function(f) {
+ scannedFiles.forEach(function (f) {
var fileSize = bytesToSize(f.size),
name = escapeHTML(f.name),
fileType = name.split('.'),
icon = '';
- fileType = fileType[fileType.length-1];
-
+ fileType = fileType[fileType.length - 1];
+
if (fileType == "db") {
return;
}
if (fileType == "jpg") {
icon = '';
- var file = $(''+icon+''+ name +' '+fileSize+'');
+ var file = $('' + icon + '' + name + ' ' + fileSize + '');
} else if (fileType == "jpeg") {
icon = '';
- var file = $(''+icon+''+ name +' '+fileSize+'');file.appendTo(fileList);
+ var file = $('' + icon + '' + name + ' ' + fileSize + ''); file.appendTo(fileList);
} else if (fileType == "png") {
icon = '';
- var file = $(''+icon+''+ name +' '+fileSize+'');file.appendTo(fileList);
+ var file = $('' + icon + '' + name + ' ' + fileSize + ''); file.appendTo(fileList);
} else if (fileType == "gif") {
icon = '';
- var file = $(''+icon+''+ name +' '+fileSize+'');file.appendTo(fileList);
+ var file = $('' + icon + '' + name + ' ' + fileSize + ''); file.appendTo(fileList);
} else {
- icon = '.'+fileType+'';
- }
-
+ icon = '.' + fileType + '';
+ }
+
if (fileType == "mp4") {
-
+
// adding watched courses to cookie information - dev
//var arr = ['001 - Course Introduction.mp4', 'bar', 'Home/IT Basics and Sysadmin Topics/DNS and BIND Deep Dive/004 - DNS Concepts - Terms and Definitions.mp4'];
//var json_str = JSON.stringify(arr);
//setCookie('watchedVideoArray', json_str);
-
-
-
- var style="";
+
+ var style = "";
// https://stackoverflow.com/questions/2980143/i-want-to-store-javascript-array-as-a-cookie/2980163
// get saved cookie information
- var json_str=getCookie("watchedVideoArray");
+ var json_str = getCookie("watchedVideoArray");
if (json_str != "") {
var arr_watchstatus = JSON.parse(json_str);
if (arr_watchstatus.includes(f.path)) {
- style='style="display: inline;"';
+ style = 'style="display: inline;"';
}
}
-
- var file = $(''+icon+''+ name +' '+fileSize+'❌✅');
-
+
+ var file = $('' + icon + '' + name + ' ' + fileSize + '❌✅');
+
} else {
- var file = $(''+icon+''+ name +' '+fileSize+'');
+ var file = $('' + icon + '' + name + ' ' + fileSize + '');
}
-
+
file.appendTo(fileList);
});
}
-
// Generate the breadcrumbs
var url = '';
- if(filemanager.hasClass('searching')){
+ if (filemanager.hasClass('searching')) {
url = 'Search results: ';
fileList.removeClass('animated');
@@ -405,29 +398,28 @@ $(function(){
var name = u.split('/');
if (i !== breadcrumbsUrls.length - 1) {
- url += '' + name[name.length-1] + ' → ';
- document.getElementById("backButton").href = "#"+u;
+ url += '' + name[name.length - 1] + ' → ';
+ document.getElementById("backButton").href = "#" + u;
}
else {
- url += '' + name[name.length-1] + '';
+ url += '' + name[name.length - 1] + '';
}
});
}
breadcrumbs.text('').append(url);
- // Show the generated elements
- fileList.fadeIn();
+ // Show the generated elements and hide loader
+ document.querySelector(".loader").style.display = "none";
+ fileList.fadeIn();
}
-
// This function escapes special html characters in names
function escapeHTML(text) {
- return text.replace(/\&/g,'&').replace(/\/g,'>');
+ return text.replace(/\&/g, '&').replace(/\/g, '>');
}
-
// Convert file sizes from bytes to human readable units
function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
diff --git a/index.php b/index.php
index 5fbe93c..bea3a31 100644
--- a/index.php
+++ b/index.php
@@ -1,109 +1,154 @@
+require(__DIR__ . '/login.php');
+define('PROJECT_ROOT', getcwd());
+?>
-
-
- MIT Learning Manager 2.5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Go Back
-
Home
-
-
-
-
-
Error! - No files here.
-
-
+
+
+
+
Michu IT Learning Manager 2.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Go Back
+
Home
+
+
+
Loading...
+
+
+
+
+
Error! - No files here.
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
+ });
+
+
+
+
\ No newline at end of file
diff --git a/login.php b/login.php
index b131f5c..c18caeb 100644
--- a/login.php
+++ b/login.php
@@ -1,36 +1,39 @@
-
-
-
-
-
Please provide password!
-
-
-
-
-
-
-
-
+ if (!function_exists('showLoginPasswordProtect')) {
+ // show login form
+ function showLoginPasswordProtect($error_msg)
+ {
+?>
+
+
-
-
-
-
-
+
+
+ Please provide MLP
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+$val) {
- $lp = (USE_USERNAME ? $key : '') .'%'.$val;
- if ($_COOKIE['verify'] == md5($lp)) {
- $found = true;
- // prolong timeout
- if (TIMEOUT_CHECK_ACTIVITY) {
- setcookie("verify", md5($lp), $timeout, '/');
- }
- break;
+ $login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
+ $pass = $_POST['access_password'];
+ if (
+ !USE_USERNAME && !in_array($pass, $LOGIN_INFORMATION)
+ || (USE_USERNAME && (!array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass))
+ ) {
+ showLoginPasswordProtect("wrong password!");
+ } else {
+ // set cookie if password was validated
+ setcookie("verify", md5($login . '%' . $pass), $timeout, '/');
+
+ // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed
+ // So need to clear password protector variables
+ unset($_POST['access_login']);
+ unset($_POST['access_password']);
+ unset($_POST['Submit']);
+ //header('Location: ' . $logoutURL . "/$script_path");
+ header('Location: ' . $logoutURL . "/study");
+ }
+ } else {
+ // check if password cookie is set
+ if (!isset($_COOKIE['verify'])) {
+ showLoginPasswordProtect("");
+ }
+ // check if cookie is good
+ $found = false;
+ foreach ($LOGIN_INFORMATION as $key => $val) {
+ $lp = (USE_USERNAME ? $key : '') . '%' . $val;
+ if ($_COOKIE['verify'] == md5($lp)) {
+ $found = true;
+ // prolong timeout
+ if (TIMEOUT_CHECK_ACTIVITY) {
+ setcookie("verify", md5($lp), $timeout, '/');
+ }
+ break;
+ }
+ }
+ if (!$found) {
+ showLoginPasswordProtect("");
}
- }
- if (!$found) {
- showLoginPasswordProtect("");
- }
}
}
?>
\ No newline at end of file
diff --git a/manage.php b/manage.php
new file mode 100644
index 0000000..c885a69
--- /dev/null
+++ b/manage.php
@@ -0,0 +1,4110 @@
+ 'Password', 'Username2' => 'Password2', ...)
+$auth_users = array(
+ 'admin' => '$2y$10$HFP49dcc1ZDL3kqIknYGFOykI7HxIk3eW7BMtyUn03D8m56R/4pLe' //,
+ //'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO'
+);
+
+//set application theme
+//options - 'light' and 'dark'
+$theme = 'light';
+
+// Readonly users
+// e.g. array('users', 'guest', ...)
+$readonly_users = array(
+ 'user'
+);
+
+// Enable highlight.js (https://highlightjs.org/) on view's page
+$use_highlightjs = false;
+
+// highlight.js style
+// for dark theme use 'ir-black'
+$highlightjs_style = 'vs';
+
+// Enable ace.js (https://ace.c9.io/) on view's page
+$edit_files = false;
+
+// Default timezone for date() and time()
+// Doc - http://php.net/manual/en/timezones.php
+$default_timezone = 'Europe/Zurich'; // UTC
+
+// Root path for file manager
+// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
+$root_path = $_SERVER['DOCUMENT_ROOT'].'Home';
+
+// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
+// Will not working if $root_path will be outside of server document root
+$root_url = '';
+
+// Server hostname. Can set manually if wrong
+$http_host = $_SERVER['HTTP_HOST'];
+
+// user specific directories
+// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...)
+$directories_users = array();
+
+// input encoding for iconv
+$iconv_input_encoding = 'UTF-8';
+
+// date() format for file modification date
+// Doc - https://www.php.net/manual/en/function.date.php
+$datetime_format = 'Y-m-d H:i';
+
+// Allowed file extensions for create and rename files
+// e.g. 'txt,html,css,js'
+$allowed_file_extensions = '';
+
+// Allowed file extensions for upload files
+// e.g. 'gif,png,jpg,html,txt'
+$allowed_upload_extensions = '';
+
+// Favicon path. This can be either a full url to an .PNG image, or a path based on the document root.
+// full path, e.g http://example.com/favicon.png
+// local path, e.g images/icons/favicon.png
+$favicon_path = 'favicon.ico';
+
+// Files and folders to excluded from listing
+// e.g. array('myfile.html', 'personal-folder', '*.php', ...)
+$exclude_items = array();
+
+// Online office Docs Viewer
+// Availabe rules are 'google', 'microsoft' or false
+// google => View documents using Google Docs Viewer
+// microsoft => View documents using Microsoft Web Apps Viewer
+// false => disable online doc viewer
+$online_viewer = 'false';
+
+// Sticky Nav bar
+// true => enable sticky header
+// false => disable sticky header
+$sticky_navbar = true;
+
+// Maximum file upload size
+// Increase the following values in php.ini to work properly
+// memory_limit, upload_max_filesize, post_max_size
+$max_upload_size_bytes = 6000;
+
+// Possible rules are 'OFF', 'AND' or 'OR'
+// OFF => Don't check connection IP, defaults to OFF
+// AND => Connection must be on the whitelist, and not on the blacklist
+// OR => Connection must be on the whitelist, or not on the blacklist
+$ip_ruleset = 'OFF';
+
+// Should users be notified of their block?
+$ip_silent = true;
+
+// IP-addresses, both ipv4 and ipv6
+$ip_whitelist = array(
+ '127.0.0.1', // local ipv4
+ '::1' // local ipv6
+);
+
+// IP-addresses, both ipv4 and ipv6
+$ip_blacklist = array(
+ '0.0.0.0', // non-routable meta ipv4
+ '::' // non-routable meta ipv6
+);
+
+// if User has the customized config file, try to use it to override the default config above
+$config_file = './config.php';
+if (is_readable($config_file)) {
+ @include($config_file);
+}
+
+// --- EDIT BELOW CAREFULLY OR DO NOT EDIT AT ALL ---
+
+// max upload file size
+define('MAX_UPLOAD_SIZE', $max_upload_size_bytes);
+
+define('FM_THEME', $theme);
+
+// private key and session name to store to the session
+if ( !defined( 'FM_SESSION_ID')) {
+ define('FM_SESSION_ID', 'filemanager');
+}
+
+// Configuration
+$cfg = new FM_Config();
+
+// Default language
+$lang = isset($cfg->data['lang']) ? $cfg->data['lang'] : 'en';
+
+// Show or hide files and folders that starts with a dot
+$show_hidden_files = isset($cfg->data['show_hidden']) ? $cfg->data['show_hidden'] : true;
+
+// PHP error reporting - false = Turns off Errors, true = Turns on Errors
+$report_errors = isset($cfg->data['error_reporting']) ? $cfg->data['error_reporting'] : true;
+
+// Hide Permissions and Owner cols in file-listing
+$hide_Cols = isset($cfg->data['hide_Cols']) ? $cfg->data['hide_Cols'] : true;
+
+// Show directory size: true or speedup output: false
+$calc_folder = isset($cfg->data['calc_folder']) ? $cfg->data['calc_folder'] : true;
+
+//available languages
+$lang_list = array(
+ 'en' => 'English'
+);
+
+if ($report_errors == true) {
+ @ini_set('error_reporting', E_ALL);
+ @ini_set('display_errors', 1);
+} else {
+ @ini_set('error_reporting', E_ALL);
+ @ini_set('display_errors', 0);
+}
+
+// if fm included
+if (defined('FM_EMBED')) {
+ $use_auth = false;
+ $sticky_navbar = false;
+} else {
+ @set_time_limit(600);
+
+ date_default_timezone_set($default_timezone);
+
+ ini_set('default_charset', 'UTF-8');
+ if (version_compare(PHP_VERSION, '5.6.0', '<') && function_exists('mb_internal_encoding')) {
+ mb_internal_encoding('UTF-8');
+ }
+ if (function_exists('mb_regex_encoding')) {
+ mb_regex_encoding('UTF-8');
+ }
+
+ session_cache_limiter('');
+ session_name(FM_SESSION_ID );
+ function session_error_handling_function($code, $msg, $file, $line) {
+ // Permission denied for default session, try to create a new one
+ if ($code == 2) {
+ session_abort();
+ session_id(session_create_id());
+ @session_start();
+ }
+ }
+ set_error_handler('session_error_handling_function');
+ session_start();
+ restore_error_handler();
+}
+
+if (empty($auth_users)) {
+ $use_auth = false;
+}
+
+$is_https = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)
+ || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
+
+// update $root_url based on user specific directories
+if (isset($_SESSION[FM_SESSION_ID]['logged']) && !empty($directories_users[$_SESSION[FM_SESSION_ID]['logged']])) {
+ $wd = fm_clean_path(dirname($_SERVER['PHP_SELF']));
+ $root_url = $root_url.$wd.DIRECTORY_SEPARATOR.$directories_users[$_SESSION[FM_SESSION_ID]['logged']];
+}
+// clean $root_url
+$root_url = fm_clean_path($root_url);
+
+// abs path for site
+defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : ''));
+defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']);
+
+// logout
+if (isset($_GET['logout'])) {
+ unset($_SESSION[FM_SESSION_ID]['logged']);
+ fm_redirect(FM_SELF_URL);
+}
+
+// Show image here
+if (isset($_GET['img'])) {
+ fm_show_image($_GET['img']);
+}
+
+// Validate connection IP
+if($ip_ruleset != 'OFF'){
+ $clientIp = $_SERVER['REMOTE_ADDR'];
+
+ $proceed = false;
+
+ $whitelisted = in_array($clientIp, $ip_whitelist);
+ $blacklisted = in_array($clientIp, $ip_blacklist);
+
+ if($ip_ruleset == 'AND'){
+ if($whitelisted == true && $blacklisted == false){
+ $proceed = true;
+ }
+ } else
+ if($ip_ruleset == 'OR'){
+ if($whitelisted == true || $blacklisted == false){
+ $proceed = true;
+ }
+ }
+
+ if($proceed == false){
+ trigger_error('User connection denied from: ' . $clientIp, E_USER_WARNING);
+
+ if($ip_silent == false){
+ fm_set_msg('Access denied. IP restriction applicable', 'error');
+ fm_show_header_login();
+ fm_show_message();
+ }
+
+ exit();
+ }
+}
+
+// Auth
+if ($use_auth) {
+ if (isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ID]['logged']])) {
+ // Logged
+ } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'])) {
+ // Logging In
+ sleep(1);
+ if(function_exists('password_verify')) {
+ if (isset($auth_users[$_POST['fm_usr']]) && isset($_POST['fm_pwd']) && password_verify($_POST['fm_pwd'], $auth_users[$_POST['fm_usr']])) {
+ $_SESSION[FM_SESSION_ID]['logged'] = $_POST['fm_usr'];
+ fm_set_msg(lng('You are logged in'));
+ fm_redirect(FM_SELF_URL . '?p=');
+ } else {
+ unset($_SESSION[FM_SESSION_ID]['logged']);
+ fm_set_msg(lng('Login failed. Invalid username or password'), 'error');
+ fm_redirect(FM_SELF_URL);
+ }
+ } else {
+ fm_set_msg(lng('password_hash not supported, Upgrade PHP version'), 'error');;
+ }
+ } else {
+ // Form
+ unset($_SESSION[FM_SESSION_ID]['logged']);
+ fm_show_header_login();
+ ?>
+
+
+ Root path \"{$root_path}\" not found!";
+ exit;
+}
+
+defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files);
+defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path);
+defined('FM_LANG') || define('FM_LANG', $lang);
+defined('FM_FILE_EXTENSION') || define('FM_FILE_EXTENSION', $allowed_file_extensions);
+defined('FM_UPLOAD_EXTENSION') || define('FM_UPLOAD_EXTENSION', $allowed_upload_extensions);
+defined('FM_EXCLUDE_ITEMS') || define('FM_EXCLUDE_ITEMS', $exclude_items);
+defined('FM_DOC_VIEWER') || define('FM_DOC_VIEWER', $online_viewer);
+define('FM_READONLY', $use_auth && !empty($readonly_users) && isset($_SESSION[FM_SESSION_ID]['logged']) && in_array($_SESSION[FM_SESSION_ID]['logged'], $readonly_users));
+define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\');
+
+// always use ?p=
+if (!isset($_GET['p']) && empty($_FILES)) {
+ fm_redirect(FM_SELF_URL . '?p=');
+}
+
+// get path
+$p = isset($_GET['p']) ? $_GET['p'] : (isset($_POST['p']) ? $_POST['p'] : '');
+
+// clean path
+$p = fm_clean_path($p);
+
+// for ajax request - save
+$input = file_get_contents('php://input');
+$_POST = (strpos($input, 'ajax') != FALSE && strpos($input, 'save') != FALSE) ? json_decode($input, true) : $_POST;
+
+// instead globals vars
+define('FM_PATH', $p);
+define('FM_USE_AUTH', $use_auth);
+define('FM_EDIT_FILE', $edit_files);
+defined('FM_ICONV_INPUT_ENC') || define('FM_ICONV_INPUT_ENC', $iconv_input_encoding);
+defined('FM_USE_HIGHLIGHTJS') || define('FM_USE_HIGHLIGHTJS', $use_highlightjs);
+defined('FM_HIGHLIGHTJS_STYLE') || define('FM_HIGHLIGHTJS_STYLE', $highlightjs_style);
+defined('FM_DATETIME_FORMAT') || define('FM_DATETIME_FORMAT', $datetime_format);
+
+unset($p, $use_auth, $iconv_input_encoding, $use_highlightjs, $highlightjs_style);
+
+/*************************** ACTIONS ***************************/
+
+// AJAX Request
+if (isset($_POST['ajax']) && !FM_READONLY) {
+
+ // save
+ if (isset($_POST['type']) && $_POST['type'] == "save") {
+ // get current path
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+ // check path
+ if (!is_dir($path)) {
+ fm_redirect(FM_SELF_URL . '?p=');
+ }
+ $file = $_GET['edit'];
+ $file = fm_clean_path($file);
+ $file = str_replace('/', '', $file);
+ if ($file == '' || !is_file($path . '/' . $file)) {
+ fm_set_msg('File not found', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+ header('X-XSS-Protection:0');
+ $file_path = $path . '/' . $file;
+
+ $writedata = $_POST['content'];
+ $fd = fopen($file_path, "w");
+ $write_results = @fwrite($fd, $writedata);
+ fclose($fd);
+ if ($write_results === false){
+ header("HTTP/1.1 500 Internal Server Error");
+ die("Could Not Write File! - Check Permissions / Ownership");
+ }
+ die(true);
+ }
+
+ //search : get list of files from the current folder
+ if(isset($_POST['type']) && $_POST['type']=="search") {
+ $dir = FM_ROOT_PATH;
+ $response = scan(fm_clean_path($_POST['path']), $_POST['content']);
+ echo json_encode($response);
+ exit();
+ }
+
+ // backup files
+ if (isset($_POST['type']) && $_POST['type'] == "backup" && !empty($_POST['file'])) {
+ $fileName = $_POST['file'];
+ $fullPath = FM_ROOT_PATH . '/';
+ if (!empty($_POST['path'])) {
+ $relativeDirPath = fm_clean_path($_POST['path']);
+ $fullPath .= "{$relativeDirPath}/";
+ }
+ $date = date("dMy-His");
+ $newFileName = "{$fileName}-{$date}.bak";
+ $fullyQualifiedFileName = $fullPath . $fileName;
+ try {
+ if (!file_exists($fullyQualifiedFileName)) {
+ throw new Exception("File {$fileName} not found");
+ }
+ if (copy($fullyQualifiedFileName, $fullPath . $newFileName)) {
+ echo "Backup {$newFileName} created";
+ } else {
+ throw new Exception("Could not copy file {$fileName}");
+ }
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+ }
+
+ // Save Config
+ if (isset($_POST['type']) && $_POST['type'] == "settings") {
+ global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $calc_folder;
+ $newLng = $_POST['js-language'];
+ fm_get_translations([]);
+ if (!array_key_exists($newLng, $lang_list)) {
+ $newLng = 'en';
+ }
+
+ $erp = isset($_POST['js-error-report']) && $_POST['js-error-report'] == "true" ? true : false;
+ $shf = isset($_POST['js-show-hidden']) && $_POST['js-show-hidden'] == "true" ? true : false;
+ $hco = isset($_POST['js-hide-cols']) && $_POST['js-hide-cols'] == "true" ? true : false;
+ $caf = isset($_POST['js-calc-folder']) && $_POST['js-calc-folder'] == "true" ? true : false;
+
+ if ($cfg->data['lang'] != $newLng) {
+ $cfg->data['lang'] = $newLng;
+ $lang = $newLng;
+ }
+ if ($cfg->data['error_reporting'] != $erp) {
+ $cfg->data['error_reporting'] = $erp;
+ $report_errors = $erp;
+ }
+ if ($cfg->data['show_hidden'] != $shf) {
+ $cfg->data['show_hidden'] = $shf;
+ $show_hidden_files = $shf;
+ }
+ if ($cfg->data['show_hidden'] != $shf) {
+ $cfg->data['show_hidden'] = $shf;
+ $show_hidden_files = $shf;
+ }
+ if ($cfg->data['hide_Cols'] != $hco) {
+ $cfg->data['hide_Cols'] = $hco;
+ $hide_Cols = $hco;
+ }
+ if ($cfg->data['calc_folder'] != $caf) {
+ $cfg->data['calc_folder'] = $caf;
+ $calc_folder = $caf;
+ }
+ $cfg->save();
+ echo true;
+ }
+
+ // new password hash
+ if (isset($_POST['type']) && $_POST['type'] == "pwdhash") {
+ $res = isset($_POST['inputPassword2']) && !empty($_POST['inputPassword2']) ? password_hash($_POST['inputPassword2'], PASSWORD_DEFAULT) : '';
+ echo $res;
+ }
+
+ //upload using url
+ if(isset($_POST['type']) && $_POST['type'] == "upload" && !empty($_REQUEST["uploadurl"])) {
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ $url = !empty($_REQUEST["uploadurl"]) && preg_match("|^http(s)?://.+$|", stripslashes($_REQUEST["uploadurl"])) ? stripslashes($_REQUEST["uploadurl"]) : null;
+ $use_curl = false;
+ $temp_file = tempnam(sys_get_temp_dir(), "upload-");
+ $fileinfo = new stdClass();
+ $fileinfo->name = trim(basename($url), ".\x00..\x20");
+
+ $allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;
+ $ext = strtolower(pathinfo($fileinfo->name, PATHINFO_EXTENSION));
+ $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;
+
+ function event_callback ($message) {
+ global $callback;
+ echo json_encode($message);
+ }
+
+ function get_file_path () {
+ global $path, $fileinfo, $temp_file;
+ return $path."/".basename($fileinfo->name);
+ }
+
+ $err = false;
+
+ if(!$isFileAllowed) {
+ $err = array("message" => "File extension is not allowed");
+ event_callback(array("fail" => $err));
+ exit();
+ }
+
+ if (!$url) {
+ $success = false;
+ } else if ($use_curl) {
+ @$fp = fopen($temp_file, "w");
+ @$ch = curl_init($url);
+ curl_setopt($ch, CURLOPT_NOPROGRESS, false );
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_FILE, $fp);
+ @$success = curl_exec($ch);
+ $curl_info = curl_getinfo($ch);
+ if (!$success) {
+ $err = array("message" => curl_error($ch));
+ }
+ @curl_close($ch);
+ fclose($fp);
+ $fileinfo->size = $curl_info["size_download"];
+ $fileinfo->type = $curl_info["content_type"];
+ } else {
+ $ctx = stream_context_create();
+ @$success = copy($url, $temp_file, $ctx);
+ if (!$success) {
+ $err = error_get_last();
+ }
+ }
+
+ if ($success) {
+ $success = rename($temp_file, get_file_path());
+ }
+
+ if ($success) {
+ event_callback(array("done" => $fileinfo));
+ } else {
+ unlink($temp_file);
+ if (!$err) {
+ $err = array("message" => "Invalid url parameter");
+ }
+ event_callback(array("fail" => $err));
+ }
+ }
+
+ exit();
+}
+
+// Delete file / folder
+if (isset($_GET['del']) && !FM_READONLY) {
+ $del = str_replace( '/', '', fm_clean_path( $_GET['del'] ) );
+ if ($del != '' && $del != '..' && $del != '.') {
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+ $is_dir = is_dir($path . '/' . $del);
+ if (fm_rdelete($path . '/' . $del)) {
+ $msg = $is_dir ? 'Folder %s deleted' : 'File %s deleted';
+ fm_set_msg(sprintf($msg, fm_enc($del)));
+ } else {
+ $msg = $is_dir ? 'Folder %s not deleted' : 'File %s not deleted';
+ fm_set_msg(sprintf($msg, fm_enc($del)), 'error');
+ }
+ } else {
+ fm_set_msg('Invalid file or folder name', 'error');
+ }
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Create folder
+if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) {
+ $type = $_GET['type'];
+ $new = str_replace( '/', '', fm_clean_path( strip_tags( $_GET['new'] ) ) );
+ if (fm_isvalid_filename($new) && $new != '' && $new != '..' && $new != '.') {
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+ if ($_GET['type'] == "file") {
+ if (!file_exists($path . '/' . $new)) {
+ if(fm_is_valid_ext($new)) {
+ @fopen($path . '/' . $new, 'w') or die('Cannot open file: ' . $new);
+ fm_set_msg(sprintf(lng('File').' %s '.lng('Created'), fm_enc($new)));
+ } else {
+ fm_set_msg('File extension is not allowed', 'error');
+ }
+ } else {
+ fm_set_msg(sprintf('File %s already exists', fm_enc($new)), 'alert');
+ }
+ } else {
+ if (fm_mkdir($path . '/' . $new, false) === true) {
+ fm_set_msg(sprintf(lng('Folder').' %s '.lng('Created'), $new));
+ } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) {
+ fm_set_msg(sprintf('Folder %s already exists', fm_enc($new)), 'alert');
+ } else {
+ fm_set_msg(sprintf('Folder %s not created', fm_enc($new)), 'error');
+ }
+ }
+ } else {
+ fm_set_msg('Invalid characters in file or folder name', 'error');
+ }
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Copy folder / file
+if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
+ // from
+ $copy = $_GET['copy'];
+ $copy = fm_clean_path($copy);
+ // empty path
+ if ($copy == '') {
+ fm_set_msg('Source path not defined', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+ // abs path from
+ $from = FM_ROOT_PATH . '/' . $copy;
+ // abs path to
+ $dest = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $dest .= '/' . FM_PATH;
+ }
+ $dest .= '/' . basename($from);
+ // move?
+ $move = isset($_GET['move']);
+ // copy/move/duplicate
+ if ($from != $dest) {
+ $msg_from = trim(FM_PATH . '/' . basename($from), '/');
+ if ($move) { // Move and to != from so just perform move
+ $rename = fm_rename($from, $dest);
+ if ($rename) {
+ fm_set_msg(sprintf('Moved from %s to %s', fm_enc($copy), fm_enc($msg_from)));
+ } elseif ($rename === null) {
+ fm_set_msg('File or folder with this path already exists', 'alert');
+
+ } else {
+ fm_set_msg(sprintf('Error while moving from %s to %s', fm_enc($copy), fm_enc($msg_from)), 'error');
+ }
+ } else { // Not move and to != from so copy with original name
+ if (fm_rcopy($from, $dest)) {
+ fm_set_msg(sprintf('Copied from %s to %s', fm_enc($copy), fm_enc($msg_from)));
+ } else {
+ fm_set_msg(sprintf('Error while copying from %s to %s', fm_enc($copy), fm_enc($msg_from)), 'error');
+ }
+ }
+ } else {
+ if (!$move){ //Not move and to = from so duplicate
+ $msg_from = trim(FM_PATH . '/' . basename($from), '/');
+ $fn_parts = pathinfo($from);
+ $extension_suffix = '';
+ if(!is_dir($from)){
+ $extension_suffix = '.'.$fn_parts['extension'];
+ }
+ //Create new name for duplicate
+ $fn_duplicate = $fn_parts['dirname'].'/'.$fn_parts['filename'].'-'.date('YmdHis').$extension_suffix;
+ $loop_count = 0;
+ $max_loop = 1000;
+ // Check if a file with the duplicate name already exists, if so, make new name (edge case...)
+ while(file_exists($fn_duplicate) & $loop_count < $max_loop){
+ $fn_parts = pathinfo($fn_duplicate);
+ $fn_duplicate = $fn_parts['dirname'].'/'.$fn_parts['filename'].'-copy'.$extension_suffix;
+ $loop_count++;
+ }
+ if (fm_rcopy($from, $fn_duplicate, False)) {
+ fm_set_msg(sprintf('Copyied from %s to %s', fm_enc($copy), fm_enc($fn_duplicate)));
+ } else {
+ fm_set_msg(sprintf('Error while copying from %s to %s', fm_enc($copy), fm_enc($fn_duplicate)), 'error');
+ }
+ }
+ else{
+ fm_set_msg('Paths must be not equal', 'alert');
+ }
+ }
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Mass copy files/ folders
+if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY) {
+ // from
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+ // to
+ $copy_to_path = FM_ROOT_PATH;
+ $copy_to = fm_clean_path($_POST['copy_to']);
+ if ($copy_to != '') {
+ $copy_to_path .= '/' . $copy_to;
+ }
+ if ($path == $copy_to_path) {
+ fm_set_msg('Paths must be not equal', 'alert');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+ if (!is_dir($copy_to_path)) {
+ if (!fm_mkdir($copy_to_path, true)) {
+ fm_set_msg('Unable to create destination folder', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+ }
+ // move?
+ $move = isset($_POST['move']);
+ // copy/move
+ $errors = 0;
+ $files = $_POST['file'];
+ if (is_array($files) && count($files)) {
+ foreach ($files as $f) {
+ if ($f != '') {
+ // abs path from
+ $from = $path . '/' . $f;
+ // abs path to
+ $dest = $copy_to_path . '/' . $f;
+ // do
+ if ($move) {
+ $rename = fm_rename($from, $dest);
+ if ($rename === false) {
+ $errors++;
+ }
+ } else {
+ if (!fm_rcopy($from, $dest)) {
+ $errors++;
+ }
+ }
+ }
+ }
+ if ($errors == 0) {
+ $msg = $move ? 'Selected files and folders moved' : 'Selected files and folders copied';
+ fm_set_msg($msg);
+ } else {
+ $msg = $move ? 'Error while moving items' : 'Error while copying items';
+ fm_set_msg($msg, 'error');
+ }
+ } else {
+ fm_set_msg('Nothing selected', 'alert');
+ }
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Rename
+if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) {
+ // old name
+ $old = $_GET['ren'];
+ $old = fm_clean_path($old);
+ $old = str_replace('/', '', $old);
+ // new name
+ $new = $_GET['to'];
+ $new = fm_clean_path(strip_tags($new));
+ $new = str_replace('/', '', $new);
+ // path
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+ // rename
+ if (fm_isvalid_filename($new) && $old != '' && $new != '') {
+ if (fm_rename($path . '/' . $old, $path . '/' . $new)) {
+ fm_set_msg(sprintf('Renamed from %s to %s', fm_enc($old), fm_enc($new)));
+ } else {
+ fm_set_msg(sprintf('Error while renaming from %s to %s', fm_enc($old), fm_enc($new)), 'error');
+ }
+ } else {
+ fm_set_msg('Invalid characters in file name', 'error');
+ }
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Download
+if (isset($_GET['dl'])) {
+ $dl = $_GET['dl'];
+ $dl = fm_clean_path($dl);
+ $dl = str_replace('/', '', $dl);
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+ if ($dl != '' && is_file($path . '/' . $dl)) {
+ fm_download_file($path . '/' . $dl, $dl, 1024);
+ exit;
+ } else {
+ fm_set_msg('File not found', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+}
+
+// Upload
+if (!empty($_FILES) && !FM_READONLY) {
+ $override_file_name = false;
+ $f = $_FILES;
+ $path = FM_ROOT_PATH;
+ $ds = DIRECTORY_SEPARATOR;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ $errors = 0;
+ $uploads = 0;
+ $allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;
+ $response = array (
+ 'status' => 'error',
+ 'info' => 'Oops! Try again'
+ );
+
+ $filename = $f['file']['name'];
+ $tmp_name = $f['file']['tmp_name'];
+ $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+ $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;
+
+ $targetPath = $path . $ds;
+ if ( is_writable($targetPath) ) {
+ $fullPath = $path . '/' . $_REQUEST['fullpath'];
+ $folder = substr($fullPath, 0, strrpos($fullPath, "/"));
+
+ if(file_exists ($fullPath) && !$override_file_name) {
+ $ext_1 = $ext ? '.'.$ext : '';
+ $fullPath = str_replace($ext_1, '', $fullPath) .'_'. date('ymdHis'). $ext_1;
+ }
+
+ if (!is_dir($folder)) {
+ $old = umask(0);
+ mkdir($folder, 0777, true);
+ umask($old);
+ }
+
+ if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) {
+ if (move_uploaded_file($tmp_name, $fullPath)) {
+ // Be sure that the file has been uploaded
+ if ( file_exists($fullPath) ) {
+ $response = array (
+ 'status' => 'success',
+ 'info' => "file upload successful"
+ );
+ } else {
+ $response = array (
+ 'status' => 'error',
+ 'info' => 'Couldn\'t upload the requested file.'
+ );
+ }
+ } else {
+ $response = array (
+ 'status' => 'error',
+ 'info' => "Error while uploading files. Uploaded files $uploads",
+ );
+ }
+ }
+ } else {
+ $response = array (
+ 'status' => 'error',
+ 'info' => 'The specified folder for upload isn\'t writeable.'
+ );
+ }
+ // Return the response
+ echo json_encode($response);
+ exit();
+}
+
+// Mass deleting
+if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) {
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ $errors = 0;
+ $files = $_POST['file'];
+ if (is_array($files) && count($files)) {
+ foreach ($files as $f) {
+ if ($f != '') {
+ $new_path = $path . '/' . $f;
+ if (!fm_rdelete($new_path)) {
+ $errors++;
+ }
+ }
+ }
+ if ($errors == 0) {
+ fm_set_msg('Selected files and folder deleted');
+ } else {
+ fm_set_msg('Error while deleting items', 'error');
+ }
+ } else {
+ fm_set_msg('Nothing selected', 'alert');
+ }
+
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Pack files
+if (isset($_POST['group']) && (isset($_POST['zip']) || isset($_POST['tar'])) && !FM_READONLY) {
+ $path = FM_ROOT_PATH;
+ $ext = 'zip';
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ //set pack type
+ $ext = isset($_POST['tar']) ? 'tar' : 'zip';
+
+
+ if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
+ fm_set_msg('Operations with archives are not available', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+
+ $files = $_POST['file'];
+ if (!empty($files)) {
+ chdir($path);
+
+ if (count($files) == 1) {
+ $one_file = reset($files);
+ $one_file = basename($one_file);
+ $zipname = $one_file . '_' . date('ymd_His') . '.'.$ext;
+ } else {
+ $zipname = 'archive_' . date('ymd_His') . '.'.$ext;
+ }
+
+ if($ext == 'zip') {
+ $zipper = new FM_Zipper();
+ $res = $zipper->create($zipname, $files);
+ } elseif ($ext == 'tar') {
+ $tar = new FM_Zipper_Tar();
+ $res = $tar->create($zipname, $files);
+ }
+
+ if ($res) {
+ fm_set_msg(sprintf('Archive %s created', fm_enc($zipname)));
+ } else {
+ fm_set_msg('Archive not created', 'error');
+ }
+ } else {
+ fm_set_msg('Nothing selected', 'alert');
+ }
+
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Unpack
+if (isset($_GET['unzip']) && !FM_READONLY) {
+ $unzip = $_GET['unzip'];
+ $unzip = fm_clean_path($unzip);
+ $unzip = str_replace('/', '', $unzip);
+ $isValid = false;
+
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ if ($unzip != '' && is_file($path . '/' . $unzip)) {
+ $zip_path = $path . '/' . $unzip;
+ $ext = pathinfo($zip_path, PATHINFO_EXTENSION);
+ $isValid = true;
+ } else {
+ fm_set_msg('File not found', 'error');
+ }
+
+
+ if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
+ fm_set_msg('Operations with archives are not available', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+
+ if ($isValid) {
+ //to folder
+ $tofolder = '';
+ if (isset($_GET['tofolder'])) {
+ $tofolder = pathinfo($zip_path, PATHINFO_FILENAME);
+ if (fm_mkdir($path . '/' . $tofolder, true)) {
+ $path .= '/' . $tofolder;
+ }
+ }
+
+ if($ext == "zip") {
+ $zipper = new FM_Zipper();
+ $res = $zipper->unzip($zip_path, $path);
+ } elseif ($ext == "tar") {
+ try {
+ $gzipper = new PharData($zip_path);
+ if (@$gzipper->extractTo($path,null, true)) {
+ $res = true;
+ } else {
+ $res = false;
+ }
+ } catch (Exception $e) {
+ //TODO:: need to handle the error
+ $res = true;
+ }
+ }
+
+ if ($res) {
+ fm_set_msg('Archive unpacked');
+ } else {
+ fm_set_msg('Archive not unpacked', 'error');
+ }
+
+ } else {
+ fm_set_msg('File not found', 'error');
+ }
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+// Change Perms (not for Windows)
+if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
+ $path = FM_ROOT_PATH;
+ if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+ }
+
+ $file = $_POST['chmod'];
+ $file = fm_clean_path($file);
+ $file = str_replace('/', '', $file);
+ if ($file == '' || (!is_file($path . '/' . $file) && !is_dir($path . '/' . $file))) {
+ fm_set_msg('File not found', 'error');
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+ }
+
+ $mode = 0;
+ if (!empty($_POST['ur'])) {
+ $mode |= 0400;
+ }
+ if (!empty($_POST['uw'])) {
+ $mode |= 0200;
+ }
+ if (!empty($_POST['ux'])) {
+ $mode |= 0100;
+ }
+ if (!empty($_POST['gr'])) {
+ $mode |= 0040;
+ }
+ if (!empty($_POST['gw'])) {
+ $mode |= 0020;
+ }
+ if (!empty($_POST['gx'])) {
+ $mode |= 0010;
+ }
+ if (!empty($_POST['or'])) {
+ $mode |= 0004;
+ }
+ if (!empty($_POST['ow'])) {
+ $mode |= 0002;
+ }
+ if (!empty($_POST['ox'])) {
+ $mode |= 0001;
+ }
+
+ if (@chmod($path . '/' . $file, $mode)) {
+ fm_set_msg('Permissions changed');
+ } else {
+ fm_set_msg('Permissions not changed', 'error');
+ }
+
+ fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
+}
+
+/*************************** /ACTIONS ***************************/
+
+// get current path
+$path = FM_ROOT_PATH;
+if (FM_PATH != '') {
+ $path .= '/' . FM_PATH;
+}
+
+// check path
+if (!is_dir($path)) {
+ fm_redirect(FM_SELF_URL . '?p=');
+}
+
+// get parent folder
+$parent = fm_get_parent_path(FM_PATH);
+
+$objects = is_readable($path) ? scandir($path) : array();
+$folders = array();
+$files = array();
+$current_path = array_slice(explode("/",$path), -1)[0];
+if (is_array($objects) && fm_is_exclude_items($current_path)) {
+ foreach ($objects as $file) {
+ if ($file == '.' || $file == '..') {
+ continue;
+ }
+ if (!FM_SHOW_HIDDEN && substr($file, 0, 1) === '.') {
+ continue;
+ }
+ $new_path = $path . '/' . $file;
+ if (@is_file($new_path) && fm_is_exclude_items($file)) {
+ $files[] = $file;
+ } elseif (@is_dir($new_path) && $file != '.' && $file != '..' && fm_is_exclude_items($file)) {
+ $folders[] = $file;
+ }
+ }
+}
+
+if (!empty($files)) {
+ natcasesort($files);
+}
+if (!empty($folders)) {
+ natcasesort($folders);
+}
+
+// upload form
+if (isset($_GET['upload']) && !FM_READONLY) {
+ fm_show_header(); // HEADER
+ fm_show_nav_path(FM_PATH); // current path
+ //get the allowed file extensions
+ function getUploadExt() {
+ $extArr = explode(',', FM_UPLOAD_EXTENSION);
+ if(FM_UPLOAD_EXTENSION && $extArr) {
+ array_walk($extArr, function(&$x) {$x = ".$x";});
+ return implode(',', $extArr);
+ }
+ return '';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
Copying
+
+ Source path:
+ Destination folder:
+
+
+ Copy
+ Move
+ Cancel
+
+
Select folder
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Netcloud Learning Manager
+
Provides learning videos for internal use.
+
by Netcloud AG
+
+
+
+
+
+
+
+
+
+
+
+
""
+
+ Full path:
+ File size:
+ MIME-type:
+
+ Files in archive:
+ Total size:
+ Size in archive:
+ Compression: %
+ ';
+ }
+ // Text info
+ if ($is_text) {
+ $is_utf8 = fm_is_utf8($content);
+ if (function_exists('iconv')) {
+ if (!$is_utf8) {
+ $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content);
+ }
+ }
+ echo 'Charset: ' . ($is_utf8 ? 'utf-8' : '8 bit') . '
';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ';
+ } else if($online_viewer == 'microsoft') {
+ echo '
';
+ }
+ } elseif ($is_zip) {
+ // ZIP content
+ if ($filenames !== false) {
+ echo '
';
+ foreach ($filenames as $fn) {
+ if ($fn['folder']) {
+ echo '' . fm_enc($fn['name']) . '
';
+ } else {
+ echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')
';
+ }
+ }
+ echo '
';
+ } else {
+ echo '
Error while fetching archive info
';
+ }
+ } elseif ($is_image) {
+ // Image content
+ if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg'))) {
+ echo '
';
+ }
+ } elseif ($is_audio) {
+ // Audio content
+ echo '
';
+ } elseif ($is_video) {
+ // Video content
+ echo '
';
+ } elseif ($is_text) {
+ if (FM_USE_HIGHLIGHTJS) {
+ // highlight
+ $hljs_classes = array(
+ 'shtml' => 'xml',
+ 'htaccess' => 'apache',
+ 'phtml' => 'php',
+ 'lock' => 'json',
+ 'svg' => 'xml',
+ );
+ $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext;
+ if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) {
+ $hljs_class = 'nohighlight';
+ }
+ $content = '
' . fm_enc($content) . '
';
+ } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) {
+ // php highlight
+ $content = highlight_string($content, true);
+ } else {
+ $content = '
' . fm_enc($content) . '
';
+ }
+ echo $content;
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ' . htmlspecialchars($content) . '';
+ } elseif ($is_text) {
+ echo '
' . htmlspecialchars($content) . '
';
+ } else {
+ fm_set_msg('FILE EXTENSION HAS NOT SUPPORTED', 'error');
+ }
+ ?>
+
+
+
+
+
+
+= $time1 && $upd) {
+ return false;
+ }
+ }
+ $ok = copy($f1, $f2);
+ if ($ok) {
+ touch($f2, $time1);
+ }
+ return $ok;
+}
+
+/**
+ * Get mime type
+ * @param string $file_path
+ * @return mixed|string
+ */
+function fm_get_mime_type($file_path)
+{
+ if (function_exists('finfo_open')) {
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
+ $mime = finfo_file($finfo, $file_path);
+ finfo_close($finfo);
+ return $mime;
+ } elseif (function_exists('mime_content_type')) {
+ return mime_content_type($file_path);
+ } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) {
+ $file = escapeshellarg($file_path);
+ $mime = shell_exec('file -bi ' . $file);
+ return $mime;
+ } else {
+ return '--';
+ }
+}
+
+/**
+ * HTTP Redirect
+ * @param string $url
+ * @param int $code
+ */
+function fm_redirect($url, $code = 302)
+{
+ header('Location: ' . $url, true, $code);
+ exit;
+}
+
+/**
+ * Path traversal prevention and clean the url
+ * It replaces (consecutive) occurrences of / and \\ with whatever is in DIRECTORY_SEPARATOR, and processes /. and /.. fine.
+ * @param $path
+ * @return string
+ */
+function get_absolute_path($path) {
+ $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
+ $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
+ $absolutes = array();
+ foreach ($parts as $part) {
+ if ('.' == $part) continue;
+ if ('..' == $part) {
+ array_pop($absolutes);
+ } else {
+ $absolutes[] = $part;
+ }
+ }
+ return implode(DIRECTORY_SEPARATOR, $absolutes);
+}
+
+/**
+ * Clean path
+ * @param string $path
+ * @return string
+ */
+function fm_clean_path($path, $trim = true)
+{
+ $path = $trim ? trim($path) : $path;
+ $path = trim($path, '\\/');
+ $path = str_replace(array('../', '..\\'), '', $path);
+ $path = get_absolute_path($path);
+ if ($path == '..') {
+ $path = '';
+ }
+ return str_replace('\\', '/', $path);
+}
+
+/**
+ * Get parent path
+ * @param string $path
+ * @return bool|string
+ */
+function fm_get_parent_path($path)
+{
+ $path = fm_clean_path($path);
+ if ($path != '') {
+ $array = explode('/', $path);
+ if (count($array) > 1) {
+ $array = array_slice($array, 0, -1);
+ return implode('/', $array);
+ }
+ return '';
+ }
+ return false;
+}
+
+/**
+ * Check file is in exclude list
+ * @param string $file
+ * @return bool
+ */
+function fm_is_exclude_items($file) {
+ $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
+ if(!in_array($file, FM_EXCLUDE_ITEMS) && !in_array("*.$ext", FM_EXCLUDE_ITEMS)) {
+ return true;
+ }
+ return false;
+}
+
+/**
+ * get language translations from json file
+ * @param int $tr
+ * @return array
+ */
+function fm_get_translations($tr) {
+ try {
+ $content = @file_get_contents('translation.json');
+ if($content !== FALSE) {
+ $lng = json_decode($content, TRUE);
+ global $lang_list;
+ foreach ($lng["language"] as $key => $value)
+ {
+ $code = $value["code"];
+ $lang_list[$code] = $value["name"];
+ if ($tr)
+ $tr[$code] = $value["translation"];
+ }
+ return $tr;
+ }
+
+ }
+ catch (Exception $e) {
+ echo $e;
+ }
+}
+
+/**
+ * @param $file
+ * Recover all file sizes larger than > 2GB.
+ * Works on php 32bits and 64bits and supports linux
+ * @return int|string
+ */
+function fm_get_size($file)
+{
+ static $iswin;
+ static $isdarwin;
+ if (!isset($iswin)) {
+ $iswin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
+ }
+ if (!isset($isdarwin)) {
+ $isdarwin = (strtoupper(substr(PHP_OS, 0)) == "DARWIN");
+ }
+
+ static $exec_works;
+ if (!isset($exec_works)) {
+ $exec_works = (function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') == 'EXEC');
+ }
+
+ // try a shell command
+ if ($exec_works) {
+ $arg = escapeshellarg($file);
+ $cmd = ($iswin) ? "for %F in (\"$file\") do @echo %~zF" : ($isdarwin ? "stat -f%z $arg" : "stat -c%s $arg");
+ @exec($cmd, $output);
+ if (is_array($output) && ctype_digit($size = trim(implode("\n", $output)))) {
+ return $size;
+ }
+ }
+
+ // try the Windows COM interface
+ if ($iswin && class_exists("COM")) {
+ try {
+ $fsobj = new COM('Scripting.FileSystemObject');
+ $f = $fsobj->GetFile( realpath($file) );
+ $size = $f->Size;
+ } catch (Exception $e) {
+ $size = null;
+ }
+ if (ctype_digit($size)) {
+ return $size;
+ }
+ }
+
+ // if all else fails
+ return filesize($file);
+}
+
+/**
+ * Get nice filesize
+ * @param int $size
+ * @return string
+ */
+function fm_get_filesize($size)
+{
+ $size = (float) $size;
+ $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
+ $power = $size > 0 ? floor(log($size, 1024)) : 0;
+ return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
+}
+
+/**
+ * Get director total size
+ * @param string $directory
+ * @return int
+ */
+function fm_get_directorysize($directory) {
+ global $calc_folder;
+ if ($calc_folder==true) { // Slower output
+ $size = 0; $count= 0; $dirCount= 0;
+ foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file)
+ if ($file->isFile())
+ { $size+=$file->getSize();
+ $count++;
+ }
+ else if ($file->isDir()) { $dirCount++; }
+ // return [$size, $count, $dirCount];
+ return $size;
+ }
+ else return 'Folder'; // Quick output
+}
+
+/**
+ * Get info about zip archive
+ * @param string $path
+ * @return array|bool
+ */
+function fm_get_zif_info($path, $ext) {
+ if ($ext == 'zip' && function_exists('zip_open')) {
+ $arch = zip_open($path);
+ if ($arch) {
+ $filenames = array();
+ while ($zip_entry = zip_read($arch)) {
+ $zip_name = zip_entry_name($zip_entry);
+ $zip_folder = substr($zip_name, -1) == '/';
+ $filenames[] = array(
+ 'name' => $zip_name,
+ 'filesize' => zip_entry_filesize($zip_entry),
+ 'compressed_size' => zip_entry_compressedsize($zip_entry),
+ 'folder' => $zip_folder
+ //'compression_method' => zip_entry_compressionmethod($zip_entry),
+ );
+ }
+ zip_close($arch);
+ return $filenames;
+ }
+ } elseif($ext == 'tar' && class_exists('PharData')) {
+ $archive = new PharData($path);
+ $filenames = array();
+ foreach(new RecursiveIteratorIterator($archive) as $file) {
+ $parent_info = $file->getPathInfo();
+ $zip_name = str_replace("phar://".$path, '', $file->getPathName());
+ $zip_name = substr($zip_name, ($pos = strpos($zip_name, '/')) !== false ? $pos + 1 : 0);
+ $zip_folder = $parent_info->getFileName();
+ $zip_info = new SplFileInfo($file);
+ $filenames[] = array(
+ 'name' => $zip_name,
+ 'filesize' => $zip_info->getSize(),
+ 'compressed_size' => $file->getCompressedSize(),
+ 'folder' => $zip_folder
+ );
+ }
+ return $filenames;
+ }
+ return false;
+}
+
+/**
+ * Encode html entities
+ * @param string $text
+ * @return string
+ */
+function fm_enc($text)
+{
+ return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
+}
+
+/**
+ * Prevent XSS attacks
+ * @param string $text
+ * @return string
+ */
+function fm_isvalid_filename($text) {
+ return (strpbrk($text, '/?%*:|"<>') === FALSE) ? true : false;
+}
+
+/**
+ * Save message in session
+ * @param string $msg
+ * @param string $status
+ */
+function fm_set_msg($msg, $status = 'ok')
+{
+ $_SESSION[FM_SESSION_ID]['message'] = $msg;
+ $_SESSION[FM_SESSION_ID]['status'] = $status;
+}
+
+/**
+ * Check if string is in UTF-8
+ * @param string $string
+ * @return int
+ */
+function fm_is_utf8($string)
+{
+ return preg_match('//u', $string);
+}
+
+/**
+ * Convert file name to UTF-8 in Windows
+ * @param string $filename
+ * @return string
+ */
+function fm_convert_win($filename)
+{
+ if (FM_IS_WIN && function_exists('iconv')) {
+ $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename);
+ }
+ return $filename;
+}
+
+/**
+ * @param $obj
+ * @return array
+ */
+function fm_object_to_array($obj)
+{
+ if (!is_object($obj) && !is_array($obj)) {
+ return $obj;
+ }
+ if (is_object($obj)) {
+ $obj = get_object_vars($obj);
+ }
+ return array_map('fm_object_to_array', $obj);
+}
+
+/**
+ * Get CSS classname for file
+ * @param string $path
+ * @return string
+ */
+function fm_get_file_icon_class($path)
+{
+ // get extension
+ $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
+
+ switch ($ext) {
+ case 'ico':
+ case 'gif':
+ case 'jpg':
+ case 'jpeg':
+ case 'jpc':
+ case 'jp2':
+ case 'jpx':
+ case 'xbm':
+ case 'wbmp':
+ case 'png':
+ case 'bmp':
+ case 'tif':
+ case 'tiff':
+ case 'svg':
+ $img = 'fa fa-picture-o';
+ break;
+ case 'passwd':
+ case 'ftpquota':
+ case 'sql':
+ case 'js':
+ case 'json':
+ case 'sh':
+ case 'config':
+ case 'twig':
+ case 'tpl':
+ case 'md':
+ case 'gitignore':
+ case 'c':
+ case 'cpp':
+ case 'cs':
+ case 'py':
+ case 'map':
+ case 'lock':
+ case 'dtd':
+ $img = 'fa fa-file-code-o';
+ break;
+ case 'txt':
+ case 'ini':
+ case 'conf':
+ case 'log':
+ case 'htaccess':
+ $img = 'fa fa-file-text-o';
+ break;
+ case 'css':
+ case 'less':
+ case 'sass':
+ case 'scss':
+ $img = 'fa fa-css3';
+ break;
+ case 'zip':
+ case 'rar':
+ case 'gz':
+ case 'tar':
+ case '7z':
+ $img = 'fa fa-file-archive-o';
+ break;
+ case 'php':
+ case 'php4':
+ case 'php5':
+ case 'phps':
+ case 'phtml':
+ $img = 'fa fa-code';
+ break;
+ case 'htm':
+ case 'html':
+ case 'shtml':
+ case 'xhtml':
+ $img = 'fa fa-html5';
+ break;
+ case 'xml':
+ case 'xsl':
+ $img = 'fa fa-file-excel-o';
+ break;
+ case 'wav':
+ case 'mp3':
+ case 'mp2':
+ case 'm4a':
+ case 'aac':
+ case 'ogg':
+ case 'oga':
+ case 'wma':
+ case 'mka':
+ case 'flac':
+ case 'ac3':
+ case 'tds':
+ $img = 'fa fa-music';
+ break;
+ case 'm3u':
+ case 'm3u8':
+ case 'pls':
+ case 'cue':
+ $img = 'fa fa-headphones';
+ break;
+ case 'avi':
+ case 'mpg':
+ case 'mpeg':
+ case 'mp4':
+ case 'm4v':
+ case 'flv':
+ case 'f4v':
+ case 'ogm':
+ case 'ogv':
+ case 'mov':
+ case 'mkv':
+ case '3gp':
+ case 'asf':
+ case 'wmv':
+ $img = 'fa fa-file-video-o';
+ break;
+ case 'eml':
+ case 'msg':
+ $img = 'fa fa-envelope-o';
+ break;
+ case 'xls':
+ case 'xlsx':
+ case 'ods':
+ $img = 'fa fa-file-excel-o';
+ break;
+ case 'csv':
+ $img = 'fa fa-file-text-o';
+ break;
+ case 'bak':
+ $img = 'fa fa-clipboard';
+ break;
+ case 'doc':
+ case 'docx':
+ case 'odt':
+ $img = 'fa fa-file-word-o';
+ break;
+ case 'ppt':
+ case 'pptx':
+ $img = 'fa fa-file-powerpoint-o';
+ break;
+ case 'ttf':
+ case 'ttc':
+ case 'otf':
+ case 'woff':
+ case 'woff2':
+ case 'eot':
+ case 'fon':
+ $img = 'fa fa-font';
+ break;
+ case 'pdf':
+ $img = 'fa fa-file-pdf-o';
+ break;
+ case 'psd':
+ case 'ai':
+ case 'eps':
+ case 'fla':
+ case 'swf':
+ $img = 'fa fa-file-image-o';
+ break;
+ case 'exe':
+ case 'msi':
+ $img = 'fa fa-file-o';
+ break;
+ case 'bat':
+ $img = 'fa fa-terminal';
+ break;
+ default:
+ $img = 'fa fa-info-circle';
+ }
+
+ return $img;
+}
+
+/**
+ * Get image files extensions
+ * @return array
+ */
+function fm_get_image_exts()
+{
+ return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd', 'svg');
+}
+
+/**
+ * Get video files extensions
+ * @return array
+ */
+function fm_get_video_exts()
+{
+ return array('avi', 'webm', 'wmv', 'mp4', 'm4v', 'ogm', 'ogv', 'mov', 'mkv');
+}
+
+/**
+ * Get audio files extensions
+ * @return array
+ */
+function fm_get_audio_exts()
+{
+ return array('wav', 'mp3', 'ogg', 'm4a');
+}
+
+/**
+ * Get text file extensions
+ * @return array
+ */
+function fm_get_text_exts()
+{
+ return array(
+ 'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config',
+ 'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue',
+ 'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py',
+ 'map', 'lock', 'dtd', 'svg', 'scss', 'asp', 'aspx', 'asx', 'asmx', 'ashx', 'jsx', 'jsp', 'jspx', 'cfm', 'cgi'
+ );
+}
+
+/**
+ * Get mime types of text files
+ * @return array
+ */
+function fm_get_text_mimes()
+{
+ return array(
+ 'application/xml',
+ 'application/javascript',
+ 'application/x-javascript',
+ 'image/svg+xml',
+ 'message/rfc822',
+ );
+}
+
+/**
+ * Get file names of text files w/o extensions
+ * @return array
+ */
+function fm_get_text_names()
+{
+ return array(
+ 'license',
+ 'readme',
+ 'authors',
+ 'contributors',
+ 'changelog',
+ );
+}
+
+/**
+ * Get online docs viewer supported files extensions
+ * @return array
+ */
+function fm_get_onlineViewer_exts()
+{
+ return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar', 'odt', 'ods');
+}
+
+function fm_get_file_mimes($extension)
+{
+ $fileTypes['swf'] = 'application/x-shockwave-flash';
+ $fileTypes['pdf'] = 'application/pdf';
+ $fileTypes['exe'] = 'application/octet-stream';
+ $fileTypes['zip'] = 'application/zip';
+ $fileTypes['doc'] = 'application/msword';
+ $fileTypes['xls'] = 'application/vnd.ms-excel';
+ $fileTypes['ppt'] = 'application/vnd.ms-powerpoint';
+ $fileTypes['gif'] = 'image/gif';
+ $fileTypes['png'] = 'image/png';
+ $fileTypes['jpeg'] = 'image/jpg';
+ $fileTypes['jpg'] = 'image/jpg';
+ $fileTypes['rar'] = 'application/rar';
+
+ $fileTypes['ra'] = 'audio/x-pn-realaudio';
+ $fileTypes['ram'] = 'audio/x-pn-realaudio';
+ $fileTypes['ogg'] = 'audio/x-pn-realaudio';
+
+ $fileTypes['wav'] = 'video/x-msvideo';
+ $fileTypes['wmv'] = 'video/x-msvideo';
+ $fileTypes['avi'] = 'video/x-msvideo';
+ $fileTypes['asf'] = 'video/x-msvideo';
+ $fileTypes['divx'] = 'video/x-msvideo';
+
+ $fileTypes['mp3'] = 'audio/mpeg';
+ $fileTypes['mp4'] = 'audio/mpeg';
+ $fileTypes['mpeg'] = 'video/mpeg';
+ $fileTypes['mpg'] = 'video/mpeg';
+ $fileTypes['mpe'] = 'video/mpeg';
+ $fileTypes['mov'] = 'video/quicktime';
+ $fileTypes['swf'] = 'video/quicktime';
+ $fileTypes['3gp'] = 'video/quicktime';
+ $fileTypes['m4a'] = 'video/quicktime';
+ $fileTypes['aac'] = 'video/quicktime';
+ $fileTypes['m3u'] = 'video/quicktime';
+
+ $fileTypes['php'] = ['application/x-php'];
+ $fileTypes['html'] = ['text/html'];
+ $fileTypes['txt'] = ['text/plain'];
+ return $fileTypes[$extension];
+}
+
+/**
+ * This function scans the files and folder recursively, and return matching files
+ * @param string $dir
+ * @param string $filter
+ * @return json
+ */
+ function scan($dir, $filter = '') {
+ $path = FM_ROOT_PATH.'/'.$dir;
+ if($dir) {
+ $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
+ $rii = new RegexIterator($ite, "/(" . $filter . ")/i");
+
+ $files = array();
+ foreach ($rii as $file) {
+ if (!$file->isDir()) {
+ $fileName = $file->getFilename();
+ $location = str_replace(FM_ROOT_PATH, '', $file->getPath());
+ $files[] = array(
+ "name" => $fileName,
+ "type" => "file",
+ "path" => $location,
+ );
+ }
+ }
+ return $files;
+ }
+}
+
+/*
+Parameters: downloadFile(File Location, File Name,
+max speed, is streaming
+If streaming - videos will show as videos, images as images
+instead of download prompt
+https://stackoverflow.com/a/13821992/1164642
+*/
+
+function fm_download_file($fileLocation, $fileName, $chunkSize = 1024)
+{
+ if (connection_status() != 0)
+ return (false);
+ $extension = pathinfo($fileName, PATHINFO_EXTENSION);
+
+ $contentType = fm_get_file_mimes($extension);
+ header("Cache-Control: public");
+ header("Content-Transfer-Encoding: binary\n");
+ header('Content-Type: $contentType');
+
+ $contentDisposition = 'attachment';
+
+
+ if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
+ $fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
+ header("Content-Disposition: $contentDisposition;filename=\"$fileName\"");
+ } else {
+ header("Content-Disposition: $contentDisposition;filename=\"$fileName\"");
+ }
+
+ header("Accept-Ranges: bytes");
+ $range = 0;
+ $size = filesize($fileLocation);
+
+ if (isset($_SERVER['HTTP_RANGE'])) {
+ list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']);
+ str_replace($range, "-", $range);
+ $size2 = $size - 1;
+ $new_length = $size - $range;
+ header("HTTP/1.1 206 Partial Content");
+ header("Content-Length: $new_length");
+ header("Content-Range: bytes $range$size2/$size");
+ } else {
+ $size2 = $size - 1;
+ header("Content-Range: bytes 0-$size2/$size");
+ header("Content-Length: " . $size);
+ }
+
+ if ($size == 0) {
+ die('Zero byte file! Aborting download');
+ }
+ @ini_set('magic_quotes_runtime', 0);
+ $fp = fopen("$fileLocation", "rb");
+
+ fseek($fp, $range);
+
+ while (!feof($fp) and (connection_status() == 0)) {
+ set_time_limit(0);
+ print(@fread($fp, 1024*$chunkSize));
+ flush();
+ ob_flush();
+ sleep(1);
+ }
+ fclose($fp);
+
+ return ((connection_status() == 0) and !connection_aborted());
+}
+
+function fm_get_theme() {
+ $result = '';
+ if(FM_THEME == "dark") {
+ $result = "text-white bg-dark";
+ }
+ return $result;
+}
+
+/**
+ * Class to work with zip files (using ZipArchive)
+ */
+class FM_Zipper
+{
+ private $zip;
+
+ public function __construct()
+ {
+ $this->zip = new ZipArchive();
+ }
+
+ /**
+ * Create archive with name $filename and files $files (RELATIVE PATHS!)
+ * @param string $filename
+ * @param array|string $files
+ * @return bool
+ */
+ public function create($filename, $files)
+ {
+ $res = $this->zip->open($filename, ZipArchive::CREATE);
+ if ($res !== true) {
+ return false;
+ }
+ if (is_array($files)) {
+ foreach ($files as $f) {
+ if (!$this->addFileOrDir($f)) {
+ $this->zip->close();
+ return false;
+ }
+ }
+ $this->zip->close();
+ return true;
+ } else {
+ if ($this->addFileOrDir($files)) {
+ $this->zip->close();
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
+ * @param string $filename
+ * @param string $path
+ * @return bool
+ */
+ public function unzip($filename, $path)
+ {
+ $res = $this->zip->open($filename);
+ if ($res !== true) {
+ return false;
+ }
+ if ($this->zip->extractTo($path)) {
+ $this->zip->close();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Add file/folder to archive
+ * @param string $filename
+ * @return bool
+ */
+ private function addFileOrDir($filename)
+ {
+ if (is_file($filename)) {
+ return $this->zip->addFile($filename);
+ } elseif (is_dir($filename)) {
+ return $this->addDir($filename);
+ }
+ return false;
+ }
+
+ /**
+ * Add folder recursively
+ * @param string $path
+ * @return bool
+ */
+ private function addDir($path)
+ {
+ if (!$this->zip->addEmptyDir($path)) {
+ return false;
+ }
+ $objects = scandir($path);
+ if (is_array($objects)) {
+ foreach ($objects as $file) {
+ if ($file != '.' && $file != '..') {
+ if (is_dir($path . '/' . $file)) {
+ if (!$this->addDir($path . '/' . $file)) {
+ return false;
+ }
+ } elseif (is_file($path . '/' . $file)) {
+ if (!$this->zip->addFile($path . '/' . $file)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
+
+/**
+ * Class to work with Tar files (using PharData)
+ */
+class FM_Zipper_Tar
+{
+ private $tar;
+
+ public function __construct()
+ {
+ $this->tar = null;
+ }
+
+ /**
+ * Create archive with name $filename and files $files (RELATIVE PATHS!)
+ * @param string $filename
+ * @param array|string $files
+ * @return bool
+ */
+ public function create($filename, $files)
+ {
+ $this->tar = new PharData($filename);
+ if (is_array($files)) {
+ foreach ($files as $f) {
+ if (!$this->addFileOrDir($f)) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ if ($this->addFileOrDir($files)) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Extract archive $filename to folder $path (RELATIVE OR ABSOLUTE PATHS)
+ * @param string $filename
+ * @param string $path
+ * @return bool
+ */
+ public function unzip($filename, $path)
+ {
+ $res = $this->tar->open($filename);
+ if ($res !== true) {
+ return false;
+ }
+ if ($this->tar->extractTo($path)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Add file/folder to archive
+ * @param string $filename
+ * @return bool
+ */
+ private function addFileOrDir($filename)
+ {
+ if (is_file($filename)) {
+ try {
+ $this->tar->addFile($filename);
+ return true;
+ } catch (Exception $e) {
+ return false;
+ }
+ } elseif (is_dir($filename)) {
+ return $this->addDir($filename);
+ }
+ return false;
+ }
+
+ /**
+ * Add folder recursively
+ * @param string $path
+ * @return bool
+ */
+ private function addDir($path)
+ {
+ $objects = scandir($path);
+ if (is_array($objects)) {
+ foreach ($objects as $file) {
+ if ($file != '.' && $file != '..') {
+ if (is_dir($path . '/' . $file)) {
+ if (!$this->addDir($path . '/' . $file)) {
+ return false;
+ }
+ } elseif (is_file($path . '/' . $file)) {
+ try {
+ $this->tar->addFile($path . '/' . $file);
+ } catch (Exception $e) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
+
+
+
+/**
+ * Save Configuration
+ */
+ class FM_Config
+{
+ var $data;
+
+ function __construct()
+ {
+ global $root_path, $root_url, $CONFIG;
+ $fm_url = $root_url.$_SERVER["PHP_SELF"];
+ $this->data = array(
+ 'lang' => 'en',
+ 'error_reporting' => true,
+ 'show_hidden' => true
+ );
+ $data = false;
+ if (strlen($CONFIG)) {
+ $data = fm_object_to_array(json_decode($CONFIG));
+ } else {
+ $msg = 'Netcloud File Manager
Error: Cannot load configuration';
+ if (substr($fm_url, -1) == '/') {
+ $fm_url = rtrim($fm_url, '/');
+ $msg .= '
';
+ $msg .= '
Seems like you have a trailing slash on the URL.';
+ $msg .= '
Try this link: ' . $fm_url . '';
+ }
+ die($msg);
+ }
+ if (is_array($data) && count($data)) $this->data = $data;
+ else $this->save();
+ }
+
+ function save()
+ {
+ $fm_file = __FILE__;
+ $var_name = '$CONFIG';
+ $var_value = var_export(json_encode($this->data), true);
+ $config_string = "
+
+ ' . $_SESSION[FM_SESSION_ID]['message'] . '
';
+ unset($_SESSION[FM_SESSION_ID]['message']);
+ unset($_SESSION[FM_SESSION_ID]['status']);
+ }
+}
+
+/**
+ * Show page header in Login Form
+ */
+function fm_show_header_login()
+{
+$sprites_ver = '20160315';
+header("Content-Type: text/html; charset=utf-8");
+header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
+header("Pragma: no-cache");
+
+global $lang, $root_url, $favicon_path;
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'Qk04AgAAAAAAADYAAAAoAAAAEAAAABAAAAABABAAAAAAAAICAAASCwAAEgsAAAAAAAAAAAAAIQQhBCEEIQQhBCEEIQQhBCEEIQ
+ QhBCEEIQQhBCEEIQQhBCEEIQQhBHNO3n/ef95/vXetNSEEIQQhBCEEIQQhBCEEIQQhBCEEc07ef95/3n/ef95/1lohBCEEIQQhBCEEIQQhBCEEIQ
+ RzTt5/3n8hBDFG3n/efyEEIQQhBCEEIQQhBCEEIQQhBHNO3n/efyEEMUbef95/IQQhBCEEIQQhBCEEIQQhBCEErTVzTnNOIQQxRt5/3n8hBCEEIQ
+ QhBCEEIQQhBCEEIQQhBCEEIQQhBDFG3n/efyEEIQQhBCEEIQQhBCEEIQQhBCEEIQQxRt5/3n+cc2stIQQhBCEEIQQhBCEEIQQhBCEEIQQIIZxz3n
+ /ef5xzay0hBCEEIQQhBCEEIQQhBCEEIQQhBCEEIQQhBDFG3n/efyEEIQQhBCEEIQQhBCEEIQQhBK01c05zTiEEMUbef95/IQQhBCEEIQQhBCEEIQ
+ QhBCEEc07ef95/IQQxRt5/3n8hBCEEIQQhBCEEIQQhBCEEIQRzTt5/3n8hBDFG3n/efyEEIQQhBCEEIQQhBCEEIQQhBKUUOWfef95/3n/ef95/IQ
+ QhBCEEIQQhBCEEIQQhBCEEIQQhBJRW3n/ef95/3n8hBCEEIQQhBCEEIQQhBCEEIQQhBCEEIQQhBCEEIQQhBCEEIQQhBCEEIQQAAA=='
+ );
+}
+
+?>
diff --git a/phpinfo.php b/phpinfo.php
new file mode 100644
index 0000000..968c8df
--- /dev/null
+++ b/phpinfo.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/scan.php b/scan.php
index 6ea7d2f..eae8ed1 100644
--- a/scan.php
+++ b/scan.php
@@ -5,22 +5,23 @@ $dir = "Home";
$response = scan($dir);
// This function scans the files folder recursively, and builds a large array
-function scan($dir){
+function scan($dir)
+{
$files = array();
// Is there actually such a folder/file?
- if(file_exists($dir)){
-
- foreach(scandir($dir) as $f) {
-
- if(!$f || $f[0] == '.') {
+ if (file_exists($dir)) {
+
+ foreach (scandir($dir) as $f) {
+
+ if (!$f || $f[0] == '.') {
continue; // Ignore hidden files
}
- if(is_dir($dir . '/' . $f)) {
+ if (is_dir($dir . '/' . $f)) {
// Remove Synology Temp-Folders, if they exists!
- if($f != '@eaDir') {
+ if ($f != '@eaDir') {
// The path is a folder
$files[] = array(
"name" => $f,
@@ -29,8 +30,7 @@ function scan($dir){
"items" => scan($dir . '/' . $f) // Recursively get the contents of the folder
);
}
- }
- else if (is_file($dir . '/' . $f)) {
+ } else if (is_file($dir . '/' . $f)) {
// It is a file
$files[] = array(
"name" => $f,
@@ -40,7 +40,6 @@ function scan($dir){
);
}
}
-
}
return $files;
@@ -54,4 +53,4 @@ echo json_encode(array(
"type" => "folder",
"path" => $dir,
"items" => $response
-));
\ No newline at end of file
+));