mirror of
https://github.com/jimeh/zynapse.git
synced 2026-02-19 07:06:39 +00:00
Initial import of old legacy Zynapse Framework,
untouched since early 2008.
This commit is contained in:
103
config/boot.php
Normal file
103
config/boot.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Zynapse Boot
|
||||
- final base setup and zynapse initialization
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// include required environment setup
|
||||
require_once(dirname(__FILE__).'/environment.php');
|
||||
|
||||
|
||||
// include shell script enviroment settings
|
||||
if ( defined('ZNAP_SHELL_SCRIPT') && is_file(dirname(__FILE__).'/environments/_shell.php') ) {
|
||||
require_once(dirname(__FILE__).'/environments/_shell.php');
|
||||
}
|
||||
|
||||
|
||||
// set zynapse root path
|
||||
if ( !defined('ZNAP_ROOT') ) {
|
||||
define('ZNAP_ROOT', dirname(dirname(__FILE__)));
|
||||
}
|
||||
|
||||
|
||||
// find zynapse libs
|
||||
if ( !empty($zynapse_libs) && is_file($zynapse_libs.'/zynapse.php') ) {
|
||||
define('ZNAP_LIB_ROOT', $zynapse_libs);
|
||||
} elseif ( is_file(ZNAP_ROOT.'/vendor/zynapse/zynapse.php') ) {
|
||||
define('ZNAP_LIB_ROOT', ZNAP_ROOT.'/vendor/zynapse');
|
||||
} elseif ( is_file(dirname(ZNAP_ROOT).'/vendor/zynapse/zynapse.php') ) {
|
||||
define('ZNAP_LIB_ROOT', dirname(ZNAP_ROOT).'/vendor/zynapse');
|
||||
}
|
||||
|
||||
|
||||
// figure out environment related settings
|
||||
if ( defined('ZNAP_SHELL_SCRIPT') ) {
|
||||
$environment = $shell_environment;
|
||||
} elseif ( !empty($_SERVER['ZNAP_ENV']) ) {
|
||||
$environment = $_SERVER['ZNAP_ENV'];
|
||||
} elseif ( $enable_advanced_host_config == true && ($current_config = match_host($host_config)) !== false ) {
|
||||
if ( !empty($current_config['environment']) ) $environment = $current_config['environment'];
|
||||
if ( !empty($current_config['mode']) ) $mode = $current_config['mode'];
|
||||
if ( !empty($current_config['root']) ) {
|
||||
if ( !empty($_SERVER['REQUEST_URI']) ) $_SERVER['REQUEST_URI'] = '/'.$current_config['root'].$_SERVER['REQUEST_URI'];
|
||||
if ( !empty($_SERVER['REDIRECT_URL']) ) $_SERVER['REDIRECT_URL'] = '/'.$current_config['root'].$_SERVER['REDIRECT_URL'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// define environment and display mode
|
||||
define('ZNAP_ENV', $environment);
|
||||
define('ZNAP_MODE', $mode);
|
||||
|
||||
|
||||
// include environment specific settings
|
||||
if ( is_file(dirname(__FILE__).'/environments/'.ZNAP_ENV.'.php') ) {
|
||||
include_once(dirname(__FILE__).'/environments/'.ZNAP_ENV.'.php');
|
||||
}
|
||||
|
||||
|
||||
// set url prefix if needed
|
||||
if ( !empty($url_prefix) ) {
|
||||
define('URL_PREFIX', $url_prefix);
|
||||
}
|
||||
|
||||
|
||||
// php error logging
|
||||
define('ZNAP_ENABLE_LOGGING', $enable_logging);
|
||||
define('ZNAP_INTERNAL_LOGGING', $internal_logging);
|
||||
|
||||
|
||||
// include and initialize main zynapse class
|
||||
require_once(ZNAP_LIB_ROOT.'/zynapse.php');
|
||||
Znap::initialize();
|
||||
if ( !empty($timer_enabled) || ZNAP_ENV != 'production' ) {
|
||||
Znap::start_timer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// function to get all matched host settings
|
||||
function match_host ($list = array()) {
|
||||
if ( is_array($list) && !empty($list) ) {
|
||||
$new_config = array();
|
||||
foreach( $list as $host => $settings ) {
|
||||
$regex = preg_quote($host, '/');
|
||||
$regex = str_replace('\*', '.*', $regex);
|
||||
$http_host = (substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.') ? substr($_SERVER['HTTP_HOST'], 4) : $_SERVER['HTTP_HOST'] ;
|
||||
if ( preg_match('/^'.$regex.'$/i', $http_host) ) {
|
||||
foreach( $settings as $key => $value ) {
|
||||
if ( !array_key_exists($key, $new_config) ) {
|
||||
$new_config[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (!empty($new_config)) ? $new_config : false ;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
40
config/database.php
Normal file
40
config/database.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Database configuration
|
||||
- only mysql is supported at this time
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$database_settings = array(
|
||||
|
||||
// database settings for development environment
|
||||
'development' => array(
|
||||
'host' => 'localhost',
|
||||
'database' => 'zynapse_development',
|
||||
'username' => 'devuser',
|
||||
'password' => 'devpass',
|
||||
'persistent' => true,
|
||||
'table_prefix' => '',
|
||||
),
|
||||
|
||||
// database settings for testing environment
|
||||
'test' => array(
|
||||
'use' => 'development',
|
||||
),
|
||||
|
||||
// database settings for production environment
|
||||
'production' => array(
|
||||
'host' => 'localhost',
|
||||
'database' => 'database_name',
|
||||
'username' => 'user',
|
||||
'password' => 'password',
|
||||
'persistent' => true,
|
||||
'table_prefix' => '',
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
72
config/environment.php
Normal file
72
config/environment.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Zynapse Environment
|
||||
- configure server environments and display modes
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
# default environment - overridden by $host_config
|
||||
# ( development | test | production )
|
||||
$environment = 'development';
|
||||
|
||||
|
||||
# default server display mode - overridden by $host_config
|
||||
$mode = 'web';
|
||||
|
||||
|
||||
# if you don't need any of the advanced host-specific
|
||||
# configuration features, you can disable it as it becomes
|
||||
# excess code which you don't need.
|
||||
$enable_advanced_host_config = true;
|
||||
|
||||
|
||||
# host configuration
|
||||
# - set environment, display mode, and root path for
|
||||
# specific hosts. available options are "environment",
|
||||
# "mode", and "root".
|
||||
$host_config = array(
|
||||
// 'zynapse' => array(
|
||||
//
|
||||
// ),
|
||||
// 'wap.zynapse' => array(
|
||||
// 'mode' => 'wap',
|
||||
// ),
|
||||
// 'admin.zynapse' => array(
|
||||
// 'root' => 'admin',
|
||||
// ),
|
||||
// 'zynapse.org' => array(
|
||||
// 'environment' => 'production',
|
||||
// ),
|
||||
// 'admin.zynapse.org' => array(
|
||||
// 'environment' => 'production',
|
||||
// 'root' => 'admin',
|
||||
// ),
|
||||
);
|
||||
|
||||
|
||||
# set custom path to zynapse libs
|
||||
$zynapse_libs = '';
|
||||
|
||||
|
||||
# Timer enabled in production environment?
|
||||
# - its always enabled in development and test environments
|
||||
$timer_enabled = false;
|
||||
|
||||
|
||||
# enable php error logging? - recommended
|
||||
$enable_logging = true;
|
||||
|
||||
# enable internal error logging? - recommended
|
||||
$internal_logging = true;
|
||||
|
||||
|
||||
# if zynapse's root is not the root of the server, define
|
||||
# the prefix path (without leading or trailing slashes).
|
||||
$url_prefix = '';
|
||||
|
||||
|
||||
|
||||
?>
|
||||
14
config/environments/_shell.php
Normal file
14
config/environments/_shell.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Zynapse Shell Script Environment
|
||||
- environment settings use by generate, migrate and other shell scripts
|
||||
|
||||
*/
|
||||
|
||||
# environment used by the shell scripts, modify accordingly to
|
||||
# the current environment the code is in
|
||||
# ( development | test | production )
|
||||
$shell_environment = 'development';
|
||||
|
||||
?>
|
||||
7
config/environments/development.php
Normal file
7
config/environments/development.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Development Environment Settings
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
7
config/environments/production.php
Normal file
7
config/environments/production.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Production Environment Settings
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
7
config/environments/test.php
Normal file
7
config/environments/test.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Test Environment Settings
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
21
config/routes.php
Normal file
21
config/routes.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Zynapse Routes
|
||||
- configure access urls
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// $router->connect('', array(':controller'=>'page'));
|
||||
$router->connect( 'page/:id([0-9]+)', array(':controller' => 'page', ':action' => 'view', 'test' => 'wiiee') );
|
||||
$router->connect( ':controller/:action/:id/:sort/:order' );
|
||||
|
||||
$router->connect( 'pages', array(':redirect_to' => '/page') );
|
||||
|
||||
|
||||
// default route
|
||||
$router->connect( ':controller/:action/:id' );
|
||||
|
||||
|
||||
?>
|
||||
18
config/strings/_global.php
Normal file
18
config/strings/_global.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Global Strings
|
||||
- language independent strings accessible directly from the
|
||||
point that Znap::initialize() is called
|
||||
|
||||
*/
|
||||
|
||||
$strings = array(
|
||||
|
||||
|
||||
// 'my_string' => 'some awesome text',
|
||||
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
46
config/strings/english.php
Normal file
46
config/strings/english.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
English Strings
|
||||
- default language strings
|
||||
|
||||
*/
|
||||
|
||||
$strings = array(
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Required Strings
|
||||
|
||||
*/
|
||||
|
||||
# local name ("Svenska" for Swedish for example)
|
||||
'_ZNAP_LANGUAGE' => 'English',
|
||||
|
||||
# short language name
|
||||
'_ZNAP_LANG' => 'en',
|
||||
|
||||
# language locale values
|
||||
'_ZNAP_LOCALE' => array('eng', 'en_US'),
|
||||
|
||||
# character encoding
|
||||
'_ZNAP_ENCODING' => 'utf-8',
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Custom Strings
|
||||
- add your custom strings here
|
||||
|
||||
*/
|
||||
|
||||
// 'my_string' => 'some awesome text',
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user