CC-2950: Tell users if they are running an out-of-date version or not

- added error checking to curl call
- added regex validation when storing link to latest version
This commit is contained in:
Yuchen Wang 2011-11-17 15:33:29 -05:00
parent eae90862b1
commit 52052bd573
2 changed files with 18 additions and 5 deletions

View file

@ -530,14 +530,19 @@ class Application_Model_Preference
public static function GetLatestLink(){
$link = self::GetValue("latest_link");
if($link == null || strlen($link) == 0) {
return "";
return "http://www.sourcefabric.org/en/airtime/download/";
} else {
return $link;
}
}
public static function SetLatestLink($link){
self::SetValue("latest_link", $link);
$pattern = "#^(http|https|ftp)://" .
"([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+" .
"(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#";
if(preg_match($pattern, $link)) {
self::SetValue("latest_link", $link);
}
}
public static function SetUploadToSoundcloudOption($upload) {