cvs: bugtracker /includes cache.php functions.php /template/generic/report index.php
| From: | Barry Carlyon | Date: | Thu, 31 Jul 2008 13:11:05 +0000 |
| Subject: | cvs: bugtracker /includes cache.php functions.php /template/generic/report index.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-2257@lists.php.net to get a copy of this message | ||
bcarlyon Thu Jul 31 13:11:05 2008 UTC
Modified files:
/bugtracker/includes cache.php functions.php
/bugtracker/template/generic/report index.php
Log:
Moved and upgraded the cache convert function
http://cvs.php.net/viewvc.cgi/bugtracker/includes/cache.php?r1=1.4&r2=1.5&diff_format=u
Index: bugtracker/includes/cache.php
diff -u bugtracker/includes/cache.php:1.4 bugtracker/includes/cache.php:1.5
--- bugtracker/includes/cache.php:1.4 Thu Jul 31 12:34:20 2008
+++ bugtracker/includes/cache.php Thu Jul 31 13:11:04 2008
@@ -45,6 +45,7 @@
return;
}
+ // return a single element
function obtain($thecache, $ref)
{
$thiscache = $this->$thecache;
@@ -69,5 +70,41 @@
return;
}
+
+ //like a cash convertor but for cache
+ function convert($thecache, $method, $selected = '', $minrange = 0, $maxrange =
'')
+ {
+ $thiscache = $this->$thecache;
+
+ if (empty($maxrange))
+ {
+ $maxrange = sizeof($thiscache);
+ }
+
+ $return_data = '';
+ //convert a given cache to another format
+ if ($method == 'select')
+ {
+ //convert to a select - drop down menu format
+ foreach ($thiscache as $ref => $data)
+ {
+ //is the ref within our range?
+ if ( ($ref >= $minrange && $ref <= $maxrange) || (!is_numeric($ref)) )
+ {
+ $return_data .= '<option value="' . $ref . '" ';
+ if ($selected == $ref)
+ {
+ $return_data .= ' selected="selected" ';
+ }
+ $return_data .= '>' . $data . '</option>';
+ }
+ }
+ }
+
+ $converted_name = $thecache . '_' . $method;
+ $this->$converted_name = $return_data;
+
+ return $return_data;
+ }
}
http://cvs.php.net/viewvc.cgi/bugtracker/includes/functions.php?r1=1.13&r2=1.14&diff_format=u
Index: bugtracker/includes/functions.php
diff -u bugtracker/includes/functions.php:1.13 bugtracker/includes/functions.php:1.14
--- bugtracker/includes/functions.php:1.13 Thu Jul 31 12:34:20 2008
+++ bugtracker/includes/functions.php Thu Jul 31 13:11:04 2008
@@ -148,28 +148,6 @@
return $res;
}
-function cache_convert($cache_data,$method,$select = '')
-{
- $return_data = '';
- //convert a given cache to another format
- if ($method == 'select')
- {
- //convert to a select - drop down menu format
- foreach ($cache_data as $ref => $data)
- {
- $return_data .= '<option value="' . $ref . '" ';
- if ($select == $ref)
- {
- $return_data .= ' selected="selected" ';
- }
- $return_data .= '>' . $data . '</option>';
- }
- }
-
- return $return_data;
-}
-
-
function check_email_mx($email) {
if( (preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) ||
(preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)) )
http://cvs.php.net/viewvc.cgi/bugtracker/template/generic/report/index.php?r1=1.6&r2=1.7&diff_format=u
Index: bugtracker/template/generic/report/index.php
diff -u bugtracker/template/generic/report/index.php:1.6
bugtracker/template/generic/report/index.php:1.7
--- bugtracker/template/generic/report/index.php:1.6 Sat Jul 26 02:33:43 2008
+++ bugtracker/template/generic/report/index.php Thu Jul 31 13:11:05 2008
@@ -1,7 +1,5 @@
<?php
-unset($php_version[0]);
-
require_once($_SERVER['DOCUMENT_ROOT'] . '../includes/recaptchalib.php');
$template_data['page_title'] .= ' - Reporting a bug';
@@ -42,9 +40,19 @@
}
}
+/*
+$php_version = $cache->php_version;
+unset($php_version[0]);
+$bug_type = $cache->bug_type;
+$os_version = $cache->os_version;
+
$form_data['php_versions'] = cache_convert($php_version, 'select',
$form_data['php_version']);
$form_data['bug_types'] = cache_convert($bug_type, 'select',
$form_data['bug_type']);
$form_data['os_versions'] = cache_convert($os_version, 'select',
$form_data['os_version']);
+*/
+$form_data['php_versions'] = $cache->convert('php_version',
'select', $form_data['php_version'], '1');
+$form_data['bug_types'] = $cache->convert('bug_type', 'select',
$form_data['bug_type']);
+$form_data['os_versions'] = $cache->convert('os_version',
'select', $form_data['os_version']);
$form_data['php_versions'] .= '<option
value="na">Irrelevant</option><option value="early">Earlier?
Upgrade First</option>';