This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.weever.joomla.1.5.php
267 lines (180 loc) · 9.01 KB
/
install.weever.joomla.1.5.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
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?php
/*
* Weever Apps Administrator Component for Joomla
* (c) 2010-2012 Weever Apps Inc. <http://www.weeverapps.com/>
*
* Authors: Robert Gerald Porter <[email protected]>
* Aaron Song <[email protected]>
* Version: 1.8.2
* License: GPL v3.0
*
* This extension is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This extension is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details <http://www.gnu.org/licenses/>.
*
*/
defined('_JEXEC') or die;
jimport('joomla.installer.installer');
$release = "1.9";
$detailsTemplate = null; $cartographerId = null; $cartographerK2Id = null; $mobileespId = null;
$lang = &JFactory::getLanguage();
$lang->load("com_weever");
$db = & JFactory::getDBO();
$query = "SELECT `id` FROM `#__plugins` WHERE element=".$db->Quote('mobileesp')." AND folder=".$db->Quote('system');
$db->setQuery($query);
$check = $db->loadResultArray();
echo "
<div style='clear:both'>
<img src='components/com_weever/assets/icons/icon-48-weever_toolbar_title.png' style='float:left;padding-right:2em' />
<h1 style='padding-top:0.625em;padding-bottom:1em;'>Weever Apps for Joomla version ". $release ."</h1>
</div>
";
if(count($check) > 0)
{
$pluginInstallText = JText::_("WEEVER_UPDATING_PLUGIN");
$templateInstallText = JText::_("WEEVER_UPDATING_TEMPLATE");
}
else
{
$pluginInstallText = JText::_("WEEVER_INSTALLING_PLUGIN");
$templateInstallText = JText::_("WEEVER_INSTALLING_TEMPLATE");
}
// INSTALL mobileESP plugin
$installer = new JInstaller;
$src = $this->parent->getPath('source');
$path = $src.DS.'plugins'.DS.'system'.DS.'mobileesp';
$result = $installer->install($path);
if($result)
$message = "<span style='color:green'>".JText::_("WEEVER_SUCCESS")."</span>";
else
$message = "<span style='color:red'>".JText::_("WEEVER_FAILED")."</span>";
echo "<p>".$pluginInstallText."system/mobileesp: <b>".$message."</b></p>";
$query = "UPDATE #__plugins SET published='1' WHERE element='mobileesp' AND folder='system'";
$db->setQuery($query);
$db->query();
echo "<p><i>".JText::_("WEEVER_ENABLED_PLUGIN")."MobileESP</i></p>";
// DETECT K2
// then INSTALL weevermapsk2 plugin
if( JFolder::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2') )
{
$src = $this->parent->getPath('source');
$path = $src.DS.'plugins'.DS.'k2'.DS.'weevermapsk2';
$result = $installer->install($path);
if($result)
$message = "<span style='color:green'>".JText::_("WEEVER_SUCCESS")."</span>";
else
$message = "<span style='color:red'>".JText::_("WEEVER_FAILED")."</span>";
echo "<p>".$pluginInstallText."k2/weevermapsk2: <b>".$message."</b></p>";
$query = "UPDATE #__plugins SET published='1' WHERE element='weevermapsk2' AND folder='k2'";
$db->setQuery($query);
$db->query();
echo "<p><i>".JText::_("WEEVER_ENABLED_PLUGIN")."Weever Maps Geocoder for K2</i></p>";
}
// INSTALL weever_cartographer R3S template
$path = $src.DS.'templates';
$result = $installer->install($path);
if($result)
$message = "<span style='color:green'>".JText::_("WEEVER_SUCCESS")."</span>";
else
$message = "<span style='color:red'>".JText::_("WEEVER_FAILED")."</span>";
echo "<p>".$templateInstallText."templates/weever_cartographer: <b>".$message."</b></p>";
if( !is_dir(JPATH_ROOT.DS."images".DS."com_weever") )
{
mkdir(JPATH_ROOT.DS."images".DS."com_weever");
if( !file_exists(JPATH_ROOT.DS."media".DS."com_weever".DS."phone_load_live.png") ) {
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."phone_load_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."phone_load_.png", JPATH_ROOT.DS."images".DS."com_weever".DS."phone_load_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."icon_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."icon_.png", JPATH_ROOT.DS."images".DS."com_weever".DS."icon_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_load_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."tablet_load_.png", JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_load_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_landscape_load_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."tablet_landscape_load_.png", JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_landscape_load_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."titlebar_logo_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."titlebar_logo_.png", JPATH_ROOT.DS."images".DS."com_weever".DS."titlebar_logo_live.png");
}
}
if(!function_exists("stream_context_create") && !function_exists("fopen") && !function_exists("stream_get_contents") && ini_get('allow_url_fopen') != 1)
echo "<div style='color:#700; font-weight:bold'>".JText::_("WEEVER_ERROR_STREAM_CONTEXT_CREATE")."</div>";
$query = " SELECT `setting` FROM #__weever_config WHERE `option`='site_key' ";
$db = &JFactory::getDBO();
$db->setQuery($query);
$key = @$db->loadObject();
$query = " SELECT `setting` FROM #__weever_config WHERE `option`='loadspinner' ";
$db = &JFactory::getDBO();
$db->setQuery($query);
$code = @$db->loadObject();
if(!isset($code->setting))
{
$query = " INSERT IGNORE INTO `#__weever_config` VALUES(9, 'google_analytics', ''); ";
$db = &JFactory::getDBO();
$db->setQuery($query);
@$db->loadObject();
$query = " INSERT IGNORE INTO `#__weever_config` VALUES(10, 'domain', ''); ";
$db = &JFactory::getDBO();
$db->setQuery($query);
@$db->loadObject();
$query = " INSERT IGNORE INTO `#__weever_config` VALUES(11, 'loadspinner', ''); ";
$db = &JFactory::getDBO();
$db->setQuery($query);
@$db->loadObject();
}
// check if there are server-side app updates to be made
if($key->setting)
{
$response = file_get_contents('http://weeverapp.com/index.php?app=ajax&m=upgrade&version=1.7&cms=joomla&site_key='.$key->setting);
?>
<form action='index.php' enctype='multipart/form-data' method='post' name='adminForm' id='adminForm'>
<?php
echo $response;
echo JHTML::_('form.token');
?>
</form>
<?php
// if an upgrade
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."phone_load_live.png") && file_exists(JPATH_ROOT.DS."media".DS."com_weever".DS."phone_load_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."phone_load_live.png", JPATH_ROOT.DS."images".DS."com_weever".DS."phone_load_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."icon_live.png") && file_exists(JPATH_ROOT.DS."media".DS."com_weever".DS."icon_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."icon_live.png", JPATH_ROOT.DS."images".DS."com_weever".DS."icon_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_load_live.png") && file_exists(JPATH_ROOT.DS."media".DS."com_weever".DS."tablet_load_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."tablet_load_live.png", JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_load_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_landscape_load_live.png") && file_exists(JPATH_ROOT.DS."media".DS."com_weever".DS."tablet_landscape_load_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."tablet_landscape_load_live.png", JPATH_ROOT.DS."images".DS."com_weever".DS."tablet_landscape_load_live.png");
if(!file_exists(JPATH_ROOT.DS."images".DS."com_weever".DS."titlebar_logo_live.png") && file_exists(JPATH_ROOT.DS."media".DS."com_weever".DS."titlebar_logo_live.png"))
copy(JPATH_ROOT.DS."media".DS."com_weever".DS."titlebar_logo_live.png", JPATH_ROOT.DS."images".DS."com_weever".DS."titlebar_logo_live.png");
}
else
{
?>
<p><?php echo JText::_("WEEVER_INSTALL_WELCOME"); ?></p>
<form action='index.php' enctype='multipart/form-data' method='post' name='adminForm' id='adminForm'>
<div>
<fieldset class='adminForm'>
<legend><?php echo JText::_("WEEVER_INSTALL_SITE_KEY"); ?></legend>
<p><i><?php echo JText::_("WEEVER_UPGRADE_NOTICE"); ?></i></p>
<table class="admintable">
<tr>
<td><?php echo JText::_("WEEVER_GET_A_KEY"); ?></td>
</tr>
<tr>
<td><input type="text" name="site_key" maxlength="42" style="width:250px;" placeholder="<?php JText::_("WEEVER_PASTE_WEEVER_SITE_KEY_HERE"); ?>" value="" /><input type="submit" value="<?php echo JText::_("WEEVER_INSTALL_SUBMIT_KEY"); ?>" /><p></p></td>
</tr>
<tr>
<td><input type="checkbox" name="staging" value="1" id="checkStaging" /> <label for="checkStaging"><?php echo JText::_("WEEVER_INSTALL_STAGING_MODE"); ?></label></td></tr>
</table>
</fieldset>
</div>
<input type="hidden" name="option" value="com_weever" />
<input type="hidden" name="view" value="account" />
<input type="hidden" name="task" value="save" />
<input type="hidden" name="install" value="1" />
<?php echo JHTML::_('form.token'); ?>
</form>
<?php
}