UnknownSec Bypass
403
:
/
var
/
www
/
html
/
lms_d5c35339adb3
/
app
/
Helpers
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
Helpers.php
<?php namespace EstudioLMS\Helpers; use DateInterval; /** * Class Helpers * @package EstudioLMS\Helpers */ class Helpers { /** * @param $data * @return string */ public static function logDataChanged($data) { $changes = []; $log = ''; foreach ($data->getDirty() as $key => $value) { $original = $data->getOriginal($key); $changes[$key] = [ 'old' => $original, 'new' => $value, ]; } if (isset($changes)) { if (count($changes) > 0) { $log = ''; foreach ($changes as $key => $change) { $log .= $key . ' Changed from: ' . $change['old'] . ' to: ' . $change['new'] . PHP_EOL; } } } return $log; } /** * @param $string * @return mixed */ public static function keepNumericOnly($string) { return preg_replace("/[^0-9,.]/", "", $string); } /** * @param $url * @return mixed */ public static function videoInfo($url) { // Handle Youtube if (strpos($url, "youtube.com")) { $output = ''; $url = parse_url($url); $api_key = 'AIzaSyDSg74gqy2oAvM3HNEogHlJFGcmqWbXGA4'; parse_str($url['query'], $output); $video_id = $output['v']; $data['video_type'] = 'youtube'; $data['video_id'] = $video_id; $xml = file_get_contents( "https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=$video_id&key=$api_key" ); $result = json_decode($xml, true); if (empty($result['items'][0]['contentDetails'])) { return null; } $vinfo = $result['items'][0]['contentDetails']; $interval = new DateInterval($vinfo['duration']); $vinfo['duration'] = $interval->h * 3600 + $interval->i * 60 + $interval->s; $thumbnail_base = 'https://i.ytimg.com/vi/'; $vinfo['thumbnail']['default'] = $thumbnail_base . $video_id . '/default.jpg'; $vinfo['thumbnail']['mqDefault'] = $thumbnail_base . $video_id . '/mqdefault.jpg'; $vinfo['thumbnail']['hqDefault'] = $thumbnail_base . $video_id . '/hqdefault.jpg'; $vinfo['thumbnail']['sdDefault'] = $thumbnail_base . $video_id . '/sddefault.jpg'; $vinfo['thumbnail']['maxresDefault'] = $thumbnail_base . $video_id . '/maxresdefault.jpg'; return $vinfo; } // End Youtube // Handle Vimeo elseif (strpos($url, "vimeo.com")) { $video_id = explode('vimeo.com/', $url); $video_id = $video_id[1]; $xml = @file_get_contents("http://vimeo.com/api/oembed.json?url=http://vimeo.com/$video_id"); $xml = json_decode($xml, true); $data['video_type'] = $xml['provider_name']; $data['video_id'] = $xml['video_id']; $data['title'] = $xml['title']; $data['url'] = isset($xml['uri']) ? $xml['uri'] : ''; $data['author_name'] = isset($xml['author_name']) ? $xml['author_name'] : ''; $data['author_url'] = isset($xml['author_url']) ? $xml['author_url'] : ''; $data['duration'] = $xml['duration']; } // End Vimeo // Set false if invalid URL else { $data = false; } return $data; } public static function formatValue($value) { $value = floor($value * 100) / 100; return number_format($value, 2, ",", "."); } public static function obfuscateEmail($email) { $em = explode("@", $email); $name = implode(array_slice($em, 0, count($em) - 1), '@'); $len = floor(strlen($name) / 2); return substr($name, 0, $len) . str_repeat('*', $len) . "@" . end($em); } public static function randomPassword($length) { $chars = "@#_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; return substr(str_shuffle($chars), 0, $length); } public static function UFlist() { $ufArr = [ 'AC' => 'AC', 'AL' => 'AL', 'AM' => 'AM', 'AP' => 'AP', 'BA' => 'BA', 'CE' => 'CE', 'DF' => 'DF', 'ES' => 'ES', 'GO' => 'GO', 'MA' => 'MA', 'MG' => 'MG', 'MS' => 'MS', 'MT' => 'MT', 'PA' => 'PA', 'PB' => 'PB', 'PE' => 'PE', 'PI' => 'PI', 'PR' => 'PR', 'RJ' => 'RJ', 'RN' => 'RN', 'RO' => 'RO', 'RR' => 'RR', 'RS' => 'RS', 'SC' => 'SC', 'SE' => 'SE', 'SP' => 'SP', 'TO' => 'TO' ]; return $ufArr; } public static function convertToHoursMins($time, $format = '%02d:%02d') { if ($time < 1) { return; } $hours = floor($time / 60); $minutes = ($time % 60); return sprintf($format, $hours, $minutes); } public static function userTypes($withSuper = false) { if ($withSuper) { $userTypes = [ 1 => 'admin', 2 => 'professor', 3 => 'aluno', 5 => 'Super Admin' ]; } else { $userTypes = [ 1 => 'admin', 2 => 'professor', 3 => 'aluno', 5 => 'Super Admin' ]; } return $userTypes; } public static function newGuid() { $s = strtoupper(md5(uniqid(rand(), true))); $guidText = substr($s, 0, 8) . '-' . substr($s, 8, 4) . '-' . substr($s, 12, 4) . '-' . substr($s, 16, 4) . '-' . substr($s, 20); return $guidText; } public static function uniqueFileName($prepend = '') { if (empty($prepend)) { return uniqid(); } return uniqid($prepend); } public static function getLocalVideoDuration($videoFile) { $file = $videoFile; $result = shell_exec('ffmpeg -i ' . escapeshellcmd($file) . ' 2>&1'); preg_match('/(?<=Duration: )(\d{2}:\d{2}:\d{2})\.\d{2}/', $result, $match); $time = $match[0]; if (count($match) > 1) { $time = $match[1]; } $parsed = date_parse($time); $seconds = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second']; return $seconds; } public static function findLongestStringFromArray($array = []) { if(!empty($array)){ $lengths = array_map('strlen', $array); $maxLength = max($lengths); $key = array_search($maxLength, $lengths); return ['length' => $maxLength,'key' => $key,'string'=>$array[$key]]; } } }
Copyright © 2026 - UnknownSec