Subversion-Projekte lars-tiefland.ci

Revision

Revision 68 | Revision 2049 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 68 Revision 1257
Zeile 1198... Zeile 1198...
1198
		{
1198
		{
1199
			if (empty($matches[2]))
1199
			if (empty($matches[2]))
1200
			{
1200
			{
1201
				return FALSE;
1201
				return FALSE;
1202
			}
1202
			}
1203
			elseif ( ! in_array($matches[1], array('http', 'https'), TRUE))
1203
			elseif ( ! in_array(strtolower($matches[1]), array('http', 'https'), TRUE))
1204
			{
1204
			{
1205
				return FALSE;
1205
				return FALSE;
1206
			}
1206
			}
Zeile 1207... Zeile 1207...
1207
 
1207
 
Zeile 1214... Zeile 1214...
1214
		if (preg_match('/^\[([^\]]+)\]/', $str, $matches) && ! is_php('7') && filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE)
1214
		if (preg_match('/^\[([^\]]+)\]/', $str, $matches) && ! is_php('7') && filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE)
1215
		{
1215
		{
1216
			$str = 'ipv6.host'.substr($str, strlen($matches[1]) + 2);
1216
			$str = 'ipv6.host'.substr($str, strlen($matches[1]) + 2);
1217
		}
1217
		}
Zeile 1218... Zeile -...
1218
 
-
 
1219
		$str = 'http://'.$str;
-
 
1220
 
-
 
1221
		// There's a bug affecting PHP 5.2.13, 5.3.2 that considers the
-
 
1222
		// underscore to be a valid hostname character instead of a dash.
-
 
1223
		// Reference: https://bugs.php.net/bug.php?id=51192
-
 
1224
		if (version_compare(PHP_VERSION, '5.2.13', '==') OR version_compare(PHP_VERSION, '5.3.2', '=='))
-
 
1225
		{
-
 
1226
			sscanf($str, 'http://%[^/]', $host);
-
 
1227
			$str = substr_replace($str, strtr($host, array('_' => '-', '-' => '_')), 7, strlen($host));
-
 
1228
		}
-
 
1229
 
1218
 
1230
		return (filter_var($str, FILTER_VALIDATE_URL) !== FALSE);
1219
		return (filter_var('http://'.$str, FILTER_VALIDATE_URL) !== FALSE);
Zeile 1231... Zeile 1220...
1231
	}
1220
	}
Zeile 1232... Zeile 1221...
1232
 
1221
 
Zeile 1238... Zeile 1227...
1238
	 * @param	string
1227
	 * @param	string
1239
	 * @return	bool
1228
	 * @return	bool
1240
	 */
1229
	 */
1241
	public function valid_email($str)
1230
	public function valid_email($str)
1242
	{
1231
	{
1243
		if (function_exists('idn_to_ascii') && $atpos = strpos($str, '@'))
1232
		if (function_exists('idn_to_ascii') && sscanf($str, '%[^@]@%s', $name, $domain) === 2)
1244
		{
1233
		{
1245
			$str = substr($str, 0, ++$atpos).idn_to_ascii(substr($str, $atpos));
1234
			$str = $name.'@'.idn_to_ascii($domain);
1246
		}
1235
		}
Zeile 1247... Zeile 1236...
1247
 
1236
 
1248
		return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);
1237
		return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);