[Done]: Add file input box to the CPG index page. [Done]: Add file input box to the CPG index page.
 

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

[Done]: Add file input box to the CPG index page.

Started by Riox, March 12, 2008, 03:05:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Riox

System: CPG 1.4.16 – Bridge -> SMF 1.1.4 | PHP 5.2.4
URL: http://foxbox.cc/ (Gallery w/o login is clean and afaik SFW)
Many of my visitors come from 4/7/f-chan and it appears that many of them overlook the Upload button so I'd like to have a file imput box there (see attached picture).
The Themen is based on http://coppermine-gallery.net/demo/cpg14x/index.php?theme=smf_1-1_rc2

Since I have no idear how complex this is going to be, just throw me a number.

SaWey

If you want to display an upload box from within your theme, just insert

<form method="post" action="upload.php" enctype="multipart/form-data">
        <input type="file" name="file_upload_array[]" size="40" class="listbox" />
<input type="hidden" name="control" value="phase_1" />
        <input type="submit" value="UPLOAD" class="button" />
</form>

somewhere in it.

If you want to disable this for certain users etc., you'll need to add some more code.

Riox

Guests cannot upload anything (no public albums and personal gallery uploads). So it would be cool if the upload box is only shown to those who logged in (Registered and Administrators Group)

Sami

1.Edit themes/smf_1-1_rc2/template.html and put this

{UPLOAD}

where ever you want upload box to show

2.Edit themes/smf_1-1_rc2/theme.php and put this code just before php end tag (?>)

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

        $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
        header("Content-Type: text/html; charset=$charset");
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{UPLOAD}' => theme_upload(),
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        );

    echo template_eval($template_header, $template_vars);
}
function theme_upload(){
if(USER_ID){
$upload = <<<EOT
<form method="post" action="upload.php" enctype="multipart/form-data">
        <input type="file" name="file_upload_array[]" size="40" class="listbox" />
<input type="hidden" name="control" value="phase_1" />
        <input type="submit" value="UPLOAD" class="button" />
</form>
EOT;
}else{
$upload = '';
}
return $upload;
}

You're done
‍I don't answer to PM with support question
Please post your issue to related board

Riox