| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
- * @param string $content the content that will be themed
- * @param boolean $print are we displaying to the screen or bypassing theming?
- * @param boolean $maintenance for maintenance mode
+ * @param string $content
+ * The content that will be themed.
+ * @param bool $print
+ * Are we displaying to the screen or bypassing theming?.
+ * @param bool $maintenance
+ * For maintenance mode.
*/
public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
// TODO: Simplify; this was copied verbatim from CiviCRM 3.4's multi-UF theming function, but that's more complex than necessary
*/
public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
// TODO: Simplify; this was copied verbatim from CiviCRM 3.4's multi-UF theming function, but that's more complex than necessary
- * @param array $params associated array
- * @param string $mail email id for cms user
- *
- * @return uid if user exists, false otherwise
+ * @param array $params
+ * @param string $mail
+ * Email id for cms user.
- * @param array $params array of name and mail values
- * @param array $errors array of errors
- * @param string $emailName field label for the 'email'
+ * @param array $params
+ * Array of name and mail values.
+ * @param array $errors
+ * Array of errors.
+ * @param string $emailName
+ * Field label for the 'email'.
*
* @return void
*/
public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
*
* @return void
*/
public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
$config = CRM_Core_Config::singleton();
- $dao = new CRM_Core_DAO();
- $name = $dao->escape(CRM_Utils_Array::value('name', $params));
+ $dao = new CRM_Core_DAO();
+ $name = $dao->escape(CRM_Utils_Array::value('name', $params));
$email = $dao->escape(CRM_Utils_Array::value('mail', $params));
_user_edit_validate(NULL, $params);
$errors = form_get_errors();
$email = $dao->escape(CRM_Utils_Array::value('mail', $params));
_user_edit_validate(NULL, $params);
$errors = form_get_errors();
* Get the drupal destination string. When this is passed in the
* URL the user will be directed to it after filling in the drupal form
*
* Get the drupal destination string. When this is passed in the
* URL the user will be directed to it after filling in the drupal form
*
- * @param CRM_Core_Form $form Form object representing the 'current' form - to which the user will be returned
- * @return string $destination destination value for URL
- *
+ * @param CRM_Core_Form $form
+ * Form object representing the 'current' form - to which the user will be returned.
+ * @return string
+ * destination value for URL
- * @param $url: string, absolute path to file
- * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+ * @param $url : string, absolute path to file
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
*/
public function addScriptUrl($url, $region) {
// CRM-15450 - D6 doesn't order internal/external links correctly so we can't use drupal_add_js
*/
public function addScriptUrl($url, $region) {
// CRM-15450 - D6 doesn't order internal/external links correctly so we can't use drupal_add_js
- * @param $code: string, javascript code
- * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+ * @param $code : string, javascript code
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
*/
public function addScript($code, $region) {
// CRM-15450 - ensure scripts are in correct order
*/
public function addScript($code, $region) {
// CRM-15450 - ensure scripts are in correct order
- * @param $url: string, absolute path to file
- * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+ * @param $url : string, absolute path to file
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
*/
public function addStyleUrl($url, $region) {
if ($region != 'html-header' || !$this->formatResourceUrl($url)) {
*/
public function addStyleUrl($url, $region) {
if ($region != 'html-header' || !$this->formatResourceUrl($url)) {
- * @param $code: string, css code
- * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+ * @param $code : string, css code
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
- * @param string $name the user name
- * @param string $password the password for the above user name
- * @param boolean $loadCMSBootstrap load cms bootstrap?
+ * @param string $name
+ * The user name.
+ * @param string $password
+ * The password for the above user name.
+ * @param bool $loadCMSBootstrap
+ * Load cms bootstrap?.
- * @return mixed false if no auth
- * array(
- * contactID, ufID, unique string ) if success
+ * @return array|bool
+ * [contactID, ufID, uniqueString] if success else false if no auth
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
- //@todo this 'PEAR-y' stuff is only required when bookstrap is not being loaded which is rare
- // if ever now.
- // probably if bootstrap is loaded this call
- // CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath); would be
- // sufficient to do what this fn does. It does exist as opposed to return which might need some hanky-panky to make
- // safe in the unknown situation where authenticate might be called & it is important that
- // false is returned
+ //@todo this 'PEAR-y' stuff is only required when bookstrap is not being loaded which is rare
+ // if ever now.
+ // probably if bootstrap is loaded this call
+ // CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath); would be
+ // sufficient to do what this fn does. It does exist as opposed to return which might need some hanky-panky to make
+ // safe in the unknown situation where authenticate might be called & it is important that
+ // false is returned
- $dbpassword = md5($password);
- $name = $dbDrupal->escapeSimple($strtolower($name));
- $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '$name' AND u.pass = '$dbpassword' AND u.status = 1";
- $query = $dbDrupal->query($sql);
+ $dbpassword = md5($password);
+ $name = $dbDrupal->escapeSimple($strtolower($name));
+ $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '$name' AND u.pass = '$dbpassword' AND u.status = 1";
+ $query = $dbDrupal->query($sql);
if ($loadCMSBootstrap) {
$bootStrapParams = array();
if ($name && $password) {
$bootStrapParams = array(
if ($loadCMSBootstrap) {
$bootStrapParams = array();
if ($name && $password) {
$bootStrapParams = array(
);
}
CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath);
);
}
CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath);
* e.g. for drupal : records a watchdog message about the new session,
* saves the login timestamp, calls hook_user op 'login' and generates a new session.
*
* e.g. for drupal : records a watchdog message about the new session,
* saves the login timestamp, calls hook_user op 'login' and generates a new session.
*
*/
public function getUFLocale() {
// return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
*/
public function getUFLocale() {
// return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
- * @param array $params Either uid, or name & pass.
- * @param boolean $loadUser boolean Require CMS user load.
- * @param boolean $throwError If true, print error on failure and exit.
- * @param boolean|string $realPath path to script
+ * @param array $params
+ * Either uid, or name & pass.
+ * @param bool $loadUser
+ * Boolean Require CMS user load.
+ * @param bool $throwError
+ * If true, print error on failure and exit.
+ * @param bool|string $realPath path to script
// which means that define(CIVICRM_CLEANURL) was correctly set.
// So we correct it
$config = CRM_Core_Config::singleton();
// which means that define(CIVICRM_CLEANURL) was correctly set.
// So we correct it
$config = CRM_Core_Config::singleton();
// CRM-8655: Drupal wasn't available during bootstrap, so hook_civicrm_config never executes
CRM_Utils_Hook::config($config);
// CRM-8655: Drupal wasn't available during bootstrap, so hook_civicrm_config never executes
CRM_Utils_Hook::config($config);
do {
$cmsRoot = $firstVar . '/' . implode('/', $pathVars);
$cmsIncludePath = "$cmsRoot/includes";
do {
$cmsRoot = $firstVar . '/' . implode('/', $pathVars);
$cmsIncludePath = "$cmsRoot/includes";
- //stop as we found bootstrap.
- if (@opendir($cmsIncludePath) &&
- file_exists("$cmsIncludePath/bootstrap.inc")
- ) {
+ // Stop if we found bootstrap.
+ if (file_exists("$cmsIncludePath/bootstrap.inc")) {
*/
public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
*/
public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
//kinda hackish but not sure how to do it right
//hope http_build_url() will help at some point.
if (is_array($parseUrl) && !empty($parseUrl)) {
//kinda hackish but not sure how to do it right
//hope http_build_url() will help at some point.
if (is_array($parseUrl) && !empty($parseUrl)) {
- $urlParts = explode('/', $url);
- $hostKey = array_search($parseUrl['host'], $urlParts);
- $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
+ $urlParts = explode('/', $url);
+ $hostKey = array_search($parseUrl['host'], $urlParts);
+ $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
* Find any users/roles/security-principals with the given permission
* and replace it with one or more permissions.
*
* Find any users/roles/security-principals with the given permission
* and replace it with one or more permissions.
*
- * @param $oldPerm string
- * @param $newPerms array, strings
+ * @param string $oldPerm
+ * @param array $newPerms
+ * Array, strings.
$perms = $perms + drupal_map_assoc($newPerms);
$permList = implode(', ', $perms);
db_query('UPDATE {permission} SET perm = "%s" WHERE rid = %d', $permList, $rid);
$perms = $perms + drupal_map_assoc($newPerms);
$permList = implode(', ', $perms);
db_query('UPDATE {permission} SET perm = "%s" WHERE rid = %d', $permList, $rid);
if ( ! empty( $roles ) ) {
$rids = implode(',', array_keys($roles));
db_query( 'UPDATE {permission} SET perm = CONCAT( perm, \', edit all events\') WHERE rid IN (' . implode(',', array_keys($roles)) . ')' );
db_query( "UPDATE {permission} SET perm = REPLACE( perm, '%s', '%s' ) WHERE rid IN ($rids)",
if ( ! empty( $roles ) ) {
$rids = implode(',', array_keys($roles));
db_query( 'UPDATE {permission} SET perm = CONCAT( perm, \', edit all events\') WHERE rid IN (' . implode(',', array_keys($roles)) . ')' );
db_query( "UPDATE {permission} SET perm = REPLACE( perm, '%s', '%s' ) WHERE rid IN ($rids)",
- $oldPerm, implode(', ', $newPerms) );*/
+ $oldPerm, implode(', ', $newPerms) );
+ @codingStandardsIgnoreEnd */
- * @param string $destination - if present, add destination to querystring (works for Drupal only)
+ * @param string $destination
+ * If present, add destination to querystring (works for Drupal only).
- public function og_membership_create($ogID, $drupalID){
- og_save_subscription( $ogID, $drupalID, array( 'is_active' => 1 ) );
+ public function og_membership_create($ogID, $drupalID) {
+ og_save_subscription($ogID, $drupalID, array('is_active' => 1));
*/
public function getTimeZoneString() {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;
*/
public function getTimeZoneString() {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;