|
|
|
@ -102,3 +102,24 @@ function fix_encoding($in_str) {
|
|
|
|
|
|
|
|
|
|
return $valid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function fixDsid($dsid) { |
|
|
|
|
$new_dsid = trim($dsid); |
|
|
|
|
|
|
|
|
|
$find = '/[^a-zA-Z0-9\.\_\-]/'; |
|
|
|
|
$replace = ''; |
|
|
|
|
$new_dsid = preg_replace($find, $replace, $new_dsid); |
|
|
|
|
|
|
|
|
|
if( strlen($new_dsid) > 63 ) |
|
|
|
|
$new_dsid = substr($new_dsid, -63); |
|
|
|
|
|
|
|
|
|
if( preg_match('/^[^a-zA-Z]/', $dsid ) ) |
|
|
|
|
$new_dsid = 'x' . $new_dsid; |
|
|
|
|
|
|
|
|
|
if( strlen($new_dsid) == 0 ) |
|
|
|
|
$new_dsid = 'item' . rand(1, 100); |
|
|
|
|
|
|
|
|
|
return $new_dsid; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|