savepic.pl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env perl
  2. #
  3. # This file is part of the LibreOffice project.
  4. #
  5. # This Source Code Form is subject to the terms of the Mozilla Public
  6. # License, v. 2.0. If a copy of the MPL was not distributed with this
  7. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  8. #
  9. # This file incorporates work covered by the following license notice:
  10. #
  11. # Licensed to the Apache Software Foundation (ASF) under one or more
  12. # contributor license agreements. See the NOTICE file distributed
  13. # with this work for additional information regarding copyright
  14. # ownership. The ASF licenses this file to you under the Apache
  15. # License, Version 2.0 (the "License"); you may not use this file
  16. # except in compliance with the License. You may obtain a copy of
  17. # the License at http://www.apache.org/licenses/LICENSE-2.0 .
  18. #
  19. require "common.pl";
  20. %aRequestMap = common::HTTP_getRequest();
  21. # get new picture
  22. $sCurrPic = $aRequestMap{ "CurrPic" };
  23. @aPictureArray = common::File_read( "picture.txt" );
  24. $nPictureArrayLen = @aPictureArray;
  25. # check if + or - was pressed
  26. if( $aRequestMap{ "Auswahl" } eq "+" )
  27. {
  28. $sCurrPic = abs( $sCurrPic ) + 1;
  29. }
  30. if( $aRequestMap{ "Auswahl" } eq "-" )
  31. {
  32. $sCurrPic = abs( $sCurrPic ) - 1;
  33. }
  34. # save picture name
  35. if( (abs( $sCurrPic ) > 0) && ( abs( $sCurrPic ) < ( $nPictureArrayLen ) ) )
  36. {
  37. open( F_CURRPIC, ">currpic.txt");
  38. print F_CURRPIC abs( $sCurrPic );
  39. close( F_CURRPIC );
  40. }
  41. # return to edit page
  42. print "Content-type: text/html\n\n";
  43. print "<HTML>\n<HEAD>\n";
  44. print "<META http-equiv=\"refresh\" CONTENT=\"0 ;URL=editpic.pl\">";
  45. print "<title>savepic.pl</title>";
  46. print "</HEAD>\n";
  47. print "<BODY>\n";
  48. print "</BODY>\n";
  49. print "</HTML>\n";
  50. %>