本文整理汇总了PHP中get_dates函数的典型用法代码示例。如果您正苦于以下问题:PHP get_dates函数的具体用法?PHP get_dates怎么用?PHP get_dates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_dates函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_graph
function generate_graph($channel)
{
$filename = make_db_filename($channel);
$dates = get_dates($filename);
$start_date = $dates['start']['date'];
$end_date = $dates['end']['date'];
$start = $dates['start_format'];
$end = $dates['end_format'];
return make_gnuplot_input($start_date, $end_date, $start, $end, $channel, $filename);
}
示例2: echo_main_dashboard_JSON
function echo_main_dashboard_JSON($project_instance, $date)
{
$start = microtime_float();
$noforcelogin = 1;
include_once dirname(dirname(dirname(__DIR__))) . '/config/config.php';
require_once 'include/pdo.php';
include 'public/login.php';
include_once 'models/banner.php';
include_once 'models/build.php';
include_once 'models/subproject.php';
$response = array();
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
if (!$db) {
$response['error'] = 'Error connecting to CDash database server';
echo json_encode($response);
return;
}
if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
$response['error'] = 'Error selecting CDash database';
echo json_encode($response);
return;
}
$projectid = $project_instance->Id;
$project = pdo_query("SELECT * FROM project WHERE id='{$projectid}'");
if (pdo_num_rows($project) > 0) {
$project_array = pdo_fetch_array($project);
$projectname = $project_array['name'];
if (isset($project_array['testingdataurl']) && $project_array['testingdataurl'] != '') {
$testingdataurl = make_cdash_url(htmlentities($project_array['testingdataurl']));
}
} else {
$response['error'] = "This project doesn't exist. Maybe the URL you are trying to access is wrong.";
echo json_encode($response);
return;
}
if (!checkUserPolicy(@$_SESSION['cdash']['loginid'], $project_array['id'], 1)) {
$response['requirelogin'] = 1;
echo json_encode($response);
return;
}
$response = begin_JSON_response();
$response['title'] = "CDash - {$projectname}";
$response['feed'] = $CDASH_ENABLE_FEED;
$response['showcalendar'] = 1;
$Banner = new Banner();
$Banner->SetProjectId(0);
$text = $Banner->GetText();
$banners = array();
if ($text !== false) {
$banners[] = $text;
}
$Banner->SetProjectId($projectid);
$text = $Banner->GetText();
if ($text !== false) {
$banners[] = $text;
}
$response['banners'] = $banners;
$site_response = array();
// If parentid is set we need to lookup the date for this build
// because it is not specified as a query string parameter.
if (isset($_GET['parentid'])) {
$parentid = pdo_real_escape_numeric($_GET['parentid']);
$parent_build = new Build();
$parent_build->Id = $parentid;
$date = $parent_build->GetDate();
$response['parentid'] = $parentid;
} else {
$response['parentid'] = -1;
}
list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']);
// Main dashboard section
get_dashboard_JSON($projectname, $date, $response);
$response['displaylabels'] = $project_array['displaylabels'];
$page_id = 'index.php';
$response['childview'] = 0;
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);
}
if ($currentstarttime > time() && !isset($_GET['parentid'])) {
$response['error'] = 'CDash cannot predict the future (yet)';
echo json_encode($response);
return;
}
// Menu definition
$response['menu'] = array();
$beginning_timestamp = $currentstarttime;
$end_timestamp = $currentstarttime + 3600 * 24;
$beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
$end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
if ($project_instance->GetNumberOfSubProjects($end_UTCDate) > 0) {
$response['menu']['subprojects'] = 1;
}
if (isset($_GET['parentid'])) {
$page_id = 'indexchildren.php';
$response['childview'] = 1;
// When a parentid is specified, we should link to the next build,
// not the next day.
//.........这里部分代码省略.........
示例3: pdo_fetch_array
echo "This project doesn't exist.";
exit;
}
$project_array = pdo_fetch_array($project);
$projectname = $project_array["name"];
$role = 0;
$user2project = pdo_query("SELECT role FROM user2project WHERE userid='{$userid}' AND projectid='{$projectid}'");
if (pdo_num_rows($user2project) > 0) {
$user2project_array = pdo_fetch_array($user2project);
$role = $user2project_array["role"];
}
if (!$project_array["showcoveragecode"] && $role < 2) {
echo "This project doesn't allow display of coverage code. Contact the administrator of the project.";
exit;
}
list($previousdate, $currenttime, $nextdate) = get_dates($date, $project_array["nightlytime"]);
$logoid = getLogoID($projectid);
$xml = begin_XML_for_XSLT();
$xml .= "<title>CDash : " . $projectname . "</title>";
$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>";
示例4: generate_subprojects_dashboard_XML
/** 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));
//.........这里部分代码省略.........
示例5: ComputeTestingDayBounds
public function ComputeTestingDayBounds()
{
if ($this->ProjectId < 1) {
return false;
}
if (isset($this->BeginningOfDay) && isset($this->EndOfDay)) {
return true;
}
$build_date = $this->GetDate();
list($previousdate, $currentstarttime, $nextdate) = get_dates($build_date, $this->NightlyStartTime);
$beginning_timestamp = $currentstarttime;
$end_timestamp = $currentstarttime + 3600 * 24;
$this->BeginningOfDay = gmdate(FMT_DATETIME, $beginning_timestamp);
$this->EndOfDay = gmdate(FMT_DATETIME, $end_timestamp);
return true;
}
示例6: second_try
function second_try($found, $post_title_param, $destination_title, $destination_dates)
{
echo "\nfound : [{$found}]";
echo "\npost_title : [{$post_title_param}]";
echo "\ndestination_title : [{$destination_title}]\n";
$post_titles = get_post_titles();
// $post_titles = array("\(Biodiversity\)"); //debug
$post_titles = array_diff($post_titles, array($post_title_param));
//exclude the $post_title_param
foreach ($post_titles as $post_title) {
$title = $destination_title . "_" . $post_title;
if ($wiki_path = get_wiki_text($title)) {
$title_dates = get_dates($wiki_path);
if ($destination_dates == $title_dates) {
//start saving...
$temp_write_file = $GLOBALS['doc_root'] . "/eoearth/Custom/temp/write.wiki";
$handle = fopen($temp_write_file, "w");
fwrite($handle, "#REDIRECT [[" . str_replace("\\", "", $found) . "]]");
fclose($handle);
echo "\n saving redirect on title: [{$title}]\n";
shell_exec("php " . $GLOBALS['doc_root'] . "/eoearth/maintenance/edit.php -m " . $title . " < {$temp_write_file}");
}
}
}
}
示例7: pdo_fetch_array
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 {
$projectname = 'NA';
}
checkUserPolicy(@$_SESSION['cdash']['loginid'], $project_array['id']);
$xml = begin_XML_for_XSLT();
$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>
<datetime>' . date('l, F d Y H:i:s T', time()) . '</datetime>
<date>' . $date . '</date>
<unixtimestamp>' . $currentstarttime . '</unixtimestamp>
<svn>' . $svnurl . '</svn>
<bugtracker>' . $bugurl . '</bugtracker>
<googletracker>' . $googletracker . '</googletracker>
<documentation>' . $docurl . '</documentation>
<logoid>' . $logoid . '</logoid>
<projectid>' . $projectid . '</projectid>
<projectname>' . $projectname . '</projectname>
<projectname_encoded>' . urlencode($projectname) . '</projectname_encoded>
<previousdate>' . $previousdate . '</previousdate>
示例8: sendsummaryemail
/** Send a summary email */
function sendsummaryemail($projectid, $groupid, $errors, $buildid)
{
include 'config/config.php';
require_once 'models/userproject.php';
require_once 'models/user.php';
require_once 'models/project.php';
require_once 'models/build.php';
require_once 'models/site.php';
$Project = new Project();
$Project->Id = $projectid;
$Project->Fill();
// Check if the email has been sent
$date = '';
// now
list($previousdate, $currentstarttime, $nextdate, $today) = get_dates($date, $Project->NightlyTime);
$dashboarddate = gmdate(FMT_DATE, $currentstarttime);
// If we already have it we return
if (pdo_num_rows(pdo_query("SELECT buildid FROM summaryemail WHERE date='{$dashboarddate}' AND groupid=" . qnum($groupid))) == 1) {
return;
}
// Update the summaryemail table to specify that we have send the email
// We also delete any previous rows from that groupid
pdo_query("DELETE FROM summaryemail WHERE groupid={$groupid}");
pdo_query("INSERT INTO summaryemail (buildid,date,groupid) VALUES ({$buildid},'{$dashboarddate}',{$groupid})");
add_last_sql_error('sendmail');
// If the trigger for SVN/CVS diff is not done yet we specify that the asynchronous trigger should
// send an email
$dailyupdatequery = pdo_query('SELECT status FROM dailyupdate WHERE projectid=' . qnum($projectid) . " AND date='{$dashboarddate}'");
add_last_sql_error('sendmail');
if (pdo_num_rows($dailyupdatequery) == 0) {
return;
}
$dailyupdate_array = pdo_fetch_array($dailyupdatequery);
$dailyupdate_status = $dailyupdate_array['status'];
if ($dailyupdate_status == 0) {
pdo_query("UPDATE dailyupdate SET status='2' WHERE projectid=" . qnum($projectid) . " AND date='{$dashboarddate}'");
return;
}
// Find the current updaters from the night using the dailyupdatefile table
$summaryEmail = '';
$query = 'SELECT ' . qid('user') . '.email,up.emailcategory,' . qid('user') . '.id
FROM ' . qid('user') . ',user2project AS up,user2repository AS ur,
dailyupdate,dailyupdatefile WHERE
up.projectid=' . qnum($projectid) . '
AND up.userid=' . qid('user') . '.id
AND ur.userid=up.userid
AND (ur.projectid=0 OR ur.projectid=' . qnum($projectid) . ")\n AND ur.credential=dailyupdatefile.author\n AND dailyupdatefile.dailyupdateid=dailyupdate.id\n AND dailyupdate.date='{$dashboarddate}'\n AND dailyupdate.projectid=" . qnum($projectid) . '
AND up.emailtype>0
';
$user = pdo_query($query);
add_last_sql_error('sendmail');
// Loop through the users and add them to the email array
while ($user_array = pdo_fetch_array($user)) {
// If the user is already in the list we quit
if (strpos($summaryEmail, $user_array['email']) !== false) {
continue;
}
// If the user doesn't want to receive email
if (!checkEmailPreferences($user_array['emailcategory'], $errors)) {
continue;
}
// Check if the labels are defined for this user
if (!checkEmailLabel($projectid, $user_array['id'], $buildid, $user_array['emailcategory'])) {
continue;
}
if ($summaryEmail != '') {
$summaryEmail .= ', ';
}
$summaryEmail .= $user_array['email'];
}
// Select the users that are part of this build
$authors = pdo_query('SELECT author FROM updatefile AS uf,build2update AS b2u
WHERE b2u.updateid=uf.updateid AND b2u.buildid=' . qnum($buildid));
add_last_sql_error('sendmail');
while ($authors_array = pdo_fetch_array($authors)) {
$author = $authors_array['author'];
if ($author == 'Local User') {
continue;
}
$UserProject = new UserProject();
$UserProject->RepositoryCredential = $author;
$UserProject->ProjectId = $projectid;
if (!$UserProject->FillFromRepositoryCredential()) {
continue;
}
// If the user doesn't want to receive email
if (!checkEmailPreferences($UserProject->EmailCategory, $errors)) {
continue;
}
// Check if the labels are defined for this user
if (!checkEmailLabel($projectid, $UserProject->UserId, $buildid, $UserProject->EmailCategory)) {
continue;
}
// Find the email
$User = new User();
$User->Id = $UserProject->UserId;
$useremail = $User->GetEmail();
// If the user is already in the list we quit
if (strpos($summaryEmail, $useremail) !== false) {
//.........这里部分代码省略.........
示例9: foreach
foreach ($assignments as $event) {
array_push($rows, $event);
}
}
$testsmod = $moduleFactory->getModule("_standard/tests");
$tests = $testsmod->extend_date();
if ($tests != "") {
foreach ($tests as $event) {
array_push($rows, $event);
}
}
}
if (isset($_SESSION['valid_user'])) {
if ($_SESSION['valid_user']) {
/* check if the user is enrolled in the course */
$sql = "SELECT COUNT(*) FROM\r\n\t\t\t\t `" . TABLE_PREFIX . "course_enrollment`\r\n\t\t\t\t\tWHERE `member_id`='" . $_SESSION['member_id'] . "'\r\n\t\t\t\t\tAND `course_id`='" . $_SESSION['course_id'] . "'";
$result = mysql_query($sql, $db);
$row = mysql_fetch_row($result);
if ($row[0] > 0) {
$dates = get_dates();
} else {
}
}
}
//Encode in JSON format.
$str = json_encode($rows);
//Replace "true","false" with true,false for javascript.
$str = str_replace('"true"', 'true', $str);
$str = str_replace('"false"', 'false', $str);
//Return the events in the JSON format.
echo $str;
示例10: array
$adviser = array();
$supervisor = array();
$course = array();
$not_enroled = array();
$enroled = array();
$study_mode = array();
$reason = array();
$addition_reason = array();
$deletion_reason = array();
$selects = template_selects($template->data);
foreach ($selects as $select) {
switch ($select) {
case 'start_dates':
if (empty($start_dates)) {
// Get an array of possible module start dates (6 months back and 12 months forward from today)
$start_dates = get_dates(date('m'), date('y'), 6, 12);
$start_selected = 6;
}
break;
case 'adviser':
if (empty($adviser)) {
$adviser = get_advisers($USER->id);
}
break;
case 'supervisor':
if (empty($supervisor)) {
$supervisor = get_supervisors($USER->id);
}
break;
case 'course':
if (empty($course)) {
示例11: Project
$Project = new Project();
$Project->Id = $projectid;
$Project->Fill();
// check if this project has subprojects.
$has_subprojects = $Project->GetNumberOfSubProjects() > 0;
// make sure the user has access to this project
checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid);
// connect to the database
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
pdo_select_db("{$CDASH_DB_NAME}", $db);
// handle optional date argument
@($date = $_GET["date"]);
if ($date != NULL) {
$date = htmlspecialchars(pdo_real_escape_string($date));
}
list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $Project->NightlyTime);
// Date range is currently hardcoded to two weeks in the past.
// This could become a configurable value instead.
$date_range = 14;
// begin .xml that is used to render this page
$xml = begin_XML_for_XSLT();
$xml .= get_cdash_dashboard_xml($projectname, $date);
$projectname = get_project_name($projectid);
$xml .= "<title>CDash Overview : " . $projectname . "</title>";
$xml .= get_cdash_dashboard_xml_by_name($projectname, $date);
$xml .= "<menu>";
$xml .= add_XML_value("previous", "overview.php?project={$projectname}&date={$previousdate}");
$xml .= add_XML_value("current", "overview.php?project={$projectname}");
$xml .= add_XML_value("next", "overview.phpv?project={$projectname}&date={$nextdate}");
$xml .= "</menu>";
$xml .= add_XML_value("hasSubProjects", $has_subprojects);
示例12: 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;
}
示例13: startElement
/** Start element */
public function startElement($parser, $name, $attributes)
{
parent::startElement($parser, $name, $attributes);
if ($this->UploadError) {
return;
}
if ($name == 'SITE') {
$this->Site->Name = $attributes['NAME'];
if (empty($this->Site->Name)) {
$this->Site->Name = '(empty)';
}
$this->Site->Insert();
$siteInformation = new SiteInformation();
$buildInformation = new BuildInformation();
// Fill in the attribute
foreach ($attributes as $key => $value) {
$siteInformation->SetValue($key, $value);
$buildInformation->SetValue($key, $value);
}
$this->Site->SetInformation($siteInformation);
$this->Build->SiteId = $this->Site->Id;
$this->Build->Name = $attributes['BUILDNAME'];
if (empty($this->Build->Name)) {
$this->Build->Name = '(empty)';
}
$this->Build->SetStamp($attributes['BUILDSTAMP']);
$this->Build->Generator = $attributes['GENERATOR'];
$this->Build->Information = $buildInformation;
} elseif ($name == 'UPLOAD') {
// Setting start time and end time is tricky here, since all
// we have is the build stamp. The strategy we take here is:
// Set the start time as late as possible, and set the end time
// as early as possible.
// This way we don't override any existing values for these fields
// when we call UpdateBuild() below.
//
// For end time, we use the start of the testing day.
// For start time, we use either the submit time (now) or
// one second before the start time of the *next* testing day
// (whichever is earlier).
// Yes, this means the build finished before it began.
//
// This associates the build with the correct day if it is only
// an upload. Otherwise we defer to the values set by the
// other handlers.
$row = pdo_single_row_query("SELECT nightlytime FROM project where id='{$this->projectid}'");
$nightly_time = $row['nightlytime'];
$build_date = extract_date_from_buildstamp($this->Build->GetStamp());
list($prev, $nightly_start_time, $next) = get_dates($build_date, $nightly_time);
// If the nightly start time is after noon (server time)
// and this buildstamp is on or after the nightly start time
// then this build belongs to the next testing day.
if (date(FMT_TIME, $nightly_start_time) > '12:00:00') {
$build_timestamp = strtotime($build_date);
$next_timestamp = strtotime($next);
if (strtotime(date(FMT_TIME, $build_timestamp), $next_timestamp) >= strtotime(date(FMT_TIME, $nightly_start_time), $next_timestamp)) {
$nightly_start_time += 3600 * 24;
}
}
$this->Build->EndTime = gmdate(FMT_DATETIME, $nightly_start_time);
$now = time();
$one_second_before_tomorrow = strtotime('+1 day -1 second', $nightly_start_time);
if ($one_second_before_tomorrow < time()) {
$this->Build->StartTime = gmdate(FMT_DATETIME, $one_second_before_tomorrow);
} else {
$this->Build->StartTime = gmdate(FMT_DATETIME, $now);
}
$this->Build->SubmitTime = gmdate(FMT_DATETIME, $now);
$this->Build->ProjectId = $this->projectid;
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it
if ($this->Build->Id == 0) {
$this->Build->Append = false;
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
$this->UpdateEndTime = true;
} else {
// Otherwise make sure that the build is up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
} elseif ($name == 'FILE') {
$this->UploadFile = new UploadFile();
$this->UploadFile->Filename = $attributes['FILENAME'];
} elseif ($name == 'CONTENT') {
$fileEncoding = isset($attributes['ENCODING']) ? $attributes['ENCODING'] : 'base64';
if (strcmp($fileEncoding, 'base64') != 0) {
// Only base64 encoding is supported for file upload
add_log("upload_handler: Only 'base64' encoding is supported", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_ERR);
$this->UploadError = true;
return;
}
// Create tmp file
$this->TmpFilename = tempnam($GLOBALS['CDASH_UPLOAD_DIRECTORY'], 'tmp');
// TODO Handle error
if (empty($this->TmpFilename)) {
add_log('Failed to create temporary filename', __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_ERR);
//.........这里部分代码省略.........
示例14: gmdate
$end_timestamp += 3600 * 24;
$end_date = gmdate(FMT_DATETIME, $end_timestamp);
$response['to_date'] = $date;
} else {
// If not, just use whichever one was set.
if (isset($_GET['from'])) {
$date = $_GET['from'];
} else {
$date = $_GET['to'];
}
}
} elseif (isset($_GET['date'])) {
$date = $_GET['date'];
}
if (is_null($begin_date)) {
list($previousdate, $beginning_timestamp, $nextdate, $d) = get_dates($date, $Project->NightlyTime);
if (is_null($date)) {
$date = $d;
}
$end_timestamp = $beginning_timestamp + 3600 * 24;
$begin_date = gmdate(FMT_DATETIME, $beginning_timestamp);
$end_date = gmdate(FMT_DATETIME, $end_timestamp);
}
// Check if the user specified a buildgroup.
$groupid = 0;
$group_join = '';
$group_clause = "b.type != 'Experimental'";
$group_link = '';
if (isset($_GET['group']) && is_numeric($_GET['group']) && $_GET['group'] > 0) {
$groupid = $_GET['group'];
$group_join = 'JOIN build2group b2g ON (b2g.buildid=b.id)';
示例15: form_error
" />
<input type="hidden" name="category" value="<?php
echo $category;
?>
" />
<div style="margin: 10px 0; vertical-align:middle;" class="sowcal">
<?php
echo form_error('delivery_date');
?>
<select name="upcoming" id="upcoming" onchange="upcoming_date(this.value);" style="width:185px; vertical-align:top;">
<option value=""><?php
echo lang('Choose delivery date');
?>
</option>
<?php
$dates = get_dates($product->delivery_method_id, 10);
foreach ($dates as $day) {
?>
<option value="<?php
echo date('d-m-Y', strtotime($day));
?>
"><?php
echo date('l, d F', strtotime($day));
?>
</option>
<?php
}
?>
<optgroup label="....................................." class="vical"></optgroup>
<option value="cal"><?php
echo lang('View calendar');