Plugin for filtering file information in cpg1.5.44 Plugin for filtering file information in cpg1.5.44
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Plugin for filtering file information in cpg1.5.44

Started by martheijnens, November 13, 2016, 03:04:40 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

martheijnens

Hi! I upgraded to cpg 1.5.44. Now, too much file information is exposed like file name, album name, file size and so on. I found a plugin to filter the file information exposed but that plugin is written for cpg 1.4.x. Can I still use that plugin?

Thanks for your response, Mathew

ron4mac

Assuming that you are referring to cpg1.4.x_plugin_display-fields_v1.3, it would need to be modified for GPG 1.5.

martheijnens

Thanks for your response! Yes, That's the one. Which modifications are needed? Is there another way to filter file information?

ron4mac

Add the following to the theme.php file for your theme:

function theme_html_picinfo(&$info)
{
    global $lang_picinfo, $CONFIG, $CURRENT_PIC_DATA, $LINEBREAK;

$filter = array('Dimensions','Filesize'); //titles of fields that you don't want

    if ($CONFIG['picinfo_movie_download_link']) {
        $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
        $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
        if ($mime_content['content']=='movie') {
            $info[$lang_picinfo['download_URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $path_to_pic.'">'. $lang_picinfo['movie_player'] .'</a>';
        }
    }

    $html = '';
    $html .= '        <tr><td colspan="2" class="tableh2">'.$lang_picinfo['title'].'</td></tr>' . $LINEBREAK;
    $template = '        <tr><td class="tableb tableb_alternate" valign="top" >%s:</td><td class="tableb tableb_alternate">%s</td></tr>' . $LINEBREAK;
    foreach ($info as $key => $value) {
    if (in_array($key, $filter)) continue;
        $html .= sprintf($template, $key, $value);
    }

    return $html;
}


Add titles to $filter for the items that you don't want displayed.