Beispiel #1
0
 /**
  * Display the publisher index page, and list all domains associated.
  * 
  * @return \Zend\View\Model\ViewModel
  */
 public function indexAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     //Pull list of websites.
     $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance();
     $parameters = array();
     // Set the parameters to empty first.
     $parameters['DomainOwnerID'] = $this->PublisherInfoID;
     $publisher_markup_rate = $this->config_handle['system']['default_publisher_markup_rate'];
     $PublisherWebsiteList = $PublisherWebsiteFactory->get($parameters);
     if ($this->is_admin) {
         $headers = array("#", "Domain", "Domain Markup", "Domain Owner", "Created", "Updated", "Approval", "Actions");
         $meta_data = array("WebDomain", "DomainMarkupRate", "DomainOwnerID", "DateCreated", "DateUpdated", "ApprovalFlag");
         // admin is logged in as a user, get the markup if any for that user
         if ($this->EffectiveID != 0) {
             $publisher_markup = \util\Markup::getMarkupForPublisher($this->EffectiveID);
             if ($publisher_markup != null) {
                 $publisher_markup_rate = $publisher_markup->MarkupRate;
             }
         }
     } else {
         $headers = array("#", "Domain", "Created", "Updated", "Approval", "Actions");
         $meta_data = array("WebDomain", "AutoApprove", "DateCreated", "DateUpdated", "ApprovalFlag");
     }
     foreach ($PublisherWebsiteList as $PublisherWebsite) {
         $website_markup = \util\Markup::getMarkupForPublisherWebsite($PublisherWebsite->PublisherWebsiteID);
         if ($website_markup != null) {
             $website_markup_rate_list[$PublisherWebsite->PublisherWebsiteID] = $website_markup->MarkupRate * 100;
         } else {
             $website_markup_rate_list[$PublisherWebsite->PublisherWebsiteID] = $publisher_markup_rate * 100;
         }
     }
     $PublisherInfoFactory = \_factory\PublisherInfo::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $this->PublisherInfoID;
     $PublisherInfo = $PublisherInfoFactory->get_row($params);
     $publisher_markup_rate *= 100;
     $view = new ViewModel(array('true_user_name' => $this->auth->getUserName(), 'domain_list_raw' => $PublisherWebsiteList, 'domain_list' => $this->order_data_table($meta_data, $PublisherWebsiteList, $headers), 'is_admin' => $this->is_admin, 'user_id_list' => $this->user_id_list_publisher, 'domain_owner' => isset($PublisherInfo->Name) ? $PublisherInfo->Name : "", 'impersonate_id' => $this->ImpersonateID, 'effective_id' => $this->auth->getEffectiveIdentityID(), 'dashboard_view' => 'publisher', 'user_identity' => $this->identity(), 'publisher_markup_rate' => $publisher_markup_rate, 'website_markup_rate_list' => isset($website_markup_rate_list) ? $website_markup_rate_list : array()));
     if ($this->is_admin == false || $this->is_admin == true && $this->PublisherInfoID != null && $this->auth->getEffectiveIdentityID() != 0) {
         $view->header_title = '<a href="/publisher/createdomain">Create New Domain</a>';
     } else {
         $view->header_title = '&nbsp;';
     }
     return $view;
 }
