Skip to content

Instantly share code, notes, and snippets.

Avatar

Rene Kreijveld renekreijveld

View GitHub Profile
@renekreijveld
renekreijveld / clidemo_2.5.php
Last active Aug 29, 2015
Example CLI script for Joomla 2.5
View clidemo_2.5.php
<?php
/**
* @package Joomla.Cli
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* Joomla 2.5 example CLI script
* Written by: Rene Kreijveld, email [at] renekreijveld.nl
* 05-feb-2014
@renekreijveld
renekreijveld / clidemo_1.5.php
Last active Aug 29, 2015
Example CLI script for Joomla 1.5
View clidemo_1.5.php
<?php
// Joomla 1.5 example CLI script
// Written by: Rene Kreijveld, email [at] renekreijveld.nl
// 05-feb-2014
// Set flag that this is a parent file
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', dirname(__DIR__));
@renekreijveld
renekreijveld / createthumbs
Last active Aug 29, 2015
Create smaller image and thumbnail from file upload field in RSForm!Pro
View createthumbs
function resizeImage($CurWidth,$CurHeight,$MaxSize,$DestFolder,$SrcImage,$Quality,$ImageType){
if($CurWidth <= 0 || $CurHeight <= 0){
return false;
}
$ImageScale = min($MaxSize/$CurWidth, $MaxSize/$CurHeight);
$NewWidth = ceil($ImageScale*$CurWidth);
$NewHeight = ceil($ImageScale*$CurHeight);
$NewCanves = imagecreatetruecolor($NewWidth, $NewHeight);
if(imagecopyresampled($NewCanves, $SrcImage,0, 0, 0, 0, $NewWidth, $NewHeight, $CurWidth, $CurHeight)){
switch(strtolower($ImageType)){
@renekreijveld
renekreijveld / geocide.php
Created May 23, 2014
A simple function/script for geocoding Address using Google Maps API.
View geocide.php
<?php
/* A simple function/script for geocoding Address using Google Maps API.
* Please check Google Maps API FAQ & Terms for more info.
*
* @author Abdullah Rubiyath
*/
/**
* Returns a Lat and Lng from an Address using Google Geocoder API. It does not
@renekreijveld
renekreijveld / sitesbackup
Last active Aug 29, 2015
Find Joomla instances and backup them
View sitesbackup
#!/bin/sh
# sitesbackup -- Find Joomla instances and backup them
# Supports all Joomla versions
# Requires jbackupstore script
#
# Backups older than 5 days are automatically cleaned
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
@renekreijveld
renekreijveld / timestamp.cmd
Last active Aug 29, 2015
Create a date-time stamp in Windows batch file
View timestamp.cmd
@echo off
for /f "tokens=1-8 delims=.:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
for /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
set dow=%%i
set mm=%%j
set dd=%%k
set yy=%%l
set hh=%%m
set min=%%n
@renekreijveld
renekreijveld / jinfo.cmd
Created Oct 15, 2014
Gather info about a Joomla 2.5+ installation for Windows
View jinfo.cmd
@ECHO OFF
REM Sitenaam ophalen
FOR /F "tokens=4" %%G IN ('FINDSTR /C:"$sitename =" configuration.php') DO (
FOR /F "tokens=1 delims='" %%A IN ('echo %%G') DO (
SET jsitename=%%A
)
)
REM Host ophalen
@renekreijveld
renekreijveld / joomlainfo.cmd
Created Oct 15, 2014
Display Joomla 2.5+ website info for Windows
View joomlainfo.cmd
@ECHO OFF
REM Joomla info ophalen
call "jinfo.cmd" > nul
REM Output data
ECHO Sitename = %jsitename%
ECHO Host = %jhost%
ECHO Database = %jdb%
ECHO User = %juser%
@renekreijveld
renekreijveld / jdbsession
Created Oct 17, 2014
Repair the session table of a Joomla database table.
View jdbsession
#!/bin/sh
# jdbsession -- Repair the session table of a Joomla database table.
#
# This scripts supports Joomla versions 1.0 - 3.3
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
# This program is free software; you may redistribute it and/or modify it.
#
@renekreijveld
renekreijveld / jdbrepair
Created Oct 17, 2014
Repair all tables of a joomla database.
View jdbrepair
#!/bin/sh
# jdbrepair -- Repair all tables of a joomla database.
#
# This scripts supports Joomla versions 1.0 - 3.3
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
# This program is free software; you may redistribute it and/or modify it.
#