Validating SSL Seal in the Browser in Magento with http:// references - magento

So, one of my developers used a function like this to make a custom navigation for a Magento eCommerce site:
<li><a class="about" href="<?php echo $this->getUrl() ?>"><?php echo $this->__('about') ?></a></li>
The only problem is it's outputting like:
<li>about</li>
From what I understand, SSL seals break in the browser if there are both http:// and https:// references.
I'm trying to look for a quick fix to remedy this and would be thrilled if someone has a better way to do this than what's been done.
Cheers!
Revised:
Thanks guys,
I think I've narrowed it down to an extenstion that was installed called, Jirafe.
The output code is:
<noscript><p><img src="http://data.jirafe.com//piwik.php?idsite=#####" style="border:0" alt="" /></p></noscript>
The php file that I think generates the script is:
class Fooman_Jirafe_Model_JirafeTracker extends Piwik_PiwikTracker
{
protected function sendRequest($url)
{
$client = new Zend_Http_Client($url);
$response = $client->request();
//check server response
if ($client->getLastResponse()->isError()) {
throw new Exception($response->getStatus() .' '. $response->getMessage());
}
return $response;
}
}
How would I request the image via SSL?
Thanks in advance!

You can use
$this->getUrl('', array('_secure' => true));
or
$this->getUrl('', array('_forced_secure' => true));
to make Magento use the configured web/secure/base_url.

I don't believe there is a problem with having non-ssl links on a secure web-page, after all you might wish to link to another website that doesn't support ssl traffic. I think perhaps you can confusing this with including non-secure resources on a page. So in your example I don't believe the anchor link is a problem, but if it was an img tag with a src attribute, then it would cause issues, since you are telling the browser to request an insecure link on a secure page.

Related

Recaptcha api gives internal server error [duplicate]

I'm using the new Google reCaptcha API for a contact form inside a page on my wordpress instance, but the API returns a 500 Internal Server Error message when using the script given by Google.
So, I'm using this code to make it work
$siteKey = "sitekey";
$secret = "secretkey";
$lang = "it";
$resp = null;
$error = null;
$reCaptcha = new ReCaptcha($secret);
if ($_POST["g-recaptcha-response"]) {
$resp = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
and, on the HTML:
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="<?php echo siteKey; ?>"></div>
But, when i open that page, the only thing I see is this:
An error occurred:
An internal error occurred: 50C0C9A3E5F28.AB460A3.4C003672
By the way, on Google Chrome console i can click on the URL generated by the API's script, and, when I open it, I see a blank page with the reCaptcha I needed.
Could it be a conflict between Google reCaptcha API and Wordpress or is it just an API's error?
you got this error because you didn't put in your domain into Key Settings in recaptcha admin site or basically wrong domain.
I've solved the problem, but the funny thing is that I don't know how, I've just re-copied the code from Google Documentation, maybe there was a mistyping.
Anyway, problem solved.

Preview Laravel Mail before sending

I want to edit my mail and change everything, if I want, as shown here.
Ive imported my file and created a test route to view the page:
use Illuminate\Mail\Markdown;
Route::get('/mail/html', function () {
$markdown = new Markdown(view(), config('mail.markdown'));
return $markdown->render('vendor.mail.html.message'); // or ..markdown.message
});
However, Im having variable errors for #slot. How to view my change/see what the mail looks like before sending? Another package for that?
Thanks
To preview your email in browser please add below code to route
Route::get('preview-notification', function () {
$markdown = new \Illuminate\Mail\Markdown(view(), config('mail.markdown'));
$data = "Your data to be use in blade file";
return $markdown->render("path-of-your-templete-blade-file", $data]);
});
and you will be access your templete using
http://your-application-url/preview-notification
This is the recommended way by the Laravel community
kunal has a nice quick solution and that's how I used to do it. But now I use mailtrap.io to test emails because it allows you to replicate the whole process of sending an email.
Create a (free) account with mailtrap.io.
Add your mailtrap username and password in .env file.
By the way, Laravel is already configured to use mailtrap by default, so it is their recommended way to test emails.
Watch how Jeffrey Ways does it in his lesson:
Laravel 5.4 From Scratch: Sending Email
https://laracasts.com/series/laravel-from-scratch-2017/episodes/26
If you want to test in locally. You can put echo command in blade file at end and put die; this way you can test.Suppose you have test-email.blade.php
test-email.blade.php // file name
This is tets mail
<?php echo "test"; die; ?>
Hope it helps!

Any wordpress plugin image captcha with shortcode

