/**
  * For download file.
  *
  * @param string $sFile file in download.
  * @param string $sName if file in download.
  * @param string $sMimeType Optional, default value is NULL.
  * @return void
  */
 public function download($sFile, $sName, $sMimeType = null)
 {
     /*
      This function takes a path to a file to output ($sFile),
      the filename that the browser will see ($sName) and
      the MIME type of the file ($sMimeType, optional).
     
      If you want to do something on download abort/finish,
      register_shutdown_function('function_name');
     */
     //if (!is_readable($sFile)) exit('File not found or inaccessible!');
     $sName = \PH7\Framework\Url\Url::decode($sName);
     // Clean the name file
     /* Figure out the MIME type (if not specified) */
     if (empty($sMimeType)) {
         $sFileExtension = $this->getFileExt($sFile);
         $mGetMimeType = $this->getMimeType($sFileExtension);
         if (!empty($mGetMimeType)) {
             $sMimeType = $mGetMimeType;
         } else {
             $sMimeType = 'application/force-download';
         }
     }
     @ob_end_clean();
     // Turn off output buffering to decrease CPU usage
     (new \PH7\Framework\Navigation\Browser())->nocache();
     // No cache
     $sPrefix = \PH7\Framework\Registry\Registry::getInstance()->site_name . '_';
     // the prefix
     header('Content-Type: ' . $sMimeType);
     header('Content-Disposition: attachment; filename=' . \PH7\Framework\Parse\Url::clean($sPrefix) . $sName);
     header('Content-Transfer-Encoding: binary');
     header('Accept-Ranges: bytes');
     header('Content-Length: ' . $this->size($sFile));
     readfile($sFile);
 }
 * @author         Pierre-Henry Soria <*****@*****.**>
 * @copyright      (c) 2012-2016, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Core / Asset / Ajax / Popup
 */
namespace PH7;

defined('PH7') or exit('Restricted access');
use PH7\Framework\Mvc\Request\Http, PH7\Framework\Layout\Html\Design, PH7\Framework\Url\Url, PH7\Framework\Mvc\Router\Uri, PH7\Framework\Url\Header;
if (AdminCore::auth() || UserCore::auth() || AffiliateCore::auth()) {
    $oHttpRequest = new Http();
    $oDesign = new Design();
    $oDesign->htmlHeader();
    $oDesign->usefulHtmlHeader();
    echo '<div class="center">';
    if ($oHttpRequest->getExists(array('mod', 'ctrl', 'act', 'id'))) {
        $sLabel = $oHttpRequest->get('label');
        $sMod = $oHttpRequest->get('mod');
        $sCtrl = $oHttpRequest->get('ctrl');
        $sAct = $oHttpRequest->get('act');
        $mId = $oHttpRequest->get('id');
        ConfirmCoreForm::display(array('label' => Url::decode($sLabel), 'module' => $sMod, 'controller' => $sCtrl, 'action' => $sAct, 'id' => $mId));
    } else {
        echo '<p>' . t('Bad parameters in the URL!') . '</p>';
    }
    echo '</div>';
    $oDesign->htmlFooter();
    unset($oHttpRequest, $oDesign);
} else {
    Header::redirect(Uri::get('user', 'signup', 'step1'), t('You must be registered to report an abuse.'));
}