From fef33d5129a15cf7039ec9ade8a8e058816984be Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 17:13:12 -0500 Subject: [PATCH 01/19] Fixes #335 --- Upload/inc/languages/english/admin/asb_addon.lang.php | 1 - Upload/inc/languages/english/asb_addon.lang.php | 1 - 2 files changed, 2 deletions(-) diff --git a/Upload/inc/languages/english/admin/asb_addon.lang.php b/Upload/inc/languages/english/admin/asb_addon.lang.php index b6c1fbb..fa4d041 100644 --- a/Upload/inc/languages/english/admin/asb_addon.lang.php +++ b/Upload/inc/languages/english/admin/asb_addon.lang.php @@ -116,7 +116,6 @@ $l['asb_latest_threads_replies'] = 'Replies:'; $l['asb_latest_threads_views'] = 'Views:'; $l['asb_latest_threads_no_threads'] = 'There are no threads to display.'; -$l['asb_latest_threads'] = 'Latest Threads'; $l['asb_gotounread'] = 'Go to first unread post'; // * settings diff --git a/Upload/inc/languages/english/asb_addon.lang.php b/Upload/inc/languages/english/asb_addon.lang.php index b6c1fbb..fa4d041 100644 --- a/Upload/inc/languages/english/asb_addon.lang.php +++ b/Upload/inc/languages/english/asb_addon.lang.php @@ -116,7 +116,6 @@ $l['asb_latest_threads_replies'] = 'Replies:'; $l['asb_latest_threads_views'] = 'Views:'; $l['asb_latest_threads_no_threads'] = 'There are no threads to display.'; -$l['asb_latest_threads'] = 'Latest Threads'; $l['asb_gotounread'] = 'Go to first unread post'; // * settings From 5b28fac01695e33cd7740c65a31a492596b55ddf Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 17:44:48 -0500 Subject: [PATCH 02/19] Fixes #336 --- Upload/inc/plugins/asb/acp.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index 32ec453..7c0297c 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -750,12 +750,23 @@ function asb_admin_custom_boxes() } else { // saving? if ($mybb->input['save_box_submit'] == 'Save') { + $id = (int) $mybb->input['id']; + if (!$mybb->input['box_name'] || !$mybb->input['box_content']) { + $redirectArray = array( + "action" => 'custom_boxes', + 'mode' => 'edit', + ); + + if ($id) { + $redirectArray['id'] = $id; + } + flash_message($lang->asb_custom_box_save_failure_no_content, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url($redirectArray)); } - $this_custom = new CustomSidebox((int) $mybb->input['id']); + $this_custom = new CustomSidebox($id); // get the info $this_custom->set('title', $mybb->input['box_name']); From 0fccc5985242fcc85dbb2ad24370dad1981b68de Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 18:46:37 -0500 Subject: [PATCH 03/19] Fixes #337 --- Upload/admin/jscripts/asb/asb_scripts.js | 25 +++++++++++++++++-- Upload/admin/jscripts/asb/asb_scripts.min.js | 2 +- Upload/admin/styles/default/asb/global.css | 6 +++++ .../inc/languages/english/admin/asb.lang.php | 3 +++ Upload/inc/plugins/asb/acp.php | 10 ++++---- Upload/inc/plugins/asb/functions_acp.php | 12 ++++++--- Upload/inc/plugins/asb/install_data.php | 6 +++++ 7 files changed, 53 insertions(+), 11 deletions(-) diff --git a/Upload/admin/jscripts/asb/asb_scripts.js b/Upload/admin/jscripts/asb/asb_scripts.js index 3e2ad4c..2a62788 100644 --- a/Upload/admin/jscripts/asb/asb_scripts.js +++ b/Upload/admin/jscripts/asb/asb_scripts.js @@ -13,6 +13,9 @@ var ASB = (function(a, $) { hooks: "hooks", actions: "actions", templates: "templates", + error_file_name_empty: "no file name", + error_file_does_not_exist: "file does not exist", + error_file_empty: "file empty or corrupted", }; /** @@ -120,12 +123,30 @@ var ASB = (function(a, $) { * @return void */ function showResults(info) { + var $fileInfo = $("#file_info"), + errorMessage; + // hide all the spinners $("div.ajax_spinners").hide(); - // any response at all means something to show - if (!info) { + // check for errors + if (typeof info.error !== "undefined") { + switch (info.error) { + case 1: + errorMessage = lang.error_file_name_empty; + break; + case 3: + errorMessage = lang.error_file_empty; + break; + default: + errorMessage = lang.error_file_does_not_exist; + break; + } + + $fileInfo.html(errorMessage); return; + } else { + $fileInfo.html("") } /* diff --git a/Upload/admin/jscripts/asb/asb_scripts.min.js b/Upload/admin/jscripts/asb/asb_scripts.min.js index 6ca1430..aaebe54 100644 --- a/Upload/admin/jscripts/asb/asb_scripts.min.js +++ b/Upload/admin/jscripts/asb/asb_scripts.min.js @@ -1 +1 @@ -var ASB=(function(i,f){var g="",b={nothing_found:"nothing found",hooks:"hooks",actions:"actions",templates:"templates"};function j(){new Peeker(f(".replace_all"),f("#replace_content"),/1/,true);new Peeker(f(".replace_all"),f("#header_search"),/0/,true);new Peeker(f(".replace_all"),f("#footer_search"),/0/,true);new Peeker(f(".eval"),f("#template_row"),/0/,true);new Peeker(f(".eval"),f("#header_search"),/0/,true);new Peeker(f(".eval"),f("#footer_search"),/0/,true);new Peeker(f(".eval"),f("#replace_all"),/0/,true);new Peeker(f(".eval"),f("#replace_content"),/0/,true);if(f("#replace_all_yes").prop("checked")){f("#header_search").hide();f("#footer_search").hide()}else{f("#replace_content").hide()}if(f("#eval_yes").prop("checked")){f("#header_search").hide();f("#footer_search").hide();f("#template_row").hide();f("#replace_all").hide();f("#replace_content").hide()}h();f("#filename").blur(e)}function e(a){if(this.value==g||this.value==""){return}g=this.value;f("#hook_list").hide();f("#template_list").hide();f("#action_list").hide();f("div.ajax_spinners").show();f.ajax({type:"post",url:"index.php",data:{module:"config-asb",action:"xmlhttp",mode:"analyze_script",filename:this.value,selected:{hook:f("#hook").val(),template:f("#template_name").val(),action:f("#action").val()}},success:d,error:function(k,m,l){alert("error\n\n"+m+"\n\n"+l)}})}function d(a){f("div.ajax_spinners").hide();if(!a){return}f.each(["hook","template","action"],function(n,l){var o=l+"s",m=''+b.nothing_found.replace("{1}",b[o])+"";if(a[o]){m=a[o]}f("#"+l+"_list").html(m).show()});h()}function h(){if(f("#hook_selector")){f("#hook_selector").change(function(a){var k=this.value;if(k==0){k=""}f("#hook").val(k)})}if(f("#template_selector")){f("#template_selector").change(function(a){var k=this.value;if(k==0){k=""}f("#template_name").val(k)})}if(f("#action_selector")){f("#action_selector").change(function(a){var k=this.value;if(k==0){k=""}f("#action").val(k)})}}function c(a,k){g=a||"";f.extend(b,k||{})}f(j);i.scripts={setup:c};return i})(ASB||{},jQuery); \ No newline at end of file +var ASB=(function(i,f){var g="",b={nothing_found:"nothing found",hooks:"hooks",actions:"actions",templates:"templates",error_file_name_empty:"no file name",error_file_does_not_exist:"file does not exist",error_file_empty:"file empty or corrupted"};function j(){new Peeker(f(".replace_all"),f("#replace_content"),/1/,true);new Peeker(f(".replace_all"),f("#header_search"),/0/,true);new Peeker(f(".replace_all"),f("#footer_search"),/0/,true);new Peeker(f(".eval"),f("#template_row"),/0/,true);new Peeker(f(".eval"),f("#header_search"),/0/,true);new Peeker(f(".eval"),f("#footer_search"),/0/,true);new Peeker(f(".eval"),f("#replace_all"),/0/,true);new Peeker(f(".eval"),f("#replace_content"),/0/,true);if(f("#replace_all_yes").prop("checked")){f("#header_search").hide();f("#footer_search").hide()}else{f("#replace_content").hide()}if(f("#eval_yes").prop("checked")){f("#header_search").hide();f("#footer_search").hide();f("#template_row").hide();f("#replace_all").hide();f("#replace_content").hide()}h();f("#filename").blur(e)}function e(a){if(this.value==g||this.value==""){return}g=this.value;f("#hook_list").hide();f("#template_list").hide();f("#action_list").hide();f("div.ajax_spinners").show();f.ajax({type:"post",url:"index.php",data:{module:"config-asb",action:"xmlhttp",mode:"analyze_script",filename:this.value,selected:{hook:f("#hook").val(),template:f("#template_name").val(),action:f("#action").val()}},success:d,error:function(k,m,l){alert("error\n\n"+m+"\n\n"+l)}})}function d(l){var a=f("#file_info"),k;f("div.ajax_spinners").hide();if(typeof l.error!=="undefined"){switch(l.error){case 1:k=b.error_file_name_empty;break;case 3:k=b.error_file_empty;break;default:k=b.error_file_does_not_exist;break}a.html(k);return}else{a.html("")}f.each(["hook","template","action"],function(o,m){var p=m+"s",n=''+b.nothing_found.replace("{1}",b[p])+"";if(l[p]){n=l[p]}f("#"+m+"_list").html(n).show()});h()}function h(){if(f("#hook_selector")){f("#hook_selector").change(function(a){var k=this.value;if(k==0){k=""}f("#hook").val(k)})}if(f("#template_selector")){f("#template_selector").change(function(a){var k=this.value;if(k==0){k=""}f("#template_name").val(k)})}if(f("#action_selector")){f("#action_selector").change(function(a){var k=this.value;if(k==0){k=""}f("#action").val(k)})}}function c(a,k){g=a||"";f.extend(b,k||{})}f(j);i.scripts={setup:c};return i})(ASB||{},jQuery); \ No newline at end of file diff --git a/Upload/admin/styles/default/asb/global.css b/Upload/admin/styles/default/asb/global.css index 6f64df1..d040cf2 100644 --- a/Upload/admin/styles/default/asb/global.css +++ b/Upload/admin/styles/default/asb/global.css @@ -212,4 +212,10 @@ td.off { .asb_label a:active { color: #333; text-decoration: none; +} + +#file_info { + color: red; + font-weight: bold; + margin-bottom: 5px; } \ No newline at end of file diff --git a/Upload/inc/languages/english/admin/asb.lang.php b/Upload/inc/languages/english/admin/asb.lang.php index 8612ced..2a3884d 100644 --- a/Upload/inc/languages/english/admin/asb.lang.php +++ b/Upload/inc/languages/english/admin/asb.lang.php @@ -365,5 +365,8 @@ $l['asb_ajax_actions'] = 'actions'; $l['asb_ajax_hooks'] = 'hooks'; $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'; ?> diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index 7c0297c..71a1004 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -1217,6 +1217,9 @@ function asb_admin_manage_scripts() hooks: '{$lang->asb_ajax_hooks}', actions: '{$lang->asb_ajax_actions}', templates: '{$lang->asb_ajax_templates}', + error_file_name_empty: '{$lang->asb_ajax_file_name_empty}', + error_file_does_not_exist: '{$lang->asb_ajax_file_does_not_exist}', + error_file_empty: '{$lang->asb_ajax_file_empty}', }); // --> @@ -1240,7 +1243,8 @@ function asb_admin_manage_scripts() $form_container->output_row("{$lang->asb_title}:", $lang->asb_title_desc, $form->generate_text_box('title', $data['title'])); - $form_container->output_row("{$lang->asb_filename}:", $lang->asb_filename_desc, $form->generate_text_box('filename', $data['filename'], array("id" => 'filename'))); + $form_container->output_row("{$lang->asb_filename}:", $lang->asb_filename_desc, '
'.$form->generate_text_box('filename', $data['filename'], array("id" => 'filename'))); + $form_container->output_row("{$lang->asb_action}:", $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_action)), "{$spinner}
{$detected_info['actions']}
" . $form->generate_text_box('script_action', $data['action'], array("id" => 'action'))); $form_container->output_row($lang->asb_page, $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_page)), $form->generate_text_box('page', $data['page'])); @@ -1606,10 +1610,6 @@ function asb_admin_xmlhttp() trim($mybb->input['filename'])) { $content = asb_detect_script_info($mybb->input['filename'], $mybb->input['selected']); - if (!$content) { - $content = array("actions", "hooks", "templates"); - } - header('Content-type: application/json'); echo(json_encode($content)); } diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php index 1f947d8..d3c97a7 100644 --- a/Upload/inc/plugins/asb/functions_acp.php +++ b/Upload/inc/plugins/asb/functions_acp.php @@ -436,17 +436,23 @@ function asb_detect_script_info($filename, $selected = array()) // check all the info if (strlen(trim($filename)) == 0) { - return false; + return array( + 'error' => 1, + ); } $full_path = '../' . trim($filename); if (!file_exists($full_path)) { - return false; + return array( + 'error' => 2, + ); } $contents = @file_get_contents($full_path); if (!$contents) { - return false; + return array( + 'error' => 3, + ); } // build the object info diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php index 53f467a..3b66fbc 100644 --- a/Upload/inc/plugins/asb/install_data.php +++ b/Upload/inc/plugins/asb/install_data.php @@ -468,6 +468,12 @@ color: #333; text-decoration: none; } + +#file_info { + color: red; + font-weight: bold; + margin-bottom: 5px; +} EOF ), ), From 850c4b8f12948a452154cda87f65c041eef3b221 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 18:53:28 -0500 Subject: [PATCH 04/19] Fixes #339 --- Upload/inc/plugins/asb/install.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php index ed12388..1dd9b45 100644 --- a/Upload/inc/plugins/asb/install.php +++ b/Upload/inc/plugins/asb/install.php @@ -68,8 +68,6 @@ function asb_info() EOF; - $button_pic = "styles/{$cp_style}/images/asb/donate.png"; - $border_pic = "styles/{$cp_style}/images/asb/pixel.png"; $asb_description = << @@ -79,12 +77,7 @@ function asb_info() {$lang->asb_logo}

-
- - - - -
+ From f970e2ae2abe4565fe5127bb0b11ec9c1b1de878 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 19:16:07 -0500 Subject: [PATCH 05/19] Fixes #338 --- .../asb/classes/AdvancedSideboxCache.php | 134 ++++++++++++++++++ Upload/inc/plugins/asb/forum.php | 4 +- Upload/inc/plugins/asb/functions.php | 133 ----------------- 3 files changed, 136 insertions(+), 135 deletions(-) diff --git a/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php b/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php index 89706c2..e201406 100644 --- a/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php +++ b/Upload/inc/plugins/asb/classes/AdvancedSideboxCache.php @@ -20,6 +20,8 @@ class AdvancedSideboxCache extends WildcardPluginCache010300 protected $subKey = ''; /** + * return an instance of the cache wrapper + * * @return instance of the child class */ static public function getInstance() @@ -30,6 +32,138 @@ static public function getInstance() } return $instance; } + + /** + * retrieve the side box data, rebuilding it if necessary + * + * @return array + */ + public function getCache() + { + $data = $this->read(); + + // if the cache has never been built or has been marked as changed + // then rebuild and store it + if ((int) $data['last_run'] == 0 || + $data['has_changed']) { + $this->buildCache($data); + $this->update(null, $data); + } + + // returned the cached info + return $data; + } + + /** + * build all of the relevant info needed to manage side boxes + * + * @param array cache data variable + * @return void + */ + public function buildCache(&$data) + { + global $db; + + // fresh start + $data['custom'] = $data['sideboxes'] = $data['scripts'] = $data['all_scripts'] = array(); + + // update the run time and changed flag before we even start + $data['last_run'] = TIME_NOW; + $data['has_changed'] = false; + + // get all the active scripts' info + $all_scripts = asb_get_all_scripts(); + + // no scripts, no work to do + if (!is_array($all_scripts) || + empty($all_scripts)) { + return; + } + + // store the script definitions and a master list + foreach ($all_scripts as $filename => $script) { + $data['scripts'][$filename] = $script; + } + $data['all_scripts'] = array_keys($all_scripts); + + // load all detected modules + $addons = asb_get_all_modules(); + + // get any custom boxes + $custom = asb_get_all_custom(); + + // get any sideboxes + $sideboxes = asb_get_all_sideboxes(); + + if (!is_array($sideboxes) || + empty($sideboxes)) { + return; + } + + foreach ($sideboxes as $sidebox) { + // build basic data + $scripts = $sidebox->get('scripts'); + $id = (int) $sidebox->get('id'); + $pos = $sidebox->get('position') ? 1 : 0; + $data['sideboxes'][$id] = $sidebox->get('data'); + $module = $sidebox->get('box_type'); + + // no scripts == all scripts + if (empty($scripts)) { + // add this side box to the 'global' set (to be merged with the current script when applicable) + $scripts = array('global'); + } + + // for each script in which the side box is used, add a pointer and if it is a custom box, cache its contents + foreach ($scripts as $filename) { + // side box from a module? + if (isset($addons[$module]) && + $addons[$module] instanceof SideboxExternalModule) { + // store the module name and all the template vars used + $data['scripts'][$filename]['sideboxes'][$pos][$id] = $module; + $data['scripts'][$filename]['template_vars'][$id] = "{$module}_{$id}"; + + // if there are any templates get their names so we can cache them + $templates = $addons[$module]->get('templates'); + if (is_array($templates) && + !empty($templates)) { + foreach ($templates as $template) { + $data['scripts'][$filename]['templates'][] = $template['title']; + } + } + + // AJAX? + if ($addons[$module]->xmlhttp && + $sidebox->hasSettings) { + $settings = $sidebox->get('settings'); + + // again, default here is off if anything goes wrong + if ($settings['xmlhttp_on']) { + // if all is good add the script building info + $data['scripts'][$filename]['extra_scripts'][$id]['position'] = $pos; + $data['scripts'][$filename]['extra_scripts'][$id]['module'] = $module; + $data['scripts'][$filename]['extra_scripts'][$id]['rate'] = $settings['xmlhttp_on']; + } + } + + if ($addons[$module]->hasScripts) { + foreach ($addons[$module]->get('scripts') as $script) { + $data['scripts'][$filename]['js'][$script] = $script; + } + } + // side box from a custom box? + } else if(isset($custom[$module]) && + $custom[$module] instanceof CustomSidebox) { + // store the pointer + $data['scripts'][$filename]['sideboxes'][$pos][$id] = $module; + $data['scripts'][$filename]['template_vars'][$id] = "{$module}_{$id}"; + + // and cache the contents + $data['custom'][$module] = $custom[$module]->get('data'); + } + } + } + } } ?> diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php index c1925f1..f6d5c5d 100644 --- a/Upload/inc/plugins/asb/forum.php +++ b/Upload/inc/plugins/asb/forum.php @@ -25,7 +25,7 @@ function asb_start() return; } - $asb = asb_get_cache(); + $asb = AdvancedSideboxCache::getInstance()->getCache(); $this_script = asb_get_this_script($asb, true); // no boxes, get out @@ -355,7 +355,7 @@ function asb_initialize() } // get the cache - $asb = asb_get_cache(); + $asb = AdvancedSideboxCache::getInstance()->getCache(); $this_script = asb_get_this_script($asb, true); // anything to show for this script? diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php index fb5beb7..76bbb6c 100644 --- a/Upload/inc/plugins/asb/functions.php +++ b/Upload/inc/plugins/asb/functions.php @@ -73,139 +73,6 @@ function asb_get_excluded_themes($sql = false) return $retval; } -/** - * retrieve the cache, rebuilding it if necessary - * - * @return array cache data - */ -function asb_get_cache() -{ - $myCache = AdvancedSideboxCache::getInstance(); - $asb = $myCache->read(); - - // if the cache has never been built or has been marked as changed - // then rebuild and store it - if ((int) $asb['last_run'] == 0 || - $asb['has_changed']) { - asb_build_cache($asb); - $myCache->update(null, $asb); - } - - // returned the cached info - return $asb; -} - -/** - * build all of the relevant info needed to manage side boxes - * - * @param array cache data variable - * @return void - */ -function asb_build_cache(&$asb) -{ - global $db; - - // fresh start - $asb['custom'] = $asb['sideboxes'] = $asb['scripts'] = $asb['all_scripts'] = array(); - - // update the run time and changed flag before we even start - $asb['last_run'] = TIME_NOW; - $asb['has_changed'] = false; - - // get all the active scripts' info - $all_scripts = asb_get_all_scripts(); - - // no scripts, no work to do - if (!is_array($all_scripts) || - empty($all_scripts)) { - return; - } - - // store the script definitions and a master list - foreach ($all_scripts as $filename => $script) { - $asb['scripts'][$filename] = $script; - } - $asb['all_scripts'] = array_keys($all_scripts); - - // load all detected modules - $addons = asb_get_all_modules(); - - // get any custom boxes - $custom = asb_get_all_custom(); - - // get any sideboxes - $sideboxes = asb_get_all_sideboxes(); - - if (!is_array($sideboxes) || - empty($sideboxes)) { - return; - } - - foreach ($sideboxes as $sidebox) { - // build basic data - $scripts = $sidebox->get('scripts'); - $id = (int) $sidebox->get('id'); - $pos = $sidebox->get('position') ? 1 : 0; - $asb['sideboxes'][$id] = $sidebox->get('data'); - $module = $sidebox->get('box_type'); - - // no scripts == all scripts - if (empty($scripts)) { - // add this side box to the 'global' set (to be merged with the current script when applicable) - $scripts = array('global'); - } - - // for each script in which the side box is used, add a pointer and if it is a custom box, cache its contents - foreach ($scripts as $filename) { - // side box from a module? - if (isset($addons[$module]) && - $addons[$module] instanceof SideboxExternalModule) { - // store the module name and all the template vars used - $asb['scripts'][$filename]['sideboxes'][$pos][$id] = $module; - $asb['scripts'][$filename]['template_vars'][$id] = "{$module}_{$id}"; - - // if there are any templates get their names so we can cache them - $templates = $addons[$module]->get('templates'); - if (is_array($templates) && - !empty($templates)) { - foreach ($templates as $template) { - $asb['scripts'][$filename]['templates'][] = $template['title']; - } - } - - // AJAX? - if ($addons[$module]->xmlhttp && - $sidebox->hasSettings) { - $settings = $sidebox->get('settings'); - - // again, default here is off if anything goes wrong - if ($settings['xmlhttp_on']) { - // if all is good add the script building info - $asb['scripts'][$filename]['extra_scripts'][$id]['position'] = $pos; - $asb['scripts'][$filename]['extra_scripts'][$id]['module'] = $module; - $asb['scripts'][$filename]['extra_scripts'][$id]['rate'] = $settings['xmlhttp_on']; - } - } - - if ($addons[$module]->hasScripts) { - foreach ($addons[$module]->get('scripts') as $script) { - $asb['scripts'][$filename]['js'][$script] = $script; - } - } - // side box from a custom box? - } else if(isset($custom[$module]) && - $custom[$module] instanceof CustomSidebox) { - // store the pointer - $asb['scripts'][$filename]['sideboxes'][$pos][$id] = $module; - $asb['scripts'][$filename]['template_vars'][$id] = "{$module}_{$id}"; - - // and cache the contents - $asb['custom'][$module] = $custom[$module]->get('data'); - } - } - } -} - /** * add all the parts of the script to build a unique name * From 81f448dfe6c58c9707f09eb9b19943e0d97cce3b Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 19:18:03 -0500 Subject: [PATCH 06/19] Fixes #342 --- Upload/inc/plugins/asb/modules/latest_threads.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php index d2304ab..292d5a1 100644 --- a/Upload/inc/plugins/asb/modules/latest_threads.php +++ b/Upload/inc/plugins/asb/modules/latest_threads.php @@ -362,7 +362,7 @@ function asb_latest_threads_get_threadlist($settings, $width) } } - $fullSubject = $thread['subject']; + $fullSubject = htmlspecialchars_uni($thread['subject']); $max_len = (int) $settings['max_thread_title_length']; if ($max_len > 0 && my_strlen($thread['subject']) > $max_len) { From 6da3af19bee73fea9c4e709796dfedc428b0c725 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 20:30:35 -0500 Subject: [PATCH 07/19] Fixes #340 --- Upload/inc/plugins/asb/acp.php | 59 +++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index 71a1004..bb6f5cb 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -1685,23 +1685,14 @@ function asb_admin_update_theme_select() $lang->load('asb'); } - $query = $db->simple_select('settings', '*', "name='asb_exclude_theme'"); + $status = asb_update_theme_select_setting(); - // is the setting created? - if ($db->num_rows($query) == 0) { + if (!$status) { flash_message($lang->asb_theme_exclude_select_update_fail, 'error'); admin_redirect('index.php?module=config-settings'); } - // update the setting - $status = $db->update_query('settings', array("optionscode" => $db->escape_string(asb_build_theme_exclude_select())), "name='asb_exclude_theme'"); - - // success? - if (!$status) { - flash_message($lang->asb_theme_exclude_select_update_fail, 'error'); - } else { - flash_message($lang->asb_theme_exclude_select_update_success, 'success'); - } + flash_message($lang->asb_theme_exclude_select_update_success, 'success'); admin_redirect(asb_build_settings_url($gid)); } @@ -1778,4 +1769,48 @@ function asb_admin_config_permissions(&$admin_permissions) $admin_permissions['asb'] = $lang->asb_admin_permissions_desc; } +/** + * update the theme exclude selector after any themes are added or deleted + * + * @return void + */ +$plugins->add_hook('admin_style_themes_import_commit', 'asb_update_theme_select_setting'); +$plugins->add_hook('admin_style_themes_duplicate_commit', 'asb_update_theme_select_setting'); +$plugins->add_hook('admin_style_themes_add_commit', 'asb_update_theme_select_setting'); +$plugins->add_hook('admin_style_themes_delete_commit', 'asb_update_theme_select_setting'); +function asb_update_theme_select_setting() +{ + global $db, $lang; + + if (!$lang->asb) { + $lang->load('asb'); + } + + $query = $db->simple_select('settings', '*', "name='asb_exclude_theme'"); + + // is the setting created? + if ($db->num_rows($query) == 0) { + return false; + } + + // update the setting + return $db->update_query('settings', array("optionscode" => $db->escape_string(asb_build_theme_exclude_select())), "name='asb_exclude_theme'"); +} + +/** + * update the theme exclude selector after any themes are edited + * + * @return void + */ +$plugins->add_hook('admin_style_themes_edit_commit', 'asb_update_theme_select_setting_on_edit'); +function asb_update_theme_select_setting_on_edit() +{ + global $db, $update_array, $theme; + + // the edit commit hook is before the actualy update so we have to update the title ourselves. + $db->update_query('themes', array('name' => $update_array['name']), "tid='{$theme['tid']}'"); + + asb_update_theme_select_setting(); +} + ?> From b91eab4c9ba6c9034c26d4d6ac808fb31465eaf3 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 20:39:20 -0500 Subject: [PATCH 08/19] For #341 --- Upload/inc/plugins/asb.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php index b889025..0aefe13 100644 --- a/Upload/inc/plugins/asb.php +++ b/Upload/inc/plugins/asb.php @@ -32,11 +32,11 @@ require_once MYBB_ROOT . 'inc/plugins/asb/forum.php'; } - /** - * class autoloader - * - * @param string the name of the class to load - */ +/** + * class autoloader + * + * @param string the name of the class to load + */ function asbClassAutoload($className) { $path = MYBB_ROOT . "inc/plugins/asb/classes/{$className}.php"; From e66f02d3b6f9b6f678c2a906ab0b0105b75c0f60 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 21:32:51 -0500 Subject: [PATCH 09/19] For #341 " -> ' --- Upload/inc/plugins/asb/acp.php | 256 ++++++------ .../inc/plugins/asb/classes/CustomSidebox.php | 2 +- Upload/inc/plugins/asb/forum.php | 18 +- Upload/inc/plugins/asb/functions.php | 10 +- Upload/inc/plugins/asb/functions_acp.php | 52 +-- Upload/inc/plugins/asb/install.php | 176 ++++---- Upload/inc/plugins/asb/install_data.php | 380 +++++++++--------- .../plugins/asb/modules/latest_threads.php | 2 +- Upload/inc/plugins/asb/modules/rand_quote.php | 2 +- .../inc/plugins/asb/modules/recent_posts.php | 2 +- 10 files changed, 450 insertions(+), 450 deletions(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index bb6f5cb..944ed42 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -89,8 +89,8 @@ function asb_admin_manage_sideboxes() $id = $box_type = $module->get('baseName'); $title = $module->get('title'); - $title_url = $html->url(array("action" => 'edit_box', "addon" => $box_type)); - $title_link = $html->link($title_url, $title, array("class" => 'add_box_link', "title" => $lang->asb_add_new_sidebox)); + $title_url = $html->url(array('action' => 'edit_box', 'addon' => $box_type)); + $title_link = $html->link($title_url, $title, array('class' => 'add_box_link', 'title' => $lang->asb_add_new_sidebox)); // add the HTML $modules .= <<get('baseName'); $title = $module->get('title'); - $title_url = $html->url(array("action" => 'edit_box', "addon" => $box_type)); - $title_link = $html->link($title_url, $title, array("class" => 'add_box_link', "title" => $lang->asb_add_new_sidebox)); + $title_url = $html->url(array('action' => 'edit_box', 'addon' => $box_type)); + $title_link = $html->link($title_url, $title, array('class' => 'add_box_link', 'title' => $lang->asb_add_new_sidebox)); // add the HTML $custom_boxes .= << EOF; - $form = new Form($html->url(array("action" => 'edit_box', "id" => $id, "addon" => $module)), 'post', 'modal_form'); + $form = new Form($html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module)), 'post', 'modal_form'); } else { // standard form stuff $page->add_breadcrumb_item($lang->asb); @@ -441,15 +441,15 @@ function asb_admin_edit_box() EOF; $page->output_header("{$lang->asb} - {$page_title}"); - $form = new Form($html->url(array("action" => 'edit_box', "id" => $id, "addon" => $module)), 'post', 'modal_form'); + $form = new Form($html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module)), 'post', 'modal_form'); } $tabs = array( - "general" => $lang->asb_modal_tab_general, - "permissions" => $lang->asb_modal_tab_permissions, - "pages" => $lang->asb_modal_tab_pages, - "themes" => $lang->asb_modal_tab_themes, - "settings" => $lang->asb_modal_tab_settings + 'general' => $lang->asb_modal_tab_general, + 'permissions' => $lang->asb_modal_tab_permissions, + 'pages' => $lang->asb_modal_tab_pages, + 'themes' => $lang->asb_modal_tab_themes, + 'settings' => $lang->asb_modal_tab_settings ); // we only need a 'Settings' tab if the current module type has settings @@ -491,22 +491,22 @@ function asb_admin_edit_box() if (!$ajax) { // box title - $form_container->output_row($lang->asb_custom_title, $current_title, $form->generate_text_box('box_title') . $form->generate_hidden_field('current_title', $sidebox->get('title')), 'box_title', array("id" => 'box_title')); + $form_container->output_row($lang->asb_custom_title, $current_title, $form->generate_text_box('box_title') . $form->generate_hidden_field('current_title', $sidebox->get('title')), 'box_title', array('id' => 'box_title')); // title link - $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')), 'title_link', array("id" => 'title_link')); + $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')), 'title_link', array('id' => 'title_link')); // position - $form_container->output_row($lang->asb_position, '', $form->generate_radio_button('box_position', 0, $lang->asb_position_left, array("checked" => ($sidebox->get('position') == 0))) . '  ' . $form->generate_radio_button('box_position', 1, $lang->asb_position_right, array("checked" => ($sidebox->get('position') != 0)))); + $form_container->output_row($lang->asb_position, '', $form->generate_radio_button('box_position', 0, $lang->asb_position_left, array('checked' => ($sidebox->get('position') == 0))) . '  ' . $form->generate_radio_button('box_position', 1, $lang->asb_position_right, array('checked' => ($sidebox->get('position') != 0)))); // display order $form_container->output_row($lang->asb_display_order, '', $form->generate_text_box('display_order', $sidebox->get('display_order'))); } else { // box title - $form_container->output_row($lang->asb_title, $current_title, $form->generate_text_box('box_title'), 'box_title', array("id" => 'box_title')); + $form_container->output_row($lang->asb_title, $current_title, $form->generate_text_box('box_title'), 'box_title', array('id' => 'box_title')); // title link and hidden fields - $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')) . $form->generate_hidden_field('current_title', $sidebox->get('title')) . $form->generate_hidden_field('display_order', $sidebox->get('display_order')) . $form->generate_hidden_field('pos', $position), 'title_link', array("id" => 'title_link')); + $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')) . $form->generate_hidden_field('current_title', $sidebox->get('title')) . $form->generate_hidden_field('display_order', $sidebox->get('display_order')) . $form->generate_hidden_field('pos', $position), 'title_link', array('id' => 'title_link')); } $form_container->end(); @@ -569,7 +569,7 @@ function asb_admin_edit_box() } // which scripts - $form_container->output_row('', $script_warning, $form->generate_select_box('script_select_box[]', $choices, $selected_scripts, array("id" => 'script_select_box', "multiple" => true, 'size' => 5))); + $form_container->output_row('', $script_warning, $form->generate_select_box('script_select_box[]', $choices, $selected_scripts, array('id' => 'script_select_box', 'multiple' => true, 'size' => 5))); $form_container->end(); echo "\n\n
\n"; @@ -581,10 +581,10 @@ function asb_admin_edit_box() $themes = 'all_themes'; } - $choices = array("all_themes" => 'All Themes') + asb_get_all_themes(); + $choices = array('all_themes' => 'All Themes') + asb_get_all_themes(); // which scripts - $form_container->output_row('', '', $form->generate_select_box('theme_select_box[]', $choices, $themes, array("id" => 'theme_select_box', "multiple" => true, 'size' => 5))); + $form_container->output_row('', '', $form->generate_select_box('theme_select_box[]', $choices, $themes, array('id' => 'theme_select_box', 'multiple' => true, 'size' => 5))); $form_container->end(); if ($do_settings) { @@ -646,16 +646,16 @@ function asb_admin_custom_boxes() if ($mybb->input['mode'] == 'export') { if ((int) $mybb->input['id'] == 0) { flash_message($lang->asb_custom_export_error, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } $this_custom = new CustomSidebox($mybb->input['id']); if (!$this_custom->isValid()) { flash_message($lang->asb_custom_export_error, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } - $this_custom->export(array("version" => ASB_CUSTOM_VERSION)); + $this_custom->export(array('version' => ASB_CUSTOM_VERSION)); exit(); } @@ -663,7 +663,7 @@ function asb_admin_custom_boxes() // info good? if ((int) $mybb->input['id'] == 0) { flash_message($lang->asb_add_custom_box_delete_failure, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } // nuke it @@ -672,13 +672,13 @@ function asb_admin_custom_boxes() // success? if (!$this_custom->remove()) { flash_message($lang->asb_add_custom_box_delete_failure, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } // :) flash_message($lang->asb_add_custom_box_delete_success, 'success'); asb_cache_has_changed(); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } // POSTing? @@ -687,17 +687,17 @@ function asb_admin_custom_boxes() if (!$_FILES['file'] || $_FILES['file']['error'] == 4) { flash_message($lang->asb_custom_import_no_file, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } if ($_FILES['file']['error']) { flash_message($lang->sprintf($lang->asb_custom_import_file_error, $_FILES['file']['error']), 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } if (!is_uploaded_file($_FILES['file']['tmp_name'])) { flash_message($lang->asb_custom_import_file_upload_error, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } $contents = @file_get_contents($_FILES['file']['tmp_name']); @@ -705,7 +705,7 @@ function asb_admin_custom_boxes() if (!trim($contents)) { flash_message($lang->asb_custom_import_file_empty, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } require_once MYBB_ROOT . 'inc/class_xml.php'; @@ -715,7 +715,7 @@ function asb_admin_custom_boxes() if (!is_array($tree) || empty($tree)) { flash_message($lang->asb_custom_import_file_empty, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } if (!is_array($tree['asb_custom_sideboxes']) || @@ -723,30 +723,30 @@ function asb_admin_custom_boxes() if (!is_array($tree['adv_sidebox']) || !is_array($tree['adv_sidebox']['custom_sidebox'])) { flash_message($lang->asb_custom_import_file_empty, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } $results = asb_legacy_custom_import($tree); if (!is_array($results)) { flash_message($results, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } $custom = new CustomSidebox($results); } else { $custom = new CustomSidebox; if (!$custom->import($contents)) { flash_message($lang->asb_custom_import_fail_generic, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } } if (!$custom->save()) { flash_message($lang->asb_custom_box_save_failure, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes'))); + admin_redirect($html->url(array('action' => 'custom_boxes'))); } flash_message($lang->asb_custom_import_save_success, 'success'); - admin_redirect($html->url(array("action" => 'custom_boxes', "id" => $custom->get('id')))); + admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $custom->get('id')))); } else { // saving? if ($mybb->input['save_box_submit'] == 'Save') { @@ -755,7 +755,7 @@ function asb_admin_custom_boxes() if (!$mybb->input['box_name'] || !$mybb->input['box_content']) { $redirectArray = array( - "action" => 'custom_boxes', + 'action' => 'custom_boxes', 'mode' => 'edit', ); @@ -777,12 +777,12 @@ function asb_admin_custom_boxes() // success? if (!$this_custom->save()) { flash_message($lang->asb_custom_box_save_failure, 'error'); - admin_redirect($html->url(array("action" => 'custom_boxes', "id" => $this_custom->get('id')))); + admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $this_custom->get('id')))); } flash_message($lang->asb_custom_box_save_success, 'success'); asb_cache_has_changed(); - admin_redirect($html->url(array("action" => 'custom_boxes', "id" => $this_custom->get('id')))); + admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $this_custom->get('id')))); } } } @@ -842,12 +842,12 @@ function asb_admin_custom_boxes() EOF; - $page->add_breadcrumb_item($lang->asb_custom_boxes, $html->url(array("action" => 'custom_boxes'))); + $page->add_breadcrumb_item($lang->asb_custom_boxes, $html->url(array('action' => 'custom_boxes'))); $page->add_breadcrumb_item($lang->asb_add_custom); $page->output_header("{$lang->asb} - {$action}"); asb_output_tabs('asb_add_custom'); - $form = new Form($html->url(array("action" => 'custom_boxes')) . $specify_box, 'post', 'edit_box'); + $form = new Form($html->url(array('action' => 'custom_boxes')) . $specify_box, 'post', 'edit_box'); $form_container = new FormContainer($currently_editing); $form_container->output_cell($lang->asb_name); @@ -856,20 +856,20 @@ function asb_admin_custom_boxes() $form_container->output_row(''); // name - $form_container->output_cell($form->generate_text_box('box_name', $this_box->get('title'), array("id" => 'box_name'))); + $form_container->output_cell($form->generate_text_box('box_name', $this_box->get('title'), array('id' => 'box_name'))); // description $form_container->output_cell($form->generate_text_box('box_description', $this_box->get('description'))); // wrap content? - $form_container->output_cell($form->generate_check_box('wrap_content', 'yes', $lang->asb_custom_box_wrap_content_desc, array("checked" => $this_box->get('wrap_content')))); + $form_container->output_cell($form->generate_check_box('wrap_content', 'yes', $lang->asb_custom_box_wrap_content_desc, array('checked' => $this_box->get('wrap_content')))); $form_container->output_row(''); - $form_container->output_cell('Content:', array("colspan" => 3)); + $form_container->output_cell('Content:', array('colspan' => 3)); $form_container->output_row(''); // content - $form_container->output_cell($form->generate_text_area('box_content', $this_box->get('content'), array("id" => 'box_content', 'class' => '', 'style' => 'width: 100%; height: 500px;')), array("colspan" => 3)); + $form_container->output_cell($form->generate_text_area('box_content', $this_box->get('content'), array('id' => 'box_content', 'class' => '', 'style' => 'width: 100%; height: 500px;')), array('colspan' => 3)); $form_container->output_row(''); // finish form @@ -909,14 +909,14 @@ function asb_admin_custom_boxes() $page->output_header("{$lang->asb} - {$lang->asb_custom_boxes}"); asb_output_tabs('asb_custom'); - $new_box_url = $html->url(array("action" => 'custom_boxes', "mode" => 'edit')); - $new_box_link = $html->link($new_box_url, $lang->asb_add_custom_box_types, array("style" => 'font-weight: bold;', "title" => $lang->asb_add_custom_box_types, "icon" => "styles/{$cp_style}/images/asb/add.png"), array("alt" => '+', "style" => 'margin-bottom: -3px;', "title" => $lang->asb_add_custom_box_types)); + $new_box_url = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')); + $new_box_link = $html->link($new_box_url, $lang->asb_add_custom_box_types, array('style' => 'font-weight: bold;', 'title' => $lang->asb_add_custom_box_types, 'icon' => "styles/{$cp_style}/images/asb/add.png"), array('alt' => '+', 'style' => 'margin-bottom: -3px;', 'title' => $lang->asb_add_custom_box_types)); echo($new_box_link . '

