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

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/home/mnnews/public_html/login/phpmyadmin/setup/lib/   drwxr-xr-x
Free 4.41 GB of 27.03 GB (16.3%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     ConfigGenerator.class.php (5.21 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Config file generator
*
* @package PhpMyAdmin-Setup
*/

/**
* Config file generation class
*
* @package PhpMyAdmin
*/
class ConfigGenerator
{
    
/**
     * Creates config file
     *
     * @param ConfigFile $cf Config file instance
     *
     * @return string
     */
    
public static function getConfigFile(ConfigFile $cf)
    {
        
$crlf = (isset($_SESSION['eol']) && $_SESSION['eol'] == 'win')
            ?
"\r\n"
            
: "\n";
        
$conf = $cf->getConfig();

        
// header
        
$ret = '<?php' . $crlf
            
. '/*' . $crlf
            
. ' * Generated configuration file' . $crlf
            
. ' * Generated by: phpMyAdmin '
                
. $GLOBALS['PMA_Config']->get('PMA_VERSION')
                .
' setup script' . $crlf
            
. ' * Date: ' . date(DATE_RFC1123) . $crlf
            
. ' */' . $crlf . $crlf;

        
//servers
        
if (! empty($conf['Servers'])) {
            
$ret .= self::getServerPart($cf, $crlf, $conf['Servers']);
            unset(
$conf['Servers']);
        }

        
// other settings
        
$persistKeys = $cf->getPersistKeysMap();

        foreach (
$conf as $k => $v) {
            
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
            
$ret .= self::_getVarExport($k, $v, $crlf);
            if (isset(
$persistKeys[$k])) {
                unset(
$persistKeys[$k]);
            }
        }
        
// keep 1d array keys which are present in $persist_keys (config.values.php)
        
foreach (array_keys($persistKeys) as $k) {
            if (
/*overload*/mb_strpos($k, '/') === false) {
                
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
                
$ret .= self::_getVarExport($k, $cf->getDefault($k), $crlf);
            }
        }
        
$ret .= '?' . '>';

        return
$ret;
    }

    
/**
     * Returns exported configuration variable
     *
     * @param string $var_name  configuration name
     * @param mixed  $var_value configuration value(s)
     * @param string $crlf      line ending
     *
     * @return string
     */
    
private static function _getVarExport($var_name, $var_value, $crlf)
    {
        if (!
is_array($var_value) || empty($var_value)) {
            return
"\$cfg['$var_name'] = "
                
. var_export($var_value, true) . ';' . $crlf;
        }
        
$ret = '';
        if (
self::_isZeroBasedArray($var_value)) {
            
$ret = "\$cfg['$var_name'] = "
                
. self::_exportZeroBasedArray($var_value, $crlf)
                .
';' . $crlf;
        } else {
            
// string keys: $cfg[key][subkey] = value
            
foreach ($var_value as $k => $v) {
                
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
                
$ret .= "\$cfg['$var_name']['$k'] = "
                    
. var_export($v, true) . ';' . $crlf;
            }
        }
        return
$ret;
    }

    
/**
     * Check whether $array is a continuous 0-based array
     *
     * @param array $array Array to check
     *
     * @return boolean
     */
    
private static function _isZeroBasedArray(array $array)
    {
        for (
$i = 0, $nb = count($array); $i < $nb; $i++) {
            if (! isset(
$array[$i])) {
                return
false;
            }
        }
        return
true;
    }

    
/**
     * Exports continuous 0-based array
     *
     * @param array  $array Array to export
     * @param string $crlf  Newline string
     *
     * @return string
     */
    
private static function _exportZeroBasedArray(array $array, $crlf)
    {
        
$retv = array();
        foreach (
$array as $v) {
            
$retv[] = var_export($v, true);
        }
        
$ret = "array(";
        if (
count($retv) <= 4) {
            
// up to 4 values - one line
            
$ret .= implode(', ', $retv);
        } else {
            
// more than 4 values - value per line
            
$imax = count($retv);
            for (
$i = 0; $i < $imax; $i++) {
                
$ret .= ($i > 0 ? ',' : '') . $crlf . '    ' . $retv[$i];
            }
        }
        
$ret .= ')';
        return
$ret;
    }

    
/**
     * Generate server part of config file
     *
     * @param ConfigFile $cf      Config file
     * @param string     $crlf    Carriage return char
     * @param array      $servers Servers list
     *
     * @return string
     */
    
protected static function getServerPart(ConfigFile $cf, $crlf, $servers)
    {
        if (
$cf->getServerCount() === 0) {
            return
null;
        }

        
$ret = "/* Servers configuration */$crlf\$i = 0;" . $crlf . $crlf;
        foreach (
$servers as $id => $server) {
            
$ret .= '/* Server: '
                
. strtr($cf->getServerName($id) . " [$id] ", '*/', '-')
                .
"*/" . $crlf
                
. '$i++;' . $crlf;
            foreach (
$server as $k => $v) {
                
$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
                
$ret .= "\$cfg['Servers'][\$i]['$k'] = "
                    
. (is_array($v) && self::_isZeroBasedArray($v)
                        ?
self::_exportZeroBasedArray($v, $crlf)
                        :
var_export($v, true))
                    .
';' . $crlf;
            }
            
$ret .= $crlf;
        }
        
$ret .= '/* End of servers configuration */' . $crlf . $crlf;
        return
$ret;
    }
}

:: 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 #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0052 ]--