Skip to content

Commit 4043d95

Browse files
committed
Merge branch '3.1'
2 parents 16f1ae2 + adab1db commit 4043d95

File tree

651 files changed

+121875
-7914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

651 files changed

+121875
-7914
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ app/config/bootstrap.local.php
55
app/config/guard.php
66
app/config/database.php
77
app/config/config.local.php
8-
8+
app/webroot/apc.php
99
dist
1010
build/api/
1111
build/code-browser/

Boxfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
web1:
2+
name: ipeer
3+
document_root: app/webroot
4+
shared_writable_dirs:
5+
- app/tmp/cache
6+
- app/tmp/logs
7+
- app/tmp/sessions
8+
- app/tmp/tests
9+
- app/tmp
10+
php_extensions:
11+
- gd
12+
- mcrypt
13+
- apc
14+
- mysql
15+
- mbstring
16+
php_display_errors: "0"
17+
after_build:
18+
- "mv app/config/database.pagoda.php app/config/database.php"
19+
- "mv app/plugins/guard/config/guard.php app/config/guard.php"
20+
cron:
21+
- "*/15 * * * *": "cake/console/cake send_emails"
22+
db1:
23+
name: ipeerdb
24+
type: mysql

app/app_controller.php

+38
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
App::import('Lib', 'toolkit');
1414
App::import('Lib', 'breadcrumb');
1515

16+
/**
17+
* _t
18+
* because CakePHP 1.3's internationalization __() call is stupid and wants
19+
* you to pass an extra parameter for no reason to get a string, use this
20+
* instead.
21+
*
22+
* @param mixed $str
23+
*
24+
* @access public
25+
* @return void
26+
*/
27+
function _t($str) {
28+
return __($str, true);
29+
}
30+
1631
/**
1732
* AppController the base controller
1833
*
@@ -30,6 +45,7 @@ class AppController extends Controller
3045
public $access = array ();
3146
public $actionList = array ();
3247
public $breadcrumb;
48+
public $validTZ;
3349

3450
/**
3551
* if this request has session transfer data
@@ -51,6 +67,7 @@ class AppController extends Controller
5167
public function __construct()
5268
{
5369
parent::__construct();
70+
$this->validTZ = array_flip(DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC));
5471
}
5572

5673
/**
@@ -61,6 +78,18 @@ public function __construct()
6178
*/
6279
public function beforeFilter()
6380
{
81+
$timezone = $this->SysParameter->findByParameterCode('system.timezone');
82+
// default to UTC if no timezone is set
83+
if (!(empty($timezone) || empty($timezone['SysParameter']['parameter_value']))) {
84+
$timezone = $timezone['SysParameter']['parameter_value'];
85+
// check that the timezone is valid
86+
if (isset($this->validTZ[$timezone])) {
87+
date_default_timezone_set($timezone);
88+
} else {
89+
$this->Session->setFlash(__('An invalid timezone is provided, please edit "system.timezone"', true));
90+
}
91+
}
92+
6493
$this->Auth->autoRedirect = false;
6594
// backward compatible with original ipeer hash method
6695
Security::setHash('md5');
@@ -97,6 +126,14 @@ public function beforeFilter()
97126
$this->_checkDatabaseVersion();
98127
}
99128

129+
// for setting up google analytics
130+
$trackingId = $this->SysParameter->findByParameterCode('google_analytics.tracking_id');
131+
$domain = $this->SysParameter->findByParameterCode('google_analytics.domain');
132+
$customLogo = $this->SysParameter->findByParameterCode('banner.custom_logo');
133+
$this->set('trackingId', $trackingId);
134+
$this->set('domain', $domain);
135+
$this->set('customLogo', $customLogo);
136+
100137
parent::beforeFilter();
101138
}
102139

@@ -210,6 +247,7 @@ public function _afterLogin($isRedirect = true)
210247
// after login stuff
211248
$this->User->loadRoles(User::get('id'));
212249
$this->AccessControl->loadPermissions();
250+
$this->SysParameter->reload();
213251
//TODO logging!
214252
}
215253

