Skip to content
Permalink
Browse files

Added ignore filtering option to notifications.

  • Loading branch information...
cubiclesoft committed Nov 16, 2016
1 parent 6009c25 commit c16f110aa5341cbb9185b28c51c31cf2168e9f6a
Showing with 12 additions and 8 deletions.
  1. +4 −1 configure.php
  2. +8 −7 support/cb_functions.php
@@ -258,8 +258,10 @@ function SetupPaths($configkey, $pathsstr, $checkpaths = true)
$cmd2 = explode(" ", $cmd);
if (strtolower($cmd2[0]) === "add")
{
echo "Filter (regular expression to apply to each backup line - optional): ";
echo "Include filter (regular expression to apply to each backup line - optional): ";
$filter = trim(fgets(STDIN));
echo "Ignore filter (regular expression to apply to each backup line - optional): ";
$ignorefilter = trim(fgets(STDIN));
echo "FROM e-mail address: ";
$from = trim(fgets(STDIN));
echo "Subject line (e.g. [Backup] Some computer name): ";
@@ -290,6 +292,7 @@ function SetupPaths($configkey, $pathsstr, $checkpaths = true)
$data = array(
"filter" => $filter,
"ignorefilter" => $ignorefilter,
"from" => $from,
"subject" => $subject,
"usemail" => $usemail,
@@ -69,14 +69,15 @@ function CB_SendNotifications($notifications)
foreach ($notifications as $notificationinfo)
{
$filter = $notificationinfo["filter"];
if ($filter === "") $messages = $cb_messages;
else
if ($filter === "") $filter = '/.*/';
$ignorefilter = $notificationinfo["ignorefilter"];
if ($ignorefilter === "") $ignorefilter = '/^\b$/';
$messages = array();
foreach ($cb_messages as $line)
{
$messages = array();
foreach ($cb_messages as $line)
{
if (preg_match($filter, $line)) $messages[] = htmlspecialchars($line);
}
if (preg_match($filter, $line) && !preg_match($ignorefilter, $line)) $messages[] = htmlspecialchars($line);
}
if (count($messages))

0 comments on commit c16f110

Please sign in to comment.
You can’t perform that action at this time.