Skip to content

Commit

Permalink
captcha cache fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Aug 5, 2017
1 parent de0059e commit 46498d9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
19 changes: 13 additions & 6 deletions upload/admin/controller/upgrade/backup.php
Expand Up @@ -66,13 +66,19 @@ public function calculate() {
$backup = explode(',', $this->request->get['backup']);

if (in_array('file', $backup)) {
$files = $this->getFiles();









$directories[] = DIR_IMAGE . $file;
}





$directories = array();

if (in_array('image', $backup)) {
Expand All @@ -93,9 +99,9 @@ public function calculate() {
$paths = array();
}

if (!$json) {

// Loop through each path
foreach ($paths as $path) {
foreach ($directories as $directory) {
$path = rtrim(DIR_IMAGE . $path, '/');

// If path is just a file delete it
Expand Down Expand Up @@ -139,6 +145,7 @@ public function calculate() {
}
}
}




Expand Down
13 changes: 7 additions & 6 deletions upload/admin/controller/upgrade/upgrade.php
Expand Up @@ -49,9 +49,7 @@ public function index() {

$data['user_token'] = $this->session->data['user_token'];




$data['version'] = VERSION;

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
Expand All @@ -70,16 +68,19 @@ public function version() {
}

if (!$json) {
$curl = curl_init(OPENCART_SERVER . 'index.php?route=marketplace/api/version');

$curl = curl_init('https://api.github.com/repos/opencart/opencart/opencart-master/releases');

curl_setopt($curl, CURLOPT_USERAGENT, 'OpenCart ' . VERSION);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($curl, CURLOPT_POST, 1);

$response = curl_exec($curl);


print_r($response);

curl_close($curl);

$response_info = json_decode($response, true);
Expand Down
8 changes: 6 additions & 2 deletions upload/admin/view/template/upgrade/upgrade.twig
Expand Up @@ -27,7 +27,9 @@
<div class="tab-content">
<div class="tab-pane active" id="tab-preparation">
<fieldset>
<legend>Latest Version</legend>
<legend id="version">Latest Version</legend>
<div class="alert alert-warning">Checking version <button type="button" id="button-version" class="btn btn-warning pull-right"><i class="fa fa-refresh"></i> Refresh</button></div>

<p>Before upgrading its very important to</p>
<ol>
<li>make a complete backup of your web site!</li>
Expand Down Expand Up @@ -134,14 +136,16 @@
$('#button-version').on('click', function() {
$.ajax({
url: 'index.php?route=upgrade/upgrade/version&user_token={{ user_token }}',
dataType: 'json',
dataType: 'html',
beforeSend: function() {
$('#button-version').button('loading');
},
complete: function() {
$('#button-version').button('reset');
},
success: function(json) {
alert(json);
if (json['error']) {
}
Expand Down
2 changes: 2 additions & 0 deletions upload/catalog/controller/extension/captcha/basic.php
Expand Up @@ -48,6 +48,8 @@ public function captcha() {
imagestring($image, 10, intval(($width - (strlen($this->session->data['captcha']) * 9)) / 2), intval(($height - 15) / 2), $this->session->data['captcha'], $black);

header('Content-type: image/jpeg');
header('Cache-Control: no-cache');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');

imagejpeg($image);

Expand Down

0 comments on commit 46498d9

Please sign in to comment.