File inc/bug.inc.php changed (mode: 100644) (index 93a595b..b6d12a1) |
... |
... |
function rg_bug_info($db, $repo_id, $bug_id) |
356 |
356 |
$c = rg_cache_get($key); |
$c = rg_cache_get($key); |
357 |
357 |
if ($c !== FALSE) { |
if ($c !== FALSE) { |
358 |
358 |
$ret = $c; |
$ret = $c; |
|
359 |
|
rg_bug_cosmetic($db, $ret); |
359 |
360 |
break; |
break; |
360 |
361 |
} |
} |
361 |
362 |
|
|
|
... |
... |
function rg_bug_info($db, $repo_id, $bug_id) |
377 |
378 |
$row = rg_sql_fetch_array($res); |
$row = rg_sql_fetch_array($res); |
378 |
379 |
$ret = array_merge($ret, $row); |
$ret = array_merge($ret, $row); |
379 |
380 |
$ret['exists'] = 1; |
$ret['exists'] = 1; |
|
381 |
|
rg_cache_set($key, $ret, RG_SOCKET_NO_WAIT); |
380 |
382 |
rg_bug_cosmetic($db, $ret); |
rg_bug_cosmetic($db, $ret); |
381 |
383 |
} |
} |
382 |
384 |
rg_sql_free_result($res); |
rg_sql_free_result($res); |
383 |
|
|
|
384 |
|
// We set the cache even on non-existent bug |
|
385 |
|
rg_cache_set($key, $ret, RG_SOCKET_NO_WAIT); |
|
386 |
385 |
break; |
break; |
387 |
386 |
} |
} |
388 |
387 |
|
|
|
... |
... |
function rg_bug_edit($db, $login_ui, $ri, $data) |
511 |
510 |
'bug' => array( |
'bug' => array( |
512 |
511 |
'who_added' => $login_ui['uid'], |
'who_added' => $login_ui['uid'], |
513 |
512 |
'who_added_text' => $login_ui['username'], |
'who_added_text' => $login_ui['username'], |
514 |
|
'url' => rg_base_url() . rg_re_bugpage($login_ui, $ri['name'], $data['bug_id']), |
|
|
513 |
|
'url' => $ri['url_repo'] . '/bug/' . $data['bug_id'], |
515 |
514 |
'assigned_to_text' => $assigned_to_text, |
'assigned_to_text' => $assigned_to_text, |
516 |
515 |
'state_text' => rg_bug_state($data['state']))); |
'state_text' => rg_bug_state($data['state']))); |
517 |
516 |
$event = rg_array_merge($event, 'bug', $data); |
$event = rg_array_merge($event, 'bug', $data); |
|
... |
... |
function rg_bug_edit($db, $login_ui, $ri, $data) |
522 |
521 |
break; |
break; |
523 |
522 |
} |
} |
524 |
523 |
|
|
525 |
|
if (rg_sql_commit($db) === FALSE) { |
|
|
524 |
|
if (rg_sql_commit($db) !== TRUE) { |
526 |
525 |
rg_bug_set_error("cannot commit (" . rg_sql_error() . ")"); |
rg_bug_set_error("cannot commit (" . rg_sql_error() . ")"); |
527 |
526 |
break; |
break; |
528 |
527 |
} |
} |
|
... |
... |
function rg_bug_edit($db, $login_ui, $ri, $data) |
532 |
531 |
// update cache |
// update cache |
533 |
532 |
$data['ok'] = 1; |
$data['ok'] = 1; |
534 |
533 |
$data['exists'] = 1; |
$data['exists'] = 1; |
535 |
|
rg_bug_cosmetic($db, $data); |
|
536 |
534 |
$key = $ri['repo_id'] . "::bugs::" . $data['bug_id']; |
$key = $ri['repo_id'] . "::bugs::" . $data['bug_id']; |
537 |
535 |
rg_cache_set($key, $data, RG_SOCKET_NO_WAIT); |
rg_cache_set($key, $data, RG_SOCKET_NO_WAIT); |
538 |
536 |
|
|
|
... |
... |
function rg_bug_delete_undelete($db, $who, $repo_id, $bug_id, $op) |
590 |
588 |
$new['deleted'] = $deleted; |
$new['deleted'] = $deleted; |
591 |
589 |
$new['utime'] = $now; |
$new['utime'] = $now; |
592 |
590 |
$new['deleted_who'] = $who; |
$new['deleted_who'] = $who; |
593 |
|
rg_bug_cosmetic($db, $new); |
|
594 |
591 |
$key = $repo_id . "::bugs::" . $bug_id; |
$key = $repo_id . "::bugs::" . $bug_id; |
595 |
592 |
rg_cache_merge($key, $new, RG_SOCKET_NO_WAIT); |
rg_cache_merge($key, $new, RG_SOCKET_NO_WAIT); |
596 |
593 |
|
|
|
... |
... |
function rg_bug_note_add($db, $repo_id, $bug_id, $login_uid, $data) |
1028 |
1025 |
'bug' => array( |
'bug' => array( |
1029 |
1026 |
'bug_id' => $bug_id, |
'bug_id' => $bug_id, |
1030 |
1027 |
'title' => $_bi['title'], |
'title' => $_bi['title'], |
1031 |
|
'url' => rg_base_url() . rg_re_bugpage($_ui, $_ri['name'], $bug_id)), |
|
|
1028 |
|
'url' => $_ri['url_repo'] . '/bug/' . $bug_id), |
1032 |
1029 |
'ri' => array( |
'ri' => array( |
1033 |
1030 |
'repo_id' => $repo_id, |
'repo_id' => $repo_id, |
1034 |
1031 |
'name' => $_ri['name']), |
'name' => $_ri['name']), |
File inc/repo.inc.php changed (mode: 100644) (index e3caa0f..0003a71) |
... |
... |
function rg_repo_path_by_name($uid, $repo_name) |
668 |
668 |
/* |
/* |
669 |
669 |
* Improve repo info |
* Improve repo info |
670 |
670 |
*/ |
*/ |
671 |
|
function rg_repo_cosmetic(&$row) |
|
|
671 |
|
function rg_repo_cosmetic($db, &$row) |
672 |
672 |
{ |
{ |
673 |
673 |
if (strlen(substr($row['description'], 0, 1)) == 1) { |
if (strlen(substr($row['description'], 0, 1)) == 1) { |
674 |
674 |
$_a = rg_xss_safe(trim($row['description'])); |
$_a = rg_xss_safe(trim($row['description'])); |
|
... |
... |
function rg_repo_cosmetic(&$row) |
679 |
679 |
|
|
680 |
680 |
if (isset($row['itime'])) |
if (isset($row['itime'])) |
681 |
681 |
$row['HTML:itime_nice'] = gmdate('Y-m-d H:i', $row['itime']); |
$row['HTML:itime_nice'] = gmdate('Y-m-d H:i', $row['itime']); |
|
682 |
|
|
|
683 |
|
$_ui = rg_user_info($db, $row['uid'], '', ''); |
|
684 |
|
if ($_ui['exists'] == 1) { |
|
685 |
|
$row['owner'] = $_ui['username']; |
|
686 |
|
$row['url_user'] = rg_base_url() . rg_re_userpage($_ui); |
|
687 |
|
$row['url_repo'] = rg_base_url() . rg_re_repopage($_ui, $row['name']); |
|
688 |
|
} |
|
689 |
|
|
|
690 |
|
$master_repo = '-'; |
|
691 |
|
if ($row['master'] > 0) { |
|
692 |
|
$master_repo = '?'; |
|
693 |
|
$_mi = rg_repo_info($db, $row['master'], 0, ''); |
|
694 |
|
if ($_mi['exists'] = 1) |
|
695 |
|
$master_repo = $_mi['name']; |
|
696 |
|
} |
|
697 |
|
$row['clone_of'] = $master_repo; |
|
698 |
|
|
|
699 |
|
$row['creation'] = gmdate("Y-m-d", $row['itime']); |
|
700 |
|
$row['disk_used'] = rg_1024($row['disk_used_mb'] * 1024 * 1024); |
682 |
701 |
} |
} |
683 |
702 |
|
|
684 |
703 |
/* |
/* |
|
... |
... |
function rg_repo_info($db, $repo_id, $uid, $repo_name) |
701 |
720 |
$c = rg_cache_get('repo_by_id' . '::' . $repo_id); |
$c = rg_cache_get('repo_by_id' . '::' . $repo_id); |
702 |
721 |
if (($c !== FALSE) && isset($c['repo_id'])) { |
if (($c !== FALSE) && isset($c['repo_id'])) { |
703 |
722 |
$ret = $c; |
$ret = $c; |
|
723 |
|
rg_repo_cosmetic($db, $ret); |
704 |
724 |
break; |
break; |
705 |
725 |
} |
} |
706 |
726 |
|
|
|
... |
... |
function rg_repo_info($db, $repo_id, $uid, $repo_name) |
743 |
763 |
|
|
744 |
764 |
$ret['ok'] = 1; |
$ret['ok'] = 1; |
745 |
765 |
if ($rows > 0) { |
if ($rows > 0) { |
746 |
|
rg_repo_cosmetic($ret); |
|
747 |
766 |
$ret['exists'] = 1; |
$ret['exists'] = 1; |
748 |
767 |
} else { |
} else { |
749 |
768 |
$ret['exists'] = 0; |
$ret['exists'] = 0; |
|
... |
... |
function rg_repo_info($db, $repo_id, $uid, $repo_name) |
758 |
777 |
$ret['repo_id'], RG_SOCKET_NO_WAIT); |
$ret['repo_id'], RG_SOCKET_NO_WAIT); |
759 |
778 |
} |
} |
760 |
779 |
|
|
|
780 |
|
if ($rows > 0) |
|
781 |
|
rg_repo_cosmetic($db, $ret); |
761 |
782 |
break; |
break; |
762 |
783 |
} |
} |
763 |
784 |
|
|
|
... |
... |
function rg_repo_edit($db, $login_ui, &$new) |
985 |
1006 |
$new['description'] = trim($new['description']); |
$new['description'] = trim($new['description']); |
986 |
1007 |
$new['itime'] = time(); |
$new['itime'] = time(); |
987 |
1008 |
$new['uid'] = $login_ui['uid']; |
$new['uid'] = $login_ui['uid']; |
988 |
|
rg_repo_cosmetic($new); |
|
|
1009 |
|
rg_repo_cosmetic($db, $new); |
989 |
1010 |
|
|
990 |
1011 |
if ($new['repo_id'] == 0) { |
if ($new['repo_id'] == 0) { |
991 |
1012 |
$new['deleted'] = 0; |
$new['deleted'] = 0; |
|
... |
... |
function rg_repo_list_query($db, $url, $sql, $params) |
1141 |
1162 |
continue; |
continue; |
1142 |
1163 |
} |
} |
1143 |
1164 |
|
|
1144 |
|
$_line['owner'] = $_ui['username']; |
|
1145 |
|
$_line['url_repo'] = rg_re_repopage($_ui, $row['name']); |
|
1146 |
|
$_line['url_user'] = rg_re_userpage($_ui); |
|
1147 |
|
rg_repo_cosmetic($_line); |
|
1148 |
|
|
|
1149 |
|
$master_repo = "-"; |
|
1150 |
|
if ($row['master'] > 0) { |
|
1151 |
|
$master_repo = "?"; |
|
1152 |
|
$_mi = rg_repo_info($db, $row['master'], 0, ""); |
|
1153 |
|
if ($_mi['exists'] = 1) |
|
1154 |
|
$master_repo = $_mi['name']; |
|
1155 |
|
} |
|
1156 |
|
$_line['clone_of'] = $master_repo; |
|
1157 |
|
$_line['creation'] = gmdate("Y-m-d", $row['itime']); |
|
1158 |
|
$_line['disk_used'] = rg_1024($row['disk_used_mb'] * 1024 * 1024); |
|
|
1165 |
|
rg_repo_cosmetic($db, $_line); |
1159 |
1166 |
|
|
1160 |
1167 |
$d[] = $_line; |
$d[] = $_line; |
1161 |
1168 |
} |
} |
|
... |
... |
function rg_repo_edit_high_level($db, &$rg) |
1730 |
1737 |
$rg['ri']['description'] = trim(rg_var_str('description')); |
$rg['ri']['description'] = trim(rg_var_str('description')); |
1731 |
1738 |
$rg['ri']['public'] = rg_var_bool('public'); |
$rg['ri']['public'] = rg_var_bool('public'); |
1732 |
1739 |
$rg['ri']['license'] = trim(rg_var_str('license')); |
$rg['ri']['license'] = trim(rg_var_str('license')); |
1733 |
|
rg_repo_cosmetic($rg['ri']); |
|
|
1740 |
|
rg_repo_cosmetic($db, $rg['ri']); |
1734 |
1741 |
//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)); |
1735 |
1742 |
|
|
1736 |
1743 |
if (!rg_valid_referer()) { |
if (!rg_valid_referer()) { |