-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.wbty_forms.php
38 lines (34 loc) · 1.16 KB
/
script.wbty_forms.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* @package AkeebaReleaseSystem
* @copyright Copyright (c)2010-2011 Nicholas K. Dionysopoulos
* @license GNU General Public License version 3, or later
* @version $Id: ars.php 123 2011-04-13 07:47:16Z nikosdion $
*/
class com_wbty_formsInstallerScript {
function update($parent) {
}
function postflight($type, $parent) {
require_once('install.wbty_forms.php');
if($type == "install"){
if(method_exists($parent, 'extension_root')) {
$configfile = $parent->getPath('extension_root').'/config.xml';
} else {
$configfile = $parent->getParent()->getPath('extension_root').'/config.xml';
}
if (file_exists($configfile)) {
$xml = file_get_contents($configfile);
$form = JForm::getInstance('installer', $xml, array(), false, '/config');
$params = array();
if ($form->getFieldset('component')) {
foreach ($form->getFieldset('component') as $field) {
$params[$field->__get('name')] = $field->__get('value');
}
}
$db = JFactory::getDBO();
$query = "UPDATE #__extensions SET params='".json_encode($params)."' WHERE element='".$parent->get('element')."'";
$db->setQuery($query)->query();
}
}
}
}