refactor: snmp cleanup (#4683)

This commit is contained in:
Tony Murray
2016-10-06 15:20:11 -05:00
committed by Neil Lathwood
parent d9c0614b30
commit 07e8e9f2be
9 changed files with 114 additions and 199 deletions

View File

@@ -1461,6 +1461,30 @@ function starts_with($haystack, $needles, $case_insensitive = false)
return false;
}
/**
* Search backwards for the $needle, returning $count found occurrence
*
* @param string $haystack
* @param string $needle
* @param int $count
* @return bool|int
*/
function strrpos_count($haystack, $needle, $count = 1)
{
if ($count <= 0) {
return false;
}
$len = strlen($haystack);
$pos = $len;
for ($i = 0; $i < $count && $pos; $i++) {
$pos = strrpos($haystack, $needle, $pos - $len - 1);
}
return $pos;
}
function get_auth_ad_user_filter($username)
{
global $config;