Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: kesulin on May 21, 2019, 06:49:53 AM

Title: Random BBCode Fix to SMF 2
Post by: kesulin on May 21, 2019, 06:49:53 AM
I am new to SMF and of course new to this comunity. Please excuse me if I broke any rule posting here and for my english too.

I try to install this mod in my SMF installation:
https://custom.simplemachines.org/mods/index.php?mod=1247 (https://custom.simplemachines.org/mods/index.php?mod=1247)

but is broken. I fix the mod for my installation and now is running. Please some admin can upload it and share with the comunity.
Thanks in advance.
Title: Re: Random BBCode Fix to SMF 2
Post by: Rock Lee on May 21, 2019, 07:08:25 PM
Broken in what way? also you can not redistribute a modification for the rights has the same. In addition you simply have to see this: How can I install a mod that doesn't work in my SMF version? (https://wiki.simplemachines.org/smf/How_can_I_install_a_mod_that_doesn%27t_work_in_my_SMF_version).


Regards!
Title: Re: Random BBCode Fix to SMF 2
Post by: kesulin on May 22, 2019, 02:28:19 AM
When install the old versiĆ³n, some problem occurrs in file Subs.php. The code was added to start of the file, out of the php tag. This text is visible in index page always.
Also, the code used a trigger.
I change all this code and use one similar than dice mod.

Quote
<file name="$sourcedir/Subs.php">
      <operation>
         <search position="after"><![CDATA[         array(
            'tag' => 'blue',
   ]]></search>
         <add><![CDATA[         array(
            'tag' => 'randomquote',
            'before' => '<div style="font-size:x-small; background-color:#ffffff; margin:5px 20px; border:1px dashed black; filter:alpha(opacity=50); opacity:0.5;">',
            'after' => '</div>',
         ),
   ]]></add>
      </operation>
   </file>   

In Subs-Post.php I added new code for check someone is editing the result. This code was copied from dice mod too.

Quote
<file name="$sourcedir/Subs-Post.php">
   <operation>
         <search position="before"><![CDATA[// Now let's quickly clean up things that will slow our parser (which are common in posted code.)
   $message = strtr($message, array('[]' => '&#91;]', '[&#039;' => '&#91;&#039;'));]]></search>
         <add><![CDATA[

   // remove anyone who posted with the [randomquote] tag, bah, ye cheating riffraff
   global $txt, $settings;
   $message = preg_replace('~\[/randomquote\]~i', '', $message);
   $message = preg_replace('~\[randomquote[^\]]*\]~i', "(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2F%7B%24settings%26%2391%3B%26%23039%3Bimages_url%26%23039%3B%5D%7D%2FRandom_warn.gif&hash=188fcc3cafe492b381369db11c4882a9) {$txt['random_cheat']}\n", $message);
   // random them values!
   $message = preg_replace_callback('~\[random\]([^\[]*)\[/random\]~i', 'random_bbcode', $message);]]></add>
      </operation>

I also changed the function random_bbcode, move funcion from file Subs.php to Subs-Post.php.
Title: Re: Random BBCode Fix to SMF 2
Post by: kesulin on May 22, 2019, 03:10:51 AM
Broken in what way? also you can not redistribute a modification for the rights has the same. In addition you simply have to see this: How can I install a mod that doesn't work in my SMF version? (https://wiki.simplemachines.org/smf/How_can_I_install_a_mod_that_doesn%27t_work_in_my_SMF_version).


Regards!
I didn't know this option. But I try it with Tabbed Smileys mod
http://custom.simplemachines.org/mods/index.php?mod=2782 (http://custom.simplemachines.org/mods/index.php?mod=2782)

And don't work, there are a problem with step 4 in ManageSmileys.php file. I solved this editing manually after force install mod.
Title: Re: Random BBCode Fix to SMF 2
Post by: Rock Lee on May 23, 2019, 12:33:03 PM
@kesulin You can not distribute a modification for the subject of the copyright of the author, unless you have an explicit authorization on it. If you mention the solution in the topic of the modification is something else and can help others to modify it manually being under their responsibility.

I didn't know this option. But I try it with Tabbed Smileys mod
http://custom.simplemachines.org/mods/index.php?mod=2782 (http://custom.simplemachines.org/mods/index.php?mod=2782)

And don't work, there are a problem with step 4 in ManageSmileys.php file. I solved this editing manually after force install mod.

Each modification is different and some may require an update by the author, in new versions it improves faults that are found and therefore can change the code that some modification uses. If after installing manually generates error you have to see the error log which may give you an indication that it is failing but I think you will receive better support in the corresponding forum.


Regards!