Example #1
0
 function main(&$args)
 {
     if ($args[1] !== 'contribute') {
         return;
     }
     $session =& CRM_Core_Session::singleton();
     $config =& CRM_Core_Config::singleton();
     if ($args[2] == 'transact') {
         if ($config->enableSSL && CRM_Core_Invoke::onlySSL($args)) {
             if (!isset($_SERVER['HTTPS'])) {
                 CRM_Utils_System::redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             } else {
                 CRM_Utils_System::mapConfigToSSL();
             }
         }
         require_once 'CRM/Contribute/Controller/Contribution.php';
         $controller =& new CRM_Contribute_Controller_Contribution($title, $mode);
         return $controller->run();
     } elseif ($args[2] == 'search') {
         require_once 'CRM/Contribute/Controller/Search.php';
         $controller =& new CRM_Contribute_Controller_Search($title, $mode);
         $url = 'civicrm/contribute/search';
         $session->pushUserContext(CRM_Utils_System::url($url, 'force=1'));
         $controller->set('context', 'search');
         return $controller->run();
     } elseif ($args[2] == 'import') {
         require_once 'CRM/Contribute/Import/Controller.php';
         $controller =& new CRM_Contribute_Import_Controller(ts('Import Contributions'));
         return $controller->run();
     } else {
         if ($args[2] == 'add') {
             $session =& CRM_Core_Session::singleton();
             $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute', 'action=browse&reset=1'));
             require_once 'CRM/Contribute/Controller/ContributionPage.php';
             $controller =& new CRM_Contribute_Controller_ContributionPage();
             return $controller->run();
         } else {
             if ($args[2] == 'contribution') {
                 require_once 'CRM/Contribute/Page/Contribution.php';
                 $page =& new CRM_Contribute_Page_Contribution();
                 return $page->run();
             } else {
                 require_once 'CRM/Contribute/Page/DashBoard.php';
                 $view =& new CRM_Contribute_Page_DashBoard(ts('DashBoard'));
                 return $view->run();
             }
         }
     }
 }