smilies bug :(

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mtha
    Senior Member
    • Oct 2002
    • 348
    • 3.6.x

    smilies bug :(

    I've look around, but couldnt find anyone talking about this problem.

    If you add some smilies, something more standard (used in YIM), for example :) and :)), you wont get the smilies that you want.

    Process:

    - Go to Admin CP
    - add smilies, add a smilies something like :)) for (for example)
    (make sure that you still have :) as )
    - post a new thread, having both :) and :))

    => both of them become and )

    The problem should also happen to the same type of code. See attachment!

    Reason:
    - vB search for :) and replace them as , before they can find :))

    I have vB 2.3.0

    Anyonw knows how to deal with this problem?



    Somehow, InvisionBoard does a very good job on inserting those smilies, without any problem.
    Attached Files
    Last edited by mtha; Fri 21 Feb '03, 10:23pm.
  • mtha
    Senior Member
    • Oct 2002
    • 348
    • 3.6.x

    #2
    One suggestion to fix this problem:

    Only replace those with  +$smilies+ 
    by that way, you dont have to worry about writing some "unexpected smilies code" in your text.

    btw, could anyone tell me which file / function do the smilies process (replace and display smiles). Thanks

    Comment

    • filburt1
      Senior Member
      • Feb 2002
      • 6606

      #3
      Originally posted by mtha
      One suggestion to fix this problem:

      Only replace those with  +$smilies+ 
      by that way, you dont have to worry about writing some "unexpected smilies code" in your text.

      btw, could anyone tell me which file / function do the smilies process (replace and display smiles). Thanks
      Follow the flow of bbcodeparse, it's buried somewhere in functions.php.

      BTW it's not a bug; how does vB know that you actually want to type one emoticon when you mean another?
      --filburt1, vBulletin.org/vBulletinTemplates.com moderator
      Web Design Forums.net: vB Board of the Month
      vBulletin Mail System (vBMS): webmail for your forum users

      Comment

      • mtha
        Senior Member
        • Oct 2002
        • 348
        • 3.6.x

        #4
        Originally posted by filburt1
        Follow the flow of bbcodeparse, it's buried somewhere in functions.php.
        Thanks

        BTW it's not a bug; how does vB know that you actually want to type one emoticon when you mean another?

        In smilies table, I add :)) for but it displayed as and ) because it replace :) as before looking for :)) first

        well, maybe it's not bug, it just acts wrong in some cases.

        we also can fix this by replacing "longest" smilies first, so, when a thread displayed, it will find :)) first, and then :)

        Comment

        • filburt1
          Senior Member
          • Feb 2002
          • 6606

          #5
          I'm not sure but I think the smilies parser is just run by str_replace so it would be much harder to make it "intelligent."
          --filburt1, vBulletin.org/vBulletinTemplates.com moderator
          Web Design Forums.net: vB Board of the Month
          vBulletin Mail System (vBMS): webmail for your forum users

          Comment

          • mtha
            Senior Member
            • Oct 2002
            • 348
            • 3.6.x

            #6
            I didnt look at all the code of InvisionBoard but they can do this perfectly.

            Do you know the SQL function, to sort smilies according to its length?

            in function.php:
            PHP Code:
                 $smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie" ); 
            If I sort (ORDER BY) this $smilies as its length, it could fix the problem.

            Comment

            • filburt1
              Senior Member
              • Feb 2002
              • 6606

              #7
              You know it just might. This query works, at least:
              Code:
              SELECT smilietext, smiliepath FROM smilie ORDER BY LENGTH(smilietext) DESC;
              --filburt1, vBulletin.org/vBulletinTemplates.com moderator
              Web Design Forums.net: vB Board of the Month
              vBulletin Mail System (vBMS): webmail for your forum users

              Comment

              • mtha
                Senior Member
                • Oct 2002
                • 348
                • 3.6.x

                #8
                Originally posted by filburt1
                You know it just might. This query works, at least:
                Code:
                 
                SELECT smilietext, smiliepath FROM smilie ORDER BY LENGTH(smilietext) DESC;
                it works perfect. Thank you, filburt1

                PHP Code:
                 $smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie ORDER BY LENGTH( `smilietext` ) DESC"); 

                I now only have to deal with smilies having > or < chars, as it is replaced by &gt; and &lt;
                If I replace it back to > and < in smilies function, does it harm anything?

                Comment

                • filburt1
                  Senior Member
                  • Feb 2002
                  • 6606

                  #9
                  Yes, it lets people use HTML in their posts.
                  --filburt1, vBulletin.org/vBulletinTemplates.com moderator
                  Web Design Forums.net: vB Board of the Month
                  vBulletin Mail System (vBMS): webmail for your forum users

                  Comment

                  • mtha
                    Senior Member
                    • Oct 2002
                    • 348
                    • 3.6.x

                    #10
                    Originally posted by filburt1
                    Yes, it lets people use HTML in their posts.

                    Then I'll replace smilies > or < to &gt; and &lt;
                    It works perfect now

                    Do you think it could give any problem, or security hole?


                    Code:
                    if($dosmilies) {
                    	$bbcode=str_replace("&gt;)", "&gt; )", $bbcode);
                    	$bbcode=str_replace("&lt;)", "&lt; )", $bbcode);
                    	if(!isset($smilies)) {
                    	 $smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie [b][color=red]ORDER BY LENGTH( `smilietext` ) DESC[/color][/b]" ); 
                    	} else {
                    	 $DB_site->data_seek(0,$smilies);
                    	}
                    	while ($smilie=$DB_site->fetch_array($smilies)) {
                    	 if(trim($smilie[smilietext])!="" ) {
                    [b][color=red]	$smilie[smilietext]=str_replace("<","&lt;",$smilie[smilietext]);
                    	$smilie[smilietext]=str_replace(">","&gt;",$smilie[smilietext]);[/color][/b]	 
                    		$bbcode=str_replace(trim($smilie[smilietext]),"<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\">",$bbcode);
                    	 }
                    	}
                    }
                    Last edited by mtha; Sat 22 Feb '03, 2:45pm.

                    Comment

                    • filburt1
                      Senior Member
                      • Feb 2002
                      • 6606

                      #11
                      \ is an escape character and isn't replaced.

                      BTW before a mod replies you should probably post this at vB.org.
                      --filburt1, vBulletin.org/vBulletinTemplates.com moderator
                      Web Design Forums.net: vB Board of the Month
                      vBulletin Mail System (vBMS): webmail for your forum users

                      Comment

                      • Cary
                        Senior Member
                        • Apr 2002
                        • 4433
                        • 3.6.x

                        #12
                        Please take this discussion over to http://vbulletin.org since it's related to hacking!

                        Comment

                        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...