Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.96.2  /  Your IP : 104.23.197.231
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nicolasj/www/sms.formationlangues.be/application/controllers/BO/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nicolasj/www/sms.formationlangues.be/application/controllers/BO/Planning.php
<?php

/*********************
 *********************

 helper fix 20 avril 2019
 Aernout Guillaume
 *********************
 *********************/

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

class Planning extends NS_Controller
{
    public function __construct()
    {
        parent::__construct(array('no_cache' => 1));

        $this->load->helper('generator');
        $this->load->model('dash_model');
        $this->load->model('crud_model');
        $this->load->model('users_model');
        $this->load->database();
    }

    public function index()
    {
        $this->users_model->log_connection();
        $data['page_name'] = 'planning';
        $data['page_title'] = get_phrase('planning');
        $data['filters'] = $this->crud_model->get_courses_local();

        //remove notification
        if ($this->session->userdata('login_type') == "student") {
            $lessons = $this->crud_model->get_student_lesson($this->session->userdata('userID'));
            if (count($lessons) > 1) {
                $this->session->unset_userdata('notification');
            }
        }

        $this->load->view('backend/index', $data);

        //quick fix bad login type
        if ($_SESSION['parent_login'] == "1" && $_SESSION['login_type'] == "invited") {
            $_SESSION['login_type'] = 'parent';
            header("Refresh:0");
        }
    }

    public function fetch()
    {
        $this->continueIfAllowed(['allowed' => ['admin', 'teacher', 'student', 'group', 'parent']]);
        $data = $this->input->get(['start', 'end', 'filter']);

        if (strtotime($data['start']) === false || strtotime($data['end']) === false) {
            echo json_encode([]);
            return;
        }
        $start = new Datetime($data['start']);
        $end = new Datetime($data['end']);

        if ($this->userInfo['role'] == "parent") {
            $events = $this->dash_model->fetch_calendar2(substr($data['start'], 0, 10), substr($data['end'], 0, 10), "parent", $data['filter']);
        } elseif ($this->userInfo['role'] == "student" || $this->userInfo['role'] == "group") {
            $events = $this->dash_model->fetch_calendar(substr($data[start], 0, 10), substr($data[end], 0, 10), "student", $data['filter']);

        } elseif ($this->userInfo['role'] == "teacher") {
            $events = json_encode($this->dash_model->get_teacher_courses_calendar((int) $this->userInfo['user_id'], $start, $end, $data['filter']));
        } else {
            // Prepare filters and search
            $locale_course_ids = $this->filter_locale_courses($data['filter']);
            $search = $this->filter_search($data['filter']);

            $events = $this->course_model->get_planning_courses($start, $end, $locale_course_ids, $search);
            echo json_encode($events);
            return;
        }

        echo $events;
    }


    public function get_lang_list()
    {
        $query = $this->db->get('course_language');
        return $query->result_array();
    }

    private function filter_locale_courses(string $raw_filter): array
    {
        $locale_course_ids = [];

        if ($raw_filter === 'c') {
            // If filter is set as "c" (Chome), use id 1, 2 and 5
            $locale_course_ids = [1, 2, 5];
        } elseif ($raw_filter !== 'null' && is_numeric($raw_filter) && (int) $raw_filter > 0) {            
            $locale_course_ids = [(int) $raw_filter];
        } else {
            $locale_course_ids = [];
        }

        return $locale_course_ids;
    }

    private function filter_search(string $raw_filter): ?string
    {
        if (substr($raw_filter, 0, 7) !== "search:") {
            return null;
        }

        $search = strtolower(urldecode(substr($raw_filter, 7)));
        return $search;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit