!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16. PHP/5.4.16 

uname -a: Linux roko-bkp 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64 

uid=48(apache) gid=48(apache) groups=48(apache),1003(webmaster) 

Safe-mode: OFF (not secure)

/var/www/html/admin/webmail/plugins/filesystem_attachments/   drwxr-xr-x
Free 9.07 GB of 93.48 GB (9.7%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     filesystem_attachments.php (4.92 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * Filesystem Attachments
 * 
 * This is a core plugin which provides basic, filesystem based
 * attachment temporary file handling.  This includes storing
 * attachments of messages currently being composed, writing attachments
 * to disk when drafts with attachments are re-opened and writing
 * attachments to disk for inline display in current html compositions.
 *
 * Developers may wish to extend this class when creating attachment
 * handler plugins:
 *   require_once('plugins/filesystem_attachments/filesystem_attachments.php');
 *   class myCustom_attachments extends filesystem_attachments
 *
 * @author Ziba Scott <ziba@umich.edu>
 * @author Thomas Bruederli <roundcube@gmail.com>
 * 
 */
class filesystem_attachments extends rcube_plugin
{
    public 
$task 'mail';
    
    function 
init()
    {
        
// Save a newly uploaded attachment
        
$this->add_hook('upload_attachment', array($this'upload'));

        
// Save an attachment from a non-upload source (draft or forward)
        
$this->add_hook('save_attachment', array($this'save'));

        
// Remove an attachment from storage
        
$this->add_hook('remove_attachment', array($this'remove'));

        
// When composing an html message, image attachments may be shown
        
$this->add_hook('display_attachment', array($this'display'));

        
// Get the attachment from storage and place it on disk to be sent
        
$this->add_hook('get_attachment', array($this'get_attachment'));

        
// Delete all temp files associated with this user
        
$this->add_hook('cleanup_attachments', array($this'cleanup'));
        
$this->add_hook('kill_session', array($this'cleanup'));
    }

    
/**
     * Save a newly uploaded attachment
     */
    
function upload($args)
    {
        
$args['status'] = false;
        
$rcmail rcmail::get_instance();

        
// use common temp dir for file uploads
        // #1484529: we need absolute path on Windows for move_uploaded_file()
        
$temp_dir realpath($rcmail->config->get('temp_dir'));
        
$tmpfname tempnam($temp_dir'rcmAttmnt');

        if (
move_uploaded_file($args['path'], $tmpfname) && file_exists($tmpfname)) {
            
$args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1;
            
$args['path'] = $tmpfname;
            
$args['status'] = true;

            
// Note the file for later cleanup
            
$_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmpfname;
        }

        return 
$args;
    }

    
/**
     * Save an attachment from a non-upload source (draft or forward)
     */
    
function save($args)
    {
        
$args['status'] = false;

        if (!
$args['path']) {
            
$rcmail rcmail::get_instance();
            
$temp_dir unslashify($rcmail->config->get('temp_dir'));
            
$tmp_path tempnam($temp_dir'rcmAttmnt');

            if (
$fp fopen($tmp_path'w')) {
                
fwrite($fp$args['data']);
                
fclose($fp);
                
$args['path'] = $tmp_path;
            } else
                return 
$args;
        }
        
        
$args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1;
        
$args['status'] = true;
            
        
// Note the file for later cleanup
        
$_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $args['path'];

        return 
$args;
    }

    
/**
     * Remove an attachment from storage
     * This is triggered by the remove attachment button on the compose screen
     */
    
function remove($args)
    {
        
$args['status'] = @unlink($args['path']);
        return 
$args;
    }

    
/**
     * When composing an html message, image attachments may be shown
     * For this plugin, the file is already in place, just check for
     * the existance of the proper metadata
     */
    
function display($args)
    {
        
$args['status'] = file_exists($args['path']);
        return 
$args;
    }

    
/**
     * This attachment plugin doesn't require any steps to put the file
     * on disk for use.  This stub function is kept here to make this 
     * class handy as a parent class for other plugins which may need it.
     */
    
function get_attachment($args)
    {
        return 
$args;
    }
    
    
/**
     * Delete all temp files associated with this user
     */
    
function cleanup($args)
    {
        
// $_SESSION['compose']['attachments'] is not a complete record of
        // temporary files because loading a draft or starting a forward copies
        // the file to disk, but does not make an entry in that array
        
if (is_array($_SESSION['plugins']['filesystem_attachments']['tmp_files'])){
            foreach (
$_SESSION['plugins']['filesystem_attachments']['tmp_files'] as $filename){
                if(
file_exists($filename)){
                    
unlink($filename);
                }
            }
            unset(
$_SESSION['plugins']['filesystem_attachments']['tmp_files']);
        }
        return 
$args;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0042 ]--