'); $table = new Table; $table->construct_header($lang->asb_name); $table->construct_header($lang->asb_custom_box_desc); - $table->construct_header($lang->asb_controls, array("colspan" => 2)); + $table->construct_header($lang->asb_controls, array('colspan' => 2)); $custom = asb_get_all_custom(); @@ -927,10 +927,10 @@ function asb_admin_custom_boxes() foreach ($custom as $this_custom) { $data = $this_custom->get('data'); // name (edit link) - $edit_url = $html->url(array("action" => 'custom_boxes', "mode" => 'edit', "id" => $data['id'])); - $edit_link = $html->link($edit_url, $data['title'], array("title" => $lang->asb_edit, "style" => 'font-weight: bold;')); + $edit_url = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit', 'id' => $data['id'])); + $edit_link = $html->link($edit_url, $data['title'], array('title' => $lang->asb_edit, 'style' => 'font-weight: bold;')); - $table->construct_cell($edit_link, array("width" => '30%')); + $table->construct_cell($edit_link, array('width' => '30%')); // description if ($data['description']) { @@ -938,7 +938,7 @@ function asb_admin_custom_boxes() } else { $description = "{$lang->asb_no_description}"; } - $table->construct_cell($description, array("width" => '60%')); + $table->construct_cell($description, array('width' => '60%')); // options popup $popup = new PopupMenu('box_' . $data['id'], $lang->asb_options); @@ -947,27 +947,27 @@ function asb_admin_custom_boxes() $popup->add_item($lang->asb_edit, $edit_url); // delete - $popup->add_item($lang->asb_delete, $html->url(array("action" => 'custom_boxes', "mode" => 'delete', "id" => $data['id'])), "return confirm('{$lang->asb_custom_del_warning}');"); + $popup->add_item($lang->asb_delete, $html->url(array('action' => 'custom_boxes', 'mode' => 'delete', 'id' => $data['id'])), "return confirm('{$lang->asb_custom_del_warning}');"); // export - $popup->add_item($lang->asb_custom_export, $html->url(array("action" => 'custom_boxes', "mode" => 'export', "id" => $data['id']))); + $popup->add_item($lang->asb_custom_export, $html->url(array('action' => 'custom_boxes', 'mode' => 'export', 'id' => $data['id']))); // popup cell - $table->construct_cell($popup->fetch(), array("width" => '10%')); + $table->construct_cell($popup->fetch(), array('width' => '10%')); // finish the table $table->construct_row(); } } else { // no saved types - $table->construct_cell($lang->asb_no_custom_boxes, array("colspan" => 4)); + $table->construct_cell($lang->asb_no_custom_boxes, array('colspan' => 4)); $table->construct_row(); } $table->output($lang->asb_custom_box_types); echo('

'); - $import_form = new Form($html->url(array("action" => 'custom_boxes', "mode" => 'import')), 'post', '', 1); + $import_form = new Form($html->url(array('action' => 'custom_boxes', 'mode' => 'import')), 'post', '', 1); $import_form_container = new FormContainer($lang->asb_custom_import); $import_form_container->output_row($lang->asb_custom_import_select_file, '', $import_form->generate_file_upload_box('file')); $import_form_container->end(); @@ -997,26 +997,26 @@ function asb_admin_manage_scripts() if (!$script_info->save()) { flash_message($lang->asb_script_save_fail, 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } flash_message($lang->asb_script_save_success, 'success'); asb_cache_has_changed(); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } elseif ($mybb->input['mode'] == 'import') { if (!$_FILES['file'] || $_FILES['file']['error'] == 4) { flash_message($lang->asb_custom_import_no_file, 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } if ($_FILES['file']['error']) { flash_message($lang->sprintf($lang->asb_custom_import_file_error, $_FILES['file']['error']), 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } if (!is_uploaded_file($_FILES['file']['tmp_name'])) { flash_message($lang->asb_custom_import_file_upload_error, 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } $contents = @file_get_contents($_FILES['file']['tmp_name']); @@ -1024,13 +1024,13 @@ function asb_admin_manage_scripts() if (strlen(trim($contents)) == 0) { flash_message($lang->asb_custom_import_file_empty, 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } $this_script = new ScriptInfo; if (!$this_script->import($contents)) { flash_message($lang->asb_script_import_fail, 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } if (!$this_script->save()) { @@ -1039,9 +1039,9 @@ function asb_admin_manage_scripts() flash_message($lang->asb_script_import_success, 'success'); asb_cache_has_changed(); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } elseif ($mybb->input['mode'] == 'inline') { - $redirect = $html->url(array("action" => 'manage_scripts')); + $redirect = $html->url(array('action' => 'manage_scripts')); if (!is_array($mybb->input['asb_inline_ids']) || empty($mybb->input['asb_inline_ids'])) { @@ -1129,9 +1129,9 @@ function asb_admin_manage_scripts() } elseif ($mybb->input['mode'] == 'export' && $mybb->input['id']) { $this_script = new ScriptInfo((int) $mybb->input['id']); - if (!$this_script->export(array("version" => ASB_SCRIPT_VERSION))) { + if (!$this_script->export(array('version' => ASB_SCRIPT_VERSION))) { flash_message($lang->asb_script_export_fail, 'error'); - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } exit; } elseif (($mybb->input['mode'] == 'activate' || @@ -1148,17 +1148,17 @@ function asb_admin_manage_scripts() flash_message($action, 'success'); asb_cache_has_changed(); } - admin_redirect($html->url(array("action" => 'manage_scripts'))); + admin_redirect($html->url(array('action' => 'manage_scripts'))); } $data = array( - "active" => 'false', - "find_top" => '{$header}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "width_left" => 160, - "width_right" => 160 + 'active' => 'false', + 'find_top' => '{$header}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'width_left' => 160, + 'width_right' => 160 ); if ($mybb->input['mode'] == 'edit') { @@ -1173,9 +1173,9 @@ function asb_admin_manage_scripts() $data = $this_script->get('data'); $detected_info = asb_detect_script_info($data['filename'], array( - "hook" => $data['hook'], - "action" => $data['action'], - "template" => $data['template_name'], + 'hook' => $data['hook'], + 'action' => $data['action'], + 'template' => $data['template_name'], )); $detected_show = ''; $button_text = $lang->asb_update; @@ -1227,7 +1227,7 @@ function asb_admin_manage_scripts() EOF; - $page->add_breadcrumb_item($lang->asb_manage_scripts, $html->url(array("action" => 'manage_scripts'))); + $page->add_breadcrumb_item($lang->asb_manage_scripts, $html->url(array('action' => 'manage_scripts'))); $page->add_breadcrumb_item($lang->asb_edit_script); $page->output_header("{$lang->asb} - {$lang->asb_manage_scripts} - {$lang->asb_edit_script}"); asb_output_tabs('asb_edit_script'); @@ -1238,30 +1238,30 @@ function asb_admin_manage_scripts()
EOF; - $form = new Form($html->url(array("action" => 'manage_scripts', "mode" => 'edit')), 'post', 'edit_script'); + $form = new Form($html->url(array('action' => 'manage_scripts', 'mode' => 'edit')), 'post', 'edit_script'); $form_container = new FormContainer($lang->asb_edit_script); $form_container->output_row("{$lang->asb_title}:", $lang->asb_title_desc, $form->generate_text_box('title', $data['title'])); - $form_container->output_row("{$lang->asb_filename}:", $lang->asb_filename_desc, '
'.$form->generate_text_box('filename', $data['filename'], array("id" => 'filename'))); + $form_container->output_row("{$lang->asb_filename}:", $lang->asb_filename_desc, '
'.$form->generate_text_box('filename', $data['filename'], array('id' => 'filename'))); - $form_container->output_row("{$lang->asb_action}:", $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_action)), "{$spinner}
{$detected_info['actions']}
" . $form->generate_text_box('script_action', $data['action'], array("id" => 'action'))); + $form_container->output_row("{$lang->asb_action}:", $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_action)), "{$spinner}
{$detected_info['actions']}
" . $form->generate_text_box('script_action', $data['action'], array('id' => 'action'))); $form_container->output_row($lang->asb_page, $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_page)), $form->generate_text_box('page', $data['page'])); $form_container->output_row($lang->asb_width_left, $lang->asb_width_left_desc, $form->generate_text_box('width_left', $data['width_left'])); $form_container->output_row($lang->asb_width_right, $lang->asb_width_right_desc, $form->generate_text_box('width_right', $data['width_right'])); - $form_container->output_row("{$lang->asb_output_to_vars}?", $lang->sprintf($lang->asb_output_to_vars_desc, '$asb_left and $asb_right'), $form->generate_yes_no_radio('eval', $data['eval'], true, array("id" => 'eval_yes', "class" => 'eval'), array("id" => 'eval_no', "class" => 'eval')), '', array(), array("id" => 'var_output')); + $form_container->output_row("{$lang->asb_output_to_vars}?", $lang->sprintf($lang->asb_output_to_vars_desc, '$asb_left and $asb_right'), $form->generate_yes_no_radio('eval', $data['eval'], true, array('id' => 'eval_yes', 'class' => 'eval'), array('id' => 'eval_no', 'class' => 'eval')), '', array(), array('id' => 'var_output')); - $form_container->output_row("{$lang->asb_template}:", $lang->asb_template_desc, "{$spinner}
{$detected_info['templates']}
" . $form->generate_text_box('template_name', $data['template_name'], array("id" => 'template_name')), '', array(), array("id" => 'template_row')); - $form_container->output_row("{$lang->asb_hook}:", $lang->asb_hook_desc, "{$spinner}
{$detected_info['hooks']}
" . $form->generate_text_box('hook', $data['hook'], array("id" => 'hook')), '', array(), array("id" => 'hook_row')); + $form_container->output_row("{$lang->asb_template}:", $lang->asb_template_desc, "{$spinner}
{$detected_info['templates']}
" . $form->generate_text_box('template_name', $data['template_name'], array('id' => 'template_name')), '', array(), array('id' => 'template_row')); + $form_container->output_row("{$lang->asb_hook}:", $lang->asb_hook_desc, "{$spinner}
{$detected_info['hooks']}
" . $form->generate_text_box('hook', $data['hook'], array('id' => 'hook')), '', array(), array('id' => 'hook_row')); - $form_container->output_row($lang->asb_header_search_text, $lang->asb_header_search_text_desc, $form->generate_text_area('find_top', $data['find_top'], array("id" => 'find_top', 'class' => '', 'style' => 'width: 100%;', "rows" => '3')), '', array(), array("id" => 'header_search')); - $form_container->output_row($lang->asb_footer_search_text, $lang->asb_footer_search_text_desc, $form->generate_text_area('find_bottom', $data['find_bottom'], array("id" => 'find_bottom', 'class' => '', 'style' => 'width: 100%; height: 100px;')) . $form->generate_hidden_field('id', $data['id']) . $form->generate_hidden_field('active', $data['active']) . $form->generate_hidden_field('action', 'manage_scripts') . $form->generate_hidden_field('mode', 'edit'), '', array(), array("id" => 'footer_search')); + $form_container->output_row($lang->asb_header_search_text, $lang->asb_header_search_text_desc, $form->generate_text_area('find_top', $data['find_top'], array('id' => 'find_top', 'class' => '', 'style' => 'width: 100%;', 'rows' => '3')), '', array(), array('id' => 'header_search')); + $form_container->output_row($lang->asb_footer_search_text, $lang->asb_footer_search_text_desc, $form->generate_text_area('find_bottom', $data['find_bottom'], array('id' => 'find_bottom', 'class' => '', 'style' => 'width: 100%; height: 100px;')) . $form->generate_hidden_field('id', $data['id']) . $form->generate_hidden_field('active', $data['active']) . $form->generate_hidden_field('action', 'manage_scripts') . $form->generate_hidden_field('mode', 'edit'), '', array(), array('id' => 'footer_search')); - $form_container->output_row($lang->asb_replace_template, $lang->asb_replace_template_desc, $form->generate_yes_no_radio('replace_all', $data['replace_all'], true, array("id" => 'replace_all_yes', "class" => 'replace_all'), array("id" => 'replace_all_no', "class" => 'replace_all')), '', array(), array("id" => 'replace_all')); + $form_container->output_row($lang->asb_replace_template, $lang->asb_replace_template_desc, $form->generate_yes_no_radio('replace_all', $data['replace_all'], true, array('id' => 'replace_all_yes', 'class' => 'replace_all'), array('id' => 'replace_all_no', 'class' => 'replace_all')), '', array(), array('id' => 'replace_all')); - $form_container->output_row($lang->asb_replacement_content, $lang->asb_replacement_content_desc, $form->generate_text_area('replacement', $data['replacement'], array("id" => 'replacement', 'class' => '', 'style' => 'width: 100%; height: 240px;')), '', array(), array("id" => 'replace_content')); + $form_container->output_row($lang->asb_replacement_content, $lang->asb_replacement_content_desc, $form->generate_text_area('replacement', $data['replacement'], array('id' => 'replacement', 'class' => '', 'style' => 'width: 100%; height: 240px;')), '', array(), array('id' => 'replace_content')); $form_container->end(); @@ -1317,36 +1317,36 @@ function asb_admin_manage_scripts() $page->output_header("{$lang->asb} - {$lang->asb_manage_scripts}"); asb_output_tabs('asb_scripts'); - $new_script_url = $html->url(array("action" => 'manage_scripts', "mode" => 'edit')); - $new_script_link = $html->link($new_script_url, $lang->asb_add_new_script, array("style" => 'font-weight: bold;', "title" => $lang->asb_add_new_script, "icon" => "styles/{$cp_style}/images/asb/add.png"), array("alt" => '+', "title" => $lang->asb_add_new_script, "style" => 'margin-bottom: -3px;')); + $new_script_url = $html->url(array('action' => 'manage_scripts', 'mode' => 'edit')); + $new_script_link = $html->link($new_script_url, $lang->asb_add_new_script, array('style' => 'font-weight: bold;', 'title' => $lang->asb_add_new_script, 'icon' => "styles/{$cp_style}/images/asb/add.png"), array('alt' => '+', 'title' => $lang->asb_add_new_script, 'style' => 'margin-bottom: -3px;')); echo($new_script_link . '

'); - $form = new Form($html->url(array("action" => 'manage_scripts', "mode" => 'inline')), 'post', 'inline_form'); + $form = new Form($html->url(array('action' => 'manage_scripts', 'mode' => 'inline')), 'post', 'inline_form'); $table = new Table; - $table->construct_header($lang->asb_title, array("width" => '34%')); - $table->construct_header($lang->asb_filename, array("width" => '16%')); - $table->construct_header($lang->asb_action, array("width" => '7%')); - $table->construct_header($lang->asb_page, array("width" => '7%')); - $table->construct_header($lang->asb_width_left, array("width" => '10%')); - $table->construct_header($lang->asb_width_right, array("width" => '10%')); - $table->construct_header($lang->asb_status, array("width" => '7%')); - $table->construct_header($lang->asb_controls, array("width" => '8%')); - $table->construct_header($form->generate_check_box('', '', '', array("id" => 'asb_select_all')), array("style" => 'width: 1%')); - - $query = $db->simple_select('asb_script_info', '*', '', array("order_by" => 'title', "order_dir" => 'ASC')); + $table->construct_header($lang->asb_title, array('width' => '34%')); + $table->construct_header($lang->asb_filename, array('width' => '16%')); + $table->construct_header($lang->asb_action, array('width' => '7%')); + $table->construct_header($lang->asb_page, array('width' => '7%')); + $table->construct_header($lang->asb_width_left, array('width' => '10%')); + $table->construct_header($lang->asb_width_right, array('width' => '10%')); + $table->construct_header($lang->asb_status, array('width' => '7%')); + $table->construct_header($lang->asb_controls, array('width' => '8%')); + $table->construct_header($form->generate_check_box('', '', '', array('id' => 'asb_select_all')), array('style' => 'width: 1%')); + + $query = $db->simple_select('asb_script_info', '*', '', array('order_by' => 'title', 'order_dir' => 'ASC')); if ($db->num_rows($query) > 0) { while ($data = $db->fetch_array($query)) { - $edit_url = $html->url(array("action" => 'manage_scripts', "mode" => 'edit', "id" => $data['id'])); - $activate_url = $html->url(array("action" => 'manage_scripts', "mode" => 'activate', "id" => $data['id'])); - $deactivate_url = $html->url(array("action" => 'manage_scripts', "mode" => 'deactivate', "id" => $data['id'])); - $activate_link = $html->link($activate_url, $lang->asb_inactive, array("style" => 'font-weight: bold; color: red;', "title" => $lang->asb_inactive_desc)); - $deactivate_link = $html->link($deactivate_url, $lang->asb_active, array("style" => 'font-weight: bold; color: green', "title" => $lang->asb_active_desc)); + $edit_url = $html->url(array('action' => 'manage_scripts', 'mode' => 'edit', 'id' => $data['id'])); + $activate_url = $html->url(array('action' => 'manage_scripts', 'mode' => 'activate', 'id' => $data['id'])); + $deactivate_url = $html->url(array('action' => 'manage_scripts', 'mode' => 'deactivate', 'id' => $data['id'])); + $activate_link = $html->link($activate_url, $lang->asb_inactive, array('style' => 'font-weight: bold; color: red;', 'title' => $lang->asb_inactive_desc)); + $deactivate_link = $html->link($deactivate_url, $lang->asb_active, array('style' => 'font-weight: bold; color: green', 'title' => $lang->asb_active_desc)); $none = <<{$lang->asb_none} EOF; - $table->construct_cell($html->link($edit_url, $data['title'], array("style" => 'font-weight: bold;'))); + $table->construct_cell($html->link($edit_url, $data['title'], array('style' => 'font-weight: bold;'))); $table->construct_cell($data['filename']); $table->construct_cell($data['action'] ? $data['action'] : $none); $table->construct_cell($data['page'] ? $data['page'] : $none); @@ -1361,19 +1361,19 @@ function asb_admin_manage_scripts() $popup->add_item($lang->asb_edit, $edit_url); // export - $popup->add_item($lang->asb_custom_export, $html->url(array("action" => 'manage_scripts', "mode" => 'export', "id" => $data['id']))); + $popup->add_item($lang->asb_custom_export, $html->url(array('action' => 'manage_scripts', 'mode' => 'export', 'id' => $data['id']))); // delete - $popup->add_item($lang->asb_delete, $html->url(array("action" => 'manage_scripts', "mode" => 'delete', "id" => $data['id'])), "return confirm('{$lang->asb_script_del_warning}');"); + $popup->add_item($lang->asb_delete, $html->url(array('action' => 'manage_scripts', 'mode' => 'delete', 'id' => $data['id'])), "return confirm('{$lang->asb_script_del_warning}');"); // popup cell $table->construct_cell($popup->fetch()); - $table->construct_cell($form->generate_check_box("asb_inline_ids[{$data['id']}]", '', '', array("class" => 'asb_check'))); + $table->construct_cell($form->generate_check_box("asb_inline_ids[{$data['id']}]", '', '', array('class' => 'asb_check'))); $table->construct_row(); $table->construct_row(); } } else { - $table->construct_cell("{$lang->asb_no_scripts}", array("colspan" => 9)); + $table->construct_cell("{$lang->asb_no_scripts}", array('colspan' => 9)); $table->construct_row(); } @@ -1393,14 +1393,14 @@ function asb_admin_manage_scripts() EOF; - $table->construct_cell('', array("colspan" => 4, 'style' =>'border-right: none;')); - $table->construct_cell($inline, array("colspan" => 5, 'style' =>'border-left: none;')); + $table->construct_cell('', array('colspan' => 4, 'style' =>'border-right: none;')); + $table->construct_cell($inline, array('colspan' => 5, 'style' =>'border-left: none;')); $table->construct_row(); $table->output($lang->asb_script_info); $form->end(); - $form = new Form($html->url(array("action" => 'manage_scripts', "mode" => 'import')), 'post', '', 1); + $form = new Form($html->url(array('action' => 'manage_scripts', 'mode' => 'import')), 'post', '', 1); $form_container = new FormContainer($lang->asb_custom_import); $form_container->output_row($lang->asb_custom_import_select_file, '', $form->generate_file_upload_box('file')); $form_container->end(); @@ -1434,10 +1434,10 @@ function asb_admin_manage_modules() asb_output_tabs('asb_modules'); $table = new Table; - $table->construct_header($lang->asb_name, array("width" => '22%')); - $table->construct_header($lang->asb_description, array("width" => '55%')); - $table->construct_header($lang->asb_modules_author, array("width" => '15%')); - $table->construct_header($lang->asb_controls, array("width" => '8%')); + $table->construct_header($lang->asb_name, array('width' => '22%')); + $table->construct_header($lang->asb_description, array('width' => '55%')); + $table->construct_header($lang->asb_modules_author, array('width' => '15%')); + $table->construct_header($lang->asb_controls, array('width' => '8%')); $addons = asb_get_all_modules(); @@ -1461,7 +1461,7 @@ function asb_admin_manage_modules() } // title - $table->construct_cell($html->link($data['module_site'], $data['title'], array("style" => 'font-weight: bold;')) . " ({$version})"); + $table->construct_cell($html->link($data['module_site'], $data['title'], array('style' => 'font-weight: bold;')) . " ({$version})"); // description $table->construct_cell($data['description'] . $out_of_date); @@ -1472,7 +1472,7 @@ function asb_admin_manage_modules() $author = $data['author']; if ($data['author_site']) { - $author = $html->link($data['author_site'], $data['author'], array("style" => 'font-weight: bold;')); + $author = $html->link($data['author_site'], $data['author'], array('style' => 'font-weight: bold;')); } // author @@ -1482,16 +1482,16 @@ function asb_admin_manage_modules() $popup = new PopupMenu('module_' . $data['baseName'], $lang->asb_options); // delete - $popup->add_item($lang->asb_delete, $html->url(array("action" => 'delete_addon', "addon" => $data['baseName'])), "return confirm('{$lang->asb_modules_del_warning}');"); + $popup->add_item($lang->asb_delete, $html->url(array('action' => 'delete_addon', 'addon' => $data['baseName'])), "return confirm('{$lang->asb_modules_del_warning}');"); // pop-up cell - $table->construct_cell($popup->fetch(), array("width" => '10%')); + $table->construct_cell($popup->fetch(), array('width' => '10%')); // finish row $table->construct_row(); } } else { - $table->construct_cell("{$lang->asb_no_modules_detected}", array("colspan" => 3)); + $table->construct_cell("{$lang->asb_no_modules_detected}", array('colspan' => 3)); $table->construct_row(); } $table->output($lang->asb_addon_modules); @@ -1652,7 +1652,7 @@ function asb_admin_delete_addon() if (!isset($mybb->input['addon']) || strlen(trim($mybb->input['addon'])) == 0) { flash_message($lang->asb_delete_addon_failure, 'error'); - admin_redirect($html->url(array("action" => 'manage_modules'))); + admin_redirect($html->url(array('action' => 'manage_modules'))); } $this_module = new SideboxExternalModule($mybb->input['addon']); @@ -1662,7 +1662,7 @@ function asb_admin_delete_addon() flash_message($lang->asb_delete_addon_success, 'success'); asb_cache_has_changed(); } - admin_redirect($html->url(array("action" => 'manage_modules'))); + admin_redirect($html->url(array('action' => 'manage_modules'))); } /** @@ -1794,7 +1794,7 @@ function asb_update_theme_select_setting() } // update the setting - return $db->update_query('settings', array("optionscode" => $db->escape_string(asb_build_theme_exclude_select())), "name='asb_exclude_theme'"); + return $db->update_query('settings', array('optionscode' => $db->escape_string(asb_build_theme_exclude_select())), "name='asb_exclude_theme'"); } /** diff --git a/Upload/inc/plugins/asb/classes/CustomSidebox.php b/Upload/inc/plugins/asb/classes/CustomSidebox.php index 5fae6b8..c502a6a 100644 --- a/Upload/inc/plugins/asb/classes/CustomSidebox.php +++ b/Upload/inc/plugins/asb/classes/CustomSidebox.php @@ -117,7 +117,7 @@ public function buildTemplate($template_variable) '; } else { $content = str_replace("\\'", "'", addslashes($content)); - eval("\${$template_variable} = \"" . $content . "\";"); + eval("\${$template_variable} = \"{$content}\";"); } return $ret_val; } diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php index f6d5c5d..29cf5f6 100644 --- a/Upload/inc/plugins/asb/forum.php +++ b/Upload/inc/plugins/asb/forum.php @@ -47,7 +47,7 @@ function asb_start() // make sure this script's width is within range 120-800 (120 because the templates // aren't made to work any smaller and tbh 800 is kind of arbitrary :s - foreach (array("left" => 0, "right" => 1) as $key => $pos) { + foreach (array('left' => 0, 'right' => 1) as $key => $pos) { $width[$pos] = (int) max(120, min(800, $this_script["width_{$key}"])); } @@ -169,13 +169,13 @@ function asb_edit_template($boxes, $width, $script) EOF; $toggle_info['left'] = array( - "close" => array( - "img" => "{$theme['imgdir']}/asb/left_arrow.png", - "alt" => '<' + 'close' => array( + 'img' => "{$theme['imgdir']}/asb/left_arrow.png", + 'alt' => '<' ), - "open" => array( - "img" => "{$theme['imgdir']}/asb/right_arrow.png", - "alt" => '>' + 'open' => array( + 'img' => "{$theme['imgdir']}/asb/right_arrow.png", + 'alt' => '>' ) ); $toggle_info['right']['close'] = $toggle_info['left']['open']; @@ -246,7 +246,7 @@ function asb_edit_template($boxes, $width, $script) $extra_scripts .= <<request_method == 'post') { - $db->update_query('users', array("show_sidebox" => (int) $mybb->input['showsidebox']), "uid='{$user['uid']}'"); + $db->update_query('users', array('show_sidebox' => (int) $mybb->input['showsidebox']), "uid='{$user['uid']}'"); } // don't be silly and waste a query :p (thanks Destroy666) diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php index 76bbb6c..39ea69f 100644 --- a/Upload/inc/plugins/asb/functions.php +++ b/Upload/inc/plugins/asb/functions.php @@ -41,7 +41,7 @@ function asb_do_checks() * credit: http://stackoverflow.com/users/1304523/justin-docanto */ if ($mybb->settings['asb_disable_for_mobile'] && - preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"])) { + preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER['HTTP_USER_AGENT'])) { return false; } @@ -90,9 +90,9 @@ function asb_build_script_filename($this_script = '') empty($this_script)) { global $mybb; $this_script = array( - "filename" => THIS_SCRIPT, - "action" => $mybb->input['action'], - "page" => $mybb->input['page'] + 'filename' => THIS_SCRIPT, + 'action' => $mybb->input['action'], + 'page' => $mybb->input['page'] ); } @@ -395,7 +395,7 @@ function asb_get_all_sideboxes($good_script = '') // get any side boxes $return_array = array(); - $query = $db->simple_select('asb_sideboxes', '*', '', array("order_by" => 'display_order', "order_dir" => 'ASC')); + $query = $db->simple_select('asb_sideboxes', '*', '', array('order_by' => 'display_order', 'order_dir' => 'ASC')); if ($db->num_rows($query) > 0) { while ($data = $db->fetch_array($query)) { $sidebox = new SideboxObject($data); diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php index d3c97a7..ad536b5 100644 --- a/Upload/inc/plugins/asb/functions_acp.php +++ b/Upload/inc/plugins/asb/functions_acp.php @@ -45,7 +45,7 @@ function asb_build_help_link($topic = '') break; } - return $html->link($url, $lang->asb_help, array("target" => '_blank', "style" => 'font-weight: bold;', "icon" => "styles/{$cp_style}/images/asb/help.png", "title" => $lang->asb_help), array("alt" => '?', "title" => $lang->asb_help, "style" => 'margin-bottom: -3px;')); + return $html->link($url, $lang->asb_help, array('target' => '_blank', 'style' => 'font-weight: bold;', 'icon' => "styles/{$cp_style}/images/asb/help.png", 'title' => $lang->asb_help), array('alt' => '?', 'title' => $lang->asb_help, 'style' => 'margin-bottom: -3px;')); } /** @@ -58,7 +58,7 @@ function asb_build_settings_menu_link() global $mybb, $lang, $html, $cp_style; $settings_url = asb_build_settings_url(asb_get_settingsgroup()); - $settings_link = $html->link($settings_url, $lang->asb_plugin_settings, array("icon" => "styles/{$cp_style}/images/asb/settings.png", "style" => 'font-weight: bold;', "title" => $lang->asb_plugin_settings), array("alt" => 'S', "style" => 'margin-bottom: -3px;')); + $settings_link = $html->link($settings_url, $lang->asb_plugin_settings, array('icon' => "styles/{$cp_style}/images/asb/settings.png", 'style' => 'font-weight: bold;', 'title' => $lang->asb_plugin_settings), array('alt' => 'S', 'style' => 'margin-bottom: -3px;')); return $settings_link; } @@ -81,32 +81,32 @@ function asb_output_tabs($current) $sub_tabs['asb_custom'] = array( 'title' => $lang->asb_custom_boxes, - 'link' => $html->url(array("action" => 'custom_boxes')), + 'link' => $html->url(array('action' => 'custom_boxes')), 'description' => $lang->asb_custom_boxes_desc ); if (in_array($current, array('asb_add_custom', 'asb_custom'))) { $sub_tabs['asb_add_custom'] = array( 'title' => $lang->asb_add_custom, - 'link' => $html->url(array("action" => 'custom_boxes', "mode" => 'edit')), + 'link' => $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')), 'description' => $lang->asb_add_custom_desc ); } $sub_tabs['asb_scripts'] = array( 'title' => $lang->asb_manage_scripts, - 'link' => $html->url(array("action" => 'manage_scripts')), + 'link' => $html->url(array('action' => 'manage_scripts')), 'description' => $lang->asb_manage_scripts_desc ); if (in_array($current, array('asb_edit_script', 'asb_scripts'))) { $sub_tabs['asb_edit_script'] = array( 'title' => $lang->asb_edit_script, - 'link' => $html->url(array("action" => 'manage_scripts', "mode" => 'edit')), + 'link' => $html->url(array('action' => 'manage_scripts', 'mode' => 'edit')), 'description' => $lang->asb_edit_script_desc ); } $sub_tabs['asb_modules'] = array( 'title' => $lang->asb_manage_modules, - 'link' => $html->url(array("action" => 'manage_modules')), + 'link' => $html->url(array('action' => 'manage_modules')), 'description' => $lang->asb_manage_modules_desc ); $page->output_nav_tabs($sub_tabs, $current); @@ -382,14 +382,14 @@ function asb_build_sidebox_info($sidebox, $wrap = true, $ajax = false) $visibility = '' . asb_build_permissions_table($sidebox) . ''; // edit link - $edit_link = $html->url(array("action" => 'edit_box', "id" => $id, "addon" => $module, "pos" => $pos)); + $edit_link = $html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module, 'pos' => $pos)); $edit_icon = <<{$lang->asb_edit} EOF; // delete link (only used if JS is disabled) if (!$ajax) { - $delete_link = $html->url(array("action" => 'delete_box', "id" => $id)); + $delete_link = $html->url(array('action' => 'delete_box', 'id' => $id)); $delete_icon = <<{$lang->asb_delete} EOF; @@ -457,20 +457,20 @@ function asb_detect_script_info($filename, $selected = array()) // build the object info $info = array( - "hook" => array( - "pattern" => "#\\\$plugins->run_hooks\([\"|'|"]([\w|_]*)[\"|'|"](.*?)\)#i", - "filter" => '_do_', - "plural" => $lang->asb_hooks + 'hook' => array( + 'pattern' => "#\\\$plugins->run_hooks\([\"|'|"]([\w|_]*)[\"|'|"](.*?)\)#i", + 'filter' => '_do_', + 'plural' => $lang->asb_hooks ), - "template" => array( - "pattern" => "#\\\$templates->get\([\"|'|"]([\w|_]*)[\"|'|"](.*?)\)#i", - "filter" => '', - "plural" => $lang->asb_templates + 'template' => array( + 'pattern' => "#\\\$templates->get\([\"|'|"]([\w|_]*)[\"|'|"](.*?)\)#i", + 'filter' => '', + 'plural' => $lang->asb_templates ), - "action" => array( - "pattern" => "#\\\$mybb->input\[[\"|'|"]action[\"|'|"]\] == [\"|'|"]([\w|_]*)[\"|'|"]#i", - "filter" => '', - "plural" => $lang->asb_actions + 'action' => array( + 'pattern' => "#\\\$mybb->input\[[\"|'|"]action[\"|'|"]\] == [\"|'|"]([\w|_]*)[\"|'|"]#i", + 'filter' => '', + 'plural' => $lang->asb_actions ) ); @@ -502,7 +502,7 @@ function asb_detect_script_info($filename, $selected = array()) $$array_name = array_reverse($$array_name); // store the HTML select box - $return_array[$array_name] = '' . $lang->asb_detected . ' ' . $info[$key]['plural'] . ':
' . $form->generate_select_box("{$array_name}_options", $$array_name, $selected[$key], array("id" => "{$key}_selector")) . '

