Skip to content

Instantly share code, notes, and snippets.

View samacs's full-sized avatar

Saul Martínez samacs

View GitHub Profile
try {
$fecha = date('Y-m-d');
$mensajeId = mysql_insert_id();
$path = realpath($_SERVER['DOCUMENT_ROOT'] . DS . '..' . DS . 'adjuntos');
$path = $path . DS . implode(DS, explode('-', $fecha)) . DS . $mensajeId;
if (!file_exists($path)) {
mkdir($path, 0777, true);
}
$file = $_FILES['archivo_adjunto'];
@samacs
samacs / IFormatter.php
Created October 22, 2012 16:23
A set of classes to demonstrate polymorphism.
<?php
/**
* Formatter interface.
*
* A contract to format.
*
* @category Formatter
* @package Formatter
* @author Saul Martinez <saul@sharkwebintelligence.com>
* @copyright 2012 Shark Web Intelligence
@samacs
samacs / helper.php
Created October 16, 2012 05:58
Simple module to get articles in Joomla >1.6
<?php
abstract class modBreakingNews
{
public function getArticles(&$params)
{
$db =& JFactory::getDbo();
$application =& JFactory::getApplication();
$applicationParams = $application->getParams();
$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));