!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/shutterfly/   drwxr-xr-x
Free 318.38 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:     PrintPhotos.inc (6.61 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 view creates a form to send data to shutterfly.com
 * @package Shutterfly
 * @subpackage UserInterface
 * @author Alan Harder <alan.harder@sun.com>
 * @version $Revision: 15513 $
 */
class PrintPhotosView extends GalleryView {

    
/**
     * @see GalleryView::isImmediate
     */
    
function isImmediate() {
    return 
true;
    }

    
/**
     * @see GalleryView::isControllerLike
     */
    
function isControllerLike() {
    return 
true;
    }

    
/**
     * @see GalleryView::renderImmedate
     */
    
function renderImmediate($status$error) {
    global 
$gallery;
    
$urlGenerator =& $gallery->getUrlGenerator();

    list (
$itemId$returnUrl) = GalleryUtilities::getRequestVariables('itemId''returnUrl');
    if (!empty(
$itemId)) {
        
$cartItemIds = array($itemId => 1);
    } else {
        
$session =& $gallery->getSession();
        
$cartItemIds $session->get('shutterfly.cart');
        
$session->remove('shutterfly.cart');
    }
    if (empty(
$cartItemIds) || empty($returnUrl)) {
        return 
GalleryCoreApi::error(ERROR_BAD_PARAMETER);
    }

    
/* Load the necessary item data */
    
$itemIds array_keys($cartItemIds);
    list (
$ret$items) = GalleryCoreApi::loadEntitiesById($itemIds);
    if (
$ret) {
        return 
$ret;
    }

    list (
$ret$thumbnails) = GalleryCoreApi::fetchThumbnailsByItemIds($itemIds);
    if (
$ret) {
        return 
$ret;
    }

    list (
$ret$resizes) = GalleryCoreApi::fetchResizesByItemIds($itemIds);
    if (
$ret) {
        return 
$ret;
    }

    list (
$ret$preferreds) = GalleryCoreApi::fetchPreferredsByItemIds($itemIds);
    if (
$ret) {
        return 
$ret;
    }

    
$ret GalleryCoreApi::studyPermissions($itemIds);
    if (
$ret) {
        return 
$ret;
    }

    
/* We want to know which are viewable to guests */
    
list ($ret$anonymousUserId) =
        
GalleryCoreApi::getPluginParameter('module''core''id.anonymousUser');
    if (
$ret) {
        return 
$ret;
    }
    
$ret GalleryCoreApi::studyPermissions($itemIds$anonymousUserId);
    if (
$ret) {
        return 
$ret;
    }

    
/* Assemble all our data */
    
$i 1;
    
$entries $protectedIds = array();
    foreach (
$items as $item) {
        
$itemId $item->getId();
        list (
$ret$permissions) = GalleryCoreApi::getPermissions($itemId);
        if (
$ret) {
        return 
$ret;
        }
        list (
$ret$publicPermissions) =
        
GalleryCoreApi::getPermissions($itemId$anonymousUserId);
        if (
$ret) {
        return 
$ret;
        }

        if (!isset(
$permissions['shutterfly.print'])) {
        
/* Skip any cart items for which we don't have print permission */
        
continue;
        }

        
$source = isset($preferreds[$itemId]) ? $preferreds[$itemId] : $item;
        
$needSession = !isset($publicPermissions['core.viewSource']);

        if (
$needSession && !isset($sfSession)) {
        
/*
         * Get G2 session for shutterfly to access non-public images.
         * We can't use this session because hijack protection will prevent access
         * plus the current user could logout before shutterfly retrieves the images.
         * Create a new session with the rights of current user for shutterfly to use.
         */
        
$sfSession = new GallerySession();
        
$ret $sfSession->initEmpty(true$gallery->getActiveUserId());
        if (
$ret) {
            return 
$ret;
        }
        }
        if (
$needSession) {
        
$sessionParam = array($sfSession->getKey() => $sfSession->getId());
        
$protectedIds[] = $source->getId();
        } else {
        
$sessionParam = array();
        }

        
$entry = array('item' => (array)$item);
        
$entry['imageUrl'] = $urlGenerator->generateUrl(
        
array_merge(array('view' => 'core.DownloadItem''itemId' => $source->getId()),
                
$sessionParam),
        array(
'forceSessionId' => false'forceFullUrl' => true));
        
$entry['imageWidth'] = $source->getWidth();
        
$entry['imageHeight'] = $source->getHeight();

        if (!isset(
$thumbnails[$itemId]) || $thumbnails[$itemId]->getPostFilterOperations()) {
        
/* Use the source if the thumbnail has a postfilter (like a watermark) */
        
$thumbSource $source;
        } else {
        
$thumbSource $thumbnails[$itemId];
        }

        
$entry['thumbUrl'] = $urlGenerator->generateUrl(
        array(
'view' => 'core.DownloadItem''itemId' => $thumbSource->getId()),
        array(
'forceSessionId' => $needSession'forceFullUrl' => true));
        
$entry['thumbWidth'] = $thumbSource->getWidth();
        
$entry['thumbHeight'] = $thumbSource->getHeight();

        
/*
         * Ugh, the Shutterfly api doesn't have a parameter for quantity.
         * Repeat the same entry multiple times to get desired quantity!
         */
        
for ($j 0$j $cartItemIds[$itemId]; $j++) {
        
$entries[$i++] = $entry;
        }
    }

    if (isset(
$sfSession)) {
        
/* Mark this session so that it can be treated specially */
        
$sfSession->put('core.isPrintService'$protectedIds);

        
/*
         * TODO: Would like to enforce a particular session timeout to ensure this session
         * lasts long enough for shutterfly to retrieve the images.  Maybe also store the
         * sessionid in this session so we can reuse it for multiple print requests (and
         * just bump timeout each time).
         */
        
$ret $sfSession->save();
        if (
$ret) {
        return 
$ret;
        }
    }

    
/*
     * Ugh, the Shutterfly api can only track its session data via some cookies
     * (redirecting to a url with embedded session id won't work) so we must
     * render a form and submit it.. here we set our own cookie that will be
     * checked to ensure we submit our form only once.
     */
    
if (!headers_sent() /* Should only skip cookie in unit test */) {
        
setcookie('G2_shutterfly''1');
        
header("Content-type: text/html; charset=UTF-8");
    }

    
GalleryCoreApi::requireOnce('modules/core/classes/GalleryTemplate.class');
    
$template = new GalleryTemplate(dirname(dirname(dirname(__FILE__))));
    
$template->setVariable('l10Domain''modules_shutterfly');
    
$template->setVariable('PrintPhotos', array('returnUrl' => $returnUrl,
                            
'count' => count($entries),
                            
'entries' => $entries));
    
$template->display('gallery:modules/shutterfly/templates/PrintPhotos.tpl');

    return 
null;
    }
}
?>

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