<?php
/**
* NOTICE OF LICENSE
*
* This file is licenced under the Software License Agreement.
* With the purchase or the installation of the software in your application
* you accept the licence agreement.
*
* You must not modify, adapt or create derivative works of this source code.
*
*  @author    Active Design <office@activedesign.ro>
*  @copyright 2017 Active Design
*  @license   LICENSE.txt
*/
class PageNotFoundController extends PageNotFoundControllerCore
{
    /*
    * module: oneclickssl
    * date: 2017-10-09 18:11:10
    * version: 1.1.1
    */
    public function initContent()
    {
        /* Let's encrypt uses a folder named ".well-known" to validate the ssl certificate
         * generation. Some hosting providers block it, so we use this simple trick to fool
         * them, so Let's encrypt will successfully validate the domain.
         */
        $request = $_SERVER['REQUEST_URI'];
        if(Tools::substr($request, 1, Tools::strlen('.well-known')) == '.well-known') {
            if(file_exists(_PS_ROOT_DIR_.$request)) {
                header('HTTP/1.1 200 OK');
                header('Status: 200 OK');
                die(Tools::file_get_contents(_PS_ROOT_DIR_.$request));
            }
        }
        return parent::initContent();
    }
}