'; + $return_array[$array_name] = '' . $lang->asb_detected . ' ' . $info[$key]['plural'] . ':
' . $form->generate_select_box("{$array_name}_options", $$array_name, $selected[$key], array('id' => "{$key}_selector")) . '

'; } else { $varName = "asb_ajax_{$array_name}"; $noContent = $lang->sprintf($lang->asb_ajax_nothing_found, $lang->$varName); @@ -571,7 +571,7 @@ function asb_build_filter_selector($filter) } global $lang, $html; - $options = array_merge(array("" => 'no filter'), $all_scripts); + $options = array_merge(array('' => 'no filter'), $all_scripts); $form = new Form($html->url(), 'post', 'script_filter', 0, 'script_filter'); echo($form->generate_select_box('page', $options, $filter)); echo($form->generate_submit_button('Filter', array('name' => 'filter'))); @@ -603,7 +603,7 @@ function asb_build_setting($this_form, $this_form_container, $setting) // sort by type if ($type[0] == 'text' || $type[0] == '') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_text_box($element_name, $setting['value'], array('id' => $element_id)), $element_name, array("id" => $row_id)); + $this_form_container->output_row($this_label, $this_desc, $this_form->generate_text_box($element_name, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); } else if ($type[0] == 'textarea') { $this_form_container->output_row($this_label, $this_desc, $this_form->generate_text_area($element_name, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); } else if ($type[0] == 'yesno') { @@ -632,13 +632,13 @@ function asb_build_setting($this_form, $this_form_container, $setting) $option_list[$optionsexp[0]] = htmlspecialchars_uni($optionsexp[1]); } else if ($type[0] == 'radio') { if ($setting['value'] == $optionsexp[0]) { - $option_list[$i] = $this_form->generate_radio_button($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, "checked" => 1, 'class' => $element_id)); + $option_list[$i] = $this_form->generate_radio_button($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'checked' => 1, 'class' => $element_id)); } else { $option_list[$i] = $this_form->generate_radio_button($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'class' => $element_id)); } } else if($type[0] == 'checkbox') { if ($setting['value'] == $optionsexp[0]) { - $option_list[$i] = $this_form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, "checked" => 1, 'class' => $element_id)); + $option_list[$i] = $this_form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'checked' => 1, 'class' => $element_id)); } else { $option_list[$i] = $this_form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'class' => $element_id)); } diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php index 1dd9b45..ef54e21 100644 --- a/Upload/inc/plugins/asb/install.php +++ b/Upload/inc/plugins/asb/install.php @@ -96,14 +96,14 @@ function asb_info() // This array returns information about the plugin, some of which was prefabricated above based on whether the plugin has been installed or not. return array( - "name" => $name, - "description" => $asb_description, - "website" => 'https://github.com/WildcardSearch/Advanced-Sidebox', - "author" => $author, - "authorsite" => 'http://www.rantcentralforums.com', - "version" => ASB_VERSION, - "compatibility" => '18*', - "codename" => 'asb', + 'name' => $name, + 'description' => $asb_description, + 'website' => 'https://github.com/WildcardSearch/Advanced-Sidebox', + 'author' => $author, + 'authorsite' => 'http://www.rantcentralforums.com', + 'version' => ASB_VERSION, + 'compatibility' => '18*', + 'codename' => 'asb', ); } @@ -292,93 +292,93 @@ function asb_build_settings_link() function asb_create_script_info($return = false) { $scripts = array( - "index" => array( - "title" => 'Index', - "filename" => 'index.php', - "template_name" => 'index', - "hook" => 'index_start', - "find_top" => '{$header}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'index' => array( + 'title' => 'Index', + 'filename' => 'index.php', + 'template_name' => 'index', + 'hook' => 'index_start', + 'find_top' => '{$header}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "forumdisplay" => array( - "title" => 'Forum Display', - "filename" => 'forumdisplay.php', - "template_name" => 'forumdisplay_threadlist', - "hook" => 'forumdisplay_start', - "find_top" => '
+ 'forumdisplay' => array( + 'title' => 'Forum Display', + 'filename' => 'forumdisplay.php', + 'template_name' => 'forumdisplay_threadlist', + 'hook' => 'forumdisplay_start', + 'find_top' => '
{$newthread}
', - "find_bottom" => '{$inline_edit_js}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'find_bottom' => '{$inline_edit_js}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "showthread" => array( - "title" => 'Show Thread', - "filename" => 'showthread.php', - "template_name" => 'showthread', - "hook" => 'showthread_start', - "find_top" => '{$ratethread}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'showthread' => array( + 'title' => 'Show Thread', + 'filename' => 'showthread.php', + 'template_name' => 'showthread', + 'hook' => 'showthread_start', + 'find_top' => '{$ratethread}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "member" => array( - "title" => 'Member Profile', - "filename" => 'member.php', - "action" => 'profile', - "template_name" => 'member_profile', - "hook" => 'member_profile_start', - "find_top" => '{$header}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'member' => array( + 'title' => 'Member Profile', + 'filename' => 'member.php', + 'action' => 'profile', + 'template_name' => 'member_profile', + 'hook' => 'member_profile_start', + 'find_top' => '{$header}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "memberlist" => array( - "title" => 'Member List', - "filename" => 'memberlist.php', - "template_name" => 'memberlist', - "hook" => 'memberlist_start', - "find_top" => '{$multipage}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'memberlist' => array( + 'title' => 'Member List', + 'filename' => 'memberlist.php', + 'template_name' => 'memberlist', + 'hook' => 'memberlist_start', + 'find_top' => '{$multipage}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "showteam" => array( - "title" => 'Forum Team', - "filename" => 'showteam.php', - "template_name" => 'showteam', - "hook" => 'showteam_start', - "find_top" => '{$header}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'showteam' => array( + 'title' => 'Forum Team', + 'filename' => 'showteam.php', + 'template_name' => 'showteam', + 'hook' => 'showteam_start', + 'find_top' => '{$header}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "stats" => array( - "title" => 'Statistics', - "filename" => 'stats.php', - "template_name" => 'stats', - "hook" => 'stats_start', - "find_top" => '{$header}', - "find_bottom" => '{$footer}', - "replace_all" => 0, - "eval" => 0, - "active" => 1, + 'stats' => array( + 'title' => 'Statistics', + 'filename' => 'stats.php', + 'template_name' => 'stats', + 'hook' => 'stats_start', + 'find_top' => '{$header}', + 'find_bottom' => '{$footer}', + 'replace_all' => 0, + 'eval' => 0, + 'active' => 1, ), - "portal" => array( - "title" => 'Portal', - "filename" => 'portal.php', - "template_name" => 'portal', - "hook" => 'portal_start', - "replace_all" => 1, - "replacement" => << array( + 'title' => 'Portal', + 'filename' => 'portal.php', + 'template_name' => 'portal', + 'hook' => 'portal_start', + 'replace_all' => 1, + 'replacement' => << {\$mybb->settings['bbname']} @@ -394,8 +394,8 @@ function asb_create_script_info($return = false) EOF , - "eval" => 0, - "active" => 1, + 'eval' => 0, + 'active' => 1, ), ); diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php index 3b66fbc..b7cfcf1 100644 --- a/Upload/inc/plugins/asb/install_data.php +++ b/Upload/inc/plugins/asb/install_data.php @@ -9,210 +9,210 @@ $tables = array( 'pgsql' => array( - "asb_sideboxes" => array( - "id" => 'SERIAL', - "display_order" => 'INT NOT NULL', - "box_type" => 'VARCHAR(25) NOT NULL', - "title" => 'TEXT', - "title_link" => 'VARCHAR(128) NOT NULL', - "position" => 'INT', - "scripts" => 'TEXT', - "groups" => 'TEXT', - "themes" => 'TEXT', - "settings" => 'TEXT', - "wrap_content" => 'INT', - "dateline" => 'INT NOT NULL, PRIMARY KEY(id)' + 'asb_sideboxes' => array( + 'id' => 'SERIAL', + 'display_order' => 'INT NOT NULL', + 'box_type' => 'VARCHAR(25) NOT NULL', + 'title' => 'TEXT', + 'title_link' => 'VARCHAR(128) NOT NULL', + 'position' => 'INT', + 'scripts' => 'TEXT', + 'groups' => 'TEXT', + 'themes' => 'TEXT', + 'settings' => 'TEXT', + 'wrap_content' => 'INT', + 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)' ), - "asb_custom_sideboxes" => array( - "id" => 'SERIAL', - "title" => 'VARCHAR(32) NOT NULL', - "description" => 'VARCHAR(128) NOT NULL', - "wrap_content" => 'INT', - "content" => 'TEXT', - "dateline" => 'INT NOT NULL, PRIMARY KEY(id)' + 'asb_custom_sideboxes' => array( + 'id' => 'SERIAL', + 'title' => 'VARCHAR(32) NOT NULL', + 'description' => 'VARCHAR(128) NOT NULL', + 'wrap_content' => 'INT', + 'content' => 'TEXT', + 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)' ), - "asb_script_info" => array( - "id" => 'SERIAL', - "title" => 'VARCHAR(32) NOT NULL', - "filename" => 'VARCHAR(32) NOT NULL', - "action" => 'VARCHAR(32) NOT NULL', - "page" => 'VARCHAR(32) NOT NULL', - "width_left" => 'INT', - "width_right" => 'INT', - "template_name" => 'VARCHAR(128) NOT NULL', - "hook" => 'VARCHAR(128) NOT NULL', - "find_top" => 'TEXT', - "find_bottom" => 'TEXT', - "replace_all" => 'INT', - "replacement" => 'TEXT', - "replacement_template" => 'VARCHAR(128) NOT NULL', - "eval" => 'INT', - "active" => 'INT', - "dateline" => 'INT NOT NULL, PRIMARY KEY(id)' + 'asb_script_info' => array( + 'id' => 'SERIAL', + 'title' => 'VARCHAR(32) NOT NULL', + 'filename' => 'VARCHAR(32) NOT NULL', + 'action' => 'VARCHAR(32) NOT NULL', + 'page' => 'VARCHAR(32) NOT NULL', + 'width_left' => 'INT', + 'width_right' => 'INT', + 'template_name' => 'VARCHAR(128) NOT NULL', + 'hook' => 'VARCHAR(128) NOT NULL', + 'find_top' => 'TEXT', + 'find_bottom' => 'TEXT', + 'replace_all' => 'INT', + 'replacement' => 'TEXT', + 'replacement_template' => 'VARCHAR(128) NOT NULL', + 'eval' => 'INT', + 'active' => 'INT', + 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)' ), ), - "asb_sideboxes" => array( - "id" => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', - "display_order" => 'INT(10) NOT NULL', - "box_type" => 'VARCHAR(25) NOT NULL', - "title" => 'TEXT', - "title_link" => 'VARCHAR(128) NOT NULL', - "position" => 'INT(2)', - "scripts" => 'TEXT', - "groups" => 'TEXT', - "themes" => 'TEXT', - "settings" => 'TEXT', - "wrap_content" => 'INT(1)', - "dateline" => 'INT(10)' + 'asb_sideboxes' => array( + 'id' => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'display_order' => 'INT(10) NOT NULL', + 'box_type' => 'VARCHAR(25) NOT NULL', + 'title' => 'TEXT', + 'title_link' => 'VARCHAR(128) NOT NULL', + 'position' => 'INT(2)', + 'scripts' => 'TEXT', + 'groups' => 'TEXT', + 'themes' => 'TEXT', + 'settings' => 'TEXT', + 'wrap_content' => 'INT(1)', + 'dateline' => 'INT(10)' ), - "asb_custom_sideboxes" => array( - "id" => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', - "title" => 'VARCHAR(32) NOT NULL', - "description" => 'VARCHAR(128) NOT NULL', - "wrap_content" => 'INT(1)', - "content" => 'TEXT', - "dateline" => 'INT(10)' + 'asb_custom_sideboxes' => array( + 'id' => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'title' => 'VARCHAR(32) NOT NULL', + 'description' => 'VARCHAR(128) NOT NULL', + 'wrap_content' => 'INT(1)', + 'content' => 'TEXT', + 'dateline' => 'INT(10)' ), - "asb_script_info" => array( - "id" => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', - "title" => 'VARCHAR(32) NOT NULL', - "filename" => 'VARCHAR(32) NOT NULL', - "action" => 'VARCHAR(32) NOT NULL', - "page" => 'VARCHAR(32) NOT NULL', - "width_left" => 'INT(2)', - "width_right" => 'INT(2)', - "template_name" => 'VARCHAR(128) NOT NULL', - "hook" => 'VARCHAR(128) NOT NULL', - "find_top" => 'TEXT', - "find_bottom" => 'TEXT', - "replace_all" => 'INT(1)', - "replacement" => 'TEXT', - "replacement_template" => 'VARCHAR(128) NOT NULL', - "eval" => 'INT(1)', - "active" => 'INT(1)', - "dateline" => 'INT(10)' + 'asb_script_info' => array( + 'id' => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'title' => 'VARCHAR(32) NOT NULL', + 'filename' => 'VARCHAR(32) NOT NULL', + 'action' => 'VARCHAR(32) NOT NULL', + 'page' => 'VARCHAR(32) NOT NULL', + 'width_left' => 'INT(2)', + 'width_right' => 'INT(2)', + 'template_name' => 'VARCHAR(128) NOT NULL', + 'hook' => 'VARCHAR(128) NOT NULL', + 'find_top' => 'TEXT', + 'find_bottom' => 'TEXT', + 'replace_all' => 'INT(1)', + 'replacement' => 'TEXT', + 'replacement_template' => 'VARCHAR(128) NOT NULL', + 'eval' => 'INT(1)', + 'active' => 'INT(1)', + 'dateline' => 'INT(10)' ), ); $columns = array( 'pgsql' => array( - "users" => array( - "show_sidebox" => 'INT DEFAULT 1', + 'users' => array( + 'show_sidebox' => 'INT DEFAULT 1', ), ), - "users" => array( - "show_sidebox" => 'INT(1) DEFAULT 1', + 'users' => array( + 'show_sidebox' => 'INT(1) DEFAULT 1', ), ); $update_themes_link = ""; $settings = array( - "asb_settings" => array( - "group" => array( - "name" => 'asb_settings', - "title" => 'Advanced Sidebox', - "description" => $lang->asb_settingsgroup_description, - "disporder" => '101', - "isdefault" => 0 + 'asb_settings' => array( + 'group' => array( + 'name' => 'asb_settings', + 'title' => 'Advanced Sidebox', + 'description' => $lang->asb_settingsgroup_description, + 'disporder' => '101', + 'isdefault' => 0 ), - "settings" => array( - "asb_show_empty_boxes" => array( - "sid" => '0', - "name" => 'asb_show_empty_boxes', - "title" => $lang->asb_show_empty_boxes . ':', - "description" => $db->escape_string($lang->asb_show_empty_boxes_desc), - "optionscode" => 'yesno', - "value" => '1', - "disporder" => '10' + 'settings' => array( + 'asb_show_empty_boxes' => array( + 'sid' => '0', + 'name' => 'asb_show_empty_boxes', + 'title' => $lang->asb_show_empty_boxes . ':', + 'description' => $db->escape_string($lang->asb_show_empty_boxes_desc), + 'optionscode' => 'yesno', + 'value' => '1', + 'disporder' => '10' ), - "asb_show_toggle_icons" => array( - "sid" => '0', - "name" => 'asb_show_toggle_icons', - "title" => $lang->asb_show_toggle_icons, - "description" => '', - "optionscode" => 'yesno', - "value" => '0', - "disporder" => '20' + 'asb_show_toggle_icons' => array( + 'sid' => '0', + 'name' => 'asb_show_toggle_icons', + 'title' => $lang->asb_show_toggle_icons, + 'description' => '', + 'optionscode' => 'yesno', + 'value' => '0', + 'disporder' => '20' ), - "asb_show_expanders" => array( - "sid" => '0', - "name" => 'asb_show_expanders', - "title" => $lang->asb_show_expanders, - "description" => '', - "optionscode" => 'yesno', - "value" => '1', - "disporder" => '30' + 'asb_show_expanders' => array( + 'sid' => '0', + 'name' => 'asb_show_expanders', + 'title' => $lang->asb_show_expanders, + 'description' => '', + 'optionscode' => 'yesno', + 'value' => '1', + 'disporder' => '30' ), - "asb_allow_user_disable" => array( - "sid" => '0', - "name" => 'asb_allow_user_disable', - "title" => $lang->asb_allow_user_disable, - "description" => '', - "optionscode" => 'yesno', - "value" => '1', - "disporder" => '40' + 'asb_allow_user_disable' => array( + 'sid' => '0', + 'name' => 'asb_allow_user_disable', + 'title' => $lang->asb_allow_user_disable, + 'description' => '', + 'optionscode' => 'yesno', + 'value' => '1', + 'disporder' => '40' ), - "asb_minify_js" => array( - "sid" => '0', - "name" => 'asb_minify_js', - "title" => $lang->asb_minify_js_title, - "description" => $lang->asb_minify_js_desc, - "optionscode" => 'yesno', - "value" => '1', - "disporder" => '50' + 'asb_minify_js' => array( + 'sid' => '0', + 'name' => 'asb_minify_js', + 'title' => $lang->asb_minify_js_title, + 'description' => $lang->asb_minify_js_desc, + 'optionscode' => 'yesno', + 'value' => '1', + 'disporder' => '50' ), - "asb_exclude_theme" => array( - "sid" => '0', - "name" => 'asb_exclude_theme', - "title" => $lang->asb_theme_exclude_list . ':', - "description" => $db->escape_string($lang->asb_theme_exclude_list_description . $update_themes_link), - "optionscode" => $db->escape_string(asb_build_theme_exclude_select()), - "value" => '', - "disporder" => '60' + 'asb_exclude_theme' => array( + 'sid' => '0', + 'name' => 'asb_exclude_theme', + 'title' => $lang->asb_theme_exclude_list . ':', + 'description' => $db->escape_string($lang->asb_theme_exclude_list_description . $update_themes_link), + 'optionscode' => $db->escape_string(asb_build_theme_exclude_select()), + 'value' => '', + 'disporder' => '60' ), - "asb_disable_for_mobile" => array( - "sid" => '0', - "name" => 'asb_disable_for_mobile', - "title" => $lang->asb_disable_for_mobile_title . ':', - "description" => $lang->asb_disable_for_mobile_description, - "optionscode" => 'yesno', - "value" => '0', - "disporder" => '70' + 'asb_disable_for_mobile' => array( + 'sid' => '0', + 'name' => 'asb_disable_for_mobile', + 'title' => $lang->asb_disable_for_mobile_title . ':', + 'description' => $lang->asb_disable_for_mobile_description, + 'optionscode' => 'yesno', + 'value' => '0', + 'disporder' => '70' ), ) ) ); $templates = array( - "asb" => array( - "group" => array( - "prefix" => 'asb', - "title" => $lang->asb, + 'asb' => array( + 'group' => array( + 'prefix' => 'asb', + 'title' => $lang->asb, ), - "templates" => array( - "asb_begin" => << array( + 'asb_begin' => << {\$left_content} EOF , - "asb_end" => << << {\$right_content} EOF , - "asb_sidebox_column" => << << {\$sideboxes} {\$content_pad} EOF , - "asb_wrapped_sidebox" => << << @@ -249,10 +249,10 @@ ); $styleSheets = array( - "folder" => 'asb', - "acp" => array( - "global" => array( - "stylesheet" => << 'asb', + 'acp' => array( + 'global' => array( + 'stylesheet' => << 'asb', - "forum" => array( - "left_arrow.png" => array( - "image" => << 'asb', + 'forum' => array( + 'left_arrow.png' => array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "donate.png" => array( - "image" => << array( + 'donate.png' => array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << array( - "image" => << array( + 'image' => << $last_read && $last_read) { $thread['newpostlink'] = get_thread_link($thread['tid'], 0, 'newpost'); - eval("\$gotounread = \"" . $templates->get("asb_latest_threads_gotounread") . "\";"); + eval("\$gotounread = \"" . $templates->get('asb_latest_threads_gotounread') . "\";"); $unreadpost = 1; } diff --git a/Upload/inc/plugins/asb/modules/rand_quote.php b/Upload/inc/plugins/asb/modules/rand_quote.php index 41ac65e..a9a8410 100644 --- a/Upload/inc/plugins/asb/modules/rand_quote.php +++ b/Upload/inc/plugins/asb/modules/rand_quote.php @@ -325,7 +325,7 @@ function asb_rand_quote_get_quote($settings, $width) EOF; // eval() the template - eval("\$this_quote = \"" . $templates->get("asb_rand_quote_sidebox") . "\";"); + eval("\$this_quote = \"" . $templates->get('asb_rand_quote_sidebox') . "\";"); return $this_quote; } diff --git a/Upload/inc/plugins/asb/modules/recent_posts.php b/Upload/inc/plugins/asb/modules/recent_posts.php index f1f898a..aef1988 100644 --- a/Upload/inc/plugins/asb/modules/recent_posts.php +++ b/Upload/inc/plugins/asb/modules/recent_posts.php @@ -279,7 +279,7 @@ function recent_posts_get_postlist($settings) $post_excerpt = my_substr($post_excerpt, 0, $settings['max_length']) . $lang->asb_recent_posts_ellipsis; } - eval("\$postlist .= \"" . $templates->get("asb_recent_posts_post") . "\";"); + eval("\$postlist .= \"" . $templates->get('asb_recent_posts_post') . "\";"); $altbg = alt_trow(); } return $postlist; From e29e17b7232bb787d17e4a3946f8cb96f4992cf0 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 21:55:25 -0500 Subject: [PATCH 10/19] For #341 consitstent template calls --- Upload/inc/plugins/asb/forum.php | 10 +++++----- Upload/inc/plugins/asb/functions.php | 4 ++-- Upload/inc/plugins/asb/modules/latest_threads.php | 6 +++--- Upload/inc/plugins/asb/modules/rand_quote.php | 4 ++-- Upload/inc/plugins/asb/modules/recent_posts.php | 2 +- Upload/inc/plugins/asb/modules/search_box.php | 2 +- Upload/inc/plugins/asb/modules/slideshow.php | 4 ++-- Upload/inc/plugins/asb/modules/staff_online_box.php | 2 +- Upload/inc/plugins/asb/modules/statistics.php | 2 +- Upload/inc/plugins/asb/modules/top_poster.php | 12 ++++++------ Upload/inc/plugins/asb/modules/welcome_box.php | 8 ++++---- Upload/inc/plugins/asb/modules/whosonline.php | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php index 29cf5f6..0904d78 100644 --- a/Upload/inc/plugins/asb/forum.php +++ b/Upload/inc/plugins/asb/forum.php @@ -202,7 +202,7 @@ function asb_edit_template($boxes, $width, $script) $closed_id = "asb_{$key}_close"; $open_id = "asb_{$key}_open"; - eval("\$toggles[\$key] = \"" . $templates->get('asb_toggle_icon') . "\";"); + eval("\$toggles[\$key] = \"{$templates->get('asb_toggle_icon')}\";"); } } @@ -218,8 +218,8 @@ function asb_edit_template($boxes, $width, $script) $insert_name = "{$key}_insert"; $sideboxes = $$insert_name; - eval("\$content_pad = \"" . $templates->get('asb_content_pad') . "\";"); - eval("\$content = \"" . $templates->get('asb_sidebox_column') . "\";"); + eval("\$content_pad = \"{$templates->get('asb_content_pad')}\";"); + eval("\$content = \"{$templates->get('asb_sidebox_column')}\";"); $toggle_left = $toggle_right = ''; $toggle_name = "toggle_{$key}"; @@ -234,8 +234,8 @@ function asb_edit_template($boxes, $width, $script) EOF; } } - eval("\$insert_top = \"" . $templates->get('asb_begin') . "\";"); - eval("\$insert_bottom = \"" . $templates->get('asb_end') . "\";"); + eval("\$insert_top = \"{$templates->get('asb_begin')}\";"); + eval("\$insert_bottom = \"{$templates->get('asb_end')}\";"); if (is_array($script['extra_scripts']) && !empty($script['extra_scripts'])) { diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php index 39ea69f..61d18be 100644 --- a/Upload/inc/plugins/asb/functions.php +++ b/Upload/inc/plugins/asb/functions.php @@ -307,9 +307,9 @@ function asb_build_sidebox_content($this_box) $expcolimage = 'collapse.png'; $expaltext = '[-]'; } - eval("\$expander = \"" . $templates->get('asb_expander') . "\";"); + eval("\$expander = \"{$templates->get('asb_expander')}\";"); } - eval("\$content = \"" . $templates->get('asb_wrapped_sidebox') . "\";"); + eval("\$content = \"{$templates->get('asb_wrapped_sidebox')}\";"); } // if there is anything to return diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php index 66287c9..6e4d346 100644 --- a/Upload/inc/plugins/asb/modules/latest_threads.php +++ b/Upload/inc/plugins/asb/modules/latest_threads.php @@ -373,7 +373,7 @@ function asb_latest_threads_get_threadlist($settings, $width) $thread['threadlink'] = get_thread_link($thread['tid']); $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, 'lastpost'); - eval("\$last_poster = \"" . $templates->get($lp_template) . "\";"); + eval("\$last_poster = \"{$templates->get($lp_template)}\";"); $gotounread = ''; $last_read = 0; @@ -410,11 +410,11 @@ function asb_latest_threads_get_threadlist($settings, $width) if ($thread['lastpost'] > $last_read && $last_read) { $thread['newpostlink'] = get_thread_link($thread['tid'], 0, 'newpost'); - eval("\$gotounread = \"" . $templates->get('asb_latest_threads_gotounread') . "\";"); + eval("\$gotounread = \"{$templates->get('asb_latest_threads_gotounread')}\";"); $unreadpost = 1; } - eval("\$threadlist .= \"" . $templates->get('asb_latest_threads_thread') . "\";"); + eval("\$threadlist .= \"{$templates->get('asb_latest_threads_thread')}\";"); $altbg = alt_trow(); } diff --git a/Upload/inc/plugins/asb/modules/rand_quote.php b/Upload/inc/plugins/asb/modules/rand_quote.php index a9a8410..12654dc 100644 --- a/Upload/inc/plugins/asb/modules/rand_quote.php +++ b/Upload/inc/plugins/asb/modules/rand_quote.php @@ -308,7 +308,7 @@ function asb_rand_quote_get_quote($settings, $width) $avatar_alt = $lang->sprintf($lang->asb_random_quote_users_profile, $plain_text_username); - eval("\$read_more = \"" . $templates->get('asb_rand_quote_read_more') . "\";"); + eval("\$read_more = \"{$templates->get('asb_rand_quote_read_more')}\";"); if (my_strlen($rand_post['subject']) > 40) { $rand_post['subject'] = my_substr($rand_post['subject'], 0, 40) . ' . . .'; @@ -325,7 +325,7 @@ function asb_rand_quote_get_quote($settings, $width) EOF; // eval() the template - eval("\$this_quote = \"" . $templates->get('asb_rand_quote_sidebox') . "\";"); + eval("\$this_quote = \"{$templates->get('asb_rand_quote_sidebox')}\";"); return $this_quote; } diff --git a/Upload/inc/plugins/asb/modules/recent_posts.php b/Upload/inc/plugins/asb/modules/recent_posts.php index aef1988..3014578 100644 --- a/Upload/inc/plugins/asb/modules/recent_posts.php +++ b/Upload/inc/plugins/asb/modules/recent_posts.php @@ -279,7 +279,7 @@ function recent_posts_get_postlist($settings) $post_excerpt = my_substr($post_excerpt, 0, $settings['max_length']) . $lang->asb_recent_posts_ellipsis; } - eval("\$postlist .= \"" . $templates->get('asb_recent_posts_post') . "\";"); + eval("\$postlist .= \"{$templates->get('asb_recent_posts_post')}\";"); $altbg = alt_trow(); } return $postlist; diff --git a/Upload/inc/plugins/asb/modules/search_box.php b/Upload/inc/plugins/asb/modules/search_box.php index 4fc81c3..df1c755 100644 --- a/Upload/inc/plugins/asb/modules/search_box.php +++ b/Upload/inc/plugins/asb/modules/search_box.php @@ -86,7 +86,7 @@ function asb_search_box_build_template($args) $lang->load('asb_addon'); } - eval("\$" . $template_var . " = \"" . $templates->get('asb_search') . "\";"); + eval("\$" . $template_var . " = \"{$templates->get('asb_search')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/slideshow.php b/Upload/inc/plugins/asb/modules/slideshow.php index 628e66f..4b98e5e 100644 --- a/Upload/inc/plugins/asb/modules/slideshow.php +++ b/Upload/inc/plugins/asb/modules/slideshow.php @@ -178,7 +178,7 @@ function asb_slideshow_build_template($args) } if ($settings['footer_text'] && $settings['footer_url']) { - eval ("\$footer = \"" . $templates->get('asb_slideshow_footer') . "\";"); + eval ("\$footer = \"{$templates->get('asb_slideshow_footer')}\";"); } $max_width = (int) $settings['max_width']; @@ -186,7 +186,7 @@ function asb_slideshow_build_template($args) $maintain_height = (int) $settings['maintain_height']; $width = $width * .9; - eval("\$\$template_var = \"" . $templates->get('asb_slideshow') . "\";"); + eval("\$\$template_var = \"{$templates->get('asb_slideshow')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/staff_online_box.php b/Upload/inc/plugins/asb/modules/staff_online_box.php index d0aa3b6..af256c7 100644 --- a/Upload/inc/plugins/asb/modules/staff_online_box.php +++ b/Upload/inc/plugins/asb/modules/staff_online_box.php @@ -287,7 +287,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) ++$counter; // add this row to the table - eval("\$online_staff .= \"" . $templates->get("asb_staff_online_bit") . "\";"); + eval("\$online_staff .= \"{$templates->get("asb_staff_online_bit")}\";"); } } diff --git a/Upload/inc/plugins/asb/modules/statistics.php b/Upload/inc/plugins/asb/modules/statistics.php index ba259fa..145c585 100644 --- a/Upload/inc/plugins/asb/modules/statistics.php +++ b/Upload/inc/plugins/asb/modules/statistics.php @@ -95,7 +95,7 @@ function asb_statistics_build_template($args) $newestmember = build_profile_link($last_username, $statistics['lastuid']); } - eval("\$" . $template_var . " = \"" . $templates->get('asb_statistics') . "\";"); + eval("\$" . $template_var . " = \"{$templates->get('asb_statistics')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/top_poster.php b/Upload/inc/plugins/asb/modules/top_poster.php index dc4486e..6f736b0 100644 --- a/Upload/inc/plugins/asb/modules/top_poster.php +++ b/Upload/inc/plugins/asb/modules/top_poster.php @@ -303,7 +303,7 @@ function asb_top_poster_build_template($args) $top_poster_posts = $lang->asb_top_poster_no_posts; $top_poster_text = $lang->asb_top_poster_no_top_poster; $top_poster_avatar = ''; - eval("\$\$template_var = \"" . $templates->get('asb_top_posters_single') . "\";"); + eval("\$\$template_var = \"{$templates->get('asb_top_posters_single')}\";"); return false; } @@ -357,9 +357,9 @@ function asb_top_poster_build_template($args) $avatar_width = (int) $settings['avatar_size']; } - eval("\$top_poster_avatar = \"" . $templates->get('asb_top_poster_avatar') . "\";"); + eval("\$top_poster_avatar = \"{$templates->get('asb_top_poster_avatar')}\";"); - eval("\$\$template_var = \"" . $templates->get('asb_top_posters_single') . "\";"); + eval("\$\$template_var = \"{$templates->get('asb_top_posters_single')}\";"); } else { $top_poster_description = $lang->sprintf($lang->asb_top_poster_description, $top_poster_timeframe_prelude) . $extraCongrats; if ($threadsOnly) { @@ -371,15 +371,15 @@ function asb_top_poster_build_template($args) if ((int) $settings['avatar_size']) { $avatar_width = (int) $settings['avatar_size']; } - eval("\$top_poster_avatar = \"" . $templates->get('asb_top_poster_avatar') . "\";"); + eval("\$top_poster_avatar = \"{$templates->get('asb_top_poster_avatar')}\";"); - eval("\$top_posters .= \"" . $templates->get('asb_top_poster') . "\";"); + eval("\$top_posters .= \"{$templates->get('asb_top_poster')}\";"); } $altbg = alt_trow(); } if ($db->num_rows($query) > 1) { - eval("\$\$template_var .= \"" . $templates->get('asb_top_posters_multiple') . "\";"); + eval("\$\$template_var .= \"{$templates->get('asb_top_posters_multiple')}\";"); } return true; } diff --git a/Upload/inc/plugins/asb/modules/welcome_box.php b/Upload/inc/plugins/asb/modules/welcome_box.php index c4fd4ec..a0f86d7 100644 --- a/Upload/inc/plugins/asb/modules/welcome_box.php +++ b/Upload/inc/plugins/asb/modules/welcome_box.php @@ -92,7 +92,7 @@ function asb_welcome_box_build_template($args) if ($mybb->user['uid'] != 0) { // Get number of new posts, threads, announcements - $query = $db->simple_select('posts', 'COUNT(pid) AS newposts', "visible=1 AND dateline > '{$mybb->user['lastvisit']}' $unviewwhere"); + $query = $db->simple_select('posts', 'COUNT(pid) AS newposts', "visible=1 AND dateline > '{$mybb->user['lastvisit']}' {$unviewwhere}"); $newposts = $db->fetch_field($query, 'newposts'); if ($newposts) { // If there aren't any new posts, there is no point in wasting two more queries @@ -149,7 +149,7 @@ function asb_welcome_box_build_template($args) {$mybb->user['username']}'s profile  EOF; - eval("\$welcometext = \"" . $templates->get("asb_welcome_membertext") . "\";"); + eval("\$welcometext = \"{$templates->get('asb_welcome_membertext')}\";"); } else { $lang->asb_welcome_guest_welcome_registration = $lang->sprintf($lang->asb_welcome_guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register'); $mybb->user['username'] = $lang->guest; @@ -167,11 +167,11 @@ function asb_welcome_box_build_template($args) $username = $lang->username; break; } - eval("\$welcometext = \"" . $templates->get('asb_welcome_guesttext') . "\";"); + eval("\$welcometext = \"{$templates->get('asb_welcome_guesttext')}\";"); } $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']); - eval("\$" . $template_var . " = \"" . $templates->get('asb_welcome') . "\";"); + eval("\$" . $template_var . " = \"{$templates->get('asb_welcome')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/whosonline.php b/Upload/inc/plugins/asb/modules/whosonline.php index 0367e3c..52778ee 100644 --- a/Upload/inc/plugins/asb/modules/whosonline.php +++ b/Upload/inc/plugins/asb/modules/whosonline.php @@ -267,11 +267,11 @@ function asb_whosonline_get_online_members($settings, $width) $enough_already = true; // . . . and insert link to the WOL full list - eval("\$onlinemembers .= \"" . $templates->get('asb_whosonline_memberbit_see_all', 1, 0) . "\";"); + eval("\$onlinemembers .= \"{$templates->get('asb_whosonline_memberbit_see_all', 1, 0)}\";"); } // . . . otherwise, add it to the list } else { - eval("\$onlinemembers .= \"" . $templates->get('asb_whosonline_memberbit_avatar', 1, 0) . "\";"); + eval("\$onlinemembers .= \"{$templates->get('asb_whosonline_memberbit_avatar', 1, 0)}\";"); // If we reach the end of the row, insert a
if (($membercount - (($row - 1) * $rowlength)) == $rowlength) { @@ -282,7 +282,7 @@ function asb_whosonline_get_online_members($settings, $width) } } else { $user['username'] = format_name(trim($user['username']), $user['usergroup'], $user['displaygroup']); - eval("\$onlinemembers .= \"" . $templates->get('asb_whosonline_memberbit_name', 1, 0) . "\";"); + eval("\$onlinemembers .= \"{$templates->get('asb_whosonline_memberbit_name', 1, 0)}\";"); $sep = $lang->comma . ' '; } } else { @@ -327,7 +327,7 @@ function asb_whosonline_get_online_members($settings, $width) $lang->asb_wol_online_counts = $lang->sprintf($lang->asb_wol_online_counts, $membercount, $guestcount); if ($membercount) { - eval("\$onlinemembers = \"" . $templates->get('asb_whosonline') . "\";"); + eval("\$onlinemembers = \"{$templates->get('asb_whosonline')}\";"); return $onlinemembers; } else { return false; From 428734694f550c6defb81e0489a82002ae70bf09 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 22:22:29 -0500 Subject: [PATCH 11/19] For #341 array list trailing comma --- Upload/inc/plugins/asb/acp.php | 8 ++-- Upload/inc/plugins/asb/cleanup.php | 2 +- Upload/inc/plugins/asb/forum.php | 6 +-- Upload/inc/plugins/asb/functions.php | 2 +- Upload/inc/plugins/asb/functions_acp.php | 44 +++++++++---------- Upload/inc/plugins/asb/functions_addon.php | 2 +- Upload/inc/plugins/asb/install_data.php | 28 ++++++------ .../plugins/asb/modules/staff_online_box.php | 2 +- Upload/inc/plugins/asb/modules/whosonline.php | 2 +- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index 944ed42..87c8992 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -449,7 +449,7 @@ function asb_admin_edit_box() 'permissions' => $lang->asb_modal_tab_permissions, 'pages' => $lang->asb_modal_tab_pages, 'themes' => $lang->asb_modal_tab_themes, - 'settings' => $lang->asb_modal_tab_settings + 'settings' => $lang->asb_modal_tab_settings, ); // we only need a 'Settings' tab if the current module type has settings @@ -891,7 +891,7 @@ function asb_admin_custom_boxes() indentWithTabs: true, indentUnit: 4, mode: "text/html", - theme: "mybb" + theme: "mybb", }); EOF; @@ -1158,7 +1158,7 @@ function asb_admin_manage_scripts() 'replace_all' => 0, 'eval' => 0, 'width_left' => 160, - 'width_right' => 160 + 'width_right' => 160, ); if ($mybb->input['mode'] == 'edit') { @@ -1290,7 +1290,7 @@ function asb_admin_manage_scripts() editorFindTop = CodeMirror.fromTextArea(document.getElementById("find_top"), options).setSize('100%', 80); editorFindBottom = CodeMirror.fromTextArea(document.getElementById("find_bottom"), options).setSize('100%', 80); - editorReplacement = CodeMirror.fromTextArea(document.getElementById("replacement"), options).setSize('100%', 300);; + editorReplacement = CodeMirror.fromTextArea(document.getElementById("replacement"), options).setSize('100%', 300); EOF; diff --git a/Upload/inc/plugins/asb/cleanup.php b/Upload/inc/plugins/asb/cleanup.php index ec9cfe4..1b820dd 100644 --- a/Upload/inc/plugins/asb/cleanup.php +++ b/Upload/inc/plugins/asb/cleanup.php @@ -17,7 +17,7 @@ 'jscripts/adv_sidebox.js', "{$config['admin_dir']}/jscripts/adv_sidebox_acp.js", "{$config['admin_dir']}/styles/adv_sidebox_acp.css", - 'inc/plugins/asb/cleanup.php' + 'inc/plugins/asb/cleanup.php', ); $removed_folders = array( diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php index 0904d78..0f9c273 100644 --- a/Upload/inc/plugins/asb/forum.php +++ b/Upload/inc/plugins/asb/forum.php @@ -42,7 +42,7 @@ function asb_start() $width = $boxes = array( 0 => '', - 1 => '' + 1 => '', ); // make sure this script's width is within range 120-800 (120 because the templates @@ -171,11 +171,11 @@ function asb_edit_template($boxes, $width, $script) $toggle_info['left'] = array( 'close' => array( 'img' => "{$theme['imgdir']}/asb/left_arrow.png", - 'alt' => '<' + 'alt' => '<', ), 'open' => array( 'img' => "{$theme['imgdir']}/asb/right_arrow.png", - 'alt' => '>' + 'alt' => '>', ) ); $toggle_info['right']['close'] = $toggle_info['left']['open']; diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php index 61d18be..5124bf1 100644 --- a/Upload/inc/plugins/asb/functions.php +++ b/Upload/inc/plugins/asb/functions.php @@ -92,7 +92,7 @@ function asb_build_script_filename($this_script = '') $this_script = array( 'filename' => THIS_SCRIPT, 'action' => $mybb->input['action'], - 'page' => $mybb->input['page'] + 'page' => $mybb->input['page'], ); } diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php index ad536b5..1f25c46 100644 --- a/Upload/inc/plugins/asb/functions_acp.php +++ b/Upload/inc/plugins/asb/functions_acp.php @@ -74,40 +74,40 @@ function asb_output_tabs($current) // set up tabs $sub_tabs['asb'] = array( - 'title' => $lang->asb_manage_sideboxes, - 'link' => $html->url(), - 'description' => $lang->asb_manage_sideboxes_desc + 'title' => $lang->asb_manage_sideboxes, + 'link' => $html->url(), + 'description' => $lang->asb_manage_sideboxes_desc, ); $sub_tabs['asb_custom'] = array( - 'title' => $lang->asb_custom_boxes, - 'link' => $html->url(array('action' => 'custom_boxes')), - 'description' => $lang->asb_custom_boxes_desc + 'title' => $lang->asb_custom_boxes, + 'link' => $html->url(array('action' => 'custom_boxes')), + 'description' => $lang->asb_custom_boxes_desc, ); if (in_array($current, array('asb_add_custom', 'asb_custom'))) { $sub_tabs['asb_add_custom'] = array( - 'title' => $lang->asb_add_custom, - 'link' => $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')), - 'description' => $lang->asb_add_custom_desc + 'title' => $lang->asb_add_custom, + 'link' => $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')), + 'description' => $lang->asb_add_custom_desc, ); } $sub_tabs['asb_scripts'] = array( - 'title' => $lang->asb_manage_scripts, - 'link' => $html->url(array('action' => 'manage_scripts')), - 'description' => $lang->asb_manage_scripts_desc + 'title' => $lang->asb_manage_scripts, + 'link' => $html->url(array('action' => 'manage_scripts')), + 'description' => $lang->asb_manage_scripts_desc, ); if (in_array($current, array('asb_edit_script', 'asb_scripts'))) { $sub_tabs['asb_edit_script'] = array( - 'title' => $lang->asb_edit_script, - 'link' => $html->url(array('action' => 'manage_scripts', 'mode' => 'edit')), - 'description' => $lang->asb_edit_script_desc + 'title' => $lang->asb_edit_script, + 'link' => $html->url(array('action' => 'manage_scripts', 'mode' => 'edit')), + 'description' => $lang->asb_edit_script_desc, ); } $sub_tabs['asb_modules'] = array( - 'title' => $lang->asb_manage_modules, - 'link' => $html->url(array('action' => 'manage_modules')), - 'description' => $lang->asb_manage_modules_desc + 'title' => $lang->asb_manage_modules, + 'link' => $html->url(array('action' => 'manage_modules')), + 'description' => $lang->asb_manage_modules_desc, ); $page->output_nav_tabs($sub_tabs, $current); } @@ -460,18 +460,18 @@ function asb_detect_script_info($filename, $selected = array()) 'hook' => array( 'pattern' => "#\\\$plugins->run_hooks\([\"|'|"]([\w|_]*)[\"|'|"](.*?)\)#i", 'filter' => '_do_', - 'plural' => $lang->asb_hooks + 'plural' => $lang->asb_hooks, ), 'template' => array( 'pattern' => "#\\\$templates->get\([\"|'|"]([\w|_]*)[\"|'|"](.*?)\)#i", 'filter' => '', - 'plural' => $lang->asb_templates + 'plural' => $lang->asb_templates, ), 'action' => array( 'pattern' => "#\\\$mybb->input\[[\"|'|"]action[\"|'|"]\] == [\"|'|"]([\w|_]*)[\"|'|"]#i", 'filter' => '', - 'plural' => $lang->asb_actions - ) + 'plural' => $lang->asb_actions, + ), ); $form = new Form('', '', '', 0, '', true); diff --git a/Upload/inc/plugins/asb/functions_addon.php b/Upload/inc/plugins/asb/functions_addon.php index e904ed2..ff93cdf 100644 --- a/Upload/inc/plugins/asb/functions_addon.php +++ b/Upload/inc/plugins/asb/functions_addon.php @@ -19,7 +19,7 @@ function asb_strip_quotes($message) $pattern = array( "#\[quote=([\"']|"|)(.*?)(?:\\1)(.*?)(?:[\"']|")?\](.*?)\[/quote\](\r\n?|\n?)#si", "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si", - "#\[\/quote\](\r\n?|\n?)#si" + "#\[\/quote\](\r\n?|\n?)#si", ); do { diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php index b7cfcf1..d09bdfb 100644 --- a/Upload/inc/plugins/asb/install_data.php +++ b/Upload/inc/plugins/asb/install_data.php @@ -21,7 +21,7 @@ 'themes' => 'TEXT', 'settings' => 'TEXT', 'wrap_content' => 'INT', - 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)' + 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)', ), 'asb_custom_sideboxes' => array( 'id' => 'SERIAL', @@ -29,7 +29,7 @@ 'description' => 'VARCHAR(128) NOT NULL', 'wrap_content' => 'INT', 'content' => 'TEXT', - 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)' + 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)', ), 'asb_script_info' => array( 'id' => 'SERIAL', @@ -48,7 +48,7 @@ 'replacement_template' => 'VARCHAR(128) NOT NULL', 'eval' => 'INT', 'active' => 'INT', - 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)' + 'dateline' => 'INT NOT NULL, PRIMARY KEY(id)', ), ), 'asb_sideboxes' => array( @@ -63,7 +63,7 @@ 'themes' => 'TEXT', 'settings' => 'TEXT', 'wrap_content' => 'INT(1)', - 'dateline' => 'INT(10)' + 'dateline' => 'INT(10)', ), 'asb_custom_sideboxes' => array( 'id' => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', @@ -71,7 +71,7 @@ 'description' => 'VARCHAR(128) NOT NULL', 'wrap_content' => 'INT(1)', 'content' => 'TEXT', - 'dateline' => 'INT(10)' + 'dateline' => 'INT(10)', ), 'asb_script_info' => array( 'id' => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY', @@ -90,7 +90,7 @@ 'replacement_template' => 'VARCHAR(128) NOT NULL', 'eval' => 'INT(1)', 'active' => 'INT(1)', - 'dateline' => 'INT(10)' + 'dateline' => 'INT(10)', ), ); @@ -114,7 +114,7 @@ 'title' => 'Advanced Sidebox', 'description' => $lang->asb_settingsgroup_description, 'disporder' => '101', - 'isdefault' => 0 + 'isdefault' => 0, ), 'settings' => array( 'asb_show_empty_boxes' => array( @@ -124,7 +124,7 @@ 'description' => $db->escape_string($lang->asb_show_empty_boxes_desc), 'optionscode' => 'yesno', 'value' => '1', - 'disporder' => '10' + 'disporder' => '10', ), 'asb_show_toggle_icons' => array( 'sid' => '0', @@ -133,7 +133,7 @@ 'description' => '', 'optionscode' => 'yesno', 'value' => '0', - 'disporder' => '20' + 'disporder' => '20', ), 'asb_show_expanders' => array( 'sid' => '0', @@ -142,7 +142,7 @@ 'description' => '', 'optionscode' => 'yesno', 'value' => '1', - 'disporder' => '30' + 'disporder' => '30', ), 'asb_allow_user_disable' => array( 'sid' => '0', @@ -151,7 +151,7 @@ 'description' => '', 'optionscode' => 'yesno', 'value' => '1', - 'disporder' => '40' + 'disporder' => '40', ), 'asb_minify_js' => array( 'sid' => '0', @@ -160,7 +160,7 @@ 'description' => $lang->asb_minify_js_desc, 'optionscode' => 'yesno', 'value' => '1', - 'disporder' => '50' + 'disporder' => '50', ), 'asb_exclude_theme' => array( 'sid' => '0', @@ -169,7 +169,7 @@ 'description' => $db->escape_string($lang->asb_theme_exclude_list_description . $update_themes_link), 'optionscode' => $db->escape_string(asb_build_theme_exclude_select()), 'value' => '', - 'disporder' => '60' + 'disporder' => '60', ), 'asb_disable_for_mobile' => array( 'sid' => '0', @@ -178,7 +178,7 @@ 'description' => $lang->asb_disable_for_mobile_description, 'optionscode' => 'yesno', 'value' => '0', - 'disporder' => '70' + 'disporder' => '70', ), ) ) diff --git a/Upload/inc/plugins/asb/modules/staff_online_box.php b/Upload/inc/plugins/asb/modules/staff_online_box.php index af256c7..ef4ea23 100644 --- a/Upload/inc/plugins/asb/modules/staff_online_box.php +++ b/Upload/inc/plugins/asb/modules/staff_online_box.php @@ -61,7 +61,7 @@ function asb_staff_online_box_info() 'description' => $lang->asb_xmlhttp_on_description, 'optionscode' => 'text', 'value' => '0', - ) + ), ), 'discarded_templates' => array( 'asb_staff_online', diff --git a/Upload/inc/plugins/asb/modules/whosonline.php b/Upload/inc/plugins/asb/modules/whosonline.php index 52778ee..1314bfd 100644 --- a/Upload/inc/plugins/asb/modules/whosonline.php +++ b/Upload/inc/plugins/asb/modules/whosonline.php @@ -68,7 +68,7 @@ function asb_whosonline_info() 'description' => $lang->asb_xmlhttp_on_description, 'optionscode' => 'text', 'value' => '0', - ) + ), ), 'templates' => array( array( From 9d159d5cf23a02ac2f1a2cd30df072fcb442a765 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Fri, 12 Oct 2018 22:46:23 -0500 Subject: [PATCH 12/19] For #341 string concatenation --- Upload/inc/plugins/asb.php | 10 ++-- Upload/inc/plugins/asb/acp.php | 60 +++++++++---------- .../inc/plugins/asb/classes/CustomSidebox.php | 2 +- .../asb/classes/SideboxExternalModule.php | 4 +- Upload/inc/plugins/asb/cleanup.php | 6 +- Upload/inc/plugins/asb/forum.php | 18 +++--- Upload/inc/plugins/asb/functions.php | 18 +++--- Upload/inc/plugins/asb/functions_acp.php | 20 +++---- Upload/inc/plugins/asb/functions_addon.php | 10 ++-- Upload/inc/plugins/asb/install.php | 14 ++--- Upload/inc/plugins/asb/install_data.php | 10 ++-- Upload/inc/plugins/asb/modules/forum_age.php | 6 +- .../plugins/asb/modules/latest_threads.php | 8 +-- Upload/inc/plugins/asb/modules/rand_quote.php | 14 ++--- .../inc/plugins/asb/modules/recent_posts.php | 12 ++-- Upload/inc/plugins/asb/modules/search_box.php | 2 +- .../plugins/asb/modules/staff_online_box.php | 12 ++-- Upload/inc/plugins/asb/modules/statistics.php | 2 +- Upload/inc/plugins/asb/modules/top_poster.php | 8 +-- .../inc/plugins/asb/modules/welcome_box.php | 4 +- Upload/inc/plugins/asb/modules/whosonline.php | 12 ++-- Upload/inc/plugins/asb/upgrade.php | 12 ++-- 22 files changed, 132 insertions(+), 132 deletions(-) diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php index 0aefe13..9ea4ed2 100644 --- a/Upload/inc/plugins/asb.php +++ b/Upload/inc/plugins/asb.php @@ -14,7 +14,7 @@ // for modules define('IN_ASB', true); -define('ASB_MODULES_DIR', MYBB_ROOT . 'inc/plugins/asb/modules'); +define('ASB_MODULES_DIR', MYBB_ROOT.'inc/plugins/asb/modules'); define('ASB_VERSION', '3.1.14'); define('ASB_CUSTOM_VERSION', '2.0'); define('ASB_SCRIPT_VERSION', '2.0'); @@ -23,13 +23,13 @@ spl_autoload_register('asbClassAutoload'); // some basic functions used everywhere -require_once MYBB_ROOT . 'inc/plugins/asb/functions.php'; +require_once MYBB_ROOT.'inc/plugins/asb/functions.php'; // load the install/admin routines only if in ACP. if (defined('IN_ADMINCP')) { - require_once MYBB_ROOT . 'inc/plugins/asb/acp.php'; + require_once MYBB_ROOT.'inc/plugins/asb/acp.php'; } else { - require_once MYBB_ROOT . 'inc/plugins/asb/forum.php'; + require_once MYBB_ROOT.'inc/plugins/asb/forum.php'; } /** @@ -38,7 +38,7 @@ * @param string the name of the class to load */ function asbClassAutoload($className) { - $path = MYBB_ROOT . "inc/plugins/asb/classes/{$className}.php"; + $path = MYBB_ROOT."inc/plugins/asb/classes/{$className}.php"; if (file_exists($path)) { require_once $path; diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index 87c8992..acc2f73 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -14,8 +14,8 @@ die('Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.'); } define('ASB_URL', 'index.php?module=config-asb'); -require_once MYBB_ROOT . 'inc/plugins/asb/functions_acp.php'; -require_once MYBB_ROOT . 'inc/plugins/asb/install.php'; +require_once MYBB_ROOT.'inc/plugins/asb/functions_acp.php'; +require_once MYBB_ROOT.'inc/plugins/asb/install.php'; /** * the ACP page router @@ -56,7 +56,7 @@ function asb_admin() } // if there is an existing function for the action - $page_function = 'asb_admin_' . $mybb->input['action']; + $page_function = 'asb_admin_'.$mybb->input['action']; if (function_exists($page_function)) { // run it $page_function(); @@ -303,7 +303,7 @@ function asb_admin_edit_box() $sidebox->set('wrap_content', $parent->get('wrap_content')); $addon_settings = $parent->get('settings'); - // if the parent module has settings . . . + // if the parent module has settings... if (is_array($addon_settings)) { // loop through them $settings = array(); @@ -322,7 +322,7 @@ function asb_admin_edit_box() $sidebox->set('wrap_content', $parent->get('wrap_content')); } - // if the text field isn't empty . . . + // if the text field isn't empty... if ($mybb->input['box_title']) { // use it $sidebox->set('title', $mybb->input['box_title']); @@ -400,7 +400,7 @@ function asb_admin_edit_box() } else { $page_title = $lang->asb_edit_a_sidebox; - // . . . otherwise we are editing so pull the actual info from the side box + // ...otherwise we are editing so pull the actual info from the side box $selected_scripts = $sidebox->get('scripts'); if (empty($selected_scripts)) { $selected_scripts = 'all_scripts'; @@ -411,7 +411,7 @@ function asb_admin_edit_box() EOF; } - // check the name of the add-on/custom against the display name of the sidebox, if they differ . . . + // check the name of the add-on/custom against the display name of the sidebox, if they differ... if ($sidebox->get('title') != $parent->get('title')) { // then this box has a custom title $custom_title = 1; @@ -479,7 +479,7 @@ function asb_admin_edit_box() } // current editing text - $currently_editing = '"' . $parent->get('title') . '"'; + $currently_editing = '"'.$parent->get('title').'"'; $box_action = $lang->asb_creating; if (isset($mybb->input['id'])) { @@ -487,17 +487,17 @@ function asb_admin_edit_box() } echo "\n
\n"; - $form_container = new FormContainer('

' . $lang->sprintf($lang->asb_new_sidebox_action, $box_action, $currently_editing) . '

'); + $form_container = new FormContainer('

'.$lang->sprintf($lang->asb_new_sidebox_action, $box_action, $currently_editing).'

'); if (!$ajax) { // box title - $form_container->output_row($lang->asb_custom_title, $current_title, $form->generate_text_box('box_title') . $form->generate_hidden_field('current_title', $sidebox->get('title')), 'box_title', array('id' => 'box_title')); + $form_container->output_row($lang->asb_custom_title, $current_title, $form->generate_text_box('box_title').$form->generate_hidden_field('current_title', $sidebox->get('title')), 'box_title', array('id' => 'box_title')); // title link $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')), 'title_link', array('id' => 'title_link')); // position - $form_container->output_row($lang->asb_position, '', $form->generate_radio_button('box_position', 0, $lang->asb_position_left, array('checked' => ($sidebox->get('position') == 0))) . '  ' . $form->generate_radio_button('box_position', 1, $lang->asb_position_right, array('checked' => ($sidebox->get('position') != 0)))); + $form_container->output_row($lang->asb_position, '', $form->generate_radio_button('box_position', 0, $lang->asb_position_left, array('checked' => ($sidebox->get('position') == 0))).'  '.$form->generate_radio_button('box_position', 1, $lang->asb_position_right, array('checked' => ($sidebox->get('position') != 0)))); // display order $form_container->output_row($lang->asb_display_order, '', $form->generate_text_box('display_order', $sidebox->get('display_order'))); @@ -506,7 +506,7 @@ function asb_admin_edit_box() $form_container->output_row($lang->asb_title, $current_title, $form->generate_text_box('box_title'), 'box_title', array('id' => 'box_title')); // title link and hidden fields - $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')) . $form->generate_hidden_field('current_title', $sidebox->get('title')) . $form->generate_hidden_field('display_order', $sidebox->get('display_order')) . $form->generate_hidden_field('pos', $position), 'title_link', array('id' => 'title_link')); + $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')).$form->generate_hidden_field('current_title', $sidebox->get('title')).$form->generate_hidden_field('display_order', $sidebox->get('display_order')).$form->generate_hidden_field('pos', $position), 'title_link', array('id' => 'title_link')); } $form_container->end(); @@ -708,7 +708,7 @@ function asb_admin_custom_boxes() admin_redirect($html->url(array('action' => 'custom_boxes'))); } - require_once MYBB_ROOT . 'inc/class_xml.php'; + require_once MYBB_ROOT.'inc/class_xml.php'; $parser = new XMLParser($contents); $tree = $parser->get_tree(); @@ -817,9 +817,9 @@ function asb_admin_custom_boxes() $action = $lang->asb_add_custom; if ($this_box->get('id')) { - $specify_box = '&id=' . $this_box->get('id'); - $currently_editing = $lang->asb_editing . ': ' . $this_box->get('title') . ''; - $action = $lang->asb_edit . ' ' . $this_box->get('title'); + $specify_box = '&id='.$this_box->get('id'); + $currently_editing = $lang->asb_editing.': '.$this_box->get('title').''; + $action = $lang->asb_edit.' '.$this_box->get('title'); } else { // new box $specify_box = ''; @@ -847,7 +847,7 @@ function asb_admin_custom_boxes() $page->output_header("{$lang->asb} - {$action}"); asb_output_tabs('asb_add_custom'); - $form = new Form($html->url(array('action' => 'custom_boxes')) . $specify_box, 'post', 'edit_box'); + $form = new Form($html->url(array('action' => 'custom_boxes')).$specify_box, 'post', 'edit_box'); $form_container = new FormContainer($currently_editing); $form_container->output_cell($lang->asb_name); @@ -911,7 +911,7 @@ function asb_admin_custom_boxes() $new_box_url = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')); $new_box_link = $html->link($new_box_url, $lang->asb_add_custom_box_types, array('style' => 'font-weight: bold;', 'title' => $lang->asb_add_custom_box_types, 'icon' => "styles/{$cp_style}/images/asb/add.png"), array('alt' => '+', 'style' => 'margin-bottom: -3px;', 'title' => $lang->asb_add_custom_box_types)); - echo($new_box_link . '

