We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31471
    • 206 Posts
    On the Core Code forum I asked if it was unrecommended to query a user without BINARY LOWER comparisation, but nothing ’till now. In the Manager’s user validation I even find this solution.
    So I made this alteration to the webloginpe.class.php file:

    The original code from line 2374:
    		$query = "SELECT * FROM ".$web_users.", ".$web_user_attributes.", ".$this->CustomTable." WHERE BINARY LOWER(".$web_users.".username) = '".strtolower($Username)."' AND ".$web_user_attributes.".`internalKey` = ".$web_users.".`id` AND ".$this->CustomTable.".`internalKey` = ".$web_users.".`id`";
    		$dataSource = $modx->db->query($query);
    		$limit = $modx->db->getRecordCount($dataSource);
    		
    		if ($limit == 0)
    		{
    			$query = "SELECT * FROM ".$web_users.", ".$web_user_attributes." WHERE BINARY LOWER(".$web_users.".username) = '".strtolower($Username)."' AND ".$web_user_attributes.".`internalKey` = ".$web_users.".`id`";
    			$dataSource = $modx->db->query($query);
    			$limit = $modx->db->getRecordCount($dataSource);
    		}


    The altered code:
    		$query = "SELECT * FROM ".$web_users.", ".$web_user_attributes.", ".$this->CustomTable." WHERE BINARY LOWER(".$web_users.".username) = '".strtolower($Username)."' AND ".$web_user_attributes.".`internalKey` = ".$web_users.".`id` AND ".$this->CustomTable.".`internalKey` = ".$web_users.".`id`";
    		$query2 = "SELECT * FROM ".$web_users.", ".$web_user_attributes.", ".$this->CustomTable." WHERE(".$web_users.".username) = '".$Username."' AND ".$web_user_attributes.".`internalKey` = ".$web_users.".`id` AND ".$this->CustomTable.".`internalKey` = ".$web_users.".`id`";
    		if (!$limit = $modx->db->getRecordCount($dataSource = $modx->db->query($query))) $limit = $modx->db->getRecordCount($dataSource = $modx->db->query($query2));
    		
    		if ($limit == 0)
    		{
    			$query = "SELECT * FROM ".$web_users.", ".$web_user_attributes." WHERE BINARY LOWER(".$web_users.".username) = '".strtolower($Username)."' AND ".$web_user_attributes.".`internalKey` = ".$web_users.".`id`";
    			$query2 = "SELECT * FROM ".$web_users.", ".$web_user_attributes." WHERE(".$web_users.".username) = '".$Username."' AND ".$web_user_attributes.".`internalKey` = ".$web_users.".`id`";
    			if (!$limit = $modx->db->getRecordCount($dataSource = $modx->db->query($query))) $limit = $modx->db->getRecordCount($dataSource = $modx->db->query($query2));
    		}

    The lines before ’if ($limit == 0)’ are for the users with Custom Tables.
    The workaround makes a second query ONLY IF the first one fails. This second query is which can read the usernames with accented characters.

    Now to enable registering with almost any characters, from line 481 let’s bring back the checking method from v1.30:
    		// Check username for bullshit.
    		$illegals = array('\\','\''); 
    		if (strlen(str_replace($illegals, '', $username)) !== strlen($username))
    		{
    		return $this->FormatMessage($this->LanguageArray[32]);
    		}
    

    My experiments with illegals ended up with these two: \ and ’. If any of you find more unacceptable or harmful characters, please enhance this list!
    The $illegals - if strlen()... method should be replaced with a more elegant regex, if somebody is brave enough to do it.

    I hope I didn’t do any typos. I hope it works for you.
      • 28033
      • 925 Posts
      Sounds good. Since there hasn’t been no outstanding bugs, anyone against pushing this, along with that fix, as the RTM release?
        My Snippets
        -> PopUpChunk v1.0
        • 25663 MODX Staff
        • 12,272 Posts
        Sounds good to me. For what it’s worth, we should have the pagination and some additional group-related functionality ready in short order for a 1.3.2 or 1.4 release
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 28033
          • 925 Posts
          Quote from: rthrash at Aug 05, 2008, 08:22 AM

          Sounds good to me. For what it’s worth, we should have the pagination and some additional group-related functionality ready in short order for a 1.3.2 or 1.4 release

          Nice.

          Speaking of 1.4, I wonder what Scotty had planned for it? He talked about starting the coding of it, but we never heard *what* was in it, IIRC...
            My Snippets
            -> PopUpChunk v1.0
            • 28033
            • 925 Posts
            http://modxcms.com/WebLoginPE-1.3.1-2142.html

            w00t!

            The only "issue" that wasn’t included in here was the template fixes, due to me being unable to find them all (they’re not as easy to see as bug reports).

            I’m gonna create a topic for template errors. Could a mod sticky it for me? Also, what do we do with the old 1.3.0 stickies? Rename them?
              My Snippets
              -> PopUpChunk v1.0
              • 25663 MODX Staff
              • 12,272 Posts
              It’s stickied. I think what would be helpful would be to compile a clean list of any known issues with the distribution, if possible linking to the specific post identifying that issue. That way the 1.3.2 release could address those issues, and add the pagination. Should be relatively quick to get that out the door as well.

              FWIW, I think a proper changelog that includes the specific thing that was addressed would be helpful as well. It’s time consuming to look up all the links in the list that’s there now. The 130-to-131.txt file should really be appended to the docs/index.html file in the same format as previous releases. We could put the list of known issues above the changelog entry, too, I suppose.

              This should really be in some sort of version control repository as well. Google Code, anyone?
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 28033
                • 925 Posts
                Quote from: rthrash at Aug 05, 2008, 10:41 AM

                It’s stickied. I think what would be helpful would be to compile a clean list of any known issues with the distribution, if possible linking to the specific post identifying that issue. That way the 1.3.2 release could address those issues, and add the pagination. Should be relatively quick to get that out the door as well.

                FWIW, I think a proper changelog that includes the specific thing that was addressed would be helpful as well. It’s time consuming to look up all the links in the list that’s there now. The 130-to-131.txt file should really be appended to the docs/index.html file in the same format as previous releases. We could put the list of known issues above the changelog entry, too, I suppose.

                This should really be in some sort of version control repository as well. Google Code, anyone?

                Yeah. The .txt file for 1.3.0->1.3.1 kinda got unwiedly after a while, due to the sheer amount of bugs that needed to be documented and fixed. I want to fix that by having a proper changelog with the next release. wink

                http://code.google.com/p/webloginpe/

                Just set that up. I’ve never messed around with that, so anyone that wants to help with it, feel free to PM/post your Google account, and I’ll add you.

                BTW, how do you add code to that? Can you do it via the browser, or do you need a program?

                (Looks like this will allow us to track the bugs/fixes, so multiple people can help out. smiley)
                  My Snippets
                  -> PopUpChunk v1.0
                  • 31471
                  • 206 Posts
                  Wow, the Google Code subversion-thingie looks very Goodle rolleyes

                  I have some improvement about using multiple instances of the snippet. But I use only partial functions, so it might be useful to test this at other’s workflows.
                  Imagine that you put some user-pictures / user-infos on your sidebar. This sidebar will mess-up when in the Content-area you display any other instance of WLPE of the same ’Type’. In this case you could give the sidebar’s snippet call an &instance=`sidebar` property, modify your sidebar-templates to show and get [+sidebar.placeholders+], and there you go! This is backward-compatible, as snippet-calls without the &instance parameter will work with the original templates.

                  I would like to put this modification on Google Code to let others test it. My account is [email protected]. Please sign me on wink
                    • 3749
                    • 24,544 Posts
                    Quote from: vhollo at Aug 05, 2008, 02:29 PM

                    Wow, the Google Code subversion-thingie looks very Goodle rolleyes

                    I have some improvement about using multiple instances of the snippet. But I use only partial functions, so it might be useful to test this at other’s workflows.
                    Imagine that you put some user-pictures / user-infos on your sidebar. This sidebar will mess-up when in the Content-area you display any other instance of WLPE of the same ’Type’. In this case you could give the sidebar’s snippet call an &instance=`sidebar` property, modify your sidebar-templates to show and get [+sidebar.placeholders+], and there you go! This is backward-compatible, as snippet-calls without the &instance parameter will work with the original templates.

                    I would like to put this modification on Google Code to let others test it. My account is [email protected]. Please sign me on wink

                    Another known problem with two WLPE calls on the same page is that when you click on a link to view a profile in a user list, you get two profiles, one from each snippet call. It happens because the link re-posts to self and when the page reloads, both snippets see the service set to "viewProfile" and spit out a profile.

                    I was thinking about a way to solve my problem (coincidentally using an &instance parameter wink ) that might work for yours too in a more generic way.

                    If you set the instance parameter in each snippet call and append the appropriate value to the re-post links in the tpls, the snippet code would know what instance it was responding to (by comparing the instance value in the $_REQUEST with the parameter). If they don’t match, the parts of the snippet that cause trouble (e.g. service= viewProfile section) could just abort and/or return no output. I’m not sure if that would deal with your problem or would have other nasty side effects or not but I thought I’d mention it.

                    I hope this makes sense (it barely makes sense to me). grin
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 28033
                      • 925 Posts
                      Added both of you guys.

                      As you can see, I got a Google Group up, as well as some other links.

                      Since this thing has a Wiki, you think we should move the documentation into it, since we’ll have to update/edit Scotty’s eventually?

                      EDIT: Does anyone know how to create a milestone, like for 1.3.2? So we can properly track it on the issues page.

                      EDIT2: I connected successfully to w/ the SVN client. Could someone else upload the files for the pending 1.3.2 release, so I can see how it’s supposed to be correctly done? smiley
                        My Snippets
                        -> PopUpChunk v1.0