Loading src/Controller/UberAffiliate.php +7 −3 Original line number Diff line number Diff line Loading @@ -90,8 +90,6 @@ class UberAffiliate extends ControllerBase { $affid = (int) Xss::filter($aff_id); $path_given = $dest_path; $tracker = (int) Xss::filter($tracker_id); Loading Loading @@ -140,11 +138,17 @@ class UberAffiliate extends ControllerBase { } // Unnecessary check_url()? Better safe than sorry... $destination_actual = check_url($destination_actual); $destination_actual = UrlHelper::stripDangerousProtocols($destination_actual); // At minimum, if all validations fail, we'll be taken to the front page. If the path // given is valid though, we'll be taken to that path either way, regardless of whether // the affiliate was credited with a valid click-thru. if (empty($destination_actual)) { $language = \Drupal::languageManager()->getLanguage('vi'); $url = Url::fromRoute('<front>', [], ['language' => $language]); return new RedirectResponse($url->toString()); } return new RedirectResponse(\Drupal\Core\Url::fromRoute($destination_actual)->toString()); } } src/Routing/AffiliateRoute.php +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ class AffiliateRoute { $affiliate_menu_path . '/' . '{aff_id}' . '/' . '{dest_path}' . '/' . '{tracker_id}', [ '_controller' => 'Drupal\uber_affiliate\Controller\UberAffiliate::affiliate_page', 'dest_path' => 'fallback', 'tracker_id' => 'fallback', ], [ '_permission' => 'track affiliate clicks for this role', Loading Loading
src/Controller/UberAffiliate.php +7 −3 Original line number Diff line number Diff line Loading @@ -90,8 +90,6 @@ class UberAffiliate extends ControllerBase { $affid = (int) Xss::filter($aff_id); $path_given = $dest_path; $tracker = (int) Xss::filter($tracker_id); Loading Loading @@ -140,11 +138,17 @@ class UberAffiliate extends ControllerBase { } // Unnecessary check_url()? Better safe than sorry... $destination_actual = check_url($destination_actual); $destination_actual = UrlHelper::stripDangerousProtocols($destination_actual); // At minimum, if all validations fail, we'll be taken to the front page. If the path // given is valid though, we'll be taken to that path either way, regardless of whether // the affiliate was credited with a valid click-thru. if (empty($destination_actual)) { $language = \Drupal::languageManager()->getLanguage('vi'); $url = Url::fromRoute('<front>', [], ['language' => $language]); return new RedirectResponse($url->toString()); } return new RedirectResponse(\Drupal\Core\Url::fromRoute($destination_actual)->toString()); } }
src/Routing/AffiliateRoute.php +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ class AffiliateRoute { $affiliate_menu_path . '/' . '{aff_id}' . '/' . '{dest_path}' . '/' . '{tracker_id}', [ '_controller' => 'Drupal\uber_affiliate\Controller\UberAffiliate::affiliate_page', 'dest_path' => 'fallback', 'tracker_id' => 'fallback', ], [ '_permission' => 'track affiliate clicks for this role', Loading