Convert all tabs to spaces

This commit is contained in:
Peter Kokot
2019-05-22 02:21:21 +02:00
parent 80d03e3e78
commit 9d47b05f2d
37 changed files with 4214 additions and 4214 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,20 +5,20 @@ use App\Repository\PackageRepository;
$errors = [];
$warnings = [];
$order_options = [
'' => 'relevance',
'id' => 'ID',
'ts1' => 'date',
'ts2' => 'last modified',
'package_name' => 'package',
'bug_type' => 'bug_type',
'status' => 'status',
'php_version' => 'php_version',
'php_os' => 'os',
'sdesc' => 'summary',
'assign' => 'assignment',
'avg_score' => 'avg. vote score',
'votes_count' => 'number of votes',
'RAND()' => 'random',
'' => 'relevance',
'id' => 'ID',
'ts1' => 'date',
'ts2' => 'last modified',
'package_name' => 'package',
'bug_type' => 'bug_type',
'status' => 'status',
'php_version' => 'php_version',
'php_os' => 'os',
'sdesc' => 'summary',
'assign' => 'assignment',
'avg_score' => 'avg. vote score',
'votes_count' => 'number of votes',
'RAND()' => 'random',
];
// Fetch pseudo packages
@@ -44,7 +44,7 @@ $begin = (int) ((!empty($_GET['begin']) && $_GET['begin'] > 0) ? $_GET['begin']
$limit = (defined('MAX_BUGS_RETURN')) ? MAX_BUGS_RETURN : 30;
$project = (!empty($_GET['project']) && $_GET['project'] != 'All') ? $_GET['project'] : '';
if (!empty($_GET['limit'])) {
$limit = ($_GET['limit'] == 'All') ? 'All' : (($_GET['limit'] > 0) ? (int) $_GET['limit'] : $limit);
$limit = ($_GET['limit'] == 'All') ? 'All' : (($_GET['limit'] > 0) ? (int) $_GET['limit'] : $limit);
}
$direction = (!empty($_GET['direction']) && $_GET['direction'] != 'DESC') ? 'ASC' : 'DESC';
$order_by = (!empty($_GET['order_by']) && array_key_exists($_GET['order_by'], $order_options)) ? $_GET['order_by'] : '';
@@ -57,228 +57,228 @@ $commented_by = !empty($_GET['commented_by']) ? spam_protect($_GET['commented_by
if (isset($_GET['cmd']) && $_GET['cmd'] == 'display')
{
$query = '
SELECT SQL_CALC_FOUND_ROWS
bugdb.*,
TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) AS unchanged,
UNIX_TIMESTAMP(ts1) AS submitted,
UNIX_TIMESTAMP(ts2) AS modified
FROM bugdb
';
$query = '
SELECT SQL_CALC_FOUND_ROWS
bugdb.*,
TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) AS unchanged,
UNIX_TIMESTAMP(ts1) AS submitted,
UNIX_TIMESTAMP(ts2) AS modified
FROM bugdb
';
if (in_array($order_by, ['votes_count', 'avg_score'])) {
$query .= 'LEFT JOIN bugdb_votes v ON bugdb.id = v.bug';
}
if (in_array($order_by, ['votes_count', 'avg_score'])) {
$query .= 'LEFT JOIN bugdb_votes v ON bugdb.id = v.bug';
}
if ($commented_by != '') {
$query .= ' LEFT JOIN bugdb_comments c ON bugdb.id = c.bug';
}
if ($commented_by != '') {
$query .= ' LEFT JOIN bugdb_comments c ON bugdb.id = c.bug';
}
$where_clause = ' WHERE 1 = 1 ';
$where_clause = ' WHERE 1 = 1 ';
if (isset($user_flags) && ($user_flags & (BUGS_SECURITY_DEV | BUGS_TRUSTED_DEV))) {
if ($private != '') {
$where_clause .= ' AND bugdb.private = "Y" ';
}
} else {
/* Non trusted developer should see the Security related bug report just when it is public */
$where_clause .= ' AND (bugdb.bug_type <> "Security" OR private = "N") ';
}
if (isset($user_flags) && ($user_flags & (BUGS_SECURITY_DEV | BUGS_TRUSTED_DEV))) {
if ($private != '') {
$where_clause .= ' AND bugdb.private = "Y" ';
}
} else {
/* Non trusted developer should see the Security related bug report just when it is public */
$where_clause .= ' AND (bugdb.bug_type <> "Security" OR private = "N") ';
}
if (!empty($package_name)) {
$where_clause .= ' AND bugdb.package_name';
if (count($package_name) > 1) {
$items = array_map([$dbh, 'quote'], $package_name);
$where_clause .= " IN (" . join(", ", $items) . ")";
} else {
$where_clause .= ' = ' . $dbh->quote($package_name[0]);
}
}
if (!empty($package_name)) {
$where_clause .= ' AND bugdb.package_name';
if (count($package_name) > 1) {
$items = array_map([$dbh, 'quote'], $package_name);
$where_clause .= " IN (" . join(", ", $items) . ")";
} else {
$where_clause .= ' = ' . $dbh->quote($package_name[0]);
}
}
if (!empty($package_nname)) {
$where_clause .= ' AND bugdb.package_name';
if (count($package_nname) > 1) {
$items = array_map([$dbh, 'quote'], $package_nname);
$where_clause .= " NOT IN (" . join(", ", $items) . ")";
} else {
$where_clause .= ' <> ' . $dbh->quote($package_nname[0]);
}
}
if (!empty($package_nname)) {
$where_clause .= ' AND bugdb.package_name';
if (count($package_nname) > 1) {
$items = array_map([$dbh, 'quote'], $package_nname);
$where_clause .= " NOT IN (" . join(", ", $items) . ")";
} else {
$where_clause .= ' <> ' . $dbh->quote($package_nname[0]);
}
}
// Ensure status is valid and tweak search clause to treat assigned, analyzed, critical and verified bugs as open
switch ($status) {
case 'All':
break;
case 'Closed':
case 'Re-Opened':
case 'Duplicate':
case 'Critical':
case 'Assigned':
case 'Analyzed':
case 'Verified':
case 'Suspended':
case 'Wont fix':
case 'No Feedback':
case 'Feedback':
case 'Not a bug':
$where_clause .= " AND bugdb.status='$status'";
break;
case 'Old Feedback':
$where_clause .= " AND bugdb.status='Feedback'
AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) > 60";
break;
case 'Fresh':
$where_clause .= " AND bugdb.status NOT IN ('Closed', 'Duplicate', 'Not a bug')
AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) < 30";
break;
case 'Stale':
$where_clause .= " AND bugdb.status NOT IN ('Closed', 'Duplicate', 'Not a bug')
AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) > 30";
break;
case 'Not Assigned':
$where_clause .= " AND bugdb.status NOT IN ('Closed', 'Duplicate', 'Not a bug', 'Assigned', 'Wont Fix', 'Suspended')";
break;
case 'OpenFeedback':
$where_clause .= " AND bugdb.status IN ('Open', 'Re-Opened', 'Assigned','Analyzed', 'Critical', 'Verified', 'Feedback')";
break;
default:
case 'Open':
$where_clause .= " AND bugdb.status IN ('Open', 'Re-Opened', 'Assigned', 'Analyzed', 'Critical', 'Verified')";
}
// Ensure status is valid and tweak search clause to treat assigned, analyzed, critical and verified bugs as open
switch ($status) {
case 'All':
break;
case 'Closed':
case 'Re-Opened':
case 'Duplicate':
case 'Critical':
case 'Assigned':
case 'Analyzed':
case 'Verified':
case 'Suspended':
case 'Wont fix':
case 'No Feedback':
case 'Feedback':
case 'Not a bug':
$where_clause .= " AND bugdb.status='$status'";
break;
case 'Old Feedback':
$where_clause .= " AND bugdb.status='Feedback'
AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) > 60";
break;
case 'Fresh':
$where_clause .= " AND bugdb.status NOT IN ('Closed', 'Duplicate', 'Not a bug')
AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) < 30";
break;
case 'Stale':
$where_clause .= " AND bugdb.status NOT IN ('Closed', 'Duplicate', 'Not a bug')
AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) > 30";
break;
case 'Not Assigned':
$where_clause .= " AND bugdb.status NOT IN ('Closed', 'Duplicate', 'Not a bug', 'Assigned', 'Wont Fix', 'Suspended')";
break;
case 'OpenFeedback':
$where_clause .= " AND bugdb.status IN ('Open', 'Re-Opened', 'Assigned','Analyzed', 'Critical', 'Verified', 'Feedback')";
break;
default:
case 'Open':
$where_clause .= " AND bugdb.status IN ('Open', 'Re-Opened', 'Assigned', 'Analyzed', 'Critical', 'Verified')";
}
if ($search_for != '') {
list($sql_search, $ignored) = format_search_string($search_for, $boolean_search);
$where_clause .= $sql_search;
if (count($ignored) > 0 ) {
$warnings[] = 'The following words were ignored: ' . implode(', ', array_unique($ignored));
}
}
if ($search_for != '') {
list($sql_search, $ignored) = format_search_string($search_for, $boolean_search);
$where_clause .= $sql_search;
if (count($ignored) > 0 ) {
$warnings[] = 'The following words were ignored: ' . implode(', ', array_unique($ignored));
}
}
if ($bug_type != '') {
if ($bug_type == 'Bugs') {
$where_clause .= ' AND (bugdb.bug_type = "Bug" OR bugdb.bug_type="Documentation Problem")';
} else {
$where_clause .= ' AND bugdb.bug_type = ' . $dbh->quote($bug_type);
}
}
if ($bug_type != '') {
if ($bug_type == 'Bugs') {
$where_clause .= ' AND (bugdb.bug_type = "Bug" OR bugdb.bug_type="Documentation Problem")';
} else {
$where_clause .= ' AND bugdb.bug_type = ' . $dbh->quote($bug_type);
}
}
if ($bug_age > 0) {
$where_clause .= " AND bugdb.ts1 >= DATE_SUB(NOW(), INTERVAL $bug_age DAY)";
}
if ($bug_age > 0) {
$where_clause .= " AND bugdb.ts1 >= DATE_SUB(NOW(), INTERVAL $bug_age DAY)";
}
if ($bug_updated > 0) {
$where_clause .= " AND bugdb.ts2 >= DATE_SUB(NOW(), INTERVAL $bug_updated DAY)";
}
if ($bug_updated > 0) {
$where_clause .= " AND bugdb.ts2 >= DATE_SUB(NOW(), INTERVAL $bug_updated DAY)";
}
if ($php_os != '') {
$where_clause .= " AND bugdb.php_os {$php_os_not} LIKE " . $dbh->quote('%'.$php_os.'%');
}
if ($php_os != '') {
$where_clause .= " AND bugdb.php_os {$php_os_not} LIKE " . $dbh->quote('%'.$php_os.'%');
}
if ($phpver != '') {
$where_clause .= " AND bugdb.php_version LIKE " . $dbh->quote($phpver.'%');
}
if ($phpver != '') {
$where_clause .= " AND bugdb.php_version LIKE " . $dbh->quote($phpver.'%');
}
if ($project != '') {
$where_clause .= " AND EXISTS (SELECT 1 FROM bugdb_pseudo_packages b WHERE b.name = bugdb.package_name AND b.project = ". $dbh->quote($project) ." LIMIT 1)";
}
if ($project != '') {
$where_clause .= " AND EXISTS (SELECT 1 FROM bugdb_pseudo_packages b WHERE b.name = bugdb.package_name AND b.project = ". $dbh->quote($project) ." LIMIT 1)";
}
if ($cve_id != '') {
$where_clause .= " AND bugdb.cve_id {$cve_id_not} LIKE " . $dbh->quote($cve_id.'%');
}
if ($cve_id != '') {
$where_clause .= " AND bugdb.cve_id {$cve_id_not} LIKE " . $dbh->quote($cve_id.'%');
}
/* A search for patch&pull should be (patch or pull) */
if ($patch != '' || $pull != '') {
$where_clause .= " AND (1=2";
}
if ($patch != '') {
$where_clause .= " OR EXISTS (SELECT 1 FROM bugdb_patchtracker WHERE bugdb_id = bugdb.id LIMIT 1)";
}
if ($pull != '') {
$where_clause .= " OR EXISTS (SELECT 1 FROM bugdb_pulls WHERE bugdb_id = bugdb.id LIMIT 1)";
}
if ($patch != '' || $pull != '') {
$where_clause .= ")";
}
if ($assign != '') {
$where_clause .= ' AND bugdb.assign = ' . $dbh->quote($assign);
}
/* A search for patch&pull should be (patch or pull) */
if ($patch != '' || $pull != '') {
$where_clause .= " AND (1=2";
}
if ($patch != '') {
$where_clause .= " OR EXISTS (SELECT 1 FROM bugdb_patchtracker WHERE bugdb_id = bugdb.id LIMIT 1)";
}
if ($pull != '') {
$where_clause .= " OR EXISTS (SELECT 1 FROM bugdb_pulls WHERE bugdb_id = bugdb.id LIMIT 1)";
}
if ($patch != '' || $pull != '') {
$where_clause .= ")";
}
if ($assign != '') {
$where_clause .= ' AND bugdb.assign = ' . $dbh->quote($assign);
}
if ($author_email != '') {
$where_clause .= ' AND bugdb.email = ' . $dbh->quote($author_email);
}
if ($commented_by != '') {
$where_clause .= ' AND c.email = ' . $dbh->quote($commented_by);
}
if ($author_email != '') {
$where_clause .= ' AND bugdb.email = ' . $dbh->quote($author_email);
}
if ($commented_by != '') {
$where_clause .= ' AND c.email = ' . $dbh->quote($commented_by);
}
$where_clause .= ' AND (1=1';
$where_clause .= ' AND (1=1';
if ($pseudo = array_intersect(array_keys($pseudo_pkgs), $package_name)) {
$where_clause .= " OR bugdb.package_name";
if (count($pseudo) > 1) {
$pseudo = array_map([$dbh, 'quote'], $pseudo);
$where_clause .= " IN (" . join(", ", $pseudo) . ")";
} else {
$where_clause .= " = " . $dbh->quote(reset($pseudo));
}
} else {
$items = array_map([$dbh, 'quote'], array_keys($pseudo_pkgs));
$where_clause .= " OR bugdb.package_name IN (" . join(", ", $items) . ")";
}
if ($pseudo = array_intersect(array_keys($pseudo_pkgs), $package_name)) {
$where_clause .= " OR bugdb.package_name";
if (count($pseudo) > 1) {
$pseudo = array_map([$dbh, 'quote'], $pseudo);
$where_clause .= " IN (" . join(", ", $pseudo) . ")";
} else {
$where_clause .= " = " . $dbh->quote(reset($pseudo));
}
} else {
$items = array_map([$dbh, 'quote'], array_keys($pseudo_pkgs));
$where_clause .= " OR bugdb.package_name IN (" . join(", ", $items) . ")";
}
$query .= "$where_clause )";
$query .= "$where_clause )";
if ($reorder_by != '') {
if ($order_by == $reorder_by) {
$direction = $direction == 'ASC' ? 'DESC' : 'ASC';
} else {
$direction = $reorder_by == 'ts2' ? 'DESC' : 'ASC';
$order_by = $reorder_by;
}
}
if ($reorder_by != '') {
if ($order_by == $reorder_by) {
$direction = $direction == 'ASC' ? 'DESC' : 'ASC';
} else {
$direction = $reorder_by == 'ts2' ? 'DESC' : 'ASC';
$order_by = $reorder_by;
}
}
$order_by_clauses = [];
if (in_array($order_by, ['votes_count', 'avg_score'])) {
$query .= ' GROUP BY bugdb.id';
$order_by_clauses = [];
if (in_array($order_by, ['votes_count', 'avg_score'])) {
$query .= ' GROUP BY bugdb.id';
switch ($order_by) {
case 'avg_score':
$order_by_clauses = [
"IFNULL(AVG(v.score), 0)+3 $direction",
"COUNT(v.bug) DESC"
];
break;
case 'votes_count':
$order_by_clauses = ["COUNT(v.bug) $direction"];
break;
}
} elseif ($order_by != '') {
$order_by_clauses = ["$order_by $direction"];
}
switch ($order_by) {
case 'avg_score':
$order_by_clauses = [
"IFNULL(AVG(v.score), 0)+3 $direction",
"COUNT(v.bug) DESC"
];
break;
case 'votes_count':
$order_by_clauses = ["COUNT(v.bug) $direction"];
break;
}
} elseif ($order_by != '') {
$order_by_clauses = ["$order_by $direction"];
}
if ($status == 'Feedback') {
$order_by_clauses[] = "bugdb.ts2 $direction";
}
if ($status == 'Feedback') {
$order_by_clauses[] = "bugdb.ts2 $direction";
}
if (count($order_by_clauses)) {
$query .= ' ORDER BY ' . implode(', ', $order_by_clauses);
}
if (count($order_by_clauses)) {
$query .= ' ORDER BY ' . implode(', ', $order_by_clauses);
}
if ($limit != 'All' && $limit > 0) {
$query .= " LIMIT $begin, $limit";
}
if ($limit != 'All' && $limit > 0) {
$query .= " LIMIT $begin, $limit";
}
if (stristr($query, ';')) {
$errors[] = 'BAD HACKER!! No database cracking for you today!';
} else {
try {
$result = $dbh->prepare($query)->execute()->fetchAll();
$rows = count($result);
$total_rows = $dbh->prepare('SELECT FOUND_ROWS()')->execute()->fetch(\PDO::FETCH_NUM)[0];
} catch (Exception $e) {
$errors[] = 'Invalid query: ' . $e->getMessage();
}
if (defined('MAX_BUGS_RETURN') && $total_rows > $rows) {
$warnings[] = 'The search was too general, only ' . MAX_BUGS_RETURN . ' bugs will be returned';
}
}
if (stristr($query, ';')) {
$errors[] = 'BAD HACKER!! No database cracking for you today!';
} else {
try {
$result = $dbh->prepare($query)->execute()->fetchAll();
$rows = count($result);
$total_rows = $dbh->prepare('SELECT FOUND_ROWS()')->execute()->fetch(\PDO::FETCH_NUM)[0];
} catch (Exception $e) {
$errors[] = 'Invalid query: ' . $e->getMessage();
}
if (defined('MAX_BUGS_RETURN') && $total_rows > $rows) {
$warnings[] = 'The search was too general, only ' . MAX_BUGS_RETURN . ' bugs will be returned';
}
}
}

View File

@@ -1,75 +1,75 @@
<?php
$trusted_developers = [
'tony2001',
'derick',
'iliaa',
'jani',
'magnus',
'jacques',
'johannes',
'bjori',
'rasmus',
'philip',
'felipe',
'pajoye',
'laruence',
'zeev',
'pollita',
'kalle',
'danbrown',
'nikic',
'tony2001',
'derick',
'iliaa',
'jani',
'magnus',
'jacques',
'johannes',
'bjori',
'rasmus',
'philip',
'felipe',
'pajoye',
'laruence',
'zeev',
'pollita',
'kalle',
'danbrown',
'nikic',
];
// Distro people (security related)
$security_distro_people = [
'jorton', /* RH */
'huzaifas', /* RH */
'vdanen', /* RH */
'geissert', /* debian */
'ondrej', /* debian */
'oden', /* Mandriva */
'sbeattie', /* Ubuntu */
'remi', /* fedora */
'olemarkus', /* Gentoo */
'jorton', /* RH */
'huzaifas', /* RH */
'vdanen', /* RH */
'geissert', /* debian */
'ondrej', /* debian */
'oden', /* Mandriva */
'sbeattie', /* Ubuntu */
'remi', /* fedora */
'olemarkus', /* Gentoo */
];
$security_developers = [
'felipe',
'rasmus',
'tony2001',
'johannes',
'derick',
'iliaa',
'andrei',
'pajoye',
'stas',
'zeev',
'wez',
'edink',
'shane',
'sas',
'ssb',
'helly',
'andi',
'scottmac',
'dmitry',
'cataphract',
'rrichards',
'chregu',
'dsp',
'jpauli',
'tyrael',
'ab',
'kaplan',
'davey',
'krakjoe',
'nikic',
'leigh',
'kalle',
'cmb',
'danbrown',
'yohgaki'
'felipe',
'rasmus',
'tony2001',
'johannes',
'derick',
'iliaa',
'andrei',
'pajoye',
'stas',
'zeev',
'wez',
'edink',
'shane',
'sas',
'ssb',
'helly',
'andi',
'scottmac',
'dmitry',
'cataphract',
'rrichards',
'chregu',
'dsp',
'jpauli',
'tyrael',
'ab',
'kaplan',
'davey',
'krakjoe',
'nikic',
'leigh',
'kalle',
'cmb',
'danbrown',
'yohgaki'
];
$security_developers = array_merge($security_developers, $security_distro_people);

View File

@@ -5,17 +5,17 @@
*/
$site_data = [
'method' => 'https',
'url' => 'bugs.php.net',
'basedir' => '/bugs',
'email' => 'php-bugs@lists.php.net',
'doc_email' => 'doc-bugs@lists.php.net',
'security_email' => 'security@php.net',
'db' => 'phpbugsdb',
'db_user' => 'nobody',
'db_pass' => '',
'db_host' => 'localhost',
'patch_tmp' => "{$ROOT_DIR}/uploads/patches/",
'method' => 'https',
'url' => 'bugs.php.net',
'basedir' => '/bugs',
'email' => 'php-bugs@lists.php.net',
'doc_email' => 'doc-bugs@lists.php.net',
'security_email' => 'security@php.net',
'db' => 'phpbugsdb',
'db_user' => 'nobody',
'db_pass' => '',
'db_host' => 'localhost',
'patch_tmp' => "{$ROOT_DIR}/uploads/patches/",
];
define('DEVBOX', true);

View File

@@ -12,41 +12,41 @@ require __DIR__ . '/../../include/prepend.php';
*/
foreach ($container->get(BugRepository::class)->findAllAssigned() as $assigned => $binfos) {
$mbody = format_email_body($binfos);
$email_user = $assigned . '@php.net';
$mbody = format_email_body($binfos);
$email_user = $assigned . '@php.net';
mail($email_user, 'Assigned PHP bugs reminder', $mbody, 'From: php-bugs@lists.php.net', '-fphp-bugs@lists.php.net');
mail($email_user, 'Assigned PHP bugs reminder', $mbody, 'From: php-bugs@lists.php.net', '-fphp-bugs@lists.php.net');
}
function format_email_body($binfos) {
$links = '';
$count = count($binfos);
$earliest_changed = time();
$earliest_opened = time();
$links = '';
$count = count($binfos);
$earliest_changed = time();
$earliest_opened = time();
foreach ($binfos as $binfo) {
foreach ($binfos as $binfo) {
if ($earliest_changed > $binfo['ts_changed']) {
$earliest_changed = $binfo['ts_changed'];
}
if ($earliest_opened > $binfo['ts_opened']) {
$earliest_opened = $binfo['ts_opened'];
}
if ($earliest_changed > $binfo['ts_changed']) {
$earliest_changed = $binfo['ts_changed'];
}
if ($earliest_opened > $binfo['ts_opened']) {
$earliest_opened = $binfo['ts_opened'];
}
$link_title = strlen($binfo['sdesc']) < 65 ? $binfo['sdesc'] : substr($binfo['sdesc'], 0, 65) . '...';
$link_title = strlen($binfo['sdesc']) < 65 ? $binfo['sdesc'] : substr($binfo['sdesc'], 0, 65) . '...';
$links .= " Title: $link_title\r\n";
$links .= " Type: {$binfo['bug_type']} with Status: {$binfo['status']}\r\n";
$links .= " Link: https://bugs.php.net/{$binfo['id']}\r\n\r\n";
}
$links .= " Title: $link_title\r\n";
$links .= " Type: {$binfo['bug_type']} with Status: {$binfo['status']}\r\n";
$links .= " Link: https://bugs.php.net/{$binfo['id']}\r\n\r\n";
}
$assigned = $binfo['assign'];
$salute = ($count === 1) ? 'one bug report' : "$count bug reports";
$date_c = date('M d, Y', $earliest_changed);
$date_o = date('M d, Y', $earliest_opened);
$assigned = $binfo['assign'];
$salute = ($count === 1) ? 'one bug report' : "$count bug reports";
$date_c = date('M d, Y', $earliest_changed);
$date_o = date('M d, Y', $earliest_opened);
$body = <<<MAIL_BODY
$body = <<<MAIL_BODY
Hello $assigned,
This is a gentle reminder about the $salute assigned to you.
@@ -59,5 +59,5 @@ Your assigned bug information:
$links
MAIL_BODY;
return $body;
return $body;
}

