File inc/bug.inc.php changed (mode: 100644) (index cf542d0..a2cc515) |
... |
... |
function rg_bug_next_id($db, $repo_id) |
260 |
260 |
/* |
/* |
261 |
261 |
* Helper for loading default values for a bug. |
* Helper for loading default values for a bug. |
262 |
262 |
*/ |
*/ |
263 |
|
function rg_bug_vars_defaults() |
|
|
263 |
|
function rg_bug_vars_defaults($rg) |
264 |
264 |
{ |
{ |
265 |
265 |
$ret = array(); |
$ret = array(); |
266 |
266 |
$ret['bug_id'] = 0; |
$ret['bug_id'] = 0; |
267 |
|
$ret['title'] = ""; |
|
268 |
|
$ret['body'] = ""; |
|
|
267 |
|
$ret['title'] = ''; |
|
268 |
|
$ret['body'] = $rg['ri']['template']; |
269 |
269 |
$ret['state'] = 1; |
$ret['state'] = 1; |
270 |
|
$ret['labels'] = ""; |
|
271 |
|
$ret['assigned_to'] = ""; |
|
|
270 |
|
$ret['labels'] = ''; |
|
271 |
|
$ret['assigned_to'] = $rg['page_ui']['username']; |
272 |
272 |
|
|
273 |
273 |
return $ret; |
return $ret; |
274 |
274 |
} |
} |
|
... |
... |
function rg_bug_vars_defaults() |
279 |
279 |
function rg_bug_vars() |
function rg_bug_vars() |
280 |
280 |
{ |
{ |
281 |
281 |
$ret = array(); |
$ret = array(); |
282 |
|
$ret['title'] = trim(rg_var_str("title")); |
|
283 |
|
$ret['body'] = trim(rg_var_str("body")); |
|
284 |
|
$ret['state'] = rg_var_uint("state"); |
|
285 |
|
$ret['labels'] = rg_var_str("labels"); |
|
286 |
|
$ret['assigned_to'] = rg_var_str("assigned_to"); |
|
|
282 |
|
$ret['title'] = trim(rg_var_str('title')); |
|
283 |
|
$ret['body'] = trim(rg_var_str('body')); |
|
284 |
|
$ret['state'] = rg_var_uint('state'); |
|
285 |
|
$ret['labels'] = trim(rg_var_str('labels')); |
|
286 |
|
$ret['assigned_to'] = trim(rg_var_str('assigned_to')); |
287 |
287 |
|
|
288 |
288 |
return $ret; |
return $ret; |
289 |
289 |
} |
} |
|
... |
... |
function rg_bug_edit_high_level($db, &$rg) |
1295 |
1295 |
|
|
1296 |
1296 |
if ($rg['doit'] == 0) { |
if ($rg['doit'] == 0) { |
1297 |
1297 |
if ($rg['bug']['bug_id'] == 0) |
if ($rg['bug']['bug_id'] == 0) |
1298 |
|
$rg['bug'] = rg_bug_vars_defaults(); |
|
|
1298 |
|
$rg['bug'] = rg_bug_vars_defaults($rg); |
1299 |
1299 |
break; |
break; |
1300 |
1300 |
} |
} |
1301 |
1301 |
|
|
|
... |
... |
function rg_bug_edit_high_level($db, &$rg) |
1319 |
1319 |
} |
} |
1320 |
1320 |
$rg['bug']['bug_id'] = $bug_id; |
$rg['bug']['bug_id'] = $bug_id; |
1321 |
1321 |
|
|
1322 |
|
$url = rg_re_bugpage($rg['page_ui'], |
|
1323 |
|
$rg['ri']['name'], $bug_id); |
|
|
1322 |
|
$url = rg_re_bugpage($rg['page_ui'], $rg['ri']['name'], $bug_id); |
1324 |
1323 |
rg_redirect($url); |
rg_redirect($url); |
1325 |
1324 |
|
|
1326 |
1325 |
$show_form = FALSE; |
$show_form = FALSE; |
File inc/repo.inc.php changed (mode: 100644) (index 6065689..19c3317) |
... |
... |
function rg_repo_path_by_name($uid, $repo_name) |
801 |
801 |
*/ |
*/ |
802 |
802 |
function rg_repo_cosmetic($db, &$row) |
function rg_repo_cosmetic($db, &$row) |
803 |
803 |
{ |
{ |
|
804 |
|
// Because this field was added later and the cache may not have it |
|
805 |
|
if (!isset($row['template'])) |
|
806 |
|
$row['template'] = ''; |
|
807 |
|
|
804 |
808 |
if (strlen(substr($row['description'], 0, 1)) == 1) { |
if (strlen(substr($row['description'], 0, 1)) == 1) { |
805 |
|
$_a = rg_xss_safe(trim($row['description'])); |
|
|
809 |
|
$_a = rg_xss_safe($row['description']); |
806 |
810 |
$row['HTML:description_nlbr'] = nl2br($_a); |
$row['HTML:description_nlbr'] = nl2br($_a); |
807 |
811 |
} else { |
} else { |
808 |
812 |
$row['HTML:description_nlbr'] = 'n/a'; |
$row['HTML:description_nlbr'] = 'n/a'; |
|
... |
... |
function rg_repo_edit($db, $login_ui, &$new) |
1047 |
1051 |
//TODO: master may be not accessible to this user. check. |
//TODO: master may be not accessible to this user. check. |
1048 |
1052 |
|
|
1049 |
1053 |
// Small fixes |
// Small fixes |
1050 |
|
$new['description'] = trim($new['description']); |
|
1051 |
1054 |
$new['itime'] = time(); |
$new['itime'] = time(); |
1052 |
1055 |
$new['uid'] = $login_ui['uid']; |
$new['uid'] = $login_ui['uid']; |
1053 |
1056 |
|
|
|
... |
... |
function rg_repo_edit($db, $login_ui, &$new) |
1059 |
1062 |
|
|
1060 |
1063 |
$sql = "INSERT INTO repos (uid, master, name" |
$sql = "INSERT INTO repos (uid, master, name" |
1061 |
1064 |
. ", itime, max_commit_size, description" |
. ", itime, max_commit_size, description" |
1062 |
|
. ", git_dir_done, public, license)" |
|
|
1065 |
|
. ", git_dir_done, public, license, template)" |
1063 |
1066 |
. " VALUES (@@uid@@, @@master@@, @@name@@" |
. " VALUES (@@uid@@, @@master@@, @@name@@" |
1064 |
1067 |
. ", @@itime@@, @@max_commit_size@@" |
. ", @@itime@@, @@max_commit_size@@" |
1065 |
1068 |
. ", @@description@@, 0, @@public@@" |
. ", @@description@@, 0, @@public@@" |
1066 |
|
. ", @@license@@)" |
|
|
1069 |
|
. ", @@license@@, @@template@@)" |
1067 |
1070 |
. " RETURNING repo_id"; |
. " RETURNING repo_id"; |
1068 |
1071 |
} else { |
} else { |
1069 |
1072 |
$sql = "UPDATE repos SET name = @@name@@" |
$sql = "UPDATE repos SET name = @@name@@" |
|
... |
... |
function rg_repo_edit($db, $login_ui, &$new) |
1071 |
1074 |
. ", description = @@description@@" |
. ", description = @@description@@" |
1072 |
1075 |
. ", public = @@public@@" |
. ", public = @@public@@" |
1073 |
1076 |
. ", license = @@license@@" |
. ", license = @@license@@" |
|
1077 |
|
. ", template = @@template@@" |
1074 |
1078 |
. " WHERE repo_id = @@repo_id@@"; |
. " WHERE repo_id = @@repo_id@@"; |
1075 |
1079 |
} |
} |
1076 |
1080 |
$res = rg_sql_query_params($db, $sql, $new); |
$res = rg_sql_query_params($db, $sql, $new); |
|
... |
... |
function rg_repo_edit_high_level($db, &$rg) |
1765 |
1769 |
if (!$edit) { |
if (!$edit) { |
1766 |
1770 |
// Defaults |
// Defaults |
1767 |
1771 |
$rg['ri'] = array(); |
$rg['ri'] = array(); |
1768 |
|
$rg['ri']['repo_id'] = "0"; |
|
1769 |
|
$rg['ri']['master'] = "0"; |
|
1770 |
|
$rg['ri']['name'] = ""; |
|
1771 |
|
$rg['ri']['max_commit_size'] = "0"; |
|
1772 |
|
$rg['ri']['description'] = ""; |
|
1773 |
|
$rg['ri']['public'] = "1"; |
|
1774 |
|
$rg['ri']['license'] = ""; |
|
|
1772 |
|
$rg['ri']['repo_id'] = '0'; |
|
1773 |
|
$rg['ri']['master'] = '0'; |
|
1774 |
|
$rg['ri']['name'] = ''; |
|
1775 |
|
$rg['ri']['max_commit_size'] = '0'; |
|
1776 |
|
$rg['ri']['description'] = ''; |
|
1777 |
|
$rg['ri']['public'] = '1'; |
|
1778 |
|
$rg['ri']['license'] = ''; |
|
1779 |
|
$rg['ri']['template'] = |
|
1780 |
|
'OS type(s) and version(s)?' . "\n\n" |
|
1781 |
|
. 'Application version(s) affected?' . "\n\n" |
|
1782 |
|
. 'Steps to reproduce?'; |
1775 |
1783 |
} |
} |
1776 |
1784 |
break; |
break; |
1777 |
1785 |
} |
} |
1778 |
1786 |
|
|
1779 |
1787 |
$rg['ri']['repo_id'] = rg_var_uint('repo_id'); |
$rg['ri']['repo_id'] = rg_var_uint('repo_id'); |
1780 |
1788 |
$rg['ri']['master'] = rg_var_uint('master'); |
$rg['ri']['master'] = rg_var_uint('master'); |
1781 |
|
$rg['ri']['name'] = rg_var_str('name'); // TODO: filter name! |
|
|
1789 |
|
$rg['ri']['name'] = trim(rg_var_str('name')); // TODO: filter name! |
1782 |
1790 |
$rg['ri']['max_commit_size'] = rg_var_uint('max_commit_size'); |
$rg['ri']['max_commit_size'] = rg_var_uint('max_commit_size'); |
1783 |
1791 |
$rg['ri']['description'] = trim(rg_var_str('description')); |
$rg['ri']['description'] = trim(rg_var_str('description')); |
1784 |
1792 |
$rg['ri']['public'] = rg_var_bool('public'); |
$rg['ri']['public'] = rg_var_bool('public'); |
1785 |
1793 |
$rg['ri']['license'] = trim(rg_var_str('license')); |
$rg['ri']['license'] = trim(rg_var_str('license')); |
|
1794 |
|
$rg['ri']['template'] = trim(rg_var_str('template')); |
1786 |
1795 |
rg_repo_cosmetic($db, $rg['ri']); |
rg_repo_cosmetic($db, $rg['ri']); |
1787 |
1796 |
//rg_log_ml("CHECK: after repo edit: rg[ri]=" . print_r($rg['ri'], TRUE)); |
//rg_log_ml("CHECK: after repo edit: rg[ri]=" . print_r($rg['ri'], TRUE)); |
1788 |
1797 |
|
|