$xml .= "<menu>"; $nightlytime = get_project_property($projectname, "nightlytime"); $xml .= add_XML_value("back", "index.php?project=" . urlencode($projectname) . "&date=" . get_dashboard_date_from_build_starttime($build_array["starttime"], $nightlytime)); $xml .= add_XML_value("noprevious", "1"); $xml .= add_XML_value("nonext", "1"); $xml .= "</menu>"; $xml .= "<user>"; $userid = $_SESSION['cdash']['loginid']; $user = pdo_query("SELECT admin FROM " . qid("user") . " WHERE id='{$userid}'"); $user_array = pdo_fetch_array($user); $xml .= add_XML_value("id", $userid); $xml .= add_XML_value("admin", $user_array["admin"]); $xml .= "</user>"; //get any measurements associated with this test $xml .= "<measurements>"; $query = "SELECT id,name,testpage,summarypage FROM measurement WHERE projectid='{$projectid}' ORDER BY name ASC"; $result = pdo_query($query); while ($row = pdo_fetch_array($result)) { $xml .= "<measurement>"; $xml .= add_XML_value("id", $row["id"]); $xml .= add_XML_value("name", $row["name"]); $xml .= add_XML_value("showT", $row["testpage"]); $xml .= add_XML_value("showS", $row["summarypage"]); $xml .= "</measurement>"; } $xml .= "</measurements>"; $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "manageMeasurements"); } // end if session
} if (count($tests) > 0) { natcasesort($tests); //now generate some XML $xml .= "<tests>\n"; $previousLetter = ""; $firstSection = TRUE; foreach ($tests as $testName) { $letter = strtolower(substr($testName, 0, 1)); if ($letter != $previousLetter) { if ($firstSection) { $xml .= "<section>\n"; $firstSection = FALSE; } else { $xml .= "</section>\n<section>"; } $xml .= add_XML_value("sectionName", $letter) . "\n"; $previousLetter = $letter; } $xml .= "<test>\n"; $xml .= add_XML_value("testName", $testName) . "\n"; $summaryLink = "testSummary.php?project={$projectid}&name={$testName}&date={$today}"; $xml .= add_XML_value("summaryLink", $summaryLink) . "\n"; $xml .= "</test>\n"; } $xml .= "</section>\n"; $xml .= "</tests>\n"; } } $xml .= "</cdash>"; generate_XSLT($xml, "testOverview");
$xml .= add_XML_value('description', stripslashes($siteinformation_array['description'])); $xml .= add_XML_value('processoris64bits', $siteinformation_array['processoris64bits']); $xml .= add_XML_value('processorvendor', $siteinformation_array['processorvendor']); $xml .= add_XML_value('processorvendorid', $siteinformation_array['processorvendorid']); $xml .= add_XML_value('processorfamilyid', $siteinformation_array['processorfamilyid']); $xml .= add_XML_value('processormodelid', $siteinformation_array['processormodelid']); $xml .= add_XML_value('processorcachesize', $siteinformation_array['processorcachesize']); $xml .= add_XML_value('numberlogicalcpus', $siteinformation_array['numberlogicalcpus']); $xml .= add_XML_value('numberphysicalcpus', $siteinformation_array['numberphysicalcpus']); $xml .= add_XML_value('totalvirtualmemory', $siteinformation_array['totalvirtualmemory']); $xml .= add_XML_value('totalphysicalmemory', $siteinformation_array['totalphysicalmemory']); $xml .= add_XML_value('logicalprocessorsperphysical', $siteinformation_array['logicalprocessorsperphysical']); $xml .= add_XML_value('processorclockfrequency', $siteinformation_array['processorclockfrequency']); $xml .= add_XML_value('ip', $site_array['ip']); $xml .= add_XML_value('latitude', $site_array['latitude']); $xml .= add_XML_value('longitude', $site_array['longitude']); $xml .= add_XML_value('outoforder', $site_array['outoforder']); $xml .= '</site>'; $user2site = pdo_query("SELECT su.userid FROM site2user AS su,user2project AS up\n WHERE su.userid=up.userid AND up.role>0 AND su.siteid='{$siteid}' and su.userid='{$userid}'"); echo pdo_error(); if (pdo_num_rows($user2site) == 0) { $xml .= add_XML_value('siteclaimed', '0'); } else { $xml .= add_XML_value('siteclaimed', '1'); } $xml .= '</user>'; } $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'editSite'); }
} } elseif (isset($_POST['makenormaluser'])) { if ($postuserid > 1) { $update_array = pdo_fetch_array(pdo_query('SELECT firstname,lastname FROM ' . qid('user') . " WHERE id='" . $postuserid . "'")); pdo_query('UPDATE ' . qid('user') . " SET admin=0 WHERE id='" . $postuserid . "'"); $xml .= '<warning>' . $update_array['firstname'] . ' ' . $update_array['lastname'] . ' is not administrator anymore.</warning>'; } else { $xml .= '<error>Administrator should remain admin.</error>'; } } elseif (isset($_POST['makeadmin'])) { $update_array = pdo_fetch_array(pdo_query('SELECT firstname,lastname FROM ' . qid('user') . " WHERE id='" . $postuserid . "'")); pdo_query('UPDATE ' . qid('user') . " SET admin=1 WHERE id='" . $postuserid . "'"); $xml .= '<warning>' . $update_array['firstname'] . ' ' . $update_array['lastname'] . ' is now an administrator.</warning>'; } elseif (isset($_POST['removeuser'])) { $user = new User(); $user->Id = $postuserid; $user->Fill(); $name = $user->GetName(); $user->Delete(); $xml .= "<warning>{$name} has been removed.</warning>"; } if (isset($_POST['search'])) { $xml .= '<search>' . $_POST['search'] . '</search>'; } if (isset($CDASH_FULL_EMAIL_WHEN_ADDING_USER) && $CDASH_FULL_EMAIL_WHEN_ADDING_USER == 1) { $xml .= add_XML_value('fullemail', '1'); } $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'manageUsers'); }
This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ include "cdash/config.php"; require_once "cdash/pdo.php"; include_once "cdash/common.php"; include_once "cdash/version.php"; require_once "cdash/cdashmail.php"; $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}"); pdo_select_db("{$CDASH_DB_NAME}", $db); $xml = begin_XML_for_XSLT(); $xml .= "<title>Recover password</title>"; if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) { $xml .= add_XML_value("noregister", "1"); } @($recover = $_POST["recover"]); if ($recover) { $email = pdo_real_escape_string($_POST["email"]); $emailResult = pdo_query("SELECT id FROM " . qid("user") . " where email='{$email}'"); add_last_sql_error("recoverPassword"); if (pdo_num_rows($emailResult) == 0) { $xml .= "<warning>This email is not registered.</warning>"; } else { // Create a new password $keychars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#\$%&"; $length = 10; // seed with microseconds function make_seed_recoverpass() {
$dynid = $dynamicanalysis_array["id"]; $defects = pdo_query("SELECT * FROM dynamicanalysisdefect WHERE dynamicanalysisid='{$dynid}'"); while ($defects_array = pdo_fetch_array($defects)) { // defects $defect_type = $defects_array["type"]; if (array_key_exists($defect_type, $defect_nice_names)) { $defect_type = $defect_nice_names[$defect_type]; } if (!in_array($defect_type, $defect_types)) { $defect_types[] = $defect_type; } $column = array_search($defect_type, $defect_types); $xml .= "<defect>"; $xml .= add_XML_value("column", $column); $xml .= add_XML_value("value", $defects_array["value"]); $xml .= "</defect>"; } $xml .= get_labels_xml_from_query_results("SELECT text FROM label, label2dynamicanalysis WHERE " . "label.id=label2dynamicanalysis.labelid AND " . "label2dynamicanalysis.dynamicanalysisid='{$dynid}' " . "ORDER BY text ASC"); $xml .= "</dynamicanalysis>"; } // explicitly list the defect types encountered here // so we can dynamically generate the header row foreach ($defect_types as $defect_type) { $xml .= "<defecttypes>"; $xml .= add_XML_value("type", $defect_type); $xml .= "</defecttypes>"; } $xml .= add_XML_value("numcolumns", sizeof($defect_types)); $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "viewDynamicAnalysis");
if (pdo_num_rows($project) > 0) { $project_array = pdo_fetch_array($project); $projectname = $project_array["name"]; } $Project->Id = $projectid; $role = $Project->GetUserRole($userid); } else { $projectname = 'Global'; } $xml = begin_XML_for_XSLT(); $xml .= "<title>Feed - " . $projectname . "</title>"; $xml .= get_cdash_dashboard_xml(get_project_name($projectid), $date); $sql = ''; if ($date) { $sql = "AND date>'" . $date . "'"; } // Get the errors $query = pdo_query("SELECT * FROM feed WHERE projectid=" . qnum($projectid) . " ORDER BY id DESC"); while ($query_array = pdo_fetch_array($query)) { $xml .= "<feeditem>"; $xml .= add_XML_value("date", $query_array["date"]); $xml .= add_XML_value("buildid", $query_array["buildid"]); $xml .= add_XML_value("type", $query_array["type"]); $xml .= add_XML_value("description", $query_array["description"]); $xml .= "</feeditem>"; } $xml .= add_XML_value("admin", $User->IsAdmin()); $xml .= add_XML_value("role", $role); $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "viewFeed");
$xml .= add_XML_value("buildtime", date("D, d M Y H:i:s T", strtotime($build_array["starttime"] . " UTC"))); $xml .= "</build>"; $xml .= "<updates>"; // Return the status $status_array = pdo_fetch_array(pdo_query("SELECT status,revision,priorrevision,path\n FROM buildupdate,build2update AS b2u WHERE buildupdate.id=b2u.updateid AND b2u.buildid='{$buildid}'")); if (strlen($status_array["status"]) > 0 && $status_array["status"] != "0") { $xml .= add_XML_value("status", $status_array["status"]); } else { $xml .= add_XML_value("status", ""); // empty status } $xml .= add_XML_value("revision", $status_array["revision"]); $xml .= add_XML_value("priorrevision", $status_array["priorrevision"]); $xml .= add_XML_value("path", $status_array["path"]); $xml .= add_XML_value("revisionurl", get_revision_url($projectid, $status_array["revision"], $status_array["priorrevision"])); $xml .= add_XML_value("revisiondiff", get_revision_url($projectid, $status_array["priorrevision"], '')); // no prior prior revision... $xml .= "<javascript>"; $updatedfiles = pdo_query("SELECT * FROM updatefile AS uf,build2update AS b2u WHERE uf.updateid=b2u.updateid AND b2u.buildid=" . $buildid . "\n ORDER BY REVERSE(RIGHT(REVERSE(filename),LOCATE('/',REVERSE(filename)))) "); function sort_array_by_directory($a, $b) { return $a > $b ? 1 : 0; } function sort_array_by_filename($a, $b) { // Extract directory $filenamea = $a['filename']; $filenameb = $b['filename']; return $filenamea > $filenameb ? 1 : 0; } $directoryarray = array();
/** 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; }
} $xml .= "</availableproject>"; } $Banner = new Banner(); $Banner->SetProjectId($projectid); // If submit has been pressed @($updateMessage = $_POST["updateMessage"]); if (isset($updateMessage)) { $Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST["message"]))); } /** We start generating the XML here */ // List the available project if ($projectid >= 0) { $xml .= "<project>"; $xml .= add_XML_value("id", $Project->Id); $xml .= add_XML_value("text", $Banner->GetText()); if ($projectid > 0) { $xml .= add_XML_value("name", $Project->GetName()); $xml .= add_XML_value("name_encoded", urlencode($Project->GetName())); } $xml .= add_XML_value("id", $Project->Id); $xml .= "</project>"; } $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "manageBanner"); } // end session OK ?>
$xml .= add_XML_value('id', $project_array['id']); $xml .= add_XML_value('name', $project_array['name']); if ($project_array['id'] == $projectid) { $xml .= add_XML_value('selected', '1'); } $xml .= '</availableproject>'; } $Banner = new Banner(); $Banner->SetProjectId($projectid); // If submit has been pressed @($updateMessage = $_POST['updateMessage']); if (isset($updateMessage)) { $Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST['message']))); } /* We start generating the XML here */ // List the available project if ($projectid >= 0) { $xml .= '<project>'; $xml .= add_XML_value('id', $Project->Id); $xml .= add_XML_value('text', $Banner->GetText()); if ($projectid > 0) { $xml .= add_XML_value('name', $Project->GetName()); $xml .= add_XML_value('name_encoded', urlencode($Project->GetName())); } $xml .= add_XML_value('id', $Project->Id); $xml .= '</project>'; } $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'manageBanner'); }
$xml .= "</sourcefile>"; } $xml .= "<sourcefile>"; $xml .= "<name>" . $build_array["sourcefile"] . "</name>"; $current_file = $build_array["sourcefile"]; } if ($build_array["type"] == 0) { $xml .= "<error>"; } else { $xml .= "<warning>"; } $xml .= "<line>" . $build_array["sourceline"] . "</line>"; $textarray = explode("\n", $build_array["text"]); foreach ($textarray as $text) { if (strlen($text) > 0) { $xml .= add_XML_value("text", $text); } } $xml .= "<sitename>" . $build_array["name"] . "</sitename>"; $xml .= "<buildname>" . $build_array["buildname"] . "</buildname>"; if ($build_array["type"] == 0) { $xml .= "</error>"; } else { $xml .= "</warning>"; } } if (pdo_num_rows($builds) > 0) { $xml .= "</sourcefile>"; } $xml .= "</cdash>"; generate_XSLT($xml, "buildOverview");
while ($projects_array = pdo_fetch_array($projects)) { $xml .= '<availableproject>'; $xml .= add_XML_value('id', $projects_array['id']); $xml .= add_XML_value('name', $projects_array['name']); if ($projects_array['id'] == $projectid) { $xml .= add_XML_value('selected', '1'); } $xml .= '</availableproject>'; } $xml .= '<dayFrom>' . $dayFrom . '</dayFrom>'; $xml .= '<monthFrom>' . $monthFrom . '</monthFrom>'; $xml .= '<yearFrom>' . $yearFrom . '</yearFrom>'; $xml .= '<dayTo>' . $dayTo . '</dayTo>'; $xml .= '<monthTo>' . $monthTo . '</monthTo>'; $xml .= '<yearTo>' . $yearTo . '</yearTo>'; @($submit = $_POST['Submit']); // Delete the builds if (isset($submit)) { $begin = $yearFrom . '-' . $monthFrom . '-' . $dayFrom . ' 00:00:00'; $end = $yearTo . '-' . $monthTo . '-' . $dayTo . ' 00:00:00'; $sql = 'SELECT id FROM build WHERE projectid=' . qnum($projectid) . " AND\n parentid IN (0, -1) AND starttime<='{$end}' AND starttime>='{$begin}'\n ORDER BY starttime ASC"; $build = pdo_query($sql); $builds = array(); while ($build_array = pdo_fetch_array($build)) { $builds[] = $build_array['id']; } remove_build($builds); $xml .= add_XML_value('alert', 'Removed ' . count($builds) . ' builds.'); } $xml .= '</cdash>'; generate_XSLT($xml, 'removeBuilds');
/** 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"); } }
$xml .= '<build>'; $build = pdo_query("SELECT * FROM build WHERE id='{$buildid}'"); $build_array = pdo_fetch_array($build); $siteid = $build_array['siteid']; $site_array = pdo_fetch_array(pdo_query("SELECT name FROM site WHERE id='{$siteid}'")); $xml .= add_XML_value('site', $site_array['name']); $xml .= add_XML_value('buildname', $build_array['name']); $xml .= add_XML_value('buildid', $build_array['id']); $xml .= add_XML_value('buildtime', $build_array['starttime']); $xml .= '</build>'; // Load coverage file. $coverageFile = new CoverageFile(); $coverageFile->Id = $fileid; $coverageFile->Load(); $xml .= '<coverage>'; $xml .= add_XML_value('fullpath', $coverageFile->FullPath); // Generating the html file $file_array = explode('<br>', $coverageFile->File); $i = 0; // Load the coverage info. $log = new CoverageFileLog(); $log->BuildId = $buildid; $log->FileId = $fileid; $log->Load(); // Detect if we have branch coverage or not. $hasBranchCoverage = false; if (!empty($log->Branches)) { $hasBranchCoverage = true; } foreach ($file_array as $line) { $linenumber = $i + 1;
$Project = new Project(); $Project->Id = $projectid; $subprojectids = $Project->GetSubProjects(); sort($subprojectids); $row = 0; foreach ($subprojectids as $subprojectid) { $xml .= '<subproject>'; $SubProject = new SubProject(); $SubProject->SetId($subprojectid); if ($row == 0) { $xml .= add_XML_value('bgcolor', '#EEEEEE'); $row = 1; } else { $xml .= add_XML_value('bgcolor', '#DDDDDD'); $row = 0; } $xml .= add_XML_value('name', $SubProject->GetName()); $xml .= add_XML_value('name_encoded', urlencode($SubProject->GetName())); $dependencies = $SubProject->GetDependencies($date); foreach ($subprojectids as $subprojectid2) { $xml .= '<dependency>'; if (in_array($subprojectid2, $dependencies) || $subprojectid == $subprojectid2) { $xml .= add_XML_value('id', $subprojectid); } $xml .= '</dependency>'; } $xml .= '</subproject>'; } $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'viewSubProjectDependencies');
' . qid('user') . '.firstname,' . qid('user') . '.lastname,' . qid('user') . '.id AS userid FROM build AS b, siteinformation AS si, site as s LEFT JOIN site2user ON (site2user.siteid=s.id) LEFT JOIN ' . qid('user') . ' ON (site2user.userid=' . qid('user') . ".id)\n WHERE s.id=b.siteid\n AND b.starttime<'{$end_UTCDate}' AND b.starttime>'{$beginning_UTCDate}'\n AND si.siteid=s.id\n AND b.projectid='{$projectid}' GROUP BY s.id,s.name,si.processorclockfrequency,\n si.description,\n si.numberphysicalcpus,s.ip,s.latitude,s.longitude," . qid('user') . '.firstname,' . qid('user') . '.lastname,' . qid('user') . '.id'); } else { $site = pdo_query('SELECT s.id,s.name,si.processorclockfrequency, si.description, si.numberphysicalcpus,s.ip,s.latitude,s.longitude, ' . qid('user') . '.firstname,' . qid('user') . '.lastname,' . qid('user') . '.id AS userid FROM build AS b, siteinformation AS si, site as s LEFT JOIN site2user ON (site2user.siteid=s.id) LEFT JOIN ' . qid('user') . ' ON (site2user.userid=' . qid('user') . ".id)\n WHERE s.id=b.siteid\n AND b.starttime<'{$end_UTCDate}' AND b.starttime>'{$beginning_UTCDate}'\n AND si.siteid=s.id\n AND b.projectid='{$projectid}' GROUP BY s.id"); } echo pdo_error(); while ($site_array = pdo_fetch_array($site)) { $xml .= '<site>'; $xml .= add_XML_value('name', $site_array['name']); $xml .= add_XML_value('id', $site_array['id']); $xml .= add_XML_value('description', $site_array['description']); $xml .= add_XML_value('processor_speed', getByteValueWithExtension($site_array['processorclockfrequency'] * 1024 * 1024)); $xml .= add_XML_value('numberphysicalcpus', $site_array['numberphysicalcpus']); $xml .= add_XML_value('latitude', $site_array['latitude']); $xml .= add_XML_value('longitude', $site_array['longitude']); $xml .= add_XML_value('longitude', $site_array['longitude']); $xml .= add_XML_value('maintainer_name', $site_array['firstname'] . ' ' . $site_array['lastname']); $xml .= add_XML_value('maintainer_id', $site_array['userid']); $xml .= '</site>'; } $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'viewMap');
/** 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'); } }
function begin_XML_for_XSLT() { global $CDASH_CSS_FILE, $CDASH_VERSION; // check if user has specified a preference for color scheme if (array_key_exists("colorblind", $_COOKIE)) { if ($_COOKIE["colorblind"] == 1) { $CDASH_CSS_FILE = "colorblind.css"; } else { $CDASH_CSS_FILE = "cdash.css"; } } $xml = '<?xml version="1.0" encoding="utf-8"?><cdash>'; $xml .= add_XML_value("cssfile", $CDASH_CSS_FILE); $xml .= add_XML_value("version", $CDASH_VERSION); return $xml; }
/** Report statistics about the last build */ function ReportLastBuild($type, $projectid, $siteid, $projectname, $nightlytime) { $xml = "<" . strtolower($type) . ">"; $nightlytime = strtotime($nightlytime); // Find the last build $build = pdo_query("SELECT starttime,id FROM build WHERE siteid='{$siteid}' AND projectid='{$projectid}' AND type='{$type}' ORDER BY submittime DESC LIMIT 1"); if (pdo_num_rows($build) > 0) { $build_array = pdo_fetch_array($build); $buildid = $build_array["id"]; // Express the date in terms of days (makes more sens) $buildtime = strtotime($build_array["starttime"] . " UTC"); $builddate = $buildtime; if (date(FMT_TIME, $buildtime) > date(FMT_TIME, $nightlytime)) { $builddate += 3600 * 24; //next day } if (date(FMT_TIME, $nightlytime) < '12:00:00') { $builddate -= 3600 * 24; // previous date } $date = date(FMT_DATE, $builddate); $days = (time() - strtotime($date)) / (3600 * 24); if ($days < 1) { $day = "today"; } else { if ($days > 1 && $days < 2) { $day = "yesterday"; } else { $day = round($days) . " days"; } } $xml .= add_XML_value("date", $day); $xml .= add_XML_value("datelink", "index.php?project=" . urlencode($projectname) . "&date=" . $date); // Configure $configure = pdo_query("SELECT status FROM configure WHERE buildid='{$buildid}'"); if (pdo_num_rows($configure) > 0) { $configure_array = pdo_fetch_array($configure); $xml .= add_XML_value("configure", $configure_array["status"]); if ($configure_array["status"] != 0) { $xml .= add_XML_value("configureclass", "error"); } else { $xml .= add_XML_value("configureclass", "normal"); } } else { $xml .= add_XML_value("configure", "-"); $xml .= add_XML_value("configureclass", "normal"); } // Update $update = pdo_query("SELECT uf.updateid FROM updatefile AS uf,build2update AS b2u WHERE uf.updateid=b2u.updateid AND b2u.buildid=" . $buildid); $nupdates = pdo_num_rows($update); $xml .= add_XML_value("update", $nupdates); // Find locally modified files $updatelocal = pdo_query("SELECT uf.updateid FROM updatefile AS uf,build2update AS b2u WHERE uf.updateid=b2u.updateid AND b2u.buildid=" . $buildid . " AND uf.author='Local User'"); // Set the color if (pdo_num_rows($updatelocal) > 0) { $xml .= add_XML_value("updateclass", "error"); } else { $xml .= add_XML_value("updateclass", "normal"); } // Find the number of errors and warnings $Build = new Build(); $Build->Id = $buildid; $nerrors = $Build->GetNumberOfErrors(); $xml .= add_XML_value("error", $nerrors); $nwarnings = $Build->GetNumberOfWarnings(); $xml .= add_XML_value("warning", $nwarnings); // Set the color if ($nerrors > 0) { $xml .= add_XML_value("errorclass", "error"); } else { if ($nwarnings > 0) { $xml .= add_XML_value("errorclass", "warning"); } else { $xml .= add_XML_value("errorclass", "normal"); } } // Find the test $nnotrun = $Build->GetNumberOfNotRunTests(); $nfail = $Build->GetNumberOfFailedTests(); // Display the failing tests then the not run if ($nfail > 0) { $xml .= add_XML_value("testfail", $nfail); $xml .= add_XML_value("testfailclass", "error"); } else { if ($nnotrun > 0) { $xml .= add_XML_value("testfail", $nnotrun); $xml .= add_XML_value("testfailclass", "warning"); } else { $xml .= add_XML_value("testfail", "0"); $xml .= add_XML_value("testfailclass", "normal"); } } $xml .= add_XML_value("NA", "0"); } else { $xml .= add_XML_value("NA", "1"); } $xml .= "</" . strtolower($type) . ">"; return $xml; }
$xml .= add_XML_value("testDetailsLink", $testDetailsLink); switch ($row["status"]) { case "passed": $xml .= add_XML_value("status", "Passed"); $xml .= add_XML_value("statusclass", "normal"); break; case "failed": $xml .= add_XML_value("status", "Failed"); $xml .= add_XML_value("statusclass", "error"); break; case "notrun": $xml .= add_XML_value("status", "Not Run"); $xml .= add_XML_value("statusclass", "warning"); break; } if ($project['showtesttime']) { if ($row["timestatus"] < $project['testtimemaxstatus']) { $xml .= add_XML_value("timestatus", "Passed"); $xml .= add_XML_value("timestatusclass", "normal"); } else { $xml .= add_XML_value("timestatus", "Failed"); $xml .= add_XML_value("timestatusclass", "error"); } } $xml .= "</build>\n"; } $xml .= "</builds>\n"; $end = microtime_float(); $xml .= "<generationtime>" . round($end - $start, 3) . "</generationtime>"; $xml .= "</cdash>\n"; generate_XSLT($xml, "queryTests");
$xml .= get_cdash_dashboard_xml_by_name($projectname, $date); // Build $xml .= "<build>"; $build = pdo_query("SELECT * FROM build WHERE id='{$buildid}'"); $build_array = pdo_fetch_array($build); $siteid = $build_array["siteid"]; $site_array = pdo_fetch_array(pdo_query("SELECT name FROM site WHERE id='{$siteid}'")); $xml .= add_XML_value("site", $site_array["name"]); $xml .= add_XML_value("buildname", $build_array["name"]); $xml .= add_XML_value("buildid", $build_array["id"]); $xml .= add_XML_value("buildtime", $build_array["starttime"]); $xml .= "</build>"; // coverage $coveragefile_array = pdo_fetch_array(pdo_query("SELECT fullpath,file FROM coveragefile WHERE id='{$fileid}'")); $xml .= "<coverage>"; $xml .= add_XML_value("fullpath", $coveragefile_array["fullpath"]); if ($CDASH_USE_COMPRESSION) { if ($CDASH_DB_TYPE == "pgsql") { if (is_resource($coveragefile_array["file"])) { $file = base64_decode(stream_get_contents($coveragefile_array["file"])); } else { $file = base64_decode($coveragefile_array["file"]); } } else { $file = $coveragefile_array["file"]; } @($uncompressedrow = gzuncompress($file)); if ($uncompressedrow !== false) { $file = $uncompressedrow; } } else {
<projectname>' . $projectname . '</projectname> <projectname_encoded>' . urlencode($projectname) . '</projectname_encoded> <previousdate>' . $previousdate . '</previousdate> <projectpublic>' . $projectpublic . '</projectpublic> <nextdate>' . $nextdate . '</nextdate>'; if (empty($project_array['homeurl'])) { $xml .= '<home>index.php?project=' . urlencode($projectname) . '</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 (!isset($date) || strlen($date) < 8 || date(FMT_DATE, $currentstarttime) == date(FMT_DATE)) { $xml .= add_XML_value('nonext', '1'); } $xml .= '</menu>'; $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'viewSubProjectDependenciesGraph');
$ncoveragefiles[5]++; // satisfactory } else { $ncoveragefiles[4]++; // medium } $ncoveragefiles[7]++; // all } // Show the number of files covered by status $xml .= '<coveragefilestatus>'; $xml .= add_XML_value('directories', $ncoveragefiles[0]); $xml .= add_XML_value('no', $ncoveragefiles[1]); $xml .= add_XML_value('zero', $ncoveragefiles[2]); $xml .= add_XML_value('low', $ncoveragefiles[3]); $xml .= add_XML_value('medium', $ncoveragefiles[4]); $xml .= add_XML_value('satisfactory', $ncoveragefiles[5]); $xml .= add_XML_value('complete', $ncoveragefiles[6]); $xml .= add_XML_value('all', $ncoveragefiles[7]); $xml .= '</coveragefilestatus>'; // Filters: // // On this page, we don't need the 'sql' or its friend 'limit' from // the filterdata, since the actual sql query is deferred until // ajax/getviewcoverage.php (called by cdashViewCoverage.js). // $filterdata = get_filterdata_from_request(); $xml .= $filterdata['xml']; $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'viewCoverage');
$nextbuildid = get_next_buildid($projectid, $siteid, $buildtype, $buildname, $starttime); if ($nextbuildid > 0) { $xml .= add_XML_value("next", "viewNotes.php?buildid=" . $nextbuildid); } else { $xml .= add_XML_value("nonext", "1"); } $xml .= "</menu>"; // Build $xml .= "<build>"; $site_array = pdo_fetch_array(pdo_query("SELECT name FROM site WHERE id='{$siteid}'")); $xml .= add_XML_value("site", $site_array["name"]); $xml .= add_XML_value("siteid", $siteid); $xml .= add_XML_value("buildname", $buildname); $xml .= add_XML_value("buildid", $buildid); $xml .= add_XML_value("stamp", $build_array["stamp"]); $xml .= "</build>"; $build2note = pdo_query("SELECT noteid,time FROM build2note WHERE buildid='{$buildid}'"); while ($build2note_array = pdo_fetch_array($build2note)) { $noteid = $build2note_array["noteid"]; $note_array = pdo_fetch_array(pdo_query("SELECT * FROM note WHERE id='{$noteid}'")); $xml .= "<note>"; $xml .= add_XML_value("name", $note_array["name"]); $xml .= add_XML_value("text", $note_array["text"]); $xml .= add_XML_value("time", $build2note_array["time"]); $xml .= "</note>"; $text = $note_array["text"]; $name = $note_array["name"]; } $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "viewNotes");
$xml .= "<title>CDash - SubProject dependencies Graph - " . $projectname . "</title>"; list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array["nightlytime"]); $logoid = getLogoID($projectid); // 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>" . $logoid . "</logoid>\n <projectid>" . $projectid . "</projectid>\n <projectname>" . $projectname . "</projectname>\n <projectname_encoded>" . urlencode($projectname) . "</projectname_encoded>\n <previousdate>" . $previousdate . "</previousdate>\n <projectpublic>" . $projectpublic . "</projectpublic>\n <nextdate>" . $nextdate . "</nextdate>"; if (empty($project_array["homeurl"])) { $xml .= "<home>index.php?project=" . urlencode($projectname) . "</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 (!isset($date) || strlen($date) < 8 || date(FMT_DATE, $currentstarttime) == date(FMT_DATE)) { $xml .= add_XML_value("nonext", "1"); } $xml .= "</menu>"; $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "viewSubProjectDependenciesGraph");
} foreach ($labelids as $labelid) { $xml .= "<labelemail>"; $xml .= add_XML_value("id", $labelid); $Label->Id = $labelid; $xml .= add_XML_value("text", $Label->GetText()); $xml .= "</labelemail>"; } $xml .= "</project>"; $sql = "SELECT id,name FROM project"; if ($User->IsAdmin() == false) { $sql .= " WHERE public=1 OR id IN (SELECT projectid AS id FROM user2project WHERE userid='{$userid}' AND role>0)"; } $projects = pdo_query($sql); while ($project_array = pdo_fetch_array($projects)) { $xml .= "<availableproject>"; $xml .= add_XML_value("id", $project_array['id']); $xml .= add_XML_value("name", $project_array['name']); if ($project_array['id'] == $projectid) { $xml .= add_XML_value("selected", "1"); } $xml .= "</availableproject>"; } $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "subscribeProject"); } // end session OK ?>
pdo_query("INSERT INTO buildgroupposition(buildgroupid,position,starttime,endtime)\n VALUES ('{$id}','1','1980-01-01 00:00:00','1980-01-01 00:00:00')"); echo pdo_error(); pdo_query("INSERT INTO buildgroup(name,projectid,starttime,endtime,description)\n VALUES ('Continuous','{$projectid}','1980-01-01 00:00:00','1980-01-01 00:00:00','Continuous Builds')"); $id = pdo_insert_id("buildgroup"); pdo_query("INSERT INTO buildgroupposition(buildgroupid,position,starttime,endtime)\n VALUES ('{$id}','2','1980-01-01 00:00:00','1980-01-01 00:00:00')"); pdo_query("INSERT INTO buildgroup(name,projectid,starttime,endtime,description)\n VALUES ('Experimental','{$projectid}','1980-01-01 00:00:00','1980-01-01 00:00:00','Experimental Builds')"); $id = pdo_insert_id("buildgroup"); pdo_query("INSERT INTO buildgroupposition(buildgroupid,position,starttime,endtime)\n VALUES ('{$id}','3','1980-01-01 00:00:00','1980-01-01 00:00:00')"); $n++; } } $xml .= add_XML_value("alert", $n . " projects have now default groups."); } else { if ($AssignBuildToDefaultGroups) { // Loop throught the builds $builds = pdo_query("SELECT id,type,projectid FROM build WHERE id NOT IN (SELECT buildid as id FROM build2group)"); while ($build_array = pdo_fetch_array($builds)) { $buildid = $build_array["id"]; $buildtype = $build_array["type"]; $projectid = $build_array["projectid"]; $buildgroup_array = pdo_fetch_array(pdo_query("SELECT id FROM buildgroup WHERE name='{$buildtype}' AND projectid='{$projectid}'")); $groupid = $buildgroup_array["id"]; pdo_query("INSERT INTO build2group(buildid,groupid) VALUES ('{$buildid}','{$groupid}')"); } $xml .= add_XML_value("alert", "Builds have been added to default groups successfully."); } } // end AssignBuildToDefaultGroups $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "upgrade");
$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>'; } $status = $ClientJobSchedule->GetStatus(); switch ($status) { case CDASH_JOB_SCHEDULED: $statusText = "Scheduled"; break; case CDASH_JOB_RUNNING: $statusText = "Running"; break; case CDASH_JOB_FINISHED: $statusText = "Finished"; break; case CDASH_JOB_FAILED: $statusText = "Failed";
This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ include dirname(__DIR__) . '/config/config.php'; require_once 'include/pdo.php'; include_once 'include/common.php'; include_once 'include/version.php'; require_once 'include/cdashmail.php'; $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}"); pdo_select_db("{$CDASH_DB_NAME}", $db); $xml = begin_XML_for_XSLT(); $xml .= '<title>Recover password</title>'; if (isset($CDASH_NO_REGISTRATION) && $CDASH_NO_REGISTRATION == 1) { $xml .= add_XML_value('noregister', '1'); } @($recover = $_POST['recover']); if ($recover) { $email = pdo_real_escape_string($_POST['email']); $emailResult = pdo_query('SELECT id FROM ' . qid('user') . " where email='{$email}'"); add_last_sql_error('recoverPassword'); if (pdo_num_rows($emailResult) == 0) { // Don't reveal whether or not this is a valid account. $xml .= '<message>A confirmation message has been sent to your inbox.</message>'; } else { // Create a new password $keychars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&'; $length = 10; $password = ''; $max = strlen($keychars) - 1;