Code Duplication    Length = 4-6 lines in 6 locations

api/src/Storage/Tracking.php 1 location

@@ 940-944 (lines=5) @@
937
				$popup = Api\Link::is_popup($this->app,'view');
938
			}
939
		}
940
		if ($link[0] == '/')
941
		{
942
			$link = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
943
				($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$link;
944
		}
945
		if (!$allow_popup)
946
		{
947
			// remove the session-id in the notification mail!

filemanager/inc/class.filemanager_merge.inc.php 1 location

@@ 203-207 (lines=5) @@
200
		}
201
202
		// Prepend site, if missing
203
		if ($link{0} == '/')
204
		{
205
			$link = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
206
				($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$link;
207
		}
208
		$file['link'] = Api\Html::a_href(Api\Html::htmlspecialchars($file['name']), $link);
209
		$file['url'] = $link;
210

api/src/Storage/Merge.php 2 locations

@@ 361-365 (lines=5) @@
358
					$link = Api\Framework::link($link, array());
359
				}
360
				// Prepend site
361
				if ($link{0} == '/')
362
				{
363
					$link = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
364
						($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$link;
365
				}
366
				$title = $style == 'href' ? Api\Html::a_href(Api\Html::htmlspecialchars($title), $link) : $link;
367
			}
368
			$link_titles[] = $title;
@@ 420-424 (lines=5) @@
417
							$link = Api\Framework::link($link, array());
418
						}
419
						// Prepend site
420
						if ($link{0} == '/')
421
						{
422
							$link = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
423
								($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$link;
424
						}
425
						$array[($prefix?$prefix.'/':'').$placeholder] = Api\Html::a_href(Api\Html::htmlspecialchars($title), $link);
426
						break;
427
					case 'links':

notifications/inc/class.notifications_email.inc.php 1 location

@@ 157-160 (lines=4) @@
154
			// do not expose sensitive data
155
			$url = preg_replace('/(sessionid|kp3|domain)=[^&]+&?/','',Api\Html::link('/index.php', $link->view));
156
			// complete missing protocol and domain part if needed
157
			if ($url{0} == '/' && $_render_external) {
158
				$url = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
159
					($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).$url;
160
			}
161
			$a_href = '<a href="'.$url.'" target="_blank">'.$link->text.'</a>';
162
			$rendered_links[] = $_render_html ? $a_href : $url;
163
		}

calendar/inc/class.calendar_boupdate.inc.php 1 location

@@ 1790-1795 (lines=6) @@
1787
		$eventStart_arr = $this->date2array($event['start']); // give this as 'date' to the link to pick the right recurrence for the participants state
1788
		$link = $GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=calendar.calendar_uiforms.edit&cal_id='.$event['id'].'&date='.$eventStart_arr['full'].'&no_popup=1&ajax=true';
1789
		// if url is only a path, try guessing the rest ;-)
1790
		if ($link[0] == '/')
1791
		{
1792
			$link = ($GLOBALS['egw_info']['server']['enforce_ssl'] || $_SERVER['HTTPS'] ? 'https://' : 'http://').
1793
				($GLOBALS['egw_info']['server']['hostname'] ? $GLOBALS['egw_info']['server']['hostname'] : $_SERVER['HTTP_HOST']).
1794
				$link;
1795
		}
1796
		$event_arr['link']['data'] = $details['link'] = $link;
1797
1798
		/* this is needed for notification-app