This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Re-arranging some other items for a webroot migration

This enhances the security of CiiMS by forcing all public data into a single directory, rather than the Yii default of storing all data in /
  • Loading branch information...
charlesportwoodii committed Aug 21, 2015
1 parent 875e525 commit 4ec138e310c6d94e43c73abcd1f76d25986a4170
View
@@ -1,6 +1,7 @@
.AppleDouble
public_html
/assets/*
/web/assets/*
/vendor/*
/themes/*
/protected/runtime/*
@@ -10,6 +11,7 @@ public_html
!/themes/default
/protected/modules/*
/uploads/*
/web/uploads/*
.htaccess
*.*~
*.swp
View
@@ -38,7 +38,7 @@ install:
before_script:
- mysql -e 'create database ciims_travis;'
- php index.php installer index --dbHost=127.0.0.1 --dbName=ciims_travis --dbUsername=root --dbPassword="" --adminEmail="travis@ciims.io" --adminPassword=travis --adminUsername=travis --siteName="CiiMS - Travis CI" --force=0 --writeConfig=1 --debug=1
- php web/index.php installer index --dbHost=127.0.0.1 --dbName=ciims_travis --dbUsername=root --dbPassword="" --adminEmail="travis@ciims.io" --adminPassword=travis --adminUsername=travis --siteName="CiiMS - Travis CI" --force=0 --writeConfig=1 --debug=1
after_failure: # Upload the application.log on failure
- "bundle exec travis-artifacts upload --path protected/runtime/application.log"
View
@@ -15,8 +15,8 @@ modules:
PhpBrowser:
url: http://localhost:8234
Yii1:
appPath: test.php
url: http://localhost:8234/test.php
appPath: web/test.php
url: http://localhost:8234/web/test.php
Db:
dsn: 'mysql:host=127.0.0.1;dbname=ciims_travis'
user: 'root'
View
@@ -70,10 +70,10 @@
"yiqing-95/YiiTimeAgo": "dev-master",
"charlesportwoodii/eanalytics": "1.1.5",
"charlesportwoodii/yii-newrelic": "1.0.1",
"charlesportwoodii/cii": "1.0.25",
"charlesportwoodii/cii": "dev-webroot",
"ciims-themes/default": "3.0.20",
"ciims-modules/dashboard": "3.0.26",
"ciims-modules/api": "2.0.22",
"ciims-modules/dashboard": "dev-webroot",
"ciims-modules/api": "dev-webroot",
"ciims-modules/install": "2.0.12",
"ciims-modules/hybridauth": "2.0.6",
"ciims-plugins/awsuploader": "1.0.3",
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -54,6 +54,9 @@
),
),
'components' => array(
'themeManager' => array(
'basePath' => (__DIR__ . DS . '..' . DS . '..' . DS . 'themes')
),
'messages' => array(
'class' => 'vendor.charlesportwoodii.cii.components.CiiPHPMessageSource'
),
@@ -234,7 +234,7 @@ public function beforeValidate()
$emailSettings->send(
$this,
Yii::t('ciims.models.Users', 'CiiMS Password Change Notification'),
'webroot.themes.' . Cii::getConfig('theme', 'default') .'.views.email.passwordchange',
'base.themes.' . Cii::getConfig('theme', 'default') .'.views.email.passwordchange',
array('user' => $this)
);
}
@@ -308,7 +308,7 @@ public function sendVerificationEmail()
return $emailSettings->send(
$this->_user,
Yii::t('ciims.models.Users', 'CiiMS Email Change Notification'),
'webroot.themes.' . Cii::getConfig('theme', 'default') .'.views.email.email-change',
'base.themes.' . Cii::getConfig('theme', 'default') .'.views.email.email-change',
array(
'key' => $this->setNewEmailChangeKey(),
'user' => $this->_user
@@ -138,7 +138,7 @@ public function save($sendEmail = true)
// Send the registration email
$emailSettings = new EmailSettings;
$emailSettings->send($this->_user, Yii::t('ciims.email','Activate Your Account'), 'webroot.themes.' . Cii::getConfig('theme', 'default') .'.views.email.register', array('user' => $this->_user, 'hash' => $meta->value), true, true);
$emailSettings->send($this->_user, Yii::t('ciims.email','Activate Your Account'), 'base.themes.' . Cii::getConfig('theme', 'default') .'.views.email.register', array('user' => $this->_user, 'hash' => $meta->value), true, true);
}
return true;
@@ -56,20 +56,20 @@ public function getThemes()
{
$themes = array();
$currentTheme = Cii::getConfig('theme');
$directories = glob(Yii::getPathOfAlias('webroot.themes') . DIRECTORY_SEPARATOR . "*", GLOB_ONLYDIR);
$themePath = Yii::getPathOfAlias('base.themes') . DS;
$directories = glob($themePath . "*", GLOB_ONLYDIR);
// Pushes the current theme onto the top of the list
foreach ($directories as $k=>$dir)
{
if ($dir == Yii::getPathOfAlias('webroot.themes').DS.$currentTheme)
if ($dir == Yii::getPathOfAlias('base.themes').DS.$currentTheme)
{
unset($directories[$k]);
break;
}
}
array_unshift($directories, Yii::getPathOfAlias('webroot.themes').DS.$currentTheme);
array_unshift($directories, $themePath.$currentTheme);
foreach($directories as $dir)
{
@@ -1,4 +1,4 @@
<?php //[STAMP] f0251ffa443e47d398b617dad0c97c61
<?php //[STAMP] 8f3d3bf1a5a647f9a018eba2e02a7efd
namespace _generated;
// This class was automatically generated by build task
@@ -1,4 +1,4 @@
<?php //[STAMP] 9b3d39522621b1db5970c714b7151b6d
<?php //[STAMP] 237e375c7afe2fbf979d474651420522
namespace _generated;
// This class was automatically generated by build task
@@ -1,4 +1,4 @@
<?php //[STAMP] 7de15de425a51bedb75c16e2282eecd3
<?php //[STAMP] 7d4e64ce13b8a91f836e205fb90e8ea2
namespace _generated;
// This class was automatically generated by build task
@@ -12,18 +12,16 @@ class UserModelTest extends \Codeception\TestCase\Test
public function _before()
{
$model = new Users;
$model->attributes = array(
$this->user = new Users;
$this->user->attributes = array(
'email' => 'example@ciims.io',
'password' => 'example_password',
'username' => 'example_user',
'user_role' => '9',
'status' => '1',
);
$model->save();
$this->user = $this->getUserModel();
$this->assertTrue($this->user->save());
}
private function getUserModel()
@@ -33,7 +31,7 @@ private function getUserModel()
public function _after()
{
$this->user->delete();
$this->assertTrue($this->user->delete());
}
public function testUserCreate()
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,10 +8,11 @@
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
defined('BASEDIR') or define('BASEDIR', __DIR__ . DS . '..' . DS);
// Bypass Yiic entirely and use this instead as the cli bootstrapper
if (php_sapi_name() === 'cli')
return require __DIR__.DS.'protected'.DS.'yiic.php';
return require BASEDIR.'protected'.DS.'yiic.php';
// Disable Error Reporting and set some constants
error_reporting(0);
@@ -23,8 +24,8 @@
if (!isset($_SERVER['CIIMS_ENV']))
$_SERVER['CIIMS_ENV'] = 'main';
$config = __DIR__.DS.'protected'.DS.'config'.DS.$_SERVER['CIIMS_ENV'].'.php';
$defaultConfig=__DIR__.DS.'protected'.DS.'config'.DS.'main.default.php';
$config = BASEDIR.'protected'.DS.'config'.DS.$_SERVER['CIIMS_ENV'].'.php';
$defaultConfig = BASEDIR.'protected'.DS.'config'.DS.'main.default.php';
// If we don't have a configuration file, run the installer.
if (!file_exists($config) && file_exists('install.php'))
@@ -41,18 +42,19 @@
$defaultConfig = require($defaultConfig);
// Include the composer dependencies
require_once __DIR__.DS.'vendor'.DS.'autoload.php';
require_once __DIR__.DS.'vendor'.DS.'yiisoft'.DS.'yii'.DS.'framework'.DS.(YII_DEBUG ? 'yii.php' : 'yiilite.php');
require_once BASEDIR.'vendor'.DS.'autoload.php';
require_once BASEDIR.'vendor'.DS.'yiisoft'.DS.'yii'.DS.'framework'.DS.(YII_DEBUG ? 'yii.php' : 'yiilite.php');
Yii::setPathOfAlias('vendor', __DIR__.DS.'vendor');
Yii::setPathOfAlias('vendor', BASEDIR.'vendor');
Yii::setPathOfAlias('base', BASEDIR);
Yii::setPathOfAlias('ext.yiinfinite-scroll.YiinfiniteScroller', Yii::getPathOfAlias('vendor.charlesportwoodii.ciinfinite-scroll.YiinfiniteScroller'));
// Merge it with our default config file
$config = CMap::mergeArray($defaultConfig, $config);
// Include the ClassMap for enhanced performance if we're not in debug mode
if (!YII_DEBUG)
require_once __DIR__.DS.'protected'.DS.'config'.DS.'classmap.php';
require_once BASEDIR.'protected'.DS.'config'.DS.'classmap.php';
$config['components']['db']['enableProfiling'] = YII_DEBUG;
$config['components']['db']['enableParamLogging'] = YII_DEBUG;
@@ -10,14 +10,15 @@
*/
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
defined('BASEDIR') or define('BASEDIR', __DIR__ . DS . '..' . DS);
error_reporting(-1);
ini_set('display_errors', 'true');
$yiiPath = __DIR__.DS.'vendor'.DS.'yiisoft'.DS.'yii'.DS.'framework'.DS.'yiilite.php';
require_once __DIR__.DS.'vendor'.DS.'autoload.php';
$yiiPath = BASEDIR.'vendor'.DS.'yiisoft'.DS.'yii'.DS.'framework'.DS.'yiilite.php';
require_once BASEDIR.'vendor'.DS.'autoload.php';
$config=dirname(__FILE__).'/protected/config/install.php';
$mainConfig = dirname(__FILE__).'/protected/config/main.php';
$config = BASEDIR.'protected'.DS.'config'.DS.'install.php';
$mainConfig = BASEDIR.'protected'.DS.'config'.DS.'main.php';
$ciimsConfig = require($config);
defined('YII_DEBUG') or define('YII_DEBUG',true);
@@ -30,7 +31,8 @@
}
require_once($yiiPath);
Yii::setPathOfAlias('vendor', BASEDIR.'vendor');
Yii::setPathOfAlias('base', BASEDIR);
Yii::setPathOfAlias('vendor', __DIR__.DS.'vendor');
$app = Yii::createWebApplication($config);
$app->run();
File renamed without changes.
View
@@ -7,19 +7,22 @@
// Definitions
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
defined('BASEDIR') or define('BASEDIR', __DIR__ . DS . '..' . DS);
defined('YII_DEBUG') or define('YII_DEBUG',true);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
if (!isset($_SERVER['CIIMS_ENV']))
$_SERVER['CIIMS_ENV'] = 'main';
$config = require __DIR__.DS.'protected'.DS.'config'.DS.$_SERVER['CIIMS_ENV'].'.php';
$defaultConfig = require __DIR__.DS.'protected'.DS.'config'.DS.'main.default.php';
$config = require BASEDIR.'protected'.DS.'config'.DS.$_SERVER['CIIMS_ENV'].'.php';
$defaultConfig = require BASEDIR.'protected'.DS.'config'.DS.'main.default.php';
// Load Yii and Composer extensions
require_once __DIR__.DS.'vendor'.DS.'yiisoft'.DS.'yii'.DS.'framework'.DS.'yii.php';
require_once __DIR__.DS.'vendor'.DS.'autoload.php';
Yii::setPathOfAlias('vendor', __DIR__.DS.'vendor');
require_once BASEDIR.'vendor'.DS.'yiisoft'.DS.'yii'.DS.'framework'.DS.'yii.php';
require_once BASEDIR.'vendor'.DS.'autoload.php';
Yii::setPathOfAlias('vendor', BASEDIR.'vendor');
Yii::setPathOfAlias('base', BASEDIR);
Yii::setPathOfAlias('ext.yiinfinite-scroll.YiinfiniteScroller', Yii::getPathOfAlias('vendor.charlesportwoodii.ciinfinite-scroll.YiinfiniteScroller'));
$config = CMap::mergeArray($defaultConfig, $config);
File renamed without changes.

0 comments on commit 4ec138e

Please sign in to comment.