<?php require_once "../models/db.php"; require_once "../models/articles.php"; $link = db_connect(); $action = isset($_GET['action']) ? $_GET['action'] : ""; switch ($action) { case "add": action_add(); break; case "edit": action_edit(); break; case "delete": action_delete(); break; default: action_list(); } function action_add() { global $link; if (!empty($_POST)) { articles_new($link, $_POST['title'], $_POST['date'], $_POST['content']); header("Location: index.php"); } $article['title'] = ""; $article['content'] = ""; $article['date'] = ""; require "../views/article_admin.php"; }
return "刪除成功"; } function action_update($dbObj) { $id = $_GET['id']; $position = $_GET['position']; $sqlCmd = "UPDATE user_position_table SET name='{$position}' WHERE id='{$id}'"; if (($success = $dbObj->Execute($sqlCmd)) != true) { return "Execute SQL Command failed: ({$sqlCmd})"; } return "更新成功"; } $dbObj = DatabaseInstance::GetInstance(); if ($_GET) { $action = $_GET['action']; $ret = ""; switch ($action) { case "add": $ret = action_add($dbObj); break; case "delete": $ret = action_delete($dbObj); break; case "update": $ret = action_update($dbObj); break; default: $ret = "No such action"; } echo $ret; }
case "tools": $cid = $h->cage->post->getInt('id'); $result = $arObj->adminProcessTools($h); print $result; exit; // this is an ajax return call, so we don't want any html echoing to the screen // this is an ajax return call, so we don't want any html echoing to the screen case "test_feed": $data = $h->cage->post->testUri('url'); $arObj->adminTestfeed($data); exit; // this is an ajax return call, so we don't want any html echoing to the screen // this is an ajax return call, so we don't want any html echoing to the screen default: echo '<h2>Add New Campaign</h2>'; action_add($h, $arObj); } ?> <div class="wrap"> <?php function action_add($h, $arObj, $data = null, $action = 'add') { $arObj = new Autoreader($h); $autoreader_settings = $arObj->getOptionSettings($h); ?> <form id="edit_campaign" action="" method="post" accept-charset="utf-8"> <?php if ($action == 'edit') {