public static function user_id_to_publisher_info_id($effective_id) { $authUsersFactory = \_factory\authUsers::get_instance(); $params["user_id"] = $effective_id; $auth_user = $authUsersFactory->get_row($params); return $auth_user->PublisherInfoID; }
private static function getDemandCustomerInfoIDFromAuthUserID($auth_user_id) { $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["user_id"] = $auth_user_id; $authUser = $authUsersFactory->get_row($params); if ($authUser != null) { return $authUser->DemandCustomerInfoID; } return false; }
public static function domain_user_authorized_publisher_passthru($parent_id, $publisher_info_id) { $auth_Users_list = array(); $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["PublisherInfoID"] = $publisher_info_id; $params["parent_id"] = $parent_id; $authUserChild = $authUsersFactory->get_row($params); if ($authUserChild !== null) { return true; } return false; }
/** * * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface> */ public function rejectcampaignAction() { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if (!$this->auth->isSuperAdmin($this->config_handle) && !$this->auth->isDomainAdmin($this->config_handle)) { die("You do not have permission to access this page"); } $id = $this->getEvent()->getRouteMatch()->getParam('param1'); if ($id == null) { die("Invalid Campaign Preview ID"); } $InsertionOrderPreviewFactory = \_factory\InsertionOrderPreview::get_instance(); $params = array(); if (!$this->auth->isSuperAdmin($this->config_handle)) { $params["UserID"] = $this->auth->getUserID(); } $params["InsertionOrderPreviewID"] = $id; $InsertionOrderPreview = $InsertionOrderPreviewFactory->get_row($params); if ($InsertionOrderPreview == null) { return $this->redirect()->toRoute('private-exchange'); } $ad_campaign_preview_name = $InsertionOrderPreview->Name; $user_id = $InsertionOrderPreview->UserID; // set the preview campaigns and its elements to inactive and mark the date and time they went live \transformation\TransformPreview::deletePreviewModeCampaign($id, $this->auth, false); $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["user_id"] = $user_id; $auth_User = $authUsersFactory->get_row($params); $site_url = $this->config_handle['delivery']['site_url']; $exchange_name = $this->config_handle['delivery']['exchange_name']; if ($auth_User !== null && $ad_campaign_preview_name && $this->config_handle['mail']['subscribe']['user_ad_campaigns']) { // approval, send out email $message = 'Your ' . $exchange_name . ' Demand Ad Campaign on Staging : ' . $ad_campaign_preview_name . ' was reset.<br /><br />Please login <a href="' . $site_url . '/auth/login">here</a> with your email and password to make changes.'; $subject = "Your " . $exchange_name . " Demand Ad Campaign on Staging : " . $ad_campaign_preview_name . " was reset"; $transport = $this->getServiceLocator()->get('mail.transport'); $text = new Mime\Part($message); $text->type = Mime\Mime::TYPE_HTML; $text->charset = 'utf-8'; $mimeMessage = new Mime\Message(); $mimeMessage->setParts(array($text)); $zf_message = new Message(); $zf_message->addTo($auth_User->user_email)->addFrom($this->config_handle['mail']['reply-to']['email'], $this->config_handle['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage); $transport->send($zf_message); } return $this->redirect()->toRoute('private-exchange'); }
public function pxwebsitesAction() { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if (!$this->auth->hasIdentity()) { return $this->redirect()->toRoute('login'); } elseif (!$this->is_domain_admin) { return $this->redirect()->toRoute('publisher'); } $error_msg = null; $success_msg = null; $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance(); $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["parent_id"] = $this->auth->getUserID(); $authUserChildlist = $authUsersFactory->get($params); $PublisherInfoFactory = \_factory\PublisherInfo::get_instance(); $pending_list = array(); $approved_list = array(); $denied_list = array(); foreach ($authUserChildlist as $authUserChild) { $orders = 'DateCreated DESC'; $params = array(); $params["DomainOwnerID"] = $authUserChild->PublisherInfoID; $params["ApprovalFlag"] = 0; $websites_list = $PublisherWebsiteFactory->get($params, $orders); $pending_list = array_merge($pending_list, $websites_list); $params["ApprovalFlag"] = 1; $websites_list = $PublisherWebsiteFactory->get($params, $orders); $approved_list = array_merge($approved_list, $websites_list); $params["ApprovalFlag"] = 2; $websites_list = $PublisherWebsiteFactory->get($params, $orders); $denied_list = array_merge($denied_list, $denied_list); } $view = new ViewModel(array('dashboard_view' => 'account', 'pending_list' => $pending_list, 'approved_list' => $approved_list, 'denied_list' => $denied_list, 'success_msg' => $success_msg, 'error_msg' => $error_msg, 'vertical_map' => \util\DeliveryFilterOptions::$vertical_map, 'user_id' => $this->auth->getUserID(), 'user_id_list' => $this->user_id_list, 'user_identity' => $this->identity(), 'true_user_name' => $this->auth->getUserName(), 'header_title' => 'Account Settings', 'is_super_admin' => $this->is_super_admin, 'is_domain_admin' => $this->is_domain_admin, 'effective_id' => $this->auth->getEffectiveIdentityID(), 'impersonate_id' => $this->ImpersonateID)); return $view->setTemplate('dashboard-manager/signup/websites.phtml'); }
/** * Given a role name, return a result set of all users with that role. * * @param string $roleName * @return multitype:Ambigous <\Zend\Db\ResultSet\ResultSet, NULL, \Zend\Db\ResultSet\ResultSetInterface> */ public function getRoleUsers($roleName) { $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["user_role"] = $this->getRoleID($roleName); // First get the role ID of the role "member" $auth_Users_list = $authUsersFactory->get($params); return $auth_Users_list; }
/** * * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface> */ public function rejectcampaignAction() { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if (strpos($this->auth->getPrimaryRole(), $this->config_handle['roles']['admin']) === false) { die("You do not have permission to access this page"); } $id = $this->getEvent()->getRouteMatch()->getParam('param1'); if ($id == null) { die("Invalid Campaign Preview ID"); } $AdCampaignPreviewFactory = \_factory\AdCampaignPreview::get_instance(); $params = array(); $params["AdCampaignPreviewID"] = $id; $AdCampaignPreview = $AdCampaignPreviewFactory->get_row($params); if ($AdCampaignPreview == null) { die("AdCampaignPreviewID not found"); } $ad_campaign_preview_name = $AdCampaignPreview->Name; $user_id = $AdCampaignPreview->UserID; // set the preview campaigns and its elements to inactive and mark the date and time they went live \transformation\TransformPreview::deletePreviewModeCampaign($id, $this->auth, false); $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["user_id"] = $user_id; $auth_User = $authUsersFactory->get_row($params); if ($auth_User !== null && $ad_campaign_preview_name && $this->config_handle['mail']['subscribe']['user_ad_campaigns']) { // approval, send out email $message = 'Your NginAd Exchange Demand Ad Campaign : ' . $ad_campaign_preview_name . ' was rejected.<br /><br />Please login <a href="http://server.nginad.com/auth/login">here</a> with your email and password'; $subject = "Your NginAd Exchange Demand Ad Campaign : " . $ad_campaign_preview_name . " was rejected"; $transport = $this->getServiceLocator()->get('mail.transport'); $text = new Mime\Part($message); $text->type = Mime\Mime::TYPE_HTML; $text->charset = 'utf-8'; $mimeMessage = new Mime\Message(); $mimeMessage->setParts(array($text)); $zf_message = new Message(); $zf_message->addTo($auth_User->user_email)->addFrom($this->config_handle['mail']['reply-to']['email'], $this->config_handle['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage); $transport->send($zf_message); } return $this->redirect()->toRoute('demand'); }
public function pxlistAction() { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if (!$this->auth->hasIdentity()) { return $this->redirect()->toRoute('login'); } elseif (!$this->is_domain_admin) { return $this->redirect()->toRoute('publisher'); } $publisher_id = intval($this->params()->fromRoute('param1', 0)); $PublisherInfoFactory = \_factory\PublisherInfo::get_instance(); $params = array(); $params["PublisherInfoID"] = $publisher_id; $PublisherInfo = $PublisherInfoFactory->get_row($params); if (!$PublisherInfo) { die("Publisher Not Found: CODE 103"); } $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["PublisherInfoID"] = $PublisherInfo->PublisherInfoID; $authUserChild = $authUsersFactory->get_row($params); if (!$authUserChild) { die("Publisher Not Found: CODE 104"); } if (!\util\AuthHelper::domain_user_authorized($this->auth->getUserID(), $authUserChild->user_id)) { die("Not Authorized: CODE 105"); } $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance(); $orders = 'DateCreated DESC'; $params = array(); $params["DomainOwnerID"] = $PublisherInfo->PublisherInfoID; $pending_list = $PublisherWebsiteFactory->get($params, $orders); $view = new ViewModel(array('dashboard_view' => 'account', 'pending_list' => $pending_list, 'PublisherInfoFactory' => $PublisherInfoFactory, 'vertical_map' => \util\DeliveryFilterOptions::$vertical_map, 'user_id_list' => $this->user_id_list, 'user_identity' => $this->identity(), 'true_user_name' => $this->auth->getUserName(), 'header_title' => 'Private Exchange Publisher Websites', 'is_domain_admin' => $this->is_domain_admin, 'effective_id' => $this->auth->getEffectiveIdentityID(), 'impersonate_id' => $this->ImpersonateID)); return $view; }
public function getDomainPublisherUsers($parent_id) { $auth_Users_list = array(); $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["parent_id"] = $parent_id; $auth_Users_list = $authUsersFactory->get($params); return $auth_Users_list; }
private function userApprovalToggle($flag, $user_id, $user_type) { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if ($this->is_admin && $user_id > 0 && ($flag === 1 || $flag === 0)) { $authUsers = new \model\authUsers(); $authUsersFactory = \_factory\authUsers::get_instance(); if ($user_type == 'publisher') { $PublisherInfoFactory = \_factory\PublisherInfo::get_instance(); $authUsers = $authUsersFactory->get_row_object(array("PublisherInfoID" => $user_id)); } if ($user_type == 'customer') { $DemandCustomerFactory = \_factory\DemandCustomerInfo::get_instance(); $authUsers = $authUsersFactory->get_row_object(array("DemandCustomerInfoID" => $user_id)); } $authUsers->user_enabled = $flag; $authUsers->user_verified = $flag; if ($flag === 1) { $authUsersFactory->saveUser($authUsers); return true; } if ($flag === 0) { if ($user_type == 'publisher') { $PublisherInfoFactory->deletePublisherInfo($user_id); } if ($user_type == 'customer') { $DemandCustomerFactory->deleteCustomerInfo($user_id); } $authUsersFactory->delete_user($authUsers->user_id); return true; } } return false; }
public function msaAction() { $user_id = $this->getRequest()->getPost('user_id'); $sechash = $this->getRequest()->getPost('sechash'); $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["user_id"] = $user_id; $auth_User = $authUsersFactory->get_row_object($params); $sechash_compare = md5(substr($auth_User->user_password, 0, 12)); if ($sechash == $sechash_compare) { $auth_User->user_agreement_accepted = 1; $auth_User->user_agreement_acceptance_date = date("Y-m-d H:i:s"); $auth_service_trusted = $this->serviceLocator->get('AuthService'); $userDetails = new \stdClass(); $userDetails->user_password = $auth_User->user_password; $userDetails->user_password_salt = $auth_User->user_password_salt; $userDetails->user_role_name = $auth_User->user_role == 2 ? $this->getConfig()['roles']['domain_admin'] : $this->getConfig()['roles']['member']; $userDetails->user_id = $auth_User->user_id; $userDetails->user_login = $auth_User->user_login; $userDetails->PublisherInfoID = $auth_User->PublisherInfoID; $userDetails->DemandCustomerInfoID = $auth_User->DemandCustomerInfoID; $userDetails->user_fullname = $auth_User->user_fullname; $result = $auth_service_trusted->authenticateTrusted($userDetails); $authUsersFactory->saveUser($auth_User); $redirect = $auth_User->user_role == 2 ? 'private-exchange' : 'publisher'; return $this->redirect()->toRoute($redirect); } else { return $this->redirect()->toRoute('login'); } }