Ejemplo n.º 1
0
 public static function processUploadFile(&$pParamHash)
 {
     $pParamHash['config_log'] = array();
     if (YamlConfig::verifyUpload($pParamHash)) {
         foreach ($pParamHash['upload_process'] as $file) {
             if ($hash = Horde_Yaml::loadFile($file['tmp_name'])) {
                 // deal with anything that might be in this hash
                 // @Todo probably want to move this out of here eventually
                 // kernel_config settings
                 if (!empty($hash['kernel_config'])) {
                     // parser is a little annoying when it comes to n and y - it reinterprets them as FALSE and TRUE
                     // we're lazy and dont want to regex the dump so lets try just flipping them back
                     foreach ($hash['kernel_config'] as $pkg => $data) {
                         foreach ($hash['kernel_config'][$pkg] as $config => $value) {
                             if ($value === TRUE || $value === FALSE) {
                                 $hash['kernel_config'][$pkg][$config] = $value ? 'y' : 'n';
                             }
                         }
                     }
                     $pParamHash['config_data']['kernel_config'] = $hash['kernel_config'];
                     // store the configurations
                     YamlConfig::setKernelConfig($pParamHash);
                 }
                 // themes_layouts settings
                 if (!empty($hash['themes_layouts'])) {
                     $pParamHash['config_data']['themes_layouts'] = $hash['themes_layouts'];
                     // store the configurations
                     YamlConfig::setThemesLayouts($pParamHash);
                 }
                 // users_permissions settings
                 if (!empty($hash['users_permissions'])) {
                     $pParamHash['config_data']['users_permissions'] = $hash['users_permissions'];
                     // store the configurations
                     YamlConfig::setUsersPermissions($pParamHash);
                 }
             }
         }
     } else {
         $pParamHash['config_log']['ERRORS'] = "Upload verification failed. " . $pParamHash['errors']['files'];
     }
     return empty($pParamHash['errors']) || count($pParamHash['errors']) == 0;
 }