Skip to content

Commit

Permalink
removing borken eventQueue references.
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Feb 22, 2013
1 parent 0374aef commit ac20f33
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 66 deletions.
8 changes: 3 additions & 5 deletions modules/base/installBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ function action() {
}

// fire install complete event.
$eq = &eventQueue::get_instance();
$event = $eq->eventFactory();
$ed = owa_coreAPI::getEventDispatch();
$event = $ed->eventFactory();
$event->set('u', 'admin');
$event->set('p', $password);
$event->set('site_id', $site_id);
$event->setEventType('install_complete');
$eq->notify($event);
$ed->notify($event);

// set view
$this->set('u', 'admin');
Expand All @@ -118,8 +118,6 @@ function action() {
$this->set('error_msg', $this->getMsg(3302));
$this->errorAction();
}

return;
}

function errorAction() {
Expand Down
18 changes: 3 additions & 15 deletions modules/base/usersAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//

require_once(OWA_BASE_DIR.'/owa_adminController.php');
require_once(OWA_BASE_DIR.'/eventQueue.php');

/**
* Add User Controller
Expand Down Expand Up @@ -57,8 +56,6 @@ function __construct($params) {
$v2->setValues(trim($this->getParam('user_id')));
$v2->setErrorMessage($this->getMsg(3001));
$this->setValidation('user_id', $v2);

return;
}

function action() {
Expand All @@ -74,34 +71,25 @@ function action() {
$temp_passkey = $userManager->createNewUser($user_params);

// log account creation event to event queue
$eq = &eventQueue::get_instance();
$eq->log(array( 'user_id' => $this->params['user_id'],
$ed = owa_coreAPI::getEventDispatch();
$ed->log(array( 'user_id' => $this->params['user_id'],
'real_name' => $this->params['real_name'],
'role' => $this->params['role'],
'email_address' => $this->params['email_address'],
'temp_passkey' => $temp_passkey),
'base.new_user_account');



$this->setRedirectAction('base.users');
$this->set('status_code', 3000);

return;
}

function errorAction() {
$this->setView('base.options');
$this->setSubview('base.usersProfile');
$this->set('error_code', 3009);
//assign original form data so the user does not have to re-enter the data
$this->set('profile', $this->params);

return;

$this->set('profile', $this->params);
}

}


?>
12 changes: 3 additions & 9 deletions modules/base/usersChangePassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
require_once(OWA_BASE_DIR.'/owa_controller.php');
require_once(OWA_BASE_DIR.'/owa_view.php');
require_once(OWA_BASE_DIR.'/owa_auth.php');
require_once(OWA_BASE_DIR.'/eventQueue.php');

/**
* Change Password Controller
Expand Down Expand Up @@ -64,27 +63,22 @@ function action() {

// log to event queue
if ($status === true) {
$eq = & eventQueue::get_instance();
$ed = owa_coreAPI::getEventDispatch();
$new_password = array('key' => $this->params['k'], 'password' => $auth->encryptPassword($this->params['password']), 'ip' => $_SERVER['REMOTE_ADDR']);
$eq->log($new_password, 'base.set_password');
$ed->log($new_password, 'base.set_password');
$auth->deleteCredentials();
$this->setRedirectAction('base.loginForm');
$this->set('status_code', 3006);
} else {
$this->setRedirectAction('base.loginForm');
$this->set('error_code', 2011); // can't find key in the db
}

return;
}

function errorAction() {
//print 'error action';

$this->setView('base.usersPasswordEntry');
$this->set('k', $this->getParam('k'));
//$this->set('password', $this->getParam('password'));
//$this->set('password2', $this->getParam('password2'));
return;
}
}

Expand Down
60 changes: 23 additions & 37 deletions owa_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,7 @@ protected function isEveryoneCapable($capability) {

function logEvent($event_type, $properties) {

if (!class_exists('eventQueue')):
require_once(OWA_BASE_DIR.'/eventQueue.php');
endif;

$eq = eventQueue::get_instance();
$ed = owa_coreAPI::getEventDispatch();

if (!is_a($properties, 'owa_event')) {

Expand All @@ -292,35 +288,32 @@ function logEvent($event_type, $properties) {
$event = $properties;
}

return $eq->log($event, $event->getEventType());
return $ed->notify( $event );
}

function createValidator() {

$this->v = owa_coreAPI::supportClassFactory('base', 'validator');

return;

$this->v = owa_coreAPI::supportClassFactory('base', 'validator');
}

function addValidation($name, $value, $validation, $conf = array()) {

if (empty($this->v)):
if ( empty( $this->v ) ) {

$this->createValidator();
endif;
}

return $this->v->addValidation($name, $value, $validation, $conf);

}

function setValidation($name, $obj) {

if (empty($this->v)):
if (empty($this->v)) {
$this->createValidator();
endif;
}

return $this->v->setValidation($name, $obj);

}

function getValidationErrorMsgs() {
Expand All @@ -331,26 +324,20 @@ function getValidationErrorMsgs() {

function isAdmin() {

if ($this->is_admin == true):
if ($this->is_admin == true) {
return true;
else:
return false;
endif;

}
}

// depricated
function _setCapability($capability) {

$this->setRequiredCapability($capability);

return;
}

function setRequiredCapability($capability) {

$this->capability = $capability;
return;
}

function getRequiredCapability() {
Expand All @@ -362,9 +349,7 @@ function getParam($name) {

if (array_key_exists($name, $this->params)) {
return $this->params[$name];
} else {
return false;
}
}
}

function setParam($name, $value) {
Expand All @@ -376,9 +361,7 @@ function isParam($name) {

if (array_key_exists($name, $this->params)) {
return true;
} else {
return false;
}
}
}

function get($name) {
Expand Down Expand Up @@ -429,21 +412,24 @@ function setTimePeriod($period) {


function setView($view) {

$this->data['view'] = $view;
return;
}

function setSubview($subview) {

$this->data['subview'] = $subview;
return;

}

function setViewMethod($method = 'delegate') {

$this->data['view_method'] = $method;
return;

}

function setRedirectAction($do) {

$this->set('view_method', 'redirect');
$this->set('do', $do);

Expand All @@ -457,26 +443,26 @@ function setRedirectAction($do) {
}

function setPagination($pagination, $name = 'pagination') {

$this->data[$name] = $pagination;
return;

}

function set($name, $value) {

$this->data[$name] = $value;
return;
}

function setControllerType($string) {

$this->type = $string;
return;

}

function mergeParams($array) {

$this->params = array_merge($this->params, $array);
return;

}

/**
Expand Down Expand Up @@ -631,4 +617,4 @@ protected function getSiteIdParameterValue() {

}

?>
?>

0 comments on commit ac20f33

Please sign in to comment.