Exemple #1
0
 public function update()
 {
     if (!$this->admin) {
         return;
     }
     $path = 'img/contents/';
     $tmp_error = '';
     $error = '';
     new_directory($path);
     if ($_FILES['icon']['error'] == 0) {
         //icon validation
         if (!upload_file($path, 'icon', $tmp_error, $photo)) {
             $error = 'Error icon upload:' . $tmp_error;
             $tmp_error = '';
         } else {
             @unlink($this->input->post('old_icon'));
             $update['icon'] = $path . $photo['file_name'];
             resize_image($update['icon'], 45, 45);
         }
     }
     if ($_FILES['image']['error'] == 0) {
         //image validation
         if (!upload_file($path, 'image', $tmp_error, $photo)) {
             $error .= trim($tmp_error) != '' ? ',  Error image upload: ' . $tmp_error : 'Error image upload: ' . $tmp_error;
             $tmp_error = '';
         } else {
             @unlink($this->input->post('old_image'));
             $update['image'] = $path . $photo['file_name'];
             resize_image($update['image'], 450);
         }
     }
     if ($error != '') {
         // if the image didn't upload
         echo json_encode(['out' => 'notOk', 'title' => 'Error', 'message' => 'Hubo un error al momento de subir una de las imagenes: ' . $error]);
     } else {
         // if everything is ok
         $update['id_status'] = $this->input->post('cboStatus');
         $update['type'] = $this->input->post('cboType');
         $update['title'] = $this->input->post('txtTitulo');
         $update['text_small'] = $this->input->post('txtSmallText');
         $update['summary'] = $this->input->post('summary');
         $update['body'] = $this->input->post('body');
         $update['author'] = $this->input->post('txtAuthor');
         $update['date'] = date('Y-m-d h:m:s');
         $this->ModelContents->update($update, $this->input->post('id'));
         //query update
         echo json_encode(['out' => 'ok', 'title' => 'Exito!', 'message' => 'El contenido ha sido actualizado exitosamente.', 'id' => $this->input->post('id')]);
     }
 }
Exemple #2
0
    exit;
}
if (isset($_POST["client_ip"])) {
    new_node_save();
    exit;
}
if (isset($_GET["node-events"])) {
    node_events();
    exit;
}
if (isset($_GET["node-events-list"])) {
    node_events_list();
    exit;
}
if (isset($_GET["new-dir"])) {
    new_directory();
    exit;
}
if (isset($_POST["ClusterDirDelete"])) {
    directory_delete();
    exit;
}
if (isset($_POST["new-directory"])) {
    new_directory_save();
    exit;
}
if (isset($_POST["ClusterSetConfig"])) {
    ClusterSetConfig();
    exit;
}
if (isset($_POST["ClusterSetConfig-nodes"])) {