Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/application/controllers/admin/Redirects.php

52 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2018-10-16 16:28:42 +00:00
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Redirects extends MY_Controller
2018-10-16 16:28:42 +00:00
{
public function __construct()
{
parent::__construct();
$this->load->model('RedirectModel', '', TRUE);
}
public function index()
{
$this->neededPermission('redirect.view');
2018-10-16 16:28:42 +00:00
$redirects = $this->RedirectModel->getItems();
$this->load->view('admin/sidebar', ['title' => 'Alle Weiterleitungen']);
$this->load->view('admin/redirects', ['redirects' => $redirects]);
$this->load->view('admin/footer', ['additionalScripts' => ['redirects.js']]);
}
public function addRedirect() {
$this->neededPermission('redirect.create');
2018-10-16 16:28:42 +00:00
$id = $this->input->post('redirectID');
$name = $this->input->post('redirectName');
$url = $this->input->post('redirectUrl');
if(isset($name) && isset($url)) {
if(isset($id)) {
$this->neededPermission('redirect.edit');
2018-10-16 16:28:42 +00:00
$this->RedirectModel->editRedirect($id, $url, $name);
} else {
$this->RedirectModel->insertRedirect($url, $name);
}
}
redirect(base_url('admin/redirects'));
}
public function removeRedirect($id = null) {
$this->neededPermission('redirect.delete');
2018-10-16 16:28:42 +00:00
if($id != null) {
$this->RedirectModel->removeRedirect($id);
}
redirect(base_url('admin/redirects'));
}
}