/** * Handle a request to view a single alert by marking the alert read and * forwarding on to the correct location. * * @param MyBB $mybb MyBB core object. * @param MyLanguage $lang Language object. */ function myalerts_redirect_alert($mybb, $lang) { $alertId = $mybb->get_input('id', MyBB::INPUT_INT); /** @var MybbStuff_MyAlerts_Entity_Alert $alert */ $alert = MybbStuff_MyAlerts_AlertManager::getInstance()->getAlert($alertId); if ($alert === null) { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); error($lang->myalerts_error_alert_not_found); return; } /** @var MybbStuff_MyAlerts_Formatter_AbstractFormatter $alertTypeFormatter */ $alertTypeFormatter = MybbStuff_MyAlerts_AlertFormatterManager::getInstance()->getFormatterForAlertType($alert->getType()->getCode()); if (!$alert || !$alertTypeFormatter) { error($lang->myalerts_error_alert_not_found); } MybbStuff_MyAlerts_AlertManager::getInstance()->markRead(array($alertId)); $redirectLink = unhtmlentities($alertTypeFormatter->buildShowLink($alert)); if (empty($redirectLink)) { $redirectLink = $mybb->settings['bburl'] . '/alerts.php'; } header('Location: ' . $redirectLink); }
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')); } }
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())); } } }
/** * Display alert if an attached account has new pm('s). * */ function accountswitcher_alerts_display_pm() { global $mybb, $lang; if ($mybb->user['uid'] && $mybb->settings['aj_myalerts'] == 1) { $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::getInstance(); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_AccountswitcherPMFormatter($mybb, $lang, 'accountswitcher_pm')); } }
function myalerts_register_core_formatters($mybb, $lang) { /** @var MybbStuff_Myalerts_AlertFormatterManager $formatterManager */ $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::getInstance(); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_RepFormatter($mybb, $lang, 'rep')); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_BuddylistFormatter($mybb, $lang, 'buddylist')); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_QuotedFormatter($mybb, $lang, 'quoted')); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_PrivateMessageFormatter($mybb, $lang, 'pm')); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_ThreadAuthorReplyFormatter($mybb, $lang, 'post_threadauthor')); $formatterManager->registerFormatter(new MybbStuff_MyAlerts_Formatter_SubscribedThreadFormatter($mybb, $lang, 'subscribed_thread')); }
function thankyoulike_templatelist() { global $mybb, $cache, $lang, $code, $templatelist; $codename = basename(__FILE__, ".php"); $prefix = 'g33k_' . $codename . '_'; if ($mybb->settings[$prefix . 'enabled'] == "1") { $lang->load('thankyoulike', false, true); if ($mybb->settings[$prefix . 'thankslike'] == "like") { $lang->tyl_send = $lang->tyl_send_like; $lang->tyl_remove = $lang->tyl_remove_like; $lang->tyl_alert = $lang->tyl_alert_like; $lang->myalerts_setting_tyl = $lang->myalerts_setting_tyl_like; } else { if ($mybb->settings[$prefix . 'thankslike'] == "thanks") { $lang->tyl_send = $lang->tyl_send_thanks; $lang->tyl_remove = $lang->tyl_remove_thanks; $lang->tyl_alert = $lang->tyl_alert_thanks; $lang->myalerts_setting_tyl = $lang->myalerts_setting_tyl_thanks; } } // Registering alert formatter if (function_exists('myalerts_is_activated') && myalerts_is_activated() && $mybb->user['uid']) { global $cache, $formatterManager; tyl_myalerts_formatter_load(); // Load cache data and compare if version is the same or not $myalerts_plugins = $cache->read('mybbstuff_myalerts_alert_types'); if ($myalerts_plugins['tyl']['code'] == 'tyl' && $myalerts_plugins['tyl']['enabled'] == 1) { if (class_exists('MybbStuff_MyAlerts_AlertFormatterManager') && class_exists('ThankyouAlertFormatter')) { $code = 'tyl'; $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::getInstance(); $formatterManager->registerFormatter(new ThankyouAlertFormatter($mybb, $lang, $code)); } } } $template_list = ''; if (THIS_SCRIPT == 'showthread.php') { $template_list = "thankyoulike_users,thankyoulike_postbit,thankyoulike,thankyoulike_classic,thankyoulike_expcollapse,thankyoulike_button_add,thankyoulike_button_del"; } if (THIS_SCRIPT == 'member.php') { $template_list = "thankyoulike_memprofile"; } if (THIS_SCRIPT == 'announcements.php') { $template_list = "thankyoulike_postbit"; } if (THIS_SCRIPT == 'private.php') { $template_list = "thankyoulike_postbit"; } if (isset($templatelist)) { $templatelist .= "," . $template_list; } else { $templatelist = $template_list; } } }
function trader_alertregister() { global $mybb, $lang; if (class_exists("MybbStuff_MyAlerts_AlertFormatterManager")) { if ($mybb->user['uid']) { $lang->load('tradefeedback'); $code = 'tradefeedback'; $formatterManager = MybbStuff_MyAlerts_AlertFormatterManager::getInstance(); $formatterManager->registerFormatter(new TradeFeedbackFormatter($mybb, $lang, $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") . "\";"); }