Пример #1
0
include_once "conn.php";
include_once "projectDB.php";
include_once "budgetDB.php";
$action = $_REQUEST["action"];
$res = "";
switch ($action) {
    case "addProject":
        $res = addProject($_REQUEST);
        break;
    case "delProject":
        $res = delProject($_REQUEST["projectId"]);
        break;
    case "editProject":
    case "editproject":
    case "editProjectHeadInfo":
        $res = editProject($_REQUEST);
        break;
    case "editProjectByProjectName":
        $res = editProjectByProjectName($_REQUEST);
        break;
    case "getProjectsByProjectId":
    case "getprojectbyid":
        $res = getProjectsByProjectId($_REQUEST['projectId']);
        break;
    case "getProjectNames":
        $res = getProjectNames();
        break;
    case "getProjectYears":
        $visitorName = $_SESSION["name"];
        if ($_SESSION["level"] == "006-001") {
            $res = getVisitorProject($visitorName, "onlyYears");
Пример #2
0
     switch ($method) {
         case "GET":
             if (isset($path[1]) && trim($path[1]) !== "") {
                 $results = getProject($path[1]);
             } else {
                 $results = getProjects($data);
             }
             break;
         case "POST":
             $results = addProject($data);
             break;
         case "PATCH":
             if (isset($path[1]) && trim($path[1]) !== "") {
                 $data["projectID"] = $path[1];
             }
             $results = editProject($data);
             break;
         case "DELETE":
             if (isset($path[1]) && trim($path[1]) !== "") {
                 $data["projectID"] = $path[1];
             }
             $results = deleteProject($data);
             break;
         default:
             $results["meta"] = methodNotAllowed($method, $path);
     }
     break;
 case "pictures":
     switch ($method) {
         case "GET":
             if (isset($path[1]) && trim($path[1]) !== "") {
if (isset($_POST['action']) && $_POST['action'] == 'View And Edit Projects And Sites') {
    $projects = getAllProjects();
    $sites = getAllSites();
    include 'view.html.php';
    exit;
}
if (isset($_POST['action']) && $_POST['action'] == 'Edit Project Details') {
    $id = $_POST['id'];
    $name = $_POST['name'];
    $description = $_POST['description'];
    include 'editProject.html.php';
    exit;
}
if (isset($_GET['editProject'])) {
    editProject();
    header('Location: .');
    exit;
}
if (isset($_POST['action']) && $_POST['action'] == 'Edit Site Details') {
    $id = $_POST['id'];
    $name = $_POST['name'];
    $description = $_POST['description'];
    $lat = $_POST['lat'];
    $lon = $_POST['lon'];
    include 'editSite.html.php';
    exit;
}
if (isset($_GET['editSite'])) {
    editSite();
    header('Location: .');
Пример #4
0
<?php

include_once "chart.php";
include_once "projectDB.php";
$chart = $_POST;
if (isset($chart["chartType"])) {
    $chartType = $chart["chartType"];
    unset($chart["chartType"]);
    // 需要清楚该元素,否则传递数组进去,会将chartType进行赋值操作导致mysql操作错误。
} else {
    $chartType = "empty";
}
if ($chartType == "project") {
    $arr = getProjectsByProjectId($chart["chartId"]);
    $item = $arr[0];
    $pChart = trim($item["projectChart"]);
    $item["projectChart"] = $pChart == "" || $pChart == "1" ? $chart["chartContent"] : $item["projectChart"] . "<>" . $chart["chartContent"];
    $res = editProject(array("projectId" => $item['projectId'], "projectChart" => $item["projectChart"]));
    // 这里只需要两个字段即可
    echo json_encode($res);
} else {
    if ($chartType == "customized") {
        $arr = getChart($chart);
        $arr = json_decode($arr, true);
        $arr = $arr[0];
        $chart["chartContent"] = $arr["chartContent"] == "" ? $chart["chartContent"] : $arr["chartContent"] . "<>" . $chart["chartContent"];
        echo editChart($chart);
    } else {
        echo "unkown chartType :" . $chartType;
    }
}
Пример #5
0
            if ($item != "." && $item != "..") {
                if (is_dir("{$dir}/{$item}")) {
                    remove_directory("{$dir}/{$item}");
                } else {
                    unlink("{$dir}/{$item}");
                }
            }
        }
        closedir($handle);
        rmdir($dir);
    }
}
if (isset($chart["chartId"])) {
    $dir = "../resources/chart/" . $chart["chartId"];
} else {
    if (isset($chart["projectId"])) {
        $dir = "../resources/chart/" . $chart["projectId"];
    }
}
if (file_exists($dir)) {
    remove_directory($dir);
} else {
    // todo
    // directory has not been existed
}
// edit project if parameters include projectChart.
if (isset($chart["projectChart"])) {
    echo editProject($chart);
} else {
    echo deleteCategory($chart);
}
Пример #6
0
                    SureRemoveDir(realpath(".."), true);
                } else {
                    if (isset($_GET["downloadXML"])) {
                        $file_url = '../file/project.xml';
                        header('Content-Type: application/octet-stream');
                        header("Content-Transfer-Encoding: Binary");
                        header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\"");
                        readfile($file_url);
                    } else {
                        if (isset($_GET["metadataKey"]) && isset($_GET["metadataValue"])) {
                            openProject();
                            editProjectMeta2("projectMeta", $_GET["metadataKey"], $_GET["metadataValue"]);
                            closeProject();
                        } else {
                            if (isset($_GET["edit"]) && isset($_GET["to"])) {
                                editProject($_GET["edit"], $_GET["to"]);
                            }
                        }
                    }
                }
            }
        }
    }
}
if (isset($_GET["status"])) {
    //Récupère le lieu de l'édition
    //$details = json_decode(file_get_contents("http://ipinfo.io/{$_SERVER['REMOTE_ADDR']}"));
    $retour = array("uploadMax" => file_upload_max_size(), "owner" => array("canEdit" => false, "author" => "", "locationGps" => "", "locationName" => ""));
    if (isset($details) && property_exists($details, "city")) {
        $retour["owner"]["locationName"] = $details->city;
    }