I am trying to use a Image Captcha plugin on my website.
Currently I am using google reCaptcha plugin with V2.
But I need a captcha with Image (like Flexible Captcha), I tried using it, but Image dosen't load for this plugin.
I searched for many, but I want it with short code, so that I can place it on my custom forms.
Or If anyone knows how to remove image issue with "Flexible Captcha" plugin, please post your solution.
Edit:
I also tried to use the Securimage-WP plugin as suggested by drew010. Following is the output of plugin:
On Admin settings for plugin:
On Login page:
Note:
My website URL is like http:abc.com/myWebFolder/
Is this thing breaks the plugin to work or it could be the theme issue.
Thanks
My plugin Securimage-WP offers a shortcode for putting a captcha on a custom form.
The plugin also defines a function which you can then call to validate the submitted CAPTCHA.
I have posted a gist here which shows a WordPress page that uses the shortcode on a form and then validates the form and CAPTCHA. Note: Since this page uses PHP, you will need a plugin (I use Exec-PHP) that allows you to run PHP code in posts and pages.
If you need to validate the CAPTCHA in a form processor that is independent of WordPress, you can hook into WP and the plugin by including wp-load.php from the root of your WordPress install.
Comment if you have any questions. Hope this helps!
thank you drew010 for your help, I made complete new installation of wordpress & used your plugin & it worked, then I also used Flexible Captcha plugin & that also worked. Then in order to debug the real problem I add my custom plugin code in new Wordpress. Then it braked. Therefore, to debug more I added each method in my plugin & tested it worked with method. The culprit was following code:
/**/
?>
<?php
function displayLoginForm() {
/*
ob_start();
get_template_part( 'signin-form' );
$ret = ob_get_contents();
ob_end_clean();
return $ret; */
ob_start();
include(ABSPATH . "wp-content/plugins/tus-forms/Views/sign-in.php");
$output = signin_get_clean();
return $output;
}
?>
Changing above into following solved my problem:
function displayLoginForm() {
/*
ob_start();
get_template_part( 'signin-form' );
$ret = ob_get_contents();
ob_end_clean();
return $ret; */
ob_start();
include(ABSPATH . "wp-content/plugins/tus-forms/Views/sign-in.php");
$output = signin_get_clean();
return $output;
}
?>
But I still don't know the real reason behind this issue?
but finally it worked.
Thanks
Captcha On Login This plugin is more flexible with image and its having another feature include of blocking ip and removing ip from blocked. I am using this plugin it is really good.
enter image description here

Magento Redirect from Observer

I am having trouble to create a working redirect in Magento from an observer.Apart from that I need to understand why the exception just like we do in controller does not work in Observer.
The typical exception done in controller is like below (adminhtml controller)
$message = $this->__('Exception Message.');
Mage::getSingleton('adminhtml/session')->addError($message);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
Somewhere in the blog I read about the below method to redirect from observer.
Mage::getSingleton('core/session')->addError('Exception Message.');
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
Mage::app()->getResponse()->sendResponse();
exit;
I don't understand the basic redirection difference when doing with an observer and controller.
Why controller redirection does not work when used in observer.
Please help me out and explain.
Thanks a lot in advance.
See below link and i also have posted code
it might help you.
Source : http://aaronbonner.io/post/418012530/redirects-in-magento-controllers
Redirects in Magento Controllers
In Zend Framework controllers, to output something other than html you will want to disable ViewHelper defaults along with some of the other magic ZF typically weaves.
In Magento, the same thing applies when doing a controller redirect.
I noticed on PHP 5.2 a redirect seemed to be ignored whereas my Macports 5.3 setup it worked. Turns out I was missing a trick, and so a proper redirect in Magento is done as follows:
In MyPackage/MyModule/controllers/MyController.php :
$this->_redirectUrl($this->getUrl('http://www.someurl.com/someresource'));
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return $this;
Without the setFlag call, your redirect will be ignored. The return call stops any further code execution and sees your redirect get actioned.

Can you retrieve your Skype status using JSONP?

Does anyone know of a URL to get your Skype status using JSONP?
I've only found an XML status URL so far (http://mystatus.skype.com/username.xml).
(I'm trying to query Skype using AJAX. Yes, I could use a server-side proxy script to beat the cross-domain limits, but a direct call would be awesome.)
Simon.
Well apparently you can get a text-only version of the status by changing the extension to .txt:
http://mystatus.skype.com/username.txt
It will return "Online" or "Offline". About the Cross-domain AJAX, you can only do it via server and direct call is definitely not allowed.
You might change the headline to 'JSONP' instead of JSON. That's what you want.
JSONP hijacks cross domain fetches like this to work, without server proxies, by carrying the data in fetches. It's like the most hackish useful technology I come to mind, right now. :)
I nagged Skype about this - the easiest way out would be for their servers to have an official, documented JSONP interface. I hope they'll do that.
In the mean time, this is how I got the problem solved:
Placed this PHP script on my server, alongside the usual HTML: http://benalman.com/projects/php-simple-proxy/
Edited the configuration of it like so:
$enable_native = true;
$valid_url_regex = '/^http:\/\/mystatus\.skype\.com\/myuserid.*/';
This allows it to fetch (via curl running on the server) the mystatus.skype.com/myuserid.num (or .txt) information.
Fetching from JS with URL:
ba-simple-proxy.php?url=http%3A%2F%2Fmystatus.skype.com%2Fmyuserid.num&mode=native&full_status=1
That's it. Pheeew... :)
Also you can retrieve it using PHP
function getSkypeStatus($username) {
$data = file_get_contents('http://mystatus.skype.com/' . urlencode($username) . '.xml');
return strpos($data, '<presence xml:lang="en">Offline</presence>') ? 'Offline' : 'Online';
}
OR
function getSkypeStatus($username) {
$data = file_get_contents('http://mystatus.skype.com/' . urlencode($username) . '.xml');
preg_match('#<presence xml:lang="en">(.*?)</presence>#i', $data, $match);
return isset($match[1]) ? $match[1] : 'Error retrieving status';
}
Cheers!
Thanks to Bradgrafelman from - http://www.phpbuilder.com/board/showthread.php?t=10361050

Resources