Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
link
Commits
951762a1
Commit
951762a1
authored
Apr 25, 2007
by
Nathan Haug
Browse files
Adding user:password@ notation to link validation. #137588.
parent
5f09d06a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
link.module
link.module
+3
-2
No files found.
link.module
View file @
951762a1
...
...
@@ -299,7 +299,7 @@ function link_widget($op, &$node, $field, &$node_field) {
$form
[
$field
[
'field_name'
]][
'more-url'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
url
(
'link/widget/js/'
.
$field
[
'type_name'
]
.
'/'
.
$field
[
'field_name'
],
NULL
,
NULL
,
TRUE
),
'#attributes'
=>
array
(
'class'
=>
'more'
),
'#attributes'
=>
array
(
'class'
=>
'more
-links
'
),
'#id'
=>
str_replace
(
'_'
,
'-'
,
$field
[
'field_name'
])
.
'-more-url'
,
);
...
...
@@ -773,13 +773,14 @@ function link_validate_url($text) {
$allowed_protocols
=
variable_get
(
'filter_allowed_protocols'
,
array
(
'http'
,
'https'
,
'ftp'
,
'news'
,
'nntp'
,
'telnet'
,
'mailto'
,
'irc'
,
'ssh'
,
'sftp'
,
'webcal'
));
$protocol
=
'(('
.
implode
(
"|"
,
$allowed_protocols
)
.
'):\/\/)'
;
$authentication
=
'([a-z0-9]+(:[a-z0-9]+)?@)'
;
$domain
=
'(([a-z0-9]([a-z0-9\-_\[\]]*\.)+)('
.
LINK_DOMAINS
.
'|[a-z]{2}))'
;
$ipv4
=
'([0-9]{1,3}(\.[0-9]{1,3}){3})'
;
$ipv6
=
'([0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})'
;
$port
=
'(:([0-9]{1,4}))'
;
// Pattern specific to eternal links
$external_pattern
=
'/^'
.
$protocol
.
'?'
.
'('
.
$domain
.
'|'
.
$ipv4
.
'|'
.
$ipv6
.
' |localhost)'
.
$port
.
'?'
;
$external_pattern
=
'/^'
.
$protocol
.
'?'
.
$authentication
.
'?'
.
'('
.
$domain
.
'|'
.
$ipv4
.
'|'
.
$ipv6
.
' |localhost)'
.
$port
.
'?'
;
// Pattern specific to internal links
$internal_pattern
=
"/^([a-z0-9_\-+\[\]]+)"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment