ACC SHELL
<?php
include( '../functions.php' );
if ( !isset( $db ) )
{
include_once( '../init-db-info.php' );
include_once( '../init-db.php' );
}
include( $_GET['initScriptName'] . '.php' );
if ( isset( $_GET['cmd'] ) && ( $_GET['cmd'] == 'delete' ) )
{
if ( $iuImageFileName != '' )
{
$fileName = $iuImageFileName;
}
else
{
$imageDbItem = $db->getItem( $iuImageDbTable, $iuItemID );
$fileName = $imageDbItem[ $iuImageDbField ];
}
$db->setItem( $iuImageDbTable, $iuItemID, array( $iuImageDbField => '' ) );
@unlink( $iuDirImagesSmall . '/' . $fileName );
@unlink( $iuDirImagesMedium . '/' . $fileName );
@unlink( $iuDirImagesLarge . '/' . $fileName );
@unlink( $iuDirImagesFull . '/' . $fileName );
echo '';
}
else
{
foreach ( $_FILES as $file )
{
$fileName = basename( $file['name'] );
if ( $fileName != '' )
{
if ( $iuImageFileName != '' )
{
$sourceImageFileName = $iuDirImagesFull . '/' . $iuImageFileName;
$fileName = $iuImageFileName;
}
else
{
$pathInfo = pathinfo( $fileName );
$fileName = friendly_url( $pathInfo['filename'] ) . '-' . $iuItemID . '.' . $pathInfo['extension'];
$sourceImageFileName = $iuDirImagesFull . '/' . $fileName;
}
if ( move_uploaded_file( $file['tmp_name'], $sourceImageFileName ) )
{
if ( $iuImageFileName == '' )
{
$db->setItem( $iuImageDbTable, $iuItemID, array( $iuImageDbField => $fileName ) );
}
createThumbnailMax( $sourceImageFileName, $iuDirImagesSmall . '/' . $fileName, $iuImagesSmallWidth, $iuImagesSmallHeight );
createThumbnailMax( $sourceImageFileName, $iuDirImagesMedium . '/' . $fileName, $iuImagesMediumWidth, $iuImagesMediumHeight );
createThumbnailMax( $sourceImageFileName, $iuDirImagesLarge . '/' . $fileName, $iuImagesLargeWidth, $iuImagesLargeHeight );
}
echo $iuDirImagesFull . '/' . $fileName . '?' . rand(0, 100000);
}
break;
}
}
?>
ACC SHELL 2018