File indexing completed on 2024-12-29 05:24:37

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 ?>
0023 <!DOCTYPE html>
0024 <html>
0025 <head>
0026     <title>Download</title>
0027 </head>
0028 <body>
0029     <main id="ads-page">   
0030         <center>
0031             <div style="height: 200px; width: 400px">            
0032                 <?php
0033                 ## reCAPTCHA V3 key define ##
0034                 #client-side
0035                 define('RECAPTCHA_SITE_KEY',  Zend_Registry::get('config')->recaptcha->sitekey); // define here reCAPTCHA_site_key
0036                 #server-side
0037                 define('RECAPTCHA_SECRET_KEY',Zend_Registry::get('config')->recaptcha->secretkey); // define here reCAPTCHA_secret_key
0038 
0039                 class Captcha{
0040                     public function getCaptcha($SecretKey){
0041                         $Resposta=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".RECAPTCHA_SECRET_KEY."&response={$SecretKey}");
0042                         $Retorno=json_decode($Resposta);
0043                         return $Retorno;
0044                     }
0045                 }
0046 
0047                 if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
0048 
0049                  //echo "<pre>"; print_r($_REQUEST); echo "</pre>";
0050 
0051                  $ObjCaptcha = new Captcha();
0052                  $Retorno = $ObjCaptcha->getCaptcha($_POST['g-recaptcha-response']); 
0053 
0054                  //echo "<pre>"; print_r($Retorno); echo "</pre>";
0055 
0056                  if($Retorno->success){
0057                   //echo '<p style="color: #0a860a;">CAPTCHA was completed successfully!</p>';
0058                   
0059                   if($this->link_type == 'download') {
0060                     echo 'If your download did not start please click <a href="'.$this->url.'">here</a>.';
0061                   } else {
0062                       echo 'If your installation did not start please click <a href="'.$this->url.'">here</a>.';
0063                   }
0064                   
0065                   echo '<script>document.location.href = "'.$this->url.'";</script>';
0066                   
0067                  //}else{   
0068                  // echo '<p style="color: #f80808;">reCAPTCHA error: Check to make sure your keys match the registered domain and are in the correct locations.<br> You may also want to doublecheck your code for typos or syntax errors.</p>';
0069                  }
0070                 } else {
0071                 ?>
0072 
0073                 <div class="">
0074                     <div class="" style="margin-top:0px;margin-bottom:15px;">
0075                         <div class="" style="width:50%">   
0076                    <form id="Form1" name="Form1" action="" method="POST">
0077                     <input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response"><br>
0078                     <?php if($this->link_type == 'download') { ?>
0079                     <input type="submit" value="Start Download">
0080                     <?php } else { ?>
0081                     <input type="submit" value="Start Installation">
0082                     <?php } ?>
0083                    </form>   
0084                   </div>  
0085                  </div>
0086                 </div>
0087 
0088                 <script src="https://www.google.com/recaptcha/api.js?render=<?php echo RECAPTCHA_SITE_KEY; ?>"></script>
0089                 <script>
0090                  grecaptcha.ready(function() {
0091                  grecaptcha.execute('<?php echo RECAPTCHA_SITE_KEY; ?>', {action: 'homepage'}).then(function(token) {  
0092                   document.getElementById('g-recaptcha-response').value=token;
0093                  });
0094                 });
0095                 </script>        
0096                 <?php
0097                 }
0098                 ?>
0099                         
0100             </div>
0101         </center>        
0102     </main>
0103 
0104 </body>
0105 </html>
0106 
0107 
0108