For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
<?php | |
namespace Application\ProdrepHelperBundle\Component\Event; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Security\Core\Exception\AuthenticationException; | |
use Symfony\Component\Security\Core\Exception\AccessDeniedException; | |
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | |
/** | |
*/ | |
class AjaxAuthenticationListener |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
stashgrep() { | |
for i in `git stash list | awk -F ':' '{print $1}'`; do | |
git stash show -p $i | grep -H --label="$i" "$1" | |
done | |
} |
<?php | |
use Doctrine\ORM\Persisters; | |
class DoctrineHelper | |
{ | |
protected $entityManagers = array(); | |
public function bulkCommit(EntityManager $em, array $entities) | |
{ |
<?php | |
function get_web_page( $url ){ | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, // return web page | |
CURLOPT_HEADER => false, // don't return headers | |
CURLOPT_FOLLOWLOCATION => true, // follow redirects | |
CURLOPT_ENCODING => "", // handle all encodings | |
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", // who am i | |
CURLOPT_AUTOREFERER => true, // set referer on redirect |
<?php | |
namespace Acme\DemoBundle\Presenter; | |
class BasePresenter | |
{ | |
protected $subject; | |
public function __construct($subject) | |
{ |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
<?php | |
namespace Acme\DBAL\Platforms; | |
use Doctrine\DBAL\Platforms\PostgreSqlPlatform as DoctrinePostgreSqlPlatform; | |
class PostgreSqlPlatform extends DoctrinePostgreSqlPlatform | |
{ | |
public function getTruncateTableSQL($tableName, $cascade = false) | |
{ |