/**
  * Process a webhook request from Mailchimp.
  *
  * The only documentation for this *sigh* is (May 2016) at
  * https://apidocs.mailchimp.com/webhooks/
  */
 public function run()
 {
     CRM_Mailchimp_Utils::checkDebug("Webhook POST: " . serialize($_POST));
     // Empty response object, default response code.
     try {
         $expected_key = CRM_Core_BAO_Setting::getItem(self::MC_SETTING_GROUP, 'security_key', NULL, FALSE);
         $given_key = isset($_GET['key']) ? $_GET['key'] : null;
         list($response_code, $response_object) = $this->processRequest($expected_key, $given_key, $_POST);
         CRM_Mailchimp_Utils::checkDebug("Webhook response code {$response_code} (200 = ok)");
     } catch (RuntimeException $e) {
         $response_code = $e->getCode();
         $response_object = NULL;
         CRM_Mailchimp_Utils::checkDebug("Webhook RuntimeException code {$response_code} (200 means OK): " . $e->getMessage());
     } catch (Exception $e) {
         // Broad catch.
         $response_code = 500;
         $response_object = NULL;
         CRM_Mailchimp_Utils::checkDebug("Webhook " . get_class($e) . ": " . $e->getMessage());
     }
     // Serve HTTP response.
     if ($response_code != 200) {
         // Some fault.
         header("HTTP/1.1 {$response_code}");
     } else {
         // Return the JSON output
         header('Content-type: application/json');
         print json_encode($response_object);
     }
     CRM_Utils_System::civiExit();
 }
Пример #2
0
 /**
  * Function for building Pledge Name combo box
  */
 function pledgeName(&$config)
 {
     $getRecords = FALSE;
     if (isset($_GET['name']) && $_GET['name']) {
         $name = CRM_Utils_Type::escape($_GET['name'], 'String');
         $name = str_replace('*', '%', $name);
         $whereClause = "p.creator_pledge_desc LIKE '%{$name}%' ";
         $getRecords = TRUE;
     }
     if (isset($_GET['id']) && is_numeric($_GET['id'])) {
         $pledgeId = CRM_Utils_Type::escape($_GET['id'], 'Integer');
         $whereClause = "p.id = {$pledgeId} ";
         $getRecords = TRUE;
     }
     if ($getRecords) {
         $query = "\nSELECT p.creator_pledge_desc, p.id\nFROM civicrm_pb_pledge p\nWHERE {$whereClause}\n";
         $dao = CRM_Core_DAO::executeQuery($query);
         $elements = array();
         while ($dao->fetch()) {
             $elements[] = array('name' => $dao->creator_pledge_desc, 'value' => $dao->id);
         }
     }
     if (empty($elements)) {
         $name = $_GET['name'];
         if (!$name && isset($_GET['id'])) {
             $name = $_GET['id'];
         }
         $elements[] = array('name' => trim($name, '*'), 'value' => trim($name, '*'));
     }
     echo CRM_Utils_JSON::encode($elements, 'value');
     CRM_Utils_System::civiExit();
 }
