Abrir el archivo de configuración (usar primer parámetro como ruta)
486477
def abrir_conf(config_file, debug=False):
    ""
    # en principio, usar el nombre de archivo predeterminado
    # si se pasa el archivo de configuración por parámetro, confirmar que exista
    # y descartar que sea una opción
    if len(sys.argv)>1:
        if os.path.splitext(sys.argv[1])[1].lower() == ".ini":
            config_file = sys.argv.pop(1)
    if not os.path.exists(config_file) or not os.path.isfile(config_file):
        warnings.warn("Archivo de configuracion %s invalido" % config_file)

    if debug: print "CONFIG_FILE:", config_file
    
    config = SafeConfigParser()
    config.read(config_file)

    return config
1184866
function() {

			// Construimos los atributos en base a la localización

			var attr = Public.unbuild(this._attributes, this.location);

			// Si no se encuentra disponible la instancia localización

			if (!(this.location instanceof Public))

				// La dirección será externa si tiene definido el atributo `protocol` o `host`

				return (attr.protocol || attr.host) ? true : false;

			// La URL será externa si `protocol` o `host` no coincide con el de localización

			return (this.location.attr('protocol') !== attr.protocol || this.location.attr('host') !== attr.host);

		}
497181
public function preparar()
    {
        if (!$this->preparada) {
            // Validamos requisitos míminos
            if (!isset($this->dirApp)) {
                throw new \RuntimeException('Todavía no define directorio base de la aplicacion.');
            }

            // Validamos presencia de rutas
            if (!isset($this->archivoRutas)) {
                $this->archivoRutas = $this->dirApp . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'rutas.php';
            }
            if (!is_file($this->archivoRutas)) {
                throw new \RuntimeException('No fue encontrado el archivo de rutas.');
            }

            // Preparamos enrutador
            $this->enrutador = new Enrutador();
            $this->enrutador->definirUriBase($this->uriBase);
            $this->enrutador->importarRutas(require $this->archivoRutas);

            // Preparamos gestores de errores
            $this->whoops = new Run();
            $this->whoops->pushHandler(new PrettyPageHandler());
            $this->whoops->writeToOutput(false);
            $this->whoops->allowQuit(false);

            set_error_handler(function($nivel, $mensaje, $archivo, $lineaArchivo){
                throw new \ErrorException($mensaje, 0, $nivel, $archivo, $lineaArchivo);
            });
            register_shutdown_function(function(){
                $error = error_get_last();
                if (is_array($error)) {
                    throw new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
                }
            });

            // Establecemos que la aplicación ya está preparada
            $this->preparada = true;
        }
    }
677480
public function syntax()
	{
		// Get files
		$status = $this->mechanism->status();
		$files  = (isset($status['added']) || isset($status['modified'])) ? array_merge($status['added'], $status['modified']) : array();

		// Whether or not to scan untracked files
		if (!$this->arguments->getOpt('exclude-untracked'))
		{
			$files = (isset($status['untracked'])) ? array_merge($files, $status['untracked']) : $files;
		}

		// Did we find any files?
		if ($files && count($files) > 0)
		{
			// Base standards directory
			if (!$standards = Config::get('repository_standards_dir'))
			{
				$this->output
				     ->addSpacer()
				     ->addLine('You must specify your standards directory first via:')
				     ->addLine(
						'muse configuration set --repository_standards_dir=/path/to/standards',
						array(
							'indentation' => '2',
							'color'       => 'blue'
						)
					)
					->addSpacer()
					->error("Error: failed to retrieve standards directory.");
			}
			else
			{
				$standards = rtrim($standards, DS) . DS . 'HubzeroCS';
			}

			// See what branch we're on, and set standards directory accordingly
			$branch = $this->mechanism->getMechanismVersionName();
			$branch = str_replace('.', '', $branch);
			if (!is_dir($standards . $branch))
			{
				$this->output->error('A standards directory for the current branch does not exist');
			}

			if ($this->arguments->getOpt('no-linting') && $this->arguments->getOpt('no-sniffing'))
			{
				$this->output->addLine('No sniffing or linting...that means we\'re not doing anything!', 'warning');
			}

			foreach ($files as $file)
			{
				$this->output->addString("Scanning {$file}...");
				$passed = true;
				$base   = $this->mechanism->getBasePath();
				$base   = rtrim($base, DS) . DS;

				// Lint files with php extension
				if (!$this->arguments->getOpt('no-linting'))
				{
					if (substr($file, -4) == '.php')
					{
						$cmd = "php -l {$base}{$file}";
						exec($cmd, $output, $code);
						if ($code !== 0)
						{
							$passed = false;
							$this->output->addLine("failed php linter", array('color'=>'red'));
						}
					}
				}

				// Now run them through PHP code sniffer
				if (!$this->arguments->getOpt('no-sniffing'))
				{
					// Append specific standard (with branchname) to command
					$cmd    = "php " . PATH_CORE . DS . 'bin' . DS . "phpcs --standard={$standards}{$branch}/ruleset.xml -n {$base}{$file}";
					$cmd    = escapeshellcmd($cmd);
					$result = shell_exec($cmd);

					if (!empty($result))
					{
						$passed = false;
						$this->output->addLine($result, array('color'=>'red'));
					}
				}

				// Did it all pass?
				if ($passed)
				{
					$this->output->addLine('clear');
				}
			}
		}
		else
		{
			$this->output->addLine('No files to scan');
		}
	}
