Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php |
— | — | @@ -42,8 +42,9 @@ |
43 | 43 | protected function parseUserValue($value) { |
44 | 44 | wfLoadExtensionMessages('SemanticMediaWiki'); |
45 | 45 | $value = trim($value); |
| 46 | + $this->m_url = ''; |
| 47 | + $this->m_value = ''; |
46 | 48 | if ($value!='') { //do not accept empty strings |
47 | | - $this->m_value = $value; |
48 | 49 | switch ($this->m_mode) { |
49 | 50 | case SMW_URI_MODE_URI: case SMW_URI_MODE_ANNOURI: |
50 | 51 | $parts = explode(':', $value, 2); // try to split "schema:rest" |
— | — | @@ -112,9 +113,10 @@ |
113 | 114 | $this->addError(wfMsgForContent('smw_baduri', $value)); |
114 | 115 | break; |
115 | 116 | } |
116 | | - $this->m_url = 'mailto:' . rawurlencode($value); |
| 117 | + $this->m_url = 'mailto:' . str_replace(array('%3A','%2F','%23','%40','%3F','%3D','%26','%25'), array(':','/','#','@','?','=','&','%'),rawurlencode($value)); |
117 | 118 | $this->m_uri = $this->m_url; |
118 | 119 | } |
| 120 | + $this->m_value = $this->m_uri; |
119 | 121 | } else { |
120 | 122 | $this->addError(wfMsgForContent('smw_emptystring')); |
121 | 123 | } |
— | — | @@ -127,11 +129,20 @@ |
128 | 130 | |
129 | 131 | protected function parseDBkeys($args) { |
130 | 132 | $this->m_value = $args[0]; |
| 133 | + $this->m_uri = $this->m_value; |
131 | 134 | $this->m_caption = $this->m_value; |
132 | 135 | if ($this->m_mode == SMW_URI_MODE_EMAIL) { |
133 | | - $this->m_url = 'mailto:' . $this->m_value; |
| 136 | + $this->m_url = $this->m_value; |
134 | 137 | } else { |
135 | | - $this->m_url = $this->m_value; |
| 138 | + $parts = explode(':', $this->m_value, 2); // try to split "schema:rest" |
| 139 | + global $wgUrlProtocols; |
| 140 | + $this->m_url = ''; |
| 141 | + foreach ($wgUrlProtocols as $prot) { // only set URL if wiki-enabled protocol |
| 142 | + if ( ($prot == $parts[0] . ':') || ($prot == $parts[0] . '://') ) { |
| 143 | + $this->m_url = $this->m_value; |
| 144 | + break; |
| 145 | + } |
| 146 | + } |
136 | 147 | } |
137 | 148 | $this->m_uri = $this->m_url; |
138 | 149 | } |