Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Plogger gallery

  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2008
    Messaggi
    266

    Plogger gallery

    Buongiorno a tutti!
    Ho scoperto uno script molto ma molto efficente. Una galleria di immagini che usa php e mysql, facile da gestire, con la possibilità di creare cartelle sotto cartelle ed un form di ricerca.
    La gallery si chiama plogger. Ora l'unica cosa che manca a questa galleria è la protezione di alcuni album (che decido io) con una password differente ovviamente dagli altri album, quindi durante l'upload dell'album e delle foto (dal pannello di controllo) vorrei avere la possibilità di mettere una password.

    Nel forum ufficiale c'è una discussione che ne parla, ma sinceramente io non sono riuscito a fare ciò. (nonostante abbia seguito la guida diciamo così..)

    Ecco il sito dove vi è lo script: http://www.plogger.org/

    Qui invece la discussione per proteggere gli album, che a quanto ho capito e provato, serve a proteggere si gli album, ma con una password prefissata in un db e uguale per tutti.

    http://www.plogger.org/forum/discuss...albums/#Item_0

    Sapete aiutarmi pls?

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2008
    Messaggi
    266
    Non riesco a capire quale di quelle risposte (se ce...) sia quella che interessa a me, cioè nell'amministrazione della galleria appena inserisco l'album devo spuntare la password con un checkbox e scriverla sotto in un form, se il checkbox non viene spuntato allora l'album sarà visibile a tutti.

    Aiutatemi per favore..

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2008
    Messaggi
    266
    Ho trovato le pagine da modificare ma non so come mettere il form e farlo scrivere nel db..

    Pagina upload.php:

    Codice PHP:
    <?php
    /* Code by Mike Johnson -- [email]mike@solanosystems.com[/email] October 23rd, 2004.
     This is the main administrative interface code. To change the look of the interface, change /plog-admin/css/admin.css.
     The initial tab is UPLOAD function. */

    // Load configuration variables from database, plog-globals, & plog-includes/plog-functions
    require_once(dirname(dirname(__FILE__)).'/plog-load-config.php');
    require(
    PLOGGER_DIR.'plog-admin/plog-admin.php');

    function 
    generate_albums_menu($albums) {
        
    $albums_menu = isset($_REQUEST['albums_menu']) ? $_REQUEST['albums_menu'] : '';
        
    $new_album_name = isset($_REQUEST['new_album_name']) ? $_REQUEST['new_album_name'] : '';
        
    $output '<select tabindex="50" style="width: 80%;" name="albums_menu" onclick="var k=document.getElementsByName(\'destination_radio\');k[0].checked=true;">';
        foreach(
    $albums as $album_id => $album) {

            if (
    $albums_menu == $album_id || $new_album_name == $album['album_name']) {
                
    $selected ' selected="selected"';
            } else {
                
    $selected '';
            }

            
    $output .= "\n\t\t\t\t\t\t" '<option value="'.$album_id.'"'.$selected.'>'.SmartStripSlashes($album['collection_name']).': '.SmartStripSlashes($album['album_name']).'</option>';
        }
        
    $output .= "\n\t\t\t\t\t</select>";

        return 
    $output;
    }

    function 
    generate_collections_menu() {
        
    $collections get_collections();
        
    $output '<select class="no-margin-top" tabindex="80" style="width: 80%;" name="collections_menu" id="collections_menu">';
        foreach(
    $collections as $collection) {

            
    $output .= "\n\t\t\t\t\t\t" '<option value="'.$collection['id'].'">'.SmartStripSlashes($collection['name']).'</option>';
        }
        
    $output .= "\n\t\t\t\t\t</select>";

        return 
    $output;
    }

    $output "\n\t" '<h1>'.plog_tr('Upload Images').'</h1>' "\n";

    // Check if update has been clicked, handle erroneous conditions, or upload
    if (isset($_REQUEST['upload'])) {
        foreach(
    $_REQUEST as $key => $val$_REQUEST[$key] = stripslashes($val);

        
    $pi pathinfo($_FILES['userfile']['name']);

        if (
    $_FILES['userfile']['name'] == '') {
            
    $output .= "\n\t" '<p class="errors">'.plog_tr('No filename specified').'!</p>' "\n";
        } else if (
    strtolower($pi['extension']) == 'zip') {
            
    // Let's decompress the zip file into the 'plog-content/uploads/' folder and then redirect the user to plog-import.php
            
    include(PLOGGER_DIR.'plog-includes/lib/pclzip-2-4/pclzip.lib.php');
            
    // Zip file to extract
            
    $archive = new PclZip($_FILES['userfile']['tmp_name']);

            
    // Create a temporary folder in 'plog-content/uploads/' based on the .zip file name
            
    $zipname strtolower(sanitize_filename(substr($_FILES['userfile']['name'], 0, -4)));
            
    $zipdir $config['basedir'].'plog-content/uploads/'.$zipname;
            
    $zipdirkey md5($zipdir);
            
    $zipresult makeDirs($zipdir);

            if (
    is_safe_mode()) {
                
    chmod_ftp($zipdir0777);
            }

            
    // Extract to 'plog-content/uploads/' folder
            
    $results $archive->extract(PCLZIP_OPT_REMOVE_ALL_PATHPCLZIP_OPT_PATH$zipdir);
            if (
    is_safe_mode()) {
                
    chmod_ftp($zipdir);
            }

            if (
    $results == 0) {
                
    // Failed
                
    $output .= "\n\t" '<p class="errors">'.plog_tr('Error').': '.$archive->errorInfo(true).'</p>' "\n";
            } else {
                
    // Unzip succeeded - doesn't necessarily mean that saving the images succeeded
                
    $errors = array();

                foreach (
    $results as $r) {
                    if (
    $r['status'] != 'ok') {
                        
    $errors[] = $r;
                    }
                }

                if (empty(
    $errors)) {
                    
    // Let's redirect to the import interface.
                    
    header('location: plog-import.php?directory='.$zipdirkey);
                    exit;
                } else {
                    
    $output .= "\n\t" '<p class="errors">'.plog_tr('There were some problems importing the files').':

    "\n";

                    foreach (
    $errors as $e) {
                        
    $output .= $e['stored_filename'].': '.$e['status'].'
    '
    ;
                    }

                    
    $output .= '
    .
                    
    sprintf(plog_tr('You can proceed to the [url="%s"]Import[/url] section to view any files that were successfully uploaded'), 'plog-import.php').'.</p>' "\n";
                }
            }

        } else if (!
    is_allowed_extension($pi['extension'])) {
            
    $output .= "\n\t" '<p class="errors">'.plog_tr('Plogger cannot handle this type of file').'.</p>' "\n";
        } else if (
    $_FILES['userfile']['error'] == 1) {
            
    $output .= "\n\t" '<p class="errors">'.plog_tr('File exceeded upload filesize limit').'!</p>' "\n";
        } else if (
    $_FILES['userfile']['size'] == 0) {
            
    $output .= "\n\t" '<p class="errors">'.plog_tr('File does not exist').'!</p>' "\n";
        } else if (!isset(
    $_REQUEST['destination_radio'])) {
            
    $output .= "\n\t" '<p class="errors">'.plog_tr('No destination album specified').'!</p>' "\n";
        } else {
            if (
    $_REQUEST['destination_radio'] == 'new' && $_REQUEST['new_album_name'] == ''){
                
    $output .= "\n\t" '<p class="errors">'.plog_tr('New album name not specified').'!</p>' "\n";
            } else {
                if (
    $_REQUEST['destination_radio'] == 'new') {
                    
    // Create the new album
                    
    $result add_album(mysql_real_escape_string($_REQUEST['new_album_name']), NULL$_REQUEST['collections_menu']);
                    if (!
    $result['errors']) {
                        
    // No errors, add uploaded image to new album
                        
    $album_id $result['id'];
                    } else {
                        
    // Errors exist, let's find out what they are
                        
    if (isset($result['output']) && $result['output'] == 'existing' && isset($result['id'])) {
                            
    // Album already exists so try insert images into the existing album
                            // and alert the user that their "new" album is already existing
                            
    $album_id $result['id'];
                            
    // Get the collection name for display
                            
    $sql "SELECT `name` FROM ".PLOGGER_TABLE_PREFIX."collections WHERE id = ".intval($_REQUEST['collections_menu']);
                            
    $result run_query($sql);
                            
    $row mysql_fetch_assoc($result);
                            
    $output .= "\n\t" '<p class="actions">'.sprintf(plog_tr('Album already exists. Uploading file to existing album %s in collection %s'), '[b]'.$_REQUEST['new_album_name'].'[/b]''[b]'.$row['name'].'[/b]').'</p>' "\n";
                        } else {
                            
    // Error has nothing to do with an existing album, show the returned error
                            
    $album_id '';
                            
    $output .= "\n\t" '<p class="errors">'.$result['errors'].'</p>' "\n";
                        }
                    }
                } else {
                    
    // Use an existing album
                    
    $album_id $_REQUEST['albums_menu'];
                }

                if (
    $album_id) {
                    
    $result add_picture($album_id$_FILES['userfile']['tmp_name'], $_FILES['userfile']['name'], $_REQUEST['caption'], $_REQUEST['description']);
                    if (!
    $result['errors']) {
                        
    // Added uploaded image successfully
                        
    $output .= "\n\t" '<p class="success">'.$result['output'].'</p>' "\n";
                    } else {
                        
    // Errors adding the image, show the returned error
                        
    $output .= "\n\t" '<p class="errors">'.$result['errors'].'</p>' "\n";
                    }
                }

            }
        }
    }

    $output .= "\n\t" '<form id="uploadForm" action="'.$_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data">
        <table class="cssbox-upload" cellspacing="0" cellpadding="0">
            <tr style="margin: 0;">
                <th class="cssbox-upload-head-blue"><h2>'
    .plog_tr('Choose an Image or ZIP Archive').'</h2></th>
                <th></th>
                <th class="cssbox-upload-head-green"><h2>'
    .plog_tr('Choose a Destination Album').'</h2></th>
            </tr>
            <tr>
                <td class="cssbox-upload-body">
                    <div class="no-margin-top no-margin-bottom">
                        <label class="no-margin-top" accesskey="n" for="userfile">'
    .sprintf(plog_tr('File[i]n[/i]ame (%s limit)'), ini_get('upload_max_filesize')).':</label>
                        <input class="no-margin-top" tabindex="10" id="userfile" name="userfile" value="Vali fail" type="file" onchange="checkArchive(this)" />'
    ;

    if (!
    is_writable(PLOGGER_DIR.'plog-content/uploads/')) {
        
    $output .= "\n\t\t\t\t\t" '<p class="actions" id="zip-alert" style="display: none;">'.sprintf(plog_tr('Please make sure the %s directory is writable before uploading a %s file'), '[b]plog-content/uploads/[/b]''.zip').'</p>';
    }

    $output .= "\n\t\t\t\t\t" '<label accesskey="c" for="caption">'.plog_tr('Picture [i]C[/i]aption (optional)').':</label>
                        <input class="no-margin-top" tabindex="20" name="caption" id="caption" style="width: 90%;" />
                        <label accesskey="d" for="description">'
    .plog_tr('[i]D[/i]escription (optional)').':</label>
                        <textarea class="no-margin-top" tabindex="30" name="description" id="description" style="width: 90%;" cols="43" rows="6"></textarea>
                    </div>
                </td>'
    ;

    $albums get_albums();

    $output .= "\n\t\t\t" '<td style="width: 2%;"></td>
                <td class="cssbox-upload-body">
                    <div class="no-margin-bottom">
                        <input tabindex="40" onclick="var k=document.getElementsByName(\'albums_menu\');k[0].focus();" type="radio" name="destination_radio" id="destination_radio" accesskey="a" value="existing" checked="checked" />
                        <label for="destination_radio" style="display: inline;">'
    .plog_tr('Existing [i]A[/i]lbum').'</label>
                        '
    .generate_albums_menu($albums).'
                    </div>
                    <h3 style="text-indent: 10px; margin-bottom: 15px;">'
    .plog_tr('-- OR --').'</h3>
                    <div>
                        <input tabindex="60" onclick="var k=document.getElementsByName(\'new_album_name\');k[0].focus();" type="radio" name="destination_radio" accesskey="b" value="new" />
                        <label for="new_album_name" style="display: inline;">'
    .plog_tr('Create a New Al[i]b[/i]um').'</label>
                        <label class="no-margin-bottom" for="new_album_name" style="font-weight: normal;">'
    .plog_tr('New Album Name').':</label>
                        <input class="no-margin-top" tabindex="70" style="width: 79%;" onclick="var k=document.getElementsByName(\'destination_radio\');k[1].checked=true;" type="text" id="new_album_name" name="new_album_name" />
                        <label class="no-margin-bottom" for="collections_menu" style="font-weight: normal;">'
    .plog_tr('In Collection').':</label>
                        '
    .generate_collections_menu().'
                    </div>
                    <p class="align-left no-margin-top no-margin-bottom" style="text-indent: 5px;"><input class="submit" type="submit" name="upload" value="'
    .plog_tr('Upload').'" /></p>
                </td>
            </tr>
        </table>
        </form>'
    ."\n";

    $output_error "\n\t" '<h1>'.plog_tr('Upload Images').'</h1>

        <p class="actions">'
    .sprintf(plog_tr('Before you can begin uploading images to your gallery, you must create at least [b]one collection[/b] AND [b]one album[/b] within that collection. Move over to the [url="%s"]Manage[/url] tab to begin creating your gallery structure.'), 'plog-manage.php').'</p>';

    require_once(
    PLOGGER_DIR.'plog-admin/includes/install-functions.php');

    if (
    gd_missing()) {
        
    $output_error "\n\t" '<h1>'.plog_tr('Upload Images').'</h1>

        <p class="errors">'
    .plog_tr('PHP GD extension is not installed, it is required to upload images.').'</p>';
        
    display($output_error'upload');
    } else {
        
    $num_albums count_albums();
        if (
    $num_albums 0)
        
    display($output'upload');
        else
        
    display($output_error'upload');
    }
    ?>
    Verso la fine c'è il codice da modificare (penso):
    Codice PHP:
    $albums get_albums();

    $output .= "\n\t\t\t" '<td style="width: 2%;"></td>
                <td class="cssbox-upload-body">
                    <div class="no-margin-bottom">
                        <input tabindex="40" onclick="var k=document.getElementsByName(\'albums_menu\');k[0].focus();" type="radio" name="destination_radio" id="destination_radio" accesskey="a" value="existing" checked="checked" />
                        <label for="destination_radio" style="display: inline;">'
    .plog_tr('Existing [i]A[/i]lbum').'</label>
                        '
    .generate_albums_menu($albums).'
                    </div>
                    <h3 style="text-indent: 10px; margin-bottom: 15px;">'
    .plog_tr('-- OR --').'</h3>
                    <div>
                        <input tabindex="60" onclick="var k=document.getElementsByName(\'new_album_name\');k[0].focus();" type="radio" name="destination_radio" accesskey="b" value="new" />
                        <label for="new_album_name" style="display: inline;">'
    .plog_tr('Create a New Al[i]b[/i]um').'</label>
                        <label class="no-margin-bottom" for="new_album_name" style="font-weight: normal;">'
    .plog_tr('New Album Name').':</label>
                        <input class="no-margin-top" tabindex="70" style="width: 79%;" onclick="var k=document.getElementsByName(\'destination_radio\');k[1].checked=true;" type="text" id="new_album_name" name="new_album_name" />
                        <label class="no-margin-bottom" for="collections_menu" style="font-weight: normal;">'
    .plog_tr('In Collection').':</label>
                        '
    .generate_collections_menu().'
                    </div>
                    <p class="align-left no-margin-top no-margin-bottom" style="text-indent: 5px;"><input class="submit" type="submit" name="upload" value="'
    .plog_tr('Upload').'" /></p>
                </td>
            </tr>
        </table>
        </form>'
    ."\n"
    Ditemi se vi serve altro...

  4. #4
    Utente di HTML.it
    Registrato dal
    Apr 2008
    Messaggi
    266
    Ragazzi ho seguito questa guida per la protezione della password:
    http://www.plogger.org/forum/discuss...albums/#Item_0

    guardate la prima risposta di dzmoore.

    Ho fatto il tutto, ora io invece di ineserire la password per il gruppo vorrei assegnare la password dall'amministrazione.. avete qualche idea? per favore aiutatemi..

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.