Skip to content

Instantly share code, notes, and snippets.

@airways
airways / mod.structure.php
Created February 17, 2013 21:01
Calling {exp:structure:entries} with a parent_id parameter that does not have any children results in all entries from the site tree being returned, instead of nothing, which is what I would expect. This patch fixes this by setting the entry_id parameter to an impossible value.
function entries() {
$parent_id = $this->EE->TMPL->fetch_param('parent_id', false);
if ($parent_id) {
$child_ids = $this->sql->get_child_entries($parent_id);
$fixed_order = $child_ids !== FALSE && count($child_ids > 0) ? implode('|', $child_ids) : false;
if ($fixed_order) {
$this->EE->TMPL->tagparams['fixed_order'] = $fixed_order;
@airways
airways / gist:3080850
Created July 10, 2012 03:48
VS Members Filtering for Playa
./system/expressionengine/third_party/playa/
diff /Volumes/HDD/Installers/CMS/EE/Playa4.3/Playa4/ee2/third_party/playa/ft.playa.php ./system/expressionengine/third_party/playa/ft.playa.php
1152a1153
> array_unshift($authors, array('id' => 'related', 'title' => '— '.lang('related').' —'));
1525a1527,1592
> // Related author?
> // -------------------------------------------
>
> $add_to_sql = array();
> if (($key = array_search('related', $this->settings['authors'])) !== FALSE)
@airways
airways / widget.c
Created May 16, 2012 14:15
Base widget methods for Allegro 5 (source unknown)
#include "widget.h"
//total event controllers
#define MAX_EVENT_CONTROLLERS 10
//event controller
typedef struct EVENT_CONTROLLER
{
@airways
airways / gist:2621942
Created May 6, 2012 12:07
Proposed filter_extensions hook and example
<?php
/////////////////////////////////////////////
// Added hook call to EE_Extensions:
/////////////////////////////////////////////
class EE_Extensions {
...
function __construct()
{
$this->EE =& get_instance();
@airways
airways / gist:2484930
Created April 25, 2012 00:40
ProForm state selection
This is an example for how to display the label selected for a dropdown value
in the notification template. It is a bit verbose in the template code,
so I am planning to add a new option soon which will make extracting the
selected label as easy as getting the selected value.
Screenshots showing how to setup the form and the field to send an email to
the address set as the value for the same dropdown field:
Field settings for a field named "state":
* https://skitch.com/blueapples/8iwir/state-notification-field
@airways
airways / gist:2237779
Created March 29, 2012 14:07
Sample invalid URLs requested by vuln scanning bot
403 Forbidden
/: 11 Time(s)
///recordings/misc/callme_page.php: 1 Time(s)
//admin/index.php: 3 Time(s)
//admin/phpmyadmin/index.php: 3 Time(s)
//admin/pma/index.php: 3 Time(s)
//db/index.php: 3 Time(s)
//dbadmin/index.php: 3 Time(s)
//index.php: 3 Time(s)
//myadmin/index.php: 2 Time(s)
@airways
airways / gist:2069111
Created March 18, 2012 05:19 — forked from neilj/gist:1532562
Sugared DOM: Better Than Templates
var el = ( function () {
var doc = document;
var directProperties = {
'class': 'className',
className: 'className',
defaultValue: 'defaultValue',
'for': 'htmlFor',
html: 'innerHTML',
@airways
airways / ext.https.php
Created March 8, 2012 20:44
Force everything to be over HTTPS
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Note: not tested
class Https_ext {
public $settings = array();
public $description = '';
public $docs_url = '';
public $name = 'HTTPS';
public $settings_exist = 'n';
public $version = '1.0';
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>0374A255-E6D9-4CD7-8FB6-4F7DAE99AFC7</string>
<key>command</key>
<string>read text
@airways
airways / core_mod.php
Created January 9, 2012 18:57
Core tags in Cell CMS
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @package CELL CMS
* @author Isaac Raway (MetaSushi, LLC) <[email protected]>
*
* Copyright (c)2009, 2010, 2011. Isaac Raway and MetaSushi, LLC.
* All rights reserved.
**/