diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d15f3da
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,365 @@
+# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,intellij+all,phpstorm+all,visualstudiocode,intellij+iml,intellij
+# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,intellij+all,phpstorm+all,visualstudiocode,intellij+iml,intellij
+
+### Intellij ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### Intellij Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+# Sonarlint plugin
+# https://plugins.jetbrains.com/plugin/7973-sonarlint
+.idea/**/sonarlint/
+
+# SonarQube Plugin
+# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
+.idea/**/sonarIssues.xml
+
+# Markdown Navigator plugin
+# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
+.idea/**/markdown-navigator.xml
+.idea/**/markdown-navigator-enh.xml
+.idea/**/markdown-navigator/
+
+# Cache file creation bug
+# See https://youtrack.jetbrains.com/issue/JBR-2257
+.idea/$CACHE_FILE$
+
+# CodeStream plugin
+# https://plugins.jetbrains.com/plugin/12206-codestream
+.idea/codestream.xml
+
+# Azure Toolkit for IntelliJ plugin
+# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
+.idea/**/azureSettings.xml
+
+### Intellij+all ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+
+# AWS User-specific
+
+# Generated files
+
+# Sensitive or high-churn files
+
+# Gradle
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+
+# Mongo Explorer plugin
+
+# File-based project format
+
+# IntelliJ
+
+# mpeltonen/sbt-idea plugin
+
+# JIRA plugin
+
+# Cursive Clojure plugin
+
+# SonarLint plugin
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+
+# Editor-based Rest Client
+
+# Android studio 3.1+ serialized cache file
+
+### Intellij+all Patch ###
+# Ignore everything but code style settings and run configurations
+# that are supposed to be shared within teams.
+
+.idea/*
+
+!.idea/codeStyles
+!.idea/runConfigurations
+
+### Intellij+iml ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+
+# AWS User-specific
+
+# Generated files
+
+# Sensitive or high-churn files
+
+# Gradle
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+
+# Mongo Explorer plugin
+
+# File-based project format
+
+# IntelliJ
+
+# mpeltonen/sbt-idea plugin
+
+# JIRA plugin
+
+# Cursive Clojure plugin
+
+# SonarLint plugin
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+
+# Editor-based Rest Client
+
+# Android studio 3.1+ serialized cache file
+
+### Intellij+iml Patch ###
+# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
+
+*.iml
+modules.xml
+.idea/misc.xml
+*.ipr
+
+### macOS ###
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### macOS Patch ###
+# iCloud generated files
+*.icloud
+
+### PhpStorm+all ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+
+# AWS User-specific
+
+# Generated files
+
+# Sensitive or high-churn files
+
+# Gradle
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+
+# Mongo Explorer plugin
+
+# File-based project format
+
+# IntelliJ
+
+# mpeltonen/sbt-idea plugin
+
+# JIRA plugin
+
+# Cursive Clojure plugin
+
+# SonarLint plugin
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+
+# Editor-based Rest Client
+
+# Android studio 3.1+ serialized cache file
+
+### PhpStorm+all Patch ###
+# Ignore everything but code style settings and run configurations
+# that are supposed to be shared within teams.
+
+
+
+### VisualStudioCode ###
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+!.vscode/*.code-snippets
+
+# Local History for Visual Studio Code
+.history/
+
+# Built Visual Studio Code Extensions
+*.vsix
+
+### VisualStudioCode Patch ###
+# Ignore all local history of files
+.history
+.ionide
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.toptal.com/developers/gitignore/api/macos,windows,intellij+all,phpstorm+all,visualstudiocode,intellij+iml,intellij
diff --git a/Upload/inc/languages/english/admin/asb.lang.php b/Upload/inc/languages/english/admin/asb.lang.php
index 21c4c81..0dcb0c6 100644
--- a/Upload/inc/languages/english/admin/asb.lang.php
+++ b/Upload/inc/languages/english/admin/asb.lang.php
@@ -399,6 +399,4 @@
$l['asb_ajax_templates'] = 'templates';
$l['asb_ajax_file_name_empty'] = 'no file name';
$l['asb_ajax_file_does_not_exist'] = 'file does not exist';
-$l['asb_ajax_file_empty'] = 'file empty or corrupted';
-
-?>
+$l['asb_ajax_file_empty'] = 'file empty or corrupted';
\ No newline at end of file
diff --git a/Upload/inc/languages/english/admin/asb_addon.lang.php b/Upload/inc/languages/english/admin/asb_addon.lang.php
index 616e45b..bb99530 100644
--- a/Upload/inc/languages/english/admin/asb_addon.lang.php
+++ b/Upload/inc/languages/english/admin/asb_addon.lang.php
@@ -41,6 +41,12 @@
$l['asb_important_threads_only_title'] = 'Important Threads Only?';
$l['asb_important_threads_only_desc'] = "YES to only use 'stickied' threads, NO (default) to use any threads/posts";
+$l['asb_load_xthreads_data_title'] = 'Load xThreads Data?';
+$l['asb_load_xthreads_data_desc'] = "YES to load xThread data available for the fetched threads, NO (default) to save unnecessary DB calls.";
+
+$l['asb_showinportal_threads_only_title'] = 'Show In Portal Threads Only?';
+$l['asb_showinportal_threads_only_desc'] = "YES to only use 'show in portal' threads marked by the OUGC Show In Portal plugin, NO (default) to use any threads/posts.";
+
$l['asb_max_thread_title_length_title'] = 'Thread Title Length Limit';
$l['asb_max_thread_title_length_desc'] = 'enter nothing or 0 to show the full title, or enter the maximal number of characters to display (default 40)';
@@ -400,6 +406,4 @@
$l['asb_birthdays_no_content'] = 'no birthdays to show';
$l['asb_birthdays_no_birthdays_today'] = 'No birthdays today.';
-$l['asb_birthdays_no_upcoming_birthdays'] = 'No upcoming birthdays.';
-
-?>
+$l['asb_birthdays_no_upcoming_birthdays'] = 'No upcoming birthdays.';
\ No newline at end of file
diff --git a/Upload/inc/languages/english/asb.lang.php b/Upload/inc/languages/english/asb.lang.php
index 39559aa..51c4301 100644
--- a/Upload/inc/languages/english/asb.lang.php
+++ b/Upload/inc/languages/english/asb.lang.php
@@ -14,6 +14,4 @@
// visibility toggle icons
$l['asb_toggle_show'] = 'show side boxes';
-$l['asb_toggle_hide'] = 'hide side boxes';
-
-?>
+$l['asb_toggle_hide'] = 'hide side boxes';
\ No newline at end of file
diff --git a/Upload/inc/languages/english/asb_addon.lang.php b/Upload/inc/languages/english/asb_addon.lang.php
index 616e45b..bb99530 100644
--- a/Upload/inc/languages/english/asb_addon.lang.php
+++ b/Upload/inc/languages/english/asb_addon.lang.php
@@ -41,6 +41,12 @@
$l['asb_important_threads_only_title'] = 'Important Threads Only?';
$l['asb_important_threads_only_desc'] = "YES to only use 'stickied' threads, NO (default) to use any threads/posts";
+$l['asb_load_xthreads_data_title'] = 'Load xThreads Data?';
+$l['asb_load_xthreads_data_desc'] = "YES to load xThread data available for the fetched threads, NO (default) to save unnecessary DB calls.";
+
+$l['asb_showinportal_threads_only_title'] = 'Show In Portal Threads Only?';
+$l['asb_showinportal_threads_only_desc'] = "YES to only use 'show in portal' threads marked by the OUGC Show In Portal plugin, NO (default) to use any threads/posts.";
+
$l['asb_max_thread_title_length_title'] = 'Thread Title Length Limit';
$l['asb_max_thread_title_length_desc'] = 'enter nothing or 0 to show the full title, or enter the maximal number of characters to display (default 40)';
@@ -400,6 +406,4 @@
$l['asb_birthdays_no_content'] = 'no birthdays to show';
$l['asb_birthdays_no_birthdays_today'] = 'No birthdays today.';
-$l['asb_birthdays_no_upcoming_birthdays'] = 'No upcoming birthdays.';
-
-?>
+$l['asb_birthdays_no_upcoming_birthdays'] = 'No upcoming birthdays.';
\ No newline at end of file
diff --git a/Upload/inc/plugins/adv_sidebox.php b/Upload/inc/plugins/adv_sidebox.php
index b080e15..af49535 100644
--- a/Upload/inc/plugins/adv_sidebox.php
+++ b/Upload/inc/plugins/adv_sidebox.php
@@ -2,6 +2,4 @@
/*
* this file is simply here to overwrite the old plug-in file (if it still exists) and prevent two instances of ASB from showing up in ACP
- */
-
-?>
+ */
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php
index f4bee97..24e4ac7 100644
--- a/Upload/inc/plugins/asb.php
+++ b/Upload/inc/plugins/asb.php
@@ -46,6 +46,4 @@ function asbClassAutoload($className)
if (file_exists($path)) {
require_once $path;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php
index a401f03..171d982 100644
--- a/Upload/inc/plugins/asb/acp.php
+++ b/Upload/inc/plugins/asb/acp.php
@@ -568,16 +568,16 @@ function asb_admin_edit_box()
// if there are few scripts to choose from, alter the layout and/or wording of choices
switch (count($choices)) {
- case 3:
- $choices['all_scripts'] = $lang->asb_both_scripts;
- break;
- case 2:
- unset($choices['all_scripts']);
- $selectedScripts = array_flip($choices);
- break;
- case 1:
- $choices['all_scripts'] = $lang->asb_all_scripts_disabled;
- break;
+ case 3:
+ $choices['all_scripts'] = $lang->asb_both_scripts;
+ break;
+ case 2:
+ unset($choices['all_scripts']);
+ $selectedScripts = array_flip($choices);
+ break;
+ case 1:
+ $choices['all_scripts'] = $lang->asb_all_scripts_disabled;
+ break;
}
// which scripts
@@ -1060,12 +1060,13 @@ function asb_admin_view_scripts()
if ($mybb->request_method == 'post') {
if ($mybb->input['mode'] == 'edit') {
$id = (int) $mybb->input['id'];
- $redirectUrl = $html->url(array('action' => 'view_scripts', 'mode' => 'edit', 'tid' => $tid));
+ $redirectUrl = $html->url(array('action' => 'view_scripts', 'mode' => 'edit', 'tid' => $tid, 'id' => $id));
$mybb->input['action'] = $mybb->input['script_action'];
$script = new ScriptInfo($mybb->input);
- $totalWidth = $mybb->input['width_left'] + $mybb->input['width_right'] + $mybb->input['width_middle'] + $mybb->input['left_margin'] + $mybb->input['right_margin'];
+ $totalWidth = $mybb->get_input('width_left', \MyBB::INPUT_FLOAT) + $mybb->get_input('width_right', \MyBB::INPUT_FLOAT) + $mybb->get_input('width_middle', \MyBB::INPUT_FLOAT) + $mybb->get_input('left_margin', \MyBB::INPUT_FLOAT) + $mybb->get_input('right_margin', \MyBB::INPUT_FLOAT);
+
if ($totalWidth > 100) {
flash_message($lang->asb_script_save_width_error, 'error');
admin_redirect($redirectUrl);
@@ -1183,64 +1184,64 @@ function asb_admin_view_scripts()
$deleted = false;
switch ($mybb->input['inline_action']) {
- case 'update_width':
- $action = $lang->asb_updated;
- $changed = false;
- $totalWidth = 0;
-
- foreach (array('width_left', 'left_margin', 'width_middle', 'right_margin', 'width_right') as $key) {
- if (isset($mybb->input[$key][$id])) {
- $totalWidth += $mybb->input[$key][$id];
- $script->set($key, $mybb->input[$key][$id]);
- $changed = true;
+ case 'update_width':
+ $action = $lang->asb_updated;
+ $changed = false;
+ $totalWidth = 0;
+
+ foreach (array('width_left', 'left_margin', 'width_middle', 'right_margin', 'width_right') as $key) {
+ if (isset($mybb->input[$key][$id])) {
+ $totalWidth += $mybb->input[$key][$id];
+ $script->set($key, $mybb->input[$key][$id]);
+ $changed = true;
+ }
}
- }
- if ($totalWidth > 100) {
- flash_message($lang->asb_script_save_width_error, 'error');
- admin_redirect($redirect);
- }
+ if ($totalWidth > 100) {
+ flash_message($lang->asb_script_save_width_error, 'error');
+ admin_redirect($redirect);
+ }
- if ($changed == false) {
- continue 2;
- }
+ if ($changed == false) {
+ continue 2;
+ }
- $scriptTid = (int) $script->get('tid');
- if (!$viewingMaster &&
- $scriptTid === 0) {
- $script->set(array('id' => 0, 'tid' => $tid));
- }
+ $scriptTid = (int) $script->get('tid');
+ if (!$viewingMaster &&
+ $scriptTid === 0) {
+ $script->set(array('id' => 0, 'tid' => $tid));
+ }
- $script->save();
- break;
- case 'delete':
- $action = $lang->asb_deleted;
- if (!$script->remove()) {
- continue 2;
- }
+ $script->save();
+ break;
+ case 'delete':
+ $action = $lang->asb_deleted;
+ if (!$script->remove()) {
+ continue 2;
+ }
- $deleted = true;
- break;
- case 'activate':
- $action = $lang->asb_activated;
- if ($script->get('active')) {
- continue 2;
- }
+ $deleted = true;
+ break;
+ case 'activate':
+ $action = $lang->asb_activated;
+ if ($script->get('active')) {
+ continue 2;
+ }
- $script->set('active', true);
- $script->save();
- break;
- case 'deactivate':
- $action = $lang->asb_deactivated;
- if (!$script->get('active')) {
- continue 2;
- }
+ $script->set('active', 1);
+ $script->save();
+ break;
+ case 'deactivate':
+ $action = $lang->asb_deactivated;
+ if (!$script->get('active')) {
+ continue 2;
+ }
- $script->set('active', false);
- $script->save();
- break;
- default:
- continue 2;
+ $script->set('active', 0);
+ $script->save();
+ break;
+ default:
+ continue 2;
}
++$job_count;
@@ -1288,7 +1289,7 @@ function asb_admin_view_scripts()
}
exit;
} elseif (($mybb->input['mode'] == 'activate' ||
- $mybb->input['mode'] == 'deactivate') &&
+ $mybb->input['mode'] == 'deactivate') &&
$mybb->input['id']) {
$script = new ScriptInfo((int) $mybb->input['id']);
$script->set('active', ($mybb->input['mode'] == 'activate'));
@@ -1416,7 +1417,7 @@ function asb_admin_view_scripts()
$formContainer->output_row("{$lang->asb_action}:", $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_action)), "{$spinner}
{$detectedInfo['actions']}
".$form->generate_text_box('script_action', $data['action'], array('id' => 'action')));
$formContainer->output_row($lang->asb_page, $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_page)), $form->generate_text_box('page', $data['page']));
- $formContainer->output_row($lang->asb_disable_for_mobile_title, $lang->asb_disable_for_mobile_description, $form->generate_yes_no_radio('mobile_disabled', $data['mobile_disabled'], true, array('id' => 'mobile_disabled_yes', 'class' => 'mobile_disabled'), array('id' => 'mobile_disabled_no', 'class' => 'mobile_disabled')), '', array(), array('id' => 'mobile_disabled'));
+ $formContainer->output_row($lang->asb_disable_for_mobile_title, $lang->asb_disable_for_mobile_description, $form->generate_yes_no_radio('mobile_disabled', (int)$data['mobile_disabled'] ?? 0, true, array('id' => 'mobile_disabled_yes', 'class' => 'mobile_disabled'), array('id' => 'mobile_disabled_no', 'class' => 'mobile_disabled')), '', array(), array('id' => 'mobile_disabled'));
$formContainer->output_row($lang->asb_width_left, $lang->asb_width_left_desc, $form->generate_text_box('width_left', $data['width_left']));
$formContainer->output_row($lang->asb_left_margin, $lang->asb_left_margin_desc, $form->generate_text_box('left_margin', $data['left_margin']));
@@ -1803,7 +1804,7 @@ function asb_admin_xmlhttp()
asbCacheHasChanged();
}
}
- // this routine allows the side box's visibility tool tip and links to be handled by JS after the side box is created
+ // this routine allows the side box's visibility tool tip and links to be handled by JS after the side box is created
} elseif($mybb->input['mode'] == 'build_info' && (int) $mybb->input['id'] > 0) {
$id = (int) $mybb->input['id'];
$sidebox = new SideboxObject($id);
@@ -1826,10 +1827,10 @@ function asb_admin_xmlhttp()
EOF;
// this HTML output will be directly stored in the side box's representative
echo(asbBuildSideBoxInfo($sidebox, false, true).$script);
- /*
- * searches for hooks, templates and actions and returns an
- * array of JSON encoded select box HTML for any that are found
- */
+ /*
+ * searches for hooks, templates and actions and returns an
+ * array of JSON encoded select box HTML for any that are found
+ */
} elseif($mybb->input['mode'] == 'analyze_script' &&
trim($mybb->input['filename'])) {
$content = asbDetectScriptInfo($mybb->input['filename'], $mybb->input['selected']);
@@ -2014,16 +2015,16 @@ function asb_admin_update_theme_select()
$plugins->add_hook('admin_config_settings_change', 'asb_admin_config_settings_change');
function asb_admin_config_settings_change()
{
- global $mybb;
-
- /* only serialize our setting if it is being saved
- * (thanks to Tanweth for helping me find this)
- *
- * we are checking for the existence of asb_show_empty_boxes
- * because checking for asb_exclude_theme fails if deselecting
- * all themes:
- * https://github.com/WildcardSearch/Advanced-Sidebox/issues/148
- */
+ global $mybb;
+
+ /* only serialize our setting if it is being saved
+ * (thanks to Tanweth for helping me find this)
+ *
+ * we are checking for the existence of asb_show_empty_boxes
+ * because checking for asb_exclude_theme fails if deselecting
+ * all themes:
+ * https://github.com/WildcardSearch/Advanced-Sidebox/issues/148
+ */
if (isset($mybb->input['upsetting']['asb_show_empty_boxes'])) {
$mybb->input['upsetting']['asb_exclude_theme'] = serialize($mybb->input['upsetting']['asb_exclude_theme']);
}
@@ -2049,7 +2050,7 @@ function asb_admin_config_action_handler(&$action)
function asb_admin_config_menu(&$sub_menu)
{
global $lang;
- if (!$lang->asb) {
+ if (!isset($lang->asb)) {
$lang->load('asb');
}
@@ -2158,6 +2159,4 @@ function asb_admin_user_users_edit_commit_start()
global $mybb, $extra_user_updates;
$extra_user_updates['show_sidebox'] = $mybb->input['show_sidebox'];
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php b/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php
index 8b83a18..1b8a8c0 100644
--- a/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php
+++ b/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php
@@ -184,6 +184,4 @@ public function buildCache(&$data)
}
}
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php b/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php
index 2d0548d..12abb45 100644
--- a/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php
+++ b/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php
@@ -34,6 +34,4 @@ public function __construct($path='')
{
parent::__construct(MYBB_ROOT.'inc/plugins/asb/install_data.php');
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/ConfigurableModule010101.php b/Upload/inc/plugins/asb/classes/ConfigurableModule010101.php
index 812920b..34b9ccb 100644
--- a/Upload/inc/plugins/asb/classes/ConfigurableModule010101.php
+++ b/Upload/inc/plugins/asb/classes/ConfigurableModule010101.php
@@ -274,6 +274,4 @@ public function outputSettings($formContainer)
{
ConfigurableModule010101::outputModuleSettings($this, $formContainer);
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/ConfigurableModuleInterface010000.php b/Upload/inc/plugins/asb/classes/ConfigurableModuleInterface010000.php
index 861e4c6..f7c9c96 100644
--- a/Upload/inc/plugins/asb/classes/ConfigurableModuleInterface010000.php
+++ b/Upload/inc/plugins/asb/classes/ConfigurableModuleInterface010000.php
@@ -7,6 +7,4 @@
interface ConfigurableModuleInterface010000
{
public function outputSettings($formContainer);
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/CustomSidebox.php b/Upload/inc/plugins/asb/classes/CustomSidebox.php
index a34852f..3d2481d 100644
--- a/Upload/inc/plugins/asb/classes/CustomSidebox.php
+++ b/Upload/inc/plugins/asb/classes/CustomSidebox.php
@@ -120,6 +120,4 @@ public function buildContent($template_variable)
return $returnVal;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/ExternalModule020100.php b/Upload/inc/plugins/asb/classes/ExternalModule020100.php
index ca7ae70..d89afde 100644
--- a/Upload/inc/plugins/asb/classes/ExternalModule020100.php
+++ b/Upload/inc/plugins/asb/classes/ExternalModule020100.php
@@ -127,6 +127,4 @@ public function remove()
return !file_exists($filename);
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/ExternalModuleInterface020100.php b/Upload/inc/plugins/asb/classes/ExternalModuleInterface020100.php
index 7b64fd6..5f21cf3 100644
--- a/Upload/inc/plugins/asb/classes/ExternalModuleInterface020100.php
+++ b/Upload/inc/plugins/asb/classes/ExternalModuleInterface020100.php
@@ -15,6 +15,4 @@ interface ExternalModuleInterface020100
public function load($name);
public function run($function_name);
public function remove();
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/HTMLGenerator010000.php b/Upload/inc/plugins/asb/classes/HTMLGenerator010000.php
index 3004a7e..57c54d9 100644
--- a/Upload/inc/plugins/asb/classes/HTMLGenerator010000.php
+++ b/Upload/inc/plugins/asb/classes/HTMLGenerator010000.php
@@ -200,6 +200,4 @@ protected function build_property_list($options = array(), $allowed = array())
}
return $property_list;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/InstallableModule010001.php b/Upload/inc/plugins/asb/classes/InstallableModule010001.php
index f50eb61..7b11898 100644
--- a/Upload/inc/plugins/asb/classes/InstallableModule010001.php
+++ b/Upload/inc/plugins/asb/classes/InstallableModule010001.php
@@ -374,6 +374,4 @@ protected function unsetCacheVersion()
$this->cache->update($this->cacheKey, $data);
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/InstallableModuleInterface010000.php b/Upload/inc/plugins/asb/classes/InstallableModuleInterface010000.php
index 9506391..44fe3c4 100644
--- a/Upload/inc/plugins/asb/classes/InstallableModuleInterface010000.php
+++ b/Upload/inc/plugins/asb/classes/InstallableModuleInterface010000.php
@@ -8,6 +8,4 @@ interface InstallableModuleInterface010000
{
public function install($cleanup = true);
public function uninstall($cleanup = true);
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/MalleableObject010000.php b/Upload/inc/plugins/asb/classes/MalleableObject010000.php
index 0673d32..725d57b 100644
--- a/Upload/inc/plugins/asb/classes/MalleableObject010000.php
+++ b/Upload/inc/plugins/asb/classes/MalleableObject010000.php
@@ -69,6 +69,4 @@ public function isValid()
{
return $this->valid;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/MalleableObjectInterface010000.php b/Upload/inc/plugins/asb/classes/MalleableObjectInterface010000.php
index a089057..4e4e214 100644
--- a/Upload/inc/plugins/asb/classes/MalleableObjectInterface010000.php
+++ b/Upload/inc/plugins/asb/classes/MalleableObjectInterface010000.php
@@ -12,6 +12,4 @@ interface MalleableObjectInterface010000
public function get($properties);
public function set($properties, $value = '');
public function isValid();
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/PortableObject010102.php b/Upload/inc/plugins/asb/classes/PortableObject010102.php
index b980042..6bb0f83 100644
--- a/Upload/inc/plugins/asb/classes/PortableObject010102.php
+++ b/Upload/inc/plugins/asb/classes/PortableObject010102.php
@@ -217,6 +217,4 @@ protected function getCleanIdentifier()
);
return preg_replace($find, $replace, strtolower(trim($name)));
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/PortableObjectInterface010100.php b/Upload/inc/plugins/asb/classes/PortableObjectInterface010100.php
index 4b9bbdd..20d3c24 100644
--- a/Upload/inc/plugins/asb/classes/PortableObjectInterface010100.php
+++ b/Upload/inc/plugins/asb/classes/PortableObjectInterface010100.php
@@ -12,6 +12,4 @@ interface PortableObjectInterface010100
public function export($options = '');
public function import($xml);
public function buildRow();
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/ScriptInfo.php b/Upload/inc/plugins/asb/classes/ScriptInfo.php
index f50e447..5f83760 100644
--- a/Upload/inc/plugins/asb/classes/ScriptInfo.php
+++ b/Upload/inc/plugins/asb/classes/ScriptInfo.php
@@ -107,12 +107,10 @@ class ScriptInfo extends PortableObject010102
/**
* @var bool
*/
- protected $mobile_disabled = false;
+ protected $mobile_disabled = 0;
/**
* @var string
*/
protected $tableName = 'asb_script_info';
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/SideboxModule.php b/Upload/inc/plugins/asb/classes/SideboxModule.php
index 472df7e..29882fa 100644
--- a/Upload/inc/plugins/asb/classes/SideboxModule.php
+++ b/Upload/inc/plugins/asb/classes/SideboxModule.php
@@ -289,6 +289,4 @@ public function doSettingsSave($settings)
return $settings;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/SideboxObject.php b/Upload/inc/plugins/asb/classes/SideboxObject.php
index 37be0a3..69ba3c1 100644
--- a/Upload/inc/plugins/asb/classes/SideboxObject.php
+++ b/Upload/inc/plugins/asb/classes/SideboxObject.php
@@ -105,6 +105,4 @@ public function load($data)
return true;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/StorableObject010001.php b/Upload/inc/plugins/asb/classes/StorableObject010001.php
index 1f5187c..3ac1c23 100644
--- a/Upload/inc/plugins/asb/classes/StorableObject010001.php
+++ b/Upload/inc/plugins/asb/classes/StorableObject010001.php
@@ -96,31 +96,33 @@ public function save()
$this->data = array();
foreach ($this as $property => $value) {
- if (in_array($property, $this->noStore)) {
+ if (in_array($property, $this->noStore) || !isset($this->$property)) {
continue;
}
switch (gettype($this->$property)) {
- case 'boolean':
- $this->data[$property] = (bool) $value;
- break;
- case 'integer':
- $this->data[$property] = (int) $value;
- break;
- case 'NULL':
- $this->data[$property] = null;
- break;
- case 'double':
- $this->data[$property] = (float) $value;
- break;
- case 'string':
- $this->data[$property] = $db->escape_string($value);
- break;
- case 'array':
- case 'object':
- case 'resource':
- $this->data[$property] = $db->escape_string(json_encode($value));
- break;
+ case 'boolean':
+ $this->data[$property] = (bool) $value;
+ break;
+ case 'integer':
+ $this->data[$property] = (int) $value;
+ break;
+ case 'NULL':
+ $this->data[$property] = null;
+ break;
+ case 'double':
+ $this->data[$property] = (float) $value;
+ break;
+ case 'string':
+ $this->data[$property] = $db->escape_string($value);
+ break;
+ case 'array':
+ case 'object':
+ case 'resource':
+ $this->data[$property] = $db->escape_string(json_encode($value));
+ break;
+ default:
+ break;
}
}
$this->data['dateline'] = TIME_NOW;
@@ -151,6 +153,4 @@ public function remove($noCleanup = false)
global $db;
return $db->delete_query($this->tableName, "id='{$this->id}'");
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/StorableObjectInterface010000.php b/Upload/inc/plugins/asb/classes/StorableObjectInterface010000.php
index 2351dca..bbcffca 100644
--- a/Upload/inc/plugins/asb/classes/StorableObjectInterface010000.php
+++ b/Upload/inc/plugins/asb/classes/StorableObjectInterface010000.php
@@ -12,6 +12,4 @@ interface StorableObjectInterface010000
public function load($data);
public function save();
public function remove($noCleanup = false);
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/WildcardPluginCache010300.php b/Upload/inc/plugins/asb/classes/WildcardPluginCache010300.php
index a7484a1..e83f68f 100644
--- a/Upload/inc/plugins/asb/classes/WildcardPluginCache010300.php
+++ b/Upload/inc/plugins/asb/classes/WildcardPluginCache010300.php
@@ -63,7 +63,7 @@ public function read($key = null)
* entire cache in the db
* @return void
*/
- public function update($key = null, $val, $hard = false)
+ public function update($key = null, $val = [], $hard = false)
{
if ($key === null) {
if ($this->subKey) {
@@ -154,6 +154,4 @@ public function setVersion($version)
{
$this->update('version', trim($version));
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/WildcardPluginCacheInterface010200.php b/Upload/inc/plugins/asb/classes/WildcardPluginCacheInterface010200.php
index 823d06d..852b21d 100644
--- a/Upload/inc/plugins/asb/classes/WildcardPluginCacheInterface010200.php
+++ b/Upload/inc/plugins/asb/classes/WildcardPluginCacheInterface010200.php
@@ -10,11 +10,9 @@
interface WildcardPluginCacheInterface010200
{
public function read($key = null);
- public function update($key = null, $val, $hard = false);
+ public function update($key = null, $val = null, $hard = false);
public function save();
public function clear($hard = false);
public function getVersion();
public function setVersion($version);
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/WildcardPluginInstaller020001.php b/Upload/inc/plugins/asb/classes/WildcardPluginInstaller020001.php
index 4807f1e..3d9a63b 100644
--- a/Upload/inc/plugins/asb/classes/WildcardPluginInstaller020001.php
+++ b/Upload/inc/plugins/asb/classes/WildcardPluginInstaller020001.php
@@ -936,6 +936,4 @@ private function createContentFolder($path)
return false;
}
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/classes/WildcardPluginInstallerInterface010000.php b/Upload/inc/plugins/asb/classes/WildcardPluginInstallerInterface010000.php
index 1fe26d6..8541b17 100644
--- a/Upload/inc/plugins/asb/classes/WildcardPluginInstallerInterface010000.php
+++ b/Upload/inc/plugins/asb/classes/WildcardPluginInstallerInterface010000.php
@@ -8,6 +8,4 @@ interface WildcardPluginInstallerInterface010000
{
public function install();
public function uninstall();
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php
index c70a109..5732c85 100644
--- a/Upload/inc/plugins/asb/forum.php
+++ b/Upload/inc/plugins/asb/forum.php
@@ -68,7 +68,10 @@ function asb_start()
$template_var = "{$moduleKey}_{$id}";
$module = new SideboxModule($moduleKey);
- $custom = new CustomSidebox($asb['custom'][$moduleKey]);
+ if(isset($asb['custom'][$moduleKey]))
+ {
+ $custom = new CustomSidebox($asb['custom'][$moduleKey]);
+ }
if (!$module->isValid() &&
!$custom->isValid()) {
@@ -133,8 +136,7 @@ function asb_start()
}
// does this column have boxes?
- if (!is_array($filteredBoxes) ||
- empty($filteredBoxes)) {
+ if (empty($filteredBoxes) || !is_array($filteredBoxes)) {
return;
}
@@ -226,6 +228,8 @@ function asb_edit_template($boxes, $width, $script)
{
global $mybb, $lang, $templates, $headerinclude, $theme;
+ $min = '';
+
if ($mybb->settings['asb_minify_js']) {
$min = '.min';
}
@@ -309,7 +313,7 @@ function asb_edit_template($boxes, $width, $script)
$propName = "{$key}_content";
$widthName = "width_{$key}";
$width = $$widthName;
- $show_column = $show[$key];
+ $show_column = $show[$key] ?? '';
$column_id = "asb_{$key}_column_id";
$insertName = $varName;
$sideboxes = $$insertName;
@@ -317,7 +321,7 @@ function asb_edit_template($boxes, $width, $script)
$toggle_left = $toggle_right = '';
$toggle_name = "toggle_{$key}";
- $$toggle_name = $toggles[$key];
+ $$toggle_name = $toggles[$key] ?? '';
eval("\$content = \"{$templates->get('asb_sidebox_column')}\";");
@@ -331,6 +335,8 @@ function asb_edit_template($boxes, $width, $script)
}
}
+ $left_content = $left_content ?? '';
+
eval("\$insertTop = \"{$templates->get('asb_begin')}\";");
eval("\$insertBottom = \"{$templates->get('asb_end')}\";");
@@ -382,14 +388,7 @@ function asb_edit_template($boxes, $width, $script)
}
// replace everything on the page?
- if ($script['replace_all'] == true) {
- // if there is content
- if ($script['replacement']) {
- // replace the existing page entirely
- $templates->cache[$script['template_name']] = str_replace(array('{$asb_left}', '{$asb_right}'), array($insertTop, $insertBottom), $script['replacement']);
- }
- // outputting to variables? (custom script/Page Manager)
- } elseif($script['eval']) {
+ if($script['eval']) {
// globalize our columns
global $asb_left, $asb_right;
@@ -405,7 +404,14 @@ function asb_edit_template($boxes, $width, $script)
eval("\$asb_left = \"".str_replace("\\'", "'", addslashes($insertTop))."\";");
eval("\$asb_right = \"".str_replace("\\'", "'", addslashes($insertBottom))."\";");
// otherwise we are editing the template in the cache
- } else {
+ } elseif ($script['replace_all'] == true) {
+ // if there is content
+ if ($script['replacement']) {
+ // replace the existing page entirely
+ $templates->cache[$script['template_name']] = str_replace(array('{$asb_left}', '{$asb_right}'), array($insertTop, $insertBottom), $script['replacement']);
+ }
+ // outputting to variables? (custom script/Page Manager)
+ } else {
// make the edits
$script['find_top'] = str_replace("\r", '', $script['find_top']);
$script['find_bottom'] = str_replace("\r", '', $script['find_bottom']);
@@ -466,8 +472,7 @@ function asb_initialize()
$script = asbGetCurrentScript($asb, true);
// anything to show for this script?
- if (!is_array($script['sideboxes']) ||
- empty($script['sideboxes'])) {
+ if (empty($script) || empty($script['sideboxes']) || !is_array($script['sideboxes'])) {
return;
}
@@ -540,6 +545,4 @@ function asb_xmlhttp()
}
exit;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php
index a58e8f1..3bf02fd 100644
--- a/Upload/inc/plugins/asb/functions.php
+++ b/Upload/inc/plugins/asb/functions.php
@@ -140,23 +140,21 @@ function asbGetCurrentScript($asb, $getAll=false)
{
global $mybb, $theme;
- $tid = $theme['tid'];
+ $tid = !empty($theme['tid']) ? (int) $theme['tid'] : 0;
$thisKey = THIS_SCRIPT;
- if (is_array($asb['scripts'][0][$thisKey]) &&
- !empty($asb['scripts'][0][$thisKey])) {
+ if (!empty($asb) && !empty($asb['scripts']) && !empty($asb['scripts'][0]) && !empty($asb['scripts'][0][$thisKey]) && is_array($asb['scripts'][0][$thisKey])) {
$returnArray = $asb['scripts'][0][$thisKey];
}
foreach (array('action', 'page') as $key) {
- $mybb->input[$key] = trim($mybb->input[$key]);
+ $mybb->input[$key] = trim($mybb->get_input($key));
if (!$mybb->input[$key]) {
continue;
}
- $filename = THIS_SCRIPT."&{$key}={$mybb->input[$key]}";
- if (!is_array($asb['scripts'][0][$filename]) ||
- empty($asb['scripts'][0][$filename])) {
+ $filename = THIS_SCRIPT."&{$key}={$mybb->get_input($key)}";
+ if (empty($asb['scripts'][0][$filename]) || !is_array($asb['scripts'][0][$filename])) {
continue;
}
@@ -164,9 +162,7 @@ function asbGetCurrentScript($asb, $getAll=false)
$returnArray = $asb['scripts'][0][$filename];
}
- if ($tid > 0 &&
- is_array($asb['scripts'][$tid][$thisKey]) &&
- !empty($asb['scripts'][$tid][$thisKey])) {
+ if ($tid > 0 && !empty($asb['scripts'][$tid][$thisKey]) && is_array($asb['scripts'][$tid][$thisKey])) {
$returnArray = $asb['scripts'][$tid][$thisKey];
}
@@ -180,7 +176,7 @@ function asbGetCurrentScript($asb, $getAll=false)
return;
}
- $returnArray = asbMergeScripts($asb, $returnArray, (array) $asb['scripts'][0]['global'], $getAll);
+ $returnArray = asbMergeScripts($asb, $returnArray, $asb['scripts'][0]['global'] ?? [], $getAll);
return $returnArray;
}
@@ -199,9 +195,9 @@ function asbMergeScripts($asb, $default, $custom, $full=false)
$returnArray = $default;
// merge any globally visible (script-wise) side boxes with this script
- $returnArray['template_vars'] = array_merge((array) $default['template_vars'], (array) $custom['template_vars']);
- $returnArray['extra_scripts'] = (array) $default['extra_scripts'] + (array) $custom['extra_scripts'];
- $returnArray['js'] = (array) $default['js'] + (array) $custom['js'];
+ $returnArray['template_vars'] = array_merge(($default['template_vars'] ?? []) , ($custom['template_vars'] ?? []));
+ $returnArray['extra_scripts'] = ($default['extra_scripts'] ?? []) + ($custom['extra_scripts'] ?? []); ;
+ $returnArray['js'] = ($default['js'] ?? []) + ($custom['js'] ?? []);
// the template handler does not need side boxes and templates
if ($full !== true) {
@@ -209,9 +205,9 @@ function asbMergeScripts($asb, $default, $custom, $full=false)
}
// asb_start() and asb_initialize() do
- $returnArray['sideboxes'][0] = asbMergeSideBoxList($asb, (array) $default['sideboxes'][0], (array) $custom['sideboxes'][0]);
- $returnArray['sideboxes'][1] = asbMergeSideBoxList($asb, (array) $default['sideboxes'][1], (array) $custom['sideboxes'][1]);
- $returnArray['templates'] = array_merge((array) $default['templates'], (array) $custom['templates']);
+ $returnArray['sideboxes'][0] = asbMergeSideBoxList($asb, $default['sideboxes'][0] ?? [], $custom['sideboxes'][0] ?? []);
+ $returnArray['sideboxes'][1] = asbMergeSideBoxList($asb, $default['sideboxes'][1] ?? [], $custom['sideboxes'][1] ?? []);
+ $returnArray['templates'] = array_merge($default['templates'] ?? [], $custom['templates'] ?? []);
return $returnArray;
}
@@ -523,6 +519,4 @@ function asbGetAllThemes($full=false)
}
return $themeList;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php
index a457911..8f408a9 100644
--- a/Upload/inc/plugins/asb/functions_acp.php
+++ b/Upload/inc/plugins/asb/functions_acp.php
@@ -605,6 +605,4 @@ function asbFindDuplicateScriptByFilename($keys, $tid=0)
}
return (int) $db->fetch_field($query, 'id');
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/functions_addon.php b/Upload/inc/plugins/asb/functions_addon.php
index d79d5ce..13f68e8 100644
--- a/Upload/inc/plugins/asb/functions_addon.php
+++ b/Upload/inc/plugins/asb/functions_addon.php
@@ -101,6 +101,8 @@ function asbBuildIdList($ids, $field='id', $wrap=true)
*/
function asbBuildSqlWhere($conditions, $op='AND', $prefix='', $wrap=true)
{
+ $where = '';
+
if (is_array($conditions)) {
$sep = '';
foreach ($conditions as $condition) {
@@ -180,6 +182,4 @@ function asbGetImagesFromPath($folder, $subfolder='', $recursive=false)
}
return $filenames;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php
index d8c8636..8fc5ad1 100644
--- a/Upload/inc/plugins/asb/install.php
+++ b/Upload/inc/plugins/asb/install.php
@@ -448,6 +448,4 @@ function asbBuildThemeExcludeSelect()
EOF;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php
index 7735ad3..a407539 100644
--- a/Upload/inc/plugins/asb/install_data.php
+++ b/Upload/inc/plugins/asb/install_data.php
@@ -1281,6 +1281,4 @@
EOF
),
),
-);
-
-?>
+);
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/birthdays.php b/Upload/inc/plugins/asb/modules/birthdays.php
index e89a34c..08c64d7 100644
--- a/Upload/inc/plugins/asb/modules/birthdays.php
+++ b/Upload/inc/plugins/asb/modules/birthdays.php
@@ -176,6 +176,4 @@ function asb_birthdays_get_content($settings, $script, $dateline)
eval("\$returnValue = \"{$templates->get('asb_birthdays')}\";");
return $returnValue;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/forum_age.php b/Upload/inc/plugins/asb/modules/forum_age.php
index 4d35311..7fef581 100644
--- a/Upload/inc/plugins/asb/modules/forum_age.php
+++ b/Upload/inc/plugins/asb/modules/forum_age.php
@@ -205,6 +205,4 @@ function asb_forum_age_settings_load()
new Peeker($(".setting_show_creation_date"), $("#row_setting_creation_date_format"), /1/, true);
EOF;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/goals.php b/Upload/inc/plugins/asb/modules/goals.php
index 280240c..12393dc 100644
--- a/Upload/inc/plugins/asb/modules/goals.php
+++ b/Upload/inc/plugins/asb/modules/goals.php
@@ -161,6 +161,4 @@ function asb_goals_get_content($settings, $script, $dateline)
eval("\$returnValue = \"{$templates->get('asb_goals')}\";");
return $returnValue;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php
index 31e1de3..23c6d04 100644
--- a/Upload/inc/plugins/asb/modules/latest_threads.php
+++ b/Upload/inc/plugins/asb/modules/latest_threads.php
@@ -21,7 +21,7 @@ function asb_latest_threads_info()
{
global $lang;
- if (!$lang->asb_addon) {
+ if (empty($lang->asb_addon)) {
$lang->load('asb_addon');
}
@@ -104,6 +104,20 @@ function asb_latest_threads_info()
'optionscode' => 'yesno',
'value' => '0',
),
+ 'xthreads' => array(
+ 'name' => 'xthreads',
+ 'title' => $lang->asb_load_xthreads_data_title,
+ 'description' => $lang->asb_load_xthreads_data_desc,
+ 'optionscode' => 'yesno',
+ 'value' => '0',
+ ),
+ 'showinportal' => array(
+ 'name' => 'showinportal',
+ 'title' => $lang->asb_showinportal_threads_only_title,
+ 'description' => $lang->asb_showinportal_threads_only_desc,
+ 'optionscode' => 'yesno',
+ 'value' => '0',
+ ),
),
'installData' => array(
'templates' => array(
@@ -172,7 +186,7 @@ function asb_latest_threads_info()
* @param array information from child box
* @return bool success/fail
*/
-function asb_latest_threads_get_content($settings, $script, $dateline)
+function asb_latest_threads_get_content($settings, $script, $dateline, $template_var)
{
global $db, $mybb, $templates, $lang, $cache, $gotounread, $theme;
@@ -212,6 +226,8 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;
+ $unviewwhere = $inactivewhere = '';
+
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if ($unviewable) {
@@ -231,6 +247,8 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
$new_threads .= " AND t.dateline > {$thread_time_limit}";
}
+ $important_threads ='';
+
if ($settings['important_threads_only']) {
$important_threads = ' AND NOT t.sticky=0';
}
@@ -259,11 +277,44 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
$altbg = alt_trow();
$threadlist = '';
+ $xthreads = function_exists('xthreads_gettfcache') && $settings['xthreads'];
+
+ $xt_fields = $xt_join_code = '';
+
+ !(function_exists('ougc_showinportal_info') && $settings['showinportal']) || $query_where .= "AND t.showinportal='1'";
+
+ if($xthreads)
+ {
+ $xt_join_code = "LEFT JOIN {$db->table_prefix}threadfields_data tfd ON (tfd.tid=t.tid)";
+
+ $threadfield_cache = xthreads_gettfcache();
+
+ if(!empty($threadfield_cache))
+ {
+ $fids = array_flip(array_map('intval', explode(',', $settings['forum_show_list'])));
+ $all_fids = ($settings['forum_show_list'] == '');
+ $xt_fields = '';
+ foreach($threadfield_cache as $k => &$v) {
+ $available = (!$v['forums']) || $all_fids;
+ if(!$available)
+ foreach(explode(',', $v['forums']) as $fid) {
+ if(isset($fids[$fid])) {
+ $available = true;
+ break;
+ }
+ }
+ if($available)
+ $xt_fields .= ', tfd.`'.$v['field'].'` AS `xthreads_'.$v['field'].'`';
+ }
+ }
+ }
+
// query for the latest forum discussions
$query = $db->query("
- SELECT t.*, u.username, u.avatar, u.usergroup, u.displaygroup
+ SELECT t.*, u.username, u.avatar, u.usergroup, u.displaygroup{$xt_fields}
FROM {$db->table_prefix}threads t
LEFT JOIN {$db->table_prefix}users u ON (u.uid=t.lastposteruid)
+ {$xt_join_code}
WHERE t.visible='1' AND t.closed NOT LIKE 'moved|%'{$query_where}
ORDER BY t.lastpost DESC
LIMIT 0, ".(int) $settings['max_threads']
@@ -291,6 +342,9 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
}
}
+ $xt_tids = '';
+ !$xthreads || $xt_tids = '0,'.implode(',', array_keys($threadCache));
+
foreach ($threadCache as $thread) {
$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);
@@ -317,11 +371,11 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
$avatarInfo = format_avatar($thread['avatar']);
- eval("\$avatar = \"{$templates->get('asb_latest_threads_last_poster_avatar_avatar')}\";");
+ $lastposter_profile_link = get_profile_link($thread['lastposteruid']);
- $formatted_name = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
+ $avatar = eval($templates->render('asb_latest_threads_last_poster_avatar_avatar'));
- $lastposter_profile_link = get_profile_link($thread['lastposteruid']);
+ $formatted_name = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
$formatted_name_profile_link = build_profile_link($formatted_name, $thread['lastposteruid']);
@@ -366,7 +420,7 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
$forum_read = $read_cutoff;
}
} else {
- $forum_read = $forumsread[$thread['fid']];
+ $forum_read = $forumsread[$thread['fid']] ?? 0;
}
if ($mybb->settings['threadreadcut'] > 0 &&
@@ -392,6 +446,24 @@ function asb_latest_threads_get_content($settings, $script, $dateline)
$unreadpost = 1;
}
+ $threadfields = array();
+
+ if($xthreads && !empty($threadfield_cache)) {
+ xthreads_set_threadforum_urlvars('thread', $thread['tid']);
+ xthreads_set_threadforum_urlvars('forum', $thread['fid']);
+
+ foreach($threadfield_cache as $k => &$v) {
+ if($v['forums'] && strpos(','.$v['forums'].',', ','.$thread['fid'].',') === false)
+ continue;
+
+ xthreads_get_xta_cache($v, $xt_tids);
+
+ $threadfields[$k] =& $thread['xthreads_'.$k];
+ xthreads_sanitize_disp($threadfields[$k], $v, ($thread['username'] !== '' ? $thread['username'] : $thread['threadusername']));
+ }
+ }
+
+ //{\$thread[\'threadlink\']}" title="{\$fullSubject}">{\$thread[\'subject\']
eval("\$threadlist .= \"{$templates->get('asb_latest_threads_thread')}\";");
$altbg = alt_trow();
}
@@ -416,6 +488,4 @@ function asb_latest_threads_settings_load()
new Peeker($(".setting_last_poster_avatar"), $("#row_setting_avatar_width"), /1/, true);
EOF;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/private_messages.php b/Upload/inc/plugins/asb/modules/private_messages.php
index 03283ea..8f77fa9 100644
--- a/Upload/inc/plugins/asb/modules/private_messages.php
+++ b/Upload/inc/plugins/asb/modules/private_messages.php
@@ -103,6 +103,4 @@ function asb_private_messages_get_content($settings, $script, $dateline)
eval("\$pmessages = \"{$templates->get('asb_pms')}\";");
return $pmessages;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/random_quote.php b/Upload/inc/plugins/asb/modules/random_quote.php
index 0e650e3..08cc68c 100644
--- a/Upload/inc/plugins/asb/modules/random_quote.php
+++ b/Upload/inc/plugins/asb/modules/random_quote.php
@@ -259,6 +259,4 @@ function asb_random_quote_get_content($settings, $script, $dateline)
// eval() the template
eval("\$this_quote = \"{$templates->get('asb_random_quote_sidebox')}\";");
return $this_quote;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/recent_posts.php b/Upload/inc/plugins/asb/modules/recent_posts.php
index 9ba7e6c..5f0b6b0 100644
--- a/Upload/inc/plugins/asb/modules/recent_posts.php
+++ b/Upload/inc/plugins/asb/modules/recent_posts.php
@@ -137,16 +137,24 @@ function asb_recent_posts_get_content($settings, $script, $dateline)
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
+
+ $unviewwhere = '';
+
if ($unviewable) {
$unviewwhere = " AND p.fid NOT IN ({$unviewable})";
}
// get inactive forums
$inactive = get_inactive_forums();
+
+ $inactivewhere = '';
+
if ($inactive) {
$inactivewhere = " AND p.fid NOT IN ({$inactive})";
}
+ $important_threads = '';
+
if ($settings['important_threads_only']) {
$important_threads = ' AND NOT t.sticky=0';
}
@@ -253,6 +261,4 @@ function asb_recent_posts_get_content($settings, $script, $dateline)
}
return $postlist;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/search.php b/Upload/inc/plugins/asb/modules/search.php
index 4743c34..332b182 100644
--- a/Upload/inc/plugins/asb/modules/search.php
+++ b/Upload/inc/plugins/asb/modules/search.php
@@ -86,6 +86,4 @@ function asb_search_get_content($settings, $script, $dateline)
eval("\$content = \"{$templates->get('asb_search')}\";");
return $content;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/modules/slideshow.php b/Upload/inc/plugins/asb/modules/slideshow.php
index 675cc59..54dc1ef 100644
--- a/Upload/inc/plugins/asb/modules/slideshow.php
+++ b/Upload/inc/plugins/asb/modules/slideshow.php
@@ -177,6 +177,4 @@ function asb_slideshow_get_content($settings, $script, $dateline, $template_var)
eval("\$content = \"{$templates->get('asb_slideshow')}\";");
return $content;
-}
-
-?>
+}
\ No newline at end of file
diff --git a/Upload/inc/plugins/asb/upgrade.php b/Upload/inc/plugins/asb/upgrade.php
index a2b928d..5f12117 100644
--- a/Upload/inc/plugins/asb/upgrade.php
+++ b/Upload/inc/plugins/asb/upgrade.php
@@ -42,6 +42,4 @@
@my_rmdir_recursive(MYBB_ADMIN_DIR.$folder);
@rmdir(MYBB_ADMIN_DIR.$folder);
}
-}
-
-?>
+}
\ No newline at end of file