'); + echo($new_box_link.'

'); $table = new Table; $table->construct_header($lang->asb_name); @@ -920,7 +920,7 @@ function asb_admin_custom_boxes() $custom = asb_get_all_custom(); - // if there are saved types . . . + // if there are saved types... if (is_array($custom) && !empty($custom)) { // display them @@ -941,7 +941,7 @@ function asb_admin_custom_boxes() $table->construct_cell($description, array('width' => '60%')); // options popup - $popup = new PopupMenu('box_' . $data['id'], $lang->asb_options); + $popup = new PopupMenu('box_'.$data['id'], $lang->asb_options); // edit $popup->add_item($lang->asb_edit, $edit_url); @@ -1234,7 +1234,7 @@ function asb_admin_manage_scripts() $spinner = <<
EOF; @@ -1245,7 +1245,7 @@ function asb_admin_manage_scripts() $form_container->output_row("{$lang->asb_filename}:", $lang->asb_filename_desc, '
'.$form->generate_text_box('filename', $data['filename'], array('id' => 'filename'))); - $form_container->output_row("{$lang->asb_action}:", $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_action)), "{$spinner}
{$detected_info['actions']}
" . $form->generate_text_box('script_action', $data['action'], array('id' => 'action'))); + $form_container->output_row("{$lang->asb_action}:", $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_action)), "{$spinner}
{$detected_info['actions']}
".$form->generate_text_box('script_action', $data['action'], array('id' => 'action'))); $form_container->output_row($lang->asb_page, $lang->sprintf($lang->asb_scriptvar_generic_desc, strtolower($lang->asb_page)), $form->generate_text_box('page', $data['page'])); $form_container->output_row($lang->asb_width_left, $lang->asb_width_left_desc, $form->generate_text_box('width_left', $data['width_left'])); @@ -1253,11 +1253,11 @@ function asb_admin_manage_scripts() $form_container->output_row("{$lang->asb_output_to_vars}?", $lang->sprintf($lang->asb_output_to_vars_desc, '$asb_left and $asb_right'), $form->generate_yes_no_radio('eval', $data['eval'], true, array('id' => 'eval_yes', 'class' => 'eval'), array('id' => 'eval_no', 'class' => 'eval')), '', array(), array('id' => 'var_output')); - $form_container->output_row("{$lang->asb_template}:", $lang->asb_template_desc, "{$spinner}
{$detected_info['templates']}
" . $form->generate_text_box('template_name', $data['template_name'], array('id' => 'template_name')), '', array(), array('id' => 'template_row')); - $form_container->output_row("{$lang->asb_hook}:", $lang->asb_hook_desc, "{$spinner}
{$detected_info['hooks']}
" . $form->generate_text_box('hook', $data['hook'], array('id' => 'hook')), '', array(), array('id' => 'hook_row')); + $form_container->output_row("{$lang->asb_template}:", $lang->asb_template_desc, "{$spinner}
{$detected_info['templates']}
".$form->generate_text_box('template_name', $data['template_name'], array('id' => 'template_name')), '', array(), array('id' => 'template_row')); + $form_container->output_row("{$lang->asb_hook}:", $lang->asb_hook_desc, "{$spinner}
{$detected_info['hooks']}
".$form->generate_text_box('hook', $data['hook'], array('id' => 'hook')), '', array(), array('id' => 'hook_row')); $form_container->output_row($lang->asb_header_search_text, $lang->asb_header_search_text_desc, $form->generate_text_area('find_top', $data['find_top'], array('id' => 'find_top', 'class' => '', 'style' => 'width: 100%;', 'rows' => '3')), '', array(), array('id' => 'header_search')); - $form_container->output_row($lang->asb_footer_search_text, $lang->asb_footer_search_text_desc, $form->generate_text_area('find_bottom', $data['find_bottom'], array('id' => 'find_bottom', 'class' => '', 'style' => 'width: 100%; height: 100px;')) . $form->generate_hidden_field('id', $data['id']) . $form->generate_hidden_field('active', $data['active']) . $form->generate_hidden_field('action', 'manage_scripts') . $form->generate_hidden_field('mode', 'edit'), '', array(), array('id' => 'footer_search')); + $form_container->output_row($lang->asb_footer_search_text, $lang->asb_footer_search_text_desc, $form->generate_text_area('find_bottom', $data['find_bottom'], array('id' => 'find_bottom', 'class' => '', 'style' => 'width: 100%; height: 100px;')).$form->generate_hidden_field('id', $data['id']).$form->generate_hidden_field('active', $data['active']).$form->generate_hidden_field('action', 'manage_scripts').$form->generate_hidden_field('mode', 'edit'), '', array(), array('id' => 'footer_search')); $form_container->output_row($lang->asb_replace_template, $lang->asb_replace_template_desc, $form->generate_yes_no_radio('replace_all', $data['replace_all'], true, array('id' => 'replace_all_yes', 'class' => 'replace_all'), array('id' => 'replace_all_no', 'class' => 'replace_all')), '', array(), array('id' => 'replace_all')); @@ -1319,7 +1319,7 @@ function asb_admin_manage_scripts() $new_script_url = $html->url(array('action' => 'manage_scripts', 'mode' => 'edit')); $new_script_link = $html->link($new_script_url, $lang->asb_add_new_script, array('style' => 'font-weight: bold;', 'title' => $lang->asb_add_new_script, 'icon' => "styles/{$cp_style}/images/asb/add.png"), array('alt' => '+', 'title' => $lang->asb_add_new_script, 'style' => 'margin-bottom: -3px;')); - echo($new_script_link . '

'); + echo($new_script_link.'

'); $form = new Form($html->url(array('action' => 'manage_scripts', 'mode' => 'inline')), 'post', 'inline_form'); @@ -1461,10 +1461,10 @@ function asb_admin_manage_modules() } // title - $table->construct_cell($html->link($data['module_site'], $data['title'], array('style' => 'font-weight: bold;')) . " ({$version})"); + $table->construct_cell($html->link($data['module_site'], $data['title'], array('style' => 'font-weight: bold;'))." ({$version})"); // description - $table->construct_cell($data['description'] . $out_of_date); + $table->construct_cell($data['description'].$out_of_date); if ($data['author'] == 'Wildcard') { $data['author'] = 'default'; @@ -1479,7 +1479,7 @@ function asb_admin_manage_modules() $table->construct_cell($author); // options pop-up - $popup = new PopupMenu('module_' . $data['baseName'], $lang->asb_options); + $popup = new PopupMenu('module_'.$data['baseName'], $lang->asb_options); // delete $popup->add_item($lang->asb_delete, $html->url(array('action' => 'delete_addon', 'addon' => $data['baseName'])), "return confirm('{$lang->asb_modules_del_warning}');"); @@ -1601,7 +1601,7 @@ function asb_admin_xmlhttp() EOF; // this HTML output will be directly stored in the side box's representative
- echo(asb_build_sidebox_info($sidebox, false, true) . $script); + echo(asb_build_sidebox_info($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 diff --git a/Upload/inc/plugins/asb/classes/CustomSidebox.php b/Upload/inc/plugins/asb/classes/CustomSidebox.php index c502a6a..c5b1bc8 100644 --- a/Upload/inc/plugins/asb/classes/CustomSidebox.php +++ b/Upload/inc/plugins/asb/classes/CustomSidebox.php @@ -60,7 +60,7 @@ public function __construct($data = '') public function load($data) { if (parent::load($data)) { - $this->baseName = 'asb_custom_' . $this->id; + $this->baseName = 'asb_custom_'.$this->id; return true; } return false; diff --git a/Upload/inc/plugins/asb/classes/SideboxExternalModule.php b/Upload/inc/plugins/asb/classes/SideboxExternalModule.php index 0cf23c8..263656b 100644 --- a/Upload/inc/plugins/asb/classes/SideboxExternalModule.php +++ b/Upload/inc/plugins/asb/classes/SideboxExternalModule.php @@ -147,10 +147,10 @@ public function install($cleanup = true) { global $db; - // already installed? unless $cleanup is specifically denied . . . + // already installed? unless $cleanup is specifically denied... if ($this->isInstalled && $cleanup) { - // . . . remove the leftovers before installing + // ...remove the leftovers before installing $this->uninstall(); } diff --git a/Upload/inc/plugins/asb/cleanup.php b/Upload/inc/plugins/asb/cleanup.php index 1b820dd..85cb379 100644 --- a/Upload/inc/plugins/asb/cleanup.php +++ b/Upload/inc/plugins/asb/cleanup.php @@ -26,7 +26,7 @@ // delete the old adv_sidebox_xxx files and folders foreach ($removed_files as $filename) { - $fullpath = MYBB_ROOT . $filename; + $fullpath = MYBB_ROOT.$filename; if (file_exists($fullpath) && !is_dir($fullpath)) { @@ -34,14 +34,14 @@ } } foreach ($removed_folders as $folder) { - $fullpath = MYBB_ROOT . $folder; + $fullpath = MYBB_ROOT.$folder; if (is_dir($fullpath)) { @my_rmdir_recursive($fullpath); @rmdir($fullpath); } } -require_once MYBB_ROOT . $config['admin_dir'] . '/inc/functions.php'; +require_once MYBB_ROOT.$config['admin_dir'].'/inc/functions.php'; flash_message('All components of previous installation deleted', 'success'); admin_redirect("{$mybb->settings['bburl']}/{$config['admin_dir']}/index.php?module=config-plugins"); diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php index 0f9c273..10f40eb 100644 --- a/Upload/inc/plugins/asb/forum.php +++ b/Upload/inc/plugins/asb/forum.php @@ -58,7 +58,7 @@ function asb_start() } // functions for add-on modules - require_once MYBB_ROOT . 'inc/plugins/asb/functions_addon.php'; + require_once MYBB_ROOT.'inc/plugins/asb/functions_addon.php'; // loop through all the boxes for the script foreach ($this_script['sideboxes'] as $pos => $sideboxes) { @@ -161,7 +161,7 @@ function asb_edit_template($boxes, $width, $script) $toggles = $show = array(); $filename = THIS_SCRIPT; - // if admin wants to show the toggle icons . . . + // if admin wants to show the toggle icons... if ($mybb->settings['asb_show_toggle_icons']) { // we will need this js $headerinclude .= <<add_hook($this_script['hook'], 'asb_start', 9); // cache any script-specific templates (read: templates used by add-ons used in the script) $template_list = ''; if (is_array($this_script['templates']) && !empty($this_script['templates'])) { - $template_list = ',' . implode(',', $this_script['templates']); + $template_list = ','.implode(',', $this_script['templates']); } // add the extra templates (if any) to our base stack global $templatelist; - $templatelist .= ',asb_begin,asb_end,asb_sidebox_column,asb_wrapped_sidebox,asb_toggle_icon,asb_content_pad,asb_expander' . $template_list; + $templatelist .= ',asb_begin,asb_end,asb_sidebox_column,asb_wrapped_sidebox,asb_toggle_icon,asb_content_pad,asb_expander'.$template_list; } /** @@ -437,7 +437,7 @@ function asb_xmlhttp() } // get the ASB core stuff - require_once MYBB_ROOT . 'inc/plugins/asb/functions_addon.php'; + require_once MYBB_ROOT.'inc/plugins/asb/functions_addon.php'; // attempt to load the module and side box requested $module = new SideboxExternalModule($mybb->input['addon']); diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php index 5124bf1..4aec01c 100644 --- a/Upload/inc/plugins/asb/functions.php +++ b/Upload/inc/plugins/asb/functions.php @@ -16,7 +16,7 @@ function asb_do_checks() { global $mybb, $theme; - // if the EXCLUDE list isn't empty and this theme is listed . . . + // if the EXCLUDE list isn't empty and this theme is listed... $exclude_list = asb_get_excluded_themes(); if ($exclude_list && in_array($theme['tid'], $exclude_list)) { @@ -65,7 +65,7 @@ function asb_get_excluded_themes($sql = false) if ($sql) { if ($retval) { - $retval = ' AND pid NOT IN(' . implode(',', $retval) . ')'; + $retval = ' AND pid NOT IN('.implode(',', $retval).')'; } else { $retval = ''; } @@ -98,7 +98,7 @@ function asb_build_script_filename($this_script = '') $this_script = array_map('trim', $this_script); - // if there is nothing to work with . . . + // if there is nothing to work with... if (!$this_script['filename']) { return; } @@ -137,7 +137,7 @@ function asb_get_this_script($asb, $get_all = false) continue; } - $filename = THIS_SCRIPT . "&{$key}={$mybb->input[$key]}"; + $filename = THIS_SCRIPT."&{$key}={$mybb->input[$key]}"; if (!is_array($asb['scripts'][$filename]) || empty($asb['scripts'][$filename])) { continue; @@ -179,7 +179,7 @@ function asb_merge_sidebox_list($asb) // allow for variable amount of arguments $args = func_get_args(); - // if there aren't at least two arrays to merge . . . + // if there aren't at least two arrays to merge... if (count($args) <= 2) { // return the single array if it exists if ($args[1]) { @@ -275,16 +275,16 @@ function asb_build_sidebox_content($this_box) } // build the template variable - $content = '{$' . "{$box_type}_{$id}" . '}'; + $content = '{$'."{$box_type}_{$id}".'}'; - // if we are building header and expander . . . + // if we are building header and expander... if ($wrap_content) { global $mybb, $templates, $theme, $collapsed; // element info $sidebox['expcolimage_id'] = "{$box_type}_{$id}_img"; $sidebox['expdisplay_id'] = "{$box_type}_{$id}_e"; - $sidebox['name'] = "{$id}_{$box_type}_" . TIME_NOW; + $sidebox['name'] = "{$id}_{$box_type}_".TIME_NOW; $sidebox['class'] = $sidebox['id'] = "{$box_type}_main_{$id}"; $sidebox['content'] = $content; $sidebox['title'] = $title; @@ -376,7 +376,7 @@ function asb_get_all_custom() $query = $db->simple_select('asb_custom_sideboxes'); if ($db->num_rows($query) > 0) { while ($data = $db->fetch_array($query)) { - $return_array['asb_custom_' . $data['id']] = new CustomSidebox($data); + $return_array['asb_custom_'.$data['id']] = new CustomSidebox($data); } } return $return_array; diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php index 1f25c46..c512c2f 100644 --- a/Upload/inc/plugins/asb/functions_acp.php +++ b/Upload/inc/plugins/asb/functions_acp.php @@ -140,8 +140,8 @@ function asb_build_footer_menu($page_key = '') $page_key = 'manage_sideboxes'; } - $help_link = ' ' . asb_build_help_link($page_key); - $settings_link = ' ' . asb_build_settings_menu_link(); + $help_link = ' '.asb_build_help_link($page_key); + $settings_link = ' '.asb_build_settings_menu_link(); if ($page_key == 'manage_sideboxes') { $filter_links = asb_build_filter_selector($mybb->input['page']); @@ -249,7 +249,7 @@ function asb_build_visibility_rows($sidebox, &$group_count, &$global) $script_title_full = ''; if (strlen($script_title) > 15) { $script_title_full = $script_title; - $script_title = substr($script_title, 0, 15) . '...'; + $script_title = substr($script_title, 0, 15).'...'; } $script_rows .= <<get('box_type'); // visibility table - $visibility = '' . asb_build_permissions_table($sidebox) . ''; + $visibility = ''.asb_build_permissions_table($sidebox).''; // edit link $edit_link = $html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module, 'pos' => $pos)); @@ -441,7 +441,7 @@ function asb_detect_script_info($filename, $selected = array()) ); } - $full_path = '../' . trim($filename); + $full_path = '../'.trim($filename); if (!file_exists($full_path)) { return array( 'error' => 2, @@ -502,7 +502,7 @@ function asb_detect_script_info($filename, $selected = array()) $$array_name = array_reverse($$array_name); // store the HTML select box - $return_array[$array_name] = '' . $lang->asb_detected . ' ' . $info[$key]['plural'] . ':
' . $form->generate_select_box("{$array_name}_options", $$array_name, $selected[$key], array('id' => "{$key}_selector")) . '

'; + $return_array[$array_name] = ''.$lang->asb_detected.' '.$info[$key]['plural'].':
'.$form->generate_select_box("{$array_name}_options", $$array_name, $selected[$key], array('id' => "{$key}_selector")).'

'; } else { $varName = "asb_ajax_{$array_name}"; $noContent = $lang->sprintf($lang->asb_ajax_nothing_found, $lang->$varName); @@ -564,7 +564,7 @@ function asb_build_filter_selector($filter) { global $all_scripts; - // if there are active scripts . . . + // if there are active scripts... if (!is_array($all_scripts) || empty($all_scripts)) { return; @@ -597,8 +597,8 @@ function asb_build_setting($this_form, $this_form_container, $setting) $row_id = "row_{$element_id}"; // prepare labels - $this_label = '' . htmlspecialchars_uni($setting['title']) . ''; - $this_desc = '' . $setting['description'] . ''; + $this_label = ''.htmlspecialchars_uni($setting['title']).''; + $this_desc = ''.$setting['description'].''; // sort by type if ($type[0] == 'text' || @@ -620,7 +620,7 @@ function asb_build_setting($this_form, $this_form_container, $setting) $this_form_container->output_row($this_label, $this_desc, $this_form->generate_password_box($element_name, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); } else if ($type[0] == 'php') { $setting['optionscode'] = substr($setting['optionscode'], 3); - eval("\$setting_code = \"" . $setting['optionscode'] . "\";"); + eval("\$setting_code = \"".$setting['optionscode']."\";"); } else { for ($i=0; $i < count($type); $i++) { $optionsexp = explode('=', $type[$i]); diff --git a/Upload/inc/plugins/asb/functions_addon.php b/Upload/inc/plugins/asb/functions_addon.php index ff93cdf..2f2bc04 100644 --- a/Upload/inc/plugins/asb/functions_addon.php +++ b/Upload/inc/plugins/asb/functions_addon.php @@ -37,7 +37,7 @@ function asb_strip_quotes($message) */ function asb_strip_url($message) { - $message = ' ' . $message; + $message = ' '.$message; $message = preg_replace("#([\>\s\(\)])(http|https|ftp|news){1}://([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", '', $message); $message = preg_replace("#([\>\s\(\)])(www|ftp)\.(([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", '', $message); return my_substr($message, 1); @@ -103,7 +103,7 @@ function asb_build_SQL_where($conditions, $op = 'AND', $prefix = '', $wrap = tru $sep = ''; foreach ($conditions as $condition) { if ($condition) { - $where .= $sep . $condition; + $where .= $sep.$condition; $sep = " {$op} "; } } @@ -133,7 +133,7 @@ function asb_get_folder_images($folder, $subfolder = '', $recursive = false) { // bad folder, get out if (!$folder || - !is_dir(MYBB_ROOT . $folder)) { + !is_dir(MYBB_ROOT.$folder)) { return false; } @@ -145,7 +145,7 @@ function asb_get_folder_images($folder, $subfolder = '', $recursive = false) // cycle through all the files/folders and produce a list $sep = ''; - foreach (new DirectoryIterator(MYBB_ROOT . $folder) as $file) { + foreach (new DirectoryIterator(MYBB_ROOT.$folder) as $file) { // skip navigation folders if ($file->isDot()) { continue; @@ -158,7 +158,7 @@ function asb_get_folder_images($folder, $subfolder = '', $recursive = false) } // get the files from this directory - $sub_files = asb_get_folder_images($folder . '/' . $file->getFilename(), $subfolder . $file->getFilename(), $recursive); + $sub_files = asb_get_folder_images($folder.'/'.$file->getFilename(), $subfolder.$file->getFilename(), $recursive); if ($sub_files) { $filenames .= "{$sep}{$sub_files}"; $sep = ','; diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php index ef54e21..86f484b 100644 --- a/Upload/inc/plugins/asb/install.php +++ b/Upload/inc/plugins/asb/install.php @@ -29,8 +29,8 @@ function asb_info() $extra_links = '
'; $settings_link = asb_build_settings_link(); if ($settings_link) { - if (file_exists(MYBB_ROOT . 'inc/plugins/asb/cleanup.php') && - file_exists(MYBB_ROOT . 'inc/plugins/adv_sidebox/acp_functions.php')) { + if (file_exists(MYBB_ROOT.'inc/plugins/asb/cleanup.php') && + file_exists(MYBB_ROOT.'inc/plugins/adv_sidebox/acp_functions.php')) { $remove_link = << @@ -141,7 +141,7 @@ function asb_install() asb_create_script_info(); - @unlink(MYBB_ROOT . 'inc/plugins/adv_sidebox.php'); + @unlink(MYBB_ROOT.'inc/plugins/adv_sidebox.php'); } /** @@ -156,12 +156,12 @@ function asb_activate() $myCache = AdvancedSideboxCache::getInstance(); - // if we just upgraded . . . + // if we just upgraded... $asbOldVersion = $myCache->getVersion(); if (isset($asbOldVersion) && $asbOldVersion && version_compare($asbOldVersion, ASB_VERSION, '<')) { - require_once MYBB_ROOT . 'inc/plugins/asb/upgrade.php'; + require_once MYBB_ROOT.'inc/plugins/asb/upgrade.php'; } $myCache->setVersion(ASB_VERSION); @@ -250,7 +250,7 @@ function asb_get_settingsgroup() function asb_build_settings_url($gid) { if ($gid) { - return 'index.php?module=config-settings&action=change&gid=' . $gid; + return 'index.php?module=config-settings&action=change&gid='.$gid; } } @@ -442,7 +442,7 @@ function asb_build_theme_exclude_select() foreach ($all_themes as $tid => $name) { $name = addcslashes($name, '"'); $theme_select .= <<{$name} + EOF; } diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php index d09bdfb..055b7a1 100644 --- a/Upload/inc/plugins/asb/install_data.php +++ b/Upload/inc/plugins/asb/install_data.php @@ -105,7 +105,7 @@ ), ); -$update_themes_link = ""; +$update_themes_link = ""; $settings = array( 'asb_settings' => array( @@ -120,7 +120,7 @@ 'asb_show_empty_boxes' => array( 'sid' => '0', 'name' => 'asb_show_empty_boxes', - 'title' => $lang->asb_show_empty_boxes . ':', + 'title' => $lang->asb_show_empty_boxes.':', 'description' => $db->escape_string($lang->asb_show_empty_boxes_desc), 'optionscode' => 'yesno', 'value' => '1', @@ -165,8 +165,8 @@ 'asb_exclude_theme' => array( 'sid' => '0', 'name' => 'asb_exclude_theme', - 'title' => $lang->asb_theme_exclude_list . ':', - 'description' => $db->escape_string($lang->asb_theme_exclude_list_description . $update_themes_link), + 'title' => $lang->asb_theme_exclude_list.':', + 'description' => $db->escape_string($lang->asb_theme_exclude_list_description.$update_themes_link), 'optionscode' => $db->escape_string(asb_build_theme_exclude_select()), 'value' => '', 'disporder' => '60', @@ -174,7 +174,7 @@ 'asb_disable_for_mobile' => array( 'sid' => '0', 'name' => 'asb_disable_for_mobile', - 'title' => $lang->asb_disable_for_mobile_title . ':', + 'title' => $lang->asb_disable_for_mobile_title.':', 'description' => $lang->asb_disable_for_mobile_description, 'optionscode' => 'yesno', 'value' => '0', diff --git a/Upload/inc/plugins/asb/modules/forum_age.php b/Upload/inc/plugins/asb/modules/forum_age.php index 7f7234c..4008534 100644 --- a/Upload/inc/plugins/asb/modules/forum_age.php +++ b/Upload/inc/plugins/asb/modules/forum_age.php @@ -195,7 +195,7 @@ function asb_forum_age_get_forum_age($args) $start = $settings['forum_age_date_format']; $age = TIME_NOW - $creationDateStamp; foreach ($allInfo as $i => $info) { - $varName = $info['name'] . 's'; + $varName = $info['name'].'s'; $$varName = 0; if ($age > $info['inSeconds']) { @@ -216,7 +216,7 @@ function asb_forum_age_get_forum_age($args) // remove increments before the selected value that are empty for ($x = 2; $x < 8; $x++) { - $varName = $allInfo[$x - 1]['name'] . 's'; + $varName = $allInfo[$x - 1]['name'].'s'; if ($settings['forum_age_date_format'] >= $x && $$varName == 0) { array_shift($forumAgeArray); @@ -231,7 +231,7 @@ function asb_forum_age_get_forum_age($args) // add "and" if there is more than one entry if (count($forumAgeArray) > 1) { - $forumAgeArray[count($forumAgeArray) - 1] = $lang->asb_forum_age_and . $forumAgeArray[count($forumAgeArray) - 1]; + $forumAgeArray[count($forumAgeArray) - 1] = $lang->asb_forum_age_and.$forumAgeArray[count($forumAgeArray) - 1]; } // compile the time text diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php index 6e4d346..9ccb01a 100644 --- a/Upload/inc/plugins/asb/modules/latest_threads.php +++ b/Upload/inc/plugins/asb/modules/latest_threads.php @@ -248,7 +248,7 @@ function asb_latest_threads_get_threadlist($settings, $width) } // Build a post parser - require_once MYBB_ROOT . 'inc/class_parser.php'; + require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new postParser; // get forums user cannot view @@ -281,7 +281,7 @@ function asb_latest_threads_get_threadlist($settings, $width) $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 't.tid'); $where['show'] = asb_build_SQL_where($show, ' OR '); $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT '); - $query_where = $new_threads . $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND '); + $query_where = $new_threads.$important_threads.$unviewwhere.$inactivewhere.asb_build_SQL_where($where, ' AND ', ' AND '); $altbg = alt_trow(); $threadlist = ''; @@ -293,7 +293,7 @@ function asb_latest_threads_get_threadlist($settings, $width) LEFT JOIN {$db->table_prefix}users u ON (u.uid=t.lastposteruid) WHERE t.visible='1' AND t.closed NOT LIKE 'moved|%'{$query_where} ORDER BY t.lastpost DESC - LIMIT 0, " . (int) $settings['max_threads'] + LIMIT 0, ".(int) $settings['max_threads'] ); if ($db->num_rows($query) == 0) { @@ -366,7 +366,7 @@ function asb_latest_threads_get_threadlist($settings, $width) $max_len = (int) $settings['max_thread_title_length']; if ($max_len > 0 && my_strlen($thread['subject']) > $max_len) { - $thread['subject'] = my_substr($thread['subject'], 0, $max_len) . $lang->asb_latest_threads_ellipsis; + $thread['subject'] = my_substr($thread['subject'], 0, $max_len).$lang->asb_latest_threads_ellipsis; } $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject'])); diff --git a/Upload/inc/plugins/asb/modules/rand_quote.php b/Upload/inc/plugins/asb/modules/rand_quote.php index 12654dc..e796eb9 100644 --- a/Upload/inc/plugins/asb/modules/rand_quote.php +++ b/Upload/inc/plugins/asb/modules/rand_quote.php @@ -235,7 +235,7 @@ function asb_rand_quote_get_quote($settings, $width) $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 'p.tid'); $where['show'] = asb_build_SQL_where($show, ' OR '); $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT '); - $query_where = $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND '); + $query_where = $important_threads.$unviewwhere.$inactivewhere.asb_build_SQL_where($where, ' AND ', ' AND '); $post_query = $db->query(" SELECT @@ -252,7 +252,7 @@ function asb_rand_quote_get_quote($settings, $width) LIMIT 1;" ); - // if there was 1 . . . + // if there was 1... if ($db->num_rows($post_query) == 0) { return false; } @@ -260,7 +260,7 @@ function asb_rand_quote_get_quote($settings, $width) $rand_post = $db->fetch_array($post_query); // build a post parser - require_once MYBB_ROOT . 'inc/class_parser.php'; + require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new postParser; // we just need the text and smilies (we'll parse them after we check length) @@ -289,19 +289,19 @@ function asb_rand_quote_get_quote($settings, $width) if ($settings['max_length'] && strlen($new_message) > $settings['max_length']) { - $new_message = substr($new_message, 0, $settings['max_length']) . ' . . .'; + $new_message = substr($new_message, 0, $settings['max_length']).'...'; } // set up the user name link so that it displays correctly for the display group of the user $plain_text_username = htmlspecialchars_uni($rand_post['username']); $username = format_name($plain_text_username, $rand_post['usergroup'], $rand_post['displaygroup']); $author_link = get_profile_link($rand_post['uid']); - $post_link = get_post_link($rand_post['pid'], $rand_post['tid']) . '#pid' . $rand_post['pid']; + $post_link = get_post_link($rand_post['pid'], $rand_post['tid']).'#pid'.$rand_post['pid']; $thread_link = get_thread_link($rand_post['tid']); // allow smilies, but kill $parser_options = array('allow_smilies' => 1); - $new_message = str_replace(array('
', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message . ' ', $parser_options)); + $new_message = str_replace(array('
', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message.' ', $parser_options)); $avatar_info = format_avatar($rand_post['avatar']); $avatar_filename = $avatar_info['image']; @@ -311,7 +311,7 @@ function asb_rand_quote_get_quote($settings, $width) eval("\$read_more = \"{$templates->get('asb_rand_quote_read_more')}\";"); if (my_strlen($rand_post['subject']) > 40) { - $rand_post['subject'] = my_substr($rand_post['subject'], 0, 40) . ' . . .'; + $rand_post['subject'] = my_substr($rand_post['subject'], 0, 40).'...'; } if (substr(strtolower($rand_post['subject']), 0, 3) == 're:') { diff --git a/Upload/inc/plugins/asb/modules/recent_posts.php b/Upload/inc/plugins/asb/modules/recent_posts.php index 3014578..5064ec5 100644 --- a/Upload/inc/plugins/asb/modules/recent_posts.php +++ b/Upload/inc/plugins/asb/modules/recent_posts.php @@ -202,7 +202,7 @@ function recent_posts_get_postlist($settings) $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 'p.tid'); $where['show'] = asb_build_SQL_where($show, ' OR '); $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT '); - $query_where = $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND '); + $query_where = $important_threads.$unviewwhere.$inactivewhere.asb_build_SQL_where($where, ' AND ', ' AND '); $altbg = alt_trow(); $maxtitlelen = 48; @@ -221,7 +221,7 @@ function recent_posts_get_postlist($settings) ORDER BY p.dateline DESC LIMIT - 0, " . (int) $settings['max_posts'] + 0, ".(int) $settings['max_posts'] ); if ($db->num_rows($query) == 0) { @@ -230,7 +230,7 @@ function recent_posts_get_postlist($settings) } // Build a post parser - require_once MYBB_ROOT . 'inc/class_parser.php'; + require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new postParser; $post_cache = array(); @@ -264,11 +264,11 @@ function recent_posts_get_postlist($settings) $max_len = (int) $settings['max_thread_title_length']; if ($max_len > 0 && my_strlen($post['subject']) > $max_len) { - $post['subject'] = my_substr($post['subject'], 0, $max_len) . $lang->asb_recent_posts_title_ellipsis; + $post['subject'] = my_substr($post['subject'], 0, $max_len).$lang->asb_recent_posts_title_ellipsis; } $post['subject'] = htmlspecialchars_uni($parser->parse_badwords($post['subject'])); - $post['link'] = get_post_link($post['pid'], $post['tid']) . "#pid{$post['pid']}"; + $post['link'] = get_post_link($post['pid'], $post['tid'])."#pid{$post['pid']}"; // we just need the text and smilies (we'll parse them after we check length) $pattern = "|[[\/\!]*?[^\[\]]*?]|si"; @@ -276,7 +276,7 @@ function recent_posts_get_postlist($settings) if ($settings['max_length'] && strlen($post_excerpt) > $settings['max_length']) { - $post_excerpt = my_substr($post_excerpt, 0, $settings['max_length']) . $lang->asb_recent_posts_ellipsis; + $post_excerpt = my_substr($post_excerpt, 0, $settings['max_length']).$lang->asb_recent_posts_ellipsis; } eval("\$postlist .= \"{$templates->get('asb_recent_posts_post')}\";"); diff --git a/Upload/inc/plugins/asb/modules/search_box.php b/Upload/inc/plugins/asb/modules/search_box.php index df1c755..30ebc70 100644 --- a/Upload/inc/plugins/asb/modules/search_box.php +++ b/Upload/inc/plugins/asb/modules/search_box.php @@ -86,7 +86,7 @@ function asb_search_box_build_template($args) $lang->load('asb_addon'); } - eval("\$" . $template_var . " = \"{$templates->get('asb_search')}\";"); + eval("\$".$template_var." = \"{$templates->get('asb_search')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/staff_online_box.php b/Upload/inc/plugins/asb/modules/staff_online_box.php index ef4ea23..6d378ce 100644 --- a/Upload/inc/plugins/asb/modules/staff_online_box.php +++ b/Upload/inc/plugins/asb/modules/staff_online_box.php @@ -186,7 +186,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) // get all the users of those specific groups $groups_in = implode(',', array_keys($usergroups)); - // if there were no groups . . . + // if there were no groups... if (!$groups_in) { // there is nothing to show return false; @@ -210,7 +210,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) // loop through our users while ($user = $db->fetch_array($query)) { - // if displaygroup is not 0 (display primary group) . . . + // if displaygroup is not 0, display primary group if ($user['displaygroup'] != 0) { // then use this group $group = $user['displaygroup']; @@ -231,7 +231,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) // loop through each user group foreach ($usergroups as $usergroup) { - // if there are no users or we have reached our limit . . . + // if there are no users or we have reached our limit... if (!isset($usergroup['user_list']) || $counter > $max_rows) { // skip an iteration continue; @@ -250,7 +250,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) // prepare the info // alt and title for image are the same - $staff_avatar_alt = $staff_avatar_title = $user['username'] . '\'s profile'; + $staff_avatar_alt = $staff_avatar_title = "{$user['username']}'s profile"; // if the user has an avatar then display it, otherwise force the default avatar. $avatar_info = format_avatar($user['avatar']); @@ -269,7 +269,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) // badge alt and title are the same $staff_badge_alt = $staff_badge_title = $usergroup['usertitle']; - // if the user's group has a badge image . . . + // if the user's group has a badge image... $staff_badge = $staff_badge_alt; if ($usergroup['image']) { // store it (if nothing is store alt property will display group default usertitle) @@ -291,7 +291,7 @@ function asb_staff_online_box_get_online_staff($settings, $width) } } - // if there were staff members online . . . + // if there were staff members online... if ($online_staff) { // show them return $online_staff; diff --git a/Upload/inc/plugins/asb/modules/statistics.php b/Upload/inc/plugins/asb/modules/statistics.php index 145c585..22817d2 100644 --- a/Upload/inc/plugins/asb/modules/statistics.php +++ b/Upload/inc/plugins/asb/modules/statistics.php @@ -95,7 +95,7 @@ function asb_statistics_build_template($args) $newestmember = build_profile_link($last_username, $statistics['lastuid']); } - eval("\$" . $template_var . " = \"{$templates->get('asb_statistics')}\";"); + eval("\$".$template_var." = \"{$templates->get('asb_statistics')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/top_poster.php b/Upload/inc/plugins/asb/modules/top_poster.php index 6f736b0..0f204d8 100644 --- a/Upload/inc/plugins/asb/modules/top_poster.php +++ b/Upload/inc/plugins/asb/modules/top_poster.php @@ -227,7 +227,7 @@ function asb_top_poster_build_template($args) $thread_where = " AND p.tid='{$tid}'"; $threadQuery = $db->simple_select('threads', 'subject', "tid='{$tid}'"); if ($db->num_rows($threadQuery) > 0) { - require_once MYBB_ROOT . 'inc/class_parser.php'; + require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new postParser; $threadTitle = $db->fetch_field($threadQuery, 'subject'); @@ -361,11 +361,11 @@ function asb_top_poster_build_template($args) eval("\$\$template_var = \"{$templates->get('asb_top_posters_single')}\";"); } else { - $top_poster_description = $lang->sprintf($lang->asb_top_poster_description, $top_poster_timeframe_prelude) . $extraCongrats; + $top_poster_description = $lang->sprintf($lang->asb_top_poster_description, $top_poster_timeframe_prelude).$extraCongrats; if ($threadsOnly) { - $top_poster_description = $lang->sprintf($lang->asb_top_poster_description_threads, $top_poster_timeframe_prelude) . $extraCongrats; + $top_poster_description = $lang->sprintf($lang->asb_top_poster_description_threads, $top_poster_timeframe_prelude).$extraCongrats; } - $top_poster_text = $top_poster . '
' . $top_poster_posts; + $top_poster_text = $top_poster.'
'.$top_poster_posts; $avatar_width = (int) $width * .2; if ((int) $settings['avatar_size']) { diff --git a/Upload/inc/plugins/asb/modules/welcome_box.php b/Upload/inc/plugins/asb/modules/welcome_box.php index a0f86d7..8d5ef92 100644 --- a/Upload/inc/plugins/asb/modules/welcome_box.php +++ b/Upload/inc/plugins/asb/modules/welcome_box.php @@ -151,7 +151,7 @@ function asb_welcome_box_build_template($args) eval("\$welcometext = \"{$templates->get('asb_welcome_membertext')}\";"); } else { - $lang->asb_welcome_guest_welcome_registration = $lang->sprintf($lang->asb_welcome_guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register'); + $lang->asb_welcome_guest_welcome_registration = $lang->sprintf($lang->asb_welcome_guest_welcome_registration, $mybb->settings['bburl'].'/member.php?action=register'); $mybb->user['username'] = $lang->guest; switch ($mybb->settings['username_method']) { case 0: @@ -171,7 +171,7 @@ function asb_welcome_box_build_template($args) } $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']); - eval("\$" . $template_var . " = \"{$templates->get('asb_welcome')}\";"); + eval("\$".$template_var." = \"{$templates->get('asb_welcome')}\";"); return true; } diff --git a/Upload/inc/plugins/asb/modules/whosonline.php b/Upload/inc/plugins/asb/modules/whosonline.php index 1314bfd..9759eb6 100644 --- a/Upload/inc/plugins/asb/modules/whosonline.php +++ b/Upload/inc/plugins/asb/modules/whosonline.php @@ -130,7 +130,7 @@ function asb_whosonline_build_template($args) // get the online members $all_onlinemembers = asb_whosonline_get_online_members($settings, $width); - // if there are members online . . . + // if there are members online... if ($all_onlinemembers) { // set out template variable to the returned member list and return true $$template_var = $all_onlinemembers; @@ -263,13 +263,13 @@ function asb_whosonline_get_online_members($settings, $width) $avatar_count) { // check to see if we've already handled this, if so, do nothing if (!$enough_already) { - // . . . if not, set a flag + // ...if not, set a flag $enough_already = true; - // . . . and insert link to the WOL full list + // ...and insert link to the WOL full list eval("\$onlinemembers .= \"{$templates->get('asb_whosonline_memberbit_see_all', 1, 0)}\";"); } - // . . . otherwise, add it to the list + // ...otherwise, add it to the list } else { eval("\$onlinemembers .= \"{$templates->get('asb_whosonline_memberbit_avatar', 1, 0)}\";"); @@ -283,7 +283,7 @@ function asb_whosonline_get_online_members($settings, $width) } else { $user['username'] = format_name(trim($user['username']), $user['usergroup'], $user['displaygroup']); eval("\$onlinemembers .= \"{$templates->get('asb_whosonline_memberbit_name', 1, 0)}\";"); - $sep = $lang->comma . ' '; + $sep = $lang->comma.' '; } } else { --$membercount; @@ -292,7 +292,7 @@ function asb_whosonline_get_online_members($settings, $width) } if (!$settings['show_avatars']) { - $onlinemembers = '' . $onlinemembers . ''; + $onlinemembers = ''.$onlinemembers.''; } $onlinecount = $membercount + $guestcount + $botcount; diff --git a/Upload/inc/plugins/asb/upgrade.php b/Upload/inc/plugins/asb/upgrade.php index fc66c81..956bd7c 100644 --- a/Upload/inc/plugins/asb/upgrade.php +++ b/Upload/inc/plugins/asb/upgrade.php @@ -128,27 +128,27 @@ if (!empty($removedForumFiles)) { foreach ($removedForumFiles as $file) { - @unlink(MYBB_ROOT . $file); + @unlink(MYBB_ROOT.$file); } } if (!empty($removedForumFolders)) { foreach ($removedForumFolders as $folder) { - @my_rmdir_recursive(MYBB_ROOT . $folder); - @rmdir(MYBB_ROOT . $folder); + @my_rmdir_recursive(MYBB_ROOT.$folder); + @rmdir(MYBB_ROOT.$folder); } } if (!empty($removedAdminFiles)) { foreach ($removedAdminFiles as $file) { - @unlink(MYBB_ADMIN_DIR . $file); + @unlink(MYBB_ADMIN_DIR.$file); } } if (!empty($removedAdminFolders)) { foreach ($removedAdminFolders as $folder) { - @my_rmdir_recursive(MYBB_ADMIN_DIR . $folder); - @rmdir(MYBB_ADMIN_DIR . $folder); + @my_rmdir_recursive(MYBB_ADMIN_DIR.$folder); + @rmdir(MYBB_ADMIN_DIR.$folder); } } From ce9fc03336febb29f38868a1b207846c67803139 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sat, 13 Oct 2018 08:16:01 -0500 Subject: [PATCH 13/19] For #341 function argument defaults --- Upload/admin/jscripts/asb/asb_inline.js | 2 +- Upload/inc/plugins/asb.php | 3 ++- Upload/inc/plugins/asb/functions.php | 10 +++++----- Upload/inc/plugins/asb/functions_acp.php | 8 ++++---- Upload/inc/plugins/asb/functions_addon.php | 6 +++--- Upload/inc/plugins/asb/install.php | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Upload/admin/jscripts/asb/asb_inline.js b/Upload/admin/jscripts/asb/asb_inline.js index 85451e4..bc20c37 100644 --- a/Upload/admin/jscripts/asb/asb_inline.js +++ b/Upload/admin/jscripts/asb/asb_inline.js @@ -1,4 +1,4 @@ -/* +/*1 * Plugin Name: Advanced Sidebox for MyBB 1.8.x * Copyright 2014 WildcardSearch * http://www.rantcentralforums.com diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php index 9ea4ed2..2968c72 100644 --- a/Upload/inc/plugins/asb.php +++ b/Upload/inc/plugins/asb.php @@ -37,7 +37,8 @@ * * @param string the name of the class to load */ -function asbClassAutoload($className) { +function asbClassAutoload($className) +{ $path = MYBB_ROOT."inc/plugins/asb/classes/{$className}.php"; if (file_exists($path)) { diff --git a/Upload/inc/plugins/asb/functions.php b/Upload/inc/plugins/asb/functions.php index 4aec01c..08cad15 100644 --- a/Upload/inc/plugins/asb/functions.php +++ b/Upload/inc/plugins/asb/functions.php @@ -53,7 +53,7 @@ function asb_do_checks() * * @return array|bool excluded themes or false */ -function asb_get_excluded_themes($sql = false) +function asb_get_excluded_themes($sql=false) { global $mybb; @@ -79,7 +79,7 @@ function asb_get_excluded_themes($sql = false) * @param array script environment info * @return string filename marked up for asb */ -function asb_build_script_filename($this_script = '') +function asb_build_script_filename($this_script='') { if ($this_script instanceof ScriptInfo) { $this_script = $this_script->get('data'); @@ -122,7 +122,7 @@ function asb_build_script_filename($this_script = '') * should be loaded along with the other info * @return array script info */ -function asb_get_this_script($asb, $get_all = false) +function asb_get_this_script($asb, $get_all=false) { global $mybb; @@ -388,7 +388,7 @@ function asb_get_all_custom() * @param string script filter * @return array SideboxObject */ -function asb_get_all_sideboxes($good_script = '') +function asb_get_all_sideboxes($good_script='') { global $db; @@ -442,7 +442,7 @@ function asb_get_all_scripts() * * @return string|bool html or false */ -function asb_get_all_themes($full = false) +function asb_get_all_themes($full=false) { global $db; diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php index c512c2f..7b07eb6 100644 --- a/Upload/inc/plugins/asb/functions_acp.php +++ b/Upload/inc/plugins/asb/functions_acp.php @@ -13,7 +13,7 @@ * @param string topic keyword * @return string html */ -function asb_build_help_link($topic = '') +function asb_build_help_link($topic='') { global $mybb, $lang, $html, $cp_style; @@ -132,7 +132,7 @@ function asb_output_footer($page_key) * @param string topic key * @return string html */ -function asb_build_footer_menu($page_key = '') +function asb_build_footer_menu($page_key='') { global $mybb; @@ -363,7 +363,7 @@ function asb_build_theme_visibility_list($sidebox, $colspan, $global) * @param bool produce delete link? * @return string html */ -function asb_build_sidebox_info($sidebox, $wrap = true, $ajax = false) +function asb_build_sidebox_info($sidebox, $wrap=true, $ajax=false) { // must be a valid object if ($sidebox instanceof SideboxObject == false || @@ -430,7 +430,7 @@ function asb_cache_has_changed() * @param array * @return array script component information */ -function asb_detect_script_info($filename, $selected = array()) +function asb_detect_script_info($filename, $selected=array()) { global $lang; diff --git a/Upload/inc/plugins/asb/functions_addon.php b/Upload/inc/plugins/asb/functions_addon.php index 2f2bc04..e23648a 100644 --- a/Upload/inc/plugins/asb/functions_addon.php +++ b/Upload/inc/plugins/asb/functions_addon.php @@ -51,7 +51,7 @@ function asb_strip_url($message) * @param bool present the id list as SQL IN()? * @return string id list */ -function asb_build_id_list($ids, $field = 'id', $wrap = true) +function asb_build_id_list($ids, $field='id', $wrap=true) { if (strlen($ids) == 0) { return false; @@ -97,7 +97,7 @@ function asb_build_id_list($ids, $field = 'id', $wrap = true) * @param bool prefix and enclose the conditions in parentheses? * @return string SQL WHERE clause */ -function asb_build_SQL_where($conditions, $op = 'AND', $prefix = '', $wrap = true) +function asb_build_SQL_where($conditions, $op='AND', $prefix='', $wrap=true) { if (is_array($conditions)) { $sep = ''; @@ -129,7 +129,7 @@ function asb_build_SQL_where($conditions, $op = 'AND', $prefix = '', $wrap = tru * @param bool recurse into subfolders? * @return string list of file names */ -function asb_get_folder_images($folder, $subfolder = '', $recursive = false) +function asb_get_folder_images($folder, $subfolder='', $recursive=false) { // bad folder, get out if (!$folder || diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php index 86f484b..c292c5a 100644 --- a/Upload/inc/plugins/asb/install.php +++ b/Upload/inc/plugins/asb/install.php @@ -289,7 +289,7 @@ function asb_build_settings_link() * @param bool return associative array? * @return array|true see above dependency */ -function asb_create_script_info($return = false) +function asb_create_script_info($return=false) { $scripts = array( 'index' => array( From 7743e2beca4d3780a56f3ad2b8ce0a7f98b1e1c2 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sat, 13 Oct 2018 14:29:28 -0500 Subject: [PATCH 14/19] For #341 underscore -> camelCase --- Upload/admin/jscripts/asb/asb_inline.js | 2 +- Upload/inc/plugins/asb/acp.php | 559 ++++++++++----------- Upload/inc/plugins/asb/cleanup.php | 10 +- Upload/inc/plugins/asb/forum.php | 126 ++--- Upload/inc/plugins/asb/functions.php | 170 +++---- Upload/inc/plugins/asb/functions_acp.php | 226 ++++----- Upload/inc/plugins/asb/functions_addon.php | 41 +- Upload/inc/plugins/asb/install.php | 94 ++-- Upload/inc/plugins/asb/install_data.php | 6 +- Upload/inc/plugins/asb/upgrade.php | 10 +- 10 files changed, 621 insertions(+), 623 deletions(-) diff --git a/Upload/admin/jscripts/asb/asb_inline.js b/Upload/admin/jscripts/asb/asb_inline.js index bc20c37..85451e4 100644 --- a/Upload/admin/jscripts/asb/asb_inline.js +++ b/Upload/admin/jscripts/asb/asb_inline.js @@ -1,4 +1,4 @@ -/*1 +/* * Plugin Name: Advanced Sidebox for MyBB 1.8.x * Copyright 2014 WildcardSearch * http://www.rantcentralforums.com diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index acc2f73..f3d5a0c 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -33,7 +33,7 @@ function asb_admin() } // now load up, this is our time - global $mybb, $lang, $html, $scripts, $all_scripts, $min; + global $mybb, $lang, $html, $scripts, $allScripts, $min; if (!$lang->asb) { $lang->load('asb'); } @@ -45,21 +45,21 @@ function asb_admin() // URL, link and image markup generator $html = new HTMLGenerator010000(ASB_URL, array('addon', 'pos', 'topic', 'ajax')); - $scripts = asb_get_all_scripts(); + $scripts = asbGetAllScripts(); if (is_array($scripts) && !empty($scripts)) { foreach ($scripts as $filename => $script) { - $all_scripts[$filename] = $script['title']; + $allScripts[$filename] = $script['title']; } } else { - $scripts = $all_scripts = array(); + $scripts = $allScripts = array(); } // if there is an existing function for the action - $page_function = 'asb_admin_'.$mybb->input['action']; - if (function_exists($page_function)) { + $pageFunction = 'asb_admin_'.$mybb->input['action']; + if (function_exists($pageFunction)) { // run it - $page_function(); + $pageFunction(); } else { // default to the main page asb_admin_manage_sideboxes(); @@ -75,9 +75,9 @@ function asb_admin() */ function asb_admin_manage_sideboxes() { - global $mybb, $db, $page, $lang, $html, $scripts, $all_scripts, $min, $cp_style; + global $mybb, $db, $page, $lang, $html, $scripts, $allScripts, $min, $cp_style; - $addons = asb_get_all_modules(); + $addons = asbGetAllModules(); // if there are add-on modules if (is_array($addons)) { @@ -87,56 +87,56 @@ function asb_admin_manage_sideboxes() continue; } - $id = $box_type = $module->get('baseName'); + $id = $type = $module->get('baseName'); $title = $module->get('title'); - $title_url = $html->url(array('action' => 'edit_box', 'addon' => $box_type)); - $title_link = $html->link($title_url, $title, array('class' => 'add_box_link', 'title' => $lang->asb_add_new_sidebox)); + $titleUrl = $html->url(array('action' => 'edit_box', 'addon' => $type)); + $titleLink = $html->link($titleUrl, $title, array('class' => 'add_box_link', 'title' => $lang->asb_add_new_sidebox)); // add the HTML $modules .= << - {$title_link} + {$titleLink}
EOF; } } - $custom = asb_get_all_custom(); + $custom = asbGetAllCustomBoxes(); // if there are custom boxes if (is_array($custom)) { // display them foreach ($custom as $module) { - $id = $box_type = $module->get('baseName'); + $id = $type = $module->get('baseName'); $title = $module->get('title'); - $title_url = $html->url(array('action' => 'edit_box', 'addon' => $box_type)); - $title_link = $html->link($title_url, $title, array('class' => 'add_box_link', 'title' => $lang->asb_add_new_sidebox)); + $titleUrl = $html->url(array('action' => 'edit_box', 'addon' => $type)); + $titleLink = $html->link($titleUrl, $title, array('class' => 'add_box_link', 'title' => $lang->asb_add_new_sidebox)); // add the HTML - $custom_boxes .= << - {$title_link} + {$titleLink}
EOF; } } - $sideboxes = asb_get_all_sideboxes($mybb->input['page']); + $sideboxes = asbGetAllSideBoxes($mybb->input['page']); // if there are side boxes if (is_array($sideboxes)) { // display them foreach ($sideboxes as $sidebox) { // build the side box - $box = asb_build_sidebox_info($sidebox); + $box = asbBuildSideBoxInfo($sidebox); // and sort it by position if ($sidebox->get('position')) { - $right_boxes .= $box; + $rightBoxes .= $box; } else { - $left_boxes .= $box; + $leftBoxes .= $box; } } } @@ -157,17 +157,17 @@ function asb_admin_manage_sideboxes() EOF; $page->output_header("{$lang->asb} - {$lang->asb_manage_sideboxes}"); - asb_output_tabs('asb'); + asbOutputTabs('asb'); - $filter_text = ''; + $filterText = ''; if ($mybb->input['page']) { - $filter_text = $lang->sprintf($lang->asb_filter_label, $all_scripts[$mybb->input['page']]); + $filterText = $lang->sprintf($lang->asb_filter_label, $allScripts[$mybb->input['page']]); } // build the display $markup = <<{$filter_text} +
{$filterText} @@ -183,13 +183,13 @@ function asb_admin_manage_sideboxes() {$modules} @@ -203,7 +203,7 @@ function asb_admin_manage_sideboxes() echo($markup); // output the link menu and MyBB footer - asb_output_footer('manage_sideboxes'); + asbOutputFooter('manage_sideboxes'); } /** @@ -213,7 +213,7 @@ function asb_admin_manage_sideboxes() */ function asb_admin_edit_box() { - global $page, $lang, $mybb, $db, $html, $scripts, $all_scripts, $min, $cp_style; + global $page, $lang, $mybb, $db, $html, $scripts, $allScripts, $min, $cp_style; $ajax = ($mybb->input['ajax'] == 1); @@ -228,20 +228,20 @@ function asb_admin_edit_box() } } - $is_custom = $is_module = false; - $custom_title = 0; + $isCustom = $isModule = false; + $customTitle = 0; $module = $mybb->input['addon']; $parent = new SideboxExternalModule($module); if (!$parent->isValid()) { // did this box come from a custom static box? - $variable_array = explode('_', $module); - $custom_id = $variable_array[count($variable_array) - 1]; + $namePieces = explode('_', $module); + $customId = $namePieces[count($namePieces) - 1]; - $parent = new CustomSidebox($custom_id); + $parent = new CustomSidebox($customId); if ($parent->isValid()) { - $is_custom = true; + $isCustom = true; } else { flash_message($lang->asb_edit_fail_bad_module, 'error'); if (!$ajax) { @@ -250,7 +250,7 @@ function asb_admin_edit_box() die('asb'); } } else { - $is_module = true; + $isModule = true; } // saving? @@ -262,52 +262,52 @@ function asb_admin_edit_box() (int) $mybb->input['display_order'] == 0) { // get a total number of side boxes on the same side and put it at the bottom $query = $db->simple_select('asb_sideboxes', 'display_order', "position='{$position}'"); - $display_order = (int) (($db->num_rows($query) + 1) * 10); + $displayOrder = (int) (($db->num_rows($query) + 1) * 10); } else { /* * or back off if they entered a value * (standard, non-modal interface for * when JS fails or isn't allowed) */ - $display_order = (int) $mybb->input['display_order']; + $displayOrder = (int) $mybb->input['display_order']; } - $sidebox->set('display_order', $display_order); + $sidebox->set('display_order', $displayOrder); // scripts - $script_list = $mybb->input['script_select_box']; - if ($script_list[0] == 'all_scripts' || - (count($script_list) >= count($all_scripts))) { - $script_list = array(); + $scriptArray = $mybb->input['script_select_box']; + if ($scriptArray[0] == 'all_scripts' || + (count($scriptArray) >= count($allScripts))) { + $scriptArray = array(); } - $sidebox->set('scripts', $script_list); + $sidebox->set('scripts', $scriptArray); // groups - $group_list = $mybb->input['group_select_box']; - if ($group_list[0] == 'all') { - $group_list = array(); + $groupArray = $mybb->input['group_select_box']; + if ($groupArray[0] == 'all') { + $groupArray = array(); } - $sidebox->set('groups', $group_list); + $sidebox->set('groups', $groupArray); // themes - $theme_list = $mybb->input['theme_select_box']; - if ($theme_list[0] == 'all_themes') { - $theme_list = array(); + $themeArray = $mybb->input['theme_select_box']; + if ($themeArray[0] == 'all_themes') { + $themeArray = array(); } - $sidebox->set('themes', $theme_list); + $sidebox->set('themes', $themeArray); // box type $sidebox->set('box_type', $module); $sidebox->set('wrap_content', true); - if ($is_module) { + if ($isModule) { $sidebox->set('wrap_content', $parent->get('wrap_content')); - $addon_settings = $parent->get('settings'); + $addonSettings = $parent->get('settings'); // if the parent module has settings... - if (is_array($addon_settings)) { + if (is_array($addonSettings)) { // loop through them $settings = array(); - foreach ($addon_settings as $setting) { + foreach ($addonSettings as $setting) { // and if the setting has a value if (isset($mybb->input[$setting['name']])) { // store it @@ -317,7 +317,7 @@ function asb_admin_edit_box() $settings = $parent->doSettingsSave($settings); $sidebox->set('settings', $settings); } - } elseif($is_custom) { + } elseif($isCustom) { // use its wrap_content property $sidebox->set('wrap_content', $parent->get('wrap_content')); } @@ -340,8 +340,8 @@ function asb_admin_edit_box() $sidebox->set('title_link', trim($mybb->input['title_link'])); // save the side box - $new_id = $sidebox->save(); - asb_cache_has_changed(); + $newId = $sidebox->save(); + asbCacheHasChanged(); // AJAX? if (!$ajax) { @@ -350,31 +350,31 @@ function asb_admin_edit_box() admin_redirect('index.php?module=config-asb'); } - $column_id = 'left_column'; + $columnKey = 'left_column'; if ($position) { - $column_id = 'right_column'; + $columnKey = 'right_column'; } // creating a new box? - $build_script = ''; + $buildScript = ''; if ($id == 0) { // grab the insert id - $id = $new_id; + $id = $newId; // then escape the title - $box_title = addcslashes($sidebox->get('title'), "'"); + $boxTitle = addcslashes($sidebox->get('title'), "'"); /* * create the new
representation of the side box * (title only it will be filled in later by the updater) */ - $build_script = "ASB.sidebox.createDiv({$id}, '{$box_title}', '{$column_id}'); "; + $buildScript = "ASB.sidebox.createDiv({$id}, '{$boxTitle}', '{$columnKey}'); "; } // update the side box after we're done via AJAX $script = << -{$build_script}ASB.sidebox.updateDiv({$id}); +{$buildScript}ASB.sidebox.updateDiv({$id}); EOF; @@ -384,29 +384,29 @@ function asb_admin_edit_box() } if ($id == 0) { - $page_title = $lang->asb_add_a_sidebox; + $pageTitle = $lang->asb_add_a_sidebox; // this is a new box, check the page view filter to try to predict which script the user will want if ($mybb->input['page']) { // start them out with the script they are viewing for Which Scripts - $selected_scripts[] = $mybb->input['page']; + $selectedScripts[] = $mybb->input['page']; } else { // if page isn't set at all then just start out with all scripts - $selected_scripts = 'all_scripts'; + $selectedScripts = 'all_scripts'; } - $custom_title = 0; - $current_title = ''; + $customTitle = 0; + $currentTitle = ''; } else { - $page_title = $lang->asb_edit_a_sidebox; + $pageTitle = $lang->asb_edit_a_sidebox; // ...otherwise we are editing so pull the actual info from the side box - $selected_scripts = $sidebox->get('scripts'); - if (empty($selected_scripts)) { - $selected_scripts = 'all_scripts'; - } elseif (isset($selected_scripts[0]) && - strlen($selected_scripts[0]) == 0) { - $script_warning = <<get('scripts'); + if (empty($selectedScripts)) { + $selectedScripts = 'all_scripts'; + } elseif (isset($selectedScripts[0]) && + strlen($selectedScripts[0]) == 0) { + $scriptWarning = <<{$lang->asb_all_scripts_deactivated}
EOF; } @@ -414,7 +414,7 @@ function asb_admin_edit_box() // check the name of the add-on/custom against the display name of the sidebox, if they differ... if ($sidebox->get('title') != $parent->get('title')) { // then this box has a custom title - $custom_title = 1; + $customTitle = 1; } } @@ -431,7 +431,7 @@ function asb_admin_edit_box() } else { // standard form stuff $page->add_breadcrumb_item($lang->asb); - $page->add_breadcrumb_item($page_title); + $page->add_breadcrumb_item($pageTitle); // add a little CSS $page->extra_header .= << EOF; - $page->output_header("{$lang->asb} - {$page_title}"); + $page->output_header("{$lang->asb} - {$pageTitle}"); $form = new Form($html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module)), 'post', 'modal_form'); } @@ -453,65 +453,65 @@ function asb_admin_edit_box() ); // we only need a 'Settings' tab if the current module type has settings - $do_settings = true; + $doSettings = true; if (!$sidebox->hasSettings && !$parent->hasSettings) { unset($tabs['settings']); - $do_settings = false; + $doSettings = false; } reset($tabs); - $observe_onload = false; + $observeOnLoad = false; if (!$ajax) { - $observe_onload = true; + $observeOnLoad = true; } - $page->output_tab_control($tabs, $observe_onload); + $page->output_tab_control($tabs, $observeOnLoad); // custom title? - if ($custom_title == 1) { + if ($customTitle == 1) { // alter the descrption - $current_title = <<{$lang->asb_current_title}

