Пример #1
0
    $js = 'window.setInterval(function() {';
    $js .= 'if(getAjaxBool("' . orongoURL("ajax/isGCSet.php") . '")) window.location="' . orongoURL("orongo-admin/post-issue.php") . '"; ';
    $js .= '},2000);';
    getDisplay()->addJS($js, "document.ready");
    if (isset($_GET['error'])) {
        $postIssue->addMessage($_GET['error'], "error");
    }
    if (isset($_GET['msg'])) {
        switch ($_GET['msg']) {
            case 0:
                $postIssue->addMessage(l("Issue posted"), "success");
                break;
            default:
                break;
        }
    } else {
        $windowJS = "var login = window.open('" . IssueTracker::getAuthSubRequestUrl(orongoURL("orongo-admin/post-issue.php")) . "');";
        getDisplay()->addJS($windowJS, "document.ready");
    }
    $postIssue->render();
} else {
    $postIssue->main(array("time" => time(), "page_title" => "Post Issue", "page_template" => "dashboard"));
    $form = new AdminFrontendForm(100, "Post Issue", "POST", orongoURL("actions/action_PostIssue.php"));
    $form->addInput("Issue Author", "issue_author", "text", "", true);
    $form->addInput("Issue Title", "issue_title", "text", "", true);
    $form->addInput("Issue Description", "issue_content", "textarea", "", true);
    $form->addInput("Issue Labels", "issue_labels", "text", "");
    $form->addButton("Post", true);
    $postIssue->addObject($form);
    $postIssue->render();
}
Пример #2
0
<?php

/**
 * @author Jaco Ruit
 */
require '../startOrongo.php';
startOrongo();
if (isset($_SESSION['auth-sub-token']) || isset($_POST['issue_author']) || isset($_POST['issue_title']) || isset($_POST['issue_labels']) || isset($_POST['issue_content'])) {
    $issue = new Issue($_POST['issue_title']);
    $issue->setStatus("New");
    $issue->setAuthor($_POST['issue_author']);
    $issue->setContent($_POST['issue_content']);
    if (!empty($_POST['issue_labels'])) {
        $labels = explode(",", trim($_POST['issue_labels']));
        foreach ($labels as &$label) {
            trim($label);
        }
        $issue->setLabels($labels);
    }
    $issueTracker = new IssueTracker($_SESSION['auth-sub-token']);
    unset($_SESSION['auth-sub-token']);
    try {
        $issueTracker->postIssue($issue);
        header("Location: " . orongoURL("orongo-admin/post-issue.php?msg=0"));
    } catch (Exception $e) {
        header("Location: " . orongoURL("orongo-admin/post-issue.php?error=" . $e->getMessage()));
    }
} else {
    header("Location: " . orongoURL("orongo-admin/post-issue.php"));
}
 /**
  * Returns a single instance of the class.
  *
  * @return obj
  */
 protected static function _getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }