]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/licenseadminpanel.php
Merge remote branch 'origin/moveaccount' into moveaccount
[quix0rs-gnu-social.git] / actions / licenseadminpanel.php
index c9aad5c4f063a75a449390de721f8321b35c136c..95ac48cc8f3d489e3204d9087943182e38e815c0 100644 (file)
@@ -153,7 +153,7 @@ class LicenseadminpanelAction extends AdminPanelAction
         // Make sure the license title is not too long
         if (mb_strlen($values['license']['type']) > 255) {
             $this->clientError(
-                _("Invalid license title. Max length is 255 characters.")
+                _('Invalid license title. Maximum length is 255 characters.')
             );
         }
 
@@ -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."));
+            }
         }
     }
 }