}
/**
+ * @todo This whole page is carzy, it's manipulating the requested page, but RequestHandler does not work this way
* @see wcf\page\IPage::readParameters()
*/
public function readParameters() {
* Handles all request on the package.php script
* and executes the requested action.
* TODO: split this page into separate pages / actions
+ * TODO: I would recommend removing this entire class, it's pretty nasty to use a page just for redirections
*
* @author Marcel Werk
* @copyright 2001-2011 WoltLab GmbH
case 'rollback':
// TODO
die('ROLLBACK');
- WCF::getSession()->checkPermissions(array('admin.system.package.canInstallPackage'));
- require_once(WCF_DIR.'lib/acp/package/PackageInstallationRollback.class.php');
- new PackageInstallationRollback($this->queueID); // TODO: undefined class PackageInstallationRollback
+ //WCF::getSession()->checkPermissions(array('admin.system.package.canInstallPackage'));
break;
case 'openQueue':
// search and replace
$matches = 0;
if ($useRegex) {
- $newValue = preg_replace('~'.$search.'~s'.(!$caseSensitive ? 'i' : ''), $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), -1, $matches); //TODO: undefined variable
+ $newValue = preg_replace('~'.$search.'~s', $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), -1, $matches);
}
else {
- if ($caseSensitive) $newValue = StringUtil::replace($search, $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), $matches); //TODO: undefined variable
- else $newValue = StringUtil::replaceIgnoreCase($search, $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), $matches);
+ $newValue = StringUtil::replaceIgnoreCase($search, $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), $matches);
}
if ($matches > 0) {
/**
* Returns a list of options.
- * TODO: move to optionlist
*
* @param integer $packageID
* @return array
<?php
namespace wcf\data\package;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\system\exception\ValidateActionException;
use wcf\system\WCF;
/**
protected $permissionsUpdate = array('admin.system.package.canUpdatePackage');
/**
- * @todo Implement validation
+ * Validates page parameter.
*/
- public function validateGetPluginList() {}
+ public function validateGetPluginList() {
+ if (!isset($this->parameters['activePage']) || !intval($this->parameters['activePage'])) {
+ throw new ValidateActionException("Missing or invalid parameter 'activePage'");
+ }
+ }
/**
* Returns a list of plugins.
/**
* Searches in templates.
- * TODO: move to template editor?
*
* @param string $search search query
* @param string $replace
*/
public function deleteFolders() {
// default template dir
- $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName); // TODO: should this folder be deleted, too?
+ $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName);
// get package dirs
$sql = "SELECT packageDir
$archive->openArchive();
}
catch (\Exception $e) {
- // TODO: Maybe break the installation if archive is broken?
- // this is a broken archive, skip it
- continue;
+ // we've encountered a broken archive, revert everything and then fail
+ $sql = "SELECT queueID, parentQueueID
+ FROM wcf".WCF_N."_package_installation_queue";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute();
+ $queues = array();
+ while ($row = $statement->fetchArray()) {
+ $queues[$row['queueID']] = $row['parentQueueID'];
+ }
+
+ $queueIDs = array();
+ $queueID = $queue->queueID;
+ while ($queueID) {
+ $queueIDs[] = $queueID;
+
+ $queueID = (isset($queues[$queueID])) ?: 0;
+ }
+
+ // remove previously created queues
+ if (!empty($queueIDs)) {
+ $sql = "DELETE FROM wcf".WCF_N."_package_installation_queue
+ WHERE queueID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ WCF::getDB()->beginTransaction();
+ foreach ($queueIDs as $queueID) {
+ $statement->execute(array($queueID));
+ }
+ WCF::getDB()->commitTransaction();
+ }
+
+ // remove package files
+ @unlink(TMP_DIR.'install/packages/'.$wcfPackageFile);
+ foreach ($otherPackages as $packageFile) {
+ @unlink(TMP_DIR.'install/packages/'.$packageFile);
+ }
+
+ // throw exception again
+ throw new SystemException('', 0, '', $e);
}
$queue = PackageInstallationQueueEditor::create(array(
SessionHandler::getInstance()->register('masterPassword', 1);
SessionHandler::getInstance()->update();
- // TODO: print message if delete fails
$installPhpDeleted = @unlink('./install.php');
$testPhpDeleted = @unlink('./test.php');
$wcfSetupTarDeleted = @unlink('./WCFSetup.tar.gz');
}
// TODO: use language variable
- $item->addInternalData('confirmMessage', 'Delete '.$count.' users?');
+ $item->addInternalData('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.user.confirmMessage', array('count' => $count)));
$item->addParameter('actionName', 'delete');
$item->addParameter('className', 'wcf\data\user\UserAction');
$item->setName('user.delete');
/**
* @see wcf\system\clipboard\action\IClipboardAction::getEditorLabel()
- * @todo use language variable
*/
public function getEditorLabel(array $objects) {
- $count = count($objects);
- if ($count == 1) {
- return 'One user marked';
- }
- else {
- return $count . ' users marked';
- }
+ return WCF::getLanguage()->getDynamicVariable('wcf.clipboard.user.marked', array('count' => count($objects)));
}
}
* @see wcf\system\option\IOptionType::getFormElement()
*/
public function getFormElement(Option $option, $value) {
- // TODO: Maybe show more digits after the comma?
$value = FileUtil::formatFileSize($value);
return parent::getFormElement($option, $value);
}
$options = $option->parseMultipleEnableOptions();
foreach ($options as $key => $optionData) {
- $tmp = explode(',', $optionData); // TODO: is either optionData an array or tmp?
+ $tmp = explode(',', $optionData);
foreach ($optionData as $item) {
if ($item{0} == '!') {
throw new SystemException("package date '".$element->nodeValue."' is invalid, violating ISO-8601 date format.");
}
- $this->packageInfo['date'] = strtotime($element->nodeValue) + 43201; // TODO: Is this even neccessary?
+ // TODO: Is this even neccessary?
+ //$this->packageInfo['date'] = strtotime($element->nodeValue) + 43201;
break;
}
}
*/
protected $staticIncludes = array();
- /**
- * list of previously included namespaces
- * @var array<string>
- */
- protected $includedNamespaces = array();
-
/**
* Creates a new TemplateScriptingCompiler object.
*
);
}
else {
- $this->includedNamespaces = $this->staticIncludes = array();
+ $this->staticIncludes = array();
}
// reset vars
if (count($this->autoloadPlugins) > 0) {
$compiledAutoloadPlugins = "<?php\n";
foreach ($this->autoloadPlugins as $className) {
- // prevent multiple use on the same namespace
- if (!in_array($className, $this->includedNamespaces)) {
- // TODO: We're using the classes with prepended namespace, why should we first
- // import them with "use" for no reason?
- //$compiledAutoloadPlugins .= "use ".$className.";\n";
- $this->includedNamespaces[] = $className;
- }
-
$compiledAutoloadPlugins .= "if (!isset(\$this->pluginObjects['$className'])) {\n";
$compiledAutoloadPlugins .= "\$this->pluginObjects['$className'] = new $className;\n";
$compiledAutoloadPlugins .= "}\n";
<?xml version="1.0" encoding="UTF-8"?>
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/language.xsd" languagecode="de" languagename="Deutsch">
+ <category name="wcf.clipboard">
+ <item name="wcf.clipboard.user.confirmMessage"><![CDATA[{if $count == 1}Einen{else}{#$count}{/if} Benutzer löschen?]]></item>
+ <item name="wcf.clipboard.user.marked"><![CDATA[{if $count == 1}Ein{else}{#$count}{/if} Benutzer markiert]]></item>
+ </category>
+
<category name="wcf.acp.cronjob">
<item name="wcf.acp.cronjob.list"><![CDATA[Cronjobs]]></item>
<item name="wcf.acp.cronjob.add"><![CDATA[Cronjob hinzufügen]]></item>
<?xml version="1.0" encoding="UTF-8"?>
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/language.xsd" languagecode="en" languagename="English">
+ <category name="wcf.clipboard">
+ <item name="wcf.clipboard.user.confirmMessage"><![CDATA[Delete {if $count == 1}one{else}{#$count}{/if} user{if $count > 1}s{/if}?]]></item>
+ <item name="wcf.clipboard.user.marked"><![CDATA[{if $count == 1}One{else}{#$count}{/if} user{if $count > 1}s{/if} marked]]></item>
+ </category>
+
<category name="wcf.acp.cronjob">
<item name="wcf.acp.cronjob.list"><![CDATA[Cron jobs]]></item>
<item name="wcf.acp.cronjob.add"><![CDATA[Add a new cron job]]></item>