1<?php 2 3/** 4 * plugins/fortune/setup.php 5 * 6 * Original code contributed by paulm@spider.org 7 * 8 * Simple SquirrelMail WebMail Plugin that displays the output of 9 * fortune above the message listing. 10 * 11 * @copyright (c) 1999-2021 The SquirrelMail Project Team 12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 13 * @version $Id: setup.php 14885 2021-02-05 19:19:32Z pdontthink $ 14 * @package plugins 15 * @subpackage fortune 16 * 17 */ 18 19/** 20 * Init plugin 21 * @access private 22 */ 23function squirrelmail_plugin_init_fortune() { 24 global $squirrelmail_plugin_hooks; 25 26 $squirrelmail_plugin_hooks['mailbox_index_before']['fortune'] = 'fortune'; 27 $squirrelmail_plugin_hooks['optpage_loadhook_display']['fortune'] = 'fortune_optpage_loadhook_display'; 28} 29 30/** 31 * Show fortune 32 * @access private 33 */ 34function fortune() { 35 global $fortune_visible, $username, $data_dir; 36 $fortune_visible = getPref($data_dir, $username, 'fortune_visible'); 37 38 // Don't show fortune if not enabled 39 if (empty($fortune_visible)) { 40 return; 41 } 42 43 include_once(SM_PATH . 'plugins/fortune/fortune_functions.php'); 44 fortune_show(); 45} 46 47/** 48 * Add fortune options 49 * @access private 50 */ 51function fortune_optpage_loadhook_display() { 52 include_once(SM_PATH . 'plugins/fortune/fortune_functions.php'); 53 fortune_show_options(); 54} 55 56