!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: nginx/1.23.4. PHP/5.6.40-65+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux foro-restaurado-2 5.15.0-1040-oracle #46-Ubuntu SMP Fri Jul 14 21:47:21 UTC 2023
aarch64
 

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

Safe-mode: OFF (not secure)

/usr/share/phpmyadmin/libraries/classes/Gis/   drwxr-xr-x
Free 83.28 GB of 96.73 GB (86.1%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     GisLineString.php (11.16 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * Handles actions related to GIS LINESTRING objects
 */

declare(strict_types=1);

namespace 
PhpMyAdmin\Gis;

use 
TCPDF;
use function 
count;
use function 
hexdec;
use function 
imagecolorallocate;
use function 
imageline;
use function 
imagestring;
use function 
json_encode;
use function 
mb_strlen;
use function 
mb_substr;
use function 
trim;

/**
 * Handles actions related to GIS LINESTRING objects
 */
class GisLineString extends GisGeometry
{
    
/** @var self */
    
private static $instance;

    
/**
     * A private constructor; prevents direct creation of object.
     *
     * @access private
     */
    
private function __construct()
    {
    }

    
/**
     * Returns the singleton.
     *
     * @return GisLineString the singleton
     *
     * @access public
     */
    
public static function singleton()
    {
        if (! isset(
self::$instance)) {
            
self::$instance = new GisLineString();
        }

        return 
self::$instance;
    }

    
/**
     * Scales each row.
     *
     * @param string $spatial spatial data of a row
     *
     * @return array an array containing the min, max values for x and y coordinates
     *
     * @access public
     */
    
public function scaleRow($spatial)
    {
        
// Trim to remove leading 'LINESTRING(' and trailing ')'
        
$linestring
            
mb_substr(
                
$spatial,
                
11,
                
mb_strlen($spatial) - 12
            
);

        return 
$this->setMinMax($linestring, []);
    }

    
/**
     * Adds to the PNG image object, the data related to a row in the GIS dataset.
     *
     * @param string      $spatial    GIS POLYGON object
     * @param string|null $label      Label for the GIS POLYGON object
     * @param string      $line_color Color for the GIS POLYGON object
     * @param array       $scale_data Array containing data related to scaling
     * @param resource    $image      Image object
     *
     * @return resource the modified image object
     *
     * @access public
     */
    
public function prepareRowAsPng(
        
$spatial,
        ?
string $label,
        
$line_color,
        array 
$scale_data,
        
$image
    
) {
        
// allocate colors
        
$black imagecolorallocate($image000);
        
$red hexdec(mb_substr($line_color12));
        
$green hexdec(mb_substr($line_color32));
        
$blue hexdec(mb_substr($line_color42));
        
$color imagecolorallocate($image$red$green$blue);

        
// Trim to remove leading 'LINESTRING(' and trailing ')'
        
$linesrting
            
mb_substr(
                
$spatial,
                
11,
                
mb_strlen($spatial) - 12
            
);
        
$points_arr $this->extractPoints($linesrting$scale_data);

        foreach (
$points_arr as $point) {
            if (! isset(
$temp_point)) {
                
$temp_point $point;
            } else {
                
// draw line section
                
imageline(
                    
$image,
                    (int) 
$temp_point[0],
                    (int) 
$temp_point[1],
                    (int) 
$point[0],
                    (int) 
$point[1],
                    
$color
                
);
                
$temp_point $point;
            }
        }
        
// print label if applicable
        
if (isset($label) && trim($label) != '') {
            
imagestring(
                
$image,
                
1,
                
$points_arr[1][0],
                
$points_arr[1][1],
                
trim($label),
                
$black
            
);
        }

        return 
$image;
    }

    
/**
     * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
     *
     * @param string      $spatial    GIS LINESTRING object
     * @param string|null $label      Label for the GIS LINESTRING object
     * @param string      $line_color Color for the GIS LINESTRING object
     * @param array       $scale_data Array containing data related to scaling
     * @param TCPDF       $pdf        TCPDF instance
     *
     * @return TCPDF the modified TCPDF instance
     *
     * @access public
     */
    
public function prepareRowAsPdf($spatial, ?string $label$line_color, array $scale_data$pdf)
    {
        
// allocate colors
        
$red hexdec(mb_substr($line_color12));
        
$green hexdec(mb_substr($line_color32));
        
$blue hexdec(mb_substr($line_color42));
        
$line = [
            
'width' => 1.5,
            
'color' => [
                
$red,
                
$green,
                
$blue,
            ],
        ];

        
// Trim to remove leading 'LINESTRING(' and trailing ')'
        
$linesrting
            
mb_substr(
                
$spatial,
                
11,
                
mb_strlen($spatial) - 12
            
);
        
$points_arr $this->extractPoints($linesrting$scale_data);

        foreach (
$points_arr as $point) {
            if (! isset(
$temp_point)) {
                
$temp_point $point;
            } else {
                
// draw line section
                
$pdf->Line(
                    
$temp_point[0],
                    
$temp_point[1],
                    
$point[0],
                    
$point[1],
                    
$line
                
);
                
$temp_point $point;
            }
        }
        
// print label
        
if (isset($label) && trim($label) != '') {
            
$pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
            
$pdf->SetFontSize(5);
            
$pdf->Cell(00trim($label));
        }

        return 
$pdf;
    }

    
/**
     * Prepares and returns the code related to a row in the GIS dataset as SVG.
     *
     * @param string $spatial    GIS LINESTRING object
     * @param string $label      Label for the GIS LINESTRING object
     * @param string $line_color Color for the GIS LINESTRING object
     * @param array  $scale_data Array containing data related to scaling
     *
     * @return string the code related to a row in the GIS dataset
     *
     * @access public
     */
    
public function prepareRowAsSvg($spatial$label$line_color, array $scale_data)
    {
        
$line_options = [
            
'name'         => $label,
            
'id'           => $label $this->getRandomId(),
            
'class'        => 'linestring vector',
            
'fill'         => 'none',
            
'stroke'       => $line_color,
            
'stroke-width' => 2,
        ];

        
// Trim to remove leading 'LINESTRING(' and trailing ')'
        
$linesrting
            
mb_substr(
                
$spatial,
                
11,
                
mb_strlen($spatial) - 12
            
);
        
$points_arr $this->extractPoints($linesrting$scale_data);

        
$row '<polyline points="';
        foreach (
$points_arr as $point) {
            
$row .= $point[0] . ',' $point[1] . ' ';
        }
        
$row .= '"';
        foreach (
$line_options as $option => $val) {
            
$row .= ' ' $option '="' trim((string) $val) . '"';
        }
        
$row .= '/>';

        return 
$row;
    }

    
/**
     * Prepares JavaScript related to a row in the GIS dataset
     * to visualize it with OpenLayers.
     *
     * @param string $spatial    GIS LINESTRING object
     * @param int    $srid       Spatial reference ID
     * @param string $label      Label for the GIS LINESTRING object
     * @param array  $line_color Color for the GIS LINESTRING object
     * @param array  $scale_data Array containing data related to scaling
     *
     * @return string JavaScript related to a row in the GIS dataset
     *
     * @access public
     */
    
public function prepareRowAsOl($spatial$srid$label$line_color, array $scale_data)
    {
        
$stroke_style = [
            
'color' => $line_color,
            
'width' => 2,
        ];

        
$result =  'var style = new ol.style.Style({'
            
'stroke: new ol.style.Stroke(' json_encode($stroke_style) . ')';
        if (
$label) {
            
$text_style = ['text' => $label];
            
$result .= ', text: new ol.style.Text(' json_encode($text_style) . ')';
        }

        
$result .= '});';

        if (
$srid == 0) {
            
$srid 4326;
        }
        
$result .= $this->getBoundsForOl($srid$scale_data);

        
// Trim to remove leading 'LINESTRING(' and trailing ')'
        
$linesrting
            
mb_substr(
                
$spatial,
                
11,
                
mb_strlen($spatial) - 12
            
);
        
$points_arr $this->extractPoints($linesrtingnull);

        return 
$result 'var line = new ol.Feature({geometry: '
            
$this->getLineForOpenLayers($points_arr$srid) . '});'
            
'line.setStyle(style);'
            
'vectorLayer.addFeature(line);';
    }

    
/**
     * Generate the WKT with the set of parameters passed by the GIS editor.
     *
     * @param array  $gis_data GIS data
     * @param int    $index    Index into the parameter object
     * @param string $empty    Value for empty points
     *
     * @return string WKT with the set of parameters passed by the GIS editor
     *
     * @access public
     */
    
public function generateWkt(array $gis_data$index$empty '')
    {
        
$no_of_points $gis_data[$index]['LINESTRING']['no_of_points'] ?? 2;
        if (
$no_of_points 2) {
            
$no_of_points 2;
        }
        
$wkt 'LINESTRING(';
        for (
$i 0$i $no_of_points$i++) {
            
$wkt .= (isset($gis_data[$index]['LINESTRING'][$i]['x'])
                    && 
trim((string) $gis_data[$index]['LINESTRING'][$i]['x']) != ''
                    
$gis_data[$index]['LINESTRING'][$i]['x'] : $empty)
                . 
' ' . (isset($gis_data[$index]['LINESTRING'][$i]['y'])
                    && 
trim((string) $gis_data[$index]['LINESTRING'][$i]['y']) != ''
                    
$gis_data[$index]['LINESTRING'][$i]['y'] : $empty) . ',';
        }

        
$wkt
            
mb_substr(
                
$wkt,
                
0,
                
mb_strlen($wkt) - 1
            
);

        return 
$wkt ')';
    }

    
/**
     * Generate parameters for the GIS data editor from the value of the GIS column.
     *
     * @param string $value of the GIS column
     * @param int    $index of the geometry
     *
     * @return array params for the GIS data editor from the value of the GIS column
     *
     * @access public
     */
    
public function generateParams($value$index = -1)
    {
        
$params = [];
        if (
$index == -1) {
            
$index 0;
            
$data GisGeometry::generateParams($value);
            
$params['srid'] = $data['srid'];
            
$wkt $data['wkt'];
        } else {
            
$params[$index]['gis_type'] = 'LINESTRING';
            
$wkt $value;
        }

        
// Trim to remove leading 'LINESTRING(' and trailing ')'
        
$linestring
            
mb_substr(
                
$wkt,
                
11,
                
mb_strlen($wkt) - 12
            
);
        
$points_arr $this->extractPoints($linestringnull);

        
$no_of_points count($points_arr);
        
$params[$index]['LINESTRING']['no_of_points'] = $no_of_points;
        for (
$i 0$i $no_of_points$i++) {
            
$params[$index]['LINESTRING'][$i]['x'] = $points_arr[$i][0];
            
$params[$index]['LINESTRING'][$i]['y'] = $points_arr[$i][1];
        }

        return 
$params;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by HackingTool | HackingTool | Generation time: 0.0049 ]--