From 50d8fa14e0a4300960b3e5648349777e1e3ddecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 3 Jan 2019 16:18:15 +0100 Subject: Add mantisbt --- .../packages/mantisbt-patches/bug_report.php.diff | 20 ++++ .../mantisbt-patches/bug_report_page.php.diff | 53 +++++++++ .../packages/mantisbt-patches/bugnote_add.php.diff | 20 ++++ .../mantisbt-patches/bugnote_add_inc.php.diff | 52 +++++++++ virtual/packages/mantisbt-plugin-slack.json | 15 +++ .../mantisbt-plugin-source-integration.json | 15 +++ ...t-plugin-source-integration_Source.API.php.diff | 12 ++ virtual/packages/mantisbt.nix | 124 +++++++++++++++++++++ 8 files changed, 311 insertions(+) create mode 100644 virtual/packages/mantisbt-patches/bug_report.php.diff create mode 100644 virtual/packages/mantisbt-patches/bug_report_page.php.diff create mode 100644 virtual/packages/mantisbt-patches/bugnote_add.php.diff create mode 100644 virtual/packages/mantisbt-patches/bugnote_add_inc.php.diff create mode 100644 virtual/packages/mantisbt-plugin-slack.json create mode 100644 virtual/packages/mantisbt-plugin-source-integration.json create mode 100644 virtual/packages/mantisbt-plugin-source-integration_Source.API.php.diff create mode 100644 virtual/packages/mantisbt.nix (limited to 'virtual/packages') diff --git a/virtual/packages/mantisbt-patches/bug_report.php.diff b/virtual/packages/mantisbt-patches/bug_report.php.diff new file mode 100644 index 0000000..a520043 --- /dev/null +++ b/virtual/packages/mantisbt-patches/bug_report.php.diff @@ -0,0 +1,20 @@ +--- a/bug_report.php 2018-02-10 21:29:27.000000000 +0100 ++++ b/bug_report.php 2018-03-03 15:04:19.622499678 +0100 +@@ -149,6 +149,17 @@ + access_ensure_project_level( config_get( 'update_bug_assign_threshold' ) ); + } + ++# begin captcha check for anon user ++if ( current_user_is_anonymous() && get_gd_version() > 0 ) { ++ $f_captcha = gpc_get_string( 'captcha', '' ); ++ $f_captcha = utf8_strtolower( trim( $f_captcha ) ); ++ ++ $t_securimage = new Securimage(); ++ if( $t_securimage->check( $f_captcha ) == false ) { ++ trigger_error( ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR ); ++ } ++} ++ + # if a profile was selected then let's use that information + if( 0 != $t_bug_data->profile_id ) { + if( profile_is_global( $t_bug_data->profile_id ) ) { diff --git a/virtual/packages/mantisbt-patches/bug_report_page.php.diff b/virtual/packages/mantisbt-patches/bug_report_page.php.diff new file mode 100644 index 0000000..80dea91 --- /dev/null +++ b/virtual/packages/mantisbt-patches/bug_report_page.php.diff @@ -0,0 +1,53 @@ +--- a/bug_report_page.php 2018-02-10 21:29:27.000000000 +0100 ++++ b/bug_report_page.php 2018-03-03 15:04:19.622499678 +0100 +@@ -708,7 +708,50 @@ + + + + ++ 0 ) { ++ $t_securimage_path = 'vendor/dapphp/securimage'; ++ $t_securimage_show = $t_securimage_path . '/securimage_show.php'; ++ $t_securimage_play = $t_securimage_path . '/securimage_play.swf?' ++ . http_build_query( array( ++ 'audio_file' => $t_securimage_path . '/securimage_play.php', ++ 'bgColor1=' => '#fff', ++ 'bgColor2=' => '#fff', ++ 'iconColor=' => '#777', ++ 'borderWidth=' => 1, ++ 'borderColor=' => '#000', ++ ) ); ++?> ++ ++ CAPTCHA ++ ++ ++ ++ ++ ++ ++ ++ visual captcha ++
++
++ ++ ++ ++ ++
++ ++ ++ ++ + + + diff --git a/virtual/packages/mantisbt-patches/bugnote_add.php.diff b/virtual/packages/mantisbt-patches/bugnote_add.php.diff new file mode 100644 index 0000000..4509f0a --- /dev/null +++ b/virtual/packages/mantisbt-patches/bugnote_add.php.diff @@ -0,0 +1,20 @@ +--- a/bugnote_add.php 2018-02-10 21:29:27.000000000 +0100 ++++ b/bugnote_add.php 2018-03-03 15:13:12.439919511 +0100 +@@ -44,6 +44,17 @@ + + $t_query = array( 'issue_id' => $f_bug_id ); + ++# begin captcha check for anon user ++if ( current_user_is_anonymous() && get_gd_version() > 0 ) { ++ $f_captcha = gpc_get_string( 'captcha', '' ); ++ $f_captcha = utf8_strtolower( trim( $f_captcha ) ); ++ ++ $t_securimage = new Securimage(); ++ if( $t_securimage->check( $f_captcha ) == false ) { ++ trigger_error( ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR ); ++ } ++} ++ + if( count( $f_files ) > 0 && is_blank( $f_text ) && helper_duration_to_minutes( $f_duration ) == 0 ) { + $t_payload = array( + 'files' => helper_array_transpose( $f_files ) diff --git a/virtual/packages/mantisbt-patches/bugnote_add_inc.php.diff b/virtual/packages/mantisbt-patches/bugnote_add_inc.php.diff new file mode 100644 index 0000000..a8589c7 --- /dev/null +++ b/virtual/packages/mantisbt-patches/bugnote_add_inc.php.diff @@ -0,0 +1,52 @@ +--- a/bugnote_add_inc.php 2018-02-10 21:29:27.000000000 +0100 ++++ b/bugnote_add_inc.php 2018-03-03 15:14:27.332428557 +0100 +@@ -119,6 +119,49 @@ + + + ++ 0 ) { ++ $t_securimage_path = 'vendor/dapphp/securimage'; ++ $t_securimage_show = $t_securimage_path . '/securimage_show.php'; ++ $t_securimage_play = $t_securimage_path . '/securimage_play.swf?' ++ . http_build_query( array( ++ 'audio_file' => $t_securimage_path . '/securimage_play.php', ++ 'bgColor1=' => '#fff', ++ 'bgColor2=' => '#fff', ++ 'iconColor=' => '#777', ++ 'borderWidth=' => 1, ++ 'borderColor=' => '#000', ++ ) ); ++?> ++ ++ CAPTCHA ++ ++ ++ ++ ++ ++ ++ ++ visual captcha ++
++
++ ++ ++ ++ ++
++ ++ ++ ++ + + $t_changeset ) { ++ event_signal( 'EVENT_BUG_ACTION', array('RESOLVE', $t_bug_id) ); ++ } + } + + /** diff --git a/virtual/packages/mantisbt.nix b/virtual/packages/mantisbt.nix new file mode 100644 index 0000000..f136ea5 --- /dev/null +++ b/virtual/packages/mantisbt.nix @@ -0,0 +1,124 @@ +with import ../../libs.nix; +with nixpkgs_unstable; +let + # FIXME: check that source-integration and slack still work + mantisbt = let + plugins = { + slack = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-slack.json // rec { + installPhase = '' + sed -i -e "s/return '@' . \\\$username;/return \\\$username;/" Slack.php + cp -a . $out + ''; + }); + source-integration = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-source-integration.json // rec { + installPhase = '' + mkdir $out + patch -p1 < ${./mantisbt-plugin-source-integration_Source.API.php.diff} + cp -a Source* $out/ + ''; + }); + }; + in rec { + config = + assert checkEnv "NIXOPS_MANTISBT_DB_PASSWORD"; + assert checkEnv "NIXOPS_MANTISBT_MASTER_SALT"; + assert checkEnv "NIXOPS_MANTISBT_LDAP_PASSWORD"; + pkgs.writeText "config_inc.php" '' + + DirectoryIndex index.php + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + AllowOverride All + Options FollowSymlinks + Require all granted + + + #Reenable during upgrade + Require all denied + + ''; + }; + phpFpm = rec { + basedir = builtins.concatStringsSep ":" ( + [ webRoot config ] + ++ pkgs.lib.attrsets.mapAttrsToList (name: value: value) plugins); + socket = "/var/run/phpfpm/mantisbt.sock"; + pool = '' + listen = ${socket} + user = ${apache.user} + group = ${apache.group} + listen.owner = ${apache.user} + listen.group = ${apache.group} + pm = ondemand + pm.max_children = 60 + pm.process_idle_timeout = 60 + + php_admin_value[upload_max_filesize] = 5000000 + + php_admin_value[open_basedir] = "${basedir}:/tmp" + ''; + }; + }; +in + mantisbt -- cgit v1.2.3