@@ -25,9 +25,9 @@ public function preDispatch()
25
25
{
26
26
parent ::preDispatch ();
27
27
$ this ->view ->setEncoding ('iso-8859-1 ' );
28
-
29
- $ this ->view ->setScriptPath (BASE_PATH ."/core/views " );
30
-
28
+
29
+ $ this ->view ->setScriptPath (BASE_PATH ."/core/views " );
30
+
31
31
$ fc = Zend_Controller_Front::getInstance ();
32
32
$ module = $ fc ->getRequest ()->getModuleName ();
33
33
if ($ module == 'default ' )
@@ -38,34 +38,34 @@ public function preDispatch()
38
38
$ this ->view ->webroot = $ fc ->getBaseUrl ();
39
39
$ this ->coreWebroot = $ this ->view ->webroot .'/core ' ;
40
40
$ this ->view ->coreWebroot = $ this ->coreWebroot ;
41
-
41
+
42
42
$ this ->view ->demoMode = $ this ->isDemoMode ();
43
43
44
44
$ this ->view ->title = Zend_Registry::get ('configGlobal ' )->application ->name ;
45
45
$ this ->view ->metaDescription = Zend_Registry::get ('configGlobal ' )->application ->description ;
46
46
$ this ->view ->metaKeywords = Zend_Registry::get ('configGlobal ' )->application ->keywords ;
47
47
48
48
// init notifier
49
- Zend_Registry::set ('notifier ' , new MIDAS_Notifier ());
50
-
49
+ Zend_Registry::set ('notifier ' , new MIDAS_Notifier ());
50
+
51
51
// Set the version
52
52
$ this ->view ->version = '3.0.0 ' ;
53
53
if (isset (Zend_Registry::get ('configDatabase ' )->version ))
54
54
{
55
55
$ this ->view ->version = Zend_Registry::get ('configDatabase ' )->version ;
56
56
}
57
-
57
+
58
58
require_once BASE_PATH . '/core/models/dao/UserDao.php ' ;
59
59
require_once BASE_PATH . '/core/models/dao/ItemDao.php ' ;
60
60
//Init Session
61
61
if ($ fc ->getRequest ()->getActionName () != 'login ' || $ fc ->getRequest ()->getControllerName () != 'user ' )
62
62
{
63
- if (isset ($ _POST ['sid ' ]))
64
- {
65
- Zend_Session::setId ($ _POST ['sid ' ]);
63
+ if (isset ($ _POST ['sid ' ]))
64
+ {
65
+ Zend_Session::setId ($ _POST ['sid ' ]);
66
66
}
67
- Zend_Session::start ();
68
-
67
+ Zend_Session::start ();
68
+
69
69
// log in when testing
70
70
$ testingUserId = $ this ->_getParam ('testingUserId ' );
71
71
$ modelLoad = new MIDAS_ModelLoader ();
@@ -77,15 +77,15 @@ public function preDispatch()
77
77
if ($ user ->Dao == false )
78
78
{
79
79
throw new Zend_Exception ('Unable to find user ' );
80
- }
80
+ }
81
81
}
82
82
else
83
83
{
84
84
$ user = new Zend_Session_Namespace ('Auth_User ' );
85
85
}
86
-
86
+
87
87
if ($ user ->Dao == null )
88
- {
88
+ {
89
89
$ userModel = $ modelLoad ->loadModel ('User ' );
90
90
$ cookieData = $ this ->getRequest ()->getCookie ('midasUtil ' );
91
91
if (!empty ($ cookieData ))
@@ -101,7 +101,7 @@ public function preDispatch()
101
101
}
102
102
}
103
103
}
104
-
104
+
105
105
$ controllerName = $ fc ->getRequest ()->getControllerName ();
106
106
$ actionName = $ fc ->getRequest ()->getActionName ();
107
107
if ($ fc ->getRequest ()->getControllerName () == 'browse ' || $ fc ->getRequest ()->getControllerName () == 'download ' )
@@ -120,11 +120,11 @@ public function preDispatch()
120
120
if ($ user ->Dao != null && $ user ->Dao instanceof UserDao)
121
121
{
122
122
if ($ fc ->getRequest ()->getControllerName () != 'install ' && $ fc ->getRequest ()->getControllerName () != 'error ' && $ user ->Dao ->isAdmin ())
123
- {
123
+ {
124
124
if ($ this ->isUpgradeNeeded ())
125
125
{
126
126
$ this ->view ->needUpgrade = true ;
127
- }
127
+ }
128
128
$ errorlogModel = $ modelLoad ->loadModel ('Errorlog ' );
129
129
$ logs = $ errorlogModel ->getLog (date ('c ' , strtotime ("-24 hour " )), date ('c ' ), 'all ' , 'all ' );
130
130
foreach ($ logs as $ key => $ l )
@@ -140,19 +140,19 @@ public function preDispatch()
140
140
}
141
141
}
142
142
143
-
143
+
144
144
if (!empty ($ user ->uploaded ))
145
145
{
146
146
$ this ->view ->showUploadedLink = true ;
147
147
}
148
148
$ this ->logged = true ;
149
149
$ this ->view ->logged = true ;
150
-
150
+
151
151
$ this ->view ->userDao = $ user ->Dao ;
152
152
$ cookieData = $ this ->getRequest ()->getCookie ('recentItems ' .$ this ->userSession ->Dao ->user_id );
153
153
$ this ->view ->recentItems = array ();
154
154
if (isset ($ cookieData ) && file_exists (BASE_PATH .'/core/configs/database.local.ini ' )) //check if midas installed
155
- {
155
+ {
156
156
$ modelLoad = new MIDAS_ModelLoader ();
157
157
$ itemModel = $ modelLoad ->loadModel ('Item ' );
158
158
$ tmpRecentItems = unserialize ($ cookieData );
@@ -172,9 +172,9 @@ public function preDispatch()
172
172
}
173
173
}
174
174
175
- $ this ->view ->recentItems = $ recentItems ;
175
+ $ this ->view ->recentItems = $ recentItems ;
176
176
$ check = $ this ->_getParam ('checkRecentItem ' );
177
- }
177
+ }
178
178
$ user ->Dao ->lastAction = date ('c ' );
179
179
}
180
180
else
@@ -189,7 +189,7 @@ public function preDispatch()
189
189
$ this ->view ->logged = false ;
190
190
$ this ->logged = false ;
191
191
}
192
-
192
+
193
193
if (isset ($ user ))
194
194
{
195
195
Zend_Registry::set ('userSession ' , $ user );
@@ -198,7 +198,7 @@ public function preDispatch()
198
198
{
199
199
Zend_Registry::set ('userSession ' , null );
200
200
}
201
-
201
+
202
202
$ this ->view ->lang = Zend_Registry::get ('configGlobal ' )->application ->lang ;
203
203
//create a global javascript json array
204
204
$ jsonGlobal = array (
@@ -210,12 +210,12 @@ public function preDispatch()
210
210
"lang " => Zend_Registry::get ('configGlobal ' )->application ->lang ,
211
211
"Yes " => $ this ->t ('Yes ' ),
212
212
"No " => $ this ->t ('No ' ));
213
-
214
-
213
+
214
+
215
215
$ login = array (
216
216
"titleUploadLogin " => $ this ->t ('Please log in ' ),
217
217
"contentUploadLogin " => $ this ->t ('You need to be logged in to be able to upload files. ' ));
218
-
218
+
219
219
$ browse = array (
220
220
'view ' => $ this ->t ('View ' ),
221
221
'uploadIn ' => $ this ->t ('Upload here ' ),
@@ -238,10 +238,10 @@ public function preDispatch()
238
238
'copy ' => $ this ->t ('Copy ' ),
239
239
'element ' => $ this ->t ('element ' ),
240
240
'community ' => array (
241
-
241
+
242
242
'invit ' => $ this ->t ('Invite collaborators ' ),
243
243
'advanced ' => $ this ->t ('Advanced properties ' )));
244
-
244
+
245
245
$ feed = array (
246
246
"deleteFeed " => $ this ->t ('Do you really want to delete the feed ' ));
247
247
@@ -276,13 +276,13 @@ public function isTestingEnv()
276
276
{
277
277
return Zend_Registry::get ('configGlobal ' )->environment == 'testing ' ;
278
278
}
279
-
279
+
280
280
/** check if demo mode is set */
281
281
public function isDemoMode ()
282
282
{
283
283
return Zend_Registry::get ('configGlobal ' )->demomode == 1 ;
284
284
}
285
-
285
+
286
286
/** disable layout */
287
287
public function disableLayout ()
288
288
{
@@ -296,15 +296,15 @@ public function disableView()
296
296
{
297
297
$ this ->_helper ->viewRenderer ->setNoRender ();
298
298
}
299
-
299
+
300
300
/** check if midas needs to be upgraded */
301
301
public function isUpgradeNeeded ()
302
302
{
303
303
require_once BASE_PATH .'/core/controllers/components/UpgradeComponent.php ' ;
304
304
$ upgradeComponent = new UpgradeComponent ();
305
305
$ db = Zend_Registry::get ('dbAdapter ' );
306
306
$ dbtype = Zend_Registry::get ('configDatabase ' )->database ->adapter ;
307
-
307
+
308
308
$ upgradeComponent ->initUpgrade ('core ' , $ db , $ dbtype );
309
309
if ($ upgradeComponent ->getNewestVersion () != $ upgradeComponent ->transformVersionToNumeric (Zend_Registry::get ('configDatabase ' )->version ))
310
310
{
@@ -319,7 +319,7 @@ public function isUpgradeNeeded()
319
319
{
320
320
return true ;
321
321
}
322
- }
322
+ }
323
323
return false ;
324
324
}
325
325
@@ -430,6 +430,6 @@ protected function t($text)
430
430
* @var UserModelBase
431
431
*/
432
432
var $ User ;
433
-
433
+
434
434
/**end completion eclipse */
435
435
}//end class
0 commit comments