-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.php
103 lines (91 loc) · 2.59 KB
/
script.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @version 1.0.0
* @category Joomla component
* @package Joomla.Administrator
* @subpackage com_extporter
* @name extporterView
* @author Dieudonne Timma <dieudonne.timma.meyatchie@mni.thm.de>
* @copyright GNU 3
* @license Open Source
*/
defined('_JEXEC') or die('Restricted access');
/**
* com_extporter script.
*/
class Com_extporterInstallerScript
{
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
if(!$this->setComponentParameter()){
echo '<p>' .JText::_('COM_EXTPORTER_INSTALL_NO_PARAMETER_INSTALLED') . '</p>';
}
$parent->getParent()->setRedirectURL('index.php?option=com_extporter');
}
function setComponentParameter(){
// Load the current component params.
$params = JComponentHelper::getParams('com_extporter');
// Set new value of param(s)
$params->set('upload_maxsize', 10);
$params->set('accept_format', "bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,BMP,CSV,DOC,GIF,ICO,JPG,JPEG,ODG,ODP,ODS,ODT,PDF,PNG,PPT,SWF,TXT,XCF,XLS");
// Save the parameters
$componentid = JComponentHelper::getComponent('com_extporter')->id;
$table = JTable::getInstance('extension');
$table->load($componentid);
$table->bind(array('params' => $params->toString()));
// check for error
if (!$table->check()) {
return false;
}
// Save to database
if (!$table->store()) {
return false;
}
return true;
}
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
echo '<p>' .JText::_('COM_EXTPORTER_UNINSTALL_TEXT') . '</p>';
}
/**
* method to update the component
*
* @return void
*/
function update($parent)
{
echo '<p>' . JText::sprintf('COM_EXTPORTER_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
/**function preflight($type, $parent)
{
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
echo '<p>' . JText::_('COM_EXTPORTER_PREFLIGHT_' . $type . '_TEXT') . '</p>';
}*/
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
/**function postflight($type, $parent)
{
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
echo '<p>' . JText::_('COM_EXTPORTERPOSTFLIGHT_' . $type . '_TEXT') . '</p>';
}*/
}