View File

@@ -18,27 +18,27 @@ list($RESOLVE_REASONS, $FIX_VARIATIONS) = $reasonRepository->findByProject($site
foreach ($container->get(BugRepository::class)->findAllWithoutFeedback() as $bug)
{
list($mailto, $mailfrom, $bcc, $params) = get_package_mail($bug['package_name'], false, $bug['bug_type']);
list($mailto, $mailfrom, $bcc, $params) = get_package_mail($bug['package_name'], false, $bug['bug_type']);
// No feedback message
if (isset($FIX_VARIATIONS) && isset($FIX_VARIATIONS['nofeedback'][$bug['package_name']])) {
$message = $FIX_VARIATIONS['nofeedback'][$bug['package_name']];
} elseif (isset($RESOLVE_REASONS['nofeedback'])) {
$message = $RESOLVE_REASONS['nofeedback']['message'];
} else {
die('[no-feedback] Could not find resolve reason! (this should not happen!)');
}
bugs_add_comment($bug['id'], $mailfrom, '', $message, 'comment');
// No feedback message
if (isset($FIX_VARIATIONS) && isset($FIX_VARIATIONS['nofeedback'][$bug['package_name']])) {
$message = $FIX_VARIATIONS['nofeedback'][$bug['package_name']];
} elseif (isset($RESOLVE_REASONS['nofeedback'])) {
$message = $RESOLVE_REASONS['nofeedback']['message'];
} else {
die('[no-feedback] Could not find resolve reason! (this should not happen!)');
}
bugs_add_comment($bug['id'], $mailfrom, '', $message, 'comment');
// Update status
$dbh->prepare('
UPDATE bugdb
SET status = "No Feedback", ts2 = NOW()
WHERE id = ?
')->execute([
$bug['id'],
]);
// Update status
$dbh->prepare('
UPDATE bugdb
SET status = "No Feedback", ts2 = NOW()
WHERE id = ?
')->execute([
$bug['id'],
]);
// Send emails
mail_bug_updates($bug, $in, $mailfrom, $message);
// Send emails
mail_bug_updates($bug, $in, $mailfrom, $message);
}

View File

