License admin panel should allow empty or valid URLs for (license

URL and license image URL) when selecting private or allrightsreserved
licenses.
This commit is contained in:
Zach Copley 2010-09-21 13:06:23 -07:00
parent 28fdc733a7
commit da4463cb76

View File

@ -161,14 +161,33 @@ class LicenseadminpanelAction extends AdminPanelAction
$options = array('allowed_schemes' => array('http', 'https')); $options = array('allowed_schemes' => array('http', 'https'));
// URLs should be set for cc license
if ($values['license']['type'] == 'cc') {
if (!Validate::uri($values['license']['url'], $options)) { if (!Validate::uri($values['license']['url'], $options)) {
$this->clientError(_("Invalid license URL.")); $this->clientError(_("Invalid license URL."));
} }
if (!Validate::uri($values['license']['image'], $options)) { if (!Validate::uri($values['license']['image'], $options)) {
$this->clientError(_("Invalid license image URL.")); $this->clientError(_("Invalid license image URL."));
} }
} }
// can be either blank or a valid URL for private & allrightsreserved
if (!empty($values['license']['url'])) {
if (!Validate::uri($values['license']['url'], $options)) {
$this->clientError(_("License URL must be blank or a valid URL."));
}
}
// can be either blank or a valid URL for private & allrightsreserved
if (!empty($values['license']['image'])) {
if (!Validate::uri($values['license']['image'], $options)) {
$this->clientError(_("License image must be blank or valid URL."));
}
}
}
} }
class LicenseAdminPanelForm extends AdminForm class LicenseAdminPanelForm extends AdminForm