News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Copyright & Footer Links

Started by All Colours Sam, May 16, 2009, 01:31:09 PM

Previous topic - Next topic

All Colours Sam

more than 10 years later, a new version has been released :P

- support for SMF 2.1.x
- removed the enable setting
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Rick53

You were very fast. Thanks very much.  :)

But I misunderstood. The Mod shows a text in the footer. My wish was to insert a link instead.
Example: Text "imprint" combined with a link.
Can the mod be supplemented in this way?


Rick53

It worked! So easy ...
Thanks

All Colours Sam

Yes the textfield admits plain text as well as any HTML tags, just be aware of who has admin access to your forum since there is no sanitization or otherwise any kind of filter.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

pikeman


Rick53

The mod works fine for me.
With HTML link or as text
SMF 2.1.3 with Curve2, PHP8

All Colours Sam

Quote from: pikeman on May 18, 2023, 03:24:01 PMThe mod reports the following error: https://i.postimg.cc/wvR8nX1y/Dnevnik-gre-aka.png .



Probably some other mod, since this one uses hooks, CustomCopy.english is the last (or first) file that gets loaded and PHP incorrectly assumes the error comes from that file.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

[chrisB]

#148
Many thanks for the mod, it makes life easier to update a modified theme I altered based on the Curve theme. 👍🏻

--

If like me, you prefer your sites copyright up top. Use this edit:

CustomCopy.php
/public_html/Sources
Find
/* Buffer time */
function CFL_Buffer($buffer)
{
global $modSettings;

if(empty($modSettings['CFL_foot_links'])) {
return $buffer;
}

$customCopy = $modSettings['CFL_foot_links'];
return preg_replace_callback(

'/(<li class="copyright">.+?)+(<\/li>)/i',

function($match) use ($customCopy) {
return ($match[1] .  ' ' . $customCopy);
},
$buffer
);
}


Replace
/* Buffer time */
function CFL_Buffer($buffer)
{
    global $modSettings;

    if (empty($modSettings['CFL_foot_links'])) {
        return $buffer;
    }

    $customCopy = $modSettings['CFL_foot_links'];
    return preg_replace_callback(

        '/(<li class="copyright">.+?)+(<\/li>)/i',

        function ($match) use ($customCopy) {
            return ($customCopy . ' ' . $match[1]);
        },
        $buffer
    );
}

Key change is:  return ($customCopy . ' ' . $match[1]);
I'm stuck in a time warp from the early 00's.

nfpuu1u

Quote from: pikeman on May 18, 2023, 03:24:01 PMThe mod reports the following error: https://i.postimg.cc/wvR8nX1y/Dnevnik-gre-aka.png .


FWIW posting error messages as screenshots are unfortunately bad in many ways because eg. users are not finding them when searching with the forum search (like it was the case for me), these are not getting indexed by search engines and similar.

Instead please use the "code" BBCode for posting these which i'm doing now:

Guest
CLI cron.php
/var/www/html/Sources/Security.php (Line 1358)
Backtrace information

Type of error: Cron
Error message Select
2: Cannot modify header information - headers already sent by (output started at /var/www/html/Themes/default/languages/CustomCopy.english.php:1)

A solution for this will be posted next / separately.

nfpuu1u

Quote from: nfpuu1u on July 12, 2025, 04:08:20 AMGuest
CLI cron.php
/var/www/html/Sources/Security.php (Line 1358)
Backtrace information

Type of error: Cron
Error message Select
2: Cannot modify header information - headers already sent by (output started at /var/www/html/Themes/default/languages/CustomCopy.english.php:1)

So i noticed the same error, did some research and found these two postings which are talking about something called "BOM" (https://en.wikipedia.org/wiki/Byte_order_mark) which seems to get inserted by e.g. Windows editors in edited files:

https://www.simplemachines.org/community/index.php?topic=586993.msg4168307#msg4168307

https://www.simplemachines.org/community/index.php?topic=573373.msg4057112#msg4057112

and Bingo after inspecting the file:

$ file Themes/default/languages/CustomCopy.english.php
Themes/default/languages/CustomCopy.english.php: PHP script, Unicode text, UTF-8 (with BOM) text



After editing the file CustomCopy.english.php and removing the BOM (Please use your favorite search engine how to do this with your favorite editor) the BOM is gone within the file:

$ file Themes/default/languages/CustomCopy.english.php
Themes/default/languages/CustomCopy.english.php: PHP script, ASCII text



At least for me the error messages in the logs are now gone as well.

nfpuu1u

#151
Forgot to mention that all three included language files seems to use that BOM (all others of the Mod are fine):

find . -type f -exec file {} \;

./license.txt: ASCII text
./readme.txt: ASCII text
./package-info.xml: XML 1.0 document, ASCII text
./remove.php: PHP script, ASCII text
./languages/CustomCopy.english.php: PHP script, Unicode text, UTF-8 (with BOM) text
./languages/CustomCopy.spanish_es.php: PHP script, Unicode text, UTF-8 (with BOM) text
./languages/CustomCopy.spanish_latin.php: PHP script, Unicode text, UTF-8 (with BOM) text
./redirect.txt: HTML document, ASCII text
./install.php: PHP script, ASCII text
./CustomCopy.php: PHP script, ASCII text

Hint for:

Quote from: nfpuu1u on July 12, 2025, 04:14:07 AMPlease use your favorite search engine how to do this with your favorite editor.

For vi/vim it is e.g.:

:set nobomb

There seems to be also tools like eg. dos2unix which can do the same.[/code]

Advertisement: