Skip to content

Commit ef6270f

Browse files
committed
Issues-648: disable links for MFE
1 parent 4844a9b commit ef6270f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Topcoder/class.topcoder.plugin.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,23 @@ function gdn_dispatcher_beforeControllerMethod_handler($sender, $args){
947947
* Add scripts. Add script to hide iPhone browser bar on pageload.
948948
*/
949949
public function base_render_before($sender) {
950+
if(isset($_SERVER['HTTP_REFERER'])) {
951+
$url = $_SERVER['HTTP_REFERER'];
952+
parse_str( parse_url( $url, PHP_URL_QUERY), $array );
953+
$embedType = $array['mbed_type'];
954+
if($embedType == 'mfe') {
955+
$sender->addDefinition('MFEEmbedded', '1');
956+
$sender->MasterView = 'mfe';
957+
// logMessage(__FILE__,__LINE__,'TopcoderPlugin','base_render_before',"Use Embed Master Template due to HTTP_REFERER".$url);
958+
}
959+
}
960+
961+
// Force view options
962+
if(getIncomingValue('embed_type') == 'mfe') {
963+
$sender->addDefinition('MFEEmbedded', '1');
964+
$sender->MasterView = 'mfe';
965+
// logMessage(__FILE__,__LINE__,'TopcoderPlugin','base_render_before',"Use Embed Master Template due to Query Param");
966+
}
950967
if (is_object($sender->Head)) {
951968
$sender->Head->addString($this->getJS());
952969
}
@@ -2450,7 +2467,7 @@ function userPhoto($user, $options = []) {
24502467
$isTopcoderAdmin = val('IsAdmin', $topcoderProfile);
24512468
$photoUrl = isset($photoUrl) && !empty(trim($photoUrl)) ? $photoUrl: UserModel::getDefaultAvatarUrl();
24522469
$isUnlickableUser = TopcoderPlugin::isUnclickableUser($name);
2453-
$href = (val('NoLink', $options)) || $isUnlickableUser ? '' : ' href="'.url($userLink).'"';
2470+
$href = (val('NoLink', $options)) || $isUnlickableUser || getIncomingValue('embed_type') == 'mfe' ? '' : ' href="'.url($userLink).'"';
24542471

24552472
Gdn::controller()->EventArguments['User'] = $user;
24562473
Gdn::controller()->EventArguments['Title'] =& $title;
@@ -2540,7 +2557,7 @@ function userAnchor($user, $cssClass = null, $options = null) {
25402557
}
25412558

25422559
// Go to Topcoder user profile link instead of Vanilla profile link
2543-
$isUnlickableUser = TopcoderPlugin::isUnclickableUser($name);
2560+
$isUnlickableUser = getIncomingValue('embed_type') == 'mfe' || TopcoderPlugin::isUnclickableUser($name);
25442561
$userUrl = $isUnlickableUser? '#' : topcoderUserUrl($user, $px);
25452562

25462563
$topcoderProfile = TopcoderPlugin::getTopcoderUser($userID);

0 commit comments

Comments
 (0)