!C99Shell v. 1.0 pre-release build #13!

Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a 

uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 

uid=99(nobody) gid=98(nobody) groups=98(nobody) 

Safe-mode: OFF (not secure)

/home/jerryg/public_html/gallery2/modules/core/   drwxr-xr-x
Free 318.36 GB of 458.09 GB (69.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     ItemAddFromBrowser.inc (8.13 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2007 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
 */

/**
 * This ItemAdd plugin adds items uploaded from the web browser.
 * @package GalleryCore
 * @subpackage UserInterface
 * @author Bharat Mediratta <bharat@menalto.com>
 * @version $Revision: 15513 $
 */
class ItemAddFromBrowser extends ItemAddPlugin {

    
/**
     * @see ItemAddPlugin::handleRequest
     */
    
function handleRequest($form, &$item) {
    global 
$gallery;

    
$status = array();
    
$error = array();
    
$uploaded false;
    list (
$ret$module) = GalleryCoreApi::loadPlugin('module''core');
    if (
$ret) {
        return array(
$retnullnull);
    }
    if (isset(
$form['action']['addFromBrowser'])) {
        list (
$ret$markup) =
        
GalleryCoreApi::getPluginParameter('module''core''misc.markup');
        if (
$ret) {
        return array(
$retnullnull);
        }

        
/* Upload any new files */
        
for ($i 1$i <= count($form['name']); $i++) {
        
$newItem null;

        
/* Placeholder for later */
        
if (!empty($form['tmp_name'][$i]) && !empty($form['size'][$i])) {
            
$file = array('name' => $form['name'][$i],
                  
'type' => $form['type'][$i],
                  
'tmp_name' => $form['tmp_name'][$i],
                  
'size' => $form['size'][$i],
                  
'caption' => $form['caption'][$i]);

            if (
$markup == 'html') {
            
/* Strip malicious content if html markup allowed */
            
$file['caption'] = GalleryUtilities::htmlSafe($file['caption'], true);
            }

            
/* Get the mime type from the upload info. */
            
$mimeType $file['type'];

            
/*
             * If we don't get useful data from that or its a type we don't
             * recognize, take a swing at it using the file name.
             */
            
list ($ret$mimeExtensions) =
            
GalleryCoreApi::convertMimeToExtensions($mimeType);
            if (
$mimeType == 'application/octet-stream' ||
                
$mimeType == 'application/unknown' ||
                empty(
$mimeExtensions)) {
            
$extension GalleryUtilities::getFileExtension($file['name']);
            list (
$ret$mimeType) = GalleryCoreApi::convertExtensionToMime($extension);
            if (
$ret) {
                
$mimeType 'application/unknown';
            }
            }

            
$filename basename($file['name']);
            list (
$base$extension) = GalleryUtilities::getFileNameComponents($filename);
            
$title = ($form['set']['title'] == 'filename') ? $base
               
: (($form['set']['title'] == 'caption') ? $file['caption'] : '');
            
$summary = empty($form['set']['summary']) ? '' $file['caption'];
            
$description = empty($form['set']['description']) ? '' $file['caption'];

            
/*
             * Don't use uploaded files, because the framework cannot safely copy them.
             * Move it to our temporary directory first.
             */

            
$platform =& $gallery->getPlatform();
            if (
$platform->is_uploaded_file($file['tmp_name'])) {
            
$tmpFile $platform->move_uploaded_file($file['tmp_name']);
            if (!
$tmpFile) {
                return array(
GalleryCoreApi::error(ERROR_PLATFORM_FAILURE), nullnull);
            }
            
$needToDeleteTmpFile true;
            } else {
            
$tmpFile $file['tmp_name'];
            
$needToDeleteTmpFile false;
            }

            list (
$ret$newItem) = GalleryCoreApi::addItemToAlbum(
            
$tmpFile$filename$title$summary,
            
$description$mimeType$item->getId());

            
/* Get rid of the tmp file if necessary */
            
if ($needToDeleteTmpFile) {
            @
$platform->unlink($tmpFile);
            }

            if (
$ret) {
            return array(
$retnullnull);
            }

            
$status['addedFiles'][] = array('fileName' => $file['name'],
                            
'id' => $newItem->getId(),
                            
'warnings' => array());
            
$uploaded true;
        } else if (!empty(
$form['name'][$i])) {
            
$error[] = 'form[error][upload][' $i ']';
            if (empty(
$form['error'])) {
            
$form['error'][$i] = -1;
            }
            switch(
$form['error'][$i]) {
            case 
UPLOAD_ERR_INI_SIZE:
            
$warning $module->translate(array(
                
'text' => 'Input file %s exceeds maximum permitted file size',
                
'arg1' => $form['name'][$i]));
            break;

            case 
UPLOAD_ERR_FORM_SIZE:
            
$warning $module->translate(array(
                
'text' => 'Input file %s exceeds file size specified in the form',
                
'arg1' => $form['name'][$i]));
            break;

            case 
UPLOAD_ERR_PARTIAL:
            
$warning $module->translate(array(
                
'text' => 'Input file %s was only partially uploaded',
                
'arg1' => $form['name'][$i]));
            break;

            default:
            
$warning $module->translate(array(
                
'text' => 'Input file %s was not uploaded. Error %d',
                
'arg1' => $form['name'][$i],
                
'arg2' => $form['error'][$i]));
            }
            
$status['addedFiles'][] = array('fileName' => $form['name'][$i],
                            
'id' => null,
                            
'warnings' => array($warning));
        }
        }
        if (
$uploaded || empty($status)) {
        
/*
         * Some files were uploaded successfully (or not even attempted)
         * Go to confirmation page, even if there were errors in uploads
         */
        
$error = array();
        } else {
        
GalleryUtilities::putRequestVariable('ItemAddFromBrowserStatus',
                             
$status['addedFiles']);
        }
    }

    return array(
null$error$status);
    }

    
/**
     * @see ItemAdd:loadTemplate
     */
    
function loadTemplate(&$template, &$form$item) {
    
$fileUploadsBool GalleryUtilities::getPhpIniBool('file_uploads');
    
$totalUploadSize ini_get('post_max_size');
    if (
preg_match("/(\d+)M/"$totalUploadSize$matches)) {
        
$totalUploadSize $matches[1] * 1024 1024;
    }

    
$maxFileSize ini_get('upload_max_filesize');
    if (
preg_match("/(\d+)M/"$maxFileSize$matches)) {
        
$maxFileSize $matches[1] * 1024 1024;
    }
    
$status GalleryUtilities::getRequestVariables('ItemAddFromBrowserStatus');

    list (
$ret$module) = GalleryCoreApi::loadPlugin('module''core');
    if (
$ret) {
        return array(
$retnullnull);
    }

    foreach (array(
'totalUploadSize''maxFileSize') as $key) {
        if ($
$key >= 1024 1024) {
        $
$key $module->translate(array('one' => '%d megabyte',
                         
'many' => '%d megabytes',
                         
'count' => (int)($$key / (1024 1024)),
                         
'arg1' => (int)($$key / (1024 1024))));
        } else if ($
$key >= 1024) {
        $
$key $module->translate(array('one' => '%d kilobytes',
                         
'many' => '%d kilobytes',
                         
'count' => (int)($$key / (1024)),
                         
'arg1' => (int)($$key / (1024))));
        }
    }

    if (
$form['formName'] != 'ItemAddFromBrowser') {
        
$form['set'] = array('title' => 'filename''summary' => 1'description' => 1);
        
$form['formName'] = 'ItemAddFromBrowser';
    }

    
$titleList = array('filename' => $module->translate('Base filename'),
               
'caption' => $module->translate('Caption'),
               
'' => $module->translate('Blank'));

    
$template->setVariable('ItemAddFromBrowser',
        array(
'totalUploadSize' => $totalUploadSize,
          
'maxFileSize' => $maxFileSize,
          
'uploadsPermitted' => $fileUploadsBool,
          
'titleList' => $titleList,
          
'status' => $status));

    
/* Set the ItemAdmin form's encoding type specially since we're uploading binary files */
    
if ($template->hasVariable('ItemAdmin')) {
        
$ItemAdmin =& $template->getVariableByReference('ItemAdmin');
        
$ItemAdmin['enctype'] = 'multipart/form-data';
    } else {
        
$ItemAdmin['enctype'] = 'multipart/form-data';
        
$template->setVariable('ItemAdmin'$ItemAdmin);
    }

    return array(
null'modules/core/templates/ItemAddFromBrowser.tpl''modules_core');
    }

    
/**
     * @see ItemAddPlugin::getTitle
     */
    
function getTitle() {
    list (
$ret$module) = GalleryCoreApi::loadPlugin('module''core');
    if (
$ret) {
        return array(
$retnull);
    }

    return array(
null$module->translate('From Web Browser'));
    }
}
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0254 ]--