]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
only validate if values are sent
authorEvan Prodromou <evan@prodromou.name>
Thu, 12 Jun 2008 19:53:24 +0000 (15:53 -0400)
committerEvan Prodromou <evan@prodromou.name>
Thu, 12 Jun 2008 19:53:24 +0000 (15:53 -0400)
darcs-hash:20080612195324-84dde-cab5efa3218f3cd3632ced1c819a5be2edb3c5a0.gz

actions/updateprofile.php
lib/action.php

index e4382f67464f23d4c3b2b7d26611a539300bb1f3..16afba6182eec91ef797cb2308eb6f8265697c73 100644 (file)
@@ -70,20 +70,20 @@ class UpdateprofileAction extends Action {
                        return false;
                }
                $nickname = $req->get_parameter('omb_listenee_nickname');
-               if (!Validate::string($nickname, array('min_length' => 1,
-                                                                                          'max_length' => 64,
-                                                                                          'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
+               if ($nickname && !Validate::string($nickname, array('min_length' => 1,
+                                                                                                                       'max_length' => 64,
+                                                                                                                       'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
                        $this->client_error(_t('Nickname must have only letters and numbers and no spaces.'));
                        return false;
                }
-               $profile_url = $req->get_parameter('omb_listenee_profile');
-               if (!common_valid_http_url($profile_url)) {
-                       $this->client_error(_t("Invalid profile URL '$profile_url'."));
+               $license = $req->get_parameter('omb_listenee_license');
+               if ($license && !common_valid_http_url($license)) {
+                       $this->client_error(_t("Invalid license URL '$license'"));
                        return false;
                }
-               $license = $req->get_parameter('omb_listenee_license');
-               if (!common_valid_http_url($license)) {
-                       $this->client_error(_t("Invalid license URL '$license'."));
+               $profile_url = $req->get_parameter('omb_listenee_profile');
+               if ($profile_url && !common_valid_http_url($profile_url)) {
+                       $this->client_error(_t("Invalid profile URL '$profile_url'."));
                        return false;
                }
                # optional stuff
index b2374b1d228dea9be6e96393f5b97ffb7edddfb1..a4cae7066c0e06b34ccf3012d151333498b46993 100644 (file)
@@ -67,7 +67,7 @@ class Action { // lawsuit
                common_server_error($msg, $code);
        }
        
-       function client_error($msg, $code=500) {
+       function client_error($msg, $code=400) {
                $action = $this->trimmed('action');
                common_debug("User error '$code' on '$action': $msg", __FILE__);
                common_user_error($msg, $code);