forked from jcketz/CrowdFunding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
217 lines (178 loc) · 9.28 KB
/
install.php
File metadata and controls
217 lines (178 loc) · 9.28 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
/**
* @package CrowdFunding
* @subpackage Components
* @author Todor Iliev
* @copyright Copyright (C) 2013 Todor Iliev <todor@itprism.com>. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die;
/**
* Script file of the component
*/
class pkg_crowdFundingInstallerScript {
/**
* method to install the component
*
* @return void
*/
public function install($parent) {
}
/**
* method to uninstall the component
*
* @return void
*/
public function uninstall($parent) {
}
/**
* method to update the component
*
* @return void
*/
public function update($parent) {
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
public function preflight($type, $parent) {
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
public function postflight($type, $parent) {
if(!defined("COM_CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR")) {
define("COM_CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR", JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . "components" . DIRECTORY_SEPARATOR ."com_crowdfunding");
}
// Register Component helpers
JLoader::register("CrowdFundingInstallHelper", COM_CROWDFUNDING_PATH_COMPONENT_ADMINISTRATOR.DIRECTORY_SEPARATOR."helpers".DIRECTORY_SEPARATOR."install.php");
jimport('joomla.filesystem.path');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$params = JComponentHelper::getParams("com_crowdfunding");
$this->imagesFolder = JFolder::makeSafe($params->get("images_directory", "images/crowdfunding"));
$this->imagesPath = JPath::clean( JPATH_SITE.DIRECTORY_SEPARATOR.$this->imagesFolder );
// Create images folder
if(!is_dir($this->imagesPath)){
CrowdFundingInstallHelper::createFolder($this->imagesPath);
}
// Start table with the information
CrowdFundingInstallHelper::startTable();
// Requirements
CrowdFundingInstallHelper::addRowHeading(JText::_("COM_CROWDFUNDING_MINIMUM_REQUIREMENTS"));
// Display result about verification for existing folder
$title = JText::_("COM_CROWDFUNDING_IMAGE_FOLDER");
$info = $this->imagesFolder;
if(!is_dir($this->imagesPath)) {
$result = array("type" => "important", "text" => JText::_("JNO"));
} else {
$result = array("type" => "success" , "text" => JText::_("JYES"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Display result about verification for writeable folder
$title = JText::_("COM_CROWDFUNDING_WRITABLE_FOLDER");
$info = $this->imagesFolder;
if(!is_writable($this->imagesPath)) {
$result = array("type" => "important", "text" => JText::_("JNO"));
} else {
$result = array("type" => "success" , "text" => JText::_("JYES"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Display result about verification for GD library
$title = JText::_("COM_CROWDFUNDING_GD_LIBRARY");
$info = "";
if(!extension_loaded('gd') AND function_exists('gd_info')) {
$result = array("type" => "important", "text" => JText::_("COM_CROWDFUNDING_WARNING"));
} else {
$result = array("type" => "success" , "text" => JText::_("JON"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Display result about verification for cURL library
$title = JText::_("COM_CROWDFUNDING_CURL_LIBRARY");
$info = "";
if( !extension_loaded('curl') ) {
$info = JText::_("COM_CROWDFUNDING_CURL_INFO");
$result = array("type" => "important", "text" => JText::_("JOFF"));
} else {
$result = array("type" => "success" , "text" => JText::_("JON"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Display result about verification Magic Quotes
$title = JText::_("COM_CROWDFUNDING_MAGIC_QUOTES");
$info = "";
if( get_magic_quotes_gpc() ) {
$info = JText::_("COM_CROWDFUNDING_MAGIC_QUOTES_INFO");
$result = array("type" => "important", "text" => JText::_("JON"));
} else {
$result = array("type" => "success" , "text" => JText::_("JOFF"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Display result about verification FileInfo
$title = JText::_("COM_CROWDFUNDING_FILEINFO");
$info = "";
if( !function_exists('finfo_open') ) {
$info = JText::_("COM_CROWDFUNDING_FILEINFO_INFO");
$result = array("type" => "important", "text" => JText::_("JOFF"));
} else {
$result = array("type" => "success", "text" => JText::_("JON"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Display result about verification of installed ITPrism Library
jimport("itprism.version");
$title = JText::_("COM_CROWDFUNDING_ITPRISM_LIBRARY");
$info = "";
if( !class_exists("ITPrismVersion") ) {
$info = JText::_("COM_CROWDFUNDING_ITPRISM_LIBRARY_DOWNLOAD");
$result = array("type" => "important", "text" => JText::_("JNO"));
} else {
$result = array("type" => "success", "text" => JText::_("JYES"));
}
CrowdFundingInstallHelper::addRow($title, $result, $info);
// Installed extensions
CrowdFundingInstallHelper::addRowHeading(JText::_("COM_CROWDFUNDING_INSTALLED_EXTENSIONS"));
// CrowdFunding Library
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CROWDFUNDING_LIBRARY"), $result, JText::_("COM_CROWDFUNDING_LIBRARY"));
// Plugins
// Content - CrowdFunding - Navigation
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CONTENT_CROWDFUNDING_NAVIGATION"), $result, JText::_("COM_CROWDFUNDING_PLUGIN"));
// Content - CrowdFunding - Share
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CONTENT_CROWDFUNDING_SHARE"), $result, JText::_("COM_CROWDFUNDING_PLUGIN"));
// Content - CrowdFunding - Admin Mail
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CONTENT_CROWDFUNDING_ADMIN_MAIL"), $result, JText::_("COM_CROWDFUNDING_PLUGIN"));
// Content - CrowdFunding - User Mail
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CONTENT_CROWDFUNDING_USER_MAIL"), $result, JText::_("COM_CROWDFUNDING_PLUGIN"));
// System - CrowdFunding - Modules
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_SYSTEM_CROWDFUNDINGMODULES"), $result, JText::_("COM_CROWDFUNDING_PLUGIN"));
// CrowdFunding Payment - PayPal
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CROWDFUNDINGPAYMENT_PAYPAL"), $result, JText::_("COM_CROWDFUNDING_PLUGIN"));
// Modules
// CrowdFunding Info
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CROWDFUNDING_MODULE_INFO"), $result, JText::_("COM_CROWDFUNDING_MODULE"));
// CrowdFunding Details
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CROWDFUNDING_MODULE_DETAILS"), $result, JText::_("COM_CROWDFUNDING_MODULE"));
// CrowdFunding Rewards
$result = array("type" => "success" , "text" => JText::_("COM_CROWDFUNDING_INSTALLED"));
CrowdFundingInstallHelper::addRow(JText::_("COM_CROWDFUNDING_CROWDFUNDING_MODULE_REWARDS"), $result, JText::_("COM_CROWDFUNDING_MODULE"));
// End table
CrowdFundingInstallHelper::endTable();
echo JText::sprintf("COM_CROWDFUNDING_MESSAGE_REVIEW_SAVE_SETTINGS", JRoute::_("index.php?option=com_crowdfunding"));
jimport("itprism.version");
if(!class_exists("ITPrismVersion")) {
echo JText::_("COM_CROWDFUNDING_MESSAGE_INSTALL_ITPRISM_LIBRARY");
}
}
}