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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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