CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/opt/cpanel/ea-php56/root/usr/share/pear/RVSeagullMod/modules/main/classes/
Upload File :
Current File : //proc/self/root/opt/cpanel/ea-php56/root/usr/share/pear/RVSeagullMod/modules/main/classes/Main.php

<?php
##copyright##

class Main 
{
    
    function Main()
    {

    }


    function verifyModules($moduleName)
    {
        $c = SGL_Config::singleton();
        $conf = $c->getAll();   
        $dbh = SGL_DB::singleton();        
        // Return true or false
        $query = "
            SELECT module_id
            FROM " . $conf['table']['module'] . "
            WHERE name = " . $dbh->quoteSmart($moduleName) . "
        ";
    
        //Fix PHP5.3 (use MDB2)
        $res = $dbh->getAll($query, SGL_DB_FETCHMODE_ASSOC);
        // If enable module and copy modules script status is true
        if (is_dir(SGL_MOD_DIR . '/' . $moduleName) && (count($res) > 0) && $this->isModuleSetupDb($moduleName)) {
            return true;
        } else {
            return false;
        }
    }
    
    function isModuleSetupDb($component) 
    {
        $c = SGL_Config::singleton();
        $conf = $c->getAll();   
        $dbh = SGL_DB::singleton();
        
        $query = "SHOW TABLES";
        //fix php 5.3 (use MDB2)
        $res = $dbh->getAll($query, SGL_DB_FETCHMODE_ORDERED);
         
        if ($component == 'smfweb') {
        	foreach ($res as $aTableName) {
        		if ($aTableName[0] === $conf['table']['smfweb_members']) return true;
        	}        
        } elseif ($component == 'forums') {
        	// component in table module and setup complete return true enable module
        	foreach ($res as $aTableName) {
        		if (isset($conf['table']['forums_members']) && $aTableName[0] === $conf['table']['forums_members'] && is_file(SGL_Config::get('path.webRoot') . '/forums/installcomplete.sql')) return true;
        	}
        } elseif ($component == 'blogweb') {
        	foreach ($res as $aTableName) {
        		if ($aTableName[0] === $conf['table']['serendipity_authors']) return true;
        	}
        } elseif ($component == 'faqweb') {
        	foreach ($res as $aTableName) {
        		if ($aTableName[0] === $conf['table']['faqweb_faquser']) return true;
        	}
        } else {
            return true;
        
        }
        return false;
    }
    
    
    /**
     * Formats input so it can be safely used in a query avoid SQL injection
     * http://php.net/manual/en/security.database.sql-injection.php
     * 
     * This is similar to PEAR::DB_common::quoteSmart which locale independent
     * but only support MySQL and use mysql_real_escape_string to escape string.
     * 
     * @param mixed $value  the data to be formatted
     * @return mixed  the formatted data.  
     */
    function quoteSmart($value, $skipQuotes = false) 
    {
                
        if (is_int($value)) {
            $safeValue =  $value;                
        } elseif (is_float($value)) {
            $safeValue = $this->_quoteFloat($value);
        } elseif (is_bool($value)) {
            $safeValue = $this->_quoteBoolean($value);
        } elseif (is_null($value)) {
            $safeValue = 'NULL';
        } else {
           // if magic quotes are enabled, any slashes are removed by $req->get();
           // no logic needed to take care of it again.
           $safeValue = "'" . mysql_real_escape_string($value) . "'";
        } 
        
        if ($skipQuotes) {
            // เอา ' ออก
        }
        
        return $safeValue;
    }

    /**
     * Formats a float value for use within a query in a locale-independent
     * manner. 
     * 
     * Copied from PEAR::DB_common but only support MySQL
     *
     * @param float the float value to be quoted.
     * @return string the quoted string.
     * @see PEAR::DB_common::quoteBoolean() v 1.7.9
     */
    function _quoteFloat($float)
    {
        return "'" . mysql_real_escape_string(str_replace(',', '.', strval(floatval($float)))) . "'";
    }

    /**
     * Formats a boolean value for use within a query in a locale-independent
     * manner.
     *
     * Identical to PEAR::DB_common
     *    
     * @param boolean the boolean value to be quoted.
     * @return string the quoted string.
     * @see PEAR::DB_common::quoteBoolean() v 1.7.9
     */
    function _quoteBoolean($boolean)
    {
        return $boolean ? '1' : '0';
    }

    
    function jsAddSlashes($str)
    {
       $pattern = array(
           "/\\\\/"  , "/\n/"    , "/\r/"    , "/\"/"    ,
           "/\'/"    , "/&/"    , "/</"    , "/>/"
       );
       $replace = array(
           "\\\\\\\\", "\\n"    , "\\r"    , "\\\""    ,
           "\\'"    , "\\x26"  , "\\x3C"  , "\\x3E"
       );
       return preg_replace($pattern, $replace, $str);
    }
    
