Skip to content

Instantly share code, notes, and snippets.

@Webklex
Webklex / typo3_readdir_err_fix
Created June 12, 2013 08:44
Typo3 - PHP Warning: readdir() Fehler [class.t3lib_div.php]
2823//Core: Error handler (BE): PHP Warning: readdir() expects parameter 1 to be resource, boolean given in typo3_src-4.7.10/t3lib/class.t3lib_div.php line 2828
2824 //ADDED 12.06.2013 - to erase error
2826
2827 if($handle !== false){
2828 while (($file = readdir($handle)) !== FALSE) {
2829 $recursionResult = NULL;
2830 if ($file !== '.' && $file !== '..') {
2831 if (@is_file($path . '/' . $file)) {
2832 $recursionResult = self::fixPermissions($path . '/' . $file);
2833 } elseif (@is_dir($path . '/' . $file)) {
@Webklex
Webklex / excelfunktionsliste.txt
Created June 12, 2013 13:46
EXCEL - Funktionsliste
Datumszwischenraum: =DATEDIF(F1;F2;"d") [Parameter: d,m,Y]
UNIX Zeit umrechnen: =DATUM(1970;1;1)+(LINKS(F1;10)/86400)
@Webklex
Webklex / sql-groupcommands
Created June 13, 2013 12:54
SQL - Groupcommands
FROM_UNIXTIME(timestamp,'%d.%m.%Y') #Gibt ein schön formatiertes Datum aus
#Build an automated CURENT_TIMESTAMP to UNIX-DATE converter by using a TRIGGER
CONVERT CURENT_TIMESTAMP TO UNIX-DATE SET NEW.date = UNIX_TIMESTAMP(NOW())
@Webklex
Webklex / img_header
Created June 14, 2013 07:15
Bilder als Content behandeln - Einbindung als IMG und gleichzeitige Ausführung eines Scripts somit möglich.
// Test image.
$fn = 'gfx/check_mail.gif';
// Image not cached or cache outdated, we respond '200 OK' and output the image.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($fn)).' GMT', true, 200);
header('Content-Length: '.filesize($fn));
header('Content-Type: image/gif');
readfile($fn);
@Webklex
Webklex / php_mysql_pw.php
Created June 25, 2013 13:10
PHP Equivalent für MySQL PASSWORD() Funktion
function mysql_41_password($in){
$p = sha1($in,true);
$p = sha1($p);
return "*".strtoupper($p);
}
@Webklex
Webklex / time_between.php
Created July 24, 2013 09:22
Zeit zwischen zwei Daten
<?php
$now = time(); // or your date as well
$your_date = strtotime("2010-01-01");
$datediff = $now - $your_date;
echo floor($datediff/(60*60*24));
?>
@Webklex
Webklex / cronjob_alternative.php
Created July 29, 2013 14:38
PHP Cronjobalternative
ignore_user_abort(1); // run script in background
set_time_limit(0); // run script forever
$interval=60*15; // do every 15 minutes...
do{
// add the script that has to be ran every 15 minutes here
// ...
sleep($interval); // wait 15 minutes
}while(true);
@Webklex
Webklex / sepa_classes.txt
Created August 28, 2013 13:08
Sammlung von relevanten / interessanten SEPA Klassen basierend auf XML
https://github.com/BureauPartners/SEPA-Incasso
https://github.com/digitick/php-sepa-xml
https://github.com/blaaat/php-sepa-credit-transfer
https://github.com/dmitrirussu/php-sepa-xml-generator
https://github.com/congressus/sepa-direct-debit
https://github.com/Celp-nl/sepa-dd-xml
@Webklex
Webklex / force_print.html
Created September 5, 2013 06:49
Seitendruck erzwingen - geeignet für Online-Druck Aktionen. Basiert auf: JavaScript
<script type="text/javascript">
try {
this.print();
}
catch(e) {
window.onload = window.print;
}
</script>
@Webklex
Webklex / add_foreign_key.sql
Created September 5, 2013 11:07
Fremdschlüssel eintragen
ALTER TABLE my_table ADD CONSTRAINT my_key FOREIGN KEY ('some_id')
REFERENCES some_new_table ('some_other_id') ON UPDATE CASCADE ON DELETE CASCADE
#Die entsprechenden Spalten müssen exakt gleich sein. Zudem muss auf den entsprechenden
#Spalten ein Index initialisiert werden. Desweiteren muss es sich bei den
#Tabellen Engines um InnoDB handeln.
#http://stackoverflow.com/questions/11073706/how-to-alter-a-mysql-tables-foreign-key-using-the-command-line
#http://stackoverflow.com/questions/4061293/mysql-cant-create-table-errno-150