cvs: bugtracker /htdocs/index index.php /includes bug.php functions.php template.php /template/generic/report index.php report.php
| From: | Barry Carlyon | Date: | Thu, 07 Aug 2008 08:59:50 +0000 |
| Subject: | cvs: bugtracker /htdocs/index index.php /includes bug.php functions.php template.php /template/generic/report index.php report.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-2329@lists.php.net to get a copy of this message | ||
bcarlyon Thu Aug 7 08:59:50 2008 UTC
Modified files:
/bugtracker/htdocs/index index.php
/bugtracker/includes bug.php functions.php template.php
/bugtracker/template/generic/report index.php report.php
Log:
Making backup commit
http://cvs.php.net/viewvc.cgi/bugtracker/htdocs/index/index.php?r1=1.15&r2=1.16&diff_format=u Index: bugtracker/htdocs/index/index.php diff -u bugtracker/htdocs/index/index.php:1.15 bugtracker/htdocs/index/index.php:1.16 --- bugtracker/htdocs/index/index.php:1.15 Fri Aug 1 14:31:41 2008 +++ bugtracker/htdocs/index/index.php Thu Aug 7 08:59:50 2008 @@ -48,12 +48,20 @@ //cache! $cache->load_cache(); $template->initialize(); +$template->alert = FALSE; //this is where we do stuff //its related to the page we are requesting from the server $template->determine_template(); +$template->in_engine = TRUE; $template->load_template(); +$template->in_engine = FALSE; + +if ($template->alert) +{ + include($template->template_file); +} //now we have stopped doing stuff @@ -69,8 +77,4 @@ $user->check_auth(); $user_data = array(); -//default is the user is not, will auth in a moment -$template_data['if logged_in'] = '<!--'; -$template_data['else logged_in'] = '-->'; -$template_data['endif logged_in'] = ''; http://cvs.php.net/viewvc.cgi/bugtracker/includes/bug.php?r1=1.4&r2=1.5&diff_format=u Index: bugtracker/includes/bug.php diff -u bugtracker/includes/bug.php:1.4 bugtracker/includes/bug.php:1.5 --- bugtracker/includes/bug.php:1.4 Fri Jul 11 13:14:18 2008 +++ bugtracker/includes/bug.php Thu Aug 7 08:59:50 2008 @@ -5,10 +5,10 @@ function report() { //lets add the bug to the bug database shall we? global $bug_data,$db,$user,$email_data,$email; + //we need to know if the user is logged in //skip check for now - $email_data['send'] = TRUE; $email_data['subject'] = 'PHP BUGZ: Bug Reported'; $email_data['bug'] = ''; http://cvs.php.net/viewvc.cgi/bugtracker/includes/functions.php?r1=1.17&r2=1.18&diff_format=u Index: bugtracker/includes/functions.php diff -u bugtracker/includes/functions.php:1.17 bugtracker/includes/functions.php:1.18 --- bugtracker/includes/functions.php:1.17 Fri Aug 1 14:31:41 2008 +++ bugtracker/includes/functions.php Thu Aug 7 08:59:50 2008 @@ -167,9 +167,9 @@ //error control -function theerrorhandler($errno, $errstr, $errfile, $errline) +function theerrorhandler($errno, $errstr, $errfile, $errline, $context) { -trace('ERROR -> in backtrace now'); + trace('ERROR -> in backtrace now'); global $backtrace; $fail = ''; switch ($errno) { @@ -186,14 +186,44 @@ case E_USER_NOTICE: $fail = "<b>My NOTICE</b> [$errno] $errstr<br />\n"; break; + + case E_NOTICE: + $fail = "<b>Notice:</b> $errstr - $errfile, $errline<br />\n"; + $backtrace = '<strong>' . $fail . '</strong>'; + break; + case E_WARNING: + $fail = "<b>Warning:</b> $errstr - $errfile, $errline<br />\n"; + $backtrace = '<strong>' . $fail . '</strong>'; + $backtrace .= 'Ref:<br /><table>'; + foreach ($context as $ref => $data) + { + $backtrace .= "<tr><td>$ref</td><td>"; + if (get_class($data)) + { + $backtrace .= get_class($data) . '</td></tr>'; + } + else if (is_array($data)) + { + $backtrace .= '</td></tr>'; + foreach ($data as $nref => $ndata) + { + $backtrace .= '<tr><td></td><td>' . $nref . '</td><td>' . $ndata . '</td></tr>'; + } + } + else + { + $backtrace .= $data . '</td></tr>'; + } + } + $backtrace .= '</table>'; + //errorarray(debug_backtrace()); + break; default: $fail = "Unknown error type: [$errno] $errstr<br />\n"; + $backtrace = '<strong>' . $fail . '</strong>'; + errorarray(debug_backtrace()); break; } - - $backtrace .= '<strong>' . $fail . '</strong>'; - errorarray(debug_backtrace()); - $first_flag = FALSE; return; @@ -229,6 +259,7 @@ } } } + $backtrace .= '<hr />'; return; } http://cvs.php.net/viewvc.cgi/bugtracker/includes/template.php?r1=1.7&r2=1.8&diff_format=u Index: bugtracker/includes/template.php diff -u bugtracker/includes/template.php:1.7 bugtracker/includes/template.php:1.8 --- bugtracker/includes/template.php:1.7 Wed Aug 6 11:18:16 2008 +++ bugtracker/includes/template.php Thu Aug 7 08:59:50 2008 @@ -74,7 +74,7 @@ return; } function meta_refresh($target, $time = 3) { - $this->meta = '<meta tt-equive="refresh" content="' . $target . ';' . $time . '" />' . "\n"; + $this->meta = '<meta http-equiv="refresh" content="' . $time . ';' . $target . '" />' . "\n"; } function load_jscript($jscripts) { if (is_array($jscripts)) { @@ -111,7 +111,6 @@ $this->system_error = '<div id="error">' . $this->system_error . '</div>'; } $this->swap('system_error', $this->system_error ); - $this->swap('form_error', $this->form_error ); return; } @@ -150,7 +149,7 @@ $this->html = preg_replace("[\>\{[\w\d].*\}\<]", '><', $this->html); //strip \ {} $this->html = preg_replace("[ \{[\w\d].*\}]", ' ', $this->html); - $this->html = preg_replace("[@]", '[cookies]', $this->html); +// $this->html = preg_replace("[@]", '[cookies]', $this->html); echo $this->html; return; @@ -226,11 +225,22 @@ if (is_array($data)) { foreach ($data as $nref => $ndata) { + + if ($mod == 'ERROR_') + { + $ndata = $ndata ? '<div class="error">' . $ndata . '</div>' : ''; + } + $ndata = $this->sanitize($ndata); $ndata = $this->time_check($nref, $ndata, $data); $html = $this->swap($mod . $nref, $ndata, $html); } } else { + if ($mod == 'ERROR_') + { + $data = $data ? '<div class="error">' . $data . '</div>' : ''; + } + $data = $this->sanitize($data); $data = $this->time_check($ref, $data, $loop_data); $html = $this->swap($mod . $ref, $data, $html); @@ -243,7 +253,7 @@ { $out = $in; - if (substr($in,0,7) == '<option') + if ((substr($in,0,7) == '<option') || (substr($in,0,4) == '<div')) { $out = $in; } @@ -329,8 +339,11 @@ } function load_template() { global $db,$cache; + $bypass = FALSE; if ($this->template_type == 'php') { include($this->template_file); + if ($bypass == TRUE) + $this->alert = TRUE; } if ($this->template_type == 'html') { $this->prehtml = file_get_contents($this->template_file); http://cvs.php.net/viewvc.cgi/bugtracker/template/generic/report/index.php?r1=1.11&r2=1.12&diff_format=u Index: bugtracker/template/generic/report/index.php diff -u bugtracker/template/generic/report/index.php:1.11 bugtracker/template/generic/report/index.php:1.12 --- bugtracker/template/generic/report/index.php:1.11 Wed Aug 6 11:18:16 2008 +++ bugtracker/template/generic/report/index.php Thu Aug 7 08:59:50 2008 @@ -5,10 +5,9 @@ $this->page_title .= 'Reporting a bug'; $this->content_title = 'Reporting a bug'; -$form_data['form_error'] = isset($form_data['form_error']) ? $form_data['form_error'] : ''; +$form_data['form_error'] = isset($form_data['form_error']) ? '<div id="error">' . $form_data['form_error'] . '</div>' : ''; //form_data recovers form_data //this is pushed to dsp_data for template process -$form_data['email'] = isset($form_data['email']) ? $form_data['email'] : ''; $form_data['php_version'] = isset($form_data['php_version']) ? $form_data['php_version'] : ''; $form_data['bug_type'] = isset($form_data['bug_type']) ? $form_data['bug_type'] : ''; $form_data['os_version'] = isset($form_data['os_version']) ? $form_data['os_version'] : ''; @@ -19,6 +18,10 @@ $form_data['php_versions'] .= '<option value="na">Irrelevant</option><option value="early">Earlier? Upgrade First</option>'; +$form_data['recap_error'] = isset($form_data['recap_error']) ? $form_data['recap_error'] : ''; + +$error_data = isset($error_data) ? $error_data : array(); + $this->prehtml = '<p> Before you report a bug, make sure to search for similar bugs using the form at the top of the page or our <a href="/search.php">advanced search page</a>. <br /><br /> @@ -47,16 +50,61 @@ {IF LOGGED_IN} You are Logged In {ELSE LOGGED_IN} - <label for="email">Email Address: {ERROR_EMAIL} </label> <input type="text" name="email" id="email" value="{FORM_EMAIL}" /> + <label for="email">Email Address: {ERROR_EMAIL} </label> <input type="text" name="email" id="email" value="{FORM_EMAIL}" /> <br /><br /> {ENDIF LOGGED_IN} - <label for="php_version">PHP version: {ERROR_PHP_VERSION}</label> <select name="php_version" id="php_version"><option value="">--Please Select--</option>{FORM_PHP_VERSIONS}</select> + <label for="bug_type">Bug Type: {ERROR_BUG_TYPE}</label> <select name="bug_type" id="bug_type"><option value="">--Please Select--</option>{FORM_BUG_TYPES}</select> + <br /><br /> + <label for="php_version">PHP version: {ERROR_PHP_VERSION}</label> <select name="php_version" id="php_version"><option value="">--Please Select--</option>{FORM_PHP_VERSIONS}</select> + <br /><br /> + <label for="os_verion">OS Version: {ERROR_OS_VERSION}</label> <select name="os_version" id="os_version"><option value="">--Please Select--</option>{FORM_OS_VERSIONS}</select> + <br /><br /> + <label for="summary">Summary: AKA title{ERROR_SUMMARY}</label> <input type="text" name="summary" id="summary" value="{FORM_SUMMARY}" maxlength="30" onkeypress="update(this);" onkeyup="update(this)" onblur="endupdate(this)" onfocus="update(this)" /><div id="summary_left" style="float: right; margin-right: 5px; display: none;" >30 Characters Left</div> + <br /><br /> + {IF LOGGED_IN} + {ELSE LOGGED_IN} + <label for="password">Password: {ERROR_PASSWORD}</label> <input type="password" name="password" id="password" /> + <br /><br /> + <!-- capthcha --> + <label for="captcha">Captcha: {ERROR_CAPTCHA}</label> <div id="captcha">'; +global $recaptcha_key; +$content .= recaptcha_get_html($recaptcha_key,$form_data['recap_error']); +$content .= ' </div><hr /> + {ENDIF LOGGED_IN} </div> + <ul> + <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 (<strong>not</strong> your whole php.ini!)</li> + <li>A <a href="/bugs-generating-backtrace.php">gdb backtrace</a> or <a href="/bugs-generating-backtrace-win32.php">Win32 backtrace</a></li> + </ul> + <br /><br /> + <label for="description">Description: {ERROR_DESCRIPTION}</label> + <textarea rows="10" cols="50" name="description" id="description">{FORM_DESCRIPTION}</textarea> + <br /><br />Please <strong>do not</strong> insert any huge text here. Keep the description as short as possible. If we want to get a strace, we will ask for it separately. +<div class="blocker"></div> + <br /> + <label for="reproduce">Reproduce: {ERROR_REPRODUCE}</label> + <textarea rows="10" cols="50" name="reproduce" id="reproduce">{FORM_REPRODUCE}</textarea> + <br /><br />Please do not post more than 20 lines of source code. + <br />If the code is longer then 20 lines, provide an URL to the source code that will reproduce the bug. + <br />You could use <a href="http://pastebin.com">Pastebin</a> +<div class="blocker"></div> + <br /> + <label for="expected">Expected: {ERROR_EXPECTED}</label> + <textarea rows="10" cols="50" name="expected" id="expected">{FORM_EXPECTED}</textarea> + <br /><br />What do you expect to happen or see when you run the code above? +<div class="blocker"></div> + <br /> + <label for="actual">Actual result: {ERROR_ACTUAL}</label> + <textarea rows="10" cols="50" name="actual" id="actual">{FORM_ACTUAL}</textarea> + <br /><br />This could be a <a href="/bugs-generating-backtrace.php">backtrace</a> for example. + <br />Try to keep it as short as possible without leaving anything relevant out. +<div class="blocker"></div> + <input type="submit" value="Send Bug Report" style="margin-right: 200px;" /> </form>'; -//generate items for swap -$error_data = array(); - $content = $this->dontloop(array('form' => $form_data, 'error' => $error_data), $content); $this->prehtml .= $content; http://cvs.php.net/viewvc.cgi/bugtracker/template/generic/report/report.php?r1=1.6&r2=1.7&diff_format=u Index: bugtracker/template/generic/report/report.php diff -u bugtracker/template/generic/report/report.php:1.6 bugtracker/template/generic/report/report.php:1.7 --- bugtracker/template/generic/report/report.php:1.6 Thu Jul 31 13:27:30 2008 +++ bugtracker/template/generic/report/report.php Thu Aug 7 08:59:50 2008 @@ -1,5 +1,13 @@ <?php +//global $bug, $comment; + +$bypass = TRUE; + +//print_r(get_class_methods($this)); +if (!is_array(get_class_methods($this))) +{ + $form_data['email'] = loadvar('email'); $form_data['php_version'] = loadvar('php_version'); $form_data['bug_type'] = loadvar('bug_type'); @@ -18,26 +26,26 @@ //lazy mans method foreach($form_data as $ref => $data) { - $form_data['error'][$ref] = $data ? FALSE : TRUE; + $error_data[$ref] = $data ? FALSE : TRUE; } //lets validatate the code field and others if needed if ($form_data['reproduce']) { //reproduce code supplied, need expected and actual - $form_data['error']['reproduce'] = $form_data['reproduce'] ? FALSE : TRUE; - $form_data['error']['expected'] = $form_data['expected'] ? FALSE : TRUE; - $form_data['error']['actual'] = $form_data['actual'] ? FALSE : TRUE; + $error_data['reproduce'] = $form_data['reproduce'] ? FALSE : TRUE; + $error_data['expected'] = $form_data['expected'] ? FALSE : TRUE; + $error_data['actual'] = $form_data['actual'] ? FALSE : TRUE; } else { - $form_data['error']['reproduce'] = FALSE; - $form_data['error']['expected'] = FALSE; - $form_data['error']['actual'] = FALSE; + $error_data['reproduce'] = FALSE; + $error_data['expected'] = FALSE; + $error_data['actual'] = FALSE; } //email -$form_data['invalid']['email'] = check_email_mx($form_data['email']) ? FALSE : TRUE; +$error_data['email'] = check_email_mx($form_data['email']) ? FALSE : '* Invalid'; //which form elements are req*? //email and password needed if not logged in @@ -45,52 +53,61 @@ //password if not logged in //lets do the captcha check +//global $user; + if (!$user->logged_in) { //check captcha require_once($_SERVER['DOCUMENT_ROOT'] . '../includes/recaptchalib.php'); +//echo 'database'; +//print_r($database); +//exit; + global $recaptcha_prv; $recap_resp = recaptcha_check_answer($recaptcha_prv,$_SERVER['REMOTE_ADDR'],$form_data['recaptcha_challenge_field'],$form_data['recaptcha_response_field']); -// $recap_resp = recaptcha_check_answer($recaptcha_prv,$_SERVER['REMOTE_ADDR'],$_POST['recaptcha_challenge_field'],$_POST['recaptcha_response_field']); if ($recap_resp->is_valid) { //all is well - $form_data['invalid']['captcha'] = FALSE; + $error_data['captcha'] = FALSE; } else { - $form_data['invalid']['captcha'] = TRUE; + $error_data['captcha'] = 'The Captcha is invalid'; $form_data['recap_error'] = $recap_resp->error; } } $errors = FALSE; //error check -foreach ($form_data['error'] as $ref => $empty) +foreach ($error_data as $ref => $empty) { if ($empty) { $errors = TRUE; + if (strlen($empty) == 1) + $error_data[$ref] = '* Required'; } } -foreach ($form_data['invalid'] as $ref => $invalid) -{ - if ($invalid == TRUE) - { - $errors = TRUE; - } -} - -/* -echo '<h1>' . $errors .'</h1>'; -print_r($form_data['error']); -echo '<br />'; -print_r($form_data['invalid']); -*/ if ($errors) { - $form_data['form_error']= 'Please correct the errors shown'; - $content .= '<h2>Errors</h2>'; + $form_data['form_error'] = 'Please correct the errors shown'; include($_SERVER['DOCUMENT_ROOT'] . '../template/generic/report/index.php'); +// global $template; + +//echo 'cookie'; +//echo $template->template_file; +//exit; + //restart + +// $template = new template(); +// $template->initialize(); + +// $template->template_file = $_SERVER['DOCUMENT_ROOT'] . '../template/generic/report/index.php'; +// $template->template_type = 'php'; +// $template->load_template(); + +// $this->template_file = $_SERVER['DOCUMENT_ROOT'] . '../template/generic/report/index.php'; +// $this->template_type = 'php'; +// $this->load_template(); } else { @@ -122,12 +139,19 @@ $meta_refresh['url'] = '/bug/' . $bug->bug_id; $meta_refresh['time'] = 10; - $content .= '<h2>Bug Reported</h2>'; + $template->meta_refresh($meta_refresh['url'], $meta_refresh['time']); + + $content = '<h2>Bug Reported</h2>'; $content .= '<div id="success">'; $content .= '<p>Your Bug has been added successfully.</p>'; $content .= '<p>You should recieve an email confirming this.</p>'; $content .= '<p>You will be redirected to your bug in ' . $meta_refresh['time'] . ' seconds or you can <a href="' . $meta_refresh['url'] .'">click here to go there</a>.</p>'; $content .= '</div>'; + $template->prehtml = $content; +} +} +else +{ +//echo 'in the engine'; } -
http://cvs.php.net/viewvc.cgi/bugtracker/htdocs/index/index.php?r1=1.15&r2=1.16&diff_format=u Index: bugtracker/htdocs/index/index.php diff -u bugtracker/htdocs/index/index.php:1.15 bugtracker/htdocs/index/index.php:1.16 --- bugtracker/htdocs/index/index.php:1.15 Fri Aug 1 14:31:41 2008 +++ bugtracker/htdocs/index/index.php Thu Aug 7 08:59:50 2008 @@ -48,12 +48,20 @@ //cache! $cache->load_cache(); $template->initialize(); +$template->alert = FALSE; //this is where we do stuff //its related to the page we are requesting from the server $template->determine_template(); +$template->in_engine = TRUE; $template->load_template(); +$template->in_engine = FALSE; + +if ($template->alert) +{ + include($template->template_file); +} //now we have stopped doing stuff @@ -69,8 +77,4 @@ $user->check_auth(); $user_data = array(); -//default is the user is not, will auth in a moment -$template_data['if logged_in'] = '<!--'; -$template_data['else logged_in'] = '-->'; -$template_data['endif logged_in'] = ''; http://cvs.php.net/viewvc.cgi/bugtracker/includes/bug.php?r1=1.4&r2=1.5&diff_format=u Index: bugtracker/includes/bug.php diff -u bugtracker/includes/bug.php:1.4 bugtracker/includes/bug.php:1.5 --- bugtracker/includes/bug.php:1.4 Fri Jul 11 13:14:18 2008 +++ bugtracker/includes/bug.php Thu Aug 7 08:59:50 2008 @@ -5,10 +5,10 @@ function report() { //lets add the bug to the bug database shall we? global $bug_data,$db,$user,$email_data,$email; + //we need to know if the user is logged in //skip check for now - $email_data['send'] = TRUE; $email_data['subject'] = 'PHP BUGZ: Bug Reported'; $email_data['bug'] = ''; http://cvs.php.net/viewvc.cgi/bugtracker/includes/functions.php?r1=1.17&r2=1.18&diff_format=u Index: bugtracker/includes/functions.php diff -u bugtracker/includes/functions.php:1.17 bugtracker/includes/functions.php:1.18 --- bugtracker/includes/functions.php:1.17 Fri Aug 1 14:31:41 2008 +++ bugtracker/includes/functions.php Thu Aug 7 08:59:50 2008 @@ -167,9 +167,9 @@ //error control -function theerrorhandler($errno, $errstr, $errfile, $errline) +function theerrorhandler($errno, $errstr, $errfile, $errline, $context) { -trace('ERROR -> in backtrace now'); + trace('ERROR -> in backtrace now'); global $backtrace; $fail = ''; switch ($errno) { @@ -186,14 +186,44 @@ case E_USER_NOTICE: $fail = "<b>My NOTICE</b> [$errno] $errstr<br />\n"; break; + + case E_NOTICE: + $fail = "<b>Notice:</b> $errstr - $errfile, $errline<br />\n"; + $backtrace = '<strong>' . $fail . '</strong>'; + break; + case E_WARNING: + $fail = "<b>Warning:</b> $errstr - $errfile, $errline<br />\n"; + $backtrace = '<strong>' . $fail . '</strong>'; + $backtrace .= 'Ref:<br /><table>'; + foreach ($context as $ref => $data) + { + $backtrace .= "<tr><td>$ref</td><td>"; + if (get_class($data)) + { + $backtrace .= get_class($data) . '</td></tr>'; + } + else if (is_array($data)) + { + $backtrace .= '</td></tr>'; + foreach ($data as $nref => $ndata) + { + $backtrace .= '<tr><td></td><td>' . $nref . '</td><td>' . $ndata . '</td></tr>'; + } + } + else + { + $backtrace .= $data . '</td></tr>'; + } + } + $backtrace .= '</table>'; + //errorarray(debug_backtrace()); + break; default: $fail = "Unknown error type: [$errno] $errstr<br />\n"; + $backtrace = '<strong>' . $fail . '</strong>'; + errorarray(debug_backtrace()); break; } - - $backtrace .= '<strong>' . $fail . '</strong>'; - errorarray(debug_backtrace()); - $first_flag = FALSE; return; @@ -229,6 +259,7 @@ } } } + $backtrace .= '<hr />'; return; } http://cvs.php.net/viewvc.cgi/bugtracker/includes/template.php?r1=1.7&r2=1.8&diff_format=u Index: bugtracker/includes/template.php diff -u bugtracker/includes/template.php:1.7 bugtracker/includes/template.php:1.8 --- bugtracker/includes/template.php:1.7 Wed Aug 6 11:18:16 2008 +++ bugtracker/includes/template.php Thu Aug 7 08:59:50 2008 @@ -74,7 +74,7 @@ return; } function meta_refresh($target, $time = 3) { - $this->meta = '<meta tt-equive="refresh" content="' . $target . ';' . $time . '" />' . "\n"; + $this->meta = '<meta http-equiv="refresh" content="' . $time . ';' . $target . '" />' . "\n"; } function load_jscript($jscripts) { if (is_array($jscripts)) { @@ -111,7 +111,6 @@ $this->system_error = '<div id="error">' . $this->system_error . '</div>'; } $this->swap('system_error', $this->system_error ); - $this->swap('form_error', $this->form_error ); return; } @@ -150,7 +149,7 @@ $this->html = preg_replace("[\>\{[\w\d].*\}\<]", '><', $this->html); //strip \ {} $this->html = preg_replace("[ \{[\w\d].*\}]", ' ', $this->html); - $this->html = preg_replace("[@]", '[cookies]', $this->html); +// $this->html = preg_replace("[@]", '[cookies]', $this->html); echo $this->html; return; @@ -226,11 +225,22 @@ if (is_array($data)) { foreach ($data as $nref => $ndata) { + + if ($mod == 'ERROR_') + { + $ndata = $ndata ? '<div class="error">' . $ndata . '</div>' : ''; + } + $ndata = $this->sanitize($ndata); $ndata = $this->time_check($nref, $ndata, $data); $html = $this->swap($mod . $nref, $ndata, $html); } } else { + if ($mod == 'ERROR_') + { + $data = $data ? '<div class="error">' . $data . '</div>' : ''; + } + $data = $this->sanitize($data); $data = $this->time_check($ref, $data, $loop_data); $html = $this->swap($mod . $ref, $data, $html); @@ -243,7 +253,7 @@ { $out = $in; - if (substr($in,0,7) == '<option') + if ((substr($in,0,7) == '<option') || (substr($in,0,4) == '<div')) { $out = $in; } @@ -329,8 +339,11 @@ } function load_template() { global $db,$cache; + $bypass = FALSE; if ($this->template_type == 'php') { include($this->template_file); + if ($bypass == TRUE) + $this->alert = TRUE; } if ($this->template_type == 'html') { $this->prehtml = file_get_contents($this->template_file); http://cvs.php.net/viewvc.cgi/bugtracker/template/generic/report/index.php?r1=1.11&r2=1.12&diff_format=u Index: bugtracker/template/generic/report/index.php diff -u bugtracker/template/generic/report/index.php:1.11 bugtracker/template/generic/report/index.php:1.12 --- bugtracker/template/generic/report/index.php:1.11 Wed Aug 6 11:18:16 2008 +++ bugtracker/template/generic/report/index.php Thu Aug 7 08:59:50 2008 @@ -5,10 +5,9 @@ $this->page_title .= 'Reporting a bug'; $this->content_title = 'Reporting a bug'; -$form_data['form_error'] = isset($form_data['form_error']) ? $form_data['form_error'] : ''; +$form_data['form_error'] = isset($form_data['form_error']) ? '<div id="error">' . $form_data['form_error'] . '</div>' : ''; //form_data recovers form_data //this is pushed to dsp_data for template process -$form_data['email'] = isset($form_data['email']) ? $form_data['email'] : ''; $form_data['php_version'] = isset($form_data['php_version']) ? $form_data['php_version'] : ''; $form_data['bug_type'] = isset($form_data['bug_type']) ? $form_data['bug_type'] : ''; $form_data['os_version'] = isset($form_data['os_version']) ? $form_data['os_version'] : ''; @@ -19,6 +18,10 @@ $form_data['php_versions'] .= '<option value="na">Irrelevant</option><option value="early">Earlier? Upgrade First</option>'; +$form_data['recap_error'] = isset($form_data['recap_error']) ? $form_data['recap_error'] : ''; + +$error_data = isset($error_data) ? $error_data : array(); + $this->prehtml = '<p> Before you report a bug, make sure to search for similar bugs using the form at the top of the page or our <a href="/search.php">advanced search page</a>. <br /><br /> @@ -47,16 +50,61 @@ {IF LOGGED_IN} You are Logged In {ELSE LOGGED_IN} - <label for="email">Email Address: {ERROR_EMAIL} </label> <input type="text" name="email" id="email" value="{FORM_EMAIL}" /> + <label for="email">Email Address: {ERROR_EMAIL} </label> <input type="text" name="email" id="email" value="{FORM_EMAIL}" /> <br /><br /> {ENDIF LOGGED_IN} - <label for="php_version">PHP version: {ERROR_PHP_VERSION}</label> <select name="php_version" id="php_version"><option value="">--Please Select--</option>{FORM_PHP_VERSIONS}</select> + <label for="bug_type">Bug Type: {ERROR_BUG_TYPE}</label> <select name="bug_type" id="bug_type"><option value="">--Please Select--</option>{FORM_BUG_TYPES}</select> + <br /><br /> + <label for="php_version">PHP version: {ERROR_PHP_VERSION}</label> <select name="php_version" id="php_version"><option value="">--Please Select--</option>{FORM_PHP_VERSIONS}</select> + <br /><br /> + <label for="os_verion">OS Version: {ERROR_OS_VERSION}</label> <select name="os_version" id="os_version"><option value="">--Please Select--</option>{FORM_OS_VERSIONS}</select> + <br /><br /> + <label for="summary">Summary: AKA title{ERROR_SUMMARY}</label> <input type="text" name="summary" id="summary" value="{FORM_SUMMARY}" maxlength="30" onkeypress="update(this);" onkeyup="update(this)" onblur="endupdate(this)" onfocus="update(this)" /><div id="summary_left" style="float: right; margin-right: 5px; display: none;" >30 Characters Left</div> + <br /><br /> + {IF LOGGED_IN} + {ELSE LOGGED_IN} + <label for="password">Password: {ERROR_PASSWORD}</label> <input type="password" name="password" id="password" /> + <br /><br /> + <!-- capthcha --> + <label for="captcha">Captcha: {ERROR_CAPTCHA}</label> <div id="captcha">'; +global $recaptcha_key; +$content .= recaptcha_get_html($recaptcha_key,$form_data['recap_error']); +$content .= ' </div><hr /> + {ENDIF LOGGED_IN} </div> + <ul> + <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 (<strong>not</strong> your whole php.ini!)</li> + <li>A <a href="/bugs-generating-backtrace.php">gdb backtrace</a> or <a href="/bugs-generating-backtrace-win32.php">Win32 backtrace</a></li> + </ul> + <br /><br /> + <label for="description">Description: {ERROR_DESCRIPTION}</label> + <textarea rows="10" cols="50" name="description" id="description">{FORM_DESCRIPTION}</textarea> + <br /><br />Please <strong>do not</strong> insert any huge text here. Keep the description as short as possible. If we want to get a strace, we will ask for it separately. +<div class="blocker"></div> + <br /> + <label for="reproduce">Reproduce: {ERROR_REPRODUCE}</label> + <textarea rows="10" cols="50" name="reproduce" id="reproduce">{FORM_REPRODUCE}</textarea> + <br /><br />Please do not post more than 20 lines of source code. + <br />If the code is longer then 20 lines, provide an URL to the source code that will reproduce the bug. + <br />You could use <a href="http://pastebin.com">Pastebin</a> +<div class="blocker"></div> + <br /> + <label for="expected">Expected: {ERROR_EXPECTED}</label> + <textarea rows="10" cols="50" name="expected" id="expected">{FORM_EXPECTED}</textarea> + <br /><br />What do you expect to happen or see when you run the code above? +<div class="blocker"></div> + <br /> + <label for="actual">Actual result: {ERROR_ACTUAL}</label> + <textarea rows="10" cols="50" name="actual" id="actual">{FORM_ACTUAL}</textarea> + <br /><br />This could be a <a href="/bugs-generating-backtrace.php">backtrace</a> for example. + <br />Try to keep it as short as possible without leaving anything relevant out. +<div class="blocker"></div> + <input type="submit" value="Send Bug Report" style="margin-right: 200px;" /> </form>'; -//generate items for swap -$error_data = array(); - $content = $this->dontloop(array('form' => $form_data, 'error' => $error_data), $content); $this->prehtml .= $content; http://cvs.php.net/viewvc.cgi/bugtracker/template/generic/report/report.php?r1=1.6&r2=1.7&diff_format=u Index: bugtracker/template/generic/report/report.php diff -u bugtracker/template/generic/report/report.php:1.6 bugtracker/template/generic/report/report.php:1.7 --- bugtracker/template/generic/report/report.php:1.6 Thu Jul 31 13:27:30 2008 +++ bugtracker/template/generic/report/report.php Thu Aug 7 08:59:50 2008 @@ -1,5 +1,13 @@ <?php +//global $bug, $comment; + +$bypass = TRUE; + +//print_r(get_class_methods($this)); +if (!is_array(get_class_methods($this))) +{ + $form_data['email'] = loadvar('email'); $form_data['php_version'] = loadvar('php_version'); $form_data['bug_type'] = loadvar('bug_type'); @@ -18,26 +26,26 @@ //lazy mans method foreach($form_data as $ref => $data) { - $form_data['error'][$ref] = $data ? FALSE : TRUE; + $error_data[$ref] = $data ? FALSE : TRUE; } //lets validatate the code field and others if needed if ($form_data['reproduce']) { //reproduce code supplied, need expected and actual - $form_data['error']['reproduce'] = $form_data['reproduce'] ? FALSE : TRUE; - $form_data['error']['expected'] = $form_data['expected'] ? FALSE : TRUE; - $form_data['error']['actual'] = $form_data['actual'] ? FALSE : TRUE; + $error_data['reproduce'] = $form_data['reproduce'] ? FALSE : TRUE; + $error_data['expected'] = $form_data['expected'] ? FALSE : TRUE; + $error_data['actual'] = $form_data['actual'] ? FALSE : TRUE; } else { - $form_data['error']['reproduce'] = FALSE; - $form_data['error']['expected'] = FALSE; - $form_data['error']['actual'] = FALSE; + $error_data['reproduce'] = FALSE; + $error_data['expected'] = FALSE; + $error_data['actual'] = FALSE; } //email -$form_data['invalid']['email'] = check_email_mx($form_data['email']) ? FALSE : TRUE; +$error_data['email'] = check_email_mx($form_data['email']) ? FALSE : '* Invalid'; //which form elements are req*? //email and password needed if not logged in @@ -45,52 +53,61 @@ //password if not logged in //lets do the captcha check +//global $user; + if (!$user->logged_in) { //check captcha require_once($_SERVER['DOCUMENT_ROOT'] . '../includes/recaptchalib.php'); +//echo 'database'; +//print_r($database); +//exit; + global $recaptcha_prv; $recap_resp = recaptcha_check_answer($recaptcha_prv,$_SERVER['REMOTE_ADDR'],$form_data['recaptcha_challenge_field'],$form_data['recaptcha_response_field']); -// $recap_resp = recaptcha_check_answer($recaptcha_prv,$_SERVER['REMOTE_ADDR'],$_POST['recaptcha_challenge_field'],$_POST['recaptcha_response_field']); if ($recap_resp->is_valid) { //all is well - $form_data['invalid']['captcha'] = FALSE; + $error_data['captcha'] = FALSE; } else { - $form_data['invalid']['captcha'] = TRUE; + $error_data['captcha'] = 'The Captcha is invalid'; $form_data['recap_error'] = $recap_resp->error; } } $errors = FALSE; //error check -foreach ($form_data['error'] as $ref => $empty) +foreach ($error_data as $ref => $empty) { if ($empty) { $errors = TRUE; + if (strlen($empty) == 1) + $error_data[$ref] = '* Required'; } } -foreach ($form_data['invalid'] as $ref => $invalid) -{ - if ($invalid == TRUE) - { - $errors = TRUE; - } -} - -/* -echo '<h1>' . $errors .'</h1>'; -print_r($form_data['error']); -echo '<br />'; -print_r($form_data['invalid']); -*/ if ($errors) { - $form_data['form_error']= 'Please correct the errors shown'; - $content .= '<h2>Errors</h2>'; + $form_data['form_error'] = 'Please correct the errors shown'; include($_SERVER['DOCUMENT_ROOT'] . '../template/generic/report/index.php'); +// global $template; + +//echo 'cookie'; +//echo $template->template_file; +//exit; + //restart + +// $template = new template(); +// $template->initialize(); + +// $template->template_file = $_SERVER['DOCUMENT_ROOT'] . '../template/generic/report/index.php'; +// $template->template_type = 'php'; +// $template->load_template(); + +// $this->template_file = $_SERVER['DOCUMENT_ROOT'] . '../template/generic/report/index.php'; +// $this->template_type = 'php'; +// $this->load_template(); } else { @@ -122,12 +139,19 @@ $meta_refresh['url'] = '/bug/' . $bug->bug_id; $meta_refresh['time'] = 10; - $content .= '<h2>Bug Reported</h2>'; + $template->meta_refresh($meta_refresh['url'], $meta_refresh['time']); + + $content = '<h2>Bug Reported</h2>'; $content .= '<div id="success">'; $content .= '<p>Your Bug has been added successfully.</p>'; $content .= '<p>You should recieve an email confirming this.</p>'; $content .= '<p>You will be redirected to your bug in ' . $meta_refresh['time'] . ' seconds or you can <a href="' . $meta_refresh['url'] .'">click here to go there</a>.</p>'; $content .= '</div>'; + $template->prehtml = $content; +} +} +else +{ +//echo 'in the engine'; } -