    /**
     * ทำหน้าที่ Map ภาษาของ Component ต่างๆ เรียกใช้โดย SGL > Task > Process
     * 
     * @param component the component name to find the language key
     * @param lang the current SGL language key
     * @return mixed $lang (ภาษาสำหรับ component) หรือ false ถ้าไม่พบภาษา
     */
    function languageMap($component, $lang)
    {
        if ($component == 'smfweb') {
                $aLangMap = array(
                    'en-iso-8859-15' => 'english',
                    'en-utf-8' => 'english',
                    'th-utf-8' => 'thai-utf8',
                );
                $resLang = array_key_exists($lang, $aLangMap) ? $aLangMap[$lang] : 'english';
                
        } elseif ($component == 'forums') {
                $aLangMap = array(
                    'en-iso-8859-15' => 'english',
                    'en-utf-8' => 'english',
                    'th-utf-8' => 'thai-utf8',
                );
                $resLang = array_key_exists($lang, $aLangMap) ? $aLangMap[$lang] : 'english';
                
        } elseif ($component == 'blogweb') {
                $aLangMap = array(
                    'en-iso-8859-15' => 'en',
                    'en-utf-8' => 'en',
                );
                $resLang = array_key_exists($lang, $aLangMap) ? $aLangMap[$lang] : 'en';
        } elseif ($component == 'faqweb') {
                $aLangMap = array(
                    'en-iso-8859-15' => 'en',
                    'en-utf-8' => 'en',
                    'th-utf-8' => 'th',
                );
                $resLang = array_key_exists($lang, $aLangMap) ? $aLangMap[$lang] : 'en';
                
        } else {
            return false;
        
        }
        
        return $resLang;
    }
    
    /**
     * create an archive of these files using the createFilesCompression() function
     * 
     * @param string $srcDir source directory for created
     * @param string $srcFolderName folder name for created
     * @param string $compress gz
     * 
     * @author apiruk boonruksa 20061204
     */
    function createFilesCompression($srcDir, $srcFolderName, $compress = "zip")
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);

        // ZIP
        if (file_exists($srcDir) && $srcFolderName && trim($compress) == "zip") {
            require_once SGL_LIB_PEAR_DIR . '/Archive/Zip.php';
            if ( !class_exists('Archive_Zip') ) {
                echo ("Archive_Zip class name invalid /Archive/Tar.php");
            }
            $obj = new Archive_Zip($srcFolderName . '.zip');
            
            
            $dh  = opendir($srcDir . '/' . $srcFolderName);
            while (false !== ($filename = readdir($dh))) {
                if ($filename == '.' || $filename == '..') {
                    continue; 
                }
                $files[] = $filename;
            }
            if ($obj->create($files)) {
                return 1;
            } else {
                return 0;
            }
            
        }
        return 0;

    }
    
    
    /**
     * upload file
     *
     * @param unknown_type $fileName
     * @param unknown_type $fileTempName
     * @return unknown
     */
    function uploadFile($fileName,$fileTempName,$target)
    {
        $extention = end(explode('.', $fileName));
        $uniqueName = md5($fileName . SGL_Session::getUid() . SGL_Date::getTime());
        $iconName = $uniqueName . '.' . $extention;        
        move_uploaded_file($fileTempName, $target . '/' . $iconName);  
        return $iconName;
    }
 
    
    /**
     * Enter description here...
     *
     * @param unknown_type $im
     * @param unknown_type $srcImgLocation
     * @param unknown_type $targetLocation
     * @param unknown_type $newWidth
     * @param unknown_type $newHeight
     * @return unknown
     */
   function resizeImageAndSave($srcImgLocation, $targetLocation, $newWidth, $newHeight)
    {
        require_once 'Image/Transform/Driver/GD.php';
        $im = new Image_Transform_Driver_GD();
        $ret = $im->load($srcImgLocation);
        if (SGL::isError($ret)) {
            return false;
        }
        $ret = $im->fit($newWidth, $newHeight);
        if (SGL::isError($ret)) {
            return false;
        }
        $ret = $im->save($targetLocation, 'jpeg');
    }


    /**
     * Enter description here...
     *
     * @return unknown
     */
    function detectGd()
    {
        $gdfuncList = get_extension_funcs('gd');
        ob_start();
        @phpinfo(INFO_MODULES);
        $output = ob_get_contents();
        ob_end_clean();
        $matches[1] = "";
        
        if (preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s",$output,$matches)) {
          $gdversion = $matches[2];
        }

        if ( $gdfuncList ) {
            if ( in_array('imagegd2',$gdfuncList) ) {
                return true;
            } else {
                return false;
             }
        } else {
           return false;
        }
    }
}
?>

Copyright 2K16 - 2K18 Indonesian Hacker Rulez