diff options
Diffstat (limited to 'web/html')
-rw-r--r-- | web/html/account.php | 5 | ||||
-rw-r--r-- | web/html/comaintainers.php | 21 | ||||
-rw-r--r-- | web/html/css/archnavbar/aurlogo.png | bin | 0 -> 5997 bytes | |||
-rw-r--r-- | web/html/css/aur.css | 4 | ||||
-rw-r--r-- | web/html/css/cgit.css | 866 | ||||
-rw-r--r-- | web/html/index.php | 5 | ||||
-rw-r--r-- | web/html/pkgbase.php | 4 | ||||
-rw-r--r-- | web/html/pkgsubmit.php | 489 |
8 files changed, 902 insertions, 492 deletions
diff --git a/web/html/account.php b/web/html/account.php index c1a1cd7..3dc8ef0 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -59,7 +59,7 @@ if (isset($_COOKIE["AURSID"])) { display_account_form("UpdateAccount", $row["Username"], $row["AccountTypeID"], $row["Suspended"], $row["Email"], "", "", $row["RealName"], $row["LangPreference"], - $row["IRCNick"], $row["PGPKey"], + $row["IRCNick"], $row["PGPKey"], $row["SSHPubKey"], $row["InactivityTS"] ? 1 : 0, $row["ID"]); } else { print __("You do not have permission to edit this account."); @@ -98,7 +98,8 @@ if (isset($_COOKIE["AURSID"])) { in_request("U"), in_request("T"), in_request("S"), in_request("E"), in_request("P"), in_request("C"), in_request("R"), in_request("L"), in_request("I"), - in_request("K"), in_request("J"), in_request("ID")); + in_request("K"), in_request("PK"), in_request("J"), + in_request("ID")); } } else { if (has_credential(CRED_ACCOUNT_SEARCH)) { diff --git a/web/html/comaintainers.php b/web/html/comaintainers.php new file mode 100644 index 0000000..591fcad --- /dev/null +++ b/web/html/comaintainers.php @@ -0,0 +1,21 @@ +<?php + +set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); + +include_once("aur.inc.php"); +include_once("pkgbasefuncs.inc.php"); + +set_lang(); +check_sid(); + +if (!isset($base_id) || !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) { + header('Location: /'); + exit(); +} + +html_header(__("Manage Co-maintainers")); +$users = pkgbase_get_comaintainers($base_id); +include('comaintainers_form.php'); +html_footer(AUR_VERSION); + + diff --git a/web/html/css/archnavbar/aurlogo.png b/web/html/css/archnavbar/aurlogo.png Binary files differnew file mode 100644 index 0000000..69110d8 --- /dev/null +++ b/web/html/css/archnavbar/aurlogo.png diff --git a/web/html/css/aur.css b/web/html/css/aur.css index 654116a..dfa6717 100644 --- a/web/html/css/aur.css +++ b/web/html/css/aur.css @@ -3,6 +3,10 @@ color: white !important; } +#archnavbarlogo { + background: url('archnavbar/aurlogo.png') !important; +} + #lang_sub { float: right; } diff --git a/web/html/css/cgit.css b/web/html/css/cgit.css new file mode 100644 index 0000000..429b5f5 --- /dev/null +++ b/web/html/css/cgit.css @@ -0,0 +1,866 @@ +/* + * ARCH GLOBAL NAVBAR + * We're forcing all generic selectors with !important + * to help prevent other stylesheets from interfering. + */ + +/* container for the entire bar */ +#archnavbar { height: 40px !important; padding: 10px 15px !important; background: #333 !important; border-bottom: 5px #08c solid !important; } +#archnavbarlogo { float: left !important; margin: 0 !important; padding: 0 !important; height: 40px !important; width: 190px !important; background: url('archnavbar/archlogo.png') no-repeat !important; } + +/* move the heading text offscreen */ +#archnavbarlogo h1 { margin: 0 !important; padding: 0 !important; text-indent: -9999px !important; } + +/* make the link the same size as the logo */ +#archnavbarlogo a { display: block !important; height: 40px !important; width: 190px !important; } + +/* display the list inline, float it to the right and style it */ +#archnavbarlist { display: inline !important; float: right !important; list-style: none !important; margin: 0 !important; padding: 0 !important; } +#archnavbarlist li { float: left !important; font-size: 14px !important; font-family: sans-serif !important; line-height: 45px !important; padding-right: 15px !important; padding-left: 15px !important; } + +/* style the links */ +#archnavbarlist li a { color: #999; font-weight: bold !important; text-decoration: none !important; } +#archnavbarlist li a:hover { color: white !important; text-decoration: underline !important; } + +/* END ARCH GLOBAL NAVBAR */ + +#footer { + clear: both; + margin: 0; +} + +#footer p { + margin: 1em; +} + +#archnavbar.anb-aur ul li#anb-aur a { + color: white !important; +} + +#archnavbarlogo { + background: url('archnavbar/aurlogo.png') !important; +} + +body { + padding: 0; + margin: 0; + font-family: sans-serif; + font-size: 10pt; + color: #333; + background: white; +} + +div#cgit a { + color: blue; + text-decoration: none; +} + +div#cgit a:hover { + text-decoration: underline; +} + +div#cgit table { + border-collapse: collapse; +} + +div#cgit table#header { + width: 100%; + margin-bottom: 1em; +} + +div#cgit table#header td.logo { + width: 96px; + vertical-align: top; +} + +div#cgit table#header td.main { + font-size: 250%; + padding-left: 10px; + white-space: nowrap; +} + +div#cgit table#header td.main a { + color: #000; +} + +div#cgit table#header td.form { + text-align: right; + vertical-align: bottom; + padding-right: 1em; + padding-bottom: 2px; + white-space: nowrap; +} + +div#cgit table#header td.form form, +div#cgit table#header td.form input, +div#cgit table#header td.form select { + font-size: 90%; +} + +div#cgit table#header td.sub { + color: #777; + border-top: solid 1px #ccc; + padding-left: 10px; +} + +div#cgit table.tabs { + border-bottom: solid 3px #ccc; + border-collapse: collapse; + margin-top: 2em; + margin-bottom: 0px; + width: 100%; +} + +div#cgit table.tabs td { + padding: 0px 1em; + vertical-align: bottom; +} + +div#cgit table.tabs td a { + padding: 2px 0.75em; + color: #777; + font-size: 110%; +} + +div#cgit table.tabs td a.active { + color: #000; + background-color: #ccc; +} + +div#cgit table.tabs td.form { + text-align: right; +} + +div#cgit table.tabs td.form form { + padding-bottom: 2px; + font-size: 90%; + white-space: nowrap; +} + +div#cgit table.tabs td.form input, +div#cgit table.tabs td.form select { + font-size: 90%; +} + +div#cgit div.path { + margin: 0px; + padding: 5px 2em 2px 2em; + color: #000; + background-color: #eee; +} + +div#cgit div.content { + margin: 0px; + padding: 2em; + border-bottom: solid 3px #ccc; +} + + +div#cgit table.list { + width: 100%; + border: none; + border-collapse: collapse; +} + +div#cgit table.list tr { + background: white; +} + +div#cgit table.list tr.logheader { + background: #eee; +} + +div#cgit table.list tr:hover { + background: #eee; +} + +div#cgit table.list tr.nohover:hover { + background: white; +} + +div#cgit table.list th { + font-weight: bold; + /* color: #888; + border-top: dashed 1px #888; + border-bottom: dashed 1px #888; + */ + padding: 0.1em 0.5em 0.05em 0.5em; + vertical-align: baseline; +} + +div#cgit table.list td { + border: none; + padding: 0.1em 0.5em 0.1em 0.5em; +} + +div#cgit table.list td.commitgraph { + font-family: monospace; + white-space: pre; +} + +div#cgit table.list td.commitgraph .column1 { + color: #a00; +} + +div#cgit table.list td.commitgraph .column2 { + color: #0a0; +} + +div#cgit table.list td.commitgraph .column3 { + color: #aa0; +} + +div#cgit table.list td.commitgraph .column4 { + color: #00a; +} + +div#cgit table.list td.commitgraph .column5 { + color: #a0a; +} + +div#cgit table.list td.commitgraph .column6 { + color: #0aa; +} + +div#cgit table.list td.logsubject { + font-family: monospace; + font-weight: bold; +} + +div#cgit table.list td.logmsg { + font-family: monospace; + white-space: pre; + padding: 0 0.5em; +} + +div#cgit table.list td a { + color: black; +} + +div#cgit table.list td a.ls-dir { + font-weight: bold; + color: #00f; +} + +div#cgit table.list td a:hover { + color: #00f; +} + +div#cgit img { + border: none; +} + +div#cgit input#switch-btn { + margin: 2px 0px 0px 0px; +} + +div#cgit td#sidebar input.txt { + width: 100%; + margin: 2px 0px 0px 0px; +} + +div#cgit table#grid { + margin: 0px; +} + +div#cgit td#content { + vertical-align: top; + padding: 1em 2em 1em 1em; + border: none; +} + +div#cgit div#summary { + vertical-align: top; + margin-bottom: 1em; +} + +div#cgit table#downloads { + float: right; + border-collapse: collapse; + border: solid 1px #777; + margin-left: 0.5em; + margin-bottom: 0.5em; +} + +div#cgit table#downloads th { + background-color: #ccc; +} + +div#cgit div#blob { + border: solid 1px black; +} + +div#cgit div.error { + color: red; + font-weight: bold; + margin: 1em 2em; +} + +div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit a.ls-mod { + font-family: monospace; +} + +div#cgit td.ls-size { + text-align: right; + font-family: monospace; + width: 10em; +} + +div#cgit td.ls-mode { + font-family: monospace; + width: 10em; +} + +div#cgit table.blob { + margin-top: 0.5em; + border-top: solid 1px black; +} + +div#cgit table.blob td.lines { + margin: 0; padding: 0 0 0 0.5em; + vertical-align: top; + color: black; +} + +div#cgit table.blob td.linenumbers { + margin: 0; padding: 0 0.5em 0 0.5em; + vertical-align: top; + text-align: right; + border-right: 1px solid gray; +} + +div#cgit table.blob pre { + padding: 0; margin: 0; +} + +div#cgit table.blob a.no, div#cgit table.ssdiff a.no { + color: gray; + text-align: right; + text-decoration: none; +} + +div#cgit table.blob a.no a:hover { + color: black; +} + +div#cgit table.bin-blob { + margin-top: 0.5em; + border: solid 1px black; +} + +div#cgit table.bin-blob th { + font-family: monospace; + white-space: pre; + border: solid 1px #777; + padding: 0.5em 1em; +} + +div#cgit table.bin-blob td { + font-family: monospace; + white-space: pre; + border-left: solid 1px #777; + padding: 0em 1em; +} + +div#cgit table.nowrap td { + white-space: nowrap; +} + +div#cgit table.commit-info { + border-collapse: collapse; + margin-top: 1.5em; +} + +div#cgit div.cgit-panel { + float: right; + margin-top: 1.5em; +} + +div#cgit div.cgit-panel table { + border-collapse: collapse; + border: solid 1px #aaa; + background-color: #eee; +} + +div#cgit div.cgit-panel th { + text-align: center; +} + +div#cgit div.cgit-panel td { + padding: 0.25em 0.5em; +} + +div#cgit div.cgit-panel td.label { + padding-right: 0.5em; +} + +div#cgit div.cgit-panel td.ctrl { + padding-left: 0.5em; +} + +div#cgit table.commit-info th { + text-align: left; + font-weight: normal; + padding: 0.1em 1em 0.1em 0.1em; + vertical-align: top; +} + +div#cgit table.commit-info td { + font-weight: normal; + padding: 0.1em 1em 0.1em 0.1em; +} + +div#cgit div.commit-subject { + font-weight: bold; + font-size: 125%; + margin: 1.5em 0em 0.5em 0em; + padding: 0em; +} + +div#cgit div.commit-msg { + white-space: pre; + font-family: monospace; +} + +div#cgit div.notes-header { + font-weight: bold; + padding-top: 1.5em; +} + +div#cgit div.notes { + white-space: pre; + font-family: monospace; + border: solid 1px #ee9; + background-color: #ffd; + padding: 0.3em 2em 0.3em 1em; + float: left; +} + +div#cgit div.notes-footer { + clear: left; +} + +div#cgit div.diffstat-header { + font-weight: bold; + padding-top: 1.5em; +} + +div#cgit table.diffstat { + border-collapse: collapse; + border: solid 1px #aaa; + background-color: #eee; +} + +div#cgit table.diffstat th { + font-weight: normal; + text-align: left; + text-decoration: underline; + padding: 0.1em 1em 0.1em 0.1em; + font-size: 100%; +} + +div#cgit table.diffstat td { + padding: 0.2em 0.2em 0.1em 0.1em; + font-size: 100%; + border: none; +} + +div#cgit table.diffstat td.mode { + white-space: nowrap; +} + +div#cgit table.diffstat td span.modechange { + padding-left: 1em; + color: red; +} + +div#cgit table.diffstat td.add a { + color: green; +} + +div#cgit table.diffstat td.del a { + color: red; +} + +div#cgit table.diffstat td.upd a { + color: blue; +} + +div#cgit table.diffstat td.graph { + width: 500px; + vertical-align: middle; +} + +div#cgit table.diffstat td.graph table { + border: none; +} + +div#cgit table.diffstat td.graph td { + padding: 0px; + border: 0px; + height: 7pt; +} + +div#cgit table.diffstat td.graph td.add { + background-color: #5c5; +} + +div#cgit table.diffstat td.graph td.rem { + background-color: #c55; +} + +div#cgit div.diffstat-summary { + color: #888; + padding-top: 0.5em; +} + +div#cgit table.diff { + width: 100%; +} + +div#cgit table.diff td { + font-family: monospace; + white-space: pre; +} + +div#cgit table.diff td div.head { + font-weight: bold; + margin-top: 1em; + color: black; +} + +div#cgit table.diff td div.hunk { + color: #009; +} + +div#cgit table.diff td div.add { + color: green; +} + +div#cgit table.diff td div.del { + color: red; +} + +div#cgit .sha1 { + font-family: monospace; + font-size: 90%; +} + +div#cgit .left { + text-align: left; +} + +div#cgit .right { + text-align: right; + float: none !important; + width: auto !important; + padding: 0 !important; +} + +div#cgit table.list td.reposection { + font-style: italic; + color: #888; +} + +div#cgit a.button { + font-size: 80%; + padding: 0em 0.5em; +} + +div#cgit a.primary { + font-size: 100%; +} + +div#cgit a.secondary { + font-size: 90%; +} + +div#cgit td.toplevel-repo { + +} + +div#cgit table.list td.sublevel-repo { + padding-left: 1.5em; +} + +div#cgit ul.pager { + list-style-type: none; + text-align: center; + margin: 1em 0em 0em 0em; + padding: 0; +} + +div#cgit ul.pager li { + display: inline-block; + margin: 0.25em 0.5em; +} + +div#cgit ul.pager a { + color: #777; +} + +div#cgit ul.pager .current { + font-weight: bold; +} + +div#cgit span.age-mins { + font-weight: bold; + color: #080; +} + +div#cgit span.age-hours { + color: #080; +} + +div#cgit span.age-days { + color: #040; +} + +div#cgit span.age-weeks { + color: #444; +} + +div#cgit span.age-months { + color: #888; +} + +div#cgit span.age-years { + color: #bbb; +} +div#cgit div.footer { + margin-top: 0.5em; + text-align: center; + font-size: 80%; + color: #ccc; +} +div#cgit a.branch-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #88ff88; + border: solid 1px #007700; +} +div#cgit a.tag-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ffff88; + border: solid 1px #777700; +} +div#cgit a.remote-deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ccccff; + border: solid 1px #000077; +} +div#cgit a.deco { + color: #000; + margin: 0px 0.5em; + padding: 0px 0.25em; + background-color: #ff8888; + border: solid 1px #770000; +} + +div#cgit div.commit-subject a.branch-deco, +div#cgit div.commit-subject a.tag-deco, +div#cgit div.commit-subject a.remote-deco, +div#cgit div.commit-subject a.deco { + margin-left: 1em; + font-size: 75%; +} + +div#cgit table.stats { + border: solid 1px black; + border-collapse: collapse; +} + +div#cgit table.stats th { + text-align: left; + padding: 1px 0.5em; + background-color: #eee; + border: solid 1px black; +} + +div#cgit table.stats td { + text-align: right; + padding: 1px 0.5em; + border: solid 1px black; +} + +div#cgit table.stats td.total { + font-weight: bold; + text-align: left; +} + +div#cgit table.stats td.sum { + color: #c00; + font-weight: bold; +/* background-color: #eee; */ +} + +div#cgit table.stats td.left { + text-align: left; +} + +div#cgit table.vgraph { + border-collapse: separate; + border: solid 1px black; + height: 200px; +} + +div#cgit table.vgraph th { + background-color: #eee; + font-weight: bold; + border: solid 1px white; + padding: 1px 0.5em; +} + +div#cgit table.vgraph td { + vertical-align: bottom; + padding: 0px 10px; +} + +div#cgit table.vgraph div.bar { + background-color: #eee; +} + +div#cgit table.hgraph { + border: solid 1px black; + width: 800px; +} + +div#cgit table.hgraph th { + background-color: #eee; + font-weight: bold; + border: solid 1px black; + padding: 1px 0.5em; +} + +div#cgit table.hgraph td { + vertical-align: middle; + padding: 2px 2px; +} + +div#cgit table.hgraph div.bar { + background-color: #eee; + height: 1em; +} + +div#cgit table.ssdiff { + width: 100%; +} + +div#cgit table.ssdiff td { + font-size: 75%; + font-family: monospace; + white-space: pre; + padding: 1px 4px 1px 4px; + border-left: solid 1px #aaa; + border-right: solid 1px #aaa; +} + +div#cgit table.ssdiff td.add { + color: black; + background: #cfc; + min-width: 50%; +} + +div#cgit table.ssdiff td.add_dark { + color: black; + background: #aca; + min-width: 50%; +} + +div#cgit table.ssdiff span.add { + background: #cfc; + font-weight: bold; +} + +div#cgit table.ssdiff td.del { + color: black; + background: #fcc; + min-width: 50%; +} + +div#cgit table.ssdiff td.del_dark { + color: black; + background: #caa; + min-width: 50%; +} + +div#cgit table.ssdiff span.del { + background: #fcc; + font-weight: bold; +} + +div#cgit table.ssdiff td.changed { + color: black; + background: #ffc; + min-width: 50%; +} + +div#cgit table.ssdiff td.changed_dark { + color: black; + background: #cca; + min-width: 50%; +} + +div#cgit table.ssdiff td.lineno { + color: black; + background: #eee; + text-align: right; + width: 3em; + min-width: 3em; +} + +div#cgit table.ssdiff td.hunk { + color: black; + background: #ccf; + border-top: solid 1px #aaa; + border-bottom: solid 1px #aaa; +} + +div#cgit table.ssdiff td.head { + border-top: solid 1px #aaa; + border-bottom: solid 1px #aaa; +} + +div#cgit table.ssdiff td.head div.head { + font-weight: bold; + color: black; +} + +div#cgit table.ssdiff td.foot { + border-top: solid 1px #aaa; + border-left: none; + border-right: none; + border-bottom: none; +} + +div#cgit table.ssdiff td.space { + border: none; +} + +div#cgit table.ssdiff td.space div { + min-height: 3em; +} + +/* + * Style definitions generated by highlight 3.14, http://www.andre-simon.de/ + * Highlighting theme: Kwrite Editor + */ +div#cgit table.blob .num { color:#b07e00; } +div#cgit table.blob .esc { color:#ff00ff; } +div#cgit table.blob .str { color:#bf0303; } +div#cgit table.blob .pps { color:#818100; } +div#cgit table.blob .slc { color:#838183; font-style:italic; } +div#cgit table.blob .com { color:#838183; font-style:italic; } +div#cgit table.blob .ppc { color:#008200; } +div#cgit table.blob .opt { color:#000000; } +div#cgit table.blob .ipl { color:#0057ae; } +div#cgit table.blob .lin { color:#555555; } +div#cgit table.blob .kwa { color:#000000; font-weight:bold; } +div#cgit table.blob .kwb { color:#0057ae; } +div#cgit table.blob .kwc { color:#000000; font-weight:bold; } +div#cgit table.blob .kwd { color:#010181; } diff --git a/web/html/index.php b/web/html/index.php index 95989f5..cfd6598 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -78,6 +78,9 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { case "request": include('pkgreq.php'); return; + case "comaintainers": + include('comaintainers.php'); + return; default: header("HTTP/1.0 404 Not Found"); include "./404.php"; @@ -141,6 +144,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { switch ($path) { case "/css/archweb.css": case "/css/aur.css": + case "/css/cgit.css": case "/css/archnavbar/archnavbar.css": header("Content-Type: text/css"); readfile("./$path"); @@ -151,6 +155,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { readfile("./$path"); break; case "/css/archnavbar/archlogo.png": + case "/css/archnavbar/aurlogo.png": case "/images/AUR-logo-80.png": case "/images/AUR-logo.png": case "/images/favicon.ico": diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php index bdce516..201749e 100644 --- a/web/html/pkgbase.php +++ b/web/html/pkgbase.php @@ -97,6 +97,8 @@ if (check_token()) { list($ret, $output) = pkgreq_file($ids, $_POST['type'], $_POST['merge_into'], $_POST['comments']); } elseif (current_action("do_CloseRequest")) { list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason'], $_POST['comments']); + } elseif (current_action("do_EditComaintainers")) { + list($ret, $output) = pkgbase_set_comaintainers($base_id, explode("\n", $_POST['users'])); } if (isset($_REQUEST['comment'])) { @@ -124,7 +126,7 @@ if (check_token()) { } $pkgs = pkgbase_get_pkgnames($base_id); -if (count($pkgs) == 1) { +if (!$output && count($pkgs) == 1) { /* Not a split package. Redirect to the package page. */ if (empty($_SERVER['QUERY_STRING'])) { header('Location: ' . get_pkg_uri($pkgs[0])); diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php deleted file mode 100644 index 098c3fa..0000000 --- a/web/html/pkgsubmit.php +++ /dev/null @@ -1,489 +0,0 @@ -<?php - -set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); - -require_once('Archive/Tar.php'); - -include_once("aur.inc.php"); # access AUR common functions -include_once("pkgfuncs.inc.php"); # package functions - -set_lang(); # this sets up the visitor's language -check_sid(); # see if they're still logged in - -$cwd = getcwd(); - -if ($_COOKIE["AURSID"]) { - $uid = uid_from_sid($_COOKIE['AURSID']); -} -else { - $uid = NULL; -} - -if ($uid): - - # Track upload errors - $error = ""; - - if (isset($_REQUEST['pkgsubmit'])) { - - # Make sure authenticated user submitted the package themselves - if (!check_token()) { - $error = __("Invalid token for user action."); - } - - # Before processing, make sure we even have a file - switch($_FILES['pfile']['error']) { - case UPLOAD_ERR_INI_SIZE: - $maxsize = ini_get('upload_max_filesize'); - $error = __("Error - Uploaded file larger than maximum allowed size (%s)", $maxsize); - break; - case UPLOAD_ERR_PARTIAL: - $error = __("Error - File partially uploaded"); - break; - case UPLOAD_ERR_NO_FILE: - $error = __("Error - No file uploaded"); - break; - case UPLOAD_ERR_NO_TMP_DIR: - $error = __("Error - Could not locate temporary upload folder"); - break; - case UPLOAD_ERR_CANT_WRITE: - $error = __("Error - File could not be written"); - break; - } - - # Check whether the file is gzip'ed - if (!$error) { - $fh = fopen($_FILES['pfile']['tmp_name'], 'rb'); - fseek($fh, 0, SEEK_SET); - list(, $magic) = unpack('v', fread($fh, 2)); - - if ($magic != 0x8b1f) { - $error = __("Error - unsupported file format (please submit gzip'ed tarballs generated by makepkg(8) only)."); - } - } - - # Check uncompressed file size (ZIP bomb protection) - $max_filesize_uncompressed = config_get_int('options', 'max_filesize_uncompressed'); - if (!$error && $max_filesize_uncompressed) { - fseek($fh, -4, SEEK_END); - list(, $filesize_uncompressed) = unpack('V', fread($fh, 4)); - - if ($filesize_uncompressed > $max_filesize_uncompressed) { - $error = __("Error - uncompressed file size too large."); - } - } - - # Close file handle before extracting stuff - if (isset($fh) && is_resource($fh)) { - fclose($fh); - } - - if (!$error) { - $tar = new Archive_Tar($_FILES['pfile']['tmp_name']); - - /* Extract PKGBUILD and .SRCINFO into a string. */ - $pkgbuild_raw = $srcinfo_raw = ''; - $dircount = 0; - foreach ($tar->listContent() as $tar_file) { - if ($tar_file['typeflag'] == 0) { - if (strchr($tar_file['filename'], '/') === false) { - $error = __("Error - source tarball may not contain files outside a directory."); - break; - } elseif ($tar_file['mode'] != 0644 && $tar_file['mode'] != 0755) { - $error = __("Error - all files must have permissions of 644 or 755."); - break; - } elseif (substr($tar_file['filename'], -9) == '/PKGBUILD') { - $pkgbuild_raw = $tar->extractInString($tar_file['filename']); - } elseif (substr($tar_file['filename'], -9) == '/.AURINFO' || - substr($tar_file['filename'], -9) == '/.SRCINFO') { - $srcinfo_raw = $tar->extractInString($tar_file['filename']); - } - } elseif ($tar_file['typeflag'] == 5) { - if (substr_count($tar_file['filename'], "/") > 1) { - $error = __("Error - source tarball may not contain nested subdirectories."); - break; - } elseif (++$dircount > 1) { - $error = __("Error - source tarball may not contain more than one directory."); - break; - } elseif ($tar_file['mode'] != 0755) { - $error = __("Error - all directories must have permissions of 755."); - break; - } - } - } - } - - if (!$error && $dircount !== 1) { - $error = __("Error - source tarball may not contain files outside a directory."); - } - - if (empty($pkgbuild_raw) && !$error) { - $error = __("Error trying to unpack upload - PKGBUILD does not exist."); - } - - if (empty($srcinfo_raw)) { - $srcinfo_raw = ''; - if (!$error) { - $error = __("The source package does not contain any meta data. Please use `makepkg --source` from pacman 4.2.0 or newer to create AUR source packages."); - } - } - - /* Parse .SRCINFO and extract meta data. */ - $pkgbase_info = array(); - $pkginfo = array(); - $section_info = array(); - foreach (explode("\n", $srcinfo_raw) as $line) { - $line = ltrim($line); - if (empty($line) || $line[0] == '#') { - continue; - } - list($key, $value) = explode(' = ', $line, 2); - $tokens = explode('_', $key, 2); - $key = $tokens[0]; - if (count($tokens) > 1) { - $arch = $tokens[1]; - } else { - $arch = NULL; - } - switch ($key) { - case 'pkgbase': - case 'pkgname': - if (!empty($section_info)) { - if (isset($section_info['pkgbase'])) { - $pkgbase_info = $section_info; - } elseif (isset($section_info['pkgname'])) { - $pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info); - } - } - $section_info = array( - 'license' => array(), - 'groups' => array(), - 'depends' => array(), - 'makedepends' => array(), - 'checkdepends' => array(), - 'optdepends' => array(), - 'source' => array(), - 'conflicts' => array(), - 'provides' => array(), - 'replaces' => array() - ); - /* Fall-through case. */ - case 'epoch': - case 'pkgdesc': - case 'pkgver': - case 'pkgrel': - case 'url': - $section_info[$key] = $value; - break; - case 'license': - case 'groups': - $section_info[$key][] = $value; - break; - case 'depends': - case 'makedepends': - case 'checkdepends': - case 'optdepends': - case 'conflicts': - case 'provides': - case 'replaces': - case 'source': - $section_info[$key][$arch][] = $value; - break; - } - } - - if (!empty($section_info)) { - if (isset($section_info['pkgbase'])) { - $pkgbase_info = $section_info; - } elseif (isset($section_info['pkgname'])) { - $pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info); - } - } - - /* Validate package base name. */ - if (!$error) { - $pkgbase_name = $pkgbase_info['pkgbase']; - if (!preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/D", $pkgbase_name)) { - $error = __("Invalid name: only lowercase letters are allowed."); - } - - /* Check whether the package base already exists. */ - $base_id = pkgbase_from_name($pkgbase_name); - } - - foreach ($pkginfo as $key => $pi) { - /* Bail out early if an error has occurred. */ - if ($error) { - break; - } - - /* Validate package names. */ - $pkg_name = $pi['pkgname']; - if (!preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/D", $pkg_name)) { - $error = __("Invalid name: only lowercase letters are allowed."); - break; - } - - /* Determine the full package versions with epoch. */ - if (isset($pi['epoch']) && (int)$pi['epoch'] > 0) { - $pkginfo[$key]['full-version'] = sprintf('%d:%s-%s', $pi['epoch'], $pi['pkgver'], $pi['pkgrel']); - } else { - $pkginfo[$key]['full-version'] = sprintf('%s-%s', $pi['pkgver'], $pi['pkgrel']); - } - - /* Check for http:// or other protocols in the URL. */ - $parsed_url = parse_url($pi['url']); - if (!$parsed_url['scheme']) { - $error = __("Package URL is missing a protocol (ie. http:// ,ftp://)"); - break; - } - - /* - * The DB schema imposes limitations on number of - * allowed characters. Print error message when these - * limitations are exceeded. - */ - if (strlen($pi['pkgname']) > 64) { - $error = __("Error - Package name cannot be greater than %d characters", 64); - break; - } - if (strlen($pi['url']) > 255) { - $error = __("Error - Package URL cannot be greater than %d characters", 255); - break; - } - if (strlen($pi['pkgdesc']) > 255) { - $error = __("Error - Package description cannot be greater than %d characters", 255); - break; - } - foreach ($pi['license'] as $lic) { - if (strlen($lic > 64)) { - $error = __("Error - Package license cannot be greater than %d characters", 64); - break; - } - } - if (strlen($pkginfo[$key]['full-version']) > 32) { - $error = __("Error - Package version cannot be greater than %d characters", 32); - break; - } - - /* Check if package name is blacklisted. */ - if (!$base_id && pkg_name_is_blacklisted($pi['pkgname']) && !can_submit_blacklisted(account_from_sid($_COOKIE["AURSID"]))) { - $error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pi['pkgname']); - break; - } - } - - if (isset($pkgbase_name)) { - $incoming_pkgdir = config_get('paths', 'storage') . substr($pkgbase_name, 0, 2) . "/" . $pkgbase_name; - } - - /* Upload PKGBUILD and tarball. */ - if (!$error && !can_submit_pkgbase($pkgbase_name, $_COOKIE["AURSID"])) { - $error = __( "You are not allowed to overwrite the %s%s%s package.", "<strong>", $pkgbase_name, "</strong>"); - } - - if (!$error) { - foreach ($pkginfo as $pi) { - if (!can_submit_pkg($pi['pkgname'], $base_id)) { - $error = __( "You are not allowed to overwrite the %s%s%s package.", "<strong>", $pi['pkgname'], "</strong>"); - break; - } - } - } - - if (!$error) { - /* - * Blow away the existing directory and its contents. - */ - if (file_exists($incoming_pkgdir)) { - rm_tree($incoming_pkgdir); - } - - /* - * The mode is masked by the current umask, so not as - * scary as it looks. - */ - if (!mkdir($incoming_pkgdir, 0777, true)) { - $error = __( "Could not create directory %s.", $incoming_pkgdir); - } - - if (!chdir($incoming_pkgdir)) { - $error = __("Could not change directory to %s.", $incoming_pkgdir); - } - - file_put_contents('PKGBUILD', $pkgbuild_raw); - move_uploaded_file($_FILES['pfile']['tmp_name'], $pkgbase_name . '.tar.gz'); - } - - /* Update the backend database. */ - if (!$error) { - begin_atomic_commit(); - - /* - * Check the category to use, "1" meaning "none" (or - * "keep category" for existing packages). - */ - if (isset($_POST['category'])) { - $category_id = max(1, intval($_POST['category'])); - } else { - $category_id = 1; - } - - if ($base_id) { - /* - * This is an overwrite of an existing package - * base, the database ID needs to be preserved - * so that any votes are retained. - */ - $was_orphan = (pkgbase_maintainer_uid($base_id) === NULL); - - pkgbase_update($base_id, $pkgbase_info['pkgbase'], $uid); - - if ($category_id > 1) { - pkgbase_update_category($base_id, $category_id); - } - - pkgbase_delete_packages($base_id); - } else { - /* This is a brand new package. */ - $was_orphan = true; - $base_id = pkgbase_create($pkgbase_name, $category_id, $uid); - } - - foreach ($pkginfo as $pi) { - $pkgid = pkg_create($base_id, $pi['pkgname'], $pi['full-version'], $pi['pkgdesc'], $pi['url']); - - foreach ($pi['license'] as $lic) { - $licid = pkg_create_license($lic); - pkg_add_lic($pkgid, $licid); - } - - foreach ($pi['groups'] as $grp) { - $grpid = pkg_create_group($grp); - pkg_add_grp($pkgid, $grpid); - } - - foreach (array('depends', 'makedepends', 'checkdepends', 'optdepends') as $deptype) { - foreach ($pi[$deptype] as $deparch => $depgrp) { - foreach ($depgrp as $dep) { - $deppkgname = preg_replace("/(<|=|>).*/", "", $dep); - $depcondition = str_replace($deppkgname, "", $dep); - pkg_add_dep($pkgid, $deptype, $deppkgname, $depcondition, $deparch); - } - } - } - - foreach (array('conflicts', 'provides', 'replaces') as $reltype) { - foreach ($pi[$reltype] as $relarch => $relgrp) { - foreach ($relgrp as $rel) { - $relpkgname = preg_replace("/(<|=|>).*/", "", $rel); - $relcondition = str_replace($relpkgname, "", $rel); - pkg_add_rel($pkgid, $reltype, $relpkgname, $relcondition, $relarch); - } - } - } - - foreach ($pi['source'] as $srcarch => $srcgrp) { - foreach ($srcgrp as $src) { - pkg_add_src($pkgid, $src, $srcarch); - } - } - } - - /* - * If we just created this package, or it was an orphan - * and we auto-adopted, add submitting user to the - * notification list. - */ - if ($was_orphan) { - pkgbase_notify(array($base_id), true); - } - - end_atomic_commit(); - - header('Location: ' . get_pkgbase_uri($pkgbase_info['pkgbase'])); - } - - chdir($cwd); - } - -html_header("Submit"); - -?> - -<div class="box"> - <h2><?= __("Submit"); ?></h2> - <p><?= __("Upload your source packages here. Create source packages with `makepkg --source`.") ?></p> - -<?php - if (empty($_REQUEST['pkgsubmit']) || $error): - # User is not uploading, or there were errors uploading - then - # give the visitor the default upload form - if (ini_get("file_uploads")): - - $pkgbase_categories = pkgbase_categories(); -?> - -<?php if ($error): ?> - <ul class="errorlist"><li><?= $error ?></li></ul> -<?php endif; ?> - -<form action="<?= get_uri('/submit/'); ?>" method="post" enctype="multipart/form-data"> - <fieldset> - <div> - <input type="hidden" name="pkgsubmit" value="1" /> - <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> - </div> - <p> - <label for="id_category"><?= __("Package Category"); ?>:</label> - <select id="id_category" name="category"> - <option value="1"><?= __("Select Category"); ?></option> - <?php - foreach ($pkgbase_categories as $num => $cat): - print '<option value="' . $num . '"'; - if (isset($_POST['category']) && $_POST['category'] == $cat): - print ' selected="selected"'; - endif; - print '>' . $cat . '</option>'; - endforeach; - ?> - </select> - </p> - <p> - <label for="id_file"><?= __("Upload package file"); ?>:</label> - <input id="id_file" type="file" name="pfile" size='30' /> - </p> - <p> - <label></label> - <input class="button" type="submit" value="<?= __("Upload"); ?>" /> - </p> - </fieldset> -</form> -</div> -<?php - else: - print __("Sorry, uploads are not permitted by this server."); -?> - -<br /> -</div> -<?php - endif; - endif; -else: - # Visitor is not logged in - html_header("Submit"); - print __("You must create an account before you can upload packages."); -?> - -<br /> - -<?php -endif; -?> - - - -<?php -html_footer(AUR_VERSION); - |