mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Notes backup] Added support for backing up notes with an API key
This commit is contained in:
@@ -38,11 +38,11 @@ class Backup extends CI_Controller {
|
||||
|
||||
if ( ! write_file($data['filename'], $this->load->view('backup/exportall', $data, true)))
|
||||
{
|
||||
$data['status'] = false;
|
||||
$data['status'] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['status'] = true;
|
||||
$data['status'] = true;
|
||||
}
|
||||
|
||||
$data['page_title'] = "ADIF - Backup";
|
||||
@@ -55,19 +55,26 @@ class Backup extends CI_Controller {
|
||||
}
|
||||
|
||||
/* Export the notes to XML */
|
||||
public function notes() {
|
||||
public function notes($key = null) {
|
||||
if ($key == null) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
}
|
||||
|
||||
$this->load->helper('file');
|
||||
$this->load->model('note');
|
||||
|
||||
$data['list_note'] = $this->note->list_all();
|
||||
$data['list_note'] = $this->note->list_all($key);
|
||||
|
||||
if ( ! write_file('backup/notes.xml', $this->load->view('backup/notes', $data, true)))
|
||||
$data['filename'] = 'backup/notes'. date('_Y_m_d_H_i_s') .'.xml';
|
||||
|
||||
if ( ! write_file($data['filename'], $this->load->view('backup/notes', $data, true)))
|
||||
{
|
||||
$data['status'] = false;
|
||||
$data['status'] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['status'] = true;
|
||||
$data['status'] = true;
|
||||
}
|
||||
|
||||
$data['page_title'] = "Notes - Backup";
|
||||
|
||||
Reference in New Issue
Block a user