public function save() { $model = $this->getModel('settings'); $res = $model->save(); $msg = $res->msg; PIPES::add_message($msg); $this->display(); }
public function uninstall() { $mod = $this->getModel('plugins'); $addon = isset($_GET['addon']) ? $_GET['addon'] : ''; $res = $mod->uninstall($addon); PIPES::add_message($res); $url = remove_query_arg(array('element', 'addon', 'action', 'action2'), $_SERVER['HTTP_REFERER']); header('Location: ' . $url); exit; }
function save() { /*echo "\n\n<br /><i><b>File:</b>".__FILE__.' <b>Line:</b>'.__LINE__."</i><br />\n\n"; echo '<pre>'; print_r($_POST); echo '</pre>';exit();*/ global $mainframe, $option; $mod = $this->getModel('pipe'); $res = $mod->save(); $msg = $res->msg; PIPES::add_message($msg); $task = filter_input(INPUT_POST, 'task'); //$apply = $task=='apply'?'&task=edit&id[]='.$res->id:''; $url = admin_url() . 'admin.php?page=' . PIPES::$__page_prefix . '.pipe&id=' . $res->id; header('Location: ' . $url); exit; // $mainframe->enqueueMessage($msg, $res->typemsg); // $mainframe->redirect("index.php?option={$option}&controller=items".$apply); }
public function import_from_file() { $upload_dir = wp_upload_dir(); $mod = $this->getModel('pipes'); $id = isset($_GET['id']) ? $_GET['id'] : 0; $file_name = isset($_GET['file_name']) ? $_GET['file_name'] : ''; if (isset($_FILES["file_import"]["name"])) { $filename = $_FILES["file_import"]["tmp_name"]; } elseif (isset($_GET['url'])) { $filename = $_GET['url']; } elseif (is_file($upload_dir['basedir'] . DS . 'wppipes' . DS . 'templates' . DS . $file_name)) { $filename = $upload_dir['basedir'] . DS . 'wppipes' . DS . 'templates' . DS . $file_name; } $file_content = file_get_contents($filename); $items = explode("\n", $file_content); $new_pipes = array(); if ($file_content == '') { $new_pipes[] = "The file has not content!"; } foreach ($items as $value) { if ($value != '') { if (substr($value, 0, 1) == '{') { $item = json_decode($value); } else { $item = json_decode(substr($value, 3)); } if (!is_object($item)) { $new_pipes[] = "There is something wrong with the structure of file's content!"; continue; } $item->current_id = $id; $new_pipes[] = $mod->import_from_file($item); } } $message = implode("</br>", $new_pipes); PIPES::add_message($message); if (isset($_GET['url'])) { $url = remove_query_arg(array('task', 'url'), $_SERVER['HTTP_REFERER']); header('Location: ' . $url); exit; } elseif ($id > 0) { $url = admin_url() . 'admin.php?page=' . PIPES::$__page_prefix . '.pipe&id=' . $id; header('Location: ' . $url); exit; } }