Bugzilla – Attachment 155987 Details for
Bug 34478
Full CSRF protection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34478: op-cud - Add a script to rename op with op-cud in templates
Bug-34478-op-cud---Add-a-script-to-rename-op-with-.patch (text/plain), 2.07 KB, created by
Jonathan Druart
on 2023-09-21 10:05:33 UTC
(
hide
)
Description:
Bug 34478: op-cud - Add a script to rename op with op-cud in templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-09-21 10:05:33 UTC
Size:
2.07 KB
patch
obsolete
>From e72e22b0addb3250868e689ff28260df752c844e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Sep 2023 10:49:45 +0200 >Subject: [PATCH] Bug 34478: op-cud - Add a script to rename op with op-cud in > templates > >--- > rename_op_with_op-cud.pl | 59 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 59 insertions(+) > create mode 100644 rename_op_with_op-cud.pl > >diff --git a/rename_op_with_op-cud.pl b/rename_op_with_op-cud.pl >new file mode 100644 >index 00000000000..a80b9131ea2 >--- /dev/null >+++ b/rename_op_with_op-cud.pl >@@ -0,0 +1,59 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use File::Find; >+use File::Slurp; >+use Data::Dumper; >+ >+my @themes; >+ >+# OPAC themes >+my $opac_dir = 'koha-tmpl/opac-tmpl'; >+opendir ( my $dh, $opac_dir ) or die "can't opendir $opac_dir: $!"; >+for my $theme ( grep { not /^\.|lib|js|xslt/ } readdir($dh) ) { >+ push @themes, "$opac_dir/$theme/en"; >+} >+close $dh; >+ >+# STAFF themes >+my $staff_dir = 'koha-tmpl/intranet-tmpl'; >+opendir ( $dh, $staff_dir ) or die "can't opendir $staff_dir: $!"; >+for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { >+ push @themes, "$staff_dir/$theme/en"; >+} >+close $dh; >+ >+my @files; >+sub wanted { >+ my $name = $File::Find::name; >+ push @files, $name >+ if $name =~ m[\.(tt|inc)$] and -f $name; >+} >+ >+find({ wanted => \&wanted, no_chdir => 1 }, @themes ); >+ >+rename_op($_) for @files; >+ >+sub rename_op { >+ my ( $file ) = @_; >+ >+ my @lines = read_file($file); >+ my @errors; >+ return unless grep { $_ =~ m|<form| } @lines; >+ my ($in_form, $closed_form, $line_open_form, $has_op); >+ my $line_number = 0; >+ for my $line (@lines) { >+ $line_number++; >+ if ( $line =~ m{^(\s*)<form.*method=('|")post('|")}i ) { >+ $in_form = 1; >+ $line_open_form = $line_number; >+ } >+ if ( $in_form && $line =~ m{name="op"}) { >+ $line =~ s{name="op"}{name="op-cud"}g; >+ } >+ if ( $in_form && $line =~ m{</form} ) { >+ $in_form = 0; >+ } >+ } >+ write_file($file, @lines); >+} >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34478
:
154241
|
154242
|
154243
|
154244
|
154245
|
154246
|
154247
|
154248
|
154249
|
154250
|
154251
|
154252
|
154253
|
154254
|
155971
|
155972
|
155973
|
155974
|
155975
|
155976
|
155977
|
155978
|
155979
|
155980
|
155981
|
155982
|
155983
|
155984
|
155985
|
155986
|
155987
|
155988
|
155989
|
155990
|
156070
|
156071
|
156072
|
156073
|
156074
|
162114
|
162165
|
162630