Skip to content

Instantly share code, notes, and snippets.

@ge0ffray
ge0ffray / gist:64c13183000e0127472b
Last active February 11, 2016 14:08
Drupal admin menu shortcut
<?php
/**
* Implements hook_menu().
*/
function foobar_menu() {
$items['admin/add-image-style'] = array(
'title' => 'Shortcut to add image style',
'page callback' => 'drupal_goto',
'page arguments' => array('/admin/config/media/image-styles/add'),
@ge0ffray
ge0ffray / .htaccess
Last active February 24, 2016 12:42
Hijack PHP easter eggs using .htaccess. This could be an alternative solution when no possibility to disable expose_php in php.ini
RewriteEngine On
RewriteCond %{QUERY_STRING} ^=PHPE9568F3[4-6]-D428-11d2-A769-00AA001ACF42$ [OR]
RewriteCond %{QUERY_STRING} ^=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000$
RewriteRule (.*) - [F]
@ge0ffray
ge0ffray / httpd.conf
Last active August 29, 2015 14:02
Cross version Apache access control
<Directory "/var/web/www/">
# use mod_authz_host since Apache 2.4
<IfDefine APACHE24>
Require local
</IfDefine>
# use mod_access before 2.4
<IfDefine !APACHE24>
Order Deny,Allow
@ge0ffray
ge0ffray / is_base64.php
Last active August 8, 2024 11:02
Check if a string seems to be base64 encoded
<?php
/**
* @param string $str
* @return bool
*/
function is_base64($str)
{
return (bool)preg_match('`^[a-zA-Z0-9+/]+={0,2}$`', $str);
}