setTpl($tpl);
$tpl->setTplFolder(TEMPLATES_PATH);
$tpl->setDrawHeader(false);
$tpl->setDrawFooter(false, $config, $errorHandler);
if (is_array($onlinePlugins))
{
if (isset($onlinePlugins[$pluginId]))
{
if (($data = file_get_contents($config['url']['pluginDownload'].'&'.http_build_query(array('file' => $onlinePlugins[$pluginId]['versions'][$onlinePlugins[$pluginId]['latestVersion']]['update']['filename'])))) !== false)
{
if (file_put_contents(PLUGINS_PATH.'plugin.zip', $data, LOCK_EX) !== false)
{
if (md5_file(PLUGINS_PATH.'plugin.zip') == $onlinePlugins[$pluginId]['versions'][$onlinePlugins[$pluginId]['latestVersion']]['update']['checksum'])
{
if (file_exists(PLUGINS_PATH.$pluginId.'/') && is_dir(PLUGINS_PATH.$pluginId.'/'))
{
$zip = new ZipArchive;
if (($zipError = $zip->open(PLUGINS_PATH.'plugin.zip')) === true)
{
$zip->extractTo(PLUGINS_PATH.$pluginId.'/');
$zip->close();
unlink(PLUGINS_PATH.'plugin.zip');
if (function_exists('apc_clear_cache')) apc_clear_cache();
sleep(3); // Verhindere Cachen der init.php
if (file_exists(PLUGINS_PATH.$pluginId.'/setup.php') && is_file(PLUGINS_PATH.$pluginId.'/setup.php'))
$tpl->redirect(PLUGINS_PATH.$pluginId.'/setup.php');
else
$tpl->redirect('?s=discover_plugins&id='.$pluginId.'&updated');
}
else
$errorMsg = _t('Leider ist ein Fehler beim entpacken des Plugins aufgetreten! Fehlercode: %s', $zipRrror);
}
else
$errorMsg = _t('Der Ordner für das Plugin existiert nicht. Bitte installiere zunächst das Plugin.');
}
else
$errorMsg = _t('Das Plugin wurde nicht vollständig heruntergeladen. Bitte versuche es erneut. Sollte der Fehler weiterhin auftreten, schreibe mir unter Kontakt, sodass ich dir möglichst schnell weiterhelfen kann.', 'https://willy-tech.de/kontakt/');
}
else
$errorMsg = _t('Konnte das Plugin nicht zwischenspeichern! Bitte schreibe mir unter Kontakt, sodass ich dir möglichst schnell weiter helfen kann.', 'https://willy-tech.de/kontakt/');
}
else
$errorMsg = _t('Konnte das Plugin auf dem Server nicht finden! Bitte schreibe mir unter Kontakt, sodass ich dir möglichst schnell weiter helfen kann.', 'https://willy-tech.de/kontakt/');
}
else
$errorMsg = _t('Konnte die PluginID auf dem Server nicht finden! Bitte schreibe mir unter Kontakt, sodass ich dir möglichst schnell weiter helfen kann.', 'https://willy-tech.de/kontakt/');
}
else
$errorMsg = _t('Leider ist beim Abrufen der Plugins ein Fehler aufgetreten. Fehlercode: %s
Bitte schreibe mir unter Kontakt, sodass ich dir möglichst schnell weiter helfen kann.', $onlinePlugins, 'https://willy-tech.de/kontakt/');
if (isset($errorMsg))
{
$tpl->assign('content', '