| 124 |
|
|
| 125 |
if ($resultdir !== false) { |
if ($resultdir !== false) { |
| 126 |
if (!$installer->extractArchive( $userfile['name'] )) { |
if (!$installer->extractArchive( $userfile['name'] )) { |
| 127 |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload '.$element.' - Upload Failed', |
HTML_installer::showInstallMessage( $installer->getErrors(), 'Upload '.$element.' - Upload Failed', |
| 128 |
returnTo( $option, $element, $client ) ); |
returnTo( $option, $element, $client ) ); |
| 129 |
} |
} |
| 130 |
$ret = $installer->install(); |
$ret = $installer->install(); |
| 131 |
|
|
| 132 |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload '.$element.' - '.($ret ? 'Success' : 'Failed'), |
HTML_installer::showInstallMessage( $installer->getErrors(), 'Upload '.$element.' - '.($ret ? 'Success' : 'Failed'), |
| 133 |
returnTo( $option, $element, $client ) ); |
returnTo( $option, $element, $client ) ); |
| 134 |
$installer->cleanUpInstall(); |
$installer->cleanUpInstall(); |
| 135 |
} else { |
} else { |
| 157 |
} |
} |
| 158 |
|
|
| 159 |
$ret = $installer->install( $path ); |
$ret = $installer->install( $path ); |
| 160 |
HTML_installer::showInstallMessage( $installer->getError(), 'Upload new '.$element.' - '.($ret ? 'Success' : 'Error'), |
HTML_installer::showInstallMessage( $installer->getErrors(), T_('Install new ').$element.' - '.($ret ? T_('Success') : T_('Error')), |
| 161 |
returnTo( $option, $element, $client ) ); |
returnTo( $option, $element, $client ) ); |
| 162 |
} |
} |
| 163 |
/** |
/** |
| 173 |
$installer = new $installerClass(); |
$installer = new $installerClass(); |
| 174 |
$result = false; |
$result = false; |
| 175 |
if ($cid[0]) { |
if ($cid[0]) { |
| 176 |
$result = $installer->uninstall( $cid[0], $option, $client ); |
$ret = $installer->uninstall( $cid[0], $option, $client ); |
| 177 |
} |
} |
| 178 |
|
else $ret = 1; |
| 179 |
|
|
| 180 |
$msg = $installer->getError(); |
HTML_installer::showInstallMessage( $installer->getErrors(), T_('Uninstall ').$element.' - '.($ret ? T_('Success') : T_('Error')), |
| 181 |
|
returnTo( $option, $element, $client ) ); |
|
mosRedirect( returnTo( $option, $element, $client ), $result ? 'Success ' . $msg : 'Failed ' . $msg ); |
|
| 182 |
} |
} |
| 183 |
/** |
/** |
| 184 |
* @param string The name of the php (temporary) uploaded file |
* @param string The name of the php (temporary) uploaded file |
| 195 |
if (mosChmod( $baseDir . $userfile_name )) { |
if (mosChmod( $baseDir . $userfile_name )) { |
| 196 |
return true; |
return true; |
| 197 |
} else { |
} else { |
| 198 |
$msg = 'Failed to change the permissions of the uploaded file.'; |
$msg = T_('Failed to change the permissions of the uploaded file.'); |
| 199 |
} |
} |
| 200 |
} else { |
} else { |
| 201 |
$msg = 'Failed to move uploaded file to <code>/media</code> directory.'; |
$msg = T_('Failed to move uploaded file to <code>/media</code> directory.'); |
| 202 |
} |
} |
| 203 |
} else { |
} else { |
| 204 |
$msg = 'Upload failed as <code>/media</code> directory is not writable.'; |
$msg = T_('Upload failed as <code>/media</code> directory is not writable.'); |
| 205 |
} |
} |
| 206 |
} else { |
} else { |
| 207 |
$msg = 'Upload failed as <code>/media</code> directory does not exist.'; |
$msg = T_('Upload failed as <code>/media</code> directory does not exist.'); |
| 208 |
} |
} |
| 209 |
return false; |
return false; |
| 210 |
} |
} |
| 220 |
$sql = "SELECT * FROM #__components WHERE id=$cid"; |
$sql = "SELECT * FROM #__components WHERE id=$cid"; |
| 221 |
$database->setQuery($sql); |
$database->setQuery($sql); |
| 222 |
if (!$database->loadObject( $row )) { |
if (!$database->loadObject( $row )) { |
| 223 |
HTML_installer::showInstallMessage($database->stderr(true),'Uninstall - error', |
HTML_installer::showInstallMessage($database->stderr(true),T_('Uninstall - error'), |
| 224 |
"index2.php?option=$option&element=component"); |
"index2.php?option=$option&element=component"); |
| 225 |
exit(); |
exit(); |
| 226 |
} |
} |
| 227 |
if ($row->iscore) { |
if ($row->iscore) { |
| 228 |
die('Is core component - may not be deleted'); |
die(T_('Is core component - may not be deleted')); |
| 229 |
HTML_installer::showInstallMessage("Component $row->name is a core component, and can not be uninstalled.<br />You need to unpublish it if you don't want to use it", 'Uninstall - error', |
HTML_installer::showInstallMessage(sprintf(T_('Component %s is a core component, and can not be uninstalled.<br />You need to unpublish it if you don\'t want to use it'), $row->name), 'Uninstall - error', |
| 230 |
"index2.php?option=$option&element=component"); |
"index2.php?option=$option&element=component"); |
| 231 |
exit(); |
exit(); |
| 232 |
} |
} |
| 237 |
foreach ($filesindir as $file) { |
foreach ($filesindir as $file) { |
| 238 |
$parser = new mosUninstallXML ($here.$file); |
$parser = new mosUninstallXML ($here.$file); |
| 239 |
$parser->uninstall(); |
$parser->uninstall(); |
| 240 |
if ($parser->terminalError) { |
if ($parser->errors->getMaxLevel() >= _MOS_ERROR_FATAL) return false; |
|
var_dump ($parser->errors); |
|
|
die('got some errors'); |
|
|
return false; |
|
|
} |
|
| 241 |
} |
} |
| 242 |
} |
} |
| 243 |
else { |
else { |
| 265 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 266 |
$database->loadObject( $row ); |
$database->loadObject( $row ); |
| 267 |
if ($row->iscore) { |
if ($row->iscore) { |
| 268 |
HTML_installer::showInstallMessage( $row->title .'is a core module, and can not be uninstalled.<br />You need to unpublish it if you don\'t want to use it', 'Uninstall - error', returnTo( $option, 'module', $row->client_id ? '' : 'admin' ) ); |
HTML_installer::showInstallMessage(sprintf(T_('%s is a core module, and can not be uninstalled.<br />You need to unpublish it if you don\'t want to use it'), $row->title), 'Uninstall - error', returnTo( $option, 'module', $row->client_id ? '' : 'admin' ) ); |
| 269 |
exit(); |
exit(); |
| 270 |
} |
} |
| 271 |
$query = "DELETE FROM #__modules_menu WHERE moduleid=$id"; |
$query = "DELETE FROM #__modules_menu WHERE moduleid=$id"; |
| 279 |
$xmlfile = $basepath . $row->module . '.xml'; |
$xmlfile = $basepath . $row->module . '.xml'; |
| 280 |
$parser = new mosUninstallXML ($xmlfile); |
$parser = new mosUninstallXML ($xmlfile); |
| 281 |
$parser->uninstall(); |
$parser->uninstall(); |
| 282 |
if ($parser->terminalError) { |
if ($parser->errors->getMaxLevel() < _MOS_ERROR_FATAL) return true; |
| 283 |
var_dump($parser->errors); |
return false; |
|
die('Uninstall failed'); |
|
|
} |
|
|
return true; |
|
| 284 |
} |
} |
| 285 |
|
|
| 286 |
/** |
/** |
| 295 |
$database->setQuery( "SELECT name, folder, element, iscore FROM #__mambots WHERE id = '$id'" ); |
$database->setQuery( "SELECT name, folder, element, iscore FROM #__mambots WHERE id = '$id'" ); |
| 296 |
$database->loadObject( $row ); |
$database->loadObject( $row ); |
| 297 |
if ($database->getErrorNum()) { |
if ($database->getErrorNum()) { |
| 298 |
HTML_installer::showInstallMessage( $database->stderr(), 'Uninstall - error', |
HTML_installer::showInstallMessage( $database->stderr(), T_('Uninstall - error'), |
| 299 |
returnTo( $option, 'mambot', $client ) ); |
returnTo( $option, 'mambot', $client ) ); |
| 300 |
exit(); |
exit(); |
| 301 |
} |
} |
| 302 |
if ($row == null) { |
if ($row == null) { |
| 303 |
HTML_installer::showInstallMessage( 'Invalid object id', 'Uninstall - error', |
HTML_installer::showInstallMessage( T_('Invalid object id'), T_('Uninstall - error'), |
| 304 |
returnTo( $option, 'mambot', $client ) ); |
returnTo( $option, 'mambot', $client ) ); |
| 305 |
exit(); |
exit(); |
| 306 |
} |
} |
| 307 |
if (trim( $row->folder ) == '') { |
if (trim( $row->folder ) == '') { |
| 308 |
HTML_installer::showInstallMessage( 'Folder field empty, cannot remove files', 'Uninstall - error', |
HTML_installer::showInstallMessage( T_('Folder field empty, cannot remove files'), T_('Uninstall - error'), |
| 309 |
returnTo( $option, 'mambot', $client ) ); |
returnTo( $option, 'mambot', $client ) ); |
| 310 |
exit(); |
exit(); |
| 311 |
} |
} |
| 312 |
$xmlfile = $mosConfig_absolute_path.'/mambots/'.$row->folder.'/'.$row->element.'.xml'; |
$xmlfile = $mosConfig_absolute_path.'/mambots/'.$row->folder.'/'.$row->element.'.xml'; |
| 313 |
$parser = new mosUninstallXML ($xmlfile); |
$parser = new mosUninstallXML ($xmlfile); |
| 314 |
$parser->uninstall(); |
$parser->uninstall(); |
| 315 |
if ($parser->terminalError) { |
if ($parser->errors->getMaxLevel() < _MOS_ERROR_FATAL) return true; |
| 316 |
var_dump($parser->errors); |
return false; |
|
die('Uninstall failed'); |
|
|
} |
|
|
return true; |
|
| 317 |
} |
} |
| 318 |
|
|
| 319 |
/** |
/** |
| 333 |
foreach ($filesindir as $file) { |
foreach ($filesindir as $file) { |
| 334 |
$parser = new mosUninstallXML ($path.$file); |
$parser = new mosUninstallXML ($path.$file); |
| 335 |
$parser->uninstall(); |
$parser->uninstall(); |
| 336 |
if ($parser->terminalError) { |
if ($parser->errors->getMaxLevel() >= _MOS_ERROR_FATAL) return false; |
|
var_dump ($parser->errors); |
|
|
return false; |
|
|
} |
|
| 337 |
} |
} |
| 338 |
} |
} |
| 339 |
else { |
else { |
| 358 |
if (file_exists( $xmlfile )) { |
if (file_exists( $xmlfile )) { |
| 359 |
$parser = new mosUninstallXML ($xmlfile); |
$parser = new mosUninstallXML ($xmlfile); |
| 360 |
$parser->uninstall(); |
$parser->uninstall(); |
| 361 |
if ($parser->terminalError) { |
if ($parser->errors->getMaxLevel() < _MOS_ERROR_FATAL) return true; |
| 362 |
var_dump($parser->errors); |
return false; |
|
die('Uninstall failed'); |
|
|
} |
|
|
return true; |
|
| 363 |
} |
} |
| 364 |
else { |
else { |
| 365 |
HTML_installer::showInstallMessage( 'Language id empty, cannot remove files', 'Uninstall - error', "index2.php?option=com_languages"); |
HTML_installer::showInstallMessage( T_('Language id empty, cannot remove files'), T_('Uninstall - error'), "index2.php?option=com_languages"); |
| 366 |
exit(); |
exit(); |
| 367 |
} |
} |
| 368 |
} |
} |