masquerade_ctools.module in Masquerade Extras 6.2
Same filename and directory in other branches
Allows Ctools to look for masquerade plugins.
File
masquerade_ctools/masquerade_ctools.moduleView source
<?php
/**
* @file
* Allows Ctools to look for masquerade plugins.
*/
/**
* Implements hook_ctools_plugin_directory().
*
* Tell ctools where to look for plugins.
*
* @see hook_ctools_plugin_directory()
*/
function masquerade_ctools_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'ctools') {
return "plugins/{$plugin_type}";
}
return '';
}
/**
* Checks if the provided account is masquerading.
* @param stdClass $account
* The user account to check.
* @return
* TRUE if the provided account is masquerading.
* FALSE otherwise.
* @retval bool
*/
function masquerade_ctools_is_masquerading($account) {
global $user;
if ($user->uid == $account->uid) {
return isset($_SESSION['masquerading']) && is_numeric($_SESSION['masquerading']);
}
$query_is_masquerading = db_query("SELECT `uid_as`\n FROM {masquerade}\n WHERE `uid_from` = %d\n LIMIT 1", $account->uid);
return (bool) db_result($query_is_masquerading);
}
/**
* Checks if the provided account is being masqueraded.
* @param stdClass $account
* The user account to check.
* @return
* TRUE if the provided account is being masqueraded.
* FALSE otherwise.
* @retval bool
*/
function masquerade_ctools_is_being_masqueraded($account) {
$query_is_being_masqueraded = db_query("SELECT `uid_from`\n FROM {masquerade}\n WHERE `uid_as` = %d\n LIMIT 1", $account->uid);
return (bool) db_result($query_is_being_masqueraded);
}
Functions
Name | Description |
---|---|
masquerade_ctools_ctools_plugin_directory | Implements hook_ctools_plugin_directory(). |
masquerade_ctools_is_being_masqueraded | Checks if the provided account is being masqueraded. |
masquerade_ctools_is_masquerading | Checks if the provided account is masquerading. |