Skip to content

Commit

Permalink
Merge branch '3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
xcompass committed Jan 16, 2014
2 parents 16f1ae2 + adab1db commit 4043d95
Show file tree
Hide file tree
Showing 651 changed files with 121,875 additions and 7,914 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ app/config/bootstrap.local.php
app/config/guard.php
app/config/database.php
app/config/config.local.php

app/webroot/apc.php
dist
build/api/
build/code-browser/
Expand Down
24 changes: 24 additions & 0 deletions Boxfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
web1:
name: ipeer
document_root: app/webroot
shared_writable_dirs:
- app/tmp/cache
- app/tmp/logs
- app/tmp/sessions
- app/tmp/tests
- app/tmp
php_extensions:
- gd
- mcrypt
- apc
- mysql
- mbstring
php_display_errors: "0"
after_build:
- "mv app/config/database.pagoda.php app/config/database.php"
- "mv app/plugins/guard/config/guard.php app/config/guard.php"
cron:
- "*/15 * * * *": "cake/console/cake send_emails"
db1:
name: ipeerdb
type: mysql
38 changes: 38 additions & 0 deletions app/app_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
App::import('Lib', 'toolkit');
App::import('Lib', 'breadcrumb');

/**
* _t
* because CakePHP 1.3's internationalization __() call is stupid and wants
* you to pass an extra parameter for no reason to get a string, use this
* instead.
*
* @param mixed $str
*
* @access public
* @return void
*/
function _t($str) {
return __($str, true);
}

/**
* AppController the base controller
*
Expand All @@ -30,6 +45,7 @@ class AppController extends Controller
public $access = array ();
public $actionList = array ();
public $breadcrumb;
public $validTZ;

/**
* if this request has session transfer data
Expand All @@ -51,6 +67,7 @@ class AppController extends Controller
public function __construct()
{
parent::__construct();
$this->validTZ = array_flip(DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC));
}

/**
Expand All @@ -61,6 +78,18 @@ public function __construct()
*/
public function beforeFilter()
{
$timezone = $this->SysParameter->findByParameterCode('system.timezone');
// default to UTC if no timezone is set
if (!(empty($timezone) || empty($timezone['SysParameter']['parameter_value']))) {
$timezone = $timezone['SysParameter']['parameter_value'];
// check that the timezone is valid
if (isset($this->validTZ[$timezone])) {
date_default_timezone_set($timezone);
} else {
$this->Session->setFlash(__('An invalid timezone is provided, please edit "system.timezone"', true));
}
}

$this->Auth->autoRedirect = false;
// backward compatible with original ipeer hash method
Security::setHash('md5');
Expand Down Expand Up @@ -97,6 +126,14 @@ public function beforeFilter()
$this->_checkDatabaseVersion();
}

// for setting up google analytics
$trackingId = $this->SysParameter->findByParameterCode('google_analytics.tracking_id');
$domain = $this->SysParameter->findByParameterCode('google_analytics.domain');
$customLogo = $this->SysParameter->findByParameterCode('banner.custom_logo');
$this->set('trackingId', $trackingId);
$this->set('domain', $domain);
$this->set('customLogo', $customLogo);

parent::beforeFilter();
}

Expand Down Expand Up @@ -210,6 +247,7 @@ public function _afterLogin($isRedirect = true)
// after login stuff
$this->User->loadRoles(User::get('id'));
$this->AccessControl->loadPermissions();
$this->SysParameter->reload();
//TODO logging!
}

Expand Down
22 changes: 20 additions & 2 deletions app/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,24 @@
*
*/

