function start() { global $mybb, $db, $lang, $formatterManager; if (class_exists('MybbStuff_MyAlerts_AlertFormatterManager')) { $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::getInstance(); if (!$formatterManager) { $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::createInstance($mybb, $lang); } $formatterManager->registerFormatter(new FFPluginMyAlertsFormatter($mybb, $lang, 'ffplugin_myalerts')); } }
function myalerts_create_instances() { global $mybb, $db, $cache, $lang, $plugins; if (!isset($lang->myalerts)) { $lang->load('myalerts'); } $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache); MybbStuff_MyAlerts_AlertManager::createInstance($mybb, $db, $cache, $plugins, $alertTypeManager); MybbStuff_MyAlerts_AlertFormatterManager::createInstance($mybb, $lang); myalerts_register_core_formatters($mybb, $lang); register_shutdown_function(array(MybbStuff_MyAlerts_AlertManager::getInstance(), 'commit')); }
public function global_start() { global $mybb, $db, $settings, $lang, $templates, $myprofile_alertbar, $templatelist, $theme; if (defined('THIS_SCRIPT') && THIS_SCRIPT == "member.php") { /* load our templates */ $templatelist .= ",myprofile_comments_content,myprofile_comments_stats,myprofile_comments_form,myprofile_comments_form_modoptions,myprofile_comments_form_script,myprofile_comments_form_status,myprofile_comments_table,myprofile_comments_comment,myprofile_comments_no_comment,myprofile_comments_comment_approve,myprofile_comments_comment_reply,myprofile_comments_comment_edit,myprofile_comments_comment_delete,myprofile_comments_comment_report,multipage_page_current,multipage_page,multipage_nextpage,multipage,codebuttons"; /* if we are in member.php, and there is logged in user, or the user is viewing own profile */ if (isset($mybb->user["uid"], $mybb->input["uid"], $mybb->input["action"]) && $mybb->input["action"] == "profile" && $mybb->user["uid"] > 0 && $mybb->input["uid"] == $mybb->user["uid"]) { /* if the user has no new comments, why reset? */ if ($mybb->user["mpnewcomments"] != "0") { $update_array = array("mpnewcomments" => "0"); $db->update_query("users", $update_array, "uid='{$mybb->user['uid']}'", "1"); /* be kind and update the user? */ $mybb->user["mpnewcomments"] = "0"; } } } /* now if the admin has chosen to activate MyAlerts, hook my custom alert formatter classe on global_start */ if (in_array($settings["mpcommentsnotification"], array("myalertsoralertbar", "myalerts")) && MyProfileUtils::myalerts_exists()) { if (class_exists("MyProfileCommentsMyAlertsFormatter")) { $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::createInstance($mybb, $lang); $formatterManager->registerFormatter(new MyProfileCommentsMyAlertsFormatter($mybb, $lang, MyProfileCommentsMyAlertsFormatter::alert_type_code())); } } }
/** * GLOBAL START * Builds a list of links for the wiki -- for instance WIKI_URL holds the base URL for the wiki wherever you are. loaded globally. * This needs updating at some point * Also handles MyAlerts formatting */ function wiki_global_start() { global $mybb, $lang, $menu_wiki, $templates; $lang->load('wiki'); // Just in case if ($mybb->settings['seourls'] == "yes" || $mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1) { define("WIKI_URL", "wiki.html"); define("WIKI_VIEW", "wiki.html"); define("WIKI_EDIT", "wiki.html"); define("WIKI_NEW", "wiki.html"); define("WIKI_PROTECT", "wiki.html"); define("WIKI_CATEGORIES", "wiki.html"); define("WIKI_EXPORT", "wiki.html"); define("WIKI_DIFF", "wiki.html"); define("WIKI_CATEGORY_LISTING", "wiki.html"); define("WIKI_CONTRIBUTORS", "wiki.html"); } else { define("WIKI_URL", "wiki.php"); define("WIKI_VIEW", "wiki.php"); define("WIKI_EDIT", "wiki.php"); define("WIKI_NEW", "wiki.php"); define("WIKI_PROTECT", "wiki.php"); define("WIKI_CATEGORIES", "wiki.php"); define("WIKI_EXPORT", "wiki.php"); define("WIKI_DIFF", "wiki.php"); define("WIKI_CATEGORY_LISTING", "wiki.php"); define("WIKI_CONTRIBUTORS", "wiki.php"); } if (class_exists('MybbStuff_MyAlerts_AlertFormatterManager')) { require_once MYBB_ROOT . "inc/plugins/wiki/WikiCustomAlertFormatter.php"; $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::getInstance(); if (!$formatterManager) { $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::createInstance($mybb, $lang); } $formatterManager->registerFormatter(new WikiCustomAlertFormatter($mybb, $lang, 'mybb_wiki_alert_code')); } eval("\$menu_wiki .= \"" . $templates->get("wiki_menu_item") . "\";"); }