@@ -22,7 +22,7 @@ if (!empty($errors)) {
<table>
<?php
if (!$logged_in) {
$_SESSION['answer'] = $captcha->getAnswer();
$_SESSION['answer'] = $captcha->getAnswer();
?>
<tr>
<th class="form-label_left">

View File

@@ -21,7 +21,7 @@ if (!empty($errors)) {
<table>
<?php
if (!$logged_in) {
$_SESSION['answer'] = $captcha->getAnswer();
$_SESSION['answer'] = $captcha->getAnswer();
?>
<tr>
<th class="form-label_left">

View File

@@ -9,62 +9,62 @@ href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">';
echo "\n <channel rdf:about=\"{$site_method}://{$site_url}{$basedir}/rss/search.php\">\n";
echo " <title>{$siteBig} Bug Search Results</title>\n";
echo " <link>{$site_method}://{$site_url}{$basedir}/rss/search.php?" , clean(http_build_query($_GET)) , "</link>\n";
echo " <description>Search Results</description>\n";
echo " <dc:language>en-us</dc:language>\n";
echo " <dc:creator>{$site}-webmaster@lists.php.net</dc:creator>\n";
echo " <dc:publisher>{$site}-webmaster@lists.php.net</dc:publisher>\n";
echo " <admin:generatorAgent rdf:resource=\"{$site_method}://{$site_url}{$basedir}\"/>\n";
echo " <sy:updatePeriod>hourly</sy:updatePeriod>\n";
echo " <sy:updateFrequency>1</sy:updateFrequency>\n";
echo " <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>\n";
echo ' <items>
<rdf:Seq>
echo " <title>{$siteBig} Bug Search Results</title>\n";
echo " <link>{$site_method}://{$site_url}{$basedir}/rss/search.php?" , clean(http_build_query($_GET)) , "</link>\n";
echo " <description>Search Results</description>\n";
echo " <dc:language>en-us</dc:language>\n";
echo " <dc:creator>{$site}-webmaster@lists.php.net</dc:creator>\n";
echo " <dc:publisher>{$site}-webmaster@lists.php.net</dc:publisher>\n";
echo " <admin:generatorAgent rdf:resource=\"{$site_method}://{$site_url}{$basedir}\"/>\n";
echo " <sy:updatePeriod>hourly</sy:updatePeriod>\n";
echo " <sy:updateFrequency>1</sy:updateFrequency>\n";
echo " <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>\n";
echo ' <items>
<rdf:Seq>
';
$items = '';
if ($total_rows > 0) {
foreach ($result as $row) {
$desc = "{$row['package_name']} ({$row['bug_type']})\nReported by ";
if (preg_match('/@php.net$/i', $row['email'])) {
$desc .= substr($row['email'], 0, strpos($row['email'], '@')) ."\n";
} else {
$desc .= substr($row['email'], 0, strpos($row['email'], '@')) . "@...\n";
}
$desc .= date(DATE_ATOM, $row['submitted']) . "\n";
$desc .= "PHP: {$row['php_version']}, OS: {$row['php_os']}\n\n";
$desc .= $row['ldesc'];
$desc = '<pre>' . clean($desc) . '</pre>';
foreach ($result as $row) {
$desc = "{$row['package_name']} ({$row['bug_type']})\nReported by ";
if (preg_match('/@php.net$/i', $row['email'])) {
$desc .= substr($row['email'], 0, strpos($row['email'], '@')) ."\n";
} else {
$desc .= substr($row['email'], 0, strpos($row['email'], '@')) . "@...\n";
}
$desc .= date(DATE_ATOM, $row['submitted']) . "\n";
$desc .= "PHP: {$row['php_version']}, OS: {$row['php_os']}\n\n";
$desc .= $row['ldesc'];
$desc = '<pre>' . clean($desc) . '</pre>';
echo " <rdf:li rdf:resource=\"{$site_method}://{$site_url}{$basedir}/{$row['id']}\" />\n";
$items .= " <item rdf:about=\"{$site_method}://{$site_url}{$basedir}/{$row['id']}\">\n";
$items .= ' <title>' . clean("{$row['bug_type']} {$row['id']} [{$row['status']}] {$row['sdesc']}") . "</title>\n";
$items .= " <link>{$site_method}://{$site_url}{$basedir}/{$row['id']}</link>\n";
$items .= ' <content:encoded><![CDATA[' . $desc . "]]></content:encoded>\n";
$items .= ' <description><![CDATA[' . $desc . "]]></description>\n";
if (!$row['unchanged']) {
$items .= ' <dc:date>' . date(DATE_ATOM, $row['submitted']) . "</dc:date>\n";
} else {
$items .= ' <dc:date>' . date(DATE_ATOM, $row['modified']) . "</dc:date>\n";
}
$items .= ' <dc:creator>' . clean(spam_protect($row['email'])) . "</dc:creator>\n";
$items .= ' <dc:subject>' . clean($row['package_name']) . ' ' . clean($row['bug_type']) . "</dc:subject>\n";
$items .= " </item>\n";
}
echo " <rdf:li rdf:resource=\"{$site_method}://{$site_url}{$basedir}/{$row['id']}\" />\n";
$items .= " <item rdf:about=\"{$site_method}://{$site_url}{$basedir}/{$row['id']}\">\n";
$items .= ' <title>' . clean("{$row['bug_type']} {$row['id']} [{$row['status']}] {$row['sdesc']}") . "</title>\n";
$items .= " <link>{$site_method}://{$site_url}{$basedir}/{$row['id']}</link>\n";
$items .= ' <content:encoded><![CDATA[' . $desc . "]]></content:encoded>\n";
$items .= ' <description><![CDATA[' . $desc . "]]></description>\n";
if (!$row['unchanged']) {
$items .= ' <dc:date>' . date(DATE_ATOM, $row['submitted']) . "</dc:date>\n";
} else {
$items .= ' <dc:date>' . date(DATE_ATOM, $row['modified']) . "</dc:date>\n";
}
$items .= ' <dc:creator>' . clean(spam_protect($row['email'])) . "</dc:creator>\n";
$items .= ' <dc:subject>' . clean($row['package_name']) . ' ' . clean($row['bug_type']) . "</dc:subject>\n";
$items .= " </item>\n";
}
} else {
$warnings[] = "No bugs matched your criteria";
$warnings[] = "No bugs matched your criteria";
}
echo <<< DATA
</rdf:Seq>
</items>
</rdf:Seq>
</items>
</channel>
<image rdf:about="{$site_method}://{$site_url}{$basedir}/images/{$site}-logo.gif">
<title>{$siteBig} Bugs</title>
<url>{$site_method}://{$site_url}{$basedir}/images/{$site}-logo.gif</url>
<link>{$site_method}://{$site_url}{$basedir}</link>
<title>{$siteBig} Bugs</title>
<url>{$site_method}://{$site_url}{$basedir}/images/{$site}-logo.gif</url>
<link>{$site_method}://{$site_url}{$basedir}</link>
</image>
{$items}

View File

@@ -9,16 +9,16 @@ echo '<?xml version="1.0"?>' . "\n";
<description>Search Results</description>
<?php
if ($total_rows > 0) {
foreach ($result as $row) {
echo " <item>\n";
echo ' <title>' . clean($row['sdesc']) . "</title>\n";
echo " <link>{$site_method}://{$site_url}{$basedir}/{$row['id']}</link>\n";
echo " <category>{$row['status']}</category>\n";
echo ' <pubDate>' . date(DATE_RSS, $row['submitted']) . "</pubDate>\n";
echo " </item>\n";
}
foreach ($result as $row) {
echo " <item>\n";
echo ' <title>' . clean($row['sdesc']) . "</title>\n";
echo " <link>{$site_method}://{$site_url}{$basedir}/{$row['id']}</link>\n";
echo " <category>{$row['status']}</category>\n";
echo ' <pubDate>' . date(DATE_RSS, $row['submitted']) . "</pubDate>\n";
echo " </item>\n";
}
} else {
$warnings[] = "No bugs matched your criteria";
$warnings[] = "No bugs matched your criteria";
}
?>
</channel>

View File

@@ -8,16 +8,16 @@ session_start();
bugs_authenticate($user, $pw, $logged_in, $user_flags);
if (!$logged_in) {
response_header("Bugs admin suite");
response_footer("Please login");
exit;
response_header("Bugs admin suite");
response_footer("Please login");
exit;
}
$actions = [
'phpinfo' => 'phpinfo()',
'list_lists' => 'Package mailing lists',
'list_responses' => 'Quick fix responses',
'mysql' => 'Database status',
'phpinfo' => 'phpinfo()',
'list_lists' => 'Package mailing lists',
'list_responses' => 'Quick fix responses',
'mysql' => 'Database status',
];
$action = !empty($_GET['action']) && isset($actions[$_GET['action']]) ? $_GET['action'] : 'list_lists';
@@ -26,89 +26,89 @@ response_header("Bugs admin suite");
inline_content_menu('/admin/', $action, $actions);
if ($action === 'phpinfo') {
ob_start();
phpinfo();
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
$phpinfo = ob_get_clean();
// Attempt to hide certain ENV vars
$vars = [
getenv('AUTH_TOKEN'),
getenv('USER_TOKEN'),
getenv('USER_PWD_SALT')
];
// Attempt to hide certain ENV vars
$vars = [
getenv('AUTH_TOKEN'),
getenv('USER_TOKEN'),
getenv('USER_PWD_SALT')
];
$phpinfo = str_replace($vars, '&lt;hidden&gt;', $phpinfo);
$phpinfo = str_replace($vars, '&lt;hidden&gt;', $phpinfo);
// Semi stolen from php-web
$m = [];
// Semi stolen from php-web
$m = [];
preg_match('!<body.*?>(.*)</body>!ims', $phpinfo, $m);
preg_match('!<body.*?>(.*)</body>!ims', $phpinfo, $m);
$m[1] = preg_replace('!<a href="http://www.php.net/"><img.*?></a>!ims', '', $m[1]);
$m[1] = preg_replace('!<a href="http://www.zend.com/"><img.*?></a>!ims', '', $m[1]);
$m[1] = str_replace(' width="600"', ' width="80%"', $m[1]);
$m[1] = preg_replace('!<a href="http://www.php.net/"><img.*?></a>!ims', '', $m[1]);
$m[1] = preg_replace('!<a href="http://www.zend.com/"><img.*?></a>!ims', '', $m[1]);
$m[1] = str_replace(' width="600"', ' width="80%"', $m[1]);
echo $m[1];
echo $m[1];
} elseif ($action === 'list_lists') {
echo "<dl>\n";
foreach ($container->get(PackageRepository::class)->findLists() as $row) {
echo "<dt>", $row['name'], ": </dt>\n<dd>", mailto_list(explode(',', $row['list_email'])), "</dd>\n";
}
echo "</dl>\n";
echo "<dl>\n";
foreach ($container->get(PackageRepository::class)->findLists() as $row) {
echo "<dt>", $row['name'], ": </dt>\n<dd>", mailto_list(explode(',', $row['list_email'])), "</dd>\n";
}
echo "</dl>\n";
} elseif ($action === 'list_responses') {
$res = $dbh->query("
SELECT *
FROM bugdb_resolves
");
$res = $dbh->query("
SELECT *
FROM bugdb_resolves
");
echo "<h3>List Responses</h3>\n";
echo "<h3>List Responses</h3>\n";
$rows = [];
while ($row = $res->fetch()) {
// This is ugly but works (tm)
$row['message'] = nl2br($row['message']);
$rows = [];
while ($row = $res->fetch()) {
// This is ugly but works (tm)
$row['message'] = nl2br($row['message']);
$rows[] = $row;
}
$rows[] = $row;
}
admin_table_dynamic($rows);
admin_table_dynamic($rows);
} elseif ($action === 'mysql') {
$res = $dbh->query("SHOW TABLES");
$res = $dbh->query("SHOW TABLES");
$sql = "SELECT version() mysql_version\n";
$sql = "SELECT version() mysql_version\n";
while ($row = $res->fetch(\PDO::FETCH_NUM)) {
$table = $row[0];
$sql .= "\t, (SELECT COUNT(*) FROM `$table`) `cnt_$table`\n";
}
while ($row = $res->fetch(\PDO::FETCH_NUM)) {
$table = $row[0];
$sql .= "\t, (SELECT COUNT(*) FROM `$table`) `cnt_$table`\n";
}
$res = $dbh->query($sql);
$row = $res->fetch();
$res = $dbh->query($sql);
$row = $res->fetch();
echo "<p>Running MySQL <b>".$row['mysql_version']."</b></p>";
unset($row['mysql_version']);
echo "<p>Running MySQL <b>".$row['mysql_version']."</b></p>";
unset($row['mysql_version']);
echo "<h3>Number of rows:</h3>\n";
echo "<h3>Number of rows:</h3>\n";
$rows = [];
$rows = [];
foreach($row as $key => $value) {
$rows[] = [str_replace('cnt_', '', $key), $value];
}
foreach($row as $key => $value) {
$rows[] = [str_replace('cnt_', '', $key), $value];
}
admin_table_static(['Table', 'Rows'], $rows);
admin_table_static(['Table', 'Rows'], $rows);
$rows = [];
$res = $dbh->query("SHOW TABLE STATUS");
echo "<h3>Table status:</h3>\n";
while ($row = $res->fetch()) {
$rows[] = $row;
}
$rows = [];
$res = $dbh->query("SHOW TABLE STATUS");
echo "<h3>Table status:</h3>\n";
while ($row = $res->fetch()) {
$rows[] = $row;
}
admin_table_dynamic($rows);
admin_table_dynamic($rows);
}
response_footer();

View File

@@ -1,9 +1,9 @@
<?php
/*
Hack note: This is for emailing the documentation team about commit/bugs emails, but could be expanded in the future.
Hack note: This is for emailing the documentation team about commit/bugs emails, but could be expanded in the future.
The API itself will probably be abandoned in the future, but here's the current URL:
- https://bugs.php.net/api.php?type=docs&action=closed&interval=7
The API itself will probably be abandoned in the future, but here's the current URL:
- https://bugs.php.net/api.php?type=docs&action=closed&interval=7
*/
use App\Repository\CommentRepository;
@@ -15,19 +15,19 @@ $action = isset($_GET['action']) ? $_GET['action'] : 'unknown';
$interval = isset($_GET['interval']) ? (int) $_GET['interval'] : 7;
if ($type === 'docs' && $action === 'closed' && $interval) {
$commentRepository = $container->get(CommentRepository::class);
$rows = $commentRepository->findDocsComments($interval);
$commentRepository = $container->get(CommentRepository::class);
$rows = $commentRepository->findDocsComments($interval);
//@todo add error handling
if (!$rows) {
echo 'The fail train has arrived.';
exit;
}
//@todo add error handling
if (!$rows) {
echo 'The fail train has arrived.';
exit;
}
echo serialize($rows);
echo serialize($rows);
} else {
echo "Unknown action";
echo "Unknown action";
}

View File

@@ -18,46 +18,46 @@ $bug_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$bug_id = $bug_id ? $bug_id : '';
if (isset($_POST['captcha']) && $bug_id != '') {
// Check if session answer is set, then compare it with the post captcha value.
// If it's not the same, then it's an incorrect password.
if (!isset($_SESSION['answer']) || $_POST['captcha'] != $_SESSION['answer']) {
$errors[] = 'Incorrect Captcha';
}
// Check if session answer is set, then compare it with the post captcha value.
// If it's not the same, then it's an incorrect password.
if (!isset($_SESSION['answer']) || $_POST['captcha'] != $_SESSION['answer']) {
$errors[] = 'Incorrect Captcha';
}
// Try to find the email and the password
if (empty($errors)) {
$query = "SELECT email, passwd FROM bugdb WHERE id = '{$bug_id}'";
// Try to find the email and the password
if (empty($errors)) {
$query = "SELECT email, passwd FROM bugdb WHERE id = '{$bug_id}'";
// Run the query
$row = $dbh->prepare($query)->execute()->fetch();
// Run the query
$row = $dbh->prepare($query)->execute()->fetch();
if (is_null($row)) {
$errors[] = "Invalid bug id provided: #{$bug_id}";
} else {
if (empty($row['passwd'])) {
$errors[] = "No password found for #$bug_id bug report, sorry.";
} else {
$new_passwd = bugs_gen_passwd();
if (is_null($row)) {
$errors[] = "Invalid bug id provided: #{$bug_id}";
} else {
if (empty($row['passwd'])) {
$errors[] = "No password found for #$bug_id bug report, sorry.";
} else {
$new_passwd = bugs_gen_passwd();
$dbh->prepare(
'UPDATE bugdb
SET passwd = ?
WHERE id = ?
')->execute([bugs_get_hash($new_passwd), $bug_id]);
$dbh->prepare(
'UPDATE bugdb
SET passwd = ?
WHERE id = ?
')->execute([bugs_get_hash($new_passwd), $bug_id]);
$resp = bugs_mail($row['email'],
"Password for {$siteBig} bug report #{$bug_id}",
"The password for {$siteBig} bug report #{$bug_id} has been set to: {$new_passwd}",
'From: noreply@php.net');
$resp = bugs_mail($row['email'],
"Password for {$siteBig} bug report #{$bug_id}",
"The password for {$siteBig} bug report #{$bug_id} has been set to: {$new_passwd}",
'From: noreply@php.net');
if ($resp) {
$success = "The password for bug report #{$bug_id} has been sent to the address associated with this report.";
} else {
$errors[] = 'Sorry. Mail can not be sent at this time, please try again later.';
}
}
}
}
if ($resp) {
$success = "The password for bug report #{$bug_id} has been sent to the address associated with this report.";
} else {
$errors[] = 'Sorry. Mail can not be sent at this time, please try again later.';
}
}
}
}
}
// Authenticate
@@ -70,7 +70,7 @@ echo "<h1>Bug Report Password Finder</h1>\n";
display_bug_error($errors);
if ($success) {
echo '<div class="success">'.$success.'</div>';
echo '<div class="success">'.$success.'</div>';
}
$_SESSION['answer'] = $captcha->getAnswer();

File diff suppressed because it is too large Load Diff

View File

@@ -16,8 +16,8 @@ backtrace_inline_menu('Windows');
<p>You'll need to install MS Visual Studio 2008, 2012 or later. You'll also need to</p>
<ul>
<li>either download the debug-pack for your PHP version from <a href="https://windows.php.net/download/">windows.php.net/download</a></li>
<li>or compile your own PHP with <code>--enable-dbg-pack</code> or <code>--enable-debug</code></li>
<li>either download the debug-pack for your PHP version from <a href="https://windows.php.net/download/">windows.php.net/download</a></li>
<li>or compile your own PHP with <code>--enable-dbg-pack</code> or <code>--enable-debug</code></li>
</ul>
<p>If you downloaded the debug-pack from the snaps site, extract it into
@@ -45,8 +45,8 @@ KERNEL32! 77e81af6()
</code></pre>
<!--
Everything below is stolen from Pierre Joye
https://blog.thepimp.net/index.php/post/2007/06/10/debug-pack-or-how-to-generate-backtrack-on-windows-without-compiling
Everything below is stolen from Pierre Joye
https://blog.thepimp.net/index.php/post/2007/06/10/debug-pack-or-how-to-generate-backtrack-on-windows-without-compiling
-->
<h1>Generating backtrace, <u>without</u> compiler, on Windows</h1>
<p>You'll need:</p>

View File

@@ -33,42 +33,42 @@ PHP configured with <code>--enable-debug</code>!
<h3>If you don't have a core file yet:</h3>
<ul>
<li>
Remove any limits you may have on core dump size from your shell:
<ul>
<li>tcsh: unlimit coredumpsize</li>
<li>bash/sh: ulimit -c unlimited</li>
</ul>
</li>
<li>
Ensure that the directory in which you're running PHP, or the
PHP-enabled httpd, has write permissions for the user who's running PHP.
</li>
<li>
Cause PHP to crash:
<ul>
<li>PHP CGI: Simply run php with the script that crashes it</li>
<li>PHP Apache Module: Run httpd -X, and access the script that crashes PHP</li>
</ul>
</li>
<li>
Remove any limits you may have on core dump size from your shell:
<ul>
<li>tcsh: unlimit coredumpsize</li>
<li>bash/sh: ulimit -c unlimited</li>
</ul>
</li>
<li>
Ensure that the directory in which you're running PHP, or the
PHP-enabled httpd, has write permissions for the user who's running PHP.
</li>
<li>
Cause PHP to crash:
<ul>
<li>PHP CGI: Simply run php with the script that crashes it</li>
<li>PHP Apache Module: Run httpd -X, and access the script that crashes PHP</li>
</ul>
</li>
</ul>
<h3>Generic way to get a core on Linux</h3>
<ul>
<li>
Set up the core pattern (run this command as <i>root</i>):
<ul>
<li>echo "&lt;cores dir&gt;/core-%e.%p" &gt; /proc/sys/kernel/core_pattern</li>
<li>make sure the directory is writable by PHP</li>
</ul>
</li>
<li>
Set the ulimit (see above how to do it).
</li>
<li>
Restart/rerun PHP.
</li>
<li>
Set up the core pattern (run this command as <i>root</i>):
<ul>
<li>echo "&lt;cores dir&gt;/core-%e.%p" &gt; /proc/sys/kernel/core_pattern</li>
<li>make sure the directory is writable by PHP</li>
</ul>
</li>
<li>
Set the ulimit (see above how to do it).
</li>
<li>
Restart/rerun PHP.
</li>
</ul>
<p>After that any process crashing in your system, including PHP, will leave
its core file in the directory you've specified in <i>core_pattern</i>.</p>
@@ -76,53 +76,53 @@ its core file in the directory you've specified in <i>core_pattern</i>.</p>
<h3>Once you have the core file:</h3>
<ul>
<li>
Run gdb with the path to the PHP or PHP-enabled httpd binary, and
path to the core file. Some examples:
<ul>
<li><code>gdb /usr/local/apache/sbin/httpd /usr/local/apache/sbin/core</code></li>
<li><code>gdb /home/user/dev/php-snaps/sapi/cli/php /home/user/dev/testing/core</code></li>
</ul>
</li>
<li>
At the gdb prompt, run:
<ul>
<li><code>(gdb) bt</code></li>
</ul>
</li>
<li>
Run gdb with the path to the PHP or PHP-enabled httpd binary, and
path to the core file. Some examples:
<ul>
<li><code>gdb /usr/local/apache/sbin/httpd /usr/local/apache/sbin/core</code></li>
<li><code>gdb /home/user/dev/php-snaps/sapi/cli/php /home/user/dev/testing/core</code></li>
</ul>
</li>
<li>
At the gdb prompt, run:
<ul>
<li><code>(gdb) bt</code></li>
</ul>
</li>
</ul>
<h3>If you can't get a core file:</h3>
<ul>
<li>
Run httpd -X under gdb with something like:
<ul>
<li><code>gdb /usr/local/apache/sbin/httpd</code></li>
<li>(gdb) run -X</li>
</ul>
</li>
<li>
Then use your web browser and access your server to force the crash.
You should see a gdb prompt appear and some message indicating that
there was a crash. At this gdb prompt, type:
<ul>
<li><code>(gdb) bt</code></li>
</ul>
<ul>
<li>
or, running from the commandline
<ul>
<li>
gdb /home/user/dev/php-snaps/sapi/cli/php
<ul>
<li><code>(gdb) run /path/to/script.php</code></li>
<li><code>(gdb) bt</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>
Run httpd -X under gdb with something like:
<ul>
<li><code>gdb /usr/local/apache/sbin/httpd</code></li>
<li>(gdb) run -X</li>
</ul>
</li>
<li>
Then use your web browser and access your server to force the crash.
You should see a gdb prompt appear and some message indicating that
there was a crash. At this gdb prompt, type:
<ul>
<li><code>(gdb) bt</code></li>
</ul>
<ul>
<li>
or, running from the commandline
<ul>
<li>
gdb /home/user/dev/php-snaps/sapi/cli/php
<ul>
<li><code>(gdb) run /path/to/script.php</code></li>
<li><code>(gdb) bt</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>This should generate a backtrace, that you should submit in
@@ -147,8 +147,8 @@ number). You can move the current working stack with the
be used as a guideline on how to handle your segfault.</p>
<ul>
<li>Sample gdb session</li>
<pre><code>
<li>Sample gdb session</li>
<pre><code>
(gdb) bt
#0 0x080ca21b in _efree (ptr=0xbfffdb9b) at zend_alloc.c:240
#1 0x080d691a in _zval_dtor (zvalue=0x8186b94) at zend_variables.c:44
@@ -172,7 +172,7 @@ $15 = 0x816cfc4 "result_error"
(gdb) print (char *)executor_globals.active_op_array->filename
$16 = 0x816afbc "/home/yohgaki/php/DEV/segfault.php"
(gdb)
</code></pre>
</code></pre>
</ul>
<p>In this session, frame 3 is the last <b><code>execute()</code></b>

View File

@@ -1,175 +1,175 @@
body {
margin: 0px;
padding: 0px;
background-color: white;
color: black;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 90%;
margin: 0px;
padding: 0px;
background-color: white;
color: black;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 90%;
}
img {
border:0 none;
border:0 none;
}
table.head,
table.middle,
table.foot {
font-size: 100%; /* make IE look normal */
width: 100%;
border: 0px;
font-size: 100%; /* make IE look normal */
width: 100%;
border: 0px;
}
td.content {
width: 100%;
vertical-align: top;
padding: 1em 0.5em 0.3em 0.5em;
width: 100%;
vertical-align: top;
padding: 1em 0.5em 0.3em 0.5em;
}
/* ========= Header ========= */
td.head-logo {
background-color: #5b69a6;
width: 120px;
text-align: left;
background-color: #5b69a6;
width: 120px;
text-align: left;
}
td.head-menu {
background-color: #5b69a6;
height: 1px;
padding-right: 0.5em;
padding-bottom: 0.1em;
text-align: right;
vertical-align: bottom;
background-color: #5b69a6;
height: 1px;
padding-right: 0.5em;
padding-bottom: 0.1em;
text-align: right;
vertical-align: bottom;
}
td.head-search {
color: #FFFFFF;
background-color: #9999cc;
border-top: 1px solid #000066;
border-bottom: 1px solid #000066;
padding-right: 0.5em;
text-align: right;
color: #FFFFFF;
background-color: #9999cc;
border-top: 1px solid #000066;
border-bottom: 1px solid #000066;
padding-right: 0.5em;
text-align: right;
}
p.head-search {
font-size: 80%;
margin-top: 0.1em;
margin-bottom: 0.1em;
font-size: 80%;
margin-top: 0.1em;
margin-bottom: 0.1em;
}
p.head-search input,
p.head-search select {
font-size: 100%;
font-size: 100%;
}
td.head-menu {
color: #000;
font-weight: bold;
font-size: 75%;
color: #000;
font-weight: bold;
font-size: 75%;
}
td.head-menu a {
color: #FFF;
font-weight: normal;
color: #FFF;
font-weight: normal;
}
td.head-menu a:link,
td.head-menu a:hover,
td.head-menu a:visited {
text-decoration: none;
text-decoration: none;
}
/* ========= Footer ========= */
td.foot-bar {
color: #000000;
background-color: #5b69a6;
border-top: 1px solid #000066;
border-bottom: 1px solid #000066;
text-align: right;
vertical-align: bottom;
padding-right: 0.3em;
font-weight: bold;
font-size: 75%;
color: #000000;
background-color: #5b69a6;
border-top: 1px solid #000066;
border-bottom: 1px solid #000066;
text-align: right;
vertical-align: bottom;
padding-right: 0.3em;
font-weight: bold;
font-size: 75%;
}
td.foot-copy {
background-color: #CCCCCC;
vertical-align: top;
padding: 0.3em;
background-color: #CCCCCC;
vertical-align: top;
padding: 0.3em;
}
td.foot-source {
background-color: #CCCCCC;
vertical-align: top;
text-align: right;
padding: 0.3em;
background-color: #CCCCCC;
vertical-align: top;
text-align: right;
padding: 0.3em;
}
/* ========= Forms ========= */
table.form-holder {
background-color: #FFFFFF;
width: auto;
background-color: #FFFFFF;
width: auto;
}
/* Labels on the left side of form and table rows */
th.form-label_left {
padding: 3px;
text-align: left;
vertical-align: top;
font-weight: bold;
color: #FFFFFF;
background-color: #5b69a6;
width: 25%;
padding: 3px;
text-align: left;
vertical-align: top;
font-weight: bold;
color: #FFFFFF;
background-color: #5b69a6;
width: 25%;
}
td.form-input {
padding: 3px;
text-align: left;
vertical-align: top;
background-color: #e8e8e8;
padding: 3px;
text-align: left;
vertical-align: top;
background-color: #e8e8e8;
}
td.form-input_center {
padding: 3px;
text-align: center;
vertical-align: middle;
background-color: #e8e8e8;
padding: 3px;
text-align: center;
vertical-align: middle;
background-color: #e8e8e8;
}
td.form-input input,
td.form-input_center input {
font-size: 90%;
font-size: 90%;
}
p.cell_note {
margin-top: 0.3em;
margin-bottom: 0.2em;
font-weight: normal;
font-size: 95%;
margin-top: 0.3em;
margin-bottom: 0.2em;
font-weight: normal;
font-size: 95%;
}
input {
font-family: verdana,arial,helvetica,sans-serif;
font-family: verdana,arial,helvetica,sans-serif;
}
textarea {
font-family: "andale mono", "monotype.com", "courier new", monospace;
font-family: "andale mono", "monotype.com", "courier new", monospace;
}
input.small, select.small {
font-size: 75%;
font-size: 75%;
}
textarea.small {
font-size: 75%;
font-size: 75%;
}
form {
margin-bottom: 0;
margin-bottom: 0;
}
/* === User Submission Responses === */
@@ -179,251 +179,251 @@ div.warnings,
div.explain,
div.success
div.tags {
margin: 4px;
padding: 6px;
clear: both;
font-size: 1.1em;
font-weight: bold;
margin: 4px;
padding: 6px;
clear: both;
font-size: 1.1em;
font-weight: bold;
}
div.errors {
border: 1px dashed #660000;
background: #fee;
color: #660000;
border: 1px dashed #660000;
background: #fee;
color: #660000;
}
div.warnings {
border: 1px dashed #ff8c00;
background: #ffa;
color: #ff8c00;
border: 1px dashed #ff8c00;
background: #ffa;
color: #ff8c00;
}
div.tags {
border: 1px dashed #ff8c00;
background: #ffa;
color: #ff8c00;
width: 500px;
margin-left : 100px;
border: 1px dashed #ff8c00;
background: #ffa;
color: #ff8c00;
width: 500px;
margin-left : 100px;
}
div.explain {
border: 1px dashed #000066;
color: #000066;
border: 1px dashed #000066;
color: #000066;
}
div.success {
border: 1px dashed #000066;
background-color: #CCFF99;
color: #000066;
padding:10px;
border: 1px dashed #000066;
background-color: #CCFF99;
color: #000066;
padding:10px;
}
div.errors ul,
div.warnings ul,
div.explain ul,
div.success ul {
margin-top: 0em;
margin-bottom: 0em;
margin-top: 0em;
margin-bottom: 0em;
}
/* ========= Statistics ========= */
.bug_bg0, .e {
background-color: #DDDDDD;
font-size: 85%;
text-align: center;
background-color: #DDDDDD;
font-size: 85%;
text-align: center;
}
.bug_bg1, .v {
background-color: #EEEEEE;
font-size: 85%;
text-align: center;
background-color: #EEEEEE;
font-size: 85%;
text-align: center;
}
.bug_head, .h {
background-color: #aabbcc;
color: #000000;
font-size: 80%;
font-weight: bold;
text-align: right;
padding: 0em .2em .2em .2em;
background-color: #aabbcc;
color: #000000;
font-size: 80%;
font-weight: bold;
text-align: right;
padding: 0em .2em .2em .2em;
}
tr.bug_header th {
background-color: #aabbcc;
color: #000000;
font-size: 80%;
font-weight: bold;
text-align: center;
padding: 0em .2em .2em .2em;
background-color: #aabbcc;
color: #000000;
font-size: 80%;
font-weight: bold;
text-align: center;
padding: 0em .2em .2em .2em;
}
a.bug_stats {
color: #000000;
color: #000000;
}
a.bug_stats_choosen {
color: #FFFF00;
color: #FFFF00;
}
.bug_bg_selected {
background-color: yellow;
background-color: yellow;
}
.bug_bg_selected a {
color: #006600;
color: #006600;
}
.stats-table tr:hover td {
background-color: #aabbcc;
background-color: #aabbcc;
}
/* ========= Other ========= */
a:link {
color: #000066;
color: #000066;
}
a:visited {
color: #003;
color: #003;
}
a:hover {
color: #000033;
color: #000033;
}
th.others {
color: #006600;
text-align: left;
color: #006600;
text-align: left;
}
td.ulcell {
vertical-align: top;
vertical-align: top;
}
em {
font-weight: bold;
font-style: italic;
font-weight: bold;
font-style: italic;
}
hr {
border: 0px;
height: 1px;
background-color: #ccc;
border: 0px;
height: 1px;
background-color: #ccc;
}
code, pre {
font-family: Consolas, Inconsolata, "Liberation Mono", monospace;
font-size: 13px;
font-family: Consolas, Inconsolata, "Liberation Mono", monospace;
font-size: 13px;
}
pre {
line-height: 1.4;
line-height: 1.4;
}
h1 {
font-size: 140%;
font-weight: bold;
color: #000066;
margin-top: 0em;
font-size: 140%;
font-weight: bold;
color: #000066;
margin-top: 0em;
}
h2 {
font-size: 125%;
font-weight: bold;
color: #000066;
border-bottom: 1px solid #000;
font-size: 125%;
font-weight: bold;
color: #000066;
border-bottom: 1px solid #000;
}
h3 {
font-size: 110%;
font-weight: bold;
color: #000066;
font-size: 110%;
font-weight: bold;
color: #000066;
}
h4 {
font-size: 100%;
font-weight: bold;
color: #000066;
font-size: 100%;
font-weight: bold;
color: #000066;
}
small {
font-size: 85%;
font-size: 85%;
}
a.small {
font-size: 75%;
text-decoration: none;
font-size: 75%;
text-decoration: none;
}
.indent {
margin-left: 20px;
margin-left: 20px;
}
.accesskey {
text-decoration: underline;
text-decoration: underline;
}
ul {
margin-top: 0em;
margin-top: 0em;
}
/* STYLES FOR THE BUG SYSTEM */
div.clear {
clear:both;
clear:both;
}
td.content {
font-size: 1em;
font-size: 1em;
}
td.content table {
font-size: 100%; /* make IE look normal */
font-size: 100%; /* make IE look normal */
padding-bottom: 15px;
}
.headerbottom {
background: #9999cc;
background: #9999cc;
}
.note, .changeset {
width:65em;
margin-left: 10px;
white-space:pre-wrap;
font-size: 13px;
width:65em;
margin-left: 10px;
white-space:pre-wrap;
font-size: 13px;
}
.lusersearch .note {
width:100%;
width:100%;
}
.log_note {
font-family:monospace;
font-size:medium;
font-family:monospace;
font-size:medium;
}
.changeset {
background-color:#eee;
white-space:normal;
padding:5px;
background-color:#eee;
white-space:normal;
padding:5px;
}
.changeset .added {
display:block;
color: #1aa100;
display:block;
color: #1aa100;
}
.changeset .removed {
display:block;
color: #de0019;
display:block;
color: #de0019;
}
input.small, select.small {
font-size: 0.75em;
font-size: 0.75em;
}
textarea.small {
font-size: 0.75em;
font-size: 0.75em;
}
form#comment,
form#update,
form#vote,
div.comment {
clear: both;
clear: both;
padding: 15px 0;
}
@@ -432,240 +432,240 @@ div.comment {
}
table.lusersearch td {
font-size: 0.75em;
font-size: 0.75em;
}
table.lusersearch tr {
vertical-align: top;
vertical-align: top;
}
div.controls {
clear: both;
width: 100%;
clear: both;
width: 100%;
}
div.controls span {
display: block;
float: left;
border: 1px solid #000;
border-top: 0 none;
font-weight: bold;
background: #ddddff;
padding: 4px 8px;
margin-left: 10px;
display: block;
float: left;
border: 1px solid #000;
border-top: 0 none;
font-weight: bold;
background: #ddddff;
padding: 4px 8px;
margin-left: 10px;
}
div.comments span {
cursor:pointer;
font-weight:normal;
cursor:pointer;
font-weight:normal;
}
div#comments_view {
padding-top:10px;
padding-top:10px;
}
div.controls .active {
cursor:auto;
position: relative;
top: -2px;
background: #ffffff;
padding-top: 6px;
cursor:auto;
position: relative;
top: -2px;
background: #ffffff;
padding-top: 6px;
}
div.controls a {
text-decoration: none;
text-decoration: none;
}
div.controls a:hover {
text-decoration: underline;
text-decoration: underline;
}
td#summary {
font-weight: bold;
font-weight: bold;
}
div.details {
margin:5px;
margin:5px;
}
th.details {
vertical-align: top;
text-align: right;
vertical-align: top;
text-align: right;
}
th.results {
background-color: #aaaaaa;
text-align: left;
background-color: #aaaaaa;
text-align: left;
}
table#details td {
vertical-align: top;
vertical-align: top;
}
div#bugheader {
border-bottom: 2px solid #666666;
width: 100%;
border-bottom: 2px solid #666666;
width: 100%;
}
div#bugheader table#details th {
text-align: right;
color: #666666;
text-align: right;
color: #666666;
}
div#bugheader table#details th#number {
color: #000066;
font-size: larger;
color: #000066;
font-size: larger;
}
div#bugheader table#details td#summary {
font-weight: bold;
vertical-align:middle;
font-weight: bold;
vertical-align:middle;
}
.diffheader {
background: #EEEE00;
background: #EEEE00;
}
.newdiff {
background: #FF0000;
background: #FF0000;
}
.olddiff {
background: #AAAAAA;
text-decoration: line-through;
background: #AAAAAA;
text-decoration: line-through;
}
form#vote {
font-size: smaller;
font-size: smaller;
}
form#vote div.sect {
float: left;
float: left;
}
form#vote fieldset {
border: 1px solid #000000;
border: 1px solid #000000;
}
form#vote div#submit {
margin-top: 24px;
margin-left: 10px;
text-align: center;
margin-top: 24px;
margin-left: 10px;
text-align: center;
}
form#asearch th {
text-align: left;
font-weight: bold;
text-align: left;
font-weight: bold;
}
form#asearch table#primary {
font-size: 100%; /* make IE look normal */
background: #eee;
padding: 4px;
font-size: 100%; /* make IE look normal */
background: #eee;
padding: 4px;
}
table#votes {
background-color:#eee;
margin:0 0 0 50px;
background-color:#eee;
margin:0 0 0 50px;
}
/* === Search === */
td.search-prev_next {
background-color: #cccccc;
text-align: center;
padding-bottom: 0.4em;
background-color: #cccccc;
text-align: center;
padding-bottom: 0.4em;
}
td.search-prev_next table {
font-size: 100%; /* make IE look normal */
font-size: 100%; /* make IE look normal */
}
td.search-prev {
text-align: left;
width: 33%;
text-align: left;
width: 33%;
}
td.search-showing {
text-align: center;
width: 34%;
text-align: center;
width: 34%;
}
td.search-next {
text-align: right;
width: 33%;
text-align: right;
width: 33%;
}
.Asn {
background-color: #bbaaff;
background-color: #bbaaff;
}
.Ana {
background-color: #99bbaa;
background-color: #99bbaa;
}
.Nab {
background-color: #aaaaaa;
background-color: #aaaaaa;
}
.Csd {
background-color: #aaffbb;
background-color: #aaffbb;
}
.Ctl {
background-color: #ff0000;
background-color: #ff0000;
}
.Dup {
background-color: #bbbbbb;
background-color: #bbbbbb;
}
.Fbk {
background-color: #bbeeff;
background-color: #bbeeff;
}
.Fre {
background-color: #aaaaaa;
background-color: #aaaaaa;
}
.NoF {
background-color: #bbffcc;
background-color: #bbffcc;
}
.Opn {
background-color: #ffbbaa;
background-color: #ffbbaa;
}
.ReO {
background-color: #ffaabb;
background-color: #ffaabb;
}
.Sus {
background-color: #ffccbb;
background-color: #ffccbb;
}
.Ver {
background-color: #99bbaa;
background-color: #99bbaa;
}
.Wfx {
background-color: #aaaaaa;
background-color: #aaaaaa;
}
.Tbd {
background-color: #cdb26e;
background-color: #cdb26e;
}
.Sec {
background-color: #B5C7CD;
background-color: #B5C7CD;
}
/* {{{ Stolen from https://www.devbridge.com/sourcery/components/jquery-autocomplete/ */
.autocomplete-w1 {
background: url(../images/shadow.png) no-repeat bottom right;
position: absolute;
top: 0px;
left: 0px;
margin: 10px 0 0 6px;
/* IE6 fix: */
_background:none;
_margin:1px 0 0 0;
background: url(../images/shadow.png) no-repeat bottom right;
position: absolute;
top: 0px;
left: 0px;
margin: 10px 0 0 6px;
/* IE6 fix: */
_background:none;
_margin:1px 0 0 0;
}
.autocomplete {
border: 1px solid #999;
background: #FFF;
cursor: default;
text-align: left;
max-height: 350px;
overflow: auto;
margin: -6px 6px 6px -6px;
/* IE6 specific: */
_height:350px;
_margin:0;
_overflow-x:hidden;
border: 1px solid #999;
background: #FFF;
cursor: default;
text-align: left;
max-height: 350px;
overflow: auto;
margin: -6px 6px 6px -6px;
/* IE6 specific: */
_height:350px;
_margin:0;
_overflow-x:hidden;
}
.autocomplete .selected {
background:#F0F0F0;
background:#F0F0F0;
}
.autocomplete div {
padding: 2px 5px;
white-space: nowrap;
padding: 2px 5px;
white-space: nowrap;
}
.autocomplete strong {
font-weight: normal;
color: #3399FF;
font-weight: normal;
color: #3399FF;
}
/* }}} */
@@ -673,11 +673,11 @@ td.search-next {
/* === Admin === */
td.tbl-row-message {
text-align: left;
text-align: left;
}
/* phpinfo() */
div.center {
margin: 0px auto;
width: 80%;
margin: 0px auto;
width: 80%;
}

View File

@@ -10,7 +10,7 @@ require_once '../include/prepend.php';
// If 'id' is passed redirect to the bug page
$id = !empty($_GET['id']) ? (int) $_GET['id'] : 0;
if ($id) {
redirect("bug.php?id={$id}");
redirect("bug.php?id={$id}");
}
// Authenticate

View File

@@ -13,7 +13,7 @@ require_once '../include/prepend.php';
$bug_id = (int) $_REQUEST['id'];
if (!$bug_id) {
redirect('index.php');
redirect('index.php');
}
// Authenticate
@@ -24,17 +24,17 @@ $bugRepository = $container->get(BugRepository::class);
$bug = $bugRepository->findOneById($bug_id);
if (!is_array($bug)) {
response_header('No Such Bug');
display_bug_error("No such bug #{$bug_id}");
response_footer();
exit;
response_header('No Such Bug');
display_bug_error("No such bug #{$bug_id}");
response_footer();
exit;
}
// If bug exists, continue..
$RESOLVE_REASONS = $FIX_VARIATIONS = $errors = [];
if ($logged_in != 'developer') {
$errors[] = 'The username or password you supplied was incorrect.';
$errors[] = 'The username or password you supplied was incorrect.';
}
$project = !empty($_GET['project']) ? $_GET['project'] : false;
@@ -47,128 +47,128 @@ $reason = isset($_REQUEST['r']) ? filter_var($_REQUEST['r'], FILTER_SANITIZE_STR
$ncomment = isset($_POST['ncomment']) ? trim($_POST['ncomment']) : '';
if (!$reason || !isset($RESOLVE_REASONS[$reason])) {
$errors[] = 'You have to use a valid reason to resolve this bug.';
$errors[] = 'You have to use a valid reason to resolve this bug.';
}
if (isset($RESOLVE_REASONS[$reason]) && $RESOLVE_REASONS[$reason]['status'] == 'Not a bug' && $ncomment == '') {
$errors[] = 'You must provide a comment when marking a bug \'Not a bug\'';
$errors[] = 'You must provide a comment when marking a bug \'Not a bug\'';
}
// Handle errors
if ($errors) {
response_header('Error in resolving bug');
display_bug_error($errors);
response_header('Error in resolving bug');
display_bug_error($errors);
?>
<form method="post" action="fix.php">
<input type="hidden" name="id" value="<?php echo $bug_id; ?>">
<input type="hidden" name="id" value="<?php echo $bug_id; ?>">
<?php // Note: same block is used also in bug.php!
if ($logged_in == 'developer') {
?>
<div class="explain">
Welcome back, <?php echo $user; ?>! (Not <?php echo $user; ?>?
<a href="logout.php">Log out.</a>)
</div>
<div class="explain">
Welcome back, <?php echo $user; ?>! (Not <?php echo $user; ?>?
<a href="logout.php">Log out.</a>)
</div>
<?php } else { ?>
<div class="explain">
Welcome! If you don't have a Git account, you can't do anything here.<br>
You can <a href="bug.php?id=<?php echo $bug_id; ?>&amp;edit=3">add a comment by following this link</a>
or if you reported this bug, you can <a href="bug.php?id=<?php echo $bug_id; ?>&amp;edit=2">edit this bug over here</a>.
<div class="details">
<label for="svnuser">php.net Username:</label>
<input type="text" id="svnuser" name="user" value="<?php echo htmlspecialchars($user) ?>" size="10" maxlength="20">
<label for="svnpw">php.net Password:</label>
<input type="password" id="svnpw" name="pw" value="<?php echo htmlspecialchars($pw) ?>" size="10">
<label for="save">Remember:</label><input style="vertical-align:middle;" type="checkbox" id="save" name="save" <?php echo !empty($_POST['save']) ? 'checked="checked"' : ''; ?>>
</div>
</div>
<div class="explain">
Welcome! If you don't have a Git account, you can't do anything here.<br>
You can <a href="bug.php?id=<?php echo $bug_id; ?>&amp;edit=3">add a comment by following this link</a>
or if you reported this bug, you can <a href="bug.php?id=<?php echo $bug_id; ?>&amp;edit=2">edit this bug over here</a>.
<div class="details">
<label for="svnuser">php.net Username:</label>
<input type="text" id="svnuser" name="user" value="<?php echo htmlspecialchars($user) ?>" size="10" maxlength="20">
<label for="svnpw">php.net Password:</label>
<input type="password" id="svnpw" name="pw" value="<?php echo htmlspecialchars($pw) ?>" size="10">
<label for="save">Remember:</label><input style="vertical-align:middle;" type="checkbox" id="save" name="save" <?php echo !empty($_POST['save']) ? 'checked="checked"' : ''; ?>>
</div>
</div>
<?php } ?>
<table>
<tr>
<th><a href="quick-fix-desc.php">Reason:</a></th>
<td colspan="5">
<select name="r">
<?php echo show_reason_types($reason); ?>
</select>
</td>
</tr>
<tr>
<th>Note:</th>
<td colspan="5"><textarea cols="80" rows="8" name="ncomment" wrap="physical"><?php echo htmlspecialchars($ncomment); ?></textarea></td>
</tr>
</table>
<input type="submit" value="Resolve">
<table>
<tr>
<th><a href="quick-fix-desc.php">Reason:</a></th>
<td colspan="5">
<select name="r">
<?php echo show_reason_types($reason); ?>
</select>
</td>
</tr>
<tr>
<th>Note:</th>
<td colspan="5"><textarea cols="80" rows="8" name="ncomment" wrap="physical"><?php echo htmlspecialchars($ncomment); ?></textarea></td>
</tr>
</table>
<input type="submit" value="Resolve">
</form>
<?php
response_footer();
exit;
response_footer();
exit;
}
// Update bug
$status = $RESOLVE_REASONS[$reason]['status'];
if (isset($FIX_VARIATIONS[$reason][$bug['bug_type']])) {
$qftext = $FIX_VARIATIONS[$reason][$bug['bug_type']];
$qftext = $FIX_VARIATIONS[$reason][$bug['bug_type']];
} else {
$qftext = $RESOLVE_REASONS[$reason]['message'];
$qftext = $RESOLVE_REASONS[$reason]['message'];
}
$ncomment = $qftext . (!empty($ncomment) ? "\n\n".$ncomment : "");
// If the report already has the status of the resolution, bounce over to the main bug form
// which shows the appropriate error message.
if ($status == $bug['status']) {
redirect("bug.php?id={$bug_id}&edit=1&in[resolve]={$reason}");
redirect("bug.php?id={$bug_id}&edit=1&in[resolve]={$reason}");
}
// Standard items
$in = [
'status' => $status,
'bug_type' => $bug['bug_type'],
'php_version' => $bug['php_version'],
'php_os' => $bug['php_os'],
'assign' => $bug['assign'],
'status' => $status,
'bug_type' => $bug['bug_type'],
'php_version' => $bug['php_version'],
'php_os' => $bug['php_os'],
'assign' => $bug['assign'],
];
// Assign automatically when closed
if ($status == 'Closed' && $in['assign'] == '') {
$in['assign'] = $auth_user->handle;
$in['assign'] = $auth_user->handle;
}
try {
// Update bug
$dbh->prepare("
UPDATE bugdb
SET
status = ?,
assign = ?,
ts2 = NOW()
WHERE id = ?
")->execute([
$status,
$in['assign'],
$bug_id,
]);
// Update bug
$dbh->prepare("
UPDATE bugdb
SET
status = ?,
assign = ?,
ts2 = NOW()
WHERE id = ?
")->execute([
$status,
$in['assign'],
$bug_id,
]);
// Add changelog entry
$changed = bug_diff($bug, $in);
if (!empty($changed)) {
$log_comment = bug_diff_render_html($changed);
if (!empty($log_comment)) {
$result = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $log_comment, 'log');
}
}
// Add changelog entry
$changed = bug_diff($bug, $in);
if (!empty($changed)) {
$log_comment = bug_diff_render_html($changed);
if (!empty($log_comment)) {
$result = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $log_comment, 'log');
}
}
// Add possible comment
if (!empty($ncomment)) {
$result = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $ncomment, 'comment');
}
// Add possible comment
if (!empty($ncomment)) {
$result = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $ncomment, 'comment');
}
// Send emails
mail_bug_updates($bug, $in, $auth_user->email, $ncomment);
redirect("bug.php?id={$bug_id}&thanks=1");
// Send emails
mail_bug_updates($bug, $in, $auth_user->email, $ncomment);
redirect("bug.php?id={$bug_id}&thanks=1");
} catch (\Exception $e) {
// If we end up here, something went wrong.
response_header('Resolve Bug: Problem');
display_bug_error($e->getMessage());
response_footer();
// If we end up here, something went wrong.
response_header('Resolve Bug: Problem');
display_bug_error($e->getMessage());
response_footer();
}

