!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:     ItemEditCaptions.inc (8.17 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 controller will save many item captions at once.
 * @package GalleryCore
 * @subpackage UserInterface
 * @author Bharat Mediratta <bharat@menalto.com>
 * @author Changpeng Zhao
 * @version $Revision: 15513 $
 */
class ItemEditCaptionsController extends GalleryController {

    
/**
     * @see GalleryController::handleRequest
     */
    
function handleRequest($form) {
    list (
$itemId$page) = GalleryUtilities::getRequestVariables('itemId''page');

    
$status $error = array();
    if (isset(
$form['action']['save'])) {
        
$ids array_keys($form['items']);

        list (
$ret$lockId) = GalleryCoreApi::acquireWriteLock($ids);
        if (
$ret) {
        return array(
$retnull);
        }

        
/* We'll check permissions one at a time below, but precache them now */
        
$ret GalleryCoreApi::studyPermissions($ids);
        if (
$ret) {
        return array(
$retnull);
        }

        list (
$ret$items) = GalleryCoreApi::loadEntitiesById($ids);
        if (
$ret) {
        return array(
$retnull);
        }

        list (
$ret$markup) =
        
GalleryCoreApi::getPluginParameter('module''core''misc.markup');
        if (
$ret) {
        return array(
$retnull);
        }

        
$status['successCount'] = 0;
        
$status['errorCount'] = 0;
        foreach (
$items as $item) {
        
/* Make sure we have permission to edit this item */
        
list ($ret$permissions) = GalleryCoreApi::getPermissions($item->getId());
        if (
$ret) {
            return array(
$retnull);
        }

        
$id $item->getId();
        if (isset(
$permissions['core.edit'])) {
            if (
$item->getSerialNumber() == $form['items'][$id]['serialNumber']) {
            if (
$markup == 'html') {
                
/* Strip malicious content if html markup allowed */
                
$form['items'][$id]['title'] =
                
GalleryUtilities::htmlSafe($form['items'][$id]['title'], true);
                
$form['items'][$id]['summary'] =
                
GalleryUtilities::htmlSafe($form['items'][$id]['summary'], true);
                
$form['items'][$id]['description'] =
                  
GalleryUtilities::htmlSafe($form['items'][$id]['description'], true);
            }

            
$item->setTitle($form['items'][$id]['title']);
            
$item->setSummary($form['items'][$id]['summary']);
            
$item->setKeywords($form['items'][$id]['keywords']);
            
$item->setDescription($form['items'][$id]['description']);

            
$ret $item->save();
            if (
$ret) {
                return array(
$retnull);
            }
            
$status[$id]['saved'] = 1;
            
$status['successCount']++;
            } else {
            
$status[$id]['obsolete'] = 1;
            
$status['errorCount']++;
            }
        } else {
            
$status[$id]['permissionDenied'] = 1;
            
$status['errorCount']++;
        }
        }

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

        
/*
         * Figure out where to redirect.  We always redirect even if we have
         * an error since we may have saved some items, but not others.
         */
        
$redirect['view'] = 'core.ItemAdmin';
        
$redirect['subView'] = 'core.ItemEditCaptions';
        
$redirect['itemId'] = (int)$itemId;
        if (!
$status['errorCount'] && isset($form['action']['save']['next'])) {
        
$redirect['page'] = $page 1;
        } else if (!
$status['errorCount'] && isset($form['action']['save']['previous'])) {
        
$redirect['page'] = max($page-10);
        } else if (!
$status['errorCount'] && isset($form['action']['save']['done'])) {
        
$results['return'] = 1;
        
$redirect['page'] = (int)$page;
        } else {
        
$redirect['page'] = (int)$page;
        }
    } else if (isset(
$form['action']['cancel'])) {
        
$results['return'] = 1;
    }

    if (!empty(
$redirect)) {
        
$results['redirect'] = $redirect;
    } else {
        
$results['delegate']['view'] = 'core.ItemAdmin';
        
$results['delegate']['subView'] = 'core.ItemEditCaptions';
    }
    
$results['status'] = $status;
    
$results['error'] = $error;

    return array(
null$results);
    }
}

/**
 * This view will allow the user to edit many item captions at once.
 */
class ItemEditCaptionsView extends GalleryView {

    
/**
     * @see GalleryView::loadTemplate
     */
    
function loadTemplate(&$template, &$form) {
    global 
$gallery;

    list (
$itemId$page$selectedId$albumPage) =
        
GalleryUtilities::getRequestVariables('itemId''page''selectedId''albumPage');

    if (
$form['formName'] != 'ItemEditCaption') {
        
$form['formName'] = 'ItemEditCaption';
        
$form['numPerPage'] = 9;

        list (
$ret$item) = GalleryCoreApi::loadEntitiesById($itemId);
        if (
$ret) {
        return array(
$retnull);
        }

        list (
$ret$childIds) =
        
GalleryCoreApi::fetchChildItemIdsWithPermission($itemId'core.edit');
        if (
$ret) {
        return array(
$retnull);
        }

        
$form['childItems'] = array();
        
$numPages 1;
        
$numPages ceil(sizeof($childIds) / $form['numPerPage']);
        if (empty(
$page) && !empty($selectedId)) {
        
/* No page given.  Determine which page we're on from the selectedId */
        
for ($i 0$i count($childIds); $i++) {
            if (
$childIds[$i] == $selectedId) {
            
$page ceil(($i 1) / $form['numPerPage']);
            }
        }
        }
        if (empty(
$page) && !empty($albumPage)) {
        
/* Still no page.  Determine which page we're on from albumPage */
        
list ($ret$theme) = $this->loadThemeForItem($item);
        if (
$ret) {
            return array(
$retnull);
        }
        list (
$ret$params) = $theme->fetchParameters($itemId);
        if (
$ret) {
            return array(
$retnull);
        }
        
$albumPageSize $theme->getPageSize($params);
        if (!empty(
$albumPageSize)) {
            
$page ceil((($albumPage 1) * $albumPageSize 1) / $form['numPerPage']);
        }
        }
        if (empty(
$page)) {
        
$page 1;
        }

        
$start $form['numPerPage'] * ($page 1);
        
$childIds array_slice($childIds$start$form['numPerPage']);

        list (
$ret$childItems) = GalleryCoreApi::loadEntitiesById($childIds);
        if (
$ret) {
        return array(
$retnull);
        }

        
/* Get child thumbnails and resizes */
        
list ($ret$derivatives) = GalleryCoreApi::fetchDerivativesByItemIds($childIds);
        if (
$ret) {
        return array(
$retnull);
        }

        
/* build peers table */
        
foreach ($childItems as $child) {
        
$childId $child->getId();
        
$form['items'][$childId] = (array)$child;

        
/* While we're at it, attach thumbnails and resizes */
        
if (isset($derivatives[$childId])) {
            foreach (
$derivatives[$childId] as $derivative) {
            
$type $derivative->getDerivativeType();
            if (empty(
$form['items'][$childId]['resize']) &&
                    
$type == DERIVATIVE_TYPE_IMAGE_RESIZE) {
                
$form['items'][$childId]['resize'] = (array)$derivative;
            } else if (
$type == DERIVATIVE_TYPE_IMAGE_THUMBNAIL) {
                
$form['items'][$childId]['thumbnail'] = (array)$derivative;
            }
            }
        }
        }
    }

    
$urlGenerator =& $gallery->getUrlGenerator();

    
$ItemEditCaptions = array();
    
$ItemEditCaptions['canCancel'] = $urlGenerator->isNavigationBackPossible();
    
$ItemEditCaptions['page'] = $page;
    
$ItemEditCaptions['numPages'] = $numPages;

    
$template->setVariable('ItemEditCaptions'$ItemEditCaptions);
    
$template->setVariable('controller''core.ItemEditCaptions');
    
$template->javascript('lib/yui/yahoo-min.js');
    
$template->javascript('lib/yui/dom-min.js');
    
$template->javascript('lib/yui/event-min.js');
    
$template->javascript('lib/yui/container-min.js');
    return array(
null, array('body' => 'modules/core/templates/ItemEditCaptions.tpl'));

    }

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

    return array(
null$core->translate('edit captions'));
    }
}
?>

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