Skip to content

Instantly share code, notes, and snippets.

View putzflorian's full-sized avatar

Florian Putz putzflorian

  • @elements-at
  • Salzburg
  • 02:15 (UTC +02:00)
View GitHub Profile
@putzflorian
putzflorian / HTTP Check Pimcore.php
Last active December 15, 2015 23:59
Website_Controller_Action::init(); Man kann nun also ein Property (https) am Dokument vergeben, ist dieses gesetzt, so ist dieses Dokument per HTTPS erreichbar, ansonsten nicht. Damit ist das Ganze um einiges flexibler und man muss auch nicht immer manuell die .htaccess bzw. apache-config ändern.
// HTTPS Check
if($this->getRequest()->isSecure()) {
if(!$this->document || !$this->document->getProperty("https")) {
$this->_redirect("http://" . $_SERVER["HTTP_HOST"] . $this->getRequest()->getRequestUri());
}
}
@putzflorian
putzflorian / Retina.php
Created April 9, 2013 08:14
Ein kleiner Helper für das einfügen von Retina Images. Bei den Thumbnails ein weiteres Thumbnail anlegen wo am Ende "_2x" angehängt wird. z.b. Das normale Thumbnail hat den Namen "teaserImage" lautet der Name vom Retina Image "teaserImage_2x".
public static function getRetinaImage($image, $thumbnail){
if($image instanceof Document_Tag_Image){
$myfile = $image->image;
} else if($image instanceof Asset_Image){
$myfile = $image;
} else {
return false;
exit;
}
$end = explode('.', $myfile->getFilename());
@putzflorian
putzflorian / Language Detection.sh
Created April 9, 2013 10:58
Detect Language in Apache Config
RewriteCond %{HTTP:Accept-Language} ^en.*$ [NC]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{QUERY_STRING} !(^q\=) [NC]
RewriteRule ^(.*)$ /en [L,R=302]
@putzflorian
putzflorian / linux comand.sh
Created April 9, 2013 11:21
some Linux commands
rsync -avz /www user@ip:/www
Ein tar.gz-Archiv erstellen:
tar cfvz test.tar.gz
Die Datei test.tar.gz (mit gzip komprimiert) entpacken
tar xfvz test.tar.gz
Zunächst der Shell-Kommandoaufruf für das Backup einer Datenbank
mysqldump -u username -p database_name > backup_file.sql
@putzflorian
putzflorian / nur eine ip ausgeben.php
Last active December 16, 2015 00:09
Ausgabe für nur eine IP
<?php if($_SERVER['REMOTE_ADDR'] == 'xx.xx.xx.xx'){ ?>
<?php if($_SERVER["HTTP_X_FORWARDED_FOR"]== 'xx.xx.xx.xx'){ ?>
<?php if(Pimcore_Tool::getClientIp() == 'xx.xx.xx.xx'){ ?>
@putzflorian
putzflorian / Datepicker.js
Last active December 16, 2015 01:29
Embed the jquery ui datepicker
var monthnames = [];
var daynames = [];
var dateFormat = 'dd.mm.yy';
var nextprev = [];
switch(lang) {
case "de":
monthnames = ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'];
daynames = ['So','Mo','Di','Mi','Do','Fr','Sa'];
@putzflorian
putzflorian / postfix_config.sh
Created April 11, 2013 19:36
Postfix on a null client A null client is a machine that can only send mail. It receives no mail from the network, and it does not deliver any mail locally. A null client typically uses POP, IMAP or NFS for mailbox access. In this example we assume that the Internet domain name is "example.com" and that the machine is named "hostname.example.com…
myhostname = hostname.example.com
myorigin = $mydomain
relayhost = $mydomain
inet_interfaces = loopback-only
mydestination =
<?php
class Website_Controller_Action extends Pimcore_Controller_Action_Frontend {
public function init () {
if($this->_getParam("language") && Zend_Locale::isLocale($this->_getParam("language"))) {
$locale = new Zend_Locale($this->_getParam("language"));
Zend_Registry::set("Zend_Locale", $locale);
}
@putzflorian
putzflorian / Formularcontroller.php
Last active December 16, 2015 03:49
Formularversand
<?php
$mandatoryFields = array(
'firstname' => $this->_getParam('firstname'),
'lastname' => $this->_getParam('lastname'),
'street' => $this->_getParam('street'),
'zip' => $this->_getParam('zip'),
'city' => $this->_getParam('city'),
'land' => $this->_getParam('land'),
'email' => $this->_getParam('email')
);
@putzflorian
putzflorian / Helper.php
Last active April 3, 2024 13:45
Website_Tool_Helper
<?php
class Website_Tool_Helper
{
public static function getImageTitle($image, $language)
{
$key = 'bild_title_' . $language;