1247715
public function writeConfiguration()
    {
        $configFile= APP_PATH.'config/database.php';
        $config    = $this->getPostConfiguration();

        $configStr = <<<CONFIG
<?php

\$config['database'] = array(
    'default'       => '{$config['driver']}',

    'connections'   => array(
        '{$config['driver']}'     => array(
            'driver'    => '{$config['driver']}',
            'host'      => isset(\$_SERVER['DB1_HOST']) ? \$_SERVER['DB1_HOST'] : '{$config['host']}',
            'database'  => isset(\$_SERVER['DB1_NAME']) ? \$_SERVER['DB1_NAME'] : '{$config['database']}',
            'username'  => isset(\$_SERVER['DB1_USER']) ? \$_SERVER['DB1_USER'] : '{$config['username']}',
            'password'  => isset(\$_SERVER['DB1_PASS']) ? \$_SERVER['DB1_PASS'] : '{$config['password']}',
            'charset'   => '{$config['charset']}',
            'collation' => '{$config['collation']}',
            'prefix'    => '{$config['prefix']}'
        )
    )
);
CONFIG;

        file_put_contents($configFile, $configStr);

        $this->makeConnection($config);
        $this->migrate();
        $this->seed();

        Response::redirect($this->data['baseUrl'].'install.php/finish');
    }
533515
public function findGeneralConfiguration(): array
    {
        /** @var array[] $configurationSets */
        $configurationSets = [[]];

        $modules = $this->packageRepository->findModules();
        foreach ($modules as $module) {
            $extra = $module->getExtra();
            $this->validateGeneralConfigurationSectionInExtra($extra);
            if (!isset($extra['phplist/core']['configuration'])) {
                continue;
            }

            $configurationSets[] = $extra['phplist/core']['configuration'];
        }

        return /** @scrutinizer ignore-call */ array_replace_recursive(...$configurationSets);
    }
351710
private final function build() {
        $temp = false;
        $str  = "";
        $tok  = explode("?", $this->sql);        

        try {
            //saber si la longitud de paramtros ? si son mayores que cero.
            $this->int = count($tok)-1 > 0 ? count($tok)-1 : 0;
               
            //saber si la longitud de interrogantes es igual a la longitud de parametros.
            if ($this->cima <= $this->int && $this->cima >= 0 && $this->list->lenght() <= $this->int) {

                //reemplasar interrogantes por parametros.
                for ($i = 0; $i <= $this->cima; $i++) {
                    $str = $str.$tok[$i].$this->list->shift().' ';
                }

                //saber si el remplaso fue exitoso.
                if (strlen($str) > 0) {
                    $this->generate  = $str;
                    $temp = true;
                }

            } else {
                die('Error longitud no admitida. ');
            }
            
        } catch (\Exception $exc) {
            $temp = false;
            
        } finally {
            return $temp;
            
        }
    }
