mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-17 11:28:41 +01:00
remove outdated code for unsupported mysql version
This commit is contained in:
parent
3c49645af0
commit
4c99f81e40
27
post.php
27
post.php
@ -39,33 +39,6 @@ function md5_hash_of_file($config, $path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Strip the symbols incompatible with the current database version.
|
|
||||||
*
|
|
||||||
* @param string @input The input string.
|
|
||||||
* @return string The value stripped of incompatible symbols.
|
|
||||||
*/
|
|
||||||
function strip_symbols($input) {
|
|
||||||
if (mysql_version() >= 50503) {
|
|
||||||
return $input; // Assume we're using the utf8mb4 charset
|
|
||||||
} else {
|
|
||||||
// MySQL's `utf8` charset only supports up to 3-byte symbols
|
|
||||||
// Remove anything >= 0x010000
|
|
||||||
|
|
||||||
$chars = preg_split('//u', $input, -1, PREG_SPLIT_NO_EMPTY);
|
|
||||||
$ret = '';
|
|
||||||
foreach ($chars as $char) {
|
|
||||||
$o = 0;
|
|
||||||
$ord = ordutf8($char, $o);
|
|
||||||
if ($ord >= 0x010000) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$ret .= $char;
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download a remote file from the given url.
|
* Download a remote file from the given url.
|
||||||
* The file is deleted at shutdown.
|
* The file is deleted at shutdown.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user