!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.39 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:     ItemEditRotateAndScalePhoto.inc (8.18 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 plugin will handle applying operations to a photo
 * @package GalleryCore
 * @subpackage UserInterface
 * @author Bharat Mediratta <bharat@menalto.com>
 * @version $Revision: 15513 $
 */
class ItemEditRotateAndScalePhoto extends ItemEditPlugin {

    
/**
     * @see ItemEditPlugin::handleRequest
     */
    
function handleRequest($form, &$item, &$preferred) {
    list (
$ret$module) = GalleryCoreApi::loadPlugin('module''core');
    if (
$ret) {
        return array(
$retnullnullnull);
    }

    
$status null;
    
$error = array();

    
$operation null;
    
/* Figure out which command we're taking */
    
if (isset($form['action']['resize'])) {
        if (empty(
$form['resize']['width']) || empty($form['resize']['height'])) {
        
$error[] = 'form[error][resize][size][missing]';
        } else if (!(
$tmp rtrim($form['resize']['width'], '%'))
            || !
is_numeric($tmp) || $tmp 1
            
|| !($tmp rtrim($form['resize']['height'], '%'))
            || !
is_numeric($tmp) || $tmp 1) {
        
$error[] = 'form[error][resize][size][invalid]';
        } else {
        
$operation 'scale';
        
$args = array($form['resize']['width'], $form['resize']['height']);
        }
    } else if (isset(
$form['action']['rotate']['clockwise'])) {
        
$operation 'rotate';
        
$args = array(90);
    } else if (isset(
$form['action']['rotate']['counterClockwise'])) {
        
$operation 'rotate';
        
$args = array(-90);
    } else if (isset(
$form['action']['rotate']['flip'])) {
        
$operation 'rotate';
        
$args = array(180);
    } else if (isset(
$form['action']['revertToOriginal'])) {
        if (!empty(
$preferred)) {
        
/*
         * Pull out the rotate and resize operations and let our change ripple
         * down the derivative tree, if necessary
         */
        
$remainingOperations = array();
        foreach (
split(';'$preferred->getDerivativeOperations()) as $tmpOperation) {
            if (
preg_match("/^(rotate|resize|scale)\|/"$tmpOperation)) {
            
$ret GalleryCoreApi::adjustDependentDerivatives($preferred->getId(),
                                      
$tmpOperation,
                                      
true);
            if (
$ret) {
                return array(
$retnullnullnull);
            }
            } else {
            
$remainingOperations[] = $tmpOperation;
            }
        }

        list (
$ret$lockId) = GalleryCoreApi::acquireWriteLock($preferred->getId());
        if (
$ret) {
            return array(
$retnullnullnull);
        }
        list (
$ret$preferred) = $preferred->refresh();
        if (
$ret) {
            return array(
$retnullnullnull);
        }

        if (
$remainingOperations) {
            
$preferred->setDerivativeOperations(join(';'$remainingOperations));
        } else {
            
$preferred->setDerivativeOperations(null);
        }

        
$ret $preferred->save();
        if (
$ret) {
            return array(
$retnullnullnull);
        }

        
$ret GalleryCoreApi::releaseLocks($lockId);
        if (
$ret) {
            return array(
$retnullnullnull);
        }

        if (
$preferred->hasNoOperations()) {
            
$ret GalleryCoreApi::remapSourceIds(
            
$preferred->getId(), $preferred->getDerivativeSourceId());
            if (
$ret) {
            return array(
$retnullnullnull);
            }

            
$ret GalleryCoreApi::deleteEntityById($preferred->getId());
            if (
$ret) {
            return array(
$retnullnullnull);
            }
        }

        
/* Prepare our status message */
        
$status $module->translate('Reverted rotate and scale changes successfully');
        }
    }

    
$preserveOriginal = isset($form['preserveOriginal']);

    if (
$form['serialNumber'] != $item->getSerialNumber()) {
        return array(
GalleryCoreApi::error(ERROR_OBSOLETE_DATA), nullnullnull);
    }

    
/*
     * If we have a command, then apply it to the correct object.
     */
    
if (!empty($operation)) {
        
$ret GalleryCoreApi::applyToolkitOperation(
        
$operation$args$preserveOriginal$item$preferred);
        if (
$ret) {
        return array(
$retnullnullnull);
        }

        
/* Set our status message */
        
switch ($operation) {
        case 
'rotate':
        
$status $module->translate('Rotated photo successfully');
        break;

        case 
'scale':
        
$status $module->translate('Scaled photo successfully');
        break;
        }
    }

    return array(
null$error$statusfalse);
    }

    
/**
     * @see ItemEditPlugin::loadTemplate
     */
    
function loadTemplate(&$template, &$form$item$thumbnail) {
    
$ItemEditRotateAndScalePhoto = array();

    list (
$ret$ItemEditRotateAndScalePhoto['isAdmin']) =
        
GalleryCoreApi::isUserInSiteAdminGroup();
    if (
$ret) {
        return array(
$retnullnull);
    }

    if (
$form['formName'] != 'ItemEditRotateAndScalePhoto') {
        
/* First time around, reset the form */
        
$form['resize']['width'] = $form['resize']['height'] = '';
        
$form['preserveOriginal'] = 1;
        
$form['formName'] = 'ItemEditRotateAndScalePhoto';
    }

    if (
$item->isLinked()) {
        
$ItemEditRotateAndScalePhoto['editPhoto']['isLinked'] = true;
        
$ItemEditRotateAndScalePhoto['editPhoto']['isLinkedTo'] = false;
    } else {
        list (
$ret$linkedIds) = GalleryCoreApi::fetchEntitiesLinkedTo($item->getId());
        if (
$ret) {
        return array(
$retnullnull);
        }

        
$ItemEditRotateAndScalePhoto['editPhoto']['isLinkedTo'] = !empty($linkedIds);
        
$ItemEditRotateAndScalePhoto['editPhoto']['isLinked'] = false;
    }

    
/* Check to see if we have a preferred source */
    
list ($ret$results) =
        
GalleryCoreApi::fetchPreferredsByItemIds(array($item->getId()));
    if (
$ret) {
        return array(
$retnullnull);
    }

    
/* Can we allow to delete the original? */
    
$mimeType $item->getMimeType();
    list (
$ret$toolkit) =
        
GalleryCoreApi::getToolkitByOperation($mimeType'rotate');
    if (
$ret) {
        return array(
$retnullnull);
    }
    
$ItemEditRotateAndScalePhoto['editPhoto']['noToolkitSupport'] = !isset($toolkit);
    
/* Get worst of rotate and resize */
    
if (isset($toolkit)) {
        list (
$ret$toolkit) =
        
GalleryCoreApi::getToolkitByOperation($mimeType'resize');
        if (
$ret) {
        return array(
$retnullnull);
        }
        
$ItemEditRotateAndScalePhoto['editPhoto']['noToolkitSupport'] = !isset($toolkit);
    }

    
$sourceMimeTypes = array($mimeType);

    if (empty(
$results)) {
        
$ItemEditRotateAndScalePhoto['editPhoto']['hasPreferredSource'] = false;
    } else {
        
$preferred $results[$item->getId()];
        if (
preg_match("/(rotate|resize|scale)\|/"$preferred->getDerivativeOperations())) {
        
$ItemEditRotateAndScalePhoto['editPhoto']['hasPreferredSource'] = true;
        } else {
        
$ItemEditRotateAndScalePhoto['editPhoto']['hasPreferredSource'] = false;
        }
        
$sourceMimeTypes[] = $preferred->getMimeType();
    }

    
/* Figure out what options we can provide */
    
list ($ret$ItemEditRotateAndScalePhoto['editPhoto']['can']['rotate']) =
        
$this->_checkForOperation('rotate'$sourceMimeTypes);
    if (
$ret) {
        return array(
$retnullnull);
    }

    list (
$ret$ItemEditRotateAndScalePhoto['editPhoto']['can']['resize']) =
        
$this->_checkForOperation('scale'$sourceMimeTypes);
    if (
$ret) {
        return array(
$retnullnull);
    }

    
$template->setVariable('ItemEditRotateAndScalePhoto'$ItemEditRotateAndScalePhoto);
    
$template->setVariable('controller''core.ItemEditRotateAndScalePhoto');
    return array(
null,
             
'modules/core/templates/ItemEditRotateAndScalePhoto.tpl''modules_core');
    }

    
/**
     * @see ItemEditPlugin::isSupported
     */
    
function isSupported($item$thumbnail) {
    return (
GalleryUtilities::isA($item'GalleryPhotoItem'));
    }

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

    return array(
null$module->translate('Modify Photo'));
    }
}
?>

:: 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.0238 ]--