SlideShare a Scribd company logo
Hidden in plain site
Joomla! hidden secrets for code monkeys
Hidden in plain site – joomla! hidden secrets for code monkeys
Junior Dev Stuff
Input
$app = JFactory::getApplication();

$option = $app->input
->getCmd(‘option’);
File uploads
with security check
$app = JFactory::getApplication();

$option = $app->input->files

->get('file', array());
File uploads
without security check
$app = JFactory::getApplication();

$option = $app->input->files

->get('file', array(), 'raw');
Date and Time
$dateString = '2015-05-31 12:00:00';

$date = JFactory::getDate($dateString);

$format = JText::_('DATE_FORMAT_LC2');

echo $date->format($format);
URI manipulation
$uri = JUri::getInstance();

$uri->setVar('joomla', 'rocks');

echo $uri->toString();
Hidden in plain site – joomla! hidden secrets for code monkeys
Serious low-level stuff
$http = JHttpFactory::getHttp();

$response = $http->get('http://www.joomla.org/
download.html');



$this->out("HTTP Code: " . $response->code);

$this->out("Headers:n" . print_r($response-
>headers, true));
HTTP Transfers

without the pain of cURL and stream contexts
$stream = new JStream();



$stream->open(JPATH_SITE . '/tmp/temp.gz', 'w',
false, null, false, false, true);

$stream->write($buffer);

$stream->chmod();

$stream->close();
Stream file I/O

with transparent GZip / BZip2 support
JArchive::extract($archiveName, $targetFolder);
Extract archives

zip, tar, tar.gz / tgz, tar.bz2 / tbz
JStringPunycode::emailToPunycode('üser@êxαmpłe.com'
);

// üser@xn--xmpe-fpa54cg0l.com



JStringPunycode::urlToPunycode('http://
www.παράδειγμα.com');

// http://www.xn--hxajbheg2az3al.com



JStringPunycode::fromPunycode('http://www.xn--
hxajbheg2az3al.com');

// http://www.παράδειγμα.com
UTF-8 Domains

a.k.a. “Punycode” or IDNA conversion
$image = new JImage(__DIR__ . '/image.jpg');

$image->createThumbs([
'640x480', '320x200', '160x100', ‘80x50'
], JImage::SCALE_FILL, __DIR__ . '/thumbs');
Image manipulation

Thumbnails
$image = new JImage(__DIR__ . '/image.jpg');

$newImage = $image

->filter('grayscale')

->rotate('10', 0xFFFFFF, true)

->resize(320, 200);

$newImage->toFile(
__DIR__ . ‘/altered.png',
IMAGETYPE_PNG
);
Image manipulation

Alter and convert images
Files and databases
GitHub integration

JGithub
$patcher = JFilesystemPatcher::getInstance();

$patcher

->reset()

->addFile(
__DIR__ . ‘/file1.patch',
JPATH_BASE, 1
);

$patcher->apply();
Apply patch files

JFilesystemPatcher
$schemaUpdater = JSchemaChangeset::getInstance(
$db, '/path/to/sql/files'
);

$errors = $schemaUpdater->check();

$schemaUpdater->fix();
Update the schema

or get a list of errors (changes not applied)
$config = [

'dbinstaller_directory' => '/path/to/xml/files',

'option' => 'com_example'

];

$schemaUpdater = new FOFDatabaseInstaller($config);

// Install or update schema

$schemaUpdater->updateSchema();

// Remove the schema

$schemaUpdater->removeSchema();
XML-based schema updates

using FOFDatabaseInstaller
$db = JFactory::getDbo();

$exporter = $db->getExporter();

$xml = $exporter->asXml();
Exporting the database

Here Be Dragons!
$db = JFactory::getDbo();

$importer = $db->getImporter();

$importer->from($xml);



// Bug: mergeStructure is protected. Sad panda :(

// $importer->mergeStructure();



$reflection = new ReflectionObject($importer);

$method = $reflection->getMethod('mergeStructure');

$method->setAccessible(true);

$method->invoke($importer);
Importing the database

Here Be Dragons!
Dial the awesome to
eleven!
Services
Lots of!
JFacebook JLinkedin
JGoogle JTwitter
JMediawiki JOpenstreetmapJOauth1Client
JOauth2Client
Services
Lots of!
Cryptography

JKeychain & JCrypt
• 3DES
• Blowfish
• Rijndael256 (AES)
• Simple (don’t use)
• mcrypt
// Set up

$plugin = JFactory::getApplication()->getParams()
->get('captcha',

JFactory::getConfig()->get('captcha'));

$captcha = JCaptcha::getInstance($plugin, array(

'namespace' => 'myComponent'

));



// Show

echo $captcha->display('mycaptcha', 'mycaptcha');



// Validate

$code = JFactory::getApplication()->input->get('mycaptcha');

if (!$captcha->checkAnswer($code))

{

throw new RuntimeException('Bots not welcome', 403);

}
CAPTCHA

Keep bots away
$less = new JLess();

$less->ccompile($lessFile, $cssFile);
Compile LESS to CSS

Server-side, cached
$pathway = JFactory::getApplication()
->getPathway();

$pathway->addItem('MyItem', $url);
Manipulate breadcrumbs

Custom, in-component pathways
Microdata

Schema.org support
https://docs.joomla.org/Microdata
More than a CMS

Custom application types
• JApplicationCLI
• JApplicationWeb
• JApplicationDaemon
Photos by Smithsonian Institution, National Museum of American History
May the
Core
be with you
The End

More Related Content

PDF
Silex meets SOAP & REST
PDF
international PHP2011_Bastian Feder_jQuery's Secrets
PDF
Feeds drupal cafe
PDF
Php unit the-mostunknownparts
PDF
The History of PHPersistence
PDF
Database Design Patterns
PDF
Doctrine fixtures
PDF
Design Patterns avec PHP 5.3, Symfony et Pimple
Silex meets SOAP & REST
international PHP2011_Bastian Feder_jQuery's Secrets
Feeds drupal cafe
Php unit the-mostunknownparts
The History of PHPersistence
Database Design Patterns
Doctrine fixtures
Design Patterns avec PHP 5.3, Symfony et Pimple

What's hot (20)

PDF
The Origin of Lithium
PDF
New in cakephp3
PDF
20 modules i haven't yet talked about
PDF
jQuery: out with the old, in with the new
KEY
Php 101: PDO
PDF
Future of HTTP in CakePHP
PDF
Building Lithium Apps
PDF
Advanced Querying with CakePHP 3
PDF
News of the Symfony2 World
PDF
Doctrine MongoDB ODM (PDXPHP)
PPTX
Zero to SOLID
KEY
Lithium Best
ODP
PDF
Introduction to the Pods JSON API
PDF
Agile database access with CakePHP 3
PDF
Symfony2 - WebExpo 2010
PDF
Unit and Functional Testing with Symfony2
PDF
Pemrograman Web 8 - MySQL
PDF
Undercover Pods / WP Functions
PPTX
Алексей Плеханов: Новинки Laravel 5
The Origin of Lithium
New in cakephp3
20 modules i haven't yet talked about
jQuery: out with the old, in with the new
Php 101: PDO
Future of HTTP in CakePHP
Building Lithium Apps
Advanced Querying with CakePHP 3
News of the Symfony2 World
Doctrine MongoDB ODM (PDXPHP)
Zero to SOLID
Lithium Best
Introduction to the Pods JSON API
Agile database access with CakePHP 3
Symfony2 - WebExpo 2010
Unit and Functional Testing with Symfony2
Pemrograman Web 8 - MySQL
Undercover Pods / WP Functions
Алексей Плеханов: Новинки Laravel 5
Ad

Similar to Hidden in plain site – joomla! hidden secrets for code monkeys (20)

PPT
Core Php Component Presentation
PPT
Corephpcomponentpresentation 1211425966721657-8
PPTX
Unit3IIpartpptx__2024_10_17_19_07_58 2.pptx
PPTX
CODE IGNITER
PDF
Symfony2 - from the trenches
PDF
DIPLOMA IN DESIGNING AND WEBSITE DEVELOPMENT
PPTX
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
PDF
Zend Server Data Caching
PDF
Working with web_services
PDF
Jooctrine - Doctrine ORM in Joomla!
KEY
Joomla Day DK 2012
PPTX
Introduction to building joomla! components using FOF
PDF
Working With The Symfony Admin Generator
PDF
PDF
php-and-zend-framework-getting-started
PDF
php-and-zend-framework-getting-started
PDF
php-and-zend-framework-getting-started
PDF
php-and-zend-framework-getting-started
PDF
CakePHP 3.0: Embracing the future
KEY
Profiling php applications
Core Php Component Presentation
Corephpcomponentpresentation 1211425966721657-8
Unit3IIpartpptx__2024_10_17_19_07_58 2.pptx
CODE IGNITER
Symfony2 - from the trenches
DIPLOMA IN DESIGNING AND WEBSITE DEVELOPMENT
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Zend Server Data Caching
Working with web_services
Jooctrine - Doctrine ORM in Joomla!
Joomla Day DK 2012
Introduction to building joomla! components using FOF
Working With The Symfony Admin Generator
php-and-zend-framework-getting-started
php-and-zend-framework-getting-started
php-and-zend-framework-getting-started
php-and-zend-framework-getting-started
CakePHP 3.0: Embracing the future
Profiling php applications
Ad

More from Nicholas Dionysopoulos (11)

PPT
Rapid application development with FOF
PDF
Joomla! Security 101 - Joomla! Day Bosnia and Herzegovina 2013
PDF
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
KEY
JWC - Rapid application development with FOF
KEY
FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012
KEY
Advanced Akeeba Backup (Joomla! Day Denmark 2012)
KEY
Joomla! Day Deutschland 2012 - Advanced Akeeba Backup
KEY
Joomla! Day Deutschland 2012 - Active Security
KEY
Joomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
KEY
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
KEY
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Rapid application development with FOF
Joomla! Security 101 - Joomla! Day Bosnia and Herzegovina 2013
Joomla! Frappe - Κατασκευή εφαρμογών για το Joomla! χωρίς να τραβάτε τα μαλιά...
JWC - Rapid application development with FOF
FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012
Advanced Akeeba Backup (Joomla! Day Denmark 2012)
Joomla! Day Deutschland 2012 - Advanced Akeeba Backup
Joomla! Day Deutschland 2012 - Active Security
Joomla! Day Poland 2012 - Monetize your site with Akeeba Subscriptions
Joomla! Day Poland 2012 - Advanced Akeeba Backup - Beyond just backing up you...
Joomla! Day Poland 2012 - Active Security for Joomla! sites

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Cloud computing and distributed systems.
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Machine learning based COVID-19 study performance prediction
Encapsulation_ Review paper, used for researhc scholars
Spectroscopy.pptx food analysis technology
Cloud computing and distributed systems.
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

Hidden in plain site – joomla! hidden secrets for code monkeys