X7ROOT File Manager
Current Path:
/home/jurarevi/beta.jurareview.ro/application/controllers
home
/
jurarevi
/
beta.jurareview.ro
/
application
/
controllers
/
📁
..
📄
announcements.php
(2.85 KB)
📄
chapters.php
(8.95 KB)
📄
config.php
(2.01 KB)
📄
contact.php
(2.52 KB)
📄
headerFooter.php
(1.39 KB)
📄
home.php
(731 B)
📄
index.html
(114 B)
📄
login.php
(925 B)
📄
menu.php
(2.19 KB)
📄
pagini.php
(3.86 KB)
📄
search.php
(1.19 KB)
📄
sidebars.php
(2.18 KB)
📄
test.php
(773 B)
📄
volumes.php
(8.79 KB)
📄
welcome.php
(770 B)
Editing: volumes.php
<?php class Volumes extends MY_Controller { function __construct() { parent::__construct(); $this->load->model('volumes_model'); $this->load->model('sidebars_model'); } function index() { $this->checkAuthentification(); $volumes = $this->volumes_model->get_volumes_list(); $data = []; $data['page_title'] = 'Lista volume'; $data['volumes'] = $volumes; $this->load->view('common/header', $data); $this->load->view('admin/admin_menu', $data); $this->load->view('admin/volumes_list', $data); $this->load->view('common/footer', $data); } public function getVolumesArchive() { $volumes = $this->volumes_model->get_volumes_list(); $data = []; $data['volumes'] = []; $data['sidebar'] = $this->sidebars_model->get_main_sidebar(); foreach ($volumes as $key => $volume) { if (!isset($data['volumes'][$volume['LastUpdated']])) { $data['volumes'][$volume['LastUpdated']] = []; } $data['volumes'][$volume['LastUpdated']][] = $volume; } $data['page_title'] = 'Lista volume'; $this->load->view('common/header', $data); $this->load->view('common/menu', $data); $this->load->view('archive', $data); $this->load->view('common/sidebar', $data); $this->load->view('common/footer', $data); } public function insert() { $this->checkAuthentification(); $data = []; $data['page_title'] = 'Adauga volum'; $data['edit'] = false; if (isset($_POST['title']) && !empty($_FILES)) { // print_r($_POST); // print_r($_FILES); // exit; $title = $_POST['title']; $files = []; foreach ($_FILES as $name => $file_details) { if (isset($file_details['error']) && $file_details['error'] == 0 && isset($file_details['size']) && $file_details['size'] > 0 && isset($file_details['name']) && $file_details['name'] != '' ) { $target_file = "resources/pdf/" . preg_replace('/\s+/', '_', strtolower($title . '_' . $name)); while (strpos($target_file, ',') !== false) { $target_file = str_replace(',', '', $target_file); } while (strpos($target_file, '.') !== false) { $target_file = str_replace('.', '', $target_file); } while (strpos($target_file, '"') !== false) { $target_file = str_replace('"', '', $target_file); } while (strpos($target_file, "'") !== false) { $target_file = str_replace("'", '', $target_file); } $target_file = $target_file . '.' . pathinfo($file_details["name"], PATHINFO_EXTENSION); $files[$name] = $target_file; move_uploaded_file($file_details["tmp_name"], $target_file); } } $announcement = $this->volumes_model->insert($title, $files); header("Location: /volumes"); } else { $this->load->view('common/header', $data); $this->load->view('admin/admin_menu', $data); $this->load->view('admin/volume_edit', $data); $this->load->view('common/footer', $data); } } public function edit($id) { $this->checkAuthentification(); $data = []; $data['page_title'] = 'Editeaza volum'; $data['edit'] = true; $data['volume'] = $this->volumes_model->get_volume_and_chapters($id); $this->load->view('common/header', $data); $this->load->view('admin/admin_menu', $data); $this->load->view('admin/volume_edit', $data); $this->load->view('common/footer', $data); } public function update($id) { $this->checkAuthentification(); $title = isset($_POST['title']) ? $_POST['title'] : ''; $foreword = isset($_POST['foreword_path']) ? $_POST['foreword_path'] : ''; if ($title != '' && isset($_FILES['foreword']['error']) && $_FILES['foreword']['error'] == 0 && isset($_FILES['foreword']['size']) && $_FILES['foreword']['size'] > 0) { $foreword = $this->save_pdf($_FILES['foreword'], 'foreword', $title); } $reviews = isset($_POST['reviews_path']) ? $_POST['reviews_path'] : ''; if ($title != '' && isset($_FILES['reviews']['error']) && $_FILES['reviews']['error'] == 0 && isset($_FILES['reviews']['size']) && $_FILES['reviews']['size'] > 0) { $reviews = $this->save_pdf($_FILES['reviews'], 'reviews', $title); } $corrigendum = isset($_POST['corrigendum_path']) ? $_POST['corrigendum_path'] : ''; if ($title != '' && isset($_FILES['corrigendum']['error']) && $_FILES['corrigendum']['error'] == 0 && isset($_FILES['corrigendum']['size']) && $_FILES['corrigendum']['size'] > 0) { $corrigendum = $this->save_pdf($_FILES['corrigendum'], 'corrigendum', $title); } $pdf = isset($_POST['file_path']) ? $_POST['file_path'] : ''; if ($title != '' && isset($_FILES['file']['error']) && $_FILES['file']['error'] == 0 && isset($_FILES['file']['size']) && $_FILES['file']['size'] > 0) { $pdf = $this->save_pdf($_FILES['file'], 'file', $title); } $this->volumes_model->update_volume($id, $title, $foreword, $reviews, $corrigendum, $pdf); header("Location: /volumes/edit/" . $id); } public function delete_volume($id) { $this->checkAuthentification(); $this->volumes_model->delete_volume($id); header("Location: /volumes"); } private function save_pdf($file, $name, $title) { $target_file = "resources/pdf/" . preg_replace('/\s+/', '_', strtolower($title . '_' . $name)); while (strpos($target_file, ',') !== false) { $target_file = str_replace(',', '', $target_file); } while (strpos($target_file, '.') !== false) { $target_file = str_replace('.', '', $target_file); } while (strpos($target_file, '"') !== false) { $target_file = str_replace('"', '', $target_file); } while (strpos($target_file, "'") !== false) { $target_file = str_replace("'", '', $target_file); } $target_file = $target_file . '.' . pathinfo($file["name"], PATHINFO_EXTENSION); move_uploaded_file($file["tmp_name"], $target_file); return $target_file; } public function view_content_online() { $volumes = $this->volumes_model->view_content_online(); $data = []; $data['page_title'] = 'All issues'; $data['volumes'] = $volumes; $data['sidebar'] = $this->sidebars_model->get_main_sidebar(); // print_r($volume);exit; $this->load->view('common/header', $data); $this->load->view('common/menu', $data); $this->load->view('volumes_list', $data); $this->load->view('common/sidebar', $data); $this->load->view('common/footer'); } public function latest_issue() { $volume = $this->volumes_model->get_last_volume(); $data = []; $data['page_title'] = 'JURA - Latest issue'; $data['volume'] = $volume; $data['sidebar'] = $this->sidebars_model->get_main_sidebar(); // print_r($volume);exit; $this->load->view('common/header'); $this->load->view('common/menu', $data); $this->load->view('home', $data); $this->load->view('common/sidebar', $data); $this->load->view('common/footer'); } public function get_issue_by_id($id) { $volume = $this->volumes_model->get_volume_and_chapters($id); $data = []; $data['page_title'] = 'JURA - ' . $volume['Title']; $data['volume'] = $volume; $data['sidebar'] = $this->sidebars_model->get_main_sidebar(); // print_r($volume);exit; $this->load->view('common/header'); $this->load->view('common/menu', $data); $this->load->view('home2', $data); $this->load->view('common/sidebar', $data); $this->load->view('common/footer'); } public function checkAuthentification() { $this->load->helper('cookie'); $logInCookie = get_cookie('juraLogInCookie'); if (empty($logInCookie) || 1 !== (int) $logInCookie) { header('Location: /login'); } return true; } }
Upload File
Create Folder