From b95ad8bb8cd17bb716fdd1f2431d55c4b2a5c396 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 9 Sep 2018 10:44:31 -0500 Subject: [PATCH 01/10] Fixes #315 --- .../asb/classes/AdvancedSideboxInstaller.php | 4 +- ....php => WildcardPluginInstaller020000.php} | 120 ++++++++++-------- 2 files changed, 69 insertions(+), 55 deletions(-) rename Upload/inc/plugins/asb/classes/{WildcardPluginInstaller010302.php => WildcardPluginInstaller020000.php} (91%) diff --git a/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php b/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php index 9f2b339..7883db2 100644 --- a/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php +++ b/Upload/inc/plugins/asb/classes/AdvancedSideboxInstaller.php @@ -7,7 +7,7 @@ * wrapper to handle our plugin's installation */ -class AdvancedSideboxInstaller extends WildcardPluginInstaller010302 +class AdvancedSideboxInstaller extends WildcardPluginInstaller020000 { /** * returns an installer object @@ -32,7 +32,7 @@ static public function getInstance() */ public function __construct($path = '') { - parent::__construct(MYBB_ROOT . 'inc/plugins/asb/install_data.php'); + parent::__construct(MYBB_ROOT.'inc/plugins/asb/install_data.php'); } } diff --git a/Upload/inc/plugins/asb/classes/WildcardPluginInstaller010302.php b/Upload/inc/plugins/asb/classes/WildcardPluginInstaller020000.php similarity index 91% rename from Upload/inc/plugins/asb/classes/WildcardPluginInstaller010302.php rename to Upload/inc/plugins/asb/classes/WildcardPluginInstaller020000.php index a820e44..f29f543 100644 --- a/Upload/inc/plugins/asb/classes/WildcardPluginInstaller010302.php +++ b/Upload/inc/plugins/asb/classes/WildcardPluginInstaller020000.php @@ -9,12 +9,12 @@ * */ -class WildcardPluginInstaller010302 implements WildcardPluginInstallerInterface010000 +class WildcardPluginInstaller020000 implements WildcardPluginInstallerInterface010000 { /** * @const version */ - const VERSION = '1.3.2'; + const VERSION = '2.0.0'; /** * @var object a copy of the MyBB db object @@ -92,20 +92,31 @@ class WildcardPluginInstaller010302 implements WildcardPluginInstallerInterface0 protected $images = array(); /** - * load the installation data and prepare for anything + * load the installation data * * @param string path to the install data * @return void */ - public function __construct($path = '') + public function __construct($path='') { if (!trim($path) || !file_exists($path)) { return; } + /** + * Check every possible element that the installer can handle and, + * if the elements exist, store their definition data along with + * a list of the names associated with each component, eg. the name + * of a setting. + * + * This gives the installer all of the information it needs to install + * and uninstall the plugin. + */ global $lang, $db; + require_once $path; + foreach (array('tables', 'columns', 'settings', 'templates', 'images', 'styleSheets') as $key) { if (!is_array($$key) || empty($$key)) { @@ -113,59 +124,61 @@ public function __construct($path = '') } $this->$key = $$key; - switch ($key) { - case 'styleSheets': - foreach (array('acp', 'forum') as $key) { - if (!is_array($styleSheets[$key]) || - empty($styleSheets[$key])) { - $this->styleSheetNames[$key] = array(); - continue; - } + } - foreach (array_keys($styleSheets[$key]) as $name) { - // stylesheets need the extension appended - $this->styleSheetNames[$key][] = $name . '.css'; - } - } - break; - case 'settings': - $this->settingGroupNames = array_keys($settings); - foreach ($settings as $group => $info) { - foreach ($info['settings'] as $name => $setting) { - $this->settingNames[] = $name; - } + if (!empty($styleSheets)) { + foreach (array('acp', 'forum') as $key) { + if (!is_array($styleSheets[$key]) || + empty($styleSheets[$key])) { + $this->styleSheetNames[$key] = array(); + continue; } - break; - case 'templates': - $this->templategroupNames = array_keys($templates); - foreach ($templates as $group => $info) { - foreach ($info['templates'] as $name => $template) { - $this->templateNames[] = $name; - } + + foreach (array_keys($styleSheets[$key]) as $name) { + // stylesheets need the extension appended + $this->styleSheetNames[$key][] = $name . '.css'; } - break; - case 'columns': - if ($db->engine == 'pgsql') { - $this->columns = $columns['pgsql']; - } else { - unset($this->columns['pgsql']); + } + } + + // settings and templates and their groups are handled similarly + if (!empty($settings)) { + $this->settingGroupNames = array_keys($settings); + foreach ($settings as $group => $info) { + foreach ($info['settings'] as $name => $setting) { + $this->settingNames[] = $name; } - case 'images': - break; - case 'tables': - if ($db->engine == 'pgsql') { - $this->tables = $tables['pgsql']; - } else { - unset($this->tables['pgsql']); + } + } + + if (!empty($templates)) { + $this->templategroupNames = array_keys($templates); + foreach ($templates as $group => $info) { + foreach ($info['templates'] as $name => $template) { + $this->templateNames[] = $name; } - default: - $singular = substr($key, 0, strlen($key) - 1); - $property = "{$singular}Names"; - $this->$property = array_keys($$key); - break; } } + // tables and columns must consider the different db engines + if (!empty($tables)) { + if ($db->engine == 'pgsql') { + $this->tables = $tables['pgsql']; + } else { + unset($this->tables['pgsql']); + } + $this->tableNames = array_keys($tables); + } + + if (!empty($columns)) { + if ($db->engine == 'pgsql') { + $this->columns = $columns['pgsql']; + } else { + unset($this->columns['pgsql']); + } + $this->columnNames = array_keys($columns); + } + // snag a copy of the db object $this->db = $db; } @@ -278,7 +291,7 @@ protected function removeTables() * @param array tables and columns * @return void */ - protected function addColumns($columns = '') + protected function addColumns($columns='') { if (!is_array($columns) || empty($columns)) { @@ -831,7 +844,7 @@ protected function buildFieldList($table) * @param bool acp or forum * @return array keys of folder names */ - private function buildThemeList($acp = false) + private function buildThemeList($acp=false) { static $cache; $folderList = array(); @@ -844,7 +857,8 @@ private function buildThemeList($acp = false) foreach (new DirectoryIterator(MYBB_ADMIN_DIR . 'styles') as $di) { $folder = $di->getFilename(); - if ($di->isDot() || + if ($folder == 'default' || + $di->isDot() || !$di->isDir() || @!file_exists(MYBB_ADMIN_DIR . "styles/{$folder}/main.css")) { continue; @@ -859,7 +873,7 @@ private function buildThemeList($acp = false) return $cache['forum']; } - $duplicates = array(); + $duplicates = array('images' => 1); $query = $this->db->simple_select('themes', 'pid, properties'); while ($theme = $this->db->fetch_array($query)) { $properties = unserialize($theme['properties']); From 2dcb75f22a4dc6c192c8328faa9a2f14ec2c06d5 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 9 Sep 2018 10:58:11 -0500 Subject: [PATCH 02/10] Fixes #316 --- Upload/admin/styles/default/asb/global.css | 215 ++++++++++++++++++ .../admin/styles/default/images/asb/add.png | Bin 0 -> 408 bytes .../styles/default/images/asb/delete.png | Bin 0 -> 377 bytes .../styles/default/images/asb/donate.png | Bin 0 -> 1338 bytes .../admin/styles/default/images/asb/edit.png | Bin 0 -> 574 bytes .../admin/styles/default/images/asb/help.png | Bin 0 -> 210 bytes .../admin/styles/default/images/asb/logo.png | Bin 0 -> 4997 bytes .../styles/default/images/asb/manage.png | Bin 0 -> 221 bytes .../admin/styles/default/images/asb/pixel.png | Bin 0 -> 148 bytes .../styles/default/images/asb/settings.png | Bin 0 -> 299 bytes .../styles/default/images/asb/trashcan_bg.png | Bin 0 -> 2390 bytes .../styles/default/images/asb/visibility.png | Bin 0 -> 245 bytes Upload/images/asb/left_arrow.png | Bin 0 -> 230 bytes Upload/images/asb/right_arrow.png | Bin 0 -> 257 bytes Upload/images/asb/see_all.png | Bin 0 -> 1229 bytes Upload/images/asb/transparent.png | Bin 0 -> 148 bytes 16 files changed, 215 insertions(+) create mode 100644 Upload/admin/styles/default/asb/global.css create mode 100644 Upload/admin/styles/default/images/asb/add.png create mode 100644 Upload/admin/styles/default/images/asb/delete.png create mode 100644 Upload/admin/styles/default/images/asb/donate.png create mode 100644 Upload/admin/styles/default/images/asb/edit.png create mode 100644 Upload/admin/styles/default/images/asb/help.png create mode 100644 Upload/admin/styles/default/images/asb/logo.png create mode 100644 Upload/admin/styles/default/images/asb/manage.png create mode 100644 Upload/admin/styles/default/images/asb/pixel.png create mode 100644 Upload/admin/styles/default/images/asb/settings.png create mode 100644 Upload/admin/styles/default/images/asb/trashcan_bg.png create mode 100644 Upload/admin/styles/default/images/asb/visibility.png create mode 100644 Upload/images/asb/left_arrow.png create mode 100644 Upload/images/asb/right_arrow.png create mode 100644 Upload/images/asb/see_all.png create mode 100644 Upload/images/asb/transparent.png diff --git a/Upload/admin/styles/default/asb/global.css b/Upload/admin/styles/default/asb/global.css new file mode 100644 index 0000000..6f64df1 --- /dev/null +++ b/Upload/admin/styles/default/asb/global.css @@ -0,0 +1,215 @@ +/* + * Plugin Name: Advanced Sidebox for MyBB 1.8.x + * Copyright 2014 WildcardSearch + * http://www.rantcentralforums.com + * + * this file contains style information for the ACP pages + */ + +/* sidebox management */ + +div.container { + width: 100%; + background: #ffffff; +} + +table.content { + text-align: center; + width: 100%; + table-layout: fixed; + border-collapse: collapse; +} + +/* components */ + +div.draggable { + z-index: 50; +} + +.custom_type, .box_type, .sidebox { + cursor: move; + font-size: 12px; + padding: 3px; + margin: 2px 1px; + + -webkit-user-select: none; /* Safari*/ + -khtml-user-select: none; /* Konqueror */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Chrome and Opera */ + + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +.box_type { + background: #99e6ff; + border: 1px solid #0086b3; + /* text-align: center; + line-height: 15px; + text-shadow: 3px 3px 3px #070772; */ +} + +.custom_type { + background: #ffffbf; + border: 1px solid #b3b300; + /* width: 93%; + text-align: center; + line-height: 15px; + text-shadow: 3px 3px 3px #5a642f; */ +} + +.sidebox { + background: #bfffbf; + border: 1px solid #00b300; + line-height: 25px; + color: #000000; + position: relative; +} + +.column { + border: 1px solid #aaaaaa; +} + +td.hover { + background: #eeeeee; +} + +.trashcan { + min-height: 80px; +} + +.forum_column { + width: 225px; + min-height: 300px; +} + +#addon_menu { + border: 1px solid #aaaaaa; +} + +#custom_menu { + border: 1px solid #aaaaaa; +} + +.column_head { + background: #aaaaaa; + color: #333; + font-size: 1.5em; +} + +/* visibility chart */ + +.tooltip { + color: #000000; + outline: none; + cursor: help; + text-decoration: none; + position: relative; +} + +.tooltip span { + display: none; + position: absolute; + top: 0px; + left: -300px; + width: 300px; + + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +.tooltip:hover span { + display: inline; +} + +.custom { + z-index: 99; +} + +* html a:hover { + background: transparent; +} + +.info { + background: #99ccff; + border: 1px solid #7396ff; +} + +.info_icon { + position: relative; + float: left; + padding: 4px; +} + +.del_icon { + position: relative; + float: right; + padding: 4px; +} + +.box_info { + background: #cccccc; + color: #333; + border: 1px solid #888888; +} + +.box_info td { + width: 10px; + height: 10px; +} + +.script_header { + background: #ffffff; + color: #000; + + height: 10px; + text-align: right; + padding-right: 10px; +} + +.group_header { + background: #ffffff; + color: #000; +} + +td.info_cell { + height: 10px; + width: 10px; +} + +th.script_header { + color: #000; + height: 10px; +} + +td.on { + background: #cfffbf; +} + +td.off { + background: #ffffff; +} + +/* footer menu */ + +.asb_label { + color: #333; + font-weight: bold; + margin: auto auto; + padding: 5px 0px; + border: 1px solid #aaaaaa; + text-align: center; + + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} + +.asb_label a:hover, +.asb_label a:active { + color: #333; + text-decoration: none; +} \ No newline at end of file diff --git a/Upload/admin/styles/default/images/asb/add.png b/Upload/admin/styles/default/images/asb/add.png new file mode 100644 index 0000000000000000000000000000000000000000..716f66a588497c78f3bfe564da0530e8d740b526 GIT binary patch literal 408 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<9ti(TE9ieNTL=nl~+zopr077W2t^fc4 literal 0 HcmV?d00001 diff --git a/Upload/admin/styles/default/images/asb/delete.png b/Upload/admin/styles/default/images/asb/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..c6dd07611ea9443a8db31ac417a9e96afc9ad49e GIT binary patch literal 377 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|#^NA%Cx&(BWL^R}Y)RhkE)4%c zaKYZ?lYt_f1s;*b3=G`DAk4@xYmNj^kiEpy*OmP)lcBexS5qCr6uW#HLN+oE0pJ<{P#P^JcG)hj0LI0$wi;$APfgvq;+f~9l-nlHUu6Ye-BY%;F#N=+M-3txS^3v)ZrpV= z`sV$mH_fvAs!gJW&6@Ulyn8HRY?E-2DXN9-+{b%=oE|J`-+Wjj;km#4=KTEup1)T9 ST<8T11O`u6KbLh*2~7ZuR+xwY literal 0 HcmV?d00001 diff --git a/Upload/admin/styles/default/images/asb/donate.png b/Upload/admin/styles/default/images/asb/donate.png new file mode 100644 index 0000000000000000000000000000000000000000..67a4a915ef58d5eaa9658fee2952eb13a83397c9 GIT binary patch literal 1338 zcmV-A1;zS_P)P)t-s&kF+o z@!S9X`2Oa!|F1LutS$cJum0er{^6?r-=Y4}g#WQP|FbvgLS^D zd_Z1xfNw|sw@6@ge7}x65I$-UI%4kIub!WfFjRA|g*zZhan8S%uBw&)!et;yZSSWx z&cK}@LtrpUTb`kmFi~t!SyX?Dh`zOz{<=+YfrkIbY9L8({N;elmE|y&cB)7&Zht9!vFT@KwfrWVNq~@fd0W>?%AsT%z6I8VgABm zKwo$N^WXlwQvb$pKvG!{J7Z8~Z~v+({<=>8>c{TZrq7i){@|!^d2@hpNlc7AsJ9cXy-i?(Xg_)aAZ&e_40$5}M=!KV3dE_ukv@oBhtt&fM;5 zG+{*5(8MBo_bnZ%3P&Dah_)AJ?Ej)7=Qc&yi@Uz7%;79QE>aN4?DS=(L z`aKZLD1mE77hc6WY`$u<5%V#G(;xUK$}yg%Jt*g^ki+v^aEG6OsvZ)g27eIX`5YYO zc{}d&J#-YsTC1(Rv=!R>~R6w6>CT8-RTmEt4&VbSYra9r;umBj)? z&R#y}kz`8DM}=6C|G*Gt9Lyw6LaV`yTB)j#H5zJh*_@19215nblYVP5WpJt?e_hy- znD;VD0EY4J2BtC-k?CjrmqQ!lp?|1YDkOwb>EsgsCItCZ6kC2LfR^xqUi?FKivM3l-ft@7jl4t~ w%f6~eS!2xo-`&|TLKPZ1yW_lE)PEHH10>5~_f(qTegFUf07*qoM6N<$f_%EGd;kCd literal 0 HcmV?d00001 diff --git a/Upload/admin/styles/default/images/asb/edit.png b/Upload/admin/styles/default/images/asb/edit.png new file mode 100644 index 0000000000000000000000000000000000000000..ab8304eade2ea8ad6d71cc5e06392601e04352c5 GIT binary patch literal 574 zcmV-E0>S->P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*b{ z4<#wyZeA(?00F*9L_t(I%bk)i(5g(FKkhb&xcsJ-ZiP9_~HQg&ii!5&+^n zT^YRh18Ap^DwIT7avfL%0`=P6YviSzV{q;J49 za8A+{;Pipk+{eZwkY3Rx%95M51?&Slz+Kxh@VpA;nkHQ58gNX~y8&bk*bDsZ72Weu zmi)i$I8X1}UXb(&=-9q3>7ea?70R>2i5ue-M_KaJc2iP+0J#MuwqMsFBlXwTSqJtE ziaiB9kaP$rdPVor@ZT^RRcxH6S8b<~z5q+W2GF$qwF>2he<8r%)oPF%wvS7C4=mY! z2uuOm4ze{-P4NaWE2(e0Bk3M+*!J5hl*{9!G=L%G4lpC>hwTpV2smoHtU|dQ=jm9x zTbDi8ntuf>N?HLnB{glosX}?NZf7hg&eL`k$}qpsngxCX4N1)^lxMc|-rFB`u-Fi$Ri!X9dGy6SfW^1~xBdqg82KEkJV^JYD@<);T3K0RWR~FtPvu literal 0 HcmV?d00001 diff --git a/Upload/admin/styles/default/images/asb/logo.png b/Upload/admin/styles/default/images/asb/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..e9d4201b3a83affb068ec6857cf056bd69b8830f GIT binary patch literal 4997 zcmV;06MF24P)Px#24YJ`L;x}XLjamUq#0TO000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*Y} z0S*eaEnPMM0013nR9JLFZ*6U5Zgc_CX>@2HM@dakWG-a~000u) zNklNwTf zvD%il)Q&#ZwkjZ1%h;()M{#NETCn1RV%e001V~sz_T1ci-udI4`#Z~x*r)Ty{FC!M zdG5XE{LXKA_xJn0k?NXyrRVymuQ0coi_lT@p}Y?rjxBjQbsfcmq@oBK{iS?#E=-^X60&Sckw`-Mkyx51DZuRW!4% z_n5%_%%;7|xc3836uWW3{~~q)u`{Th$opb%i2pABAvAC>Rd3fd)stu=cxvjtq!}g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VxYuh{=YQ%1*YI~J{ld5#}E;W5nEITrK#Cv z^rAWAT`W^z+ouQEvSYuU=l9QjVin=klLy)Rzh3jc)sjV*jb=cMk~K-$T4HhC>1=Zz0D z!BfeVPrS*>r``_yABSs-pINiauL^pqwdk5h0YfU~;HcVlPoFphfSJ=q@T*nt(AM6C z3fywn3*_a+NG2U`ZkM@VTQU)V+wb|4*CpomYtO%AG!w@Sb`6bg`30i4W6-9F27_d)2EKLCl~Erg@cWh>9phGke&m$`26u) z^Dk$G3}!}x97l1|4(Y(3<7l@v$7C`^GTBAiQCnvzD@}04+zEErZy#PnNpZf7t2&d8 z4*)CNf6s;VE-T<~AMEDu+xL6uyK?&tQvj$MQp!nV%dPKw;L#80Os2mWP(6IOnVmKD zH0*QxqI>l!WbBxsloS{GHZ9r3o_hDW5yP>A`+4_M_I}VzixGO46;V_ewjwOl+uensgH_f8$l)yTh%9Dc;1&j9Muu5)B!GhKC7!;n><^h( z#aT=kl3gbPg}gmo978y+Cnqp4ZvIrnwr$InEer;W_w3oj!0#+_MuQ={#USJ~vqXd= z&-PC&9R?kVIXVj-F(oma<@NSvHfosF$hN?+At*C}Ekc>0;JI1@^M3`sfLnc;nRvyEuGk!oJ hE>9Q75RU7~2|zXz1LGsbJ;p#5gQu&X%Q~loCIG6HA4LEF literal 0 HcmV?d00001 diff --git a/Upload/admin/styles/default/images/asb/settings.png b/Upload/admin/styles/default/images/asb/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..25c2fe973e4619f41ae27c4236839020a0f2e6fa GIT binary patch literal 299 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv5AX?b1=2vk%*@Qj#>U0P#mmbp zB_$;*E9>d$84(fD-rhcK+O+@w|8L#iUItXhSQ6wH%;50sMjD8d&XcT2@mcaU|^G3 zy;{oQON-viL!xsW*wPo4Ed0Tuu(-CWBr%mW;OL=KuRgsD;^m2HdbzoL8i!uOjkvgd z&%eC8yIZoM;{3}`pRyKA`SE7%Q3uThk3PM3c$B1b_hcI}$`njxgN@xNA>knk@ literal 0 HcmV?d00001 diff --git a/Upload/admin/styles/default/images/asb/trashcan_bg.png b/Upload/admin/styles/default/images/asb/trashcan_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..cbc776b67561753f29d54614338b69d7c9ceaa0d GIT binary patch literal 2390 zcmV-c390spP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*b{ z5IPpJD4E0n00`DeL_t(|+U=ctj8(-Q$3MF)>hch%NNwGU^?|g5Avj~KVrfx8@lj%G zkw~qzO0WV}P#Ubp+P6@t7KkrW?L%vnah^?&;Dl((3&7eUZ6_MhLV1Ne2-R&PU zcez~eJ?GrJ>_yJZHz8!_&dlBYp5O0#e)IZG0}&AiFto8lfqw#DR#N;uGLp#E5MTmu zCNL1_54;a-_8cw+7AYxq7PUDZSfiw9hzxcunzXU)_58v-J=9Kc*9LqD>;|?2+q^?; z0A2+CqNI2wnr9|lUG#qx(dU+ch4162Vz@flZz)D~TFe%Uccron*j0IlJ&}1!eHqfUu zuq^89TwgB@>wt3#eKnL(^JTz7U={GTl44gD)i3;F+SqPDKmV}54-C(1WL#qOrvp!C zlG zPVd9H_uG=c{S@H2lxkm6QasfaeU(PW*D5K-Dk&aOQoLRe;ws-XtxAe_loZQ>5x_43 zvHh2-;OKoN#cN862fZLKNQj_kYh$m9(((~wZ}QPxF|N?Y_K56s;NBu3#=qE2ifujw zoCK^7kT08|&I?`DSFsr1tEAYc!l|Ta1Fi!W2k;>FvAbIa|{3C zskQBgz}*Q|4q?wiRfNOURhEZ_i_4VluEHiamKk{vx(|Cj>yo|-V!TL6@pc#fksE-= zqkkmgnUv4ZiWGH3eZzoCi<_U<#*T_CF``V_s4D&TVc=hp%KD%n#*fzFyB>{nCn9Z* zF76b_9{qkNQnc4xaRKwRv7f54pSvQJ^%dh)b@;C3k?usK%{jM5iaPepPDrVCjyCq# zz^Uq9rmO{c#&37aia4UJ6PoI^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ho%4MS_nLWZMm<=eq}bk2S zpI_-TqBeFJa8`}K#!e+guN>OuTeuT-D*%PNO=dimGu##91wS?M*XYC9{I9cp#amw^ zBJwLTW0VxjOUnD%@b{dVoTuo-U3d7N_4{ zKFHgkz|;CLzWw7HJ6m(Ln7ao!CC>JKY4UW=m@u!BbNM9xAg(hmo0uglq_n43N&H~F zc7SsQv&M$X2kjjPCo`*VPB)b>5jeH-)tzH*UT61CJi4VhWxe~QN)gH2DqgvXhCAGz jXS{4EefKl|aV2A4z8m*3llV-a0~kDA{an^LB{Ts5X?RqT literal 0 HcmV?d00001 diff --git a/Upload/images/asb/left_arrow.png b/Upload/images/asb/left_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..bf5342f2c740d27e2c57d9629881f5ad6f48cf59 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^>>xG=8<0#rS+W&KF%}28J29*~C-V}>VN3FMcLCBs z@Y8vBJ&@uo@Q5sCVBi)8VMc~ob0mO*>?NMQuIzW2`1#FDr>K140Scvgx;TbNT+Y3) zk@tWCkIO~-j@>11CQMS@#9^x{og(@yL4J7$)3(mr#K1FBo>{o=ZD-(|q;`v4ZBL1AM=DbNn|nzOD5=!Ybz*Q_$VM SXD2t%Mg~t;KbLh*2~7YPBuV`M literal 0 HcmV?d00001 diff --git a/Upload/images/asb/right_arrow.png b/Upload/images/asb/right_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..407d79272b3866016a7668a6fd17b561c239ad12 GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^>>xG=8<0#rS+W&KF%}28J29*~C-V}>VN3FMcLCBs z@Y8vBJ&@uo@Q5sCVBi)8VMc~ob0mO*>?NMQuIzW2`1#E_u7-EU0EHSoT^vIsE|*T& z$lIVG;?ndI7pj%~f;>=}2T_@HzDmlHcy?j7InK5VU!t>Yo6m$k>;}ahBpmQP8JAARXHf8&6ugo`P*Mqdsl;p=F^5h9a_OWz1{v7LpyV?t`LUD( zvD5;9MLo!({=lLYvT29d^db&j#bKzpjAAaM1b~=;8sNnO8eZ&=Kpg9E981e*mGRkt z4rZ6b9N>t6b5y_uDuj?;2ptnal_Fl1m{%>1tBH>@01|$!gnt}JfKMdAbwDCqpC|xM z0!e~~Bq7iUNQI}QqSG>wQ6_Fm7N1FuKb!LY6(;~}$|;9MXCu(Ihsg^~B87lO97YBb zLF1+*^0UDzeHOwAQFn4R7%s^n(Qr#9osoXX;HkD-Dg?r1D+wFT**`v2C*L=M_SKvy zHIPjlisgbiR+nm~pez?^f>$~j&w24}^YcqFZqg0wYn2+k_dgD|cUf8MHe6{?Q5Q!q zUlgsEe-*NxQ%Ra4OC2+RYce8iIQ#7Eu>SmRY+H&gFR&r>WBY(%F($gBo0q#L^UZR+>23`?wi^}X zi(7Zd{og0!L*%Kq73mK$y~BL_++MA0D5r(jD7 z)Sv7S(oyqLf6MKUT_v@H->4&PZ7;eYM)UBq4VQAY9S;ZY8*pjL?!DPJgu8d!;mQtZ zBGkk+4;hcwK@*A=za5yft<49IG+rAS$@=5kNZ)FE?u;&B+3F-r}k`<9ay$X3W^=&C1cjf%eP!ivlBCu5ldmHU;_0oJ$kAF`)o|;|dbgdcbbfS?h4cR6Xjfl( Vl@}@$hXvn+AmQlP3o(-7{{iNT9OnQ4 literal 0 HcmV?d00001 diff --git a/Upload/images/asb/transparent.png b/Upload/images/asb/transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..38b7cf4574fa0d3897966d6332b62a7dc0a395a6 GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?juK)l4Uw%aT1W2wV$S;_| z;n|He5GTpo-G!lpRn`N@;VkfoEM{Qf76xHPhFNnYfP(BLp1!W^51ClS*<{!s^uGiO iae2BphHzX@P5`o*7#JTZ?lA_k7(8A5T-G@yGywoYHX$eg literal 0 HcmV?d00001 From f81d770c522a0da0466798465a54f1b45a3db200 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 9 Sep 2018 18:15:44 -0500 Subject: [PATCH 03/10] Fixes #307 ...adds forum age module. --- .../english/admin/asb_addon.lang.php | 53 +++- .../inc/languages/english/asb_addon.lang.php | 53 +++- Upload/inc/plugins/asb/modules/forum_age.php | 261 ++++++++++++++++++ 3 files changed, 363 insertions(+), 4 deletions(-) create mode 100644 Upload/inc/plugins/asb/modules/forum_age.php diff --git a/Upload/inc/languages/english/admin/asb_addon.lang.php b/Upload/inc/languages/english/admin/asb_addon.lang.php index 0baed45..4dbb172 100644 --- a/Upload/inc/languages/english/admin/asb_addon.lang.php +++ b/Upload/inc/languages/english/admin/asb_addon.lang.php @@ -144,7 +144,7 @@ $l['asb_recent_posts_no_posts'] = 'There are no posts to display.'; -// pm's +// pms $l['asb_private_messages'] = 'Private Messages'; $l['asb_private_messages_desc'] = "Lists the user's PM info"; @@ -316,7 +316,7 @@ $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 + // 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}"; @@ -330,4 +330,53 @@ $l['asb_goals_footer_goal_reached'] = 'Goal Met!'; $l['asb_goals_footer_progress'] = 'Only {1} {2} left to go!'; +// forum age +$l['asb_forum_age_title'] = 'Forum Age'; +$l['asb_forum_age_description'] = 'Displays the date the forum was founded and/or the current age of the forum.'; + +$l['asb_forum_age_show_creation_date_title'] = 'Show Creation Date?'; +$l['asb_forum_age_show_creation_date_description'] = 'YES (default) to include the creation date of the forum in the descriptive text, NO to show only the forum age.'; + +$l['asb_forum_age_forum_age_date_format_title'] = 'Forum Age Date Format'; +$l['asb_forum_age_forum_age_date_format_description'] = 'Select an option to format to a specific time interval.'; + +$l['asb_forum_age_creation_date_format_title'] = 'Creation Date Format'; +$l['asb_forum_age_creation_date_format_description'] = 'Select a format for the creation date using PHP date() format'; + +$l['asb_forum_age_optionscode_second'] = 'Second'; +$l['asb_forum_age_optionscode_minute'] = 'Minute'; +$l['asb_forum_age_optionscode_hour'] = 'Hour'; +$l['asb_forum_age_optionscode_day'] = 'Day'; +$l['asb_forum_age_optionscode_week'] = 'Week'; +$l['asb_forum_age_optionscode_month'] = 'Month'; +$l['asb_forum_age_optionscode_year'] = 'Year'; + +$l['asb_forum_age_years'] = '{1} years'; +$l['asb_forum_age_year'] = '{1} year'; + +$l['asb_forum_age_months'] = '{1} months'; +$l['asb_forum_age_month'] = '{1} month'; + +$l['asb_forum_age_weeks'] = '{1} weeks'; +$l['asb_forum_age_week'] = '{1} week'; + +$l['asb_forum_age_days'] = '{1} days'; +$l['asb_forum_age_day'] = '{1} day'; + +$l['asb_forum_age_hours'] = '{1} hours'; +$l['asb_forum_age_hour'] = '{1} hour'; + +$l['asb_forum_age_minutes'] = '{1} minutes'; +$l['asb_forum_age_minute'] = '{1} minute'; + +$l['asb_forum_age_seconds'] = '{1} seconds'; +$l['asb_forum_age_second'] = '{1} second'; + +$l['asb_forum_age_less_than'] = 'less than a'; + +$l['asb_forum_age_text'] = '{1} has been active for {2}'; + +$l['asb_forum_age_and'] = 'and '; +$l['asb_forum_age_founded_message'] = 'This forum was founded on {1}'; + ?> diff --git a/Upload/inc/languages/english/asb_addon.lang.php b/Upload/inc/languages/english/asb_addon.lang.php index 0baed45..4dbb172 100644 --- a/Upload/inc/languages/english/asb_addon.lang.php +++ b/Upload/inc/languages/english/asb_addon.lang.php @@ -144,7 +144,7 @@ $l['asb_recent_posts_no_posts'] = 'There are no posts to display.'; -// pm's +// pms $l['asb_private_messages'] = 'Private Messages'; $l['asb_private_messages_desc'] = "Lists the user's PM info"; @@ -316,7 +316,7 @@ $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 + // 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}"; @@ -330,4 +330,53 @@ $l['asb_goals_footer_goal_reached'] = 'Goal Met!'; $l['asb_goals_footer_progress'] = 'Only {1} {2} left to go!'; +// forum age +$l['asb_forum_age_title'] = 'Forum Age'; +$l['asb_forum_age_description'] = 'Displays the date the forum was founded and/or the current age of the forum.'; + +$l['asb_forum_age_show_creation_date_title'] = 'Show Creation Date?'; +$l['asb_forum_age_show_creation_date_description'] = 'YES (default) to include the creation date of the forum in the descriptive text, NO to show only the forum age.'; + +$l['asb_forum_age_forum_age_date_format_title'] = 'Forum Age Date Format'; +$l['asb_forum_age_forum_age_date_format_description'] = 'Select an option to format to a specific time interval.'; + +$l['asb_forum_age_creation_date_format_title'] = 'Creation Date Format'; +$l['asb_forum_age_creation_date_format_description'] = 'Select a format for the creation date using PHP date() format'; + +$l['asb_forum_age_optionscode_second'] = 'Second'; +$l['asb_forum_age_optionscode_minute'] = 'Minute'; +$l['asb_forum_age_optionscode_hour'] = 'Hour'; +$l['asb_forum_age_optionscode_day'] = 'Day'; +$l['asb_forum_age_optionscode_week'] = 'Week'; +$l['asb_forum_age_optionscode_month'] = 'Month'; +$l['asb_forum_age_optionscode_year'] = 'Year'; + +$l['asb_forum_age_years'] = '{1} years'; +$l['asb_forum_age_year'] = '{1} year'; + +$l['asb_forum_age_months'] = '{1} months'; +$l['asb_forum_age_month'] = '{1} month'; + +$l['asb_forum_age_weeks'] = '{1} weeks'; +$l['asb_forum_age_week'] = '{1} week'; + +$l['asb_forum_age_days'] = '{1} days'; +$l['asb_forum_age_day'] = '{1} day'; + +$l['asb_forum_age_hours'] = '{1} hours'; +$l['asb_forum_age_hour'] = '{1} hour'; + +$l['asb_forum_age_minutes'] = '{1} minutes'; +$l['asb_forum_age_minute'] = '{1} minute'; + +$l['asb_forum_age_seconds'] = '{1} seconds'; +$l['asb_forum_age_second'] = '{1} second'; + +$l['asb_forum_age_less_than'] = 'less than a'; + +$l['asb_forum_age_text'] = '{1} has been active for {2}'; + +$l['asb_forum_age_and'] = 'and '; +$l['asb_forum_age_founded_message'] = 'This forum was founded on {1}'; + ?> diff --git a/Upload/inc/plugins/asb/modules/forum_age.php b/Upload/inc/plugins/asb/modules/forum_age.php new file mode 100644 index 0000000..b228391 --- /dev/null +++ b/Upload/inc/plugins/asb/modules/forum_age.php @@ -0,0 +1,261 @@ +
Please make sure IN_MYBB is defined.'); +} + +/** + * provide info to ASB about the addon + * + * @return array + */ +function asb_forum_age_info() +{ + global $lang; + + if (!$lang->asb_addon) { + $lang->load('asb_addon'); + } + + return array ( + 'title' => $lang->asb_forum_age_title, + 'description' => $lang->asb_forum_age_description, + 'wrap_content' => true, + 'version' => '1.0.0', + 'compatibility' => '2.1', + 'xmlhttp' => true, + 'settings' => array( + 'forum_age_date_format' => array( + 'name' => 'forum_age_date_format', + 'title' => $lang->asb_forum_age_forum_age_date_format_title, + 'description' => $lang->asb_forum_age_forum_age_date_format_description, + 'optionscode' => <<asb_forum_age_optionscode_year} +2={$lang->asb_forum_age_optionscode_month} +3={$lang->asb_forum_age_optionscode_week} +4={$lang->asb_forum_age_optionscode_day} +5={$lang->asb_forum_age_optionscode_hour} +6={$lang->asb_forum_age_optionscode_minute} +7={$lang->asb_forum_age_optionscode_second} +EOF + , + 'value' => 'year', + ), + 'show_creation_date' => array( + 'name' => 'show_creation_date', + 'title' => $lang->asb_forum_age_show_creation_date_title, + 'description' => $lang->asb_forum_age_show_creation_date_description, + 'optionscode' => 'yesno', + 'value' => '1', + ), + 'creation_date_format' => array( + 'name' => 'creation_date_format', + 'title' => $lang->asb_forum_age_creation_date_format_title, + 'description' => $lang->asb_forum_age_creation_date_format_description, + 'optionscode' => 'text', + 'value' => 'F jS, Y', + ), + '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_forum_age', + 'template' => << + {\$forumAge} + {\$creationDate} +EOF + ), + array( + 'title' => 'asb_forum_age_creation_date', + 'template' => << + {\$creationText} + +EOF + ), + array( + 'title' => 'asb_forum_age_text', + 'template' => <<{\$forumAgeText} +EOF + ), + ), + ); +} + +/** + * handles display of children of this addon at page load + * + * @param array + * @return bool success/fail + */ +function asb_forum_age_build_template($args) +{ + extract($args); + global $$template_var, $lang; + + if (!$lang->asb_addon) { + $lang->load('asb_addon'); + } + + $forum_age_status = asb_forum_age_get_forum_age($args); + if (!$forum_age_status) { + $$template_var = "{$lang->asb_forum_age_no_content}"; + return false; + } + + $$template_var = $forum_age_status; + return true; +} + +/** + * AJAX + * + * @param array + * @return string + */ +function asb_forum_age_xmlhttp($args) +{ + $forum_age_status = asb_forum_age_get_forum_age($args); + if ($forum_age_status) { + return $forum_age_status; + } + return 'nochange'; +} + +/** + * build the content based on settings + * + * @param array + * @return string + */ +function asb_forum_age_get_forum_age($args) +{ + global $mybb, $db, $lang, $templates; + + if (!$lang->asb_addon) { + $lang->load('asb_addon'); + } + + extract($args); + + // get the forum creation date + $query = $db->simple_select('users', 'regdate', "uid='1'"); + if ($db->num_rows($query) == 0) { + return false; + } + + $creationDateStamp = $db->fetch_field($query, 'regdate'); + + // if we are showing the creation date, include the footer + if ($settings['show_creation_date']) { + $format = $mybb->settings['dateformat']; + if ($settings['creation_date_format']) { + $format = $settings['creation_date_format']; + } + + $creationDate = my_date($format, $creationDateStamp); + $creationText = $lang->sprintf($lang->asb_forum_age_founded_message, $creationDate); + eval("\$creationDate = \"{$templates->get('asb_forum_age_creation_date')}\";"); + } + + // information for all increments + $allInfo = array( + 1 => array('name' => 'year', 'inSeconds' => 365 * 24 * 60 * 60), + 2 => array('name' => 'month', 'inSeconds' => 30 * 24 * 60 * 60), + 3 => array('name' => 'week', 'inSeconds' => 7 * 24 * 60 * 60), + 4 => array('name' => 'day', 'inSeconds' => 24 * 60 * 60), + 5 => array('name' => 'hour', 'inSeconds' => 60 * 60), + 6 => array('name' => 'minute', 'inSeconds' => 60), + 7 => array('name' => 'second', 'inSeconds' => 1), + ); + + /** + * loop through each increment and determine whether that + * increment should be shown, hidden, or replaced + */ + $start = $settings['forum_age_date_format']; + $age = TIME_NOW - $creationDateStamp; + foreach ($allInfo as $i => $info) { + $varName = $info['name'] . 's'; + $$varName = 0; + + if ($age > $info['inSeconds']) { + $$varName = (int) ($age / $info['inSeconds']); + $age = $age - ($$varName * $info['inSeconds']); + } + + $key = "asb_forum_age_{$info['name']}"; + $data = $$varName; + if ($$varName > 1) { + $key .= 's'; + } elseif ($$varName == 0) { + $data = $lang->asb_forum_age_less_than; + } + + $forumAgeArray[] = $lang->sprintf($lang->$key, $data); + } + + // remove increments before the selected value that are empty + for ($x = 2; $x < 8; $x++) { + $varName = $allInfo[$x - 1]['name'] . 's'; + if ($settings['forum_age_date_format'] >= $x && + $$varName == 0) { + array_shift($forumAgeArray); + $start--; + } + } + + // remove increments after the selected value + for ($x = $start; $x < 7; $x++) { + unset($forumAgeArray[$x]); + } + + // 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]; + } + + // compile the time text + $forumAgeText = implode(', ', $forumAgeArray); + eval("\$forumAgeText = \"{$templates->get('asb_forum_age_text')}\";"); + $forumAge = $lang->sprintf($lang->asb_forum_age_text, $mybb->settings['bbname'], $forumAgeText); + + eval("\$returnValue = \"{$templates->get('asb_forum_age')}\";"); + return $returnValue; +} + +/** + * insert peeker for creation date + * + * @return void + */ +function asb_forum_age_settings_load() +{ + echo << + new Peeker($(".setting_show_creation_date"), $("#setting_creation_date_format"), /1/, true); + +EOF; +} + +?> From 173a9ff731cf4a26470c6dbb8577aae8d731ffee Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 9 Sep 2018 20:45:49 -0500 Subject: [PATCH 04/10] Fixes #306 ...adds birthdays module. --- .../english/admin/asb_addon.lang.php | 18 ++ .../inc/languages/english/asb_addon.lang.php | 18 ++ Upload/inc/plugins/asb/modules/birthdays.php | 158 ++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 Upload/inc/plugins/asb/modules/birthdays.php diff --git a/Upload/inc/languages/english/admin/asb_addon.lang.php b/Upload/inc/languages/english/admin/asb_addon.lang.php index 4dbb172..fcbc637 100644 --- a/Upload/inc/languages/english/admin/asb_addon.lang.php +++ b/Upload/inc/languages/english/admin/asb_addon.lang.php @@ -379,4 +379,22 @@ $l['asb_forum_age_and'] = 'and '; $l['asb_forum_age_founded_message'] = 'This forum was founded on {1}'; +$l['asb_forum_age_no_content'] = 'nothing to show'; + +// birthdays +$l['asb_birthdays_title'] = 'Birthdays'; +$l['asb_birthdays_description'] = 'Displays birthdays for the month, or today'; + +$l['asb_birthdays_time_frame_title'] = 'Timeframe'; +$l['asb_birthdays_time_frame_description'] = 'Choose to show birthdays for the month, today'; + +$l['asb_birthdays_timeframe_optionscode_this_month'] = 'This Month'; +$l['asb_birthdays_timeframe_optionscode_today'] = 'Today'; + +$l['asb_birthdays_this_months_birthdays'] = 'This Month\'s Birthdays'; +$l['asb_birthdays_todays_birthdays'] = 'Today\'s Birthdays'; + +$l['asb_birthdays_user_info'] = '{1} on {2}'; +$l['asb_birthdays_no_content'] = 'no birthdays to show'; + ?> diff --git a/Upload/inc/languages/english/asb_addon.lang.php b/Upload/inc/languages/english/asb_addon.lang.php index 4dbb172..fcbc637 100644 --- a/Upload/inc/languages/english/asb_addon.lang.php +++ b/Upload/inc/languages/english/asb_addon.lang.php @@ -379,4 +379,22 @@ $l['asb_forum_age_and'] = 'and '; $l['asb_forum_age_founded_message'] = 'This forum was founded on {1}'; +$l['asb_forum_age_no_content'] = 'nothing to show'; + +// birthdays +$l['asb_birthdays_title'] = 'Birthdays'; +$l['asb_birthdays_description'] = 'Displays birthdays for the month, or today'; + +$l['asb_birthdays_time_frame_title'] = 'Timeframe'; +$l['asb_birthdays_time_frame_description'] = 'Choose to show birthdays for the month, today'; + +$l['asb_birthdays_timeframe_optionscode_this_month'] = 'This Month'; +$l['asb_birthdays_timeframe_optionscode_today'] = 'Today'; + +$l['asb_birthdays_this_months_birthdays'] = 'This Month\'s Birthdays'; +$l['asb_birthdays_todays_birthdays'] = 'Today\'s Birthdays'; + +$l['asb_birthdays_user_info'] = '{1} on {2}'; +$l['asb_birthdays_no_content'] = 'no birthdays to show'; + ?> diff --git a/Upload/inc/plugins/asb/modules/birthdays.php b/Upload/inc/plugins/asb/modules/birthdays.php new file mode 100644 index 0000000..74a101b --- /dev/null +++ b/Upload/inc/plugins/asb/modules/birthdays.php @@ -0,0 +1,158 @@ +
Please make sure IN_MYBB is defined.'); +} + +/** + * provide info to ASB about the addon + * + * @return array + */ +function asb_birthdays_info() +{ + global $lang; + + if (!$lang->asb_addon) { + $lang->load('asb_addon'); + } + + return array ( + 'title' => $lang->asb_birthdays_title, + 'description' => $lang->asb_birthdays_description, + 'wrap_content' => true, + 'version' => '1.0.0', + 'compatibility' => '2.1', + 'settings' => array( + 'timeframe' => array( + 'name' => 'timeframe', + 'title' => $lang->asb_birthdays_time_frame_title, + 'description' => $lang->asb_birthdays_time_frame_description, + 'optionscode' => <<asb_birthdays_timeframe_optionscode_this_month} +2={$lang->asb_birthdays_timeframe_optionscode_today} +EOF + , + 'value' => '2', + ), + ), + 'templates' => array( + array( + 'title' => 'asb_birthdays', + 'template' => << + + {\$birthdaysTitle} + + + + + {\$userList} + + +EOF + ), + array( + 'title' => 'asb_birthdays_user_link', + 'template' => <<{\$name} +EOF + ), + ), + ); +} + +/** + * handles display of children of this addon at page load + * + * @param array + * @return bool success/fail + */ +function asb_birthdays_build_template($args) +{ + extract($args); + global $$template_var, $lang; + + if (!$lang->asb_addon) { + $lang->load('asb_addon'); + } + + $birthdays_status = asb_birthdays_get_birthdays($args); + if (!$birthdays_status) { + $$template_var = "{$lang->asb_birthdays_no_content}"; + return false; + } + + $$template_var = $birthdays_status; + return true; +} + +/** + * build the content based on settings + * + * @param array + * @return string + */ +function asb_birthdays_get_birthdays($args) +{ + global $mybb, $db, $lang, $templates, $cache; + + if (!$lang->asb_addon) { + $lang->load('asb_addon'); + } + + extract($args); + + require_once MYBB_ROOT.'inc/functions_calendar.php'; + $day = my_date('j'); + $month = my_date('n'); + $year = my_date('Y'); + $today = ($settings['timeframe'] == 2); + + /** + * results by month return with a slighlty different + * structure so we have to modify the daily to match + */ + if (!$today) { + $birthdaysTitle = $lang->asb_birthdays_this_months_birthdays; + $birthdays = get_birthdays($month); + } else { + $birthdaysTitle = $lang->asb_birthdays_todays_birthdays; + $birthdays = get_birthdays($month, $day); + $birthdays = array("{$day}-{$month}" => $birthdays); + } + + // build the user list + $userList = $sep = ''; + foreach ($birthdays as $date => $users) { + foreach ($users as $user) { + if ($user['birthdayprivacy'] != 'all') { + continue; + } + + $name = format_name(htmlspecialchars_uni($user['username']), $user['usergroup'], $user['displaygroup']); + $profileLink = get_profile_link($user['uid']); + + $birthday = my_date('F jS, Y', strtotime("{$year}-{$date}")); + $userInfo = $lang->sprintf($lang->asb_birthdays_user_info, $user['age'], $birthday); + + eval("\$userList .= \$sep . \"{$templates->get('asb_birthdays_user_link')}\";"); + $sep = ', '; + } + } + + eval("\$returnValue = \"{$templates->get('asb_birthdays')}\";"); + return $returnValue; +} + +?> From 464c7cb6e064e60e1d828b071c53917426905eba Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Mon, 10 Sep 2018 14:59:20 -0500 Subject: [PATCH 05/10] Fixes #319 --- Upload/inc/plugins/asb/functions_acp.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Upload/inc/plugins/asb/functions_acp.php b/Upload/inc/plugins/asb/functions_acp.php index 2d6908d..4995f0f 100644 --- a/Upload/inc/plugins/asb/functions_acp.php +++ b/Upload/inc/plugins/asb/functions_acp.php @@ -588,6 +588,7 @@ function asb_build_setting($this_form, $this_form_container, $setting) $type = array_map('trim', $type); $element_name = "{$setting['name']}"; $element_id = "setting_{$setting['name']}"; + $row_id = "row_{$element_id}"; // prepare labels $this_label = '' . htmlspecialchars_uni($setting['title']) . ''; @@ -596,21 +597,21 @@ 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" => $element_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' => $element_id)); + $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') { - $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' => $element_id)); + $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)); } 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' => $element_id)); + $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)); } 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' => $element_id)); + $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)); } 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' => $element_id)); + $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)); } 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' => $element_id)); + $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'] . "\";"); @@ -638,14 +639,14 @@ function asb_build_setting($this_form, $this_form_container, $setting) } } 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' => $element_id)); + $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)); } else { $setting_code = implode('
', $option_list); } } if ($setting_code) { - $this_form_container->output_row($this_label, $this_desc, $setting_code, '', array(), array('id' => 'row_' . $element_id)); + $this_form_container->output_row($this_label, $this_desc, $setting_code, '', array(), array('id' => $row_id)); } } From 76143a21898b6236373304751e8e39780fca5cbe Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Mon, 10 Sep 2018 15:36:25 -0500 Subject: [PATCH 06/10] Fixes #317 --- Upload/inc/plugins/asb/modules/forum_age.php | 2 +- Upload/inc/plugins/asb/modules/latest_threads.php | 15 +++++++++++++++ Upload/inc/plugins/asb/modules/whosonline.php | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Upload/inc/plugins/asb/modules/forum_age.php b/Upload/inc/plugins/asb/modules/forum_age.php index b228391..7f7234c 100644 --- a/Upload/inc/plugins/asb/modules/forum_age.php +++ b/Upload/inc/plugins/asb/modules/forum_age.php @@ -253,7 +253,7 @@ function asb_forum_age_settings_load() echo << - new Peeker($(".setting_show_creation_date"), $("#setting_creation_date_format"), /1/, true); + new Peeker($(".setting_show_creation_date"), $("#row_setting_creation_date_format"), /1/, true); EOF; } diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php index cc7173b..020388b 100644 --- a/Upload/inc/plugins/asb/modules/latest_threads.php +++ b/Upload/inc/plugins/asb/modules/latest_threads.php @@ -421,4 +421,19 @@ function asb_latest_threads_get_threadlist($settings, $width) return false; } +/** + * insert peeker for creation date + * + * @return void + */ +function asb_latest_threads_settings_load() +{ + echo << + new Peeker($(".setting_last_poster_avatar"), $("#row_setting_avatar_width"), /1/, true); + +EOF; +} + ?> diff --git a/Upload/inc/plugins/asb/modules/whosonline.php b/Upload/inc/plugins/asb/modules/whosonline.php index a0554da..0367e3c 100644 --- a/Upload/inc/plugins/asb/modules/whosonline.php +++ b/Upload/inc/plugins/asb/modules/whosonline.php @@ -334,4 +334,19 @@ function asb_whosonline_get_online_members($settings, $width) } } +/** + * insert peeker for creation date + * + * @return void + */ +function asb_whosonline_settings_load() +{ + echo << + new Peeker($(".setting_show_avatars"), $("#row_setting_asb_avatar_per_row, #row_setting_asb_avatar_max_rows, #row_setting_asb_avatar_maintain_aspect"), /1/, true); + +EOF; +} + ?> From f171bfd216b2a23a90525202dd9995ddc9b72604 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 23 Sep 2018 07:40:42 -0500 Subject: [PATCH 07/10] Fixes #321 --- 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 fcbc637..e71f927 100644 --- a/Upload/inc/languages/english/admin/asb_addon.lang.php +++ b/Upload/inc/languages/english/admin/asb_addon.lang.php @@ -148,7 +148,6 @@ $l['asb_private_messages'] = 'Private Messages'; $l['asb_private_messages_desc'] = "Lists the user's PM info"; -$l['asb_pms_received_new'] = '{1}, you have {2} unread message(s).'; $l['asb_pms_received_new'] = '{1}, you have {2} unread message(s).'; $l['asb_pms_no_messages'] = 'Please {1} or {2} to use this functionality.'; diff --git a/Upload/inc/languages/english/asb_addon.lang.php b/Upload/inc/languages/english/asb_addon.lang.php index fcbc637..e71f927 100644 --- a/Upload/inc/languages/english/asb_addon.lang.php +++ b/Upload/inc/languages/english/asb_addon.lang.php @@ -148,7 +148,6 @@ $l['asb_private_messages'] = 'Private Messages'; $l['asb_private_messages_desc'] = "Lists the user's PM info"; -$l['asb_pms_received_new'] = '{1}, you have {2} unread message(s).'; $l['asb_pms_received_new'] = '{1}, you have {2} unread message(s).'; $l['asb_pms_no_messages'] = 'Please {1} or {2} to use this functionality.'; From f53f9cc17f33a9cce780341cb1d8851032edb452 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 23 Sep 2018 07:52:54 -0500 Subject: [PATCH 08/10] Fixes #322 --- Upload/inc/plugins/asb/modules/latest_threads.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Upload/inc/plugins/asb/modules/latest_threads.php b/Upload/inc/plugins/asb/modules/latest_threads.php index 020388b..d2304ab 100644 --- a/Upload/inc/plugins/asb/modules/latest_threads.php +++ b/Upload/inc/plugins/asb/modules/latest_threads.php @@ -28,7 +28,7 @@ function asb_latest_threads_info() return array( 'title' => $lang->asb_latest_threads, 'description' => $lang->asb_latest_threads_desc, - 'version' => '1.1.3', + 'version' => '1.2.0', 'compatibility' => '2.1', 'wrap_content' => true, 'xmlhttp' => true, @@ -144,6 +144,12 @@ function asb_latest_threads_info() 'title' => 'asb_latest_threads_last_poster_avatar', 'template' => <<{\$lang->asb_latest_threads_lastpost} +EOF + ), + array( + 'title' => 'asb_latest_threads_last_poster_avatar_avatar', + 'template' => << EOF ), ), @@ -334,9 +340,7 @@ function asb_latest_threads_get_threadlist($settings, $width) $avatarInfo = format_avatar($thread['avatar']); - $avatar = << -EOF; + eval("\$avatar = \"{$templates->get('asb_latest_threads_last_poster_avatar_avatar')}\";"); $formatted_name = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']); From 5a6661346bf1945964204298c1e56f99f336e3d6 Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 23 Sep 2018 10:12:14 -0500 Subject: [PATCH 09/10] For #306 Redesigned completely due to user feedback. --- .../english/admin/asb_addon.lang.php | 5 +- .../inc/languages/english/asb_addon.lang.php | 5 +- Upload/inc/plugins/asb/modules/birthdays.php | 127 +++++++++++++----- 3 files changed, 98 insertions(+), 39 deletions(-) diff --git a/Upload/inc/languages/english/admin/asb_addon.lang.php b/Upload/inc/languages/english/admin/asb_addon.lang.php index e71f927..b6c1fbb 100644 --- a/Upload/inc/languages/english/admin/asb_addon.lang.php +++ b/Upload/inc/languages/english/admin/asb_addon.lang.php @@ -390,10 +390,13 @@ $l['asb_birthdays_timeframe_optionscode_this_month'] = 'This Month'; $l['asb_birthdays_timeframe_optionscode_today'] = 'Today'; -$l['asb_birthdays_this_months_birthdays'] = 'This Month\'s Birthdays'; +$l['asb_birthdays_upcoming_birthdays'] = 'Upcoming Birthdays'; $l['asb_birthdays_todays_birthdays'] = 'Today\'s Birthdays'; $l['asb_birthdays_user_info'] = '{1} on {2}'; $l['asb_birthdays_no_content'] = 'no birthdays to show'; +$l['asb_birthdays_no_birthdays_today'] = 'No birthdays today.'; +$l['asb_birthdays_no_upcoming_birthdays'] = 'No upcoming birthdays.'; + ?> diff --git a/Upload/inc/languages/english/asb_addon.lang.php b/Upload/inc/languages/english/asb_addon.lang.php index e71f927..b6c1fbb 100644 --- a/Upload/inc/languages/english/asb_addon.lang.php +++ b/Upload/inc/languages/english/asb_addon.lang.php @@ -390,10 +390,13 @@ $l['asb_birthdays_timeframe_optionscode_this_month'] = 'This Month'; $l['asb_birthdays_timeframe_optionscode_today'] = 'Today'; -$l['asb_birthdays_this_months_birthdays'] = 'This Month\'s Birthdays'; +$l['asb_birthdays_upcoming_birthdays'] = 'Upcoming Birthdays'; $l['asb_birthdays_todays_birthdays'] = 'Today\'s Birthdays'; $l['asb_birthdays_user_info'] = '{1} on {2}'; $l['asb_birthdays_no_content'] = 'no birthdays to show'; +$l['asb_birthdays_no_birthdays_today'] = 'No birthdays today.'; +$l['asb_birthdays_no_upcoming_birthdays'] = 'No upcoming birthdays.'; + ?> diff --git a/Upload/inc/plugins/asb/modules/birthdays.php b/Upload/inc/plugins/asb/modules/birthdays.php index 74a101b..fb4ef0e 100644 --- a/Upload/inc/plugins/asb/modules/birthdays.php +++ b/Upload/inc/plugins/asb/modules/birthdays.php @@ -32,40 +32,49 @@ function asb_birthdays_info() 'wrap_content' => true, 'version' => '1.0.0', 'compatibility' => '2.1', - 'settings' => array( - 'timeframe' => array( - 'name' => 'timeframe', - 'title' => $lang->asb_birthdays_time_frame_title, - 'description' => $lang->asb_birthdays_time_frame_description, - 'optionscode' => <<asb_birthdays_timeframe_optionscode_this_month} -2={$lang->asb_birthdays_timeframe_optionscode_today} -EOF - , - 'value' => '2', - ), - ), 'templates' => array( array( 'title' => 'asb_birthdays', 'template' => << - {\$birthdaysTitle} + {\$lang->asb_birthdays_todays_birthdays} + + {\$todaysBirthdays} + + + {\$lang->asb_birthdays_upcoming_birthdays} + + {\$upcomingBirthdays} +EOF + ), + array( + 'title' => 'asb_birthdays_user_row', + 'template' => << + + {\$avatar} ({\$user[\'age\']}){\$name} + +EOF + ), + array( + 'title' => 'asb_birthdays_no_birthdays', + 'template' => << - - {\$userList} + + {\$noBirthdays} + EOF ), array( - 'title' => 'asb_birthdays_user_link', + 'title' => 'asb_birthdays_user_avatar', 'template' => <<{\$name} +avatar + EOF ), ), @@ -117,26 +126,61 @@ function asb_birthdays_get_birthdays($args) $day = my_date('j'); $month = my_date('n'); $year = my_date('Y'); - $today = ($settings['timeframe'] == 2); - - /** - * results by month return with a slighlty different - * structure so we have to modify the daily to match - */ - if (!$today) { - $birthdaysTitle = $lang->asb_birthdays_this_months_birthdays; - $birthdays = get_birthdays($month); - } else { - $birthdaysTitle = $lang->asb_birthdays_todays_birthdays; - $birthdays = get_birthdays($month, $day); - $birthdays = array("{$day}-{$month}" => $birthdays); + + $todaysBirthdayUsers = get_birthdays($month, $day); + $upcomingBirthdayUsers = get_birthdays($month); + + $userAvatars = $userAvatarList = array(); + foreach ($upcomingBirthdayUsers as $users) { + foreach ($users as $user) { + $userAvatarList[] = $user['uid']; + } + } + + $userAvatarList = implode(',', $userAvatarList); + $query = $db->simple_select('users', 'uid, avatar, avatardimensions', "uid IN({$userAvatarList})"); + while ($user = $db->fetch_array($query)) { + $userAvatars[$user['uid']] = format_avatar($user['avatar'], $user['avatardimensions'], '20x20'); + } + + $alreadyDone = array(); + $altbg = 'trow1'; + $todaysBirthdays = ''; + foreach ($todaysBirthdayUsers as $user) { + if ($user['birthdayprivacy'] != 'all') { + continue; + } + + $name = format_name(htmlspecialchars_uni($user['username']), $user['usergroup'], $user['displaygroup']); + $profileLink = get_profile_link($user['uid']); + + $birthday = my_date('F jS, Y', strtotime("{$year}-{$day}-{$month}")); + $userInfo = $lang->sprintf($lang->asb_birthdays_user_info, $user['age'], $birthday); + + $avatarInfo = $userAvatars[$user['uid']]; + eval("\$avatar = \"{$templates->get('asb_birthdays_user_avatar')}\";"); + + eval("\$todaysBirthdays .= \"{$templates->get('asb_birthdays_user_row')}\";"); + + $altbg = alt_trow(); + $alreadyDone[$user['uid']] = true; + } + + if (!$todaysBirthdays) { + $noBirthdays = $lang->asb_birthdays_no_birthdays_today; + eval("\$todaysBirthdays = \"{$templates->get('asb_birthdays_no_birthdays')}\";"); } // build the user list - $userList = $sep = ''; - foreach ($birthdays as $date => $users) { + $altbg = 'trow1'; + $upcomingBirthdays = ''; + foreach ($upcomingBirthdayUsers as $date => $users) { foreach ($users as $user) { - if ($user['birthdayprivacy'] != 'all') { + $dateParts = explode('-', $date); + $userDay = $dateParts[0]; + if ($user['birthdayprivacy'] != 'all' || + $alreadyDone[$user['uid']] || + $userDay <= $day) { continue; } @@ -146,11 +190,20 @@ function asb_birthdays_get_birthdays($args) $birthday = my_date('F jS, Y', strtotime("{$year}-{$date}")); $userInfo = $lang->sprintf($lang->asb_birthdays_user_info, $user['age'], $birthday); - eval("\$userList .= \$sep . \"{$templates->get('asb_birthdays_user_link')}\";"); - $sep = ', '; + $avatarInfo = $userAvatars[$user['uid']]; + eval("\$avatar = \"{$templates->get('asb_birthdays_user_avatar')}\";"); + + eval("\$upcomingBirthdays .= \"{$templates->get('asb_birthdays_user_row')}\";"); + + $altbg = alt_trow(); } } + if (!$upcomingBirthdays) { + $noBirthdays = $lang->asb_birthdays_no_upcoming_birthdays; + eval("\$upcomingBirthdays = \"{$templates->get('asb_birthdays_no_birthdays')}\";"); + } + eval("\$returnValue = \"{$templates->get('asb_birthdays')}\";"); return $returnValue; } From 7f902ca41cc4257790ab3fa154eae7aea5c557be Mon Sep 17 00:00:00 2001 From: Mark Vincent Date: Sun, 23 Sep 2018 10:43:44 -0500 Subject: [PATCH 10/10] 1.1.13 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 408a10e..76fee6d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Advanced-Sidebox 3.1.12 +## Advanced-Sidebox 3.1.13

Advanced Sidebox Logo diff --git a/Upload/inc/plugins/asb.php b/Upload/inc/plugins/asb.php index 0efe63c..97abf00 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.12'); +define('ASB_VERSION', '3.1.13'); define('ASB_CUSTOM_VERSION', '2.0'); define('ASB_SCRIPT_VERSION', '2.0');