示例#1
0
function run($supportedArgs, $context)
{
    session_start();
    require_once '../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config =& CRM_Core_Config::singleton();
    // this does not return on failure
    CRM_Utils_System::authenticateScript(true);
    $mailDir = MAIL_DIR_DEFAULT;
    if (isset($_GET['mailDir'])) {
        $mailDir = $_GET['mailDir'];
    }
    if (array_key_exists('context', $_GET) && isset($supportedArgs[strtolower($_GET['context'])])) {
        $context = $supportedArgs[strtolower($_GET['context'])];
    }
    $email = new bin_Email2Activity($mailDir, $context);
    $email->run();
}
function run($supportedArgs, $context)
{
    session_start();
    require_once '../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    // this does not return on failure
    CRM_Utils_System::authenticateScript(true);
    //log the execution of script
    CRM_Core_Error::debug_log_message('Email2Activity.php');
    // load bootstrap to call hooks
    require_once 'CRM/Utils/System.php';
    CRM_Utils_System::loadBootStrap();
    $mailDir = MAIL_DIR_DEFAULT;
    if (isset($_GET['mailDir'])) {
        $mailDir = $_GET['mailDir'];
    }
    if ($mailDir == 'PUT YOUR MAIL DIR HERE') {
        require_once 'CRM/Core/Error.php';
        CRM_Core_Error::fatal();
    }
    if (array_key_exists('context', $_GET) && isset($supportedArgs[strtolower($_GET['context'])])) {
        $context = $supportedArgs[strtolower($_GET['context'])];
    }
    $email = new bin_Email2Activity($mailDir, $context);
    $email->run();
}