Beispiel #2
0
 /**
  * Toggle the approval given the supplied flag to toggle.
  *
  * @param integer $flag 0 = Pending | 1 = Approved
  * @return boolean TRUE if successful, FALSE if failure.
  */
 private function adApprovalToggle($flag)
 {
     $DomainID = intval($this->params()->fromRoute('param1', 0));
     $PublisherAdZoneID = intval($this->params()->fromRoute('id', 0));
     if (($this->is_super_admin || $this->is_domain_admin) && $DomainID > 0 && $PublisherAdZoneID > 0 && ($flag === 0 || $flag === 1 || $flag === 2)) {
         $DomainObj = $this->get_domain_data($DomainID, $this->PublisherInfoID);
         if ($DomainObj === null) {
             $error_message = "An invalid publishing web domain was specified for the specified user.";
         } else {
             if ($this->is_domain_admin) {
                 if (!\util\AuthHelper::domain_user_authorized_publisher($this->auth->getUserID(), $DomainObj->DomainOwnerID)) {
                     die("Not Authorized");
                 }
             }
             $PublisherAdZoneFactory = \_factory\PublisherAdZone::get_instance();
             $AdObject = new \model\PublisherAdZone();
             $parameters = array("PublisherWebsiteID" => $DomainObj->PublisherWebsiteID, "PublisherAdZoneID" => $PublisherAdZoneID);
             $AdObject = $PublisherAdZoneFactory->get_row_object($parameters);
             if (intval($AdObject->PublisherAdZoneID) == $PublisherAdZoneID) {
                 $AdObject->AutoApprove = 0;
                 $AdObject->AdStatus = intval($flag);
                 if ($PublisherAdZoneFactory->save_ads($AdObject)) {
                     if (($flag == 1 || $flag == 2) && $this->config_handle['mail']['subscribe']['user_zones']) {
                         $PublisherInfoFactory = \_factory\PublisherInfo::get_instance();
                         $params = array();
                         $params["PublisherInfoID"] = $DomainObj->DomainOwnerID;
                         $PublisherInfo = $PublisherInfoFactory->get_row($params);
                         if ($PublisherInfo !== null) {
                             // approval, send out email
                             $site_url = $this->config_handle['delivery']['site_url'];
                             $exchange_name = $this->config_handle['delivery']['exchange_name'];
                             if ($flag == 1) {
                                 $message = 'Your ' . $exchange_name . ' Publisher Ad Zone for : ' . $DomainObj->WebDomain . ' : ' . $AdObject->AdName . ' was approved.<br /><br />Please login <a href="' . $site_url . '/auth/login">here</a> with your email and password';
                                 $subject = "Your " . $exchange_name . " Publisher Ad Zone for : " . $DomainObj->WebDomain . " was approved";
                             } else {
                                 $message = 'Your ' . $exchange_name . ' Publisher Ad Zone for : ' . $DomainObj->WebDomain . ' : ' . $AdObject->AdName . ' was rejected.<br /><br />Please login <a href="' . $site_url . '/auth/login">here</a> with your email and password';
                                 $subject = "Your " . $exchange_name . " Publisher Ad Zone for : " . $DomainObj->WebDomain . " 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($PublisherInfo->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 TRUE;
                 }
             }
         }
     }
     return FALSE;
 }
Beispiel #3
0
 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');
 }
Beispiel #4
0
 private function add_publisher_request_params($config, &$banner_request, &$PublisherAdZone)
 {
     $PublisherInfoFactory = \_factory\PublisherInfo::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $PublisherAdZone->AdOwnerID;
     $PublisherInfo = $PublisherInfoFactory->get_row_cached($config, $params);
     if ($PublisherInfo == null) {
         return;
     }
     $banner_request["publisher_info_website"] = $PublisherInfo->Domain;
     $banner_request["publisher_id"] = $PublisherInfo->PublisherInfoID;
     $banner_request["publisher_name"] = $PublisherInfo->Name;
     $banner_request["publisher_iab_category"] = array($PublisherInfo->IABCategory);
 }
 /**
  * Toggle the approval given the supplied flag to toggle.
  * 
  * @param integer $flag 0 = Pending | 1 = Approved
  * @return boolean TRUE if successful, FALSE if failure.
  */
 private function domainApprovalToggle($flag)
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     $PublisherWebsiteID = intval($this->params()->fromRoute('param1', 0));
     if ($this->is_admin && $PublisherWebsiteID > 0 && ($flag === 2 || $flag === 1 || $flag === 0)) {
         $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance();
         $domain_object = new \model\PublisherWebsite();
         $request = $this->getRequest();
         $parameters = array("PublisherWebsiteID" => $PublisherWebsiteID);
         $domain_object = $PublisherWebsiteFactory->get_row_object($parameters);
         // Make sure entry exists.
         if (intval($domain_object->PublisherWebsiteID) == $PublisherWebsiteID) {
             $domain_object->AutoApprove = 0;
             $domain_object->ApprovalFlag = $flag;
             if ($flag == 2) {
                 $PublisherAdZoneFactory = \_factory\PublisherAdZone::get_instance();
                 $params = array();
                 $params["PublisherWebsiteID"] = $PublisherWebsiteID;
                 $PublisherAdZoneList = $PublisherAdZoneFactory->get($params);
                 foreach ($PublisherAdZoneList as $PublisherAdZone) {
                     $PublisherAdZoneFactory->updatePublisherAdZonePublisherAdZoneStatus($PublisherAdZone->PublisherAdZoneID, 2);
                 }
             }
             if (($flag == 1 || $flag == 2) && $this->config_handle['mail']['subscribe']['user_domains']) {
                 $PublisherInfoFactory = \_factory\PublisherInfo::get_instance();
                 $params = array();
                 $params["PublisherInfoID"] = $domain_object->DomainOwnerID;
                 $PublisherInfo = $PublisherInfoFactory->get_row($params);
                 if ($PublisherInfo !== null) {
                     // approval, send out email
                     if ($flag == 1) {
                         $message = 'Your NginAd Exchange Publisher Domain: ' . $domain_object->WebDomain . ' was approved.<br /><br />Please login <a href="http://server.nginad.com/auth/login">here</a> with your email and password';
                         $subject = "Your NginAd Exchange Publisher Domain: " . $domain_object->WebDomain . " was approved";
                     } else {
                         $message = 'Your NginAd Exchange Publisher Domain: ' . $domain_object->WebDomain . ' 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 Publisher Domain: " . $domain_object->WebDomain . " 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($PublisherInfo->Email)->addFrom($this->config_handle['mail']['reply-to']['email'], $this->config_handle['mail']['reply-to']['name'])->setSubject($subject)->setBody($mimeMessage);
                     $transport->send($zf_message);
                 }
             }
             if ($PublisherWebsiteFactory->save_domain($domain_object) > 0) {
                 return TRUE;
             }
         }
     }
     return FALSE;
 }
Beispiel #6
0
 public function listAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if (!$this->auth->hasIdentity()) {
         return $this->redirect()->toRoute('login');
     } elseif (!$this->is_super_admin) {
         return $this->redirect()->toRoute('publisher');
     }
     $publisher_id = intval($this->params()->fromRoute('param1', 0));
     $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance();
     $PublisherInfoFactory = \_factory\PublisherInfo::get_instance();
     $orders = 'DateCreated DESC';
     $params = array();
     $params["DomainOwnerID"] = $publisher_id;
     $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' => 'Websites', 'is_super_admin' => $this->is_super_admin, 'effective_id' => $this->auth->getEffectiveIdentityID(), 'impersonate_id' => $this->ImpersonateID));
     return $view;
 }
Beispiel #7
0
 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;
 }