{$sidebox->get('title')}
{$lang->asb_current_title_info} EOF; } else { // default description - $current_title = $lang->asb_default_title_info; + $currentTitle = $lang->asb_default_title_info; } // current editing text - $currently_editing = '"'.$parent->get('title').'"'; + $currentlyEditing = '"'.$parent->get('title').'"'; - $box_action = $lang->asb_creating; + $boxAction = $lang->asb_creating; if (isset($mybb->input['id'])) { - $box_action = $lang->asb_editing; + $boxAction = $lang->asb_editing; } echo "\n
\n"; - $form_container = new FormContainer('

'.$lang->sprintf($lang->asb_new_sidebox_action, $box_action, $currently_editing).'

'); + $formContainer = new FormContainer('

'.$lang->sprintf($lang->asb_new_sidebox_action, $boxAction, $currentlyEditing).'

'); if (!$ajax) { // box title - $form_container->output_row($lang->asb_custom_title, $current_title, $form->generate_text_box('box_title').$form->generate_hidden_field('current_title', $sidebox->get('title')), 'box_title', array('id' => 'box_title')); + $formContainer->output_row($lang->asb_custom_title, $currentTitle, $form->generate_text_box('box_title').$form->generate_hidden_field('current_title', $sidebox->get('title')), 'box_title', array('id' => 'box_title')); // title link - $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')), 'title_link', array('id' => 'title_link')); + $formContainer->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')), 'title_link', array('id' => 'title_link')); // position - $form_container->output_row($lang->asb_position, '', $form->generate_radio_button('box_position', 0, $lang->asb_position_left, array('checked' => ($sidebox->get('position') == 0))).'  '.$form->generate_radio_button('box_position', 1, $lang->asb_position_right, array('checked' => ($sidebox->get('position') != 0)))); + $formContainer->output_row($lang->asb_position, '', $form->generate_radio_button('box_position', 0, $lang->asb_position_left, array('checked' => ($sidebox->get('position') == 0))).'  '.$form->generate_radio_button('box_position', 1, $lang->asb_position_right, array('checked' => ($sidebox->get('position') != 0)))); // display order - $form_container->output_row($lang->asb_display_order, '', $form->generate_text_box('display_order', $sidebox->get('display_order'))); + $formContainer->output_row($lang->asb_display_order, '', $form->generate_text_box('display_order', $sidebox->get('display_order'))); } else { // box title - $form_container->output_row($lang->asb_title, $current_title, $form->generate_text_box('box_title'), 'box_title', array('id' => 'box_title')); + $formContainer->output_row($lang->asb_title, $currentTitle, $form->generate_text_box('box_title'), 'box_title', array('id' => 'box_title')); // title link and hidden fields - $form_container->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')).$form->generate_hidden_field('current_title', $sidebox->get('title')).$form->generate_hidden_field('display_order', $sidebox->get('display_order')).$form->generate_hidden_field('pos', $position), 'title_link', array('id' => 'title_link')); + $formContainer->output_row($lang->asb_title_link, $lang->asb_title_link_desc, $form->generate_text_box('title_link', $sidebox->get('title_link')).$form->generate_hidden_field('current_title', $sidebox->get('title')).$form->generate_hidden_field('display_order', $sidebox->get('display_order')).$form->generate_hidden_field('pos', $position), 'title_link', array('id' => 'title_link')); } - $form_container->end(); + $formContainer->end(); echo "\n
\n
\n"; - $form_container = new FormContainer($lang->asb_which_groups); + $formContainer = new FormContainer($lang->asb_which_groups); // prepare options for which groups $options = array(); @@ -533,22 +533,22 @@ function asb_admin_edit_box() } // which groups - $form_container->output_row('', $script_warning, $form->generate_select_box('group_select_box[]', $options, $groups, array('id' => 'group_select_box', 'multiple' => true, 'size' => 5))); - $form_container->output_row('', '', $form->generate_hidden_field('this_group_count', count($options))); + $formContainer->output_row('', $scriptWarning, $form->generate_select_box('group_select_box[]', $options, $groups, array('id' => 'group_select_box', 'multiple' => true, 'size' => 5))); + $formContainer->output_row('', '', $form->generate_hidden_field('this_group_count', count($options))); - $form_container->end(); + $formContainer->end(); echo "\n
\n
\n"; - $form_container = new FormContainer($lang->asb_which_scripts); + $formContainer = new FormContainer($lang->asb_which_scripts); // prepare for which scripts $choices = array(); $choices['all_scripts'] = $lang->asb_all; // are there active scripts? - if (is_array($all_scripts)) { + if (is_array($allScripts)) { // loop through them - foreach ($all_scripts as $filename => $title) { + foreach ($allScripts as $filename => $title) { // store the script as a choice $choices[$filename] = $title; } @@ -561,7 +561,7 @@ function asb_admin_edit_box() break; case 2: unset($choices['all_scripts']); - $selected_scripts = array_flip($choices); + $selectedScripts = array_flip($choices); break; case 1: $choices['all_scripts'] = $lang->asb_all_scripts_disabled; @@ -569,11 +569,11 @@ function asb_admin_edit_box() } // which scripts - $form_container->output_row('', $script_warning, $form->generate_select_box('script_select_box[]', $choices, $selected_scripts, array('id' => 'script_select_box', 'multiple' => true, 'size' => 5))); - $form_container->end(); + $formContainer->output_row('', $scriptWarning, $form->generate_select_box('script_select_box[]', $choices, $selectedScripts, array('id' => 'script_select_box', 'multiple' => true, 'size' => 5))); + $formContainer->end(); echo "\n
\n
\n"; - $form_container = new FormContainer($lang->asb_which_themes); + $formContainer = new FormContainer($lang->asb_which_themes); // do we have themes stored? $themes = $sidebox->get('themes'); @@ -581,16 +581,16 @@ function asb_admin_edit_box() $themes = 'all_themes'; } - $choices = array('all_themes' => 'All Themes') + asb_get_all_themes(); + $choices = array('all_themes' => 'All Themes') + asbGetAllThemes(); // which scripts - $form_container->output_row('', '', $form->generate_select_box('theme_select_box[]', $choices, $themes, array('id' => 'theme_select_box', 'multiple' => true, 'size' => 5))); - $form_container->end(); + $formContainer->output_row('', '', $form->generate_select_box('theme_select_box[]', $choices, $themes, array('id' => 'theme_select_box', 'multiple' => true, 'size' => 5))); + $formContainer->end(); - if ($do_settings) { + if ($doSettings) { echo "
\n
\n"; - $form_container = new FormContainer($lang->asb_modal_tab_settings_desc); + $formContainer = new FormContainer($lang->asb_modal_tab_settings_desc); $settings = $parent->get('settings'); @@ -605,10 +605,10 @@ function asb_admin_edit_box() foreach ((array) $settings as $setting) { // allow the handler to build module settings - asb_build_setting($form, $form_container, $setting); + asbBuildSetting($form, $formContainer, $setting); } - $form_container->end(); + $formContainer->end(); $parent->doSettingsLoad(); } @@ -630,7 +630,7 @@ function asb_admin_edit_box() $form->end(); // output the link menu and MyBB footer - asb_output_footer('edit_box'); + asbOutputFooter('edit_box'); } } @@ -649,13 +649,13 @@ function asb_admin_custom_boxes() admin_redirect($html->url(array('action' => 'custom_boxes'))); } - $this_custom = new CustomSidebox($mybb->input['id']); - if (!$this_custom->isValid()) { + $custom = new CustomSidebox($mybb->input['id']); + if (!$custom->isValid()) { flash_message($lang->asb_custom_export_error, 'error'); admin_redirect($html->url(array('action' => 'custom_boxes'))); } - $this_custom->export(array('version' => ASB_CUSTOM_VERSION)); + $custom->export(array('version' => ASB_CUSTOM_VERSION)); exit(); } @@ -667,17 +667,17 @@ function asb_admin_custom_boxes() } // nuke it - $this_custom = new CustomSidebox($mybb->input['id']); + $custom = new CustomSidebox($mybb->input['id']); // success? - if (!$this_custom->remove()) { + if (!$custom->remove()) { flash_message($lang->asb_add_custom_box_delete_failure, 'error'); admin_redirect($html->url(array('action' => 'custom_boxes'))); } // :) flash_message($lang->asb_add_custom_box_delete_success, 'success'); - asb_cache_has_changed(); + asbCacheHasChanged(); admin_redirect($html->url(array('action' => 'custom_boxes'))); } @@ -726,7 +726,7 @@ function asb_admin_custom_boxes() admin_redirect($html->url(array('action' => 'custom_boxes'))); } - $results = asb_legacy_custom_import($tree); + $results = asbLegacyCustomImport($tree); if (!is_array($results)) { flash_message($results, 'error'); @@ -766,23 +766,23 @@ function asb_admin_custom_boxes() flash_message($lang->asb_custom_box_save_failure_no_content, 'error'); admin_redirect($html->url($redirectArray)); } - $this_custom = new CustomSidebox($id); + $custom = new CustomSidebox($id); // get the info - $this_custom->set('title', $mybb->input['box_name']); - $this_custom->set('description', $mybb->input['box_description']); - $this_custom->set('content', $mybb->input['box_content']); - $this_custom->set('wrap_content', ($mybb->input['wrap_content'] == 'yes')); + $custom->set('title', $mybb->input['box_name']); + $custom->set('description', $mybb->input['box_description']); + $custom->set('content', $mybb->input['box_content']); + $custom->set('wrap_content', ($mybb->input['wrap_content'] == 'yes')); // success? - if (!$this_custom->save()) { + if (!$custom->save()) { flash_message($lang->asb_custom_box_save_failure, 'error'); - admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $this_custom->get('id')))); + admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $custom->get('id')))); } flash_message($lang->asb_custom_box_save_success, 'success'); - asb_cache_has_changed(); - admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $this_custom->get('id')))); + asbCacheHasChanged(); + admin_redirect($html->url(array('action' => 'custom_boxes', 'id' => $custom->get('id')))); } } } @@ -790,10 +790,10 @@ function asb_admin_custom_boxes() $page->add_breadcrumb_item($lang->asb, $html->url()); if ($mybb->input['mode'] == 'edit') { - $queryadmin = $db->simple_select('adminoptions', '*', "uid='{$mybb->user['uid']}'"); - $admin_options = $db->fetch_array($queryadmin); + $query = $db->simple_select('adminoptions', '*', "uid='{$mybb->user['uid']}'"); + $adminOptions = $db->fetch_array($query); - if ($admin_options['codepress'] != 0) { + if ($adminOptions['codepress'] != 0) { $page->extra_header .= << @@ -813,17 +813,17 @@ function asb_admin_custom_boxes() EOF; } - $this_box = new CustomSidebox((int) $mybb->input['id']); + $custom = new CustomSidebox((int) $mybb->input['id']); $action = $lang->asb_add_custom; - if ($this_box->get('id')) { - $specify_box = '&id='.$this_box->get('id'); - $currently_editing = $lang->asb_editing.': '.$this_box->get('title').''; - $action = $lang->asb_edit.' '.$this_box->get('title'); + if ($custom->get('id')) { + $specifyBox = '&id='.$custom->get('id'); + $currentlyEditing = $lang->asb_editing.': '.$custom->get('title').''; + $action = $lang->asb_edit.' '.$custom->get('title'); } else { // new box - $specify_box = ''; - $sample_content = <<
@@ -834,8 +834,8 @@ function asb_admin_custom_boxes() EOF; - $this_box->set('content', $sample_content); - $this_box->set('wrap_content', true); + $custom->set('content', $sampleContent); + $custom->set('wrap_content', true); } $page->extra_header .= <<add_breadcrumb_item($lang->asb_custom_boxes, $html->url(array('action' => 'custom_boxes'))); $page->add_breadcrumb_item($lang->asb_add_custom); $page->output_header("{$lang->asb} - {$action}"); - asb_output_tabs('asb_add_custom'); + asbOutputTabs('asb_add_custom'); - $form = new Form($html->url(array('action' => 'custom_boxes')).$specify_box, 'post', 'edit_box'); - $form_container = new FormContainer($currently_editing); + $form = new Form($html->url(array('action' => 'custom_boxes')).$specifyBox, 'post', 'edit_box'); + $formContainer = new FormContainer($currentlyEditing); - $form_container->output_cell($lang->asb_name); - $form_container->output_cell($lang->asb_description); - $form_container->output_cell($lang->asb_custom_box_wrap_content); - $form_container->output_row(''); + $formContainer->output_cell($lang->asb_name); + $formContainer->output_cell($lang->asb_description); + $formContainer->output_cell($lang->asb_custom_box_wrap_content); + $formContainer->output_row(''); // name - $form_container->output_cell($form->generate_text_box('box_name', $this_box->get('title'), array('id' => 'box_name'))); + $formContainer->output_cell($form->generate_text_box('box_name', $custom->get('title'), array('id' => 'box_name'))); // description - $form_container->output_cell($form->generate_text_box('box_description', $this_box->get('description'))); + $formContainer->output_cell($form->generate_text_box('box_description', $custom->get('description'))); // wrap content? - $form_container->output_cell($form->generate_check_box('wrap_content', 'yes', $lang->asb_custom_box_wrap_content_desc, array('checked' => $this_box->get('wrap_content')))); - $form_container->output_row(''); + $formContainer->output_cell($form->generate_check_box('wrap_content', 'yes', $lang->asb_custom_box_wrap_content_desc, array('checked' => $custom->get('wrap_content')))); + $formContainer->output_row(''); - $form_container->output_cell('Content:', array('colspan' => 3)); - $form_container->output_row(''); + $formContainer->output_cell('Content:', array('colspan' => 3)); + $formContainer->output_row(''); // content - $form_container->output_cell($form->generate_text_area('box_content', $this_box->get('content'), array('id' => 'box_content', 'class' => '', 'style' => 'width: 100%; height: 500px;')), array('colspan' => 3)); - $form_container->output_row(''); + $formContainer->output_cell($form->generate_text_area('box_content', $custom->get('content'), array('id' => 'box_content', 'class' => '', 'style' => 'width: 100%; height: 500px;')), array('colspan' => 3)); + $formContainer->output_row(''); // finish form - $form_container->end(); + $formContainer->end(); $buttons[] = $form->generate_submit_button('Save', array('name' => 'save_box_submit')); $form->output_submit_wrapper($buttons); $form->end(); - if($admin_options['codepress'] != 0) - { + if ($adminOptions['codepress'] != 0) { echo << var editor = CodeMirror.fromTextArea(document.getElementById("box_content"), { @@ -897,7 +896,7 @@ function asb_admin_custom_boxes() EOF; // build link bar and ACP footer - asb_output_footer('edit_custom'); + asbOutputFooter('edit_custom'); } } @@ -907,30 +906,30 @@ function asb_admin_custom_boxes() $page->add_breadcrumb_item($lang->asb_custom_boxes); $page->output_header("{$lang->asb} - {$lang->asb_custom_boxes}"); - asb_output_tabs('asb_custom'); + asbOutputTabs('asb_custom'); - $new_box_url = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')); - $new_box_link = $html->link($new_box_url, $lang->asb_add_custom_box_types, array('style' => 'font-weight: bold;', 'title' => $lang->asb_add_custom_box_types, 'icon' => "styles/{$cp_style}/images/asb/add.png"), array('alt' => '+', 'style' => 'margin-bottom: -3px;', 'title' => $lang->asb_add_custom_box_types)); - echo($new_box_link.'

