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; }
private function userApprovalToggle($flag, $user_id, $user_type) { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if (($this->is_super_admin || $this->is_domain_admin) && $user_id > 0 && ($flag === 1 || $flag === 0)) { if ($this->is_domain_admin) { if (!\util\AuthHelper::domain_user_authorized_publisher($this->auth->getUserID(), $user_id)) { die("Not Authorized"); } } $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; $authUsers->user_agreement_accepted = 0; 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->deactivate_user($authUsers->user_id); return true; } } return false; }
public static function sendCreditApplication($transport, $config, $demand_customer_info_id) { $DemandCustomerInfoFactory = \_factory\DemandCustomerInfo::get_instance(); $params = array(); $params["DemandCustomerInfoID"] = $demand_customer_info_id; $DemandCustomerInfo = $DemandCustomerInfoFactory->get_row($params); if ($DemandCustomerInfo != null) { $site_url = $config['delivery']['site_url']; $exchange_name = $config['delivery']['exchange_name']; // approval, send out email $subject = "Your " . $exchange_name . " Private Exchange Requires Credit Approval"; $message = 'Your ' . $exchange_name . ' Private Exchange for: ' . $DemandCustomerInfo->Company . ', needs credit approval before you can access Platform Connection Inventory and SSP RTB Inventory.' . '<br /><br />Please download the credit application <a href="' . $site_url . '/forms/credit.application.pdf">here</a>.' . '<br /><br />Link: ' . $site_url . '/forms/credit.application.pdf' . '<br /><br />Fill out the application completely and email it back to:' . $config['mail']['reply-to']['email'] . '<br /><br />Once your application is approved we will set a credit limit for your programmatic media buys and enable either the Platform Connection inventory, or the SSP RTB inventory or both depending on your credit worthiness.'; $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($DemandCustomerInfo->Email)->addFrom($config['mail']['reply-to']['email'], $config['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage); $transport->send($zf_message); $DemandCustomerInfoFactory->markCreditApplicationSent($demand_customer_info_id); } }