1060102
private function getPostConfiguration()
    {
        $driver     = Input::post('dbdriver');
        $database   = Input::post('dbname');

        /**
         * point to APP_PATH/storage/db if driver is sqlite
         */
        if($driver == 'sqlite'){
            $database = APP_PATH.'storage/db/'.$database.'.sqlite';
        }

        return array(
            'driver'    => $driver,
            'host'      => Input::post('dbhost'),
            'database'  => $database,
            'username'  => Input::post('dbuser'),
            'password'  => Input::post('dbpass'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        );
    }
671211
private function copyCustomSystem()
    {
        //Para cada biblioteca
        foreach (Helper::listFolder(PATH_HOME . VENDOR) as $lib) {

            // copia tema caso não exista no projeto mas exista nas libs
            if (!file_exists(PATH_HOME . "public/assets/theme.min.css") && file_exists(PATH_HOME . VENDOR . $lib . "/public/assets/theme.min.css"))
                copy(PATH_HOME . VENDOR . $lib . "/public/assets/theme.min.css", PATH_HOME . "public/assets/theme.min.css");

            $libNot = Config::getMenuNotAllow();

            //Remove index caso alguma biblioteca já possua
            if (file_exists(PATH_HOME . VENDOR . $lib . "/public/view/index.php") && file_exists(PATH_HOME . "public/view/index.php")) {
                if (preg_match("/<h1>Parabéns, tudo funcionando de acordo!<\/h1>/i", file_get_contents(PATH_HOME . "public/view/index.php")) && (!isset($libNot) || !in_array($lib, $libNot))) {
                    unlink(PATH_HOME . "public/view/index.php");
                    unlink(PATH_HOME . "public/param/index.json");
                }
            }
        }
    }
317132
private function _errorConfig() {
        //error code config
        $error1 = (object) [
            'code' => 1,
            'resourceId' => false,
            'description' => 'Resource Not Found'
        ];

        $error2 = (object) [
            'code' => 2,
            'resourceId' => false,
            'description' => 'Circular Dependency Detected'
        ];

        $this->_errorCodes = [
            1 => $error1,
            2 => $error2
        ];
    }
811652
public static function getConfiguration(): array
    {
        static $configuration;
        if (\is_array($configuration)) {
            return $configuration;
        }
        if (VersionNumberUtility::convertVersionStringToArray(VersionNumberUtility::getCurrentTypo3Version())['version_main'] < 9) {
            $configuration = isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['staticfilecache']) ? (array)\unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['staticfilecache']) : [];
        } else {
            $configuration = (array)GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('staticfilecache');
        }

        return $configuration;
    }
599445
private function configureEnv() {
		if ($this->selfEdit) {
			chdir(__DIR__."/../../..");
			\putenv('COMPOSER=composer-mouf.json');
		} else {
			chdir(__DIR__."/../../../../../..");
		}
		
		$composerHome = getenv('COMPOSER_HOME');
		if (!$composerHome) {
			$composerTmpDir = sys_get_temp_dir().'/.mouf_composer/';
			if (function_exists('posix_getpwuid')) {
				$processUser = posix_getpwuid(posix_geteuid());
				$composerTmpDir .= $processUser['name'].'/';
			}
			\putenv('COMPOSER_HOME='.$composerTmpDir);
		}
		
	}
702147
protected function _prepareLayout()
    {
        $menu = [
            __d('installer', 'Welcome') => [
                'url' => ['plugin' => 'Installer', 'controller' => 'startup', 'action' => 'language'],
                'active' => ($this->request->action === 'language')
            ],
            __d('installer', 'System Requirements') => [
                'url' => ['plugin' => 'Installer', 'controller' => 'startup', 'action' => 'requirements'],
                'active' => ($this->request->action === 'requirements')
            ],
            __d('installer', 'License Agreement') => [
                'url' => ['plugin' => 'Installer', 'controller' => 'startup', 'action' => 'license'],
                'active' => ($this->request->action === 'license')
            ],
            __d('installer', 'Database Setup') => [
                'url' => ['plugin' => 'Installer', 'controller' => 'startup', 'action' => 'database'],
                'active' => ($this->request->action === 'database')
            ],
            __d('installer', 'Your Account') => [
                'url' => ['plugin' => 'Installer', 'controller' => 'startup', 'action' => 'account'],
                'active' => ($this->request->action === 'account')
            ],
            __d('installer', 'Finish') => [
                'url' => ['plugin' => 'Installer', 'controller' => 'startup', 'action' => 'finish'],
                'active' => ($this->request->action === 'finish')
            ],
        ];

        $this->set('menu', $menu);
    }
48094
private function init(){
        //Load Archivos de Funciones
        $this->loadFunctionsFiles();
        //Instancio el sistema de Cache
        $this->cache= new Support\Cache\Cache();
        //EnolaContext->init(): Cargo las configuraciones de contexto faltante
        $this->context->init();
        //Instancio el motor de Dependencias
        $this->dependenciesEngine= new Support\DependencyEngine\DependenciesEngine();
        //Cargo las librerias definidas por el usuario
        $this->loadLibraries();
    }
