예제 #1
0
include_once 'models/project.php';
include_once "models/clientjobschedule.php";
if (!$CDASH_MANAGE_CLIENTS) {
    echo "CDash has not been setup to allow client management";
    return;
}
$userid = $_SESSION['cdash']['loginid'];
if (!isset($_GET['scheduleid'])) {
    echo "Schedule id not set";
    return;
}
$scheduleid = $_GET['scheduleid'];
$ClientJobSchedule = new ClientJobSchedule();
$ClientJobSchedule->Id = $scheduleid;
$projectid = $ClientJobSchedule->GetProjectId();
$xml = begin_XML_for_XSLT();
$xml .= add_XML_value("manageclient", $CDASH_MANAGE_CLIENTS);
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
pdo_select_db("{$CDASH_DB_NAME}", $db);
$xml .= add_XML_value("title", "CDash - Scheduled Build Submissions");
$xml .= add_XML_value("menutitle", "CDash");
$xml .= add_XML_value("menusubtitle", "Submitted Builds");
$xml .= "<hostname>" . $_SERVER['SERVER_NAME'] . "</hostname>";
$xml .= "<date>" . date("r") . "</date>";
$xml .= "<backurl>user.php</backurl>";
$builds = $ClientJobSchedule->GetAssociatedBuilds();
foreach ($builds as $buildid) {
    $xml .= '<build>';
    $xml .= add_XML_value("id", $buildid);
    $xml .= '</build>';
}
예제 #2
0
/** Login Form function */
function LoginForm($loginerror)
{
    include dirname(__DIR__) . '/config/config.php';
    require_once 'include/pdo.php';
    include_once 'include/common.php';
    include 'include/version.php';
    $xml = begin_XML_for_XSLT();
    $xml .= '<title>Login</title>';
    if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) {
        $xml .= add_XML_value('noregister', '1');
    }
    if (@$_GET['note'] == 'register') {
        $xml .= '<message>Registration Complete. Please login with your email and password.</message>';
    }
    if ($loginerror != '') {
        $xml .= '<message>' . $loginerror . '</message>';
    }
    if ($CDASH_ALLOW_LOGIN_COOKIE) {
        $xml .= '<allowlogincookie>1</allowlogincookie>';
    }
    if ($GOOGLE_CLIENT_ID != '' && $GOOGLE_CLIENT_SECRET != '') {
        $xml .= '<oauth2>';
        $xml .= add_XML_value('client', $GOOGLE_CLIENT_ID);
        // Google OAuth needs to know the base url to redirect back to
        $xml .= add_XML_value('CDASH_BASE_URL', get_server_URI());
        $xml .= '</oauth2>';
    }
    $xml .= '</cdash>';
    if (!isset($NoXSLGenerate)) {
        generate_XSLT($xml, 'login');
    }
}
예제 #3
0
/** Generate the subprojects dashboard */
function generate_subprojects_dashboard_XML($project_instance, $date)
{
    $start = microtime_float();
    $noforcelogin = 1;
    include_once "cdash/config.php";
    require_once "cdash/pdo.php";
    include 'login.php';
    include_once "models/banner.php";
    include_once "models/subproject.php";
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        echo "Error connecting to CDash database server<br>\n";
        return;
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        echo "Error selecting CDash database<br>\n";
        return;
    }
    $Project = $project_instance;
    $projectid = $project_instance->Id;
    $homeurl = make_cdash_url(htmlentities($Project->HomeUrl));
    checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid);
    $xml = begin_XML_for_XSLT();
    $xml .= "<title>CDash - " . $Project->Name . "</title>";
    $Banner = new Banner();
    $Banner->SetProjectId(0);
    $text = $Banner->GetText();
    if ($text !== false) {
        $xml .= "<banner>";
        $xml .= add_XML_value("text", $text);
        $xml .= "</banner>";
    }
    $Banner->SetProjectId($projectid);
    $text = $Banner->GetText();
    if ($text !== false) {
        $xml .= "<banner>";
        $xml .= add_XML_value("text", $text);
        $xml .= "</banner>";
    }
    global $CDASH_SHOW_LAST_SUBMISSION;
    if ($CDASH_SHOW_LAST_SUBMISSION) {
        $xml .= "<showlastsubmission>1</showlastsubmission>";
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $Project->NightlyTime);
    $svnurl = make_cdash_url(htmlentities($Project->CvsUrl));
    $homeurl = make_cdash_url(htmlentities($Project->HomeUrl));
    $bugurl = make_cdash_url(htmlentities($Project->BugTrackerUrl));
    $googletracker = htmlentities($Project->GoogleTracker);
    $docurl = make_cdash_url(htmlentities($Project->DocumentationUrl));
    // Main dashboard section
    $xml .= "<dashboard>\n  <datetime>" . date("l, F d Y H:i:s T", time()) . "</datetime>\n  <date>" . $date . "</date>\n  <unixtimestamp>" . $currentstarttime . "</unixtimestamp>\n  <svn>" . $svnurl . "</svn>\n  <bugtracker>" . $bugurl . "</bugtracker>\n  <googletracker>" . $googletracker . "</googletracker>\n  <documentation>" . $docurl . "</documentation>\n  <logoid>" . $Project->getLogoID() . "</logoid>\n  <projectid>" . $projectid . "</projectid>\n  <projectname>" . $Project->Name . "</projectname>\n  <projectname_encoded>" . urlencode($Project->Name) . "</projectname_encoded>\n  <previousdate>" . $previousdate . "</previousdate>\n  <projectpublic>" . $Project->Public . "</projectpublic>\n  <nextdate>" . $nextdate . "</nextdate>";
    if (empty($Project->HomeUrl)) {
        $xml .= "<home>index.php?project=" . urlencode($Project->Name) . "</home>";
    } else {
        $xml .= "<home>" . $homeurl . "</home>";
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/models/proProject.php")) {
        include_once "local/models/proProject.php";
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $xml .= "<proedition>" . $pro->GetEdition(1) . "</proedition>";
    }
    if ($currentstarttime > time()) {
        $xml .= "<future>1</future>";
    } else {
        $xml .= "<future>0</future>";
    }
    $xml .= "</dashboard>";
    // Menu definition
    $xml .= "<menu>";
    if (!has_next_date($date, $currentstarttime)) {
        $xml .= add_XML_value("nonext", "1");
    }
    $xml .= "</menu>";
    $beginning_timestamp = $currentstarttime;
    $end_timestamp = $currentstarttime + 3600 * 24;
    $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
    $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
    // User
    if (isset($_SESSION['cdash'])) {
        $xml .= "<user>";
        $userid = $_SESSION['cdash']['loginid'];
        $user2project = pdo_query("SELECT role FROM user2project WHERE userid='{$userid}' and projectid='{$projectid}'");
        $user2project_array = pdo_fetch_array($user2project);
        $user = pdo_query("SELECT admin FROM " . qid("user") . "  WHERE id='{$userid}'");
        $user_array = pdo_fetch_array($user);
        $xml .= add_XML_value("id", $userid);
        $isadmin = 0;
        if ($user2project_array["role"] > 1 || $user_array["admin"]) {
            $isadmin = 1;
        }
        $xml .= add_XML_value("admin", $isadmin);
        $xml .= add_XML_value("projectrole", $user2project_array['role']);
        $xml .= "</user>";
    }
    // Get some information about the project
    $xml .= "<project>";
    $xml .= add_XML_value("nbuilderror", $Project->GetNumberOfErrorBuilds($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("nbuildwarning", $Project->GetNumberOfWarningBuilds($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("nbuildpass", $Project->GetNumberOfPassingBuilds($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("nconfigureerror", $Project->GetNumberOfErrorConfigures($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("nconfigurewarning", $Project->GetNumberOfWarningConfigures($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("nconfigurepass", $Project->GetNumberOfPassingConfigures($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("ntestpass", $Project->GetNumberOfPassingTests($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("ntestfail", $Project->GetNumberOfFailingTests($beginning_UTCDate, $end_UTCDate, true));
    $xml .= add_XML_value("ntestnotrun", $Project->GetNumberOfNotRunTests($beginning_UTCDate, $end_UTCDate, true));
    if (strlen($Project->GetLastSubmission()) == 0) {
        $xml .= add_XML_value("lastsubmission", "NA");
    } else {
        $xml .= add_XML_value("lastsubmission", $Project->GetLastSubmission());
    }
    $xml .= "</project>";
    // Look for the subproject
    $row = 0;
    $subprojectids = $Project->GetSubProjects();
    $subprojProp = array();
    foreach ($subprojectids as $subprojectid) {
        $SubProject = new SubProject();
        $SubProject->SetId($subprojectid);
        $subprojProp[$subprojectid] = array('name' => $SubProject->GetName());
    }
    $testSubProj = new SubProject();
    $result = $testSubProj->GetNumberOfErrorBuilds($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['nbuilderror'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfWarningBuilds($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['nbuildwarning'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfPassingBuilds($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['nbuildpass'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfErrorConfigures($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['nconfigureerror'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfWarningConfigures($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['nconfigurewarning'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfPassingConfigures($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['nconfigurepass'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfPassingTests($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['ntestpass'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfFailingTests($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['ntestfail'] = $row[1];
        }
    }
    $result = $testSubProj->GetNumberOfNotRunTests($beginning_UTCDate, $end_UTCDate, True);
    if ($result) {
        foreach ($result as $row) {
            $subprojProp[$row['subprojectid']]['ntestnotrun'] = $row[1];
        }
    }
    $reportArray = array('nbuilderror', 'nbuildwarning', 'nbuildpass', 'nconfigureerror', 'nconfigurewarning', 'nconfigurepass', 'ntestpass', 'ntestfail', 'ntestnotrun');
    foreach ($subprojectids as $subprojectid) {
        $SubProject = new SubProject();
        $SubProject->SetId($subprojectid);
        $xml .= "<subproject>";
        $xml .= add_XML_value("name", $SubProject->GetName());
        $xml .= add_XML_value("name_encoded", urlencode($SubProject->GetName()));
        foreach ($reportArray as $reportnum) {
            $reportval = array_key_exists($reportnum, $subprojProp[$subprojectid]) ? $subprojProp[$subprojectid][$reportnum] : 0;
            $xml .= add_XML_value($reportnum, $reportval);
        }
        if (strlen($SubProject->GetLastSubmission()) == 0) {
            $xml .= add_XML_value("lastsubmission", "NA");
        } else {
            $xml .= add_XML_value("lastsubmission", $SubProject->GetLastSubmission());
        }
        $xml .= "</subproject>";
        if ($row == 1) {
            $row = 0;
        } else {
            $row = 1;
        }
    }
    // end for each subproject
    $end = microtime_float();
    $xml .= "<generationtime>" . round($end - $start, 3) . "</generationtime>";
    $xml .= "</cdash>";
    return $xml;
}
예제 #4
0
파일: login.php 프로젝트: rpshaw/CDash
/** Login Form function */
function LoginForm($loginerror)
{
    include "cdash/config.php";
    require_once "cdash/pdo.php";
    include_once "cdash/common.php";
    include "cdash/version.php";
    $xml = begin_XML_for_XSLT();
    $xml .= "<title>Login</title>";
    if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) {
        $xml .= add_XML_value("noregister", "1");
    }
    if (@$_GET['note'] == "register") {
        $xml .= "<message>Registration Complete. Please login with your email and password.</message>";
    }
    if ($loginerror != "") {
        $xml .= "<message>" . $loginerror . "</message>";
    }
    if ($CDASH_ALLOW_LOGIN_COOKIE) {
        $xml .= "<allowlogincookie>1</allowlogincookie>";
    }
    if ($GOOGLE_CLIENT_ID != '' && $GOOGLE_CLIENT_SECRET != '') {
        $xml .= "<oauth2>";
        $xml .= add_XML_value("client", $GOOGLE_CLIENT_ID);
        $xml .= "</oauth2>";
    }
    $xml .= "</cdash>";
    if (!isset($NoXSLGenerate)) {
        generate_XSLT($xml, "login");
    }
}
예제 #5
0
파일: register.php 프로젝트: kitware/cdash
/** Login Form function */
function RegisterForm($regerror)
{
    include dirname(__DIR__) . '/config/config.php';
    require_once 'include/pdo.php';
    include_once 'include/common.php';
    if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) {
        die("You cannot access this page. Contact your administrator if you think that's an error.");
    }
    $xml = begin_XML_for_XSLT();
    $xml .= '<title>CDash - Registration</title>';
    $xml .= '<error>' . $regerror . '</error>';
    if (isset($_GET['firstname'])) {
        $xml .= '<firstname>' . $_GET['firstname'] . '</firstname>';
    } else {
        $xml .= '<firstname></firstname>';
    }
    if (isset($_GET['lastname'])) {
        $xml .= '<lastname>' . $_GET['lastname'] . '</lastname>';
    } else {
        $xml .= '<lastname></lastname>';
    }
    if (isset($_GET['email'])) {
        $xml .= '<email>' . $_GET['email'] . '</email>';
    } else {
        $xml .= '<email></email>';
    }
    $xml .= '</cdash>';
    generate_XSLT($xml, 'register');
}
예제 #6
0
파일: register.php 프로젝트: rpshaw/CDash
/** Login Form function */
function RegisterForm($regerror)
{
    include "cdash/config.php";
    require_once "cdash/pdo.php";
    include_once "cdash/common.php";
    if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) {
        die("You cannot access this page. Contact your administrator if you think that's an error.");
    }
    $xml = begin_XML_for_XSLT();
    $xml .= "<title>CDash - Registration</title>";
    $xml .= "<error>" . $regerror . "</error>";
    if (isset($_GET["firstname"])) {
        $xml .= "<firstname>" . $_GET["firstname"] . "</firstname>";
    } else {
        $xml .= "<firstname></firstname>";
    }
    if (isset($_GET["lastname"])) {
        $xml .= "<lastname>" . $_GET["lastname"] . "</lastname>";
    } else {
        $xml .= "<lastname></lastname>";
    }
    if (isset($_GET["email"])) {
        $xml .= "<email>" . $_GET["email"] . "</email>";
    } else {
        $xml .= "<email></email>";
    }
    $xml .= "</cdash>";
    generate_XSLT($xml, "register");
}