if(file_exists(dirname(__FILE__).'/bootstrap.local.php')) {
if (file_exists(dirname(__FILE__).'/bootstrap.local.php')) {
include('bootstrap.local.php');
}

/**
// because the installed.txt file has been moved from CONFIG to TMP
// we need the following to move the file if the install.txt is still in the old
// place
if (!file_exists(dirname(__FILE__).'/../tmp/installed.txt') && file_exists(dirname(__FILE__).'/installed.txt')) {
copy(dirname(__FILE__).'/installed.txt', dirname(__FILE__).'/../tmp/installed.txt');
// in case we can't remove the old file, we will leave it there
@unlink(dirname(__FILE__).'/installed.txt');
} else if (!file_exists(dirname(__FILE__).'/../tmp/installed.txt') && !file_exists(dirname(__FILE__).'/installed.txt')) {
define('IS_INSTALLED', 0);
} else {
define('IS_INSTALLED', 1);
}

/**
* Create an empty database.php file if one isn't found.
*
* This lets us remove database.php from version control. This was a bit of
Expand All @@ -65,3 +78,8 @@
$fd = fopen(CONFIGS.'database.php', 'x');
fclose($fd);
}

require_once(CONFIGS.'database.php');
if (!defined('DB_PREDEFINED')) {
define('DB_PREDEFINED', false);
}
4 changes: 2 additions & 2 deletions app/config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
/**
* iPeer database version
*/
Configure::write('DATABASE_VERSION', 4);
Configure::write('DATABASE_VERSION', 6);


$CWL['LoginURL'] = 'https://www.auth.cwl.ubc.ca/auth/login';
Expand All @@ -342,7 +342,7 @@
$CWL['applicationID'] = '';
$CWL['applicationPassword'] = '';

define('IPEER_VERSION', '3.0.9');
define('IPEER_VERSION', '3.1.0');


/**
Expand Down
19 changes: 19 additions & 0 deletions app/config/database.pagoda.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
define("DB_HOST", $_SERVER['DB1_HOST']);
define("DB_NAME", $_SERVER['DB1_NAME']);
define("DB_USER", $_SERVER['DB1_USER']);
define("DB_PASS", $_SERVER['DB1_PASS']);
define("DB_PREDEFINED", true);

class DATABASE_CONFIG
{
public $default = array(
'driver' => 'mysql',
'connect' => 'mysql_pconnect',
'host' => DB_HOST,
'login' => DB_USER,
'password' => DB_PASS,
'database' => DB_NAME,
'prefix' => ''
);
}
4 changes: 2 additions & 2 deletions app/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* is directed to the installation page. Setup normal router otherwise.
*
* iPeer is considered to be installed if the text file installed.txt
* is located in the CONFIGS directory.
* is located in the TMP directory.
* */

if (file_exists(CONFIGS.'installed.txt')) {
if (IS_INSTALLED) {
// Disable access to the installer by redirecting all attempts to access
// the installer to the index page. Except for install5, which is needed
// to tell the user that an install was successful.
Expand Down
1 change: 0 additions & 1 deletion app/config/sql/delta_5.sql
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ ALTER TABLE `surveys` CHANGE `created` `created` DATETIME NULL DEFAULT NULL, C
ALTER TABLE `surveys` CHARACTER SET = utf8 , CHANGE COLUMN `name` `name` VARCHAR(255) NOT NULL ;
ALTER TABLE `surveys` ADD `availability` VARCHAR( 10 ) NOT NULL DEFAULT 'public' AFTER `name`;

ALTER TABLE `sys_parameters` CHARACTER SET = utf8, CHANGE `created` `created` DATETIME NULL DEFAULT NULL, CHANGE `modified` `modified` DATETIME NULL DEFAULT NULL ;
INSERT INTO `sys_parameters` VALUES (NULL, 'system.version', '3.0.0', 'S', 'System version', 'A', 1, NOW(), 1, NOW()),
(NULL, 'display.login.header', '', 'S', 'Login Info Header', 'A', 0, NOW(), 0, NOW()),
(NULL, 'display.login.footer', '', 'S', 'Login Info Footer', 'A', 0, NOW(), 0, NOW()),
Expand Down
Loading

0 comments on commit 4043d95

Please sign in to comment.