Пример #3
0
 /**
  * Retrieve records.
  */
 public static function getBatchList()
 {
     $sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
     $params = $_REQUEST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     if ($context != 'financialBatch') {
         // data entry status batches
         $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     }
     $params['context'] = $context;
     // get batch list
     $batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     if ($context == 'financialBatch') {
         $selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
     } else {
         $selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
     }
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
Пример #4
0
 static function getImageProp()
 {
     $img = $_GET['img'];
     list($w, $h) = CRM_Badge_BAO_Badge::getImageProperties($img);
     echo json_encode(array('width' => $w, 'height' => $h));
     CRM_Utils_System::civiExit();
 }
 function preProcess()
 {
     if (!CRM_Core_Permission::check('access custom search form')) {
         CRM_Utils_System::permissionDenied();
         CRM_Utils_System::civiExit();
     }
 }
Пример #6
0
 public function run()
 {
     /**
      * @var \Civi\Angular\Manager $angular
      */
     //Use our manager instead of the one provided by core
     $angular = new Civi\Angular\VolunteerManager(\CRM_Core_Resources::singleton());
     $moduleNames = $this->parseModuleNames(\CRM_Utils_Request::retrieve('modules', 'String'), $angular);
     switch (\CRM_Utils_Request::retrieve('format', 'String')) {
         case 'json':
         case '':
             $this->send('application/javascript', json_encode($this->getMetadata($moduleNames, $angular)));
             break;
         case 'js':
             $digest = $this->digestJs($angular->getResources($moduleNames, 'js', 'path'));
             //Tell crmResource to use our ajax end-point
             $digest = str_replace("ajax/angular-modules", "ajax/volunteer-angular-modules", $digest);
             $this->send('application/javascript', $digest);
             break;
         case 'css':
             $this->send('text/css', \CRM_Utils_File::concat($angular->getResources($moduleNames, 'css', 'path'), "\n"));
             break;
         default:
             \CRM_Core_Error::fatal("Unrecognized format");
     }
     \CRM_Utils_System::civiExit();
 }
Пример #7
0
 /**
  * Function to retrieve contact mailings
  */
 public static function getContactMailings()
 {
     $contactID = CRM_Utils_Type::escape($_GET['contact_id'], 'Integer');
     $sortMapper = array(0 => 'subject', 1 => 'creator_name', 2 => '', 3 => 'start_date', 4 => '', 5 => 'links');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $params = $_POST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     $params['contact_id'] = $contactID;
     $params['context'] = $context;
     // get the contact mailings
     $mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     $selectorElements = array('subject', 'mailing_creator', 'recipients', 'start_date', 'openstats', 'links');
     header('Content-Type: application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($mailings, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
Пример #8
0
 function run()
 {
     $json = array();
     // get action
     $data = json_decode(file_get_contents("php://input"));
     // switch
     switch ($data->action) {
         case 'views':
             // variables
             $view_array = views_get_all_views($reset = FALSE);
             // build array for each view and their display
             foreach ($view_array as $view => $v) {
                 foreach ($view_array[$view]->display as $display => $d) {
                     $arr = array('id' => "{$v->name}:{$display}", 'name' => "{$v->human_name} ({$d->display_title})");
                     $json[] = $arr;
                 }
             }
             break;
         case 'settings':
             // variables
             // log
             $settings = CRM_Core_BAO_Setting::getItem('windowsill', 'settings');
             $json = json_decode(utf8_decode($settings), true);
             break;
     }
     // return JSON
     // http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension
     // http://civicrm.stackexchange.com/questions/2348/how-to-display-a-drupal-view-in-a-civicrm-tab
     print json_encode($json, JSON_PRETTY_PRINT);
     // exit
     CRM_Utils_System::civiExit();
 }
 public function postProcess()
 {
     $params = $this->_submitValues;
     $batchDetailsSql = " UPDATE civicrm_batch SET ";
     $batchDetailsSql .= "    title = %1 ";
     $batchDetailsSql .= " ,  description = %2 ";
     $batchDetailsSql .= " ,  banking_account = %3 ";
     $batchDetailsSql .= " ,  banking_date  = %4 ";
     $batchDetailsSql .= " ,  exclude_from_posting = %5 ";
     $batchDetailsSql .= " ,  contribution_type_id = %6 ";
     $batchDetailsSql .= " ,  payment_instrument_id = %7 ";
     $batchDetailsSql .= " WHERE id = %8 ";
     $bankingDate = CRM_Utils_Date::processDate($params['banking_date']);
     $sqlParams = array();
     $sqlParams[1] = array((string) $params['batch_title'], 'String');
     $sqlParams[2] = array((string) $params['description'], 'String');
     $sqlParams[3] = array((string) $params['banking_account'], 'String');
     $sqlParams[4] = array((string) $bankingDate, 'String');
     $sqlParams[5] = array((string) $params['exclude_from_posting'], 'String');
     $sqlParams[6] = array((string) $params['contribution_type_id'], 'String');
     $sqlParams[7] = array((string) $params['payment_instrument_id'], 'String');
     $sqlParams[8] = array((int) $params['id'], 'Integer');
     CRM_Core_DAO::executeQuery($batchDetailsSql, $sqlParams);
     drupal_goto('civicrm/batch/process', array('query' => array('bid' => $params['id'], 'reset' => '1')));
     CRM_Utils_System::civiExit();
 }
Пример #10
0
 public function remove_participant_from_cart()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Integer');
     $participant = CRM_Event_Cart_BAO_MerParticipant::get_by_id($id);
     $participant->delete();
     CRM_Utils_System::civiExit();
 }
Пример #11
0
 /**
  * Function to setDefaults according to membership type
  */
 function getMemberTypeDefaults($config)
 {
     if (!$_POST['mtype']) {
         $details['name'] = '';
         $details['auto_renew'] = '';
         $details['total_amount'] = '';
         echo json_encode($details);
         CRM_Utils_System::civiExit();
     }
     $memType = CRM_Utils_Type::escape($_POST['mtype'], 'Integer');
     $query = "SELECT name, minimum_fee AS total_amount, financial_type_id, auto_renew\nFROM    civicrm_membership_type\nWHERE   id = %1";
     $dao = CRM_Core_DAO::executeQuery($query, array(1 => array($memType, 'Positive')));
     $properties = array('financial_type_id', 'total_amount', 'name', 'auto_renew');
     while ($dao->fetch()) {
         foreach ($properties as $property) {
             $details[$property] = $dao->{$property};
         }
     }
     $details['total_amount_numeric'] = $details['total_amount'];
     // fix the display of the monetary value, CRM-4038
     $details['total_amount'] = CRM_Utils_Money::format($details['total_amount'], NULL, '%a');
     $options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required '));
     $details['auto_renew'] = CRM_Utils_Array::value('auto_renew', $options[$details]);
     echo json_encode($details);
     CRM_Utils_System::civiExit();
 }
Пример #12
0
 /**
  * Function the check whether the field belongs
  * to multi-record custom set
  */
 function checkIsMultiRecord()
 {
     $customId = $_GET['customId'];
     $isMultiple = CRM_Core_BAO_CustomField::isMultiRecordField($customId);
     $isMultiple = array('is_multi' => $isMultiple);
     echo json_encode($isMultiple);
     CRM_Utils_System::civiExit();
 }
Пример #13
0
 /**
  * Get list of teams.
  *
  * @return array
  */
 public static function getTeamList()
 {
     $params = $_REQUEST;
     if (isset($params['parent_id'])) {
         // requesting child groups for a given parent
         $params['page'] = 1;
         $params['rp'] = 0;
         $groups = self::getTeamListSelector($params);
         CRM_Utils_JSON::output($groups);
     } else {
         $sortMapper = array(0 => 'groups.title', 1 => 'count', 2 => 'createdBy.sort_name', 3 => '', 4 => 'groups.group_type', 5 => 'groups.visibility');
         $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
         $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
         $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
         $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
         $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
         if ($sort && $sortOrder) {
             $params['sortBy'] = $sort . ' ' . $sortOrder;
         }
         $params['page'] = $offset / $rowCount + 1;
         $params['rp'] = $rowCount;
         $params['group_type'] = teamGroupType();
         // restrict to teams logged in user may access
         $contact = billing_contact_get();
         //@todo remove for admin
         if (!CRM_Core_Permission::check('edit all contacts')) {
             $params['created_by'] = $contact['sort_name'];
         }
         // get team list
         $groups = self::getTeamListSelector($params);
         // if no groups found with parent-child hierarchy and logged in user say can view child groups only (an ACL case),
         // go ahead with flat hierarchy
         if (empty($groups)) {
             $groupsAccessible = CRM_Core_PseudoConstant::group();
             $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
             if (!empty($groupsAccessible) && $parentsOnly) {
                 // recompute group list with flat hierarchy
                 $params['parentsOnly'] = 0;
                 $groups = self::getTeamListSelector($params);
             }
         }
         $iFilteredTotal = $iTotal = count($groups);
         //$params['total'];
         $selectorElements = array('group_name', 'count', 'created_by', 'group_description', 'group_type', 'visibility', 'org_info', 'links', 'class');
         if (empty($params['showOrgInfo'])) {
             unset($selectorElements[6]);
         }
         //add setting so this can be tested by unit test
         //@todo - ideally the portion of this that retrieves the groups should be extracted into a function separate
         // from the one which deals with web inputs & outputs so we have a properly testable & re-usable function
         if (!empty($params['is_unit_test'])) {
             return array($groups, $iFilteredTotal);
         }
         header('Content-Type: application/json');
         echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
         CRM_Utils_System::civiExit();
     }
 }
 public static function getNavigationMenu()
 {
     $contactID = CRM_Core_Session::singleton()->get('userID');
     if ($contactID) {
         CRM_Core_Page_AJAX::setJsHeaders();
         print CRM_Core_Smarty::singleton()->fetchWith('CRM/Menufontawesome/Page/navigation.js.tpl', array('navigation' => CRM_Menufontawesome_BAO_Navigation::createNavigation($contactID)));
     }
     CRM_Utils_System::civiExit();
 }
 static function deleteQrCode()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullArray);
     if ($id) {
         CRM_Core_DAO::executeQuery('DELETE FROM civicrm_qrcode_settings WHERE id = %1', array(1 => array($id, 'Integer')));
         echo 'deleted';
     }
     CRM_Utils_System::civiExit();
 }
 /**
  * process the form after the input has been submitted and validated
  * @todo this is horrible copy & paste code because there is so much risk of breakage
  * in fixing the existing pdfLetter classes to be suitably generic
  * @access public
  *
  * @param $form
  * @param $membershipIDs
  * @param $skipOnHold
  * @param $skipDeceased
  * @param $contactIDs
  *
  * @return void
  */
 static function postProcessMembers(&$form, $membershipIDs, $skipOnHold, $skipDeceased, $contactIDs)
 {
     list($formValues, $categories, $html_message, $messageToken, $returnProperties) = self::processMessageTemplate($form);
     $html = self::generateHTML($membershipIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $html_message, $categories);
     self::createActivities($form, $html_message, $contactIDs);
     CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
     $form->postProcessHook();
     CRM_Utils_System::civiExit(1);
 }
 /**
  * Function to return all contributions in JSON format (for ajax calls)
  * 
  * Can also be acheived by using CiviCRM Javascript API
  */
 public static function getAllContributions()
 {
     $contributions = self::_getContributionByFinancialType();
     $total = 0;
     foreach ($contributions as $contribution) {
         $total += $contribution['net_amount'];
     }
     echo json_encode($contributions);
     CRM_Utils_System::civiExit();
 }
