getConfig() public static method

Return the global configuration, merged with all user related configurations.
public static getConfig ( ) : Kimai_Config
return Kimai_Config
Ejemplo n.º 1
0
Archivo: View.php Proyecto: kimai/kimai
 public function init()
 {
     $this->setBasePath(APPLICATION_PATH . '/templates/');
     $this->addHelperPath(APPLICATION_PATH . '/templates/helpers/', 'Zend_View_Helper');
     $this->addHelperPath(APPLICATION_PATH . '/libraries/Kimai/View/Helper/', 'Kimai_View_Helper');
     parent::init();
     $kga = Kimai_Registry::getConfig();
     $this->assign('kga', $kga);
 }
Ejemplo n.º 2
0
Archivo: Skin.php Proyecto: kimai/kimai
 /**
  * @return string
  */
 public function getName()
 {
     if (null === $this->skinName) {
         $skin = Kimai_Config::getDefault(Kimai_Config::DEFAULT_SKIN);
         $kga = Kimai_Registry::getConfig();
         if (!empty($kga->getSettings()->getSkin())) {
             $skin = $kga->getSettings()->getSkin();
         } else {
             if (!empty($kga->getSkin())) {
                 $skin = $kga->getSkin();
             }
         }
         $this->skinName = $this->view->escape($skin);
     }
     return $this->skinName;
 }
Ejemplo n.º 3
0
Archivo: func.php Proyecto: kimai/kimai
/**
 * @param $database
 * @param $hostname
 * @param $username
 * @param $password
 * @param $charset
 * @param $prefix
 * @param $lang
 * @param $salt
 * @param $timezone
 * @return bool
 */
function write_config_file($database, $hostname, $username, $password, $charset, $prefix, $lang, $salt, $timezone = null)
{
    $kga = Kimai_Registry::getConfig();
    $database = addcslashes($database, '"$');
    $hostname = addcslashes($hostname, '"$');
    $username = addcslashes($username, '"$');
    $password = addcslashes($password, '"$');
    $file = fopen(realpath(dirname(__FILE__)) . '/autoconf.php', 'w');
    if (!$file) {
        return false;
    }
    // fallback if timezone was not provided
    if (!empty($timezone)) {
        $timezone = addcslashes($timezone, '"$');
        $timezone = '"' . $timezone . '"';
    } else {
        if (isset($kga['defaultTimezone'])) {
            $timezone = '"' . $kga['defaultTimezone'] . '"';
        } else {
            $timezone = 'date_default_timezone_get()';
        }
    }
    // fetch skin from global config with "standard" fallback
    $skin = !empty($kga->getSkin()) ? $kga->getSkin() : Kimai_Config::getDefault(Kimai_Config::DEFAULT_SKIN);
    $billable = !empty($kga->getBillable()) ? var_export($kga->getBillable(), true) : var_export(Kimai_Config::getDefault(Kimai_Config::DEFAULT_BILLABLE), true);
    $authenticator = !empty($kga->getAuthenticator()) ? $kga->getAuthenticator() : Kimai_Config::getDefault(Kimai_Config::DEFAULT_AUTHENTICATOR);
    $lang = !empty($lang) ? $lang : Kimai_Config::getDefault(Kimai_Config::DEFAULT_LANGUAGE);
    $config = <<<EOD
<?php
/**
 * This file is part of
 * Kimai - Open Source Time Tracking // http://www.kimai.org
 * (c) Kimai-Development-Team since 2006
 *
 * Kimai is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; Version 3, 29 June 2007
 *
 * Kimai is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimai; If not, see <http://www.gnu.org/licenses/>.
 */

// This file was automatically generated by the installer

\$server_hostname = "{$hostname}";
\$server_database = "{$database}";
\$server_username = "******";
\$server_password = "******";
\$server_charset = "{$charset}";
\$server_prefix = "{$prefix}";
\$language = "{$lang}";
\$password_salt = "{$salt}";
\$defaultTimezone = {$timezone};
\$skin = "{$skin}";
\$authenticator = "{$authenticator}";
\$billable = {$billable};

EOD;
    fputs($file, $config);
    fclose($file);
    return true;
}