%PlayListName%
'; $templateB= '
%VideoFileName%
%FileInfo%
'; $templateC = '
View Playlist'; $playlists = glob('playlist/*'); foreach($playlists as $playlist){ if (is_dir($playlist)){ $videos = glob($playlist . '/*.mp4'); //check if PHP was higher than 7.4, if true then not using inith filename if(ctype_xdigit(basename($playlist))){ $playlistName = hex2bin(basename($playlist)); }else{ $playlistName = basename($playlist); } $box = str_replace("%PlayListName%",$playlistName,$templateA); if (count($videos) != 0){ $box = str_replace("%PlayPlayList%","vidPlay.php?src=".$videos[0]."&playlist=".$playlist."",$box); }else{ //$box = str_replace('View Playlist','  Empty playlist',$box); } echo $box; foreach($videos as $video){ //echo $video . '
'; $filename = basename($video,".mp4"); if (ctype_xdigit(str_replace("inith","",$filename)) && strlen(str_replace("inith","",$filename)) % 2 == 0) { $decodedName = hex2bin(str_replace("inith","",$filename)); }else{ $decodedName = $filename; } $box = str_replace("%VideoPlayPath%","vidPlay.php?src=".$video,$templateB); $box = str_replace("%VideoFileName%",$decodedName,$box); $box = str_replace("%DownloadPath%","download.php?download=".$video,$box); $box = str_replace("%FileInfo%",formatBytes(filesize($video)) . " [".pathinfo($video, PATHINFO_EXTENSION)."]",$box); echo $box; } if (count($videos) != 0){ echo str_replace("%PlayPlayList%","vidPlay.php?src=".$videos[0]."&playlist=".basename($playlist),$templateC); }else{ echo str_replace("%PlayPlayList%","",$templateC); } } } $unsorted = glob("uploads/*.mp4"); $box = str_replace("%PlayListName%","Unsorted Videos",$templateA); if (count($unsorted) != 0){ $box = str_replace("%PlayPlayList%","vidPlay.php?src=".$unsorted[0]."&playlist=uploads",$box); }else{ //$box = str_replace('   Play playlist','  Empty playlist',$box); } echo $box; foreach ($unsorted as $video){ $filename = basename($video,".mp4"); if (ctype_xdigit(str_replace("inith","",$filename)) && strlen(str_replace("inith","",$filename)) % 2 == 0) { $decodedName = hex2bin(str_replace("inith","",$filename)); }else{ $decodedName = $filename; } $box = str_replace("%VideoPlayPath%","vidPlay.php?src=".$video,$templateB); $box = str_replace("%VideoFileName%",$decodedName,$box); $box = str_replace("%DownloadPath%","download.php?download=".$video,$box); $box = str_replace("%FileInfo%",formatBytes(filesize($video)) . " [".pathinfo($video, PATHINFO_EXTENSION)."]",$box); echo $box; } if (count($unsorted) != 0){ echo str_replace("%PlayPlayList%","vidPlay.php?src=".$unsorted[0]."&playlist=uploads",$templateC); }else{ echo str_replace('View Playlist',"

/// Empty Playlist ///

",$templateC); } //Check for external storage devices if (file_exists("/media/")){ //This system have media directory and check for mounting points $extstorages = glob("/media/storage*"); foreach ($extstorages as $storage){ if (file_exists("$storage/Video/")){ $unsorted = glob("$storage/Video/*.mp4"); $box = str_replace("%PlayListName%","External Storage ($storage)",$templateA); if (count($unsorted) != 0){ $box = str_replace("%PlayPlayList%","vidPlay.php?src=../SystemAOB/functions/extDiskAccess.php?file=".$unsorted[0]."&playlist=$storage/Video/&isExt=true",$box); }else{ $box = str_replace('   Play playlist','  Empty playlist / Not Plugged In',$box); } echo $box; foreach ($unsorted as $video){ $filedata = explode('/',$video); $fullFileName = array_pop($filedata); $filename = str_replace(".mp4","",$fullFileName); //$filename = basename($video,".mp4"); if (strpos($filename,"inith") !== false){ $decodedName = hex2bin(str_replace("inith","",$filename)); }else{ $decodedName = $filename; } $box = str_replace("%VideoPlayPath%","vidPlay.php?src=../SystemAOB/functions/extDiskAccess.php?file=".$video,$templateB); $box = str_replace("%VideoFileName%",$decodedName,$box); $box = str_replace("%DownloadPath%","download.php?download=".$video,$box); $box = str_replace("%FileInfo%",formatBytes(filesize($video)) . " [".pathinfo($video, PATHINFO_EXTENSION)."]",$box); echo $box; } if (count($unsorted) != 0){ echo str_replace("%PlayPlayList%","vidPlay.php?src=../SystemAOB/functions/extDiskAccess.php?file=".$unsorted[0]."&playlist=$storage/Video/&isExt=true",$templateC); }else{ echo str_replace('View Playlist',"

/// Empty Playlist ///

",$templateC); } } } } //scan for external playlist. This won't show if nothing is found. if (file_exists("/media/")){ //This system have media directory and check for mounting points $extstorages = glob("/media/storage*"); foreach ($extstorages as $storage){ if (file_exists("$storage/Video/")){ $playlists = glob( $storage . '/Video/*'); foreach($playlists as $playlist){ if (is_dir($playlist)){ $unsorted = glob($playlist . "/*.mp4"); //basename in traiditional mode to prevent utf-8 encoding error $tmp_1 = explode("/",$playlist); $basename = array_pop($tmp_1); if (ctype_xdigit($basename) && strlen($basename) % 2 == 0) { $playlistName = hex2bin($basename); } else { $playlistName = $basename; } $box = str_replace("%PlayListName%", $playlistName . " - ($storage)",$templateA); $box = str_replace('layout icon','disk outline icon',$box); if (count($unsorted) != 0){ $box = str_replace("%PlayPlayList%","vidPlay.php?src=../SystemAOB/functions/extDiskAccess.php?file=".$unsorted[0]."&playlist=$storage/Video/$basename&isExt=true",$box); }else{ //$box = str_replace('   Play playlist','  Empty playlist / Not Plugged In',$box); } echo $box; foreach ($unsorted as $video){ $filedata = explode('/',$video); $fullFileName = array_pop($filedata); $filename = str_replace(".mp4","",$fullFileName); if (strpos($filename,"inith") !== false){ $decodedName = hex2bin(str_replace("inith","",$filename)); }else{ $decodedName = $filename; } $box = str_replace("%VideoPlayPath%","vidPlay.php?src=../SystemAOB/functions/extDiskAccess.php?file=".$video,$templateB); $box = str_replace("%VideoFileName%",$decodedName,$box); $box = str_replace("%DownloadPath%","download.php?download=".$video,$box); $box = str_replace("%FileInfo%",formatBytes(filesize($video)) . " [".pathinfo($video, PATHINFO_EXTENSION)."]",$box); echo $box; } if (count($unsorted) != 0){ echo str_replace("%PlayPlayList%","vidPlay.php?src=../SystemAOB/functions/extDiskAccess.php?file=".$unsorted[0]."&playlist=$playlist&isExt=true",$templateC); }else{ echo str_replace('View Playlist',"

/// Empty Playlist ///

",$templateC); } } } } } } ?>