function indexAction()
 {
     Am_Mail::setDefaultTransport(new Am_Mail_Transport_Null());
     if ($this->_request->get('start')) {
         $this->getSession()->yourmembers_db = null;
         $this->getSession()->yourmembers_import = null;
     } elseif ($this->_request->get('import_settings')) {
         $this->getSession()->yourmembers_import = null;
     }
     if (!$this->getSession()->yourmembers_db) {
         return $this->askDbSettings();
     }
     $this->db_yourmembers = Am_Db::connect($this->getSession()->yourmembers_db);
     if (!$this->getSession()->yourmembers_import) {
         return $this->askImportSettings();
     }
     // disable ALL hooks
     $this->getDi()->hook = new Am_Hook($this->getDi());
     $done = $this->_request->getInt('done', 0);
     $importSettings = $this->getSession()->yourmembers_import;
     $import = $this->_request->getFiltered('i', $importSettings['import']);
     $class = "Am_Import_" . ucfirst($import) . "3";
     $importer = new $class($this->db_yourmembers, (array) @$importSettings[$import]);
     if ($importer->run($done) === true) {
         $this->view->title = ucfirst($import) . " Import Finished";
         $this->view->content = "{$done} records imported from Wordpress Your Members Plugin";
         $this->view->content .= "<br /><br/><a href='" . REL_ROOT_URL . "/admin-import-your-members'>Continue to import other information</a>";
         $this->view->content .= "<br /><br />Do not forget to <a href='" . REL_ROOT_URL . "/admin-rebuild'>Rebuild Db</a> after all import operations are done.";
         $this->view->display('admin/layout.phtml');
         $this->getSession()->yourmembers_import = null;
     } else {
         $this->redirectHtml(REL_ROOT_URL . "/admin-import-your-members?done={$done}&i={$import}", "{$done} records imported");
     }
 }
 public function preDispatch()
 {
     // Try to set any available english UTF-8 locale. Required for fgetcsv function to parse UTF-8 content.
     setlocale(LC_ALL, 'C.UTF-8', 'en_US.UTF-8', 'C');
     Am_Mail::setDefaultTransport(new Am_Mail_Transport_Null());
 }
