コード例 #1
0
ファイル: login.php プロジェクト: pyp22/aurweb
    $login = try_login();
    $login_error = $login['error'];
}
html_header('AUR ' . __("Login"));
?>
<div id="dev-login" class="box">
	<h2>AUR <?php 
echo __('Login');
?>
</h2>
	<?php 
if (isset($_COOKIE["AURSID"])) {
    ?>
	<p>
		<?php 
    echo __("Logged-in as: %s", '<strong>' . username_from_sid($_COOKIE["AURSID"]) . '</strong>');
    ?>
		<a href="<?php 
    echo get_uri('/logout/');
    ?>
">[<?php 
    echo __("Logout");
    ?>
]</a>
	</p>
	<?php 
} elseif (!$disable_http_login || isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) {
    ?>
	<form method="post" action="<?php 
    echo get_uri('/login');
    ?>
コード例 #2
0
ファイル: login_form.php プロジェクト: Zariel/arch-aur
<div id="login_bar" class="pgbox">
<?php 
if (isset($_COOKIE["AURSID"])) {
    print __("Logged-in as: %s", '<b>' . username_from_sid($_COOKIE["AURSID"]) . '</b>');
    ?>
 <a href="logout.php">[<?php 
    print __("Logout");
    ?>
]</a>
<?php 
} else {
    if ($login_error) {
        print "<span class='error'>" . $login_error . "</span><br />\n";
    }
    '?' . implode('&amp', $_GET);
    ?>
<form method="post" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">
	<div>
	<?php 
    print __('Username') . ':';
    ?>
	<input type="text" name="user" size="30" maxlength="<?php 
    print USERNAME_MAX_LEN;
    ?>
" value="<?php 
    if (isset($_POST['user'])) {
        print htmlspecialchars($_POST['user'], ENT_QUOTES);
    }
コード例 #3
0
ファイル: header.php プロジェクト: pyp22/aurweb
    ?>
						<?php 
    if (has_credential(CRED_ACCOUNT_SEARCH)) {
        ?>
						<li><a href="<?php 
        echo get_uri('/accounts/');
        ?>
"><?php 
        echo __("Accounts");
        ?>
</a></li>
						<?php 
    }
    ?>
						<li><a href="<?php 
    echo get_user_uri(username_from_sid($_COOKIE['AURSID'])) . 'edit/';
    ?>
"><?php 
    echo __(" My Account");
    ?>
</a></li>
						<?php 
    if (has_credential(CRED_TU_LIST_VOTES)) {
        ?>
<li><a href="<?php 
        echo get_uri('/tu/');
        ?>
"><?php 
        echo __("Trusted User");
        ?>
</a></li><?php 
コード例 #4
0
ファイル: user_table.php プロジェクト: Zariel/arch-aur
<?php

$username = username_from_sid($_COOKIE["AURSID"]);
?>
<table class='boxSoft'>
<tr>
<th colspan='2' class='boxSoftTitle'>
<span class='f3'><?php 
print __("My Statistics");
?>
</span>
</th>
</tr>
<tr>
<td class='boxSoft'>
<span class='f4'><a href="packages.php?SeB=m&amp;L=2&amp;K=<?php 
echo $username;
?>
">
<?php 
print __("Packages in unsupported");
?>
</a></span>
</td>
<td class='boxSoft'>
<span class='f4'><?php 
print $maintainer_unsupported_count;
?>
</span>
</td>
</tr>
コード例 #5
0
ファイル: tu.php プロジェクト: Zariel/arch-aur
 $hasvoted = mysql_num_rows(db_query($qvoted, $dbh));
 # List voters of a proposal.
 $qwhoVoted = "SELECT tv.UserID,U.Username\n\t\t\t\t\tFROM TU_Votes tv, Users U\n\t\t\t\t\tWHERE tv.VoteID = {$row['ID']}\n\t\t\t\t\tAND tv.UserID = U.ID\n\t\t\t\t\tORDER BY Username";
 $result = db_query($qwhoVoted, $dbh);
 if (mysql_num_rows($result) > 0) {
     while ($who = mysql_fetch_assoc($result)) {
         $whovoted .= '<a href="account.php?Action=AccountInfo&ID=' . $who['UserID'] . '">' . $who['Username'] . '</a> ';
     }
 }
 $canvote = 1;
 $errorvote = "";
 if ($isrunning == 0) {
     $canvote = 0;
     $errorvote = __("Voting is closed for this proposal.");
 } else {
     if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) {
         $canvote = 0;
         $errorvote = __("You cannot vote in an proposal about you.");
     } else {
         if ($hasvoted != 0) {
             $canvote = 0;
             $errorvote = __("You've already voted for this proposal.");
         }
     }
 }
 if ($canvote == 1) {
     if (isset($_POST['doVote'])) {
         if (isset($_POST['voteYes'])) {
             $myvote = "Yes";
         } else {
             if (isset($_POST['voteNo'])) {
コード例 #6
0
ファイル: pkg_comment_form.php プロジェクト: Zariel/arch-aur
    $q .= 'AND CommentNotify.PkgID = ' . intval($_REQUEST['ID']);
    $result = db_query($q, $dbh);
    $bcc = array();
    if (mysql_num_rows($result)) {
        while ($row = mysql_fetch_assoc($result)) {
            array_push($bcc, $row['Email']);
        }
        $q = 'SELECT Packages.Name ';
        $q .= 'FROM Packages ';
        $q .= 'WHERE Packages.ID = ' . intval($_REQUEST['ID']);
        $result = db_query($q, $dbh);
        $row = mysql_fetch_assoc($result);
        # TODO: native language emails for users, based on their prefs
        # Simply making these strings translatable won't work, users would be
        # getting emails in the language that the user who posted the comment was in
        $body = 'from http://aur.archlinux.org/packages.php?ID=' . $_REQUEST['ID'] . "\n" . username_from_sid($_COOKIE['AURSID']) . " wrote:\n\n" . $_POST['comment'] . "\n\n---\nIf you no longer wish to receive notifications about this package, please go the the above package page and click the UnNotify button.";
        $body = wordwrap($body, 70);
        $bcc = implode(', ', $bcc);
        $headers = "Bcc: {$bcc}\nReply-to: nobody@archlinux.org\nFrom: aur-notify@archlinux.org\nX-Mailer: AUR\n";
        @mail(' ', "AUR Comment for " . $row['Name'], $body, $headers);
    }
}
# Prompt visitor for comment
?>
<div class="pgbox">
	<form action='<?php 
echo $_SERVER['PHP_SELF'] . '?ID=' . $_REQUEST['ID'];
?>
' method='post'>
	<div style="padding: 1%">
<?php 
コード例 #7
0
ファイル: pkgbasefuncs.inc.php プロジェクト: pyp22/aurweb
/**
 * Adopt or disown packages
 *
 * @param array $base_ids Array of package base IDs to adopt/disown
 * @param bool $action Adopts if true, disowns if false. Adopts by default
 * @param int $via Package request to close upon adoption
 *
 * @return array Tuple of success/failure indicator and error message
 */
function pkgbase_adopt($base_ids, $action = true, $via)
{
    $dbh = DB::connect();
    $uid = uid_from_sid($_COOKIE["AURSID"]);
    if (!$uid) {
        if ($action) {
            return array(false, __("You must be logged in before you can adopt packages."));
        } else {
            return array(false, __("You must be logged in before you can disown packages."));
        }
    }
    /* Verify package ownership. */
    $base_ids = sanitize_ids($base_ids);
    $q = "SELECT ID FROM PackageBases ";
    $q .= "WHERE ID IN (" . implode(",", $base_ids) . ") ";
    if ($action && !has_credential(CRED_PKGBASE_ADOPT)) {
        /* Regular users may only adopt orphan packages. */
        $q .= "AND MaintainerUID IS NULL";
    }
    if (!$action && !has_credential(CRED_PKGBASE_DISOWN)) {
        /* Regular users may only disown their own packages. */
        $q .= "AND MaintainerUID = " . $uid;
    }
    $result = $dbh->query($q);
    $base_ids = $result->fetchAll(PDO::FETCH_COLUMN, 0);
    /* Error out if the list of remaining packages is empty. */
    if (empty($base_ids)) {
        if ($action) {
            return array(false, __("You did not select any packages to adopt."));
        } else {
            return array(false, __("You did not select any packages to disown."));
        }
    }
    /*
     * Close package request if the disownment was initiated through the
     * request interface. NOTE: This needs to happen *before* the actual
     * disown operation. Otherwise, the former maintainer will not be
     * included in the Cc list of the request notification email.
     */
    if ($via) {
        pkgreq_close(intval($via), 'accepted', '');
    }
    /* Scan through pending orphan requests and close them. */
    if (!$action) {
        $username = username_from_sid($_COOKIE['AURSID']);
        foreach ($base_ids as $base_id) {
            $pkgreq_ids = pkgreq_by_pkgbase($base_id, 'orphan');
            foreach ($pkgreq_ids as $pkgreq_id) {
                pkgreq_close(intval($pkgreq_id), 'accepted', 'The user ' . $username . ' disowned the package.', true);
            }
        }
    }
    /* Adopt or disown the package. */
    if ($action) {
        $q = "UPDATE PackageBases ";
        $q .= "SET MaintainerUID = {$uid} ";
        $q .= "WHERE ID IN (" . implode(",", $base_ids) . ") ";
        $dbh->exec($q);
    } else {
        /* Update the co-maintainer list when disowning a package. */
        if (has_credential(CRED_PKGBASE_DISOWN)) {
            foreach ($base_ids as $base_id) {
                pkgbase_set_comaintainers($base_id, array());
            }
            $q = "UPDATE PackageBases ";
            $q .= "SET MaintainerUID = NULL ";
            $q .= "WHERE ID IN (" . implode(",", $base_ids) . ") ";
            $dbh->exec($q);
        } else {
            foreach ($base_ids as $base_id) {
                $comaintainers = pkgbase_get_comaintainers($base_id);
                if (count($comaintainers) > 0) {
                    $uid = uid_from_username($comaintainers[0]);
                    $comaintainers = array_diff($comaintainers, array($comaintainers[0]));
                    pkgbase_set_comaintainers($base_id, $comaintainers);
                } else {
                    $uid = "NULL";
                }
                $q = "UPDATE PackageBases ";
                $q .= "SET MaintainerUID = " . $uid . " ";
                $q .= "WHERE ID = " . $base_id;
                $dbh->exec($q);
            }
        }
    }
    if ($action) {
        pkgbase_notify($base_ids);
        return array(true, __("The selected packages have been adopted."));
    } else {
        return array(true, __("The selected packages have been disowned."));
    }
}