Skip to content

Commit

Permalink
Merge pull request #286 from WildcardSearch/maintenance
Browse files Browse the repository at this point in the history
3.1.8 Release
  • Loading branch information
Mark Vincent authored Nov 25, 2017
2 parents 1ef3fd8 + 0171bd5 commit 0605d71
Show file tree
Hide file tree
Showing 17 changed files with 874 additions and 602 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Advanced-Sidebox 3.1.7
## Advanced-Sidebox 3.1.8

<p align="center">
<img title="Advanced Sidebox Logo" alt="Advanced Sidebox Logo" src="http://i.imgur.com/4QWLq5V.png" />
Expand Down
38 changes: 37 additions & 1 deletion Upload/inc/languages/english/admin/asb_addon.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,17 @@
$l['asb_top_poster_no_avatar'] = 'no avatar';
$l['asb_top_poster_posts'] = 'posts';
$l['asb_top_poster_post'] = 'post';
$l['asb_top_poster_congrats'] = 'Congratulations to {1}, our current top poster for the last {2} with {3} {4}!';
$l['asb_top_poster_congrats'] = 'Congratulations to {1}, our current top poster for the last {2} with {3} {4}{5}!';
$l['asb_top_poster_congrats_all_time'] = 'Congratulations to {1}, our all time top poster with {2} {3}{4}!';
$l['asb_top_poster_specific_thread_congrats'] = ' in {1}';
$l['asb_top_poster_description'] = 'Top Posters For {1}';

$l['asb_top_poster_time_frame_title'] = 'Time Frame';
$l['asb_top_poster_time_frame_desc'] = 'time to compare for top poster stats';

$l['asb_top_poster_tid_title'] = 'Thread ID';
$l['asb_top_poster_tid_desc'] = 'enter a thread id to show the top poster for that thread, leave this field blank to show the top poster from all threads (default)';

$l['asb_top_poster_max_posters_title'] = 'Number Of Top Posters';
$l['asb_top_poster_max_posters_desc'] = '0 or invalid values default to 1';

Expand Down Expand Up @@ -282,4 +287,35 @@
$l['asb_top_poster_six_months_desc'] = 'The Last Six Months';
$l['asb_top_poster_one_year_desc'] = 'The Last Year';

// goals
$l['asb_goals_title'] = 'Forum Goals';
$l['asb_goals_description'] = 'displays a countdown';

// setting
$l['asb_goals_goal_type_title'] = 'Goal Type';
$l['asb_goals_goal_type_description'] = 'the type of goal to be tracked';
$l['asb_goals_goal_type_optionscode_posts'] = 'Post Count';
$l['asb_goals_goal_type_optionscode_threads'] = 'Thread Count';
$l['asb_goals_goal_type_optionscode_users'] = 'User Count';

$l['asb_goals_goal_title'] = 'Goal';
$l['asb_goals_goal_description'] = 'the total number of items before the goal is reached';

$l['asb_goals_success_image_title'] = 'Success Image';
$l['asb_goals_success_image_description'] = 'enter an image URL here to display it when the goal has been met, leave it blank to show no image (default)';

// messages
$l['asb_goals_goal_reached'] = "We've done it! We've made {1} {2}!";
$l['asb_goals_progress_message'] = "of the way to our goal of {1} {2}!";
$l['asb_goals_progress_bar_title'] = "{1} of {2}";

$l['asb_goals_no_content'] = 'nothing to show';

$l['asb_goals_posts'] = 'posts';
$l['asb_goals_threads'] = 'threads';
$l['asb_goals_users'] = 'users';

$l['asb_goals_footer_goal_reached'] = 'Goal Met!';
$l['asb_goals_footer_progress'] = 'Only {1} {2} left to go!';

?>
38 changes: 37 additions & 1 deletion Upload/inc/languages/english/asb_addon.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,17 @@
$l['asb_top_poster_no_avatar'] = 'no avatar';
$l['asb_top_poster_posts'] = 'posts';
$l['asb_top_poster_post'] = 'post';
$l['asb_top_poster_congrats'] = 'Congratulations to {1}, our current top poster for the last {2} with {3} {4}!';
$l['asb_top_poster_congrats'] = 'Congratulations to {1}, our current top poster for the last {2} with {3} {4}{5}!';
$l['asb_top_poster_congrats_all_time'] = 'Congratulations to {1}, our all time top poster with {2} {3}{4}!';
$l['asb_top_poster_specific_thread_congrats'] = ' in {1}';
$l['asb_top_poster_description'] = 'Top Posters For {1}';

