News:

CPG Release 1.6.28
added submissions from {406man}
cleaned up a few PHP (8.4) deprecations
fixed PHP deprecation in calendar
removed security vulnerability
(please upgrade when possible)

Main Menu

Recent posts

#1
cpg1.6 bridging / Re: SMF Session Verification E...
Last post by ron4mac - Today at 01:41:01 PM
Thanks for the feedback (please consider posting a github issue in the future).

I don't currently have a SMF setup. Below is how I will change the relevant code:

function _session_load()
{
    $superCage = Inspekt::makeSuperCage();

    if ($superCage->cookie->keyExists('PHPSESSID')) {

        $session_id = $superCage->cookie->getEscaped('PHPSESSID');

        $sql = "SELECT data FROM {$this->sessionstable} WHERE session_id = '$session_id'";

        $result = $this->query($sql);

        if (cpg_db_num_rows($result)) {

            list($data) = cpg_db_fetch_row($result);
            if (substr($data, 0, 2) === 'a:') ini_set('session.serialize_handler', 'php_serialize');  //<-- added

            session_name('CPG');
            session_start();

            session_decode($data);

            $session = $_SESSION;

            return $session;
        }
        $result->free();
    }

    return false;
}

function _session_save($session)
{
    $superCage = Inspekt::makeSuperCage();

    if ($superCage->cookie->keyExists('PHPSESSID')) {

        $session_id = $superCage->cookie->getEscaped('PHPSESSID');

        $_SESSION = $session;

        $data = cpg_db_escape_string(session_encode());  //<-- changed

        $sql = "UPDATE {$this->sessionstable} SET data = '$data' WHERE session_id = '$session_id'";

        $this->query($sql);
    }
}

Could you please verify that it functions properly?
#2
cpg1.6 bridging / SMF Session Verification Error...
Last post by Lighting-Gallery - September 27, 2026, 07:58:23 PM
I was attempting to set up a new Coppermine 1.6 installation bridged to our SMF 2.0.19 forum and hitting log out in CPG would always result in "Session verification failed.  Please try logging out and back in again, and then try again."  I tracked this down to a session serialization issue.  At some point SMF added @ini_set('session.serialize_handler', 'php_serialize') to their Load.php.  In CPG's smf20.inc.php _session_load() function it attempts to decode the session without specifying the handler.  This is usually going to be 'php' not 'php_serialize' and it will fail to deserialize the session.  As a result, it can't pass the session number value to SMF and it displays the error.  Adding the following to the start of _session_load() fixed the issue.

@ini_set('session.serialize_handler', 'php_serialize');
if (ini_get('session.serialize_handler') != 'php_serialize')
    @ini_set('session.serialize_handler', 'php');

I checked SMF 2.1 as well and although it does not display an error upon log out, CPG was still unable to deserialize the session data without it.  That might cause problems for anyone attempting to access SMF session variables within CPG.  It seems to me CPG should update the SMF bridge to deserialize using 'php_serialize'.

#3
cpg1.6 themes (visuals) / Re: Masonry View Code
Last post by phill104 - September 17, 2026, 10:37:37 PM
Well done and thank you for sharing your work.
#4
cpg1.6 themes (visuals) / Masonry View Code
Last post by donsenilo - September 16, 2026, 10:01:56 PM
I created this Code (with a little Help of A.I.) to change the Appearance of the Thumbnails.
It works and looks good (for me), so maybe someone would find it useful.

I created a new Theme using the water_drop as Source. Here is my Site if you wanna have a look: https://myasa.eu/.