Пример #18
0
 /**
  * Create the labels (pdf)
  * It assumes the participants are from the same event
  *
  * @param array $participants
  *
  * @return;
  */
 public function run(&$participants)
 {
     // fetch the 1st participant, and take her event to retrieve its attributes
     $participant = reset($participants);
     $eventID = $participant['event_id'];
     $this->event = self::retrieveEvent($eventID);
     //call function to create labels
     self::createLabels($participants);
     CRM_Utils_System::civiExit(1);
 }
 function postProcess()
 {
     $config = CRM_Core_Config::singleton();
     $extenDr = $config->extensionsDir;
     $sDbScriptsDir = $extenDr . DIRECTORY_SEPARATOR . 'uk.co.vedaconsulting.recurdatafix' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR;
     CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, sprintf("%supdate.sql", $sDbScriptsDir));
     //CRM_Core_Session::setStatus('Updated table civicrm_recur table with membership id', 'Success', 'info');
     CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/recurdatafix/create', 'reset=1'));
     CRM_Utils_System::civiExit();
 }
Пример #20
0
 /**
  *  Function to get email address of a contact
  */
 static function getGovernmentID()
 {
     $contactID = CRM_Utils_Request::retrieve('cid', 'Integer');
     $govVal = self::retreiveContactFieldValue($contactID);
     $ov = CRM_Core_OptionGroup::values('type_20130502144049');
     $hideGovID = civicrm_api3('CustomField', 'getvalue', array('custom_group_id' => 'Identify', 'name' => 'is_government', 'return' => 'id'));
     $subTypes['govTypeNumber'] = CRM_Utils_Array::value('typeNumber', $govVal);
     $subTypes['govType'] = $ov[CRM_Utils_Array::value('type', $govVal)];
     echo json_encode($subTypes);
     CRM_Utils_System::civiExit();
 }
 function run()
 {
     $post = trim(file_get_contents('php://input'));
     if (empty($post)) {
         header('HTTP/1.1 421 No Event');
         CRM_Core_Error::debug_var("ENDPOINT EVENT", "Needs to be called by mailjet", true, true);
         return;
     }
     $httpHeader = CRM_Mailjet_Page_EndPoint::processMessage($post);
     header($httpHeader);
     CRM_Utils_System::civiExit();
 }
