$query = "SELECT project_name, project_id FROM projects"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $all_dp_projects[$row["project_id"]] = trim(strtolower($row["project_name"])); if ($row["project_id"] == $project_id) { $project_name = $row["project_name"]; } } // if there is a project name, we want to get the bugs for that project if ($project_name != "") { $mantis->resetRequest(); $mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("getMantisBugByProjectName"); $mantis->addArg($project_name); $bugs = $mantis->call(); if (ERROR::isError($bugs)) { die($bugs->getErrstr()); } } else { $mantis->resetRequest(); $mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("getMantisBugByProjectID"); $mantis->addArg(""); $bugs = $mantis->call(); if (ERROR::isError($bugs)) { die($bugs->getErrstr()); } } if ($bugs == 0) {
} if (($_POST["project_id"] == "" || $_POST["project_id"] == 0) && $_POST["bug_action"] == "task") { $AppUI->redirect($forward_link); die; } $mantis = new PHPXMLRPCClient(); $mantis->createClient($web_path_to_mantis_xmlrpc . "mantisserver.php", $domain); $mantis->setXMLRPCDebug(0); if ($_POST["bug_action"] == "task") { foreach ($_POST["bugs"] as $b) { $mantis->resetRequest(); $mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("getMantisBugById"); $mantis->addArg($b); $bug = $mantis->call(); if (ERROR::isError($bug)) { die($bug->getErrstr()); } $obj = new CTask(); $obj->task_id = false; $obj->task_name = $bug["summary"]; $obj->task_project = $_POST["project_id"]; $obj->task_start_date = date("Y-m-d h:i:s", time()); $obj->task_end_date = date("Y-m-d h:i:s", time() + 24 * 60 * 60); $obj->task_description = $bug["description"]; $obj->task_owner = $AppUI->user_id; $obj->task_milestone = false; $obj->task_type = 3; $result = createTask($obj); if (!$result) {
<?php require_once "mantis_config.php"; if ($_GET["project_id"] == "") { $AppUI->redirect("m=projects"); die; } $forward_link = "m=projects&a=view&project_id=" . $_GET["project_id"]; $mantis = new PHPXMLRPCClient(); $mantis->createClient($web_path_to_mantis_xmlrpc . "mantisserver.php", $domain); $mantis->setXMLRPCDebug(0); $query = "SELECT project_name, project_description FROM projects WHERE project_id='" . $_GET["project_id"] . "'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $project_name = $row["project_name"]; $project_description = $row["project_description"]; $mantis->resetRequest(); $mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("project_create"); $mantis->addArg($project_name); $mantis->addArg($project_description); $mantis->addArg("10"); $bug = $mantis->call(); if (ERROR::isError($bug)) { die($bug->getErrstr()); } $AppUI->redirect($forward_link); die;