File inc/repo.inc.php changed (mode: 100644) (index 19c3317..bf1c8d8) |
... |
... |
rg_rights_register("repo_path", $rg_repo_path_rights, "P", |
55 |
55 |
rg_rights_register("repo", $rg_repo_rights, "AaB", |
rg_rights_register("repo", $rg_repo_rights, "AaB", |
56 |
56 |
FALSE, "rg_repo_rights_inject"); |
FALSE, "rg_repo_rights_inject"); |
57 |
57 |
|
|
|
58 |
|
/* |
|
59 |
|
* Improve repo info |
|
60 |
|
*/ |
|
61 |
|
function rg_repo_cosmetic($db, &$row) |
|
62 |
|
{ |
|
63 |
|
// Because this field was added later and the cache may not have it |
|
64 |
|
if (!isset($row['template'])) |
|
65 |
|
$row['template'] = ''; |
|
66 |
|
|
|
67 |
|
if (strlen(substr($row['description'], 0, 1)) == 1) { |
|
68 |
|
$_a = rg_xss_safe($row['description']); |
|
69 |
|
$row['HTML:description_nlbr'] = nl2br($_a); |
|
70 |
|
} else { |
|
71 |
|
$row['HTML:description_nlbr'] = 'n/a'; |
|
72 |
|
} |
|
73 |
|
|
|
74 |
|
if (isset($row['itime'])) |
|
75 |
|
$row['HTML:itime_nice'] = gmdate('Y-m-d', $row['itime']); |
|
76 |
|
|
|
77 |
|
$_ui = rg_user_info($db, $row['uid'], '', ''); |
|
78 |
|
if ($_ui['exists'] == 1) { |
|
79 |
|
$row['owner'] = $_ui['username']; |
|
80 |
|
$row['url_user'] = rg_base_url() . rg_re_userpage($_ui); |
|
81 |
|
$row['url_repo'] = rg_base_url() . rg_re_repopage($_ui, $row['name']); |
|
82 |
|
} |
|
83 |
|
|
|
84 |
|
$master_repo = '-'; |
|
85 |
|
if ($row['master'] > 0) { |
|
86 |
|
$master_repo = '?'; |
|
87 |
|
$_mi = rg_repo_info($db, $row['master'], 0, ''); |
|
88 |
|
if ($_mi['exists'] = 1) |
|
89 |
|
$master_repo = $_mi['name']; |
|
90 |
|
} |
|
91 |
|
$row['clone_of'] = $master_repo; |
|
92 |
|
|
|
93 |
|
if (isset($row['disk_used_mb'])) |
|
94 |
|
$row['disk_used'] = rg_1024($row['disk_used_mb'] * 1024 * 1024); |
|
95 |
|
} |
|
96 |
|
|
58 |
97 |
/* |
/* |
59 |
98 |
* Returns info about a repo |
* Returns info about a repo |
60 |
99 |
* If you want to lookup by repo_id or uid/repo_name |
* If you want to lookup by repo_id or uid/repo_name |
|
... |
... |
function rg_repo_path_by_name($uid, $repo_name) |
796 |
835 |
return rg_user_path_by_id($uid) . "/repos/by_name/" . $repo_name . ".git"; |
return rg_user_path_by_id($uid) . "/repos/by_name/" . $repo_name . ".git"; |
797 |
836 |
} |
} |
798 |
837 |
|
|
799 |
|
/* |
|
800 |
|
* Improve repo info |
|
801 |
|
*/ |
|
802 |
|
function rg_repo_cosmetic($db, &$row) |
|
803 |
|
{ |
|
804 |
|
// Because this field was added later and the cache may not have it |
|
805 |
|
if (!isset($row['template'])) |
|
806 |
|
$row['template'] = ''; |
|
807 |
|
|
|
808 |
|
if (strlen(substr($row['description'], 0, 1)) == 1) { |
|
809 |
|
$_a = rg_xss_safe($row['description']); |
|
810 |
|
$row['HTML:description_nlbr'] = nl2br($_a); |
|
811 |
|
} else { |
|
812 |
|
$row['HTML:description_nlbr'] = 'n/a'; |
|
813 |
|
} |
|
814 |
|
|
|
815 |
|
if (isset($row['itime'])) |
|
816 |
|
$row['HTML:itime_nice'] = gmdate('Y-m-d', $row['itime']); |
|
817 |
|
|
|
818 |
|
$_ui = rg_user_info($db, $row['uid'], '', ''); |
|
819 |
|
if ($_ui['exists'] == 1) { |
|
820 |
|
$row['owner'] = $_ui['username']; |
|
821 |
|
$row['url_user'] = rg_base_url() . rg_re_userpage($_ui); |
|
822 |
|
$row['url_repo'] = rg_base_url() . rg_re_repopage($_ui, $row['name']); |
|
823 |
|
} |
|
824 |
|
|
|
825 |
|
$master_repo = '-'; |
|
826 |
|
if ($row['master'] > 0) { |
|
827 |
|
$master_repo = '?'; |
|
828 |
|
$_mi = rg_repo_info($db, $row['master'], 0, ''); |
|
829 |
|
if ($_mi['exists'] = 1) |
|
830 |
|
$master_repo = $_mi['name']; |
|
831 |
|
} |
|
832 |
|
$row['clone_of'] = $master_repo; |
|
833 |
|
|
|
834 |
|
if (isset($row['disk_used_mb'])) |
|
835 |
|
$row['disk_used'] = rg_1024($row['disk_used_mb'] * 1024 * 1024); |
|
836 |
|
} |
|
837 |
|
|
|
838 |
838 |
/* |
/* |
839 |
839 |
* Delete a repo |
* Delete a repo |
840 |
840 |
*/ |
*/ |