Example #1
0
 public static function verifyPeer($bool)
 {
     self::$verifyPeer = $bool;
 }
Example #2
0
displayStatus("========== TogglSync ==========");
displayStatus("Running at " . Date('Y-m-d H:i:s'));
displayStatus("===============================");
/*
 * Establish a connection to the database
 */
try {
    displayStatus("Establishing database connection");
    $db = new PDO('mysql:host=' . $DB_HOST . ';dbname=' . $DB_NAME . ';charset=utf8', '' . $DB_USER . '', '' . $DB_PASS . '');
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    displayStatus("Could not establish a connection to the database.");
    die;
}
displayStatus("Connected to database.");
Toggl::setKey($TOGGL_KEY);
/*
 * Get a list of projects in our workspace
 */
displayStatus("Getting workspace projects from Toggl");
$projects = TogglWorkspace::getWorkspaceProjects($TOGGL_WORKSPACE);
/*
 * Here's where the fun begins
 * Go through all of our projects
 */
foreach ($projects as $Project) {
    try {
        //See if we've already added this project...
        $stmt = $db->prepare("SELECT * FROM " . $TBL_PROJECTS . " WHERE pid=?");
        $stmt->execute(array($Project['id']));
        //If we haven't added the project, add it!
Example #3
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'];
Example #4
0
 public static function setWorkspace($wid)
 {
     self::$wid = $wid;
 }