Esempio n. 1
0
 static function init()
 {
     try {
         self::$db = new PDO(self::$dsn, self::$username, self::$password, self::$options);
         self::$db->exec("set names utf8");
     } catch (PDOException $e) {
         print "MySql Connection error!: " . $e->getMessage();
         die;
     }
 }
Esempio n. 2
0
<?php

header('Access-Control-Allow-Origin: *');
header("Content-type: text/html; charset=utf-8");
require_once 'toggl.php';
require_once 'mantis.php';
$toggl = new Toggl();
$toggl->init();
$mantis = new Mantis();
$mantis->init();
//$statuses = $mantis->getStatuses();
$request = strstr($_SERVER['REQUEST_URI'], ".php");
$p = explode("/", $request);
$func = $p[1];
$r = $_REQUEST;
//var_dump($r);
switch ($func) {
    case 'showMain':
        echo json_encode($r);
        break;
    case 'togglUsers':
        $u = $toggl->getUsers();
        echo json_encode($u);
        break;
    case 'togglProjects':
        echo json_encode($toggl->getProjects());
        break;
    case 'togglTasks':
        $uid = $r['userId'];
        $pid = $r['projectId'];
        $until = $r['until'];
Esempio n. 3
0
$issue->category = BUG_CATEGORY;
$issue->description = 'From: ' . $_POST['email'] . "\n\n" . $_POST['comment'];
$issue->additional_information = $crashlog[0];
$issue->priority = array('id' => 10);
$issue->status = array('id' => 10);
$issue->reproducibility = array('id' => 70);
$issue->resolution = array('id' => 10);
$issue->projection = array('id' => 10);
$issue->eta = array('id' => 10);
$issue->view_state = array('id' => 50);
$issue->version = $_POST['version'];
if (empty($issue->description)) {
    $issue->description = 'Crashed.';
}
$attachments = array('crashes', 'console', 'preferences', 'exception', 'shell', 'system');
try {
    $mantis = new Mantis();
    $issue->project = $mantis->getProject($_REQUEST['project']);
    if (!$mantis->hasVersion($issue->project->id, $issue->version)) {
        $mantis->addVersion($issue->project->id, $issue->version);
    }
    $id = $mantis->addIssue($issue);
    foreach ($attachments as $f) {
        $str = $_POST[$f];
        if (!empty($str)) {
            $mantis->addAttachment($id, $f . '.txt', $str);
        }
    }
} catch (SoapFault $e) {
    print 'ERR An error occurred while storing the report';
}