public static function donation_button_campaign_monitor_handler($posted)
 {
     $cm_api_key = get_option("campaignmonitor_api_key");
     $client_id = get_option("campaignmonitor_client_id");
     $cm_list_id = get_option("campaignmonitor_lists");
     $fname = isset($posted['first_name']) ? $posted['first_name'] : '';
     $lname = isset($posted['last_name']) ? $posted['last_name'] : '';
     $email = isset($posted['payer_email']) ? $posted['payer_email'] : $posted['receiver_email'];
     $debug = get_option('log_enable_campaignmonitor') == 'yes' ? 'yes' : 'no';
     if ('yes' == $debug) {
         $log = new Donation_Button_Logger();
     }
     if (isset($cm_api_key) && !empty($cm_api_key) && (isset($client_id) && !empty($client_id)) && (isset($cm_list_id) && !empty($cm_list_id))) {
         include_once DBP_PLUGIN_DIR_PATH . '/admin/partials/lib/campaign_monitor/csrest_subscribers.php';
         $wrap = new CS_REST_Subscribers($cm_list_id, $cm_api_key);
         try {
             $response = $wrap->get($email);
             if ($response->http_status_code == "200") {
                 $result = $wrap->update($email, array('EmailAddress' => $email, 'Name' => $fname . ' ' . $lname, 'CustomFields' => array(), 'Resubscribe' => true));
                 if ("yes" == $debug) {
                     if ($response->response->State == "Unsubscribed") {
                         $log->add('CampaignMonitor', ' CampaignMonitor new contact ' . $email . ' added to selected contact list');
                     } else {
                         $log->add('CampaignMonitor', ' CampaignMonitor update contact ' . $email . ' to selected contact list');
                     }
                 }
             } else {
                 $result = $wrap->add(array('EmailAddress' => $email, 'Name' => $fname . ' ' . $lname, 'CustomFields' => array(), 'Resubscribe' => true));
                 if (isset($result) && 'yes' == $debug) {
                     $log->add('CampaignMonitor', ' CampaignMonitor new contact ' . $email . ' added to selected contact list');
                 }
             }
         } catch (Exception $e) {
             if ('yes' == $debug) {
                 $log->add('CampaignMonitor', prin_r($e, true));
             }
         }
     } else {
         if ('yes' == $debug) {
             $log->add('CampaignMonitor', 'Campaign Monitor API Key OR Campaign Monitor Client ID does not set');
         }
     }
 }
 public static function donation_button_icontact_handler($posted)
 {
     if (!isset($posted) || empty($posted)) {
         return;
     }
     $ic_api_key = get_option("icontact_api_id");
     $app_password = get_option("icontact_api_password");
     $app_username = get_option("icontact_api_username");
     $icontact_list = get_option("icontact_lists");
     $fname = isset($posted['first_name']) ? $posted['first_name'] : '';
     $lname = isset($posted['last_name']) ? $posted['last_name'] : '';
     $email = isset($posted['payer_email']) ? $posted['payer_email'] : $posted['receiver_email'];
     $debug = get_option('log_enable_icontact') == 'yes' ? 'yes' : 'no';
     if ('yes' == $debug) {
         $log = new Donation_Button_Logger();
     }
     if (isset($ic_api_key) && !empty($ic_api_key) && (isset($app_username) && !empty($app_username)) && (isset($app_password) && !empty($app_password))) {
         if (isset($icontact_list) && !empty($icontact_list)) {
             include_once DBP_PLUGIN_DIR_PATH . '/admin/partials/lib/icontact/icontact.php';
             iContactApi::getInstance()->setConfig(array('appId' => $ic_api_key, 'apiUsername' => $app_username, 'apiPassword' => $app_password));
             $iContact = iContactApi::getInstance();
             try {
                 $contactid = $iContact->addContact($email, 'normal', null, $fname, $lname, null, null, null, null, null, null, null, null, null);
                 $subscribed = $iContact->subscribeContactToList($contactid->contactId, $icontact_list, 'normal');
                 if ('yes' == $debug) {
                     if ($subscribed) {
                         $log->add('Icontact', $email . ' Successfully Add Contact in iContact');
                     } else {
                         $log->add('Icontact', $email . ' Contact already added to target campaign in iContact');
                     }
                 }
             } catch (Exception $e) {
                 if ('yes' == $debug) {
                     $log->add('Icontact', prin_r($e, true));
                 }
             }
         }
     }
 }
Beispiel #3
0
<?php

// borrador
//  $inputName = $_GET['userfile'];
// borrador
prin_r($inputName);
$nombreFile = $_REQUEST["nomFile"];
$opcion = $_REQUEST["opcion"];
//$nombreFile=$_REQUEST["nomFile"];
$rutaFile = $_REQUEST["rutaFile"];
echo $nombreFile . '/' . $opcion . '/' . $rutaFile;
try {
    switch ($opcion) {
        case "imagen":
            $nomFile = $_REQUEST["nomFile"];
            $id = $_GET['sessionId'];
            $id = trim($id);
            session_name($id);
            session_start();
            $inputName = $_GET['userfile'];
            $fileName = $_FILES[$inputName]['name'];
            $tempLoc = $_FILES[$inputName]['tmp_name'];
            echo $_FILES[$inputName]['error'];
            $target_path = '../../../carpetaDocumentos/';
            /*
             * carpturo el nombre y la extension del file
             */
            $nombre_extension = basename($fileName);
            /*
             * carpturo la extension del file
             */