Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit ee3ed51

Browse files
author
Charles Ma
committed
BUG: fixed bug #302 Notification class + trailling spaces
1 parent abf1912 commit ee3ed51

File tree

3 files changed

+53
-52
lines changed

3 files changed

+53
-52
lines changed

core/AppController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public function preDispatch()
4545
$this->view->metaDescription = Zend_Registry::get('configGlobal')->application->description;
4646
$this->view->metaKeywords = Zend_Registry::get('configGlobal')->application->keywords;
4747

48-
// init notifier
49-
Zend_Registry::set('notifier', new MIDAS_Notifier());
50-
5148
// Set the version
5249
$this->view->version = '3.0.0';
5350
if(isset(Zend_Registry::get('configDatabase')->version))
@@ -199,6 +196,10 @@ public function preDispatch()
199196
Zend_Registry::set('userSession', null);
200197
}
201198

199+
// init notifier
200+
Zend_Registry::set('notifier', new MIDAS_Notifier($this->logged, $this->userSession));
201+
202+
202203
$this->view->lang = Zend_Registry::get('configGlobal')->application->lang;
203204
//create a global javascript json array
204205
$jsonGlobal = array(

core/controllers/components/DemoComponent.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,127 +12,127 @@
1212

1313
/** Demo management Componenet */
1414
class DemoComponent extends AppComponent
15-
{
15+
{
1616
/** reset database (only works with mysql)*/
1717
public function reset()
1818
{
1919
if(Zend_Registry::get('configGlobal')->demomode != 1)
2020
{
2121
throw new Zend_Exception("Please enable demo mode");
2222
}
23-
24-
$db = Zend_Registry::get('dbAdapter');
23+
24+
$db = Zend_Registry::get('dbAdapter');
2525
$dbname = Zend_Registry::get('configDatabase')->database->params->dbname;
26-
27-
$stmt = $db->query("SELECT * FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = '".$dbname."'");
26+
27+
$stmt = $db->query("SELECT * FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = '".$dbname."'");
2828
while($row = $stmt->fetch())
2929
{
30-
$db->query("DELETE FROM `".$row['TABLE_NAME']."`");
30+
$db->query("DELETE FROM `".$row['TABLE_NAME']."`");
3131
}
3232

3333
$path = BASE_PATH.'/data/assetstore';
3434
$dir = opendir($path);
35-
while($entry = readdir($dir))
36-
{
35+
while($entry = readdir($dir))
36+
{
3737
if(is_dir($path.'/'.$entry) && !in_array($entry, array('.', '..')))
3838
{
3939
$this->_rrmdir($path.'/'.$entry);
4040
}
4141
}
42-
42+
4343
$path = BASE_PATH.'/data/thumbnail';
4444
$dir = opendir($path);
45-
while($entry = readdir($dir))
46-
{
45+
while($entry = readdir($dir))
46+
{
4747
if(is_dir($path.'/'.$entry) && !in_array($entry, array('.', '..')))
4848
{
4949
$this->_rrmdir($path.'/'.$entry);
5050
}
5151
}
52-
52+
5353
if(file_exists(BASE_PATH.'/core/configs/ldap.local.ini'))
5454
{
5555
unlink(BASE_PATH.'/core/configs/ldap.local.ini');
5656
}
57-
57+
5858
$modelLoad = new MIDAS_ModelLoader();
5959
$userModel = $modelLoad->loadModel('User');
6060
$communityModel = $modelLoad->loadModel('Community');
6161
$assetstoreModel = $modelLoad->loadModel('Assetstore');
6262
$admin = $userModel->createUser('admin@kitware.com', 'admin', 'Demo', 'Administrator', 1);
6363
$user = $userModel->createUser('user@kitware.com', 'user', 'Demo', 'User', 0);
64-
64+
6565
$communityDao = $communityModel->createCommunity('Demo', "This is a Demo Community", MIDAS_COMMUNITY_PUBLIC, $admin, MIDAS_COMMUNITY_CAN_JOIN);
66-
66+
6767
$assetstoreDao = new AssetstoreDao();
6868
$assetstoreDao->setName('Default');
6969
$assetstoreDao->setPath(BASE_PATH.'/data/assetstore');
7070
$assetstoreDao->setType(MIDAS_ASSETSTORE_LOCAL);
71-
$assetstoreModel->save($assetstoreDao);
72-
71+
$assetstoreModel->save($assetstoreDao);
72+
7373
$applicationConfig = parse_ini_file(BASE_PATH.'/core/configs/application.ini', true);
74-
$applicationConfig['global']['defaultassetstore.id'] = $assetstoreDao->getKey();
75-
$applicationConfig['global']['demomode'] = true;
76-
$applicationConfig['global']['environment'] = 'development';
77-
$applicationConfig['global']['application.name'] = 'MIDAS - Demo';
78-
$applicationConfig['global']['application.description'] = 'MIDAS integrates multimedia server technology with Kitware?s open-source data analysis and visualization clients. The server follows open standards for data storage, access and harvesting';
79-
$applicationConfig['global']['application.keywords'] = 'demonstration, data management, visualization';
80-
74+
$applicationConfig['global']['defaultassetstore.id'] = $assetstoreDao->getKey();
75+
$applicationConfig['global']['demomode'] = true;
76+
$applicationConfig['global']['environment'] = 'development';
77+
$applicationConfig['global']['application.name'] = 'MIDAS - Demo';
78+
$applicationConfig['global']['application.description'] = 'MIDAS integrates multimedia server technology with Kitware?s open-source data analysis and visualization clients. The server follows open standards for data storage, access and harvesting';
79+
$applicationConfig['global']['application.keywords'] = 'demonstration, data management, visualization';
80+
8181
$enabledModules = array('visualize', 'oai', 'metadataextractor', 'api', 'scheduler', 'thumbnailcreator', 'statistics');
82-
82+
8383
foreach($enabledModules as $module)
8484
{
8585
if(file_exists(BASE_PATH.'/core/configs/'.$module.'.demo.local.ini'))
8686
{
8787
copy(BASE_PATH.'/core/configs/'.$module.'.demo.local.ini', BASE_PATH.'/core/configs/'.$module.'.local.ini');
88-
$applicationConfig['module'][$module] = true;
88+
$applicationConfig['module'][$module] = true;
8989
}
9090
else
9191
{
9292
unlink(BASE_PATH.'/core/configs/'.$module.'.local.ini');
9393
}
9494
}
95-
95+
9696
require_once BASE_PATH.'/core/controllers/components/UtilityComponent.php';
9797
$utilityComponent = new UtilityComponent();
9898
$utilityComponent->createInitFile(BASE_PATH.'/core/configs/application.local.ini', $applicationConfig);
99-
99+
100100
$configGlobal = new Zend_Config_Ini(APPLICATION_CONFIG, 'global', true);
101101
Zend_Registry::set('configGlobal', $configGlobal);
102-
102+
103103
require_once BASE_PATH.'/core/controllers/components/UploadComponent.php';
104104
$uploadCompoenent = new UploadComponent();
105105
$item = $uploadCompoenent->createUploadedItem($admin, 'midasLogo.gif', BASE_PATH.'/core/public/images/midasLogo.gif', $communityDao->getPublicFolder());
106106
$item = $uploadCompoenent->createUploadedItem($admin, 'cow.vtp', BASE_PATH.'/core/public/demo/cow.vtp', $communityDao->getPublicFolder());
107107
}
108-
108+
109109
/** recursively delete a folder*/
110-
private function _rrmdir($dir)
111-
{
110+
private function _rrmdir($dir)
111+
{
112112
if(!file_exists($dir))
113113
{
114114
return;
115115
}
116-
if(is_dir($dir))
117-
{
118-
$objects = scandir($dir);
116+
if(is_dir($dir))
117+
{
118+
$objects = scandir($dir);
119119
}
120120

121-
foreach($objects as $object)
122-
{
123-
if($object != "." && $object != "..")
124-
{
121+
foreach($objects as $object)
122+
{
123+
if($object != "." && $object != "..")
124+
{
125125
if(filetype($dir."/".$object) == "dir")
126126
{
127127
$this->_rrmdir($dir."/".$object);
128128
}
129-
else
129+
else
130130
{
131-
unlink($dir."/".$object);
131+
unlink($dir."/".$object);
132132
}
133-
}
134-
}
135-
reset($objects);
136-
rmdir($dir);
133+
}
134+
}
135+
reset($objects);
136+
rmdir($dir);
137137
}
138138
} // end class

core/models/pdo/UserModel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,17 @@ function getAdmins()
125125
$sql = $this->database->select();
126126
$sql ->where('admin = ?', 1);
127127

128-
$rowset = $this->database->fetchAll($sql);
128+
$rowset = $this->database->fetchAll($sql);
129129
$return = array();
130130
foreach($rowset as $row)
131-
{
131+
{
132132
$return[] = $this->initDao('User', $row);
133133
}
134134
return $return;
135135
} // end getAll()
136-
137136

138-
137+
138+
139139
/** Returns a user given its folder (either public,private or base folder) */
140140
function getByFolder($folder)
141141
{

0 commit comments

Comments
 (0)