function civicrm_invoke()
{
    civicrm_init();
    plugin_init();
    $user = JFactory::getUser();
    /* bypass synchronize if running upgrade
     * to avoid any serious non-recoverable error
     * which might hinder the upgrade process.
     */
    require_once 'CRM/Utils/Array.php';
    if (CRM_Utils_Array::value('task', $_REQUEST) != 'civicrm/upgrade') {
        require_once 'CRM/Core/BAO/UFMatch.php';
        CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);
    }
    require_once 'CRM/Utils/System/Joomla.php';
    CRM_Utils_System_Joomla::addHTMLHead(NULL, TRUE);
    if (isset($_GET['task'])) {
        $args = explode('/', trim($_GET['task']));
    } else {
        $_GET['task'] = 'civicrm/dashboard';
        $_GET['reset'] = 1;
        $args = array('civicrm', 'dashboard');
    }
    CRM_Core_Invoke::invoke($args);
}
function civicrm_invoke()
{
    civicrm_init();
    global $my;
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($my, false, 'Mambo');
    $args = explode('/', trim($_GET['task']));
    CRM_Core_Invoke::invoke($args);
}
Exemple #3
0
function civicrm_invoke()
{
    civicrm_init();
    plugin_init();
    $user = JFactory::getUser();
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($user, false, 'Joomla', 'Individual');
    if (isset($_GET['task'])) {
        $args = explode('/', trim($_GET['task']));
        CRM_Core_Invoke::invoke($args);
    } else {
        $_GET['task'] = 'civicrm/dashboard';
        $_GET['reset'] = 1;
        $args = array('civicrm', 'dashboard');
        CRM_Core_Invoke::invoke($args);
    }
}
Exemple #4
0
function civicrm_invoke()
{
    civicrm_init();
    // check and ensure that we have a valid session
    if (!empty($_POST)) {
        // the session should not be empty
        // however for standalone forms, it will not have any CiviCRM variables in the
        // session either, so dont check for it
        if (count($_SESSION) <= 1) {
            require_once 'CRM/Utils/System.php';
            $config =& CRM_Core_Config::singleton();
            CRM_Utils_System::redirect($config->userFrameworkBaseURL);
        }
    }
    // add all the values from the itemId param
    // overrride the GET values if conflict
    if (CRM_Utils_Array::value('Itemid', $_GET)) {
        $component =& JComponentHelper::getComponent('com_civicrm');
        $menu =& JSite::getMenu();
        $item = $menu->getItems('componentid', $component->id, true);
        $params = $menu->getParams($_GET['Itemid']);
        $args = array('task', 'id', 'gid', 'reset', 'pageId', 'action');
        foreach ($args as $a) {
            $val = $params->get($a, null);
            if ($val !== null) {
                $_GET[$a] = $val;
            }
        }
    }
    $task = CRM_Utils_Array::value('task', $_GET, '');
    $args = explode('/', trim($task));
    // check permission
    if (!civicrm_check_permission($args)) {
        echo "You do not have permission to execute this url.";
        return;
    }
    require_once 'CRM/Utils/System/Joomla.php';
    CRM_Utils_System_Joomla::addHTMLHead(null, true);
    $user = JFactory::getUser();
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($user, false, 'Joomla', 'Individual');
    CRM_Core_Invoke::invoke($args);
}
function civicrm_invoke()
{
    civicrm_init();
    // check and ensure that we have a valid session
    if (!empty($_POST)) {
        // the session should not be empty
        // however for standalone forms, it will not have any CiviCRM variables in the
        // session either, so dont check for it
        if (count($_SESSION) <= 1) {
            require_once 'CRM/Utils/System.php';
            $config = CRM_Core_Config::singleton();
            CRM_Utils_System::redirect($config->userFrameworkBaseURL);
        }
    }
    // add all the values from the itemId param
    // overrride the GET values if conflict
    if (CRM_Utils_Array::value('Itemid', $_GET)) {
        $component = JComponentHelper::getComponent('com_civicrm');
        $menu = JSite::getMenu();
        $params = $menu->getParams($_GET['Itemid']);
        $args = array('task', 'id', 'gid', 'pageId', 'action', 'csid');
        $view = CRM_Utils_Array::value('view', $_GET);
        if ($view) {
            $args[] = 'reset';
        }
        foreach ($args as $a) {
            $val = $params->get($a, NULL);
            if ($val !== NULL && $view) {
                $_GET[$a] = $val;
            }
        }
    }
    $task = CRM_Utils_Array::value('task', $_GET, '');
    $args = explode('/', trim($task));
    require_once 'CRM/Utils/System/Joomla.php';
    CRM_Utils_System_Joomla::addHTMLHead(NULL, TRUE);
    $user = JFactory::getUser();
    require_once 'CRM/Core/BAO/UFMatch.php';
    CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);
    CRM_Core_Invoke::invoke($args);
}
Exemple #6
0
function invoke()
{
    $session =& CRM_Core_Session::singleton();
    $config =& CRM_Core_Config::singleton();
    // display error if any
    showError($session);
    $urlVar = $config->userFrameworkURLVar;
    require_once 'CRM/Core/Invoke.php';
    if ($session->get('userID') == null || $session->get('userID') == '') {
        if ($_GET[$urlVar] == "") {
            require_once "CRM/Core/BAO/UFMatch.php";
            if (CRM_Core_BAO_UFMatch::isEmptyTable() == false) {
                include 'login.html';
            } else {
                $session->set('new_install', true);
                include 'new_install.html';
            }
            exit(1);
        } else {
            $str = '';
            if ($session->get('new_install') !== true && $_GET[$urlVar] !== "civicrm/standalone/register") {
                $str = "<a href=\"{$config->userFrameworkBaseURL}\">Login here</a> if you have an account.\n";
            } elseif ($_GET[$urlVar] == "civicrm/standalone/register" && isset($_GET['reset'])) {
                // this is when user first registers with civicrm
                print "<head><style type=\"text/css\"> body {border: 1px #CCC solid;margin: 3em;padding: 1em 1em 1em 2em;} </style></head>\n";
            }
            print $str . CRM_Core_Invoke::invoke(explode('/', $_GET[$urlVar]));
        }
    } else {
        if ($_GET[$urlVar] == "") {
            print CRM_Core_Invoke::invoke(array("civicrm", "dashboard"));
        } else {
            print CRM_Core_Invoke::invoke(explode('/', $_GET[$urlVar]));
        }
    }
}
 /**
  * @description: invoke CiviCRM in a WordPress context
  * Callback function from add_menu_page()
  * Callback from WordPress 'init' and 'the_content' hooks
  * Also called by add_shortcode_includes() and _civicrm_update_user()
  */
 public function invoke()
 {
     static $alreadyInvoked = FALSE;
     if ($alreadyInvoked) {
         return;
     }
     if (!$this->initialize()) {
         return '';
     }
     // CRM-12523
     // WordPress has it's own timezone calculations
     // Civi relies on the php default timezone which WP
     // overrides with UTC in wp-settings.php
     $wpBaseTimezone = date_default_timezone_get();
     $wpUserTimezone = get_option('timezone_string');
     if ($wpUserTimezone) {
         date_default_timezone_set($wpUserTimezone);
         CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
     }
     // Add our standard css & js
     CRM_Core_Resources::singleton()->addCoreResources();
     // CRM-95XX
     // At this point we are calling a civicrm function
     // Since WP messes up and always quotes the request, we need to reverse
     // what it just did
     $this->remove_wp_magic_quotes();
     if (isset($_GET['q'])) {
         $args = explode('/', trim($_GET['q']));
     } else {
         $_GET['q'] = 'civicrm/dashboard';
         $_GET['reset'] = 1;
         $args = array('civicrm', 'dashboard');
     }
     global $current_user;
     get_currentuserinfo();
     /*
      * bypass synchronize if running upgrade
      * to avoid any serious non-recoverable error
      * which might hinder the upgrade process.
      */
     if (CRM_Utils_Array::value('q', $_GET) != 'civicrm/upgrade') {
         require_once 'CRM/Core/BAO/UFMatch.php';
         CRM_Core_BAO_UFMatch::synchronize($current_user, FALSE, 'WordPress', 'Individual', TRUE);
     }
     if ($this->isPageRequest() && !in_the_loop() && !is_admin()) {
         return;
     }
     $alreadyInvoked = TRUE;
     // do the business
     CRM_Core_Invoke::invoke($args);
     // restore WP's timezone
     if ($wpBaseTimezone) {
         date_default_timezone_set($wpBaseTimezone);
     }
     // notify plugins
     do_action('civicrm_invoked');
 }
 /**
  * Invoke CiviCRM in a WordPress context
  * Callback function from add_menu_page()
  * Callback from WordPress 'init' and 'the_content' hooks
  * Also called by shortcode_render() and _civicrm_update_user()
  *
  * @return void
  */
 public function invoke()
 {
     static $alreadyInvoked = FALSE;
     if ($alreadyInvoked) {
         return;
     }
     // bail if this is called via a content-preprocessing plugin
     if ($this->is_page_request() && !in_the_loop() && !is_admin()) {
         return;
     }
     if (!$this->initialize()) {
         return;
     }
     // CRM-12523
     // WordPress has it's own timezone calculations
     // Civi relies on the php default timezone which WP
     // overrides with UTC in wp-settings.php
     $wpBaseTimezone = date_default_timezone_get();
     $wpUserTimezone = get_option('timezone_string');
     if ($wpUserTimezone) {
         date_default_timezone_set($wpUserTimezone);
         CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
     }
     // CRM-95XX
     // At this point we are calling a CiviCRM function
     // WP always quotes the request, CiviCRM needs to reverse what it just did
     $this->remove_wp_magic_quotes();
     // Code inside invoke() requires the current user to be set up
     $current_user = wp_get_current_user();
     /**
      * Bypass synchronize if running upgrade to avoid any serious non-recoverable
      * error which might hinder the upgrade process.
      */
     if (CRM_Utils_Array::value('q', $_GET) != 'civicrm/upgrade') {
         $this->users->sync_user($current_user);
     }
     // set flag
     $alreadyInvoked = TRUE;
     // get args
     $argdata = $this->get_request_args();
     // set dashboard as default if args are empty
     if (!isset($_GET['q'])) {
         $_GET['q'] = 'civicrm/dashboard';
         $_GET['reset'] = 1;
         $argdata['args'] = array('civicrm', 'dashboard');
     }
     // do the business
     CRM_Core_Invoke::invoke($argdata['args']);
     // restore WP's timezone
     if ($wpBaseTimezone) {
         date_default_timezone_set($wpBaseTimezone);
     }
     // restore WP's arrays
     $this->restore_wp_magic_quotes();
     // notify plugins
     do_action('civicrm_invoked');
 }