Skip to content

Instantly share code, notes, and snippets.

View rande's full-sized avatar
🖖
hello!

Thomas rande

🖖
hello!
View GitHub Profile
<?php
class myModelForm extends BaseModelForm
{
public function saveEmbeddedForms($con = null, $forms = null)
{
// nop, don't trust this
}
public function processUploadedFile($field, $filename = null, $values = null)
@rande
rande / gist:509720
Created August 5, 2010 13:19
Create cache from a files containing url (multi-threaded python script)
import threading, time, urllib
import fileinput, io
class UrlDownloadThread ( threading.Thread ):
def __init__(self, url):
self.url = url
threading.Thread.__init__(self)
def run(self):
@rande
rande / gist:443693
Created June 18, 2010 14:26
automatically redirect a user when a csrf token is detected
$this->dispatcher->connect('form.validation_error', function(sfEvent $event) {
$form = $event->getSubject();
$error = $event['error'];
if(!$form->isCSRFProtected())
{
return;
}
$field_name = sfForm::getCSRFFieldName();
static protected $zendLoaded = false;
public function registerZend()
{
if (!self::$zendLoaded)
{
return;
}