Changeset 1946417
- Timestamp:
- 09/24/2018 11:05:33 PM (7 years ago)
- Location:
- vulnerability-alerts
- Files:
-
- 21 added
- 9 edited
-
tags/1.4 (added)
-
tags/1.4/class-notification.php (added)
-
tags/1.4/class-vulnerability-alerts.php (added)
-
tags/1.4/languages (added)
-
tags/1.4/languages/vulnerability-alerts-en_US.mo (added)
-
tags/1.4/languages/vulnerability-alerts-en_US.po (added)
-
tags/1.4/languages/vulnerability-alerts-fr_FR.mo (added)
-
tags/1.4/languages/vulnerability-alerts-fr_FR.po (added)
-
tags/1.4/languages/vulnerability-alerts-pt_BR.mo (added)
-
tags/1.4/languages/vulnerability-alerts-pt_BR.po (added)
-
tags/1.4/license.txt (added)
-
tags/1.4/readme.md (added)
-
tags/1.4/readme.txt (added)
-
tags/1.4/report.php (added)
-
tags/1.4/screenshot-1.png (added)
-
tags/1.4/screenshot-2.png (added)
-
tags/1.4/style.css (added)
-
tags/1.4/uninstall.php (added)
-
tags/1.4/vulnerability-alerts.php (added)
-
trunk/class-notification.php (added)
-
trunk/class-vulnerability-alerts.php (added)
-
trunk/languages/vulnerability-alerts-en_US.mo (modified) (previous)
-
trunk/languages/vulnerability-alerts-en_US.po (modified) (3 diffs)
-
trunk/languages/vulnerability-alerts-pt_BR.mo (modified) (previous)
-
trunk/languages/vulnerability-alerts-pt_BR.po (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/report.php (modified) (1 diff)
-
trunk/screenshot-1.png (modified) (previous)
-
trunk/screenshot-2.png (modified) (previous)
-
trunk/vulnerability-alerts.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vulnerability-alerts/trunk/languages/vulnerability-alerts-en_US.po
r1787624 r1946417 2 2 msgstr "" 3 3 "Project-Id-Version: Vulnerability Alerts\n" 4 "POT-Creation-Date: 201 7-12-15 10:55-0300\n"5 "PO-Revision-Date: 201 7-12-15 10:55-0300\n"4 "POT-Creation-Date: 2018-09-24 19:57-0300\n" 5 "PO-Revision-Date: 2018-09-24 19:57-0300\n" 6 6 "Last-Translator: Edir Pedro <[email protected]>\n" 7 7 "Language-Team: \n" 8 "Language: English\n"8 "Language: en\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.5.7\n"12 "X-Generator: Poedit 2.1.1\n" 13 13 "X-Poedit-KeywordsList: _;__;_e;_n:1,2\n" 14 14 "X-Poedit-Basepath: .\n" … … 16 16 "X-Poedit-SearchPath-0: ..\n" 17 17 18 #: ../ report.php:3 ../vulnerability-alerts.php:17519 msgid " Vulnerability Alerts"18 #: ../class-notification.php:29 19 msgid "E-mail" 20 20 msgstr "" 21 21 22 #: ../report.php:9 22 #: ../class-notification.php:36 23 msgid "Send Alerts" 24 msgstr "" 25 26 #: ../class-notification.php:44 27 msgid "Vulnerabilities to Ignore" 28 msgstr "" 29 30 #: ../class-notification.php:59 31 msgid "Notification" 32 msgstr "" 33 34 #: ../class-notification.php:86 35 msgid "" 36 "Fill the options below if you want to be notified by mail about new " 37 "vulnerabilities. Add multiple e-mail addresses separating them by comma." 38 msgstr "" 39 40 #: ../class-notification.php:108 41 msgid "Daily" 42 msgstr "" 43 44 #: ../class-notification.php:109 45 msgid "Every Monday" 46 msgstr "" 47 48 #: ../class-notification.php:110 49 msgid "Every Tuesday" 50 msgstr "" 51 52 #: ../class-notification.php:111 53 msgid "Every Wednesday" 54 msgstr "" 55 56 #: ../class-notification.php:112 57 msgid "Every Thursday" 58 msgstr "" 59 60 #: ../class-notification.php:113 61 msgid "Every Friday" 62 msgstr "" 63 64 #: ../class-notification.php:114 65 msgid "Every Saturday" 66 msgstr "" 67 68 #: ../class-notification.php:115 69 msgid "Every Sunday" 70 msgstr "" 71 72 #: ../class-notification.php:116 73 msgid "Every Month" 74 msgstr "" 75 76 #: ../class-notification.php:182 77 msgid "You have entered an invalid e-mail address." 78 msgstr "" 79 80 #: ../class-notification.php:232 81 msgid "Hello Friend," 82 msgstr "" 83 84 #: ../class-notification.php:233 85 #, php-format 86 msgid "Some vulnerabilities were found in %s, visit the site for more details." 87 msgstr "" 88 89 #: ../class-notification.php:251 ../report.php:34 90 msgid "Plugins" 91 msgstr "" 92 93 #: ../class-notification.php:263 ../report.php:57 94 msgid "Themes" 95 msgstr "" 96 97 #: ../class-notification.php:269 98 msgid "Hope this help!" 99 msgstr "" 100 101 #: ../class-notification.php:273 102 #, php-format 103 msgid "Some vulnerabilities were found in %s" 104 msgstr "" 105 106 #: ../class-vulnerability-alerts.php:107 107 msgid "Summary" 108 msgstr "" 109 110 #: ../class-vulnerability-alerts.php:125 111 msgid "Last request to" 112 msgstr "" 113 114 #: ../class-vulnerability-alerts.php:131 115 msgid "Your website is secure" 116 msgstr "" 117 118 #: ../class-vulnerability-alerts.php:133 119 msgid "Requires your attention" 120 msgstr "" 121 122 #: ../class-vulnerability-alerts.php:136 123 msgid "" 124 "Some paid plugins and themes, or developed exclusively for this website and " 125 "not shared for the public, may not be reported by WPScan." 126 msgstr "" 127 128 #: ../class-vulnerability-alerts.php:140 23 129 msgid "Check Now" 24 130 msgstr "" 25 131 26 #: ../report.php:10 27 #, php-format 28 msgid "Last request to %s on %s" 29 msgstr "" 30 31 #: ../report.php:11 32 msgid "" 33 "Some paid plugins and themes, or developed exclusively for this website and " 34 "not shared for the public, may not be reported on WPScan." 35 msgstr "" 36 37 #: ../report.php:21 ../report.php:40 ../report.php:61 38 msgid "Name" 39 msgstr "" 40 41 #: ../report.php:22 ../report.php:41 ../report.php:62 42 msgid "Vulnerabilities" 43 msgstr "" 44 45 #: ../report.php:28 ../report.php:48 ../report.php:69 46 #, php-format 47 msgid "Version %s" 48 msgstr "" 49 50 #: ../report.php:34 ../vulnerability-alerts.php:564 51 msgid "Plugins" 52 msgstr "" 53 54 #: ../report.php:55 ../vulnerability-alerts.php:576 55 msgid "Themes" 56 msgstr "" 57 58 #: ../vulnerability-alerts.php:114 132 #: ../class-vulnerability-alerts.php:165 59 133 #, php-format 60 134 msgid "%d vulnerability found" … … 63 137 msgstr[1] "" 64 138 65 #: ../vulnerability-alerts.php:187 139 #: ../class-vulnerability-alerts.php:232 ../class-vulnerability-alerts.php:233 140 #: ../report.php:3 141 msgid "Vulnerability Alerts" 142 msgstr "" 143 144 #: ../class-vulnerability-alerts.php:249 66 145 msgid "View" 67 146 msgstr "" 68 147 69 #: ../ vulnerability-alerts.php:25970 msgid " Reportupdated."148 #: ../class-vulnerability-alerts.php:323 149 msgid "Task is running and in few minutes your report will be updated." 71 150 msgstr "" 72 151 73 #: ../ vulnerability-alerts.php:307152 #: ../class-vulnerability-alerts.php:379 74 153 msgid "Report not available" 75 154 msgstr "" 76 155 77 #: ../ vulnerability-alerts.php:332156 #: ../class-vulnerability-alerts.php:405 78 157 msgid "Not fixed" 79 158 msgstr "" 80 159 81 #: ../ vulnerability-alerts.php:332160 #: ../class-vulnerability-alerts.php:405 82 161 #, php-format 83 162 msgid "Fixed in version %s" 84 163 msgstr "" 85 164 86 #: ../ vulnerability-alerts.php:38287 msgid "N otification"165 #: ../report.php:19 ../report.php:40 ../report.php:63 166 msgid "Name" 88 167 msgstr "" 89 168 90 #: ../ vulnerability-alerts.php:38891 msgid " E-mail Address"169 #: ../report.php:20 ../report.php:41 ../report.php:64 170 msgid "Vulnerabilities" 92 171 msgstr "" 93 172 94 #: ../vulnerability-alerts.php:395 95 msgid "Send E-mail Alerts" 173 #: ../report.php:27 ../report.php:49 ../report.php:72 174 #, php-format 175 msgid "Version %s" 96 176 msgstr "" 97 98 #: ../vulnerability-alerts.php:40399 msgid "Vulnerabilities to Ignore"100 msgstr ""101 102 #: ../vulnerability-alerts.php:416103 msgid ""104 "Fill the options below if you want to be notified by mail about new "105 "vulnerabilities."106 msgstr ""107 108 #: ../vulnerability-alerts.php:438109 msgid "Daily"110 msgstr ""111 112 #: ../vulnerability-alerts.php:439113 msgid "Every Monday"114 msgstr ""115 116 #: ../vulnerability-alerts.php:440117 msgid "Every Tuesday"118 msgstr ""119 120 #: ../vulnerability-alerts.php:441121 msgid "Every Wednesday"122 msgstr ""123 124 #: ../vulnerability-alerts.php:442125 msgid "Every Thursday"126 msgstr ""127 128 #: ../vulnerability-alerts.php:443129 msgid "Every Friday"130 msgstr ""131 132 #: ../vulnerability-alerts.php:444133 msgid "Every Saturday"134 msgstr ""135 136 #: ../vulnerability-alerts.php:445137 msgid "Every Sunday"138 msgstr ""139 140 #: ../vulnerability-alerts.php:446141 msgid "Every Month"142 msgstr ""143 144 #: ../vulnerability-alerts.php:504145 msgid "You have entered an invalid e-mail address."146 msgstr ""147 148 #: ../vulnerability-alerts.php:545149 msgid "Hello Friend,"150 msgstr ""151 152 #: ../vulnerability-alerts.php:546153 #, php-format154 msgid "Some vulnerabilities were found in %s, visit the site for more details."155 msgstr ""156 157 #: ../vulnerability-alerts.php:582158 msgid "Hope this help!"159 msgstr ""160 161 #: ../vulnerability-alerts.php:586162 #, php-format163 msgid "Some vulnerabilities were found in %s"164 msgstr "" -
vulnerability-alerts/trunk/languages/vulnerability-alerts-pt_BR.po
r1939555 r1946417 2 2 msgstr "" 3 3 "Project-Id-Version: Vulnerability Alerts\n" 4 "POT-Creation-Date: 2018-09- 11 19:48-0300\n"5 "PO-Revision-Date: 2018-09- 11 19:49-0300\n"4 "POT-Creation-Date: 2018-09-24 19:57-0300\n" 5 "PO-Revision-Date: 2018-09-24 19:57-0300\n" 6 6 "Last-Translator: Edir Pedro <[email protected]>\n" 7 7 "Language-Team: \n" … … 16 16 "X-Poedit-SearchPath-0: ..\n" 17 17 18 #: ../report.php:3 ../vulnerability-alerts.php:184 19 #: ../vulnerability-alerts.php:185 20 msgid "Vulnerability Alerts" 21 msgstr "Alertas de Vulnerabilidade" 22 23 #: ../report.php:9 18 #: ../class-notification.php:29 19 msgid "E-mail" 20 msgstr "E-mail" 21 22 #: ../class-notification.php:36 23 msgid "Send Alerts" 24 msgstr "Enviar Alertas" 25 26 #: ../class-notification.php:44 27 msgid "Vulnerabilities to Ignore" 28 msgstr "Vulnerabilidades Ignoradas" 29 30 #: ../class-notification.php:59 31 msgid "Notification" 32 msgstr "Notificação" 33 34 #: ../class-notification.php:86 35 msgid "" 36 "Fill the options below if you want to be notified by mail about new " 37 "vulnerabilities. Add multiple e-mail addresses separating them by comma." 38 msgstr "" 39 "Preencha as opções abaixo se desejar ser notificado por e-mail sobre novas " 40 "vulnerabilidades. Adicione múltiplos endereços de e-mail separando-os por " 41 "vírgula." 42 43 #: ../class-notification.php:108 44 msgid "Daily" 45 msgstr "Diariamente" 46 47 #: ../class-notification.php:109 48 msgid "Every Monday" 49 msgstr "Toda Segunda" 50 51 #: ../class-notification.php:110 52 msgid "Every Tuesday" 53 msgstr "Toda Terça" 54 55 #: ../class-notification.php:111 56 msgid "Every Wednesday" 57 msgstr "Toda Quarta" 58 59 #: ../class-notification.php:112 60 msgid "Every Thursday" 61 msgstr "Toda Quinta" 62 63 #: ../class-notification.php:113 64 msgid "Every Friday" 65 msgstr "Toda Sexta" 66 67 #: ../class-notification.php:114 68 msgid "Every Saturday" 69 msgstr "Todo Sábado" 70 71 #: ../class-notification.php:115 72 msgid "Every Sunday" 73 msgstr "Todo Domingo" 74 75 #: ../class-notification.php:116 76 msgid "Every Month" 77 msgstr "Todo Mês" 78 79 #: ../class-notification.php:182 80 msgid "You have entered an invalid e-mail address." 81 msgstr "Você informou um endereço de e-mail inválido." 82 83 #: ../class-notification.php:232 84 msgid "Hello Friend," 85 msgstr "Olá Amigo(a)," 86 87 #: ../class-notification.php:233 88 #, php-format 89 msgid "Some vulnerabilities were found in %s, visit the site for more details." 90 msgstr "" 91 "Algumas vulnerabilidades foram encontradas em %s, visite o site para mais " 92 "detalhes." 93 94 #: ../class-notification.php:251 ../report.php:34 95 msgid "Plugins" 96 msgstr "Plugins" 97 98 #: ../class-notification.php:263 ../report.php:57 99 msgid "Themes" 100 msgstr "Temas" 101 102 #: ../class-notification.php:269 103 msgid "Hope this help!" 104 msgstr "Espero que isso ajude!" 105 106 #: ../class-notification.php:273 107 #, php-format 108 msgid "Some vulnerabilities were found in %s" 109 msgstr "Algumas vulnerabilidades foram encontradas em %s" 110 111 #: ../class-vulnerability-alerts.php:107 112 msgid "Summary" 113 msgstr "Resumo" 114 115 #: ../class-vulnerability-alerts.php:125 116 msgid "Last request to" 117 msgstr "Última verificação no" 118 119 #: ../class-vulnerability-alerts.php:131 120 msgid "Your website is secure" 121 msgstr "Seu site esta seguro" 122 123 #: ../class-vulnerability-alerts.php:133 124 #, fuzzy 125 #| msgid "Require your attention" 126 msgid "Requires your attention" 127 msgstr "Requer sua atenção" 128 129 #: ../class-vulnerability-alerts.php:136 130 msgid "" 131 "Some paid plugins and themes, or developed exclusively for this website and " 132 "not shared for the public, may not be reported by WPScan." 133 msgstr "" 134 "Alguns plugins e temas pagos, ou desenvolvidos exclusivamente para este site " 135 "e não compartilhados com o público, podem não ser reportados pelo WPScan." 136 137 #: ../class-vulnerability-alerts.php:140 24 138 msgid "Check Now" 25 139 msgstr "Verificar Agora" 26 140 27 #: ../report.php:10 28 #, php-format 29 msgid "Last request to %s on %s" 30 msgstr "Última verificação no %s em %s" 31 32 #: ../report.php:12 33 msgid "" 34 "Some paid plugins and themes, or developed exclusively for this website and " 35 "not shared for the public, may not be reported on WPScan." 36 msgstr "" 37 "Alguns plugins e temas pagos, ou desenvolvidos exclusivamente para este site " 38 "e não compartilhados com o público, podem não ser reportados pelo WPScan." 39 40 #: ../report.php:22 ../report.php:43 ../report.php:66 41 msgid "Name" 42 msgstr "Nome" 43 44 #: ../report.php:23 ../report.php:44 ../report.php:67 45 msgid "Vulnerabilities" 46 msgstr "Vulnerabilidades" 47 48 #: ../report.php:30 ../report.php:52 ../report.php:75 49 #, php-format 50 msgid "Version %s" 51 msgstr "Versão %s" 52 53 #: ../report.php:37 ../vulnerability-alerts.php:610 54 msgid "Plugins" 55 msgstr "Plugins" 56 57 #: ../report.php:60 ../vulnerability-alerts.php:622 58 msgid "Themes" 59 msgstr "Temas" 60 61 #: ../vulnerability-alerts.php:117 141 #: ../class-vulnerability-alerts.php:165 62 142 #, php-format 63 143 msgid "%d vulnerability found" … … 66 146 msgstr[1] "%d vulnerabilidades encontradas" 67 147 68 #: ../vulnerability-alerts.php:201 148 #: ../class-vulnerability-alerts.php:232 ../class-vulnerability-alerts.php:233 149 #: ../report.php:3 150 msgid "Vulnerability Alerts" 151 msgstr "Alertas de Vulnerabilidade" 152 153 #: ../class-vulnerability-alerts.php:249 69 154 msgid "View" 70 155 msgstr "Ver" 71 156 72 #: ../ vulnerability-alerts.php:27573 msgid " Reportupdated."74 msgstr " Relatórioatualizado."75 76 #: ../ vulnerability-alerts.php:329157 #: ../class-vulnerability-alerts.php:323 158 msgid "Task is running and in few minutes your report will be updated." 159 msgstr "Tarefa em andamento e em poucos minutos seu relatório será atualizado." 160 161 #: ../class-vulnerability-alerts.php:379 77 162 msgid "Report not available" 78 163 msgstr "Relatório não disponível" 79 164 80 #: ../ vulnerability-alerts.php:355165 #: ../class-vulnerability-alerts.php:405 81 166 msgid "Not fixed" 82 167 msgstr "Sem correção" 83 168 84 #: ../ vulnerability-alerts.php:355169 #: ../class-vulnerability-alerts.php:405 85 170 #, php-format 86 171 msgid "Fixed in version %s" 87 172 msgstr "Corrigido na versão %s" 88 173 89 #: ../vulnerability-alerts.php:410 90 msgid "Notification" 91 msgstr "Notificação" 92 93 #: ../vulnerability-alerts.php:416 94 msgid "E-mail Address" 95 msgstr "Endereço de E-mail" 96 97 #: ../vulnerability-alerts.php:423 98 msgid "Send E-mail Alerts" 99 msgstr "Enviar Alertas no E-mail" 100 101 #: ../vulnerability-alerts.php:431 102 msgid "Vulnerabilities to Ignore" 103 msgstr "Vulnerabilidades Ignoradas" 104 105 #: ../vulnerability-alerts.php:444 106 msgid "" 107 "Fill the options below if you want to be notified by mail about new " 108 "vulnerabilities." 109 msgstr "" 110 "Preencha as opções abaixo se desejar ser notificado por e-mail sobre novas " 111 "vulnerabilidades." 112 113 #: ../vulnerability-alerts.php:455 114 msgid "Add multiple e-mail addresses separating them by comma." 115 msgstr "Adicione múltiplos endereços de e-mail separando-os por vírgula." 116 117 #: ../vulnerability-alerts.php:467 118 msgid "Daily" 119 msgstr "Diariamente" 120 121 #: ../vulnerability-alerts.php:468 122 msgid "Every Monday" 123 msgstr "Toda Segunda" 124 125 #: ../vulnerability-alerts.php:469 126 msgid "Every Tuesday" 127 msgstr "Toda Terça" 128 129 #: ../vulnerability-alerts.php:470 130 msgid "Every Wednesday" 131 msgstr "Toda Quarta" 132 133 #: ../vulnerability-alerts.php:471 134 msgid "Every Thursday" 135 msgstr "Toda Quinta" 136 137 #: ../vulnerability-alerts.php:472 138 msgid "Every Friday" 139 msgstr "Toda Sexta" 140 141 #: ../vulnerability-alerts.php:473 142 msgid "Every Saturday" 143 msgstr "Todo Sábado" 144 145 #: ../vulnerability-alerts.php:474 146 msgid "Every Sunday" 147 msgstr "Todo Domingo" 148 149 #: ../vulnerability-alerts.php:475 150 msgid "Every Month" 151 msgstr "Todo Mês" 152 153 #: ../vulnerability-alerts.php:541 154 msgid "You have entered an invalid e-mail address." 155 msgstr "Você informou um endereço de e-mail inválido." 156 157 #: ../vulnerability-alerts.php:591 158 msgid "Hello Friend," 159 msgstr "Olá Amigo(a)," 160 161 #: ../vulnerability-alerts.php:592 162 #, php-format 163 msgid "Some vulnerabilities were found in %s, visit the site for more details." 164 msgstr "" 165 "Algumas vulnerabilidades foram encontradas em %s, visite o site para mais " 166 "detalhes." 167 168 #: ../vulnerability-alerts.php:628 169 msgid "Hope this help!" 170 msgstr "Espero que isso ajude!" 171 172 #: ../vulnerability-alerts.php:632 173 #, php-format 174 msgid "Some vulnerabilities were found in %s" 175 msgstr "Algumas vulnerabilidades foram encontradas em %s" 174 #: ../report.php:19 ../report.php:40 ../report.php:63 175 msgid "Name" 176 msgstr "Nome" 177 178 #: ../report.php:20 ../report.php:41 ../report.php:64 179 msgid "Vulnerabilities" 180 msgstr "Vulnerabilidades" 181 182 #: ../report.php:27 ../report.php:49 ../report.php:72 183 #, php-format 184 msgid "Version %s" 185 msgstr "Versão %s" 186 187 #~ msgid "Information" 188 #~ msgstr "Informações" 189 190 #~ msgid "Report updated." 191 #~ msgstr "Relatório atualizado." 192 193 #~ msgid "Add multiple e-mail addresses separating them by comma." 194 #~ msgstr "Adicione múltiplos endereços de e-mail separando-os por vírgula." 176 195 177 196 #~ msgid "Plugin" -
vulnerability-alerts/trunk/readme.txt
r1939555 r1946417 4 4 Requires at least: 3.4 5 5 Tested up to: 4.9.8 6 Stable tag: 1. 3.66 Stable tag: 1.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 32 32 33 33 == Changelog == 34 35 = 1.4 = 36 * [Added] Some UI improvements 37 * [Fixed] Check Now button now runs the scheduled task to avoid timeout error 34 38 35 39 = 1.3.6 = -
vulnerability-alerts/trunk/report.php
r1939555 r1946417 5 5 <?php settings_errors(); ?> 6 6 7 <form method='post'> 8 <input type="hidden" name="verify" value="1"> 9 <p class="alignright"><?php submit_button( __( 'Check Now', self::$id ), 'primary', 'submit', false ) ?></p> 10 <p><?php printf( __( 'Last request to %s on %s', self::$id ), '<a href="https://wpvulndb.com/" target="_blank">WPScan Vulnerability Database</a>', date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $report['cache'] ) ) ?> 11 <br> 12 <?php _e( 'Some paid plugins and themes, or developed exclusively for this website and not shared for the public, may not be reported on WPScan.', self::$id ) ?> 13 </p> 14 </form> 7 <div id="poststuff"> 8 9 <div id="post-body" class="metabox-holder columns-2"> 10 11 <div id="postbox-body" class="postbox-container"> 15 12 16 <h3>WordPress</h3> 17 18 <table class="wp-list-table widefat striped plugins"> 19 <thead> 20 <tr> 21 <td scope="col" class="manage-column check-column"> </td> 22 <th scope="col" class="manage-column column-name column-primary" width="250"><?php _e( 'Name', self::$id ) ?></th> 23 <th scope="col" class="manage-column column-description"><?php _e( 'Vulnerabilities', self::$id ) ?></th> 24 </tr> 25 </thead> 26 <tbody id="report-wordpress"> 27 <tr> 28 <th scope="row" class="check-column" align="center"><?php echo self::get_status( 'wordpress' ) ?></span></th> 29 <td class="plugin-title column-primary"> 30 <strong>WordPress</strong> <?php echo sprintf( __( 'Version %s', self::$id ), get_bloginfo( 'version' ) ) ?> 31 </td> 32 <td><?php self::list_vulnerabilities( 'wordpress' ) ?></td> 33 </tr> 34 </tbody> 35 </table> 36 37 <h3><?php _e( 'Plugins', self::$id ) ?></h3> 38 39 <table class="wp-list-table widefat striped plugins"> 40 <thead> 41 <tr> 42 <td scope="col" class="manage-column check-column"> </td> 43 <th scope="col" class="manage-column column-name column-primary" width="250"><?php _e( 'Name', self::$id ) ?></th> 44 <th scope="col" class="manage-column column-description"><?php _e( 'Vulnerabilities', self::$id ) ?></th> 45 </tr> 46 </thead> 47 <tbody id="report-plugins"> 48 <?php foreach ( get_plugins() as $name => $details ) : ?> 49 <tr> 50 <th scope="row" class="check-column" align="center"><?php echo self::get_status( 'plugins', $name ) ?></span></th> 51 <td class="plugin-title column-primary"> 52 <strong><?php echo $details['Name'] ?></strong> <?php echo sprintf( __( 'Version %s', self::$id ), $details['Version'] ) ?> 53 </td> 54 <td><?php self::list_vulnerabilities( 'plugins', $name ) ?></td> 55 </tr> 56 <?php endforeach; ?> 57 </tbody> 58 </table> 59 60 <h3><?php _e( 'Themes', self::$id ) ?></h3> 61 62 <table class="wp-list-table widefat striped plugins"> 63 <thead> 64 <tr> 65 <td scope="col" class="manage-column check-column"> </td> 66 <th scope="col" class="manage-column column-name column-primary" width="250"><?php _e( 'Name', self::$id ) ?></th> 67 <th scope="col" class="manage-column column-description"><?php _e( 'Vulnerabilities', self::$id ) ?></th> 68 </tr> 69 </thead> 70 <tbody id="report-themes"> 71 <?php foreach ( wp_get_themes() as $name => $details ) : ?> 72 <tr> 73 <th scope="row" class="check-column" align="center"><?php echo self::get_status( 'themes', $name ) ?></span></th> 74 <td class="plugin-title column-primary"> 75 <strong><?php echo $details['Name'] ?></strong> <?php echo sprintf( __( 'Version %s', self::$id ), $details['Version'] ) ?> 76 </td> 77 <td><?php self::list_vulnerabilities( 'themes', $name ) ?></td> 78 </tr> 79 <?php endforeach; ?> 80 </tbody> 81 </table> 82 83 <form action='options.php' method='post'> 84 <?php 85 settings_fields( self::$id . '_notification' ); 86 do_settings_sections( self::$id . '_notification' ); 87 submit_button(); 88 ?> 89 </form> 13 <h3>WordPress</h3> 14 15 <table class="wp-list-table widefat striped plugins"> 16 <thead> 17 <tr> 18 <td scope="col" class="manage-column check-column"> </td> 19 <th scope="col" class="manage-column column-name column-primary" width="250"><?php _e( 'Name', self::$id ) ?></th> 20 <th scope="col" class="manage-column column-description"><?php _e( 'Vulnerabilities', self::$id ) ?></th> 21 </tr> 22 </thead> 23 <tbody id="report-wordpress"> 24 <tr> 25 <th scope="row" class="check-column" align="center"><?php echo self::get_status( 'wordpress' ) ?></span></th> 26 <td class="plugin-title column-primary"> 27 <strong>WordPress</strong> <?php echo sprintf( __( 'Version %s', self::$id ), get_bloginfo( 'version' ) ) ?> 28 </td> 29 <td><?php self::list_vulnerabilities( 'wordpress' ) ?></td> 30 </tr> 31 </tbody> 32 </table> 33 34 <h3><?php _e( 'Plugins', self::$id ) ?></h3> 35 36 <table class="wp-list-table widefat striped plugins"> 37 <thead> 38 <tr> 39 <td scope="col" class="manage-column check-column"> </td> 40 <th scope="col" class="manage-column column-name column-primary" width="250"><?php _e( 'Name', self::$id ) ?></th> 41 <th scope="col" class="manage-column column-description"><?php _e( 'Vulnerabilities', self::$id ) ?></th> 42 </tr> 43 </thead> 44 <tbody id="report-plugins"> 45 <?php foreach ( get_plugins() as $name => $details ) : ?> 46 <tr> 47 <th scope="row" class="check-column" align="center"><?php echo self::get_status( 'plugins', $name ) ?></span></th> 48 <td class="plugin-title column-primary"> 49 <strong><?php echo $details['Name'] ?></strong> <?php echo sprintf( __( 'Version %s', self::$id ), $details['Version'] ) ?> 50 </td> 51 <td><?php self::list_vulnerabilities( 'plugins', $name ) ?></td> 52 </tr> 53 <?php endforeach; ?> 54 </tbody> 55 </table> 56 57 <h3><?php _e( 'Themes', self::$id ) ?></h3> 58 59 <table class="wp-list-table widefat striped plugins"> 60 <thead> 61 <tr> 62 <td scope="col" class="manage-column check-column"> </td> 63 <th scope="col" class="manage-column column-name column-primary" width="250"><?php _e( 'Name', self::$id ) ?></th> 64 <th scope="col" class="manage-column column-description"><?php _e( 'Vulnerabilities', self::$id ) ?></th> 65 </tr> 66 </thead> 67 <tbody id="report-themes"> 68 <?php foreach ( wp_get_themes() as $name => $details ) : ?> 69 <tr> 70 <th scope="row" class="check-column" align="center"><?php echo self::get_status( 'themes', $name ) ?></span></th> 71 <td class="plugin-title column-primary"> 72 <strong><?php echo $details['Name'] ?></strong> <?php echo sprintf( __( 'Version %s', self::$id ), $details['Version'] ) ?> 73 </td> 74 <td><?php self::list_vulnerabilities( 'themes', $name ) ?></td> 75 </tr> 76 <?php endforeach; ?> 77 </tbody> 78 </table> 79 80 </div> 81 82 <div id="postbox-container-1" class="postbox-container"> 83 84 <?php do_meta_boxes( self::$id, 'side', null ); ?> 85 86 </div> 87 88 </div> 89 90 <br class="clear"> 91 92 </div> 90 93 91 94 </div> -
vulnerability-alerts/trunk/vulnerability-alerts.php
r1939555 r1946417 5 5 * Description: Scans your system to find vulnerabilities listed in WPScan Vulnerability Database. 6 6 * Plugin URI: http://wordpress.org/plugins/vulnerability-alerts/ 7 * Version: 1. 3.67 * Version: 1.4 8 8 * Author: Edir Pedro 9 9 * Author URI: http://edirpedro.com.br … … 16 16 defined( 'ABSPATH' ) or die( "No script kiddies please!" ); 17 17 18 19 class Vulnerabilty_Alerts { 20 21 // Plugin name 22 static public $id = 'vulnerability-alerts'; 23 24 // Report shortcut 25 static public $report = array(); 26 27 // Arguments to WP Remote Get 28 static public $remote = array( 29 'user-agent' => 'WordPress Plugin Vulnerability Alerts' 30 ); 31 32 /* 33 * Initialize actions 34 */ 35 static public function init() { 36 37 // Languages 38 load_plugin_textdomain( self::$id, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 39 40 // Arguments to wp remote get 41 self::$remote['user-agent'] .= '; ' . get_bloginfo( 'url' ); 42 43 // Report 44 self::$report = get_option( self::$id ); 45 46 // Hooks 47 add_action( 'admin_menu', array( __CLASS__, 'menu' ) ); 48 add_action( 'admin_bar_menu', array( __CLASS__, 'admin_bar' ), 65 ); // Between Updates, Comments and New Content menu 49 add_action( 'admin_init', array( 'Vulnerabilty_Alerts_Notification', 'init' ) ); 50 add_action( self::$id . '_schedule', array( __CLASS__, 'schedule' ), 999 ); 51 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( __CLASS__, 'add_action_links' ) ); 52 53 } 54 55 56 /* 57 * Plugins Loaded 58 */ 59 static public function loaded() { 60 61 // Languages 62 load_plugin_textdomain( self::$id, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 63 64 } 65 66 /* 67 * Activate actions 68 */ 69 static public function activate() { 70 71 wp_clear_scheduled_hook( self::$id . '_schedule' ); // Prevent duplication 72 wp_schedule_event( time(), 'daily', self::$id . '_schedule' ); 73 74 self::verify(); 75 76 } 77 78 /* 79 * Deactivate actions 80 */ 81 static public function deactivate() { 82 83 wp_clear_scheduled_hook( self::$id . '_schedule' ); 84 85 } 86 87 /* 88 * Schedule and event to run verify() function 89 */ 90 static public function schedule() { 91 92 self::verify(); 93 94 // Notify by mail when solicited 95 Vulnerabilty_Alerts_Notification::notify(); 96 97 } 98 99 /* 100 * Create a shortcut on Admin Bar to show the total of vulnerabilities found 101 */ 102 static public function admin_bar( $wp_admin_bar ) { 103 104 if ( ! current_user_can( 'manage_options' ) ) { 105 return; 106 } 107 108 $report = self::$report; 109 $total = self::get_total(); 110 111 if ( ! empty( $report ) and $total > 0 ) { 112 $args = array( 113 'id' => self::$id, 114 'title' => '<span class="ab-icon dashicons-shield"></span><span class="ab-label">' . $total . '</span>', 115 'href' => admin_url( 'tools.php?page=' . self::$id ), 116 'meta' => array( 117 'title' => sprintf( _n( '%d vulnerability found', '%d vulnerabilities found', $total, self::$id ), $total ) 118 ) 119 ); 120 $wp_admin_bar->add_node( $args ); 121 } 122 123 } 124 125 /* 126 * Return the total of vulnerabilities found 127 */ 128 static public function get_total() { 129 $report = self::$report; 130 $options = get_option( self::$id . '_notification' ); 131 $ignored = empty( $options['ignored'] ) ? array() : $options['ignored']; 132 133 $total = 0; 134 $total += $report['wordpress']['total']; 135 $total += $report['plugins']['total']; 136 $total += $report['themes']['total']; 137 138 // WordPress ignored 139 if ( $report['wordpress']['total'] > 0 ) { 140 foreach ( $report['wordpress']['vulnerabilities'] as $item ) { 141 if ( in_array( $item->id, $ignored ) ) { 142 $total -= 1; 143 } 144 } 145 } 146 147 // Plugins ignored 148 if ( $report['plugins']['total'] > 0 ) { 149 foreach ( $report['plugins'] as $plugin ) { 150 if ( empty( $plugin['vulnerabilities'] ) ) { 151 continue; 152 } 153 foreach ( $plugin['vulnerabilities'] as $item ) { 154 if ( in_array( $item->id, $ignored ) ) { 155 $total -= 1; 156 } 157 } 158 } 159 } 160 161 // Themes ignored 162 if ( $report['themes']['total'] > 0 ) { 163 foreach ( $report['themes'] as $theme ) { 164 if ( empty( $theme['vulnerabilities'] ) ) { 165 continue; 166 } 167 foreach ( $theme['vulnerabilities'] as $item ) { 168 if ( in_array( $item->id, $ignored ) ) { 169 $total -= 1; 170 } 171 } 172 } 173 } 174 175 return $total; 176 } 177 178 /* 179 * Create a menu on Tools section 180 */ 181 static public function menu() { 182 183 add_management_page( 184 __( 'Vulnerability Alerts', self::$id ), 185 __( 'Vulnerability Alerts', self::$id ), 186 'manage_options', 187 self::$id, 188 array( __CLASS__, 'report' ) 189 ); 190 191 } 192 193 /* 194 * Include a shortcut on Plugins Page 195 * 196 * @param array $links - Array of links provided by the filter 197 * @return array 198 */ 199 static public function add_action_links( $links ) { 200 201 $links[] = '<a href="' . admin_url( 'tools.php?page=' . self::$id ) . '">' . __( 'View' ) . '</a>'; 202 203 return $links; 204 205 } 206 207 /* 208 * Function to verify on WpScan Database for vulnerabilities 209 */ 210 static public function verify() { 211 212 // Suppports during WP Cron 213 if ( ! function_exists( 'get_plugins' ) ) { 214 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 215 } 216 217 $report = array(); 218 219 // WordPress 220 $report['wordpress'] = array(); 221 $report['wordpress']['total'] = 0; 222 $version = get_bloginfo( 'version' ); 223 $response = wp_remote_get( 'https://wpvulndb.com/api/v2/wordpresses/' . str_replace( '.', '', $version ), self::$remote ); 224 if ( is_array( $response ) ) { 225 $result = (array) json_decode( $response['body'] ); 226 if ( ! empty( $result ) ) { 227 $report['wordpress']['vulnerabilities'] = self::get_vulnerabilities( $result, $version ); 228 $report['wordpress']['total'] = count( $report['wordpress']['vulnerabilities'] ); 229 } 230 } 231 232 // Plugins 233 $report['plugins'] = array(); 234 $report['plugins']['total'] = 0; 235 foreach ( get_plugins() as $name => $details ) { 236 $parts = pathinfo( $name ); 237 $response = wp_remote_get( 'https://wpvulndb.com/api/v2/plugins/' . $parts['dirname'], self::$remote ); 238 if ( is_array( $response ) ) { 239 $result = (array) json_decode( $response['body'] ); 240 if ( ! empty( $result ) ) { 241 $report['plugins'][ $name ]['vulnerabilities'] = self::get_vulnerabilities( $result, $details['Version'] ); 242 $report['plugins']['total'] += count( $report['plugins'][ $name ]['vulnerabilities'] ); 243 } 244 } 245 } 246 247 // Themes 248 $report['themes'] = array(); 249 $report['themes']['total'] = 0; 250 foreach ( wp_get_themes() as $name => $details ) { 251 $response = wp_remote_get( 'https://wpvulndb.com/api/v2/themes/' . $name, self::$remote ); 252 if ( is_array( $response ) ) { 253 $result = (array) json_decode( $response['body'] ); 254 if ( ! empty( $result ) ) { 255 $report['themes'][ $name ]['vulnerabilities'] = self::get_vulnerabilities( $result, $details['Version'] ); 256 $report['themes']['total'] += count( $report['themes'][ $name ]['vulnerabilities'] ); 257 } 258 } 259 } 260 261 // Caching 262 $report['cache'] = strtotime( current_time( 'mysql' ) ); 263 update_option( self::$id, $report, true ); 264 self::$report = $report; 265 266 } 267 268 /* 269 * Report Page 270 */ 271 static public function report() { 272 273 // Button Check Now 274 if ( isset( $_POST['verify'] ) ) { 275 add_settings_error( self::$id, 'update', __( 'Report updated.', self::$id ), 'updated' ); 276 self::verify(); 277 } 278 279 $report = self::$report; 280 include 'report.php'; 281 282 } 283 284 /* 285 * Filter vulnerability list from WPScan 286 * 287 * @param array $data - Report data for the element to check 288 * @param string $version - Installed version 289 * @return string 290 */ 291 static public function get_vulnerabilities( $data, $version ) { 292 293 $list = array(); 294 $key = key( $data ); 295 296 if ( empty( $data[ $key ]->vulnerabilities ) ) { 297 return $list; 298 } 299 300 foreach ( $data[ $key ]->vulnerabilities as $item ) { 301 if ( $item->fixed_in ) { 302 if ( version_compare( $version, $item->fixed_in, '<' ) ) { 303 $list[] = $item; 304 } 305 } else { 306 $list[] = $item; 307 } 308 } 309 310 return $list; 311 312 } 313 314 /* 315 * List vulnerabilities on screen 316 * 317 * @param string $type - Type of report: wordpress, plugins, themes 318 * @param string $name - key name of the element 319 * @return string 320 */ 321 static public function list_vulnerabilities( $type, $name = null ) { 322 323 $report = self::$report[ $type ]; 324 if ( array_key_exists( $name, $report ) ) { 325 $report = $report[ $name ]; 326 } 327 328 if ( ! isset( $report['vulnerabilities'] ) ) { 329 _e( 'Report not available', self::$id ); 330 331 return; 332 } 333 334 $list = array(); 335 336 foreach ( $report['vulnerabilities'] as $item ) { 337 $html = '<a href="' . esc_url( 'https://wpvulndb.com/vulnerabilities/' . $item->id ) . '" target="_blank">'; 338 $html .= self::get_vulnerability_title( $item ); 339 $html .= '</a>'; 340 $list[] = $html; 341 } 342 343 echo empty( $list ) ? '- -' : join( '<br>', $list ); 344 345 } 346 347 /* 348 * Get vulnerability title 349 * 350 * @param string $vulnerability - element array 351 * @return string 352 */ 353 static public function get_vulnerability_title( $vulnerability ) { 354 $title = esc_html( $vulnerability->title ) . ' - '; 355 $title .= empty( $vulnerability->fixed_in ) ? __( 'Not fixed', self::$id ) : sprintf( __( 'Fixed in version %s', self::$id ), $vulnerability->fixed_in ); 356 357 return $title; 358 } 359 360 /* 361 * Show status icons: checked, attention and error 362 * 363 * @param string $type - Type of report: wordpress, plugins, themes 364 * @param string $name - key name of the element 365 * @return string 366 */ 367 static public function get_status( $type, $name = null ) { 368 369 $report = self::$report[ $type ]; 370 if ( array_key_exists( $name, $report ) ) { 371 $report = $report[ $name ]; 372 } 373 374 if ( ! isset( $report['vulnerabilities'] ) ) { 375 return ' <span class="dashicons dashicons-no-alt" style="color:gray"></span>'; 376 } 377 378 if ( empty( $report['vulnerabilities'] ) ) { 379 return ' <span class="dashicons dashicons-yes" style="color:green"></span>'; 380 } else { 381 return ' <span class="dashicons dashicons-warning" style="color:Crimson"></span>'; 382 } 383 384 } 385 386 } 387 388 /* 389 * Notification System 390 */ 391 392 class Vulnerabilty_Alerts_Notification extends Vulnerabilty_Alerts { 393 394 /* 395 * Notification Options 396 */ 397 static public function init() { 398 399 $report = self::$report; 400 401 $total = 0; 402 $total += $report['wordpress']['total']; 403 $total += $report['plugins']['total']; 404 $total += $report['themes']['total']; 405 406 register_setting( self::$id . '_notification', self::$id . '_notification', array( __CLASS__, 'validate' ) ); 407 408 add_settings_section( 409 self::$id . '_notification_section', 410 __( 'Notification', self::$id ), 411 array( __CLASS__, 'introduction' ), 412 self::$id . '_notification' ); 413 414 add_settings_field( 415 'email', 416 __( 'E-mail Address', self::$id ), 417 array( __CLASS__, 'field_email' ), 418 self::$id . '_notification', 419 self::$id . '_notification_section' ); 420 421 add_settings_field( 422 'interval', 423 __( 'Send E-mail Alerts', self::$id ), 424 array( __CLASS__, 'field_interval' ), 425 self::$id . '_notification', 426 self::$id . '_notification_section' ); 427 428 if ( $total > 0 ) { 429 add_settings_field( 430 'ignored', 431 __( 'Vulnerabilities to Ignore', self::$id ), 432 array( __CLASS__, 'field_ignored' ), 433 self::$id . '_notification', 434 self::$id . '_notification_section' ); 435 } 436 437 } 438 439 /* 440 * Introduction 441 */ 442 static public function introduction() { 443 444 echo '<p>' . __( 'Fill the options below if you want to be notified by mail about new vulnerabilities.', self::$id ) . '</p>'; 445 446 } 447 448 /* 449 * Field E-mail 450 */ 451 static public function field_email() { 452 453 $options = get_option( self::$id . '_notification' ); 454 echo '<input type="text" name="' . self::$id . '_notification[email]" value="' . $options['email'] . '" class="regular-text" placeholder="[email protected], [email protected]">'; 455 echo '<p class="description">' . __( 'Add multiple e-mail addresses separating them by comma.', self::$id ) . '</p>'; 456 457 } 458 459 /* 460 * Field Interval 461 */ 462 static public function field_interval() { 463 464 $options = get_option( self::$id . '_notification' ); 465 $interval = empty( $options['interval'] ) ? 'd' : $options['interval']; 466 echo '<select name="' . self::$id . '_notification[interval]">'; 467 echo '<option value="d" ' . selected( 'd', $interval, false ) . '>' . __( 'Daily', self::$id ) . '</option>'; 468 echo '<option value="1" ' . selected( 1, $interval, false ) . '>' . __( 'Every Monday', self::$id ) . '</option>'; 469 echo '<option value="2" ' . selected( 2, $interval, false ) . '>' . __( 'Every Tuesday', self::$id ) . '</option>'; 470 echo '<option value="3" ' . selected( 3, $interval, false ) . '>' . __( 'Every Wednesday', self::$id ) . '</option>'; 471 echo '<option value="4" ' . selected( 4, $interval, false ) . '>' . __( 'Every Thursday', self::$id ) . '</option>'; 472 echo '<option value="5" ' . selected( 5, $interval, false ) . '>' . __( 'Every Friday', self::$id ) . '</option>'; 473 echo '<option value="6" ' . selected( 6, $interval, false ) . '>' . __( 'Every Saturday', self::$id ) . '</option>'; 474 echo '<option value="7" ' . selected( 7, $interval, false ) . '>' . __( 'Every Sunday', self::$id ) . '</option>'; 475 echo '<option value="m" ' . selected( 'm', $interval, false ) . '>' . __( 'Every Month', self::$id ) . '</option>'; 476 echo '</selected>'; 477 478 } 479 480 /* 481 * Field Ignore 482 */ 483 static public function field_ignored() { 484 485 $options = get_option( self::$id . '_notification' ); 486 $ignored = empty( $options['ignored'] ) ? array() : $options['ignored']; 487 488 self::list_vulnerabilities_to_ignore( 'wordpress' ); 489 490 foreach ( get_plugins() as $name => $details ) { 491 self::list_vulnerabilities_to_ignore( 'plugins', $name ); 492 } 493 494 foreach ( wp_get_themes() as $name => $details ) { 495 self::list_vulnerabilities_to_ignore( 'themes', $name ); 496 } 497 498 } 499 500 /* 501 * List of vulnerabilities 502 * 503 * @param string $type - Type of report: wordpress, plugins, themes 504 * @param string $name - key name of the element 505 * @return string 506 */ 507 static public function list_vulnerabilities_to_ignore( $type, $name = null ) { 508 509 $report = self::$report[ $type ]; 510 if ( array_key_exists( $name, $report ) ) { 511 $report = $report[ $name ]; 512 } 513 514 if ( ! isset( $report['vulnerabilities'] ) ) { 515 return null; 516 } 517 518 $options = get_option( self::$id . '_notification' ); 519 $ignored = empty( $options['ignored'] ) ? array() : $options['ignored']; 520 521 foreach ( $report['vulnerabilities'] as $item ) { 522 echo '<label><input type="checkbox" name="' . self::$id . '_notification[ignored][]" value="' . $item->id . '" ' . ( in_array( $item->id, $ignored ) ? 'checked="checked"' : null ) . '> '; 523 echo self::get_vulnerability_title( $item ); 524 echo '</label><br>'; 525 } 526 527 } 528 529 /* 530 * Validating fields 531 */ 532 static public function validate( $input ) { 533 534 // Email 535 if ( ! empty( $input['email'] ) ) { 536 537 $emails = explode( ',', $input['email'] ); 538 539 foreach ( $emails as $email ) { 540 if ( ! is_email( trim( $email ) ) ) { 541 add_settings_error( self::$id . '_notification', 'invalid-email', __( 'You have entered an invalid e-mail address.', self::$id ) ); 542 } 543 } 544 545 } 546 547 return $input; 548 549 } 550 551 /* 552 * Sending notification 553 */ 554 static public function notify() { 555 556 // Suppports during WP Cron 557 if ( ! function_exists( 'get_plugins' ) ) { 558 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 559 } 560 561 $report = self::$report; 562 $total = self::get_total(); 563 564 if ( $total == 0 ) { 565 return; 566 } 567 568 $options = get_option( self::$id . '_notification' ); 569 $email = empty( $options['email'] ) ? null : $options['email']; 570 $interval = empty( $options['interval'] ) ? 'd' : $options['interval']; 571 $ignored = empty( $options['ignored'] ) ? array() : $options['ignored']; 572 573 // Check email 574 if ( empty( $email ) ) { 575 return; 576 } 577 578 // Check weekly interval 579 if ( is_numeric( $interval ) && date( 'N' ) != $interval ) { 580 return; 581 } 582 583 // Check monthly interval 584 if ( $interval == 'm' && date( 'j' ) != 1 ) { 585 return; 586 } 587 588 // Send email 589 $has_vulnerabilities = false; 590 $msg = '<doctype html><html><head><meta charset="utf-8"></head><body>'; 591 $msg .= '<p>' . __( 'Hello Friend,', self::$id ) . '</p>'; 592 $msg .= '<p>' . sprintf( __( 'Some vulnerabilities were found in %s, visit the site for more details.', self::$id ), '<a href="' . get_bloginfo( 'url' ) . '">' . get_bloginfo( 'name' ) . '</a>' ) . '</p>'; 593 594 // WordPress 595 if ( $report['wordpress']['total'] > 0 ) { 596 $list = self::email_vulnerabilities( 'wordpress' ); 597 if ( ! empty( $list ) ) { 598 $has_vulnerabilities = true; 599 $msg .= '<p><b>WordPress</b><br>'; 600 $msg .= join( '<br>', $list ) . '</p>'; 601 } 602 } 603 604 // Plugins 605 if ( $report['plugins']['total'] > 0 ) { 606 foreach ( get_plugins() as $name => $details ) { 607 $list = self::email_vulnerabilities( 'plugins', $name ); 608 if ( ! empty( $list ) ) { 609 $has_vulnerabilities = true; 610 $msg .= '<p><b>' . __( 'Plugins', self::$id ) . ' ' . $details['Name'] . '</b><br>'; 611 $msg .= join( '<br>', $list ) . '</p>'; 612 } 613 } 614 } 615 616 // Themes 617 if ( $report['themes']['total'] > 0 ) { 618 foreach ( wp_get_themes() as $name => $details ) { 619 $list = self::email_vulnerabilities( 'themes', $name ); 620 if ( ! empty( $list ) ) { 621 $has_vulnerabilities = true; 622 $msg .= '<p><b>' . __( 'Themes', self::$id ) . ' ' . $details['Name'] . '</b><br>'; 623 $msg .= join( '<br>', $list ) . '</p>'; 624 } 625 } 626 } 627 628 $msg .= '<p>' . __( 'Hope this help!', self::$id ) . '</p>'; 629 $msg .= '</body></html>'; 630 631 if ( $has_vulnerabilities ) { 632 $subject = sprintf( __( 'Some vulnerabilities were found in %s', self::$id ), get_bloginfo( 'name' ) ); 633 $headers = array( 'Content-Type: text/html; charset=UTF-8' ); 634 wp_mail( $options['email'], $subject, $msg, $headers ); 635 } 636 637 } 638 639 /* 640 * List of vulnerabilities to send by mail 641 */ 642 static public function email_vulnerabilities( $type, $name = null ) { 643 644 $report = self::$report[ $type ]; 645 if ( array_key_exists( $name, $report ) ) { 646 $report = $report[ $name ]; 647 } 648 649 if ( ! isset( $report['vulnerabilities'] ) ) { 650 return null; 651 } 652 653 $options = get_option( self::$id . '_notification' ); 654 $ignored = empty( $options['ignored'] ) ? array() : $options['ignored']; 655 656 $list = array(); 657 658 foreach ( $report['vulnerabilities'] as $item ) { 659 if ( ! in_array( $item->id, $ignored ) ) { 660 $html = '<a href="' . esc_url( 'https://wpvulndb.com/vulnerabilities/' . $item->id ) . '" target="_blank">'; 661 $html .= self::get_vulnerability_title( $item ); 662 $html .= '</a>'; 663 $list[] = $html; 664 } 665 } 666 667 return $list; 668 669 } 670 671 } 672 18 //Includes 19 require_once 'class-vulnerability-alerts.php'; 20 require_once 'class-notification.php'; 673 21 674 22 // Activating … … 680 28 // Initialize 681 29 add_action( 'init', array( 'Vulnerabilty_Alerts', 'init' ) ); 682
Note: See TracChangeset
for help on using the changeset viewer.