public static function request($path_args) { global $config; $json = file_get_contents("php://input"); $data = json_decode($json); $issue = self::prepIssue($data); $soap = new SoapClient($config->mantis->wsdl); try { $issue_id = $soap->mc_issue_add($config->mantis->user, $config->mantis->pass, $issue); return array('success' => true, 'version' => $soap->mc_version(), 'issue_id' => $issue_id); } catch (SoapFault $ex) { throw new Exception("Failed to log feedback"); } }
require_once 'WebfinanceCompany.php'; $prefs = new WebfinancePreferences(); $wsdl = $prefs->prefs['mantis_api_url'] . '?wsdl'; $username = $prefs->prefs['mantis_login']; $password = $prefs->prefs['mantis_password']; $company = new WebfinanceCompany($_POST['provider_id']); $company_info = $company->GetInfo(); $method = 'http://'; if (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] !== 'off') { $method = 'https://'; } $url = $method . $_SERVER['HTTP_HOST'] . '/document/edit.php?md5=' . $_POST['md5']; $issue = array('summary' => "Document {$note} from {$company_info['name']}", 'description' => "New document {$note} from {$company_info['name']}\n\n{$url}", 'category' => 'Documents', 'project' => array('id' => 381)); try { $mantis = new SoapClient($wsdl); $ticket_id = $mantis->mc_issue_add($username, $password, $issue); $query .= ", ticket_id = {$ticket_id}"; } catch (SoapFault $fault) { echo $fault; exit; } } $q = "{$query} {$where}"; $result = mysql_query($q) or die(mysql_error() . ' ' . $q); $redirect_url = './?'; if (!empty($_POST['provider_id_filter'])) { $redirect_url = "/prospection/fiche_prospect.php?id={$_POST['provider_id_filter']}&onglet=documents&"; } if (!empty($_POST['status_filter'])) { $redirect_url .= "&status_filter={$_POST['status_filter']}"; }
// $bugdata->project_id = 1; // $bugdata->reporter_id = 'test'; // $bugdata->summary = $_POST['title']; // $bugdata->description = $text; // // # Add issue to tracker database // $id = $bugdata->create(); $issueTitle = $_POST['title']; # Use built-in SOAP service to create new issue $cul_ini_array = parse_ini_file('../cul_config.ini'); $url_base = $cul_ini_array['api_url_base']; $client = new SoapClient("http://{$url_base}/api/soap/mantisconnect.php?wsdl"); $project = new StdClass(); $project->id = 1; $issueData = array('project' => $project, 'summary' => $issueTitle, 'description' => $text, 'category' => 'General'); $newIssueId = $client->mc_issue_add($cul_ini_array['api_user'], $cul_ini_array['api_pass'], $issueData); # Handle attachments $errorMessage = ''; if ($_FILES['attachment']['error'] != 4) { # TODO: the file upload routine is kludgy. It would be better to read the # temporary file directly and pass it to the soap request, rather than saving # a file to the server only to delete it again a few steps later. $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["attachment"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if image file is a actual image or fake image // $check = getimagesize($_FILES["attachment"]["tmp_name"]); // if($check !== false) { // echo "File is an image - " . $check["mime"] . "."; // $uploadOk = 1;
$status = new StdClass(); $status->id = $statusid; $issueData->status = $status; //Resumen $issueData->summary = $summary; //Descripcion $issueData->description = $_REQUEST['descripcion']; //categoria $issueData->category = $_REQUEST['categoria']; //Asignado a $handler = new StdClass(); $handler->name = $usuarioAsignar; $issueData->handler = $handler; //Peticion SOAP try { $requerimiento = $client->mc_issue_add($user, $password, $issueData); } catch (SoapFault $f) { echo '<div style="text-align: center"><p><b>'; echo $this->lenguaje->getCadena("errorCreacionIncidente"); echo "</b></p></div>"; exit; } //Mensaje if ($requerimiento > 0) { echo '<div style="text-align: center"><p><b>'; echo $this->lenguaje->getCadena("creacionExitosa"); echo '<a href="' . $busqueda . $requerimiento . '">' . $requerimiento . '</a>'; echo "</b></p></div>"; $this->registrarActividad($requerimiento); exit; }