$l['asb_top_poster_time_frame_title'] = 'Time Frame';
$l['asb_top_poster_time_frame_desc'] = 'time to compare for top poster stats';

$l['asb_top_poster_tid_title'] = 'Thread ID';
$l['asb_top_poster_tid_desc'] = 'enter a thread id to show the top poster for that thread, leave this field blank to show the top poster from all threads (default)';

$l['asb_top_poster_max_posters_title'] = 'Number Of Top Posters';
$l['asb_top_poster_max_posters_desc'] = '0 or invalid values default to 1';

Expand Down Expand Up @@ -282,4 +287,35 @@
$l['asb_top_poster_six_months_desc'] = 'The Last Six Months';
$l['asb_top_poster_one_year_desc'] = 'The Last Year';

// goals
$l['asb_goals_title'] = 'Forum Goals';
$l['asb_goals_description'] = 'displays a countdown';

// setting
$l['asb_goals_goal_type_title'] = 'Goal Type';
$l['asb_goals_goal_type_description'] = 'the type of goal to be tracked';
$l['asb_goals_goal_type_optionscode_posts'] = 'Post Count';
$l['asb_goals_goal_type_optionscode_threads'] = 'Thread Count';
$l['asb_goals_goal_type_optionscode_users'] = 'User Count';

$l['asb_goals_goal_title'] = 'Goal';
$l['asb_goals_goal_description'] = 'the total number of items before the goal is reached';

$l['asb_goals_success_image_title'] = 'Success Image';
$l['asb_goals_success_image_description'] = 'enter an image URL here to display it when the goal has been met, leave it blank to show no image (default)';

// messages
$l['asb_goals_goal_reached'] = "We've done it! We've made {1} {2}!";
$l['asb_goals_progress_message'] = "of the way to our goal of {1} {2}!";
$l['asb_goals_progress_bar_title'] = "{1} of {2}";

$l['asb_goals_no_content'] = 'nothing to show';

$l['asb_goals_posts'] = 'posts';
$l['asb_goals_threads'] = 'threads';
$l['asb_goals_users'] = 'users';

$l['asb_goals_footer_goal_reached'] = 'Goal Met!';
$l['asb_goals_footer_progress'] = 'Only {1} {2} left to go!';

?>
2 changes: 1 addition & 1 deletion Upload/inc/plugins/asb.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.7');
define('ASB_VERSION', '3.1.8');
define('ASB_CUSTOM_VERSION', '2.0');
define('ASB_SCRIPT_VERSION', '2.0');