Пример #22
0
 /**
  * Constructor
  *
  * @param string  $host      the memcached server host
  * @param int     $port      the memcached server port
  * @param int     $timeout   the default timeout
  *
  * @return void
  */
 function __construct($host = 'localhost', $port = 11211, $timeout = 3600)
 {
     $this->_host = $host;
     $this->_port = $port;
     $this->_timeout = $timeout;
     $this->_cache = new Memcache();
     if (!$this->_cache->connect($this->_host, $this->_port)) {
         // dont use fatal here since we can go in an infinite loop
         echo 'Could not connect to Memcached server';
         CRM_Utils_System::civiExit();
     }
 }
Пример #23
0
 /**
  * Function to fetch the template text/html messages
  */
 function template()
 {
     $templateId = CRM_Utils_Type::escape($_POST['tid'], 'Integer');
     $messageTemplate = new CRM_Core_DAO_MessageTemplates();
     $messageTemplate->id = $templateId;
     $messageTemplate->selectAdd();
     $messageTemplate->selectAdd('msg_text, msg_html, msg_subject, pdf_format_id');
     $messageTemplate->find(TRUE);
     $messages = array('subject' => $messageTemplate->msg_subject, 'msg_text' => $messageTemplate->msg_text, 'msg_html' => $messageTemplate->msg_html, 'pdf_format_id' => $messageTemplate->pdf_format_id);
     echo json_encode($messages);
     CRM_Utils_System::civiExit();
 }
Пример #24
0
 /**
  * Function to setDefaults according to membership type
  */
 function getMemberTypeDefaults($config)
 {
     require_once 'CRM/Utils/Type.php';
     $memType = CRM_Utils_Type::escape($_POST['mtype'], 'Integer');
     $contributionType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $memType, 'contribution_type_id');
     $totalAmount = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $memType, 'minimum_fee');
     // fix the display of the monetary value, CRM-4038
     require_once 'CRM/Utils/Money.php';
     $totalAmount = CRM_Utils_Money::format($totalAmount, null, '%a');
     $details = array('contribution_type_id' => $contributionType, 'total_amount' => $totalAmount);
     echo json_encode($details);
     CRM_Utils_System::civiExit();
 }
Пример #25
0
 /**
  * Generates a XLS 2007 file and forces the browser to download it.
  *
  * @param Object $form
  * @param Array &$rows
  *
  * See @CRM_Report_Utils_Report::export2csv().
  */
 static function export2excel2007(&$form, &$rows, &$stats)
 {
     //Force a download and name the file using the current timestamp.
     $datetime = date('Ymd-Gi', $_SERVER['REQUEST_TIME']);
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="Report_' . $datetime . '.xlsx"');
     header("Content-Description: " . ts('CiviCRM report'));
     header("Content-Transfer-Encoding: binary");
     header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
     // always modified
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     self::generateFile($form, $rows, $stats);
     CRM_Utils_System::civiExit();
 }
Пример #26
0
 /**
  * Function to fetch the template text/html messages
  */
 function template()
 {
     require_once 'CRM/Utils/Type.php';
     $templateId = CRM_Utils_Type::escape($_POST['tid'], 'Integer');
     require_once "CRM/Core/DAO/MessageTemplates.php";
     $messageTemplate = new CRM_Core_DAO_MessageTemplates();
     $messageTemplate->id = $templateId;
     $messageTemplate->selectAdd();
     $messageTemplate->selectAdd('msg_text, msg_html, msg_subject');
     $messageTemplate->find(true);
     $messages = array('subject' => $messageTemplate->msg_subject, 'msg_text' => $messageTemplate->msg_text, 'msg_html' => $messageTemplate->msg_html);
     echo json_encode($messages);
     CRM_Utils_System::civiExit();
 }
Пример #27
0
 /**
  * the main function that is called when the page loads,
  * it decides the which action has to be taken for the page.
  *
  * @return null
  */
 function run()
 {
     $secretCode = CRM_Utils_Type::escape($_GET['mandrillSecret'], 'String');
     $mandrillSecret = CRM_Core_OptionGroup::values('mandrill_secret', TRUE);
     if ($secretCode !== $mandrillSecret['Secret Code']) {
         return FALSE;
     }
     if (CRM_Utils_Array::value('mandrill_events', $_POST)) {
         $reponse = json_decode($_POST['mandrill_events'], TRUE);
         if (is_array($reponse) && !empty($reponse)) {
             CRM_Mte_BAO_Mandrill::processMandrillCalls($reponse);
         }
     }
     CRM_Utils_System::civiExit();
 }
Пример #28
0
 /**
  * This function uses the deprecated v1 datatable api and needs updating. See CRM-16353.
  * @deprecated
  */
 public static function getOptionList()
 {
     $params = $_REQUEST;
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     $options = CRM_Core_BAO_CustomOption::getOptionListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     $selectorElements = array('label', 'value', 'is_default', 'is_active', 'links', 'class');
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($options, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
/**
 *
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2010
 * $Id: index.php
 * To import the table used for civicrm ticketing system
 */
function runCodeTableImport()
{
    session_start();
    require_once '../../civicrm/civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    require_once 'CRM/Core/DAO.php';
    $config =& CRM_Core_Config::singleton();
    CRM_Utils_System::authenticateScript(true);
    $sql = "\nCREATE TABLE IF NOT EXISTS `civicrm_value_direct_debit_display_settings` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Default MySQL primary key',\n  `entity_id` int(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n  `entity_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n  `display_dd_block` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
    //echo $sql;exit;
    CRM_Core_DAO::executeQuery($sql);
    echo "CiviCRM Direct Debit - table(s) created Successful";
    //CRM_Utils_System::redirect( );
    CRM_Utils_System::civiExit();
}
Пример #30
0
 /**
  * Show import status.
  */
 public static function status()
 {
     // make sure we get an id
     if (!isset($_GET['id'])) {
         return;
     }
     $config = CRM_Core_Config::singleton();
     $file = "{$config->uploadDir}status_{$_GET['id']}.txt";
     if (file_exists($file)) {
         $str = file_get_contents($file);
         echo $str;
     } else {
         $status = "<div class='description'>&nbsp; " . ts('No processing status reported yet.') . "</div>";
         echo json_encode(array(0, $status));
     }
     CRM_Utils_System::civiExit();
 }