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

Commit 4ad1954

Browse files
author
Charles Ma
committed
ENH: refs #0301 Added remote script and backend
1 parent 8df8675 commit 4ad1954

File tree

32 files changed

+1091
-34
lines changed

32 files changed

+1091
-34
lines changed

core/GlobalController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class MIDAS_GlobalController extends Zend_Controller_Action
2323
/** contructor*/
2424
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
2525
{
26+
2627
if($this->isDebug())
2728
{
2829
$this->_controllerTimer = microtime(true);
@@ -201,6 +202,10 @@ public function loadElements()
201202
{
202203
$nameComponent = $component . "Component";
203204
Zend_Loader::loadClass($nameComponent, BASE_PATH . '/core/controllers/components');
205+
if(!class_exists($nameComponent))
206+
{
207+
throw new Zend_Exception('Unable to find '.$nameComponent);
208+
}
204209
@$this->Component->$component = new $nameComponent();
205210
}
206211
}
@@ -213,6 +218,10 @@ public function loadElements()
213218
$nameForm = $forms . "Form";
214219

215220
Zend_Loader::loadClass($nameForm, BASE_PATH . '/core/controllers/forms');
221+
if(!class_exists($nameForm))
222+
{
223+
throw new Zend_Exception('Unable to find '.$nameForm);
224+
}
216225
@$this->Form->$forms = new $nameForm();
217226
}
218227
}

core/constant/group.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
=========================================================================*/
1212

1313
define("MIDAS_GROUP_ANONYMOUS_KEY", 0);
14+
define("MIDAS_GROUP_SERVER_KEY", -1);
1415
?>

core/controllers/components/NotifyErrorComponent.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public function fatalEror($logger, $mailer)
5858
{
5959
$e['typeText'] = 'E_ERROR';
6060
}
61+
elseif($e['type'] == 4 )
62+
{
63+
$e['typeText'] = '4';
64+
}
6165
elseif($e['type'] == E_WARNING )
6266
{
6367
$e['typeText'] = 'E_WARNING';
@@ -92,6 +96,10 @@ public function fatalEror($logger, $mailer)
9296
{
9397
$e['typeText'] = 'E_ERROR';
9498
}
99+
elseif($e['type'] == 4 )
100+
{
101+
$e['typeText'] = '4';
102+
}
95103
elseif($e['type'] == E_WARNING )
96104
{
97105
$e['typeText'] = 'E_WARNING';

core/models/MIDASDatabasePdo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ protected function getLinkedObject($var, $dao)
155155
{
156156
$return[] = $model->initDao($this->_mainData[$var]['model'], $row);
157157
}
158+
158159
return $return;
159160
} //end getLinkedObject
160161

core/models/base/GroupModelBase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public function load($key = null)
4848
$dao->saved = true;
4949
return $dao;
5050
}
51+
elseif($key == MIDAS_GROUP_SERVER_KEY)
52+
{
53+
$this->loadDaoClass('GroupDao');
54+
$dao = new GroupDao();
55+
$dao->setGroupId(MIDAS_GROUP_SERVER_KEY);
56+
$dao->setCommunityId(0);
57+
$dao->setName('Servers');
58+
$dao->saved = true;
59+
return $dao;
60+
}
5161
else
5262
{
5363
return parent::load($key);

core/models/pdo/GroupModel.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ function addUser($group, $user)
4545
throw new Zend_Exception("Should be an user.");
4646
}
4747

48-
$community = $group->getCommunity();
49-
$groupMember = $community->getMemberGroup();
50-
if($groupMember->getKey() != $group->getKey())
48+
if($group->getKey() != MIDAS_GROUP_SERVER_KEY)
5149
{
52-
$this->addUser($groupMember, $user);
50+
$community = $group->getCommunity();
51+
$groupMember = $community->getMemberGroup();
52+
if($groupMember->getKey() != $group->getKey())
53+
{
54+
$this->addUser($groupMember, $user);
55+
}
5356
}
54-
57+
5558
$this->database->link('users', $group, $user);
5659
} // end function addItem
5760

library/Zend/Application/Bootstrap/Bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function run()
9595

9696
$front->setParam('bootstrap', $this);
9797
$response = $front->dispatch();
98+
9899
if ($front->returnResponse()) {
99100
return $response;
100101
}

modules/GlobalModule.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public function loadModuleElements()
124124
{
125125
$nameComponent = ucfirst($this->moduleName).'_'.$component . "Component";
126126
include_once (BASE_PATH . "/modules/".$this->moduleName."/controllers/components/".$component."Component.php");
127+
if(!class_exists($nameComponent))
128+
{
129+
throw new Zend_Exception('Unable to find '.$nameComponent);
130+
}
127131
@$this->ModuleComponent->$component = new $nameComponent();
128132
}
129133
}
@@ -134,6 +138,10 @@ public function loadModuleElements()
134138
{
135139
$nameForm = ucfirst($this->moduleName).'_'.$forms . "Form";
136140
include_once (BASE_PATH . "/modules/".$this->moduleName."/controllers/forms/".$forms."Form.php");
141+
if(!class_exists($nameForm))
142+
{
143+
throw new Zend_Exception('Unable to find '.$nameForm);
144+
}
137145
@$this->ModuleForm->$forms = new $nameForm();
138146
}
139147
}

modules/api/models/pdo/UserapiModel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ function getUserapiFromToken($token)
195195
->where('t.expiration_date > ?', $now)
196196
->where('t.token = ?', $token);
197197

198-
199198
$row = $this->database->fetchRow($sql);
200199
return $this->initDao('Userapi', $row, 'api');
201200
}

modules/remoteprocessing/Notification.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,19 @@ public function addJob($params)
3838
unset($params['os']);
3939
$job->setCondition($params['condition']);
4040
unset($params['condition']);
41-
$job->setParams(JsonComponent::encode($params));
41+
42+
if(isset($params['expiration']))
43+
{
44+
$job->setExpirationDate($params['expiration']);
45+
}
46+
else
47+
{
48+
$date = new Zend_Date();
49+
$date->add('5', Zend_Date::HOUR);
50+
$job->setExpirationDate($date->toString('c'));
51+
}
52+
53+
$job->setParams(JsonComponent::encode($params['params']));
4254
$this->Remoteprocessing_Job->save($job);
4355
return;
4456
}

0 commit comments

Comments
 (0)