<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Cms extends CI_Controller {


    function __construct()
    {
        parent::__construct();
        $this->load->library('form_validation');
        $this->form_validation->set_error_delimiters('<span class="help-block">', '</span>');
        $this->load->helper('form');
        $this->load->helper('string');
        $this->load->model('Cms_model');

    }

    /**
     * This function is for listing all the CMS pages added in backend
     *
     * @return void
     */
    public function index(){

        if($this->session->userdata('logged_in')){
            //$this->load->view('test');//die;
            $data['cms_data'] = $this->Cms_model->get_cms_records();

            //echo "<pre>"; print_r($data);echo "</pre>";die;

            $this->load->view('templates/header');
            $this->load->view('templates/left_sidebar.php');
            $this->load->view('admin/cms/listing', $data);
            $this->load->view('templates/footer');
        } else {
            redirect('admin/login');
        }
    }


    /**
     * This function is for adding the CMS page in backend
     *
     * @return void
     */
    public function add_cms(){

        if($this->session->userdata('logged_in')){

            // validatation for required fields
            $this->form_validation->set_rules('page_title','Page Title','required');
            $this->form_validation->set_rules('url_key','URL Key','required');
            $this->form_validation->set_rules('page_status','Status','required');
            $this->form_validation->set_rules('page_content','Page Content','required');


            if ($this->form_validation->run() == true){

                $data['page_title']   = $this->input->post('page_title');
                $data['url_key']   = $this->input->post('url_key');
                $data['page_status']   = $this->input->post('page_status');
                $data['page_content']   = $this->input->post('page_content');
                $data['content_heading']   = $this->input->post('content_heading');
                $data['meta_keywords']   = $this->input->post('meta_keywords');
                $data['meta_desc']   = $this->input->post('meta_desc');
                $data['created_by']   = $this->session->userdata('username');
                $data['created_at']   = date('M Y h:i:s A');

                $data_inserted = $this->Cms_model->save_cms_data($data);

                if($data_inserted)
                {
                    $this->session->set_flashdata('success', 'CMS page added successfuly');
                    redirect('admin/cms');

                }
                else
                {
                    $data['error']="Please Enter Valid Username and Password..";
                    $this->load->view('admin/cms/add_cms', $data);
                }

            }else{

                $this->load->view('admin/cms/add_cms');
            }

        } else {
            redirect('admin/login');
        }
    }


    /**
     * This function is for adding the CMS page in backend
     *
     * @return void
     */
    public function edit_cms(){

        if($this->session->userdata('logged_in')){

            // validatation for required fields
            $this->form_validation->set_rules('page_title','Page Title','required');
            $this->form_validation->set_rules('url_key','URL Key','required');
            $this->form_validation->set_rules('page_status','Status','required');
            $this->form_validation->set_rules('page_content','Page Content','required');


            if ($this->form_validation->run() == true){

                $data['page_title']   = $this->input->post('page_title');
                $data['url_key']   = $this->input->post('url_key');
                $data['page_status']   = $this->input->post('page_status');
                $data['page_content']   = $this->input->post('page_content');
                $data['content_heading']   = $this->input->post('content_heading');
                $data['meta_keywords']   = $this->input->post('meta_keywords');
                $data['meta_desc']   = $this->input->post('meta_desc');
                $data['created_by']   = $this->session->userdata('username');
                $data['created_at']   = date('M Y h:i:s A');

                $data_inserted = $this->Cms_model->save_cms_data($data);

                if($data_inserted)
                {
                    $this->session->set_flashdata('success', 'CMS page added successfuly');
                    redirect('admin/cms');

                }
                else
                {
                    $data['error']="Please Enter Valid Username and Password..";
                    $this->load->view('admin/cms/add_cms', $data);
                }

            }else{

                $this->load->view('admin/cms/add_cms');
            }

        } else {
            redirect('admin/login');
        }
    }

    /**
     * This function is to view CMS page
     *
     * @param $cms_id
     * @return void
     */
    public function view_cms($cms_id){


    }

    /**
     * This function is to hard delete the CMS page
     *
     * @param $cms_id
     * @return void
     */
    public function delete_cms($cms_id){


    }
}<commit_msg>changes in cms module<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Cms extends CI_Controller {

    /**
     * Create a new controller instance.
     *
     * @return void
     *
     */
    function __construct()
    {
        parent::__construct();
        $this->load->library('form_validation');
        $this->form_validation->set_error_delimiters('<span class="help-block">', '</span>');
        $this->load->helper('form');
        $this->load->helper('string');
        $this->load->model('Cms_model');

    }

    /**
     * Display a listing of the resource.
     *
     * @return void
     */
    public function index(){

        if($this->session->userdata('logged_in')){
            //$this->load->view('test');//die;
            $data['cms_data'] = $this->Cms_model->get_cms_records();

            //echo "<pre>"; print_r($data);echo "</pre>";die;

            $this->load->view('templates/header');
            $this->load->view('templates/left_sidebar.php');
            $this->load->view('admin/cms/listing', $data);
            $this->load->view('templates/footer');
        } else {
            redirect('admin/login');
        }
    }


    /**
     * Store a newly created resource in storage.
     *
     * @return void
     */
    public function add_cms(){

        if($this->session->userdata('logged_in')){

            // validatation for required fields
            $this->form_validation->set_rules('page_title','Page Title','required');
            $this->form_validation->set_rules('url_key','URL Key','required');
            $this->form_validation->set_rules('page_status','Status','required');
            $this->form_validation->set_rules('page_content','Page Content','required');


            if ($this->form_validation->run() == true){

                $data['page_title']   = $this->input->post('page_title');
                $data['url_key']   = $this->input->post('url_key');
                $data['page_status']   = $this->input->post('page_status');
                $data['page_content']   = $this->input->post('page_content');
                $data['content_heading']   = $this->input->post('content_heading');
                $data['meta_keywords']   = $this->input->post('meta_keywords');
                $data['meta_desc']   = $this->input->post('meta_desc');
                $data['created_by']   = $this->session->userdata('username');
                $data['created_at']   = date('M Y h:i:s A');

                $data_inserted = $this->Cms_model->save_cms_data($data);

                if($data_inserted)
                {
                    $this->session->set_flashdata('success', 'CMS page added successfuly');
                    redirect('admin/cms');

                }
                else
                {
                    $data['error']="Please Enter Valid Username and Password..";
                    $this->load->view('admin/cms/add_cms', $data);
                }

            }else{

                $this->load->view('admin/cms/add_cms');
            }

        } else {
            redirect('admin/login');
        }
    }


    /**
     * Show the form for editing the specified resource.
     *
     * @param int $cms_id
     * @return void
     */
    public function edit_cms($cms_id){

        if($this->session->userdata('logged_in')){

            // validatation for required fields
            $this->form_validation->set_rules('page_title','Page Title','required');
            $this->form_validation->set_rules('url_key','URL Key','required');
            $this->form_validation->set_rules('page_status','Status','required');
            $this->form_validation->set_rules('page_content','Page Content','required');


            if ($this->form_validation->run() == true){

                $data['page_title']   = $this->input->post('page_title');
                $data['url_key']   = $this->input->post('url_key');
                $data['page_status']   = $this->input->post('page_status');
                $data['page_content']   = $this->input->post('page_content');
                $data['content_heading']   = $this->input->post('content_heading');
                $data['meta_keywords']   = $this->input->post('meta_keywords');
                $data['meta_desc']   = $this->input->post('meta_desc');
                $data['created_by']   = $this->session->userdata('username');
                $data['created_at']   = date('M Y h:i:s A');

                $data_inserted = $this->Cms_model->save_cms_data($data);

                if($data_inserted)
                {
                    $this->session->set_flashdata('success', 'CMS page added successfuly');
                    redirect('admin/cms');

                }
                else
                {
                    $data['error']="Please Enter Valid Username and Password..";
                    $this->load->view('admin/cms/add_cms', $data);
                }

            }else{

                $this->load->view('admin/cms/add_cms');
            }

        } else {
            redirect('admin/login');
        }
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  int  $cms_id
     * @return void
     */
    public function update_cms( $cms_id)
    {
        //
    }


    /**
     * Display the specified resource.
     *
     * @param $cms_id
     * @return void
     */
    public function view_cms($cms_id){


    }

    /**
     * Remove the specified resource from storage.
     *
     * @param int $cms_id
     * @return void
     */
    public function delete_cms($cms_id){


    }
}
{'fraction_non_alphanumeric': 0.16924476797088261, 'fraction_numerical': 0.0, 'mean_word_length': 1.8787323205866946, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 203, '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': '4875790', 'n_tokens_mistral': 3260, 'n_tokens_neox': 3018, 'n_words': 472}