Beispiel #1
0
 private function onCustomizeExtraFields()
 {
     if ($this->_realAccessLevel < ACCESS_LEVEL_SA) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
         return;
         //$this->fatal(ERROR_NO_PERMISSION);
     }
     $extraFieldsMaintScript = $this->getTrimmedInput('commandList', $_POST);
     $extraFieldsMaintScriptArray = explode(',', $extraFieldsMaintScript);
     foreach ($extraFieldsMaintScriptArray as $index => $commandEncoded) {
         $command = urldecode($commandEncoded);
         $args = explode(' ', $command);
         if (!isset($args[0])) {
             continue;
         }
         switch ($args[0]) {
             case 'ADDFIELD':
                 $args = explode(' ', $command, 4);
                 $extraFields = new ExtraFields($this->_siteID, intval($args[1]));
                 $extraFields->define(urldecode($args[3]), intval($args[2]));
                 break;
             case 'DELETEFIELD':
                 $args = explode(' ', $command, 3);
                 $extraFields = new ExtraFields($this->_siteID, intval($args[1]));
                 $extraFields->remove(urldecode($args[2]));
                 break;
             case 'ADDOPTION':
                 $args = explode(' ', $command, 3);
                 $args2 = explode(':', $args[2]);
                 $extraFields = new ExtraFields($this->_siteID, intval($args[1]));
                 $extraFields->addOptionToColumn(urldecode($args2[0]), urldecode($args2[1]));
                 break;
             case 'DELETEOPTION':
                 $args = explode(' ', $command, 3);
                 $args2 = explode(':', $args[2]);
                 $extraFields = new ExtraFields($this->_siteID, intval($args[1]));
                 $extraFields->deleteOptionFromColumn(urldecode($args2[0]), urldecode($args2[1]));
                 break;
             case 'SWAPFIELDS':
                 $args = explode(' ', $command, 3);
                 $args2 = explode(':', $args[2]);
                 $extraFields = new ExtraFields($this->_siteID, intval($args[1]));
                 $extraFields->swapColumns(urldecode($args2[0]), urldecode($args2[1]));
                 break;
             case 'RENAMEROW':
                 $args = explode(' ', $command, 3);
                 $args2 = explode(':', $args[2]);
                 $extraFields = new ExtraFields($this->_siteID, intval($args[1]));
                 $extraFields->renameColumn(urldecode($args2[0]), urldecode($args2[1]));
                 break;
         }
     }
     CATSUtility::transferRelativeURI('m=settings&a=customizeExtraFields');
 }