This Code goes at the End of the theme.php (but before the //EOF):
/******************************************************************************
 ** Section <<<theme_display_thumbnails>>> - ABSOLUT KRISENSICHERES MASONRY LAYOUT
 ******************************************************************************/
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '')
{
    global $CONFIG;

    if ($nbThumb == 0) {
        theme_no_img_to_display($album_name);
        return;
    }

    // 1. Start des Masonry-Containers
    echo '<div class="cpg_masonry_container">';

    // 2. Loop durch alle Bilder
    foreach ($thumb_list as $thumb) {
        echo '<div class="cpg_masonry_brick">';
       
        // KRISENSICHERER LINK-BAU: Wir generieren die displayimage.php URL direkt aus der Bild-ID (pid)
        if (!empty($thumb['pid'])) {
            $image_url = "displayimage.php?album=" . $aid . "&amp;pid=" . $thumb['pid'];
            echo '<a class="cpg_masonry_link" href="' . $image_url . '">' . $thumb['image'] . '</a>';
        } else {
            // Fallback, falls keine PID existiert (gibt zumindest das Bild aus)
            echo $thumb['image'];
        }
       
        // Bildunterschrift (Dateiname, Bewertungen etc.)
        if (!empty($thumb['caption'])) {
            echo '<div class="cpg_caption">' . $thumb['caption'] . '</div>';
        }
       
        // Admin-Knöpfe für Bearbeiten/Löschen (falls eingeloggt)
        if (!empty($thumb['admin_menu'])) {
            echo '<div class="cpg_admin_menu">' . $thumb['admin_menu'] . '</div>';
        }
       
        echo '</div>';
    }

    echo '</div>';

    // 3. Seitennummerierung (Pagination)
    if ($display_tabs && $total_pages > 1) {
        echo '<div class="cpg_pagination">';
        theme_display_video_tabs($total_pages, $page, $mode);
        echo '</div>';
    }
}
This goes into the style.css:
/* Setzt umschließende System-Tabellen vollständig zurück */
.thumbnails,
.thumbnails > table,
.thumbnails > table > tbody > tr > td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
}

/* Der Hauptcontainer erzeugt das Spalten-Layout */
.cpg_masonry_container {
    display: block !important;
    column-count: 4 !important;
    column-gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 20px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Jede einzelne Kachel */
.cpg_masonry_brick {
    display: inline-block !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    break-inside: avoid !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-radius: 4px;
}

/* Der neue, direkte Link umschließt das Bild perfekt */
a.cpg_masonry_link {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    cursor: pointer !important;         /* Erzwingt das Hand-Symbol */
    text-decoration: none !important;
}

/* Das Bild innerhalb des Links zentrieren */
a.cpg_masonry_link img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    border: none !important;
}

/* Bildtitel und Beschreibung */
.cpg_caption {
    margin-top: 10px !important;
    font-size: 11px !important;
    color: #555 !important;
    line-height: 1.4 !important;
}

/* Admin-Menü falls eingeloggt */
.cpg_admin_menu {
    margin-top: 10px !important;
    font-size: 10px !important;
}

/* RESPONSIVE STEUERUNG */
@media (max-width: 1200px) { .cpg_masonry_container { column-count: 3 !important; } }
@media (max-width: 768px)  { .cpg_masonry_container { column-count: 2 !important; } }
@media (max-width: 480px)  { .cpg_masonry_container { column-count: 1 !important; } }
#5
cpg1.6 bridging / Re: Converting MyBB to SMF
Last post by Krash - September 16, 2026, 01:10:59 AM
Fixed the login problem by enabling subdomain independent cookies in SMF.  Not sure why that worked, Coppermine is installed in subdirectory in forum.

The update ran correctly.  Bridge is working with hacks posted above.  May be able to get original admin's login, but it's ok as is.

Thanks for the info.

#6
cpg1.6 bridging / Re: Converting MyBB to SMF
Last post by phill104 - September 15, 2026, 01:15:26 PM
The login should use the SMF login, that is the expected behaviour. Once logged in at the correct level in SMF you should also be logged into CPG.

If you search these forums there are many posts on recovering a lost admin account. probably best to start there. Once your admin account is restored you can use bridemgr as expected and also run update.php

