svn: /pear/packages/Bugtracker/trunk/site/ bug.php report.php

From: Date: Thu, 13 Aug 2009 12:11:54 +0000
Subject: svn: /pear/packages/Bugtracker/trunk/site/ bug.php report.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-57108@lists.php.net to get a copy of this message
jani Thu, 13 Aug 2009 12:11:54 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=287216 Log: - Fixed some bad queries (certain columns do not exist anymore) and unified the style a bit Changed paths: U pear/packages/Bugtracker/trunk/site/bug.php U pear/packages/Bugtracker/trunk/site/report.php Modified: pear/packages/Bugtracker/trunk/site/bug.php =================================================================== --- pear/packages/Bugtracker/trunk/site/bug.php 2009-08-13 11:40:21 UTC (rev 287215) +++ pear/packages/Bugtracker/trunk/site/bug.php 2009-08-13 12:11:54 UTC (rev 287216) @@ -138,7 +138,7 @@ exit; } -// handle any updates, displaying errors if there were any +// Handle any updates, displaying errors if there were any $errors = array(); $previous = $current = array(); @@ -184,11 +184,10 @@ $_POST['in']['name'] = $auth_user->name; } -// FIXME: MDB2 changes '' into null? Need to pass handle like this because of it.. - $handle = $dbh->escape($_POST['in']['handle']); - $query = "INSERT INTO bugdb_comments (bug, email, handle, ts, comment, reporter_name) - VALUES (?, ?, '{$handle}', NOW(), ?, ?)"; - $res = $dbh->prepare($query)->execute(array( + $res = $dbh->prepare(' + INSERT INTO bugdb_comments (bug, email, comment, reporter_name, ts) + VALUES (?, ?, ?, ?, NOW()) + ')->execute(array( $bug_id, $_POST['in']['commentemail'], $ncomment, @@ -267,9 +266,12 @@ )); if (!empty($ncomment)) { - $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) - VALUES ({$bug_id}, ?, NOW(), ?)"; - $dbh->prepare($query)->execute(array($from, $ncomment)); + $dbh->prepare(" + INSERT INTO bugdb_comments (bug, email, comment, ts) + VALUES ({$bug_id}, ?, ?, NOW()) + ")->execute(array( + $from, $ncomment, + )); } } } elseif (isset($_POST['in']) && isset($_POST['preview']) && $edit == 2) { @@ -376,15 +378,16 @@ $_POST['in']['assign'] = $auth_user->handle; } - $dbh->prepare($query .= " - sdesc = ?, - status = ?, - package_name = ?, - bug_type = ?, - assign = ?, - php_version = ?, - php_os = ?, - ts2 = NOW() WHERE id = {$bug_id} + $dbh->prepare($query . " + sdesc = ?, + status = ?, + package_name = ?, + bug_type = ?, + assign = ?, + php_version = ?, + php_os = ?, + ts2 = NOW() + WHERE id = {$bug_id} ")->execute(array ( $_POST['in']['sdesc'], $status, @@ -395,23 +398,27 @@ $_POST['in']['php_os'], )); - $changed = bug_diff($bug, $_POST['in']); + $changed = bug_diff($bug, $_POST['in']); if (!empty($changed)) { $log_comment = bug_diff_render_html($changed); } if (!empty($log_comment)) { $dbh->prepare(" - INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, handle, comment_type) - VALUES (?, ?, NOW(), ?, ?, ?, 'log') - ")->execute(array ($bug_id, $from, $log_comment, $comment_name, $auth_user->handle)); + INSERT INTO bugdb_comments (bug, email, comment, reporter_name, comment_type, ts) + VALUES (?, ?, ?, ?, 'log', NOW()) + ")->execute(array( + $bug_id, $from, $log_comment, $comment_name, + )); } if (!empty($ncomment)) { $dbh->prepare(" - INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, handle, comment_type) - VALUES (?, ?, NOW(), ?, ?, ?, 'comment') - ")->execute(array ($bug_id, $from, $ncomment, $comment_name, $auth_user->handle)); + INSERT INTO bugdb_comments (bug, email, comment, reporter_name, comment_type, ts) + VALUES (?, ?, ?, ?, 'comment', NOW()) + ")->execute(array( + $bug_id, $from, $ncomment, $comment_name, + )); } } } elseif (isset($_POST['in']) && isset($_POST['preview']) && $edit == 1) { Modified: pear/packages/Bugtracker/trunk/site/report.php =================================================================== --- pear/packages/Bugtracker/trunk/site/report.php 2009-08-13 11:40:21 UTC (rev 287215) +++ pear/packages/Bugtracker/trunk/site/report.php 2009-08-13 12:11:54 UTC (rev 287216) @@ -44,7 +44,6 @@ // try to verify the user $_POST['in']['email'] = $auth_user->email; - $_POST['in']['handle'] = $auth_user->handle; $package_name = $_POST['in']['package_name']; $package_version = !empty($_POST['in']['package_version']) ? $_POST['in']['package_version'] : ''; @@ -143,13 +142,12 @@ $ok_to_submit_report = true; } - if ($_POST['edit_after_preview']) { + if (isset($_POST['edit_after_preview'])) { $ok_to_submit_report = false; response_header("Report - New"); } if ($ok_to_submit_report) { - $registereduser = 1; $_POST['in']['reporter_name'] = $auth_user->name; $_POST['in']['handle'] = $auth_user->handle; @@ -168,7 +166,7 @@ $fdesc .= $_POST['in']['actres'] . "\n"; } - if ($_POST['preview']) { + if (isset($_POST['preview'])) { $_POST['in']['status'] = 'Open'; $_SESSION['bug_preview'] = $_POST['in']; $_SESSION['captcha'] = $_POST['captcha']; @@ -178,9 +176,7 @@ $res = $dbh->prepare(' INSERT INTO bugdb ( - registered, package_name, - package_version, bug_type, email, sdesc, @@ -191,10 +187,9 @@ reporter_name, status, ts1 - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "Open", NOW())')->execute(array ( - $registereduser, + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, "Open", NOW()) + ')->execute(array( $package_name, - $package_version, $_POST['in']['bug_type'], $_POST['in']['email'], $_POST['in']['sdesc'], @@ -207,7 +202,7 @@ ); if (PEAR::isError($res)) { echo "<pre>"; - var_dump($_POST['in'], $fdesc, $package_version, $package_name, $registereduser); + var_dump($_POST['in'], $fdesc, $package_version, $package_name); die($res->getMessage()); } $cid = $dbh->lastInsertId(); @@ -439,7 +434,7 @@ ?> <tr> <th>Solve the problem:<br /><?php echo $captcha; ?> = ?</th> - <td class="form-input"><input type="text" name="captcha" /></td> + <td class="form-input" autocomplete="off"><input type="text" name="captcha" /></td> </tr> <?php } ?> <tr>

« previous php.pear.cvs (#57108) next »