1111366
protected function getConfiguration()
    {
        return array(
            'minHeight' => 200,
            'toolbar' => array(),
            'buttons' => array('html', '|', 'formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'video', 'file', 'table', 'link', '|', 'alignment', '|', 'horizontalrule'),
            'buttonsAdd' => array(),
            'formattingTags' => array('p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4'),
            'buttonSource' => true,
            'iframe' => false,
            'fullpage' => false,
            'css' => false,
            'focus' => false,
            'shortcuts' => true,
            'autoresize' => true,
            'cleanup' => true,
            'toolbarFixed' => false,
            'toolbarFixedTopOffset' => 0,
            'toolbarFixedBox' => false,
            'toolbarFixedTarget' => 'document',
            'paragraphy' => true,
            'convertLinks' => true,
            'convertDivs' => true,
            'autosave' => false,
            'autosaveInterval' => 60,
            'modalOverlay' => true,
            'tabindex' => false,
            'observeImages' => true,
            'air' => false,
            'airButtons' => array('formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent'),
            'wym' => false,
            'mobile' => true,
            'linkProtocol' => 'http://',
            'placeholder' => false,
            'linebreaks' => false,
            'allowedTags' => false,
            'deniedTags' => array('html', 'head', 'link', 'body', 'meta', 'script', 'style', 'applet'),
            'boldTag' => 'strong',
            'italicTag' => 'em',
            'linkEmail' => false,
            'linkAnchor' => false,
            'formattingPre' => false,
            'phpTags' => false,
            'visual' => true,
            's3' => false,
            'tabFocus' => true,
            'removeEmptyTags' => true,
            'convertImageLinks' => false,
            'convertVideoLinks' => false,
            'pastePlainText' => false,
            'linkNoFollow' => false,
            'clipboardUpload' => true,
            'dragUpload' => true,
            'tidyHtml' => false,
            'imageFloatMargin' => '10px',
            'tabSpaces' => false,
            'observeLinks' => false,
            'plugins' => array(),
        );
    }
914794
private function createConfigFiles()
    {
        $moduleName = ucfirst($this->getModule());
        $moduleNameLower = strtolower($this->getModule());
        $moduleNameUpper = strtoupper($this->getModule());

        /* Criação do arquivo de configuração do módulo */
        $module_config_php = file_get_contents(dirname(__FILE__) . DS . 'Module' . DS . 'Module_config_php.tpl');
        $moduleConfigPhp = str_replace("%moduleNameUpper%", $moduleNameUpper, str_replace("%moduleName%", $moduleName, str_replace("%moduleNameLower%", $moduleNameLower, $module_config_php)));
        file_put_contents(MODULES_PATH . ucfirst($this->getModule()) . DS . 'config' . DS . 'module.config.php', "<?php\n\n".$moduleConfigPhp);
        chmod(MODULES_PATH . ucfirst($this->getModule()) . DS . 'config' . DS . 'module.config.php', 0644);

        /* Criação do arquivo de definição do módulo */
        $module_php = file_get_contents(dirname(__FILE__) . DS . 'Module' . DS . 'Module_php.tpl');
        $modulePhp = str_replace("%moduleNameUpper%", $moduleNameUpper, str_replace("%moduleName%", $moduleName, str_replace("%moduleNameLower%", $moduleNameLower, $module_php)));
        file_put_contents(MODULES_PATH . ucfirst($this->getModule()) . DS . 'Module.php', "<?php\n\n".$modulePhp);
        chmod(MODULES_PATH . ucfirst($this->getModule()) . DS . 'Module.php', 0644);
    }
149354
def ObtenerTablaParametros(self, tipo_recurso, sep="||"):
        ""        
        if not self.client:
            self.Conectar()
        self.response = self.client("parametros", "v1", tipo_recurso)
        result = json.loads(self.response)
        ret = {}
        if result['success']:
            data = result['data']
            # armo un diccionario con los datos devueltos:
            key = [k for k in data[0].keys() if k.startswith("id")][0]
            val = [k for k in data[0].keys() if k.startswith("desc")][0]
            for it in data:
                ret[it[key]] = it[val]
            self.data = data
        else:
            error = result['error']
            self.Excepcion = error['mensaje']
        if sep:
            return ["%s%%s%s%%s%s" % (sep, sep, sep) % it for it in sorted(ret.items())]
        else:
            return ret