예제 #3
0
 public function run()
 {
     if (!$this->getForm()->validate()) {
         echo $this->renderConfirmationForm();
     } else {
         $prefix = $this->grid->getId() . '_';
         foreach ($this->getForm()->getValue() as $k => $v) {
             if (strpos($k, $prefix) === 0) {
                 $this->_vars[substr($k, strlen($prefix))] = $v;
             }
         }
         // disable emailing
         Am_Mail::setDefaultTransport(new Am_Mail_Transport_Null());
         return parent::run();
     }
 }
 public function doAction()
 {
     // disable all emails
     Am_Mail::setDefaultTransport(new Am_Mail_Transport_Null());
     $payplugin = null;
     foreach ($this->getDi()->plugins_payment->getEnabled() as $pl) {
         if ($pl == 'free') {
             continue;
         }
         $payplugin = $this->getDi()->plugins_payment->loadGet($pl);
         break;
     }
     if (empty($payplugin)) {
         throw new Am_Exception_InputError("No payment plugins enabled. Visit [aMember Cp -> Setup/Configuration -> Plugins] and enable one");
     }
     $batch = new Am_BatchProcessor(array($this, 'generateUser'), 5);
     $context = array('payplugin' => $payplugin);
     if (!$batch->run($context)) {
         $this->sendRedirect();
     }
     $this->updateDemoHistory(true);
     $this->session->unsetAll();
     $this->_redirect('admin-build-demo');
 }
 function indexAction()
 {
     Am_Mail::setDefaultTransport(new Am_Mail_Transport_Null());
     if ($this->_request->get('start')) {
         $this->getSession()->wordpress_db = null;
         $this->getSession()->wordpress_import = null;
     } elseif ($this->_request->get('import_settings')) {
         $this->getSession()->wordpress_import = null;
     }
     if (!$this->getSession()->wordpress_db) {
         return $this->askDbSettings();
     }
     $this->db_wordpress = Am_Db::connect($this->getSession()->wordpress_db);
     if (!$this->getSession()->wordpress_import) {
         return $this->askImportSettings();
     }
     // disable ALL hooks
     $this->getDi()->hook = new Am_Hook($this->getDi());
     $done = $this->_request->getInt('done', 0);
     $importSettings = $this->getSession()->wordpress_import;
     $import = $this->_request->getFiltered('i', $importSettings['import']);
     if ($import == 'product') {
         foreach ($importSettings['pr_link'] as $wom => $am) {
             if ($am) {
                 $this->getDi()->productTable->load($am)->data()->set('wom:id', $wom)->update();
                 $done++;
             }
         }
         $this->view->title = "Product Linking Finished";
         $this->view->content = "{$done} records linked from Wordpress Optimize Member Plugin";
         $this->view->content .= "<br /><br/><a href='" . REL_ROOT_URL . "/admin-import-wordpress-optimize-member'>Continue to import other information</a>";
         $this->view->display('admin/layout.phtml');
         $this->getSession()->wordpress_import = null;
         return;
     }
     $class = "Am_Import_" . ucfirst($import) . "3";
     $importer = new $class($this->db_wordpress, (array) @$importSettings[$import]);
     if ($importer->run($done) === true) {
         $this->view->title = ucfirst($import) . " Import Finished";
         $this->view->content = "{$done} records imported from Wordpress Optimize Member Plugin";
         $this->view->content .= "<br /><br/><a href='" . REL_ROOT_URL . "/admin-import-wordpress-optimize-member'>Continue to import other information</a>";
         $this->view->content .= "<br /><br />Do not forget to <a href='" . REL_ROOT_URL . "/admin-rebuild'>Rebuild Db</a> after all import operations are done.";
         $this->view->display('admin/layout.phtml');
         $this->getSession()->wordpress_import = null;
     } else {
         $this->redirectHtml(REL_ROOT_URL . "/admin-import-wordpress-optimize-member?done={$done}&i={$import}", "{$done} records imported");
     }
 }
 function indexAction()
 {
     $enabled = $this->getDi()->plugins_protect->loadEnabled()->getAllEnabled();
     foreach ($enabled as $k => $pl) {
         if ($pl->getId() == 'invision') {
             unset($enabled[$k]);
             break;
         }
     }
     $this->getDi()->plugins_protect->setEnabled($enabled);
     Am_Mail::setDefaultTransport(new Am_Mail_Transport_Null());
     if ($this->_request->get('start')) {
         $this->getSession()->ipb_nexus_db = null;
         $this->getSession()->ipb_nexus_import = null;
     } elseif ($this->_request->get('import_settings')) {
         $this->getSession()->ipb_nexus_import = null;
     }
     if (!$this->getSession()->ipb_nexus_db) {
         return $this->askDbSettings();
     }
     $this->db_ipb_nexus = Am_Db::connect($this->getSession()->ipb_nexus_db);
     if (!$this->getSession()->ipb_nexus_import) {
         return $this->askImportSettings();
     }
     // disable ALL hooks
     $this->getDi()->hook = new Am_Hook($this->getDi());
     $done = $this->_request->getInt('done', 0);
     $importSettings = $this->getSession()->ipb_nexus_import;
     $import = $this->_request->getFiltered('i', $importSettings['import']);
     $class = "Am_Import_" . ucfirst($import) . "3";
     $importer = new $class($this->db_ipb_nexus, (array) @$importSettings[$import]);
     if ($importer->run($done) === true) {
         $this->view->title = ucfirst($import) . " Import Finished";
         $this->view->content = "{$done} records imported from IPB Nexus";
         $this->view->content .= "<br /><br/><a href='" . REL_ROOT_URL . "/admin-import-ipb-nexus'>Continue to import other information</a>";
         $this->view->content .= "<br /><br />Do not forget to <a href='" . REL_ROOT_URL . "/admin-rebuild'>Rebuild Db</a> after all import operations are done.";
         $this->view->display('admin/layout.phtml');
         $this->getSession()->ipb_nexus_import = null;
     } else {
         $this->redirectHtml(REL_ROOT_URL . "/admin-import-ipb-nexus?done={$done}&i={$import}", "{$done} records imported");
     }
 }