Пример #1
0
<?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(AURWEB_VERSION);
Пример #2
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
include_once "aur.inc.php";
include_once "pkgfuncs.inc.php";
set_lang();
check_sid();
html_header(__("Disown Package"));
$maintainer_uids = array(pkgbase_maintainer_uid($base_id));
$comaintainers = pkgbase_get_comaintainers($base_id);
if (has_credential(CRED_PKGBASE_DISOWN, $maintainer_uids)) {
    ?>
<div class="box">
	<h2><?php 
    echo __('Disown Package: %s', htmlspecialchars($pkgbase_name));
    ?>
</h2>
	<p>
		<?php 
    echo __('Use this form to disown the package base %s%s%s which includes the following packages: ', '<strong>', htmlspecialchars($pkgbase_name), '</strong>');
    ?>
	</p>
	<ul>
		<?php 
    foreach (pkgbase_get_pkgnames($base_id) as $pkgname) {
        ?>
		<li><?php 
        echo htmlspecialchars($pkgname);
        ?>
</li>
		<?php 
Пример #3
0
/**
 * Update the list of co-maintainers of a package base
 *
 * @param int $base_id The package base ID to update the co-maintainers of
 * @param array $users Array of co-maintainer user names
 *
 * @return array Tuple of success/failure indicator and error message
 */
function pkgbase_set_comaintainers($base_id, $users)
{
    if (!has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) {
        return array(false, __("You are not allowed to manage co-maintainers of this package base."));
    }
    /* Remove empty and duplicate user names. */
    $users = array_unique(array_filter(array_map('trim', $users)));
    $dbh = DB::connect();
    $uids = array();
    foreach ($users as $user) {
        $q = "SELECT ID FROM Users ";
        $q .= "WHERE UserName = "******"Invalid user name: %s", $user));
        }
        $uids[] = $uid;
    }
    $q = sprintf("DELETE FROM PackageComaintainers WHERE PackageBaseID = %d", $base_id);
    $dbh->exec($q);
    $i = 1;
    foreach ($uids as $uid) {
        $q = sprintf("INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (%d, %d, %d)", $base_id, $uid, $i);
        $dbh->exec($q);
        $i++;
    }
    return array(true, __("The package base co-maintainers have been updated."));
}