• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_project_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_project_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_project_id函数的具体用法?PHP get_project_id怎么用?PHP get_project_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_project_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testDeleteDailyUpdate

 function testDeleteDailyUpdate()
 {
     //double check that it's the testing database before doing anything hasty...
     if ($this->databaseName !== "cdash4simpletest") {
         $this->fail("can only test on a database named 'cdash4simpletest'");
         return 1;
     }
     //remove the daily update entry for some projects so that subsequent tests
     //will cover dailyupdate.php more thoroughly
     $cvsID = get_project_id("InsightExample");
     if (!($query = pdo_query("DELETE FROM dailyupdate WHERE projectid='{$cvsID}'"))) {
         $this->fail("pdo_query returned false");
         return 1;
     }
     $svnID = get_project_id("EmailProjectExample");
     if (!($query = pdo_query("DELETE FROM dailyupdate WHERE projectid='{$svnID}'"))) {
         $this->fail("pdo_query returned false");
         return 1;
     }
     $gitID = get_project_id("PublicDashboard");
     if (!($query = pdo_query("DELETE FROM dailyupdate WHERE projectid='{$gitID}'"))) {
         $this->fail("pdo_query returned false");
         return 1;
     }
     $this->pass("Passed");
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:26,代码来源:test_deletedailyupdate.php


示例2: CoveragePerDirectory

 /** Return the coverage per directory with the number of lines
  * covered and not covered */
 private function CoveragePerDirectory()
 {
     include_once '../cdash/common.php';
     if (!isset($this->Parameters['project'])) {
         echo "Project not set";
         return;
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         echo "Project not found";
         return;
     }
     // Select the last build that has coverage from the project
     $query = pdo_query("SELECT buildid FROM coveragesummary,build WHERE build.id=coveragesummary.buildid\n                              AND build.projectid='{$projectid}' ORDER BY buildid DESC LIMIT 1");
     echo pdo_error();
     if (pdo_num_rows($query) == 0) {
         echo "No coverage entries found for this project";
         return;
     }
     $query_array = pdo_fetch_array($query);
     $buildid = $query_array['buildid'];
     // Find the coverage files
     $query = pdo_query("SELECT cf.fullpath,c.loctested,c.locuntested FROM coverage as c,coveragefile as cf\n                 WHERE c.fileid=cf.id AND c.buildid='" . $buildid . "' ORDER BY cf.fullpath ASC");
     echo pdo_error();
     $coveragearray = array();
     while ($query_array = pdo_fetch_array($query)) {
         $fullpath = $query_array['fullpath'];
         $paths = explode('/', $fullpath);
         $current = array();
         for ($i = 1; $i < count($paths) - 1; $i++) {
             if ($i == 1) {
                 if (!isset($coveragearray[$paths[$i]])) {
                     $coveragearray[$paths[$i]] = array();
                 }
                 $current =& $coveragearray[$paths[$i]];
             } else {
                 if ($i == count($paths) - 2) {
                     if (isset($current[$paths[$i]])) {
                         $v = $current[$paths[$i]]['locuntested'];
                         $current[$paths[$i]]['locuntested'] = (int) $v + $query_array['locuntested'];
                         $v = $current[$paths[$i]]['loctested'];
                         $current[$paths[$i]]['loctested'] = (int) $v + $query_array['loctested'];
                     } else {
                         @($current[$paths[$i]]['locuntested'] = $query_array['locuntested']);
                         @($current[$paths[$i]]['loctested'] = $query_array['loctested']);
                     }
                     unset($current);
                 } else {
                     $current[$paths[$i]] = array();
                     $current[$paths[$i]]['locuntested'] = 0;
                     $current[$paths[$i]]['loctested'] = 0;
                     $current =& $current[$paths[$i]];
                 }
             }
         }
     }
     return $coveragearray;
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:60,代码来源:api_coverage.php


示例3: ListDefects

 /** List Defects */
 private function ListDefects()
 {
     include_once 'cdash/common.php';
     if (!isset($this->Parameters['project'])) {
         echo "Project not set";
         return;
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         echo "Project not found";
         return;
     }
     // We need multiple queries (4 to be exact)
     // First for the build failures
     $users = array();
     $query = pdo_query("SELECT SUM(errors) AS nerrors,SUM(nfiles) AS nfiles,author FROM(\n            SELECT b.id,bed.difference_positive AS errors,u.author,\n            COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n            FROM build2group AS b2g, buildgroup AS bg,updatefile AS u,build2update AS b2u, builderrordiff AS bed, build AS b\n            WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n            AND bed.buildid=b.id AND bed.difference_positive>0 AND bed.difference_negative!=bed.difference_positive\n            AND b.starttime<NOW()\n            GROUP BY b.id,bed.difference_positive,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['builderrors'] = $query_array['nerrors'];
         $users[$query_array['author']]['builderrorsfiles'] = $query_array['nfiles'];
     }
     // Then for the build fixes
     $query = pdo_query("SELECT SUM(fixes) AS nfixes,SUM(nfiles) AS nfiles,author FROM(\n            SELECT b.id,bed.difference_positive AS errors,bed.difference_negative AS fixes,u.author,\n            COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n            FROM build2group AS b2g, buildgroup AS bg,updatefile AS u,build2update AS b2u, builderrordiff AS bed, build AS b\n            WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n            AND bed.buildid=b.id AND bed.difference_negative>0 AND bed.difference_positive<bed.difference_negative\n            AND b.starttime<NOW()\n            GROUP BY b.id,bed.difference_positive,bed.difference_negative,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['buildfixes'] = $query_array['nfixes'];
         $users[$query_array['author']]['buildfixesfiles'] = $query_array['nfiles'];
     }
     // Then for the test failures
     $query = pdo_query("SELECT SUM(testerrors) AS ntesterrors,SUM(nfiles) AS nfiles,author FROM(SELECT b.id, td.difference_positive AS testerrors,\n              u.author,COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n              FROM build2group AS b2g, buildgroup AS bg,updatefile AS u, build2update AS b2u, build AS b, testdiff AS td\n              WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n              AND td.buildid=b.id AND td.difference_positive>0 AND td.type=1\n              AND b.starttime<NOW()\n              GROUP BY b.id,td.difference_positive,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['testerrors'] = $query_array['ntesterrors'];
         $users[$query_array['author']]['testerrorsfiles'] = $query_array['nfiles'];
     }
     // Then for the test fixes
     $query = pdo_query("SELECT SUM(testfixes) AS ntestfixes,SUM(nfiles) AS nfiles,author FROM(SELECT b.id, td.difference_positive AS testfixes,\n              u.author,COUNT(u.author) AS nfiles, COUNT(DISTINCT u.author) AS dauthor\n              FROM build2group AS b2g, buildgroup AS bg,updatefile AS u, build2update AS b2u, build AS b, testdiff AS td\n              WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n              AND td.buildid=b.id AND td.difference_positive>0 AND td.type=2 AND td.difference_negative=0\n              AND b.starttime<NOW()\n              GROUP BY b.id,td.difference_positive,u.author HAVING COUNT(DISTINCT u.author)=1) AS q GROUP BY author");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['testfixes'] = $query_array['ntestfixes'];
         $users[$query_array['author']]['testfixesfiles'] = $query_array['nfiles'];
     }
     // Another select for neutral
     $query = pdo_query("SELECT b.id, bed.difference_positive AS errors,\n          u.author AS author,count(*) AS nfiles\n         FROM build2group AS b2g, buildgroup AS bg,updatefile AS u, build2update AS b2u, build AS b\n         LEFT JOIN builderrordiff AS bed ON (bed.buildid=b.id AND difference_positive!=difference_negative)\n         LEFT JOIN testdiff AS t ON (t.buildid=b.id)\n         WHERE b.projectid=" . $projectid . " AND u.updateid=b2u.updateid AND b2u.buildid=b.id AND b2g.buildid=b.id AND b2g.groupid=bg.id AND bg.name!='Experimental'\n         AND bed.difference_positive IS NULL\n         AND t.difference_positive IS NULL\n         AND b.starttime<NOW() GROUP BY u.author,b.id,bed.difference_positive");
     echo pdo_error();
     while ($query_array = pdo_fetch_array($query)) {
         $users[$query_array['author']]['neutralfiles'] = $query_array['nfiles'];
     }
     return $users;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:51,代码来源:api_user.php


示例4: startElement

 /** startElement function */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     // Check that the project name matches
     if ($name == 'PROJECT') {
         if (get_project_id($attributes['NAME']) != $this->projectid) {
             add_log('Wrong project name: ' . $attributes['NAME'], 'ProjectHandler::startElement', LOG_ERR, $this->projectid);
             $this->ProjectNameMatches = false;
         }
     }
     if (!$this->ProjectNameMatches) {
         return;
     }
     if ($name == 'PROJECT') {
         $this->SubProjects = array();
         $this->Dependencies = array();
     } elseif ($name == 'SUBPROJECT') {
         $this->CurrentDependencies = array();
         $this->SubProject = new SubProject();
         $this->SubProject->SetProjectId($this->projectid);
         $this->SubProject->SetName($attributes['NAME']);
         if (array_key_exists('GROUP', $attributes)) {
             $this->SubProject->SetGroup($attributes['GROUP']);
         }
     } elseif ($name == 'DEPENDENCY') {
         // A DEPENDENCY is expected to be:
         //
         //  - another subproject that already exists
         //    (from a previous element in this submission)
         //
         $dependentProject = new SubProject();
         $dependentProject->SetName($attributes['NAME']);
         $dependentProject->SetProjectId($this->projectid);
         // The subproject's Id is automatically loaded once its name & projectid
         // are set.
         $this->CurrentDependencies[] = $dependentProject->GetId();
     } elseif ($name == 'EMAIL') {
         $this->Email = $attributes['ADDRESS'];
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:41,代码来源:project_handler.php


示例5: ListFiles

 /**
  * List all files for a given project
  * @param project the name of the project
  * @param key the web API key for that project
  * @param [match] regular expression that files must match
  * @param [mostrecent] include this if you only want the most recent match
  */
 function ListFiles()
 {
     include_once '../cdash/common.php';
     include_once '../models/project.php';
     global $CDASH_DOWNLOAD_RELATIVE_URL;
     if (!isset($this->Parameters['project'])) {
         return array('status' => false, 'message' => 'You must specify a project parameter.');
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         return array('status' => false, 'message' => 'Project not found.');
     }
     $Project = new Project();
     $Project->Id = $projectid;
     $files = $Project->GetUploadedFilesOrUrls();
     if (!$files) {
         return array('status' => false, 'message' => 'Error in Project::GetUploadedFilesOrUrls');
     }
     $filteredList = array();
     foreach ($files as $file) {
         if ($file['isurl']) {
             continue;
             // skip if filename is a URL
         }
         if (isset($this->Parameters['match']) && !preg_match('/' . $this->Parameters['match'] . '/', $file['filename'])) {
             continue;
             //skip if it doesn't match regex
         }
         $filteredList[] = array_merge($file, array('url' => $CDASH_DOWNLOAD_RELATIVE_URL . '/' . $file['sha1sum'] . '/' . $file['filename']));
         if (isset($this->Parameters['mostrecent'])) {
             break;
             //user requested only the most recent file
         }
     }
     return array('status' => true, 'files' => $filteredList);
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:43,代码来源:api_project.php


示例6: htmlspecialchars

<html>
  <head>
   <title>CDash-Groups Description</title>
   <meta name="robots" content="noindex,nofollow" />
   <link rel="StyleSheet" type="text/css" href="cdash/cssfile"/>
  </head>
<body>
<table border="0" cellpadding="3" cellspacing="1" bgcolor="#0000aa" width="100%">
   <tr>
    <th class="table-heading1"><a href="#" class="jqmClose">[close]</a></th>
    <th class="table-heading1">CDash Build Group Description</th>
   </tr>
   <?php 
$i = 0;
$project = htmlspecialchars(pdo_real_escape_string($_GET["project"]));
$projectid = get_project_id($project);
if ($projectid < 1) {
    ?>
</table>
<center><a href="#" class="jqmClose">Close</a></center>
<?php 
    return;
}
$group = pdo_query("SELECT buildgroup.name,buildgroup.description\n                          FROM buildgroup,buildgroupposition \n                          WHERE buildgroup.projectid='{$projectid}' \n                          AND buildgroup.id = buildgroupposition.buildgroupid\n                          AND buildgroup.endtime = '1980-01-01 00:00:00'\n                          AND buildgroupposition.endtime = '1980-01-01 00:00:00'\n                          ORDER BY buildgroupposition.position ASC");
while ($group_array = pdo_fetch_array($group)) {
    ?>
 
    <tr class="<?php 
    if ($i % 2 == 0) {
        echo "treven";
    } else {
开发者ID:rpshaw,项目名称:CDash,代码行数:31,代码来源:groupsDescription.php


示例7: pdo_connect

include 'public/login.php';
include_once 'include/common.php';
include 'include/version.php';
require_once 'models/project.php';
require_once 'models/subproject.php';
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
pdo_select_db("{$CDASH_DB_NAME}", $db);
@($projectname = $_GET['project']);
if ($projectname != null) {
    $projectname = htmlspecialchars(pdo_real_escape_string($projectname));
}
@($date = $_GET['date']);
if ($date != null) {
    $date = htmlspecialchars(pdo_real_escape_string($date));
}
$projectid = get_project_id($projectname);
if ($projectid == 0) {
    echo 'Invalid project';
    return;
}
$project = pdo_query("SELECT * FROM project WHERE id='{$projectid}'");
if (pdo_num_rows($project) > 0) {
    $project_array = pdo_fetch_array($project);
    $svnurl = make_cdash_url(htmlentities($project_array['cvsurl']));
    $homeurl = make_cdash_url(htmlentities($project_array['homeurl']));
    $bugurl = make_cdash_url(htmlentities($project_array['bugtrackerurl']));
    $googletracker = htmlentities($project_array['googletracker']);
    $docurl = make_cdash_url(htmlentities($project_array['documentationurl']));
    $projectpublic = $project_array['public'];
    $projectname = $project_array['name'];
} else {
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:viewSubProjectDependenciesGraph.php


示例8: glob

$files = glob($directory . '/*.xml');
$filelist = array();
foreach ($files as $file) {
    if (filemtime($file) > $lastcheck) {
        $filelist[] = $file;
    }
}
$i = 0;
$n = count($filelist);
foreach ($filelist as $filename) {
    ++$i;
    // split on path separator
    $pathParts = preg_split('_[\\\\/]_', $filename);
    // split on cdash separator "_"
    $cdashParts = explode('_', $pathParts[count($pathParts) - 1]);
    $projectid = get_project_id($cdashParts[0]);
    if ($projectid != -1) {
        $name = get_project_name($projectid);
        echo 'Project [' . $name . '] importing file (' . $i . '/' . $n . '): ' . $filename . "\n";
        ob_flush();
        flush();
        $handle = fopen($filename, 'r');
        ctest_parse($handle, $projectid);
        fclose($handle);
        unset($handle);
    } else {
        echo 'Project id not found - skipping file (' . $i . '/' . $n . '): ' . $filename . "\n";
        ob_flush();
        flush();
    }
}
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:importBuilds.php


示例9: get_dashboard_JSON

function get_dashboard_JSON($projectname, $date, &$response)
{
    include "cdash/config.php";
    require_once "cdash/pdo.php";
    $projectid = get_project_id($projectname);
    if ($projectid == -1) {
        return;
    }
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        echo "Error connecting to CDash database server<br>\n";
        exit(0);
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        echo "Error selecting CDash database<br>\n";
        exit(0);
    }
    $project = pdo_query("SELECT * FROM project WHERE id='{$projectid}'");
    if (pdo_num_rows($project) > 0) {
        $project_array = pdo_fetch_array($project);
    } else {
        $project_array = array();
        $project_array["cvsurl"] = "unknown";
        $project_array["bugtrackerurl"] = "unknown";
        $project_array["documentationurl"] = "unknown";
        $project_array["homeurl"] = "unknown";
        $project_array["googletracker"] = "unknown";
        $project_array["name"] = $projectname;
        $project_array["nightlytime"] = "00:00:00";
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array["nightlytime"]);
    $response['datetime'] = date("l, F d Y H:i:s", time());
    $response['date'] = $date;
    $response['unixtimestamp'] = $currentstarttime;
    $response['startdate'] = date("l, F d Y H:i:s", $currentstarttime);
    $response['svn'] = make_cdash_url(htmlentities($project_array["cvsurl"]));
    $response['bugtracker'] = make_cdash_url(htmlentities($project_array["bugtrackerurl"]));
    $response['googletracker'] = htmlentities($project_array["googletracker"]);
    $response['documentation'] = make_cdash_url(htmlentities($project_array["documentationurl"]));
    $response['projectid'] = $projectid;
    $response['projectname'] = $project_array["name"];
    $response['projectname_encoded'] = urlencode($project_array["name"]);
    $response['projectpublic'] = $project_array["public"];
    $response['previousdate'] = $previousdate;
    $response['nextdate'] = $nextdate;
    $response['logoid'] = getLogoID($projectid);
    if (empty($project_array["homeurl"])) {
        $response['home'] = "index.php?project=" . urlencode($project_array["name"]);
    } else {
        $response['home'] = make_cdash_url(htmlentities($project_array["homeurl"]));
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/models/proProject.php")) {
        include_once "local/models/proProject.php";
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $response['proedition'] = $pro->GetEdition(1);
    }
    $userid = 0;
    if (isset($_SESSION['cdash'])) {
        $userid = $_SESSION['cdash']['loginid'];
        // Is the user super administrator
        $userquery = pdo_query("SELECT admin FROM " . qid('user') . " WHERE id='{$userid}'");
        $user_array = pdo_fetch_array($userquery);
        $response['admin'] = $user_array[0];
        // Is the user administrator of the project
        $userquery = pdo_query("SELECT role FROM user2project WHERE userid=" . qnum($userid) . " AND projectid=" . qnum($projectid));
        $user_array = pdo_fetch_array($userquery);
        $response['projectrole'] = $user_array[0];
    }
    $response['userid'] = $userid;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:71,代码来源:common.php


示例10: ScheduleStatus

 /** Return the status of a scheduled build */
 private function ScheduleStatus()
 {
     include "cdash/config.php";
     include_once 'cdash/common.php';
     include_once "models/clientjobschedule.php";
     include_once "models/clientos.php";
     include_once "models/clientcmake.php";
     include_once "models/clientcompiler.php";
     include_once "models/clientlibrary.php";
     $status = array();
     $status['scheduled'] = 0;
     if (!isset($this->Parameters['project'])) {
         echo "Project name should be set";
         return;
     }
     $projectid = get_project_id($this->Parameters['project']);
     if (!is_numeric($projectid) || $projectid <= 0) {
         echo "Project not found";
         return;
     }
     $scheduleid = $this->Parameters['scheduleid'];
     if (!is_numeric($scheduleid) || $scheduleid <= 0) {
         echo "ScheduleId not set";
         return;
     }
     $clientJobSchedule = new ClientJobSchedule();
     $clientJobSchedule->Id = $scheduleid;
     $clientJobSchedule->ProjectId = $projectid;
     $status['status'] = $clientJobSchedule->GetStatus();
     switch ($status['status']) {
         case -1:
             $status['statusstring'] = "not found";
             break;
         case 0:
             $status['statusstring'] = "scheduled";
             break;
         case 2:
             $status['statusstring'] = "running";
             break;
         case 3:
             $status['statusstring'] = "finished";
             break;
         case 4:
             $status['statusstring'] = "aborted";
             break;
         case 5:
             $status['statusstring'] = "failed";
             break;
     }
     $status['scheduleid'] = $clientJobSchedule->Id;
     $status['builds'] = $clientJobSchedule->GetAssociatedBuilds();
     $status['scheduled'] = 0;
     if ($status['status'] > 0) {
         $status['scheduled'] = 1;
     }
     return $status;
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:58,代码来源:api_build.php


示例11: post_submit

/** Function to deal with the external tool mechanism */
function post_submit()
{
    include "models/buildfile.php";
    // We expect POST to contain the following values.
    $vars = array('project', 'build', 'stamp', 'site', 'track', 'type', 'starttime', 'endtime', 'datafilesmd5');
    foreach ($vars as $var) {
        if (!isset($_POST[$var]) || empty($_POST[$var])) {
            $response_array['status'] = 1;
            $response_array['description'] = 'Variable \'' . $var . '\' not set but required.';
            echo json_encode($response_array);
            return;
        }
    }
    $projectname = htmlspecialchars(pdo_real_escape_string($_POST['project']));
    $buildname = htmlspecialchars(pdo_real_escape_string($_POST['build']));
    $buildstamp = htmlspecialchars(pdo_real_escape_string($_POST['stamp']));
    $sitename = htmlspecialchars(pdo_real_escape_string($_POST['site']));
    $track = htmlspecialchars(pdo_real_escape_string($_POST['track']));
    $type = htmlspecialchars(pdo_real_escape_string($_POST['type']));
    $starttime = htmlspecialchars(pdo_real_escape_string($_POST['starttime']));
    $endtime = htmlspecialchars(pdo_real_escape_string($_POST['endtime']));
    // Check if we have the CDash@Home scheduleid
    $scheduleid = 0;
    if (isset($_POST["clientscheduleid"])) {
        $scheduleid = pdo_real_escape_numeric($_POST["clientscheduleid"]);
    }
    // Add the build
    $build = new Build();
    $build->ProjectId = get_project_id($projectname);
    $build->StartTime = gmdate(FMT_DATETIME, $starttime);
    $build->EndTime = gmdate(FMT_DATETIME, $endtime);
    $build->SubmitTime = gmdate(FMT_DATETIME);
    $build->Name = $buildname;
    $build->InsertErrors = false;
    // we have no idea if we have errors at this point
    $build->SetStamp($buildstamp);
    // Get the site id
    $site = new Site();
    $site->Name = $sitename;
    $site->Insert();
    $build->SiteId = $site->Id;
    // Make this an "append" build, so that it doesn't result in a separate row
    // from the rest of the "normal" submission.
    $build->Append = true;
    // TODO: Check the labels and generator and other optional
    if (isset($_POST["generator"])) {
        $build->Generator = htmlspecialchars(pdo_real_escape_string($_POST['generator']));
    }
    $subprojectname = "";
    if (isset($_POST["subproject"])) {
        $subprojectname = htmlspecialchars(pdo_real_escape_string($_POST['subproject']));
        $build->SetSubProject($subprojectname);
    }
    // Check if this build already exists.
    $buildid = $build->GetIdFromName($subprojectname);
    // If not, add a new one.
    if ($buildid === 0) {
        $buildid = add_build($build, $scheduleid);
    }
    // Returns the OK submission
    $response_array['status'] = 0;
    $response_array['buildid'] = $buildid;
    $buildfile = new BuildFile();
    // Check if the files exists
    foreach ($_POST['datafilesmd5'] as $md5) {
        $buildfile->md5 = $md5;
        $old_buildid = $buildfile->MD5Exists();
        if (!$old_buildid) {
            $response_array['datafilesmd5'][] = 0;
        } else {
            $response_array['datafilesmd5'][] = 1;
            // Associate this build file with the new build if it has been previously
            // uploaded.
            require_once "copy_build_data.php";
            copy_build_data($old_buildid, $buildid, $type);
        }
    }
    echo json_encode($response_array);
}
开发者ID:rpshaw,项目名称:CDash,代码行数:80,代码来源:do_submit.php


示例12: get_updates_xml_from_commits

function get_updates_xml_from_commits($projectname, $projectid, $dates, $commits)
{
    $xml = "<updates>\n";
    $xml .= "<timestamp>" . date(FMT_DATETIMETZ, $dates['nightly-0']) . "</timestamp>";
    // Get revision numbers for the current day and "the last time it ran before that..."
    // Only works if the LIMIT 2 query below returns exactly 2 records and the date from
    // the most recent record matches the current 'nightly-0' date... If those criteria
    // are not met, the revision strings will be empty and no revision information will
    // be displayed on the resulting web page.
    //
    $revision_current = '';
    $revision_prior = '';
    $qry = "SELECT date, revision FROM dailyupdate " . "WHERE projectid='{$projectid}' " . "  AND date <= '" . gmdate(FMT_DATE, $dates['nightly-0']) . "' " . "ORDER BY date DESC LIMIT 2";
    $rows = pdo_all_rows_query($qry);
    if (count($rows) == 2) {
        if ($rows[0]['date'] == gmdate(FMT_DATE, $dates['nightly-0'])) {
            $revision_current = $rows[0]['revision'];
            $revision_prior = $rows[1]['revision'];
        }
    }
    $xml .= add_XML_value("revision", $revision_current);
    $xml .= add_XML_value("priorrevision", $revision_prior);
    $xml .= add_XML_value("revisionurl", get_revision_url($projectid, $revision_current, $revision_prior));
    $xml .= add_XML_value("revisiondiff", get_revision_url($projectid, $revision_prior, ''));
    // no prior prior revision...
    $xml .= "<javascript>\n";
    // Args to dbAdd : "true" means directory, "false" means file
    //
    $xml .= "dbAdd(true, \"Updated files  (" . count($commits) . ")\", \"\", 0, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
    $previousdir = "";
    usort($commits, "sort_by_directory_file_time");
    $projecturl = get_project_property($projectname, "cvsurl");
    foreach ($commits as $commit) {
        $directory = $commit['directory'];
        if ($directory != $previousdir) {
            $xml .= "dbAdd(true, \"" . $directory . "\", \"\", 1, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
            $previousdir = $directory;
        }
        $filename = $commit['filename'];
        $revision = '';
        if ($commit['priorrevision'] != "-1") {
            $revision = $commit['revision'];
        }
        $time = gmdate(FMT_DATETIME, strtotime($commit['time']));
        $author = $commit['author'];
        // Only display email if the user is logged in
        if (isset($_SESSION['cdash'])) {
            if (isset($commit['email'])) {
                $email = $commit['email'];
            } else {
                $email = get_author_email($projectname, $author);
            }
        } else {
            // If the author is an email (git for instance) we remove everything after the @
            $posat = strpos($author, '@');
            if ($posat !== false) {
                $author = substr($author, 0, $posat);
            }
            $email = "";
        }
        $comment = $commit['comment'];
        $comment = str_replace("\n", " ", $comment);
        // Do this twice so that <something> ends up as
        // &amp;lt;something&amp;gt; because it gets sent to a
        // java script function not just displayed as html
        $comment = XMLStrFormat($comment);
        $comment = XMLStrFormat($comment);
        $diff_url = get_diff_url(get_project_id($projectname), $projecturl, $directory, $filename, $revision);
        $diff_url = XMLStrFormat($diff_url);
        $xml .= "dbAdd(false, \"" . $filename . "  Revision: " . $revision . "\",\"" . $diff_url . "\",2,\"\",\"1\",\"" . $author . "\",\"" . $email . "\",\"" . $comment . "\",\"" . $commit['bugurl'] . "\",\"" . $commit['bugid'] . "\",\"" . $commit['bugpos'] . "\")\n";
    }
    $xml .= "</javascript>\n";
    $xml .= "</updates>";
    return $xml;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:75,代码来源:viewChanges.php


示例13: startElement

 /** startElement function */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     // Check that the project name matches
     if ($name == 'PROJECT') {
         if (get_project_id($attributes['NAME']) != $this->projectid) {
             add_log("Wrong project name: " . $attributes['NAME'], "ProjectHandler::startElement", LOG_ERR, $this->projectid);
             $this->ProjectNameMatches = false;
         }
     }
     if (!$this->ProjectNameMatches) {
         return;
     }
     if ($name == 'PROJECT') {
         $this->SubProjects = array();
         $this->Dependencies = array();
     } else {
         if ($name == 'SUBPROJECT') {
             $this->SubProject = new SubProject();
             $this->SubProject->SetProjectId($this->projectid);
             $this->SubProject->SetName($attributes['NAME']);
             if (array_key_exists("GROUP", $attributes)) {
                 $this->SubProject->SetGroup($attributes['GROUP']);
             }
             $this->SubProject->Save();
             // Insert the label
             $Label = new Label();
             $Label->Text = $this->SubProject->GetName();
             $Label->Insert();
             $this->SubProjects[$this->SubProject->GetId()] = $this->SubProject;
             $this->Dependencies[$this->SubProject->GetId()] = array();
         } else {
             if ($name == 'DEPENDENCY') {
                 // A DEPENDENCY is expected to be:
                 //
                 //  - another subproject that already exists (from a previous element in
                 //      this submission)
                 //
                 $dependentProject = new SubProject();
                 $dependentProject->SetName($attributes['NAME']);
                 $dependentProject->SetProjectId($this->projectid);
                 // The subproject's Id is automatically loaded once its name & projectid
                 // are set.
                 $dependencyid = $dependentProject->GetId();
                 $added = false;
                 if ($dependencyid !== false && is_numeric($dependencyid)) {
                     if (array_key_exists($dependencyid, $this->SubProjects)) {
                         $this->Dependencies[$this->SubProject->GetId()][] = $dependencyid;
                         $added = true;
                     }
                 }
                 if (!$added) {
                     add_log("Project.xml DEPENDENCY of " . $this->SubProject->GetName() . " not mentioned earlier in file: " . $attributes['NAME'], "ProjectHandler:startElement", LOG_WARNING, $this->projectid);
                 }
             } else {
                 if ($name == 'EMAIL') {
                     $email = $attributes['ADDRESS'];
                     // Check if the user is in the database
                     $User = new User();
                     $posat = strpos($email, '@');
                     if ($posat !== false) {
                         $User->FirstName = substr($email, 0, $posat);
                         $User->LastName = substr($email, $posat + 1);
                     } else {
                         $User->FirstName = $email;
                         $User->LastName = $email;
                     }
                     $User->Email = $email;
                     $User->Password = md5($email);
                     $User->Admin = 0;
                     $userid = $User->GetIdFromEmail($email);
                     if (!$userid) {
                         $User->Save();
                         $userid = $User->Id;
                     }
                     // Insert into the UserProject
                     $UserProject = new UserProject();
                     $UserProject->EmailType = 3;
                     // any build
                     $UserProject->EmailCategory = 54;
                     // everything except warnings
                     $UserProject->UserId = $userid;
                     $UserProject->ProjectId = $this->projectid;
                     $UserProject->Save();
                     // Insert the labels for this user
                     $LabelEmail = new LabelEmail();
                     $LabelEmail->UserId = $userid;
                     $LabelEmail->ProjectId = $this->projectid;
                     $Label = new Label();
                     $Label->SetText($this->SubProject->GetName());
                     $labelid = $Label->GetIdFromText();
                     if (!empty($labelid)) {
                         $LabelEmail->LabelId = $labelid;
                         $LabelEmail->Insert();
                     }
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:rpshaw,项目名称:CDash,代码行数:101,代码来源:project_handler.php


示例14: display_warning

        exit;
    }
}
if (isset($_POST['confirmed'])) {
    if (!insert_project($_POST['project_name'], $_POST['ocp_id'])) {
        display_warning('Utworzenie projektu zakoñczone niepowodzeniem!');
        exit;
    }
    $orgs = str_replace("\r", '', $_POST['orgs']);
    $orgs = explode("\n", $orgs);
    $new_orgs = get_new_orgs($orgs);
    if (!insert_new_orgs($new_orgs)) {
        display_warning('Dodanie nowych organizacji zakoñczone niepowodzeniem!');
        exit;
    }
    if (!insert_orgs_into_project($orgs, get_project_id($_POST['project_name']))) {
        display_warning('Przypisanie organizacji do projektu zakoñczone niepowodzeniem!');
        exit;
    }
    display_warning('Stworzenie projektu ' . htmlspecialchars(stripslashes($_POST['project_name'])) . ' zakoñczone sukcesem!');
} else {
    $orgs = str_replace("\r", '', $_POST['orgs']);
    $orgs = explode("\n", $orgs);
    $orgs = array_map('trim', $orgs);
    $upper_orgs = array();
    foreach ($orgs as $o) {
        if (!empty($o)) {
            $upper_orgs[strtoupper($o)] = $o;
        }
    }
    $orgs = array_values($upper_orgs);
开发者ID:exviva,项目名称:flip,代码行数:31,代码来源:create_project.php


示例15: get_dashboard_JSON

function get_dashboard_JSON($projectname, $date, &$response)
{
    include 'config/config.php';
    require_once 'include/pdo.php';
    $projectid = get_project_id($projectname);
    if ($projectid == -1) {
        return;
    }
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        echo "Error connecting to CDash database server<br>\n";
        exit(0);
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        echo "Error selecting CDash database<br>\n";
        exit(0);
    }
    $project = pdo_query("SELECT * FROM project WHERE id='{$projectid}'");
    if (pdo_num_rows($project) > 0) {
        $project_array = pdo_fetch_array($project);
    } else {
        $project_array = array();
        $project_array['cvsurl'] = 'unknown';
        $project_array['bugtrackerurl'] = 'unknown';
        $project_array['documentationurl'] = 'unknown';
        $project_array['homeurl'] = 'unknown';
        $project_array['googletracker'] = 'unknown';
        $project_array['name'] = $projectname;
        $project_array['nightlytime'] = '00:00:00';
    }
    if (is_null($date)) {
        $date = date(FMT_DATE);
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']);
    $response['datetime'] = date('l, F d Y H:i:s', time());
    $response['date'] = $date;
    $response['unixtimestamp'] = $currentstarttime;
    $response['startdate'] = date('l, F d Y H:i:s', $currentstarttime);
    $response['vcs'] = make_cdash_url(htmlentities($project_array['cvsurl']));
    $response['bugtracker'] = make_cdash_url(htmlentities($project_array['bugtrackerurl']));
    $response['googletracker'] = htmlentities($project_array['googletracker']);
    $response['documentation'] = make_cdash_url(htmlentities($project_array['documentationurl']));
    $response['projectid'] = $projectid;
    $response['projectname'] = $project_array['name'];
    $response['projectname_encoded'] = urlencode($project_array['name']);
    $response['public'] = $project_array['public'];
    $response['previousdate'] = $previousdate;
    $response['nextdate'] = $nextdate;
    $response['logoid'] = getLogoID($projectid);
    if (empty($project_array['homeurl'])) {
        $response['home'] = 'index.php?project=' . urlencode($project_array['name']);
    } else {
        $response['home'] = make_cdash_url(htmlentities($project_array['homeurl']));
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/models/proProject.php')) {
        include_once 'local/models/proProject.php';
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $response['proedition'] = $pro->GetEdition(1);
    }
    $userid = 0;
    if (isset($_SESSION['cdash']) && isset($_SESSION['cdash']['loginid'])) {
        $userid = $_SESSION['cdash']['loginid'];
        // Is the user an administrator of this project?
        $row = pdo_single_row_query('SELECT role FROM user2project
            WHERE userid=' . qnum($userid) . ' AND
            projectid=' . qnum($projectid));
        $response['projectrole'] = $row[0];
        if ($response['projectrole'] > 1) {
            $response['user']['admin'] = 1;
        }
    }
    $response['userid'] = $userid;
}
开发者ID:kitware,项目名称:cdash,代码行数:74,代码来源:common.php



注:本文中的get_project_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_project_name函数代码示例发布时间:2022-05-15
下一篇:
PHP get_project_access函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap