This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if request.method == 'GET': | |
# new callback functions | |
if 'format' in request.GET: | |
if request.GET['format'] == 'json': | |
json_serializer = serializers.get_serializer("json")() | |
if 'function' in request.GET: | |
if request.GET['function'] == 'get_all_entries': | |
allEntries = Entry.objects.all().order_by('-published') | |
return HttpResponse(json_serializer.serialize(allEntries, ensure_ascii=False)) | |
elif request.GET['function'] == 'get_latest_entry': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def manage(request): | |
if request.method == 'POST': | |
if ('submit' in request.POST) and ('format' in request.POST): | |
if request.POST['format'] == 'json': | |
if 'new_entry' in request.POST: | |
# gives us a json: { "text" : "Dies ist eine Meldung", "isPublic" : 1 } | |
# entry_text = | |
# entry_isPublic = | |
# entry_published = datetime.now() | |
# -> save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new_entry(request): | |
format = "json" | |
if ('format' in request.POST): | |
format = request.POST['format'] | |
if ('submit' in request.POST): | |
# gives us a json: { "text" : "Dies ist eine Meldung", "isPublic" : 1 } | |
# entry_text = | |
# entry_isPublic = | |
# entry_published = datetime.now() | |
# -> save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@login_required(redirect_field_name='redirect') | |
def manage(request): | |
if (request.method == 'POST'): | |
format = 'json' | |
if ('format' in request.POST): | |
format = request.POST['format'] | |
if ('submit' in request.POST) and (format == 'json'): | |
if ('new_entry' in request.POST): | |
# format: { "text" : "text body", "isPublic" : 0|1 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submitNewEntry() { | |
var text = $('.new-entry').val(); | |
if (text == 'Neuen Eintrag schreiben...') | |
return false; | |
if ( $('.is-public:checkbox:checked').val() == 'on' ) | |
var isPublic = parseInt(1); | |
else | |
var isPublic = parseInt(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class BrowserDetectionMiddleware(object): | |
""" | |
Middleware to detect a wap, mobile html or full compatible browser | |
""" | |
def process_request(self, request): | |
browser_type = None | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('content-type: text/html; charset=utf-8'); | |
$path = ''; | |
require_once($path . '/app/Mage.php'); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
$websiteId = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOSTNAMES=`mktemp -p /tmp/` | |
grep -h "ServerName" /etc/apache2/sites-enabled/*|uniq|cut -d " " -f3 > $HOSTNAMES | |
dig -f $HOSTNAMES A +noall +answer | |
rm $HOSTNAMES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('default_charset', 'UTF-8'); | |
$debug = 1; | |
$mode = NULL; | |
function fetchsite($url = NULL, $matrikel = NULL, $password = NULL) { | |
global $debug, $mode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('default_charset', 'UTF-8'); | |
$debug = 1; | |
$mode = NULL; | |
function fetchsite($url = NULL, $matrikel = NULL, $password = NULL) { | |
global $debug, $mode; |
OlderNewer