'); + $newBoxUrl = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit')); + $newBoxLink = $html->link($newBoxUrl, $lang->asb_add_custom_box_types, array('style' => 'font-weight: bold;', 'title' => $lang->asb_add_custom_box_types, 'icon' => "styles/{$cp_style}/images/asb/add.png"), array('alt' => '+', 'style' => 'margin-bottom: -3px;', 'title' => $lang->asb_add_custom_box_types)); + echo($newBoxLink.'

'); $table = new Table; $table->construct_header($lang->asb_name); $table->construct_header($lang->asb_custom_box_desc); $table->construct_header($lang->asb_controls, array('colspan' => 2)); - $custom = asb_get_all_custom(); + $customBoxes = asbGetAllCustomBoxes(); // if there are saved types... - if (is_array($custom) && - !empty($custom)) { + if (is_array($customBoxes) && + !empty($customBoxes)) { // display them - foreach ($custom as $this_custom) { - $data = $this_custom->get('data'); + foreach ($customBoxes as $custom) { + $data = $custom->get('data'); // name (edit link) - $edit_url = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit', 'id' => $data['id'])); - $edit_link = $html->link($edit_url, $data['title'], array('title' => $lang->asb_edit, 'style' => 'font-weight: bold;')); + $editUrl = $html->url(array('action' => 'custom_boxes', 'mode' => 'edit', 'id' => $data['id'])); + $editLink = $html->link($editUrl, $data['title'], array('title' => $lang->asb_edit, 'style' => 'font-weight: bold;')); - $table->construct_cell($edit_link, array('width' => '30%')); + $table->construct_cell($editLink, array('width' => '30%')); // description if ($data['description']) { @@ -944,7 +943,7 @@ function asb_admin_custom_boxes() $popup = new PopupMenu('box_'.$data['id'], $lang->asb_options); // edit - $popup->add_item($lang->asb_edit, $edit_url); + $popup->add_item($lang->asb_edit, $editUrl); // delete $popup->add_item($lang->asb_delete, $html->url(array('action' => 'custom_boxes', 'mode' => 'delete', 'id' => $data['id'])), "return confirm('{$lang->asb_custom_del_warning}');"); @@ -967,16 +966,16 @@ function asb_admin_custom_boxes() echo('

