<commit_before><?php
namespace LouisLam\CRUD;

use League\Plates\Engine;
use LouisLam\Auth;
use LouisLam\Util;
use Slim\Slim;

/**
 * Class SlimLouisCRUD
 * Created by PhpStorm.
 * User: <NAME>
 * Date: 8/13/2015
 * Time: 10:37 AM
 * @package LouisLam\CRUD
 */
class SlimLouisCRUD extends LouisCRUD
{

    protected $checkLogin = false;

    private $groupName;
    private $apiGroupName;

    /** @var Slim */
    private $slim;

    /** @var callable */
    protected $configFunction;

    /** @var callable */
    protected $listviewFunction = null;

    /** @var callable */
    protected $createFunction = null;

    /** @var callable */
    protected $editFunction = null;

    /** @var callable */
    protected $deleteFunction = null;

    /** @var callable */
    protected $exportFunction = null;

    /** @var string[] */
    private $tableList = [];
    private $routeNameList = [];
    private $tableDisplayName = [];

    private $currentRouteName = "";

    protected $firstPageURL = "";


    /**
     * SlimCRUD constructor.
     * @param string $groupName
     * @param string $apiGroupName
     * @param Slim $slim
     */
    public function __construct($groupName = "crud", $apiGroupName = "api", $slim = null)
    {
        session_start();

        parent::__construct();
        $this->groupName = $groupName;
        $this->apiGroupName = $apiGroupName;

        if ($slim == null) {
            $this->slim = new Slim();
        } else {
            $this->slim = $slim;
        }

        // Upload function
        $this->slim->post("/louislam-crud/upload/:type", function ($type) {

            if (!empty($_POST['uploadpath'])) {
                $result = $this->upload("upload", $_POST['uploadpath']);
            } else {
                $result = $this->upload();
            }

            if (isset($_GET["fullpath"]) && $_GET["fullpath"] == "no") {

            } else {
                $result["url"] = \LouisLam\Util::fullURL($result["url"]);
            }



            if ($type == "js") {
                $url = $result["url"];

                if ($result["uploaded"]) {
                    echo <<< HTML
<script type="text/javascript">
    window.parent.CKEDITOR.tools.callFunction("0", "$url", "");
</script>
HTML;
                } else {
                    $msg = $result["msg"];<commit_msg>fix multi html editor can not upload image<commit_after><?php
namespace LouisLam\CRUD;

use League\Plates\Engine;
use LouisLam\Auth;
use LouisLam\Util;
use Slim\Slim;

/**
 * Class SlimLouisCRUD
 * Created by PhpStorm.
 * User: <NAME>
 * Date: 8/13/2015
 * Time: 10:37 AM
 * @package LouisLam\CRUD
 */
class SlimLouisCRUD extends LouisCRUD
{

    protected $checkLogin = false;

    private $groupName;
    private $apiGroupName;

    /** @var Slim */
    private $slim;

    /** @var callable */
    protected $configFunction;

    /** @var callable */
    protected $listviewFunction = null;

    /** @var callable */
    protected $createFunction = null;

    /** @var callable */
    protected $editFunction = null;

    /** @var callable */
    protected $deleteFunction = null;

    /** @var callable */
    protected $exportFunction = null;

    /** @var string[] */
    private $tableList = [];
    private $routeNameList = [];
    private $tableDisplayName = [];

    private $currentRouteName = "";

    protected $firstPageURL = "";


    /**
     * SlimCRUD constructor.
     * @param string $groupName
     * @param string $apiGroupName
     * @param Slim $slim
     */
    public function __construct($groupName = "crud", $apiGroupName = "api", $slim = null)
    {
        session_start();

        parent::__construct();
        $this->groupName = $groupName;
        $this->apiGroupName = $apiGroupName;

        if ($slim == null) {
            $this->slim = new Slim();
        } else {
            $this->slim = $slim;
        }

        // Upload function
        $this->slim->post("/louislam-crud/upload/:type", function ($type) {

            if (!empty($_POST['uploadpath'])) {
                $result = $this->upload("upload", $_POST['uploadpath']);
            } else {
                $result = $this->upload();
            }

            if (isset($_GET["fullpath"]) && $_GET["fullpath"] == "no") {

            } else {
                $result["url"] = \LouisLam\Util::fullURL($result["url"]);
            }



            if ($type == "js") {
                $url = $result["url"];

                if ($result["uploaded"]) {

                    $funcNum = isset($_GET['CKEditorFuncNum']) ? $_GET['CKEditorFuncNum'] : 0;

                    echo <<< HTML
<script type="text/javascript">
    window.parent.CKEDITOR.tools.callFunction("$funcNum", "$url", "");
</script>
HTML;
                } else {
                    $msg = $result["msg"];
{'fraction_non_alphanumeric': 0.16004988567865308, 'fraction_numerical': 0.004988567865308668, 'mean_word_length': 2.0474984167194425, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2959249', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1407, 'n_words': 316}