Skip to content

Instantly share code, notes, and snippets.

View neo22s's full-sized avatar

Chema neo22s

View GitHub Profile
@neo22s
neo22s / controller.php
Created April 18, 2017 18:15
language selector koseven
<?php
/**
* Front end controller for OC app
*
* @package OC
* @category Controller
* @author Chema <[email protected]>
* @copyright (c) 2009-2013 Open Classifieds Team
* @license GPL v3
*/
@neo22s
neo22s / get_spam_score.php
Last active May 24, 2024 20:31
PHPMailer Spamassassin Score
<?
/**
* Example how to use it in PHPMailer
*/
//once initiated PHPMAiler before you can get_spam_socre you need to execute preSend() since is the way to get the RAW email that will be sent.
$mail->preSend();
$spam_score = get_spam_score($mail->getSentMIMEMessage());
if ($spam_score >= 5 OR $spam_score === FALSE)
@neo22s
neo22s / ishttps.php
Created September 2, 2016 18:18
New is_HTTPS_protocol changed today in cloudflares
<?php
/**
* checks if is https by protocol used in nginx
* @return boolean
*/
public static function is_HTTPS_protocol()
{
//we are sure is a https request , we use first the Nginx forwarded PROTO OR apache
if( (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) AND $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
@neo22s
neo22s / ishttps.php
Created September 2, 2016 18:17
is_HTTPS_protocol working until today.
<?php
/**
* checks if is https by protocol used in nginx
* @return boolean
*/
public static function is_HTTPS_protocol()
{
//we are sure is a https request , we use first the Nginx forwarded PROTO OR apache
if( (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) AND $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
@neo22s
neo22s / emailvalidator.php
Created August 15, 2016 14:23
Lumen test email validator
<?
/**
* Class email validator
*
* @author Chema <[email protected]>
* @copyright (c) 2015
* @license GPL v3
*/
namespace App;
@neo22s
neo22s / securepay.php
Created May 17, 2016 11:41
securepay.php
<?
$merchant_id = 'merchant';
$txnpassword = 'pwd';
$order_id = 'order123';
$amount = 5308;//53.2
$currency = 'AUD';
$fp_timestamp = gmdate('YmdHIis');
$fingerprint = $merchant_id.'|'.$txnpassword.'|0|'.$order_id.'|'.$amount.'|'.$fp_timestamp;
@neo22s
neo22s / securenet.php
Created February 20, 2016 14:15
Securenet PHP integration
<?php
/**
* Securenet PHP library
* See docs https://apidocs.securenet.com/docs/
* You need PHP >= 5.5 and CURL installed
*
* @category Payments
* @author Chema <[email protected]>
* @copyright (c) 2009-2016 Open Classifieds Team
* @license GPL v3
@neo22s
neo22s / licensetest.php
Last active November 14, 2016 07:58
test license for open classifieds
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', 1);
$license = 'YOURLICENSEHERE';
$api_url = 'https://selfhosted.yclas.com/api/license/'.$license.'/?domain='.$_SERVER['HTTP_HOST'];
die(var_dump(json_decode(curl_get_contents($api_url))));
@neo22s
neo22s / adaptive.php
Created February 7, 2016 21:36
paypal adaptive payment example to pay directly to an account
<?
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', 1);
use PayPal\Service\AdaptivePaymentsService;
use PayPal\Types\AP\FundingConstraint;
use PayPal\Types\AP\FundingTypeInfo;
use PayPal\Types\AP\FundingTypeList;
use PayPal\Types\AP\PayRequest;
var a = new Array(10);
var b = new Array(10);
var c = new Array(10);
a[0] = "As soon as we fix the flood of resources ";
a[1] = "As soon as we have the tests ";
a[2] = "After we refactor the code ";
a[3] = "When we have the last bug fixed ";
a[4] = "When the installation problem it's solved ";
a[5] = "When we figure out why the process is down ";