From: Marcel Werk Date: Sun, 29 Sep 2013 13:58:02 +0000 (+0200) Subject: Fixed user import issues X-Git-Tag: 2.0.0_Beta_10~14 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2ec5b95d223fc2978614e21c8dcc4feffa59ca96;p=GitHub%2FWoltLab%2FWCF.git Fixed user import issues --- diff --git a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php index 730b1323bb..75da10caf1 100644 --- a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php @@ -1,6 +1,7 @@ + */ + protected $userOptions = array(); + /** * Creates a new UserImporter object. */ @@ -43,6 +50,10 @@ class UserImporter extends AbstractImporter { while ($row = $statement->fetchArray()) { $this->eventIDs[] = $row['eventID']; } + + $userOptionList = new UserOptionList(); + $userOptionList->readObjects(); + $this->userOptions = $userOptionList->getObjects(); } /** @@ -81,6 +92,37 @@ class UserImporter extends AbstractImporter { $userOptions[$optionID] = $optionValue; } } + + // fix option values + foreach ($userOptions as $optionID => &$optionValue) { + switch ($this->userOptions[$optionID]->optionType) { + case 'boolean': + if ($optionValue) $optionValue = 1; + else $optionValue = 0; + break; + + case 'integer': + $optionValue = intval($optionValue); + if ($optionValue > 2147483647) $optionValue = 2147483647; + break; + + case 'float': + $optionValue = floatval($optionValue); + break; + + case 'textarea': + if (strlen($optionValue) > 16777215) $optionValue = substr($optionValue, 0, 16777215); + break; + + case 'birthday': + case 'date': + if (!preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $optionValue)) $optionValue = '0000-00-00'; + break; + + default: + if (strlen($optionValue) > 65535) $optionValue = substr($optionValue, 0, 65535); + } + } } // create user