Example #1
0
 /**
  * get wrapper
  *
  * @param $var
  * @return mixed
  */
 public static function get($var)
 {
     static $cfg;
     if (!$cfg) {
         $cfg = Config::loadConfig();
     }
     return isset($cfg[$var]) ? $cfg[$var] : null;
 }
Example #2
0
File: App.php Project: lerre/canphp
 /**
  * 初始化配置
  */
 protected static function init()
 {
     Config::init(BASE_PATH);
     Config::loadConfig(CONFIG_PATH . 'global.php');
     Config::loadConfig(CONFIG_PATH . Config::get('ENV') . '.php');
     date_default_timezone_set(Config::get('TIMEZONE'));
     //error display
     if (Config::get('DEBUG')) {
         ini_set("display_errors", 1);
         error_reporting(E_ALL ^ E_NOTICE);
     } else {
         ini_set("display_errors", 0);
         error_reporting(0);
     }
 }
Example #3
0
 /**
  * 
  */
 public function __construct()
 {
     $config = new Config();
     $config->loadConfig('config.yml');
     Service::set('config', $config);
     $request = new Request();
     Service::set('request', $request);
     $session = new Session();
     Service::set('session', $session);
     $routes = (include '../config/routes.php');
     $router = new Router($routes);
     Service::set('router', $router);
     Service::set('pdo', new \PDO($config->getVal('mysql/type') . ':host=' . $config->getVal('mysql/host') . ';dbname=' . $config->getVal('mysql/db'), $config->getVal('mysql/username'), $config->getVal('mysql/pass'), array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')));
     $log = new Log(URL . '/logs/log.txt');
     Service::set('log', $log);
     Service::set('user', new User());
 }
Example #4
0
/*
	This file is part of myTinyTodo.
	(C) Copyright 2009-2010 Max Pozdeev <maxpozdeev@gmail.com>
	Licensed under the GNU GPL v3 license. See file COPYRIGHT for details.
*/
if (!defined('MTTPATH')) {
    define('MTTPATH', dirname(__FILE__) . '/');
}
require_once MTTPATH . 'common.php';
require_once MTTPATH . 'db/config.php';
ini_set('display_errors', 0);
if (!isset($config)) {
    global $config;
}
Config::loadConfig($config);
unset($config);
date_default_timezone_set(Config::get('timezone'));
# MySQL Database Connection
if (Config::get('db') == 'mysql') {
    try {
        require_once MTTPATH . 'class.db.mysql.php';
        $db = DBConnection::init(new Database_Mysql());
        $db->connect(Config::get('mysql.host'), Config::get('mysql.user'), Config::get('mysql.password'), Config::get('mysql.db'));
        $db->dq("SET NAMES utf8");
    } catch (Exception $e) {
        die('Database connection error - check config file');
    }
} elseif (Config::get('db') == 'sqlite') {
    try {
        require_once MTTPATH . 'class.db.sqlite3.php';
Example #5
0
<?php

/* THIS FILE IS NOT MEANT FOR CUSTOMIZING.
 * PLEASE EDIT THE FOLLOWING TO CHANGE YOUR CONFIG:
 * /etc/airtime/airtime.conf
 * /etc/airtime/pypo.cfg
 * /etc/airtime/recorder.cfg
 */
global $CC_CONFIG;
$CC_CONFIG = array('tblNamePrefix' => 'cc_', 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A', 'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs', "rootDir" => __DIR__ . "/../..");
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
Config::loadConfig($configFile);
// Add database table names
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'] . 'playlist';
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'] . 'playlistcontents';
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'] . 'files';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'] . 'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'] . 'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'] . 'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'] . 'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'] . 'smemb';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'] . 'pref';
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'] . 'schedule';
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'] . 'playlisttimes';
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'] . 'show_schedule';
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'] . 'show_days';
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'] . 'show';
$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'] . 'show_instances';
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'] . '_id';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'] . '_id';
$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'] . '_id';
Example #6
0
<?php

/* THIS FILE IS NOT MEANT FOR CUSTOMIZING.
 * PLEASE EDIT THE FOLLOWING TO CHANGE YOUR CONFIG:
 * /etc/airtime/airtime.conf
 * /etc/airtime/pypo.cfg
 * /etc/airtime/recorder.cfg
 */
global $CC_CONFIG;
$CC_CONFIG = array('tblNamePrefix' => 'cc_', 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A', 'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs', "rootDir" => __DIR__ . "/../..", 'pearPath' => dirname(__FILE__) . '/../../library/pear', 'zendPath' => dirname(__FILE__) . '/../../library/Zend', 'phingPath' => dirname(__FILE__) . '/../../library/phing');
$CC_CONFIG = Config::loadConfig($CC_CONFIG);
// Add database table names
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'] . 'playlist';
$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'] . 'playlistcontents';
$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'] . 'files';
$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'] . 'access';
$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'] . 'perms';
$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'] . 'sess';
$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'] . 'subjs';
$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'] . 'smemb';
$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'] . 'pref';
$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'] . 'schedule';
$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'] . 'playlisttimes';
$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'] . 'show_schedule';
$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'] . 'show_days';
$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'] . 'show';
$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'] . 'show_instances';
$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'] . '_id';
$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'] . '_id';
$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'] . '_id';
$CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'] . '_id';
    if (!empty($extension_class_paths)) {
        $locations = array_merge(explode(',', $extension_class_paths), $locations);
    }
    // Check for the presense of this class in our all our directories.
    $fileName = $className . '.php';
    foreach ($locations as $path) {
        if (file_exists("{$basePath}/{$path}/{$fileName}")) {
            require "{$path}/{$fileName}";
            break;
        }
    }
}
set_include_path(get_include_path() . PATH_SEPARATOR . realpath('.') . PATH_SEPARATOR . realpath('./external'));
error_reporting(E_ALL | E_STRICT);
require_once 'src/common/Config.php';
Config::loadConfig('test');
require_once 'test/TestContext.php';
if (defined('PHPUnit_MAIN_METHOD') === false) {
    define('PHPUnit_MAIN_METHOD', 'ShindigAllTests::main');
}
$_SERVER["HTTP_HOST"] = 'localhost';
class ShindigAllTests
{
    public static function main()
    {
        PHPUnit_TextUI_TestRunner::run(self::suite(), array());
    }
    public static function suite()
    {
        $suite = new PHPUnit_Framework_TestSuite();
        $suite->setName('Shindig');