Skip to content

Commit b2adfe9

Browse files
author
Mark Vincent
authored
Merge pull request #313 from WildcardSearch/maintenance
3.1.12 Release
2 parents aeb85c6 + 7b547a5 commit b2adfe9

14 files changed

+156
-46
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Advanced-Sidebox 3.1.11
1+
## Advanced-Sidebox 3.1.12
22

33
<p align="center">
44
<img title="Advanced Sidebox Logo" alt="Advanced Sidebox Logo" src="http://i.imgur.com/4QWLq5V.png" />

Upload/inc/plugins/asb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// for modules
1616
define('IN_ASB', true);
1717
define('ASB_MODULES_DIR', MYBB_ROOT . 'inc/plugins/asb/modules');
18-
define('ASB_VERSION', '3.1.11');
18+
define('ASB_VERSION', '3.1.12');
1919
define('ASB_CUSTOM_VERSION', '2.0');
2020
define('ASB_SCRIPT_VERSION', '2.0');
2121

Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* wrapper to handle our plugin's installation
88
*/
99

10-
class AdvancedSideboxInstaller extends WildcardPluginInstaller010202
10+
class AdvancedSideboxInstaller extends WildcardPluginInstaller010302
1111
{
1212
/**
1313
* returns an installer object

Upload/inc/plugins/asb/classes/CustomSidebox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* this file contains an object wrapper for individual custom boxes
88
*/
99

10-
class CustomSidebox extends PortableObject010000
10+
class CustomSidebox extends PortableObject010001
1111
{
1212
/**
1313
* @var string

Upload/inc/plugins/asb/classes/PortableObject010000.php renamed to Upload/inc/plugins/asb/classes/PortableObject010001.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* XML file and to output a row to be included in a collection exported by
1010
* an outside function
1111
*/
12-
abstract class PortableObject010000 extends StorableObject010000 implements PortableObjectInterface010000
12+
abstract class PortableObject010001 extends StorableObject010000 implements PortableObjectInterface010000
1313
{
1414
/**
1515
* provides export functionality for any StorableObject
@@ -71,6 +71,7 @@ public function export($options = '')
7171
header('Pragma: no-cache');
7272
header('Expires: 0');
7373
echo $xml;
74+
return true;
7475
}
7576

7677
/**
@@ -102,7 +103,8 @@ public function import($xml)
102103
}
103104

104105
// get the field name from the array key
105-
$newKey = explode('-', $key)[0];
106+
$newKey = explode('-', $key);
107+
$newKey = $newKey[0];
106108

107109
// is it a valid property name for this object?
108110
if (property_exists($this, $newKey)) {

Upload/inc/plugins/asb/classes/ScriptInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* this file contains an object wrapper for script definitons
88
*/
99

10-
class ScriptInfo extends PortableObject010000
10+
class ScriptInfo extends PortableObject010001
1111
{
1212
/**
1313
* @var string

Upload/inc/plugins/asb/classes/WildcardPluginInstaller010202.php renamed to Upload/inc/plugins/asb/classes/WildcardPluginInstaller010302.php

Lines changed: 85 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
*
1010
*/
1111

12-
class WildcardPluginInstaller010202 implements WildcardPluginInstallerInterface010000
12+
class WildcardPluginInstaller010302 implements WildcardPluginInstallerInterface010000
1313
{
1414
/**
1515
* @const version
1616
*/
17-
const VERSION = '1.2.2';
17+
const VERSION = '1.3.2';
1818

1919
/**
2020
* @var object a copy of the MyBB db object
@@ -145,8 +145,19 @@ public function __construct($path = '')
145145
}
146146
break;
147147
case 'columns':
148+
if ($db->engine == 'pgsql') {
149+
$this->columns = $columns['pgsql'];
150+
} else {
151+
unset($this->columns['pgsql']);
152+
}
148153
case 'images':
149154
break;
155+
case 'tables':
156+
if ($db->engine == 'pgsql') {
157+
$this->tables = $tables['pgsql'];
158+
} else {
159+
unset($this->tables['pgsql']);
160+
}
150161
default:
151162
$singular = substr($key, 0, strlen($key) - 1);
152163
$property = "{$singular}Names";
@@ -216,8 +227,8 @@ protected function addTable($table, $columns)
216227

217228
// create the table if it doesn't already exist
218229
if (!$this->tableExists($table)) {
219-
$table = TABLE_PREFIX . $table;
220-
$this->db->write_query("CREATE TABLE {$table} ({$columnList}) ENGINE={$this->db->table_type}{$collation};");
230+
$queryExtra = ($this->db->engine == 'pgsql') ? '' : " ENGINE={$this->db->table_type}{$collation}";
231+
$this->db->write_query("CREATE TABLE {$this->db->table_prefix}{$table} ({$columnList}){$queryExtra};");
221232
}
222233
}
223234

@@ -256,8 +267,9 @@ protected function removeTables()
256267
return;
257268
}
258269

259-
$dropList = implode(', ' . TABLE_PREFIX, $this->tableNames);
260-
$this->db->drop_table($dropList);
270+
foreach ($this->tableNames as $table) {
271+
$this->db->drop_table($table);
272+
}
261273
}
262274

263275
/**
@@ -274,17 +286,11 @@ protected function addColumns($columns = '')
274286
}
275287

276288
foreach ($columns as $table => $allColumns) {
277-
$sep = $addedColumns = '';
278289
foreach ($allColumns as $title => $definition) {
279290
if (!$this->fieldExists($table, $title)) {
280-
$addedColumns .= "{$sep}{$title} {$definition}";
281-
$sep = ', ADD ';
291+
$this->db->add_column($table, $title, $definition);
282292
}
283293
}
284-
if (strlen($addedColumns) > 0) {
285-
// trickery, again
286-
$this->db->add_column($table, $addedColumns, '');
287-
}
288294
}
289295
}
290296

@@ -302,17 +308,11 @@ protected function removeColumns()
302308
}
303309

304310
foreach ($this->columns as $table => $columns) {
305-
$sep = $droppedColumns = '';
306311
foreach ($columns as $title => $definition) {
307312
if ($this->fieldExists($table, $title)) {
308-
$droppedColumns .= "{$sep}{$title}";
309-
$sep = ', DROP ';
313+
$this->db->drop_column($table, $title);
310314
}
311315
}
312-
if (strlen($droppedColumns) > 0) {
313-
// tricky, tricky xD
314-
$result = $this->db->drop_column($table, $droppedColumns);
315-
}
316316
}
317317
}
318318

@@ -551,7 +551,7 @@ protected function addStyleSheets()
551551
// now cache the actual files
552552
require_once MYBB_ROOT . "{$config['admin_dir']}/inc/functions_themes.php";
553553

554-
if(!cache_stylesheet(1, $data['cachefile'], $data['stylesheet']))
554+
if(!cache_stylesheet(1, $styleSheet['cachefile'], $data['stylesheet']))
555555
{
556556
$this->db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
557557
}
@@ -663,7 +663,7 @@ protected function addImages()
663663
!mkdir("{$path}/images", 0777, true)) ||
664664
($mainFolder &&
665665
!is_dir("{$path}/images{$mainFolder}") &&
666-
!mkdir("{$path}/images{$mainFolder}", 0777, true))) {
666+
!$this->createContentFolder("{$path}/images{$mainFolder}"))) {
667667
continue;
668668
}
669669

@@ -693,7 +693,7 @@ protected function addImages()
693693
if (!is_dir($path) ||
694694
($mainFolder &&
695695
!is_dir("{$path}{$mainFolder}") &&
696-
!mkdir("{$path}{$mainFolder}", 0777, true))) {
696+
!$this->createContentFolder("{$path}{$mainFolder}"))) {
697697
continue;
698698
}
699699

@@ -770,14 +770,23 @@ protected function buildTableList()
770770
{
771771
global $config;
772772

773-
$query = $this->db->write_query("
774-
SHOW TABLES
775-
FROM `{$config['database']['database']}`
776-
");
773+
// PostgreSQL requires a little more work to grab the table names
774+
if ($this->db->engine == 'pgsql') {
775+
$tableArray = $this->db->list_tables($config['database']['database'], $this->db->table_prefix);
777776

778-
$tableList = array();
779-
while ($row = $this->db->fetch_array($query)) {
780-
$tableList[array_pop($row)] = 1;
777+
foreach ($tableArray as $table) {
778+
$tableList[$table] = 1;
779+
}
780+
} else {
781+
$query = $this->db->write_query("
782+
SHOW TABLES
783+
FROM `{$config['database']['database']}`
784+
");
785+
786+
$tableList = array();
787+
while ($row = $this->db->fetch_array($query)) {
788+
$tableList[array_pop($row)] = 1;
789+
}
781790
}
782791
return $tableList;
783792
}
@@ -867,6 +876,52 @@ private function buildThemeList($acp = false)
867876

868877
return $folderList;
869878
}
879+
880+
/**
881+
* verify that path exists or can be created
882+
*
883+
* @param folder path
884+
* @return bool
885+
*/
886+
private function createContentFolder($path)
887+
{
888+
if (mkdir($path, 0777, true)) {
889+
file_put_contents($path . '/index.html', <<<EOF
890+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
891+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
892+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
893+
<head>
894+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
895+
<meta name="robots" content="noindex, nofollow" />
896+
<title>forbidden</title>
897+
<style type="text/css">
898+
body {
899+
background: #F0F0F0;
900+
color: #010101;
901+
font-family: verdana,arial;
902+
font-size: 14px;
903+
font-weight: bold;
904+
}
905+
#msg {
906+
border: 1px solid #F08080;
907+
background: #FFF0F0;
908+
padding: 20px;
909+
margin: 5px;
910+
}
911+
</style>
912+
</head>
913+
<body>
914+
<div id="msg">you don't have permission to access this resource</div>
915+
</body>
916+
</html>
917+
EOF
918+
);
919+
920+
return true;
921+
}
922+
923+
return false;
924+
}
870925
}
871926

872927
?>

Upload/inc/plugins/asb/install_data.php

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,49 @@
88
*/
99

1010
$tables = array(
11+
'pgsql' => array(
12+
"asb_sideboxes" => array(
13+
"id" => 'SERIAL',
14+
"display_order" => 'INT NOT NULL',
15+
"box_type" => 'VARCHAR(25) NOT NULL',
16+
"title" => 'TEXT',
17+
"title_link" => 'VARCHAR(128) NOT NULL',
18+
"position" => 'INT',
19+
"scripts" => 'TEXT',
20+
"groups" => 'TEXT',
21+
"themes" => 'TEXT',
22+
"settings" => 'TEXT',
23+
"wrap_content" => 'INT',
24+
"dateline" => 'INT NOT NULL, PRIMARY KEY(id)'
25+
),
26+
"asb_custom_sideboxes" => array(
27+
"id" => 'SERIAL',
28+
"title" => 'VARCHAR(32) NOT NULL',
29+
"description" => 'VARCHAR(128) NOT NULL',
30+
"wrap_content" => 'INT',
31+
"content" => 'TEXT',
32+
"dateline" => 'INT NOT NULL, PRIMARY KEY(id)'
33+
),
34+
"asb_script_info" => array(
35+
"id" => 'SERIAL',
36+
"title" => 'VARCHAR(32) NOT NULL',
37+
"filename" => 'VARCHAR(32) NOT NULL',
38+
"action" => 'VARCHAR(32) NOT NULL',
39+
"page" => 'VARCHAR(32) NOT NULL',
40+
"width_left" => 'INT',
41+
"width_right" => 'INT',
42+
"template_name" => 'VARCHAR(128) NOT NULL',
43+
"hook" => 'VARCHAR(128) NOT NULL',
44+
"find_top" => 'TEXT',
45+
"find_bottom" => 'TEXT',
46+
"replace_all" => 'INT',
47+
"replacement" => 'TEXT',
48+
"replacement_template" => 'VARCHAR(128) NOT NULL',
49+
"eval" => 'INT',
50+
"active" => 'INT',
51+
"dateline" => 'INT NOT NULL, PRIMARY KEY(id)'
52+
),
53+
),
1154
"asb_sideboxes" => array(
1255
"id" => 'INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY',
1356
"display_order" => 'INT(10) NOT NULL',
@@ -48,13 +91,18 @@
4891
"eval" => 'INT(1)',
4992
"active" => 'INT(1)',
5093
"dateline" => 'INT(10)'
51-
)
94+
),
5295
);
5396

5497
$columns = array(
98+
'pgsql' => array(
99+
"users" => array(
100+
"show_sidebox" => 'INT DEFAULT 1',
101+
),
102+
),
55103
"users" => array(
56-
"show_sidebox" => 'INT(1) DEFAULT 1'
57-
)
104+
"show_sidebox" => 'INT(1) DEFAULT 1',
105+
),
58106
);
59107

60108
$update_themes_link = "<ul><li><a href=\"" . ASB_URL . "&amp;action=update_theme_select\" title=\"\">{$lang->asb_theme_exclude_select_update_link}</a><br />{$lang->asb_theme_exclude_select_update_description}</li></ul>";

Upload/inc/plugins/asb/modules/private_messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function asb_private_messages_get_messages()
145145
$username = build_profile_link(format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']), $mybb->user['uid']);
146146
$lang->asb_pms_received_new = $lang->sprintf($lang->asb_pms_received_new, $username, $mybb->user['pms_unread']);
147147

148-
eval("\$" . pmessages . " = \"" . $templates->get('asb_pms') . "\";");
148+
eval("\$pmessages = \"{$templates->get('asb_pms')}\";");
149149
}
150150
} else {
151151
// user has disabled PMs

Upload/inc/plugins/asb/modules/rand_quote.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ function asb_rand_quote_get_quote($settings, $width)
303303
$parser_options = array('allow_smilies' => 1);
304304
$new_message = str_replace(array('<br />', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message . ' ', $parser_options));
305305

306-
$avatar_filename = format_avatar($rand_post['avatar'])['image'];
306+
$avatar_info = format_avatar($rand_post['avatar']);
307+
$avatar_filename = $avatar_info['image'];
307308

308309
$avatar_alt = $lang->sprintf($lang->asb_random_quote_users_profile, $plain_text_username);
309310

0 commit comments

Comments
 (0)