You can also disable bridging via PHPmyadmin. Browse to the config table and disable bridging there by changing the 1 to a 0 in the bridged_enable entry
#7
cpg1.6 bridging / Re: Converting MyBB to SMF
Last post by Krash - September 15, 2026, 05:22:03 AM
Ok, believe I've upgraded CM to current version 1.6.29 in the production forum.  The update failed, apparently because it was still bridged to MyBB.  Tried bridgemgr.php script but it requires login by whomever originally installed the gallery long ago.  So I hacked the code in smf21.inc.php, hacked the database, and it displayed update progress screen and showed it completed. 

Upgraded CM is apparently now bridged to SMF.  Everything seems to be working, database has been updated, gallery is intact, but we're back to the original problem, CM does not recognize SMF login.  I'm unable to login to CM to access bridge manager, members cannot login to CM.  The CM login redirects to SMF.

Had the same login problem on the acfsmf clone, fixed it by deleting and reinstalling CM, but every time I do something it's different.  Hesitate to try that in production with the hacks in place.

smf21.inc.php hack -


        function __construct()
        {
            global $BRIDGE;

            if (!USE_BRIDGEMGR) {
                require_once('../smf/Settings.php');
                $boardurl = 'http://www.mysite.com/board';
            } else {
            //  require_once($BRIDGE['relative_path_to_config_file'] . 'Settings.php');
                require_once('/home/u0fgcfwp0drf/domains/australian-coins.net/public_html/Settings.php');
            }


Database hack -


short_name    smf21

#8
cpg1.6 bridging / Re: Converting MyBB to SMF
Last post by Krash - September 15, 2026, 04:18:52 AM
Quote from: Krash on September 15, 2026, 04:15:35 AMOk, here's the problem.  Forum has been converted from MyBB to SMF.  Coppermine is still bridged to MyBB.  When I run update.php it errors out with this -


Fatal error: Uncaught Error: Failed opening required '../inc/config.php' (include_path='.:/opt/alt/php80/usr/share/pear:/opt/alt/php80/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/bridge/mybb.inc.php:56 Stack trace: #0 /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/bridge/mybb.inc.php(213): cpg_udb->__construct() #1 /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/include/init.inc.php(246): require_once('/home/u0fgcfwp0...') #2 /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/update.php(23): include_once('/home/u0fgcfwp0...') #3 {main} thrown in /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/bridge/mybb.inc.php on line 56


Can't load CM to get into bridge manager.  Can't login to bridgemgr.php because original install was done years ago by another admin.  I need to change the bridge from MyBB to SMF by manually editing the files, but can't find it.



#9
cpg1.6 bridging / Re: Converting MyBB to SMF
Last post by Krash - September 15, 2026, 04:15:35 AM
Ok, here's the problem.  Forum has been converted from MyBB to SMF.  Coppermine is still bridged to MyBB.  When I run update.php it errors out with this -


Fatal error: Uncaught Error: Failed opening required '../inc/config.php' (include_path='.:/opt/alt/php80/usr/share/pear:/opt/alt/php80/usr/share/php:/usr/share/pear:/usr/share/php') in /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/bridge/mybb.inc.php:56 Stack trace: #0 /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/bridge/mybb.inc.php(213): cpg_udb->__construct() #1 /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/include/init.inc.php(246): require_once('/home/u0fgcfwp0...') #2 /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/update.php(23): include_once('/home/u0fgcfwp0...') #3 {main} thrown in /home/u0fgcfwp0drf/domains/australian-coins.net/public_html/gallery/bridge/mybb.inc.php on line 56


Can't load CM to get into bridge manager.  I need to change the bridge from MyBB to SMF by manually editing the files, but can't find it.


#10
cpg1.6 bridging / Re: Converting MyBB to SMF
Last post by ron4mac - September 14, 2026, 05:01:38 PM
If you upgrade your gallery, AFAIK, you can bridge with SMF 2.1 regardless whether you've previously bridged with MyBB. Steps you should take: unbridge your current 1.6.03 gallery; use the installer_stub (found in this forum or with the Github release files) to upgrade your gallery to 1.6.29; establish the bridge to SMF 2.1.