View File

@@ -1,108 +1,108 @@
'use strict';
window.addEventListener(
'load',
function () {
document
.querySelectorAll('select[name="in[package_name]"]')
.forEach(
function (select) {
var packageGroup = document.createElement('select'),
initialValue = select.value,
initialGroup = select.querySelector(':scope option[value="' + initialValue + '"]').parentNode;
'load',
function () {
document
.querySelectorAll('select[name="in[package_name]"]')
.forEach(
function (select) {
var packageGroup = document.createElement('select'),
initialValue = select.value,
initialGroup = select.querySelector(':scope option[value="' + initialValue + '"]').parentNode;
packageGroup.name = 'in[package_group]';
packageGroup.name = 'in[package_group]';
select
.querySelectorAll(':scope optgroup')
.forEach(
function (optgroup) {
var packageOption = document.createElement('option'),
groupName = optgroup.label;
select
.querySelectorAll(':scope optgroup')
.forEach(
function (optgroup) {
var packageOption = document.createElement('option'),
groupName = optgroup.label;
packageOption.textContent = groupName;
packageOption.value = groupName;
packageGroup.appendChild(packageOption);
packageOption.textContent = groupName;
packageOption.value = groupName;
packageGroup.appendChild(packageOption);
optgroup
.querySelectorAll(':scope option')
.forEach(
function (option) {
option.setAttribute('bug-group', groupName);
}
);
}
);
optgroup
.querySelectorAll(':scope option')
.forEach(
function (option) {
option.setAttribute('bug-group', groupName);
}
);
}
);
var instructions = select.querySelector(':scope option[value="none"]');
if (instructions instanceof HTMLElement) {
instructions.textContent = 'Select a category';
}
var instructions = select.querySelector(':scope option[value="none"]');
if (instructions instanceof HTMLElement) {
instructions.textContent = 'Select a category';
}
select
.querySelectorAll(':scope optgroup')
.forEach(
function (optgroup) {
optgroup.style.display = 'none';
}
);
select
.querySelectorAll(':scope optgroup')
.forEach(
function (optgroup) {
optgroup.style.display = 'none';
}
);
function updateGroup() {
select.disabled = false;
function updateGroup() {
select.disabled = false;
if (instructions instanceof HTMLElement) {
instructions.style.display = 'none';
}
if (instructions instanceof HTMLElement) {
instructions.style.display = 'none';
}
var previousOptions = select.querySelectorAll(':scope > option:not([value=none])'),
nextLabel = packageGroup.value,
nextGroup = select.querySelector(':scope optgroup[label="' + nextLabel + '"]');
var previousOptions = select.querySelectorAll(':scope > option:not([value=none])'),
nextLabel = packageGroup.value,
nextGroup = select.querySelector(':scope optgroup[label="' + nextLabel + '"]');
if (previousOptions.length !== 0) {
var previousLabel = previousOptions[0].getAttribute('bug-group'),
previousGroup = select.querySelector(':scope optgroup[label="' + previousLabel + '"]');
if (previousOptions.length !== 0) {
var previousLabel = previousOptions[0].getAttribute('bug-group'),
previousGroup = select.querySelector(':scope optgroup[label="' + previousLabel + '"]');
moveOptions(select, previousGroup);
}
moveOptions(select, previousGroup);
}
moveOptions(nextGroup, select);
moveOptions(nextGroup, select);
select.selectedIndex = -1;
}
select.selectedIndex = -1;
}
function moveOptions(from, to) {
from.querySelectorAll(':scope > option')
.forEach(
function (option) {
to.appendChild(option);
}
);
}
function moveOptions(from, to) {
from.querySelectorAll(':scope > option')
.forEach(
function (option) {
to.appendChild(option);
}
);
}
packageGroup.addEventListener('click', updateGroup);
packageGroup.addEventListener('change', updateGroup);
packageGroup.addEventListener('click', updateGroup);
packageGroup.addEventListener('change', updateGroup);
if (initialGroup instanceof HTMLOptGroupElement) {
packageGroup.value = initialGroup.label;
moveOptions(initialGroup, select);
} else {
select.disabled = true;
select.value = null;
packageGroup.selectedIndex = -1;
}
if (initialGroup instanceof HTMLOptGroupElement) {
packageGroup.value = initialGroup.label;
moveOptions(initialGroup, select);
} else {
select.disabled = true;
select.value = null;
packageGroup.selectedIndex = -1;
}
packageGroup.style.marginRight = '.5em';
[select, packageGroup].forEach(
function (element) {
element.size = 12;
element.style.width = '22em';
}
);
packageGroup.style.marginRight = '.5em';
[select, packageGroup].forEach(
function (element) {
element.size = 12;
element.style.width = '22em';
}
);
select
.parentNode
.insertBefore(packageGroup, select);
}
);
}
select
.parentNode
.insertBefore(packageGroup, select);
}
);
}
);

View File

@@ -1,17 +1,17 @@
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
var fnFormatSearchResult = function(value, data, currentValue) {
var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
var listing = users[value]["name"] + " (" + users[value]["username"] + ")";
var pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
var listing = users[value]["name"] + " (" + users[value]["username"] + ")";
listing = listing.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
return '<img src="https://secure.gravatar.com/avatar/' + users[value]["email"] + '.jpg?s=25"> ' + listing;
listing = listing.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
return '<img src="https://secure.gravatar.com/avatar/' + users[value]["email"] + '.jpg?s=25"> ' + listing;
};
$('#assigned_user').autocomplete({
minChars:2,
maxHeight:400,
width:300,
fnFormatResult: fnFormatSearchResult,
onSelect: function(value, data){ $('#assigned_user').val(users[value]["username"]); },
lookup: lookup
minChars:2,
maxHeight:400,
width:300,
fnFormatResult: fnFormatSearchResult,
onSelect: function(value, data){ $('#assigned_user').val(users[value]["username"]); },
lookup: lookup
});

View File

@@ -5,64 +5,64 @@ ini_set('zlib.output_compression', 1);
function getAllUsers()
{
$opts = ['ignore_errors' => true];
$ctx = stream_context_create(['http' => $opts]);
$token = getenv('USER_TOKEN');
$opts = ['ignore_errors' => true];
$ctx = stream_context_create(['http' => $opts]);
$token = getenv('USER_TOKEN');
$retval = @file_get_contents('https://master.php.net/fetch/allusers.php?&token=' . rawurlencode($token), false, $ctx);
$retval = @file_get_contents('https://master.php.net/fetch/allusers.php?&token=' . rawurlencode($token), false, $ctx);
if (!$retval) {
return;
}
if (!$retval) {
return;
}
$json = json_decode($retval, true);
$json = json_decode($retval, true);
if (!is_array($json)) {
return;
}
if (!is_array($json)) {
return;
}
if (isset($json['error'])) {
return;
}
return $json;
if (isset($json['error'])) {
return;
}
return $json;
}
if (!file_exists("/tmp/svnusers.json") || filemtime("/tmp/svnusers.json") < $_SERVER["REQUEST_TIME"] - 3600) {
$json = getAllUsers();
$json_data = var_export($json, true);
file_put_contents("/tmp/svnusers.php", '<?php $json = '.$json_data.';');
$modified = time();
$json = getAllUsers();
$json_data = var_export($json, true);
file_put_contents("/tmp/svnusers.php", '<?php $json = '.$json_data.';');
$modified = time();
} else {
include "/tmp/svnusers.php";
$modified = filemtime("/tmp/svnusers.php");
include "/tmp/svnusers.php";
$modified = filemtime("/tmp/svnusers.php");
}
$tsstring = gmdate('D, d M Y H:i:s ', $modified);
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $tsstring) {
header('HTTP/1.1 304 Not Modified');
exit;
header('HTTP/1.1 304 Not Modified');
exit;
} else {
$expires = gmdate('D, d M Y H:i:s ', strtotime('+2 months', $_SERVER['REQUEST_TIME'])) . 'GMT';
header("Last-Modified: {$tsstring}");
header("Expires: {$expires}");
$expires = gmdate('D, d M Y H:i:s ', strtotime('+2 months', $_SERVER['REQUEST_TIME'])) . 'GMT';
header("Last-Modified: {$tsstring}");
header("Expires: {$expires}");
}
$lookup = $user = [];
if ($json) {
foreach ($json as $row) {
$lookup[] = $row['name'];
$lookup[] = $row["username"];
foreach ($json as $row) {
$lookup[] = $row['name'];
$lookup[] = $row["username"];
$data = [
'email' => md5($row['username'] . '@php.net'),
'name' => $row['name'],
'username' => $row['username'],
];
$user[$row["username"]] = $data;
$user[$row["name"]] = $data;
}
$data = [
'email' => md5($row['username'] . '@php.net'),
'name' => $row['name'],
'username' => $row['username'],
];
$user[$row["username"]] = $data;
$user[$row["name"]] = $data;
}
}
echo 'var users = ', json_encode($user), ";\n",
'var lookup = ', json_encode($lookup), ";\n";
'var lookup = ', json_encode($lookup), ";\n";

View File

@@ -1,10 +1,10 @@
function show(layer)
{
var l = document.getElementById(layer);
var l = document.getElementById(layer);
l.style.display = "block";
}
function hide(layer)
{
var l = document.getElementById(layer);
l.style.display = "none";
var l = document.getElementById(layer);
l.style.display = "none";
}

View File

@@ -16,11 +16,11 @@ if (isset($_POST['user'])) {
bugs_authenticate($user, $pwd, $logged_in, $user_flags);
if ($logged_in === 'developer') {
if (!empty($_POST['referer']) &&
preg_match("/^{$site_method}:\/\/". preg_quote($site_url) .'/i', $referer) &&
parse_url($referer, PHP_URL_PATH) != '/logout.php') {
redirect($referer);
}
if (!empty($_POST['referer']) &&
preg_match("/^{$site_method}:\/\/". preg_quote($site_url) .'/i', $referer) &&
parse_url($referer, PHP_URL_PATH) != '/logout.php') {
redirect($referer);
}
redirect('index.php');
} else {
?>
@@ -28,7 +28,7 @@ if (isset($_POST['user'])) {
<?php
}
} else {
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
}
?>

View File

@@ -6,69 +6,69 @@ require '../include/prepend.php';
function status_print ($status, $num, $width, $align = STR_PAD_LEFT)
{
echo ucfirst($status), ':', str_pad($num, $width - strlen($status), ' ', $align), "\n\n";
echo ucfirst($status), ':', str_pad($num, $width - strlen($status), ' ', $align), "\n\n";
}
function get_status_count ($status, $category = '')
{
global $phpver, $dbh;
global $phpver, $dbh;
$query = "SELECT count(id) from bugdb WHERE";
$query = "SELECT count(id) from bugdb WHERE";
if ($phpver > 0) {
$query .= " php_version LIKE '{$phpver}%' AND";
}
if ($phpver > 0) {
$query .= " php_version LIKE '{$phpver}%' AND";
}
/* Categories which are excluded from bug count */
$excluded = "'Feature/Change Request', 'Systems problem', 'Website Problem', 'PEAR related', 'PECL related', 'Documentation problem', 'Translation problem', 'PHP-GTK related', 'Online Doc Editor problem'";
/* Categories which are excluded from bug count */
$excluded = "'Feature/Change Request', 'Systems problem', 'Website Problem', 'PEAR related', 'PECL related', 'Documentation problem', 'Translation problem', 'PHP-GTK related', 'Online Doc Editor problem'";
if ($category != '') {
$query.= " {$status} AND bug_type = 'Bug' AND package_name = " . $dbh->quote($category);
} else {
$query.= " status='{$status}' ";
}
$query.= "AND bug_type NOT IN({$excluded})";
if ($category != '') {
$query.= " {$status} AND bug_type = 'Bug' AND package_name = " . $dbh->quote($category);
} else {
$query.= " status='{$status}' ";
}
$query.= "AND bug_type NOT IN({$excluded})";
$res = $dbh->prepare($query)->execute([]);
$row = $res->fetch(\PDO::FETCH_NUM);
$res = $dbh->prepare($query)->execute([]);
$row = $res->fetch(\PDO::FETCH_NUM);
return $row[0];
return $row[0];
}
// Input
$phpver = (isset($_GET['phpver']) ? (int) $_GET['phpver'] : false);
if (!$phpver || ($phpver !== 5 && $phpver !== 7)) {
echo "<h3>Bug stats for both <a href='lstats.php?phpver=5'>PHP 5</a> and <a href='lstats.php?phpver=7'>PHP 7</a>:</h3>\n<pre>\n";
echo "<h3>Bug stats for both <a href='lstats.php?phpver=5'>PHP 5</a> and <a href='lstats.php?phpver=7'>PHP 7</a>:</h3>\n<pre>\n";
} else {
echo "<h3>Bug stats for PHP $phpver:</h3>\n<pre>\n";
echo "<h3>Bug stats for PHP $phpver:</h3>\n<pre>\n";
}
if (isset($_GET['per_category']))
{
$packageRepository = $container->get(PackageRepository::class);
$pseudo_pkgs = $packageRepository->findAll($_GET['project'] ?? '');
$packageRepository = $container->get(PackageRepository::class);
$pseudo_pkgs = $packageRepository->findAll($_GET['project'] ?? '');
$totals = [];
foreach ($pseudo_pkgs as $category => $data) {
$count = get_status_count ("status NOT IN('to be documented', 'closed', 'not a bug', 'duplicate', 'wont fix', 'no feedback')", $category);
if ($count > 0) {
$totals[$category] = $count;
}
}
arsort($totals);
foreach ($totals as $category => $total) {
status_print($category, $total, 40);
}
$totals = [];
foreach ($pseudo_pkgs as $category => $data) {
$count = get_status_count ("status NOT IN('to be documented', 'closed', 'not a bug', 'duplicate', 'wont fix', 'no feedback')", $category);
if ($count > 0) {
$totals[$category] = $count;
}
}
arsort($totals);
foreach ($totals as $category => $total) {
status_print($category, $total, 40);
}
} else {
foreach ($tla as $status => $short) {
if (!in_array($status, ['Duplicate'])) {
$count = get_status_count ($status);
status_print($status, $count, 30);
}
}
foreach ($tla as $status => $short) {
if (!in_array($status, ['Duplicate'])) {
$count = get_status_count ($status);
status_print($status, $count, 30);
}
}
}

View File

@@ -19,108 +19,108 @@ $patchTracker = $container->get(PatchTracker::class);
bugs_authenticate($user, $pw, $logged_in, $user_flags);
if (!isset($_GET['bug_id']) && !isset($_GET['bug'])) {
response_header('Error :: no bug selected');
display_bug_error('No patch selected to view');
response_footer();
exit;
response_header('Error :: no bug selected');
display_bug_error('No patch selected to view');
response_footer();
exit;
}
$canpatch = ($logged_in == 'developer');
$revision = isset($_GET['revision']) ? $_GET['revision'] : null;
$patch_name = isset($_GET['patch']) ? $_GET['patch'] : null;
$patch_name = isset($_GET['patch']) ? $_GET['patch'] : null;
if ($patch_name) {
$patch_name_url = urlencode($patch_name);
$patch_name_url = urlencode($patch_name);
}
$bug_id = !empty($_GET['bug']) ? (int) $_GET['bug'] : 0;
if (empty($bug_id)) {
$bug_id = (int) $_GET['bug_id'];
$bug_id = (int) $_GET['bug_id'];
}
$bugRepository = $container->get(BugRepository::class);
if (!($buginfo = $bugRepository->findOneById($bug_id))) {
response_header('Error :: invalid bug selected');
display_bug_error("Invalid bug #{$bug_id} selected");
response_footer();
exit;
response_header('Error :: invalid bug selected');
display_bug_error("Invalid bug #{$bug_id} selected");
response_footer();
exit;
}
if (!bugs_has_access($bug_id, $buginfo, $pw, $user_flags)) {
response_header('Error :: No access to bug selected');
display_bug_error("You have no access to bug #{$bug_id}");
response_footer();
exit;
response_header('Error :: No access to bug selected');
display_bug_error("You have no access to bug #{$bug_id}");
response_footer();
exit;
}
if (isset($patch_name) && isset($revision)) {
if ($revision == 'latest') {
$revisions = $patchRepository->findRevisions($buginfo['id'], $patch_name);
if (isset($revisions[0])) {
$revision = $revisions[0]['revision'];
}
}
if ($revision == 'latest') {
$revisions = $patchRepository->findRevisions($buginfo['id'], $patch_name);
if (isset($revisions[0])) {
$revision = $revisions[0]['revision'];
}
}
$path = $patchTracker->getPatchFullpath($bug_id, $patch_name, $revision);
if (!file_exists($path)) {
response_header('Error :: no such patch/revision');
display_bug_error('Invalid patch/revision specified');
response_footer();
exit;
}
$path = $patchTracker->getPatchFullpath($bug_id, $patch_name, $revision);
if (!file_exists($path)) {
response_header('Error :: no such patch/revision');
display_bug_error('Invalid patch/revision specified');
response_footer();
exit;
}
if (isset($_GET['download'])) {
header('Last-modified: ' . gmdate('l, d-M-y H:i:s \G\M\T', filemtime($path)));
header('Content-type: application/octet-stream');
header('Content-disposition: attachment; filename="' . $patch_name . '.patch.txt"');
header('Content-length: '.filesize($path));
readfile($path);
exit;
}
if (isset($_GET['download'])) {
header('Last-modified: ' . gmdate('l, d-M-y H:i:s \G\M\T', filemtime($path)));
header('Content-type: application/octet-stream');
header('Content-disposition: attachment; filename="' . $patch_name . '.patch.txt"');
header('Content-length: '.filesize($path));
readfile($path);
exit;
}
try {
$patchcontents = $patchRepository->getPatchContents($buginfo['id'], $patch_name, $revision);
} catch (\Exception $e) {
response_header('Error :: Cannot retrieve patch');
display_bug_error('Internal error: Invalid patch/revision specified (is in database, but not in filesystem)');
response_footer();
exit;
}
try {
$patchcontents = $patchRepository->getPatchContents($buginfo['id'], $patch_name, $revision);
} catch (\Exception $e) {
response_header('Error :: Cannot retrieve patch');
display_bug_error('Internal error: Invalid patch/revision specified (is in database, but not in filesystem)');
response_footer();
exit;
}
$package_name = $buginfo['package_name'];
$handle = $patchRepository->findDeveloper($bug_id, $patch_name, $revision);
$obsoletedby = $obsoletePatchRepository->findObsoletingPatches($bug_id, $patch_name, $revision);
$obsoletes = $obsoletePatchRepository->findObsoletePatches($bug_id, $patch_name, $revision);
$patches = $patchRepository->findAllByBugId($bug_id);
$revisions = $patchRepository->findRevisions($bug_id, $patch_name);
$package_name = $buginfo['package_name'];
$handle = $patchRepository->findDeveloper($bug_id, $patch_name, $revision);
$obsoletedby = $obsoletePatchRepository->findObsoletingPatches($bug_id, $patch_name, $revision);
$obsoletes = $obsoletePatchRepository->findObsoletePatches($bug_id, $patch_name, $revision);
$patches = $patchRepository->findAllByBugId($bug_id);
$revisions = $patchRepository->findRevisions($bug_id, $patch_name);
response_header("Bug #{$bug_id} :: Patches");
include "{$ROOT_DIR}/templates/listpatches.php";
response_header("Bug #{$bug_id} :: Patches");
include "{$ROOT_DIR}/templates/listpatches.php";
if (isset($_GET['diff']) && $_GET['diff'] && isset($_GET['old']) && is_numeric($_GET['old'])) {
$old = $patchTracker->getPatchFullpath($bug_id, $patch_name, $_GET['old']);
$new = $path;
if (!realpath($old) || !realpath($new)) {
response_header('Error :: Cannot retrieve patch');
display_bug_error('Internal error: Invalid patch revision specified for diff');
response_footer();
exit;
}
if (isset($_GET['diff']) && $_GET['diff'] && isset($_GET['old']) && is_numeric($_GET['old'])) {
$old = $patchTracker->getPatchFullpath($bug_id, $patch_name, $_GET['old']);
$new = $path;
if (!realpath($old) || !realpath($new)) {
response_header('Error :: Cannot retrieve patch');
display_bug_error('Internal error: Invalid patch revision specified for diff');
response_footer();
exit;
}
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_WARNING, 0);
$d = new \Horde_Text_Diff('auto', [file($old), file($new)]);
$diff = new Diff($d);
$d = new \Horde_Text_Diff('auto', [file($old), file($new)]);
$diff = new Diff($d);
include "{$ROOT_DIR}/templates/patchdiff.php";
include "{$ROOT_DIR}/templates/patchdiff.php";
response_footer();
exit;
}
include "{$ROOT_DIR}/templates/patchdisplay.php";
response_footer();
exit;
response_footer();
exit;
}
include "{$ROOT_DIR}/templates/patchdisplay.php";
response_footer();
exit;
}
$patches = $patchTracker->listPatches($bug_id);

