diff options
-rw-r--r-- | web/html/packages.php | 21 | ||||
-rw-r--r-- | web/lang/en/pkgfuncs_po.inc | 6 | ||||
-rw-r--r-- | web/lib/pkgfuncs.inc | 53 |
3 files changed, 78 insertions, 2 deletions
diff --git a/web/html/packages.php b/web/html/packages.php index 4cb8c478..0559060c 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -66,6 +66,27 @@ if (isset($_REQUEST["do_Flag"])) { print "<p>\n"; print __("The selected packages have been flagged out-of-date."); print "</p>\n"; + + # notification by tardo. + $f_name = username_from_sid($_COOKIE['AURSID']); + $f_email = email_from_sid($_COOKIE['AURSID']); + $f_uid = uid_from_sid($_COOKIE['AURSID']); + $q = "SELECT Packages.Name, Users.Email, Packages.ID "; + $q.= "FROM Packages, Users "; + $q.= "WHERE Packages.ID IN (" . $flag .") "; + $q.= "AND Users.ID = Packages.MaintainerUID "; + $q.= "AND Users.ID != " . $f_uid; + $result = db_query($q, $dbh); + if (mysql_num_rows($result)) { + while ($row = mysql_fetch_assoc($result)) { + # construct email + $body = "Your package " . $row['Name'] . " has been flagged out of date by " . $f_name . ". You may view your package at:\nhttp://aur.archlinux.org/packages.php?do_Details=1&ID=" . $row['ID']; + $body = wordwrap($body, 70); + $headers = "To: ".$row['Email']."\nReply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR\n"; + @mail(' ', "AUR Out-of-date Notification for ".$row['Name'], $body, $headers); + } + } + } else { print "<p>\n"; print __("You did not select any packages to flag."); diff --git a/web/lang/en/pkgfuncs_po.inc b/web/lang/en/pkgfuncs_po.inc index dcd46f4f..634f45af 100644 --- a/web/lang/en/pkgfuncs_po.inc +++ b/web/lang/en/pkgfuncs_po.inc @@ -151,4 +151,10 @@ $_t["en"]["License"] = "License"; $_t["en"]["unknown"] = "unknown"; +$_t["en"]["Required by"] = "Required by"; + +$_t["en"]["The above files have been verified (by %h%s%h) and are safe to use."] = "The above files have been verified (by %h%s%h) and are safe to use."; + +$_t["en"]["This package has been flagged out of date."] = "This package has been flagged out of date."; + ?> diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 3089ccb5..2e5bd4b8 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -152,6 +152,25 @@ function package_dependencies($pkgid=0) { return $deps; } +# reverse deps by tardo +# +function package_required($pkgid=0) { + $deps = array(); + if ($pkgid) { + $dbh = db_connect(); + $q = "SELECT PackageID, Name, DummyPkg from PackageDepends, Packages "; + $q.= "WHERE PackageDepends.PackageID = Packages.ID "; + $q.= "AND PackageDepends.DepPkgID = "; + $q.= mysql_real_escape_string($pkgid); + $result = db_query($q, $dbh); + if (!$result) {return array();} + while ($row = mysql_fetch_row($result)) { + $deps[] = $row; + } + } + return $deps; +} + # create a dummy package and return it's Packages.ID if it already exists, # return the existing ID # @@ -338,12 +357,16 @@ function package_details($id=0, $SID="") { if ($row["LocationID"] == 2) { echo " <tr><td colspan='2'>"; if ($row["Safe"]) { - echo "<span class='f7'>".__("The above files have been verified (by %s) and are safe to use.", array(username_from_id($row["VerifiedBy"])))."</span></td>"; + echo "<span class='f7'>".__("The above files have been verified (by %h%s%h) and are safe to use.", array("<a href='/account.php?Action=AccountInfo&ID=".$row["VerifiedBy"]."'>", username_from_id($row["VerifiedBy"]), "</a>"))."</span></td>"; } else { echo "<span class='f6'>".__("Be careful! The above files may contain malicious code that can damage your system.")."</span></td>"; } echo " </tr>\n"; } + if ($row["OutOfDate"] == 1) { + echo "\n<tr><td colspan='2'>"; + echo "<span class='f6'>".__("This package has been flagged out of date.")."</span></td></tr>"; + } echo " <tr><td class='boxSoft' colspan='2'><img src='/images/pad.gif' height='30'></td></tr>\n"; echo " <tr>\n"; echo " <td valign='top' style='padding-right: 10'>\n"; @@ -368,6 +391,32 @@ function package_details($id=0, $SID="") { if ($darr[2] == 0) echo $url."'>".$darr[1].$darr[3]."</a><br />\n"; else echo "<a href='#'>".$darr[1].$darr[3]."</a><br />\n"; } + echo "</td></tr>\n"; + echo "</table></td>"; + + # reverse-deps by tardo - could use some beautification + echo " <td valign='top'>"; + echo "<table class='boxSoft' style='width: 200px'>"; + echo "<tr><td class='boxSoftTitle'><span class='f3'>"; + echo __("Required by")."</span></td></tr>\n"; + echo "<tr><td class='boxSoft'>"; + $deps = package_required($row["ID"]); + while (list($k, $darr) = each($deps)) { + $url = "<a href='/packages.php?do_Details=1&ID=".$darr[0]; + while(list($k, $var) = each($pkgsearch_vars)) { + if (($var == "do_MyPackages" || $var == "do_Orphans") && $_REQUEST[$var]) { + $url .= "&".$var."=1"; + } else { + $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); + } + } + reset($pkgsearch_vars); + + // $darr[3] is the DepCondition + + if ($darr[2] == 0) print $url."'>".$darr[1].$darr[3]."</a><br />\n"; + else print "<a href='#'>".$darr[1].$darr[3]."</a><br />\n"; + } echo "</td></tr>\n"; echo " </table>\n"; echo " </td>\n"; @@ -517,7 +566,7 @@ function package_details($id=0, $SID="") { echo " <tr>\n"; echo " <td class='boxSoft'>"; echo "<code>\n"; - echo str_replace("\n", "<br>", str_replace('"',""", htmlspecialchars(strip_tags(stripslashes($carr["Comments"]))))); + echo nl2br(htmlspecialchars($carr["Comments"])); echo "</code></td>\n"; echo " </tr>\n"; echo " </table>\n"; |