app/config/bootstrap.php

+20-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,24 @@
4949
*
5050
*/
5151

52-
if(file_exists(dirname(__FILE__).'/bootstrap.local.php')) {
52+
if (file_exists(dirname(__FILE__).'/bootstrap.local.php')) {
5353
include('bootstrap.local.php');
5454
}
5555

56-
/**
56+
// because the installed.txt file has been moved from CONFIG to TMP
57+
// we need the following to move the file if the install.txt is still in the old
58+
// place
59+
if (!file_exists(dirname(__FILE__).'/../tmp/installed.txt') && file_exists(dirname(__FILE__).'/installed.txt')) {
60+
copy(dirname(__FILE__).'/installed.txt', dirname(__FILE__).'/../tmp/installed.txt');
61+
// in case we can't remove the old file, we will leave it there
62+
@unlink(dirname(__FILE__).'/installed.txt');
63+
} else if (!file_exists(dirname(__FILE__).'/../tmp/installed.txt') && !file_exists(dirname(__FILE__).'/installed.txt')) {
64+
define('IS_INSTALLED', 0);
65+
} else {
66+
define('IS_INSTALLED', 1);
67+
}
68+
69+
/**
5770
* Create an empty database.php file if one isn't found.
5871
*
5972
* This lets us remove database.php from version control. This was a bit of
@@ -65,3 +78,8 @@
6578
$fd = fopen(CONFIGS.'database.php', 'x');
6679
fclose($fd);
6780
}
81+
82+
require_once(CONFIGS.'database.php');
83+
if (!defined('DB_PREDEFINED')) {
84+
define('DB_PREDEFINED', false);
85+
}

app/config/core.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@
319319
/**
320320
* iPeer database version
321321
*/
322-
Configure::write('DATABASE_VERSION', 4);
322+
Configure::write('DATABASE_VERSION', 6);
323323

324324

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

345-
define('IPEER_VERSION', '3.0.9');
345+
define('IPEER_VERSION', '3.1.0');
346346

347347

348348
/**

app/config/database.pagoda.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
define("DB_HOST", $_SERVER['DB1_HOST']);
3+
define("DB_NAME", $_SERVER['DB1_NAME']);
4+
define("DB_USER", $_SERVER['DB1_USER']);
5+
define("DB_PASS", $_SERVER['DB1_PASS']);
6+
define("DB_PREDEFINED", true);
7+
8+
class DATABASE_CONFIG
9+
{
10+
public $default = array(
11+
'driver' => 'mysql',
12+
'connect' => 'mysql_pconnect',
13+
'host' => DB_HOST,
14+
'login' => DB_USER,
15+
'password' => DB_PASS,
16+
'database' => DB_NAME,
17+
'prefix' => ''
18+
);
19+
}

app/config/routes.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
* is directed to the installation page. Setup normal router otherwise.
2929
*
3030
* iPeer is considered to be installed if the text file installed.txt
31-
* is located in the CONFIGS directory.
31+
* is located in the TMP directory.
3232
* */
3333

34-
if (file_exists(CONFIGS.'installed.txt')) {
34+
if (IS_INSTALLED) {
3535
// Disable access to the installer by redirecting all attempts to access
3636
// the installer to the index page. Except for install5, which is needed
3737
// to tell the user that an install was successful.

app/config/sql/delta_5.sql

-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ ALTER TABLE `surveys` CHANGE `created` `created` DATETIME NULL DEFAULT NULL, C
379379
ALTER TABLE `surveys` CHARACTER SET = utf8 , CHANGE COLUMN `name` `name` VARCHAR(255) NOT NULL ;
380380
ALTER TABLE `surveys` ADD `availability` VARCHAR( 10 ) NOT NULL DEFAULT 'public' AFTER `name`;
381381

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

0 commit comments

Comments
 (0)