function sms_valid_ruleset_is_enabled in SMS Framework 6
Same name and namespace in other branches
- 6.2 modules/sms_valid/sms_valid.module \sms_valid_ruleset_is_enabled()
- 7 modules/sms_valid/sms_valid.module \sms_valid_ruleset_is_enabled()
Check what directions are enabled for a ruleset
Parameters
$prefix: A prefix number.
$dir: The direction code that you want to check. See SMS_DIR_* constants.
Return value
Boolean. Whether the ruleset is enabled for this direction.
3 calls to sms_valid_ruleset_is_enabled()
- sms_valid_admin_rulesets_form in modules/
sms_valid/ sms_valid.admin.inc - Validation rulesets list form
- sms_valid_admin_ruleset_form in modules/
sms_valid/ sms_valid.admin.inc - Validation ruleset editing form
- sms_valid_validate in modules/
sms_valid/ sms_valid.module - Validate a number
File
- modules/
sms_valid/ sms_valid.module, line 240 - Number validation feature module for Drupal SMS Framework.
Code
function sms_valid_ruleset_is_enabled($prefix, $dir = SMS_DIR_OUT) {
$result = db_query("SELECT dirs_enabled FROM {sms_valid_rules} WHERE prefix = %d LIMIT 1", $prefix);
$dirs_enabled = db_result($result);
// There must be a better way of doing this, but this works ok
if ($dirs_enabled == SMS_DIR_ALL) {
return TRUE;
}
if ($dirs_enabled == SMS_DIR_OUT && $dir == SMS_DIR_OUT) {
return TRUE;
}
if ($dirs_enabled == SMS_DIR_IN && $dir == SMS_DIR_IN) {
return TRUE;
}
return FALSE;
}