<commit_before><?php

/*
 *  Created on :Jul 10, 2015, 12:18:54 PM
 *  Author     :<NAME> <<EMAIL>>
 */

class Media_upload extends CI_Controller {

    function secure_soft() {
        if ($this->session->userdata('loggedin') != 1) {//Checking for authentication
            redirect('/login');
            die();
        }
    }

    function secure_hard() {
        $this->secure_soft();
        if ($this->permissions->get_level() == 0) {
            echo $this->load->view('common/header', '', TRUE);
            $message['errors'] = "Insufficient Privelleges. Please Contact Our Content Head";
            echo $this->load->view('Error_message', $message, TRUE);
            echo $this->load->view('common/footer', '', TRUE);
            die();
        }
        return 1;
    }

    public function do_upload() {
        $config = array(
            'upload_path' => "../resources/" . $this->input->post('directory'),
            'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|docx|ppt|pptx",
            'overwrite' => FALSE,
            'max_size' => "2048000"
        );
        $this->load->library('upload', $config);
        $this->load->helper(array('form', 'url'));


        if ($this->upload->do_upload()) {
            $data = array('upload_data' => $this->upload->data());<commit_msg>Users, upload create directory if not exists<commit_after><?php

/*
 *  Created on :Jul 10, 2015, 12:18:54 PM
 *  Author     :<NAME> <<EMAIL>>
 */

class Media_upload extends CI_Controller {

    function secure_soft() {
        if ($this->session->userdata('loggedin') != 1) {//Checking for authentication
            redirect('/login');
            die();
        }
    }

    function secure_hard() {
        $this->secure_soft();
        if ($this->permissions->get_level() == 0) {
            echo $this->load->view('common/header', '', TRUE);
            $message['errors'] = "Insufficient Privelleges. Please Contact Our Content Head";
            echo $this->load->view('Error_message', $message, TRUE);
            echo $this->load->view('common/footer', '', TRUE);
            die();
        }
        return 1;
    }

    public function do_upload() {
        $directory = "../resources/" . $this->input->post('directory');
        $config = array(
            'upload_path' => $directory,
            'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|docx|ppt|pptx",
            'overwrite' => FALSE,
            'max_size' => "2048000"
        );

        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }

        $this->load->library('upload', $config);
        $this->load->helper(array('form', 'url'));


        if ($this->upload->do_upload()) {
            $data = array('upload_data' => $this->upload->data());
{'fraction_non_alphanumeric': 0.18218036943136545, 'fraction_numerical': 0.017385005432814196, 'mean_word_length': 2.200463499420626, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 61, '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': '7051090', 'n_tokens_mistral': 861, 'n_tokens_neox': 804, 'n_words': 162}