Skip to content

Instantly share code, notes, and snippets.

@rvsjoen
rvsjoen / infiniteloop.patch
Created October 30, 2011 21:03
Infinite loop bug
diff --git index.php index.php
diff --git libraries/joomla/application/application.php libraries/joomla/application/application.php
index 9faf1ff..710ed45 100644
--- libraries/joomla/application/application.php
+++ libraries/joomla/application/application.php
@@ -196,6 +196,9 @@ class JApplication extends JObject
{
jimport('joomla.plugin.helper');
+ // If we get this far, we can enable the custom error page handler
@rvsjoen
rvsjoen / install.php
Created November 2, 2011 19:27
Automatic extension installation
<?php
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
@rvsjoen
rvsjoen / gist:1355080
Created November 10, 2011 15:13
RFC violation
diff --git administrator/includes/framework.php administrator/includes/framework.php
index 0e2ec0e..a6d7274 100644
--- administrator/includes/framework.php
+++ administrator/includes/framework.php
@@ -21,7 +21,23 @@ defined('_JEXEC') or die;
* Installation check, and check on removal of the install directory.
*/
if (!file_exists(JPATH_CONFIGURATION.'/configuration.php') || (filesize(JPATH_CONFIGURATION.'/configuration.php') < 10) /*|| file_exists(JPATH_INSTALLATION.'/index.php')*/) {
- header('Location: ../installation/index.php');
+
public function __construct(&$subject, $config = array()){
parent::__construct($subject, $config);
$this->loadLanguage();
}
@rvsjoen
rvsjoen / gist:1440151
Created December 6, 2011 21:45
Loading jQuery in Joomla
$doc = JFactory::getDocument();
$doc->addScript('https://www.google.com/jsapi');
$doc->addScriptDeclaration('
google.load("jquery", "1.6.2", {uncompressed: true});
google.load("jqueryui", "1.8.15", {uncompressed:true});
');
$doc->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/themes/ui-lightness/jquery-ui.css');
@rvsjoen
rvsjoen / gist:1699501
Created January 29, 2012 16:24
Joomla! 1.7 to 2.5 upgrade issues
a. Copy the Joomla_2.5.0-Stable-Update_Package.zip to your root html folder.
b. Using the FTP File Manager, Unarchive this file. Check the Override Existing Files box.
c. After this completes, the site should load and should say 2.5.0 in the Site Information.
d. In the back end, go to Installation Manager: Database. It will likely show problems. Click Fix and it should fix the problems.
e. Go to Installation Manager: Discover and click Discover. It will likely show new extensions. Select them all and click Install. It should install the new 2.5 extensions.
f. At this point, everything should be OK except that it will still indicate that you need to update to 2.5.0 in the Update tab (even though you don't!). To fix this, you need to edit a row in the database.
g. Go to the phpMyAdmin and find the row in the #__extensions table where id=700. In the manifest_cache column, you will see the text:
"version":"1.7.3"
Change this to
"version":"2.5.0"
function makeRequest($str){
return base64_encode(json_encode($str));
}
function doPost($str, $url = null){
$baseurl = "http://localhost/?format=json";
var_dump($baseurl.'&api='.$str);
return json_decode(file_get_contents($baseurl.'&api='.$str.$url));
}
private function authenticate($username, $password = null, $valid = 86400)
{
// Get a database object
$db = JFactory::getDbo();
$db->setQuery($db->getQuery(true)
->select('id, password')
->from('#__users')
->where('username='.$db->q($username)));
$result = $db->loadObject();
@rvsjoen
rvsjoen / rest.txt
Created March 6, 2012 15:49
REST interface
### General requirements
- Should return 405 method not supported if the components do not provide controllers in the specified format
- Should work with and without SEF enabled, with and without htaccess
- Preferably implemented in a plugin so it can be easily disabled
- Uses OAuth2 for security
- The REST trigger should be configurable via parameter
- The format of the returned document is controlled by the HTTP Accept header
### URLs
@rvsjoen
rvsjoen / routing.txt
Created June 12, 2012 19:38
Component routing
$this->_segment_map = array(
"items" => array(
"item" => array(
"layout" => array(
"new" => "new"
"edit" => "edit"
)
)
),
"item" => "items,