diff --git a/airtime_mvc/application/forms/Login.php b/airtime_mvc/application/forms/Login.php index 0fd00d47b..926570b41 100644 --- a/airtime_mvc/application/forms/Login.php +++ b/airtime_mvc/application/forms/Login.php @@ -1,7 +1,5 @@ getHeader('referer'); $originIsSafe = false; foreach (CORSHelper::getAllowedOrigins() as $safeOrigin) { - if (StringHelper::startsWith($safeOrigin, $refererUrl)) { + if ($this->startsWith($safeOrigin, $refererUrl)) { $originIsSafe = true; break; } @@ -110,4 +108,28 @@ class Application_Form_Login extends Zend_Form $this->addElement($captcha); } + /** + * tests if a string starts with a given string + * + * This method was pinched as is from phing since it was the only line of code + * actually used from phing. I'm not 100% convinced why it was deemed necessary + * in the first place as it is a rather simple method in the first place. + * + * For now it's here as a copy and we can refactor it away completely later. + * + * @see + * + * @param $check + * @param $string + * + * @return bool + */ + private function startsWith($check, $string) + { + if ($check === "" || $check === $string) { + return true; + } else { + return (strpos($string, $check) === 0) ? true : false; + } + } }