Uname:
Linux webm016.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software:
Apache
PHP version:
7.4.33 [ PHP INFO ] PHP os:
Linux
Server Ip:
54.36.31.145
Your Ip:
216.73.216.182
User:
homesquasz (91404) | Group:
users (100)
Safe Mode:
OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl
<?php
/*
* Generated by CRUDigniter v3.2
* www.crudigniter.com
*/
class Notifier extends FrontApplication{
function __construct()
{
parent::__construct();
$this->load->model('Notifier_model');
}
/*
* Listing of notifier
*/
function index()
{
$params['limit'] = RECORDS_PER_PAGE;
$params['offset'] = ($this->input->get('per_page')) ? $this->input->get('per_page') : 0;
$config = $this->config->item('pagination');
$config['base_url'] = site_url('notifier/index?');
$config['total_rows'] = $this->Notifier_model->get_all_notifier_count();
$this->pagination->initialize($config);
$this->data['notifier'] = $this->Notifier_model->get_all_notifier($params);
$this->data['_view'] = 'notifier/index';
$this->load->view('layouts/main',$this->data);
}
/*
* Adding a new notifier
*/
function add()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('users_id','Users Id','required');
if($this->form_validation->run())
{
$users= $this->input->post("notifyto_id");
foreach($users as $notify){
$params = array(
'users_id' => $this->input->post('users_id'),
'notifyto'=> $notify
);
$notifier_id = $this->Notifier_model->add_notifier($params);
}
redirect('notifier/index');
}
else
{
$this->load->model('User_model');
$this->data['all_users'] = $this->User_model->get_all_users();
$this->data['_view'] = 'notifier/add';
$this->load->view('layouts/main',$this->data);
}
}
/*
* Editing a notifier
*/
function edit($id)
{
// check if the notifier exists before trying to edit it
$this->data['notifier'] = $this->Notifier_model->get_notifier($id);
if(isset($this->data['notifier']['id']))
{
$this->load->library('form_validation');
$this->form_validation->set_rules('users_id','Users Id','required');
if($this->form_validation->run())
{
$params = array(
'users_id' => $this->input->post('users_id'),
);
$this->Notifier_model->update_notifier($id,$params);
redirect('notifier/index');
}
else
{
$this->load->model('User_model');
$this->data['all_users'] = $this->User_model->get_all_users();
$this->data['_view'] = 'notifier/edit';
$this->load->view('layouts/main',$this->data);
}
}
else
show_error('The notifier you are trying to edit does not exist.');
}
/*
* Deleting notifier
*/
function remove($id)
{
$notifier = $this->Notifier_model->get_notifier($id);
// check if the notifier exists before trying to delete it
if(isset($notifier['id']))
{
$this->Notifier_model->delete_notifier($id);
redirect('notifier/index');
}
else
show_error('The notifier you are trying to delete does not exist.');
}
}