Advanced search  

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

Pages: [1]   Go Down

Author Topic: [Done]: Add file input box to the CPG index page.  (Read 4500 times)

0 Members and 1 Guest are viewing this topic.

Riox

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 55
[Done]: Add file input box to the CPG index page.
« on: March 12, 2008, 03:05:10 am »

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.
« Last Edit: March 12, 2008, 07:26:02 pm by Sami »
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: Add file input box to the CPG index page.
« Reply #1 on: March 12, 2008, 03:45:47 am »

If you want to display an upload box from within your theme, just insert
Code: [Select]
<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.
Logged

Riox

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 55
Re: Add file input box to the CPG index page.
« Reply #2 on: March 12, 2008, 04:46:33 am »

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)
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Add file input box to the CPG index page.
« Reply #3 on: March 12, 2008, 06:05:06 am »

1.Edit themes/smf_1-1_rc2/template.html and put this
Code: [Select]
{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 (?>)
Code: [Select]
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
Logged
‍I don't answer to PM with support question
Please post your issue to related board

Riox

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 55
Re: Add file input box to the CPG index page.
« Reply #4 on: March 12, 2008, 05:56:42 pm »

Works like a charm. Thank you!
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 17 queries.