Имеем следующий вкьмод для рекапчи2 PHP: <?xml version="1.0" encoding="UTF-8"?><modification> <id>Google reCaptcha2 for ocStore 1.5.5x</id> <version>1.0</version> <vqmver></vqmver> <author>Dragon [https://opencartforum.com/user/3857-dragon/]</author> <file name="admin/controller/setting/setting.php"> <operation error="log"> <search position="after"><![CDATA[$this->data['text_no'] = $this->language->get('text_no');]]></search> <add><![CDATA[ /* Google Captha */ $this->data['text_enabled'] = $this->language->get('text_enabled'); $this->data['text_disabled'] = $this->language->get('text_disabled'); $this->data['text_google_captcha'] = $this->language->get('text_google_captcha'); $this->data['help_google_captcha'] = $this->language->get('help_google_captcha'); $this->data['entry_google_captcha_public'] = $this->language->get('entry_google_captcha_public'); $this->data['entry_google_captcha_secret'] = $this->language->get('entry_google_captcha_secret'); $this->data['entry_google_captcha_status'] = $this->language->get('entry_google_captcha_status'); /* #Google Captha */ ]]></add> </operation> <operation error="log"> <search position="before"><![CDATA[if (isset($this->request->post['config_sms_copy'])) {]]></search> <add><![CDATA[ /* Google Captha */ if (isset($this->request->post['config_google_captcha_public'])) { $this->data['config_google_captcha_public'] = $this->request->post['config_google_captcha_public']; } else { $this->data['config_google_captcha_public'] = $this->config->get('config_google_captcha_public'); } if (isset($this->request->post['config_google_captcha_secret'])) { $this->data['config_google_captcha_secret'] = $this->request->post['config_google_captcha_secret']; } else { $this->data['config_google_captcha_secret'] = $this->config->get('config_google_captcha_secret'); } if (isset($this->request->post['config_google_captcha_status'])) { $this->data['config_google_captcha_status'] = $this->request->post['config_google_captcha_status']; } else { $this->data['config_google_captcha_status'] = $this->config->get('config_google_captcha_status'); } /* #Google Captha */]]></add> </operation> </file> <file name="admin/language/*/setting/setting.php"> <operation error="log"> <search position="after"><![CDATA[$_['text_seo_pro'] = 'SeoPro';]]></search> <add><![CDATA[$_['text_google_captcha'] = 'Google reCAPTCHA';]]></add> </operation> <operation error="log"> <search position="after"><![CDATA[$_['entry_seo_url_postfix'] = 'Окончание ЧПУ:<span class="help">Например .html<br />(только для SeoPro)</span>';]]></search> <add><![CDATA[$_['entry_google_captcha_public'] = 'Site key'; $_['entry_google_captcha_secret'] = 'Secret key'; $_['entry_google_captcha_status'] = 'Status'; //Help $_['help_google_captcha'] = 'Go to <a href="https://www.google.com/recaptcha/intro/index.html" target="_blank"><u>Google reCAPTCHA page</u></a> and register your website.'; ]]></add> </operation> </file> <file name="admin/view/template/setting/setting.tpl"> <operation error="log"> <search position="before" offset="1"><![CDATA[<div id="tab-sms">]]></search> <add><![CDATA[<h2>Google reCaptcha</h2> <table class="form"> <div class="alert alert-info"><?php echo $help_google_captcha; ?></div> <tr> <td><label for="input-google-captcha-public"><?php echo $entry_google_captcha_public; ?></label></td> <td> <input type="text" name="config_google_captcha_public" value="<?php echo $config_google_captcha_public; ?>" placeholder="<?php echo $entry_google_captcha_public; ?>" id="input-google-captcha-public" class="form-control" /> </td> </tr> <tr> <td><label for="input-google-captcha-secret"><?php echo $entry_google_captcha_secret; ?></label></td> <td> <input type="text" name="config_google_captcha_secret" value="<?php echo $config_google_captcha_secret; ?>" placeholder="<?php echo $entry_google_captcha_secret; ?>" id="input-google-captcha-secret" class="form-control" /> </td> </tr> <tr> <td><label for="input-google-captcha-status"><?php echo $entry_google_captcha_status; ?></label></td> <td> <select name="config_google_captcha_status" id="input-google-captcha-status" class="form-control"> <?php if ($config_google_captcha_status) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?></option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select> </td> </tr> </table>]]></add> </operation> </file> <file name="catalog/controller/product/product.php"> <operation error="log"> <search position="after"> <![CDATA[$this->data['entry_review'] = $this->language->get('entry_review');]]></search> <add><![CDATA[/* Google Captcha */ if ($this->config->get('config_google_captcha_status')) { $this->document->addScript('https://www.google.com/recaptcha/api.js'); $this->data['site_key'] = $this->config->get('config_google_captcha_public'); } else { $this->data['site_key'] = ''; } /* #Google Captcha */]]></add> </operation> <operation error="log"> <search position="replace" offset="2"> <![CDATA[if (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) {]]></search> <add><![CDATA[/* Google Captcha */ if ($this->config->get('config_google_captcha_status') && empty($json['error'])) { if (isset($this->request->post['g-recaptcha-response'])) { $recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('config_google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']); $recaptcha = json_decode($recaptcha, true); if (!$recaptcha['success']) { $json['error'] = $this->language->get('error_captcha'); } } else { $json['error'] = $this->language->get('error_captcha'); } } /* #Google Captcha */]]></add> </operation> </file> <file name="catalog/view/theme/*/template/product/product.tpl"> <operation error="log"> <search position="replace" offset="3"><![CDATA[<b><?php echo $entry_captcha; ?></b><br />]]></search> <add><![CDATA[<?php if ($site_key) { ?> <div class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>"></div> <?php } ?><br>]]></add> </operation> <operation error="log"> <search position="after"><![CDATA[$('#button-review').bind('click', function() {]]></search> <add><![CDATA[var recaptcha = ''; if ($("textarea").is("#g-recaptcha-response")) { recaptcha = '&g-recaptcha-response=' + encodeURIComponent($('textarea[name=\'g-recaptcha-response\']').val()); grecaptcha.reset(); }]]></add> </operation> <operation error="log"> <search position="replace"> <![CDATA[+ '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),]]></search> <add><![CDATA[+ recaptcha,]]></add> </operation> </file> <file name="catalog/controller/information/contact.php"> <operation error="log"> <search position="replace" offset="4"><![CDATA[if (isset($this->request->post['captcha'])) {]]></search> <add><![CDATA[ if ($this->config->get('config_google_captcha_status')) { $this->document->addScript('https://www.google.com/recaptcha/api.js'); $this->data['site_key'] = $this->config->get('config_google_captcha_public'); } else { $this->data['site_key'] = ''; } ]]></add> </operation> <operation error="log"> <search position="replace" offset="2"><![CDATA[if (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha'])) {]]></search> <add><![CDATA[ if ($this->config->get('config_google_captcha_status')) { $recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('config_google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']); $recaptcha = json_decode($recaptcha, true); if (!$recaptcha['success']) { $this->error['captcha'] = $this->language->get('error_captcha'); } } ]]></add> </operation> </file> <file name="catalog/view/theme/*/template/information/contact.tpl"> <operation error="log"> <search position="replace"><![CDATA[<i class="fa fa-pencil"></i> <b><?php echo $entry_captcha; ?></b><br />]]></search> <add><![CDATA[ <?php if ($site_key) { ?> <div class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>"></div> <?php } ?> ]]></add> </operation> <operation error="log"> <search position="replace" offset="3"><![CDATA[<img src="index.php?route=information/contact/captcha" style="vertical-align: middle;" /> ]]></search> <add><![CDATA[]]></add> </operation> </file></modification> --- Добавлено, 23 фев 2018 --- Установлен MegaReviewsv.105 --- Добавлено, 23 фев 2018 --- Вспоминание об капче нашел только в этом файле: PHP: <?phperror_reporting(0);class ControllerModuleMegareviews extends Controller { protected function index($setting) { $this->data = array_merge($this->data, $this->load->language('module/megareviews')); $this->load->model('module/megareviews'); $settings=$this->config->get('settings'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['options'] = $this->model_module_megareviews->getOptions(); $this->data['ays'] = $this->model_module_megareviews->getAys(); if (isset($this->request->get['product_id'])) $this->data['product_id'] = $this->request->get['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => 'r.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $settings['perpage'] ); $css_file = 'megareviews.css'; if(file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/' . $css_file)) { $this->data['path']='catalog/view/theme/' . $this->config->get('config_template'); $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/' . $css_file); $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/magnific-popup.css'); }else { $this->document->addStyle('catalog/view/theme/default/stylesheet/' . $css_file); $this->document->addStyle('catalog/view/theme/default/stylesheet/magnific-popup.css'); $this->data['path']='catalog/view/theme/default'; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/megareviews.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/megareviews.tpl'; } else { $this->template = 'default/template/module/megareviews.tpl'; } $this->document->addStyle('https://fonts.googleapis.com/css?family=Open+Sans'); $this->document->addScript('catalog/view/javascript/megareviews.js'); $this->document->addScript('catalog/view/javascript/jquery.magnific-popup.min.js'); $this->load->model('tool/image'); $rating=$this->data['reviewsinfo']['rating'];$starwidth=20; $this->data['reviewsinfo']['stars']=''; for($i=1;$i<=5;$i++){ if($i<=$rating) $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } if(floor($rating)!=$rating){ $pos=floor($rating)*$starwidth; $width=($rating-floor($rating))*$starwidth; $this->data['reviewsinfo']['stars'].="<div class='mr-star' style='position:absolute;left:".$pos."px;overflow:hidden;width:".$width."px;'><img width='".$starwidth."' height='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; } $this->data['reviews'] = $this->model_module_megareviews->getReviews($data); if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } foreach($this->data['reviews'] as &$review){ $stars=''; $starwidth=15; for($i=1;$i<=5;$i++){ if($i<=$review['rating']) $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } $review['stars']=$stars; $review['options']=$this->model_module_megareviews->getOptionValues($review['review_id']); $review['ays']=$this->model_module_megareviews->getAyValues($review['review_id']); $review['images']=$this->model_module_megareviews->getImages($review['review_id']); foreach($review['images'] as &$im){ $im['small'] = $this->model_tool_image->resize($im['big'], 100, 100); } unset($im); if(isset($votes[$review['review_id']]))$review['vote']=$votes[$review['review_id']]; else $review['vote']=-1; } unset($review); $this->response->setOutput($this->render()); } public function addReview(){ if (($this->request->server['REQUEST_METHOD'] == 'POST') ) { $post=$this->request->post; $this->load->model('setting/setting'); $settings=$this->config->get('settings'); if ($settings['captcha']==1 && (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha']))) { return; } for ($i = 0; $i < count($_FILES['file']['name']); $i++) {//loop to get individual element from the array $target_path = "image/data/mr/"; //Declaring Path for uploaded images if(!is_dir($target_path)) mkdir($target_path); $validextensions = array("jpeg", "jpg", "png"); //Extensions which are allowed $ext = explode('.', basename($_FILES['file']['name'][$i]));//explode file name from dot(.) $file_extension = end($ext); //store extensions in the variable $target_name = rand(1,10000). $ext[0]. "." . $ext[count($ext) - 1];//set the target path with a new name of image $target_path = $target_path.$target_name; $j = $j + 1;//increment the number of uploaded images according to the files in array if (($_FILES["file"]["size"][$i] < 1000000) //Approx. 100kb files can be uploaded. && in_array($file_extension, $validextensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path)) {//if file moved to uploads folder $post['files'][]="data/mr/".$target_name; } else {//if file was not moved. } } } } $post['status']='0'; if($settings['approve']==0)$post['status']='1'; $this->load->model('module/megareviews'); $this->model_module_megareviews->addReview($post); } public function ajaxOptions() { $this->load->model('module/megareviews'); $this->load->model('setting/setting'); $s=$this->config->get('settings'); echo json_encode(Array("options" => $this->model_module_megareviews->getOptions(), "ay" => $this->model_module_megareviews->getAys(), "rating" => $s['rvalues'])); } public function ajaxVote() { $this->load->model('module/megareviews'); $this->load->model('setting/setting'); $data=$_POST; $forever = time()+3600*24*365*10; if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } if(isset($votes[$data['id']])){ if($votes[$data['id']]==$data['vote']){ unset($votes[$data['id']]); $result['status']=0; if($data['vote']==0) $this->model_module_megareviews->downVote($data['id'],-1); else $this->model_module_megareviews->upVote($data['id'],-1); }else{ $result['status']=-1; } }else{ $result['status']=1; $votes[$data['id']]=$data['vote']; if($data['vote']==0) $this->model_module_megareviews->downVote($data['id'],1); else $this->model_module_megareviews->upVote($data['id'],1); } setcookie( 'lastvote', json_encode($votes), $forever); //print_r($_COOKIE); echo json_encode($result); } public function ajaxValidate() { $data=$_POST; $this->load->model('setting/setting'); $settings=$this->config->get('settings'); $this->load->language('module/megareviews'); $f=true; if($settings['recommend']==2 && !isset($data['recommend'])){ $f=false; $error["recommend"]=$this->language->get('text_requirederror'); } if($settings['rating']==2 && $data['rating']<0){ $f=false; $error["rating"]=$this->language->get('text_requirederror'); } if($settings['title']==2 && strlen($data['title'])==0){ $f=false; $error["title"]=$this->language->get('text_requirederror'); } $error["text"]=''; if($settings['text']==2 && strlen($data['text'])==0){ $f=false; $error["text"]=$this->language->get('text_requirederror'); } if(!isset($data['text']) || strlen($data['text'])<$settings['textcount']){ $f=false; $error["text"].=$this->language->get('text_lengtherror'); } if($settings['nickname']==2 && (!isset($data['author']) || strlen($data['author'])==0)){ $f=false; $error["author"]=$this->language->get('text_requirederror'); } if($settings['phone']==2 && (!isset($data['phone']) || strlen($data['phone'])==0)){ $f=false; $error["phone"]=$this->language->get('text_requirederror'); } if($settings['email']==2 && (!isset($data['email']) || strlen($data['email'])==0)){ $f=false; $error["email"]=$this->language->get('text_requirederror'); } if($settings['custom']==2 && (!isset($data['custom']) || strlen($data['custom'])==0)){ $f=false; $error["custom"]=$this->language->get('text_requirederror'); } if ($settings['captcha']==1 && (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $data['captcha']))) { $f=false; $error['captcha'] = $this->language->get('text_errorcaptcha'); } $result["status"] = $f ? '1' : '0'; $result["message"]=$f ? $settings['approve']==1 ? $this->language->get('text_addsuccess0') : $this->language->get('text_addsuccess1') : $this->language->get('text_adderror'); $result["error"]=$error; echo json_encode($result); } public function ajaxgetReviews() { $data=$_POST; $this->data = array_merge($this->data, $this->load->language('module/megareviews')); $this->load->model('module/megareviews'); $settings=$this->config->get('settings'); $this->data['options'] = $this->model_module_megareviews->getOptions(); $this->data['ays'] = $this->model_module_megareviews->getAys(); $this->data['product_id'] = $data['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => $data['sort'], 'order' => $data['order'], 'start' => (int) $data['start'], 'limit' => (int)$data['limit'] ); $css_file = 'megareviews.css'; if(file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/' . $css_file)) { $this->data['path']='catalog/view/theme/' . $this->config->get('config_template'); }else { $this->data['path']='catalog/view/theme/default'; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/megareviews_list.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/megareviews_list.tpl'; } else { $this->template = 'default/template/module/megareviews_list.tpl'; } $this->load->model('tool/image'); $rating=$this->data['reviewsinfo']['rating'];$starwidth=25; $this->data['reviewsinfo']['stars']=''; for($i=1;$i<=5;$i++){ if($i<=$rating) $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } if(floor($rating)!=$rating){ $pos=floor($rating)*$starwidth; $width=($rating-floor($rating))*$starwidth; $this->data['reviewsinfo']['stars'].="<div class='mr-star' style='position:absolute;left:".$pos."px;overflow:hidden;width:".$width."px;'><img width='".$starwidth."' height='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; } $this->data['reviews'] = $this->model_module_megareviews->getReviews($data); if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } foreach($this->data['reviews'] as &$review){ $stars=''; $starwidth=15; for($i=1;$i<=5;$i++){ if($i<=$review['rating']) $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } $review['stars']=$stars; $review['options']=$this->model_module_megareviews->getOptionValues($review['review_id']); $review['ays']=$this->model_module_megareviews->getAyValues($review['review_id']); $review['images']=$this->model_module_megareviews->getImages($review['review_id']); foreach($review['images'] as &$im){ $im['small'] = $this->model_tool_image->resize($im['big'], 100, 100); } unset($im); if(isset($votes[$review['review_id']]))$review['vote']=$votes[$review['review_id']]; else $review['vote']=-1; } unset($review); print_r($this->render()); }}?>