'); - $import_form = new Form($html->url(array('action' => 'custom_boxes', 'mode' => 'import')), 'post', '', 1); - $import_form_container = new FormContainer($lang->asb_custom_import); - $import_form_container->output_row($lang->asb_custom_import_select_file, '', $import_form->generate_file_upload_box('file')); - $import_form_container->end(); - $import_buttons[] = $import_form->generate_submit_button($lang->asb_custom_import, array('name' => 'import')); - $import_form->output_submit_wrapper($import_buttons); - $import_form->end(); + $importForm = new Form($html->url(array('action' => 'custom_boxes', 'mode' => 'import')), 'post', '', 1); + $importFormContainer = new FormContainer($lang->asb_custom_import); + $importFormContainer->output_row($lang->asb_custom_import_select_file, '', $importForm->generate_file_upload_box('file')); + $importFormContainer->end(); + $importButtons[] = $importForm->generate_submit_button($lang->asb_custom_import, array('name' => 'import')); + $importForm->output_submit_wrapper($importButtons); + $importForm->end(); // build link bar and ACP footer - asb_output_footer('custom'); + asbOutputFooter('custom'); } /** @@ -993,14 +992,14 @@ function asb_admin_manage_scripts() if ($mybb->request_method == 'post') { if ($mybb->input['mode'] == 'edit') { $mybb->input['action'] = $mybb->input['script_action']; - $script_info = new ScriptInfo($mybb->input); + $script = new ScriptInfo($mybb->input); - if (!$script_info->save()) { + if (!$script->save()) { flash_message($lang->asb_script_save_fail, 'error'); admin_redirect($html->url(array('action' => 'manage_scripts'))); } flash_message($lang->asb_script_save_success, 'success'); - asb_cache_has_changed(); + asbCacheHasChanged(); admin_redirect($html->url(array('action' => 'manage_scripts'))); } elseif ($mybb->input['mode'] == 'import') { if (!$_FILES['file'] || @@ -1027,18 +1026,18 @@ function asb_admin_manage_scripts() admin_redirect($html->url(array('action' => 'manage_scripts'))); } - $this_script = new ScriptInfo; - if (!$this_script->import($contents)) { + $script = new ScriptInfo; + if (!$script->import($contents)) { flash_message($lang->asb_script_import_fail, 'error'); admin_redirect($html->url(array('action' => 'manage_scripts'))); } - if (!$this_script->save()) { + if (!$script->save()) { flash_message($lang->asb_script_import_fail, 'error'); } flash_message($lang->asb_script_import_success, 'success'); - asb_cache_has_changed(); + asbCacheHasChanged(); admin_redirect($html->url(array('action' => 'manage_scripts'))); } elseif ($mybb->input['mode'] == 'inline') { $redirect = $html->url(array('action' => 'manage_scripts')); @@ -1107,7 +1106,7 @@ function asb_admin_manage_scripts() $objectTitle = $lang->asb_script_definitions; if ($job_count > 0) { $status = 'success'; - asb_cache_has_changed(); + asbCacheHasChanged(); if ($job_count == 1) { $objectTitle = $lang->asb_script_definition; } @@ -1119,17 +1118,17 @@ function asb_admin_manage_scripts() if ($mybb->input['mode'] == 'delete' && $mybb->input['id']) { - $this_script = new ScriptInfo((int) $mybb->input['id']); - if (!$this_script->remove()) { + $script = new ScriptInfo((int) $mybb->input['id']); + if (!$script->remove()) { flash_message($lang->asb_script_delete_fail, 'error'); } else { flash_message($lang->asb_script_delete_success, 'success'); - asb_cache_has_changed(); + asbCacheHasChanged(); } } elseif ($mybb->input['mode'] == 'export' && $mybb->input['id']) { - $this_script = new ScriptInfo((int) $mybb->input['id']); + $script = new ScriptInfo((int) $mybb->input['id']); - if (!$this_script->export(array('version' => ASB_SCRIPT_VERSION))) { + if (!$script->export(array('version' => ASB_SCRIPT_VERSION))) { flash_message($lang->asb_script_export_fail, 'error'); admin_redirect($html->url(array('action' => 'manage_scripts'))); } @@ -1137,16 +1136,16 @@ function asb_admin_manage_scripts() } elseif (($mybb->input['mode'] == 'activate' || $mybb->input['mode'] == 'deactivate') && $mybb->input['id']) { - $this_script = new ScriptInfo((int) $mybb->input['id']); - $this_script->set('active', ($mybb->input['mode'] == 'activate')); + $script = new ScriptInfo((int) $mybb->input['id']); + $script->set('active', ($mybb->input['mode'] == 'activate')); - if (!$this_script->save()) { + if (!$script->save()) { $action = ($mybb->input['mode'] == 'activate') ? $lang->asb_script_activate_fail : $lang->asb_script_deactivate_fail; flash_message($action, 'error'); } else { $action = ($mybb->input['mode'] == 'activate') ? $lang->asb_script_activate_success : $lang->asb_script_deactivate_success; flash_message($action, 'success'); - asb_cache_has_changed(); + asbCacheHasChanged(); } admin_redirect($html->url(array('action' => 'manage_scripts'))); } @@ -1162,32 +1161,32 @@ function asb_admin_manage_scripts() ); if ($mybb->input['mode'] == 'edit') { - $this_script = new ScriptInfo((int) $mybb->input['id']); + $script = new ScriptInfo((int) $mybb->input['id']); - $detected_show = ' style="display: none;"'; - $button_text = $lang->asb_add; + $detectedShow = ' style="display: none;"'; + $buttonText = $lang->asb_add; $filename = ''; $action = $lang->asb_edit_script; - if ($this_script->isValid()) { - $data = $this_script->get('data'); + if ($script->isValid()) { + $data = $script->get('data'); - $detected_info = asb_detect_script_info($data['filename'], array( + $detectedInfo = asbDetectScriptInfo($data['filename'], array( 'hook' => $data['hook'], 'action' => $data['action'], 'template' => $data['template_name'], )); - $detected_show = ''; - $button_text = $lang->asb_update; + $detectedShow = ''; + $buttonText = $lang->asb_update; $filename = $data['filename']; $action = "{$lang->asb_edit} {$data['title']}"; } $lang->asb_edit_script = $action; - $queryadmin = $db->simple_select('adminoptions', '*', "uid='{$mybb->user['uid']}'"); - $admin_options = $db->fetch_array($queryadmin); + $query = $db->simple_select('adminoptions', '*', "uid='{$mybb->user['uid']}'"); + $adminOptions = $db->fetch_array($query); - if ($admin_options['codepress'] != 0) { + if ($adminOptions['codepress'] != 0) { $page->extra_header .= << @@ -1230,7 +1229,7 @@ function asb_admin_manage_scripts() $page->add_breadcrumb_item($lang->asb_manage_scripts, $html->url(array('action' => 'manage_scripts'))); $page->add_breadcrumb_item($lang->asb_edit_script); $page->output_header("{$lang->asb} - {$lang->asb_manage_scripts} - {$lang->asb_edit_script}"); - asb_output_tabs('asb_edit_script'); + asbOutputTabs('asb_edit_script'); $spinner = <<
- {$custom_boxes} + {$customBoxes} - {$left_boxes} + {$leftBoxes} - {$right_boxes} + {$rightBoxes}
{$lang->asb_sample_content_line1}
{$lang->asb_sample_content_line3}
{$visibility_rows}{$themeList}
EOF; } @@ -194,14 +194,14 @@ function asb_build_permissions_table($sidebox) * @param bool global visibility * @return string html */ -function asb_build_visibility_rows($sidebox, &$group_count, &$global) +function asbBuildVisibilityRows($sidebox, &$group_count, &$global) { - global $db, $lang, $all_scripts; + global $db, $lang, $allScripts; static $options; - if (!is_array($all_scripts) || - empty($all_scripts)) { + if (!is_array($allScripts) || + empty($allScripts)) { return $lang->asb_no_active_scripts; } @@ -229,7 +229,7 @@ function asb_build_visibility_rows($sidebox, &$group_count, &$global) } elseif (isset($groups[0]) && strlen($groups[0]) == 0) { return "{$lang->asb_all_scripts_deactivated}"; } else { - $scripts = $all_scripts; + $scripts = $allScripts; } } elseif (isset($scripts[0]) && strlen($scripts[0]) == 0) { @@ -245,7 +245,7 @@ function asb_build_visibility_rows($sidebox, &$group_count, &$global) } $script_rows = ''; - foreach ($all_scripts as $script => $script_title) { + foreach ($allScripts as $script => $script_title) { $script_title_full = ''; if (strlen($script_title) > 15) { $script_title_full = $script_title; @@ -315,11 +315,11 @@ function asb_build_visibility_rows($sidebox, &$group_count, &$global) * @param bool global visibility * @return string html */ -function asb_build_theme_visibility_list($sidebox, $colspan, $global) +function asbBuildThemeVisibilityList($sidebox, $colspan, $global) { global $lang; - $themes = asb_get_all_themes(); + $themes = asbGetAllThemes(); $good_themes = $sidebox->get('themes'); if (!$themes) { @@ -328,20 +328,20 @@ function asb_build_theme_visibility_list($sidebox, $colspan, $global) if (!$good_themes || count($good_themes) == count($themes)) { - $theme_list = $lang->asb_visibile_for_all_themes; + $themeList = $lang->asb_visibile_for_all_themes; if ($global) { return ''; } } else { - $theme_list = ''; + $themeList = ''; foreach ($themes as $tid => $name) { if ($good_themes && !in_array($tid, $good_themes)) { - $theme_list .= <<{$name} EOF; } else { - $theme_list .= << - {$theme_list} + {$themeList} EOF; } @@ -363,7 +363,7 @@ function asb_build_theme_visibility_list($sidebox, $colspan, $global) * @param bool produce delete link? * @return string html */ -function asb_build_sidebox_info($sidebox, $wrap=true, $ajax=false) +function asbBuildSideBoxInfo($sidebox, $wrap=true, $ajax=false) { // must be a valid object if ($sidebox instanceof SideboxObject == false || @@ -371,7 +371,7 @@ function asb_build_sidebox_info($sidebox, $wrap=true, $ajax=false) return false; } - global $html, $scripts, $all_scripts, $lang, $cp_style; + global $html, $scripts, $allScripts, $lang, $cp_style; $title = $sidebox->get('title'); $id = $sidebox->get('id'); @@ -379,25 +379,25 @@ function asb_build_sidebox_info($sidebox, $wrap=true, $ajax=false) $module = $sidebox->get('box_type'); // visibility table - $visibility = ''.asb_build_permissions_table($sidebox).''; + $visibility = ''.asbBuildPermissionsTable($sidebox).''; // edit link - $edit_link = $html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module, 'pos' => $pos)); - $edit_icon = <<{$lang->asb_edit} + $editUrl = $html->url(array('action' => 'edit_box', 'id' => $id, 'addon' => $module, 'pos' => $pos)); + $editIcon = <<{$lang->asb_edit} EOF; // delete link (only used if JS is disabled) if (!$ajax) { - $delete_link = $html->url(array('action' => 'delete_box', 'id' => $id)); - $delete_icon = <<{$lang->asb_delete} + $deleteUrl = $html->url(array('action' => 'delete_box', 'id' => $id)); + $deleteIcon = <<{$lang->asb_delete} EOF; } // the content $box = <<Information{$visibility}{$edit_icon}{$delete_icon}{$title} +Information{$visibility}{$editIcon}{$deleteIcon}{$title} EOF; // the
(if applicable) @@ -417,7 +417,7 @@ function asb_build_sidebox_info($sidebox, $wrap=true, $ajax=false) * * @return void */ -function asb_cache_has_changed() +function asbCacheHasChanged() { AdvancedSideboxCache::getInstance()->update('has_changed', true); } @@ -430,7 +430,7 @@ function asb_cache_has_changed() * @param array * @return array script component information */ -function asb_detect_script_info($filename, $selected=array()) +function asbDetectScriptInfo($filename, $selected=array()) { global $lang; @@ -441,14 +441,14 @@ function asb_detect_script_info($filename, $selected=array()) ); } - $full_path = '../'.trim($filename); - if (!file_exists($full_path)) { + $fullPath = '../'.trim($filename); + if (!file_exists($fullPath)) { return array( 'error' => 2, ); } - $contents = @file_get_contents($full_path); + $contents = @file_get_contents($fullPath); if (!$contents) { return array( 'error' => 3, @@ -476,44 +476,44 @@ function asb_detect_script_info($filename, $selected=array()) $form = new Form('', '', '', 0, '', true); foreach (array('hook', 'template', 'action') as $key) { - $array_name = "{$key}s"; - $$array_name = array(); + $element = "{$key}s"; + $$element = array(); // find any references to the current object preg_match_all($info[$key]['pattern'], $contents, $matches, PREG_SET_ORDER); foreach ($matches as $match) { // no duplicates and if there is a filter check it - if (!in_array($match[1], $$array_name) && - (strlen(${$array_name}['filter'] == 0 || - strpos($match[1], ${$array_name}['filter']) === false))) { - ${$array_name}[$match[1]] = $match[1]; + if (!in_array($match[1], $$element) && + (strlen(${$element}['filter'] == 0 || + strpos($match[1], ${$element}['filter']) === false))) { + ${$element}[$match[1]] = $match[1]; } } // anything to show? - if (!empty($$array_name)) { + if (!empty($$element)) { // sort the results, preserving keys - ksort($$array_name); + ksort($$element); // make none = '' the first entry - $$array_name = array_reverse($$array_name); - ${$array_name}[] = 'none'; - $$array_name = array_reverse($$array_name); + $$element = array_reverse($$element); + ${$element}[] = 'none'; + $$element = array_reverse($$element); // store the HTML select box - $return_array[$array_name] = ''.$lang->asb_detected.' '.$info[$key]['plural'].':
'.$form->generate_select_box("{$array_name}_options", $$array_name, $selected[$key], array('id' => "{$key}_selector")).'

'; + $returnArray[$element] = ''.$lang->asb_detected.' '.$info[$key]['plural'].':
'.$form->generate_select_box("{$element}_options", $$element, $selected[$key], array('id' => "{$key}_selector")).'

'; } else { - $varName = "asb_ajax_{$array_name}"; + $varName = "asb_ajax_{$element}"; $noContent = $lang->sprintf($lang->asb_ajax_nothing_found, $lang->$varName); // store the no content message - $return_array[$array_name] = <<{$noContent} EOF; } } - return $return_array; + return $returnArray; } /** @@ -522,7 +522,7 @@ function asb_detect_script_info($filename, $selected=array()) * @param array * @return void */ -function asb_legacy_custom_import($tree) +function asbLegacyCustomImport($tree) { global $lang; @@ -536,19 +536,19 @@ function asb_legacy_custom_import($tree) $property == 'value') { continue; } - $input_array[$property] = $value['value']; + $inputArray[$property] = $value['value']; } - if ($input_array['content'] && - $input_array['checksum'] && - my_strtolower(md5(base64_decode($input_array['content']))) == my_strtolower($input_array['checksum'])) { - $input_array['content'] = trim(base64_decode($input_array['content'])); - $input_array['title'] = $input_array['name']; - return $input_array; + if ($inputArray['content'] && + $inputArray['checksum'] && + my_strtolower(md5(base64_decode($inputArray['content']))) == my_strtolower($inputArray['checksum'])) { + $inputArray['content'] = trim(base64_decode($inputArray['content'])); + $inputArray['title'] = $inputArray['name']; + return $inputArray; } $error = $lang->asb_custom_import_file_empty; - if ($input_array['content']) { + if ($inputArray['content']) { $error = $lang->asb_custom_import_file_corrupted; } return $error; @@ -560,18 +560,18 @@ function asb_legacy_custom_import($tree) * @param string script to show or 'all_scripts' to avoid filtering altogether * @return string html */ -function asb_build_filter_selector($filter) +function asbBuildFilterSelector($filter) { - global $all_scripts; + global $allScripts; // if there are active scripts... - if (!is_array($all_scripts) || - empty($all_scripts)) { + if (!is_array($allScripts) || + empty($allScripts)) { return; } global $lang, $html; - $options = array_merge(array('' => 'no filter'), $all_scripts); + $options = array_merge(array('' => 'no filter'), $allScripts); $form = new Form($html->url(), 'post', 'script_filter', 0, 'script_filter'); echo($form->generate_select_box('page', $options, $filter)); echo($form->generate_submit_button('Filter', array('name' => 'filter'))); @@ -586,73 +586,73 @@ function asb_build_filter_selector($filter) * @param array setting properties * @return void */ -function asb_build_setting($this_form, $this_form_container, $setting) +function asbBuildSetting($this_form, $this_form_container, $setting) { // create each element with unique id and name properties $options = ''; $type = explode("\n", $setting['optionscode']); $type = array_map('trim', $type); - $element_name = "{$setting['name']}"; - $element_id = "setting_{$setting['name']}"; - $row_id = "row_{$element_id}"; + $elementName = "{$setting['name']}"; + $elementId = "setting_{$setting['name']}"; + $rowId = "row_{$elementId}"; // prepare labels - $this_label = ''.htmlspecialchars_uni($setting['title']).''; - $this_desc = ''.$setting['description'].''; + $thisLabel = ''.htmlspecialchars_uni($setting['title']).''; + $thisDescription = ''.$setting['description'].''; // sort by type if ($type[0] == 'text' || $type[0] == '') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_text_box($element_name, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_text_box($elementName, $setting['value'], array('id' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'textarea') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_text_area($element_name, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_text_area($elementName, $setting['value'], array('id' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'yesno') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_yes_no_radio($element_name, $setting['value'], true, array('id' => $element_id.'_yes', 'class' => $element_id), array('id' => $element_id.'_no', 'class' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_yes_no_radio($elementName, $setting['value'], true, array('id' => $elementId.'_yes', 'class' => $elementId), array('id' => $elementId.'_no', 'class' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'onoff') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_on_off_radio($element_name, $setting['value'], true, array('id' => $element_id.'_on', 'class' => $element_id), array('id' => $element_id.'_off', 'class' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_on_off_radio($elementName, $setting['value'], true, array('id' => $elementId.'_on', 'class' => $elementId), array('id' => $elementId.'_off', 'class' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'language') { $languages = $lang->get_languages(); - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_select_box($element_name, $languages, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_select_box($elementName, $languages, $setting['value'], array('id' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'adminlanguage') { $languages = $lang->get_languages(1); - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_select_box($element_name, $languages, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_select_box($elementName, $languages, $setting['value'], array('id' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'passwordbox') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_password_box($element_name, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_password_box($elementName, $setting['value'], array('id' => $elementId)), $elementName, array('id' => $rowId)); } else if ($type[0] == 'php') { $setting['optionscode'] = substr($setting['optionscode'], 3); eval("\$setting_code = \"".$setting['optionscode']."\";"); } else { for ($i=0; $i < count($type); $i++) { - $optionsexp = explode('=', $type[$i]); - if (!$optionsexp[1]) { + $optionsArray = explode('=', $type[$i]); + if (!$optionsArray[1]) { continue; } if ($type[0] == 'select') { - $option_list[$optionsexp[0]] = htmlspecialchars_uni($optionsexp[1]); + $optionList[$optionsArray[0]] = htmlspecialchars_uni($optionsArray[1]); } else if ($type[0] == 'radio') { - if ($setting['value'] == $optionsexp[0]) { - $option_list[$i] = $this_form->generate_radio_button($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'checked' => 1, 'class' => $element_id)); + if ($setting['value'] == $optionsArray[0]) { + $optionList[$i] = $this_form->generate_radio_button($elementName, $optionsArray[0], htmlspecialchars_uni($optionsArray[1]), array('id' => $elementId.'_'.$i, 'checked' => 1, 'class' => $elementId)); } else { - $option_list[$i] = $this_form->generate_radio_button($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'class' => $element_id)); + $optionList[$i] = $this_form->generate_radio_button($elementName, $optionsArray[0], htmlspecialchars_uni($optionsArray[1]), array('id' => $elementId.'_'.$i, 'class' => $elementId)); } } else if($type[0] == 'checkbox') { - if ($setting['value'] == $optionsexp[0]) { - $option_list[$i] = $this_form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'checked' => 1, 'class' => $element_id)); + if ($setting['value'] == $optionsArray[0]) { + $optionList[$i] = $this_form->generate_check_box($elementName, $optionsArray[0], htmlspecialchars_uni($optionsArray[1]), array('id' => $elementId.'_'.$i, 'checked' => 1, 'class' => $elementId)); } else { - $option_list[$i] = $this_form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'class' => $element_id)); + $optionList[$i] = $this_form->generate_check_box($elementName, $optionsArray[0], htmlspecialchars_uni($optionsArray[1]), array('id' => $elementId.'_'.$i, 'class' => $elementId)); } } } if ($type[0] == 'select') { - $this_form_container->output_row($this_label, $this_desc, $this_form->generate_select_box($element_name, $option_list, $setting['value'], array('id' => $element_id)), $element_name, array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $this_form->generate_select_box($elementName, $optionList, $setting['value'], array('id' => $elementId)), $elementName, array('id' => $rowId)); } else { - $setting_code = implode('
', $option_list); + $setting_code = implode('
', $optionList); } } if ($setting_code) { - $this_form_container->output_row($this_label, $this_desc, $setting_code, '', array(), array('id' => $row_id)); + $this_form_container->output_row($thisLabel, $thisDescription, $setting_code, '', array(), array('id' => $rowId)); } } diff --git a/Upload/inc/plugins/asb/functions_addon.php b/Upload/inc/plugins/asb/functions_addon.php index e23648a..eb74761 100644 --- a/Upload/inc/plugins/asb/functions_addon.php +++ b/Upload/inc/plugins/asb/functions_addon.php @@ -13,7 +13,7 @@ * @param string message * @return string message */ -function asb_strip_quotes($message) +function asbStripQuotes($message) { // Assign pattern and replace values. $pattern = array( @@ -35,7 +35,7 @@ function asb_strip_quotes($message) * @param string message * @return string message */ -function asb_strip_url($message) +function asbStripUrls($message) { $message = ' '.$message; $message = preg_replace("#([\>\s\(\)])(http|https|ftp|news){1}://([^\/\"\s\<\[\.]+\.([^\/\"\s\<\[\.]+\.)*[\w]+(:[0-9]+)?(/[^\"\s<\[]*)?)#i", '', $message); @@ -51,41 +51,42 @@ function asb_strip_url($message) * @param bool present the id list as SQL IN()? * @return string id list */ -function asb_build_id_list($ids, $field='id', $wrap=true) +function asbBuildIdList($ids, $field='id', $wrap=true) { if (strlen($ids) == 0) { return false; } if (strpos($ids, ',') !== false) { - $id_array = explode(',', $ids); - foreach ($id_array as $key => $id) { + $idArray = explode(',', $ids); + + foreach ($idArray as $key => $id) { if((int) $id == 0) { - unset($id_array[$key]); + unset($idArray[$key]); } } - if (count($id_array) > 1) { - $id_list = implode(',', $id_array); - } elseif (count($id_array) == 1) { - $id_list = (int) $id_array[key($id_array)]; + if (count($idArray) > 1) { + $idList = implode(',', $idArray); + } elseif (count($idArray) == 1) { + $idList = (int) $idArray[key($idArray)]; } } else { - $id_list = (int) $ids; + $idList = (int) $ids; } - if (!$id_list) { + if (!$idList) { return false; } if ($wrap && $field) { - $id_list = <<getFilename(), $subfolder.$file->getFilename(), $recursive); - if ($sub_files) { - $filenames .= "{$sep}{$sub_files}"; + $subFiles = asbGetImagesFromPath($folder.'/'.$file->getFilename(), $subfolder.$file->getFilename(), $recursive); + if ($subFiles) { + $filenames .= "{$sep}{$subFiles}"; $sep = ','; } continue; diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php index c292c5a..cc09e7c 100644 --- a/Upload/inc/plugins/asb/install.php +++ b/Upload/inc/plugins/asb/install.php @@ -26,12 +26,12 @@ function asb_info() $lang->load('asb'); } - $extra_links = '
'; - $settings_link = asb_build_settings_link(); - if ($settings_link) { + $extraLinks = '
'; + $settingsLink = asbBuildSettingsLink(); + if ($settingsLink) { if (file_exists(MYBB_ROOT.'inc/plugins/asb/cleanup.php') && file_exists(MYBB_ROOT.'inc/plugins/adv_sidebox/acp_functions.php')) { - $remove_link = << {$lang->asb_remove_old_files_desc}
{$lang->asb_remove_old_files} @@ -40,40 +40,40 @@ function asb_info() } // only show Manage Sideboxes link if active - $plugin_list = $cache->read('plugins'); - $manage_link = ''; - if (!empty($plugin_list['active']) && - is_array($plugin_list['active']) && - in_array('asb', $plugin_list['active'])) { + $pluginList = $cache->read('plugins'); + $manageLink = ''; + if (!empty($pluginList['active']) && + is_array($pluginList['active']) && + in_array('asb', $pluginList['active'])) { $url = ASB_URL; - $manage_link = << {$lang->asb_manage_sideboxes} EOF; } - $settings_link = << - {$settings_link} + {$settingsLink} EOF; - $extra_links = << - {$settings_link} - {$manage_link}{$remove_link} + {$settingsLink} + {$manageLink}{$removeLink}
  • {$lang->asb_help}
  • EOF; - $asb_description = << - {$lang->asb_description1}

    {$lang->asb_description2}{$extra_links} + {$lang->asb_description1}

    {$lang->asb_description2}{$extraLinks} {$lang->asb_logo}

    @@ -84,7 +84,7 @@ function asb_info() EOF; } else { - $asb_description = $lang->asb_description1; + $asbDescription = $lang->asb_description1; } $name = << $name, - 'description' => $asb_description, + 'description' => $asbDescription, 'website' => 'https://github.com/WildcardSearch/Advanced-Sidebox', 'author' => $author, 'authorsite' => 'http://www.rantcentralforums.com', @@ -114,7 +114,7 @@ function asb_info() */ function asb_is_installed() { - return asb_get_settingsgroup(); + return asbGetSettingsGroup(); } /** @@ -134,12 +134,12 @@ function asb_install() AdvancedSideboxInstaller::getInstance()->install(); - $addons = asb_get_all_modules(); + $addons = asbGetAllModules(); foreach ($addons as $addon) { $addon->install(); } - asb_create_script_info(); + asbCreateScriptInfo(); @unlink(MYBB_ROOT.'inc/plugins/adv_sidebox.php'); } @@ -197,7 +197,7 @@ function asb_uninstall() global $mybb; // remove the modules first - $addons = asb_get_all_modules(); + $addons = asbGetAllModules(); // if there are add-on modules installed if (is_array($addons)) { @@ -223,21 +223,18 @@ function asb_uninstall() * * @return int gid */ -function asb_get_settingsgroup() +function asbGetSettingsGroup() { - static $asb_settings_gid; + static $gid; // if we have already stored the value - if (isset($asb_settings_gid)) { - // don't waste a query - $gid = (int) $asb_settings_gid; - } else { + if (!isset($gid)) { global $db; - // otherwise we will have to query the db $query = $db->simple_select('settinggroups', 'gid', "name='asb_settings'"); $gid = (int) $db->fetch_field($query, 'gid'); } + return $gid; } @@ -247,7 +244,7 @@ function asb_get_settingsgroup() * @param int settings group id * @return string url */ -function asb_build_settings_url($gid) +function asbBuildSettingsUrl($gid) { if ($gid) { return 'index.php?module=config-settings&action=change&gid='.$gid; @@ -259,7 +256,7 @@ function asb_build_settings_url($gid) * * @return string html */ -function asb_build_settings_link() +function asbBuildSettingsLink() { global $lang; @@ -267,12 +264,12 @@ function asb_build_settings_link() $lang->load('asb'); } - $gid = asb_get_settingsgroup(); + $gid = asbGetSettingsGroup(); // does the group exist? if ($gid) { // if so build the URL - $url = asb_build_settings_url($gid); + $url = asbBuildSettingsUrl($gid); // did we get a URL? if ($url) { @@ -289,7 +286,7 @@ function asb_build_settings_link() * @param bool return associative array? * @return array|true see above dependency */ -function asb_create_script_info($return=false) +function asbCreateScriptInfo($return=false) { $scripts = array( 'index' => array( @@ -401,15 +398,16 @@ function asb_create_script_info($return=false) if ($return == false) { foreach ($scripts as $info) { - $this_script = new ScriptInfo($info); - $this_script->save(); + $script = new ScriptInfo($info); + $script->save(); } + return true; } else { foreach ($scripts as $key => $info) { - $ret_scripts[$key] = new ScriptInfo($info); + $returnArray[$key] = new ScriptInfo($info); } - return $ret_scripts; // upgrade script will save these script defs + return $returnArray; // upgrade script will save these script defs } } @@ -418,18 +416,18 @@ function asb_create_script_info($return=false) * * @return string|bool html or false */ -function asb_build_theme_exclude_select() +function asbBuildThemeExcludeSelect() { global $lang; if (!$lang->asb) { $lang->load('asb'); } - $all_themes = asb_get_all_themes(true); + $allThemes = asbGetAllThemes(true); - $theme_count = min(5, count($all_themes)); - if ($theme_count == 0) { - return $theme_select = << @@ -439,9 +437,9 @@ function asb_build_theme_exclude_select() } // Create an option for each theme and insert code to unserialize each option and 'remember' settings - foreach ($all_themes as $tid => $name) { + foreach ($allThemes as $tid => $name) { $name = addcslashes($name, '"'); - $theme_select .= <<{$name} EOF; } @@ -449,8 +447,8 @@ function asb_build_theme_exclude_select() // put it all together return << -{$theme_select} + EOF; diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php index 055b7a1..6819674 100644 --- a/Upload/inc/plugins/asb/install_data.php +++ b/Upload/inc/plugins/asb/install_data.php @@ -105,7 +105,7 @@ ), ); -$update_themes_link = ""; +$updateThemeExcludeLink = ""; $settings = array( 'asb_settings' => array( @@ -166,8 +166,8 @@ 'sid' => '0', 'name' => 'asb_exclude_theme', 'title' => $lang->asb_theme_exclude_list.':', - 'description' => $db->escape_string($lang->asb_theme_exclude_list_description.$update_themes_link), - 'optionscode' => $db->escape_string(asb_build_theme_exclude_select()), + 'description' => $db->escape_string($lang->asb_theme_exclude_list_description.$updateThemeExcludeLink), + 'optionscode' => $db->escape_string(asbBuildThemeExcludeSelect()), 'value' => '', 'disporder' => '60', ), diff --git a/Upload/inc/plugins/asb/upgrade.php b/Upload/inc/plugins/asb/upgrade.php index 956bd7c..3b370d6 100644 --- a/Upload/inc/plugins/asb/upgrade.php +++ b/Upload/inc/plugins/asb/upgrade.php @@ -18,7 +18,7 @@ /* < 2.1 */ if (version_compare($asbOldVersion, '2.1', '<')) { - $sideboxes = asb_get_all_sideboxes(); + $sideboxes = asbGetAllSideBoxes(); foreach ($sideboxes as $sidebox) { $settings = array(); foreach ((array) $sidebox->get('settings') as $name => $setting) { @@ -29,16 +29,16 @@ } for ($x = 1; $x < 4; $x++) { - $module_name = 'example'; + $moduleName = 'example'; if ($x != 1) { - $module_name .= $x; + $moduleName .= $x; } - $module = new SideboxExternalModule($module_name); + $module = new SideboxExternalModule($moduleName); $module->remove(); } - asb_cache_has_changed(); + asbCacheHasChanged(); $removedForumFiles = array( 'jscripts/asb.js', From 2993d5087e43f454775887d62c1cee1119dcb126 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sat, 13 Oct 2018 14:33:58 -0500 Subject: [PATCH 15/19] Fixes #343 --- Upload/inc/plugins/asb/acp.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index f3d5a0c..dc01ae2 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -894,10 +894,10 @@ function asb_admin_custom_boxes() }); EOF; - - // build link bar and ACP footer - asbOutputFooter('edit_custom'); } + + // build link bar and ACP footer + asbOutputFooter('edit_custom'); } $page->extra_header .= << Date: Sat, 13 Oct 2018 15:16:08 -0500 Subject: [PATCH 16/19] Fixes #345 --- Upload/inc/plugins/asb/acp.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index dc01ae2..38b0d7b 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -850,10 +850,9 @@ function asb_admin_custom_boxes() $form = new Form($html->url(array('action' => 'custom_boxes')).$specifyBox, 'post', 'edit_box'); $formContainer = new FormContainer($currentlyEditing); - $formContainer->output_cell($lang->asb_name); - $formContainer->output_cell($lang->asb_description); - $formContainer->output_cell($lang->asb_custom_box_wrap_content); - $formContainer->output_row(''); + $formContainer->output_row_header($lang->asb_name); + $formContainer->output_row_header($lang->asb_description); + $formContainer->output_row_header($lang->asb_custom_box_wrap_content); // name $formContainer->output_cell($form->generate_text_box('box_name', $custom->get('title'), array('id' => 'box_name'))); @@ -863,14 +862,14 @@ function asb_admin_custom_boxes() // wrap content? $formContainer->output_cell($form->generate_check_box('wrap_content', 'yes', $lang->asb_custom_box_wrap_content_desc, array('checked' => $custom->get('wrap_content')))); - $formContainer->output_row(''); + $formContainer->construct_row(); $formContainer->output_cell('Content:', array('colspan' => 3)); - $formContainer->output_row(''); + $formContainer->construct_row(); // content $formContainer->output_cell($form->generate_text_area('box_content', $custom->get('content'), array('id' => 'box_content', 'class' => '', 'style' => 'width: 100%; height: 500px;')), array('colspan' => 3)); - $formContainer->output_row(''); + $formContainer->construct_row(); // finish form $formContainer->end(); From 211c1058432b7f6192929ddfd9b19f2cb4da2094 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sat, 13 Oct 2018 15:48:56 -0500 Subject: [PATCH 17/19] Fixes #344 --- Upload/inc/plugins/asb/acp.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Upload/inc/plugins/asb/acp.php b/Upload/inc/plugins/asb/acp.php index 38b0d7b..32472d9 100644 --- a/Upload/inc/plugins/asb/acp.php +++ b/Upload/inc/plugins/asb/acp.php @@ -847,6 +847,10 @@ function asb_admin_custom_boxes() $page->output_header("{$lang->asb} - {$action}"); asbOutputTabs('asb_add_custom'); + $onClick = <<asb_custom_box_save_failure_no_content}', { theme: 'error' }); return false; } +EOF; + $form = new Form($html->url(array('action' => 'custom_boxes')).$specifyBox, 'post', 'edit_box'); $formContainer = new FormContainer($currentlyEditing); @@ -873,7 +877,7 @@ function asb_admin_custom_boxes() // finish form $formContainer->end(); - $buttons[] = $form->generate_submit_button('Save', array('name' => 'save_box_submit')); + $buttons[] = $form->generate_submit_button('Save', array('name' => 'save_box_submit', 'onclick' => $onClick)); $form->output_submit_wrapper($buttons); $form->end(); From 41da1d3e2ba23b49825a6df2d0f81ef4305ed4db Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sat, 13 Oct 2018 16:30:47 -0500 Subject: [PATCH 18/19] Fixes #346 - Fixes #347 Show Sidebox UCP Setting Rework --- Upload/inc/plugins/asb/forum.php | 35 +++++++------------------ Upload/inc/plugins/asb/install.php | 6 +++++ Upload/inc/plugins/asb/install_data.php | 12 +++++++++ 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Upload/inc/plugins/asb/forum.php b/Upload/inc/plugins/asb/forum.php index dcd0cd4..cc83d6d 100644 --- a/Upload/inc/plugins/asb/forum.php +++ b/Upload/inc/plugins/asb/forum.php @@ -386,41 +386,24 @@ function asb_initialize() */ function asbUserCpOptionsEnd() { - global $db, $mybb, $templates, $user, $lang; + global $db, $mybb, $templates, $user, $lang, $asbShowSideboxes; - if (!$lang->asb) { - $lang->load('asb'); - } - - // if the form is being submitted save the users choice. + // if the form is being submitted save the users choice. if ($mybb->request_method == 'post') { $db->update_query('users', array('show_sidebox' => (int) $mybb->input['showsidebox']), "uid='{$user['uid']}'"); + return; } - // don't be silly and waste a query :p (thanks Destroy666) + if (!$lang->asb) { + $lang->load('asb'); + } + + // don't be silly and waste a query :p (thanks Destroy666) if ($mybb->user['show_sidebox'] > 0) { - // checked $checked = 'checked="checked" '; } - $userCpOption = << - - - - - - - - - cache['usercp_options'] = str_replace($find, $userCpOption, $templates->cache['usercp_options']); + eval("\$asbShowSideboxes = \"{$templates->get('asb_ucp_show_sidebox_option')}\";"); } /** diff --git a/Upload/inc/plugins/asb/install.php b/Upload/inc/plugins/asb/install.php index cc09e7c..068dfe8 100644 --- a/Upload/inc/plugins/asb/install.php +++ b/Upload/inc/plugins/asb/install.php @@ -168,6 +168,9 @@ function asb_activate() // change the permissions to on by default change_admin_permission('config', 'asb'); + + require_once MYBB_ROOT . '/inc/adminfunctions_templates.php'; + find_replace_templatesets('usercp_options', "#" . preg_quote('{$board_style}') . "#i", '{$asbShowSideboxes}{$board_style}'); } /** @@ -179,6 +182,9 @@ function asb_deactivate() { // remove the permissions change_admin_permission('config', 'asb', -1); + + require_once MYBB_ROOT . '/inc/adminfunctions_templates.php'; + find_replace_templatesets('usercp_options', "#" . preg_quote('{$asbShowSideboxes}') . "#i", ''); } /** diff --git a/Upload/inc/plugins/asb/install_data.php b/Upload/inc/plugins/asb/install_data.php index 6819674..0d61fa3 100644 --- a/Upload/inc/plugins/asb/install_data.php +++ b/Upload/inc/plugins/asb/install_data.php @@ -243,6 +243,18 @@
    {\$expaltext}
    +EOF + , + 'asb_ucp_show_sidebox_option' => << + + + + + + + EOF ), ), From 93c62b72de665b3e0fa0266afea5f79769c9a20e Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sat, 13 Oct 2018 16:33:07 -0500 Subject: [PATCH 19/19] 3.1.15 Pre-release --- README.md | 2 +- Upload/inc/plugins/asb.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fb92f2..64eb9a9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Advanced-Sidebox 3.1.14 +## Advanced-Sidebox 3.1.15

    Advanced Sidebox Logo diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php index 2968c72..b801e91 100644 --- a/Upload/inc/plugins/asb.php +++ b/Upload/inc/plugins/asb.php @@ -15,7 +15,7 @@ // for modules define('IN_ASB', true); define('ASB_MODULES_DIR', MYBB_ROOT.'inc/plugins/asb/modules'); -define('ASB_VERSION', '3.1.14'); +define('ASB_VERSION', '3.1.15'); define('ASB_CUSTOM_VERSION', '2.0'); define('ASB_SCRIPT_VERSION', '2.0');