Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

Commit

Permalink
Restructured the directory layout fit the typical vendor directory la…
Browse files Browse the repository at this point in the history
…yout.
  • Loading branch information
nirix committed Oct 30, 2012
1 parent a2bfc6f commit 2b4a8c3
Show file tree
Hide file tree
Showing 196 changed files with 30 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
system/config/database.php
vendor/traq/config/database.php
.sass-cache
.DS_Store
.project
.settings
.buildpath
.buildpath
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "system/avalon"]
path = system/avalon
[submodule "vendor/avalon"]
path = vendor/avalon
url = git://github.com/nirix/avalon.git
8 changes: 4 additions & 4 deletions css.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}

// Fetch the request class.
require "./system/avalon/http/request.php";
require "./vendor/avalon/http/request.php";
use avalon\http\Request;

$output = array();
Expand All @@ -57,9 +57,9 @@
$theme = htmlspecialchars($_REQUEST['theme']);
foreach (explode(',', $_REQUEST['theme']) as $file) {
// Check if the file exists...
if (file_exists(__DIR__ . "/system/views/{$theme}/css/{$file}.css")) {
if (file_exists(__DIR__ . "/vendor/traq/views/{$theme}/css/{$file}.css")) {
// Add it to the output array.
$output[] = file_get_contents(__DIR__ . "/system/views/{$theme}/css/{$file}.css");
$output[] = file_get_contents(__DIR__ . "/vendor/traq/views/{$theme}/css/{$file}.css");
}
}
}
Expand All @@ -74,4 +74,4 @@
$output = preg_replace('/\s*(,|;|:|{|})\s*/', '$1', $output);

// Minify the CSS.
echo str_replace(array("\t", "\n"), '', $output);
echo str_replace(array("\t", "\n"), '', $output);
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
define('START_TIME', microtime(true));
define('START_MEM', memory_get_usage());

require dirname(__FILE__) . '/system/bootstrap.php';
require dirname(__FILE__) . '/vendor/bootstrap.php';

use avalon\core\Kernel as Avalon;

Avalon::init();
Avalon::run();
Avalon::run();
6 changes: 3 additions & 3 deletions install/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

define("APPPATH", dirname(__FILE__));
define("SYSPATH", dirname(__DIR__) . '/system/avalon');
define("SYSPATH", dirname(__DIR__) . '/vendor/avalon');

require SYSPATH . '/autoloader.php';

Expand All @@ -29,7 +29,7 @@

require 'nanite.php';
require SYSPATH . '/libs/fishhook.php';
require '../system/models/user.php';
require '../vendor/traq/models/user.php';
require 'common.php';

use avalon\output\View;
Expand Down Expand Up @@ -61,4 +61,4 @@ public static function halt($title, $message)
View::set('message', $message);
die(render('error'));
}
}
}
42 changes: 14 additions & 28 deletions install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
use avalon\output\View;

// Make sure the config file doesn't exist...
if (file_exists('../system/config/database.php'))
{
if (file_exists('../vendor/traq/config/database.php')) {
Error::halt('Error', 'Config file already exists.');
}

Expand All @@ -46,30 +45,25 @@
post('/step/2', function(){
// Check for form errors
$errors = array();
foreach (array('type', 'host', 'username', 'database') as $field)
{
if ($_POST[$field] == '')
{
foreach (array('type', 'host', 'username', 'database') as $field) {
if ($_POST[$field] == '') {
$errors[$field] = true;
}
}

View::set('errors', $errors);

// Fix the errors
if (count($errors))
{
if (count($errors)) {
View::set('title', 'Step 1 - Database Details');
render('database_config');
}
// Make sure there's no Traq installed here with the same table prefix
else if (false and is_installed(array_merge(array('driver' => 'pdo'), $_POST)))
{
else if (false and is_installed(array_merge(array('driver' => 'pdo'), $_POST))) {
Error::halt('Error', 'Traq is already installed.');
}
// Confirm details
else
{
else {
// Store DB info in the session
$_SESSION['db'] = array(
'driver' => 'pdo',
Expand All @@ -94,24 +88,20 @@
post('/step/3', function(){
// Check for form errors
$errors = array();
foreach (array('username', 'name', 'password', 'email') as $field)
{
if ($_POST[$field] == '')
{
foreach (array('username', 'name', 'password', 'email') as $field) {
if ($_POST[$field] == '') {
$errors[$field] = true;
}
}

// Fix the errors
if (count($errors))
{
if (count($errors)) {
View::set('title', 'Step 2 - Admin Account');
View::set('errors', $errors);
render('admin_account');
}
// Setup the database
else
{
else {
$conn = Database::factory($_SESSION['db'], 'main');

// Fetch the install SQL.
Expand Down Expand Up @@ -140,25 +130,21 @@
$config = array();
$config[] = '<?php';
$config[] = '$db = array(';
foreach (array('driver', 'type', 'host', 'username', 'password', 'database', 'prefix') as $key)
{
foreach (array('driver', 'type', 'host', 'username', 'password', 'database', 'prefix') as $key) {
$config[] = ' \'' . $key . '\' => "' . $_SESSION['db'][$key] . '",';

}
$config[] = ');';
$config = implode(PHP_EOL, $config);

// Write the config to file
if(!file_exists('../system/config/database.php') and is_writable('../system/config'))
{
$handle = fopen('../system/config/database.php', 'w+');
if(!file_exists('../vendor/traq/config/database.php') and is_writable('../vendor/traq/config')) {
$handle = fopen('../vendor/traq/config/database.php', 'w+');
fwrite($handle, $config);
fclose($handle);
$config_created = true;
}
// Tell the user how to create the config file
else
{
else {
View::set('config_code', $config);
$config_created = false;
}
Expand Down
4 changes: 2 additions & 2 deletions install/views/done.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<?php } else { ?>
<div align="center">
The installer was unable to create the config file,
You will need to save the code below to: <code>system/config/database.php</code>
You will need to save the code below to: <code>vendor/traq/config/database.php</code>
</div>
<br />
<pre id="config_code">
<?php echo htmlentities($config_code); ?>
</pre>
<?php } ?>
<?php } ?>
Submodule avalon updated from 000000 to f6f8f0
2 changes: 1 addition & 1 deletion system/bootstrap.php → vendor/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

// Define the paths needed
define("SYSPATH", dirname(__FILE__) . '/avalon');
define("APPPATH", dirname(__FILE__));
define("APPPATH", dirname(__FILE__) . '/traq');
define("DOCROOT", dirname(dirname(__FILE__)));

// Load the framework
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2b4a8c3

Please sign in to comment.