View File

@@ -20,26 +20,26 @@ response_header('Quick Fix Descriptions');
<?php
foreach ($RESOLVE_REASONS as $key => $reason) {
if (!empty($reason['package_name']))
$reason['title'] = "{$reason['title']} ({$reason['package_name']})";
if (!empty($reason['package_name']))
$reason['title'] = "{$reason['title']} ({$reason['package_name']})";
echo "
<tr>
<td>{$reason['title']}</td>
<td>Status: {$reason['status']}</td>
<td><pre>{$reason['message']}</pre></td>
</tr>
";
echo "
<tr>
<td>{$reason['title']}</td>
<td>Status: {$reason['status']}</td>
<td><pre>{$reason['message']}</pre></td>
</tr>
";
if (isset($FIX_VARIATIONS[$key])) {
foreach ($FIX_VARIATIONS[$key] as $type => $variation) {
echo "
<tr>
<td>{$reason['title']} ({$type})</td>
<td>Status: {$reason['status']}</td>
<td><pre>{$variation}</pre></td>
</tr>";
}
}
foreach ($FIX_VARIATIONS[$key] as $type => $variation) {
echo "
<tr>
<td>{$reason['title']} ({$type})</td>
<td>Status: {$reason['status']}</td>
<td><pre>{$variation}</pre></td>
</tr>";
}
}
}
?>
</table>

View File

