['type' => 'string', 'default' => ''], 'from_addr' => ['type' => 'string', 'default' => ''] ]; /** Configuration category fallback. */ if (!isset($phpMussel['Config']['notifications'])) { $phpMussel['Config']['notifications'] = []; } /** Configuration directive fallbacks. */ array_walk($phpMussel['Config']['Config Defaults']['notifications'], function ($Values, $Key) use (&$phpMussel) { if (!isset($phpMussel['Config']['notifications'][$Key])) { $phpMussel['Config']['notifications'][$Key] = $Values['default']; } $phpMussel['AutoType']($phpMussel['Config']['notifications'][$Key], $Values['type']); }); /** * Registers the `$phpMussel_Notifications` closure to the `before_html_out` * hook. */ $phpMussel['Register_Hook']('phpMussel_Notifications', 'before_html_out'); /** * The plugin closure. * * @return bool Returns true if everything is working correctly. */ $phpMussel_Notifications = function () use (&$phpMussel) { if ( empty($phpMussel['Config']['notifications']['to_addr']) || empty($phpMussel['Config']['notifications']['from_addr']) || empty($phpMussel['whyflagged']) ) { return false; } $Content = $phpMussel['ParseVars']([ 'whyflagged' => $phpMussel['whyflagged'], 'ipaddr' => $_SERVER[$phpMussel['Config']['general']['ipaddr']], 'time' => date('r') ], $phpMussel['L10N']->getString('notifications_template')); mail( $phpMussel['Config']['notifications']['to_addr'], $phpMussel['L10N']->getString('denied'), $Content, "MIME-Version: 1.0\nContent-type: text/plain; charset=iso-8859-1\nFrom: " . $phpMussel['Config']['notifications']['from_addr'], '-f' . $phpMussel['Config']['notifications']['from_addr'] ); return true; };