• Welcome to Simple Machines Community Forum. Please login or sign up.
December 07, 2021, 07:08:08 AM

News:

Wondering if this will always be free?  See why free is better.


Random BBCode Fix to SMF 2

Started by kesulin, May 21, 2019, 06:49:53 AM

Previous topic - Next topic

kesulin

May 21, 2019, 06:49:53 AM Last Edit: May 22, 2019, 07:48:30 PM by Illori
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

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.

-Rock Lee-

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?.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

kesulin

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', " {$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.

kesulin

Quote from: 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?.


Regards!
I didn't know this option. But I try it with Tabbed Smileys mod
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.

-Rock Lee-

@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.

Quote from: kesulin on May 22, 2019, 03:10:51 AM
I didn't know this option. But I try it with Tabbed Smileys mod
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!
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Advertisement: