当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Setting类代码示例

本文整理汇总了PHP中CRM_Core_BAO_Setting的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Setting类的具体用法?PHP CRM_Core_BAO_Setting怎么用?PHP CRM_Core_BAO_Setting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CRM_Core_BAO_Setting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: windowsill_civicrm_tokenValues

/**
 * implementation of CiviCRM tokenValues hook.
 */
function windowsill_civicrm_tokenValues(&$values, &$contactIDs, $jobID, $tokens = array(), $context = NULL)
{
    // Get settings from civicrm
    $settings = CRM_Core_BAO_Setting::getItem('windowsill', 'settings');
    $decode = json_decode(utf8_decode($settings), TRUE);
    // Loop settings
    foreach ($decode as &$value) {
        // Check if tab is configured
        if ($value['token']) {
            $name = str_replace(' ', '_', $value['name']);
            $view = explode(':', $value['view']);
            // Rendered
            $rendered = views_embed_view($view[0], $view[1]);
            /*
            // absolute paths are set to url paths (Anchor tags)
            //$rendered['windowsill:'.$name] = preg_replace('/<\s*a\s(.*?)href="\/(.*?)"(.*?)>/i', '<a $1href="'.$base_url.$base_path.'$2"$3>', $rendered['windowsill:'.$name]);
            //$rendered['windowsill:'.$name] = preg_replace('/<\s*img\s(.*?)src="\/(.*?)"(.*?)>/i', '<img $1src="'.$base_url.$base_path.'$2"$3>', $rendered['windowsill:'.$name]);
            */
            // Set token
            foreach ($contactIDs as $contactID) {
                $values[$contactID]['windowsill.' . $name] = $rendered;
            }
        }
    }
}
开发者ID:kewljuice,项目名称:be.ctrl.windowsill,代码行数:28,代码来源:hooks.php

示例2: checkAllHouseholds

 /**
  * Identify all the households to check and do it
  *
  * If max_count is set, it will stop after that amount,
  * saving the last household id for the next call
  */
 public function checkAllHouseholds($max_count = NULL)
 {
     $max_count = (int) $max_count;
     $activity_type_id = CRM_Householdmerge_Logic_Configuration::getCheckHouseholdActivityTypeID();
     $activity_status_ids = CRM_Householdmerge_Logic_Configuration::getLiveActivityStatusIDs();
     if ($max_count) {
         $contact_id_minimum = CRM_Core_BAO_Setting::getItem(CRM_Householdmerge_Logic_Configuration::$HHMERGE_SETTING_DOMAIN, 'hh_check_last_id');
         if (!$contact_id_minimum) {
             $contact_id_minimum = 0;
         }
         $limit_clause = "LIMIT {$max_count}";
     } else {
         $contact_id_minimum = 0;
         $limit_clause = '';
     }
     $last_contact_id_processed = 0;
     $selector_sql = "SELECT civicrm_contact.id AS contact_id\n                     FROM civicrm_contact\n                     LEFT JOIN civicrm_activity_contact ON civicrm_activity_contact.contact_id = civicrm_contact.id\n                     LEFT JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_activity.id AND civicrm_activity.activity_type_id = {$activity_type_id} AND civicrm_activity.status_id IN ({$activity_status_ids})\n                     WHERE contact_type = 'Household'\n                       AND civicrm_activity.id IS NULL                       \n                       AND (civicrm_contact.is_deleted IS NULL or civicrm_contact.is_deleted = 0)\n                       AND civicrm_contact.id > {$contact_id_minimum}\n                     GROUP BY civicrm_contact.id\n                     ORDER BY civicrm_contact.id ASC\n                     {$limit_clause}";
     $query = CRM_Core_DAO::executeQuery($selector_sql);
     while ($query->fetch()) {
         $last_contact_id_processed = $query->contact_id;
         $this->checkHousehold($last_contact_id_processed);
         $max_count--;
     }
     // done
     if ($max_count > 0) {
         // we're through the whole list, reset marker
         CRM_Core_BAO_Setting::setItem('0', CRM_Householdmerge_Logic_Configuration::$HHMERGE_SETTING_DOMAIN, 'hh_check_last_id');
     } else {
         CRM_Core_BAO_Setting::setItem($last_contact_id_processed, CRM_Householdmerge_Logic_Configuration::$HHMERGE_SETTING_DOMAIN, 'hh_check_last_id');
     }
     return;
 }
开发者ID:systopia,项目名称:de.systopia.householdmerge,代码行数:38,代码来源:Checker.php

示例3: run

 function run()
 {
     $this->setActivityStatusIds();
     $this->setValues();
     $contactParams = array('is_opt_out' => 1);
     $groupId = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id');
     $location = '';
     if ($this->isGroupContactAdded($this->contactId, $groupId)) {
         $this->setGroupContactRemoved($this->contactId, $groupId);
         $location = 'removed from Members after optout link';
         if (CRM_Speakcivi_Cleanup_Leave::hasJoins($this->contactId)) {
             CRM_Speakcivi_Logic_Activity::leave($this->contactId, 'confirmation_link', $this->campaignId, $this->activityId, '', 'Added by SpeakCivi Optout');
         }
     }
     if ($this->campaignId) {
         $campaign = new CRM_Speakcivi_Logic_Campaign($this->campaignId);
         $locale = $campaign->getLanguage();
         $language = substr($locale, 0, 2);
         $this->setLanguageTag($this->contactId, $language);
     }
     CRM_Speakcivi_Logic_Contact::set($this->contactId, $contactParams);
     $aids = $this->findActivitiesIds($this->activityId, $this->campaignId, $this->contactId);
     $this->setActivitiesStatuses($this->activityId, $aids, 'optout', $location);
     $country = $this->getCountry($this->campaignId);
     $url = "{$country}/post_optout";
     CRM_Utils_System::redirect($url);
 }
开发者ID:WeMoveEU,项目名称:speakcivi,代码行数:27,代码来源:Optout.php

示例4: run

 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();
 }
开发者ID:kewljuice,项目名称:be.ctrl.windowsill,代码行数:32,代码来源:data.php

示例5: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     // text for sort_name or email criteria
     $config = CRM_Core_Config::singleton();
     $label = empty($config->includeEmailInName) ? ts('Name') : ts('Name or Email');
     $this->add('text', 'sort_name', $label);
     $searchOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'advanced_search_options');
     if (!empty($searchOptions['contactType'])) {
         $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements();
         $this->add('select', 'contact_type', ts('is...'), $contactTypes);
     }
     if (!empty($searchOptions['groups'])) {
         // Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title)
         $groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($this->_group, NULL, '&nbsp;&nbsp;', TRUE);
         // add select for groups
         $group = array('' => ts('- any group -')) + $groupHierarchy;
         $this->_groupElement =& $this->addElement('select', 'group', ts('in'), $group);
     }
     if (!empty($searchOptions['tags'])) {
         // tag criteria
         if (!empty($this->_tag)) {
             $tag = array('' => ts('- any tag -')) + $this->_tag;
             $this->_tagElement =& $this->addElement('select', 'tag', ts('with'), $tag);
         }
     }
     parent::buildQuickForm();
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:34,代码来源:Basic.php

示例6: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     // text for sort_name or email criteria
     $config = CRM_Core_Config::singleton();
     $label = empty($config->includeEmailInName) ? ts('Name') : ts('Name or Email');
     $this->add('text', 'sort_name', $label);
     $searchOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'advanced_search_options');
     $shortCuts = array();
     //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
     // this is loaded onto then replace with something like '__' & test
     $separator = CRM_Core_DAO::VALUE_SEPARATOR;
     if (!empty($searchOptions['contactType'])) {
         $contactTypes = array('' => ts('- any contact type -')) + CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
         $this->add('select', 'contact_type', ts('is...'), $contactTypes, FALSE, array('class' => 'crm-select2'));
     }
     if (!empty($searchOptions['groups'])) {
         // Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title)
         $groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($this->_group, NULL, '&nbsp;&nbsp;', TRUE);
         // add select for groups
         $group = array('' => ts('- any group -')) + $groupHierarchy;
         $this->add('select', 'group', ts('in'), $group, FALSE, array('class' => 'crm-select2'));
     }
     if (!empty($searchOptions['tags'])) {
         // tag criteria
         if (!empty($this->_tag)) {
             $tag = array('' => ts('- any tag -')) + $this->_tag;
             $this->add('select', 'tag', ts('with'), $tag, FALSE, array('class' => 'crm-select2'));
         }
     }
     parent::buildQuickForm();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:38,代码来源:Basic.php

示例7: run

 /**
  * 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();
 }
开发者ID:sunilpawar,项目名称:uk.co.vedaconsulting.mailchimp,代码行数:36,代码来源:WebHook.php

示例8: _civicrm_api3_generic_getList_defaults

/**
 * Set defaults for api.getlist
 *
 * @param $entity string
 * @param $request array
 */
function _civicrm_api3_generic_getList_defaults($entity, &$request)
{
    $config = CRM_Core_Config::singleton();
    $fields = _civicrm_api_get_fields($entity);
    $defaults = array('page_num' => 1, 'input' => '', 'image_field' => NULL, 'id_field' => 'id', 'params' => array());
    // Find main field from meta
    foreach (array('sort_name', 'title', 'label', 'name') as $field) {
        if (isset($fields[$field])) {
            $defaults['label_field'] = $defaults['search_field'] = $field;
            break;
        }
    }
    foreach (array('description') as $field) {
        if (isset($fields[$field])) {
            $defaults['description_field'] = $field;
            break;
        }
    }
    $resultsPerPage = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10);
    $request += $defaults;
    // Default api params
    $params = array('options' => array('limit' => $resultsPerPage + 1, 'offset' => ($request['page_num'] - 1) * $resultsPerPage, 'sort' => $request['label_field']), 'sequential' => 1);
    // When searching e.g. autocomplete
    if ($request['input']) {
        $params[$request['search_field']] = array('LIKE' => ($config->includeWildCardInName ? '%' : '') . $request['input'] . '%');
    }
    // When looking up a field e.g. displaying existing record
    if (!empty($request['id'])) {
        if (is_string($request['id']) && strpos(',', $request['id'])) {
            $request['id'] = explode(',', $request['id']);
        }
        $params[$request['id_field']] = is_array($request['id']) ? array('IN' => $request['id']) : $request['id'];
    }
    $request['params'] += $params;
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:41,代码来源:Getlist.php

示例9: postProcess

 /**
  * Form submission of new/edit api is processed.
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     //get the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     // Save the API Key & Save the Security Key
     if (CRM_Utils_Array::value('api_key', $params)) {
         CRM_Core_BAO_Setting::setItem($params['api_key'], self::MC_SETTING_GROUP, 'api_key');
     }
     $session = CRM_Core_Session::singleton();
     $message = "Api Key has been Saved!";
     $session->setStatus($message, ts('Api Key Saved'), 'success');
     $urlParams = null;
     $session->replaceUserContext(CRM_Utils_System::url('civicrm/mailchimp/apikeyregister', $urlParams));
     try {
         $mcClient = new Mailchimp($params['api_key']);
         $mcHelper = new Mailchimp_Helper($mcClient);
         $details = $mcHelper->accountDetails();
     } catch (Mailchimp_Invalid_ApiKey $e) {
         CRM_Core_Session::setStatus($e->getMessage());
         return FALSE;
     } catch (Mailchimp_HttpError $e) {
         CRM_Core_Session::setStatus($e->getMessage());
         return FALSE;
     }
     $message = "Following is the account information received from API callback:<br/>\n        <table class='mailchimp-table'>\n        <tr><td>Company:</td><td>{$details['contact']['company']}</td></tr>\n        <tr><td>First Name:</td><td>{$details['contact']['fname']}</td></tr>\n        <tr><td>Last Name:</td><td>{$details['contact']['lname']}</td></tr>\n        </table>";
     CRM_Core_Session::setStatus($message);
 }
开发者ID:prashantgajare,项目名称:com.webaccessglobal.mailchimpsync,代码行数:34,代码来源:ApiKeyRegister.php

示例10: setDefaultValues

 public function setDefaultValues()
 {
     $defaults = array();
     try {
         $defaults['rood_mtype'] = civicrm_api3('MembershipType', 'getvalue', array('return' => 'id', 'name' => 'Lid SP en ROOD'));
     } catch (Exception $e) {
         //do nothing
     }
     try {
         $defaults['rood_mstatus'] = civicrm_api3('MembershipStatus', 'getvalue', array('return' => 'id', 'name' => 'Correctie'));
     } catch (Exception $e) {
         //do nothing
     }
     try {
         $defaults['sp_mtype'] = civicrm_api3('MembershipType', 'getvalue', array('return' => 'id', 'name' => 'Lid SP'));
     } catch (Exception $e) {
         //do nothing
     }
     try {
         $status = civicrm_api3('MembershipStatus', 'getvalue', array('return' => 'id', 'name' => 'current'));
         $defaults['member_status_id'][$status] = $status;
     } catch (Exception $e) {
         //do nothing
     }
     $date = new DateTime();
     $date->modify('-26 years');
     $date->modify('first day of this year');
     list($defaults['birth_date_from']) = CRM_Utils_Date::setDateDefaults($date->format('Y-m-d'));
     $date->modify('last day of this year');
     list($defaults['birth_date_to']) = CRM_Utils_Date::setDateDefaults($date->format('Y-m-d'));
     $minimum_fee = CRM_Core_BAO_Setting::getItem('nl.sp.rood', 'minimum_fee', null, '5.00');
     $defaults['minimum_fee'] = $minimum_fee;
     return $defaults;
 }
开发者ID:SPnl,项目名称:nl.sp.rood,代码行数:34,代码来源:UpgradeRoodMembership.php

示例11: setPreUpgradeMessage

 /**
  * Compute any messages which should be displayed before upgrade.
  *
  * @param string $preUpgradeMessage
  *   alterable.
  * @param $currentVer
  * @param $latestVer
  */
 public static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer)
 {
     if (version_compare(phpversion(), self::MIN_RECOMMENDED_PHP_VER) < 0) {
         $preUpgradeMessage .= '<br />' . ts('This webserver is running an outdated version of PHP (%1). The recommended version is %2 or later.', array(1 => phpversion(), 2 => self::MIN_RECOMMENDED_PHP_VER)) . '<br />' . ts('You may proceed with the upgrade and CiviCRM %1 will continue working normally, but future releases will require PHP %2.', array(1 => $latestVer, 2 => self::MIN_RECOMMENDED_PHP_VER));
     }
     // http://issues.civicrm.org/jira/browse/CRM-13572
     // Depending on how the code was upgraded, some sites may still have copies of old
     // source files left behind. This is often a forgivable offense, but it's quite
     // dangerous for CIVI-SA-2013-001.
     global $civicrm_root;
     $ofcFile = "{$civicrm_root}/packages/OpenFlashChart/php-ofc-library/ofc_upload_image.php";
     if (file_exists($ofcFile)) {
         if (@unlink($ofcFile)) {
             $preUpgradeMessage .= '<br />' . ts('This system included an outdated, insecure script (%1). The file was automatically deleted.', array(1 => $ofcFile));
         } else {
             $preUpgradeMessage .= '<br />' . ts('This system includes an outdated, insecure script (%1). Please delete it.', array(1 => $ofcFile));
         }
     }
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'enable_innodb_fts', NULL, FALSE)) {
         // The FTS indexing feature dynamically manipulates the schema which could
         // cause conflicts with other layers that manipulate the schema. The
         // simplest thing is to turn it off and back on.
         // It may not always be necessary to do this -- but I doubt we're going to test
         // systematically in future releases.  When it is necessary, one could probably
         // ignore the matter and simply run CRM_Core_InnoDBIndexer::fixSchemaDifferences
         // after the upgrade.  But that's speculative.  For now, we'll leave this
         // advanced feature in the hands of the sysadmin.
         $preUpgradeMessage .= '<br />' . ts('This database uses InnoDB Full Text Search for optimized searching. The upgrade procedure has not been tested with this feature. You should disable (and later re-enable) the feature by navigating to "Administer => System Settings => Miscellaneous".');
     }
 }
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:38,代码来源:General.php

示例12: getSettings

 /**
  * @return array
  */
 public static function getSettings()
 {
     if (is_null(static::$settings)) {
         static::$settings = (array) CRM_Core_BAO_Setting::getItem('Extension', 'uk.co.compucorp.civicrm.giftaid:settings');
     }
     return static::$settings;
 }
开发者ID:aydun,项目名称:uk.co.compucorp.civicrm.giftaid,代码行数:10,代码来源:Admin.php

示例13: LLC

/**
+--------------------------------------------------------------------+
| CiviCRM version 4.6                                                |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015                                |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM.                                    |
|                                                                    |
| CiviCRM is free software; you can copy, modify, and distribute it  |
| under the terms of the GNU Affero General Public License           |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
|                                                                    |
| CiviCRM is distributed in the hope that it will be useful, but     |
| WITHOUT ANY WARRANTY; without even the implied warranty of         |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
| See the GNU Affero General Public License for more details.        |
|                                                                    |
| You should have received a copy of the GNU Affero General Public   |
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
function civicrm_api3_prevem_login($params)
{
    $prevemUrl = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'prevem_url');
    $prevemURL = !empty($prevemUrl) ? CRM_Utils_URL::mask($prevemUrl, array('user', 'pass')) : NULL;
    if (!$prevemURL) {
        return civicrm_api3_create_error("prevemURL is not configured. Go to Administer>CiviMail>CiviMail Component Settings to configure prevemURL");
    }
    $prevemConsumer = parse_url($prevemUrl, PHP_URL_USER);
    $prevemSecret = parse_url($prevemUrl, PHP_URL_PASS);
    /** TODO Parse $prevemUrl. Send login request to get token. **/
    /** To send login request, see eg http://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents **/
    $postdata = http_build_query(array('email' => $prevemConsumer . "@foo.com", 'password' => $prevemSecret));
    $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
    $context = stream_context_create($opts);
    $result = file_get_contents($prevemURL . '/api/Users/login', FALSE, $context);
    if ($result === FALSE) {
        return civicrm_api3_create_error("Failed to login. Check if Preview Manager is running on " . $prevemURL);
    } else {
        $accessToken = json_decode($result)->{'id'};
        if (!$accessToken) {
            return civicrm_api3_create_error("Failed to parse access token. Check if Preview Manager is running on " . $prevemURL);
        }
        $returnValues = array('url' => $prevemURL, 'consumerId' => $prevemConsumer, 'token' => $accessToken, 'password' => $prevemSecret);
        return civicrm_api3_create_success($returnValues, $params, 'Prevem', 'login');
    }
}
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:51,代码来源:Prevem.php

示例14: overrides_civicrm_install

/**
 * Implements hook_civicrm_install().
 *
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
 */
function overrides_civicrm_install()
{
    CRM_Core_DAO::executeQuery("\n    CREATE TABLE `klangsoft_overrides` (\n      `snapshot` text NOT NULL\n    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    CRM_Core_DAO::executeQuery("INSERT INTO `klangsoft_overrides` VALUES ('a:0:{}');");
    CRM_Core_BAO_Setting::setItem('', 'com.klangsoft_overrides', 'last_snapshot');
    _overrides_civix_civicrm_install();
}
开发者ID:konadave,项目名称:com.klangsoft.overrides,代码行数:12,代码来源:overrides.php

示例15: route

 /**
  * @param array $cxn
  * @param string $entity
  * @param string $action
  * @param array $params
  * @return mixed
  */
 public static function route($cxn, $entity, $action, $params)
 {
     $SUPER_PERM = array('administer CiviCRM');
     require_once 'api/v3/utils.php';
     // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()?
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') && !CRM_Utils_System::isSSL() && strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https') {
         return civicrm_api3_create_error('System policy requires HTTPS.');
     }
     // Note: $cxn and cxnId are authenticated before router is called.
     $dao = new CRM_Cxn_DAO_Cxn();
     $dao->cxn_id = $cxn['cxnId'];
     if (empty($cxn['cxnId']) || !$dao->find(TRUE) || !$dao->cxn_id) {
         return civicrm_api3_create_error('Failed to lookup connection authorizations.');
     }
     if (!$dao->is_active) {
         return civicrm_api3_create_error('Connection is inactive.');
     }
     if (!is_string($entity) || !is_string($action) || !is_array($params)) {
         return civicrm_api3_create_error('API parameters are malformed.');
     }
     if (empty($cxn['perm']['api']) || !is_array($cxn['perm']['api']) || empty($cxn['perm']['grant']) || !(is_array($cxn['perm']['grant']) || is_string($cxn['perm']['grant']))) {
         return civicrm_api3_create_error('Connection has no permissions.');
     }
     $whitelist = \Civi\API\WhitelistRule::createAll($cxn['perm']['api']);
     \Civi::service('dispatcher')->addSubscriber(new \Civi\API\Subscriber\WhitelistSubscriber($whitelist));
     CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
     if ($cxn['perm']['grant'] === '*') {
         CRM_Core_Config::singleton()->userPermissionTemp->grant($SUPER_PERM);
     } else {
         CRM_Core_Config::singleton()->userPermissionTemp->grant($cxn['perm']['grant']);
     }
     $params['check_permissions'] = 'whitelist';
     return civicrm_api($entity, $action, $params);
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:41,代码来源:ApiRouter.php


注:本文中的CRM_Core_BAO_Setting类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。