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: chapters.php
<?php class Chapters extends MY_Controller { function __construct() { parent::__construct(); $this->load->model('chapters_model'); $this->load->model('sidebars_model'); } public function getOnlineFirst() { $this->checkAuthentification(); $data = []; $data['chapters'] = $this->chapters_model->getOnlineFirst(); $data['page_title'] = 'Edit Online First'; $this->load->view('common/header', $data); $this->load->view('admin/admin_menu', $data); $this->load->view('admin/chapters_edit', $data); $this->load->view('common/footer', $data); } public function listOnlineFirst() { $data = []; $data['chapters'] = $this->chapters_model->getOnlineFirst(); $data['page_title'] = 'Online First'; $data['sidebar'] = $this->sidebars_model->get_main_sidebar(); $this->load->view('common/header', $data); $this->load->view('common/menu', $data); $this->load->view('online_first', $data); $this->load->view('common/sidebar', $data); $this->load->view('common/footer', $data); } public function get_chapter($id) { $data = []; $data['chapter'] = $this->chapters_model->get_chapter($id); $data['page_title'] = isset($data['chapter']['Title']) ? $data['chapter']['Title'] : 'Capitol'; $data['sidebar'] = $this->sidebars_model->get_main_sidebar(); $this->load->view('common/header', $data); $this->load->view('common/menu', $data); $this->load->view('abstract', $data); $this->load->view('common/sidebar', $data); $this->load->view('common/footer', $data); } public function insert($volume_id) { $this->checkAuthentification(); $data = []; $data['page_title'] = 'Adauga volum'; $data['edit'] = false; $data['volume_id'] = $volume_id; $this->load->view('common/header', $data); $this->load->view('admin/admin_menu', $data); $this->load->view('admin/chapter_edit', $data); $this->load->view('common/footer', $data); } public function edit($id, $volume_id) { $this->checkAuthentification(); $data = []; $data['page_title'] = 'Editeaza capitol'; $data['edit'] = true; $data['volume_id'] = $volume_id; $data['chapter'] = $this->chapters_model->get_chapter($id); $this->load->view('common/header', $data); $this->load->view('admin/admin_menu', $data); $this->load->view('admin/chapter_edit', $data); $this->load->view('common/footer', $data); } public function update_chapter($id, $volume_id) { $this->checkAuthentification(); $title = isset($_POST['title']) ? $_POST['title'] : ''; $authors = isset($_POST['authors']) ? $_POST['authors'] : ''; $keywords = isset($_POST['keywords']) ? $_POST['keywords'] : ''; $abstract = isset($_POST['content']) ? $_POST['content'] : ''; $pdf = isset($_POST['pdffile_path']) ? $_POST['pdffile_path'] : ''; if (isset($_FILES['pdffile']['error']) && $_FILES['pdffile']['error'] == 0 && isset($_FILES['pdffile']['size']) && $_FILES['pdffile']['size'] > 0) { $target_file = "resources/pdf/" . 'volume_' . $volume_id . '_' . preg_replace('/\s+/', '_', strtolower($title) . '_abstract'); 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($_FILES['pdffile']["name"], PATHINFO_EXTENSION); move_uploaded_file($_FILES['pdffile']["tmp_name"], $target_file); $pdf = $target_file; } $this->chapters_model->update_chapter($id, $volume_id, $title, $authors, $abstract, $keywords, $pdf); if ($volume_id > 0) { header("Location: /volumes/edit/" . $volume_id); } else { header("/chapters/getOnlineFirst"); } } public function move_to_latest_volume($id, $volume_id) { $this->checkAuthentification(); $title = isset($_POST['title']) ? $_POST['title'] : ''; $authors = isset($_POST['authors']) ? $_POST['authors'] : ''; $keywords = isset($_POST['keywords']) ? $_POST['keywords'] : ''; $abstract = isset($_POST['content']) ? $_POST['content'] : ''; $pdf = isset($_POST['pdffile_path']) ? $_POST['pdffile_path'] : ''; $this->load->model('volumes_model'); $volume = $this->volumes_model->get_last_volume(); $volume_id = $volume['Id']; if (isset($_FILES['pdffile']['error']) && $_FILES['pdffile']['error'] == 0 && isset($_FILES['pdffile']['size']) && $_FILES['pdffile']['size'] > 0) { $target_file = "resources/pdf/" . 'volume_' . $volume_id . '_' . preg_replace('/\s+/', '_', strtolower($title) . '_abstract'); 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($_FILES['pdffile']["name"], PATHINFO_EXTENSION); move_uploaded_file($_FILES['pdffile']["tmp_name"], $target_file); $pdf = $target_file; } $this->chapters_model->update_chapter($id, $volume_id, $title, $authors, $abstract, $keywords, $pdf); if ($volume_id > 0) { header("Location: /volumes/edit/" . $volume_id); } else { header("/chapters/getOnlineFirst"); } } public function insert_chapter($volume_id) { $this->checkAuthentification(); $title = isset($_POST['title']) ? $_POST['title'] : ''; $authors = isset($_POST['authors']) ? $_POST['authors'] : ''; $keywords = isset($_POST['keywords']) ? $_POST['keywords'] : ''; $abstract = isset($_POST['content']) ? $_POST['content'] : ''; if (isset($_FILES['pdffile']['error']) && $_FILES['pdffile']['error'] == 0 && isset($_FILES['pdffile']['size']) && $_FILES['pdffile']['size'] > 0) { $target_file = "resources/pdf/" . 'volume_' . $volume_id . '_' . preg_replace('/\s+/', '_', strtolower($title) . '_abstract'); 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($_FILES['pdffile']["name"], PATHINFO_EXTENSION); move_uploaded_file($_FILES['pdffile']["tmp_name"], $target_file); $pdf = $target_file; } $this->chapters_model->insert_chapter($volume_id, $title, $authors, $abstract, $keywords, $pdf); if ($volume_id > 0) { header("Location: /volumes/edit/" . $volume_id); } else { header("/chapters/getOnlineFirst"); } } public function delete_chapter($id, $volume_id) { $this->checkAuthentification(); $this->chapters_model->delete_chapter($id); if ($volume_id > 0) { header("Location: /volumes/edit/" . $volume_id); } else { header("/chapters/getOnlineFirst"); } } public function checkAuthentification() { return true; $this->load->helper('cookie'); $logInCookie = get_cookie('juraLogInCookie'); if (empty($logInCookie) || 1 !== (int) $logInCookie) { header('Location: /login'); } return true; } }
Upload File
Create Folder