@@ -32,223 +32,223 @@ $versions = $versionsGenerator->getVersions();
// captcha is not necessary if the user is logged in
if (!$logged_in) {
$captcha = $container->get(Captcha::class);
$captcha = $container->get(Captcha::class);
}
$packageAffectedScript = <<<SCRIPT
<script src="$site_method://$site_url$basedir/js/package-affected.js"></script>
<script src="$site_method://$site_url$basedir/js/package-affected.js"></script>
SCRIPT;
// Handle input
if (isset($_POST['in'])) {
$errors = incoming_details_are_valid($_POST['in'], 1, $logged_in);
$errors = incoming_details_are_valid($_POST['in'], 1, $logged_in);
// Check if session answer is set, then compare it with the post captcha value.
// If it's not the same, then it's an incorrect password.
if (!$logged_in) {
if (!isset($_SESSION['answer'])) {
$errors[] = 'Please enable cookies so the Captcha system can work';
} elseif ($_POST['captcha'] != $_SESSION['answer']) {
$errors[] = 'Incorrect Captcha';
}
if (is_spam($_POST['in']['ldesc']) ||
is_spam($_POST['in']['expres']) ||
is_spam($_POST['in']['repcode'])) {
$errors[] = 'Spam detected';
}
}
// Check if session answer is set, then compare it with the post captcha value.
// If it's not the same, then it's an incorrect password.
if (!$logged_in) {
if (!isset($_SESSION['answer'])) {
$errors[] = 'Please enable cookies so the Captcha system can work';
} elseif ($_POST['captcha'] != $_SESSION['answer']) {
$errors[] = 'Incorrect Captcha';
}
if (is_spam($_POST['in']['ldesc']) ||
is_spam($_POST['in']['expres']) ||
is_spam($_POST['in']['repcode'])) {
$errors[] = 'Spam detected';
}
}
// Set auto-generated password when not supplied or logged in
if ($logged_in || $_POST['in']['passwd'] == '') {
$_POST['in']['passwd'] = uniqid();
}
// Set auto-generated password when not supplied or logged in
if ($logged_in || $_POST['in']['passwd'] == '') {
$_POST['in']['passwd'] = uniqid();
}
// try to verify the user
$_POST['in']['email'] = $auth_user->email;
// try to verify the user
$_POST['in']['email'] = $auth_user->email;
$package_name = $_POST['in']['package_name'];
$package_name = $_POST['in']['package_name'];
if (!$errors) {
// When user submits a report, do a search and display the results before allowing them to continue.
if (!isset($_POST['preview']) && empty($_POST['in']['did_luser_search'])) {
if (!$errors) {
// When user submits a report, do a search and display the results before allowing them to continue.
if (!isset($_POST['preview']) && empty($_POST['in']['did_luser_search'])) {
$_POST['in']['did_luser_search'] = 1;
$_POST['in']['did_luser_search'] = 1;
$where_clause = "WHERE package_name != 'Feature/Change Request'";
$where_clause = "WHERE package_name != 'Feature/Change Request'";
if (!($user_flags & BUGS_SECURITY_DEV)) {
$where_clause .= " AND private = 'N' ";
}
if (!($user_flags & BUGS_SECURITY_DEV)) {
$where_clause .= " AND private = 'N' ";
}
// search for a match using keywords from the subject
list($sql_search, $ignored) = format_search_string($_POST['in']['sdesc']);
// search for a match using keywords from the subject
list($sql_search, $ignored) = format_search_string($_POST['in']['sdesc']);
$where_clause .= $sql_search;
$where_clause .= $sql_search;
$query = "SELECT * from bugdb $where_clause LIMIT 5";
$query = "SELECT * from bugdb $where_clause LIMIT 5";
$possible_duplicates = $dbh->prepare($query)->execute()->fetchAll();
$possible_duplicates = $dbh->prepare($query)->execute()->fetchAll();
if (!$possible_duplicates) {
$ok_to_submit_report = true;
} else {
response_header("Report - Confirm", $packageAffectedScript);
if (count($_FILES)) {
echo '<h1>WARNING: YOU MUST RE-UPLOAD YOUR PATCH, OR IT WILL BE IGNORED</h1>';
}
if (!$possible_duplicates) {
$ok_to_submit_report = true;
} else {
response_header("Report - Confirm", $packageAffectedScript);
if (count($_FILES)) {
echo '<h1>WARNING: YOU MUST RE-UPLOAD YOUR PATCH, OR IT WILL BE IGNORED</h1>';
}
?>
<p>
Are you sure that you searched before you submitted your bug report? We
found the following bugs that seem to be similar to yours; please check
them before submitting the report as they might contain the solution you
are looking for.
</p>
<p>
Are you sure that you searched before you submitted your bug report? We
found the following bugs that seem to be similar to yours; please check
them before submitting the report as they might contain the solution you
are looking for.
</p>
<p>
If you're sure that your report is a genuine bug that has not been reported
before, you can scroll down and click the "Send Bug Report" button again to
really enter the details into our database.
</p>
<p>
If you're sure that your report is a genuine bug that has not been reported
before, you can scroll down and click the "Send Bug Report" button again to
really enter the details into our database.
</p>
<div class="warnings">
<table class="lusersearch">
<tr>
<th>Description</th>
<th>Possible Solution</th>
</tr>
<div class="warnings">
<table class="lusersearch">
<tr>
<th>Description</th>
<th>Possible Solution</th>
</tr>
<?php
foreach ($possible_duplicates as $row) {
$resolution = $dbh->prepare("
SELECT comment
FROM bugdb_comments
WHERE bug = ?
ORDER BY id DESC
LIMIT 1
")->execute([$row['id']])->fetch(\PDO::FETCH_NUM)[0];
foreach ($possible_duplicates as $row) {
$resolution = $dbh->prepare("
SELECT comment
FROM bugdb_comments
WHERE bug = ?
ORDER BY id DESC
LIMIT 1
")->execute([$row['id']])->fetch(\PDO::FETCH_NUM)[0];
$summary = $row['ldesc'];
if (strlen($summary) > 256) {
$summary = substr(trim($summary), 0, 256) . ' ...';
}
$summary = $row['ldesc'];
if (strlen($summary) > 256) {
$summary = substr(trim($summary), 0, 256) . ' ...';
}
$bug_url = "bug.php?id={$row['id']}";
$bug_url = "bug.php?id={$row['id']}";
$sdesc = htmlspecialchars($row['sdesc']);
$summary = htmlspecialchars($summary);
$resolution = htmlspecialchars($resolution);
$sdesc = htmlspecialchars($row['sdesc']);
$summary = htmlspecialchars($summary);
$resolution = htmlspecialchars($resolution);
echo <<< OUTPUT
<tr>
<td colspan='2'><strong>{$row['package_name']}</strong> : <a href='{$bug_url}'>Bug #{$row['id']}: {$sdesc}</a></td>
</tr>
<tr>
<td><pre class='note'>{$summary}</pre></td>
<td><pre class='note'>{$resolution}</pre></td>
</tr>
echo <<< OUTPUT
<tr>
<td colspan='2'><strong>{$row['package_name']}</strong> : <a href='{$bug_url}'>Bug #{$row['id']}: {$sdesc}</a></td>
</tr>
<tr>
<td><pre class='note'>{$summary}</pre></td>
<td><pre class='note'>{$resolution}</pre></td>
</tr>
OUTPUT;
}
}
echo "
</table>
</div>
";
}
} else {
// We displayed the luser search and they said it really was not already submitted, so let's allow them to submit.
$ok_to_submit_report = true;
}
echo "
</table>
</div>
";
}
} else {
// We displayed the luser search and they said it really was not already submitted, so let's allow them to submit.
$ok_to_submit_report = true;
}
if (isset($_POST['edit_after_preview'])) {
$ok_to_submit_report = false;
response_header("Report - New", $packageAffectedScript);
}
if (isset($_POST['edit_after_preview'])) {
$ok_to_submit_report = false;
response_header("Report - New", $packageAffectedScript);
}
if ($ok_to_submit_report) {
$_POST['in']['reporter_name'] = $auth_user->name;
$_POST['in']['handle'] = $auth_user->handle;
if ($ok_to_submit_report) {
$_POST['in']['reporter_name'] = $auth_user->name;
$_POST['in']['handle'] = $auth_user->handle;
// Put all text areas together.
$fdesc = "Description:\n------------\n" . $_POST['in']['ldesc'] . "\n\n";
if (!empty($_POST['in']['repcode'])) {
$fdesc .= "Test script:\n---------------\n";
$fdesc .= $_POST['in']['repcode'] . "\n\n";
}
if (!empty($_POST['in']['expres']) || $_POST['in']['expres'] === '0') {
$fdesc .= "Expected result:\n----------------\n";
$fdesc .= $_POST['in']['expres'] . "\n\n";
}
if (!empty($_POST['in']['actres']) || $_POST['in']['actres'] === '0') {
$fdesc .= "Actual result:\n--------------\n";
$fdesc .= $_POST['in']['actres'] . "\n";
}
// Put all text areas together.
$fdesc = "Description:\n------------\n" . $_POST['in']['ldesc'] . "\n\n";
if (!empty($_POST['in']['repcode'])) {
$fdesc .= "Test script:\n---------------\n";
$fdesc .= $_POST['in']['repcode'] . "\n\n";
}
if (!empty($_POST['in']['expres']) || $_POST['in']['expres'] === '0') {
$fdesc .= "Expected result:\n----------------\n";
$fdesc .= $_POST['in']['expres'] . "\n\n";
}
if (!empty($_POST['in']['actres']) || $_POST['in']['actres'] === '0') {
$fdesc .= "Actual result:\n--------------\n";
$fdesc .= $_POST['in']['actres'] . "\n";
}
// Bug type 'Security' marks automatically the report as private
$_POST['in']['private'] = ($_POST['in']['bug_type'] == 'Security') ? 'Y' : 'N';
$_POST['in']['block_user_comment'] = 'N';
// Bug type 'Security' marks automatically the report as private
$_POST['in']['private'] = ($_POST['in']['bug_type'] == 'Security') ? 'Y' : 'N';
$_POST['in']['block_user_comment'] = 'N';
if (isset($_POST['preview'])) {
$_POST['in']['status'] = 'Open';
$_SESSION['bug_preview'] = $_POST['in'];
$_SESSION['bug_preview']['ldesc_orig'] = $_POST['in']['ldesc'];
$_SESSION['bug_preview']['ldesc'] = $fdesc;
$_SESSION['captcha'] = $_POST['captcha'];
redirect('bug.php?id=preview');
}
if (isset($_POST['preview'])) {
$_POST['in']['status'] = 'Open';
$_SESSION['bug_preview'] = $_POST['in'];
$_SESSION['bug_preview']['ldesc_orig'] = $_POST['in']['ldesc'];
$_SESSION['bug_preview']['ldesc'] = $fdesc;
$_SESSION['captcha'] = $_POST['captcha'];
redirect('bug.php?id=preview');
}
$res = $dbh->prepare('
INSERT INTO bugdb (
package_name,
bug_type,
email,
sdesc,
ldesc,
php_version,
php_os,
passwd,
reporter_name,
status,
ts1,
private,
visitor_ip
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, "Open", NOW(), ?, INET6_ATON(?))
')->execute([
$package_name,
$_POST['in']['bug_type'],
$_POST['in']['email'],
$_POST['in']['sdesc'],
$fdesc,
$_POST['in']['php_version'],
$_POST['in']['php_os'],
bugs_get_hash($_POST['in']['passwd']),
$_POST['in']['reporter_name'],
$_POST['in']['private'],
$_SERVER['REMOTE_ADDR']
]
);
$res = $dbh->prepare('
INSERT INTO bugdb (
package_name,
bug_type,
email,
sdesc,
ldesc,
php_version,
php_os,
passwd,
reporter_name,
status,
ts1,
private,
visitor_ip
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, "Open", NOW(), ?, INET6_ATON(?))
')->execute([
$package_name,
$_POST['in']['bug_type'],
$_POST['in']['email'],
$_POST['in']['sdesc'],
$fdesc,
$_POST['in']['php_version'],
$_POST['in']['php_os'],
bugs_get_hash($_POST['in']['passwd']),
$_POST['in']['reporter_name'],
$_POST['in']['private'],
$_SERVER['REMOTE_ADDR']
]
);
$cid = $dbh->lastInsertId();
$cid = $dbh->lastInsertId();
$redirectToPatchAdd = false;
if (!empty($_POST['in']['patchname']) && $_POST['in']['patchname']) {
$tracker = $container->get(PatchTracker::class);
$redirectToPatchAdd = false;
if (!empty($_POST['in']['patchname']) && $_POST['in']['patchname']) {
$tracker = $container->get(PatchTracker::class);
try {
$developer = !empty($_POST['in']['handle']) ? $_POST['in']['handle'] : $_POST['in']['email'];
$patchrevision = $tracker->attach($cid, 'patchfile', $_POST['in']['patchname'], $developer, []);
} catch (\Exception $e) {
$redirectToPatchAdd = true;
}
}
try {
$developer = !empty($_POST['in']['handle']) ? $_POST['in']['handle'] : $_POST['in']['email'];
$patchrevision = $tracker->attach($cid, 'patchfile', $_POST['in']['patchname'], $developer, []);
} catch (\Exception $e) {
$redirectToPatchAdd = true;
}
}
if (empty($_POST['in']['handle'])) {
$mailfrom = spam_protect($_POST['in']['email'], 'text');
} else {
$mailfrom = $_POST['in']['handle'];
}
if (empty($_POST['in']['handle'])) {
$mailfrom = spam_protect($_POST['in']['email'], 'text');
} else {
$mailfrom = $_POST['in']['handle'];
}
$report = <<< REPORT
$report = <<< REPORT
From: {$mailfrom}
Operating system: {$_POST['in']['php_os']}
PHP version: {$_POST['in']['php_version']}
@@ -257,133 +257,133 @@ Bug Type: {$_POST['in']['bug_type']}
Bug description:
REPORT;
$ascii_report = "{$report}{$_POST['in']['sdesc']}\n\n" . wordwrap($fdesc, 72);
$ascii_report.= "\n-- \nEdit bug report at ";
$ascii_report.= "{$site_method}://{$site_url}{$basedir}/bug.php?id=$cid&edit=";
$ascii_report = "{$report}{$_POST['in']['sdesc']}\n\n" . wordwrap($fdesc, 72);
$ascii_report.= "\n-- \nEdit bug report at ";
$ascii_report.= "{$site_method}://{$site_url}{$basedir}/bug.php?id=$cid&edit=";
list($mailto, $mailfrom, $bcc, $params) = get_package_mail($package_name, false, $_POST['in']['bug_type']);
list($mailto, $mailfrom, $bcc, $params) = get_package_mail($package_name, false, $_POST['in']['bug_type']);
$protected_email = '"' . spam_protect($_POST['in']['email'], 'text') . '"' . "<{$mailfrom}>";
$protected_email = '"' . spam_protect($_POST['in']['email'], 'text') . '"' . "<{$mailfrom}>";
$extra_headers = "From: {$protected_email}\n";
$extra_headers.= "X-PHP-BugTracker: {$siteBig}bug\n";
$extra_headers.= "X-PHP-Bug: {$cid}\n";
$extra_headers.= "X-PHP-Type: {$_POST['in']['bug_type']}\n";
$extra_headers.= "X-PHP-Version: {$_POST['in']['php_version']}\n";
$extra_headers.= "X-PHP-Category: {$package_name}\n";
$extra_headers.= "X-PHP-OS: {$_POST['in']['php_os']}\n";
$extra_headers.= "X-PHP-Status: Open\n";
$extra_headers.= "Message-ID: <bug-{$cid}@{$site_url}>";
$extra_headers = "From: {$protected_email}\n";
$extra_headers.= "X-PHP-BugTracker: {$siteBig}bug\n";
$extra_headers.= "X-PHP-Bug: {$cid}\n";
$extra_headers.= "X-PHP-Type: {$_POST['in']['bug_type']}\n";
$extra_headers.= "X-PHP-Version: {$_POST['in']['php_version']}\n";
$extra_headers.= "X-PHP-Category: {$package_name}\n";
$extra_headers.= "X-PHP-OS: {$_POST['in']['php_os']}\n";
$extra_headers.= "X-PHP-Status: Open\n";
$extra_headers.= "Message-ID: <bug-{$cid}@{$site_url}>";
if (isset($bug_types[$_POST['in']['bug_type']])) {
$type = $bug_types[$_POST['in']['bug_type']];
} else {
$type = 'unknown';
}
if (isset($bug_types[$_POST['in']['bug_type']])) {
$type = $bug_types[$_POST['in']['bug_type']];
} else {
$type = 'unknown';
}
// provide shortcut URLS for "quick bug fixes"
$reasonRepository = $container->get(ReasonRepository::class);
list($RESOLVE_REASONS, $FIX_VARIATIONS) = $reasonRepository->findByProject($_GET['project'] ?? '');
// provide shortcut URLS for "quick bug fixes"
$reasonRepository = $container->get(ReasonRepository::class);
list($RESOLVE_REASONS, $FIX_VARIATIONS) = $reasonRepository->findByProject($_GET['project'] ?? '');
$dev_extra = '';
$maxkeysize = 0;
foreach ($RESOLVE_REASONS as $v) {
if (!$v['webonly']) {
$actkeysize = strlen($v['title']) + 1;
$maxkeysize = (($maxkeysize < $actkeysize) ? $actkeysize : $maxkeysize);
}
}
foreach ($RESOLVE_REASONS as $k => $v) {
if (!$v['webonly']) {
$dev_extra .= str_pad("{$v['title']}:", $maxkeysize) . " {$site_method}://{$site_url}/fix.php?id={$cid}&r={$k}\n";
}
}
$dev_extra = '';
$maxkeysize = 0;
foreach ($RESOLVE_REASONS as $v) {
if (!$v['webonly']) {
$actkeysize = strlen($v['title']) + 1;
$maxkeysize = (($maxkeysize < $actkeysize) ? $actkeysize : $maxkeysize);
}
}
foreach ($RESOLVE_REASONS as $k => $v) {
if (!$v['webonly']) {
$dev_extra .= str_pad("{$v['title']}:", $maxkeysize) . " {$site_method}://{$site_url}/fix.php?id={$cid}&r={$k}\n";
}
}
// mail to reporter
bugs_mail(
$_POST['in']['email'],
"$type #$cid: {$_POST['in']['sdesc']}",
"{$ascii_report}2\n",
"From: $siteBig Bug Database <$mailfrom>\n" .
"X-PHP-Bug: $cid\n" .
"X-PHP-Site: {$siteBig}\n" .
"Message-ID: <bug-$cid@{$site_url}>"
);
// mail to reporter
bugs_mail(
$_POST['in']['email'],
"$type #$cid: {$_POST['in']['sdesc']}",
"{$ascii_report}2\n",
"From: $siteBig Bug Database <$mailfrom>\n" .
"X-PHP-Bug: $cid\n" .
"X-PHP-Site: {$siteBig}\n" .
"Message-ID: <bug-$cid@{$site_url}>"
);
// mail to package mailing list
bugs_mail(
$mailto,
"[$siteBig-BUG] $type #$cid [NEW]: {$_POST['in']['sdesc']}",
$ascii_report . "1\n-- \n{$dev_extra}",
$extra_headers,
$params
);
// mail to package mailing list
bugs_mail(
$mailto,
"[$siteBig-BUG] $type #$cid [NEW]: {$_POST['in']['sdesc']}",
$ascii_report . "1\n-- \n{$dev_extra}",
$extra_headers,
$params
);
if ($redirectToPatchAdd) {
$patchname = urlencode($_POST['in']['patchname']);
$patchemail= urlencode($_POST['in']['email']);
redirect("patch-add.php?bug_id={$cid}&patchname={$patchname}&email={$patchemail}");
}
redirect("bug.php?id={$cid}&thanks=4");
}
} else {
// had errors...
response_header('Report - Problems', $packageAffectedScript);
}
if ($redirectToPatchAdd) {
$patchname = urlencode($_POST['in']['patchname']);
$patchemail= urlencode($_POST['in']['email']);
redirect("patch-add.php?bug_id={$cid}&patchname={$patchname}&email={$patchemail}");
}
redirect("bug.php?id={$cid}&thanks=4");
}
} else {
// had errors...
response_header('Report - Problems', $packageAffectedScript);
}
} // end of if input
$package = !empty($_REQUEST['package']) ? $_REQUEST['package'] : (!empty($package_name) ? $package_name : (isset($_POST['in']) && $_POST['in'] && isset($_POST['in']['package_name']) ? $_POST['in']['package_name'] : ''));
if (!is_string($package)) {
response_header('Report - Problems', $packageAffectedScript);
$errors[] = 'Invalid package name passed. Please fix it and try again.';
display_bug_error($errors);
response_footer();
exit;
response_header('Report - Problems', $packageAffectedScript);
$errors[] = 'Invalid package name passed. Please fix it and try again.';
display_bug_error($errors);
response_footer();
exit;
}
if (!isset($_POST['in'])) {
$_POST['in'] = [
'package_name' => isset($_GET['package_name']) ? clean($_GET['package_name']) : '',
'bug_type' => isset($_GET['bug_type']) ? clean($_GET['bug_type']) : '',
'email' => '',
'sdesc' => '',
'ldesc' => isset($_GET['manpage']) ? clean("\n---\nFrom manual page: https://php.net/" . ltrim($_GET['manpage'], '/') . "\n---\n") : '',
'repcode' => '',
'expres' => '',
'actres' => '',
'php_version' => '',
'php_os' => '',
'passwd' => '',
];
$_POST['in'] = [
'package_name' => isset($_GET['package_name']) ? clean($_GET['package_name']) : '',
'bug_type' => isset($_GET['bug_type']) ? clean($_GET['bug_type']) : '',
'email' => '',
'sdesc' => '',
'ldesc' => isset($_GET['manpage']) ? clean("\n---\nFrom manual page: https://php.net/" . ltrim($_GET['manpage'], '/') . "\n---\n") : '',
'repcode' => '',
'expres' => '',
'actres' => '',
'php_version' => '',
'php_os' => '',
'passwd' => '',
];
response_header('Report - New', $packageAffectedScript);
response_header('Report - New', $packageAffectedScript);
?>
<p>
Before you report a bug, make sure to search for similar bugs using the &quot;Bug List&quot; link.
Also, read the instructions for <a target="top" href="how-to-report.php">how to report a bug that someone will want to help fix</a>.
</p>
<p>
Before you report a bug, make sure to search for similar bugs using the &quot;Bug List&quot; link.
Also, read the instructions for <a target="top" href="how-to-report.php">how to report a bug that someone will want to help fix</a>.
</p>
<p>
If you aren't sure that what you're about to report is a bug, you should ask for help using one of the means for support
<a href="https://php.net/support.php">listed here</a>.
</p>
<p>
If you aren't sure that what you're about to report is a bug, you should ask for help using one of the means for support
<a href="https://php.net/support.php">listed here</a>.
</p>
<p>
<strong>Failure to follow these instructions may result in your bug simply being marked as &quot;not a bug.&quot;</strong>
</p>
<p>
<strong>Failure to follow these instructions may result in your bug simply being marked as &quot;not a bug.&quot;</strong>
</p>
<p>Report <img src="images/pear_item.gif"><b>PEAR</b> related bugs <a href="https://pear.php.net/bugs/">here</a></p>
<p>Report <img src="images/pear_item.gif"><b>PEAR</b> related bugs <a href="https://pear.php.net/bugs/">here</a></p>
<p>
<strong>If you feel this bug concerns a security issue, e.g. a buffer overflow, weak encryption, etc, then email
<p>
<strong>If you feel this bug concerns a security issue, e.g. a buffer overflow, weak encryption, etc, then email
<?php echo make_mailto_link("{$site_data['security_email']}?subject=%5BSECURITY%5D+possible+new+bug%21", $site_data['security_email']); ?>
who will assess the situation or use <strong>Security</strong> as bug type in the form below.</strong>
</p>
<?php echo make_mailto_link("{$site_data['security_email']}?subject=%5BSECURITY%5D+possible+new+bug%21", $site_data['security_email']); ?>
who will assess the situation or use <strong>Security</strong> as bug type in the form below.</strong>
</p>
<?php
@@ -392,176 +392,176 @@ if (!isset($_POST['in'])) {
display_bug_error($errors);
?>
<form method="post" action="report.php?package=<?php echo htmlspecialchars($package); ?>" name="bugreport" id="bugreport" enctype="multipart/form-data">
<input type="hidden" name="in[did_luser_search]" value="<?php echo isset($_POST['in']['did_luser_search']) ? $_POST['in']['did_luser_search'] : 0; ?>">
<table class="form-holder" cellspacing="1">
<form method="post" action="report.php?package=<?php echo htmlspecialchars($package); ?>" name="bugreport" id="bugreport" enctype="multipart/form-data">
<input type="hidden" name="in[did_luser_search]" value="<?php echo isset($_POST['in']['did_luser_search']) ? $_POST['in']['did_luser_search'] : 0; ?>">
<table class="form-holder" cellspacing="1">
<?php if ($logged_in) { ?>
<tr>
<th class="form-label_left">Your handle:</th>
<td class="form-input">
<?php echo $auth_user->handle; ?>
<input type="hidden" name="in[email]" value="<?php echo $auth_user->email; ?>">
</td>
</tr>
<tr>
<th class="form-label_left">Your handle:</th>
<td class="form-input">
<?php echo $auth_user->handle; ?>
<input type="hidden" name="in[email]" value="<?php echo $auth_user->email; ?>">
</td>
</tr>
<?php } else { ?>
<tr>
<th class="form-label_left">Y<span class="accesskey">o</span>ur email address:<br><strong>MUST BE VALID</strong></th>
<td class="form-input">
<input type="text" size="20" maxlength="40" name="in[email]" value="<?php echo htmlspecialchars($_POST['in']['email'], ENT_COMPAT, 'UTF-8'); ?>" accesskey="o">
</td>
</th>
</tr>
<tr>
<th class="form-label_left">Y<span class="accesskey">o</span>ur email address:<br><strong>MUST BE VALID</strong></th>
<td class="form-input">
<input type="text" size="20" maxlength="40" name="in[email]" value="<?php echo htmlspecialchars($_POST['in']['email'], ENT_COMPAT, 'UTF-8'); ?>" accesskey="o">
</td>
</th>
</tr>
<tr>
<th class="form-label_left"><span class="accesskey">P</span>assword:</th>
<td class="form-input">
<input type="password" size="20" maxlength="20" name="in[passwd]" value="<?php echo htmlspecialchars($_POST['in']['passwd'], ENT_COMPAT, 'UTF-8');?>" accesskey="p"><br>
You <strong>must</strong> enter any password here, which will be stored for this bug report.<br>
This password allows you to come back and modify your submitted bug report at a later date.
[<a href="bug-pwd-finder.php">Lost a bug password?</a>]
</td>
</tr>
<tr>
<th class="form-label_left"><span class="accesskey">P</span>assword:</th>
<td class="form-input">
<input type="password" size="20" maxlength="20" name="in[passwd]" value="<?php echo htmlspecialchars($_POST['in']['passwd'], ENT_COMPAT, 'UTF-8');?>" accesskey="p"><br>
You <strong>must</strong> enter any password here, which will be stored for this bug report.<br>
This password allows you to come back and modify your submitted bug report at a later date.
[<a href="bug-pwd-finder.php">Lost a bug password?</a>]
</td>
</tr>
<?php } ?>
<tr>
<th class="form-label_left">PHP version:</th>
<td class="form-input">
<select name="in[php_version]">
<?php show_version_options($_POST['in']['php_version']); ?>
</select>
</td>
</tr>
<tr>
<th class="form-label_left">PHP version:</th>
<td class="form-input">
<select name="in[php_version]">
<?php show_version_options($_POST['in']['php_version']); ?>
</select>
</td>
</tr>
<tr>
<th class="form-label_left">Package affected:</th>
<td class="form-input">
<select name="in[package_name]">
<?php show_package_options($_POST['in']['package_name'], 0, htmlspecialchars($package)); ?>
</select>
</td>
</tr>
<tr>
<th class="form-label_left">Package affected:</th>
<td class="form-input">
<select name="in[package_name]">
<?php show_package_options($_POST['in']['package_name'], 0, htmlspecialchars($package)); ?>
</select>
</td>
</tr>
<tr>
<th class="form-label_left">Bug Type:</th>
<td class="form-input">
<select name="in[bug_type]">
<?php show_type_options($_POST['in']['bug_type']); ?>
</select>
</td>
</tr>
<tr>
<th class="form-label_left">Bug Type:</th>
<td class="form-input">
<select name="in[bug_type]">
<?php show_type_options($_POST['in']['bug_type']); ?>
</select>
</td>
</tr>
<tr>
<th class="form-label_left">Operating system:</th>
<td class="form-input">
<input type="text" size="20" maxlength="32" name="in[php_os]" value="<?php echo htmlspecialchars($_POST['in']['php_os'], ENT_COMPAT, 'UTF-8'); ?>">
</td>
</tr>
<tr>
<th class="form-label_left">Operating system:</th>
<td class="form-input">
<input type="text" size="20" maxlength="32" name="in[php_os]" value="<?php echo htmlspecialchars($_POST['in']['php_os'], ENT_COMPAT, 'UTF-8'); ?>">
</td>
</tr>
<tr>
<th class="form-label_left">Summary:</th>
<td class="form-input">
<input type="text" size="40" maxlength="79" name="in[sdesc]" value="<?php echo htmlspecialchars($_POST['in']['sdesc'], ENT_COMPAT, 'UTF-8'); ?>">
</td>
</tr>
<tr>
<th class="form-label_left">Summary:</th>
<td class="form-input">
<input type="text" size="40" maxlength="79" name="in[sdesc]" value="<?php echo htmlspecialchars($_POST['in']['sdesc'], ENT_COMPAT, 'UTF-8'); ?>">
</td>
</tr>
<tr>
<th class="form-label_left">Note:</th>
<td class="form-input">
Please supply any information that may be helpful in fixing the bug:
<ul>
<li>The version number of the <?php echo $siteBig; ?> package or files you are using.</li>
<li>A short script that reproduces the problem.</li>
<li>The list of modules you compiled PHP with (your configure line).</li>
<li>Any other information unique or specific to your setup.</li>
<li>Any changes made in your php.ini compared to php.ini-dist or php.ini-recommended (<strong>not</strong> your whole php.ini!)</li>
<li>A <a href="bugs-generating-backtrace.php">gdb backtrace</a>.</li>
</ul>
</td>
</tr>
<tr>
<th class="form-label_left">Note:</th>
<td class="form-input">
Please supply any information that may be helpful in fixing the bug:
<ul>
<li>The version number of the <?php echo $siteBig; ?> package or files you are using.</li>
<li>A short script that reproduces the problem.</li>
<li>The list of modules you compiled PHP with (your configure line).</li>
<li>Any other information unique or specific to your setup.</li>
<li>Any changes made in your php.ini compared to php.ini-dist or php.ini-recommended (<strong>not</strong> your whole php.ini!)</li>
<li>A <a href="bugs-generating-backtrace.php">gdb backtrace</a>.</li>
</ul>
</td>
</tr>
<tr>
<th class="form-label_left">
Description:
<p class="cell_note">
Put short code samples in the &quot;Test script&quot; section <strong>below</strong>
and upload patches <strong>below</strong>.
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[ldesc]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['ldesc'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<tr>
<th class="form-label_left">
Test script:
<p class="cell_note">
A short test script you wrote that demonstrates the bug.
Please <strong>do not</strong> post more than 20 lines of code.
If the code is longer than 20 lines, provide a URL to the source
code that will reproduce the bug.
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[repcode]" wrap="no"><?php echo htmlspecialchars($_POST['in']['repcode'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<tr>
<th class="form-label_left">
Description:
<p class="cell_note">
Put short code samples in the &quot;Test script&quot; section <strong>below</strong>
and upload patches <strong>below</strong>.
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[ldesc]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['ldesc'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<tr>
<th class="form-label_left">
Test script:
<p class="cell_note">
A short test script you wrote that demonstrates the bug.
Please <strong>do not</strong> post more than 20 lines of code.
If the code is longer than 20 lines, provide a URL to the source
code that will reproduce the bug.
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[repcode]" wrap="no"><?php echo htmlspecialchars($_POST['in']['repcode'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<?php
$patchname = isset($_POST['in']['patchname']) ? $_POST['in']['patchname'] : '';
$patchfile = isset($_FILES['patchfile']['name']) ? $_FILES['patchfile']['name'] : '';
include "{$ROOT_DIR}/templates/patchform.php";
$patchname = isset($_POST['in']['patchname']) ? $_POST['in']['patchname'] : '';
$patchfile = isset($_FILES['patchfile']['name']) ? $_FILES['patchfile']['name'] : '';
include "{$ROOT_DIR}/templates/patchform.php";
?>
<tr>
<th class="form-label_left">
Expected result:
<p class="cell_note">
Skip if irrelevant.
What do you expect to happen or see when you run the test script above?
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[expres]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['expres'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<tr>
<th class="form-label_left">
Expected result:
<p class="cell_note">
Skip if irrelevant.
What do you expect to happen or see when you run the test script above?
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[expres]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['expres'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<tr>
<th class="form-label_left">
Actual result:
<p class="cell_note">
Skip if irrelevant.
This could be a <a href="bugs-generating-backtrace.php">backtrace</a> for example.
Try to keep it as short as possible without leaving anything relevant out.
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[actres]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['actres'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<tr>
<th class="form-label_left">
Actual result:
<p class="cell_note">
Skip if irrelevant.
This could be a <a href="bugs-generating-backtrace.php">backtrace</a> for example.
Try to keep it as short as possible without leaving anything relevant out.
</p>
</th>
<td class="form-input">
<textarea cols="80" rows="15" name="in[actres]" wrap="soft"><?php echo htmlspecialchars($_POST['in']['actres'], ENT_COMPAT, 'UTF-8'); ?></textarea>
</td>
</tr>
<?php if (!$logged_in) {
$_SESSION['answer'] = $captcha->getAnswer();
$_SESSION['answer'] = $captcha->getAnswer();
if (!empty($_POST['captcha']) && empty($ok_to_submit_report)) {
$captcha_label = '<strong>Solve this <em>new</em> problem:</strong>';
} else {
$captcha_label = 'Solve the problem:';
}
if (!empty($_POST['captcha']) && empty($ok_to_submit_report)) {
$captcha_label = '<strong>Solve this <em>new</em> problem:</strong>';
} else {
$captcha_label = 'Solve the problem:';
}
?>
<tr>
<th><?php echo $captcha_label; ?><br><?php echo htmlspecialchars($captcha->getQuestion()); ?></th>
<td class="form-input"><input type="text" name="captcha" autocomplete="off"></td>
</tr>
<tr>
<th><?php echo $captcha_label; ?><br><?php echo htmlspecialchars($captcha->getQuestion()); ?></th>
<td class="form-input"><input type="text" name="captcha" autocomplete="off"></td>
</tr>
<?php } ?>
<tr>
<th class="form-label_left">Submit:</th>
<td class="form-input">
<input type="submit" value="Send bug report">
<input type="submit" value="Preview" name="preview">
</td>
</tr>
</table>
</form>
<tr>
<th class="form-label_left">Submit:</th>
<td class="form-input">
<input type="submit" value="Send bug report">
<input type="submit" value="Preview" name="preview">
</td>
</tr>
</table>
</form>
<?php
response_footer();

View File

@@ -12,28 +12,28 @@ session_start();
$bug_id = (isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0);
if (!$bug_id) {
echo json_encode(['result' => ['error' => 'Missing bug id']]);
exit;
echo json_encode(['result' => ['error' => 'Missing bug id']]);
exit;
}
// Obtain common includes
require_once '../include/prepend.php';
if (isset($_POST['MAGIC_COOKIE'])) {
list($user, $pwd) = explode(":", base64_decode($_POST['MAGIC_COOKIE']), 2);
$auth_user = new stdClass;
$auth_user->handle = $user;
$auth_user->password = $pwd;
list($user, $pwd) = explode(":", base64_decode($_POST['MAGIC_COOKIE']), 2);
$auth_user = new stdClass;
$auth_user->handle = $user;
$auth_user->password = $pwd;
} else {
echo json_encode(['result' => ['error' => 'Missing credentials']]);
exit;
echo json_encode(['result' => ['error' => 'Missing credentials']]);
exit;
}
bugs_authenticate($user, $pwd, $logged_in, $user_flags);
if (empty($auth_user->handle)) {
echo json_encode(['result' => ['error' => 'Invalid user or password']]);
exit;
echo json_encode(['result' => ['error' => 'Invalid user or password']]);
exit;
}
// fetch info about the bug into $bug
@@ -41,57 +41,57 @@ $bugRepository = $container->get(BugRepository::class);
$bug = $bugRepository->findOneById($bug_id);
if (!is_array($bug)) {
echo json_encode(['result' => ['error' => 'No such bug']]);
exit;
echo json_encode(['result' => ['error' => 'No such bug']]);
exit;
}
if (!bugs_has_access($bug_id, $bug, $pwd, $user_flags)) {
echo json_encode(['result' => ['error' => 'No access to bug']]);
exit;
echo json_encode(['result' => ['error' => 'No access to bug']]);
exit;
}
if (!empty($_POST['ncomment']) && !empty($_POST['user'])) {
$user = htmlspecialchars(trim($_POST['user']));
$ncomment = htmlspecialchars(trim($_POST['ncomment']));
$from = "{$user}@php.net";
$user = htmlspecialchars(trim($_POST['user']));
$ncomment = htmlspecialchars(trim($_POST['ncomment']));
$from = "{$user}@php.net";
try {
/* svn log comment */
bugs_add_comment($bug_id, $from, $user, $ncomment, 'svn');
try {
/* svn log comment */
bugs_add_comment($bug_id, $from, $user, $ncomment, 'svn');
/* Close the bug report as requested if it is not already closed */
if (!empty($_POST['status'])
&& $bug['status'] !== 'Closed'
&& $_POST['status'] === 'Closed') {
/* Change the bug status to Closed */
bugs_status_change($bug_id, 'Closed');
/* Close the bug report as requested if it is not already closed */
if (!empty($_POST['status'])
&& $bug['status'] !== 'Closed'
&& $_POST['status'] === 'Closed') {
/* Change the bug status to Closed */
bugs_status_change($bug_id, 'Closed');
$in = $bug;
/* Just change the bug status */
$in['status'] = $_POST['status'];
$in = $bug;
/* Just change the bug status */
$in['status'] = $_POST['status'];
$changed = bug_diff($bug, $in);
if (!empty($changed)) {
$log_comment = bug_diff_render_html($changed);
if (!empty($log_comment)) {
/* Add a log of status change */
bugs_add_comment($bug_id, $from, '', $log_comment, 'log');
}
}
$changed = bug_diff($bug, $in);
if (!empty($changed)) {
$log_comment = bug_diff_render_html($changed);
if (!empty($log_comment)) {
/* Add a log of status change */
bugs_add_comment($bug_id, $from, '', $log_comment, 'log');
}
}
/* Send a mail notification when automatically closing a bug */
mail_bug_updates($bug, $in, $from, $ncomment, 1, $bug_id);
}
/* Send a mail notification when automatically closing a bug */
mail_bug_updates($bug, $in, $from, $ncomment, 1, $bug_id);
}
echo json_encode(['result' => ['status' => $bug]]);
exit;
} catch (Exception $e) {
echo json_encode(['result' => ['error' => $e->getMessage()]]);
exit;
}
echo json_encode(['result' => ['status' => $bug]]);
exit;
} catch (Exception $e) {
echo json_encode(['result' => ['error' => $e->getMessage()]]);
exit;
}
} else if (!empty($_POST['getbug'])) {
echo json_encode(['result' => ['status' => $bug]]);
exit;
echo json_encode(['result' => ['status' => $bug]]);
exit;
}
echo json_encode(['result' => ['error' => 'Nothing to do']]);

View File

@@ -20,30 +20,30 @@ $bugRepository = $container->get(BugRepository::class);
$bug = $bugRepository->findOneById($bug_id);
if (!$bug) {
header('HTTP/1.0 404 Not Found');
die('Nothing found');
header('HTTP/1.0 404 Not Found');
die('Nothing found');
}
if ($bug['private'] == 'Y') {
header('HTTP/1.0 403 Forbidden');
die('Access restricted');
header('HTTP/1.0 403 Forbidden');
die('Access restricted');
}
$commentRepository = $container->get(CommentRepository::class);
$comments = $commentRepository->findByBugId($bug_id);
if ($format == 'xml') {
header('Content-type: text/xml; charset=utf-8');
include './xml.php';
exit;
header('Content-type: text/xml; charset=utf-8');
include './xml.php';
exit;
} elseif ($format == "rss2") {
header('Content-type: application/rss+xml; charset=utf-8');
$uri = "{$site_method}://{$site_url}{$basedir}/bug.php?id={$bug['id']}";
include './rss.php';
exit;
header('Content-type: application/rss+xml; charset=utf-8');
$uri = "{$site_method}://{$site_url}{$basedir}/bug.php?id={$bug['id']}";
include './rss.php';
exit;
} else {
header('Content-type: application/rdf+xml; charset=utf-8');
$uri = "{$site_method}://{$site_url}{$basedir}/bug.php?id={$bug['id']}";
include './rdf.php';
exit;
header('Content-type: application/rdf+xml; charset=utf-8');
$uri = "{$site_method}://{$site_url}{$basedir}/bug.php?id={$bug['id']}";
include './rdf.php';
exit;
}

View File

@@ -2,9 +2,9 @@
$desc = "{$bug['package_name']} {$bug['bug_type']}\nReported by ";
if (preg_match('/@php.net$/i', $bug['email'])) {
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) ."\n";
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) ."\n";
} else {
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) . "@...\n";
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) . "@...\n";
}
$desc .= date(DATE_ATOM, $bug['submitted']) . "\n";
$desc .= "PHP: {$bug['php_version']}, OS: {$bug['php_os']}\n\n";
@@ -13,116 +13,116 @@ $desc = '<pre>' . clean($desc) . '</pre>';
$state = 'http://xmlns.com/baetle/#Open';
switch ($bug['status']) {
case 'Closed':
$state = 'http://xmlns.com/baetle/#Closed';
break;
case 'Wont fix':
$state = 'http://xmlns.com/baetle/#WontFix';
break;
case 'No Feedback':
$state = 'http://xmlns.com/baetle/#Incomplete';
break;
case 'Not a bug':
$state = 'http://xmlns.com/baetle/#WorksForMe';
break;
case 'Duplicate':
$state = 'http://xmlns.com/baetle/#Duplicate';
break;
case 'Suspended':
$state = 'http://xmlns.com/baetle/#Later';
break;
case 'Assigned':
$state = 'http://xmlns.com/baetle/#Started';
break;
case 'Open':
$state = 'http://xmlns.com/baetle/#Open';
break;
case 'Analyzed':
case 'Verified':
$state = 'http://xmlns.com/baetle/#Verified';
break;
case 'Feedback':
$state = 'http://xmlns.com/baetle/#NotReproducable';
break;
case 'Closed':
$state = 'http://xmlns.com/baetle/#Closed';
break;
case 'Wont fix':
$state = 'http://xmlns.com/baetle/#WontFix';
break;
case 'No Feedback':
$state = 'http://xmlns.com/baetle/#Incomplete';
break;
case 'Not a bug':
$state = 'http://xmlns.com/baetle/#WorksForMe';
break;
case 'Duplicate':
$state = 'http://xmlns.com/baetle/#Duplicate';
break;
case 'Suspended':
$state = 'http://xmlns.com/baetle/#Later';
break;
case 'Assigned':
$state = 'http://xmlns.com/baetle/#Started';
break;
case 'Open':
$state = 'http://xmlns.com/baetle/#Open';
break;
case 'Analyzed':
case 'Verified':
$state = 'http://xmlns.com/baetle/#Verified';
break;
case 'Feedback':
$state = 'http://xmlns.com/baetle/#NotReproducable';
break;
}
print '<?xml version="1.0"?>';
?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:btl="http://xmlns.com/baetle/#"
xmlns:wf="http://www.w3.org/2005/01/wf/flow#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:btl="http://xmlns.com/baetle/#"
xmlns:wf="http://www.w3.org/2005/01/wf/flow#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
<channel rdf:about="<?php echo $uri; ?>">
<title><?php echo $bug['package_name']; ?> Bug #<?php echo intval($bug['id']); ?></title>
<link><?php echo $uri; ?></link>
<description><?php echo clean("[{$bug['status']}] {$bug['sdesc']}"); ?></description>
<channel rdf:about="<?php echo $uri; ?>">
<title><?php echo $bug['package_name']; ?> Bug #<?php echo intval($bug['id']); ?></title>
<link><?php echo $uri; ?></link>
<description><?php echo clean("[{$bug['status']}] {$bug['sdesc']}"); ?></description>
<dc:language>en-us</dc:language>
<dc:creator><?php echo $site; ?>-webmaster@lists.php.net</dc:creator>
<dc:publisher><?php echo $site; ?>-webmaster@lists.php.net</dc:publisher>
<dc:language>en-us</dc:language>
<dc:creator><?php echo $site; ?>-webmaster@lists.php.net</dc:creator>
<dc:publisher><?php echo $site; ?>-webmaster@lists.php.net</dc:publisher>
<admin:generatorAgent rdf:resource="<?php echo $site_method?>://<?php echo $site_url, $basedir; ?>" />
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<admin:generatorAgent rdf:resource="<?php echo $site_method?>://<?php echo $site_url, $basedir; ?>" />
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<items>
<rdf:Seq>
<rdf:li rdf:resource="<?php echo $uri; ?>" />
<items>
<rdf:Seq>
<rdf:li rdf:resource="<?php echo $uri; ?>" />
<?php foreach ($comments as $comment) { ?>
<rdf:li rdf:resource="<?php echo $uri; ?>#<?php echo $comment['added']; ?>"/>
<rdf:li rdf:resource="<?php echo $uri; ?>#<?php echo $comment['added']; ?>"/>
<?php } ?>
</rdf:Seq>
</items>
</channel>
</rdf:Seq>
</items>
</channel>
<btl:Bug rdf:about="<?php echo $uri; ?>">
<btl:summary><?php echo clean($bug['sdesc']); ?></btl:summary>
<btl:description><?php echo clean($bug['ldesc']); ?></btl:description>
<wf:state rdf:resource="<?php echo $state; ?>" />
</btl:Bug>
<btl:Bug rdf:about="<?php echo $uri; ?>">
<btl:summary><?php echo clean($bug['sdesc']); ?></btl:summary>
<btl:description><?php echo clean($bug['ldesc']); ?></btl:description>
<wf:state rdf:resource="<?php echo $state; ?>" />
</btl:Bug>
<item rdf:about="<?php echo $uri; ?>">
<title><?php echo clean(substr($bug['email'], 0, strpos($bug['email'], '@'))), "@... [{$bug['ts1']}]"; ?></title>
<link><?php echo $uri; ?></link>
<description><![CDATA[<?php echo $desc; ?>]]></description>
<content:encoded><![CDATA[<?php echo $desc; ?>]]></content:encoded>
<dc:date><?php echo date(DATE_ATOM, $bug['submitted']); ?></dc:date>
</item>
<item rdf:about="<?php echo $uri; ?>">
<title><?php echo clean(substr($bug['email'], 0, strpos($bug['email'], '@'))), "@... [{$bug['ts1']}]"; ?></title>
<link><?php echo $uri; ?></link>
<description><![CDATA[<?php echo $desc; ?>]]></description>
<content:encoded><![CDATA[<?php echo $desc; ?>]]></content:encoded>
<dc:date><?php echo date(DATE_ATOM, $bug['submitted']); ?></dc:date>
</item>
<?php
foreach ($comments as $comment) {
if (empty($comment['registered'])) { continue; }
foreach ($comments as $comment) {
if (empty($comment['registered'])) { continue; }
$ts = urlencode($comment['ts']);
$displayts = date('Y-m-d H:i', $comment['added'] - date('Z', $comment['added']));
$ts = urlencode($comment['ts']);
$displayts = date('Y-m-d H:i', $comment['added'] - date('Z', $comment['added']));
?>
<item rdf:about="<?php echo $uri; ?>#<?php echo $comment['added']; ?>">
<title>
<item rdf:about="<?php echo $uri; ?>#<?php echo $comment['added']; ?>">
<title>
<?php
if ($comment['handle']) {
echo clean($comment['handle']) . " [$displayts]";
} else {
echo clean(substr($comment['email'], 0, strpos($comment['email'], '@'))), "@... [$displayts]";
}
if ($comment['handle']) {
echo clean($comment['handle']) . " [$displayts]";
} else {
echo clean(substr($comment['email'], 0, strpos($comment['email'], '@'))), "@... [$displayts]";
}
?>
</title>
</title>
<link><?php echo $uri; ?>#<?php echo $comment['added']; ?></link>
<link><?php echo $uri; ?>#<?php echo $comment['added']; ?></link>
<description><![CDATA[<pre><?php echo clean($comment['comment']); ?></pre>]]></description>
<content:encoded><![CDATA[<pre><?php echo clean($comment['comment']); ?></pre>]]></content:encoded>
<dc:date><?php echo date(DATE_ATOM, $comment['added']); ?></dc:date>
</item>
<description><![CDATA[<pre><?php echo clean($comment['comment']); ?></pre>]]></description>
<content:encoded><![CDATA[<pre><?php echo clean($comment['comment']); ?></pre>]]></content:encoded>
<dc:date><?php echo date(DATE_ATOM, $comment['added']); ?></dc:date>
</item>
<?php } ?>
</rdf:RDF>

View File

@@ -3,9 +3,9 @@ echo '<?xml version="1.0"?>';
$desc = "{$bug['package_name']} {$bug['bug_type']}\nReported by ";
if (preg_match('/@php.net$/i', $bug['email'])) {
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) ."\n";
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) ."\n";
} else {
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) . "@...\n";
$desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) . "@...\n";
}
$desc .= date(DATE_RSS, $bug['submitted']) . "\n";
$desc .= "PHP: {$bug['php_version']}, OS: {$bug['php_os']}\n\n";
@@ -14,30 +14,30 @@ $desc = '<pre>' . clean($desc) . '</pre>';
?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><?php echo "{$bug['package_name']} Bug #{$bug['id']}"; ?></title>
<link><?php echo $uri; ?></link>
<description><?php echo clean("[{$bug['status']}] {$bug['sdesc']}"); ?></description>
<pubDate><?php echo date('r', $bug['submitted']); ?></pubDate>
<lastBuildDate><?php echo date('r', ($bug['modified']) ? $bug['modified'] : $bug['submitted']); ?></lastBuildDate>
<atom:link href="<?php echo "{$site_method}://{$site_url}{$basedir}/rss/bug.php?id={$bug['id']}&amp;format=rss2"; ?>" rel="self" type="application/rss+xml" />
<item>
<title><?php echo ($bug['assign']) ? clean($bug['assign']) : clean(substr($bug['email'], 0, strpos($bug['email'], '@'))), "@... [{$bug['ts1']}]"; ?></title>
<description><![CDATA[ <?php echo $desc; ?> ]]></description>
<pubDate><?php echo date('r', $bug['submitted']); ?></pubDate>
<guid><?php echo $uri; ?></guid>
</item>
<channel>
<title><?php echo "{$bug['package_name']} Bug #{$bug['id']}"; ?></title>
<link><?php echo $uri; ?></link>
<description><?php echo clean("[{$bug['status']}] {$bug['sdesc']}"); ?></description>
<pubDate><?php echo date('r', $bug['submitted']); ?></pubDate>
<lastBuildDate><?php echo date('r', ($bug['modified']) ? $bug['modified'] : $bug['submitted']); ?></lastBuildDate>
<atom:link href="<?php echo "{$site_method}://{$site_url}{$basedir}/rss/bug.php?id={$bug['id']}&amp;format=rss2"; ?>" rel="self" type="application/rss+xml" />
<item>
<title><?php echo ($bug['assign']) ? clean($bug['assign']) : clean(substr($bug['email'], 0, strpos($bug['email'], '@'))), "@... [{$bug['ts1']}]"; ?></title>
<description><![CDATA[ <?php echo $desc; ?> ]]></description>
<pubDate><?php echo date('r', $bug['submitted']); ?></pubDate>
<guid><?php echo $uri; ?></guid>
</item>
<?php
foreach ($comments as $comment) {
if (empty($comment['registered'])) continue;
$displayts = date(DATE_RSS, $comment['added']);
foreach ($comments as $comment) {
if (empty($comment['registered'])) continue;
$displayts = date(DATE_RSS, $comment['added']);
?>
<item>
<title><?php echo clean($comment['email'] . " [$displayts]"); ?></title>
<description><![CDATA[ <?php echo '<pre>', clean($comment['comment']), '</pre>'; ?>]]></description>
<pubDate><?php echo date('r', $comment['added']); ?></pubDate>
<guid><?php echo $uri, '#', $comment['added']; ?></guid>
</item>
<item>
<title><?php echo clean($comment['email'] . " [$displayts]"); ?></title>
<description><![CDATA[ <?php echo '<pre>', clean($comment['comment']), '</pre>'; ?>]]></description>
<pubDate><?php echo date('r', $comment['added']); ?></pubDate>
<guid><?php echo $uri, '#', $comment['added']; ?></guid>
</item>
<?php } ?>
</channel>
</channel>
</rss>

View File

@@ -17,11 +17,11 @@ $format = (isset($_GET['format']) && $_GET['format'] === 'rss2') ? 'rss2' : 'rdf
// Maximum number of bugs to return
if ($format === 'rss2') {
// RSS channel shows way more data (e.g. no bug description) thus
// we can fetch more rows
define ('MAX_BUGS_RETURN', 500);
// RSS channel shows way more data (e.g. no bug description) thus
// we can fetch more rows
define ('MAX_BUGS_RETURN', 500);
} else {
define ('MAX_BUGS_RETURN', 150);
define ('MAX_BUGS_RETURN', 150);
}
// Obtain common includes
@@ -29,16 +29,16 @@ require_once '../../include/prepend.php';
require "{$ROOT_DIR}/include/query.php";
if ($format === 'rss2') {
require "{$ROOT_DIR}/templates/search-rss2.php";
require "{$ROOT_DIR}/templates/search-rss2.php";
} else {
require "{$ROOT_DIR}/templates/search-rdf.php";
require "{$ROOT_DIR}/templates/search-rdf.php";
}
if (count($warnings) > 0) {
echo "<!--\n\n";
echo "The following warnings occured during your request:\n\n";
foreach($warnings as $warning) {
echo clean('* ' . $warning) . "\n";
}
echo "-->\n";
echo "<!--\n\n";
echo "The following warnings occured during your request:\n\n";
foreach($warnings as $warning) {
echo clean('* ' . $warning) . "\n";
}
echo "-->\n";
}

View File

@@ -1,16 +1,16 @@
<?php
echo "<bug>\n";
foreach ($bug as $key => $value) {
if (is_int($key)) continue;
echo " <$key>", clean($value), "</$key>\n";
if (is_int($key)) continue;
echo " <$key>", clean($value), "</$key>\n";
}
foreach ($comments as $comment) {
if (empty($comment['registered'])) continue;
echo " <comment>\n";
foreach ($comment as $key => $value) {
if (is_int($key)) continue;
echo " <$key>", clean($value), "</$key>\n";
}
echo " </comment>\n";
if (empty($comment['registered'])) continue;
echo " <comment>\n";
foreach ($comment as $key => $value) {
if (is_int($key)) continue;
echo " <$key>", clean($value), "</$key>\n";
}
echo " </comment>\n";
}
echo "</bug>\n";

View File

@@ -10,7 +10,7 @@ require_once '../include/prepend.php';
// Redirect early if a bug id is passed as search string
if (isset($_GET['search_for']) && preg_match('/^\d+$/', trim($_GET['search_for']), $search_for_id_array)) {
redirect("bug.php?id=${search_for_id_array[0]}");
redirect("bug.php?id=${search_for_id_array[0]}");
}
// For bug count only, used in places like doc.php.net
@@ -23,11 +23,11 @@ $is_security_developer = ($user_flags & (BUGS_TRUSTED_DEV | BUGS_SECURITY_DEV));
$newrequest = http_build_query(array_merge($_GET, $_POST));
if (!$count_only) {
response_header(
'Bugs :: Search', "
<link rel='alternate' type='application/rss+xml' title='Search bugs - RDF' href='rss/search.php?{$newrequest}'>
<link rel='alternate' type='application/rss+xml' title='Search bugs - RSS 2.0' href='rss/search.php?format=rss2&{$newrequest}'>
");
response_header(
'Bugs :: Search', "
<link rel='alternate' type='application/rss+xml' title='Search bugs - RDF' href='rss/search.php?{$newrequest}'>
<link rel='alternate' type='application/rss+xml' title='Search bugs - RSS 2.0' href='rss/search.php?format=rss2&{$newrequest}'>
");
}
// Include common query handler (used also by rss/search.php)
@@ -35,86 +35,86 @@ require "{$ROOT_DIR}/include/query.php";
if (isset($_GET['cmd']) && $_GET['cmd'] == 'display')
{
// FIXME: this if doesn't make sense, check is already performed in
// query.php - whole condition can be removed, reducing level of
// nesting by one.
if (!isset($result)) {
$errors[] = 'Invalid query';
} else {
// For count only, simply print the count and exit
if ($count_only) {
echo (int) $total_rows;
exit;
}
// FIXME: this if doesn't make sense, check is already performed in
// query.php - whole condition can be removed, reducing level of
// nesting by one.
if (!isset($result)) {
$errors[] = 'Invalid query';
} else {
// For count only, simply print the count and exit
if ($count_only) {
echo (int) $total_rows;
exit;
}
// Selected packages to search in
$package_name_string = '';
if (count($package_name) > 0) {
foreach ($package_name as $type_str) {
$package_name_string.= '&amp;package_name[]=' . urlencode($type_str);
}
}
// Selected packages to search in
$package_name_string = '';
if (count($package_name) > 0) {
foreach ($package_name as $type_str) {
$package_name_string.= '&amp;package_name[]=' . urlencode($type_str);
}
}
// Selected packages NOT to search in
$package_nname_string = '';
if (count($package_nname) > 0) {
foreach ($package_nname as $type_str) {
$package_nname_string.= '&amp;package_nname[]=' . urlencode($type_str);
}
}
// Selected packages NOT to search in
$package_nname_string = '';
if (count($package_nname) > 0) {
foreach ($package_nname as $type_str) {
$package_nname_string.= '&amp;package_nname[]=' . urlencode($type_str);
}
}
$link_params = [
'search_for' => urlencode($search_for),
'project' => urlencode($project),
'php_os' => urlencode($php_os),
'php_os_not' => $php_os_not,
'author_email' => urlencode($author_email),
'bug_type' => urlencode($bug_type),
'boolean' => $boolean_search,
'bug_age' => $bug_age,
'bug_updated' => $bug_updated,
'order_by' => $order_by,
'direction' => $direction,
'limit' => $limit,
'phpver' => urlencode($phpver),
'cve_id' => urlencode($cve_id),
'cve_id_not' => $cve_id_not,
'patch' => urlencode($patch),
'pull' => urlencode($pull),
'assign' => urlencode($assign),
'commented_by' => urlencode($commented_by),
];
$link_params = [
'search_for' => urlencode($search_for),
'project' => urlencode($project),
'php_os' => urlencode($php_os),
'php_os_not' => $php_os_not,
'author_email' => urlencode($author_email),
'bug_type' => urlencode($bug_type),
'boolean' => $boolean_search,
'bug_age' => $bug_age,
'bug_updated' => $bug_updated,
'order_by' => $order_by,
'direction' => $direction,
'limit' => $limit,
'phpver' => urlencode($phpver),
'cve_id' => urlencode($cve_id),
'cve_id_not' => $cve_id_not,
'patch' => urlencode($patch),
'pull' => urlencode($pull),
'assign' => urlencode($assign),
'commented_by' => urlencode($commented_by),
];
if ($is_security_developer) {
$link_params['private'] = $private;
}
if ($is_security_developer) {
$link_params['private'] = $private;
}
// Remove empty URL parameters
foreach ($link_params as $index => $param) {
if (empty($param))
unset($link_params[$index]);
}
// Remove empty URL parameters
foreach ($link_params as $index => $param) {
if (empty($param))
unset($link_params[$index]);
}
// Create link params string
$link_params_string = '';
foreach ($link_params as $index => $param) {
$link_params_string .= "&amp;$index=$param";
}
// Create link params string
$link_params_string = '';
foreach ($link_params as $index => $param) {
$link_params_string .= "&amp;$index=$param";
}
$link = "search.php?cmd=display{$package_name_string}{$package_nname_string}{$link_params_string}";
$clean_link = "search.php?cmd=display{$link_params_string}";
$link = "search.php?cmd=display{$package_name_string}{$package_nname_string}{$link_params_string}";
$clean_link = "search.php?cmd=display{$link_params_string}";
if (isset($_GET['showmenu'])) {
$link .= '&amp;showmenu=1';
}
if (isset($_GET['showmenu'])) {
$link .= '&amp;showmenu=1';
}
if (!$rows) {
$errors[] = 'No bugs were found.';
display_bug_error($errors, 'warnings', '');
} else {
display_bug_error($warnings, 'warnings', 'WARNING:');
$link .= '&amp;status=' . urlencode($status);
$package_count = count($package_name);
if (!$rows) {
$errors[] = 'No bugs were found.';
display_bug_error($errors, 'warnings', '');
} else {
display_bug_error($warnings, 'warnings', 'WARNING:');
$link .= '&amp;status=' . urlencode($status);
$package_count = count($package_name);
?>
<table border="0" cellspacing="2" width="100%">
@@ -125,9 +125,9 @@ if (isset($_GET['cmd']) && $_GET['cmd'] == 'display')
<tr>
<td class="search-prev_next" style="text-align: center;" colspan="10">
<?php
$pck = htmlspecialchars($package_name[0]);
$pck_url = urlencode($pck);
echo "Bugs for {$pck}\n";
$pck = htmlspecialchars($package_name[0]);
$pck_url = urlencode($pck);
echo "Bugs for {$pck}\n";
?>
</td>
</tr>
@@ -149,62 +149,62 @@ if (isset($_GET['cmd']) && $_GET['cmd'] == 'display')
</tr>
<?php
foreach ($result as $row) {
$status_class = $row['private'] == 'Y' ? 'Sec' : ($tla[$row['status']] ?? '');
foreach ($result as $row) {
$status_class = $row['private'] == 'Y' ? 'Sec' : ($tla[$row['status']] ?? '');
echo ' <tr valign="top" class="' , $status_class, '">' , "\n";
echo ' <tr valign="top" class="' , $status_class, '">' , "\n";
// Bug ID
echo ' <td align="center"><a href="bug.php?id=', $row['id'], '">', $row['id'], '</a>';
echo '<br><a href="bug.php?id=', $row['id'], '&amp;edit=1">(edit)</a></td>', "\n";
// Bug ID
echo ' <td align="center"><a href="bug.php?id=', $row['id'], '">', $row['id'], '</a>';
echo '<br><a href="bug.php?id=', $row['id'], '&amp;edit=1">(edit)</a></td>', "\n";
// Date
echo ' <td align="center">', format_date(strtotime($row['ts1'])), "</td>\n";
// Date
echo ' <td align="center">', format_date(strtotime($row['ts1'])), "</td>\n";
// Last Modified
$ts2 = strtotime($row['ts2']);
echo ' <td align="center">' , ($ts2 ? format_date($ts2) : 'Not modified') , "</td>\n";
// Last Modified
$ts2 = strtotime($row['ts2']);
echo ' <td align="center">' , ($ts2 ? format_date($ts2) : 'Not modified') , "</td>\n";
// Package
if ($package_count !== 1) {
$pck = htmlspecialchars($row['package_name']);
$pck_url = urlencode($pck);
echo "<td><a href='{$clean_link}&amp;package_name[]={$pck_url}'>{$pck}</a></td>\n";
}
// Package
if ($package_count !== 1) {
$pck = htmlspecialchars($row['package_name']);
$pck_url = urlencode($pck);
echo "<td><a href='{$clean_link}&amp;package_name[]={$pck_url}'>{$pck}</a></td>\n";
}
/// Bug type
$type_idx = !empty($row['bug_type']) ? $row['bug_type'] : 'Bug';
echo ' <td>', htmlspecialchars($bug_types[$type_idx]), '</td>', "\n";
/// Bug type
$type_idx = !empty($row['bug_type']) ? $row['bug_type'] : 'Bug';
echo ' <td>', htmlspecialchars($bug_types[$type_idx]), '</td>', "\n";
// Status
echo ' <td>', htmlspecialchars($row['status']);
if ($row['status'] == 'Feedback' && $row['unchanged'] > 0) {
printf ("<br>%d day%s", $row['unchanged'], $row['unchanged'] > 1 ? 's' : '');
}
echo '</td>', "\n";
// Status
echo ' <td>', htmlspecialchars($row['status']);
if ($row['status'] == 'Feedback' && $row['unchanged'] > 0) {
printf ("<br>%d day%s", $row['unchanged'], $row['unchanged'] > 1 ? 's' : '');
}
echo '</td>', "\n";
/// PHP version
echo ' <td>', htmlspecialchars($row['php_version']), '</td>';
/// PHP version
echo ' <td>', htmlspecialchars($row['php_version']), '</td>';
// OS
echo ' <td>', $row['php_os'] ? htmlspecialchars($row['php_os']) : '&nbsp;', '</td>', "\n";
// OS
echo ' <td>', $row['php_os'] ? htmlspecialchars($row['php_os']) : '&nbsp;', '</td>', "\n";
// Short description
echo ' <td><a href="bug.php?id=', $row['id'], '">', $row['sdesc'] ? htmlspecialchars($row['sdesc']) : '&nbsp;', '</a></td>', "\n";
// Short description
echo ' <td><a href="bug.php?id=', $row['id'], '">', $row['sdesc'] ? htmlspecialchars($row['sdesc']) : '&nbsp;', '</a></td>', "\n";
// Assigned to
echo ' <td>', ($row['assign'] ? ("<a href=\"{$clean_link}&amp;assign=" . urlencode($row['assign']) . '">' . htmlspecialchars($row['assign']) . '</a>') : '&nbsp;'), '</td>';
echo " </tr>\n";
}
// Assigned to
echo ' <td>', ($row['assign'] ? ("<a href=\"{$clean_link}&amp;assign=" . urlencode($row['assign']) . '">' . htmlspecialchars($row['assign']) . '</a>') : '&nbsp;'), '</td>';
echo " </tr>\n";
}
show_prev_next($begin, $rows, $total_rows, $link, $limit);
show_prev_next($begin, $rows, $total_rows, $link, $limit);
echo "</table>\n\n";
}
echo "</table>\n\n";
}
response_footer();
exit;
}
response_footer();
exit;
}
}
display_bug_error($errors);
@@ -228,9 +228,9 @@ display_bug_error($warnings, 'warnings', 'WARNING:');
<select name="order_by"><?php show_order_options($limit);?></select>
<br>
<small>
<input type="radio" name="direction" value="ASC" <?php if($direction != "DESC") { echo('checked="checked"'); }?>>Ascending
&nbsp;
<input type="radio" name="direction" value="DESC" <?php if($direction == "DESC") { echo('checked="checked"'); }?>>Descending
<input type="radio" name="direction" value="ASC" <?php if($direction != "DESC") { echo('checked="checked"'); }?>>Ascending
&nbsp;
<input type="radio" name="direction" value="DESC" <?php if($direction == "DESC") { echo('checked="checked"'); }?>>Descending
</small>
<br><br>
<input type="hidden" name="cmd" value="display">
@@ -307,10 +307,10 @@ display_bug_error($warnings, 'warnings', 'WARNING:');
<td style="white-space: nowrap">Return bugs <b>assigned</b> to</td>
<td><input type="text" name="assign" value="<?php echo htmlspecialchars($assign, ENT_COMPAT, 'UTF-8'); ?>">
<?php
if (!empty($auth_user->handle)) {
$u = htmlspecialchars($auth_user->handle);
echo "<input type=\"button\" value=\"set to $u\" onclick=\"form.assign.value='$u'\">";
}
if (!empty($auth_user->handle)) {
$u = htmlspecialchars($auth_user->handle);
echo "<input type=\"button\" value=\"set to $u\" onclick=\"form.assign.value='$u'\">";
}
?>
</td>
</tr>
@@ -320,10 +320,10 @@ display_bug_error($warnings, 'warnings', 'WARNING:');
<td style="white-space: nowrap">Return bugs with author email</td>
<td><input accesskey="m" type="text" name="author_email" value="<?php echo htmlspecialchars($author_email, ENT_COMPAT, 'UTF-8'); ?>">
<?php
if (!empty($auth_user->handle)) {
$u = htmlspecialchars($auth_user->handle);
echo "<input type=\"button\" value=\"set to $u\" onclick=\"form.author_email.value='$u@php.net'\">";
}
if (!empty($auth_user->handle)) {
$u = htmlspecialchars($auth_user->handle);
echo "<input type=\"button\" value=\"set to $u\" onclick=\"form.author_email.value='$u@php.net'\">";
}
?>
</td>
</tr>
@@ -347,12 +347,12 @@ display_bug_error($warnings, 'warnings', 'WARNING:');
<td><input type="checkbox" name="pull" value="Y" <?php echo $pull == 'Y' ? " checked" : "" ?>></td>
</tr>
<tr>
<th>Commented by</th>
<td style="white-space: nowrap">Return bugs that have been <strong>commented by</strong></td>
<td><input type="email" name="commented_by" placeholder="me@example.com" value="<?php echo htmlspecialchars($commented_by, ENT_COMPAT, 'UTF-8'); ?>"></td>
<th>Commented by</th>
<td style="white-space: nowrap">Return bugs that have been <strong>commented by</strong></td>
<td><input type="email" name="commented_by" placeholder="me@example.com" value="<?php echo htmlspecialchars($commented_by, ENT_COMPAT, 'UTF-8'); ?>"></td>
</tr>
<?php
if ($is_security_developer) {
if ($is_security_developer) {
?>
<tr valign="top">
<th>Private</th>
@@ -368,46 +368,46 @@ response_footer();
function show_prev_next($begin, $rows, $total_rows, $link, $limit)
{
echo "<!-- BEGIN PREV/NEXT -->\n";
echo " <tr>\n";
echo ' <td class="search-prev_next" colspan="11">' . "\n";
echo "<!-- BEGIN PREV/NEXT -->\n";
echo " <tr>\n";
echo ' <td class="search-prev_next" colspan="11">' . "\n";
if ($limit=='All') {
echo "$total_rows Bugs</td></tr>\n";
return;
}
if ($limit=='All') {
echo "$total_rows Bugs</td></tr>\n";
return;
}
echo ' <table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n";
echo " <tr>\n";
echo ' <td class="search-prev">';
if ($begin > 0) {
echo '<a href="' . $link . '&amp;begin=';
echo max(0, $begin - $limit);
echo '">&laquo; Show Previous ' . $limit . ' Entries</a>';
} else {
echo '&nbsp;';
}
echo "</td>\n";
echo ' <table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n";
echo " <tr>\n";
echo ' <td class="search-prev">';
if ($begin > 0) {
echo '<a href="' . $link . '&amp;begin=';
echo max(0, $begin - $limit);
echo '">&laquo; Show Previous ' . $limit . ' Entries</a>';
} else {
echo '&nbsp;';
}
echo "</td>\n";
echo ' <td class="search-showing">Showing ' . ($begin+1);
echo '-' . ($begin+$rows) . ' of ' . $total_rows . "</td>\n";
echo ' <td class="search-showing">Showing ' . ($begin+1);
echo '-' . ($begin+$rows) . ' of ' . $total_rows . "</td>\n";
echo ' <td class="search-next">';
if ($begin+$rows < $total_rows) {
echo '<a href="' . $link . '&amp;begin=' . ($begin+$limit);
echo '">Show Next ' . $limit . ' Entries &raquo;</a>';
} else {
echo '&nbsp;';
}
echo "</td>\n </tr>\n </table>\n </td>\n </tr>\n";
echo "<!-- END PREV/NEXT -->\n";
echo ' <td class="search-next">';
if ($begin+$rows < $total_rows) {
echo '<a href="' . $link . '&amp;begin=' . ($begin+$limit);
echo '">Show Next ' . $limit . ' Entries &raquo;</a>';
} else {
echo '&nbsp;';
}
echo "</td>\n </tr>\n </table>\n </td>\n </tr>\n";
echo "<!-- END PREV/NEXT -->\n";
}
function show_order_options($current)
{
global $order_options;
global $order_options;
foreach ($order_options as $k => $v) {
echo '<option value="', $k, '"', ($v == $current ? ' selected="selected"' : ''), '>Sort by ', $v, "</option>\n";
}
foreach ($order_options as $k => $v) {
echo '<option value="', $k, '"', ($v == $current ? ' selected="selected"' : ''), '>Sort by ', $v, "</option>\n";
}
}

View File

@@ -13,18 +13,18 @@ bugs_authenticate($user, $pw, $logged_in, $user_flags);
response_header('Bugs Stats');
$titles = [
'Closed' => 'Closed',
'Open' => 'Open',
'Critical' => 'Crit',
'Verified' => 'Verified',
'Analyzed' => 'Analyzed',
'Assigned' => 'Assigned',
'Feedback' => 'Fdbk',
'No Feedback' => 'No&nbsp;Fdbk',
'Suspended' => 'Susp',
'Not a bug' => 'Not&nbsp;a&nbsp;bug',
'Duplicate' => 'Dupe',
'Wont fix' => 'Wont&nbsp;Fix',
'Closed' => 'Closed',
'Open' => 'Open',
'Critical' => 'Crit',
'Verified' => 'Verified',
'Analyzed' => 'Analyzed',
'Assigned' => 'Assigned',
'Feedback' => 'Fdbk',
'No Feedback' => 'No&nbsp;Fdbk',
'Suspended' => 'Susp',
'Not a bug' => 'Not&nbsp;a&nbsp;bug',
'Duplicate' => 'Dupe',
'Wont fix' => 'Wont&nbsp;Fix',
];
$rev = isset($_GET['rev']) ? $_GET['rev'] : 1;
@@ -36,54 +36,54 @@ $pkg_tmp = [];
$pkg_total = [];
$pkg_names = [];
$all = [];
$pseudo = true;
$pseudo = true;
if (!array_key_exists($sort_by, $titles)) {
$sort_by = 'Open';
$sort_by = 'Open';
}
$bug_type = $_GET['bug_type'] ?? 'All';
$bugRepository = $container->get(BugRepository::class);
foreach ($bugRepository->findAllByBugType($bug_type) as $row) {
$pkg_tmp[$row['status']][$row['package_name']] = $row['quant'];
@$pkg_total[$row['package_name']] += $row['quant'];
@$all[$row['status']] += $row['quant'];
@$total += $row['quant'];
$pkg_names[$row['package_name']] = 0;
$pkg_tmp[$row['status']][$row['package_name']] = $row['quant'];
@$pkg_total[$row['package_name']] += $row['quant'];
@$all[$row['status']] += $row['quant'];
@$total += $row['quant'];
$pkg_names[$row['package_name']] = 0;
}
if (count($pkg_tmp)) {
foreach ($titles as $key => $val) {
if (isset($pkg_tmp[$key]) && is_array($pkg_tmp[$key])) {
$pkg[$key] = array_merge($pkg_names, $pkg_tmp[$key]);
} else {
$pkg[$key] = $pkg_names;
}
}
foreach ($titles as $key => $val) {
if (isset($pkg_tmp[$key]) && is_array($pkg_tmp[$key])) {
$pkg[$key] = array_merge($pkg_names, $pkg_tmp[$key]);
} else {
$pkg[$key] = $pkg_names;
}
}
}
if ($total > 0) {
if ($rev == 1) {
arsort($pkg[$sort_by]);
} else {
asort($pkg[$sort_by]);
}
if ($rev == 1) {
arsort($pkg[$sort_by]);
} else {
asort($pkg[$sort_by]);
}
}
?>
<form method="get" action="stats.php">
<table>
<tr>
<td style="white-space: nowrap">
<strong>Bug Type:</strong>
<select class="small" id="bug_type" name="bug_type" onchange="this.form.submit(); return false;">
<?php show_type_options($bug_type, true) ?>
</select>
<input class="small" type="submit" name="submitStats" value="Search">
</td>
</tr>
</table>
<table>
<tr>
<td style="white-space: nowrap">
<strong>Bug Type:</strong>
<select class="small" id="bug_type" name="bug_type" onchange="this.form.submit(); return false;">
<?php show_type_options($bug_type, true) ?>
</select>
<input class="small" type="submit" name="submitStats" value="Search">
</td>
</tr>
</table>
</form>
<table style="width: 100%; margin-top: 1em;" class="stats-table">
@@ -91,65 +91,65 @@ if ($total > 0) {
<?php // Exit if there are no bugs for this version
if ($total == 0) {
echo '<tr><td>No bugs found</td></tr></table>' . "\n";
response_footer();
exit;
echo '<tr><td>No bugs found</td></tr></table>' . "\n";
response_footer();
exit;
}
echo display_stat_header($total, true);
echo <<< OUTPUT
<tr>
<td class="bug_head">All</td>
<td class="bug_bg0">{$total}</td>
<tr>
<td class="bug_head">All</td>
<td class="bug_bg0">{$total}</td>
OUTPUT;
$i = 1;
foreach ($titles as $key => $val) {
echo ' <td class="bug_bg' , $i++ % 2 , '">';
echo bugstats($key, 'all') , "</td>\n";
echo ' <td class="bug_bg' , $i++ % 2 , '">';
echo bugstats($key, 'all') , "</td>\n";
}
echo " </tr>\n";
echo " </tr>\n";
$stat_row = 1;
foreach ($pkg[$sort_by] as $name => $value) {
if ($name != 'all') {
// Output a new header row every 40 lines
if (($stat_row++ % 40) == 0) {
echo display_stat_header($total, false);
}
echo <<< OUTPUT
<tr>
<td class="bug_head">{$name}</td>
<td class="bug_bg0">{$pkg_total[$name]}</td>
if ($name != 'all') {
// Output a new header row every 40 lines
if (($stat_row++ % 40) == 0) {
echo display_stat_header($total, false);
}
echo <<< OUTPUT
<tr>
<td class="bug_head">{$name}</td>
<td class="bug_bg0">{$pkg_total[$name]}</td>
OUTPUT;
$i = 1;
foreach ($titles as $key => $val) {
echo ' <td class="bug_bg', $i++ % 2, '">';
echo bugstats($key, $name), "</td>\n";
}
echo " </tr>\n";
}
$i = 1;
foreach ($titles as $key => $val) {
echo ' <td class="bug_bg', $i++ % 2, '">';
echo bugstats($key, $name), "</td>\n";
}
echo " </tr>\n";
}
}
echo "</table>\n<hr>\n<p><b>PHP Versions for recent bug reports:</b></p><div>";
$last_date = null;
foreach ($bugRepository->findPhpVersions($bug_type) as $row) {
if ($row['d'] != $last_date) {
if ($last_date !== null) {
echo "</table>\n\n";
}
echo "<table style='float:left; margin-right:20px'>\n".
"<tr class='bug_header'><th colspan='2'>{$row["d"]}</th></tr>\n";
$last_date = $row['d'];
}
$version = htmlentities($row["formatted_version"], ENT_QUOTES, 'UTF-8');
echo "<tr><td class='bug_head'>{$version}</td><td class='bug_bg1'>{$row["quant"]}</td></tr>\n";
if ($row['d'] != $last_date) {
if ($last_date !== null) {
echo "</table>\n\n";
}
echo "<table style='float:left; margin-right:20px'>\n".
"<tr class='bug_header'><th colspan='2'>{$row["d"]}</th></tr>\n";
$last_date = $row['d'];
}
$version = htmlentities($row["formatted_version"], ENT_QUOTES, 'UTF-8');
echo "<tr><td class='bug_head'>{$version}</td><td class='bug_bg1'>{$row["quant"]}</td></tr>\n";
}
if ($last_date) {
echo "</table>\n";
echo "</table>\n";
}
echo "</div>\n";
@@ -159,64 +159,64 @@ response_footer();
function bugstats($status, $name)
{
global $pkg, $all, $bug_type;
global $pkg, $all, $bug_type;
if ($name == 'all') {
if (isset($all[$status])) {
return '<a href="search.php?cmd=display&amp;' .
'bug_type='.$bug_type.'&amp;status=' .$status .
'&amp;by=Any&amp;limit=30">' .
$all[$status] . "</a>\n";
}
} else {
if (empty($pkg[$status][$name])) {
return '&nbsp;';
} else {
return '<a href="search.php?cmd=display&amp;'.
'bug_type='.$bug_type.'&amp;status=' .
$status .
'&amp;package_name%5B%5D=' . urlencode($name) .
'&amp;by=Any&amp;limit=30">' .
$pkg[$status][$name] . "</a>\n";
}
}
if ($name == 'all') {
if (isset($all[$status])) {
return '<a href="search.php?cmd=display&amp;' .
'bug_type='.$bug_type.'&amp;status=' .$status .
'&amp;by=Any&amp;limit=30">' .
$all[$status] . "</a>\n";
}
} else {
if (empty($pkg[$status][$name])) {
return '&nbsp;';
} else {
return '<a href="search.php?cmd=display&amp;'.
'bug_type='.$bug_type.'&amp;status=' .
$status .
'&amp;package_name%5B%5D=' . urlencode($name) .
'&amp;by=Any&amp;limit=30">' .
$pkg[$status][$name] . "</a>\n";
}
}
}
function sort_url($name)
{
global $sort_by, $rev, $titles;
global $sort_by, $rev, $titles;
if ($name == $sort_by) {
$reve = (int) !$rev;
} else {
$reve = 1;
}
if ($sort_by != $name) {
$attr = 'class="bug_stats"';
} else {
$attr = 'class="bug_stats_choosen"';
}
return '<a href="stats.php?sort_by=' . urlencode($name) .
'&amp;rev=' . $reve . '" ' . $attr . '>' .
$titles[$name] . '</a>';
if ($name == $sort_by) {
$reve = (int) !$rev;
} else {
$reve = 1;
}
if ($sort_by != $name) {
$attr = 'class="bug_stats"';
} else {
$attr = 'class="bug_stats_choosen"';
}
return '<a href="stats.php?sort_by=' . urlencode($name) .
'&amp;rev=' . $reve . '" ' . $attr . '>' .
$titles[$name] . '</a>';
}
function display_stat_header($total, $grandtotal = true)
{
global $titles;
global $titles;
$stat_head = " <tr class='bug_header'>\n";
if ($grandtotal) {
$stat_head .= " <th>Name</th>\n";
} else {
$stat_head .= " <th>&nbsp;</th>\n";
}
$stat_head .= " <th>&nbsp;</th>\n";
$stat_head = " <tr class='bug_header'>\n";
if ($grandtotal) {
$stat_head .= " <th>Name</th>\n";
} else {
$stat_head .= " <th>&nbsp;</th>\n";
}
$stat_head .= " <th>&nbsp;</th>\n";
foreach ($titles as $key => $val) {
$stat_head .= ' <th>' . sort_url($key) . "</th>\n";
}
foreach ($titles as $key => $val) {
$stat_head .= ' <th>' . sort_url($key) . "</th>\n";
}
$stat_head .= '</tr>' . "\n";
return $stat_head;
$stat_head .= '</tr>' . "\n";
return $stat_head;
}

View File

@@ -8,13 +8,13 @@ require_once '../include/prepend.php';
$id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
if (empty($id)) {
die('invalid bug id');
die('invalid bug id');
}
if (!isset($_POST['score'])) die("missing parameter score");
$score = (int) $_POST['score'];
if ($score < -2 || $score > 2) {
die("invalid score: $score");
die("invalid score: $score");
}
if (!isset($_POST['reproduced'])) die("missing parameter reproduced");
@@ -24,40 +24,40 @@ $samever = isset($_POST['samever']) ? (int) $_POST['samever'] : 0;
$sameos = isset($_POST['sameos']) ? (int) $_POST['sameos'] : 0;
if (!$container->get(BugRepository::class)->exists($id)) {
session_start();
session_start();
// Authenticate
bugs_authenticate($user, $pw, $logged_in, $user_flags);
// Authenticate
bugs_authenticate($user, $pw, $logged_in, $user_flags);
response_header('No such bug.');
display_bug_error("No such bug #{$id}");
response_footer();
exit;
response_header('No such bug.');
display_bug_error("No such bug #{$id}");
response_footer();
exit;
}
// Figure out which IP the user is coming from avoiding RFC 1918 space
function get_real_ip ()
{
$ip = false;
$ip = false;
// User is behind a proxy and check that we discard RFC1918 IP
// addresses if they are behind a proxy then only figure out which
// IP belongs to the user. Might not need any more hacking if
// there is a squid reverse proxy infront of apache.
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip) { array_unshift($ips, $ip); $ip = false; }
for ($i = 0; $i < count($ips); $i++) {
// Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
// -- jim kill me later with my regexp pattern below.
if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i]) &&
preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $ips[$i])) {
$ip = $ips[$i];
break;
}
}
}
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
// User is behind a proxy and check that we discard RFC1918 IP
// addresses if they are behind a proxy then only figure out which
// IP belongs to the user. Might not need any more hacking if
// there is a squid reverse proxy infront of apache.
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip) { array_unshift($ips, $ip); $ip = false; }
for ($i = 0; $i < count($ips); $i++) {
// Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
// -- jim kill me later with my regexp pattern below.
if (!eregi ("^(10|172\.16|192\.168)\.", $ips[$i]) &&
preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $ips[$i])) {
$ip = $ips[$i];
break;
}
}
}
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}
$ip = ip2long(get_real_ip());
@@ -65,36 +65,36 @@ $ip = ip2long(get_real_ip());
// Check whether the user has already voted on this bug.
if (empty($container->get(VoteRepository::class)->findOneByIdAndIp($id, $ip))) {
// If the user vote isn't found, create one.
$dbh->prepare("
INSERT INTO bugdb_votes (bug, ip, score, reproduced, tried, sameos, samever)
VALUES (
{$id}, {$ip}, {$score}, " .
($reproduced == 1 ? "1," : "0,") .
($reproduced != 2 ? "1," : "0,") .
($reproduced ? "$sameos," : "NULL,") .
($reproduced ? "$samever" : "NULL") .
')'
)->execute();
// If the user vote isn't found, create one.
$dbh->prepare("
INSERT INTO bugdb_votes (bug, ip, score, reproduced, tried, sameos, samever)
VALUES (
{$id}, {$ip}, {$score}, " .
($reproduced == 1 ? "1," : "0,") .
($reproduced != 2 ? "1," : "0,") .
($reproduced ? "$sameos," : "NULL,") .
($reproduced ? "$samever" : "NULL") .
')'
)->execute();
// redirect to the bug page (which will display the success message)
redirect("bug.php?id=$id&thanks=6");
// redirect to the bug page (which will display the success message)
redirect("bug.php?id=$id&thanks=6");
} else {
// As the user has already voted, just update their existing vote.
$dbh->prepare("UPDATE bugdb_votes
SET score = ?, reproduced = ? , tried = ?, sameos = ?, samever = ?
WHERE bug = ? AND ip = ?")
->execute([
$score,
($reproduced == 1 ? "1" : "0"),
($reproduced != 2 ? "1" : "0"),
($reproduced ? "$sameos" : null),
($reproduced ? "$samever" : null),
$id,
$ip
]);
// As the user has already voted, just update their existing vote.
$dbh->prepare("UPDATE bugdb_votes
SET score = ?, reproduced = ? , tried = ?, sameos = ?, samever = ?
WHERE bug = ? AND ip = ?")
->execute([
$score,
($reproduced == 1 ? "1" : "0"),
($reproduced != 2 ? "1" : "0"),
($reproduced ? "$sameos" : null),
($reproduced ? "$samever" : null),
$id,
$ip
]);
// Let the user know they have already voted and the existing vote will be
// updated.
redirect("bug.php?id=$id&thanks=10");
// Let the user know they have already voted and the existing vote will be
// updated.
redirect("bug.php?id=$id&thanks=10");
}