Expand Down
2 changes: 1 addition & 1 deletion Upload/inc/plugins/asb/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function asb_create_script_info($return = false)
function asb_build_theme_exclude_select()
{
global $lang;
if (!$lang-asb) {
if (!$lang->asb) {
$lang->load('asb');
}

Expand Down
212 changes: 212 additions & 0 deletions Upload/inc/plugins/asb/modules/goals.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
<?php
/*
* Plugin Name: Advanced Sidebox for MyBB 1.8.x
* Copyright 2014 WildcardSearch
* http://www.rantcentralforums.com
*
* ASB default module
*/

// disallow direct access
if (!defined('IN_MYBB') ||
!defined('IN_ASB')) {
die('Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.');
}

/**
* provide info to ASB about the addon
*
* @return array
*/
function asb_goals_info()
{
global $lang;

if (!$lang->asb_addon) {
$lang->load('asb_addon');
}

return array (
'title' => $lang->asb_goals_title,
'description' => $lang->asb_goals_description,
'wrap_content' => true,
'version' => '1',
'compatibility' => '2.1',
'xmlhttp' => true,
'settings' => array(
'goal_type' => array(
'name' => 'goal_type',
'title' => $lang->asb_goals_goal_type_title,
'description' => $lang->asb_goals_goal_type_description,
'optionscode' => <<<EOF
select
1={$lang->asb_goals_goal_type_optionscode_posts}
2={$lang->asb_goals_goal_type_optionscode_threads}
3={$lang->asb_goals_goal_type_optionscode_users}
EOF
,
'value' => '1',
),
'goal' => array(
'name' => 'goal',
'title' => $lang->asb_goals_goal_title,
'description' => $lang->asb_goals_goal_description,
'optionscode' => 'text',
'value' => '100000',
),
'success_image' => array(
'name' => 'success_image',
'title' => $lang->asb_goals_success_image_title,
'description' => $lang->asb_goals_success_image_description,
'optionscode' => 'text',
'value' => '',
),
'xmlhttp_on' => array(
'name' => 'xmlhttp_on',
'title' => $lang->asb_xmlhttp_on_title,
'description' => $lang->asb_xmlhttp_on_description,
'optionscode' => 'text',
'value' => '0',
),
),
'templates' => array(
array(
'title' => 'asb_goals',
'template' => <<<EOF
<tr>
<td class="trow1" style="text-align: center;">{\$progress}</td>
</tr>
<tr>
<td class="tfoot" style="text-align: center;"><span class="smalltext">{\$stats}</span></td>
EOF
),
array(
'title' => 'asb_goals_goal_reached',
'template' => <<<EOF
<span style="font-size: 1.6em; color: navy;">{\$goal_reached_message}</span>{\$successImage}
EOF
),
array(
'title' => 'asb_goals_progress',
'template' => <<<EOF
<span style="font-size: 1.4em; color: green;">{\$percentage}%</span> {\$progress_message}<br />
<div style="width: 95%; background: white; height: 20px; border: 2px outset grey;">
<div style="width: {\$percentage}%; background: blue; height: 20px;" title="{\$progress_bar_title}">
</div>
</div>
EOF
),
array(
'title' => 'asb_goals_goal_reached_image',
'template' => <<<EOF
<img src="{\$settings[\'success_image\']}" alt="celebrate!"/>
EOF
),
),
);
}

/**
* handles display of children of this addon at page load
*
* @param array
* @return bool success/fail
*/
function asb_goals_build_template($args)
{
extract($args);
global $$template_var, $lang;

if (!$lang->asb_addon) {
$lang->load('asb_addon');
}

$goalStatus = asb_goals_get_progress($args);
if (!$goalStatus) {
$$template_var = "<tr><td>{$lang->asb_goals_no_content}</td></tr>";
return false;
}

$$template_var = $goalStatus;
return true;
}

/**
* AJAX
*
* @param array
* @return string
*/
function asb_goals_xmlhttp($args)
{
$goalStatus = asb_goals_get_progress($args);
if ($goalStatus) {
return $goalStatus;
}
return 'nochange';
}

/**
* build the content based on settings
*
* @param array
* @return string
*/
function asb_goals_get_progress($args)
{
global $lang, $templates, $db;

if (!$lang->asb_addon) {
$lang->load('asb_addon');
}

extract($args);

$returnValue = '';
$table = 'forums';
$field = 'posts';
$function = 'SUM';
$goal_type_plural = $lang->asb_goals_posts;
switch((int) $settings['goal_type']) {
case 2:
$field = 'threads';
$goal_type_plural = $lang->asb_goals_threads;
break;
case 3:
$table = 'users';
$goal_type_plural = $lang->asb_goals_users;
$field = 'uid';
$function = 'COUNT';
break;
}

$query = $db->simple_select($table, "{$function}({$field}) AS total");
$total = $db->fetch_field($query, 'total');
$goal = my_number_format($settings['goal']);

if ($total >= $goal) {
$percentage = 100;
$stats = $lang->asb_goals_footer_goal_reached;
$goal_reached_message = $lang->sprintf($lang->asb_goals_goal_reached, $goal, $goal_type_plural);

$successImage = '';
if ($settings['success_image']) {
eval("\$successImage = \"{$templates->get('asb_goals_goal_reached_image')}\";");
}

eval("\$progress = \"{$templates->get('asb_goals_goal_reached')}\";");
} else {
$itemsLeft = my_number_format($goal - $total);
$percentage = round(($total / $goal) * 100, 1);
$stats = $lang->sprintf($lang->asb_goals_footer_progress, $itemsLeft, $goal_type_plural);
$progress_message = $lang->sprintf($lang->asb_goals_progress_message, $goal, $goal_type_plural);
$progress_bar_title = $lang->sprintf($lang->asb_goals_progress_bar_title, $total, $goal);
eval("\$progress = \"{$templates->get('asb_goals_progress')}\";");
}

eval("\$returnValue = \"{$templates->get('asb_goals')}\";");
return $returnValue;
}

?>
Loading

0 comments on commit 0605d71

Please sign in to comment.