Re: [aur-dev] [PATCH 2/3] Move package merging to a separate page

2012-09-27 Thread Lukas Fleischer
On Wed, Sep 26, 2012 at 08:03:24PM -0400, canyonknight wrote:
> Package actions now have a separate box on the package details page. Add
> a package merge link in that box.
> 
> Link leads to a new page (pkgmerge.php) that can be used to confirm package
> merging. A separate page with confirmation is used to avoid CSRFs.
> 
> Signed-off-by: canyonknight 
> ---
>  web/html/index.php   |  3 +++
>  web/html/pkgmerge.php| 48 
> 
>  web/template/pkg_details.php |  1 +
>  3 files changed, 52 insertions(+)
>  create mode 100644 web/html/pkgmerge.php
> 
> diff --git a/web/html/index.php b/web/html/index.php
> index 3fe6338..12f79cb 100644
> --- a/web/html/index.php
> +++ b/web/html/index.php
> @@ -46,6 +46,9 @@ if (isset($tokens[1]) && '/' . $tokens[1] == 
> get_pkg_route()) {
>   case "delete":
>   include('pkgdel.php');
>   return;
> + case "merge":
> + include('pkgmerge.php');
> + return;
>   }
>  
>   if (isset($_COOKIE['AURSID'])) {
> diff --git a/web/html/pkgmerge.php b/web/html/pkgmerge.php
> new file mode 100644
> index 000..687982e
> --- /dev/null
> +++ b/web/html/pkgmerge.php
> @@ -0,0 +1,48 @@
> + +
> +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(__("Package Merging"));
> +
> +$atype = "";
> +
> +if (isset($_COOKIE["AURSID"])) {
> + $atype = account_from_sid($_COOKIE["AURSID"]);
> +}
> +
> +if ($atype == "Trusted User" || $atype == "Developer"): ?>
> +
> +  ?>
> + 
> +  another package. ',
> + '', htmlspecialchars($pkgname), ''
> + );
> + echo __('Once the package has been merged it cannot be 
> reversed. ');
> + echo __('Enter the package name you wish to merge the package 
> into. ');
> + echo __('Select the checkbox to confirm action.') ?>
> + 
> + 
> + 
> +  value="1" />
> + 
> + 
> +  into:") ?>
> +  />
> +  value="1" />
> + 
> +  value="" />
> + 
> + 
> +
> +
> + + print __("Only Trusted Users and Developers can merge packages.");
> +endif;
> +
> +html_footer(AUR_VERSION);

Same here, it would be good if we used the echo shortcut syntax here.

> diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
> index dcc086b..182722d 100644
> --- a/web/template/pkg_details.php
> +++ b/web/template/pkg_details.php
> @@ -56,6 +56,7 @@ $sources = package_sources($row["ID"]);
>   
>"Developer"): ?>
>   
> + 
>   
>   
>   
> -- 
> 1.7.12.1


[aur-dev] [PATCH 2/3] Move package merging to a separate page

2012-09-26 Thread canyonknight
Package actions now have a separate box on the package details page. Add
a package merge link in that box.

Link leads to a new page (pkgmerge.php) that can be used to confirm package
merging. A separate page with confirmation is used to avoid CSRFs.

Signed-off-by: canyonknight 
---
 web/html/index.php   |  3 +++
 web/html/pkgmerge.php| 48 
 web/template/pkg_details.php |  1 +
 3 files changed, 52 insertions(+)
 create mode 100644 web/html/pkgmerge.php

diff --git a/web/html/index.php b/web/html/index.php
index 3fe6338..12f79cb 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -46,6 +46,9 @@ if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) 
{
case "delete":
include('pkgdel.php');
return;
+   case "merge":
+   include('pkgmerge.php');
+   return;
}
 
if (isset($_COOKIE['AURSID'])) {
diff --git a/web/html/pkgmerge.php b/web/html/pkgmerge.php
new file mode 100644
index 000..687982e
--- /dev/null
+++ b/web/html/pkgmerge.php
@@ -0,0 +1,48 @@
+
+
+   
+   
+   ', htmlspecialchars($pkgname), ''
+   );
+   echo __('Once the package has been merged it cannot be 
reversed. ');
+   echo __('Enter the package name you wish to merge the package 
into. ');
+   echo __('Select the checkbox to confirm action.') ?>
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   " />
+   
+   
+
+
+


+   



-- 
1.7.12.1