summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-09-21 13:06:23 -0700
committerZach Copley <zach@status.net>2010-09-21 13:06:23 -0700
commitda4463cb765937190e8a202d20ca5d33ecd46beb (patch)
tree0b3d7b11a4ae2b813db09023fc5a7d02535918ee
parent28fdc733a7e90146ae7803d61c352c1758285bd8 (diff)
License admin panel should allow empty or valid URLs for (license
URL and license image URL) when selecting private or allrightsreserved licenses.
-rw-r--r--actions/licenseadminpanel.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/actions/licenseadminpanel.php b/actions/licenseadminpanel.php
index c9aad5c4f..9165ca19d 100644
--- a/actions/licenseadminpanel.php
+++ b/actions/licenseadminpanel.php
@@ -161,12 +161,31 @@ class LicenseadminpanelAction extends AdminPanelAction
$options = array('allowed_schemes' => array('http', 'https'));
- if (!Validate::uri($values['license']['url'], $options)) {
- $this->clientError(_("Invalid license URL."));
+ // URLs should be set for cc license
+
+ if ($values['license']['type'] == 'cc') {
+ if (!Validate::uri($values['license']['url'], $options)) {
+ $this->clientError(_("Invalid license URL."));
+ }
+ if (!Validate::uri($values['license']['image'], $options)) {
+ $this->clientError(_("Invalid license image URL."));
+ }
}
- if (!Validate::uri($values['license']['image'], $options)) {
- $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."));
+ }
}
}
}