From ee1bcb70457292b077fe4861a290e6064c34b6fd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 24 Jun 2017 22:42:47 -0400 Subject: [PATCH 001/170] initial --- .gitignore | 2 +- README.md | 4 +- action.post.php | 56 +- action.topic.php | 61 +- admin/about.php | 8 +- admin/admin_cat_manager.php | 55 +- admin/admin_digest.php | 25 +- admin/admin_footer.php | 11 +- admin/admin_forum_manager.php | 106 +-- admin/admin_forum_prune.php | 91 +- admin/admin_forum_reorder.php | 29 +- admin/admin_groupmod.php | 36 +- admin/admin_header.php | 44 +- admin/admin_permissions.php | 120 +-- admin/admin_report.php | 62 +- admin/admin_synchronization.php | 33 +- admin/admin_type_manager.php | 188 ++-- admin/admin_votedata.php | 31 +- admin/index.php | 219 ++--- admin/menu.php | 57 +- admin/migrate.php | 94 ++ assets/css/index.html | 2 +- assets/images/category/index.html | 2 +- assets/images/category/newbb.png | Bin 959 -> 1650 bytes assets/images/category/topxoops.png | Bin 537 -> 618 bytes assets/images/filetypes/html.gif | Bin 180 -> 183 bytes assets/images/filetypes/wav.gif | Bin 160 -> 162 bytes assets/images/logo_module.png | Bin 0 -> 6510 bytes assets/images/menu/digest.png | Bin 982 -> 1354 bytes assets/images/menu/index.html | 2 +- assets/images/newbb.png | Bin 959 -> 1650 bytes assets/index.html | 2 +- assets/js/index.html | 2 +- blocks/index.html | 2 +- blocks/list_topic.php | 40 +- blocks/newbb_block.php | 184 ++-- blocks/newbb_block_tag.php | 2 +- class/category.php | 55 +- class/digest.php | 50 +- class/forum.php | 144 ++- class/icon.php | 33 +- class/index.html | 2 +- class/ipcheck.php | 6 +- class/karma.php | 12 +- class/migrate.php | 130 +++ class/moderate.php | 155 +-- class/newbbtree.php | 2 +- class/online.php | 118 +-- class/permission.category.php | 12 +- class/permission.forum.php | 45 +- class/permission.php | 55 +- class/plugin/index.html | 2 +- class/plugin/userlog.php | 20 +- class/plugins/plugin.tag.php | 48 +- class/post.php | 330 +++---- class/rate.php | 11 +- class/read.php | 49 +- class/readforum.php | 14 +- class/readtopic.php | 14 +- class/report.php | 26 +- class/stats.php | 163 +--- class/text.php | 14 +- class/topic.php | 128 +-- class/topic.renderer.php | 278 +++--- class/tree.php | 12 +- class/type.php | 93 +- class/uploader.php | 4 +- class/user.php | 62 +- class/userstats.php | 19 +- class/utility.php | 81 ++ class/xmlrss.php | 8 +- delete.php | 74 +- digest.php | 9 +- dl_attachment.php | 31 +- docs/changelog.txt | 37 +- edit.php | 40 +- footer.php | 7 +- header.php | 96 +- images/category/blank.gif | Bin 0 -> 49 bytes images/category/cbb.png | Bin 0 -> 1011 bytes images/category/index.html | 1 + images/category/topxoops.png | Bin 0 -> 618 bytes images/category/xoops-cn.png | Bin 0 -> 587 bytes images/cbb.png | Bin 0 -> 1011 bytes images/filetypes/ace.gif | Bin 0 -> 119 bytes images/filetypes/avi.gif | Bin 0 -> 271 bytes images/filetypes/bmp.gif | Bin 0 -> 120 bytes images/filetypes/doc.gif | Bin 0 -> 940 bytes images/filetypes/exe.gif | Bin 0 -> 1096 bytes images/filetypes/flash.gif | Bin 0 -> 254 bytes images/filetypes/gif.gif | Bin 0 -> 119 bytes images/filetypes/html.gif | Bin 0 -> 183 bytes images/filetypes/jpeg.gif | Bin 0 -> 119 bytes images/filetypes/jpg.gif | Bin 0 -> 119 bytes images/filetypes/mid.gif | Bin 0 -> 141 bytes images/filetypes/mov.gif | Bin 0 -> 271 bytes images/filetypes/mp3.gif | Bin 0 -> 253 bytes images/filetypes/mpg.gif | Bin 0 -> 271 bytes images/filetypes/netscape.gif | Bin 0 -> 214 bytes images/filetypes/pdf.gif | Bin 0 -> 370 bytes images/filetypes/png.gif | Bin 0 -> 119 bytes images/filetypes/ppt.gif | Bin 0 -> 867 bytes images/filetypes/rar.gif | Bin 0 -> 119 bytes images/filetypes/txt.gif | Bin 0 -> 901 bytes images/filetypes/unknown.gif | Bin 0 -> 112 bytes images/filetypes/wav.gif | Bin 0 -> 162 bytes images/filetypes/xls.gif | Bin 0 -> 941 bytes images/filetypes/zip.gif | Bin 0 -> 235 bytes images/menu/about.png | Bin 0 -> 1442 bytes images/menu/blocks.png | Bin 0 -> 2072 bytes images/menu/cat.png | Bin 0 -> 1295 bytes images/menu/digest.png | Bin 0 -> 1354 bytes images/menu/forum.png | Bin 0 -> 1739 bytes images/menu/groupmod.png | Bin 0 -> 2231 bytes images/menu/home.png | Bin 0 -> 1403 bytes images/menu/index.html | 1 + images/menu/order.png | Bin 0 -> 1337 bytes images/menu/permissions.png | Bin 0 -> 2902 bytes images/menu/prefs.png | Bin 0 -> 2425 bytes images/menu/prune.png | Bin 0 -> 2081 bytes images/menu/report.png | Bin 0 -> 1774 bytes images/menu/synchronization.png | Bin 0 -> 1323 bytes images/menu/type.png | Bin 0 -> 1949 bytes images/menu/votedata.png | Bin 0 -> 1884 bytes images/myimages/20130701_3033.jpg | Bin 0 -> 50778 bytes images/myimages/20130701_3050.jpg | Bin 0 -> 45269 bytes images/myimages/20130701_3061.jpg | Bin 0 -> 55224 bytes images/myimages/20130701_3071.jpg | Bin 0 -> 48297 bytes images/myimages/20130701_3077.jpg | Bin 0 -> 51343 bytes images/myimages/20130701_3099.jpg | Bin 0 -> 52576 bytes images/myimages/20130701_3102.jpg | Bin 0 -> 46362 bytes images/myimages/20140645.jpg | Bin 0 -> 65448 bytes images/myimages/20141124_1296edit.jpg | Bin 0 -> 51733 bytes images/myimages/20141124_1328edit.jpg | Bin 0 -> 64826 bytes images/myimages/20141124_1330edit.jpg | Bin 0 -> 62153 bytes images/myimages/20141131.jpg | Bin 0 -> 68876 bytes images/myimages/20141138.jpg | Bin 0 -> 77183 bytes images/myimages/20141144.jpg | Bin 0 -> 66940 bytes images/myimages/20141149.jpg | Bin 0 -> 54836 bytes images/myimages/20151220_131648.jpg | Bin 0 -> 58931 bytes images/myimages/20160306_3642.jpg | Bin 0 -> 54117 bytes images/myimages/3438.jpg | Bin 0 -> 87641 bytes images/myimages/3518.jpg | Bin 0 -> 38381 bytes images/myimages/3519.jpg | Bin 0 -> 38431 bytes images/myimages/3521.jpg | Bin 0 -> 38305 bytes images/myimages/3543.jpg | Bin 0 -> 49207 bytes images/myimages/3554.jpg | Bin 0 -> 30220 bytes images/myimages/3556.jpg | Bin 0 -> 33784 bytes images/myimages/3562.jpg | Bin 0 -> 40387 bytes images/myimages/3640.jpg | Bin 0 -> 68187 bytes images/myimages/BoobieGirl100x100.gif | Bin 0 -> 72460 bytes images/myimages/IMG_5026.jpg | Bin 0 -> 35794 bytes images/myimages/IMG_5030.jpg | Bin 0 -> 14207 bytes images/myimages/LibertySchooner1.jpg | Bin 0 -> 34648 bytes images/myimages/LibertySchooner2.jpg | Bin 0 -> 55163 bytes images/myimages/LibertySchooner3.jpg | Bin 0 -> 50636 bytes images/myimages/Newport Master Plan.pdf | Bin 0 -> 124119 bytes images/myimages/Sixth-Borough.jpg | Bin 0 -> 42705 bytes images/myimages/alexsbrickovenpizza.jpg | Bin 0 -> 57610 bytes images/myimages/bike2015.gif | Bin 0 -> 757265 bytes images/myimages/bike22015.gif | Bin 0 -> 739639 bytes images/myimages/bike32015.jpg | Bin 0 -> 63124 bytes images/myimages/bike42015.jpg | Bin 0 -> 101609 bytes images/myimages/burger.jpg | Bin 0 -> 68595 bytes images/myimages/burger2.jpg | Bin 0 -> 57716 bytes images/myimages/carinaespanol.jpg | Bin 0 -> 53715 bytes images/myimages/carrino.jpg | Bin 0 -> 172470 bytes images/myimages/cheesecakefactory.jpg | Bin 0 -> 65570 bytes images/myimages/chickfila.jpg | Bin 0 -> 49610 bytes images/myimages/chipotle.jpg | Bin 0 -> 61099 bytes images/myimages/chipotle2.jpg | Bin 0 -> 56531 bytes images/myimages/chipotle3.jpg | Bin 0 -> 72651 bytes images/myimages/chocolat.jpg | Bin 0 -> 114035 bytes images/myimages/chocolat2.jpg | Bin 0 -> 60745 bytes images/myimages/embankmentmeeting.jpg | Bin 0 -> 19683 bytes images/myimages/eztowing.jpg | Bin 0 -> 94363 bytes images/myimages/eztowing2.jpg | Bin 0 -> 91042 bytes images/myimages/eztowing3.jpg | Bin 0 -> 26791 bytes images/myimages/eztowing4.jpg | Bin 0 -> 21181 bytes images/myimages/eztowing5.jpg | Bin 0 -> 20734 bytes images/myimages/fuelspill.jpg | Bin 0 -> 33763 bytes images/myimages/fuelspill2.jpg | Bin 0 -> 46585 bytes images/myimages/fuelspill3.jpg | Bin 0 -> 37425 bytes images/myimages/fulop.jpg | Bin 0 -> 49357 bytes images/myimages/fulop2.jpg | Bin 0 -> 43574 bytes images/myimages/fulop3.jpg | Bin 0 -> 89393 bytes images/myimages/fulop4.jpg | Bin 0 -> 62839 bytes images/myimages/fulop5.jpg | Bin 0 -> 102593 bytes images/myimages/fulop6.jpg | Bin 0 -> 95507 bytes images/myimages/fulop7.jpg | Bin 0 -> 110538 bytes images/myimages/fulop8.jpg | Bin 0 -> 91362 bytes images/myimages/goldmansachs.jpg | Bin 0 -> 32852 bytes images/myimages/goldmansachs2.jpg | Bin 0 -> 36081 bytes images/myimages/goldmansachs3.jpg | Bin 0 -> 66655 bytes images/myimages/goldmansachs4.jpg | Bin 0 -> 32654 bytes images/myimages/gregoryscoffee.jpg | Bin 0 -> 40855 bytes images/myimages/gregoryscoffee2.jpg | Bin 0 -> 45524 bytes images/myimages/gregoryscoffee3.jpg | Bin 0 -> 67860 bytes images/myimages/gregoryscoffee4.jpg | Bin 0 -> 51776 bytes images/myimages/halloweenjam.jpg | Bin 0 -> 264105 bytes images/myimages/healy1.jpg | Bin 0 -> 60845 bytes images/myimages/healy2.jpg | Bin 0 -> 58138 bytes images/myimages/healy3.jpg | Bin 0 -> 62180 bytes images/myimages/hobokenprotest.jpg | Bin 0 -> 74149 bytes images/myimages/hobokenprotest2.jpg | Bin 0 -> 73075 bytes images/myimages/hollandtunnel.jpg | Bin 0 -> 45782 bytes images/myimages/hyattfishing.jpg | Bin 0 -> 107727 bytes images/myimages/hyattfishing2.jpg | Bin 0 -> 126854 bytes images/myimages/jambajuice.jpg | Bin 0 -> 67468 bytes images/myimages/jcsky.jpg | Bin 0 -> 46044 bytes images/myimages/jcsky2.jpg | Bin 0 -> 41883 bytes images/myimages/juicebar.jpg | Bin 0 -> 84855 bytes images/myimages/knitting.jpg | Bin 0 -> 91933 bytes images/myimages/lawyer.jpg | Bin 0 -> 22002 bytes images/myimages/loewsjersey.jpg | Bin 0 -> 72160 bytes images/myimages/lspanimation1.gif | Bin 0 -> 2380026 bytes images/myimages/lspanimation2.gif | Bin 0 -> 1726203 bytes images/myimages/lspprotest.jpg | Bin 0 -> 74308 bytes images/myimages/lspprotest3.jpg | Bin 0 -> 90988 bytes images/myimages/lstprotest2.jpg | Bin 0 -> 119085 bytes images/myimages/mayordebate2013.jpg | Bin 0 -> 70832 bytes images/myimages/mayordebate20132.jpg | Bin 0 -> 68702 bytes images/myimages/modernsage.jpg | Bin 0 -> 243576 bytes images/myimages/newportviolin.jpg | Bin 0 -> 62196 bytes images/myimages/newportviolin2.jpg | Bin 0 -> 82276 bytes images/myimages/newportviolin3.jpg | Bin 0 -> 51558 bytes images/myimages/ninebarcafe.jpg | Bin 0 -> 139144 bytes images/myimages/obama1.jpg | Bin 0 -> 33730 bytes images/myimages/obama2.jpg | Bin 0 -> 22477 bytes images/myimages/obama3.jpg | Bin 0 -> 40966 bytes images/myimages/pedestrianplaza.jpg | Bin 0 -> 69796 bytes images/myimages/portapizza.jpg | Bin 0 -> 33965 bytes images/myimages/portapizza2.jpg | Bin 0 -> 24322 bytes images/myimages/powerhouse.jpg | Bin 0 -> 43574 bytes images/myimages/pratobakery.jpg | Bin 0 -> 86881 bytes images/myimages/rainbow.jpg | Bin 0 -> 75542 bytes images/myimages/shoreclub1.gif | Bin 0 -> 96535 bytes images/myimages/shoreclub2.jpg | Bin 0 -> 41878 bytes images/myimages/shoreclub3.jpg | Bin 0 -> 53023 bytes images/myimages/shortgrain.jpg | Bin 0 -> 81660 bytes images/myimages/shortgrain2.jpg | Bin 0 -> 74086 bytes images/myimages/spectra.jpg | Bin 0 -> 68572 bytes images/myimages/spectra10.jpg | Bin 0 -> 126972 bytes images/myimages/spectra11.jpg | Bin 0 -> 65579 bytes images/myimages/spectra2.jpg | Bin 0 -> 77440 bytes images/myimages/spectra3.jpg | Bin 0 -> 41892 bytes images/myimages/spectra4.jpg | Bin 0 -> 73919 bytes images/myimages/spectra5.jpg | Bin 0 -> 48022 bytes images/myimages/spectra6.jpg | Bin 0 -> 43581 bytes images/myimages/spectra7.jpg | Bin 0 -> 49138 bytes images/myimages/spectra8.jpg | Bin 0 -> 49699 bytes images/myimages/spectra9.jpg | Bin 0 -> 41094 bytes images/myimages/statement.pdf | Bin 0 -> 65201 bytes images/myimages/steveandwife.jpg | Bin 0 -> 44628 bytes images/myimages/tayary.jpg | Bin 0 -> 20451 bytes images/myimages/telcolofts.jpg | Bin 0 -> 254044 bytes images/myimages/two-boots-letter-size.jpg | Bin 0 -> 61169 bytes images/myimages/twoboots.jpg | Bin 0 -> 61902 bytes images/myimages/url.jpg | Bin 0 -> 55374 bytes images/myimages/viagra.jpg | Bin 0 -> 18838 bytes images/myimages/whiteshirts.jpg | Bin 0 -> 27303 bytes images/myimages/whiteshirts2.jpg | Bin 0 -> 23542 bytes images/myimages/wholefoods.jpg | Bin 0 -> 82415 bytes images/xoopsbb_slogo.png | Bin 0 -> 6510 bytes include/common.php | 2 +- include/display.php | 5 +- include/form.forum.php | 4 +- include/form.post.php | 107 +-- include/functions.config.php | 33 +- include/functions.forum.php | 72 +- include/functions.image.php | 4 +- include/functions.ini.php | 52 +- include/functions.language.php | 4 +- include/functions.php | 17 +- include/functions.read.php | 9 +- include/functions.recon.php | 6 +- include/functions.render.php | 18 +- include/functions.rpc.php | 4 +- include/functions.session.php | 10 +- include/functions.stats.php | 10 +- include/functions.time.php | 34 +- include/functions.topic.php | 4 +- include/functions.user.php | 66 +- include/functions.welcome.inc.php | 49 +- include/functions.welcome.php | 15 +- include/images.php | 4 +- include/index.html | 2 +- include/module.php | 180 +--- include/notification.inc.php | 38 +- include/plugin.dist.php | 9 +- include/plugin.php | 12 +- include/search.inc.php | 52 +- include/sitemap.plugin.php | 4 +- include/vars.php | 12 +- index.php | 68 +- language/english/admin.php | 27 +- language/english/blocks.php | 2 +- language/english/help/disclaimer.html | 48 + language/english/help/help.html | 55 ++ language/english/help/helpheader.html | 6 + language/english/help/index.html | 1 + language/english/help/license.html | 288 ++++++ language/english/help/support.html | 9 + language/english/index.html | 2 +- language/english/main.php | 885 +++++++++--------- language/english/modinfo.php | 334 +++---- language/index.html | 2 +- list.tag.php | 4 +- list.topic.php | 25 +- makepdf.php | 33 +- moderate.php | 288 +++--- newtopic.php | 43 +- notification_update.php | 2 +- polls.php | 301 +++--- post.php | 237 +++-- print.php | 38 +- ratethread.php | 25 +- reply.php | 50 +- report.php | 41 +- rss.php | 80 +- search.php | 244 ++--- seo.php | 15 +- seo_url.php | 126 +-- sql/mysql.sql | 255 ++--- sql/newbb_5_migrate.yml | 668 +++++++++++++ templates/blocks/newbb_block_list_topic.tpl | 17 +- templates/blocks/newbb_block_text.tpl | 18 +- templates/blocks/newbb_tag_block_cloud.tpl | 2 +- templates/blocks/newbb_tag_block_top.tpl | 2 +- templates/css/language/english/style.css | 7 +- templates/css/language/persian/style.css | 7 +- templates/images/icon/blank.gif | Bin 49 -> 51 bytes templates/images/icon/googleplus.png | Bin 747 -> 1398 bytes templates/images/icon/minus.png | Bin 798 -> 3268 bytes templates/images/icon/new_forum.png | Bin 979 -> 1425 bytes templates/images/icon/plus.png | Bin 799 -> 3277 bytes .../images/language/english/new_forum.png | Bin 576 -> 652 bytes .../images/language/english/new_subforum.png | Bin 594 -> 670 bytes templates/images/language/english/p_bann.png | Bin 993 -> 1661 bytes templates/images/language/english/t_poll.png | Bin 2119 -> 2190 bytes templates/images/mime/html.gif | Bin 180 -> 183 bytes templates/images/mime/wav.gif | Bin 160 -> 162 bytes templates/images/rpg/orange.gif | Bin 816 -> 818 bytes templates/newbb_edit_post.tpl | 9 +- templates/newbb_index.tpl | 192 ++-- templates/newbb_index_menu.tpl | 21 +- templates/newbb_moderate.tpl | 83 ++ templates/newbb_notification_select.tpl | 62 +- templates/newbb_online.tpl | 9 +- templates/newbb_search.tpl | 43 +- templates/newbb_searchresults.tpl | 11 +- templates/newbb_thread.tpl | 56 +- templates/newbb_viewall.tpl | 145 ++- templates/newbb_viewforum.tpl | 121 +-- templates/newbb_viewforum_menu.tpl | 23 +- templates/newbb_viewforum_subforum.tpl | 17 +- templates/newbb_viewpost.tpl | 69 +- templates/newbb_viewtopic.tpl | 108 +-- .../blocks/newbb_block.tpl | 48 +- .../blocks/newbb_block_author.tpl | 50 +- .../blocks/newbb_block_list_topic.tpl | 26 +- .../blocks/newbb_block_post.tpl | 65 +- .../blocks/newbb_block_text.tpl | 14 +- .../blocks/newbb_block_topic.tpl | 80 +- .../css/language/english/style.css | 466 ++++----- .../css/language/persian/style.css | 7 +- .../images/icon/blank.gif | Bin 49 -> 51 bytes .../images/icon/googleplus.png | Bin 747 -> 1398 bytes .../images/icon/index.html | 2 +- .../images/icon/minus.png | Bin 798 -> 3268 bytes .../images/icon/new_forum.png | Bin 979 -> 1425 bytes .../images/icon/plus.png | Bin 799 -> 3277 bytes .../images/language/english/new_forum.png | Bin 576 -> 652 bytes .../images/language/english/new_subforum.png | Bin 594 -> 670 bytes .../images/language/english/p_bann.png | Bin 993 -> 1661 bytes .../images/language/english/t_poll.png | Bin 2119 -> 2190 bytes .../images/language/persian/index.html | 2 +- .../images/language/persian/new_forum.png | Bin 576 -> 652 bytes .../images/language/persian/new_subforum.png | Bin 594 -> 670 bytes .../images/language/persian/offline.png | Bin 2438 -> 2909 bytes .../images/language/persian/online.png | Bin 2378 -> 2846 bytes .../images/language/persian/p_bann.png | Bin 993 -> 1661 bytes .../images/language/persian/p_delete.png | Bin 2449 -> 2875 bytes .../images/language/persian/p_edit.png | Bin 1784 -> 2116 bytes .../images/language/persian/p_quote.png | Bin 2648 -> 3031 bytes .../images/language/persian/p_reply.png | Bin 1752 -> 2015 bytes .../images/language/persian/p_report.png | Bin 2700 -> 3100 bytes .../images/language/persian/p_up.png | Bin 1162 -> 1499 bytes .../images/language/persian/t_new.png | Bin 7756 -> 7949 bytes .../images/language/persian/t_poll.png | Bin 7773 -> 7958 bytes .../images/language/persian/t_qr.png | Bin 7703 -> 7904 bytes .../images/language/persian/t_reply.png | Bin 7759 -> 7933 bytes .../images/mime/html.gif | Bin 180 -> 183 bytes templates_fulldiv_opacity/images/mime/wav.gif | Bin 160 -> 162 bytes .../images/rpg/orange.gif | Bin 816 -> 818 bytes .../js/language/english/newbb_toggle_class.js | 65 +- .../js/language/english/newbb_validation.js | 37 +- templates_fulldiv_opacity/newbb_edit_post.tpl | 77 +- templates_fulldiv_opacity/newbb_index.tpl | 142 ++- .../newbb_index_menu.tpl | 22 +- .../newbb_notification_select.tpl | 23 +- templates_fulldiv_opacity/newbb_online.tpl | 18 +- .../newbb_poll_results.tpl | 2 +- templates_fulldiv_opacity/newbb_poll_view.tpl | 2 +- templates_fulldiv_opacity/newbb_rss.tpl | 2 +- templates_fulldiv_opacity/newbb_search.tpl | 106 +-- .../newbb_searchresults.tpl | 8 +- templates_fulldiv_opacity/newbb_thread.tpl | 183 ++-- templates_fulldiv_opacity/newbb_viewall.tpl | 441 ++++----- templates_fulldiv_opacity/newbb_viewforum.tpl | 325 +++---- .../newbb_viewforum_menu.tpl | 37 +- .../newbb_viewforum_subforum.tpl | 21 +- templates_fulldiv_opacity/newbb_viewpost.tpl | 129 ++- templates_fulldiv_opacity/newbb_viewtopic.tpl | 111 +-- topicmanager.php | 118 +-- update_type.php | 29 +- view.tag.php | 4 +- viewforum.php | 204 ++-- viewpost.php | 181 ++-- viewtopic.php | 286 +++--- votepolls.php | 48 +- xoops_version.php | 772 +++++++-------- 422 files changed, 7042 insertions(+), 7234 deletions(-) create mode 100644 admin/migrate.php create mode 100644 assets/images/logo_module.png create mode 100644 class/migrate.php create mode 100644 class/utility.php create mode 100644 images/category/blank.gif create mode 100644 images/category/cbb.png create mode 100644 images/category/index.html create mode 100644 images/category/topxoops.png create mode 100644 images/category/xoops-cn.png create mode 100644 images/cbb.png create mode 100644 images/filetypes/ace.gif create mode 100644 images/filetypes/avi.gif create mode 100644 images/filetypes/bmp.gif create mode 100644 images/filetypes/doc.gif create mode 100644 images/filetypes/exe.gif create mode 100644 images/filetypes/flash.gif create mode 100644 images/filetypes/gif.gif create mode 100644 images/filetypes/html.gif create mode 100644 images/filetypes/jpeg.gif create mode 100644 images/filetypes/jpg.gif create mode 100644 images/filetypes/mid.gif create mode 100644 images/filetypes/mov.gif create mode 100644 images/filetypes/mp3.gif create mode 100644 images/filetypes/mpg.gif create mode 100644 images/filetypes/netscape.gif create mode 100644 images/filetypes/pdf.gif create mode 100644 images/filetypes/png.gif create mode 100644 images/filetypes/ppt.gif create mode 100644 images/filetypes/rar.gif create mode 100644 images/filetypes/txt.gif create mode 100644 images/filetypes/unknown.gif create mode 100644 images/filetypes/wav.gif create mode 100644 images/filetypes/xls.gif create mode 100644 images/filetypes/zip.gif create mode 100644 images/menu/about.png create mode 100644 images/menu/blocks.png create mode 100644 images/menu/cat.png create mode 100644 images/menu/digest.png create mode 100644 images/menu/forum.png create mode 100644 images/menu/groupmod.png create mode 100644 images/menu/home.png create mode 100644 images/menu/index.html create mode 100644 images/menu/order.png create mode 100644 images/menu/permissions.png create mode 100644 images/menu/prefs.png create mode 100644 images/menu/prune.png create mode 100644 images/menu/report.png create mode 100644 images/menu/synchronization.png create mode 100644 images/menu/type.png create mode 100644 images/menu/votedata.png create mode 100644 images/myimages/20130701_3033.jpg create mode 100644 images/myimages/20130701_3050.jpg create mode 100644 images/myimages/20130701_3061.jpg create mode 100644 images/myimages/20130701_3071.jpg create mode 100644 images/myimages/20130701_3077.jpg create mode 100644 images/myimages/20130701_3099.jpg create mode 100644 images/myimages/20130701_3102.jpg create mode 100644 images/myimages/20140645.jpg create mode 100644 images/myimages/20141124_1296edit.jpg create mode 100644 images/myimages/20141124_1328edit.jpg create mode 100644 images/myimages/20141124_1330edit.jpg create mode 100644 images/myimages/20141131.jpg create mode 100644 images/myimages/20141138.jpg create mode 100644 images/myimages/20141144.jpg create mode 100644 images/myimages/20141149.jpg create mode 100644 images/myimages/20151220_131648.jpg create mode 100644 images/myimages/20160306_3642.jpg create mode 100644 images/myimages/3438.jpg create mode 100644 images/myimages/3518.jpg create mode 100644 images/myimages/3519.jpg create mode 100644 images/myimages/3521.jpg create mode 100644 images/myimages/3543.jpg create mode 100644 images/myimages/3554.jpg create mode 100644 images/myimages/3556.jpg create mode 100644 images/myimages/3562.jpg create mode 100644 images/myimages/3640.jpg create mode 100644 images/myimages/BoobieGirl100x100.gif create mode 100644 images/myimages/IMG_5026.jpg create mode 100644 images/myimages/IMG_5030.jpg create mode 100644 images/myimages/LibertySchooner1.jpg create mode 100644 images/myimages/LibertySchooner2.jpg create mode 100644 images/myimages/LibertySchooner3.jpg create mode 100644 images/myimages/Newport Master Plan.pdf create mode 100644 images/myimages/Sixth-Borough.jpg create mode 100644 images/myimages/alexsbrickovenpizza.jpg create mode 100644 images/myimages/bike2015.gif create mode 100644 images/myimages/bike22015.gif create mode 100644 images/myimages/bike32015.jpg create mode 100644 images/myimages/bike42015.jpg create mode 100644 images/myimages/burger.jpg create mode 100644 images/myimages/burger2.jpg create mode 100644 images/myimages/carinaespanol.jpg create mode 100644 images/myimages/carrino.jpg create mode 100644 images/myimages/cheesecakefactory.jpg create mode 100644 images/myimages/chickfila.jpg create mode 100644 images/myimages/chipotle.jpg create mode 100644 images/myimages/chipotle2.jpg create mode 100644 images/myimages/chipotle3.jpg create mode 100644 images/myimages/chocolat.jpg create mode 100644 images/myimages/chocolat2.jpg create mode 100644 images/myimages/embankmentmeeting.jpg create mode 100644 images/myimages/eztowing.jpg create mode 100644 images/myimages/eztowing2.jpg create mode 100644 images/myimages/eztowing3.jpg create mode 100644 images/myimages/eztowing4.jpg create mode 100644 images/myimages/eztowing5.jpg create mode 100644 images/myimages/fuelspill.jpg create mode 100644 images/myimages/fuelspill2.jpg create mode 100644 images/myimages/fuelspill3.jpg create mode 100644 images/myimages/fulop.jpg create mode 100644 images/myimages/fulop2.jpg create mode 100644 images/myimages/fulop3.jpg create mode 100644 images/myimages/fulop4.jpg create mode 100644 images/myimages/fulop5.jpg create mode 100644 images/myimages/fulop6.jpg create mode 100644 images/myimages/fulop7.jpg create mode 100644 images/myimages/fulop8.jpg create mode 100644 images/myimages/goldmansachs.jpg create mode 100644 images/myimages/goldmansachs2.jpg create mode 100644 images/myimages/goldmansachs3.jpg create mode 100644 images/myimages/goldmansachs4.jpg create mode 100644 images/myimages/gregoryscoffee.jpg create mode 100644 images/myimages/gregoryscoffee2.jpg create mode 100644 images/myimages/gregoryscoffee3.jpg create mode 100644 images/myimages/gregoryscoffee4.jpg create mode 100644 images/myimages/halloweenjam.jpg create mode 100644 images/myimages/healy1.jpg create mode 100644 images/myimages/healy2.jpg create mode 100644 images/myimages/healy3.jpg create mode 100644 images/myimages/hobokenprotest.jpg create mode 100644 images/myimages/hobokenprotest2.jpg create mode 100644 images/myimages/hollandtunnel.jpg create mode 100644 images/myimages/hyattfishing.jpg create mode 100644 images/myimages/hyattfishing2.jpg create mode 100644 images/myimages/jambajuice.jpg create mode 100644 images/myimages/jcsky.jpg create mode 100644 images/myimages/jcsky2.jpg create mode 100644 images/myimages/juicebar.jpg create mode 100644 images/myimages/knitting.jpg create mode 100644 images/myimages/lawyer.jpg create mode 100644 images/myimages/loewsjersey.jpg create mode 100644 images/myimages/lspanimation1.gif create mode 100644 images/myimages/lspanimation2.gif create mode 100644 images/myimages/lspprotest.jpg create mode 100644 images/myimages/lspprotest3.jpg create mode 100644 images/myimages/lstprotest2.jpg create mode 100644 images/myimages/mayordebate2013.jpg create mode 100644 images/myimages/mayordebate20132.jpg create mode 100644 images/myimages/modernsage.jpg create mode 100644 images/myimages/newportviolin.jpg create mode 100644 images/myimages/newportviolin2.jpg create mode 100644 images/myimages/newportviolin3.jpg create mode 100644 images/myimages/ninebarcafe.jpg create mode 100644 images/myimages/obama1.jpg create mode 100644 images/myimages/obama2.jpg create mode 100644 images/myimages/obama3.jpg create mode 100644 images/myimages/pedestrianplaza.jpg create mode 100644 images/myimages/portapizza.jpg create mode 100644 images/myimages/portapizza2.jpg create mode 100644 images/myimages/powerhouse.jpg create mode 100644 images/myimages/pratobakery.jpg create mode 100644 images/myimages/rainbow.jpg create mode 100644 images/myimages/shoreclub1.gif create mode 100644 images/myimages/shoreclub2.jpg create mode 100644 images/myimages/shoreclub3.jpg create mode 100644 images/myimages/shortgrain.jpg create mode 100644 images/myimages/shortgrain2.jpg create mode 100644 images/myimages/spectra.jpg create mode 100644 images/myimages/spectra10.jpg create mode 100644 images/myimages/spectra11.jpg create mode 100644 images/myimages/spectra2.jpg create mode 100644 images/myimages/spectra3.jpg create mode 100644 images/myimages/spectra4.jpg create mode 100644 images/myimages/spectra5.jpg create mode 100644 images/myimages/spectra6.jpg create mode 100644 images/myimages/spectra7.jpg create mode 100644 images/myimages/spectra8.jpg create mode 100644 images/myimages/spectra9.jpg create mode 100644 images/myimages/statement.pdf create mode 100644 images/myimages/steveandwife.jpg create mode 100644 images/myimages/tayary.jpg create mode 100644 images/myimages/telcolofts.jpg create mode 100644 images/myimages/two-boots-letter-size.jpg create mode 100644 images/myimages/twoboots.jpg create mode 100644 images/myimages/url.jpg create mode 100644 images/myimages/viagra.jpg create mode 100644 images/myimages/whiteshirts.jpg create mode 100644 images/myimages/whiteshirts2.jpg create mode 100644 images/myimages/wholefoods.jpg create mode 100644 images/xoopsbb_slogo.png create mode 100644 language/english/help/disclaimer.html create mode 100644 language/english/help/help.html create mode 100644 language/english/help/helpheader.html create mode 100644 language/english/help/index.html create mode 100644 language/english/help/license.html create mode 100644 language/english/help/support.html create mode 100644 sql/newbb_5_migrate.yml create mode 100644 templates/newbb_moderate.tpl diff --git a/.gitignore b/.gitignore index 85d2647d..3b2fc0a4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ *~ \#* *.bak -.idea/ + diff --git a/README.md b/README.md index 8c2c33e4..81797cd3 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@ [![Codacy Badge](https://api.codacy.com/project/badge/grade/2d27c0023ee54f0b9ba2b5d17a68b2a5)](https://www.codacy.com/app/mambax7/newbb) [![Code Climate](https://img.shields.io/codeclimate/github/mambax7/newbb.svg?style=flat)](https://codeclimate.com/github/mambax7/newbb) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/4be750c7-07e0-4317-93ba-9937c607a827/mini.png)](https://insight.sensiolabs.com/projects/4be750c7-07e0-4317-93ba-9937c607a827) -[![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/newbb.svg?style=flat)](https://github.com/XoopsModules25x/newbb/tags/) +[![Latest Pre-Resease](https://img.shields.io/github/tag/XoopsModules25x/newbb.svg?style=flat)](https://github.com/XoopsModules25x/newbb/tags/) [![Latest Version](https://img.shields.io/github/release/XoopsModules25x/newbb.svg?style=flat)](https://github.com/XoopsModules25x/newbb/releases/) Forum module for [XOOPS CMS](http://xoops.org) for discussions -[![Tutorial Available](http://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/xoops-newbb-module/) Tutorial: see [GitBook](https://www.gitbook.com/book/xoops/xoops-newbb-module-tutorial/). +[![Tutorial Available](http://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/xoops-newbb-module/) Tutorial: see [here](https://www.gitbook.com/book/xoops/xoops-newbb-module-tutorial/). To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/newbb-tutorial) [![Translations on Transifex](http://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) diff --git a/action.post.php b/action.post.php index 53bb56f6..9ea3efb3 100644 --- a/action.post.php +++ b/action.post.php @@ -1,30 +1,35 @@ * @since 4.00 * @package module::newbb */ + +use Xmf\Request; + include_once __DIR__ . '/header.php'; -$topic_id = XoopsRequest::getInt('topic_id', 0, 'POST'); -$post_id = XoopsRequest::getArray('post_id', XoopsRequest::getArray('post_id', 0, 'POST'), 'GET'); -$uid = XoopsRequest::getInt('uid', 0, 'GET'); +$topic_id = Request::getInt('topic_id', 0, 'POST'); +$post_id = Request::getArray('post_id', Request::getArray('post_id', 0, 'POST'), 'GET'); +$uid = Request::getInt('uid', 0, 'GET'); -$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); +$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); $op = in_array($op, ['approve', 'delete', 'restore', 'split'], true) ? $op : ''; -$mode = XoopsRequest::getInt('mode', 1, 'GET'); +$mode = Request::getInt('mode', 1, 'GET'); if (0 === count($post_id) || 0 === count($op)) { // irmtfan - issue with javascript:history.go(-1) - redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NORIGHTTOACCESS); + redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NEWBB_NORIGHTTOACCESS); } - +/** @var NewbbPostHandler $postHandler */ $postHandler = xoops_getModuleHandler('post', 'newbb'); +/** @var NewbbTopicHandler $topicHandler */ $topicHandler = xoops_getModuleHandler('topic', 'newbb'); +/** @var NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (empty($topic_id)) { $forum_obj = null; @@ -36,7 +41,7 @@ $isadmin = newbb_isAdmin($forum_obj); if (!$isadmin) { - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NORIGHTTOACCESS); + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } switch ($op) { @@ -50,6 +55,7 @@ if ($post_obj->getVar('topic_id') < 1) { continue; } + $postHandler->approve($post_obj, true); $topics[$post_obj->getVar('topic_id')] = 1; $forums[$post_obj->getVar('forum_id')] = 1; @@ -70,6 +76,7 @@ $criteria = new Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN'); $posts_obj = $postHandler->getObjects($criteria, true); foreach ($post_id as $post) { + /** @var \NewbbPost $post_obj */ $post_obj = $posts_obj[$post]; if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) { continue; @@ -96,17 +103,13 @@ $forum_list = $forumHandler->getList($criteria_forum); include_once __DIR__ . '/include/notification.inc.php'; + /** @var \XoopsNotificationHandler $notificationHandler */ $notificationHandler = xoops_getHandler('notification'); foreach ($post_id as $post) { $tags = []; + /** @var \NewbbPost[] $posts_obj[$post] */ $tags['THREAD_NAME'] = $topic_list[$posts_obj[$post]->getVar('topic_id')]; - $tags['THREAD_URL'] = XOOPS_URL - . '/modules/' - . $xoopsModule->getVar('dirname') - . '/viewtopic.php?topic_id=' - . $posts_obj[$post]->getVar('topic_id') - . '&forum=' - . $posts_obj[$post]->getVar('forum_id'); + $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $posts_obj[$post]->getVar('topic_id') . '&forum=' . $posts_obj[$post]->getVar('forum_id'); $tags['FORUM_NAME'] = $forum_list[$posts_obj[$post]->getVar('forum_id')]; $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $posts_obj[$post]->getVar('forum_id'); $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post; @@ -142,7 +145,8 @@ } break; case 'split': - $post_obj =& $postHandler->get($post_id); + /** @var \NewbbPost $post_obj */ + $post_obj = $postHandler->get($post_id); if (0 === count($post_id) || $post_obj->isTopic()) { break; } @@ -165,21 +169,21 @@ $postHandler->insert($post_obj); /* split a single post */ - if (1 === $mode) { + if ($mode === 1) { $criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id)); $criteria->add(new Criteria('pid', $post_id)); $postHandler->updateAll('pid', $pid, $criteria, true); /* split a post and its children posts */ - } elseif (2 === $mode) { + } elseif ($mode === 2) { include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('bb_posts'), 'post_id', 'pid'); + $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); $posts = $mytree->getAllChildId($post_id); if (count($posts) > 0) { $criteria = new Criteria('post_id', '(' . implode(',', $posts) . ')', 'IN'); $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); } /* split a post and all posts coming after */ - } elseif (3 === $mode) { + } elseif ($mode === 3) { $criteria = new CriteriaCompo(new Criteria('topic_id', $topic_id)); $criteria->add(new Criteria('post_id', $post_id, '>')); $postHandler->updateAll('topic_id', $new_topic_id, $criteria, true); @@ -210,17 +214,17 @@ $forum_id = $post_obj->getVar('forum_id'); $topicHandler->synchronization($topic_id); $topicHandler->synchronization($new_topic_id); - $sql = sprintf('UPDATE %s SET forum_topics = forum_topics+1 WHERE forum_id = %u', $GLOBALS['xoopsDB']->prefix('bb_forums'), $forum_id); + $sql = sprintf('UPDATE %s SET forum_topics = forum_topics+1 WHERE forum_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); $result = $GLOBALS['xoopsDB']->queryF($sql); break; } if (!empty($topic_id)) { - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id", 2, _MD_NEWBB_DBUPDATED); } elseif (!empty($forum_id)) { - redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum_id", 2, _MD_NEWBB_DBUPDATED); } else { - redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_NEWBB_DBUPDATED); } // irmtfan move to footer.php include_once __DIR__ . '/footer.php'; diff --git a/action.topic.php b/action.topic.php index 86fc3f6c..c53ee815 100644 --- a/action.topic.php +++ b/action.topic.php @@ -1,41 +1,47 @@ * @since 4.00 * @package module::newbb */ + +use Xmf\Request; + include_once __DIR__ . '/header.php'; -$forum_id = XoopsRequest::getInt('forum_id', 0, 'POST'); -$topic_id = XoopsRequest::getArray('topic_id', null, 'POST'); +$forum_id = Request::getInt('forum_id', 0, 'POST'); +$topic_id = Request::getArray('topic_id', null, 'POST'); -$op = XoopsRequest::getCmd('op', '', 'POST'); +$op = Request::getCmd('op', '', 'POST'); $op = in_array($op, ['approve', 'delete', 'restore', 'move'], true) ? $op : ''; if (0 === count($topic_id) || 0 === count($op)) { // irmtfan - issue with javascript:history.go(-1) - redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NORIGHTTOACCESS); + redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NEWBB_NORIGHTTOACCESS); } $topic_id = array_values($topic_id); +/** @var \NewbbTopicHandler $topicHandler */ $topicHandler = xoops_getModuleHandler('topic', 'newbb'); +/** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $isadmin = newbb_isAdmin($forum_id); if (!$isadmin) { - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NORIGHTTOACCESS); + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } switch ($op) { case 'restore': $forums = []; $topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { - $topic_obj =& $topics_obj[$id]; + /** @var \Topic $topic_obj */ + $topic_obj = $topics_obj[$id]; $topicHandler->approve($topic_obj); $topicHandler->synchronization($topic_obj); $forums[$topic_obj->getVar('forum_id')] = 1; @@ -51,7 +57,8 @@ $forums = []; $topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { - $topic_obj =& $topics_obj[$id]; + /** @var \Topic $topic_obj */ + $topic_obj = $topics_obj[$id]; $topicHandler->approve($topic_obj); $topicHandler->synchronization($topic_obj); $forums[$topic_obj->getVar('forum_id')] = 1; @@ -68,9 +75,10 @@ } include_once __DIR__ . '/include/notification.inc.php'; + /** @var \XoopsNotificationHandler $notificationHandler */ $notificationHandler = xoops_getHandler('notification'); foreach (array_keys($topics_obj) as $id) { - $topic_obj =& $topics_obj[$id]; + $topic_obj = $topics_obj[$id]; $tags = []; $tags['THREAD_NAME'] = $topic_obj->getVar('topic_title'); $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topic_obj->getVar('forum_id'); @@ -95,7 +103,7 @@ $forums = []; $topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topics_obj) as $id) { - $topic_obj =& $topics_obj[$id]; + $topic_obj = $topics_obj[$id]; // irmtfan should be set to false to not delete topic from database $topicHandler->delete($topic_obj, false); $topicHandler->synchronization($topic_obj); @@ -110,25 +118,29 @@ unset($topics_obj, $forums_obj); break; case 'move': - if (XoopsRequest::getInt('newforum', 0, 'POST') - && XoopsRequest::getInt('newforum', 0, 'POST') !== $forum_id - && $forumHandler->getPermission(XoopsRequest::getInt('newforum', 0, 'POST'), 'post') + if (Request::getInt('newforum', 0, 'POST') + && Request::getInt('newforum', 0, 'POST') !== $forum_id + && $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post') ) { $criteria = new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'); + /** @var \NewbbPostHandler $postHandler */ $postHandler = xoops_getModuleHandler('post', 'newbb'); - $postHandler->updateAll('forum_id', XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true); - $topicHandler->updateAll('forum_id', XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true); - $forumHandler->synchronization(XoopsRequest::getInt('newforum', 0, 'POST')); + $postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); + $topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); + $forumHandler->synchronization(Request::getInt('newforum', 0, 'POST')); $forumHandler->synchronization($forum_id); } else { include $GLOBALS['xoops']->path('header.php'); + /** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $categories = $categoryHandler->getByPermission('access'); - $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); + $categories = $categoryHandler->getByPermission('access'); + $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); $box = ''; unset($forums, $categories); - echo "
"; + echo ""; echo ""; echo "
"; echo ""; - echo ''; echo '
' . _MD_MOVETOPICTO . ''; + echo '
' . _MD_NEWBB_MOVETOPICTO . ''; echo $box; echo '
'; @@ -167,12 +179,13 @@ } break; } +/** @var \NewbbStatsHandler $statsHandler */ $statsHandler = xoops_getModuleHandler('stats', 'newbb'); $statsHandler->reset(); if (empty($forum_id)) { - redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED); } else { - redirect_header(XOOPS_URL . '/modules/newbb/viewforum.php?forum=$forum_id', 2, _MD_DBUPDATED); + redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); } // irmtfan move to footer.php include_once __DIR__ . '/footer.php'; diff --git a/admin/about.php b/admin/about.php index 813074c6..932eeb31 100644 --- a/admin/about.php +++ b/admin/about.php @@ -1,5 +1,5 @@ addNavigation(basename(__FILE__)); -echo $aboutAdmin->renderAbout('PBQZ7D6LT6UBC', false); +$adminObject->displayNavigation(basename(__FILE__)); +\Xmf\Module\Admin::setPaypal('PBQZ7D6LT6UBC'); +$adminObject->displayAbout(false); include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index 1cd3e047..1b440338 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -28,13 +28,18 @@ // URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // // Project: XOOPS Project // // ------------------------------------------------------------------------- // + +use Xmf\Request; + include_once __DIR__ . '/admin_header.php'; -mod_loadFunctions('render', 'newbb'); +include_once __DIR__ . '/../include/functions.render.php'; + xoops_cp_header(); -echo '
'; -$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); -$cat_id = XoopsRequest::getInt('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST'), 'GET'); // (int)( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] ); +$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); +$cat_id = Request::getInt('cat_id', Request::getInt('cat_id', 0, 'POST'), 'GET'); // (int)( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] ); + +/** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); /** @@ -60,7 +65,7 @@ function editCategory(XoopsObject $category_obj = null) $category_obj = $categoryHandler->create(); } $groups_cat_access = null; - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); if (!$category_obj->isNew()) { $sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $category_obj->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); @@ -115,19 +120,19 @@ function editCategory(XoopsObject $category_obj = null) // //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $category_obj->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY); // echo "" . _AM_NEWBB_EDITCATEGORY . ''; // } else { - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); // } echo '
'; editCategory($category_obj); break; case 'del': - if (!XoopsRequest::getBool('confirm', '', 'POST')) { - xoops_confirm(['op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); + if (!Request::getBool('confirm', '', 'POST')) { + xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); break; } else { $category_obj = $categoryHandler->create(false); - $category_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST')); + $category_obj->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); $categoryHandler->delete($category_obj); redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED); @@ -135,7 +140,8 @@ function editCategory(XoopsObject $category_obj = null) break; case 'save': - mod_clearCacheFile('permission_category', 'newbb'); + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); + $cacheHelper->delete('permission_category'); if ($cat_id) { $category_obj = $categoryHandler->get($cat_id); $message = _AM_NEWBB_CATEGORYUPDATED; @@ -144,11 +150,11 @@ function editCategory(XoopsObject $category_obj = null) $message = _AM_NEWBB_CATEGORYCREATED; } - $category_obj->setVar('cat_title', XoopsRequest::getString('title', '', 'POST')); - $category_obj->setVar('cat_image', XoopsRequest::getString('cat_image', '', 'POST')); - $category_obj->setVar('cat_order', XoopsRequest::getInt('cat_order', 0, 'POST')); - $category_obj->setVar('cat_description', XoopsRequest::getText('cat_description', '', 'POST')); - $category_obj->setVar('cat_url', XoopsRequest::getString('cat_url', '', 'POST')); + $category_obj->setVar('cat_title', Request::getString('title', '', 'POST')); + $category_obj->setVar('cat_image', Request::getString('cat_image', '', 'POST')); + $category_obj->setVar('cat_order', Request::getInt('cat_order', 0, 'POST')); + $category_obj->setVar('cat_description', Request::getText('cat_description', '', 'POST')); + $category_obj->setVar('cat_url', Request::getString('cat_url', '', 'POST')); $cat_isNew = $category_obj->isNew(); if (!$categoryHandler->insert($category_obj)) { @@ -162,19 +168,16 @@ function editCategory(XoopsObject $category_obj = null) default: if (!$categories = $categoryHandler->getByPermission('all')) { - $indexAdmin->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); - echo $indexAdmin->renderButton('left'); + $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); + $adminObject->displayButton(); - echo '
'; echo '
'; newCategory(); - echo '
'; break; } - echo $indexAdmin->addNavigation(basename(__FILE__)); - echo '
'; - $indexAdmin->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); - echo $indexAdmin->renderButton('left'); + $adminObject->displayNavigation(basename(__FILE__)); + $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); + $adminObject->displayButton(); echo ""; echo ""; @@ -195,9 +198,9 @@ function editCategory(XoopsObject $category_obj = null) echo ''; } echo '
'; - echo '
'; break; } -mod_clearCacheFile('permission_category', 'newbb'); -echo '
'; +$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); +$cacheHelper->delete('permission_category'); + include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_digest.php b/admin/admin_digest.php index d55910d9..e98e76b6 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -1,5 +1,5 @@ path('class/pagenav.php'); -$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); -$item = XoopsRequest::getString('op', XoopsRequest::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process"); +$op = Request::getCmd('op', Request::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); +$item = Request::getString('op', Request::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process"); -$start = XoopsRequest::getInt('start', 0, 'GET'); +$start = Request::getInt('start', 0, 'GET'); //$reportHandler = xoops_getModuleHandler('report', 'newbb'); xoops_cp_header(); switch ($op) { case 'delete': - $digest_ids = XoopsRequest::getArray('digest_id', '', 'POST'); + $digest_ids = Request::getArray('digest_id', '', 'POST'); + /** @var \NewbbDigestHandler $digestHandler */ $digestHandler = xoops_getModuleHandler('digest', 'newbb'); - if ('' !== $digest_ids) { + if ($digest_ids !== '') { foreach ($digest_ids as $did => $value) { $digestHandler->delete($did); } @@ -52,13 +55,13 @@ break; default: - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); - echo '
'; + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + $limit = 5; - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); //if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); - // else echo $indexAdmin->addNavigation(basename(__FILE__)); + // else $adminObject->displayNavigation(basename(__FILE__)); echo ''; echo ""; echo ""; @@ -88,8 +91,6 @@ $nav = new XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); echo $nav->renderNav(4); - echo ''; - break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_footer.php b/admin/admin_footer.php index d56db3cd..d135b445 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -18,13 +18,8 @@ */ global $pathIcon32; -echo "
\n" - . "
\n" - . " XOOPS\n" - . "
\n" - . ' ' - . _AM_MODULEADMIN_ADMIN_FOOTER - . "\n" - . "
\n"; +if (!class_exists('\Xoops', false)) { + echo "
\n" . "
\n" . " XOOPS\n" . "
\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . "
\n"; +} xoops_cp_footer(); diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index b43f03be..a549df94 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -1,5 +1,5 @@ path('class/xoopstree.php'); include_once $GLOBALS['xoops']->path('class/pagenav.php'); -mod_loadFunctions('forum', 'newbb'); -mod_loadFunctions('render', 'newbb'); -load_functions('cache'); +include_once __DIR__ . '/../include/functions.forum.php'; +include_once __DIR__ . '/../include/functions.render.php'; + +$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); xoops_cp_header(); -$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); -$forum_id = XoopsRequest::getInt('forum', XoopsRequest::getInt('forum', 0, 'POST'), 'GET'); //(int)( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) ); +$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); +$forum_id = Request::getInt('forum', Request::getInt('forum', 0, 'POST'), 'GET'); //(int)( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) ); +/** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); switch ($op) { case 'moveforum': //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); - if (XoopsRequest::getInt('dest_forum', 0, 'POST')) { - $dest = XoopsRequest::getInt('dest_forum', 0, 'POST'); + if (Request::getInt('dest_forum', 0, 'POST')) { + $dest = Request::getInt('dest_forum', 0, 'POST'); if ($dest > 0) { - $pid = $dest; + $pid = (int)$dest; $forum_dest = $forumHandler->get($pid); $cid = $forum_dest->getVar('cat_id'); unset($forum_dest); } else { - $cid = abs($dest); + $cid = abs((int)$dest); $pid = 0; } $forum_obj = $forumHandler->get($forum_id); @@ -66,7 +71,7 @@ $forumHandler->updateAll('cat_id', $cid, new Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); } - mod_clearCacheFile('forum', 'newbb'); + $cacheHelper->delete('forum'); redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED); } else { redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); @@ -92,18 +97,18 @@ case 'mergeforum': //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); - if (XoopsRequest::getString('dest_forum', '', 'POST')) { - $forum_dest = $forumHandler->get(XoopsRequest::getString('dest_forum', '', 'POST')); + if (Request::getString('dest_forum', '', 'POST')) { + $forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST')); if (is_object($forum_dest)) { $cid = $forum_dest->getVar('cat_id'); - $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' SET forum_id=' . XoopsRequest::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; + $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; $result_post = $GLOBALS['xoopsDB']->queryF($sql); - $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . ' SET forum_id=' . XoopsRequest::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; + $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; $result_topic = $GLOBALS['xoopsDB']->queryF($sql); $forum_obj = $forumHandler->get($forum_id); - $forumHandler->updateAll('parent_forum', XoopsRequest::getInt('dest_forum', 0, 'POST'), new Criteria('parent_forum', $forum_id)); + $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new Criteria('parent_forum', $forum_id)); if ($cid !== $forum_obj->getVar('cat_id') && $subforums = newbb_getSubForum($forum_id)) { $forums = array_map('intval', array_values($subforums)); $forumHandler->updateAll('cat_id', $cid, new Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); @@ -111,10 +116,9 @@ $forumHandler->delete($forum_obj); - //mod_clearCacheFile("forum", "newbb"); $forumHandler->synchronization($forum_dest); unset($forum_dest); - mod_clearCacheFile('forum', 'newbb'); + $cacheHelper->delete('forum'); redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MERGED); } else { @@ -149,28 +153,30 @@ $message = _AM_NEWBB_FORUMCREATED; } - $forum_obj->setVar('forum_name', XoopsRequest::getString('forum_name', '', 'POST')); - $forum_obj->setVar('forum_desc', XoopsRequest::getString('forum_desc', '', 'POST')); - $forum_obj->setVar('forum_order', XoopsRequest::getInt('forum_order', 0, 'POST')); - $forum_obj->setVar('forum_moderator', XoopsRequest::getArray('forum_moderator', [], 'POST')); - $forum_obj->setVar('parent_forum', XoopsRequest::getInt('parent_forum', 0, 'POST')); - $forum_obj->setVar('attach_maxkb', XoopsRequest::getInt('attach_maxkb', 0, 'POST')); - $forum_obj->setVar('attach_ext', XoopsRequest::getString('attach_ext', '', 'POST')); - $forum_obj->setVar('hot_threshold', XoopsRequest::getInt('hot_threshold', 0, 'POST')); - if (XoopsRequest::getInt('parent_forum', 0, 'POST')) { - $parent_obj = $forumHandler->get(XoopsRequest::getInt('parent_forum', 0, 'POST'), ['cat_id']); + $forum_obj->setVar('forum_name', Request::getString('forum_name', '', 'POST')); + $forum_obj->setVar('forum_desc', Request::getString('forum_desc', '', 'POST')); + $forum_obj->setVar('forum_order', Request::getInt('forum_order', 0, 'POST')); + $forum_obj->setVar('forum_moderator', Request::getArray('forum_moderator', [], 'POST')); + $forum_obj->setVar('parent_forum', Request::getInt('parent_forum', 0, 'POST')); + $forum_obj->setVar('attach_maxkb', Request::getInt('attach_maxkb', 0, 'POST')); + $forum_obj->setVar('attach_ext', Request::getString('attach_ext', '', 'POST')); + $forum_obj->setVar('hot_threshold', Request::getInt('hot_threshold', 0, 'POST')); + if (Request::getInt('parent_forum', 0, 'POST')) { + $parent_obj = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']); $_POST['cat_id'] = $parent_obj->getVar('cat_id'); } - $forum_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST')); + $forum_obj->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); if ($forumHandler->insert($forum_obj)) { - mod_clearCacheFile('forum', 'newbb'); - if (XoopsRequest::getInt('perm_template', 0, 'POST')) { + $cacheHelper->delete('forum'); + if (Request::getInt('perm_template', 0, 'POST')) { + /** @var \NewbbPermissionHandler $grouppermHandler */ $grouppermHandler = xoops_getModuleHandler('permission', $xoopsModule->getVar('dirname')); $perm_template = $grouppermHandler->getTemplate(); - $memberHandler = xoops_getHandler('member'); - $glist = $memberHandler->getGroupList(); - $perms = $grouppermHandler->getValidForumPerms(true); + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + $glist = $memberHandler->getGroupList(); + $perms = $grouppermHandler->getValidForumPerms(true); foreach (array_keys($glist) as $group) { foreach ($perms as $perm) { $ids = $grouppermHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); @@ -192,32 +198,25 @@ case 'mod': $forum_obj = $forumHandler->get($forum_id); - //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, _AM_NEWBB_EDITTHISFORUM . $forum_obj->getVar('forum_name')); - echo "
" . _AM_NEWBB_EDITTHISFORUM . ''; - include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); - - echo '
'; break; case 'del': - if (1 !== XoopsRequest::getInt('confirm', 0, 'POST')) { - xoops_confirm(['op' => 'del', 'forum' => XoopsRequest::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); + if (1 !== Request::getInt('confirm', 0, 'POST')) { + xoops_confirm(['op' => 'del', 'forum' => Request::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); break; } else { - $forum_obj = $forumHandler->get(XoopsRequest::getInt('forum', 0, 'POST')); + $forum_obj = $forumHandler->get(Request::getInt('forum', 0, 'POST')); $forumHandler->delete($forum_obj); - mod_clearCacheFile('forum', 'newbb'); + $cacheHelper->delete('forum'); redirect_header('admin_forum_manager.php?op=manage', 1, _AM_NEWBB_FORUMREMOVED); } break; case 'addforum': - //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, _AM_NEWBB_CREATENEWFORUM); - echo "
" . _AM_NEWBB_CREATENEWFORUM . ''; echo '
'; - $parent_forum = XoopsRequest::getInt('forum', 0, 'GET'); - $cat_id = XoopsRequest::getInt('cat_id', 0, 'GET'); + $parent_forum = Request::getInt('forum', 0, 'GET'); + $cat_id = Request::getInt('cat_id', 0, 'GET'); if (!$parent_forum && !$cat_id) { break; } @@ -225,24 +224,20 @@ $forum_obj->setVar('parent_forum', $parent_forum); $forum_obj->setVar('cat_id', $cat_id); include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); - - echo '
'; - break; default: + /** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (0 === count($categories)) { redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } - $echo = $indexAdmin->addNavigation(basename(__FILE__)); - $echo .= '
'; - + $echo = $adminObject->displayNavigation(basename(__FILE__)); $echo .= "
"; $echo .= ""; $echo .= "'; @@ -254,7 +249,7 @@ $echo .= ''; $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); @@ -301,7 +296,6 @@ echo $echo; echo '
" . _AM_NEWBB_NAME . '
'; - echo '
'; break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 5dd6761b..319726b6 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -24,47 +24,46 @@ // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // + +use Xmf\Request; + include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); +include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); xoops_cp_header(); -echo '
'; -echo $indexAdmin->addNavigation(basename(__FILE__)); +$adminObject->displayNavigation(basename(__FILE__)); //if (!$newXoopsModuleGui) loadModuleAdminMenu(5, _AM_NEWBB_PRUNE_TITLE); -// else echo $indexAdmin->addNavigation(basename(__FILE__)); +// else $adminObject->displayNavigation(basename(__FILE__)); echo "" . "
"; -if (XoopsRequest::getString('submit', '', 'POST')) { +if (Request::getString('submit', '', 'POST')) { $post_list = null; $topic_list = null; $topics_number = 0; $posts_number = 0; $selected_forums = ''; // irmtfan fix if it is array - $temp = XoopsRequest::getArray('forums', null, 'POST'); + $temp = Request::getArray('forums', null, 'POST'); if (!$temp || !$temp[0]) { redirect_header('admin_forum_prune.php', 1, _AM_NEWBB_PRUNE_FORUMSELERROR); - } elseif (is_array(XoopsRequest::getArray('forums', '', 'POST'))) { - $selected_forums = implode(',', XoopsRequest::getArray('forums', null, 'POST')); + } elseif (is_array(Request::getArray('forums', '', 'POST'))) { + $selected_forums = implode(',', Request::getArray('forums', null, 'POST')); } else { - $selected_forums = XoopsRequest::getArray('forums', null, 'POST'); + $selected_forums = Request::getArray('forums', null, 'POST'); } - $prune_days = $myts->addSlashes(XoopsRequest::getInt('days', 0, 'POST')); + $prune_days = Request::getInt('days', 0, 'POST'); $prune_ddays = time() - $prune_days; - $archive = XoopsRequest::getInt('archive', 0, 'POST');//$_POST["archive"]); - $sticky = XoopsRequest::getInt('sticky', 0, 'POST');//$_POST["sticky"]); - $digest = XoopsRequest::getInt('digest', 0, 'POST');//$_POST["digest"]); - $lock = XoopsRequest::getInt('lock', 0, 'POST');//$_POST["lock"]); - $hot = XoopsRequest::getInt('hot', 0, 'POST');//$_POST["hot"]); - $store = null; //irmtfan define to fix - if (XoopsRequest::getInt('store', 0, 'POST')) { - $store = $myts->addSlashes(XoopsRequest::getInt('store', 0, 'POST')); - } + $archive = Request::getInt('archive', 0, 'POST'); + $sticky = Request::getInt('sticky', 0, 'POST'); + $digest = Request::getInt('digest', 0, 'POST'); + $lock = Request::getInt('lock', 0, 'POST'); + $hot = Request::getInt('hot', 0, 'POST'); + $store = Request::getInt('store', null, 'POST'); - $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' p + $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p WHERE t.forum_id IN (' . $selected_forums . ') AND p.post_id =t.topic_last_post_id '; @@ -77,7 +76,7 @@ if ($lock) { $sql .= ' AND t.topic_status <> 1 '; } - if (0 !== $hot) { + if ($hot !== 0) { $sql .= ' AND t.topic_replies < ' . $hot . ' '; } @@ -85,10 +84,10 @@ // Ok now we have the sql query completed, go for topic_id's and posts_id's $topics = []; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } // Dave_L code - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { + while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { $topics[] = $row['topic_id']; } $topics_number = count($topics); @@ -96,14 +95,14 @@ $post_list = ''; if ('' !== $topic_list) { - $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; + $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; $posts = []; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } // Dave_L code - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { + while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { $posts[] = $row['post_id']; } $posts_number = count($posts); @@ -113,43 +112,40 @@ if ('' !== $post_list) { // COPY POSTS TO OTHER FORUM if (null !== $store) { - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } } else { // ARCHIVING POSTS - if (1 == $archive) { - $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' - . $GLOBALS['xoopsDB']->prefix('bb_posts') - . ' p, ' - . $GLOBALS['xoopsDB']->prefix('bb_posts_text') - . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); + if ($archive == 1) { + $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); while (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('bb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); + $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); } } // DELETE POSTS - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . " WHERE topic_id IN ($topic_list)"; + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } // DELETE TOPICS - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . " WHERE topic_id IN ($topic_list)"; + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } // DELETE POSTS_TEXT - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts_text') . " WHERE post_id IN ($post_list)"; + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { - return _MD_ERROR; + return _MD_NEWBB_ERROR; } // SYNC FORUMS AFTER DELETE + /** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forumHandler->synchronization(); // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL: @@ -168,7 +164,7 @@ /* Let User select the number of days $sform->addElement( new XoopsFormText(_AM_NEWBB_PRUNE_DAYS , 'days', 5, 10,100 ), true ); */ - // $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("bb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("bb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"; + // $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("newbb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("newbb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"; // $result = $GLOBALS['xoopsDB']->query(); // Days selected by selbox (better error control :lol:) $days = new XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false); @@ -184,7 +180,7 @@ $sform->addElement($days); // START irmtfan remove hardcode db access include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files - mod_loadFunctions('forum', 'newbb'); + include_once __DIR__ . '/../include/functions.forum.php'; $forumSelMulti = ""; // disable all categories $forumSelBox = ''; @@ -196,13 +192,13 @@ $checkbox = new XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); $radiobox = new XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); // PUAJJ I HATE IT, please tidy up - $sql = "SELECT forum_name, forum_id FROM " . $GLOBALS['xoopsDB']->prefix("bb_forums") . " ORDER BY forum_id"; + $sql = "SELECT forum_name, forum_id FROM " . $GLOBALS['xoopsDB']->prefix("newbb_forums") . " ORDER BY forum_id"; if ($result = $GLOBALS['xoopsDB']->query($sql)) { if ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) { do { $checkbox->addOption($myrow['forum_id'], $myrow['forum_name']); $radiobox->addOption($myrow['forum_id'], $myrow['forum_name']); - } while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result); + } while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)); } else { echo "NO FORUMS"; } @@ -259,5 +255,4 @@ } echo '
'; -echo '
'; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index 4e82f779..515e37e2 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -1,5 +1,5 @@ prefix('bb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; + $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_categories') . ' set cat_order = ' . $cat_orders[$i] . " WHERE cat_id=$cat[$i]"; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); } } $ordersCount = count($orders); for ($i = 0; $i < $ordersCount; ++$i) { - $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i]; + $sql = 'update ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . ' set forum_order = ' . $orders[$i] . ' WHERE forum_id=' . $forum[$i]; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_FORUM_ERROR); } } redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER); } else { - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $orders = []; $cat_orders = []; $forum = []; $cat = []; xoops_cp_header(); - echo '
'; - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); echo "" . "'; echo ''; + /** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); @@ -110,6 +114,5 @@ echo '
"; $tform = new XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); @@ -73,9 +75,11 @@ echo "" . _AM_NEWBB_REORDERWEIGHT . '
'; echo ''; echo '
'; - echo ''; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index 855fa15e..836c36cd 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -1,5 +1,5 @@ '; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); -echo $indexAdmin->addNavigation(basename(__FILE__)); +include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +$adminObject->displayNavigation(basename(__FILE__)); +/** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -if (XoopsRequest::getString('submit', '', 'POST')) { - $fgroups = XoopsRequest::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; - $fforum = XoopsRequest::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); +/** @var \NewbbForumHandler $forumHandler */ +$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +if (Request::getString('submit', '', 'POST')) { + $fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; + $fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); $fuser = []; - if (0 !== $fforum) { - if ('' !== $fgroups) { + if ($fforum !== 0) { + if ($fgroups !== '') { $gg = []; foreach ($fgroups as $k) { $gg = $memberHandler->getUsersByGroup($k, false); @@ -51,10 +55,10 @@ } } } - if (-1 == $fforum) { // alle Foren - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; + if ($fforum == -1) { // alle Foren + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; } else { - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; } if (is_array($fuser) && $GLOBALS['xoopsDB']->queryF($sql)) { $mess = _AM_NEWBB_GROUPMOD_ADDMOD; @@ -69,8 +73,9 @@ echo _AM_NEWBB_GROUPMOD_TITLEDESC; echo "

" . "
"; echo "
"; +/** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); -$criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); +$criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); @@ -96,6 +101,5 @@ echo ''; echo '
'; -echo ''; -echo ''; +echo ''; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_header.php b/admin/admin_header.php index 00e5d470..2d7a3218 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -29,33 +29,43 @@ // Project: XOOPS Project // // ------------------------------------------------------------------------- // +use Xmf\Request; + //include $GLOBALS['xoops']->path('include/cp_header.php'); include __DIR__ . '/../../../include/cp_header.php'; include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'); include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php'); include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php'); -include_once $GLOBALS['xoops']->path('Frameworks/art/functions.php'); -include_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php'); - -include_once __DIR__ . '/../include/config.php'; +//include_once $GLOBALS['xoops']->path('Frameworks/art/functions.php'); +//include_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php'); -xoops_load('XoopsRequest'); +include_once dirname(__DIR__) . '/include/config.php'; $moduleDirName = basename(dirname(__DIR__)); -xoops_loadLanguage('main', 'newbb'); -xoops_loadLanguage('modinfo', 'newbb'); +if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { +} else { + $moduleHelper = Xmf\Module\Helper::getHelper('system'); +} +/** @var Xmf\Module\Admin $adminObject */ +$adminObject = Xmf\Module\Admin::getInstance(); -/** @var XoopsModuleHandler $moduleHandler */ -$moduleHandler = xoops_getHandler('module'); -$module = $moduleHandler->getByDirname($moduleDirName); -$pathIcon16 = XOOPS_URL . '/' . $module->getInfo('sysicons16'); -$pathIcon32 = XOOPS_URL . '/' . $module->getInfo('sysicons32'); -$pathModIcon32 = XOOPS_URL . '/' . $module->getInfo('modicons32'); +$myts = MyTextSanitizer::getInstance(); -$xoopsModuleAdminPath = $GLOBALS['xoops']->path('www/' . $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin')); -require_once $xoopsModuleAdminPath . '/moduleadmin.php'; +if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { + require_once $GLOBALS['xoops']->path('class/template.php'); + $xoopsTpl = new XoopsTpl(); +} -$indexAdmin = new ModuleAdmin(); +$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32'); -$myts = MyTextSanitizer::getInstance(); +// Local icons path +$xoopsTpl->assign('pathModIcon16', $pathIcon16); +$xoopsTpl->assign('pathModIcon32', $pathIcon32); + +// Load language files +$moduleHelper->loadLanguage('admin'); +$moduleHelper->loadLanguage('modinfo'); +$moduleHelper->loadLanguage('main'); diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index ac1b169d..fe627303 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -28,9 +28,14 @@ // URL: http://xoops.org/ // // Project: XOOPS Project // // ------------------------------------------------------------------------- // + +use Xmf\Request; + include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); -include_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); +include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +if (!class_exists('XoopsGroupPermForm')) { + include_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); +} /** * TODO: synchronize cascade permissions for multi-level @@ -85,7 +90,9 @@ public function render() $this->_itemTree[$item_id]['allchild'] = []; $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); } - $gpermHandler = xoops_getHandler('groupperm'); + /** @var \XoopsGroupPermHandler $gpermHandler */ + $gpermHandler = xoops_getHandler('groupperm'); + /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); foreach (array_keys($glist) as $i) { @@ -101,17 +108,7 @@ public function render() $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); $this->addElement($tray); $ret = '

' . $this->getTitle() . '

' . $this->_permDesc . '
'; - $ret .= "
getExtra() - . ">\n\n"; + $ret .= "getExtra() . ">\n
\n"; $elements = $this->getElements(); $hidden = ''; foreach (array_keys($elements) as $i) { @@ -119,7 +116,7 @@ public function render() $ret .= $elements[$i]; } elseif (!$elements[$i]->isHidden()) { $ret .= "\n\n"; @@ -159,20 +156,7 @@ public function __construct($caption, $name, $groupId, $values = null) public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) { if ($option['id'] > 0) { - $tree .= $prefix - . '
\n"; + $tree .= ' />' . $option['name'] . '
\n"; } else { $tree .= $prefix . $option['name'] . '
\n"; } @@ -219,15 +190,16 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; -$action = strtolower(XoopsRequest::getCmd('action', '')); +$action = strtolower(Request::getCmd('action', '')); $module_id = $xoopsModule->getVar('mid'); +/** @var \NewbbPermissionHandler $newbbpermHandler */ $newbbpermHandler = xoops_getModuleHandler('permission', 'newbb'); $perms = $newbbpermHandler->getValidForumPerms(); switch ($action) { case 'template': xoops_cp_header(); - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); @@ -254,35 +226,16 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $option_ids = []; foreach ($perms as $perm) { ++$ii; - if (0 == $ii % 5) { + if ($ii % 5 == 0) { $ret_ele .= ''; } $checked = in_array('forum_' . $perm, $selected) ? ' checked' : ''; $option_id = $perm . '_' . $i; $option_ids[] = $option_id; - $ret_ele .= ''; + $ret_ele .= ''; } $ret_ele .= '
" . $elements[$i]->getCaption(); - if ('' !== $elements[$i]->getDescription()) { + if ($elements[$i]->getDescription() !== '') { $ret .= '

' . $elements[$i]->getDescription() . ''; } $ret .= "
\n" . $elements[$i]->render() . "\n
' - . constant('_AM_NEWBB_CAN_' - . strtoupper($perm)) - . '
' . constant('_AM_NEWBB_CAN_' . strtoupper($perm)) . '
'; - $ret_ele .= _ALL - . ' '; + $ret_ele .= _ALL . ' '; $ret_ele .= '
'; $ret_ele .= ''; $elements[] = $ret_ele; @@ -304,7 +257,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) case 'template_save': // $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0); - $res = $newbbpermHandler->setTemplate(XoopsRequest::getArray('perms', '', 'POST'), $groupid = 0); + $res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); if ($res) { redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); } else { @@ -315,11 +268,11 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) case 'apply': $perm_template = $newbbpermHandler->getTemplate(); - if (null === $perm_template) { + if ($perm_template === null) { redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE); } xoops_cp_header(); - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); @@ -332,11 +285,13 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $opform->addElement($op_select); $opform->display(); + /** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); + /** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { @@ -362,16 +317,17 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) break; case 'apply_save': - if (!XoopsRequest::getArray('forums', '', 'POST')) { + if (!Request::getArray('forums', '', 'POST')) { break; } - foreach (XoopsRequest::getArray('forums', '', 'POST') as $forum) { + foreach (Request::getArray('forums', '', 'POST') as $forum) { if ($forum < 1) { continue; } $newbbpermHandler->applyTemplate($forum, $module_id); } - mod_clearCacheFile('permission', 'newbb'); + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); + $cacheHelper->delete('permission'); redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_APPLIED); break; @@ -379,7 +335,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) xoops_cp_header(); $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -394,7 +350,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); } - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); @@ -428,7 +384,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } $op_keys = array_keys($op_options); - $op = strtolower(XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'COOKIE'), 'GET')); + $op = strtolower(Request::getCmd('op', Request::getCmd('op', '', 'COOKIE'), 'GET')); if (empty($op)) { $op = $op_keys[0]; setcookie('op', isset($op_keys[1]) ? $op_keys[1] : ''); @@ -448,10 +404,10 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - if ('category' === $op) { + if ($op === 'category') { foreach (array_keys($categories) as $key) { $form->addItem($key, $categories[$key]); } @@ -474,9 +430,11 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form->display(); // Since we can not control the permission update, a trick is used here + /** @var \NewbbPermissionHandler $permissionHandler */ $permissionHandler = xoops_getModuleHandler('permission', 'newbb'); $permissionHandler->createPermData(); - mod_clearCacheFile('permission', 'newbb'); + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); + $cacheHelper->delete('permission'); include_once __DIR__ . '/admin_footer.php'; break; } diff --git a/admin/admin_report.php b/admin/admin_report.php index ba393d15..daaa364f 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -29,25 +29,32 @@ // Project: XOOPS Project // // ------------------------------------------------------------------------- // +use Xmf\Request; + include_once __DIR__ . '/admin_header.php'; include_once $GLOBALS['xoops']->path('class/pagenav.php'); -$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); -$item = XoopsRequest::getString('op', XoopsRequest::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process"); -$start = XoopsRequest::getInt('start', XoopsRequest::getInt('start', 0, 'GET'), 'POST'); //$start = !empty($_POST['start']) ? (int)( $_POST['start'] ) : (int)( @$_GET['start'] ); +$op = Request::getCmd('op', 'default'); +$item = Request::getString('item', 'process'); +$start = Request::getInt('start', 0); + +$op = Request::hasVar('submit', 'POST') ? 'save' : $op; +$op = Request::hasVar('delete', 'POST') ? 'delete' : $op; + +/** @var \NewbbReportHandler $reportHandler */ $reportHandler = xoops_getModuleHandler('report', 'newbb'); xoops_cp_header(); -echo '
'; + switch ($op) { case 'save': - $report_ids = XoopsRequest::getArray('report_id', '', 'POST'); - // $report_ids = XoopsRequest::getInt('report_id', 0, 'POST'); //$_POST['report_id']; + $report_ids = Request::getArray('report_id', '', 'POST'); + // $report_ids = Request::getInt('report_id', 0, 'POST'); //$_POST['report_id']; // irmtfan add error redirect header if (0 === count($report_ids)) { redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); } - $report_memos = XoopsRequest::getArray('report_memo', [], 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array(); + $report_memos = Request::getArray('report_memo', [], 'POST'); // isset($_POST['report_memo']) ? $_POST['report_memo'] : array(); foreach ($report_ids as $rid => $value) { if (!$value) { continue; @@ -63,7 +70,7 @@ break; case 'delete': - $report_ids = XoopsRequest::getArray('report_id', [], 'POST');// $_POST['report_id']; + $report_ids = Request::getArray('report_id', [], 'POST');// $_POST['report_id']; // irmtfan add error redirect header if (0 === count($report_ids)) { redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTNOTSELECT); @@ -83,10 +90,10 @@ case 'default': default: - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/xoopsformloader.php'); - mod_loadFunctions('user', 'newbb'); + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + include_once __DIR__ . '/../include/functions.user.php'; - if ('processed' !== $item) { + if ($item !== 'processed') { $process_result = 0; $item_other = 'processed'; $title_other = _AM_NEWBB_PROCESSEDREPORT; @@ -100,14 +107,12 @@ $limit = 10; - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); //if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN); - // else echo $indexAdmin->addNavigation(basename(__FILE__)); + // else $adminObject->displayNavigation(basename(__FILE__)); - echo "
" - . $title_other - . '

'; + echo "
" . $title_other . '

'; echo ''; echo ""; @@ -118,21 +123,10 @@ $reports = $reportHandler->getAllReports(0, 'ASC', $limit, $start, $process_result); foreach ($reports as $report) { - $post_link = '' - . $myts->htmlSpecialChars($report['subject']) - . ''; + $post_link = '' + . $myts->htmlSpecialChars($report['subject']) . ''; $checkbox = ''; - if ('processed' !== $item) { + if ($item !== 'processed') { $memo = ''; } else { $memo = $myts->htmlSpecialChars($report['report_memo']); @@ -146,9 +140,9 @@ echo ''; $uid = (int)$report['reporter_uid']; $reporter_name = newbb_getUnameFromId($uid, $GLOBALS['xoopsModuleConfig']['show_realname']); - $reporter = !empty($uid) ? "" . $reporter_name . '
' : ''; + $reporter = (!empty($uid)) ? "" . $reporter_name . '
' : ''; - echo "'; + echo "'; echo ''; echo ""; echo ''; @@ -157,7 +151,7 @@ echo ""; } $buttons = ''; - if ('processed' !== $item) { + if ($item !== 'processed') { $submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); $buttons .= $submit->render() . ' '; } @@ -176,8 +170,6 @@ $nav = new XoopsPageNav($reportHandler->getCount(new Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); echo $nav->renderNav(4); - echo ''; - break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index a43c222a..99ff11e2 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -3,22 +3,25 @@ * newbb * * @copyright XOOPS Project (http://xoops.org) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @author Taiwen Jiang (phppp or D.J.) * @since 4.00 * @package module::newbb */ + +use Xmf\Request; + // irmtfan - TODO - should be changed completly with Newbb new function newbb_synchronization include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -mod_loadFunctions('recon', 'newbb'); -$form = '
'; -$form .= $indexAdmin->addNavigation(basename(__FILE__)); +include_once __DIR__ . '/../include/functions.recon.php'; +$form = ''; +$form .= $adminObject->displayNavigation(basename(__FILE__)); //if (!empty($_GET['type'])) { -$start = XoopsRequest::getInt('start', 0, 'GET'); //(int)( @$_GET['start'] ); +$start = Request::getInt('start', 0, 'GET'); //(int)( @$_GET['start'] ); -switch (XoopsRequest::getString('type', '', 'GET')) {// @$_GET['type']) +switch (Request::getString('type', '', 'GET')) {// @$_GET['type']) // irmtfan rewrite forum sync case 'forum': $result = newbb_synchronization('forum'); @@ -28,7 +31,8 @@ break; // irmtfan rewrite topic sync case 'topic': - $limit = XoopsRequest::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); + $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); + /** @var \NewbbTopicHandler $topicHandler */ $topicHandler = xoops_getModuleHandler('topic', 'newbb'); $criteria = new Criteria('approved', 1); if ($start >= ($count = $topicHandler->getCount($criteria))) { @@ -53,7 +57,8 @@ break; // irmtfan - user is not in recon functions - only here case 'user': - $limit = XoopsRequest::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); + $limit = Request::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); + /** @var \XoopsUserHandler $userHandler */ $userHandler = xoops_getHandler('user'); if ($start >= ($count = $userHandler->getCount())) { break; @@ -62,21 +67,19 @@ $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start); while (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result)) { // irmtfan approved=1 AND - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . " WHERE topic_poster = {$uid}"; + $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}"; $ret = $GLOBALS['xoopsDB']->query($sql); list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret); // irmtfan approved=1 AND - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . " WHERE topic_digest > 0 AND topic_poster = {$uid}"; + $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_digest > 0 AND topic_poster = {$uid}"; $ret = $GLOBALS['xoopsDB']->query($sql); list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret); // irmtfan approved=1 AND - $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . " WHERE uid = {$uid}"; + $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE uid = {$uid}"; $ret = $GLOBALS['xoopsDB']->query($sql); list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret); - $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' - . $GLOBALS['xoopsDB']->prefix('bb_user_stats') - . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); + $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); } redirect_header('admin_synchronization.php?type=user&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); @@ -163,7 +166,5 @@ $form .= ''; $form .= ''; -$form .= '
'; - echo $form; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index caf5b07c..0f97e2c5 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -4,18 +4,19 @@ * * * @copyright XOOPS Project (http://xoops.org) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @author Taiwen Jiang (phppp or D.J.) * @since 4.00 * @package module::newbb */ +use Xmf\Request; + include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -echo '
'; echo '
'; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php'); -echo $indexAdmin->addNavigation(basename(__FILE__)); +include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +$adminObject->displayNavigation(basename(__FILE__)); /* * The 'op' could be @@ -29,8 +30,8 @@ *
  • default: list of existing types
  • * */ -$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET');// !empty($_GET['op'])? $_GET['op'] : ( !empty($_POST['op']) ? $_POST['op'] : "" ); -if (!in_array($op, [ +$op = Request::getCmd('op', ''); +$validOps = [ 'save_type', 'delete', 'template', @@ -41,27 +42,29 @@ 'edit_forum', 'save_forum', 'add' -], true) -) { +]; +if (!in_array($op, $validOps, true)) { $op = ''; } +/** @var \NewbbTypeHandler $typeHandler */ $typeHandler = xoops_getModuleHandler('type', 'newbb'); +$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); switch ($op) { case 'save_type': $type_names0 = $_POST['type_name']; - $type_names = XoopsRequest::getArray('type_name', null, 'POST');// $_POST['type_name']; + $type_names = Request::getArray('type_name', null, 'POST'); $type_del = []; foreach (array_keys($type_names) as $key) { - if (XoopsRequest::getBool('isnew', '', 'POST')) { + if (Request::getBool('isnew', '', 'POST')) { $type_obj = $typeHandler->create(); } elseif (!$type_obj = $typeHandler->get($key)) { continue; } - // if (XoopsRequest::getArray("type_del[$key]", '', 'POST')) { - $temp = XoopsRequest::getArray('type_del', '', 'POST'); + // if (Request::getArray("type_del[$key]", '', 'POST')) { + $temp = Request::getArray('type_del', '', 'POST'); if ($temp[$key]) { $type_del[] = $key; continue; @@ -70,12 +73,12 @@ // if ($type_obj->getVar($var) != @$_POST[$var][$key]) { // $type_obj->setVar($var, @$_POST[$var][$key]); // } - $temp = XoopsRequest::getArray($var, '', 'POST'); + $temp = Request::getArray($var, '', 'POST'); if ($type_obj->getVar($var) != $temp[$key]) { $type_obj->setVar($var, $temp[$key]); } - // $type_obj->setVar($var, XoopsRequest::getArray($var, '', 'POST')[$key]); + // $type_obj->setVar($var, Request::getArray($var, '', 'POST')[$key]); } $typeHandler->insert($type_obj); unset($type_obj); @@ -85,12 +88,12 @@ $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); } else { - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); } break; case 'delete': - $type_dels = @unserialize(XoopsRequest::getString('type_del', '', 'POST')); + $type_dels = @unserialize(Request::getString('type_del', '', 'POST')); foreach ($type_dels as $key) { if (!$type_obj = $typeHandler->get($key)) { continue; @@ -98,36 +101,24 @@ $typeHandler->delete($type_obj); unset($type_obj); } - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); break; case 'template': $types_obj = $typeHandler->getAll(); - if (0 === count($types_obj)) { + if (count($types_obj) === 0) { redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); } - echo ""; + echo ""; echo _AM_NEWBB_TYPE_ADD . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE_APPLY . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_FORUM . ' | '; - echo '
    '; - echo '
    '; echo '
    '; - - echo "
    " . _AM_NEWBB_TYPE_TEMPLATE . ''; echo '
    '; echo "
    "; @@ -138,13 +129,13 @@ echo "
    '; echo ''; - if ($templates = mod_loadCacheFile('type_template')) { + if ($templates = $cacheHelper->read('type_template')) { arsort($templates); foreach ($templates as $order => $key) { if (!isset($types_obj[$key])) { continue; } - $type_obj =& $types_obj[$key]; + $type_obj = $types_obj[$key]; echo ""; echo ""; echo "'; @@ -169,22 +160,21 @@ echo ""; echo '
    ' . _AM_NEWBB_REPORTTEXT . ': ' . $myts->htmlSpecialChars($report['report_text']) . '" . $reporter . long2ip($report['reporter_ip']) . '" . $reporter . $report['reporter_ip'] . '
    ' . _AM_NEWBB_REPORTMEMO . ': ' . $memo . '
    " . _AM_NEWBB_TYPE_DESCRIPTION . '
    " . $type_obj->getVar('type_name') . '
    '; echo ''; - echo '
    '; break; case 'save_template': - $templates = array_flip(array_filter(XoopsRequest::getArray('type_order', [], 'POST'))); - mod_createCacheFile($templates, 'type_template'); - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_DBUPDATED); + $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); + $cacheHelper->write('type_template', $templates); + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); break; case 'apply': - if (!$templates = mod_loadCacheFile('type_template')) { + if (!$templates = $cacheHelper->read('type_template')) { redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); } $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); $forumHandler = xoops_getModuleHandler('forum', 'newbb'); @@ -207,31 +197,18 @@ $fmform->addElement($tray); //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); - echo "
    " . _AM_NEWBB_ACTION . ''; echo '
    '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_ADD . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE_APPLY . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_FORUM . ' | '; - echo '
    '; echo '
    '; echo '
    '; - echo "
    " . _AM_NEWBB_TYPE_TEMPLATE . ''; - echo '
    '; - echo ""; echo ""; echo "'; @@ -245,7 +222,7 @@ if (!isset($types_obj[$key])) { continue; } - $type_obj =& $types_obj[$key]; + $type_obj = $types_obj[$key]; echo ""; echo "'; echo ''; @@ -256,25 +233,24 @@ echo '
    " . _AM_NEWBB_TYPE_NAME . '
    " . $type_obj->getVar('type_name') . '' . $order . '
    '; echo '
    '; $fmform->display(); - echo '
    '; break; case 'save_apply': - if (!$templates = mod_loadCacheFile('type_template')) { + if (!$templates = $cacheHelper->read('type_template')) { redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); } - foreach (XoopsRequest::getArray('forums', [], 'POST') as $forum) { + foreach (Request::getArray('forums', [], 'POST') as $forum) { if ($forum < 1) { continue; } $typeHandler->updateByForum($forum, array_flip($templates)); } - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_DBUPDATED); + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); break; case 'forum': $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new Criteria('cat_id')); + $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (empty($categories)) { @@ -304,66 +280,42 @@ $fmform->addElement($tray); //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); - echo "
    " . _AM_NEWBB_ACTION . ''; - echo '
    '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_ADD . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_FORUM . ' | '; - echo '
    '; echo '
    '; echo '
    '; - echo "
    " . _AM_NEWBB_TYPE_FORUM . ''; - echo '
    '; $fmform->display(); - echo '
    '; break; case 'edit_forum': - if (!XoopsRequest::getInt('forum', 0, 'POST') || XoopsRequest::getInt('forum', 0, 'POST') < 1) { + if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); } $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - if (!$forum_obj = $forumHandler->get(XoopsRequest::getInt('forum', 0, 'POST'))) { + if (!$forum_obj = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); } $types_obj = $typeHandler->getAll(); - if (0 === count($types_obj)) { + if (count($types_obj) === 0) { redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); } - echo "
    " . _AM_NEWBB_ACTION . ''; - echo '
    '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_ADD . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_FORUM . ' | '; - echo '
    '; - echo '
    '; echo '
    '; - echo "
    " . _AM_NEWBB_TYPE_FORUM . ''; echo '
    '; - echo "
    " . _AM_NEWBB_TYPE_FORUM . ' - ' . $forum_obj->getVar('forum_name') . ''; echo "
    "; echo ""; echo ""; @@ -372,7 +324,7 @@ echo "'; echo ''; - $types = $typeHandler->getByForum(XoopsRequest::getInt('forum', 0, 'POST')); + $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); $types_order = []; foreach ($types as $key => $type) { $types_order[] = $type['type_order']; @@ -382,7 +334,7 @@ if (!isset($types_obj[$type['type_id']])) { continue; } - $type_obj =& $types_obj[$type['type_id']]; + $type_obj = $types_obj[$type['type_id']]; echo ""; echo ""; echo "'; @@ -402,60 +354,47 @@ echo "
    " . _AM_NEWBB_TYPE_DESCRIPTION . '
    " . $type_obj->getVar('type_name') . '
    "; echo '
    • ' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '
    • '; echo '
    • ' . _AM_NEWBB_TYPE_ORDER_DESC . '

    • '; - echo ""; + echo ""; echo ""; echo " "; echo ""; echo '
    '; echo '
    '; - echo '
    '; break; case 'save_forum': - if (!XoopsRequest::getInt('forum', 0, 'POST') || XoopsRequest::getInt('forum', 0, 'POST') < 1) { + if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); } - $typeHandler->updateByForum(XoopsRequest::getInt('forum', 0, 'POST'), XoopsRequest::getArray('type_order', null, 'POST')); - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_DBUPDATED); + $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); break; case 'add': default: $types_obj = $typeHandler->getAll(); - if (0 === count($types_obj)) { + if (count($types_obj) === 0) { $op = 'add'; $title = _AM_NEWBB_TYPE_ADD; } else { $title = _AM_NEWBB_TYPE_LIST; } - if ('add' !== $op) { - echo "
    " . _AM_NEWBB_ACTION . ''; - echo '
    '; - echo ""; + if ($op !== 'add') { + echo ""; echo _AM_NEWBB_TYPE_ADD . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_TEMPLATE . ' | '; - echo ""; + echo ""; echo _AM_NEWBB_TYPE_FORUM . ' | '; - echo '
    '; echo '
    '; echo '
    '; } - echo "
    " . $title . ''; - echo '
    '; - echo "
    "; echo ""; echo ""; - if ('add' !== $op) { + if ($op !== 'add') { echo "'; } echo "'; @@ -465,7 +404,7 @@ $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); - if ('add' !== $op) { + if ($op !== 'add') { foreach ($types_obj as $key => $type_obj) { echo ""; echo ""; @@ -501,7 +440,6 @@ echo ""; echo '
    " . _DELETE . '" . _AM_NEWBB_TYPE_NAME . '
    '; echo '
    '; - echo '
    '; break; } diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index c9a55568..365db3da 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -1,5 +1,5 @@ queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('bb_votedata') . " WHERE ratingid = $rid"); + $rid = Request::getInt('rid', 0, 'GET'); + $topic_id = Request::getInt('topic_id', 0, 'GET'); + $sql = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid"); $GLOBALS['xoopsDB']->query($sql); - $query = 'select rating FROM ' . $GLOBALS['xoopsDB']->prefix('bb_votedata') . ' WHERE topic_id = ' . $topic_id . ''; + $query = 'select rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ''; $voteresult = $GLOBALS['xoopsDB']->query($query); $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); $totalrating = 0; @@ -48,7 +51,7 @@ } $finalrating = $totalrating / $votesDB; $finalrating = number_format($finalrating, 4); - $sql = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('bb_topics'), $finalrating, $votesDB, $topic_id); + $sql = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); $GLOBALS['xoopsDB']->queryF($sql); redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED); @@ -56,15 +59,15 @@ case 'main': default: - $start = XoopsRequest::getInt('start', 0, 'POST'); + $start = Request::getInt('start', 0, 'POST'); $useravgrating = '0'; $uservotes = '0'; - $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('bb_votedata') . ' ORDER BY ratingtimestamp DESC'; + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC'; $results = $GLOBALS['xoopsDB']->query($sql, 20, $start); $votes = $GLOBALS['xoopsDB']->getRowsNum($results); - $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('bb_votedata') . ''; + $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ''; $result2 = $GLOBALS['xoopsDB']->query($sql, 20, $start); $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); $useravgrating = 0; @@ -80,8 +83,7 @@ } xoops_cp_header(); - echo '
    '; - echo $indexAdmin->addNavigation(basename(__FILE__)); + $adminObject->displayNavigation(basename(__FILE__)); echo "
    \n
    " . _AM_NEWBB_VOTE_USERAVG . ": $useravgrating
    \n @@ -89,7 +91,6 @@
    \n
    • " . _AM_NEWBB_VOTE_DELETEDSC . "
    \n -
    \n
    \n \n @@ -102,11 +103,11 @@ \n \n"; - if (0 == $votes) { + if ($votes == 0) { echo "'; } while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) { - $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('bb_topics') . ' WHERE topic_id=' . $topic_id . ''; + $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ''; $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); diff --git a/admin/index.php b/admin/index.php index 3e2cdab9..cb76055a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -29,32 +29,15 @@ // Project: XOOPS Project // // ------------------------------------------------------------------------- // include_once __DIR__ . '/admin_header.php'; -include_once __DIR__ . '/../class/utilities.php'; -mod_loadFunctions('stats', 'newbb'); +include_once __DIR__ . '/../class/utility.php'; +include_once __DIR__ . '/../include/functions.stats.php'; $attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/'); $thumb_path = $attach_path . 'thumbs/'; $folder = [$attach_path, $thumb_path]; -/** - * @param $path - * @return bool|string - */ -function newbb_admin_getPathStatus($path = '') -{ - if ('' === $path) { - return false; - } - if (@is_writable($path)) { - $path_status = ''; - } elseif (!@is_dir($path)) { - $path_status = _AM_NEWBB_NOTAVAILABLE . " " . _AM_NEWBB_CREATETHEDIR . ''; - } else { - $path_status = _AM_NEWBB_NOTWRITABLE . " " . _AM_NEWBB_SETMPERM . ''; - } - - return $path_status; -} +/** @var Xmf\Module\Admin $adminObject */ +$adminObject = Xmf\Module\Admin::getInstance(); /** * @param $target @@ -88,7 +71,7 @@ function newbb_getImageLibs() { $imageLibs = []; unset($output, $status); - if (1 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) { + if ($GLOBALS['xoopsModuleConfig']['image_lib'] == 1 || $GLOBALS['xoopsModuleConfig']['image_lib'] == 0) { $path = empty($GLOBALS['xoopsModuleConfig']['path_magick']) ? '' : $GLOBALS['xoopsModuleConfig']['path_magick'] . '/'; @exec($path . 'convert -version', $output, $status); if (empty($status) && !empty($output) && preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) { @@ -97,7 +80,7 @@ function newbb_getImageLibs() unset($output, $status); } - if (2 == $GLOBALS['xoopsModuleConfig']['image_lib'] || 0 == $GLOBALS['xoopsModuleConfig']['image_lib']) { + if ($GLOBALS['xoopsModuleConfig']['image_lib'] == 2 || $GLOBALS['xoopsModuleConfig']['image_lib'] == 0) { $path = empty($GLOBALS['xoopsModuleConfig']['path_netpbm']) ? '' : $GLOBALS['xoopsModuleConfig']['path_netpbm'] . '/'; @exec($path . 'jpegtopnm -version 2>&1', $output, $status); if (empty($status) && !empty($output) && preg_match("/netpbm[ \t]+([0-9\.]+)/i", $output[0], $matches)) { @@ -106,153 +89,87 @@ function newbb_getImageLibs() unset($output, $status); } - $GDfuncList = get_extension_funcs('gd'); - ob_start(); - @phpinfo(INFO_MODULES); - $output = ob_get_contents(); - ob_end_clean(); - $matches[1] = ''; - $gdversion = ''; - if (preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s", $output, $matches)) { - $gdversion = $matches[2]; - } - if ($GDfuncList) { - if (in_array('imagegd2', $GDfuncList, true)) { - $imageLibs['gd2'] = $gdversion; - } else { - $imageLibs['gd1'] = $gdversion; - } + if (function_exists('gd_info')) { + $tmpInfo = gd_info(); + $imageLibs['gd'] = $tmpInfo['GD Version']; } return $imageLibs; } -$op = XoopsRequest::getCmd('op', '', 'GET'); // (isset($_GET['op']))? $_GET['op'] : ""; - -switch ($op) { - case 'createdir': - $path = XoopsRequest::getString('path', '', 'GET');// $_GET['path']; - $res = newbb_admin_mkdir($path); - $msg = $res ? _AM_NEWBB_DIRCREATED : _AM_NEWBB_DIRNOTCREATED; - redirect_header('index.php', 2, $msg . ': ' . $path); - break; - - case 'setperm': - $path = XoopsRequest::getString('path', '', 'GET');// $_GET['path']; - $res = newbb_admin_chmod($path, 0777); - $msg = $res ? _AM_NEWBB_PERMSET : _AM_NEWBB_PERMNOTSET; - redirect_header('index.php', 2, $msg . ': ' . $path); - break; - - case 'senddigest': - $digestHandler = xoops_getModuleHandler('digest', 'newbb'); - $res = $digestHandler->process(true); - $msg = $res ? _AM_NEWBB_DIGEST_FAILED : _AM_NEWBB_DIGEST_SENT; - redirect_header('index.php', 2, $msg); - break; - - case 'default': - default: - xoops_cp_header(); +xoops_cp_header(); - echo '
    '; - $imageLibs = newbb_getImageLibs(); - /** @var XoopsModuleHandler $moduleHandler */ - $moduleHandler = xoops_getHandler('module'); - $reportHandler = xoops_getModuleHandler('report', 'newbb'); +$imageLibs = newbb_getImageLibs(); +/** @var \XoopsModuleHandler $moduleHandler */ +$moduleHandler = xoops_getHandler('module'); +/** @var \NewbbReportHandler $reportHandler */ +$reportHandler = xoops_getModuleHandler('report', 'newbb'); - $isOK = false; - // START irmtfan add a poll_module config - //XOOPS_POLL - $xoopspoll = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); - if (is_object($xoopspoll)) { - $isOK = $xoopspoll->getVar('isactive'); - } - /* - else { - //Umfrage - $xoopspoll = &$moduleHandler->getByDirname('umfrage'); - if (is_object($xoopspoll)) $isOK = $xoopspoll->getVar('isactive'); - } - */ - // END irmtfan add a poll_module config - - $memlimit_iniphp = returnBytes(@ini_get('memory_limit')); - $postmaxsize_iniphp = returnBytes(@ini_get('post_max_size')); - if ($postmaxsize_iniphp < $memlimit_iniphp) { - $uploadlimit = sprintf(_AM_NEWBB_MEMLIMITOK, returnBytes($postmaxsize_iniphp, true)); - $uploadfarbe = 'Green'; - } else { - $uploadlimit = _AM_NEWBB_MEMLIMITTOLARGE; - $uploadfarbe = 'Red'; - } - - $indexAdmin->addInfoBox(_AM_NEWBB_PREFERENCES); - // START irmtfan better poll module display link and version - check if xoops poll module is available - if ($isOK) { - $pollLink = _AM_NEWBB_AVAILABLE . ': '; - $pollLink .= 'getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "'; - $pollLink .= ' title="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "'; - $pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')'; - } else { - $pollLink = _AM_NEWBB_NOTAVAILABLE; - } - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_POLLMODULE . ': %s' . '', $pollLink, 'Green'); - // END irmtfan better poll module display link and version - check if xoops poll module is available - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_IMAGEMAGICK . ' %s' . '', - array_key_exists('imagemagick', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . 'NetPBM' . ': %s' . '', - array_key_exists('netpbm', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_GDLIB1 . ' %s' . '', - array_key_exists('gd1', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd1'] : _AM_NEWBB_NOTAVAILABLE, 'Red'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_GDLIB2 . ' %s' . '', - array_key_exists('gd2', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd2'] : _AM_NEWBB_NOTAVAILABLE, 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_PREFERENCES, '' . _AM_NEWBB_UPLOAD . ' %s' . '', $uploadlimit, $uploadfarbe); - - $indexAdmin->addInfoBox(_AM_NEWBB_BOARDSUMMARY); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, '' . _AM_NEWBB_TOTALTOPICS . ': %s' . '', getTotalTopics(), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, '' . _AM_NEWBB_TOTALPOSTS . ': %s' . '', getTotalPosts(), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_BOARDSUMMARY, '' . _AM_NEWBB_TOTALVIEWS . ': %s' . '', getTotalViews(), 'Green'); +$isOK = false; +// START irmtfan add a poll_module config +//XOOPS_POLL +$xoopspoll = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); +if (is_object($xoopspoll)) { + $isOK = $xoopspoll->getVar('isactive'); +} +// END irmtfan add a poll_module config - $indexAdmin->addInfoBox(_AM_NEWBB_REPORT); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_REPORT, '' . _AM_NEWBB_REPORT_PENDING . ': %s' . '', $reportHandler->getCount(new Criteria('report_result', 0)), 'Green'); - $indexAdmin->addInfoBoxLine(_AM_NEWBB_REPORT, '' . _AM_NEWBB_REPORT_PROCESSED . ': %s' . '', $reportHandler->getCount(new Criteria('report_result', 1)), 'Green'); +$memlimit_iniphp = return_bytes(@ini_get('memory_limit')); +$postmaxsize_iniphp = return_bytes(@ini_get('post_max_size')); +$uploadlimit = _AM_NEWBB_MEMLIMITTOLARGE; +if ($postmaxsize_iniphp < $memlimit_iniphp) { + $uploadlimit = sprintf(_AM_NEWBB_MEMLIMITOK, return_bytes($postmaxsize_iniphp, true)); +} - // foreach (array_keys($folder) as $i) { - // if (!newbb_admin_getPathStatus($folder[$i]) == '') { - // $indexAdmin->addConfigBoxLine($folder[$i] . ' ' . newbb_admin_getPathStatus($folder[$i]), 'folder'); - // } else { - // $indexAdmin->addConfigBoxLine($folder[$i], 'folder'); - // } - // $indexAdmin->addConfigBoxLine(array($folder[$i], '755'), 'chmod'); - // } +$adminObject->addInfoBox(_AM_NEWBB_PREFERENCES); +// START irmtfan better poll module display link and version - check if xoops poll module is available +if ($isOK) { + $pollLink = _AM_NEWBB_AVAILABLE . ': '; + $pollLink .= 'getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "'; + $pollLink .= ' title="' . $xoopspoll->getVar('name') . ' ' . _VERSION . ' (' . $xoopspoll->getInfo('version') . ') "'; + $pollLink .= '>' . '(' . $xoopspoll->getVar('name') . ')'; +} else { + $pollLink = _AM_NEWBB_NOTAVAILABLE; +} +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_POLLMODULE . ': %s', $pollLink)); +// END irmtfan better poll module display link and version - check if xoops poll module is available +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_IMAGEMAGICK . ' %s', array_key_exists('imagemagick', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['imagemagick'] : _AM_NEWBB_NOTAVAILABLE)); +$adminObject->addInfoBoxLine(sprintf('NetPBM' . ': %s', array_key_exists('netpbm', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['netpbm'] : _AM_NEWBB_NOTAVAILABLE)); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_GDLIB . ' %s', array_key_exists('gd', $imageLibs) ? _AM_NEWBB_AUTODETECTED . $imageLibs['gd'] : _AM_NEWBB_NOTAVAILABLE)); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_UPLOAD . ' %s', $uploadlimit)); + +$adminObject->addInfoBox(_AM_NEWBB_BOARDSUMMARY); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALTOPICS . ': %s', getTotalTopics())); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALPOSTS . ': %s', getTotalPosts())); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALVIEWS . ': %s', getTotalViews())); + +$adminObject->addInfoBox(_AM_NEWBB_REPORT); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PENDING . ': %s', $reportHandler->getCount(new Criteria('report_result', 0)))); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PROCESSED . ': %s', $reportHandler->getCount(new Criteria('report_result', 1)))); + +foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + NewbbUtility::prepareFolder($uploadFolders[$i]); + $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder'); +} - // $indexAdmin = new ModuleAdmin(); - foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - NewbbUtilities::prepareFolder($uploadFolders[$i]); - $indexAdmin->addConfigBoxLine($uploadFolders[$i], 'folder'); - // $indexAdmin->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); - } +$adminObject->displayNavigation(basename(__FILE__)); +$adminObject->displayIndex(); - echo $indexAdmin->addNavigation(basename(__FILE__)); - echo $indexAdmin->renderIndex(); +include_once __DIR__ . '/admin_footer.php'; - echo '
    '; - include_once __DIR__ . '/admin_footer.php'; - break; -} -mod_clearCacheFile('config', 'newbb'); -mod_clearCacheFile('permission', 'newbb'); +$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); +$cacheHelper->delete('config'); +$cacheHelper->delete('permission'); /** * @param $sizeAsString * @param bool $b * @return int|string */ -function returnBytes($sizeAsString, $b = false) +function return_bytes($sizeAsString, $b = false) { - if (false === $b) { + if ($b === false) { switch (substr($sizeAsString, -1)) { case 'M': case 'm': diff --git a/admin/menu.php b/admin/menu.php index 67bf386f..17ee4e0d 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -29,95 +29,104 @@ // Project: XOOPS Project // // ------------------------------------------------------------------------- // +//$moduleDirName = basename(dirname(__DIR__)); + +//$moduleHandler = xoops_getHandler('module'); +//$module = $moduleHandler->getByDirname($moduleDirName); +//$pathIcon32 = '../../' . $module->getInfo('sysicons32'); +//$pathModIcon32 = './' . $module->getInfo('modicons32'); +//xoops_loadLanguage('modinfo', $module->dirname()); + $moduleDirName = basename(dirname(__DIR__)); -/** @var XoopsModuleHandler $moduleHandler */ -$moduleHandler = xoops_getHandler('module'); -$module = $moduleHandler->getByDirname($moduleDirName); -$pathIcon32 = '../../' . $module->getInfo('sysicons32'); -$pathModIcon32 = './' . $module->getInfo('modicons32'); -xoops_loadLanguage('modinfo', $module->dirname()); +if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { +} else { + $moduleHelper = Xmf\Module\Helper::getHelper('system'); +} +$adminObject = \Xmf\Module\Admin::getInstance(); + +$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); +//$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32'); -//$adminmenu[] = array( -// 'title' => _AM_MODULEADMIN_HOME, -// 'link' => 'admin/index.php', -// 'icon' => $pathIcon32 . '/home.png' -//); +// Load language files +$moduleHelper->loadLanguage('admin'); +$moduleHelper->loadLanguage('modinfo'); +$moduleHelper->loadLanguage('main'); $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_INDEX, 'link' => 'admin/index.php', - 'icon' => $pathIcon32 . '/home.png' + 'icon' => $pathIcon32 . 'home.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_CATEGORY, 'link' => 'admin/admin_cat_manager.php', - 'icon' => $pathIcon32 . '/category.png' + 'icon' => $pathIcon32 . 'category.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_FORUM, 'link' => 'admin/admin_forum_manager.php', - 'icon' => $pathIcon32 . '/forums.png' + 'icon' => $pathIcon32 . 'forums.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_PERMISSION, 'link' => 'admin/admin_permissions.php', - 'icon' => $pathIcon32 . '/permissions.png' + 'icon' => $pathIcon32 . 'permissions.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_ORDER, 'link' => 'admin/admin_forum_reorder.php', - 'icon' => $pathIcon32 . '/compfile.png' + 'icon' => $pathIcon32 . 'compfile.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_PRUNE, 'link' => 'admin/admin_forum_prune.php', - 'icon' => $pathIcon32 . '/update.png' + 'icon' => $pathIcon32 . 'update.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_REPORT, 'link' => 'admin/admin_report.php', - 'icon' => $pathIcon32 . '/content.png' + 'icon' => $pathIcon32 . 'content.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_DIGEST, 'link' => 'admin/admin_digest.php', - 'icon' => $pathIcon32 . '/digest.png' + 'icon' => $pathIcon32 . 'digest.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_VOTE, 'link' => 'admin/admin_votedata.php', - 'icon' => $pathIcon32 . '/button_ok.png' + 'icon' => $pathIcon32 . 'button_ok.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_TYPE, 'link' => 'admin/admin_type_manager.php', - 'icon' => $pathIcon32 . '/type.png' + 'icon' => $pathIcon32 . 'type.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_GROUPMOD, 'link' => 'admin/admin_groupmod.php', - 'icon' => $pathIcon32 . '/groupmod.png' + 'icon' => $pathIcon32 . 'groupmod.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_SYNC, 'link' => 'admin/admin_synchronization.php', - 'icon' => $pathIcon32 . '/synchronized.png' + 'icon' => $pathIcon32 . 'synchronized.png' ]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_ABOUT, 'link' => 'admin/about.php', - 'icon' => $pathIcon32 . '/about.png' + 'icon' => $pathIcon32 . 'about.png' ]; diff --git a/admin/migrate.php b/admin/migrate.php new file mode 100644 index 00000000..44f0742a --- /dev/null +++ b/admin/migrate.php @@ -0,0 +1,94 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: Kazumi Ono (AKA onokazu) // +// URL: http://www.myweb.ne.jp/, http://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // +// ------------------------------------------------------------------------- // + +use Xmf\Request; + +include_once __DIR__ . '/admin_header.php'; +xoops_cp_header(); + +$adminObject->displayNavigation(basename(__FILE__)); + +echo << +
    + +
    +
    + +
    +
    + +
    + +EOF; + +XoopsLoad::load('migrate', 'newbb'); +$newbbMigrate = new NewbbMigrate(); + +$op = Request::getCmd('op', 'default'); +$opShow = Request::getCmd('show', null, 'POST'); +$opMigrate = Request::getCmd('migrate', null, 'POST'); +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; + +$message = ''; + +switch ($op) { + case 'show': + $queue = $newbbMigrate->getSynchronizeDDL(); + if (!empty($queue)) { + echo "
    \n";
    +            foreach ($queue as $line) {
    +                echo $line . ";\n";
    +            }
    +            echo "
    \n"; + } + break; + case 'migrate': + $newbbMigrate->synchronizeSchema(); + $message = 'Database migrated to current schema.'; + break; + case 'schema': + xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm'); + break; + case 'confirmwrite': + if ($GLOBALS['xoopsSecurity']->check()) { + $newbbMigrate->saveCurrentSchema(); + $message = 'Current schema file written'; + } + break; +} + +echo "
    $message
    "; + +include_once __DIR__ . '/admin_footer.php'; diff --git a/assets/css/index.html b/assets/css/index.html index 2c5cdd3f..990cbd60 100644 --- a/assets/css/index.html +++ b/assets/css/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/assets/images/category/index.html b/assets/images/category/index.html index 2c5cdd3f..990cbd60 100644 --- a/assets/images/category/index.html +++ b/assets/images/category/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/assets/images/category/newbb.png b/assets/images/category/newbb.png index 7fd8e73006e38004d1e5dd2a1f17a0ac52744da2..891a5728e236be78d1709ba94e8f6d13020fd889 100644 GIT binary patch literal 1650 zcmbVNdrT8|96uj8WFXE6iZSd~=QNwN*DIy;q(JFIJ7|Zr8^syuwRe;guGd|UwU9L; z;t<@+Okhrf>!vb?;v)vc!GOSEDhktNieeaJ4^a@~HiW=>yYkxpFfQ38cfZ&7^Z9i002OcX0tMd8!J3~-5(8q|Hsa!_J<073-fwXJ2bHp~sj8L3p0vBo*2>FnJBz<{JSv!~%{GTwM zXzeiM*>OP%?x1pM3wIxxYi7Zmc29TYGvuN{UZV-_QqUYFWyvLR8>3Omc-#peBQQj* zjD|$&XjmZ5G7YfiscEj98bbZ<&r2lEP+L0g-9q=iKEpCsstEL zfFX%erIyZNH8ux>+AR32UxM>HgB3m%izsLuWhmM}Q8}{}keo#^lp~9>g9^PEOeJg> z<#hNiXF69UP7`nAn3|?Ya7tZ-c!GDe>c6s{#$x|RF##8hz*idoDwWwSuKs+}xx(ib zbFG8hxPGCz#t1o$>;iy!&n71sRIGg|dv=G}Y-SIe*j*6&=ZI3N#BrSMIyE{vilXSq z$Ov1W+}zx((P)fDJJiR1dw6VYOr=t>d0z#;K8b@D(^l`adELurzL^jb~iOOm6nz!CMNFLvxn=( zzP>*8W)u5fJnQwcnLuY}C(E)M9+xfWWO-kslp9>P+CDDUwL(kZ9X=67Tss#(=zlK$ z^0A{sjgP~_dne)+|AuJx7A@Rd7JacQu4HoD+k4=hKEzSUFIVI*h=Sbx=eq;@|5zNHEAD%^B+ForYH|Cm?oV`^@`8gDvBda6{dl=y(WTGl-%8xStf^zI|Ie$kjy3Z#OU(4`~59l1}m#+hvUxgSWV=VF)mU(t=+H!7kw5DMDqWZGVa2+nV nFYVp(ym#W*!BqG+DnE?v delta 916 zcmeywv!8u}ND*Eu@!~Yxm z|Nr~({)%DMxKlQ6uuU@`d-v|$dGqE)Mn-mZ zb#-)f%$_~_`0?Y9A3tttYFfB(;mw;jU%h&@YuB!wJ9lo|wymY5rM$fS{{8#^CVGC} zJRu7hVvI@N?k~IqW5#zOL+#8HJh6^qHL*EP&EIo-U3d7N?I+=C1cYWFT;S z=ep*Fhh!9PO>0+JAnokP!uWA*$NTS(f7c7GFOi-wLxZz(`j=1lr~Rw?f7euGR`r3H zWHW`IrfIBMA?k^_vla$+<#VRJVpet&Nk|k-&=fPD{?so%qBA9nby24B)?I3iJ=}+G zm`o_-@k%-OBChpjgx>zRhNK#1ua!piJ*}aQYZzxoS7f*{=EgF~243xaC$#f}WzKaD zxu*r!x9`~-oX_yaEb!e@H5R7muxk7F(Z{k_n5-gtWyNHAi%#vjGVuW4+up{B%qBd4 znU-C9crhYk>bF7}Kfm+mHglaYDw{4Cr!2LetHpB1lF0Iune4th4bI%@KhRQX$)F*+ zzP{}`*NdWaSJD(KdN-fsat%m4C~@Zw(~|c#%NsXn)iuBW&E;Vvl<~dg!d$^{cZE;~ za|Sybr<5Noyq_h#zKTn5v*sjxO})&#E9S3r+|`Y1GvcDQ?bWNECjHgS!T4HRxN+V- z&lY`=54ICM>T0|e%yC@xb8~yJ<*6*b{ZHEe@6)WW-+j8cFF!ud#Ovd`7Fl3)sg}4# zl%yn`=BH$)RpQpL j=JkdzKn;>08-nxGO3D+9CK^a^F)(<#`njxgN@xNAPOhn5 diff --git a/assets/images/category/topxoops.png b/assets/images/category/topxoops.png index 1a2f29ee13b833b4dfe502adfa91a0801e55e437..b249156d4652b76b108bf975992bb1da8661b313 100644 GIT binary patch delta 604 zcmV-i0;Bzz1nLBk8Gix*008`}-`D^E0x?NMK~#90W8A%aH^WE*EDQ_`E-o$u?F>4B zJ$v@BK$+=`w6$vHf7+T)G+-KN2hba^U=hQN4dnPomW7L>YWaV8JL42De72gHTwSw9 zT|t3?fnm|+%`?}oJ-T24L`pk2_~yfh3=9l^&YVHkf>oTw#D4_N#-*NtfdOt81J)S+ zU#tHA?L!2+RvpT2xc0x{+W)r?;R^mYTtm?amr}7olR^Vm*R09w>e_qi)P$u=PhGvb zti2uX%1PzrSJ$k$x@L`baPa-7Pw|U0FfeSMI1y9)=7R?^;^OM^@({$v%8CdhOxG~J zy7m9hFE|?^E`O=Xz`*eToieS7up-M1e<UYfsO0Gm>L5M8$^V>+U(|o2VDymlqDowzI}V{ zh7G0h@sL!lE-(M&)hmb^z_4e}o`H4-{Qv;yiyFu3b^3$=0000p!3-o_#CPlkQY`6?zK#qG8~eHcB(ehe3dtTp zz6=aiY77hwEes65fII$-=mn+<(3`r<+q)1^J?*fl+&68#i!*Y z-2V5s&;6~RevP9kntRIgZT~@0qgvt`QIe8al4_M)lnSI6j0_Adbqx%44J|_qjIB&f stW3 diff --git a/assets/images/filetypes/html.gif b/assets/images/filetypes/html.gif index a7aa7dc276d856da8653601235b3b5786a022c0f..eb948eae6aa24400081b4c5e6e1d97999cb9eace 100644 GIT binary patch delta 126 zcmV-^0D=Fs0k;7RM@dFFIbjq46acgTkqkm<4hlddWJ2!JQHvj+t delta 123 zcmV->0EGXy0ki=OM@dFFIbjq46ae!8kqkm+00d#s$VsccIHS#ZmPjCu!GU}sDIURz zrGX%bKn-AnEDZ5@+?D~MpyT;~6d_TRGnSB(p{{tW5DraMl|mro1PAPH8x;V)GUwAW dvjJc$=tKZl{a)d`{(f=$Z6ASxgMP1TP}!-Lj$z-ow@8(|(FB0NAP4{eG26^zI3iO^opefV_)rCw&M;`EoIpk7f;^o# j3`wB~z+BOcfCxf!Pw!3P!vkm}v)!h6Z h;sGG!gECasntSo(oE?UOe$SsPT!4WWgM=3e06U!pG86y+ diff --git a/assets/images/logo_module.png b/assets/images/logo_module.png new file mode 100644 index 0000000000000000000000000000000000000000..371bc71989298ddfa707d499a45b3d36aadc9b87 GIT binary patch literal 6510 zcmaJ`bySq?z9pokq|>2G7@7fw4gmovX{ljoW(F8iKsp8iX{C{Fq*J<)7LZOsP+D5J z_?`2ebN{&Ceb;*5C)VEk7tj9VS?i6|(tJvYPm7O+hDNBWqNsB}n%=*{xY+k!92Il; z{Xm0MGDPaaZIGUpu23{NYq%8@pz3UC3)O*IT6?<;LcwTgm;ie{L!_aGx&#F7%xC!r z!{_CUxM!oGfn~f9mJmlM5?}?jwTDSDAGEYH1MID(m<>cU_%#p;P&<1SA6KZZkER~P z#}OiK%`77g0DDQ?3phiOmH;njCzzXrmlX3~x)S&EKifcNz+VugqZISMk}}lL0w};; zp#Tv+eqIQ_C_g|{fKNb3SWHap2|$ovfFH;&2owk0e-tgP;O^t=&Jpbpdx?(Pb?KR6qfKcNs33a(H~B-~XG4tM&yi&}PYB;3so zjsPg=iU17kVb*X@x4+OD8WO57H>4#D0##L%V!r3|+1p!7fD}aJg~a7S0!s1<0s=|` z;==rba>4?NqDuVY;tGPwe{&V#5O-%N4EZPqE{Bx}T>zM!Ey7$hX>3>Xnzxa>sp|E?eyWX4n z>dGz}4UJ+`RZ&jQYyO8R0fN5w{jHDf%4CIpJk+S(X>hJjv`@62_#u7IHx(~-b}&ZB za3G#%O7q*`x5Ha5DZ#-ZrHgW$X?ZAF6#iQh5QsmFm9_JTz=%!!2 z)BLvj%1WDLi&RZbHKqXQ1@eoXjZeX=!uH$i>-P4RXFt*$<7v@6j3DNA$g!G>CL_v2_i)Z9^({)$pCQVq31#?VQT+q|xEwz_V z%u@z7_^2M40lmCQ7-O-UKhH!j!UYz@HislV_{AhshaJ5m#@4-RT z9#?n+M^~+}Ptlb-h^43pX0<_$`O81vZy$K?zpC)R4nIz#^!+xh+wkl8zU`|sM#HON z4*y$a_`zB-A=TYZt^7thdI}&HO|%9xQ_XVMkbGP7&|Db>qddjnNpDuy>p8ZPU-b#I`nqp6S}T< zn*!rsXTsn0<9zejR`2n77fo8ewzxL1MW;-J7QB73bgx`zg)cmul0}dZDP-8s36O0<)BgrbApz; zGw4lDjroAd8*wK~n!ep}8>JcBNtKO5(lS$FblqL%9U4;VrX8aS1t&0|Ois@Up`9Dp zOyXiT2Dq)vfBcb4ca{C5K?nbuj2BFxCXo~Z-}d))xkQeXRd(!4%ZgFgnzph1CQf2A z&1nLCQ%5^fKkZ&+HVDhAB^p_P=*s)bf=@lAWlhMnFxWZ-ni}h}!hM#x(?Md>Rt{74~ z<413{vv_uYo_IgJ(q2jd^UmF)JYHApX6d-y{r>P3FZ5+@8M;7~C1@oG|Wa`}4&2KHo4uL5ksz@RpPASrF4tTcu~ z7`MI&4o*{3rlWQ%v7p700xud(5cp32 zK(%?&UQcU7P`Dxlt7+~?l=nK5I(1!0kpcW(J`5&o5QEA~;?e6$7uYV*$#H9aO|s2f z)@c!xK)P9UfXOcB_aPJN#$hq+D8=u)#jPPZ9`S<92rV4LYbK-#vySt!ASuoCc>tY{ za?rQIM^_-d^>kA`eU>Oq0(+(EK9wmk`zJhHC%JEoS|W=dz_#FVlSiy2U9h|&?%3qL zT4H<r_kT-{Jk^V-z#yWrXN3t^nYU6JnaHWbh)8R%COf(#0tNJyVG=6ig{Wt&yO*^ zx8yAKfLOVsLFK4)SP$kG#ImivIMv=vy+U}m#;{k^>lSKrkS9Lx&SH!7QS`$`hp7-W zxHSls7oqEC>KqT0IP-TO(65eg&*bdZChEt?2)kPi7Ly6Qa=;CSC@-&}=a)&%3Xm5o z20c7rh_IU7@a$li&AtQ|m6Y{_;6cgDC$&ad2Xb^2=fNn|_DkAk;Ai7zH@jHhkm*TL zmH4W7uaxLYMBn3p>d}DM4Zo7ugt2w*RTQMwRSejdQ7)m{F0^a`Q04 z!kRp`buMI~!YGKQ4jO@1LiX629EWD)L7FVyCCxlh|KVY(n1FjW%~BpVd)V;Wi9yHH z<7d=Dg1LvT40UyQc@m_Sx?qo$|Lf zmJ_Nvt@gSvv>Z)0pMN|*#4Q-SM7^mE%$;E6F8z%g>U(NJ!`hTqq~UO|j#VmK0Yv1+q1q+Cf zb9VXTcy3BcJrQG{ZF5u6Kp+c? zu386ctKTYgBXr>RHuSNlUh3b==%b5f*;h++MYbURdR2>wwD}fW!Z)`|!PGQM zDEldgI7V@`jJ59l$l29&Yr4L^2p$pM^G;KY^^@y3kE9&;Ns-2~pC&t+E_%siUu4l< zVpl$=$0*Vkf69|*&GsJAS`%8t8)D&1m^wedy2h*mxj33XAFqYTysMPwX5&mSGvXBH zhf^=Bh@0xQM+_;BL-L758rLWbohR1xi5iSS4TDGPc)T_)+4Lys1{YuH=SJTLJ>m(L z$Az7~ehKxQm&m~?-Fl!e2*NxvGO)-7qEM)6rw3{W>`SnRgwfgXt1lr?PRUq>5*E3b zLoK+BvX#KddnpFpJsx`%HYRz-&My^oxJ%;W@7u-7OcJ4R4zalaK0H{86E$2T@@c3c9S1 zX(g0mnG-p@o1iF&o z_(^&jjly1kRlYsY$eVf%MdHArZ~3j($MoZ>*$)sB54{-jrtECk;5Djj7^g;qaFE$v=cGqQGxS@Iu_A%MO$mG2|R7e zlQ=gDxkPq(3ss7eUe{2@vef2|sQ}FKxgdI2n(W$!a%!(YqtzB_7lE;qM_%Ro!ju6| z?eYefDf6Z9iRuXW=Yp5>w$KivUDBjW%Nf4D+07#iX&GO$Xrk5d_LhJ~=}_kuGsWMh zQwY8Z)y9!vR-qnQJ%NiH9-Suwcv*U3bR*~11)%^#@PNjCzH5(+947}si)aJ_;e zUU($W(~kbSW9ISq8;{c2HpBh+mYO+>3$4a`9fnk7Bw}iHklS%5tEw!4DW12I6)&st zt+=-adGAoHp(il>GQ~EW7GuN=6<_}$Tr}qi`9Os%URCI5VYdoLRb@WbYw8wSK69;I zTTOx2q;EIS53-eiAR$>r)g}!!PijZPW8qugrP4&>IYl%rZX&O{vQ-kvIut(2VW)3bk6Y^ zg4WtnY?dq5$tAO|%I+>SqT?tzWC1Qml{a2h##tLk3nl1i*W{`HWH*A-qpY5&%B{(e zB}tZKl?8Jk@1@aFx(UQmnWWv>M|Ro%34n5cKn+hLvmUd@{KZp1d4h9KA#>j(ETl4lxqh#ElnvdB{BM?iyC_8CBFvis3JlP$PQEfsjXX>NIUC}S~rYTvkj z>N--n+Z_!2{!VL68MK*%Dv&K z)NjB@1TIhhc#57fti*=iVA2Gokuy3E@goR*sVt#|nlFAc-BmHu6krP+a^U79;RaUY zH*I04($kuS$^F(}yuQRO(6hIru?Eo#RjnVq4(P1NIP~EfAWn=+EbB_7v1L-m6x%vm zD;;)p+3Ld8e+sr+_9Z#WEiMZzx>k+Bs_hP{${zt)Y{Od-b18x`Nh#~zN$p>ra>p*r zDxXwO09K7t)(7J7N5J_MWE>t;n4?I$KF<1&;YTMXCF5Bt8-vMj(v2QAcQ<;Rh1wZj z7}>#qU|55mh}C&ViP#2p{&;&+3PiP>V5QZX8+H(tbCTpo{_z^siA0ewcwb)dn!KFj z18HPPVvL@gglJB8G01LTMhk^LUBvdaBnaDdBlU44JtZ9JUK1-AEdKJN;K8+Tam+wI zOGHA#(p(%nTShrYs)b?AN>qD>5Ic+V1Z(ANR2J-6F5ECh5|8s;PharE6yZiKhUxK4 zwE%ChzJO)qqo_8<1}1U7IS+0wi0D2{M@t{u=!jF#h{1<8?T+YaTwzsZ?@@%7cJ?O{wBOnHFWthrPRoAEX++0}C zdLC+$l{oZy)gbO@RDN%x>|;!)LJc9K4noLcw06F1cmhkEy(f_)z?!%6Ta>f&ZIDbo za9A5RQ?+kGCN*wBVA?s>DgXvT6IKkt9$WQn(fvws7Q`7BK-?2x&CRm6-fZ^3hAWeg z?I;FIG<*u9=M6CDcjO*PRIlqC-9=+OuCbb*!t2*Ed>02&5iwAH%CSxQVhm0S?~7kZ zO?eEw6n99n*DJuj{L=%H+ly(}>FMe8!?OsFyeY0O5B25Och_0rbR62Wl{H)a3GVxQ zG)iwTJozhze=})b>IJ@xqkF5;-QA6!e}lz(bd)lJo%sriLz%T4 zkXk}A6nx9f$Y-S}Z(hd8utVL^a!|K%?461g5z8Igy=K)RqbVW&t%4(q*u2Stxx_EL z%5sd+$v9t0Ez6&mkcn&{oZ^6oCw zcXok&wJ#LPR#IBJ^{XGY#!=&*mK`e3WS@aiiBP#Tmy+f-7XdB3+q9 z#; zQ*M1erve(Y?onJiEbqQ3l@<&Y;AN2g54pES#Ce%L(tQ>sns*!SyJ%9`u~`elqyMuzju2|XX@R$P`; zd?9h1fwp$w^?nO+LZP~}rE`7oQj;xNfo2B&+4@xJ=3NTN@zQ<8gBBwzkNEMAh?8db zJ;b-x-5+`LLrFX)@K2ZDjF@l8!zCU_t3GB#po`{LlvXtF!dX|Z&ktr9U;X%Kj&j@$ z-Q(G%^b4BFQuuZzyjFgG%{G^Hds+x*x;w?OnQD1fB(_Z1daHVMsEVl1CKX(b!kS|~ dxWl4GyGk`()Mk+q{__V!RY_B^Lf#_ie*iMZ6qo=2 literal 0 HcmV?d00001 diff --git a/assets/images/menu/digest.png b/assets/images/menu/digest.png index 760c603f678ad0920f3ba11924c61baf10a5c050..b1d2aaf974153ee9c1e708ebeb9d1de75df392ac 100644 GIT binary patch delta 1346 zcmV-I1-<g(YN8Gi-<0047(dh`GQ010qNS#tmY4-xXM#KnFAjP7OTmc0UR7O-tZ($+61@CvrCvbs4A_W#5 zDJ&#hgc7>|8Ou(=2GAPEj@P?*|IFOElfpX}kL^tpMJd9OMt@rEeeOBWJ@=gFT=;7L zvWXGD|7lAP2i3q7a0-xru^}E}M`0LZGM}St0Q?5DG6JXX-@pIk?c2Bi7lz@9J9@ny z&!0bEotc^Wu3oQ?%+%uI;;)x3UHbOIg$spIm`0<~yLt2GP2d+G(Lf-jJXNpP@qM2( zb=g6PgIMF^<9~!`+aX^K+H z660taBuVJ^`&kVnQcBZqx3yA=R;z`S5^F7k!2n|nwOTC! ze4qft0vPjs|7sLP-`~4;?}so9{iA7;QVMG=-EKG9+}zy1c=2NOST2WVtz~s}b^G$= z%YXHg)`bwZTrO{KY-}t%dGh2Z4RoR?S^|o9@813Y^z?MDe-CZs?c293FE4M-&CN~5 zaeN|yX0yqQ7cVw%-MTe7N?G^!_nDuckAR;u9q0p5*0V>8B@+>?HA*Sh(??AyMGyqQ zL1&#*bV3M<#Uj>P1;}h@2tX*MD3{A@ZGUayc^>6***TU{qLe}@h1Qy#ogLSjV`F0o zA>2BE=XtbREo!wIT7Q{MN-6sNzT=adY#IA!&z{li^<1#5je;PcP$-Zj36CE?=D~vp zZhoX`inTVUppPCs%C&BW5kfehIRd3pi8M|5`0*pPT8%i4iR0J}mM{z{l}haH?tk*~ zz&-Z2Uirm zd-tw$?%cWBC`=Fp>Dt=b@7vqk6LB1$_F)^!#lxsoh$@j z4r7LxQO`FE`~kc_3UCjF5tbgp{aws)x&3Ni?LTRM0{o+&HLvDUa@a2CEqi4B`cIb_Lo1C76=D-CY>|xA&jfKT%P#F{3cE znLe{Kg9T8|YtcDYvycb?jVB{9$)o#++yfh5#5X1%b^Y?@ zeLr9Mu5$kOr}p`Y@BS>GR-eA|WMKOd*5e^j4l}qeF&TZ^?AxULe&7FN(T6S1uhU;Y zry?=8@oKC5{Q74%|Jf8JfB%vhpFK%SF6#2^kAejkK3s^BuzjSl;>$GmzouX9gzm^! zI9*Y3j0ikg^xZxAOOHux#T9YqhYL=|oQ$_pD=eE+epl2}h}Gr(ZY@tQ&($II64uX? z+5^vYbbN6&k12Cle6fSgYkH4~)K<6bj0bzdYgWHo^s8So#LVX9vajbPd8X!Bu6cJ! zy0+F_Ca~<~+qy=V*NxF!y$Xvja7C>R3*#_eH;I34NH_N(&o4GlO^*ZZV&yQ~1DVZ_-eT@D8m+B|KJy~?{_Iug) zRW`3b^Xui#iJgB=bjQ=xz1Ocl7yW%H=jvc{u?-|YECIW*vfVF&SO^QT*YNG zjkr(eY1iv677*n+8SA`M)N!Fh=H)E&;8t6XyJtdw+*!9s`mk60<7D|4CpT>ie(4_D zyg5uj-gBnv&GlivzE?LbRQ+D_c*>2FtGB4Edg|xZn_+R8af;N|P93i%*`?WjJJ#Nt z9&QwvwdL;Kz*qY=&8dC19bA{4~{ll zyFw!C8<`)MX5lFAhistory.go(-1); + \ No newline at end of file diff --git a/assets/images/newbb.png b/assets/images/newbb.png index 7fd8e73006e38004d1e5dd2a1f17a0ac52744da2..891a5728e236be78d1709ba94e8f6d13020fd889 100644 GIT binary patch literal 1650 zcmbVNdrT8|96uj8WFXE6iZSd~=QNwN*DIy;q(JFIJ7|Zr8^syuwRe;guGd|UwU9L; z;t<@+Okhrf>!vb?;v)vc!GOSEDhktNieeaJ4^a@~HiW=>yYkxpFfQ38cfZ&7^Z9i002OcX0tMd8!J3~-5(8q|Hsa!_J<073-fwXJ2bHp~sj8L3p0vBo*2>FnJBz<{JSv!~%{GTwM zXzeiM*>OP%?x1pM3wIxxYi7Zmc29TYGvuN{UZV-_QqUYFWyvLR8>3Omc-#peBQQj* zjD|$&XjmZ5G7YfiscEj98bbZ<&r2lEP+L0g-9q=iKEpCsstEL zfFX%erIyZNH8ux>+AR32UxM>HgB3m%izsLuWhmM}Q8}{}keo#^lp~9>g9^PEOeJg> z<#hNiXF69UP7`nAn3|?Ya7tZ-c!GDe>c6s{#$x|RF##8hz*idoDwWwSuKs+}xx(ib zbFG8hxPGCz#t1o$>;iy!&n71sRIGg|dv=G}Y-SIe*j*6&=ZI3N#BrSMIyE{vilXSq z$Ov1W+}zx((P)fDJJiR1dw6VYOr=t>d0z#;K8b@D(^l`adELurzL^jb~iOOm6nz!CMNFLvxn=( zzP>*8W)u5fJnQwcnLuY}C(E)M9+xfWWO-kslp9>P+CDDUwL(kZ9X=67Tss#(=zlK$ z^0A{sjgP~_dne)+|AuJx7A@Rd7JacQu4HoD+k4=hKEzSUFIVI*h=Sbx=eq;@|5zNHEAD%^B+ForYH|Cm?oV`^@`8gDvBda6{dl=y(WTGl-%8xStf^zI|Ie$kjy3Z#OU(4`~59l1}m#+hvUxgSWV=VF)mU(t=+H!7kw5DMDqWZGVa2+nV nFYVp(ym#W*!BqG+DnE?v delta 916 zcmeywv!8u}ND*Eu@!~Yxm z|Nr~({)%DMxKlQ6uuU@`d-v|$dGqE)Mn-mZ zb#-)f%$_~_`0?Y9A3tttYFfB(;mw;jU%h&@YuB!wJ9lo|wymY5rM$fS{{8#^CVGC} zJRu7hVvI@N?k~IqW5#zOL+#8HJh6^qHL*EP&EIo-U3d7N?I+=C1cYWFT;S z=ep*Fhh!9PO>0+JAnokP!uWA*$NTS(f7c7GFOi-wLxZz(`j=1lr~Rw?f7euGR`r3H zWHW`IrfIBMA?k^_vla$+<#VRJVpet&Nk|k-&=fPD{?so%qBA9nby24B)?I3iJ=}+G zm`o_-@k%-OBChpjgx>zRhNK#1ua!piJ*}aQYZzxoS7f*{=EgF~243xaC$#f}WzKaD zxu*r!x9`~-oX_yaEb!e@H5R7muxk7F(Z{k_n5-gtWyNHAi%#vjGVuW4+up{B%qBd4 znU-C9crhYk>bF7}Kfm+mHglaYDw{4Cr!2LetHpB1lF0Iune4th4bI%@KhRQX$)F*+ zzP{}`*NdWaSJD(KdN-fsat%m4C~@Zw(~|c#%NsXn)iuBW&E;Vvl<~dg!d$^{cZE;~ za|Sybr<5Noyq_h#zKTn5v*sjxO})&#E9S3r+|`Y1GvcDQ?bWNECjHgS!T4HRxN+V- z&lY`=54ICM>T0|e%yC@xb8~yJ<*6*b{ZHEe@6)WW-+j8cFF!ud#Ovd`7Fl3)sg}4# zl%yn`=BH$)RpQpL j=JkdzKn;>08-nxGO3D+9CK^a^F)(<#`njxgN@xNAPOhn5 diff --git a/assets/index.html b/assets/index.html index 2c5cdd3f..990cbd60 100644 --- a/assets/index.html +++ b/assets/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/assets/js/index.html b/assets/js/index.html index 2c5cdd3f..990cbd60 100644 --- a/assets/js/index.html +++ b/assets/js/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/blocks/index.html b/blocks/index.html index 2c5cdd3f..990cbd60 100644 --- a/blocks/index.html +++ b/blocks/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/blocks/list_topic.php b/blocks/list_topic.php index 6b6e1121..240b57ad 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -1,9 +1,9 @@ , irmtfan * @author The Persian Xoops Support Site * @since 4.3 @@ -17,16 +17,17 @@ } define('LIST_TOPIC_DEFINED', true); -include_once __DIR__ . '/../include/functions.ini.php'; -require_once __DIR__ . '/../class/topic.renderer.php'; -include_once __DIR__ . '/../footer.php'; // to include js/style files like validate function +//include_once dirname(__DIR__) . '/include/functions.ini.php'; +require_once dirname(__DIR__) . '/class/topic.renderer.php'; +include_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function xoops_loadLanguage('main', 'newbb'); -mod_loadFunctions('time', 'newbb'); -mod_loadFunctions('session', 'newbb'); -mod_loadFunctions('render', 'newbb'); -mod_loadFunctions('user', 'newbb'); +include_once __DIR__ . '/../include/functions.config.php'; +include_once __DIR__ . '/../include/functions.time.php'; +include_once __DIR__ . '/../include/functions.session.php'; +include_once __DIR__ . '/../include/functions.render.php'; +include_once __DIR__ . '/../include/functions.user.php'; // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) @@ -115,19 +116,19 @@ function newbb_list_topic_edit($options) // topic_poster element $topicPosterRadioEle = new XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); - $topicPosterRadioEle->addOption(-1, _MD_TOTALUSER); - $topicPosterRadioEle->addOption((-1 !== $options[1]) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users + $topicPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); + $topicPosterRadioEle->addOption(($options[1] !== -1) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" $topicPosterSelectEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; $topicPosterEle = new XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); // lastposter element - $lastPosterRadioEle = new XoopsFormRadio(_MD_POSTER, 'options[2]', $options[2]); - $lastPosterRadioEle->addOption(-1, _MD_TOTALUSER); - $lastPosterRadioEle->addOption((-1 !== $options[2]) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 + $lastPosterRadioEle = new XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); + $lastPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); + $lastPosterRadioEle->addOption(($options[2] !== -1) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" - $lastPosterSelectEle = new XoopsFormSelectUser(_MD_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; - $lastPosterEle = new XoopsFormLabel(_MD_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); + $lastPosterSelectEle = new XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; + $lastPosterEle = new XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); // type element $types = $topicRenderer->getTypes(); // get all available types in all forums @@ -140,7 +141,7 @@ function newbb_list_topic_edit($options) } // sort element - $sortEle = new XoopsFormSelect(_MD_SORTBY, 'options[4]', $options[4]); + $sortEle = new XoopsFormSelect(_MD_NEWBB_SORTBY, 'options[4]', $options[4]); $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); $sorts = $topicRenderer->getSort('', 'title'); $sortEle->addOptionArray($sorts); @@ -177,12 +178,13 @@ function newbb_list_topic_edit($options) // forum element $optionsForum = explode(',', $options[12]); - mod_loadFunctions('forum', 'newbb'); + include_once __DIR__ . '/../include/functions.forum.php'; + /** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums $accessForums = $forumHandler->getIdsByValues(array_map('intval', $optionsForum)); - $isAll = (0 === count($optionsForum) || empty($optionsForum[0])); + $isAll = (count($optionsForum) === 0 || empty($optionsForum[0])); $forumSel = ""; $form .= "'; + $selection['forum'] .= ''; $selection['forum'] .= newbb_forumSelectBox($forum_selected); $selection['forum'] .= ''; - // END irmtfan add forum selection box - $sort_selected = $this->vars['sort']; // irmtfan no need to check + $sort_selected = $this->vars['sort']; $sorts = $this->getSort('', 'title'); $selection['sort'] = "'; $selection['order'] = "'; $since = isset($this->vars['since']) ? $this->vars['since'] : $this->config['since_default']; @@ -691,7 +675,7 @@ public function buildHeaders(Smarty $xoopsTpl) { $args = []; foreach ($this->vars as $var => $val) { - if ('sort' === $var || 'order' === $var) { + if ($var === 'sort' || $var === 'order') { continue; } $args[] = "{$var}={$val}"; @@ -716,7 +700,7 @@ public function buildFilters(Smarty $xoopsTpl) { $args = []; foreach ($this->vars as $var => $val) { - if ('status' === $var) { + if ($var === 'status') { continue; } $args[] = "{$var}={$val}"; @@ -726,7 +710,7 @@ public function buildFilters(Smarty $xoopsTpl) $status = []; foreach ($links as $link => $title) { - $_args = ["status={$link}"]; + $_args = ["status={$link}"]; $status[$link]['title'] = $title; $status[$link]['link'] = $this->page . '?' . implode('&', array_merge($args, $_args)); } @@ -742,7 +726,8 @@ public function getTypes($type_id = null) static $types; if (!isset($types)) { $typeHandler = xoops_getModuleHandler('type', 'newbb'); - $types = $typeHandler->getByForum(explode('|', @$this->vars['forum'])); + /** @var \NewbbTypeHandler $typeHandler */ + $types = $typeHandler->getByForum(explode('|', @$this->vars['forum'])); } if (empty($type_id)) { @@ -764,14 +749,14 @@ public function buildTypes(Smarty $xoopsTpl) $args = []; foreach ($this->vars as $var => $val) { - if ('type' === $var) { + if ($var === 'type') { continue; } $args[] = "{$var}={$val}"; } foreach ($types as $id => $type) { - $_args = ["type={$id}"]; + $_args = ["type={$id}"]; $status[$id]['title'] = $type['type_name']; $status[$id]['link'] = $this->page . '?' . implode('&', array_merge($args, $_args)); } @@ -810,7 +795,7 @@ public function buildPagenav(Smarty $xoopsTpl) if ($count_topic > $this->config['topics_per_page']) { $args = []; foreach ($this->vars as $var => $val) { - if ('start' === $var) { + if ($var === 'start') { continue; } $args[] = "{$var}={$val}"; @@ -820,9 +805,9 @@ public function buildPagenav(Smarty $xoopsTpl) if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { $nav->url = formatURL($_SERVER['SERVER_NAME']) . ' /' . $nav->url; } - if ('select' === $this->config['pagenav_display']) { + if ($this->config['pagenav_display'] === 'select') { $navi = $nav->renderSelect(); - } elseif ('image' === $this->config['pagenav_display']) { + } elseif ($this->config['pagenav_display'] === 'image') { $navi = $nav->renderImageNav(4); } else { $navi = $nav->renderNav(4); @@ -850,22 +835,12 @@ public function getCount() // topic fields $selects[] = 'COUNT(*)'; - $froms[] = $this->handler->db->prefix('bb_topics') . ' AS t '; - $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; + $froms[] = $this->handler->db->prefix('newbb_topics') . ' AS t '; + $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; $wheres[] = '1 = 1'; - $sql = ' SELECT ' - . implode(', ', $selects) - . ' FROM ' - . implode(', ', $froms) - . ' ' - . implode(' ', $joins) - . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') - . // irmtfan bug fix: Undefined index: join when post_excerpt = 0 - ' WHERE ' - . implode(' AND ', $wheres) - . ' AND ' - . @implode(' AND ', @$this->query['where']); + $sql = ' SELECT ' . implode(', ', $selects) . ' FROM ' . implode(', ', $froms) . ' ' . implode(' ', $joins) . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') . // irmtfan bug fix: Undefined index: join when post_excerpt = 0 + ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']); if (!$result = $this->handler->db->query($sql)) { return 0; @@ -906,30 +881,18 @@ public function renderTopics(Smarty $xoopsTpl = null) // post fields $selects[] = 'p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; - $froms[] = $this->handler->db->prefix('bb_topics') . ' AS t '; - $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; + $froms[] = $this->handler->db->prefix('newbb_topics') . ' AS t '; + $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; $wheres[] = '1 = 1'; if (!empty($this->config['post_excerpt'])) { $selects[] = 'p.post_karma, p.require_reply, pt.post_text'; - $this->query['join'][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; + $this->query['join'][] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; } //if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; // irmtfan commented no need - $sql = ' SELECT ' - . implode(', ', $selects) - . ' FROM ' - . implode(', ', $froms) - . ' ' - . implode(' ', $joins) - . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') - . // irmtfan bug fix: Undefined index join when post_excerpt = 0 - ' WHERE ' - . implode(' AND ', $wheres) - . ' AND ' - . @implode(' AND ', @$this->query['where']) - . ' ORDER BY ' - . implode(', ', $this->query['sort']); + $sql = ' SELECT ' . implode(', ', $selects) . ' FROM ' . implode(', ', $froms) . ' ' . implode(' ', $joins) . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') . // irmtfan bug fix: Undefined index join when post_excerpt = 0 + ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']) . ' ORDER BY ' . implode(', ', $this->query['sort']); if (!$result = $this->handler->db->query($sql, $this->config['topics_per_page'], @$this->vars['start'])) { if (is_object($xoopsTpl)) { @@ -941,11 +904,11 @@ public function renderTopics(Smarty $xoopsTpl = null) return $ret; } - mod_loadFunctions('render', 'newbb'); - mod_loadFunctions('session', 'newbb'); - mod_loadFunctions('time', 'newbb'); - mod_loadFunctions('read', 'newbb'); - mod_loadFunctions('topic', 'newbb'); + include_once __DIR__ . '/../include/functions.render.php'; + include_once __DIR__ . '/../include/functions.session.php'; + include_once __DIR__ . '/../include/functions.time.php'; + include_once __DIR__ . '/../include/functions.read.php'; + include_once __DIR__ . '/../include/functions.topic.php'; $sticky = 0; $topics = []; @@ -955,7 +918,7 @@ public function renderTopics(Smarty $xoopsTpl = null) $forums = []; $anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); - while (false !== ($myrow = $this->handler->db->fetchArray($result))) { + while ($myrow = $this->handler->db->fetchArray($result)) { if ($myrow['topic_sticky']) { ++$sticky; } @@ -977,7 +940,7 @@ public function renderTopics(Smarty $xoopsTpl = null) if ($rating < 1) { $rating_img = newbbDisplayImage('blank'); } else { - $rating_img = newbbDisplayImage('rate' . $rating, constant('_MD_RATE' . $rating)); + $rating_img = newbbDisplayImage('rate' . $rating, constant('_MD_NEWBB_RATE' . $rating)); } // ------------------------------------------------------ @@ -995,23 +958,14 @@ public function renderTopics(Smarty $xoopsTpl = null) $append = true; } } else { - $topic_page_jump .= '[' - . $i - . ']'; + $topic_page_jump .= '[' . $i . ']'; // irmtfan remove here and move //$topic_page_jump_icon = "" . newbbDisplayImage('document',_MD_NEWBB_GOTOLASTPOST) . ''; } } } // irmtfan - move here for both topics with and without pages - change topic_id to post_id - $topic_page_jump_icon = "" . newbbDisplayImage('lastposticon', - _MD_NEWBB_GOTOLASTPOST) . ''; + $topic_page_jump_icon = "" . newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST) . ''; // ------------------------------------------------------ // => topic array @@ -1040,11 +994,14 @@ public function renderTopics(Smarty $xoopsTpl = null) 'topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], - 'topic_title_excerpt' => $topic_title_excerpt, //irmtfan use topic_title_excerpt + 'topic_title_excerpt' => $topic_title_excerpt, + //irmtfan use topic_title_excerpt //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], // . '&forum=' . $myrow['forum_id'], // irmtfan comment - 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], // irmtfan remove hardcode link + 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], + // irmtfan remove hardcode link 'rating_img' => $rating_img, - 'votes' => $myrow['votes'], //irmtfan added + 'votes' => $myrow['votes'], + //irmtfan added 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], @@ -1052,17 +1009,23 @@ public function renderTopics(Smarty $xoopsTpl = null) 'topic_poster_name' => !empty($myrow['poster_name']) ? $myts->htmlSpecialChars($myrow['poster_name']) : $anonymous, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), - 'topic_last_post_id' => $myrow['topic_last_post_id'], //irmtfan added + 'topic_last_post_id' => $myrow['topic_last_post_id'], + //irmtfan added 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster_uid' => $myrow['uid'], 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars($myrow['last_poster_name']) : $anonymous, 'topic_forum' => $myrow['forum_id'], 'topic_excerpt' => $topic_excerpt, - 'sticky' => $myrow['topic_sticky'] ? newbbDisplayImage('topic_sticky', _MD_TOPICSTICKY) : '', // irmtfan bug fixed - 'lock' => $myrow['topic_status'] ? newbbDisplayImage('topic_locked', _MD_TOPICLOCK) : '', //irmtfan added - 'digest' => $myrow['topic_digest'] ? newbbDisplayImage('topic_digest', _MD_TOPICDIGEST) : '', //irmtfan added - 'poll' => $myrow['topic_haspoll'] ? newbbDisplayImage('poll', _MD_TOPICHASPOLL) : '', //irmtfan added - 'approve' => $myrow['approved'], //irmtfan added + 'sticky' => $myrow['topic_sticky'] ? newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY) : '', + // irmtfan bug fixed + 'lock' => $myrow['topic_status'] ? newbbDisplayImage('topic_locked', _MD_NEWBB_TOPICLOCK) : '', + //irmtfan added + 'digest' => $myrow['topic_digest'] ? newbbDisplayImage('topic_digest', _MD_NEWBB_TOPICDIGEST) : '', + //irmtfan added + 'poll' => $myrow['topic_haspoll'] ? newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL) : '', + //irmtfan added + 'approve' => $myrow['approved'], + //irmtfan added ]; /* users */ @@ -1070,7 +1033,7 @@ public function renderTopics(Smarty $xoopsTpl = null) $posters[$myrow['uid']] = 1; // reads if (!empty($this->config['read_mode'])) { - $reads[$myrow['topic_id']] = (1 == $this->config['read_mode']) ? $myrow['last_post_time'] : $myrow['topic_last_post_id']; + $reads[$myrow['topic_id']] = ($this->config['read_mode'] == 1) ? $myrow['last_post_time'] : $myrow['topic_last_post_id']; } // types if (!empty($myrow['type_id'])) { @@ -1089,6 +1052,7 @@ public function renderTopics(Smarty $xoopsTpl = null) } */ $type_list = $this->getTypes(); + /** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (count($forums) > 0) { @@ -1099,13 +1063,7 @@ public function renderTopics(Smarty $xoopsTpl = null) foreach (array_keys($topics) as $id) { $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable - $topics[$id]['topic_forum_link'] = '' - . $forum_list[$topics[$id]['topic_forum']]['forum_name'] - . ''; + $topics[$id]['topic_forum_link'] = '' . $forum_list[$topics[$id]['topic_forum']]['forum_name'] . ''; //irmtfan use topic_title_excerpt -- add else if (!empty($topics[$id]['type_id']) && isset($type_list[$topics[$id]['type_id']])) { @@ -1122,17 +1080,17 @@ public function renderTopics(Smarty $xoopsTpl = null) // START irmtfan - add topic_folder_text for alt //if ($topics[$id]["lock"] === 1) { // $topic_folder = 'topic_locked'; - // $topic_folder_text = _MD_TOPICLOCKED; + // $topic_folder_text = _MD_NEWBB_TOPICLOCKED; //} else { //if ($topic_digest) { // $topic_folder = 'topic_digest'; - // $topic_folder_text = _MD_TOPICDIGEST; + // $topic_folder_text = _MD_NEWBB_TOPICDIGEST; if ($topics[$id]['topic_replies'] >= $forum_list[$topics[$id]['topic_forum']]['hot_threshold']) { $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot'; - $topic_folder_text = empty($topic_isRead[$id]) ? _MD_MORETHAN : _MD_MORETHAN2; + $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWBB_MORETHAN : _MD_NEWBB_MORETHAN2; } else { $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic'; - $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWPOSTS : _MD_NONEWPOSTS; + $topic_folder_text = empty($topic_isRead[$id]) ? _MD_NEWBB_NEWPOSTS : _MD_NEWBB_NONEWPOSTS; } //} // END irmtfan remove hardcodes from topic_folder smarty @@ -1143,10 +1101,10 @@ public function renderTopics(Smarty $xoopsTpl = null) } if (count($topics) > 0) { - $sql = ' SELECT DISTINCT topic_id FROM ' . $this->handler->db->prefix('bb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')'; + $sql = ' SELECT DISTINCT topic_id FROM ' . $this->handler->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')'; if ($result = $this->handler->db->query($sql)) { while (list($topic_id) = $this->handler->db->fetchRow($result)) { - $topics[$topic_id]['attachment'] = ' ' . newbbDisplayImage('attachment', _MD_TOPICSHASATT); + $topics[$topic_id]['attachment'] = ' ' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); } } } diff --git a/class/tree.php b/class/tree.php index 2d11ca4b..babad5a2 100644 --- a/class/tree.php +++ b/class/tree.php @@ -82,7 +82,7 @@ protected function _makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', * @param string $prefix String to indent deeper levels * @param integer $key ID of the object to display as the root of select options * @param null $tags - * @return array HTML select box + * @return array|string HTML select box * @internal param string $name Name of the select box * @internal param string $fieldName Name of the member variable from the * node objects that should be used as the title for the options. @@ -139,12 +139,12 @@ public function makeSelBox( * @param string $key top key of the tree * @param array $ret the tree * @param integer $depth level of subcategories - * @return void + * @return array * @internal param array $tags fields to be used */ public function getAllChild_object($key, &$ret, $depth = 0) { - if (0 == --$depth) { + if (--$depth == 0) { return; } @@ -184,11 +184,11 @@ public function &makeObjectTree($key = 0, $depth = 0) * @param array $ret the tree * @param array $tags fields to be used * @param integer $depth level of subcategories - * @return void - */ + * @return array + **/ public function getAllChild_array($key, &$ret, array $tags = [], $depth = 0) { - if (0 == --$depth) { + if (--$depth == 0) { return; } diff --git a/class/type.php b/class/type.php index dfa4c7a0..a1c33287 100644 --- a/class/type.php +++ b/class/type.php @@ -1,9 +1,9 @@ * @since 4.00 * @package module::newbb @@ -17,8 +17,6 @@ * @author D.J. (phppp) * @copyright copyright © 2006 XoopsForge.com * @package module::newbb - * - * {@link ArtObject} **/ class NewbbType extends XoopsObject { @@ -41,9 +39,6 @@ public function __construct() * * @author D.J. (phppp) * @copyright copyright © 2006 XOOPS Project - * - * {@link ArtObjectHandler} - * */ class NewbbTypeHandler extends XoopsPersistableObjectHandler { @@ -52,7 +47,7 @@ class NewbbTypeHandler extends XoopsPersistableObjectHandler */ public function __construct(XoopsDatabase $db) { - parent::__construct($db, 'bb_type', 'NewbbType', 'type_id', 'type_name'); + parent::__construct($db, 'newbb_type', 'NewbbType', 'type_id', 'type_name'); } /** @@ -67,21 +62,14 @@ public function getByForum($forums = null) $forums = (is_array($forums) ? array_filter(array_map('intval', array_map('trim', $forums))) : (empty($forums) ? 0 : [(int)$forums])); - $sql = ' SELECT o.type_id, o.type_name, o.type_color, l.type_order' - . ' FROM ' - . $this->db->prefix('bb_type_forum') - . ' AS l ' - . " LEFT JOIN {$this->table} AS o ON o.{$this->keyName} = l.{$this->keyName} " - . ' WHERE ' - . ' l.forum_id ' - . (empty($forums) ? 'IS NOT NULL' : 'IN (' . implode(', ', $forums) . ')') - . ' ORDER BY l.type_order ASC'; - if (false === ($result = $this->db->query($sql))) { + $sql = ' SELECT o.type_id, o.type_name, o.type_color, l.type_order' . ' FROM ' . $this->db->prefix('newbb_type_forum') . ' AS l ' . " LEFT JOIN {$this->table} AS o ON o.{$this->keyName} = l.{$this->keyName} " . ' WHERE ' . ' l.forum_id ' + . (empty($forums) ? 'IS NOT NULL' : 'IN (' . implode(', ', $forums) . ')') . ' ORDER BY l.type_order ASC'; + if (($result = $this->db->query($sql)) === false) { //xoops_error($this->db->error()); return $ret; } - while (false !== ($myrow = $this->db->fetchArray($result))) { + while ($myrow = $this->db->fetchArray($result)) { $ret[$myrow[$this->keyName]] = [ 'type_id' => $myrow[$this->keyName], 'type_order' => $myrow['type_order'], @@ -130,17 +118,9 @@ public function updateByForum($forum_id, $types) $types_update = array_filter($types_update); if (!empty($types_valid)) { - $sql = 'DELETE FROM ' - . $this->db->prefix('bb_type_forum') - . ' WHERE ' - . ' forum_id = ' - . $forum_id - . ' AND ' - . // irmtfan bug fix: delete other forums types when update the type for a specific forum - " {$this->keyName} NOT IN (" - . implode(', ', $types_valid) - . ')'; - if (false === ($result = $this->db->queryF($sql))) { + $sql = 'DELETE FROM ' . $this->db->prefix('newbb_type_forum') . ' WHERE ' . ' forum_id = ' . $forum_id . ' AND ' . // irmtfan bug fix: delete other forums types when update the type for a specific forum + " {$this->keyName} NOT IN (" . implode(', ', $types_valid) . ')'; + if (($result = $this->db->queryF($sql)) === false) { } } @@ -151,8 +131,8 @@ public function updateByForum($forum_id, $types) if ($types_existing[$key]['type_order'] == $order) { continue; } - $sql = 'UPDATE ' . $this->db->prefix('bb_type_forum') . " SET type_order = {$order}" . " WHERE {$this->keyName} = {$key} AND forum_id = {$forum_id}"; - if (false === ($result = $this->db->queryF($sql))) { + $sql = 'UPDATE ' . $this->db->prefix('newbb_type_forum') . " SET type_order = {$order}" . " WHERE {$this->keyName} = {$key} AND forum_id = {$forum_id}"; + if (($result = $this->db->queryF($sql)) === false) { } } } @@ -164,8 +144,8 @@ public function updateByForum($forum_id, $types) //if (!in_array($key, $types_add)) continue; $type_query[] = "({$key}, {$forum_id}, {$order})"; } - $sql = 'INSERT INTO ' . $this->db->prefix('bb_type_forum') . ' (type_id, forum_id, type_order) ' . ' VALUES ' . implode(', ', $type_query); - if (false === ($result = $this->db->queryF($sql))) { + $sql = 'INSERT INTO ' . $this->db->prefix('newbb_type_forum') . ' (type_id, forum_id, type_order) ' . ' VALUES ' . implode(', ', $type_query); + if (($result = $this->db->queryF($sql)) === false) { //xoops_error($this->db->error()); } } @@ -190,16 +170,16 @@ public function delete(XoopsObject $object, $force = true) /* * Remove forum-type links */ - $sql = 'DELETE' . ' FROM ' . $this->db->prefix('bb_type_forum') . ' WHERE ' . $this->keyName . ' = ' . $object->getVar($this->keyName); - if (false === ($result = $this->db->{$queryFunc}($sql))) { + $sql = 'DELETE' . ' FROM ' . $this->db->prefix('newbb_type_forum') . ' WHERE ' . $this->keyName . ' = ' . $object->getVar($this->keyName); + if (($result = $this->db->{$queryFunc}($sql)) === false) { // xoops_error($this->db->error()); } /* * Reset topic type linked to this type */ - $sql = 'UPATE' . ' ' . $this->db->prefix('bb_topics') . ' SET ' . $this->keyName . '=0' . ' WHERE ' . $this->keyName . ' = ' . $object->getVar($this->keyName); - if (false === ($result = $this->db->{$queryFunc}($sql))) { + $sql = 'UPATE' . ' ' . $this->db->prefix('newbb_topics') . ' SET ' . $this->keyName . '=0' . ' WHERE ' . $this->keyName . ' = ' . $object->getVar($this->keyName); + if (($result = $this->db->{$queryFunc}($sql)) === false) { //xoops_error($this->db->error()); } @@ -217,41 +197,12 @@ public function delete(XoopsObject $object, $force = true) public function cleanOrphan($table_link = '', $field_link = '', $field_object = '') //cleanOrphan() { /* clear forum-type links */ - if ($this->mysql_major_version() >= 4) { - $sql = 'DELETE FROM ' . $this->db->prefix('bb_type_forum') . " WHERE ({$this->keyName} NOT IN ( SELECT DISTINCT {$this->keyName} FROM {$this->table}) )"; - } else { - $sql = 'DELETE ' - . $this->db->prefix('bb_type_forum') - . ' FROM ' - . $this->db->prefix('bb_type_forum') - . " LEFT JOIN {$this->table} AS aa ON " - . $this->db->prefix('bb_type_forum') - . ".{$this->keyName} = aa.{$this->keyName} " - . " WHERE (aa.{$this->keyName} IS NULL)"; - } - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); - } + $sql = 'DELETE FROM ' . $this->db->prefix('newbb_type_forum') . " WHERE ({$this->keyName} NOT IN ( SELECT DISTINCT {$this->keyName} FROM {$this->table}) )"; + $this->db->queryF($sql); /* reconcile topic-type link */ - if ($this->mysql_major_version() >= 4) { - $sql = 'UPATE ' . $this->db->prefix('bb_topics') . " SET {$this->keyName} = 0" . " WHERE ({$this->keyName} NOT IN ( SELECT DISTINCT {$this->keyName} FROM {$this->table}) )"; - } else { - $sql = 'UPATE ' - . $this->db->prefix('bb_topics') - . ' FROM ' - . $this->db->prefix('bb_type_forum') - . ' SET ' - . $this->db->prefix('bb_topics') - . ".{$this->keyName} = 0" - . " LEFT JOIN {$this->table} AS aa ON " - . $this->db->prefix('bb_topics') - . ".{$this->keyName} = aa.{$this->keyName} " - . " WHERE (aa.{$this->keyName} IS NULL)"; - } - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); - } + $sql = 'UPATE ' . $this->db->prefix('newbb_topics') . " SET {$this->keyName} = 0" . " WHERE ({$this->keyName} NOT IN ( SELECT DISTINCT {$this->keyName} FROM {$this->table}) )"; + $this->db->queryF($sql); return true; } diff --git a/class/uploader.php b/class/uploader.php index 4c6bf57b..c2e144e5 100644 --- a/class/uploader.php +++ b/class/uploader.php @@ -3,7 +3,7 @@ * NewBB, XOOPS forum module * * @copyright XOOPS Project (http://xoops.org) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @author Taiwen Jiang (phppp or D.J.) * @since 4.00 * @package module::newbb @@ -35,7 +35,7 @@ public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, // $this->XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); if (!is_array($allowedMimeTypes)) { - if (empty($allowedMimeTypes) || '*' === $allowedMimeTypes) { + if (empty($allowedMimeTypes) || $allowedMimeTypes === '*') { $allowedMimeTypes = []; } else { $allowedMimeTypes = array_filter(array_map('trim', explode('|', strtolower($allowedMimeTypes)))); diff --git a/class/user.php b/class/user.php index 8792ac40..1eddb29f 100644 --- a/class/user.php +++ b/class/user.php @@ -1,9 +1,9 @@ * @since 4.00 * @package module::newbb @@ -123,40 +123,43 @@ public function getUserbar() if (is_object($GLOBALS['xoopsUser'])) { $userbar['pm'] = [ 'link' => "javascript:void openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $user->getVar('uid') . "', 'pmlite', 450, 380);", - 'name' => _MD_PM + 'name' => _MD_NEWBB_PM ]; } if ($user->getVar('user_viewemail') || $isadmin) { $userbar['email'] = [ 'link' => "javascript:void window.open('mailto:" . $user->getVar('email') . "', 'new');", - 'name' => _MD_EMAIL + 'name' => _MD_NEWBB_EMAIL ]; } if ($url = $user->getVar('url')) { - $userbar['url'] = ['link' => "javascript:void window.open('" . $url . "', 'new');", 'name' => _MD_WWW]; + $userbar['url'] = [ + 'link' => "javascript:void window.open('" . $url . "', 'new');", + 'name' => _MD_NEWBB_WWW + ]; } if ($icq = $user->getVar('user_icq')) { $userbar['icq'] = [ 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $icq . "', 'new');", - 'name' => _MD_ICQ + 'name' => _MD_NEWBB_ICQ ]; } if ($aim = $user->getVar('user_aim')) { $userbar['aim'] = [ 'link' => "javascript:void window.open('aim:goim?screenname=" . $aim . '&message=Hi+' . $aim . '+Are+you+there?' . "', 'new');", - 'name' => _MD_AIM + 'name' => _MD_NEWBB_AIM ]; } if ($yim = $user->getVar('user_yim')) { $userbar['yim'] = [ 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $yim . '&.src=pg' . "', 'new');", - 'name' => _MD_YIM + 'name' => _MD_NEWBB_YIM ]; } if ($msn = $user->getVar('user_msnm')) { $userbar['msnm'] = [ 'link' => "javascript:void window.open('http://members.msn.com?mem=" . $msn . "', 'new');", - 'name' => _MD_MSNM + 'name' => _MD_NEWBB_MSNM ]; } @@ -172,7 +175,7 @@ public function getLevel() $level = newbb_calculateLevel($this->user->getVar('posts'), $this->user->getVar('user_regdate')); $info = ''; - if (2 == $GLOBALS['xoopsModuleConfig']['user_level']) { + if ($GLOBALS['xoopsModuleConfig']['user_level'] == 2) { static $rpg_images; if (!isset($rpg_images)) { $iconHandler = newbbGetIconHandler(); @@ -183,28 +186,23 @@ public function getLevel() } } // irmtfan hardcore removed align="left" - $table = "
    " . _AM_NEWBB_VOTE_DATE . "" . _AM_NEWBB_ACTION . "
    " . _AM_NEWBB_VOTE_NOVOTES . '
    "; - $info = _MD_LEVEL . ' ' . $level['level'] . '
    ' . _MD_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '
    ' . sprintf($table, $rpg_images['orange'], $level['hp_width']); - $info .= _MD_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '
    ' . sprintf($table, $rpg_images['green'], $level['mp_width']); - $info .= _MD_EXP . ' ' . $level['exp'] . '
    ' . sprintf($table, $rpg_images['blue'], $level['exp_width']); + $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '
    ' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '
    ' . sprintf($table, $rpg_images['orange'], $level['hp_width']); + $info .= _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '
    ' . sprintf($table, $rpg_images['green'], $level['mp_width']); + $info .= _MD_NEWBB_EXP . ' ' . $level['exp'] . '
    ' . sprintf($table, $rpg_images['blue'], $level['exp_width']); } else { - $info = _MD_LEVEL . ' ' . $level['level'] . '; ' . _MD_EXP . ' ' . $level['exp'] . '
    '; - $info .= _MD_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '
    '; - $info .= _MD_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max']; + $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '; ' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '
    '; + $info .= _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '
    '; + $info .= _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max']; } return $info; } /** - * @param $user + * @param \XoopsUser $user * @return mixed */ public function getInfo(&$user) @@ -241,15 +239,16 @@ public function getInfo(&$user) // START hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? //checks for user's groups $userinfo['groups'] = []; - $memberHandler = xoops_getHandler('member'); - $usergroups = $memberHandler->getGroupsByUser($userinfo['uid'], true); + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + $usergroups = $memberHandler->getGroupsByUser($userinfo['uid'], true); foreach ($usergroups as $group) { $userinfo['groups'][] = $group->getVar('name'); } // END hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? $userinfo['from'] = $user->getVar('user_from'); - mod_loadFunctions('time', 'newbb'); + include_once __DIR__ . '/../include/functions.time.php'; $userinfo['regdate'] = newbb_formatTimestamp($user->getVar('user_regdate'), 'reg'); $userinfo['last_login'] = newbb_formatTimestamp($user->getVar('last_login')); // irmtfan add last_login @@ -309,10 +308,11 @@ public function loadUserOnline() if (empty($this->users) || !$this->enableOnline) { return; } - mod_loadFunctions('render', 'newbb'); - $image_online = newbbDisplayImage('online', _MD_ONLINE); - $image_offline = newbbDisplayImage('offline', _MD_OFFLINE); + include_once __DIR__ . '/../include/functions.render.php'; + $image_online = newbbDisplayImage('online', _MD_NEWBB_ONLINE); + $image_offline = newbbDisplayImage('offline', _MD_NEWBB_OFFLINE); + /** @var \NewbbOnlineHandler $onlineHandler */ $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlines = $onlineHandler->checkStatus(array_keys($this->users)); @@ -333,9 +333,9 @@ public function loadUserDigest() return; } - $sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('bb_user_stats') . ' WHERE uid IN( ' . implode(', ', array_keys($this->users)) . ')'; + $sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . ' WHERE uid IN( ' . implode(', ', array_keys($this->users)) . ')'; $result = $GLOBALS['xoopsDB']->query($sql); - while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { + while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) { $this->userlist[$myrow['uid']]['digests'] = (int)$myrow['user_digests']; } } diff --git a/class/userstats.php b/class/userstats.php index eff26f30..07f7fc3d 100644 --- a/class/userstats.php +++ b/class/userstats.php @@ -1,9 +1,9 @@ * @since 4.00 * @package module::newbb @@ -12,19 +12,18 @@ // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); -newbb_load_object(); /** * Class NewbbUserstats */ -class NewbbUserstats extends XoopsObject //ArtObject +class NewbbUserstats extends XoopsObject { /** * */ public function __construct() { - parent::__construct('bb_user_stats'); + parent::__construct(); $this->initVar('uid', XOBJ_DTYPE_INT); $this->initVar('user_topics', XOBJ_DTYPE_INT); $this->initVar('user_digests', XOBJ_DTYPE_INT); @@ -37,14 +36,14 @@ public function __construct() * user stats * */ -class NewbbUserstatsHandler extends XoopsPersistableObjectHandler //ArtObjectHandler +class NewbbUserstatsHandler extends XoopsPersistableObjectHandler { /** - * @param XoopsDatabase $db + * @param XoopsDatabase|null $db */ public function __construct(XoopsDatabase $db) { - parent::__construct($db, 'bb_user_stats', 'NewbbUserstats', 'uid', ''); + parent::__construct($db, 'newbb_user_stats', 'NewbbUserstats', 'uid', ''); } /** @@ -84,7 +83,7 @@ public function get($id = null, $fields = null) //get($id) if (!$result = $this->db->query($sql)) { return $object; } - while (false !== ($row = $this->db->fetchArray($result))) { + while ($row = $this->db->fetchArray($result)) { $object->assignVars($row); } */ @@ -110,7 +109,7 @@ public function getStats($id) return $row; } /* - function insert(&$object, $force = true) + function insert(XoopsObject $object, $force = true) { if (!$object->isDirty()) { $object->setErrors("not isDirty"); diff --git a/class/utility.php b/class/utility.php new file mode 100644 index 00000000..9dd4b5b5 --- /dev/null +++ b/class/utility.php @@ -0,0 +1,81 @@ +queryF("SHOW TABLES LIKE '$tablename'"); + + return ($xoopsDB->getRowsNum($result) > 0); + } + + /** + * Verify that a field exists inside a mysql table + * + * @package News + * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright (c) Hervé Thouzard + * @param $fieldname + * @param $table + * @return bool + */ + public function fieldExists($fieldname, $table) + { + global $xoopsDB; + $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + + return ($xoopsDB->getRowsNum($result) > 0); + } + + /** + * Add a field to a mysql table + * + * @package News + * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright (c) Hervé Thouzard + * @param $field + * @param $table + * @return bool|\mysqli_result + */ + public function addField($field, $table) + { + global $xoopsDB; + $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field;"); + + return $result; + } + + /** + * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * + * @param string $folder Le chemin complet du répertoire à vérifier + * + * @return void + */ + public static function prepareFolder($folder) + { + try { + if (!@mkdir($folder) && !is_dir($folder)) { + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); + } else { + file_put_contents($folder . '/index.html', ''); + } + } catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n", '
    '; + } + } +} diff --git a/class/xmlrss.php b/class/xmlrss.php index 97e7c3de..a3b938e8 100644 --- a/class/xmlrss.php +++ b/class/xmlrss.php @@ -1,9 +1,9 @@ * @since 4.00 * @package module::newbb @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); -load_functions('locale'); +//load_functions('locale'); /** * Description @@ -114,7 +114,7 @@ public function addItem($title, $link, $description = '', $label = '', $pubdate */ public function cleanup($text, $trim = 0) { - if ('utf-8' === strtolower($this->xml_encoding) && strncasecmp(_CHARSET, $this->xml_encoding, 5)) { + if (strtolower($this->xml_encoding) === 'utf-8' && strncasecmp(_CHARSET, $this->xml_encoding, 5)) { $text = XoopsLocal::convert_encoding($text, 'utf-8'); } if (!empty($trim)) { diff --git a/delete.php b/delete.php index aaa4e735..e3a5cfa4 100644 --- a/delete.php +++ b/delete.php @@ -1,35 +1,40 @@ * @since 4.00 * @package module::newbb */ +use Xmf\Request; + include_once __DIR__ . '/header.php'; -$ok = XoopsRequest::getInt('ok', 0, 'POST'); +$ok = Request::getInt('ok', 0, 'POST'); foreach (['forum', 'topic_id', 'post_id', 'order', 'pid', 'act'] as $getint) { - ${$getint} = XoopsRequest::getInt($getint, 0, 'POST'); + ${$getint} = Request::getInt($getint, 0, 'POST'); } foreach (['forum', 'topic_id', 'post_id', 'order', 'pid', 'act'] as $getint) { - ${$getint} = !empty(${$getint}) ? ${$getint} : XoopsRequest::getInt($getint, 0, 'GET'); + ${$getint} = !empty(${$getint}) ? ${$getint} : Request::getInt($getint, 0, 'GET'); } //$viewmode = (isset($_GET['viewmode']) && $_GET['viewmode'] !== 'flat') ? 'thread' : 'flat'; //$viewmode = ($viewmode) ? $viewmode: (isset($_POST['viewmode'])?$_POST['viewmode'] : 'flat'); -$viewmode = (XoopsRequest::getString('viewmode', '', 'GET') - && 'flat' !== XoopsRequest::getString('viewmode', '', 'GET')) ? 'thread' : 'flat'; -$viewmode = $viewmode ?: (XoopsRequest::getString('viewmode', '', 'POST') ?: 'flat'); +$viewmode = (Request::getString('viewmode', '', 'GET') + && Request::getString('viewmode', '', 'GET') !== 'flat') ? 'thread' : 'flat'; +$viewmode = $viewmode ?: (Request::getString('viewmode', '', 'POST') ?: 'flat'); +/** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +/** @var \NewbbTopicHandler $topicHandler */ $topicHandler = xoops_getModuleHandler('topic', 'newbb'); -$postHandler = xoops_getModuleHandler('post', 'newbb'); +/** @var \NewbbPostHandler $postHandler */ +$postHandler = xoops_getModuleHandler('post', 'newbb'); if (!empty($post_id)) { $topic = $topicHandler->getByPost($post_id); @@ -40,47 +45,50 @@ if (!$topic_id) { $redirect = empty($forum) ? 'index.php' : 'viewforum.php?forum=' . $forum; $redirect = XOOPS_URL . '/modules/newbb/' . $redirect; - redirect_header($redirect, 2, _MD_ERRORTOPIC); + redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); } $forum = $topic->getVar('forum_id'); $forum_obj = $forumHandler->get($forum); if (!$forumHandler->getPermission($forum_obj)) { - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NORIGHTTOACCESS); + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } $isadmin = newbb_isAdmin($forum_obj); $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; -$post_obj =& $postHandler->get($post_id); +/** @var NewbbPost $post_obj */ +$post_obj = $postHandler->get($post_id); $topic_status = $topic->getVar('topic_status'); if (($post_obj->checkIdentity() || $isadmin) && $topicHandler->getPermission($topic->getVar('forum_id'), $topic_status, 'delete') ) { } else { - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&pid=$pid&forum=$forum", 2, _MD_DELNOTALLOWED); + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&pid=$pid&forum=$forum", 2, _MD_NEWBB_DELNOTALLOWED); } if (!$isadmin && !$post_obj->checkTimelimit('delete_timelimit')) { - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&pid=$pid", 2, _MD_TIMEISUPDEL); + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&pid=$pid", 2, _MD_NEWBB_TIMEISUPDEL); } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { + /** @var \NewbbOnlineHandler $onlineHandler */ $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forum_obj); } if ($ok) { $isDeleteOne = (1 === $ok); - if ($post_obj->isTopic() && 0 == $topic->getVar('topic_replies')) { + if ($post_obj->isTopic() && $topic->getVar('topic_replies') == 0) { $isDeleteOne = false; } if ($isDeleteOne && $post_obj->isTopic() && $topic->getVar('topic_replies') > 0) { //$postHandler->emptyTopic($post_obj); - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&pid=$pid&forum=$forum", 2, _MD_POSTFIRSTWITHREPLYNODELETED); + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&pid=$pid&forum=$forum", 2, _MD_NEWBB_POSTFIRSTWITHREPLYNODELETED); } else { - if (XoopsRequest::getString('post_text', '', 'POST')) { + if (Request::getString('post_text', '', 'POST')) { //send a message + /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); $senduser = $memberHandler->getUser($post_obj->getVar('uid')); if ($senduser->getVar('notify_method') > 0) { @@ -94,21 +102,12 @@ $xoopsMailer->setHTML(true); $xoopsMailer->setToUsers($senduser); $xoopsMailer->setFromName($GLOBALS['xoopsUser']->getVar('uname')); - $xoopsMailer->setSubject(_MD_DELEDEDMSG_SUBJECT); - $forenurl = '' - . $post_obj->getVar('subject') - . ''; + $xoopsMailer->setSubject(_MD_NEWBB_DELEDEDMSG_SUBJECT); + $forenurl = '' . $post_obj->getVar('subject') . ''; if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { $forenurl = seo_urls($forenurl); } - $body = sprintf(_MD_DELEDEDMSG_BODY, $senduser->getVar('uname'), $forenurl, XoopsRequest::getString('post_text', '', 'POST'), $GLOBALS['xoopsUser']->getVar('uname'), - $GLOBALS['xoopsConfig']['sitename'], XOOPS_URL . '/'); + $body = sprintf(_MD_NEWBB_DELEDEDMSG_BODY, $senduser->getVar('uname'), $forenurl, Request::getString('post_text', '', 'POST'), $GLOBALS['xoopsUser']->getVar('uname'), $GLOBALS['xoopsConfig']['sitename'], XOOPS_URL . '/'); $body = $myts->nl2Br($body); $xoopsMailer->setBody($body); $xoopsMailer->send(); @@ -117,22 +116,23 @@ $postHandler->delete($post_obj, $isDeleteOne); $forumHandler->synchronization($forum); $topicHandler->synchronization($topic_id); + /** @var \NewbbStatsHandler $statsHandler */ $statsHandler = xoops_getModuleHandler('stats', 'newbb'); $statsHandler->reset(); } - $post_obj->loadFilters('delete'); + //$post_obj->loadFilters('delete'); if ($isDeleteOne) { - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum", 2, _MD_POSTDELETED); + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&order=$order&viewmode=$viewmode&pid=$pid&forum=$forum", 2, _MD_NEWBB_POSTDELETED); } else { - redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum", 2, _MD_POSTSDELETED); + redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum", 2, _MD_NEWBB_POSTSDELETED); } } else { include $GLOBALS['xoops']->path('header.php'); - //xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => 1), 'delete.php', _MD_DEL_ONE); - echo '
    ' . _MD_DEL_ONE . '
    + //xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => 1), 'delete.php', _MD_NEWBB_DEL_ONE); + echo '
    ' . _MD_NEWBB_DEL_ONE . '
    '; - echo _MD_DELEDEDMSG . '
    '; + echo _MD_NEWBB_DELEDEDMSG . '
    '; echo '
    '; echo ''; echo ''; @@ -141,7 +141,7 @@ echo ''; echo $GLOBALS['xoopsSecurity']->getTokenHTML(); echo ' - +
    '; if ($isadmin) { @@ -152,7 +152,7 @@ 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => 99 - ], 'delete.php', _MD_DEL_RELATED); + ], 'delete.php', _MD_NEWBB_DEL_RELATED); } include $GLOBALS['xoops']->path('footer.php'); } diff --git a/digest.php b/digest.php index 015e4a95..32dbe24c 100644 --- a/digest.php +++ b/digest.php @@ -1,9 +1,9 @@ * @since 4.00 * @package module::newbb @@ -15,13 +15,14 @@ } ob_start(); include_once __DIR__ . '/header.php'; -if (0 == $GLOBALS['xoopsModuleConfig']['email_digest']) { +if ($GLOBALS['xoopsModuleConfig']['email_digest'] == 0) { echo '
    Not set'; return false; } +/** @var \NewbbDigestHandler $digestHandler */ $digestHandler = xoops_getModuleHandler('digest', 'newbb'); $msg = $digestHandler->process(); -$msg .= ob_get_contents(); +$msg .= ob_get_contents(); ob_end_clean(); echo '
    ' . $msg; diff --git a/dl_attachment.php b/dl_attachment.php index bfc83157..200efe30 100644 --- a/dl_attachment.php +++ b/dl_attachment.php @@ -1,53 +1,60 @@ * @since 4.00 * @package module::newbb */ +use Xmf\Request; + ob_start(); include_once __DIR__ . '/header.php'; include $GLOBALS['xoops']->path('header.php'); -$attach_id = XoopsRequest::getInt('attachid', 0, 'GET'); -$post_id = XoopsRequest::getInt('post_id', 0, 'GET'); +$attach_id = Request::getInt('attachid', 0, 'GET'); +$post_id = Request::getInt('post_id', 0, 'GET'); if (!$post_id || !$attach_id) { - exit(_MD_NO_SUCH_FILE . ': post_id:' . $post_id . '; attachid' . $attachid); + exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $post_id . '; attachid' . $attachid); } +/** @var \NewbbPostHandler $postHandler */ $postHandler = xoops_getModuleHandler('post', 'newbb'); -$forumpost =& $postHandler->get($post_id); + +/** @var \NewbbPost $forumpost */ +$forumpost = $postHandler->get($post_id); if (!$approved = $forumpost->getVar('approved')) { - exit(_MD_NORIGHTTOVIEW); + exit(_MD_NEWBB_NORIGHTTOVIEW); } +/** @var NewbbTopicHandler $topicHandler */ $topicHandler = xoops_getModuleHandler('topic', 'newbb'); $topic_obj = $topicHandler->getByPost($post_id); $topic_id = $topic_obj->getVar('topic_id'); if (!$approved = $topic_obj->getVar('approved')) { - exit(_MD_NORIGHTTOVIEW); + exit(_MD_NEWBB_NORIGHTTOVIEW); } +/** @var NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forum_obj = $forumHandler->get($topic_obj->getVar('forum_id')); if (!$forumHandler->getPermission($forum_obj)) { - exit(_MD_NORIGHTTOACCESS); + exit(_MD_NEWBB_NORIGHTTOACCESS); } if (!$topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'view')) { - exit(_MD_NORIGHTTOVIEW); + exit(_MD_NEWBB_NORIGHTTOVIEW); } $attachments = $forumpost->getAttachment(); $attach = $attachments[$attach_id]; if (!$attach) { - exit(_MD_NO_SUCH_FILE); + exit(_MD_NEWBB_NO_SUCH_FILE); } $file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); if (!file_exists($file_saved)) { - exit(_MD_NO_SUCH_FILE); + exit(_MD_NEWBB_NO_SUCH_FILE); } if ($down = $forumpost->incrementDownload($attach_id)) { $forumpost->saveAttachment(); diff --git a/docs/changelog.txt b/docs/changelog.txt index ac0256db..5aa1eaab 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,30 +1,17 @@ -4.34 Final (XOOPS 2.5.10) 2019-05-07 +5.00 Alpha (XOOPS 2.5.8.1+) (NOT RELEASED) =========================================== -- 4.34 Final release - -4.34 RC1 (XOOPS 2.5.10) 2019-02-09 -=========================================== -- fix for Criteria('1', 1) (geekwright/mamba) - - -4.33 Final (XOOPS 2.5.8) 2016-11-27 -=========================================== -- cosmetics (mamba) -- array short syntax (mamba) -- assignment in condition (mamba) -- double quotes (mamba) -- Yoda (mamba) - - -4.33 RC 13 (XOOPS 2.5.8) 2016-10-18 +- Remove use of Art framework (geekwright) +- standardize names of classes, tables and constants to include "newbb" (geekwright) +- Use XMF whenever practical (geekwright) +- Simplify database migration strategy (geekwright) +- lots of warning/error cleanup (geekwright) +- extra code updates (mamba) +- Short syntax in array literals (mamba) + +4.33 RC 13 (XOOPS 2.5.8) (NOT RELEASED) =========================================== -- code cosmetics (mamba0 -- replaced "< br />" with "< br>" (mamba) -- fixed issue with Functions not loaded when not current module #32 (djsherren/geekright) -- HTML 5 adjustments with 'selected' and 'checked' (mamba) -- removed parenthesis from include/require as they are not functions (mamba) -- using $GLOBALS['xoopsOption'] instead of '$xoopsOption' (mamba) -- renamed logo to 'logoModule.png' (mamba) +- code cosmetics (mamba) +- standardize br tags (mamba) 4.33 RC 12 (XOOPS 2.5.8) (2016-04-03) =========================================== diff --git a/edit.php b/edit.php index 61e476b7..97474c5d 100644 --- a/edit.php +++ b/edit.php @@ -1,37 +1,44 @@ * @since 4.00 * @package module::newbb */ +use Xmf\Request; + include_once __DIR__ . '/header.php'; foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { - ${$getint} = XoopsRequest::getInt($getint, 0, 'GET'); + ${$getint} = Request::getInt($getint, 0, 'GET'); } if (!$topic_id && !$post_id) { $redirect = empty($forum) ? 'index.php' : "viewforum.php?forum={$forum}"; - redirect_header($redirect, 2, _MD_ERRORTOPIC); + redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); } +/** @var \NewbbForumHandler $forumHandler */ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +/** @var \NewbbTopicHandler $topicHandler */ $topicHandler = xoops_getModuleHandler('topic', 'newbb'); -$postHandler = xoops_getModuleHandler('post', 'newbb'); +/** @var \NewbbPostHandler $postHandler */ +$postHandler = xoops_getModuleHandler('post', 'newbb'); +/** @var \NewbbPost $post_obj */ $post_obj = $postHandler->get($post_id); $topic_obj = $topicHandler->get($post_obj->getVar('topic_id')); $forum_obj = $forumHandler->get($post_obj->getVar('forum_id')); if (!$forumHandler->getPermission($forum_obj)) { - redirect_header('index.php', 2, _MD_NORIGHTTOACCESS); + redirect_header('index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { + /** @var \NewbbOnlineHandler $onlineHandler */ $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forum_obj); } @@ -43,9 +50,9 @@ $error_msg = null; if (!$topicHandler->getPermission($forum_obj, $topic_status, 'edit') || (!$isadmin && !$post_obj->checkIdentity())) { - $error_msg = _MD_NORIGHTTOEDIT; + $error_msg = _MD_NEWBB_NORIGHTTOEDIT; } elseif (!$isadmin && !$post_obj->checkTimelimit('edit_timelimit')) { - $error_msg = _MD_TIMEISUP; + $error_msg = _MD_NEWBB_TIMEISUP; } if (!empty($error_msg)) { @@ -55,8 +62,8 @@ $query_vars = ['topic_id', 'post_id', 'forum', 'status', 'order', 'mode', 'viewmode']; $query_array = []; foreach ($query_vars as $var) { - if (XoopsRequest::getString($var, '', 'GET')) { - $query_array[$var] = "{$var}=" . XoopsRequest::getString($var, '', 'GET'); + if (Request::getString($var, '', 'GET')) { + $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); } } $page_query = htmlspecialchars(implode('&', array_values($query_array))); @@ -75,7 +82,7 @@ include_once $GLOBALS['xoops']->path('header.php'); /* -$xoopsTpl->assign('lang_forum_index', sprintf(_MD_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); +$xoopsTpl->assign('lang_forum_index', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); $categoryHandler = xoops_getModuleHandler("category"); $category_obj = $categoryHandler->get($forum_obj->getVar('cat_id'), array("cat_title")); @@ -98,7 +105,7 @@ $dobr = $post_obj->getVar('dobr'); $icon = $post_obj->getVar('icon'); $attachsig = $post_obj->getVar('attachsig'); -$istopic = $post_obj->istopic() ? 1 : 0; +$istopic = $post_obj->isTopic() ? 1 : 0; $isedit = 1; $subject = $post_obj->getVar('subject', 'E'); $message = $post_obj->getVar('post_text', 'E'); @@ -107,9 +114,10 @@ $post_karma = $post_obj->getVar('post_karma'); $require_reply = $post_obj->getVar('require_reply'); -$xoopsTpl->assign('error_message', _MD_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); +$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); include __DIR__ . '/include/form.post.php'; +/** @var \NewbbKarmaHandler $karmaHandler */ $karmaHandler = xoops_getModuleHandler('karma', 'newbb'); $user_karma = $karmaHandler->getUserKarma(); @@ -117,9 +125,9 @@ $posts_context_obj = $istopic ? [] : [$postHandler->get($post_obj->getVar('pid'))]; foreach ($posts_context_obj as $post_context_obj) { if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_context_obj->getVar('post_karma') > 0) { - $p_message = sprintf(_MD_KARMA_REQUIREMENT, '***', $post_context_obj->getVar('post_karma')) . '
    '; + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_context_obj->getVar('post_karma')) . ''; } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_context_obj->getVar('require_reply')) { - $p_message = _MD_REPLY_REQUIREMENT; + $p_message = _MD_NEWBB_REPLY_REQUIREMENT; } else { $p_message = $post_context_obj->getVar('post_text'); } @@ -135,7 +143,7 @@ $posts_context[] = [ 'subject' => $p_subject, - 'meta' => _MD_BY . ' ' . $p_name . ' ' . _MD_ON . ' ' . $p_date, + 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, 'content' => $p_message ]; } diff --git a/footer.php b/footer.php index f24c09cd..d8b3395a 100644 --- a/footer.php +++ b/footer.php @@ -11,7 +11,7 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ - * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package NEWBB * @since 4.3 * @author irmtfan @@ -27,6 +27,7 @@ // get css rel path from setted language $css_rel_path = $iconHandler->getPath('language/' . $GLOBALS['xoopsConfig']['language'], 'newbb', 'language/english', 'css'); // add local stylesheet +/** @var xos_opal_Theme $xoTheme */ $xoTheme->addStylesheet($css_rel_path . '/style.css'); // get js rel path from setted language @@ -35,12 +36,12 @@ xoops_load('XoopsLists'); $allfiles = XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($js_rel_path)); foreach ($allfiles as $jsfile) { - if ('js' === strtolower(pathinfo($jsfile, PATHINFO_EXTENSION))) { + if (strtolower(pathinfo($jsfile, PATHINFO_EXTENSION)) === 'js') { $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } global $forumCookie; // for $forumCookie["prefix"] revert last change - use global instead of include_once // add toggle script //$toggle_script = "var toggle_cookie=\"" . $forumCookie['prefix'] . 'G' . '\';'; -$toggle_script = 'var toggle_cookie="' . $forumCookie['prefix'] . 'G' . '";'; +$toggle_script = 'var toggle_cookie="' . $forumCookie['prefix'] . 'G";'; $xoTheme->addScript(null, ['type' => 'text/javascript'], $toggle_script); diff --git a/header.php b/header.php index 7ea4d9e5..fc4ba4ed 100644 --- a/header.php +++ b/header.php @@ -1,20 +1,22 @@ * @since 4.00 * @package module::newbb */ -include __DIR__ . '/../../mainfile.php'; + +use Xmf\Request; + +include dirname(dirname(__DIR__)) . '/mainfile.php'; // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); $xoopsLogger->startTime('newBB_Header'); // irmtfan assign newbb dirname then replace all. include xoops header.php (now commented and removed) $dirname = $xoopsModule->getVar('dirname'); //include_once $GLOBALS['xoops']->path('header.php'); -xoops_load('XoopsRequest'); if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { include_once __DIR__ . '/seo_url.php'; @@ -22,17 +24,17 @@ $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite']) && (!isset($_POST) || count($_POST) <= 0) - && (false === strpos(getenv('REQUEST_URI'), '.html')) + && (strpos(getenv('REQUEST_URI'), '.html') === false) ) { $redir = false; - if (true === strpos(getenv('REQUEST_URI'), 'mark_read=') || true === strpos(getenv('REQUEST_URI'), 'mark=')) { + if (strpos(getenv('REQUEST_URI'), 'mark_read=') === true || strpos(getenv('REQUEST_URI'), 'mark=') === true) { // Mark Forums } else { if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) { //rewrite only for files - if ('' !== trim(getenv('SCRIPT_NAME'))) { - if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { + if (trim(getenv('SCRIPT_NAME')) !== '') { + if (strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/') === false) { $redir = true; } elseif (getenv('QUERY_STRING')) { $redir = true; @@ -41,7 +43,7 @@ } } - if (true === $redir) { + if ($redir === true) { $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); $newurl = seo_urls(''); @@ -58,8 +60,8 @@ include_once $GLOBALS['xoops']->path('modules/' . $dirname . '/include/vars.php'); -mod_loadFunctions('user', $dirname); -mod_loadFunctions('topic', $dirname); +include_once __DIR__ . '/include/functions.user.php'; +include_once __DIR__ . '/include/functions.topic.php'; require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); require_once $GLOBALS['xoops']->path('class/module.textsanitizer.php'); @@ -69,76 +71,22 @@ $menumode_other = []; $menu_url = htmlspecialchars(preg_replace('/&menumode=[^&]/', '', $_SERVER['REQUEST_URI'])); $menu_url .= (false === strpos($menu_url, '?')) ? '?menumode=' : '&menumode='; -foreach ($GLOBALS['xoopsModuleConfig']['valid_menumodes'] as $key => $val) { - if ($key !== $menumode) { - $menumode_other[] = ['title' => $val, 'link' => $menu_url . $key]; - } -} -// irmtfan new method for add js scripts - commented and move to footer.php -//global $xoopsTpl; -//$xoopsTpl->assign("xoops_module_header",' -// -//'. @$xoopsTpl->get_template_vars("xoops_module_header")); - -/* START irmtfan remove and move to newbb/footer.php */ -/* -$newbb_module_header = ''; -$newbb_module_header .= ''; -if (!empty($GLOBALS['xoopsModuleConfig']['pngforie_enabled'])) { - $newbb_module_header .= ''; -} -// START hacked by irmtfan to add localization/customization for newbb style.css -mod_loadFunctions("render", $dirname); -$iconHandler = newbbGetIconHandler(); -// get from setted language -$rel_path=$iconHandler->getPath("language/" . $GLOBALS['xoopsConfig']['language'], $dirname ,"language/english"); -if (!file_exists(XOOPS_ROOT_PATH . $rel_path . '/style.css')) { - // for backward compatibility - as before - $rel_path="/modules/" . $dirname . "/templates"; -} -$newbb_module_header .= ' - - - - '; -// END hacked by irmtfan to add localization/customization for newbb style.css -if ($menumode === 2) { - $newbb_module_header .= ' - - - '; -} - -if ($menumode === 1) { - $newbb_module_header .= ' - - - '; -} - -$xoops_module_header = $newbb_module_header; // for cache hack -*/ -/* END irmtfan remove and move to newbb/footer.php */ +//foreach ($GLOBALS['xoopsModuleConfig']['valid_menumodes'] as $key => $val) { +// if ($key !== $menumode) { +// $menumode_other[] = array('title' => $val, 'link' => $menu_url . $key); +// } +//} if (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['welcome_forum']) && !$GLOBALS['xoopsUser']->getVar('posts') ) { - mod_loadFunctions('welcome', $dirname); + include_once __DIR__ . '/include/functions.welcome.php'; } // irmtfan for backward compatibility $pollmodules = $GLOBALS['xoopsModuleConfig']['poll_module']; -/** @var XoopsModuleHandler $moduleHandler */ +/** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); -$xoopspoll = $moduleHandler->getByDirname($pollmodules); -/* -if (is_object($xoopspoll) && $xoopspoll->getVar('isactive')) { - $pollmodules = 'xoopspoll'; -} else { - //Umfrage - $xoopspoll = &$moduleHandler->getByDirname('umfrage'); - if (is_object($xoopspoll) && $xoopspoll->getVar('isactive')) - $pollmodules = 'umfrage'; -} -*/ +$xoopspoll = $moduleHandler->getByDirname($pollmodules); + $xoopsLogger->stopTime('newBB_Header'); diff --git a/images/category/blank.gif b/images/category/blank.gif new file mode 100644 index 0000000000000000000000000000000000000000..fc6b95918d4510f8ea292192537443ec0524000e GIT binary patch literal 49 zcmZ?wbhEHby zPe@}|6vn@2Qva1lY+3>tn-bn4Bp?P5gF*gHuK@tiL0w0eF#_&{UpJAGGH83DY=rPVq*M4U zgr6T$tM>t5jF8j|03a_Be}*51sGlC3mgPbJ(3#<6GHEavtX8XBE(hT8c%sp$)oKN> zw6rugHnRbPWv+nW|h!qtTR?mlHyYii*r;vr?%Hhr^?zqX!2EG)>bqJuomJ z5D2okee)fB^%#*K;ktuZ1pH#iKEOv7aE1ZgtDs^LLKUFmV;C36=J!-G_G)y|Fiq2) zot?wO!%nAjcX!w8^}5||0DiyU0hphkZ*OlGi9`T|LZQiIa=Bcbt2`*9nwpw;Jf2FW4i66{5=mxr zbF33kHsZl&IVk|^CILVdfV?EjBj?UA56Ws7fZ1%;>-AMtRcf`Gi$tSQg+h@@P$(4J z+uP}Mn#beiL0lx2N_o9riA2KZ^YwatcXzj3E@v2~va(X8Qf2o;i}3sNe1`8;P_YOA z^0pM8y2zccsfFHGqrX+~ukrf&dTD9t&d$!s$w|JhmypqD?C9v&*x2an>jTiz(lR|g z-PF`nTwLsQIvoy2_OfIQf?JoFpE}sa;$6INxDq;N_~__}Wm%ieCX>l#W@fk`!!Y4+ zIFqxrwI!8Gxiidz0I)1OF)=YXILI&z7ZD1DwY9aat*t{tLn|vQ*?s)-9aNuR#_*|l zg;zr743CVAXti2~VN52|^73*d5&@vo>Bh&$_xJY!BoYa?+pW{-xcofmqI^DI=BbH9 zB4V*Pd*0$*NN*GUeIk+pAa9fs`G@3-<%@|#a0{Od;K|~Z(Ahie^ZEAn_Ii4H0MInu z)z#&2I9QfdtJTNH#}history.go(-1); \ No newline at end of file diff --git a/images/category/topxoops.png b/images/category/topxoops.png new file mode 100644 index 0000000000000000000000000000000000000000..b249156d4652b76b108bf975992bb1da8661b313 GIT binary patch literal 618 zcmV-w0+s!VP)5R0sYUY31nol%f8fXX58?ayz!;B5&_(zt7 zi=%4!e|bCO6fbylfq?;T7X#K9{$H#9|LsEryH*{_Zn*Zp;oASV58(>_H(W!}2$xc^L6brQ zSJ$k`>+0Hj>ePg#OHWYJc5v|hr%&;VGcYi0o;VRx{N{rP zGUDRu^70VG#>$EaBTUyYzPk1Q&o4L|Aug%Oz`*eToieS7up z-M1e<w} z2&l-)Qer8tm~=EX)lg7iU|`sI;DC#{IX5RKM4SW<|9^g+fq{X6jqAUd8UqU(M1;KB z?B;_9T?-bJB_v$FeS7YP4W;q%kW{TMFaPA#D~KB8yoXC1kNLR~5fFAzaj~ANs-mM8)1nk+SO{xWqHAKy6)04~qDt>@Blq^q+$2LRfW zKu_u_brs)sf=2R!${IF^%9@|skyu^f>dU{9QUc%7+h^&T6xRW8<(BmJU4C*J0D51Y zm}5#Dc_ci|XsBtvu6s7+W)?u~0({=Y_YNnfWPWjAiuh5-viJ{>hwlNvdLW%$08*TR zL6;nUK^`8UQAaA{eDUd9sA<@{a(^MBv;G`s&f?wzQ`vseA)|r`bNr$d*V%0Wz@1mz z`G6lC`FX%@OD3l=egOcxE&Mukf-vdoJkCh_lk~|#R{==bW~qtFyt5E~|Jf|sdj!zl z!?Q>5DyF6-l^JrCi+TywT5#*ej|y$+vJIyo0GGC;Z1cq;HsAD@$Z5r3-8?edR@wIB zsGd@-v5=E5btQci6J5(|7oP$DcDi@?X59pa8HeD`^{} Z!*5hG00*k+y zPe@}|6vn@2Qva1lY+3>tn-bn4Bp?P5gF*gHuK@tiL0w0eF#_&{UpJAGGH83DY=rPVq*M4U zgr6T$tM>t5jF8j|03a_Be}*51sGlC3mgPbJ(3#<6GHEavtX8XBE(hT8c%sp$)oKN> zw6rugHnRbPWv+nW|h!qtTR?mlHyYii*r;vr?%Hhr^?zqX!2EG)>bqJuomJ z5D2okee)fB^%#*K;ktuZ1pH#iKEOv7aE1ZgtDs^LLKUFmV;C36=J!-G_G)y|Fiq2) zot?wO!%nAjcX!w8^}5||0DiyU0hphkZ*OlGi9`T|LZQiIa=Bcbt2`*9nwpw;Jf2FW4i66{5=mxr zbF33kHsZl&IVk|^CILVdfV?EjBj?UA56Ws7fZ1%;>-AMtRcf`Gi$tSQg+h@@P$(4J z+uP}Mn#beiL0lx2N_o9riA2KZ^YwatcXzj3E@v2~va(X8Qf2o;i}3sNe1`8;P_YOA z^0pM8y2zccsfFHGqrX+~ukrf&dTD9t&d$!s$w|JhmypqD?C9v&*x2an>jTiz(lR|g z-PF`nTwLsQIvoy2_OfIQf?JoFpE}sa;$6INxDq;N_~__}Wm%ieCX>l#W@fk`!!Y4+ zIFqxrwI!8Gxiidz0I)1OF)=YXILI&z7ZD1DwY9aat*t{tLn|vQ*?s)-9aNuR#_*|l zg;zr743CVAXti2~VN52|^73*d5&@vo>Bh&$_xJY!BoYa?+pW{-xcofmqI^DI=BbH9 zB4V*Pd*0$*NN*GUeIk+pAa9fs`G@3-<%@|#a0{Od;K|~Z(Ahie^ZEAn_Ii4H0MInu z)z#&2I9QfdtJTNH#}<> z6S3=xpY|k&?1rN&pSwsah^5Lg^2IpUrFXAeR_)}XdH#d!GppETn&&f|1SNWv*b0uQ RFwB_5_JFb0N1Btt8UR)aBpS9BP}F!UZ;61mvZ_GlkN0Vjjlft!fp0YuJ!me@770a zt}f4I5>I6jjH!!vm1<^Tm31}j$PwV!LhX4Qm|6>4B|NjF?2vGdV!pOkD!k`1~t zvD4yn%$8M{l$kp@_D4@j!aR*rEK@Xhypdj$AG^^)_x(oC$2K=}E*xg`Up?iLdzO>f Q!gIyKUp?mZvM^W!0HBL0LjV8( literal 0 HcmV?d00001 diff --git a/images/filetypes/doc.gif b/images/filetypes/doc.gif new file mode 100644 index 0000000000000000000000000000000000000000..078d9f7a14ae12ac13f99fe1279fac7ff320de26 GIT binary patch literal 940 zcmchWze|^K5XbLJ4mQ}LNN7vokl`R6L}fuOrWiz-LUo4k zXoM6km3z2_Yq*pOn&x2^reRW|m{kw8Pz@C{vKrzc7NQ}rq8cznqY_#4AO;&~uvnHd zR5j1s)m_RTv{Ytp>Lz6u6*Sdc)m3nhC}v&EMP0B*9>`>yIPi}M9HJU9M5B^XbU+L? z&|pa=S8ZyZnn?wTKWM2`O@&;siwc@1YC?`AO#tX(oS<<_l;nX-wuu8x7{(#00YfyK z$U+CiU;{06qMD{n%@Zz0kobd^N~J!I%C)(7HJcMw%*|D5wh6jYZ?db^CXPBn1c_3m!V>;e?mHM%gdd6#@nl} z7CXD=X5O}EUtj(vQ{j`yc8R!q_2#pCj~?B=fBDRf)4T5--G8RJzGM5Q zV_P>I+rH`ewvDIPuR670)?r2}}K{VoH;e+Gu9 z3=BZV9R`Lg3=EeT7>+P7Y-3=U&%od=Ep=Z){Ir6?e3~f(q%AaRCI_ZjwGiYcCnVTymCx=g-+%aiV`?P7@ zh6XYo?xu+efr|26j&>?0M)K~iCJW|Ib8*xT4R%h94@^xCO-TyT)0S|y*RZzG@^Cfv z_puG~cZdx0=xnd;?`>vfVQ{wBcXu|*OpDCRj<2rBId=4*r>j{)v}b6bb4Y+wMQK(| zWuAw#k*AAse3WNhbzx#`U~+tLT2fd_LP%z6WJXFvVQ$j4E$hMpU8YZLx_RYzYC>pR zQ|00XGlP8{L;am|GvcB{y}aD)TN)~-Oz50Cu`4djGdVVR#>6&9OWlI3#Qe;J)r+Q1 zpU{>ZY+F{4QIeNdRg$xE@$C3e&)&A$Y5i@J`#N4fxxI18w3fQ^H&5^OcQmeCG<(CU zB@1RxJ9+Hzq@MPr3+Bw9Id#^Q2@7UTo6^&(-r{Hf`Uq;nL~T5AWQ0eE&Yfpa+USSr|c%)BzEoJmJ9cpMjA> z#$&^RgSI<5CjN4M9V#MhmUoAtP*Hex6Nenbj13;b2VD~G_!uS!Brti{)*Oi7RCZ%` z%jIf|nCQgX$vTNoP$JDI!jN$no1rGBqGao0cW#C3rN8J|F z=_Wqbn6eKygxLLNDmY15E^IXG)XKJ&RsG|yB=uf-XZhoi&1zLJd6zP4a117APjWu$U}!Sy*&HAz;0eH(QlMq z2PkL=lm*fZ|G@yrAQCA4WMO1r5MF-UYo0&harQ>T$_7>@njEeP7|Z3xu#lri_J8bEngw1 H$Y2csmZD3t literal 0 HcmV?d00001 diff --git a/images/filetypes/gif.gif b/images/filetypes/gif.gif new file mode 100644 index 0000000000000000000000000000000000000000..34a12623bfe60b0546fba010249c54b8a305f76c GIT binary patch literal 119 zcmZ?wbhEHb6krfwSj56`?C>#$CWe3i|1mHy{Qv(SNJ4<(PZmZ71{MY#5ErDDf!W5x z>W-ZjpJTSH!lcaH$+16rQWEBAoSGqWyUJN%$>y4M#kr?-&;8qdpzHamyGbjTbRJ1* QaGIw+g(=cRnv=mA0C!O-SO5S3 literal 0 HcmV?d00001 diff --git a/images/filetypes/html.gif b/images/filetypes/html.gif new file mode 100644 index 0000000000000000000000000000000000000000..eb948eae6aa24400081b4c5e6e1d97999cb9eace GIT binary patch literal 183 zcmZ?wbhEHb6k!ly*!-UX2>$;7Qb1H+Uk_w695`@b|Ni|T4mP0plZBCifsH{2BndLZ zfhFa_3D4D2n?(c<2{?<(97tuzShYw^X`g#TL<>WWlU!Fy_n!mvGn<%ME#}I#7W{Y< zcXE>JgQibQ4zDTmUg^ZYd7=6Bz*r+`Ssv?)PwpMdXmvOsJL{uh^r67Yr{Wyt%`ILr J?d^gL)&QM1KvDnz literal 0 HcmV?d00001 diff --git a/images/filetypes/jpeg.gif b/images/filetypes/jpeg.gif new file mode 100644 index 0000000000000000000000000000000000000000..252922ef2d47f1e76dac80024cc11f949282b10d GIT binary patch literal 119 zcmZ?wbhEHb6krfwSj56`?C`OcCWe3i|1mHy{Qv(SNJ4<(PZmZ71{MY#5ErDDf!W5x z>W-ZjpJTSH!lcaH$+16rQWEBAoMI8xo-<|Vrf1o!on!Z#*nhT>$`uuUm$Gw;kY`qt P(>(PlOpzwCoD9|gMn5G} literal 0 HcmV?d00001 diff --git a/images/filetypes/jpg.gif b/images/filetypes/jpg.gif new file mode 100644 index 0000000000000000000000000000000000000000..252922ef2d47f1e76dac80024cc11f949282b10d GIT binary patch literal 119 zcmZ?wbhEHb6krfwSj56`?C`OcCWe3i|1mHy{Qv(SNJ4<(PZmZ71{MY#5ErDDf!W5x z>W-ZjpJTSH!lcaH$+16rQWEBAoMI8xo-<|Vrf1o!on!Z#*nhT>$`uuUm$Gw;kY`qt P(>(PlOpzwCoD9|gMn5G} literal 0 HcmV?d00001 diff --git a/images/filetypes/mid.gif b/images/filetypes/mid.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea7302cb16e099c6c65a5e53105caa2f13eaa2aa GIT binary patch literal 141 zcmZ?wbhEHb6k!lySoEI(2~lR~uvFoJ=%L-mXQ{?HedGyr;9SLO<*IXjxsdOxs#JqG&-KU7K7Vwz?}SRq q6Qj9px||7FDGrgl7F^wQDs1}B`+7%u`>M}8YCe@$Ked;I!5RSWfH>>` literal 0 HcmV?d00001 diff --git a/images/filetypes/mov.gif b/images/filetypes/mov.gif new file mode 100644 index 0000000000000000000000000000000000000000..55f2116261790454ca65d5bbeea02aa91679cd02 GIT binary patch literal 271 zcmZ?wbhEHb6k!lyI3mZ8kTBoCAR!^){Q3C?^XH%c@Zp0&!upS9BP}F!UZ;61mvZ_GlkN0Vjjlft!fp0YuJ!me@770a zt}f4I5>I6jjH!!vm1<^Tm31}j$PwVpS9BP}F!UZ;61mvZ_GlkN0Vjjlft!fp0YuJ!me@770a zt}f4I5>I6jjH!!vm1<^Tm31}j$PwVE{$ycfVBloX0f~al zU|?xBIO(~1?+w1q){Zed0%a~qHc1MxJMkXhzLCRl`BX=d`+X*$AMDa%IQX8!g6rOU3D&^VOnk{z+fF#L9b;!SO;<5C pOihVs5pD}NVbO_IG2t}Tl<({2H0X9}@lcsHNpi{3Wg>zM)&MS7MRNcE literal 0 HcmV?d00001 diff --git a/images/filetypes/pdf.gif b/images/filetypes/pdf.gif new file mode 100644 index 0000000000000000000000000000000000000000..8d0603ae654c1c5a04ef7373d8e2d1edcdc2d1f6 GIT binary patch literal 370 zcmZ?wbhEHb6k!lyxT?T#|Neaj1_l8Ef&W0j!0^Dq;lcX#5BmEhBqZ)Xc<>-U|AD{% z{qyG^Y}oK%{`~tFF1)w5e-IG=J|N(Mfx-Lucur2v2OIXkckq9pum8Z_;X!=-gNB9& z_4N-53LYdRJlMYqMEQ|~c3Jf|R3qXEiVC#37P~f2>)!&@*$%DsYzJFsv zKnNSd4V^Ftj)3+H8-x$2D(qXpka#vNesMDz&fy*|#oENcFVE=4EXu{r fvyFjsS16;GBmPM+R#ERg!Bm literal 0 HcmV?d00001 diff --git a/images/filetypes/png.gif b/images/filetypes/png.gif new file mode 100644 index 0000000000000000000000000000000000000000..d7ce8e0d0e4b967090620c5c4e567f4fd293230c GIT binary patch literal 119 zcmZ?wbhEHb6krfwSj56`?C`M`28MtC|1mHy{Qv(SNJ4<(PZmZ71{MY#5ErDDf!W5x z>W-ZjpJTSH!lcaH$+16rQWEBAoMM@xx#QjLeI{q;eXidAt>%^4H2$*WlWZ$h`i`{d QILSU|do|HSnv=mA0BkZSfdBvi literal 0 HcmV?d00001 diff --git a/images/filetypes/ppt.gif b/images/filetypes/ppt.gif new file mode 100644 index 0000000000000000000000000000000000000000..a3800d12c69e3a307fa01e58e0726f0e5dc8990c GIT binary patch literal 867 zcmeIxv1=DG6u|K;O2!l%uGl4;C%@(F(xZ#~5d9gK@)pb4rTtBEW5#TH1u2J9#tu5% zc;FH`Whj+U9j;pjkqm|M#^980@qYh?_~pan%@5wI*Dv?#V@4QBgwV33rKD9)>yZji zMPRjN%h@>-BNLW^WzEEz$kwq~4uzPRLf8UK0rPYP_+sq~8MqiZ%nS$1VdCIr&mvWtT*sghrtgfCX>>9%KNM+RnD!Bzq_O zNop^3kQ(JV$}uXiN(QC98c+>MnWU!Njkzphj;;^* z<> z6S3=xpY|k&?1rN&pSwsah^5Lg^2IpUrFXAeR_)}XdH#d!GppETn&&f|1SNWv*b0uQ RFwB_5_JFb0N1Btt8UR)aB(tE;Q`?%n%;6pV(zND2WRP!0g)1qY5S25t_PfQAJJ zo0x?8JUkXSG_*5v2`Fe3G&FRJ3vGW!;@+puk`a E0Au7Ji2wiq literal 0 HcmV?d00001 diff --git a/images/filetypes/unknown.gif b/images/filetypes/unknown.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea1216596152a3c3cc2cc3703e2e3fe34c8c7840 GIT binary patch literal 112 zcmZ?wbhEHb6krfwSj56`?C`OcrWOVUhW}syWI%x8PZmZ71{MY#5ErDDf!Wk!$>0&+vnRp`PKufdl*Z@2{_~2MQ|wWMO1rU}4Y!sQ{^U zU{3egb;mE6h0)8v`~{Pop{qvU-R8`U1W7rAfSW6)^(EflzTIQ$o{KCE2NXCM7z}Tp zNw!c5_MThfmHQ)rb=ov|)ss9A%C2*aF6Pr;S60WB M(Bc;w#K~X{0GpyZ=l}o! literal 0 HcmV?d00001 diff --git a/images/filetypes/xls.gif b/images/filetypes/xls.gif new file mode 100644 index 0000000000000000000000000000000000000000..187a19b53c3ff8f46ded3daa7ed2ef5ed87758cc GIT binary patch literal 941 zcmchWze|^K5Xa9lP=caziChwcgofxavS?^AzZFDD6f|jekkt@4v=m=*%6=?Sa^R5B zP%b&u&|(r4afG!KO$K#GCk8WHB+jJ z$nXry&Yfsz$1(TB@cBNGXxxDVCxs6kr1l7RyXa@znDO zi_i!uS}ON&3)gTd6*SGmEKI|sL@}!#YM~k`Xk<0SLo7r?U_~`xh(;x{=s^rN&|tAF zWvFVNxvRUBKWM4U+|*6VE-GlMxvHz+9#PD?n2Wk#k35jcHgVt|5jaFOV2DN~qv(Jb zY@orCO0L?}JT;RF5`WNAshSG8Viy%OP1J-ONtyuA#W+FZmMF;snQRjWnlOw*R0D=+ zHj#x6h`|P0>O?h7o0=zFj3Ds`EtN`r9F=Qx?`k$DteBgt)NB)UrQT#$t4$nrgvMbZ zHKOY#jgA6tp!poQ65-(qDrvWumX_M>HlJga|Lg7k+u0$qCi{x8{t4-tkvHAFBa2Vp zO?T~>y!df(Z29_k8JXLAW^HhK^}va^`C$D0z0Ox(o;|)X@!@Xou`NBVuj8+0_jgQ; z4lMS!9)9cpIk$8Bu7gijZ!fR6bkEAwq067153TfloU#6-|6YmOTX^VoV#*% n;rwR1HSp-#g*)2@7LKk>y;z$)wdwHSFkhPZmZ71|bF=kW!GH46GRoRQen;l@^Pv6>^X`Rw%-> zO6x-N3>(7*s~1dQm0$>IWJqqTHjz61$Z%1N!QAsJ0=Mo-TDUehWo1Q;@GVW_?=@DJ t%*$?n#=lst(|NFnQ@IRY)@Ihl^j^n7Qcp{Ndy}i9|V`JkEK+7jz&L*W4O3Ep@&$39RQd&(- z%?Aw)4Z8tjA^pIeP5g=-7YwLFH+V%CMJD{WlAdyHAkH_in@8_>GXAqi(Wm&kci|e{XA`!~U z%7!Zuf@#yHF)%QI%)SqZm9@2-qS5HJZQHhel|O*&2>gCOt*xyDgF))*>+xAWZ%sYND>L4o%ZYr_)@%e3{#~Z*%wVzep(wg+j)vRjaDYnzs>IQ1@>Fg+c(9Win^ZT-w{) zsIIOCKnOumQ4yM^F@5?pOw+`+ZKQN6@&X{GL0SsN|`t|D%rW+rC>$>Q=1}GfIMM{ZjK3Y>O%VKbFkb;5& z08GoGAP~rjofiP56zOyZ-7pYB;y5nJp%l8VqwD&Z3q%0|$8m_oVuZtC{C>Z;`rzpD z0wARv9sv-G-NUjh$b!mb98V*J5T0rZB)9tdxOMB67soCvL=ytjGznxok;5e(b{8nc zk|nS5^T7kSj*H{CI8IjcvwK`Aaiu~Nf|DmZsj8}?u&~hc5gz#c{!wiirvtfCoF!pN zNeMH;PjTc(GmhhuN~cMshJ7geD^T?GTp|{WF?a4hBoZ;&+FIH7Lj%3Ny_~;r0o%5*Z5u<^?@R3Y zWHGUu`+|*_ID^|D&xOJ@y-#rV$Q@357!5`bfOIIH1OGKxK(Dk^6lr zd&vwPzn`G}_;GGTqr~HJlF8)gSSND|ChNsTMQq=?nJd?${M~hy_O>=Mj)Q5MlRE`! zOwbV#$=7FB%wqetkNLCf99MdJ=s12H$8jDBAcq6)7!D*72~z2F&P$K7Q0bGr`_6iH zezTiGyO5TnM_IOXsaM>D0LGGVgvFD!*Is#KeXR95sf01 zJ8=i3R9*)jhrPFH1BaTAQ2E01-0bU{7=Y`#L*psdR87+awQsHf;6^l>!{{6Ud-i;{ wW&Zr*MBGgfaTJ^NdBMl#;Whh{cHJq?)qMAENyq0TeCH6%~`>%ok@WZm0D=sjF6NTvAA?qB)!9 zQY`P{##JPwKDu=EHtbb>k>rO5Bp7&}_vO1R)C`FuQA53czYZP0UY4A_Lj~e7HF6s%DPjofE22T$CQ?e2oZulYd_ec!i!W~Z&CSOuc+#0Y zaW{l#U0t8PP%Y~2@Zc=V7s6&!#M)y^?U>HjWbbLKKv#rl4igAXLue{VqeHhi9LYDn z_xdA0{P_=NzrXg^2|uHJ8sLFLue|WWOO?n^ddthFSX-+WYipIJ?68_Qqac)hvU z+^o06^;Sik$5hc`^n-BZdzPwzNHNMn;&jM*v!ffQNA|VnuD#})yr1gyLGtqt?)3Jq zynX+ldsn|s`~<+?FJ1c8U}fdU1G9QrwOYx!&Kv7td~PEgpTD>gmh0em-{c(G zxxVqZ>~Ecx)pP5zJMJv>#ti&aHwOo{b$+J()odA&!P@bSP`hkBEnR5y*hcwoyED6W z_|EU%{Qm6E4@!_hBKRcYJMTl~Ts4@@!}15CYUAL#%bNqyx3BZUac$qUH@UHKp1-`X z#lcfgNH7=y2$3 z5owZRRFJV^Q_QAj%(Q5mgw!e8C8Y~0qOzZF%Td^sfh;*tEK*sA*@9v%YAs${3iA^H zXCMYaMEZoVuHK(&4-N)#JZ?JYs?Iq&6B~=z%waP#T2*T`TTDtxW~D1CG3#)$Z-EEB8(?P4%-ik>t~Zt9AZc-LI7EQON> zV6t9Sw>Ek`*YEY-ZB+Zav)RRQjA!RnwNX9&bhCf?aw#y$aAy;Cp6|1BUGw_Y1OJS6 zwvooRY0!uoDwue42;_tzCvTMroxovH_H&|)7ZPH+D`Fu+0kvz+n=vZIwZRsM8QP)DBQR#C- zYWC@|N5y?f?79UpaFXW59q;e0)O9S2Mcp5dtG;T}hiZ_sXJ<#gVwNMsBj`qu?kF~P z61v(qepN!~g=_N^mr7tMWVd}>ggeQSogzt4b(!h9wQU^HzKL9qZ#uK^??g zSa?UPj)gD87LK_<_t7M@;c&Rv9uDIrkRGslGN2@a#CYN?2b>2z1NIM~KWrtBSKMyz zkOOe18hlYg(s)R9Lm1yHUM`6Kz`U#!B1E%EVq<-_$?{(b9{zf~_I zTt#>W;iQ!vs|aI^4U8)&KSH^J@#;zEeOmATGyVlr5-DGv1Iph30000NwJRlvAOwvOWK0}2VqOLllNe_vnd#~7s#}la;=cO!bb=y5 z1P^_vSKo8~^Q?mZ>0c(*T#7>Ov?e7(w-3L6dCw#FjsGx`CaKm6trS{o%6SyUFH3?C z1yn#ph%pkP5MsI+7O3l|m`d3Ze+7 zuX?%`RDoF#L?B8e#vwqWjH$rdN2-D0SZ8* zWXTm2Kthbfg8PAl0*J(Bj4J>RxN?1olt`j$_ba8)N~2T`ph1#*qO!2zjWQ%Ps1PGQ znYaZ22lG1>&po=SP_9Xmq%jUMeR&XLB!oZ+0q=cd48h|=V6B_+>POjd0N`*T7p9a# zL@JIkGDsq_0l*;V-xsczh!3&)ZUX@Cz=e2A#UTW)UAso7)7cP;VIV>XwO3*whQN)E zqjNnpKJLo_hx2i$#a3EexH*MQ?m=cK08&_%mt>66*pFp`Myb!Y2rnMy(2?iOB@rQ@ zu2ujt+g9DKWxbOpoz|LUbb{aAR?aTBZ~;JyA}ozismuE~KrowtD&87~43xdsbY02uQpC`Xhjdv#` zh9e>h#9`B1Xfx64#q_x5(B26)Pim~s6>Oc+JhiXI=RbC7n=lZ98c^E88>nWY1>wvJ8_sdRZ~I1!s=k+eVq+I}L#Kv5%!<0p|BkbN}`h zrjXIg9LDBj&t{k`qiZe3n*}KPK-Xp`qsWtqczUU#zVjf_iurxB?Aks-=KtDb;i0)H zCPo!soLx2d71V?4bq ze;{n093f5e{8>1+!ovBLDhy>6SSNI|gv5pK%7;k`uy(^NCSwVy3UpJ&u>4zT8?2jY z09ZJ`!l?_(06cqeC$lqS04%Q=dNym8BVe3htVSt)vfN7n7T$Sy>A))|t|U6nji=3C zSC+%_n!);k7VUhYNC-l8zTEE7Gj>CBGEV5)1W|IT0RX^Sb2icPc$PNQ*B)3~r(=8r zfUz0Y8W6}_sLof`I@rwiwc#9q^^j!=IL-`+hq;%IzL_d{qM}LFr{$H(x>UOmr z)?NDB#Sfm@vB3kzc9uqzX7v`&;$d)ZTN6@8zq}7z02lNh{ePej{sdh9u1&UO$~gc4002ovPDHLk FV1m2OTJrz^ literal 0 HcmV?d00001 diff --git a/images/menu/digest.png b/images/menu/digest.png new file mode 100644 index 0000000000000000000000000000000000000000..b1d2aaf974153ee9c1e708ebeb9d1de75df392ac GIT binary patch literal 1354 zcmV-Q1-1H#P)A_s`7i&aT%Rb`3_v2vH!#qK{kw1rbz6 zR7h`OA-)CgcgQDjfj}Y!79A-pBwU0Ny8s!>PQeDy8pn>;yLkW1+_{s&I~R}bO%p{a z!jVQ=?S1Y!&pr2?=Un(||FVe@zyE1V4+qu26mSZVf3YDRVn<;ZVltnjYykWQv@!yx z@87@w`t)f$&&vh3)*d6E0j#xr{`{F{vx!p51{)KyxWW1J=Up%% z1jZQp{XR*O5XUjIv$LdWN|Gcwr+a&Qc%Da^rrf!6hhDG8{Nl2Qt5E!}Q6+T7gSzj*Ot z^;j;4X02s)b#?pl<;(Sx)`bwZTrO{KY-}t%dGh2Z4RoR?S^|o9@813Y^z?MDe-CZs z?c293FE4M-&CN~5aeN|yX0yqQ7cVw%-MTe7N?G^!_nDuckAR;u9q0p5*0V>8B@+>? zHA*Sh(??AyMGyqQL1&#*bV3M<#Uj>P1;}h@2tX*MD3{A@ZEfLs9_4b`IhInQltL+m z)|#E29oL#;V`B&*+&X~gd9+$BYPA|#f0<26Df<1s|T(GQ-f*_z! zD3Bxxj~_qg!Gi~GexzxNwKk`qj~+eBwQhzHLO7o}0;N)kG)?*V@gucbjW~{p0L^77?Nu3o*0lrkq;p65|2mE8YX%N|wMtUhvcJ5w%Wj2k9WN>>-%ZWqt< zSYKafW@d)1tu2f($3#nOO%z4W->~<;oOSb8D=O@X)XiC7^bJEsZ=WTdOZN*IHuih(`vQI zM)uUy6hRPh?bC~~6J>2%!CQc5v5H%AzT3np(EFrW&Y2ZB+~ z0mH#{oh$@j4r7LxQO`FE`~kc_3UCjF5tbgp{aws)x&3Ni?LTRM0{o+&HLvDUnVgLXD literal 0 HcmV?d00001 diff --git a/images/menu/forum.png b/images/menu/forum.png new file mode 100644 index 0000000000000000000000000000000000000000..edc18f25fa3210ed3edc4936f05cd5a367995fad GIT binary patch literal 1739 zcmV;+1~mDJP)WrZ_()UY(n14u7g!1l%dQK% zJ3Bkb>&hG$%MHZQN z+#PbHf2&;D^nAyk4(|cvq5|}vK6PU9{3UwIRugGm{{5pzkG{B=5OT%KCtvu{xyd7c zJ=KMjl0+i$&3E2B^h*}09155^@m|*n*LBxyi^+AbnM@PrXg`Cca0eU|1G~eyM#vg~@ z_c2|23D>p$u+jd0@5IE!W*|JX`0CZG_au|a`v7-ZC6dYHhkJW_H&Q4qfEpVc+uYgN z`4Q&Hc_Z|;_yiH$sT}#fq_q5zI<7>x3~YzaU3m# z5dHoA4_&-?@!F({UEI({L4di!Tq{hw<=*~T_Xh#sRh1>;l`ekuZi4AFBRxl`vImH^J%Y@^-OIj+ z5Vt4rzP8)hL4bPCG!7^8xTBMpU#UG`-r-C4+6nx=WnR6 zuM=Er5o3y6Z2R>7D-BQ=3)K>=jF3qs=LgvMu;&?DJDT?KZsf_Q{i56mgcP78cFnT{ ztsvd`Yp`z+TxXb=)TBe(3#Ve{ks{L-2&e49@3oHq;pyIa0pgE56<=EE$eQXPG8Mqq zgyyWd8R7kV$vT4c>HS!9n6h;-yzmxOq@iRMK7=ID+?E)Jw*Xrbz>C&3#{&YT6auhv z?h8_}@zBP72q8$GdAt0Ma^*YnnpT z27u8JG(_f&zF4a7|2+8(n;AI%I-_qNrslKXrn0*Bwly_CJmj?u70RD4T>>GSW6~#^ z)##}y%=kFQ7_`<4UahqR0s+DsKF7b$zQ;??KF6+IyO6U=xFi~E`d6VBOqB#^z;7HJ z(rB%bBUy5TQ)pu_TBEJOV$oPE25l|I7>w_ueGMjyqb3PeB>3{S#~2>Ypd59Z{g`kX zfdG^~1!751)HgRp3$yVUEU&}P?rhUitQSJeiMEuqRtBnxu84Bu{h^YpYlUtULQp)U zlqH8!>gKo;=K#&+QmFbZ2`K#sM3q~=z9_6aGWy?0bA>_@PXJ{a95oUpX)CLaQ@}==!)E)aJj!s23!$y@lxSX zPPhU&?Ud=4pxc_fEdtSCOyO$t8Z+f%vpLL^kD1Cr#awDzr>D#3^UYnka^>xj0&veeT(f44DL+5|Q=aF| z=l*&Y_djjN?6Pv0ISYD2JvjgF8H{_U08_tRmc_E{K>)J=Xd?k&o_Dxt(W2!X$Bp$} z@!{bo_wZKX_fhC6hKJ9=M9*X_82=sI-+d3A{!Ta?j%kMu9a=Dw;==-%&E|!PL;{VU zUBjH5H(?d*FsLGoyb&Tb!of?J=9q=sUp9kb7&x8IuNMHoXtUW2u~&q{>V(N^0>iT) zSu7Zlg~@J0mfZv8p#nuwplRCJkpet-1`>%x0ssVy0i42tv#?+s42X$8Wcqdf2{z~Xtb`cuW!D6jsxMp_rgh?U@QcTlYt)8p#liTy5XAbLNb{|AP}e@ zN~gTMoLjYO)em`|{}#)#9g#@nlQnDBJOGBdg4){JgFQVx$#LHpht_-_zs>cE8?9vSzsujYer*UETU4M~*zzfqnb- zEzHc!{E%<|h?XztB_8fy2!``428-KPQ&aQ#a6^cV8#jJbUtj-0Fc?(KlT9%FNC1AU zLHq$vdc__@qfvBpbe!F~b?d>Q@)?GC1!@Yf7B&)>sSe}wnjnd{smWw|1sMJ>004c{ zrcK-S@83W3`t|Gko12?kL!posjYi>exj+a3!!Qj1^dXaV9X830P~U5mrxC>C929W| ziN#_*V3;9%GODYquT)o8{{#S6QBg5<#flY2tyXIer4)i7%tpVh)4_R8r*kf)6v52* z$ye9zQr0*MY0l7d>eOey0*0A^XLaP(ty>REOG|q_9?y3N0CJWrSz@%??fc^A@h+v5a2$`MY7Dis-TQNOb@fk=9zEI&yudPgR;*sVx^&sHWmj}v2g|ZB z7!2SzPEV)P!Bi^Mt|*F45QHK^`b&gDA>ZD;d*@%caN+)wIxl<$gJZ^w88ZnX$j;7& zEX%OjY*1B|F&d3o9*-wWQ549sjCec_LI`f$xUp$)@s|eJwQJY({QUf1yWMVt!(lWv zcjDR?%?KwbOa_9n*&^o59E+?h7X(3oEX$~>s=6?g)`(|d!-fsglqplryWMW7t?eE@ z{!0VS-KOwNo&?sD2haGiIDaF8(`Q@Y%1C3h#|f5YQBY8D^~8x2H~#Mql$4abFG-T8 zqoWhs_g_cYoQtA2N?pE%V;#3BasN|n&Z?qu^5cojFeSCpM?kS5RtU-NLvj^+C*d&j6r+S zia>V+EX%@bway=`Irs|5wr$%Av$C>A%d&iT>(;I9PaZlPjtWXC`uh41Oo?Q)#{tnL zLbDnWCIli&pi&^lF)(Bsp(a(Ba>wA_gI0{ob3;|tqGtkZ-@g5|l9G}?IvkENUDpW! zT3T9q*6;UMMx)WYcDud8VzIoVswy;117k3PGx6YU0tnBbk1*(WAOgZM;EWu23lH9$ z0bQpU$a|{e8~|+DvZbi3tn6$mm9%|v{t#GE15rdWrSO~c^78WL#bPl4{l1<~r=hAU zBvZfj6OI942na_&7}9UXnhvTF5T1b=k0U$Bgk&-aP1D*3126zEY0{(*)9JMB^M>ES zI{P6ee2;;7jvuF6{sd7J!LlrLy}w{M9EPsz@Ot`apPYcM=l}r-!}P`5SEG$fcVHk9GcXuB?eE7?u09Zi~jEa_ml$!}o zWFT@j7z`q$91D_4jB1*ONF)-zbLY-ij~+d`($mvJMT3A9)6!thUqJ7*0F-ba)R+P_ zmPRU&K={-ZEE1cLlWjsc9Hwn;Z6CC?wLSG_X((E-rrCU@(x!)2?Y6y?OKIZ!0S+-@_0uo}!|nQHvKZelH^< zqargibBw`YAeyGpXfzs$#bRd~8XA66TU&b(Lp)Rl0{{TCbm`K!^7HeT3xY5@l}h1%&#EP)89%w>!@ zh8ttTf|=rjEFodO7)Xpp?`=$c5Ht}JVtfN*B1+;gj7%X5pijmGeHq;lnF%l^bM4mk zuI;_|93R@1Zf)l}j8A^amvip9=lj0j`F-E{4)DJ`f^_cdkURHv$dBTKE!VKUqg^(* zp$N_!o_y*F1aAyq{m%fjzR)U9OgvEZgn>j{!)$D}VN2x}j0}$y41yGD(9+r>he9F6 zESbgLj=h8sg1){!Ll-);uP9LlE?f)%z}7myC@!|ZT5N{ZV#fJzzRekn781OvrCFYw z3@MVyjJCFRQdM1zN}msHd-kv*YQl7QN@;FsmI0va#Wq~IbP3;I9Key@!+CucEj4&! zbCWz34lA}|n|QgqoA~{HFqX`qXJ<3qE*DOpIb%#sN0i3qCIG)TWo~#q9y&5Sj7TKXAW0I+%e^q0CHy{m z3tyc*7g!bp+Zr0=nMg!&mX?S^hkA&=t`3yt#_ip)18%n)r%s(Ru3!I^S*i5g>SWNM{ z%h1!)Ln^DPpc{JrljmTfq_h-|Z`_FB&=76}N3dqYdW_wru zaqQ?(@=R?lC@tu=J`^D^a`PsXKtK%N{Ee8+7Uh?pf0~zyc?|e!{c=1WQ`S^eptrY| zY}&j92`zzGJictT+U(f8X%o3IG=#D7@rKpw)?@tM-82(v2AW!1<(bHgqQ%tM$&XK3 zYHDggNx_XWuZ)h4qWhKZm;q*SI33F1z(4@VC_;-QLD+49mX7D;^&1|;WGMWv1qT3o zNeK=d*lRi8Klq+SlG5vG02liD0szp}xl1lv>B{TqyH8)6_br4-j+}!Ff!)2Q^MkP4 zaqaTucQe*r4nE&to46yU1u0?HGjs}(ufKs?! zP6z?K`unBGYTd82J+d`LKw&=oEwN690?9+MiPLD%>ghLwOtYeb2X4l!c$Y|AHRjO z)dGPcBrAv|M@9rXLw}%+QaBu?xdG&0AnUbhZ*LVQ$poj<1=mU^98M?9k{Ogyg#HR+ z;=yFz69Ry@+yjSW1=OetRaG&oMw4Syg{nqz_T2e-F$;R=|0y^CjNkvW5SM8NND2(e znA1G#WPt)eswE-S86Yy|i;fFZkO?TCF5H(1U~axpbFBja{swAquZny1>MH;M002ov JPDHLkV1k$PfMWmv literal 0 HcmV?d00001 diff --git a/images/menu/index.html b/images/menu/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/images/menu/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/menu/order.png b/images/menu/order.png new file mode 100644 index 0000000000000000000000000000000000000000..ac20f8e1c424114edc339e7413947a485713baa6 GIT binary patch literal 1337 zcmV-91;+Y`P)q$gGR9J<@mrZXQRTPGwu{}u4)xYBL_&2dwjL>b{HnCU?%i4py zbLY;tT^jhZB&o+`t9lj?Z+V*;_ElILjlo9N4Bx*u0Wb!9eo*9%MuW-8$-7+yo^I8t zTJ4E3;ircgjA=RsWZeTM4#EXM2!ZRmXsxX-0)K9KI3{4fj!g7z88A`w&Gd(JbfbDG zxKb(v2YR&O_Lj?z=#lb$KUxfo0n5UQgB`O-iW-4ZT}ut1jfDYfUX_N_2x)M&73(7K z^QW_I{t*(^dzMu#(Otnbngy4kW(w-~f(maIvv`4nFD#Rv!?B5=?1SiZkZ zCX>N$G;kb;`Pm$QZ#lR@sDl=u-ita)jR8~ZLBJS;5CSP>bgCI+P)bGac^;)wnRp_> zz5C0QORKzp`7(__aPvwQp;WVrjA`xDI@FBbJKVIURIdEfMZmHwY}>}R?P#nix&WmV zj^py=$tJ$q~Os;zh>C$Enq7y!+EzDT-Rm!!3vd1 zg>tFH;NT#qPE9dCKTkX!k4hD;I|w)=rSJxOE9AIqhHL}@k zG(WUrvB=KOj+;)WZ@23wBo(GV2m&@XHlFs>Kr)%c7=vxwR4Nrpr7~W%%37(!&`_Fe z_B8o?K8jpQiBgLG{(gcWpwVcQ7Zw&SbNGcs^}G*+Y#qm8Y3UD!GDB2$cS)yGo5QVh$Fau?uEp092OUs$Ye4Ue_uohK`u8>ebxZTFIW6m}o{W0t)#&`BvoZr(vf{DPJxF*REZg z9vvO~Vr+ao7J{ESGf$yVz_#r!v2}X8243V+ngF_(P>uudhid9;8wys@vP!ru{JKR6Ve7 zEX-21T7AS3{*(Y%Z_MYvzVyzePZ9}R`+?3B^z=eucCPZ_ v2UqS+O--Ex`u-Q-4od;!K=M_9zf$`bh1ma)s}GZ<00000NkvXXu0mjf+{%Sx literal 0 HcmV?d00001 diff --git a/images/menu/permissions.png b/images/menu/permissions.png new file mode 100644 index 0000000000000000000000000000000000000000..bd06d335eb29aabb95107488e44ffc9fdcb6d392 GIT binary patch literal 2902 zcmV-c3#s&pP)ZO@k!M)k>u@4#yFjo11UvdA`W9Y~IJRn>=neF$@EWqBxQy z%}J8<3qr_ix88c|)c*>2^UXKuWHQ-JQB=Rz>+Sb?y&ZnPpQdRVs;WUzfE{W4=2|qpDUKQ*=X3`#q;t`U6=nX7OVM&-|uG~rwYe$AP9mj%kl-D z=U)ZzZ+(4zxf=klzyA93U0q$@4u``808~wbrmBu8%CqHi@t2lG1}JkLUsbj^pyOEE7TqLZJ}c41<+i?pUI>_D^>2-c=kKxqMsu z&0U96^Vw6jrGD4vjnvoI#o_gOK~ps6cDuhrQznyLS*A8bJD1{hp)6mtcJaKhRaM1@ z0>R+#2K@d&EEe-dqtUN%9Cy#~@bGH@9&iDG<2bXbs={#`NRotLFo@=+rmw52dU;}E z;+dJ*g}t4fo4-CkH}`vqL}E^qhpy{HlB5y%($a#H&ld{onwz#6hVJAGMLQY^!Eqegwv29yxT)3rN-`7^%jJH}^ZY;5 z*4Ew}3WZ1{5~0@L)apbdp?E%*1uuwXZL)D=V=@Vvrcf?(M3zLrsjAU%z!wX9LxhlS zp5st1mm!KGR##U`(O7JytE+qSjCmkS!IEN1(o;D1#g*eVS0I+RW+twYo zA7tDva%ud+sGpU4BuOISa2T;z4Dq-JU)u0|Ns!;V?TXisI9RcGqm~*mzJ;Rfgxe zoXYc);h?{Bd3hNtD=UQOd6=dN!!R6GGYehawU!Nz03MHLMv)bGy&l@KtmK0aJ~%o)H8-S;gmeWYiWmtAYt#OqpG z*C$j(Mx~gArfE=B6+WLIx9qsxnMtSU56_Pv81!46on4c^fB%8gejjtlo# zO_P8us{k;61HkL`&IkfuWtduurrphtKKkg`2g5_pt!-*)N~Kco#A|CPhH>u`xDq8w z5_H`FK^3NH!nS2xni!)><&w`d^aX)8U*rYx`=^J`y02WG@Bnzkw(UmKvMEuNK-2Wp z4FJF2pRH6XoL#kJg;KHY@y8zz|K(qO_gGDB{Lg!D-FZi(CPB~6q=_hT4$lb)2Ypag zjR=AOjuV|&TqBIj#ctTNxp_?@{C-#=9#OOX~r}~+4l6)Pg8gA|5|S-93%7d^R85S7(B-#6pl!4k53ULsYaFrm#V5D z6e*W0m8fkRlqgB0uo{bWb#5pvFE0-~|Ll`F0BdS%Ynx5e#L7yx8jVKhZU6xA=(@gW z7)Ez%Yis|`ojdP4KXQ@O#C6EBrhl|Be>oC~Hnz64ttsS-!Ms?)wKa}VC{okh){a6x zmzkYO+pLditZ&>^6Anio_~)Phe9zF};6LSZx$c&h769N9iNwnFqV%T#p`MC&Z&B*~y%w0z*3_tm@IUN)1ts!d(F>`=sU2m!6@It;_K2_d9vSF^kK z^u_(GPtRtu_SI*9{uWFcm0l{C^r?0MOV38UU>N7hhGF>e-_}WtE+2hXlUr$ zym_;$tEN_3axQOT|2E7#h(u4S`^!VaKl9>IIR@ zOsA%l3m48Gzc@PbuS-iyOIx;VY1p@KU$ZRBB$LTFxm<2=e0=;Q0ObY%0A*oeVLp?| zq%6zo_W69#EnB*i`}gnf{?#wvI5IXd_I_(~%f3=6&sc^oR;!j*RaH0u(&=fW)2U-G z{Nte?FU-%S_U_%g@$lipf79FByY1@Lt7LF+P*0^&M~)sn`n+kHSpe2&0l4;E)S&I4jj0pQZB8&__G&AX49#3+xnY41gO_E4cTn=?Bu11bI0C3 z_OjdMGQRh{N50kH-~XLJAXq;>K86z~PFy{C^5j!PLqji{ra5=L{r?l-dM8vxQ3@9? zUK|aDLN%sow#Q;o&$eybws&-NXfMC~(m>Cao((MPYgH5lwr#)h`fIPf+P8Oa$CFP! z`NYnhJMK~xl{tNS$Q~RV{EuVDj{P8$$-E0-`P0Qe4*&oT0KHnRR>sE0#u>(C*|xo< zzP^Fk)Um1g?z`{aG&eVE`+UB&nx=v0`SJbx@44lH2fp>!;Yg$*J)I_J&z=#_oH_H; zci(;YCx&5+0Vn}5KU?VY0M}yx;8UqoO4s$(YPH(KvMk%QZe2VW3?>VO0#Q{JyLRpB z_{vxMb_4m*0Bptw$y%CVqvF_r7$kvp3}b0stQmi@3PBI6pf(dx>S) z4ws9GyWMV5C={S+8j{Ji?sB<8jvqg6OiYXq3=9lBUMiK&0LWdt#OLOV0B}t&3xbfF znwpwOBogh4qBIafh^A>+UClY^bUHsYH1x!K@4feuWmzcz0EG;daI&$R5->1{*cko|>=6sPuf1{t%PrbteXgYZC;2%{g74zuP zqyG+I0f2}vaO?js;CkHGAOs(8H3MJp)}PLQ0&khyR8B6$9RL6T07*qoM6N<$g3kn` AVE_OC literal 0 HcmV?d00001 diff --git a/images/menu/prefs.png b/images/menu/prefs.png new file mode 100644 index 0000000000000000000000000000000000000000..faea90be5daa53d9f18cc0a6b635f40ea71b6405 GIT binary patch literal 2425 zcmV-<35NEGP)q^Mmhk(3yfV^N80 ziKawRBp=@w-~F1I)5U#yqAa#Oz{A{o-^`r<{h$9iXRa`|H{X2o%hS`-G@DJp0$?o@ zi=ya(@t)c7q`lAW-i3QC%QCVo!#T&zn>T;{^2;yp++QX3pTyW|qdA2!X8e;q*9IdN z8}0c|48~fFF<4^|BUn@38*30iL;wiElO!pF!GPg#NY&au0^Xhgh~ucWxznw`w=p1! zEKy`Z3?hOcpbDyJfZ#*9IRXMGs48d}kK<=3f}pBs2o!n2bWM2rcOIv7022UF6fx)x z_^|dE)Ag7~nl*w5{X+3BkS8gl-GtE~B~2V5cLr2?=~KtdYec3(s5*iRXix&+gC~T5 zxcdwMWP^mQyB%(=ZQ%2SC+B7eKI{j;fWUA!r5;Zsk)dt`H5MOATLJ}7wz6r+T+Kg8t@8^uT* z5mCj5wA?&+Ae6cgLkJ$6dsu{GEZ)S-wA&m%+M<;U`K5J2=1Pi_9KV|pvVxFjggnEK z5`yyt=fNv4KmQn0%^IT0rT16)k9V)3z5o%#nEyiqkwH}H{`xk9re*fbQ8sRM*j?{p z1hfdK3xx6L3s1-#E_2`tG=LSuOJ`3oKYy4wj;WFJpTGE+kSSV>5ML0AG7H=%0Yo-J z05=%&vn#8-VGOHVee(595CH|jpdo=IqG@+U*0#xPU!- z`f*;kvc@|XS6H5J@y9QoAsG$#*FY3Sh(a+KaHq)l=`TFZdKK3jpuq!zh@d_Y8+i4r zPxAHWKErP6xPGg{v!|8_!4t0Jt|nymIvL6u~PiH@c_~ zXz-{8Gz3E7*dBVW-Q1ke=$xlosZfbyj1lrYBaUMljrydqsVb^UQ51AKJG5Hu2Q^R% zLy)-2PtITACqKQ$$D0FG1iXSMVgwUK96Av5#nZGhGe1Aykb40B>)m%pAAWqd{&)X!1JQt3 zi&%p(77;@n8~)_^Wxn?GF+%X=luH}FcBI8hZ>$2PA^jwjwDG? zRjiE&!BeYNg9u>);O)2H9;HR7U)=y>05M?76OAYsfrTm0(S?J1Wll00AyS@>qBugu zOyV89r&@{W^?J11ZHmGX$5FZGc>N><&IgVyFY$YypCzc4aSP=b#_Cx@CFanfgQ!xb>DYM`MTqPHfChs1cwY+Uo^VP4<#n&u zW#i5rn#~q7vok>1L+bT9-UqC;42MI420~DpjRtWX1A=qz{`pXq&i3{t=ZX&|09IF5 zzp%EpCgp;M%{eDUQE=nNjrs>4eDJq_^TQuLSEf~2)vMJC)*3|6G)aA}Rx^m0D2lMw zlI8gXK$;}mKl;%>e&yV`bK4UDue|cg<$XPuwZZ~15Km7}&mK8)B)hw@!P3!X;{>Tex2hdPGGH}C<=d4;_4IC<2R)ZE-lX_C}ONg}6C zonmuylf#GSCP;%X)nE3K(oq~m;}%{zR|wv_#2DL9r0Di~E0-@{-n#eJ57=w3y=G3H zJXy{2{BW<=JEp4N%nSd!^?LP*g@uL2r;i=C^?H>M0@YfL!C*k1Wf)_zksX%^0THYb zMoGHa-Rb;$nq}`ESv>NcBuzg2)s-vXef8B>ukH%~KvnJb_I9(;XtbSkOVw(1UR9Si zHa6zg*Vh-4BsoB!(K^sN&~CR|fJ@Uf+1c62nysnlD%GkH;Le@(UtYR+@!O-(==MAB zywh7;T%229U*CG`t+)Dnh4zq%h*#BJpa3#p1Gv4kwA5Z&TABe40If7lTU%RO^-ib5 z&6_t_U0s!Do_+S2TCHXTWovsof8&iej`aKedcWV_$n(4pILgcl|0@HZU_%(E;r8}+ zJUcsE0pcV{;w;PTd+)thyL0DGYcv`iQq_Y|6n(Z{ug{1`)a`cHcXoDGI-Sn#Teohl zUbt|fbM4x-0gyBPcKUw->;t3%#Dl@0VvLFU{eGp9F5Q59HEXlHL rn5JoR_wL>F!i5XP>#x5a_U`*X1a~=J@WY-w00000NkvXXu0mjfq9U2M literal 0 HcmV?d00001 diff --git a/images/menu/prune.png b/images/menu/prune.png new file mode 100644 index 0000000000000000000000000000000000000000..318a3643e5610123cf4a8bd55c8bc1a32a76ba22 GIT binary patch literal 2081 zcmV++2;TRJP)Y9K`W9jvYHXW6MMkM zlVs1+a{Av>dbjCXg#nhDv;(&5I67hZ= zAnPFwBwTW0AQwS~!5IdLqG=h5s%8YIPwBdIW=Z03%RV|kQNYh0V&Odx`I^h7*PEIH zhy~aaU;!CWnm64BiGd8|$R!HSAjkm70LqDCM#9F_%5y7?QLB0H2V9uwA=AKocNYii z7WwDtG6|>v6#=arR2gVxpjCtK>tM_WRh%bXTnFq^kZlELqL?9&AuPL>_C0;?H?HE# zo^?3~Hom}9i*Mv^L)l;@Jxenl(qJ?|@NqC^g7ROw7nC2g8qn*(J_=3`IOoAR2hs~p z4;oP>RY=XE8U{AM!~XHkM4{F~olX$!#7sg4F@O2GEK?>7ar@5k#MdtmE!i3zP++Qc7xlbiDZuN}yC@7d=!qp9|2L5bB zB801|SgIvG0g^YeF;4}j!l+1>U6Y`qw z&GNM`F~caWpd>a3$y1;W6^`?VUd0ISLeoGy{T?a?n&$Q(r3&pAahs;&fMbJgfn_DJ z?KW(optPz8%o->zrOW_Grr~5a#Lqy;bWvOc=Kf9ieP9@1=%DMMYn}+@iNGTlm)v$h zuUkpcik~9_$?iRz-}oq5D>p{sFgfAQHR8jJ7y;0OU|Enzf^9=O4YTh1HQBQVNS'; echo ""; echo ""; echo " "; @@ -372,7 +372,7 @@ echo ""; echo ""; if ('add' !== $op) { - echo "'; + echo "'; } echo "'; echo "'; @@ -395,7 +395,7 @@ echo ""; echo ''; } - echo ""; echo ''; } - echo "
    " . _DELETE . '" . _DELETE . '" . _AM_NEWBB_TYPE_NAME . '" . _AM_NEWBB_TYPE_COLOR . '
    "; + echo "
    "; } else { $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); @@ -412,7 +412,7 @@ echo "
    "; + echo "
    "; echo ""; } echo ""; From 6690a27cb43d812bab5593bfa6e29315eaa8a3d4 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Thu, 14 Sep 2017 13:42:58 +0300 Subject: [PATCH 057/170] Edit message --- admin/admin_type_manager.php | 6 +++--- language/english/admin.php | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 65e2b75a..5c2dc706 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -107,7 +107,7 @@ case 'template': $typesObject = $typeHandler->getAll(); if (0 === count($typesObject)) { - redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); } $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); @@ -279,7 +279,7 @@ case 'edit_forum': if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); } $forumHandler = xoops_getModuleHandler('forum', 'newbb'); @@ -289,7 +289,7 @@ $typesObject = $typeHandler->getAll(); if (0 === count($typesObject)) { - redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD); + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); } $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); diff --git a/language/english/admin.php b/language/english/admin.php index 33e35f3a..a8574656 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -257,9 +257,11 @@ define('_AM_NEWBB_VOTE_DELETEDSC', 'Deletes the selected voting information from the database.'); // admin_type_manager.php define('_AM_NEWBB_TYPE_ADD', 'Add types'); +define('_AM_NEWBB_TYPE_ADD_ERR', 'Error. Add types'); define('_AM_NEWBB_TYPE_TEMPLATE', 'Type template'); define('_AM_NEWBB_TYPE_TEMPLATE_APPLY', 'Apply template'); define('_AM_NEWBB_TYPE_FORUM', 'Type per forum'); +define('_AM_NEWBB_TYPE_FORUM_ERR', 'Error. It is necessary to choose a forum and not a category.'); define('_AM_NEWBB_TYPE_NAME', 'Type name'); define('_AM_NEWBB_TYPE_COLOR', 'Color'); define('_AM_NEWBB_TYPE_DESCRIPTION', 'Description'); From 379ce6c62167a1985696c435fa890d5d2cd37489 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Thu, 14 Sep 2017 15:06:17 +0300 Subject: [PATCH 058/170] Edit
    --- admin/admin_type_manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 5c2dc706..29d89930 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -14,7 +14,7 @@ include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -echo '
    '; +echo '
    '; include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $adminObject->displayNavigation(basename(__FILE__)); @@ -220,7 +220,7 @@ unset($typesObject[$key]); } echo '
    '; - echo '
    '; + echo '
    '; $fmform->display(); break; From c44527cf85089651b0b861933cd14e4eb3bb9447 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Thu, 14 Sep 2017 15:29:44 +0300 Subject: [PATCH 059/170] Cosmetics --- admin/admin_type_manager.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 29d89930..be154437 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -115,7 +115,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); $adminObject->displayButton(); - + echo '' . _AM_NEWBB_TYPE_ORDER_DESC . ''; echo ""; echo ""; echo ""; @@ -149,7 +149,6 @@ } echo "
    "; - echo '
    • ' . _AM_NEWBB_TYPE_ORDER_DESC . '
    '; echo ""; echo " "; echo ""; @@ -296,7 +295,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); $adminObject->displayButton(); - + echo '' . _AM_NEWBB_TYPE_ORDER_DESC . ''; echo ""; echo ""; echo ""; @@ -333,8 +332,7 @@ } echo "
    "; - echo '
    • ' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '
    • '; - echo '
    • ' . _AM_NEWBB_TYPE_ORDER_DESC . '
    '; + echo '' . _AM_NEWBB_TYPE_EDITFORUM_DESC . ''; echo ""; echo ""; echo " "; From ee41631475c57f32b3d6926fbc43a2f5329f54af Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Thu, 14 Sep 2017 17:47:59 +0300 Subject: [PATCH 060/170] Add message type error --- language/english/admin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/language/english/admin.php b/language/english/admin.php index a8574656..59961c09 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -259,6 +259,7 @@ define('_AM_NEWBB_TYPE_ADD', 'Add types'); define('_AM_NEWBB_TYPE_ADD_ERR', 'Error. Add types'); define('_AM_NEWBB_TYPE_TEMPLATE', 'Type template'); +define('_AM_NEWBB_TYPE_TEMPLATE_ERR', 'Error. Set template order'); define('_AM_NEWBB_TYPE_TEMPLATE_APPLY', 'Apply template'); define('_AM_NEWBB_TYPE_FORUM', 'Type per forum'); define('_AM_NEWBB_TYPE_FORUM_ERR', 'Error. It is necessary to choose a forum and not a category.'); From 007af3e4edcb9fde476d5c88e4c25da64968a3f9 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Thu, 14 Sep 2017 20:59:36 +0300 Subject: [PATCH 061/170] Type manager --- admin/admin_groupmod.php | 3 +-- admin/admin_type_manager.php | 6 +++--- language/english/admin.php | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index 28535d4c..64ea92c9 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -97,8 +97,7 @@ foreach ($groups as $value) { echo ' ' . $value->getVar('name') . '
    '; } -echo "
    "; - +echo "
    "; echo ''; echo '
    '; echo ''; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index be154437..edecc572 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -164,7 +164,7 @@ case 'apply': if (!$templates = $cacheHelper->read('type_template')) { - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); } $categoryHandler = xoops_getModuleHandler('category', 'newbb'); @@ -283,7 +283,7 @@ $forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); } $typesObject = $typeHandler->getAll(); @@ -365,7 +365,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); $adminObject->displayButton(); } - + echo _AM_NEWBB_TYPE_HELP; echo "
    "; echo ""; echo ""; diff --git a/language/english/admin.php b/language/english/admin.php index 59961c09..c2f0c880 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -271,6 +271,7 @@ define('_AM_NEWBB_TODEL_TYPE', 'Are you sure to delete the types: [%s]?'); define('_AM_NEWBB_TYPE_EDITFORUM_DESC', 'The data have not been saved yet. You must submit to save it.'); define('_AM_NEWBB_TYPE_ORDER_DESC', 'To activate a type for a forum, a value greater than 0 is required for \'type_order\'; In other words, a type will be inactive for a forum if \'type_order\' is set to 0.'); +define('_AM_NEWBB_TYPE_HELP', 'Allows you to create \'Types\' of forums, to highlight forum topics. Example: [Important], [ATTENTION] etc.'); // admin_synchronization.php define('_AM_NEWBB_SYNC_TYPE_FORUM', 'Forum Data'); define('_AM_NEWBB_SYNC_TYPE_TOPIC', 'Topic Data'); From e7c59ac4b6dc4a918fbef33ef1b9ea0cdf5e0eda Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Thu, 14 Sep 2017 22:42:18 +0300 Subject: [PATCH 062/170] Fix PDF --- class/post.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class/post.php b/class/post.php index 392274ca..89f9c3f4 100644 --- a/class/post.php +++ b/class/post.php @@ -622,13 +622,13 @@ public function showPost($isAdmin) $thread_action = []; // irmtfan add pdf permission - if (file_exists(XOOPS_PATH . '/vendor/tcpdf/tcpdf.php') + if (!is_file(XOOPS_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php') && $topicHandler->getPermission($forum_id, $topic_status, 'pdf')) { $thread_action['pdf']['image'] = newbbDisplayImage('pdf', _MD_NEWBB_PDF); $thread_action['pdf']['link'] = XOOPS_URL . '/modules/newbb/makepdf.php?type=post&pageid=0'; $thread_action['pdf']['name'] = _MD_NEWBB_PDF; $thread_action['pdf']['target'] = '_blank'; - } + } // irmtfan add print permission if ($topicHandler->getPermission($forum_id, $topic_status, 'print')) { $thread_action['print']['image'] = newbbDisplayImage('printer', _MD_NEWBB_PRINT); From d19572bd1de43c0a72f4cfccd68ef37cc4cfdf79 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Fri, 15 Sep 2017 09:45:09 +0300 Subject: [PATCH 063/170] Add help message --- admin/admin_digest.php | 4 ++++ admin/admin_report.php | 1 + language/english/admin.php | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/admin/admin_digest.php b/admin/admin_digest.php index d9c33b09..6556f66f 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -87,6 +87,10 @@ //if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); // else $adminObject->displayNavigation(basename(__FILE__)); + echo '
    • ' . _AM_NEWBB_DIGEST_HELP_1 . '
    • '; + echo '
    • ' . _AM_NEWBB_DIGEST_HELP_2 . '
    • '; + echo '
    • ' . _AM_NEWBB_DIGEST_HELP_3 . '
    • '; + echo '
    • ' . _AM_NEWBB_DIGEST_HELP_4 . '
    '; echo ''; echo "
    "; echo ""; diff --git a/admin/admin_report.php b/admin/admin_report.php index a66b35e6..d3070a6b 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -113,6 +113,7 @@ // else $adminObject->displayNavigation(basename(__FILE__)); $adminObject->addItemButton($title_other, $item_other, $icon = 'add'); $adminObject->displayButton(); + echo _AM_NEWBB_REPORTADMIN_HELP; echo ''; echo "
    "; echo ""; diff --git a/language/english/admin.php b/language/english/admin.php index c2f0c880..168abff0 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -70,6 +70,10 @@ define('_AM_NEWBB_PERMSET', 'The permission has been set'); define('_AM_NEWBB_PERMNOTSET', 'The permission can not be set'); define('_AM_NEWBB_DIGEST', 'Send New Digest'); +define('_AM_NEWBB_DIGEST_HELP_1', 'Allows you to create and send notifications about digest topics.'); +define('_AM_NEWBB_DIGEST_HELP_2', 'Create a newsletter is possible only after the topic is marked as \'Digest\'.'); +define('_AM_NEWBB_DIGEST_HELP_3', 'The dispatch is made only to users signed up for notification of digest topics.'); +define('_AM_NEWBB_DIGEST_HELP_4', 'After creating and sending, do not delete the created messages. Otherwise they will be generated again.'); //define('_AM_NEWBB_DIGEST_PAST', 'Should be sent out %d minutes ago'); //define('_AM_NEWBB_DIGEST_NEXT', 'Need to send out in %d minutes'); //define('_AM_NEWBB_DIGEST_ARCHIVE', 'Digest archive'); @@ -225,6 +229,7 @@ define('_AM_NEWBB_AUTHOR_WORD_EXTRA', 'Extra words by module Author'); // admin_report.php define('_AM_NEWBB_REPORTADMIN', 'Reported posts manager'); +define('_AM_NEWBB_REPORTADMIN_HELP', 'Allows you to view and process the user\'s appeal to messages from other users who appeared to them not to comply with forum rules, etc.'); define('_AM_NEWBB_PROCESSEDREPORT', 'View processed reports'); define('_AM_NEWBB_PROCESSREPORT', 'View new reports'); define('_AM_NEWBB_REPORTTITLE', 'Report title'); From c4d756540650dee169def5bb4d91a73aa43a415e Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Fri, 15 Sep 2017 10:58:07 +0300 Subject: [PATCH 064/170] Cosmetics --- admin/admin_cat_manager.php | 2 ++ admin/admin_digest.php | 3 ++- admin/admin_forum_manager.php | 7 ++++++- admin/admin_report.php | 7 ++++--- admin/admin_synchronization.php | 3 ++- admin/admin_type_manager.php | 8 ++++++++ admin/admin_votedata.php | 5 +++-- 7 files changed, 27 insertions(+), 8 deletions(-) diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index 0bc4018c..cb3392ca 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -178,6 +178,7 @@ function editCategory(XoopsObject $categoryObject = null) $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); $adminObject->displayButton(); + echo "
    " . "
    "; echo ""; echo ""; echo "'; @@ -197,6 +198,7 @@ function editCategory(XoopsObject $categoryObject = null) echo ''; } echo '
    " . _AM_NEWBB_CATEGORY1 . '
    '; + echo '
    '; break; } diff --git a/admin/admin_digest.php b/admin/admin_digest.php index 6556f66f..b342d1f8 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -91,6 +91,7 @@ echo '
  • ' . _AM_NEWBB_DIGEST_HELP_2 . '
  • '; echo '
  • ' . _AM_NEWBB_DIGEST_HELP_3 . '
  • '; echo '
  • ' . _AM_NEWBB_DIGEST_HELP_4 . '
  • '; + echo "" . "
    "; echo ''; echo ""; echo ""; @@ -117,7 +118,7 @@ echo $hidden->render() . ''; echo '
    '; - + echo '
    '; $nav = new XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); echo $nav->renderNav(4); diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index c009782f..510d71ab 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -82,6 +82,7 @@ $box .= newbbForumSelectBox($forum_id, 'all', true, true); $box .= ''; + echo "" . "'; echo ''; echo '
    "; echo '
    '; echo ''; echo ''; @@ -91,6 +92,7 @@ echo '
    ' . $box . '
    '; + echo '
    '; } break; @@ -129,7 +131,7 @@ $box .= ''; $box .= newbbForumSelectBox($forum_id, 'all'); $box .= ''; - + echo "" . "'; echo ''; echo '
    "; echo '
    '; echo ''; echo ''; @@ -140,6 +142,7 @@ echo '
    ' . $box . '
    '; + echo ''; } break; @@ -238,6 +241,7 @@ } $echo = $adminObject->displayNavigation(basename(__FILE__)); + $echo .= "" . "
    "; $echo .= ""; $echo .= ""; $echo .= "'; @@ -296,6 +300,7 @@ echo $echo; echo '
    " . _AM_NEWBB_NAME . '
    '; + echo '
    '; break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_report.php b/admin/admin_report.php index d3070a6b..79e73d01 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -114,11 +114,12 @@ $adminObject->addItemButton($title_other, $item_other, $icon = 'add'); $adminObject->displayButton(); echo _AM_NEWBB_REPORTADMIN_HELP; + echo "" . "
    "; echo '
    '; echo ""; echo ""; - echo "'; - echo "'; + echo "'; + echo "'; echo ''; $reports = $reportHandler->getAllReports('report_id', 'ASC', $limit, $start, $process_result); @@ -175,7 +176,7 @@ echo $hidden->render() . ''; echo '
    " . _AM_NEWBB_REPORTTITLE . '" . $extra . '" . _AM_NEWBB_REPORTTITLE . '" . $extra . '
    '; - + echo '
    '; $nav = new XoopsPageNav($reportHandler->getCount(new Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); echo $nav->renderNav(4); break; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index 171006f7..e6ac1f77 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -165,6 +165,7 @@ $form .= ''; $form .= ''; $form .= ''; - +echo "" . "
    "; echo $form; +echo '
    '; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index edecc572..61028f89 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -116,6 +116,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); $adminObject->displayButton(); echo '' . _AM_NEWBB_TYPE_ORDER_DESC . ''; + echo "" . "
    "; echo "
    "; echo ""; echo ""; @@ -154,6 +155,7 @@ echo ""; echo '
    '; echo '
    '; + echo '
    '; break; case 'save_template': @@ -197,6 +199,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); $adminObject->displayButton(); + echo "" . "
    "; echo ""; echo ""; echo "'; @@ -219,6 +222,7 @@ unset($typesObject[$key]); } echo '
    " . _AM_NEWBB_TYPE_NAME . '
    '; + echo '
    '; echo '
    '; $fmform->display(); break; @@ -296,6 +300,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); $adminObject->displayButton(); echo '' . _AM_NEWBB_TYPE_ORDER_DESC . ''; + echo "" . "
    "; echo "
    "; echo ""; echo ""; @@ -339,6 +344,7 @@ echo ""; echo '
    '; echo '
    '; + echo '
    '; break; case 'save_forum': @@ -366,6 +372,7 @@ $adminObject->displayButton(); } echo _AM_NEWBB_TYPE_HELP; + echo "" . "
    "; echo "
    "; echo ""; echo ""; @@ -418,6 +425,7 @@ echo ""; echo '
    '; echo '
    '; + echo '
    '; break; } diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index f9612301..26173373 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -84,7 +84,7 @@ xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); - + echo "
    \n
    " . _AM_NEWBB_VOTE_USERAVG . ": $useravgrating
    \n
    " . _AM_NEWBB_VOTE_TOTALRATE . ": $uservotes
    \n @@ -92,7 +92,7 @@
    • " . _AM_NEWBB_VOTE_DELETEDSC . "
    \n
    \n - + " . "
    \n \n \n @@ -124,6 +124,7 @@ \n"; } echo '
    " . _AM_NEWBB_VOTE_ID . "
    '; + echo '
    '; //Include page navigation include_once $GLOBALS['xoops']->path('class/pagenav.php'); $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; From 3ea0901a121a9c863a4432f74e5dd0957bf968cf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 15 Sep 2017 10:58:40 -0400 Subject: [PATCH 065/170] adding handlers to common.php --- action.post.php | 12 ++--- action.topic.php | 20 ++++----- admin/admin_cat_manager.php | 10 ++--- admin/admin_digest.php | 12 ++--- admin/admin_forum_manager.php | 24 +++++----- admin/admin_forum_prune.php | 4 +- admin/admin_forum_reorder.php | 8 ++-- admin/admin_groupmod.php | 8 ++-- admin/admin_header.php | 21 +++++---- admin/admin_permissions.php | 38 ++++++++-------- admin/admin_report.php | 6 +-- admin/admin_synchronization.php | 4 +- admin/admin_type_manager.php | 26 +++++------ admin/index.php | 4 +- blocks/newbb_block.php | 1 - class/Helper.php | 75 +++++++++++++++++++++++++++++++ class/category.php | 4 -- class/digest.php | 1 + class/forum.php | 1 - class/online.php | 4 +- class/readforum.php | 1 + class/topic.renderer.php | 3 +- delete.php | 20 ++++----- dl_attachment.php | 12 ++--- edit.php | 22 ++++----- header.php | 2 + include/common.php | 63 ++++++++++++++++++++++++-- include/form.post.php | 2 +- include/functions.forum.php | 1 - include/functions.read.php | 8 ++-- include/functions.welcome.inc.php | 8 ++-- include/module.php | 6 +-- index.php | 28 ++++++------ list.topic.php | 4 +- makepdf.php | 14 +++--- moderate.php | 8 ++-- newtopic.php | 12 ++--- post.php | 16 +++---- print.php | 12 ++--- ratethread.php | 12 ++--- reply.php | 20 ++++----- report.php | 10 ++--- rss.php | 14 +++--- search.php | 4 +- topicmanager.php | 31 ++++++------- update_type.php | 6 +-- viewforum.php | 22 ++++----- viewpost.php | 22 ++++----- viewtopic.php | 22 ++++----- votepolls.php | 4 +- 50 files changed, 414 insertions(+), 278 deletions(-) create mode 100644 class/Helper.php diff --git a/action.post.php b/action.post.php index 0c0b8fa2..e4e31c85 100644 --- a/action.post.php +++ b/action.post.php @@ -25,12 +25,12 @@ // irmtfan - issue with javascript:history.go(-1) redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_NO_SELECTION); } -/** @var NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); -/** @var NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (empty($topic_id)) { $forumObject = null; } else { diff --git a/action.topic.php b/action.topic.php index 6fdc5892..8628f4d8 100644 --- a/action.topic.php +++ b/action.topic.php @@ -25,10 +25,10 @@ } $topic_id = array_values($topic_id); -/** @var \NewbbTopicHandler|XoopsPersistableObjectHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var \NewbbForumHandler|XoopsPersistableObjectHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbTopicHandler|XoopsPersistableObjectHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbForumHandler|XoopsPersistableObjectHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); $isAdmin = newbbIsAdmin($forum_id); @@ -125,16 +125,16 @@ && Request::getInt('newforum', 0, 'POST') !== $forum_id && $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) { $criteria = new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'); - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); +// /** @var \NewbbPostHandler $postHandler */ +// $postHandler = xoops_getModuleHandler('post', 'newbb'); $postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); $topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true); $forumHandler->synchronization(Request::getInt('newforum', 0, 'POST')); $forumHandler->synchronization($forum_id); } else { include $GLOBALS['xoops']->path('header.php'); - /** @var \NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// /** @var \NewbbCategoryHandler $categoryHandler */ +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $categories = $categoryHandler->getByPermission('access'); $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); @@ -181,8 +181,8 @@ } break; } -/** @var \NewbbStatsHandler $statsHandler */ -$statsHandler = xoops_getModuleHandler('stats', 'newbb'); +///** @var \NewbbStatsHandler $statsHandler */ +//$statsHandler = xoops_getModuleHandler('stats', 'newbb'); $statsHandler->reset(); if (empty($forum_id)) { redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED); diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index cb3392ca..64dce338 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -39,8 +39,8 @@ $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); $cat_id = Request::getInt('cat_id', Request::getInt('cat_id', 0, 'POST'), 'GET'); // (int)( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] ); -/** @var \NewbbCategoryHandler $categoryHandler */ -$categoryHandler = xoops_getModuleHandler('category', 'newbb'); +///** @var \NewbbCategoryHandler $categoryHandler */ +//$categoryHandler = xoops_getModuleHandler('category', 'newbb'); /** * newCategory() @@ -59,7 +59,7 @@ function newCategory() function editCategory(XoopsObject $categoryObject = null) { global $xoopsModule; - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); if (null === $categoryObject) { $categoryObject = $categoryHandler->create(); } @@ -168,7 +168,7 @@ function editCategory(XoopsObject $categoryObject = null) default: if (!$categories = $categoryHandler->getByPermission('all')) { $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); echo '
    '; newCategory(); @@ -176,7 +176,7 @@ function editCategory(XoopsObject $categoryObject = null) } $adminObject->displayNavigation(basename(__FILE__)); $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); echo "" . "
    "; echo ""; diff --git a/admin/admin_digest.php b/admin/admin_digest.php index b342d1f8..86734635 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -44,8 +44,8 @@ switch ($op) { case 'delete': $digest_ids = Request::getArray('digest_id', [], 'POST'); - /** @var \NewbbDigestHandler $digestHandler */ - $digestHandler = xoops_getModuleHandler('digest', 'newbb'); +// /** @var \NewbbDigestHandler $digestHandler */ +// $digestHandler = xoops_getModuleHandler('digest', 'newbb'); foreach ($digest_ids as $did => $value) { $digest = $digestHandler->get($did); $digestHandler->delete($digest); @@ -59,7 +59,7 @@ case 'digestconfirmed': $message = ''; if ('POST' === Request::getMethod()) { - $digestHandler = xoops_getModuleHandler('digest', 'newbb'); +// $digestHandler = xoops_getModuleHandler('digest', 'newbb'); switch ($digestHandler->process(true)) { case 0: @@ -83,7 +83,7 @@ $adminObject->displayNavigation(basename(__FILE__)); $adminObject->addItemButton(_AM_NEWBB_DIGEST, 'admin_digest.php?op=digest', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); //if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN); // else $adminObject->displayNavigation(basename(__FILE__)); @@ -100,8 +100,8 @@ echo ''; $digests = []; - /** @var \NewbbDigestHandler $digestHandler */ - $digestHandler = xoops_getModuleHandler('digest', 'newbb'); +// /** @var \NewbbDigestHandler $digestHandler */ +// $digestHandler = xoops_getModuleHandler('digest', 'newbb'); $digests = $digestHandler->getAllDigests($start, $limit); foreach ($digests as $digest) { echo ""; diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index 510d71ab..8332fa31 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -44,8 +44,8 @@ $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); $forum_id = Request::getInt('forum', Request::getInt('forum', 0, 'POST'), 'GET'); //(int)( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) ); -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); switch ($op) { case 'moveforum': //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); @@ -173,21 +173,21 @@ if ($forumHandler->insert($forumObject)) { //$cacheHelper->delete('forum'); if (Request::getInt('perm_template', 0, 'POST')) { - /** @var \NewbbPermissionHandler $grouppermHandler */ - $grouppermHandler = xoops_getModuleHandler('permission', $xoopsModule->getVar('dirname')); - $perm_template = $grouppermHandler->getTemplate(); +// /** @var \NewbbPermissionHandler $permHandler */ +// $permHandler = xoops_getModuleHandler('permission', 'newbb'); + $perm_template = $permHandler->getTemplate(); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); - $perms = $grouppermHandler->getValidForumPerms(true); + $perms = $permHandler->getValidForumPerms(true); foreach (array_keys($glist) as $group) { foreach ($perms as $perm) { - $ids = $grouppermHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); + $ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); if (!in_array($forumObject->getVar('forum_id'), $ids)) { if (empty($perm_template[$group][$perm])) { - $grouppermHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); + $permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); } else { - $grouppermHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); + $permHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); } } } @@ -231,8 +231,8 @@ default: - /** @var \NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// /** @var \NewbbCategoryHandler $categoryHandler */ +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -252,7 +252,7 @@ $echo .= "'; $echo .= ''; - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 7d648a20..61f4d58e 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -145,8 +145,8 @@ return _MD_NEWBB_ERROR; } // SYNC FORUMS AFTER DELETE - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// /** @var \NewbbForumHandler $forumHandler */ +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forumHandler->synchronization(); // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL: } diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index 5c919603..787c9131 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -75,10 +75,10 @@ echo "'; echo ''; - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - /** @var \NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// /** @var \NewbbForumHandler $forumHandler */ +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// /** @var \NewbbCategoryHandler $categoryHandler */ +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index 64ea92c9..f425c12a 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -37,8 +37,8 @@ $adminObject->displayNavigation(basename(__FILE__)); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (Request::getString('submit', '', 'POST')) { $fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; $fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); @@ -73,8 +73,8 @@ echo _AM_NEWBB_GROUPMOD_TITLEDESC; echo "

    " . _AM_NEWBB_MERGE . '
    " . _AM_NEWBB_REORDERWEIGHT . '
    " . "'; @@ -269,8 +269,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) break; case 'template_save': - // $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0); - $res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); + // $res = $permHandler->setTemplate($_POST['perms'], $groupid = 0); + $res = $permHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); if ($res) { redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); } else { @@ -280,7 +280,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) // exit(); case 'apply': - $perm_template = $newbbpermHandler->getTemplate(); + $perm_template = $permHandler->getTemplate(); if (null === $perm_template) { redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE); } @@ -298,14 +298,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $opform->addElement($op_select); $opform->display(); - /** @var \NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// /** @var \NewbbCategoryHandler $categoryHandler */ +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// /** @var \NewbbForumHandler $forumHandler */ +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c - 1000] = ' '; @@ -337,7 +337,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) if ($forum < 1) { continue; } - $newbbpermHandler->applyTemplate($forum, $module_id); + $permHandler->applyTemplate($forum, $module_id); } $cacheHelper = NewbbUtility::cleanCache(); //$cacheHelper->delete('permission'); @@ -347,7 +347,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) default: xoops_cp_header(); - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -356,7 +356,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (0 === count($forums)) { @@ -416,7 +416,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -426,7 +426,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } unset($categories); } else { - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (count($forums) > 0) { foreach (array_keys($forums) as $c) { @@ -443,9 +443,9 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form->display(); // Since we can not control the permission update, a trick is used here - /** @var \NewbbPermissionHandler $permissionHandler */ - $permissionHandler = xoops_getModuleHandler('permission', 'newbb'); - $permissionHandler->createPermData(); +// /** @var \NewbbPermissionHandler $permHandler */ +// $permHandler = xoops_getModuleHandler('permission', 'newbb'); + $permHandler->createPermData(); $cacheHelper = NewbbUtility::cleanCache(); //$cacheHelper->delete('permission'); include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_report.php b/admin/admin_report.php index 79e73d01..c2791275 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -41,8 +41,8 @@ $op = Request::hasVar('submit', 'POST') ? 'save' : $op; $op = Request::hasVar('delete', 'POST') ? 'delete' : $op; -/** @var \NewbbReportHandler $reportHandler */ -$reportHandler = xoops_getModuleHandler('report', 'newbb'); +///** @var \NewbbReportHandler $reportHandler */ +//$reportHandler = xoops_getModuleHandler('report', 'newbb'); xoops_cp_header(); @@ -112,7 +112,7 @@ //if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN); // else $adminObject->displayNavigation(basename(__FILE__)); $adminObject->addItemButton($title_other, $item_other, $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); echo _AM_NEWBB_REPORTADMIN_HELP; echo "
    "; echo "
    "; -/** @var \NewbbCategoryHandler $categoryHandler */ -$categoryHandler = xoops_getModuleHandler('category', 'newbb'); +///** @var \NewbbCategoryHandler $categoryHandler */ +//$categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); diff --git a/admin/admin_header.php b/admin/admin_header.php index b96385d4..fdf0cf79 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -40,13 +40,14 @@ //include_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php'); include_once dirname(__DIR__) . '/include/config.php'; +include_once dirname(__DIR__) . '/include/common.php'; $moduleDirName = basename(dirname(__DIR__)); -if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { -} else { - $moduleHelper = Xmf\Module\Helper::getHelper('system'); -} +//if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { +//} else { +// $moduleHelper = Xmf\Module\Helper::getHelper('system'); +//} /** @var Xmf\Module\Admin $adminObject */ $adminObject = Xmf\Module\Admin::getInstance(); @@ -59,13 +60,17 @@ $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); $pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); -$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32'); +//$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32'); +$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); // Local icons path $xoopsTpl->assign('pathModIcon16', $pathIcon16); $xoopsTpl->assign('pathModIcon32', $pathIcon32); // Load language files -$moduleHelper->loadLanguage('admin'); -$moduleHelper->loadLanguage('modinfo'); -$moduleHelper->loadLanguage('main'); +//$moduleHelper->loadLanguage('admin'); +//$moduleHelper->loadLanguage('modinfo'); +//$moduleHelper->loadLanguage('main'); +$helper->loadLanguage('admin'); +$helper->loadLanguage('modinfo'); +$helper->loadLanguage('main'); diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index 0196b1e3..00e9516c 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -205,9 +205,9 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; $action = strtolower(Request::getCmd('action', '')); $module_id = $xoopsModule->getVar('mid'); -/** @var \NewbbPermissionHandler $newbbpermHandler */ -$newbbpermHandler = xoops_getModuleHandler('permission', 'newbb'); -$perms = $newbbpermHandler->getValidForumPerms(); +///** @var \NewbbPermissionHandler $permHandler */ +//$permHandler = xoops_getModuleHandler('permission', 'newbb'); +$perms = $permHandler->getValidForumPerms(); switch ($action) { case 'template': @@ -229,7 +229,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); $elements = []; - $perm_template = $newbbpermHandler->getTemplate(); + $perm_template = $permHandler->getTemplate(); foreach (array_keys($glist) as $i) { $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; $ret_ele = '
    ' . $glist[$i] . '
    " . "
    "; echo ''; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index e6ac1f77..917eea63 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -32,8 +32,8 @@ // irmtfan rewrite topic sync case 'topic': $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); - /** @var \NewbbTopicHandler $topicHandler */ - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); +// /** @var \NewbbTopicHandler $topicHandler */ +// $topicHandler = xoops_getModuleHandler('topic', 'newbb'); $criteria = new Criteria('approved', 1); if ($start >= ($count = $topicHandler->getCount($criteria))) { break; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 61028f89..b689c38a 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -47,8 +47,8 @@ $op = ''; } -/** @var \NewbbTypeHandler $typeHandler */ -$typeHandler = xoops_getModuleHandler('type', 'newbb'); +///** @var \NewbbTypeHandler $typeHandler */ +//$typeHandler = xoops_getModuleHandler('type', 'newbb'); $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); switch ($op) { @@ -114,7 +114,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); echo '' . _AM_NEWBB_TYPE_ORDER_DESC . ''; echo "" . "
    "; echo ""; @@ -169,11 +169,11 @@ redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); } - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; @@ -197,7 +197,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); echo "" . "
    "; echo ""; @@ -241,14 +241,14 @@ break; case 'forum': - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); +// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (empty($categories)) { redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories)); if (empty($forums)) { redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); @@ -275,7 +275,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); $fmform->display(); break; @@ -285,7 +285,7 @@ redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); } - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); } @@ -298,7 +298,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); echo '' . _AM_NEWBB_TYPE_ORDER_DESC . ''; echo "
    " . "
    "; echo ""; @@ -369,7 +369,7 @@ $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); } echo _AM_NEWBB_TYPE_HELP; echo "" . ""; echo ""; diff --git a/admin/index.php b/admin/index.php index 5acb4a51..e7710c3d 100644 --- a/admin/index.php +++ b/admin/index.php @@ -102,8 +102,8 @@ function newbb_getImageLibs() $imageLibs = newbb_getImageLibs(); /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); -/** @var \NewbbReportHandler $reportHandler */ -$reportHandler = xoops_getModuleHandler('report', 'newbb'); +///** @var \NewbbReportHandler $reportHandler */ +//$reportHandler = xoops_getModuleHandler('report', 'newbb'); $isOK = false; // START irmtfan add a poll_module config diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index f72e573d..dc4d7f3d 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -581,7 +581,6 @@ function b_newbb_author_show($options) { global $accessForums; global $newbbConfig; - $myts = MyTextSanitizer::getInstance(); $block = []; // $i = 0; diff --git a/class/Helper.php b/class/Helper.php new file mode 100644 index 00000000..6f7f0347 --- /dev/null +++ b/class/Helper.php @@ -0,0 +1,75 @@ + - + */ + +//defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +/** + * Class Helper + */ +class Newbb extends \Xmf\Module\Helper +{ + public $debugArray = []; + + /** + * @internal param $debug + */ + protected function __construct() + { + // $this->debug = $debug; + $this->dirname = basename(dirname(__DIR__)); + } + + /** + * @param bool $debug + * + * @return Publisher + */ + public static function getInstance($debug = false) + { + static $instance; + if (null === $instance) { + $instance = new static($debug); + } + + return $instance; + } + + + /** + * @param null|string $name + * @param null|string $value + * + * @return mixed + */ + public function setConfig($name = null, $value = null) + { + if (null === $this->configs) { + $this->initConfig(); + } + $this->configs[$name] = $value; + $this->addLog("Setting config '{$name}' : " . $this->configs[$name]); + + return $this->configs[$name]; + } + +} diff --git a/class/category.php b/class/category.php index 2394e29b..79f96165 100644 --- a/class/category.php +++ b/class/category.php @@ -48,7 +48,6 @@ public function getIdsByPermission($perm = 'access') { /** @var \NewbbPermissionHandler $permHandler */ $permHandler = xoops_getModuleHandler('permission', 'newbb'); - return $permHandler->getCategories($perm); } @@ -132,7 +131,6 @@ public function getPermission($category, $perm = 'access') $cat_id = is_object($category) ? $category->getVar('cat_id') : (int)$category; /** @var NewbbPermissionHandler $permHandler */ $permHandler = xoops_getModuleHandler('permission', 'newbb'); - return $permHandler->getPermission('category', $perm, $cat_id); } @@ -144,7 +142,6 @@ public function deletePermission(NewbbCategory $category) { /** @var NewbbPermissionHandler $permHandler */ $permHandler = xoops_getModuleHandler('permission', 'newbb'); - return $permHandler->deleteByCategory($category->getVar('cat_id')); } @@ -156,7 +153,6 @@ public function applyPermissionTemplate(NewbbCategory $category) { /** @var NewbbPermissionHandler $permHandler */ $permHandler = xoops_getModuleHandler('permission', 'newbb'); - return $permHandler->setCategoryPermission($category->getVar('cat_id')); } diff --git a/class/digest.php b/class/digest.php index 0f33b530..8cc411a1 100644 --- a/class/digest.php +++ b/class/digest.php @@ -9,6 +9,7 @@ * @since 4.00 * @package module::newbb */ + class Digest extends XoopsObject { public $digest_id; diff --git a/class/forum.php b/class/forum.php index fdfbe56a..b0238a30 100644 --- a/class/forum.php +++ b/class/forum.php @@ -121,7 +121,6 @@ public function getIdsByPermission($perm = 'access') { /** @var \NewbbPermissionHandler $permHandler */ $permHandler = xoops_getModuleHandler('permission', 'newbb'); - return $permHandler->getForums($perm); } diff --git a/class/online.php b/class/online.php index 4d77dd1b..5874f9cc 100644 --- a/class/online.php +++ b/class/online.php @@ -32,8 +32,8 @@ class NewbbOnlineHandler */ public function init($forum = null, $forumtopic = null) { - //$this->db = XoopsDatabaseFactory::getDatabaseConnection(); - $this->db = $GLOBALS['xoopsDB']; + $this->db = XoopsDatabaseFactory::getDatabaseConnection(); +// $this->db = $GLOBALS['xoopsDB']; if (is_object($forum)) { $this->forum_id = $forum->getVar('forum_id'); $this->forumObject = $forum; diff --git a/class/readforum.php b/class/readforum.php index caf88b06..0aeaac52 100644 --- a/class/readforum.php +++ b/class/readforum.php @@ -38,6 +38,7 @@ * @author D.J. (phppp, http://xoopsforge.com) * @copyright copyright (c) 2005 XOOPS.org */ + class ReadForum extends Read { /** diff --git a/class/topic.renderer.php b/class/topic.renderer.php index bf3821a5..29ead3d7 100644 --- a/class/topic.renderer.php +++ b/class/topic.renderer.php @@ -732,8 +732,9 @@ public function getTypes($type_id = null) { static $types; if (!isset($types)) { - $typeHandler = xoops_getModuleHandler('type', 'newbb'); /** @var \NewbbTypeHandler $typeHandler */ + $typeHandler = xoops_getModuleHandler('type', 'newbb'); + $types = $typeHandler->getByForum(explode('|', @$this->vars['forum'])); } diff --git a/delete.php b/delete.php index 4dd9da97..ab51ca7e 100644 --- a/delete.php +++ b/delete.php @@ -29,12 +29,12 @@ && 'flat' !== Request::getString('viewmode', '', 'GET')) ? 'thread' : 'flat'; $viewmode = $viewmode ?: (Request::getString('viewmode', '', 'POST') ?: 'flat'); -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var \NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); if (!empty($post_id)) { $topic = $topicHandler->getByPost($post_id); @@ -71,8 +71,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forumObject); } @@ -115,8 +115,8 @@ $postHandler->delete($postObject, $isDeleteOne); $forumHandler->synchronization($forum); $topicHandler->synchronization($topic_id); - /** @var \NewbbStatsHandler $statsHandler */ - $statsHandler = xoops_getModuleHandler('stats', 'newbb'); +// /** @var \NewbbStatsHandler $statsHandler */ +// $statsHandler = xoops_getModuleHandler('stats', 'newbb'); $statsHandler->reset(); } diff --git a/dl_attachment.php b/dl_attachment.php index d4eaae80..768bd11c 100644 --- a/dl_attachment.php +++ b/dl_attachment.php @@ -22,23 +22,23 @@ exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $post_id . '; attachid' . $attachid); } -/** @var \NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var \NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); /** @var \NewbbPost $forumpost */ $forumpost = $postHandler->get($post_id); if (!$approved = $forumpost->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); } -/** @var NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); $topicObject = $topicHandler->getByPost($post_id); $topic_id = $topicObject->getVar('topic_id'); if (!$approved = $topicObject->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); } -/** @var NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forumObject = $forumHandler->get($topicObject->getVar('forum_id')); if (!$forumHandler->getPermission($forumObject)) { exit(_MD_NEWBB_NORIGHTTOACCESS); diff --git a/edit.php b/edit.php index 11e95475..a90fa971 100644 --- a/edit.php +++ b/edit.php @@ -22,12 +22,12 @@ redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); } -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var \NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); /** @var \NewbbPost $postObject */ $postObject = $postHandler->get($post_id); @@ -38,8 +38,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forumObject); } $isAdmin = newbbIsAdmin($forumObject); @@ -72,7 +72,7 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forumObject); } @@ -117,8 +117,8 @@ $xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); include __DIR__ . '/include/form.post.php'; -/** @var \NewbbKarmaHandler $karmaHandler */ -$karmaHandler = xoops_getModuleHandler('karma', 'newbb'); +///** @var \NewbbKarmaHandler $karmaHandler */ +//$karmaHandler = xoops_getModuleHandler('karma', 'newbb'); $user_karma = $karmaHandler->getUserKarma(); $posts_context = []; diff --git a/header.php b/header.php index ed089bac..bf7dbc33 100644 --- a/header.php +++ b/header.php @@ -12,6 +12,8 @@ use Xmf\Request; include dirname(dirname(__DIR__)) . '/mainfile.php'; +require_once __DIR__ . '/include/common.php'; + // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); /** @var \XoopsLogger $xoopsLogger */ $xoopsLogger->startTime('newBB_Header'); diff --git a/include/common.php b/include/common.php index c4b07d78..9cb1a300 100644 --- a/include/common.php +++ b/include/common.php @@ -38,7 +38,64 @@ xoops_loadLanguage('common', NEWBB_DIRNAME); -xoops_load('constants', NEWBB_DIRNAME); +//xoops_load('constants', NEWBB_DIRNAME); xoops_load('utility', NEWBB_DIRNAME); -xoops_load('XoopsRequest'); -xoops_load('XoopsFilterInput'); +//xoops_load('XoopsRequest'); +//xoops_load('XoopsFilterInput'); + +require_once NEWBB_ROOT_PATH . '/class/helper.php'; + +$debug = false; +$helper = Newbb::getInstance($debug); + +//This is needed or it will not work in blocks. +global $newbbIsAdmin; + +// Load only if module is installed +if (is_object($helper->getModule())) { + // Find if the user is admin of the module + $publisherIsAdmin = NewbbUtility::userIsAdmin(); +} + +$db = \XoopsDatabaseFactory::getDatabase(); + +/** @var \NewbbCategoryHandler $categoryHandler */ +$categoryHandler = $helper->getHandler('category'); +/** @var \NewbbDigestHandler $digestHandler */ +$digestHandler = $helper->getHandler('digest'); +/** @var \NewbbForumHandler $forumHandler */ +$forumHandler = $helper->getHandler('forum'); +/** @var \NewbbIconHandler $iconHandler */ +$iconHandler = $helper->getHandler('icon'); +/** @var \NewbbKarmaHandler $karmaHandler */ +$karmaHandler = $helper->getHandler('karma'); +/** @var \NewbbModerateHandler $moderateHandler */ +$moderateHandler = $helper->getHandler('moderate'); +/** @var \NewbbOnlineHandler $onlineHandler */ +$onlineHandler = $helper->getHandler('online'); +/** @var \NewbbPermissionHandler $permHandler */ +$permHandler = $helper->getHandler('permission'); +/** @var \NewbbPostHandler $postHandler */ +$postHandler = $helper->getHandler('post'); +/** @var \NewbbRateHandler $rateHandler */ +$rateHandler = $helper->getHandler('rate'); +/** @var \NewbbReadHandler $readHandler */ +//$readHandler = $helper->getHandler('read' . $type); +/** @var \NewbbReadForumHandler $readForumHandler */ +$readForumHandler = $helper->getHandler('readforum'); +/** @var \NewbbReadtopicHandler $readTopicHandler */ +$readTopicHandler = $helper->getHandler('readtopic'); +/** @var \NewbbReportHandler $reportHandler */ +$reportHandler = $helper->getHandler('report'); +/** @var \NewbbStatsHandler $statsHandler */ +$statsHandler = $helper->getHandler('stats'); +/** @var \NewbbTextHandler $textHandler */ +$textHandler = $helper->getHandler('text'); +/** @var \NewbbTopicHandler $topicHandler */ +$topicHandler = $helper->getHandler('topic'); +/** @var \NewbbTypeHandler $typeHandler */ +$typeHandler = $helper->getHandler('type'); +/** @var \NewbbUserstatsHandler $userstatsHandler */ +$userstatsHandler = $helper->getHandler('userstats'); +/** @var \NewbbXmlrssHandler $xmlrssHandler */ +$xmlrssHandler = $helper->getHandler('xmlrss'); diff --git a/include/form.post.php b/include/form.post.php index 306c63c4..96e90d8f 100644 --- a/include/form.post.php +++ b/include/form.post.php @@ -24,7 +24,7 @@ $xoopsTpl->assign('lang_forum_index', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); -$categoryHandler = xoops_getModuleHandler('category'); +$categoryHandler = xoops_getModuleHandler('category', 'newbb'); $categoryObject = $categoryHandler->get($forumObject->getVar('cat_id'), ['cat_title']); //check banning diff --git a/include/functions.forum.php b/include/functions.forum.php index f8809d2a..89dfffc7 100644 --- a/include/functions.forum.php +++ b/include/functions.forum.php @@ -27,7 +27,6 @@ function newbbForumSelectBox($value = null, $permission = 'access', $categoryDelimiter = true, $see = false) { global $xoopsUser; - /** @var \NewbbCategoryHandler $categoryHandler */ $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $categories = $categoryHandler->getByPermission($permission, ['cat_id', 'cat_order', 'cat_title'], false); diff --git a/include/functions.read.php b/include/functions.read.php index dd8fba3e..4796a9d7 100644 --- a/include/functions.read.php +++ b/include/functions.read.php @@ -54,9 +54,9 @@ function newbbGetRead($type, $item_id, $uid = null) function newbbSetReadForum($status = 0, $uid = null) { /** @var \NewbbReadForumHandler $readHandler */ - $readHandler = xoops_getModuleHandler('readforum', 'newbb'); + $readForumHandler = xoops_getModuleHandler('readforum', 'newbb'); - return $readHandler->setReadItems($status, $uid); + return $readForumHandler->setReadItems($status, $uid); } /** @@ -68,9 +68,9 @@ function newbbSetReadForum($status = 0, $uid = null) function newbbSetReadTopic($status = 0, $forum_id = 0, $uid = null) { /** @var \NewbbReadtopicHandler $readHandler */ - $readHandler = xoops_getModuleHandler('readtopic', 'newbb'); + $readTopicHandler = xoops_getModuleHandler('readtopic', 'newbb'); - return $readHandler->setReadItems($status, $forum_id, $uid); + return $readTopicHandler->setReadItems($status, $forum_id, $uid); } /** diff --git a/include/functions.welcome.inc.php b/include/functions.welcome.inc.php index bf98ce94..853320ba 100644 --- a/include/functions.welcome.inc.php +++ b/include/functions.welcome.inc.php @@ -45,10 +45,10 @@ if (!defined('_PROFILE_MA_ALLABOUT')) { $mod->loadLanguage(); } - /** @var \NewbbPermissionHandler $grouppermHandler */ - $grouppermHandler = xoops_getModuleHandler('permission', 'newbb'); - $show_ids = $grouppermHandler->getItemIds('profile_show', $groups, $mod->getVar('mid')); - $visible_ids = $grouppermHandler->getItemIds('profile_visible', $groups, $mod->getVar('mid')); + /** @var \NewbbPermissionHandler $permHandler */ + $permHandler = xoops_getModuleHandler('permission', 'newbb'); + $show_ids = $permHandler->getItemIds('profile_show', $groups, $mod->getVar('mid')); + $visible_ids = $permHandler->getItemIds('profile_visible', $groups, $mod->getVar('mid')); unset($mod); $fieldids = array_intersect($show_ids, $visible_ids); /** @var \ProfileProfileHandler $profileHandler */ diff --git a/include/module.php b/include/module.php index 9a3db4c2..06651155 100644 --- a/include/module.php +++ b/include/module.php @@ -120,7 +120,7 @@ function xoops_module_install_newbb(XoopsModule $module) { /* Create a test category */ /** @var NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', $module->getVar('dirname')); + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $category = $categoryHandler->create(); $category->setVar('cat_title', _MI_NEWBB_INSTALL_CAT_TITLE, true); $category->setVar('cat_image', '', true); @@ -132,7 +132,7 @@ function xoops_module_install_newbb(XoopsModule $module) /* Create a forum for test */ /** @var NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', $module->getVar('dirname')); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forum = $forumHandler->create(); $forum->setVar('forum_name', _MI_NEWBB_INSTALL_FORUM_NAME, true); $forum->setVar('forum_desc', _MI_NEWBB_INSTALL_FORUM_DESC, true); @@ -180,7 +180,7 @@ function xoops_module_install_newbb(XoopsModule $module) /* Create a test post */ include_once __DIR__ . '/functions.user.php'; /** @var NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', $module->getVar('dirname')); + $postHandler = xoops_getModuleHandler('post', 'newbb'); /** @var $forumpost */ $forumpost = $postHandler->create(); $forumpost->setVar('poster_ip', \Xmf\IPAddress::fromRequest()->asReadable()); diff --git a/index.php b/index.php index 5cb64f35..fd4b190b 100644 --- a/index.php +++ b/index.php @@ -29,8 +29,8 @@ } $viewcat = Request::getInt('cat', 0, 'GET');//TODO mb check if this is GET or POST? -/** @var \NewbbCategoryHandler $categoryHandler */ -$categoryHandler = xoops_getModuleHandler('category', 'newbb'); +///** @var \NewbbCategoryHandler $categoryHandler */ +//$categoryHandler = xoops_getModuleHandler('category', 'newbb'); $categories = []; if (!$viewcat) { @@ -70,15 +70,15 @@ $xoopsTpl->assign('forum_index_title', $forum_index_title); //if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { if (!empty($GLOBALS['xoopsModuleConfig']['wol_enabled'])) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init(); $xoopsTpl->assign('online', $onlineHandler->showOnline()); } -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -/** @var \NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); /* Allowed forums */ $forums_allowed = $forumHandler->getIdsByPermission(); @@ -138,8 +138,8 @@ $xoopsTpl->assign('delete_post', $deleteposts); } -/** @var \NewbbReportHandler $reportHandler */ -$reportHandler = xoops_getModuleHandler('report', 'newbb'); +///** @var \NewbbReportHandler $reportHandler */ +//$reportHandler = xoops_getModuleHandler('report', 'newbb'); $reported = $reportHandler->getCount(new Criteria('report_result', 0)); $xoopsTpl->assign('reported_count', $reported); if ($reported > 0) { @@ -227,8 +227,8 @@ if (!empty($GLOBALS['xoopsModuleConfig']['statistik_enabled'])) { $userstats = []; if (is_object($GLOBALS['xoopsUser'])) { - /** @var \NewbbUserstatsHandler $userstatsHandler */ - $userstatsHandler = xoops_getModuleHandler('userstats'); +// /** @var \NewbbUserstatsHandler $userstatsHandler */ +// $userstatsHandler = xoops_getModuleHandler('userstats'); $userstats_row = $userstatsHandler->getStats($GLOBALS['xoopsUser']->getVar('uid')); $userstats['topics'] = sprintf(_MD_NEWBB_USER_TOPICS, (int)(@$userstats_row['user_topics'])); $userstats['posts'] = sprintf(_MD_NEWBB_USER_POSTS, (int)(@$userstats_row['user_posts'])); @@ -244,8 +244,8 @@ } /* display forum stats */ -/** @var \NewbbStatsHandler $statsHandler */ -$statsHandler = xoops_getModuleHandler('stats'); +///** @var \NewbbStatsHandler $statsHandler */ +//$statsHandler = xoops_getModuleHandler('stats', 'newbb'); $stats = $statsHandler->getStats(array_merge([0], $forums_available)); $xoopsTpl->assign_by_ref('stats', $stats); $xoopsTpl->assign('subforum_display', $GLOBALS['xoopsModuleConfig']['subforum_display']); diff --git a/list.topic.php b/list.topic.php index f230495e..fbcb9903 100644 --- a/list.topic.php +++ b/list.topic.php @@ -55,8 +55,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init(); $onlineHandler->render($xoopsTpl); } diff --git a/makepdf.php b/makepdf.php index 050b1893..1468c968 100644 --- a/makepdf.php +++ b/makepdf.php @@ -50,8 +50,8 @@ exit(_MD_NEWBB_ERRORTOPIC); } -/** @var \NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var \NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); $post = $postHandler->get($post_id); if (!$approved = $post->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); @@ -59,16 +59,16 @@ $post_data = $postHandler->getPostForPDF($post); //$post_edit = $post->displayPostEdit(); //reserve for future versions to display edit records -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); $forumtopic = $topicHandler->getByPost($post_id); $topic_id = $forumtopic->getVar('topic_id'); if (!$approved = $forumtopic->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); } -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forum = $forum ?: $forumtopic->getVar('forum_id'); $viewtopic_forum = $forumHandler->get($forum); $parent_forums = []; @@ -91,7 +91,7 @@ exit(_MD_NEWBB_NORIGHTTOPDF); } -$categoryHandler = xoops_getModuleHandler('category', 'newbb'); +//$categoryHandler = xoops_getModuleHandler('category', 'newbb'); $cat = $viewtopic_forum->getVar('cat_id'); $viewtopic_cat = $categoryHandler->get($cat); diff --git a/moderate.php b/moderate.php index da0bad9b..4100851a 100644 --- a/moderate.php +++ b/moderate.php @@ -24,8 +24,8 @@ redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } $is_administrator = $GLOBALS['xoopsUserIsAdmin']; -/** @var \NewbbModerateHandler $moderateHandler */ -$moderateHandler = xoops_getModuleHandler('moderate', 'newbb'); +///** @var \NewbbModerateHandler $moderateHandler */ +//$moderateHandler = xoops_getModuleHandler('moderate', 'newbb'); if (Request::hasVar('submit', 'POST') && Request::getInt('expire', 0, 'POST')) { $ipWithMask = ''; @@ -143,8 +143,8 @@ ]; $xoopsTpl->assign('columnHeaders', $columnHeaders); - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// /** @var \NewbbForumHandler $forumHandler */ +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forum_list = $forumHandler->getAll(null, ['forum_name'], false); $columnRows = []; diff --git a/newtopic.php b/newtopic.php index 32b4e0fa..46248d4b 100644 --- a/newtopic.php +++ b/newtopic.php @@ -17,15 +17,15 @@ redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); } -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum'); $forumObject = $forumHandler->get($forum); if (!$forumHandler->getPermission($forumObject)) { redirect_header(XOOPS_URL . '/index.php', 2, _NOPERM); } -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); $topicObject = $topicHandler->create(); $topicObject->setVar('forum_id', $forum); if (!$topicHandler->getPermission($forumObject, 0, 'post')) { @@ -45,8 +45,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forumObject); } diff --git a/post.php b/post.php index 9f242ac2..bcaf1f3f 100644 --- a/post.php +++ b/post.php @@ -39,12 +39,12 @@ redirect_header('index.php', 2, _MD_NEWBB_ERRORFORUM); } -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var \NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); if (!empty($isedit) && $post_id > 0) { /** @var NewbbPost $postObject */ @@ -61,8 +61,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forumObject); } diff --git a/print.php b/print.php index c963ff56..44b350d0 100644 --- a/print.php +++ b/print.php @@ -54,8 +54,8 @@ } if (0 !== $post_id) { - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); +// /** @var \NewbbPostHandler $postHandler */ +// $postHandler = xoops_getModuleHandler('post', 'newbb'); /** @var \NewbbPost $post */ $post = $postHandler->get($post_id); if (!$approved = $post->getVar('approved')) { @@ -72,8 +72,8 @@ } } - /** @var \NewbbTopicHandler $topicHandler */ - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); +// /** @var \NewbbTopicHandler $topicHandler */ +// $topicHandler = xoops_getModuleHandler('topic', 'newbb'); $topicObject = $topicHandler->get($topic_id); $topic_id = $topicObject->getVar('topic_id'); $forum = $topicObject->getVar('forum_id'); @@ -86,8 +86,8 @@ exit(_MD_NEWBB_NORIGHTTOVIEW); } - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// /** @var \NewbbForumHandler $forumHandler */ +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forum = $topicObject->getVar('forum_id'); $forumObject = $forumHandler->get($forum); if (!$forumHandler->getPermission($forumObject)) { diff --git a/ratethread.php b/ratethread.php index 665f339b..04f68175 100644 --- a/ratethread.php +++ b/ratethread.php @@ -41,8 +41,8 @@ ${$var} = Request::getInt($var, Request::getInt($var, 0, 'POST'), 'GET'); } -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); $topicObject = $topicHandler->get($topic_id); if (!$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'post') && !$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'reply')) { @@ -53,14 +53,14 @@ if (empty($rate)) { redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); } -/** @var \NewbbRateHandler $rateHandler */ -$rateHandler = xoops_getModuleHandler('rate', $xoopsModule->getVar('dirname')); +///** @var \NewbbRateHandler $rateHandler */ +//$rateHandler = xoops_getModuleHandler('rate', 'newbb'); if (0 !== $ratinguser) { // Check if Topic POSTER is voting (UNLESS Anonymous users allowed to post) $crit_post = new CriteriaCompo(new Criteria('topic_id', $topic_id)); $crit_post->add(new Criteria('uid', $ratinguser)); - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', $xoopsModule->getVar('dirname')); +// /** @var \NewbbPostHandler $postHandler */ +// $postHandler = xoops_getModuleHandler('post', 'newbb'); if ($postHandler->getCount($crit_post)) { redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); } diff --git a/reply.php b/reply.php index 14081804..309546f4 100644 --- a/reply.php +++ b/reply.php @@ -44,12 +44,12 @@ redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); } -/** @var NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -/** @var NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var NewbbPostHandler $postHandler */ -$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var NewbbPostHandler $postHandler */ +//$postHandler = xoops_getModuleHandler('post', 'newbb'); if (!$pid = $post_id) { $pid = $topicHandler->getTopPostId($topic_id); @@ -87,8 +87,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forumObject); } @@ -168,8 +168,8 @@ include __DIR__ . '/include/form.post.php'; -/** @var \NewbbKarmaHandler $karmaHandler */ -$karmaHandler = xoops_getModuleHandler('karma', 'newbb'); +///** @var \NewbbKarmaHandler $karmaHandler */ +//$karmaHandler = xoops_getModuleHandler('karma', 'newbb'); $user_karma = $karmaHandler->getUserKarma(); $posts_context = []; diff --git a/report.php b/report.php index 19731ab5..2f6a2c1b 100644 --- a/report.php +++ b/report.php @@ -48,8 +48,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forum); } @@ -72,7 +72,7 @@ if ('' !== $error_message) { xoops_error($error_message); } else { - $reportHandler = xoops_getModuleHandler('report', 'newbb'); +// $reportHandler = xoops_getModuleHandler('report', 'newbb'); $report = $reportHandler->create(); $report->setVar('report_text', Request::getString('report_text', '', 'POST')); $report->setVar('post_id', Request::getInt('post_id', 0, 'POST')); @@ -83,7 +83,7 @@ $report->setVar('report_memo', ''); if ($report_id = $reportHandler->insert($report)) { - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); +// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (empty($forum)) { } $forumObject = $forumHandler->get($forum); @@ -124,7 +124,7 @@ $report_form->addElement(new XoopsFormCaptcha()); } -$postHandler = xoops_getModuleHandler('post', 'newbb'); +//$postHandler = xoops_getModuleHandler('post', 'newbb'); $postObject = $postHandler->get($post_id); $forum = $postObject->getVar('forum_id'); diff --git a/rss.php b/rss.php index e55eae23..2f7fae99 100644 --- a/rss.php +++ b/rss.php @@ -50,9 +50,9 @@ $forums = array_map('intval', array_map('trim', explode('|', $forumSet))); } -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); $validForums = $forumHandler->getIdsByPermission(); // get all accessible forums if (is_array($forums) && count($forums) > 0) { @@ -86,8 +86,8 @@ if (!$tpl->is_cached('db:newbb_rss.tpl', $xoopsCachedTemplateId, $compile_id)) { include_once __DIR__ . '/include/functions.time.php'; - /** @var \NewbbXmlrssHandler $xmlrssHandler */ - $xmlrssHandler = xoops_getModuleHandler('xmlrss', 'newbb'); +// /** @var \NewbbXmlrssHandler $xmlrssHandler */ +// $xmlrssHandler = xoops_getModuleHandler('xmlrss', 'newbb'); $rss = $xmlrssHandler->create(); $rss->setVarRss('channel_title', $GLOBALS['xoopsConfig']['sitename'] . ' :: ' . _MD_NEWBB_FORUM); @@ -167,8 +167,8 @@ } $users = newbbGetUnameFromIds(array_keys($users), $GLOBALS['xoopsModuleConfig']['show_realname']); if (count($types) > 0) { - /** @var \NewbbTypeHandler $typeHandler */ - $typeHandler = xoops_getModuleHandler('type', 'newbb'); +// /** @var \NewbbTypeHandler $typeHandler */ +// $typeHandler = xoops_getModuleHandler('type', 'newbb'); $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); } diff --git a/search.php b/search.php index 0e3be1ed..897b0598 100644 --- a/search.php +++ b/search.php @@ -75,8 +75,8 @@ $search_username = trim($uname); if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init(0); } diff --git a/topicmanager.php b/topicmanager.php index fd403144..c7c0eec8 100644 --- a/topicmanager.php +++ b/topicmanager.php @@ -55,10 +55,10 @@ redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); } -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var \NewbbTopicHandler $topicHandler */ +//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); +///** @var \NewbbForumHandler $forumHandler */ +//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); if (!$forum) { /** @var \Topic $topicObject */ @@ -73,8 +73,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - /** @var \NewbbOnlineHandler $onlineHandler */ - $onlineHandler = xoops_getModuleHandler('online', 'newbb'); +// /** @var \NewbbOnlineHandler $onlineHandler */ +// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); $onlineHandler->init($forum); } // irmtfan add restore to viewtopic @@ -165,10 +165,10 @@ . _MD_NEWBB_RETURNFORUMINDEX . '

    '; } elseif ('merge' === $mode) { - /** @var NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); - /** @var \NewbbRateHandler $rateHandler */ - $rateHandler = xoops_getModuleHandler('rate', 'newbb'); +// /** @var NewbbPostHandler $postHandler */ +// $postHandler = xoops_getModuleHandler('post', 'newbb'); +// /** @var \NewbbRateHandler $rateHandler */ +// $rateHandler = xoops_getModuleHandler('rate', 'newbb'); foreach ($topic_id as $tid) { $topicObject = $topicHandler->get($tid); @@ -287,10 +287,11 @@ } if ('digest' === $mode && $GLOBALS['xoopsDB']->getAffectedRows()) { $topicObject = $topicHandler->get($topic_id); - /** @var \NewbbStatsHandler $statsHandler */ - $statsHandler = xoops_getModuleHandler('stats', 'newbb'); +// /** @var \NewbbStatsHandler $statsHandler */ +// $statsHandler = xoops_getModuleHandler('stats', 'newbb'); $statsHandler->update($topicObject->getVar('forum_id'), 'digest'); - $userstatsHandler = xoops_getModuleHandler('userstats', 'newbb'); +// /** @var \NewbbUserstatsHandler $userstatsHandler */ +// $userstatsHandler = xoops_getModuleHandler('userstats', 'newbb'); if ($user_stat = $userstatsHandler->get($topicObject->getVar('topic_poster'))) { $z = $user_stat->getVar('user_digests') + 1; $user_stat->setVar('user_digests', (int)$z); @@ -324,8 +325,8 @@ echo '
    \n\n"; + $ret .= "\n\n"; } else { $hidden .= $elements[$i]->render(); } @@ -205,16 +205,16 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; $action = strtolower(Request::getCmd('action', '')); $module_id = $xoopsModule->getVar('mid'); -///** @var \NewbbPermissionHandler $permHandler */ -//$permHandler = xoops_getModuleHandler('permission', 'newbb'); -$perms = $permHandler->getValidForumPerms(); +/** @var \NewbbPermissionHandler $newbbpermHandler */ +$newbbpermHandler = xoops_getModuleHandler('permission', 'newbb'); +$perms = $newbbpermHandler->getValidForumPerms(); switch ($action) { case 'template': xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ @@ -229,7 +229,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); $elements = []; - $perm_template = $permHandler->getTemplate(); + $perm_template = $newbbpermHandler->getTemplate(); foreach (array_keys($glist) as $i) { $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; $ret_ele = ''; @@ -260,17 +260,17 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $ret = '

    ' . _AM_NEWBB_PERM_TEMPLATE . '

    ' . _AM_NEWBB_PERM_TEMPLATE_DESC . '


    '; $ret .= "\n
    "; @@ -404,7 +404,7 @@ } else { $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton(); + $adminObject->displayButton('left'); for ($i = 0; $i < 10; ++$i) { echo "
    ' . _MD_NEWBB_MOVETOPICTO . ''; $box = '\n" . $elements[$i]->render() . "\n
    \n" . $elements[$i]->render() . "\n
    ' . $glist[$i] . '
    \n"; $ret .= implode("\n", $elements); - $ret .= ''; $ret .= '
    '; + $ret .= '
    '; $ret .= $tray->render(); $ret .= '
    '; echo $ret; include_once __DIR__ . '/admin_footer.php'; break; - + case 'template_save': - // $res = $permHandler->setTemplate($_POST['perms'], $groupid = 0); - $res = $permHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); + // $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0); + $res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); if ($res) { redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); } else { @@ -280,14 +280,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) // exit(); case 'apply': - $perm_template = $permHandler->getTemplate(); + $perm_template = $newbbpermHandler->getTemplate(); if (null === $perm_template) { redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE); } xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_APPLY, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ @@ -298,14 +298,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $opform->addElement($op_select); $opform->display(); -// /** @var \NewbbCategoryHandler $categoryHandler */ -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + /** @var \NewbbCategoryHandler $categoryHandler */ + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); -// /** @var \NewbbForumHandler $forumHandler */ -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var \NewbbForumHandler $forumHandler */ + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c - 1000] = ' '; @@ -337,7 +337,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) if ($forum < 1) { continue; } - $permHandler->applyTemplate($forum, $module_id); + $newbbpermHandler->applyTemplate($forum, $module_id); } $cacheHelper = NewbbUtility::cleanCache(); //$cacheHelper->delete('permission'); @@ -347,7 +347,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) default: xoops_cp_header(); -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -356,7 +356,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (0 === count($forums)) { @@ -365,7 +365,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ @@ -416,7 +416,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -426,7 +426,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } unset($categories); } else { -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (count($forums) > 0) { foreach (array_keys($forums) as $c) { @@ -443,9 +443,9 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form->display(); // Since we can not control the permission update, a trick is used here -// /** @var \NewbbPermissionHandler $permHandler */ -// $permHandler = xoops_getModuleHandler('permission', 'newbb'); - $permHandler->createPermData(); + /** @var \NewbbPermissionHandler $permissionHandler */ + $permissionHandler = xoops_getModuleHandler('permission', 'newbb'); + $permissionHandler->createPermData(); $cacheHelper = NewbbUtility::cleanCache(); //$cacheHelper->delete('permission'); include_once __DIR__ . '/admin_footer.php'; diff --git a/language/english/admin.php b/language/english/admin.php index 168abff0..98f6f809 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -185,6 +185,9 @@ define('_AM_NEWBB_PERM_TEMPLATEAPP', 'Apply default permission'); define('_AM_NEWBB_PERM_TEMPLATE_APPLIED', 'Default permissions have been applied to forums'); define('_AM_NEWBB_PERM_ACTION', 'Permission management tools'); +define('_AM_NEWBB_PERM_ACTION_HELP', 'Allows you to set the access rights for each function and group'); +define('_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT', 'Allows you to create an access rights template for automatic installation when creating a forum.'); +define('_AM_NEWBB_PERM_ACTION_HELP_APPLY', 'Allows you to apply a permission template to already created forums.'); define('_AM_NEWBB_PERM_SETBYGROUP', 'Set permissions directly by group'); // admin_forum_prune.php define('_AM_NEWBB_PRUNE_RESULTS_TITLE', 'Prune Results'); From e4a3461047fb430ec431042aad531d712c2818d2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 15 Sep 2017 14:55:53 -0400 Subject: [PATCH 067/170] rename helper.php --- class/{Helper.php => helper.php} | 0 class/utility.php | 26 +++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) rename class/{Helper.php => helper.php} (100%) diff --git a/class/Helper.php b/class/helper.php similarity index 100% rename from class/Helper.php rename to class/helper.php diff --git a/class/utility.php b/class/utility.php index e52964bb..0929b592 100644 --- a/class/utility.php +++ b/class/utility.php @@ -94,5 +94,29 @@ public static function cleanCache() ]; $maintenance->CleanCache($cacheList); xoops_setActiveModules(); - } + } + + /** + * Checks if a user is admin of NewBB + * + * @return boolean + */ + public static function userIsAdmin() + { + $helper = Newbb::getInstance(); + + static $newbbIsAdmin; + + if (isset($newbbIsAdmin)) { + return $newbbIsAdmin; + } + + if (!$GLOBALS['xoopsUser']) { + $newbbIsAdmin = false; + } else { + $newbbIsAdmin = $GLOBALS['xoopsUser']->isAdmin($helper->getModule()->getVar('mid')); + } + + return $newbbIsAdmin; + } } From 9ff09a235583e66c7ba29f7f3cf5fe201510f5fb Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Fri, 15 Sep 2017 19:10:15 +0300 Subject: [PATCH 068/170] Cosmetics --- admin/admin_permissions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index edd1729a..9250261e 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -107,7 +107,7 @@ public function render() $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); $this->addElement($tray); - $ret = '

    ' . $this->getTitle() . '

    ' . $this->_permDesc . '
    '; + $ret = '
    ' . $this->getTitle() . '
    ' . $this->_permDesc . '
    '; $ret .= "
    getExtra() . ">\n\n"; $elements = $this->getElements(); $hidden = ''; @@ -233,8 +233,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) foreach (array_keys($glist) as $i) { $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; $ret_ele = ''; - $ret_ele .= '
    ' . $glist[$i] . ''; - $ret_ele .= '
    '; + $ret_ele .= '
    '; + $ret_ele .= '
    '; $ii = 0; $option_ids = []; foreach ($perms as $perm) { @@ -257,7 +257,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $tray->addElement(new XoopsFormHidden('action', 'template_save')); $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); - $ret = '

    ' . _AM_NEWBB_PERM_TEMPLATE . '

    ' . _AM_NEWBB_PERM_TEMPLATE_DESC . '


    '; + $ret = '
    ' . _AM_NEWBB_PERM_TEMPLATE . '
    ' . _AM_NEWBB_PERM_TEMPLATE_DESC . '
    '; $ret .= "\n
    \n"; $ret .= implode("\n", $elements); $ret .= '
    '; @@ -267,9 +267,9 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) echo $ret; include_once __DIR__ . '/admin_footer.php'; break; - + case 'template_save': - // $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0); + // $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0); $res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); if ($res) { redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); From 53f35c44aedc027d824ae428785137fa24466847 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Sat, 16 Sep 2017 18:46:44 +0300 Subject: [PATCH 069/170] Deleting digest from the config --- xoops_version.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/xoops_version.php b/xoops_version.php index be4eeccd..26fc5252 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -532,19 +532,19 @@ 'valuetype' => 'int', 'default' => 1 ]; -$modversion['config'][] = [ - 'name' => 'email_digest', - 'title' => '_MI_NEWBB_EMAIL_DIGEST', - 'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 0, - 'options' => [ - _MI_NEWBB_EMAIL_NONE => 0, - _MI_NEWBB_EMAIL_DAILY => 1, - _MI_NEWBB_EMAIL_WEEKLY => 2 - ] -]; +//$modversion['config'][] = [ +// 'name' => 'email_digest', +// 'title' => '_MI_NEWBB_EMAIL_DIGEST', +// 'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC', +// 'formtype' => 'select', +// 'valuetype' => 'int', +// 'default' => 0, +// 'options' => [ +// _MI_NEWBB_EMAIL_NONE => 0, +// _MI_NEWBB_EMAIL_DAILY => 1, +// _MI_NEWBB_EMAIL_WEEKLY => 2 +// ] +//]; $modversion['config'][] = [ 'name' => 'show_ip', 'title' => '_MI_NEWBB_SHOW_IP', From 504bdbd615b18a85f7d42797e90c51ece530187d Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Sun, 17 Sep 2017 22:30:26 +0300 Subject: [PATCH 070/170] Edit config digest --- xoops_version.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xoops_version.php b/xoops_version.php index 26fc5252..4ff5c272 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -532,19 +532,20 @@ 'valuetype' => 'int', 'default' => 1 ]; -//$modversion['config'][] = [ -// 'name' => 'email_digest', -// 'title' => '_MI_NEWBB_EMAIL_DIGEST', -// 'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC', +$modversion['config'][] = [ + 'name' => 'email_digest', + 'title' => '_MI_NEWBB_EMAIL_DIGEST', + 'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC', + 'formtype' => 'yesno', // 'formtype' => 'select', -// 'valuetype' => 'int', -// 'default' => 0, + 'valuetype' => 'int', + 'default' => 0 //, // 'options' => [ // _MI_NEWBB_EMAIL_NONE => 0, // _MI_NEWBB_EMAIL_DAILY => 1, // _MI_NEWBB_EMAIL_WEEKLY => 2 // ] -//]; +]; $modversion['config'][] = [ 'name' => 'show_ip', 'title' => '_MI_NEWBB_SHOW_IP', From 9161e7e877792ff66a0ef4d8531a6f9f5891c1c8 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Sun, 17 Sep 2017 23:25:56 +0300 Subject: [PATCH 071/170] Edit config file --- xoops_version.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/xoops_version.php b/xoops_version.php index 4ff5c272..be4eeccd 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -536,15 +536,14 @@ 'name' => 'email_digest', 'title' => '_MI_NEWBB_EMAIL_DIGEST', 'description' => '_MI_NEWBB_EMAIL_DIGEST_DESC', - 'formtype' => 'yesno', -// 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 0 //, -// 'options' => [ -// _MI_NEWBB_EMAIL_NONE => 0, -// _MI_NEWBB_EMAIL_DAILY => 1, -// _MI_NEWBB_EMAIL_WEEKLY => 2 -// ] + 'formtype' => 'select', + 'valuetype' => 'int', + 'default' => 0, + 'options' => [ + _MI_NEWBB_EMAIL_NONE => 0, + _MI_NEWBB_EMAIL_DAILY => 1, + _MI_NEWBB_EMAIL_WEEKLY => 2 + ] ]; $modversion['config'][] = [ 'name' => 'show_ip', From 4b973d29348bb94483a48324746dcc1b3ec4f791 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Sep 2017 00:05:17 -0400 Subject: [PATCH 072/170] fix return type --- class/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/helper.php b/class/helper.php index 6f7f0347..f7cfa199 100644 --- a/class/helper.php +++ b/class/helper.php @@ -42,7 +42,7 @@ protected function __construct() /** * @param bool $debug * - * @return Publisher + * @return Newbb */ public static function getInstance($debug = false) { From 0fb1c0bcf8379abf58946a8504e267bf60c9f49c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Sep 2017 00:06:16 -0400 Subject: [PATCH 073/170] PhpDocs --- class/topic.renderer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/class/topic.renderer.php b/class/topic.renderer.php index 29ead3d7..bf27921b 100644 --- a/class/topic.renderer.php +++ b/class/topic.renderer.php @@ -625,6 +625,7 @@ public function getStatus($type = null, $status = null) /** * @param Smarty $xoopsTpl + * @throws \RuntimeException */ public function buildSelection(Smarty $xoopsTpl) { @@ -674,6 +675,7 @@ public function buildSearch(Smarty $xoopsTpl) /** * @param Smarty $xoopsTpl + * @throws \RuntimeException */ public function buildHeaders(Smarty $xoopsTpl) { From 98a0032b3b675276c63852581873eb8f7639eee6 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Mon, 18 Sep 2017 10:22:06 +0300 Subject: [PATCH 074/170] Add help Digest --- admin/admin_digest.php | 4 ++++ language/english/admin.php | 1 + language/english/modinfo.php | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/admin_digest.php b/admin/admin_digest.php index 86734635..5006aa76 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -119,6 +119,10 @@ echo '
    '; echo '
    '; + echo '
    '; + echo ' ' . _AM_NEWBB_PREFERENCES . ' - ' . _MI_NEWBB_ADMENU_DIGEST . ' '; + echo _AM_NEWBB_DIGEST_HELP_AUTO_DIGEST; + echo '
    '; $nav = new XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); echo $nav->renderNav(4); diff --git a/language/english/admin.php b/language/english/admin.php index 98f6f809..66f2bd25 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -74,6 +74,7 @@ define('_AM_NEWBB_DIGEST_HELP_2', 'Create a newsletter is possible only after the topic is marked as \'Digest\'.'); define('_AM_NEWBB_DIGEST_HELP_3', 'The dispatch is made only to users signed up for notification of digest topics.'); define('_AM_NEWBB_DIGEST_HELP_4', 'After creating and sending, do not delete the created messages. Otherwise they will be generated again.'); +define('_AM_NEWBB_DIGEST_HELP_AUTO_DIGEST', 'To configure the automatic creation and distribution of Digest topics, you need to create a cron task on your server.
    For example: * NIX systems: 0 6 * * * wget --post-data \'foo=bar\' https://example.com/modules/newbb/digest.php
    In this example, the script will run every day at 6.00 and check if there are any new Digest topics. If they are not found, mailing will not be done.
    If for any reason you do not have the opportunity to create a task, then it is possible to create and make the dispatch on this page manually by clicking on the button above.
    Please note that it is not recommended to delete created mailings, otherwise they will be created and sent again.'); //define('_AM_NEWBB_DIGEST_PAST', 'Should be sent out %d minutes ago'); //define('_AM_NEWBB_DIGEST_NEXT', 'Need to send out in %d minutes'); //define('_AM_NEWBB_DIGEST_ARCHIVE', 'Digest archive'); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 89952a2c..c49bc533 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -108,7 +108,7 @@ define('_MI_NEWBB_SHOW_PERMISSIONTABLE', 'Show Permission Table'); define('_MI_NEWBB_SHOW_PERMISSIONTABLE_DESC', 'Setting YES will display user\'s right'); define('_MI_NEWBB_EMAIL_DIGEST', 'Email post digest'); -define('_MI_NEWBB_EMAIL_DIGEST_DESC', 'Set time period for sending post digest to users'); +define('_MI_NEWBB_EMAIL_DIGEST_DESC', 'Set time period for sending post digest to users
    Note: To enable this feature, read recommendations on setting up.'); define('_MI_NEWBB_EMAIL_NONE', 'No email'); define('_MI_NEWBB_EMAIL_DAILY', 'Daily'); define('_MI_NEWBB_EMAIL_WEEKLY', 'Weekly'); From 6157152f796127e3e121281d7f8dacaac93784c0 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Mon, 18 Sep 2017 12:12:12 +0300 Subject: [PATCH 075/170] Add help --- admin/admin_cat_manager.php | 6 ++++++ admin/admin_forum_manager.php | 9 +++++++++ language/english/admin.php | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index 64dce338..64ab6956 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -199,6 +199,12 @@ function editCategory(XoopsObject $categoryObject = null) } echo '
    '; echo '
    '; + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_CATEGORY . ' '; + echo _AM_NEWBB_HELP_CATEGORY_TAB; + echo '
    ' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; + echo '
    ' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; + echo '
    '; break; } diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index 8332fa31..f46bdf46 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -301,6 +301,15 @@ echo $echo; echo '
    '; echo '
    '; + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_FORUM . ' '; + echo _AM_NEWBB_HELP_FORUM_TAB; + echo '
    ' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; + echo '
    ' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; + echo '
    ' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . ' - ' . _AM_NEWBB_CREATEFORUM; + echo '
    ' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . ' - ' . _AM_NEWBB_MOVE; + echo '
    ' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . ' - ' . _AM_NEWBB_MERGE; + echo '
    '; break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/language/english/admin.php b/language/english/admin.php index 66f2bd25..6a6e6adb 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -318,3 +318,7 @@ define('_AM_NEWBB_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); define('_AM_NEWBB_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); define('_AM_NEWBB_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +// Help tab +define('_AM_NEWBB_HELP_CATEGORY_TAB', 'To create a category, use the button above and fill in all the fields on the form.
    By default, category images are located: /modules/newbb/assets/images/category/
    Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.'); +define('_AM_NEWBB_HELP_FORUM_TAB', 'To create and manage the forums use the buttons with the right
    To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.
    To move the forum between categories, use the \'Move\' button. Follow the further instructions.
    To merge forums, use the \'Merge\' button. Follow the further instructions.'); From 97c5ef34964391e26f32794b7d386db456fc0fd1 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Mon, 18 Sep 2017 12:40:55 +0300 Subject: [PATCH 076/170] Edit help --- language/english/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/english/admin.php b/language/english/admin.php index 6a6e6adb..83ace109 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -321,4 +321,4 @@ // Help tab define('_AM_NEWBB_HELP_CATEGORY_TAB', 'To create a category, use the button above and fill in all the fields on the form.
    By default, category images are located: /modules/newbb/assets/images/category/
    Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.'); -define('_AM_NEWBB_HELP_FORUM_TAB', 'To create and manage the forums use the buttons with the right
    To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.
    To move the forum between categories, use the \'Move\' button. Follow the further instructions.
    To merge forums, use the \'Merge\' button. Follow the further instructions.'); +define('_AM_NEWBB_HELP_FORUM_TAB', 'To create and manage the forums use the buttons with the right
    To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.
    To move the forum between categories, use the \'Move\' button. Follow the further instructions.
    To merge forums, use the \'Merge\' button. Follow the further instructions.
    If you have an access rights template, then you can apply it to the forum you are creating.'); From f8dd8bcf5de15bf1d12974a42e8ba9c45f6df565 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Mon, 18 Sep 2017 14:12:02 +0300 Subject: [PATCH 077/170] Add help tab module --- admin/admin_forum_prune.php | 6 +++++- admin/admin_forum_reorder.php | 4 ++++ admin/admin_groupmod.php | 4 ++++ admin/admin_permissions.php | 5 ++++- admin/admin_report.php | 4 ++++ admin/admin_synchronization.php | 4 ++++ admin/admin_type_manager.php | 4 ++++ admin/admin_votedata.php | 4 ++++ language/english/admin.php | 8 ++++++++ 9 files changed, 41 insertions(+), 2 deletions(-) diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 61f4d58e..93db93e0 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -254,5 +254,9 @@ $sform->display(); } -echo '
    '; + echo '
    '; + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_PRUNE . ' '; + echo _AM_NEWBB_HELP_PRUNE_TAB; + echo '
    '; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index 787c9131..fc8e2480 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -114,5 +114,9 @@ echo '
    '; echo ''; echo '
    '; + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_ORDER . ' '; + echo _AM_NEWBB_HELP_ORDER_TAB; + echo '
    '; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index f425c12a..b6999d39 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -101,4 +101,8 @@ echo ''; echo ''; echo ''; +echo '
    '; +echo ' ' . _MI_NEWBB_ADMENU_GROUPMOD . ' '; +echo _AM_NEWBB_HELP_GROUPMOD_TAB; +echo '
    '; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index 9250261e..9a42568f 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -441,7 +441,10 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) unset($forums, $categories); } $form->display(); - + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_PERMISSION . ' '; + echo _AM_NEWBB_HELP_PERMISSION_TAB; + echo '
    '; // Since we can not control the permission update, a trick is used here /** @var \NewbbPermissionHandler $permissionHandler */ $permissionHandler = xoops_getModuleHandler('permission', 'newbb'); diff --git a/admin/admin_report.php b/admin/admin_report.php index c2791275..1b439dd6 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -179,6 +179,10 @@ echo ''; $nav = new XoopsPageNav($reportHandler->getCount(new Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); echo $nav->renderNav(4); + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_REPORT . ' '; + echo _AM_NEWBB_HELP_REPORT_TAB; + echo '
    '; break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index 917eea63..61eedf39 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -168,4 +168,8 @@ echo "" . "
    "; echo $form; echo '
    '; +echo '
    '; +echo ' ' . _MI_NEWBB_ADMENU_SYNC . ' '; +echo _AM_NEWBB_HELP_SYNC_TAB; +echo '
    '; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index b689c38a..4c30bbef 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -426,6 +426,10 @@ echo ''; echo ''; echo ''; + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_TYPE . ' '; + echo _AM_NEWBB_HELP_TYPE_TAB; + echo '
    '; break; } diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index 26173373..98d0e8bb 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -130,6 +130,10 @@ $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; $pagenav = new XoopsPageNav($page, 20, $start, 'start'); echo '
    ' . $page . '' . $pagenav->renderImageNav(4) . '
    '; + echo '
    '; + echo ' ' . _MI_NEWBB_ADMENU_VOTE . ' '; + echo _AM_NEWBB_HELP_VOTE_TAB; + echo '
    '; break; } include_once __DIR__ . '/admin_footer.php'; diff --git a/language/english/admin.php b/language/english/admin.php index 83ace109..44ca96ae 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -322,3 +322,11 @@ // Help tab define('_AM_NEWBB_HELP_CATEGORY_TAB', 'To create a category, use the button above and fill in all the fields on the form.
    By default, category images are located: /modules/newbb/assets/images/category/
    Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.'); define('_AM_NEWBB_HELP_FORUM_TAB', 'To create and manage the forums use the buttons with the right
    To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.
    To move the forum between categories, use the \'Move\' button. Follow the further instructions.
    To merge forums, use the \'Merge\' button. Follow the further instructions.
    If you have an access rights template, then you can apply it to the forum you are creating.'); +define('_AM_NEWBB_HELP_PERMISSION_TAB', 'When setting permissions, be careful.
    After you install and apply the settings, you will automatically go to the next permissions tab.
    Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.'); +define('_AM_NEWBB_HELP_ORDER_TAB', 'Allows you to set the order of categories and forums relative to each other.
    The order (Weight) is set to 0 - top, 99 (and further) - bottom.'); +define('_AM_NEWBB_HELP_PRUNE_TAB', 'Allows you to clear forums from empty themes, obsolete themes, etc.
    Also you can not delete topics that you want to clear, but transfer them to a specially created category \'Archive\' or any other.'); +define('_AM_NEWBB_HELP_REPORT_TAB', 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.
    You can review the report and take action in relation to the message, the author, etc.
    When a user sends a message, moderators and administrators are notified by e-mail.'); +define('_AM_NEWBB_HELP_VOTE_TAB', 'If you have the voting function enabled, here you can see the results of the voting.
    This vote is not associated with other XOOPS modules.'); +define('_AM_NEWBB_HELP_TYPE_TAB', 'Allows you to create tags for highlighting themes. For example:
    [Important] Topic Title
    [ATTENTION] Topic Title
    You can set theme types when creating a theme on the user side.'); +define('_AM_NEWBB_HELP_GROUPMOD_TAB', 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.
    It is recommended to create separate groups of moderators, for more convenient management of moderators.
    You can also assign specific users to moderators when creating a forum.'); +define('_AM_NEWBB_HELP_SYNC_TAB', 'If you notice a problem with the message dates, the appearance of blank messages, etc. Here you can synchronize and correct forum data and topics'); From 4f4efe767ea5d07aa1c866e8b72b7142527e6409 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Sep 2017 11:12:48 -0400 Subject: [PATCH 078/170] updates --- seo_url.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/seo_url.php b/seo_url.php index 6360e0a6..86d3196b 100644 --- a/seo_url.php +++ b/seo_url.php @@ -240,6 +240,14 @@ function forum_seo_topic($_cat_id) $res = $GLOBALS['xoopsDB']->fetchArray($result); $ret = forum_seo_title($res['topic_title']); + $moduleDirName = basename(__DIR__); + /** @var \NewbbTopicHandler $topicsHandler */ + $topicsHandler = xoops_getModuleHandler('topic', 'newbb'); + $criteria = new CriteriaCompo(new Criteria('topic_id', $_cat_id, '=')); + $fields = ['topic_title']; + $ret0 = $topicsHandler->getAll($criteria, $fields, false); + + return $ret; } From 5381483810dd49ccfab2164675864f3eb2c72628 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Mon, 18 Sep 2017 20:36:54 +0300 Subject: [PATCH 079/170] Edit permission table --- assets/images/icons/accept.png | Bin 0 -> 781 bytes assets/images/icons/application_add.png | Bin 0 -> 619 bytes assets/images/icons/application_delete.png | Bin 0 -> 610 bytes assets/images/icons/application_edit.png | Bin 0 -> 703 bytes .../images/icons/application_form_delete.png | Bin 0 -> 605 bytes assets/images/icons/application_form_edit.png | Bin 0 -> 714 bytes .../images/icons/application_form_magnify.png | Bin 0 -> 612 bytes assets/images/icons/application_lightning.png | Bin 0 -> 656 bytes assets/images/icons/cancel.png | Bin 0 -> 587 bytes assets/images/icons/chart_bar.png | Bin 0 -> 541 bytes assets/images/icons/chart_bar_add.png | Bin 0 -> 626 bytes assets/images/icons/chart_bar_delete.png | Bin 0 -> 636 bytes assets/images/icons/drive_add.png | Bin 0 -> 623 bytes assets/images/icons/drive_delete.png | Bin 0 -> 628 bytes assets/images/icons/folder_delete.png | Bin 0 -> 666 bytes assets/images/icons/folder_go.png | Bin 0 -> 694 bytes assets/images/icons/html_add.png | Bin 0 -> 698 bytes assets/images/icons/html_delete.png | Bin 0 -> 688 bytes assets/images/icons/page_white_acrobat.png | Bin 0 -> 591 bytes assets/images/icons/page_white_delete.png | Bin 0 -> 536 bytes assets/images/icons/printer_add.png | Bin 0 -> 782 bytes assets/images/icons/printer_delete.png | Bin 0 -> 792 bytes assets/images/icons/report_add.png | Bin 0 -> 714 bytes assets/images/icons/report_delete.png | Bin 0 -> 729 bytes assets/images/icons/tag_blue_add.png | Bin 0 -> 671 bytes assets/images/icons/tag_blue_delete.png | Bin 0 -> 701 bytes assets/images/icons/user_delete.png | Bin 0 -> 767 bytes assets/images/icons/user_go.png | Bin 0 -> 793 bytes language/english/main.php | 36 ++++++++++++++++++ templates/newbb_viewforum.tpl | 2 +- templates/newbb_viewtopic.tpl | 2 +- 31 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 assets/images/icons/accept.png create mode 100644 assets/images/icons/application_add.png create mode 100644 assets/images/icons/application_delete.png create mode 100644 assets/images/icons/application_edit.png create mode 100644 assets/images/icons/application_form_delete.png create mode 100644 assets/images/icons/application_form_edit.png create mode 100644 assets/images/icons/application_form_magnify.png create mode 100644 assets/images/icons/application_lightning.png create mode 100644 assets/images/icons/cancel.png create mode 100644 assets/images/icons/chart_bar.png create mode 100644 assets/images/icons/chart_bar_add.png create mode 100644 assets/images/icons/chart_bar_delete.png create mode 100644 assets/images/icons/drive_add.png create mode 100644 assets/images/icons/drive_delete.png create mode 100644 assets/images/icons/folder_delete.png create mode 100644 assets/images/icons/folder_go.png create mode 100644 assets/images/icons/html_add.png create mode 100644 assets/images/icons/html_delete.png create mode 100644 assets/images/icons/page_white_acrobat.png create mode 100644 assets/images/icons/page_white_delete.png create mode 100644 assets/images/icons/printer_add.png create mode 100644 assets/images/icons/printer_delete.png create mode 100644 assets/images/icons/report_add.png create mode 100644 assets/images/icons/report_delete.png create mode 100644 assets/images/icons/tag_blue_add.png create mode 100644 assets/images/icons/tag_blue_delete.png create mode 100644 assets/images/icons/user_delete.png create mode 100644 assets/images/icons/user_go.png diff --git a/assets/images/icons/accept.png b/assets/images/icons/accept.png new file mode 100644 index 0000000000000000000000000000000000000000..89c8129a490b329f3165f32fa0781701aab417ea GIT binary patch literal 781 zcmV+o1M>WdP)4-QibtN)VXQDpczE`xXAkUjh%RI>;okxb7K@0kpyQ1k_Y(|Oe7$m(^ zNYX>mI||sUbmn+c3<&FnE=4u#()KBS^SH8e)Qs5i!#lY=$-1gbH6VluzU=m=EP78&5vQ z-?+fFP-G2l&l_QzYealK$;1Rl?FkzXR&Jv@fBPNjCr#AYRyJ7UJQ0v#?)7Ott=>3`#-pV!7>9}>Q1jL)H6h&gkP@3nI=+F3nA~M>u#(n* z8T!#8oEw&-mED4!h4s!N@Jo3S7N&Q6%6l3}nlcd~X@>;uelvPsSkXIgg~e+^T1zSf z3SNj(5%jK~i8@b;C0Ag3?`k8$#1J0F}NdayEtTz+~+#EG995YAF(1xew#=1J)ogJuY z3Lxu(1VP;KAh`GKm^?X0f~UCV*)Nf5F(3GKr=#9qzp;L29U)FF98>T4&VoHZ|-ho>^FRq4ws;uOVa=V002ovPDHLk FV1kR43LgLf literal 0 HcmV?d00001 diff --git a/assets/images/icons/application_delete.png b/assets/images/icons/application_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..0a335acf67423fd5a17caf2d18a67e66e870611f GIT binary patch literal 610 zcmV-o0-gPdP)hj32+Ia2PFSwHp_;8^u8>r6{e*krHy43#H^jT&z}Wa&xpokqZtA zFR&Fehhe_gp*x{i&XLj%HzdqAeQvxDT1Rjn;gaWw} z5^~2QShuR2o0yn9fA7Y?Xzt(DKhn`?rmhAn(VT1h2r!!4rBZw52P-vSDzPZb#g$`y ztkj8XEoxZ`Y73PkKp{LJ5D~&7@Je_kT)~2i-c6l&IJJyK&5~gfN`_2W7%3TM2{XqE zQA8qFq861?%N|ZG0Wt%FLJ$TKq7Wo2$Odl0Q&0;JYFQzcn1MtBWCjLiAQxdE1Cmih zK`p|mAf*(48Y1z>=gVSoY2jATaZ?l66O4$*k`47+`l zweRoK+p__ghH^x(%m8DN8Gl-sYSGx#3kS}zEMMMC5wqj&noaWd37uvw=_X01NGD-Z+i^1;8t2&z(w`{C(PM?|mR`Ky`;pIFxeKF=OosmQ6jmTLP{}-6iF>nO8f(+aY2!Xm^*5Av6NhR zD0!Nar%`rnu~v@R4hO^8&iS41=VQN>+65QO>m_E!|B#IbuI^pAy5?9WYjHC`6;s8j z!_-hy%sJEya}KAD$C|Z-~!ZLFQctG09Uhp@QPcl?mU}7$E{?cz}t3fC%LK?;}5+keI!OTyHb6 z@j}nbBm-HHT&CJnb^IYBAVSCka_RdNzT74;XDve?FCx*eM2ky^TZSvCN4lf#zADBt{VLMZ58~8Xlk&tIj2}J+_M1=n24SuBB zC|kIW{HG=&F(WrHgY=^pRBSp=QTYN)m5{Hh{2@SBTQi04uPMk>dS9PrQdx|l%yhmz zOH#Sz0@1`YLTX0HPj&aS)SnFM)H&2CwbI1q`b)fRK1k<-HpW#}^Sv*{jiIgdH9W>t zQ6<#EFflVmJF;g{aA;S(kLP%K=NdiTT|X03N>|n%ZExo<#LO72ZdK{vlG)|{vIVoS lXs&IrKfQB(Y=*2{WUucY-zdJL^dl3I%>;ad8o^ z7>UT-aEZGeIS2v;T;fmM9XBTt$%UH}0?1h*2qK@)Ge19v#5w^G0dO}Gk-On;h*g0V zg0c5w{A6?(dp$&D`V;BhwH(@f3^+wpiDS%+&U-Vg>20eaQ79BhObrh(SA506v+ZnZ z$g})zgzWPtJU(945y>2Pr{~-rKqTCq^~N9e(A;`~%*Utj>?T{b@1P-MscT0g(~ZNI{bH#Y_Utm11j?0+FF&hK-qRX-TePYY3~f zgtoM;)~2M+AJew!(sr+7^KN&$cgxoJcJAGZGzzQ(AD(j#=leYm&p8hTfchUO*=18r zr!~koJq|$qh+zB()q@3G>7PU6y;(H$c~Nhe#3lU)C~l9VR_BJ=;N(S}WT3GGbJ~$L zY!^k>SWYq!Z~hmmJ4PWHsEvN4)9Gy^Z?)wOR0E3;1OdDR51!|xxx?Z3jR~6$3lGcS zw`wrecMQ|rMHQ4-uw*icvKH@8Qe-U(ejNgB1!Gqt;e8II!iaktI@}570bpEkH@7b5obwc$sUX75)sc{ zLoV$^I#`Q!&qeqKv2}x;Q6ZOcK?qbLvr>-a zyc(hY)2O@Nn=hiGX9AH(WK#{q_3OcQFyqRCxB{6^XTi-jVaae3jL(UZMoZqHPUiu` zFod;2WZ-*e#Qe)flJ*;9mgV@eat;ZSNkD%BUpZPjbEd(ZH>lOVM>tFq!k`K6p&rZ) zt12-&(V<8oA9F-Oc!oCq@PvQW{0``D3AONE*fZt6-G6K6?>+q?gw;DtTL1t607*qoM6N<$g3ymi=>Px# literal 0 HcmV?d00001 diff --git a/assets/images/icons/application_form_magnify.png b/assets/images/icons/application_form_magnify.png new file mode 100644 index 0000000000000000000000000000000000000000..7b7fbd17e39353723122664abae8461f3788227d GIT binary patch literal 612 zcmV-q0-ODbP)PDrjnPX=rH; zqQ${l4iyS4Fv&4giDwVmm?Q$ zhTL&8OyXERuCJ_Y++wrjMj8GD99k(+b> z<{<5wp8G;7au@E7lX7q%1U@V;^Dm<#Bbba-gga)&*~B}OVT z8FJ_8^ce^a9*{dnoOjg?w)UFTS_KNZh~pjN>QDihNJTD3CPDxgha7@4JUq?D&XIEY9KSYW_M1j`N1m2BQ6{jt9pgXOIG5 z7fYv3PRIVYk-8wpOV0eq;C3`{e8D((T~xwBz-I8+ZE$ y`XBWUUFlg}deaE*PP<-CUAQ$+zVt#$I(`F{%rIviW}jLB0000{ZkEO_ z+;HhiElFxjo6yjHV871y>^#rs^RXwCT*&fzIWyybxb6!Br}uWWU;9$Bf*GKSsUj+v z8fuD(pk|l|qDo!0UmO{kxHx#D=eBF#)81E=FC^>ptVCh4Bz?ebSMrvWzAUg(nYV;x z&cwLV+rmnnxcZLBnJG~v2nK}tXOutoV-he?G$bx z+bC({FJWHT=iUt#X!bBen!k*-=p@PWvgC{e!HNhnW4l8{R)d>tR6uCaqq{zj!VO;W#; z=I-mb+9r}T#Z-x$suC48_VSB{1!iC0r8N1H^86&l9p|WTJFS^-G}e*;M)Q6>s#cP zI`Y#S($G6W`W@NI5g|L-MKl0Zmu$m^(0~^Lwo5OO~d#(vPfzV&qIn(Wzh!))n z^W^$!aM&X3bCX~Vo|JLOLCb!-`g!yN7b-yh!|sbVZ|M~fElQAyiB?lO%sjz z7TJ==TTk%_A{ znxkIa+E~RC#EKF{U0G~y<6)R9(uCp7&f7|JN}RHwEO@{EgbF~D3a1<@ip|9yZb^6$ fo@6A$W#9P^w2GuX0-m@}00000NkvXXu0mjfB69Bi literal 0 HcmV?d00001 diff --git a/assets/images/icons/chart_bar_add.png b/assets/images/icons/chart_bar_add.png new file mode 100644 index 0000000000000000000000000000000000000000..d283e846a29f929681435f01c961faf486f274a6 GIT binary patch literal 626 zcmV-&0*(ENP)v?QT{`n=t5=RT+5AJm{BbjCAW=lY$)Da?%jsp?V9`R99QPKcuTq)0YGwL-(m(ExjR zzuclKmIO;e`|<-qG<-6WDBZP8-RFN8Ox*-kikvBOrm?96F3M(~{l;?gmI5KBPtkOY!&7>tk<7nGEZ-Y!L3%G}C~r6|OhNInrl zqM|;42>1ZrLyRHVOl)v{XpDkl^VKAerZ3ijA_ypt(BA64R z80Y(Hh{E@82W;)EvAMI#{Pa^6UeD0o(N$jIQP(YWX%`EErHrMF_GXrsb|5O2g|h>< zS^xBg@!?5ceO{!qsIvO;9rd3>6eoS>vAY)*fLY))&;S3R-CpH1QEovYWmCYySByZom|YEI8%B`R1GhlckjSpUF2{PTyTgQ57!`qvAzz zqRdR~&DsJuuN>Roji{mtBqkobY_#vd1jR>XWmO0<(brXB&1n08mJz%tHYgGkF7Kde zWOG2edbw;-l@x>&gkty#&L?b01W`Jxk%o=`a4>!xRLNo_i;?DA#Yw`rNQlr?O*FQO zkb;nj!0T5a0S+Bz&3J533SUOB+cLz2Edb7!0B0cx1Yy-BTu_WtLQM456m2ONpPWm< z3*HBU4LBFb)jB#vz&Z#4yl1VYSf4On@v-dUl-%R=%v0j>7o=XtjZSd8_KjT4`eo<9 zdk{fPC>^W=_I0Z3g&_JCdpTCl)!obD|BB)W!1_yo3B|7_u;pC;i{dA52tYEI|a~eRQO%X$#2w7ptCJieWo?|tumGdpatSl}!}!5N1pKRTVx zYtQov9GK7Nn9XJZrqgMF$z(#YQ7)H@#ADO~CtouR!$~HSBI(}|Zd2EFIF5r}uUD*8 zDh=U)D?W_J;}{GEFikTcg^Bdt@Anal#gNHlNOYYqH(0CH66%RW0;AFBgk5Tdh>S6) zsw&i@(I_I327D}hnA}^In5vQP$D)maB4FVOQ z0hf5YdVgCqA3E{(5>wnYI+BvLk;4J;Fx*1L!MP-8z)TFztX+(o=;@1Xf{ z8zaR&EeYiS+`6&~Pw{a1dUSK7c$Mb_%(D;egYqi>H=r0SR#1Hd3 zbY|nm@?BBzL2(N&Tbo$0>hYiWzmcyj9o@cp-I~M4TIne^cJIJaO+4GKx~F$XWFb(ha-_q6-cG~B>a{s~x5BE5t9KSg>n~%S){RQIedSx-2#tZ-e002ov JPDHLkV1g!V6x{#- literal 0 HcmV?d00001 diff --git a/assets/images/icons/drive_delete.png b/assets/images/icons/drive_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..e6eb186651560bfda194ec72b52e1b48dea31a2b GIT binary patch literal 628 zcmV-)0*n2LP)_P+#g$MH7vfLQmHX~h5`qmw zX%SqwFr*kv!PKM2!+a za=FeGc#O|esT54pL?jaNK|vs`yWK95$s}}LC(;csU1yC(gR`g8X;_wZPA-i?K*ktk zS?27CL;|r`4Ap8C?RLAU5IaeyS*b`>Rqld4sD$ElI>l%-LO!2Iv)SBGh-o++qTlcH z0}@4am=wicfoP;@8n4S{vxF%q#7eW0(+6^D zK*hm7u-N;I^p71#?@ZXq1st#5=VS8*0!W}-F6T=oFy*6rAF+f3tUP>zh<*#FUu)Rg z*}{#Z=vf2$17g0QT){rre2<%@$58hTVEZNJ=2N(?Eo0^T7bxC|Rx6dtTHu!XQTW>L zL#T^7aPR5gEBs;!^Y+QvP5htL?kGQ3*B@Mq9elv})WnIGJGNwe+ehz0k7@48)wj)0 z+s?016qX#q(SV`dW3EU2nqBlc@2+dlhJ(XLvdflTdDin#Z|>HdSAPI_FMg8I(Y~ty O0000#NXU(rVJZ0_Z7&gXp3z2_(q;VkBGMmsaW16Y~9 zp7fgr29!F<6RP>ub)&O4fa*V43V`C3yGz;wP~!A;4tPPFm}sl;XZ|Jd$pb)31sm2?QX#5xu zDMxIG3FC+rZ21>aF->7BLCkLhiNJ=4Xh0M6jm8n%ee?z>@vSZsmO#QHQGTDG?-71; z|3Slt3Z$mMI}gV3jscN_SKq?<{>Mjwg2jd#=*TQ%RKcRuE)beKot?IvC(#|lF1=DdvMQ?PApSc z(OerDrLOlX<;5AkFU)$g!?9p2(@mCY5j}K^A z`%F()Gos|V2Oy!%=+bUOREP)Iz!8ao4L~j+rb@K)1;4cy?z}jjz=<|ot9ojHO7-2^ z`+I{3!zhCP=C$6fDzWuJ*>mjD0&07*qoM6N<$f)0Et AfB*mh literal 0 HcmV?d00001 diff --git a/assets/images/icons/folder_go.png b/assets/images/icons/folder_go.png new file mode 100644 index 0000000000000000000000000000000000000000..34a736f70261338c9bca98c38b78193740fa83a0 GIT binary patch literal 694 zcmV;n0!jUeP)N@Zw27r|iugjyK_i?%mf=ZN1k*q&Uedp~2B7g_+fS`hk+Nr1A{hI)z0`VHB6Nndl zX$Di6C%-U4JXr@~z-vS-U`e(1B@n-FV+JTmdRsylL39C=TOrljOR~Cct>JYCvg#mK z1ulqf0!%<`#~!NMu5Ba=9u&fmP-Zhc6E?!yaAE01t20W#1|(JmqlC- zu^GHsMqCzbhR}vI*0gbTWQ<2wA~0LlNQ8*Dc(aJuEaI~Cy?zX0(B7i0rEb>&+G>xJ z3k&o-xX8WohAjXsqHu`)jo1ugGgz-V-_eT`kMj#kXL{&TC&D=t zDS)urCatsVt!&16hZE0Sc81**wR}pC@@4w{a?#MB{`E|khgw{yHQH-JtJz=E5u9kb zz}UGYch2$-=^h zQVJ0^k`=iwScsT0WZcd--+ABnd7lTRY!o%WUt(rVM9KuEOi*_8;z#2zM3oQ}Cqf8N zh*3Df1)=ap9+aXGGJaax+r}S;s1c(fYDhGK7(tZ~j37#giWlX~?NKs*`!+5_1yMty z;-e8n31WCroJ4#uoG3mhoz;w@A*B4IW(@Y#a3QjxzsA<(9qd@y$nHnKc$&TqGsvA_1`Q{e zLGB`|#<`p4>6!C@!GR@oclL7U*=6oOy+D2X3zD_Rp4+DW4&IJAd{CSyE*M@ECyE!P zT@SKl<2op%Y+kgVp<8<>k#gbEHPUb2g~CT_ttD!cO0>6?=%|*cS4&K*W^_#{^QAFL zIjORF(SCk8xb_V5yZT7dKsHtcPF{V71w)-;Ua+8;i{KTDO3&iYJR82pqv5+88a&7G z8@p&NRWL1+m>K`FY~QS7-SgTHujpGv?~Hz4zJJKQ$9H-A>g!NqX8ez3`(_;n_5wBF gJ8Bpk0QT%*y_loy;s5{u07*qoM6N<$f-kT=jQ{`u literal 0 HcmV?d00001 diff --git a/assets/images/icons/html_delete.png b/assets/images/icons/html_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..1bd28489e55af96b73429471606072a80143216b GIT binary patch literal 688 zcmV;h0#E&kP)P}pU>|WE!{&llBw4ut;O*J;G z?4X<_99Tb_)^ftJ&2y={NW(?62&7JgAW9`ma6zfGq}+P;gCv0~55KdZ*20SU6}qZr z+RG_R=2Xa=ks>IX3t8@jrYMz`go7JvWNAX~1T&-VBC626yaNN8L8&(*4IgnK#qvm6 zFAV3E!YkJv58_2>G!+B#W+a;N{%eB|cdxVd-d5i2Yv)Msc9wm-jXF>EtMD{^8)i&S zhWaGuE~09@zH^nG>2o$6K2BxnDvEbc`Oy1}x7Hxpa_OV(T{DYsqYfVwCyEPyoS!(? z;l5q$IeD74&o80B4`$3{BwNgrC!fg1#)ZO1I$KNlmW0-j5Gsa9LXec8Ml~Oxb>33g zb>{B}UYO53ev*wAfg6wev0$iE%nKG2a}m5^QQ2Cq(s=WT_6MhM#UKq}e5}MsQX`p4 z8vA;>E|fdl&n>J;mZjeq9~Qn0m11bx`DChbe$}(+Y(6@0q7;+Gv1I)QH+MXh%fA7S WOLjj|mpRh_0000~O9lw>B8WRlD)Gm}Jrz31u-X&&gn2lvjs=i{7nIaL6v2==uw+8Lcs(8j27 z;|c`rmSv@Lx!heopGP^^Ieb3f=R!%Lpp$}iMS-&P3EJ)s48wrJ_Ni0~k|c47D2nj= z{jS6bt|kFpFf|p5cM`_&0Zh|`rfEp0(}=}lT#(6RpzAsUfxv^LSYX>WlAaN$>)*J5 z0#sE+JRUD8iT9*fz{)_^7@6P&!sEjTcD+I9Z4YjT1`wH@fV{cEvneYGFU%maIEU2s55&K(LixD|{p-uiS@?KNj zk-Go8G$hH6g002ovPDHLkV1hVj1#|!a literal 0 HcmV?d00001 diff --git a/assets/images/icons/page_white_delete.png b/assets/images/icons/page_white_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..af1ecaf2981fa37628c8b8b15ee389f9575e5f6b GIT binary patch literal 536 zcmV+z0_XjSP)(?iiXTHIMmcoLoO94I8;j@ zv^2DJ5#orqydFJX|Gm$_Bi_vyew+j6{r}$Qc@D1%fQqeAhJj)1!z4pP83k2MV2~s! zSt^w(<#HLFVBg_#xz1W8ioi(WY&Hu~6zil?DI^jJgu`K35(hkP)H%@Imesbg#5!Ps_$Ni*SiR8&sKb9?M`0-mH)gtg&YgRX#*TXz@Z+| z;|2H@xzE0TfuORhuO2k6#K8#sW^J`mQ0+E@$K`QkFV+DTlI$w{GJ;zid{*v9xeIe_ z$|Bp`@iKkgoFK3{4Z)#DWKV~W4K@5WZN+Ql_7%YxNqSx7%cWud&cX>)_PvD*UzxZg a%Kia9Rjz_59@~-t0000z?``cAjK`}OU-rz95{9r*BaIM4Gr-{-(903g`rl=7|Q zY>&q#(t7d)h;*K$NIRJnY9{ifSDk%3Yqu%bRNiu?SJ@=KZ>A87|74X-AsAty99n|( z-hARj^YETs1wxH0v9ZNr=5v;if#(y4@r4vpnH**!S=<;|!byew*{*^rjVs9uW{F_- zOBPd$X*fS}2(N5{PqwnQg)-H6=C1;^T3uA7nc&tpIrzzK{^i`S6lvJzwqOp#u}(%i z-QnOQ5=l{kfHX@9aq?JLBZA;^9v_InM?~Jm3>{-^K0(gXsOWT}uC6XF7K^1+KpM*i z1_t2udU3ADjTjMxqIm=f{;xT_C!@GY3I`b_Mg(VWy5Vp*AeYNgUS3|t3w&fD8jV7! zRQ?xyt<&j5b#?UuFW|D-EO@4;r@^x9KXJKS*sgDFZOsc*Dit`6qnJ!4gu`Jf`jaQG z`ylT>kBfIiU~X69sr4ZkhJm2Hy&b_|kYX?x5DJB0x7!PNVC;t4#9%m}$GeCXy*3$Y zdXJ#A<}d_pZEdjGY!sbNhd>|zi^WoaL{ou5|6L5u-3Pz4qmAety@ZmceGrg2U^bg6 zdc7XxO(+V50xc~qG^X%cF-8K9v2zXi^eAcG3xP}~%NdPED&QMmynKbRHxmUMzj6RQ z)(hyeN@#PJMM4uCZ6X4xRQjmCzTQ_`TMI_-Mk2{!b%VnK>(>B<`N@M8)qp=c#EPlOx(m^7ZttmyEx}O|KIyO@5`Y8P&=Gak4UOI z9A;ssgC#(yb0mbF7m2Kp5(`OOSQV z#ZO&(x9_ilO06xv9b+)LoFSy)_{?B*K8a*Hi^)I+ci%6eOlj%)tDr(_OK^fIBAEJ; z!Ng(;^a2C_Y7|^&tD7+hG^6Q13R+uR3oEo^%vO}a4B2gFCHu3B6wI?R7(Eeekn#D93#ZJ1gl2JlLaG}i(tJMm*T#oYcaselBlZ9X~2(?=M zUvRZFO{2QHdY%(7nM?*8PNx&$aQL6tY&PuFH#Ie}lt!Zg!!SI3eSPrz{k-UR9C{V# z%f~QSR)Asg5qx^y2B}mEN~Kc4>-F*&3 zz9|c^P`3wzRrze&$pas9{spPtk*$9`fqKI)>UhS{rM!uL;bHz3OoF`S0YRRM%X|m5 W5Be1eiT(`$0000?M^6&hEY^hlvJDB989RxW$OpU>|&7C!ZMnz(wW_8 z%4_O$i8?inSS;2{tXQNsU5p{a{r<(%`+a5ad~p{ZcsQJk=lOolb2t(J5|77oe7-}2 z8KVMDRRtsxN%c0hhs>33w>$E6c@f{1U6{ODj!Y)AE%6~nqj3krFv=;j4xf8;n7mSs zcswprG#W)D5)rh%zK(P{y%8WLn1iEUz9k?Rl2bSwMk=Ki?=?40^$1L&Ozp!v;TK7go1 z1mo?ESa_ku*f|-WPTD-Rl{2>3{J8$g&vy`u#j*tnM$gFjf+!$&6%tLPyOTK-3Sn(+ zEy4vH%o9A&V*a@Xqo?-@=GM0>Xny?%*LwVDvi^qtyY0yjr6tSA*qBm!!@ft$$ucnaoc7ie`(Yhjtzp+;Yl%oE&J zW7eX=@UeUVO{d~c+^xa{Ys2O>>g`5NQwg>Z3>}pso6Yhskt3+RQHl;{1I$h(Z#GXU z#RLX}K{`;k45P)CROWRt-dv0|g`BB9e*V>|nBUvKAsWJiZyICw7K_xGH4{3!sG!{InF^GJm$ zT{%7}NF?WKp`AQp>d)-)JCE#U_u1-VZlkc;HoNjMY=As7s@ zT*1L*gVtKiw5u?DYPS$>dhJ6)j~7?FJ-FQU6ZJ2Cp#HfF48tH02&}Pz)dFLsm@gn3 zT;3e$QehAPCuhy)V$zIzI%_9)_GPmuj? zLiBATzFpamXNTy=c?NdQz)-$R7?Bu|#Vyrh#JDi@CxPb8zJlt8i@>xLz^mGT$;v`> zly2;#$a5ytNVXiieW2)$Qo2>O*3<1R+tx86rx%Decli$==AQF^vpmAoR0K|e00000 LNkvXXu0mjfW4KG5 literal 0 HcmV?d00001 diff --git a/assets/images/icons/tag_blue_add.png b/assets/images/icons/tag_blue_add.png new file mode 100644 index 0000000000000000000000000000000000000000..f135248f82e3d0b87d29d1628057f62dc51ec6c6 GIT binary patch literal 671 zcmV;Q0$}}#P)0~-SI9%?%=X}23bKl`4NrEVf$mjFO<#Nbov&dvJ zNT<_CrBZ7ExK+Uw3I&YEL1 zq(%qHWHR0F_n|0?dQQMtEQVk(xD>*X>NJrR|6!IJgTVluzJkEFiIZBbhHyBHKp?OH z;YfLEc{Cb2#_Pl@g6c zwX8?E)9I*5#h(iF=`qaGA;gdY_^%U4sZ=5tu-olxvtB}>ke2l*x7+On$PNQM`eeub zw>sQOtcA_q_1U#pC~GN zxfc`_zq*cJS5eFyM^neBh0V3}>eD$_#z~y93x^BudEejjyyv`!5k(Q1Oa`e`3dv*= zi9`bNcpQQtAQp?w0$`>sCY?^B-|tVXYPG6B!r|~#2t$==L8Verl*{Gv2ts4T1p-Cg41%^T)c)i|3Aq-XBPb9^Eh~-MB(?O%%1HUtLQYw|; z_xr)~`~-xd%KMgOSq3fM-RomxYk()80j@IKD;A5?1w0eX zO8_7BFTq~F0B&Ih{IyeXKfVEz$#iz?L`i>Ij^m_Stu}(_2;{@7O(gElqvL#zLDr4E zPj?Wzbx~#))VC+@m1SA2+wGRu@+EI*AlQZ4U$s{{4PFIsxvodT`{7+wFD@IcbRw7dsPL` zqN+OerCF_3joECLc-<-@E9d2JYjfCrFoQ2E$G|VCW%r`$A@jfIYBU-(27}>DVEOcY jqWG2CCjT8;O!xl+&v_qytO7mD00000NkvXXu0mjfWRW`K literal 0 HcmV?d00001 diff --git a/assets/images/icons/user_delete.png b/assets/images/icons/user_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..acbb5630e51a12a1cd30ea799d659b309e7041cd GIT binary patch literal 767 zcmV!wMF|0iq|AK>&MHw6~-ksQ9RtH+=$?!G=zinz|BNIO*d}XYdmm2K>Qw%i9j?X9SgRBJn4W5%uAclWG_T7f?M4s9q5$`w5b| z31S}-Tq~-?NahjDw3mU5cfqF5z)+g+pPplGDyLv1f8WAnTQ+Xiw;{fhcBLH^j|gI# z2~IT;7{m9#PQ$2>16f?4#0x*vLFksSJ~;)W1wO>uQ-rAG1{C+&5Zw%%))Pc(2_k9< z`smoi)Pkk!SK)SAcOy>0d#x(Rl;b_GP?XFE#P>r%M^9Kn>j@#I>kHsrS$qYvKE>lwZZUsXcw4nFNHZZ~?%71a&2u7&aV|47ZvJKBUVO{)!ekB`ACp}1 xSnjsa#jtYM{A~v!cV^R$X2;lcpKyd7^}lwPp>~q=QF{OY002ovPDHLkV1lJ{Vb%Zu literal 0 HcmV?d00001 diff --git a/assets/images/icons/user_go.png b/assets/images/icons/user_go.png new file mode 100644 index 0000000000000000000000000000000000000000..0468cf08f3760dc13e44aed69f4f15cedc93b503 GIT binary patch literal 793 zcmV+!1LpjRP)a8r-1c`3+>owstQ*9I-_ekzW(ohmYMY`{P6ZeF5{f*M765oC3mgQisOM;QQbX@ggAS2KgDM2gcqZA9XdZ>iF!~Vl<60PAsYul3 zdO@$k{dkx0EmyGNDt9}0CpW25-SK_A4lC2`W(<=`JkE57@PX&*6@@GQDqw`DDAt^o zq{Ey(Out`(COaJJ>@YJM^^2KrxFq*RzAhRU<&M8e2tg%w*9#|$0B%$xx&b3n#4 zkf!uOYO^O28&82>e-b(E7tlIZg-q>P1XbD?eadJSW`T2LeMI1S3A7{YkWT@r!zKv( zO-N}zjVBW|c%-j32i0RzNc%F;I4prs$%aP>#pqIKVL?pfIIhp@vQS;GLtGb-&KrG^L94A_pU%f6M3**AM

    gJ6i>thi*In%G< z11qR?nZ<5fV+Cs0?EF;*rjKIYInQ$Ka$^8kIXfoF@SaV-aWlw~zZ}ip35JN+^=tnJ XxNVQ!&Csrn00000NkvXXu0mjfj)-I{ literal 0 HcmV?d00001 diff --git a/language/english/main.php b/language/english/main.php index d6326148..59c68517 100644 --- a/language/english/main.php +++ b/language/english/main.php @@ -102,6 +102,7 @@ define('_MD_NEWBB_SEARCHTHISFORUM', 'Search This Forum'); define('_MD_NEWBB_TOPIC_SUBJECTC', 'Topic Prefix:'); define('_MD_NEWBB_RATINGS', 'Ratings'); +/* define('_MD_NEWBB_CAN_ACCESS', 'You can access the forum.
    '); define('_MD_NEWBB_CANNOT_ACCESS', 'You cannot access the forum.
    '); define('_MD_NEWBB_CAN_POST', 'You can start a new topic.
    '); @@ -130,6 +131,35 @@ define('_MD_NEWBB_CANNOT_UPLOAD', 'You cannot upload.
    '); define('_MD_NEWBB_CAN_SIGNATURE', 'You can use signature.
    '); define('_MD_NEWBB_CANNOT_SIGNATURE', 'You cannot use signature.
    '); +*/ +define('_MD_NEWBB_CAN_ACCESS', ' '); +define('_MD_NEWBB_CANNOT_ACCESS', ' '); +define('_MD_NEWBB_CAN_POST', ' '); +define('_MD_NEWBB_CANNOT_POST', ' '); +define('_MD_NEWBB_CAN_VIEW', ' '); +define('_MD_NEWBB_CANNOT_VIEW', ' '); +define('_MD_NEWBB_CAN_REPLY', ' '); +define('_MD_NEWBB_CANNOT_REPLY', ' '); +define('_MD_NEWBB_CAN_EDIT', ' '); +define('_MD_NEWBB_CANNOT_EDIT', ' '); +define('_MD_NEWBB_CAN_DELETE', ' '); +define('_MD_NEWBB_CANNOT_DELETE', ' '); +define('_MD_NEWBB_CAN_ADDPOLL', ' '); +define('_MD_NEWBB_CANNOT_ADDPOLL', ' '); +define('_MD_NEWBB_CAN_VOTE', ' '); +define('_MD_NEWBB_CANNOT_VOTE', ' '); +define('_MD_NEWBB_CAN_ATTACH', ' '); +define('_MD_NEWBB_CANNOT_ATTACH', ' '); +define('_MD_NEWBB_CAN_NOAPPROVE', ' '); +define('_MD_NEWBB_CANNOT_NOAPPROVE', ' '); +define('_MD_NEWBB_CAN_TYPE', ' '); +define('_MD_NEWBB_CANNOT_TYPE', ' '); +define('_MD_NEWBB_CAN_HTML', ' '); +define('_MD_NEWBB_CANNOT_HTML', ' '); +define('_MD_NEWBB_CAN_UPLOAD', ' '); +define('_MD_NEWBB_CANNOT_UPLOAD', ' '); +define('_MD_NEWBB_CAN_SIGNATURE', ' '); +define('_MD_NEWBB_CANNOT_SIGNATURE', ' '); define('_MD_NEWBB_IMTOPICS', 'Important Topics'); define('_MD_NEWBB_NOTIMTOPICS', 'Forum Topics'); define('_MD_NEWBB_FORUMOPTION', 'Forum options'); @@ -489,10 +519,16 @@ define('_MD_NEWBB_SELECT_HTML', 'Strip all html from result?'); define('_MD_NEWBB_SELECT_EXCLUDE', 'Exclude these tags:'); define('_MD_NEWBB_SELECT_TAG', 'Tag'); +/* define('_MD_NEWBB_CAN_PDF', 'You can create PDF files.
    '); define('_MD_NEWBB_CANNOT_PDF', 'You cannot create PDF files.
    '); define('_MD_NEWBB_CAN_PRINT', 'You can get print page.
    '); define('_MD_NEWBB_CANNOT_PRINT', 'You cannot get print page.
    '); +*/ +define('_MD_NEWBB_CAN_PDF', ' '); +define('_MD_NEWBB_CANNOT_PDF', ' '); +define('_MD_NEWBB_CAN_PRINT', ' '); +define('_MD_NEWBB_CANNOT_PRINT', ' '); define('_MD_NEWBB_NORIGHTTOPDF', 'You don\'t have the right to create PDF in this forum.'); define('_MD_NEWBB_NORIGHTTOPRINT', 'You don\'t have the right to get print in this forum.'); // irmtfan for new block system diff --git a/templates/newbb_viewforum.tpl b/templates/newbb_viewforum.tpl index 3b7b0983..aa79b0ad 100644 --- a/templates/newbb_viewforum.tpl +++ b/templates/newbb_viewforum.tpl @@ -272,7 +272,7 @@

    <{foreach item=perm from=$permission_table}> -
    <{$perm}>
    +
    <{$perm}>
    <{/foreach}>
    diff --git a/templates/newbb_viewtopic.tpl b/templates/newbb_viewtopic.tpl index 5f3548c8..79eb74cb 100644 --- a/templates/newbb_viewtopic.tpl +++ b/templates/newbb_viewtopic.tpl @@ -258,7 +258,7 @@
    <{foreach item=perm from=$permission_table}> -
    <{$perm}>
    +
    <{$perm}>
    <{/foreach}>
    From d7a5a9ddc5ccd44b01585b8742cd3f0a42a41f3a Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Tue, 19 Sep 2017 09:13:56 +0300 Subject: [PATCH 080/170] Returning the access rights table --- language/english/main.php | 23 +++++++++++------------ templates/newbb_viewforum.tpl | 2 +- templates/newbb_viewtopic.tpl | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/language/english/main.php b/language/english/main.php index 59c68517..73c1c85c 100644 --- a/language/english/main.php +++ b/language/english/main.php @@ -102,7 +102,7 @@ define('_MD_NEWBB_SEARCHTHISFORUM', 'Search This Forum'); define('_MD_NEWBB_TOPIC_SUBJECTC', 'Topic Prefix:'); define('_MD_NEWBB_RATINGS', 'Ratings'); -/* +//Pemission table define('_MD_NEWBB_CAN_ACCESS', 'You can access the forum.
    '); define('_MD_NEWBB_CANNOT_ACCESS', 'You cannot access the forum.
    '); define('_MD_NEWBB_CAN_POST', 'You can start a new topic.
    '); @@ -131,7 +131,11 @@ define('_MD_NEWBB_CANNOT_UPLOAD', 'You cannot upload.
    '); define('_MD_NEWBB_CAN_SIGNATURE', 'You can use signature.
    '); define('_MD_NEWBB_CANNOT_SIGNATURE', 'You cannot use signature.
    '); -*/ +define('_MD_NEWBB_CAN_PDF', 'You can create PDF files.
    '); +define('_MD_NEWBB_CANNOT_PDF', 'You cannot create PDF files.
    '); +define('_MD_NEWBB_CAN_PRINT', 'You can get print page.
    '); +define('_MD_NEWBB_CANNOT_PRINT', 'You cannot get print page.
    '); +/* define('_MD_NEWBB_CAN_ACCESS', ' '); define('_MD_NEWBB_CANNOT_ACCESS', ' '); define('_MD_NEWBB_CAN_POST', ' '); @@ -160,6 +164,11 @@ define('_MD_NEWBB_CANNOT_UPLOAD', ' '); define('_MD_NEWBB_CAN_SIGNATURE', ' '); define('_MD_NEWBB_CANNOT_SIGNATURE', ' '); +define('_MD_NEWBB_CAN_PDF', ' '); +define('_MD_NEWBB_CANNOT_PDF', ' '); +define('_MD_NEWBB_CAN_PRINT', ' '); +define('_MD_NEWBB_CANNOT_PRINT', ' '); +*/ define('_MD_NEWBB_IMTOPICS', 'Important Topics'); define('_MD_NEWBB_NOTIMTOPICS', 'Forum Topics'); define('_MD_NEWBB_FORUMOPTION', 'Forum options'); @@ -519,16 +528,6 @@ define('_MD_NEWBB_SELECT_HTML', 'Strip all html from result?'); define('_MD_NEWBB_SELECT_EXCLUDE', 'Exclude these tags:'); define('_MD_NEWBB_SELECT_TAG', 'Tag'); -/* -define('_MD_NEWBB_CAN_PDF', 'You can create PDF files.
    '); -define('_MD_NEWBB_CANNOT_PDF', 'You cannot create PDF files.
    '); -define('_MD_NEWBB_CAN_PRINT', 'You can get print page.
    '); -define('_MD_NEWBB_CANNOT_PRINT', 'You cannot get print page.
    '); -*/ -define('_MD_NEWBB_CAN_PDF', ' '); -define('_MD_NEWBB_CANNOT_PDF', ' '); -define('_MD_NEWBB_CAN_PRINT', ' '); -define('_MD_NEWBB_CANNOT_PRINT', ' '); define('_MD_NEWBB_NORIGHTTOPDF', 'You don\'t have the right to create PDF in this forum.'); define('_MD_NEWBB_NORIGHTTOPRINT', 'You don\'t have the right to get print in this forum.'); // irmtfan for new block system diff --git a/templates/newbb_viewforum.tpl b/templates/newbb_viewforum.tpl index aa79b0ad..895a5563 100644 --- a/templates/newbb_viewforum.tpl +++ b/templates/newbb_viewforum.tpl @@ -272,7 +272,7 @@
    <{foreach item=perm from=$permission_table}> -
    <{$perm}>
    +
    <{$perm}>
    <{/foreach}>
    diff --git a/templates/newbb_viewtopic.tpl b/templates/newbb_viewtopic.tpl index 79eb74cb..59fd0d6e 100644 --- a/templates/newbb_viewtopic.tpl +++ b/templates/newbb_viewtopic.tpl @@ -258,7 +258,7 @@
    <{foreach item=perm from=$permission_table}> -
    <{$perm}>
    +
    <{$perm}>
    <{/foreach}>
    From f5c725c3b4648c96b8353e984623787ab97f5788 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Fri, 22 Sep 2017 21:18:47 +0300 Subject: [PATCH 081/170] Add Forum Rules --- language/english/modinfo.php | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/language/english/modinfo.php b/language/english/modinfo.php index c49bc533..64532b19 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -216,6 +216,69 @@ Feel free to register and login to start your topics. If you have any question concerning NewBB usage, please visit your local support site or [url=https://xoops.org/modules/newbb/]XOOPS Support Site[/url]. + + ------- Example rules ---------- + + Forum Rules + + 1. Each participant of the Forum bears full responsibility for the information posted at the Forum. The Administration of the Forum is not responsible for the content of any topics and/or individual messages, except for messages posted by the administration. + + 2. You agree not to post on the forum and not send offensive, threatening, libelous messages, pornography, incitement to national hatred, messages degrading religious feelings or inciting hatred (racial, social or any other) against the members of the forum, and other messages. + + Attempts to post such messages may lead to your disconnection from the forum (and your provider will be notified). + Moderators have access to the IP addresses of all messages, which makes such a policy possible. + + 3. You agree not to publish materials in violation of copyright, not to send SPAM to the forum participants, not to use the forum for the distribution of advertisements of extraneous nature, the installation of pyramid schemes and other illegal commercial activities. + + 4. You agree not to engage in deliberate imitation-provocative activities on the forum: + - bluff (persistent withdrawal of the discussion aside without explanation); + - cartouches (a long mutual throwing of collateral counter-arguments without discussing the topic on the merits and ignoring the other participants in the discussion); + - open or veiled ohayvaniem COB, CPE or individual people (criticism must be correct and reasoned); + - manipulation of the minds of readers with the help of text techniques NLP; + - etc. + Corresponding messages will be moved to a separate section, or immediately deleted. + + 5. Our forum is designed to discuss events and opinions, but not to discuss the people who expressed these views. + To "clarify the relationship" it is recommended to use "Personal Messages". + Public "clarification of relations" are allowed only in the corresponding section, and only with the observance of ethical standards. + There is no duplication of messages, except for important administration messages in all forums. Other identical messages are deleted. + + 6. Take care that the design of messages does not create difficulties when viewing. Avoid excessive citation. It is not recommended extensive citation of Internet sources, which can be given a hyperlink. + Do not neglect the preview of the message before publishing. + If necessary, edit your messages. + + 7. You acknowledge that: + - the opinion of the forum administration may not coincide with the opinion of the authors of the messages; + - the administration has the right to remove any information from the forum pages if, in its opinion, the messages carrying this information violate these Rules; + - messages that violate these rules may be erased without notice to their authors, and accounts of these authors may be removed from the lists of the forum, if such violations are allowed in the future. + + 8. Moderation policy: + + 8.1. Off-topics are highlighted in separate topics, with cross-references. + The request to participants to adhere to this rule: if you want to discuss the side branch - open a new topic and give cross-references. + + 8.2. Phrases with violation of ethical standards are removed entirely; in their place is inserted * censored *, or , or + + 8.3. Flood and "clarifying the relationship" with ethical compliance: either deleted or transferred to the appropriate section (at the discretion of the moderator). + Themes from the corresponding section can be deleted two weeks after the last replica in this topic. + + 8.4. To those who regularly violate the rules of our forum, the translation can be applied to "pre-moderation" (all messages of such participants get to the forum only after their approval by the moderator). + + The information on sanctions for participants will be placed in the appropriate section. + + 9. Discussion of the actions of moderators and the administration of the forum is allowed only in a certain section and only in the correct form (that is politely and with the justification of their point of view). + + For the solution of everyday questions on moderation, please contact the moderators and administrators via private messages. + + All questions, suggestions and comments on the forum should be posted in the appropriate section, or sent to administrators via private messages or by e-mail. + + 10. As a user you are aware of the fact that the information you enter will be stored in the host\'s database. Check which information about you is publicly available by clicking on the "profile" link. + Although this information will not be disclosed to third parties without your permission, the administration of the forums can not be responsible for the actions of hackers, which can lead to unauthorized access to it. + Consider this feature of information exchange on the Internet. + + The forum automatically uses cookies to store information on your computer. These cookies do not contain any information from your input and serve only to improve the quality of the forums. Your e-mail address is used only to confirm your registration, inform you of new messages and password (and to send a new password if you forget the current one). + + The use of the Forum is evidence of your consent to these Rules. '); define('_MI_NEWBB_ADMENU_GROUPMOD', 'Group moderate'); //define('_MI_NEWBB_SUBJECT_PREFIX', 'Add a prefix to the topic subject'); From 251b7908a6bad6b182af61645b02a199294a7b32 Mon Sep 17 00:00:00 2001 From: geekwright Date: Tue, 26 Sep 2017 10:58:37 -0500 Subject: [PATCH 082/170] Store $db in __construct() Re: #50 --- class/online.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/class/online.php b/class/online.php index 5874f9cc..c01d95e6 100644 --- a/class/online.php +++ b/class/online.php @@ -26,14 +26,17 @@ class NewbbOnlineHandler public $topic_id; public $user_ids = []; + public function __construct(XoopsDatabase $db) + { + $this->db = $db; + } + /** * @param null|\NewbbForum $forum * @param null|Topic $forumtopic */ public function init($forum = null, $forumtopic = null) { - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); -// $this->db = $GLOBALS['xoopsDB']; if (is_object($forum)) { $this->forum_id = $forum->getVar('forum_id'); $this->forumObject = $forum; From 1771d29b15cdf1bf5a4de53220922b5c420e5d42 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Sun, 24 Sep 2017 14:28:49 +0300 Subject: [PATCH 083/170] Transfer templates_fulliv_opacity --- .../templates_fulldiv_opacity}/blocks/index.html | 0 .../blocks/newbb_block.tpl | 0 .../blocks/newbb_block_author.tpl | 0 .../blocks/newbb_block_list_topic.tpl | 0 .../blocks/newbb_block_post.tpl | 0 .../blocks/newbb_block_text.tpl | 0 .../blocks/newbb_block_topic.tpl | 0 .../blocks/newbb_tag_block_cloud.tpl | 0 .../blocks/newbb_tag_block_top.tpl | 0 .../templates_fulldiv_opacity}/css/index.html | 0 .../css/language/english/index.html | 0 .../css/language/english/style.css | 0 .../css/language/index.html | 0 .../css/language/persian/index.html | 0 .../css/language/persian/style.css | 0 .../images/icon/admin_delete.png | Bin .../images/icon/admin_edit.png | Bin .../images/icon/admin_merge.png | Bin .../images/icon/admin_move.png | Bin .../images/icon/anonym.png | Bin .../images/icon/attachment.png | Bin .../images/icon/blank.gif | Bin .../images/icon/blank.png | Bin .../templates_fulldiv_opacity}/images/icon/buzz.png | Bin .../images/icon/delicious.png | Bin .../templates_fulldiv_opacity}/images/icon/digg.png | Bin .../images/icon/document.png | Bin .../templates_fulldiv_opacity}/images/icon/down.png | Bin .../images/icon/facebook.png | Bin .../images/icon/forum.png | Bin .../images/icon/forum_new.png | Bin .../images/icon/friendfeed.png | Bin .../images/icon/googleplus.png | Bin .../images/icon/index.html | 0 .../images/icon/lastposticon.png | Bin .../templates_fulldiv_opacity}/images/icon/less.png | Bin .../images/icon/linkedin.png | Bin .../images/icon/minus.png | Bin .../templates_fulldiv_opacity}/images/icon/more.png | Bin .../images/icon/new_forum.png | Bin .../templates_fulldiv_opacity}/images/icon/next.png | Bin .../templates_fulldiv_opacity}/images/icon/pdf.png | Bin .../templates_fulldiv_opacity}/images/icon/plus.png | Bin .../templates_fulldiv_opacity}/images/icon/poll.png | Bin .../templates_fulldiv_opacity}/images/icon/post.gif | Bin .../images/icon/previous.png | Bin .../images/icon/printer.png | Bin .../images/icon/rate1.png | Bin .../images/icon/rate2.png | Bin .../images/icon/rate3.png | Bin .../images/icon/rate4.png | Bin .../images/icon/rate5.png | Bin .../images/icon/reddit.png | Bin .../templates_fulldiv_opacity}/images/icon/rss.png | Bin .../images/icon/spacer-a.png | Bin .../images/icon/statistik.png | Bin .../images/icon/stumbleupon.png | Bin .../images/icon/subforum.png | Bin .../images/icon/technorati.png | Bin .../images/icon/topic.png | Bin .../images/icon/topic_digest.png | Bin .../images/icon/topic_hot.png | Bin .../images/icon/topic_hot_new.png | Bin .../images/icon/topic_locked.png | Bin .../images/icon/topic_my.gif | Bin .../images/icon/topic_new.png | Bin .../images/icon/topic_sticky.png | Bin .../images/icon/twitter.png | Bin .../templates_fulldiv_opacity}/images/icon/up.png | Bin .../images/icon/whosonline.png | Bin .../templates_fulldiv_opacity}/images/icon/wong.png | Bin .../templates_fulldiv_opacity}/images/index.html | 0 .../images/language/english/index.html | 0 .../images/language/english/new_forum.png | Bin .../images/language/english/new_subforum.png | Bin .../images/language/english/offline.png | Bin .../images/language/english/online.png | Bin .../images/language/english/p_bann.png | Bin .../images/language/english/p_delete.png | Bin .../images/language/english/p_edit.png | Bin .../images/language/english/p_pdf.gif | Bin .../images/language/english/p_quote.png | Bin .../images/language/english/p_reply.png | Bin .../images/language/english/p_report.png | Bin .../images/language/english/t_new.png | Bin .../images/language/english/t_poll.png | Bin .../images/language/english/t_qr.png | Bin .../images/language/english/t_qr_expand.png | Bin .../images/language/english/t_reply.png | Bin .../images/language/index.html | 0 .../images/language/persian/index.html | 0 .../images/language/persian/new_forum.png | Bin .../images/language/persian/new_subforum.png | Bin .../images/language/persian/offline.png | Bin .../images/language/persian/online.png | Bin .../images/language/persian/p_bann.png | Bin .../images/language/persian/p_delete.png | Bin .../images/language/persian/p_edit.png | Bin .../images/language/persian/p_quote.png | Bin .../images/language/persian/p_reply.png | Bin .../images/language/persian/p_report.png | Bin .../images/language/persian/p_up.png | Bin .../images/language/persian/t_new.png | Bin .../images/language/persian/t_poll.png | Bin .../images/language/persian/t_qr.png | Bin .../images/language/persian/t_qr_expand.png | Bin .../images/language/persian/t_reply.png | Bin .../templates_fulldiv_opacity}/images/mime/ace.gif | Bin .../templates_fulldiv_opacity}/images/mime/avi.gif | Bin .../templates_fulldiv_opacity}/images/mime/bmp.gif | Bin .../templates_fulldiv_opacity}/images/mime/doc.gif | Bin .../templates_fulldiv_opacity}/images/mime/exe.gif | Bin .../images/mime/flash.gif | Bin .../templates_fulldiv_opacity}/images/mime/gif.gif | Bin .../templates_fulldiv_opacity}/images/mime/html.gif | Bin .../images/mime/index.html | 0 .../templates_fulldiv_opacity}/images/mime/jpeg.gif | Bin .../templates_fulldiv_opacity}/images/mime/jpg.gif | Bin .../templates_fulldiv_opacity}/images/mime/mid.gif | Bin .../templates_fulldiv_opacity}/images/mime/mov.gif | Bin .../templates_fulldiv_opacity}/images/mime/mp3.gif | Bin .../templates_fulldiv_opacity}/images/mime/mpg.gif | Bin .../images/mime/netscape.gif | Bin .../templates_fulldiv_opacity}/images/mime/pdf.gif | Bin .../templates_fulldiv_opacity}/images/mime/png.gif | Bin .../templates_fulldiv_opacity}/images/mime/ppt.gif | Bin .../templates_fulldiv_opacity}/images/mime/rar.gif | Bin .../templates_fulldiv_opacity}/images/mime/txt.gif | Bin .../images/mime/unknown.gif | Bin .../templates_fulldiv_opacity}/images/mime/wav.gif | Bin .../templates_fulldiv_opacity}/images/mime/xls.gif | Bin .../templates_fulldiv_opacity}/images/mime/zip.gif | Bin .../templates_fulldiv_opacity}/images/rpg/blue.gif | Bin .../templates_fulldiv_opacity}/images/rpg/green.gif | Bin .../images/rpg/img_backing.gif | Bin .../images/rpg/img_left.gif | Bin .../images/rpg/img_right.gif | Bin .../images/rpg/index.html | 0 .../images/rpg/orange.gif | Bin .../themes/templates_fulldiv_opacity}/index.html | 0 .../themes/templates_fulldiv_opacity}/js/index.html | 0 .../js/language/english/index.html | 0 .../js/language/english/newbb_toggle_class.js | 0 .../js/language/english/newbb_validation.js | 0 .../js/language/index.html | 0 .../templates_fulldiv_opacity}/newbb_edit_post.tpl | 0 .../templates_fulldiv_opacity}/newbb_index.tpl | 0 .../templates_fulldiv_opacity}/newbb_index_menu.tpl | 0 .../newbb_notification_select.tpl | 0 .../templates_fulldiv_opacity}/newbb_online.tpl | 0 .../newbb_poll_results.tpl | 0 .../templates_fulldiv_opacity}/newbb_poll_view.tpl | 0 .../themes/templates_fulldiv_opacity}/newbb_rss.tpl | 0 .../templates_fulldiv_opacity}/newbb_search.tpl | 0 .../newbb_searchresults.tpl | 0 .../templates_fulldiv_opacity}/newbb_thread.tpl | 0 .../templates_fulldiv_opacity}/newbb_viewall.tpl | 0 .../templates_fulldiv_opacity}/newbb_viewforum.tpl | 0 .../newbb_viewforum_menu.tpl | 0 .../newbb_viewforum_subforum.tpl | 0 .../templates_fulldiv_opacity}/newbb_viewpost.tpl | 0 .../templates_fulldiv_opacity}/newbb_viewtopic.tpl | 0 .../themes/templates_fulldiv_opacity}/readme.txt | 0 163 files changed, 0 insertions(+), 0 deletions(-) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_block.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_block_author.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_block_list_topic.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_block_post.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_block_text.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_block_topic.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_tag_block_cloud.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/blocks/newbb_tag_block_top.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/css/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/css/language/english/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/css/language/english/style.css (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/css/language/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/css/language/persian/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/css/language/persian/style.css (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/admin_delete.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/admin_edit.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/admin_merge.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/admin_move.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/anonym.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/attachment.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/blank.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/blank.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/buzz.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/delicious.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/digg.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/document.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/down.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/facebook.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/forum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/forum_new.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/friendfeed.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/googleplus.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/lastposticon.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/less.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/linkedin.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/minus.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/more.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/new_forum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/next.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/pdf.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/plus.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/poll.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/post.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/previous.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/printer.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/rate1.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/rate2.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/rate3.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/rate4.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/rate5.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/reddit.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/rss.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/spacer-a.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/statistik.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/stumbleupon.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/subforum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/technorati.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_digest.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_hot.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_hot_new.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_locked.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_my.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_new.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/topic_sticky.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/twitter.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/up.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/whosonline.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/icon/wong.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/new_forum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/new_subforum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/offline.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/online.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_bann.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_delete.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_edit.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_pdf.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_quote.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_reply.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/p_report.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/t_new.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/t_poll.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/t_qr.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/t_qr_expand.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/english/t_reply.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/new_forum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/new_subforum.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/offline.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/online.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_bann.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_delete.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_edit.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_quote.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_reply.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_report.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/p_up.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/t_new.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/t_poll.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/t_qr.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/t_qr_expand.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/language/persian/t_reply.png (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/ace.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/avi.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/bmp.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/doc.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/exe.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/flash.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/gif.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/html.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/jpeg.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/jpg.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/mid.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/mov.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/mp3.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/mpg.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/netscape.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/pdf.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/png.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/ppt.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/rar.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/txt.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/unknown.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/wav.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/xls.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/mime/zip.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/blue.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/green.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/img_backing.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/img_left.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/img_right.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/images/rpg/orange.gif (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/js/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/js/language/english/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/js/language/english/newbb_toggle_class.js (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/js/language/english/newbb_validation.js (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/js/language/index.html (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_edit_post.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_index.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_index_menu.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_notification_select.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_online.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_poll_results.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_poll_view.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_rss.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_search.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_searchresults.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_thread.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_viewall.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_viewforum.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_viewforum_menu.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_viewforum_subforum.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_viewpost.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/newbb_viewtopic.tpl (100%) rename {templates_fulldiv_opacity => EXTRA/themes/templates_fulldiv_opacity}/readme.txt (100%) diff --git a/templates_fulldiv_opacity/blocks/index.html b/EXTRA/themes/templates_fulldiv_opacity/blocks/index.html similarity index 100% rename from templates_fulldiv_opacity/blocks/index.html rename to EXTRA/themes/templates_fulldiv_opacity/blocks/index.html diff --git a/templates_fulldiv_opacity/blocks/newbb_block.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_block.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_block_author.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_author.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_block_author.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_author.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_block_list_topic.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_list_topic.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_block_list_topic.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_list_topic.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_block_post.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_post.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_block_post.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_post.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_block_text.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_text.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_block_text.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_text.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_block_topic.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_topic.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_block_topic.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_block_topic.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_tag_block_cloud.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_tag_block_cloud.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_tag_block_cloud.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_tag_block_cloud.tpl diff --git a/templates_fulldiv_opacity/blocks/newbb_tag_block_top.tpl b/EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_tag_block_top.tpl similarity index 100% rename from templates_fulldiv_opacity/blocks/newbb_tag_block_top.tpl rename to EXTRA/themes/templates_fulldiv_opacity/blocks/newbb_tag_block_top.tpl diff --git a/templates_fulldiv_opacity/css/index.html b/EXTRA/themes/templates_fulldiv_opacity/css/index.html similarity index 100% rename from templates_fulldiv_opacity/css/index.html rename to EXTRA/themes/templates_fulldiv_opacity/css/index.html diff --git a/templates_fulldiv_opacity/css/language/english/index.html b/EXTRA/themes/templates_fulldiv_opacity/css/language/english/index.html similarity index 100% rename from templates_fulldiv_opacity/css/language/english/index.html rename to EXTRA/themes/templates_fulldiv_opacity/css/language/english/index.html diff --git a/templates_fulldiv_opacity/css/language/english/style.css b/EXTRA/themes/templates_fulldiv_opacity/css/language/english/style.css similarity index 100% rename from templates_fulldiv_opacity/css/language/english/style.css rename to EXTRA/themes/templates_fulldiv_opacity/css/language/english/style.css diff --git a/templates_fulldiv_opacity/css/language/index.html b/EXTRA/themes/templates_fulldiv_opacity/css/language/index.html similarity index 100% rename from templates_fulldiv_opacity/css/language/index.html rename to EXTRA/themes/templates_fulldiv_opacity/css/language/index.html diff --git a/templates_fulldiv_opacity/css/language/persian/index.html b/EXTRA/themes/templates_fulldiv_opacity/css/language/persian/index.html similarity index 100% rename from templates_fulldiv_opacity/css/language/persian/index.html rename to EXTRA/themes/templates_fulldiv_opacity/css/language/persian/index.html diff --git a/templates_fulldiv_opacity/css/language/persian/style.css b/EXTRA/themes/templates_fulldiv_opacity/css/language/persian/style.css similarity index 100% rename from templates_fulldiv_opacity/css/language/persian/style.css rename to EXTRA/themes/templates_fulldiv_opacity/css/language/persian/style.css diff --git a/templates_fulldiv_opacity/images/icon/admin_delete.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_delete.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/admin_delete.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_delete.png diff --git a/templates_fulldiv_opacity/images/icon/admin_edit.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_edit.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/admin_edit.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_edit.png diff --git a/templates_fulldiv_opacity/images/icon/admin_merge.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_merge.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/admin_merge.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_merge.png diff --git a/templates_fulldiv_opacity/images/icon/admin_move.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_move.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/admin_move.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/admin_move.png diff --git a/templates_fulldiv_opacity/images/icon/anonym.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/anonym.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/anonym.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/anonym.png diff --git a/templates_fulldiv_opacity/images/icon/attachment.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/attachment.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/attachment.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/attachment.png diff --git a/templates_fulldiv_opacity/images/icon/blank.gif b/EXTRA/themes/templates_fulldiv_opacity/images/icon/blank.gif similarity index 100% rename from templates_fulldiv_opacity/images/icon/blank.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/blank.gif diff --git a/templates_fulldiv_opacity/images/icon/blank.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/blank.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/blank.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/blank.png diff --git a/templates_fulldiv_opacity/images/icon/buzz.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/buzz.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/buzz.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/buzz.png diff --git a/templates_fulldiv_opacity/images/icon/delicious.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/delicious.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/delicious.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/delicious.png diff --git a/templates_fulldiv_opacity/images/icon/digg.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/digg.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/digg.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/digg.png diff --git a/templates_fulldiv_opacity/images/icon/document.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/document.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/document.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/document.png diff --git a/templates_fulldiv_opacity/images/icon/down.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/down.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/down.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/down.png diff --git a/templates_fulldiv_opacity/images/icon/facebook.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/facebook.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/facebook.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/facebook.png diff --git a/templates_fulldiv_opacity/images/icon/forum.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/forum.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/forum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/forum.png diff --git a/templates_fulldiv_opacity/images/icon/forum_new.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/forum_new.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/forum_new.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/forum_new.png diff --git a/templates_fulldiv_opacity/images/icon/friendfeed.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/friendfeed.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/friendfeed.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/friendfeed.png diff --git a/templates_fulldiv_opacity/images/icon/googleplus.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/googleplus.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/googleplus.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/googleplus.png diff --git a/templates_fulldiv_opacity/images/icon/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/icon/index.html similarity index 100% rename from templates_fulldiv_opacity/images/icon/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/index.html diff --git a/templates_fulldiv_opacity/images/icon/lastposticon.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/lastposticon.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/lastposticon.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/lastposticon.png diff --git a/templates_fulldiv_opacity/images/icon/less.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/less.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/less.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/less.png diff --git a/templates_fulldiv_opacity/images/icon/linkedin.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/linkedin.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/linkedin.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/linkedin.png diff --git a/templates_fulldiv_opacity/images/icon/minus.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/minus.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/minus.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/minus.png diff --git a/templates_fulldiv_opacity/images/icon/more.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/more.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/more.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/more.png diff --git a/templates_fulldiv_opacity/images/icon/new_forum.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/new_forum.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/new_forum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/new_forum.png diff --git a/templates_fulldiv_opacity/images/icon/next.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/next.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/next.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/next.png diff --git a/templates_fulldiv_opacity/images/icon/pdf.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/pdf.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/pdf.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/pdf.png diff --git a/templates_fulldiv_opacity/images/icon/plus.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/plus.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/plus.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/plus.png diff --git a/templates_fulldiv_opacity/images/icon/poll.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/poll.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/poll.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/poll.png diff --git a/templates_fulldiv_opacity/images/icon/post.gif b/EXTRA/themes/templates_fulldiv_opacity/images/icon/post.gif similarity index 100% rename from templates_fulldiv_opacity/images/icon/post.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/post.gif diff --git a/templates_fulldiv_opacity/images/icon/previous.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/previous.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/previous.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/previous.png diff --git a/templates_fulldiv_opacity/images/icon/printer.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/printer.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/printer.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/printer.png diff --git a/templates_fulldiv_opacity/images/icon/rate1.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/rate1.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/rate1.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/rate1.png diff --git a/templates_fulldiv_opacity/images/icon/rate2.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/rate2.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/rate2.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/rate2.png diff --git a/templates_fulldiv_opacity/images/icon/rate3.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/rate3.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/rate3.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/rate3.png diff --git a/templates_fulldiv_opacity/images/icon/rate4.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/rate4.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/rate4.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/rate4.png diff --git a/templates_fulldiv_opacity/images/icon/rate5.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/rate5.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/rate5.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/rate5.png diff --git a/templates_fulldiv_opacity/images/icon/reddit.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/reddit.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/reddit.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/reddit.png diff --git a/templates_fulldiv_opacity/images/icon/rss.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/rss.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/rss.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/rss.png diff --git a/templates_fulldiv_opacity/images/icon/spacer-a.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/spacer-a.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/spacer-a.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/spacer-a.png diff --git a/templates_fulldiv_opacity/images/icon/statistik.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/statistik.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/statistik.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/statistik.png diff --git a/templates_fulldiv_opacity/images/icon/stumbleupon.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/stumbleupon.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/stumbleupon.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/stumbleupon.png diff --git a/templates_fulldiv_opacity/images/icon/subforum.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/subforum.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/subforum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/subforum.png diff --git a/templates_fulldiv_opacity/images/icon/technorati.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/technorati.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/technorati.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/technorati.png diff --git a/templates_fulldiv_opacity/images/icon/topic.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic.png diff --git a/templates_fulldiv_opacity/images/icon/topic_digest.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_digest.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_digest.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_digest.png diff --git a/templates_fulldiv_opacity/images/icon/topic_hot.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_hot.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_hot.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_hot.png diff --git a/templates_fulldiv_opacity/images/icon/topic_hot_new.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_hot_new.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_hot_new.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_hot_new.png diff --git a/templates_fulldiv_opacity/images/icon/topic_locked.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_locked.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_locked.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_locked.png diff --git a/templates_fulldiv_opacity/images/icon/topic_my.gif b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_my.gif similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_my.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_my.gif diff --git a/templates_fulldiv_opacity/images/icon/topic_new.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_new.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_new.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_new.png diff --git a/templates_fulldiv_opacity/images/icon/topic_sticky.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_sticky.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/topic_sticky.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/topic_sticky.png diff --git a/templates_fulldiv_opacity/images/icon/twitter.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/twitter.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/twitter.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/twitter.png diff --git a/templates_fulldiv_opacity/images/icon/up.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/up.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/up.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/up.png diff --git a/templates_fulldiv_opacity/images/icon/whosonline.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/whosonline.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/whosonline.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/whosonline.png diff --git a/templates_fulldiv_opacity/images/icon/wong.png b/EXTRA/themes/templates_fulldiv_opacity/images/icon/wong.png similarity index 100% rename from templates_fulldiv_opacity/images/icon/wong.png rename to EXTRA/themes/templates_fulldiv_opacity/images/icon/wong.png diff --git a/templates_fulldiv_opacity/images/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/index.html similarity index 100% rename from templates_fulldiv_opacity/images/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/index.html diff --git a/templates_fulldiv_opacity/images/language/english/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/index.html similarity index 100% rename from templates_fulldiv_opacity/images/language/english/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/index.html diff --git a/templates_fulldiv_opacity/images/language/english/new_forum.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/new_forum.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/new_forum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/new_forum.png diff --git a/templates_fulldiv_opacity/images/language/english/new_subforum.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/new_subforum.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/new_subforum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/new_subforum.png diff --git a/templates_fulldiv_opacity/images/language/english/offline.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/offline.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/offline.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/offline.png diff --git a/templates_fulldiv_opacity/images/language/english/online.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/online.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/online.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/online.png diff --git a/templates_fulldiv_opacity/images/language/english/p_bann.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_bann.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_bann.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_bann.png diff --git a/templates_fulldiv_opacity/images/language/english/p_delete.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_delete.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_delete.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_delete.png diff --git a/templates_fulldiv_opacity/images/language/english/p_edit.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_edit.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_edit.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_edit.png diff --git a/templates_fulldiv_opacity/images/language/english/p_pdf.gif b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_pdf.gif similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_pdf.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_pdf.gif diff --git a/templates_fulldiv_opacity/images/language/english/p_quote.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_quote.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_quote.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_quote.png diff --git a/templates_fulldiv_opacity/images/language/english/p_reply.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_reply.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_reply.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_reply.png diff --git a/templates_fulldiv_opacity/images/language/english/p_report.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_report.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/p_report.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/p_report.png diff --git a/templates_fulldiv_opacity/images/language/english/t_new.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_new.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/t_new.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_new.png diff --git a/templates_fulldiv_opacity/images/language/english/t_poll.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_poll.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/t_poll.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_poll.png diff --git a/templates_fulldiv_opacity/images/language/english/t_qr.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_qr.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/t_qr.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_qr.png diff --git a/templates_fulldiv_opacity/images/language/english/t_qr_expand.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_qr_expand.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/t_qr_expand.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_qr_expand.png diff --git a/templates_fulldiv_opacity/images/language/english/t_reply.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_reply.png similarity index 100% rename from templates_fulldiv_opacity/images/language/english/t_reply.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/english/t_reply.png diff --git a/templates_fulldiv_opacity/images/language/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/language/index.html similarity index 100% rename from templates_fulldiv_opacity/images/language/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/language/index.html diff --git a/templates_fulldiv_opacity/images/language/persian/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/index.html similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/index.html diff --git a/templates_fulldiv_opacity/images/language/persian/new_forum.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/new_forum.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/new_forum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/new_forum.png diff --git a/templates_fulldiv_opacity/images/language/persian/new_subforum.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/new_subforum.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/new_subforum.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/new_subforum.png diff --git a/templates_fulldiv_opacity/images/language/persian/offline.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/offline.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/offline.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/offline.png diff --git a/templates_fulldiv_opacity/images/language/persian/online.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/online.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/online.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/online.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_bann.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_bann.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_bann.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_bann.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_delete.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_delete.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_delete.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_delete.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_edit.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_edit.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_edit.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_edit.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_quote.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_quote.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_quote.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_quote.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_reply.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_reply.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_reply.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_reply.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_report.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_report.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_report.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_report.png diff --git a/templates_fulldiv_opacity/images/language/persian/p_up.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_up.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/p_up.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/p_up.png diff --git a/templates_fulldiv_opacity/images/language/persian/t_new.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_new.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/t_new.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_new.png diff --git a/templates_fulldiv_opacity/images/language/persian/t_poll.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_poll.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/t_poll.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_poll.png diff --git a/templates_fulldiv_opacity/images/language/persian/t_qr.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_qr.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/t_qr.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_qr.png diff --git a/templates_fulldiv_opacity/images/language/persian/t_qr_expand.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_qr_expand.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/t_qr_expand.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_qr_expand.png diff --git a/templates_fulldiv_opacity/images/language/persian/t_reply.png b/EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_reply.png similarity index 100% rename from templates_fulldiv_opacity/images/language/persian/t_reply.png rename to EXTRA/themes/templates_fulldiv_opacity/images/language/persian/t_reply.png diff --git a/templates_fulldiv_opacity/images/mime/ace.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/ace.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/ace.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/ace.gif diff --git a/templates_fulldiv_opacity/images/mime/avi.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/avi.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/avi.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/avi.gif diff --git a/templates_fulldiv_opacity/images/mime/bmp.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/bmp.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/bmp.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/bmp.gif diff --git a/templates_fulldiv_opacity/images/mime/doc.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/doc.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/doc.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/doc.gif diff --git a/templates_fulldiv_opacity/images/mime/exe.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/exe.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/exe.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/exe.gif diff --git a/templates_fulldiv_opacity/images/mime/flash.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/flash.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/flash.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/flash.gif diff --git a/templates_fulldiv_opacity/images/mime/gif.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/gif.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/gif.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/gif.gif diff --git a/templates_fulldiv_opacity/images/mime/html.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/html.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/html.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/html.gif diff --git a/templates_fulldiv_opacity/images/mime/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/mime/index.html similarity index 100% rename from templates_fulldiv_opacity/images/mime/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/index.html diff --git a/templates_fulldiv_opacity/images/mime/jpeg.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/jpeg.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/jpeg.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/jpeg.gif diff --git a/templates_fulldiv_opacity/images/mime/jpg.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/jpg.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/jpg.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/jpg.gif diff --git a/templates_fulldiv_opacity/images/mime/mid.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/mid.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/mid.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/mid.gif diff --git a/templates_fulldiv_opacity/images/mime/mov.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/mov.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/mov.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/mov.gif diff --git a/templates_fulldiv_opacity/images/mime/mp3.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/mp3.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/mp3.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/mp3.gif diff --git a/templates_fulldiv_opacity/images/mime/mpg.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/mpg.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/mpg.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/mpg.gif diff --git a/templates_fulldiv_opacity/images/mime/netscape.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/netscape.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/netscape.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/netscape.gif diff --git a/templates_fulldiv_opacity/images/mime/pdf.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/pdf.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/pdf.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/pdf.gif diff --git a/templates_fulldiv_opacity/images/mime/png.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/png.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/png.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/png.gif diff --git a/templates_fulldiv_opacity/images/mime/ppt.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/ppt.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/ppt.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/ppt.gif diff --git a/templates_fulldiv_opacity/images/mime/rar.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/rar.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/rar.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/rar.gif diff --git a/templates_fulldiv_opacity/images/mime/txt.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/txt.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/txt.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/txt.gif diff --git a/templates_fulldiv_opacity/images/mime/unknown.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/unknown.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/unknown.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/unknown.gif diff --git a/templates_fulldiv_opacity/images/mime/wav.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/wav.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/wav.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/wav.gif diff --git a/templates_fulldiv_opacity/images/mime/xls.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/xls.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/xls.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/xls.gif diff --git a/templates_fulldiv_opacity/images/mime/zip.gif b/EXTRA/themes/templates_fulldiv_opacity/images/mime/zip.gif similarity index 100% rename from templates_fulldiv_opacity/images/mime/zip.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/mime/zip.gif diff --git a/templates_fulldiv_opacity/images/rpg/blue.gif b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/blue.gif similarity index 100% rename from templates_fulldiv_opacity/images/rpg/blue.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/blue.gif diff --git a/templates_fulldiv_opacity/images/rpg/green.gif b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/green.gif similarity index 100% rename from templates_fulldiv_opacity/images/rpg/green.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/green.gif diff --git a/templates_fulldiv_opacity/images/rpg/img_backing.gif b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/img_backing.gif similarity index 100% rename from templates_fulldiv_opacity/images/rpg/img_backing.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/img_backing.gif diff --git a/templates_fulldiv_opacity/images/rpg/img_left.gif b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/img_left.gif similarity index 100% rename from templates_fulldiv_opacity/images/rpg/img_left.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/img_left.gif diff --git a/templates_fulldiv_opacity/images/rpg/img_right.gif b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/img_right.gif similarity index 100% rename from templates_fulldiv_opacity/images/rpg/img_right.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/img_right.gif diff --git a/templates_fulldiv_opacity/images/rpg/index.html b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/index.html similarity index 100% rename from templates_fulldiv_opacity/images/rpg/index.html rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/index.html diff --git a/templates_fulldiv_opacity/images/rpg/orange.gif b/EXTRA/themes/templates_fulldiv_opacity/images/rpg/orange.gif similarity index 100% rename from templates_fulldiv_opacity/images/rpg/orange.gif rename to EXTRA/themes/templates_fulldiv_opacity/images/rpg/orange.gif diff --git a/templates_fulldiv_opacity/index.html b/EXTRA/themes/templates_fulldiv_opacity/index.html similarity index 100% rename from templates_fulldiv_opacity/index.html rename to EXTRA/themes/templates_fulldiv_opacity/index.html diff --git a/templates_fulldiv_opacity/js/index.html b/EXTRA/themes/templates_fulldiv_opacity/js/index.html similarity index 100% rename from templates_fulldiv_opacity/js/index.html rename to EXTRA/themes/templates_fulldiv_opacity/js/index.html diff --git a/templates_fulldiv_opacity/js/language/english/index.html b/EXTRA/themes/templates_fulldiv_opacity/js/language/english/index.html similarity index 100% rename from templates_fulldiv_opacity/js/language/english/index.html rename to EXTRA/themes/templates_fulldiv_opacity/js/language/english/index.html diff --git a/templates_fulldiv_opacity/js/language/english/newbb_toggle_class.js b/EXTRA/themes/templates_fulldiv_opacity/js/language/english/newbb_toggle_class.js similarity index 100% rename from templates_fulldiv_opacity/js/language/english/newbb_toggle_class.js rename to EXTRA/themes/templates_fulldiv_opacity/js/language/english/newbb_toggle_class.js diff --git a/templates_fulldiv_opacity/js/language/english/newbb_validation.js b/EXTRA/themes/templates_fulldiv_opacity/js/language/english/newbb_validation.js similarity index 100% rename from templates_fulldiv_opacity/js/language/english/newbb_validation.js rename to EXTRA/themes/templates_fulldiv_opacity/js/language/english/newbb_validation.js diff --git a/templates_fulldiv_opacity/js/language/index.html b/EXTRA/themes/templates_fulldiv_opacity/js/language/index.html similarity index 100% rename from templates_fulldiv_opacity/js/language/index.html rename to EXTRA/themes/templates_fulldiv_opacity/js/language/index.html diff --git a/templates_fulldiv_opacity/newbb_edit_post.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_edit_post.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_edit_post.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_edit_post.tpl diff --git a/templates_fulldiv_opacity/newbb_index.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_index.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl diff --git a/templates_fulldiv_opacity/newbb_index_menu.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_index_menu.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_index_menu.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_index_menu.tpl diff --git a/templates_fulldiv_opacity/newbb_notification_select.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_notification_select.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_notification_select.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_notification_select.tpl diff --git a/templates_fulldiv_opacity/newbb_online.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_online.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_online.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_online.tpl diff --git a/templates_fulldiv_opacity/newbb_poll_results.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_poll_results.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_poll_results.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_poll_results.tpl diff --git a/templates_fulldiv_opacity/newbb_poll_view.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_poll_view.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_poll_view.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_poll_view.tpl diff --git a/templates_fulldiv_opacity/newbb_rss.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_rss.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_rss.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_rss.tpl diff --git a/templates_fulldiv_opacity/newbb_search.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_search.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl diff --git a/templates_fulldiv_opacity/newbb_searchresults.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_searchresults.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_searchresults.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_searchresults.tpl diff --git a/templates_fulldiv_opacity/newbb_thread.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_thread.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_thread.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_thread.tpl diff --git a/templates_fulldiv_opacity/newbb_viewall.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_viewall.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl diff --git a/templates_fulldiv_opacity/newbb_viewforum.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_viewforum.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl diff --git a/templates_fulldiv_opacity/newbb_viewforum_menu.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_menu.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_viewforum_menu.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_menu.tpl diff --git a/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_viewforum_subforum.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl diff --git a/templates_fulldiv_opacity/newbb_viewpost.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewpost.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_viewpost.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_viewpost.tpl diff --git a/templates_fulldiv_opacity/newbb_viewtopic.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewtopic.tpl similarity index 100% rename from templates_fulldiv_opacity/newbb_viewtopic.tpl rename to EXTRA/themes/templates_fulldiv_opacity/newbb_viewtopic.tpl diff --git a/templates_fulldiv_opacity/readme.txt b/EXTRA/themes/templates_fulldiv_opacity/readme.txt similarity index 100% rename from templates_fulldiv_opacity/readme.txt rename to EXTRA/themes/templates_fulldiv_opacity/readme.txt From c8aeee795d3aae28bc06c13e63e33d0f822e670f Mon Sep 17 00:00:00 2001 From: geekwright Date: Tue, 26 Sep 2017 11:47:12 -0500 Subject: [PATCH 084/170] Store permission template as config Re: #37 --- class/permission.forum.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/class/permission.forum.php b/class/permission.forum.php index bfff7ce9..c8a356d3 100644 --- a/class/permission.forum.php +++ b/class/permission.forum.php @@ -25,6 +25,8 @@ */ class NewbbPermissionForumHandler extends NewbbPermissionHandler { + protected $templateFilename; + /** * @param XoopsDatabase|null $db */ @@ -32,6 +34,7 @@ public function __construct(XoopsDatabase $db) { // $this->NewbbPermissionHandler($db); parent::__construct($db); + $this->templateFilename = XOOPS_VAR_PATH . '/configs/newbb_permission_template.php'; } /** @@ -248,24 +251,20 @@ public function applyTemplate($forum, $mid = 0) } /** - * @return mixed|null + * @return array|false */ public function getTemplate() { - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); - $perms = $cacheHelper->read('perm_template'); - + $perms = \Xmf\Yaml::readWrapped($this->templateFilename); return $perms; } /** - * @param $perms + * @param array $perms * @return bool */ public function setTemplate($perms) { - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); - - return $cacheHelper->write('perm_template', $perms); + return \Xmf\Yaml::saveWrapped($perms, $this->templateFilename); } } From 0a3529b07172ef7420ca87078d0fb560ace31ef2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 19 Nov 2017 12:18:53 -0500 Subject: [PATCH 085/170] forumDescription, cosmetics --- .../xbootstrap/modules/newbb/newbb_viewforum.tpl | 2 +- admin/admin_digest.php | 2 +- admin/admin_report.php | 6 +++--- admin/admin_type_manager.php | 10 +++++----- class/helper.php | 5 ++--- class/online.php | 4 ++-- class/post.php | 6 +++--- class/utility.php | 16 ++++++++-------- docs/changelog.txt | 1 + docs/lang_diff.txt | 8 ++++++++ header.php | 1 + include/search.inc.php | 7 +++++-- index.php | 2 +- language/english/main.php | 4 +++- language/english/modinfo.php | 14 +++++++++----- templates/newbb_viewforum.tpl | 1 + viewforum.php | 6 ++++-- xoops_version.php | 2 +- 18 files changed, 59 insertions(+), 38 deletions(-) diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl index fe5b2585..27d686bf 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl @@ -124,7 +124,7 @@ - + <{$smarty.const._MD_NEWBB_FORUMDESCRIPTION}> <{$forumDescription}>
    diff --git a/admin/admin_digest.php b/admin/admin_digest.php index 5006aa76..51428cbb 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -91,7 +91,7 @@ echo '
  • ' . _AM_NEWBB_DIGEST_HELP_2 . '
  • '; echo '
  • ' . _AM_NEWBB_DIGEST_HELP_3 . '
  • '; echo '
  • ' . _AM_NEWBB_DIGEST_HELP_4 . '
  • '; - echo "" . "
    "; + echo "" . "
    "; echo '
    '; echo ""; echo ""; diff --git a/admin/admin_report.php b/admin/admin_report.php index 1b439dd6..e8840b23 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -111,10 +111,10 @@ //if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN); // else $adminObject->displayNavigation(basename(__FILE__)); - $adminObject->addItemButton($title_other, $item_other, $icon = 'add'); + $adminObject->addItemButton($title_other, $item_other, $icon = 'add'); $adminObject->displayButton('left'); echo _AM_NEWBB_REPORTADMIN_HELP; - echo "
    " . "
    "; + echo "" . "
    "; echo ''; echo ""; echo ""; @@ -142,7 +142,7 @@ $memo = ''; } else { $memo = $myts->htmlSpecialChars($report['report_memo']); - } + } echo ""; echo ''; echo "'; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 4c30bbef..edce7381 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -49,7 +49,7 @@ ///** @var \NewbbTypeHandler $typeHandler */ //$typeHandler = xoops_getModuleHandler('type', 'newbb'); -$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); +$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); switch ($op) { case 'save_type': @@ -366,10 +366,10 @@ } if ('add' !== $op) { - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); - $adminObject->displayButton('left'); + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); + $adminObject->displayButton('left'); } echo _AM_NEWBB_TYPE_HELP; echo "
    ' . _AM_NEWBB_REPORTPOST . ': ' . $post_link . '" . $report['report_id'] . '
    " . "'; $echo .= ''; -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 93db93e0..7dabdadf 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -145,29 +145,29 @@ return _MD_NEWBB_ERROR; } // SYNC FORUMS AFTER DELETE -// /** @var \NewbbForumHandler $forumHandler */ -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + // /** @var Newbb\ForumHandler $forumHandler */ + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); $forumHandler->synchronization(); // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL: } } - $tform = new XoopsThemeForm(_AM_NEWBB_PRUNE_RESULTS_TITLE, 'prune_results', xoops_getenv('PHP_SELF')); - $tform->addElement(new XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_FORUMS, $selected_forums)); - $tform->addElement(new XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_TOPICS, $topics_number)); - $tform->addElement(new XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_POSTS, $posts_number)); + $tform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_RESULTS_TITLE, 'prune_results', xoops_getenv('PHP_SELF')); + $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_FORUMS, $selected_forums)); + $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_TOPICS, $topics_number)); + $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_POSTS, $posts_number)); $tform->display(); } else { - $sform = new XoopsThemeForm(_AM_NEWBB_PRUNE_TITLE, 'prune', xoops_getenv('PHP_SELF')); + $sform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_TITLE, 'prune', xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); /* Let User select the number of days - $sform->addElement( new XoopsFormText(_AM_NEWBB_PRUNE_DAYS , 'days', 5, 10,100 ), true ); + $sform->addElement( new \XoopsFormText(_AM_NEWBB_PRUNE_DAYS , 'days', 5, 10,100 ), true ); */ // $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("newbb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("newbb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"; // $result = $GLOBALS['xoopsDB']->query(); // Days selected by selbox (better error control :lol:) - $days = new XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false); + $days = new \XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false); $days->addOptionArray([ 604800 => _AM_NEWBB_PRUNE_WEEK, 1209600 => _AM_NEWBB_PRUNE_2WEEKS, @@ -186,11 +186,11 @@ $forumSelBox = ''; $forumSelBox .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false $forumSelBox .= ''; - $forumEle = new XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); - $storeEle = new XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); + $forumEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); + $storeEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); /* irmtfan remove hardcode - $checkbox = new XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); - $radiobox = new XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); + $checkbox = new \XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); + $radiobox = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); // PUAJJ I HATE IT, please tidy up $sql = "SELECT forum_name, forum_id FROM " . $GLOBALS['xoopsDB']->prefix("newbb_forums") . " ORDER BY forum_id"; if ($result = $GLOBALS['xoopsDB']->query($sql)) { @@ -211,22 +211,22 @@ $sform->addElement(/*$checkbox*/ $forumEle); // irmtfan - $sticky_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1); + $sticky_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1); $sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); $sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); $sform->addElement($sticky_confirmation); - $digest_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_DIGEST, 'digest', 1); + $digest_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_DIGEST, 'digest', 1); $digest_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); $digest_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); $sform->addElement($digest_confirmation); - $lock_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_LOCK, 'lock', 0); + $lock_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_LOCK, 'lock', 0); $lock_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); $lock_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); $sform->addElement($lock_confirmation); - $hot_confirmation = new XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false); + $hot_confirmation = new \XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false); $hot_confirmation->addOptionArray([ '0' => 0, '5' => 5, @@ -241,22 +241,22 @@ $sform->addElement(/*$radiobox*/ $storeEle); // irmtfan - $archive_confirmation = new XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); + $archive_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); $archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); $archive_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); $sform->addElement($archive_confirmation); - $button_tray = new XoopsFormElementTray('', ''); - $button_tray->addElement(new XoopsFormButton('', 'submit', _AM_NEWBB_PRUNE_SUBMIT, 'submit')); - $button_tray->addElement(new XoopsFormButton('', 'reset', _AM_NEWBB_PRUNE_RESET, 'reset')); + $button_tray = new \XoopsFormElementTray('', ''); + $button_tray->addElement(new \XoopsFormButton('', 'submit', _AM_NEWBB_PRUNE_SUBMIT, 'submit')); + $button_tray->addElement(new \XoopsFormButton('', 'reset', _AM_NEWBB_PRUNE_RESET, 'reset')); $sform->addElement($button_tray); $sform->display(); } - echo '
    "; diff --git a/class/helper.php b/class/helper.php index f7cfa199..579a38ff 100644 --- a/class/helper.php +++ b/class/helper.php @@ -14,11 +14,11 @@ /** * NewBB module for xoops * - * @copyright XOOPS Project (http://xoops.org) + * @copyright XOOPS Project (https://xoops.org) * @license GPL 2.0 or later * @package newbb * @since 5.0.0 - * @author XOOPS Development Team - + * @author XOOPS Development Team - */ //defined('XOOPS_ROOT_PATH') || die('Restricted access'); @@ -71,5 +71,4 @@ public function setConfig($name = null, $value = null) return $this->configs[$name]; } - } diff --git a/class/online.php b/class/online.php index c01d95e6..9c336938 100644 --- a/class/online.php +++ b/class/online.php @@ -295,7 +295,7 @@ public function getAll(CriteriaElement $criteria = null) $ret = []; $limit = $start = 0; $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_online'); - if (is_object($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (is_object($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' ' . $criteria->renderWhere(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); @@ -358,7 +358,7 @@ public function checkStatus($uids) public function getCount(CriteriaElement $criteria = null) { $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online'); - if (is_object($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (is_object($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { diff --git a/class/post.php b/class/post.php index 89f9c3f4..dc216d53 100644 --- a/class/post.php +++ b/class/post.php @@ -628,7 +628,7 @@ public function showPost($isAdmin) $thread_action['pdf']['link'] = XOOPS_URL . '/modules/newbb/makepdf.php?type=post&pageid=0'; $thread_action['pdf']['name'] = _MD_NEWBB_PDF; $thread_action['pdf']['target'] = '_blank'; - } + } // irmtfan add print permission if ($topicHandler->getPermission($forum_id, $topic_status, 'print')) { $thread_action['print']['image'] = newbbDisplayImage('printer', _MD_NEWBB_PRINT); @@ -1161,7 +1161,7 @@ public function getPostCount($criteria = null, $join = null) // LEFT JOIN $sql .= $join; // WHERE - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { @@ -1191,7 +1191,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join if (!empty($join)) { $sql .= $join; } - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' ' . $criteria->renderWhere(); if ('' !== $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); diff --git a/class/utility.php b/class/utility.php index 0929b592..1166be5a 100644 --- a/class/utility.php +++ b/class/utility.php @@ -81,15 +81,15 @@ public static function prepareFolder($folder) public static function cleanCache() { - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); - if (method_exists($cacheHelper,'clear')) { - $cacheHelper->clear(); + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); + if (method_exists($cacheHelper, 'clear')) { + $cacheHelper->clear(); return; - } - // for 2.5 systems, clear everything - require_once XOOPS_ROOT_PATH . '/modules/system/class/maintenance.php'; - $maintenance = new SystemMaintenance(); - $cacheList = [ + } + // for 2.5 systems, clear everything + require_once XOOPS_ROOT_PATH . '/modules/system/class/maintenance.php'; + $maintenance = new SystemMaintenance(); + $cacheList = [ 3, // xoops_cache ]; $maintenance->CleanCache($cacheList); diff --git a/docs/changelog.txt b/docs/changelog.txt index 5aa1eaab..3c8f00f8 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -7,6 +7,7 @@ - lots of warning/error cleanup (geekwright) - extra code updates (mamba) - Short syntax in array literals (mamba) +- added forumDescription to viewforum.php (aerograf/mamba) 4.33 RC 13 (XOOPS 2.5.8) (NOT RELEASED) =========================================== diff --git a/docs/lang_diff.txt b/docs/lang_diff.txt index 5daeecd6..bed4ad2f 100644 --- a/docs/lang_diff.txt +++ b/docs/lang_diff.txt @@ -3,6 +3,13 @@ LANGUAGE DIFFERENCES Below are language differences from a version to next version. +5.0 Alpha-1 +---------------- +main.php +---------- +define('_MD_NEWBB_FORUMDESCRIPTION', 'Forum Description:'); + +=========================================== Version 4.3 rev.9992 ---------------- admin.php @@ -114,3 +121,4 @@ define("_MB_NEWBB_CRITERIA_ORDER","Order by"); define("_MB_NEWBB_TITLE_LENGTH_DESC","Length of topic title excerpt in block. 0 for show the whole title and no excerpt."); define("_MB_NEWBB_POST_EXCERPT","Post text excerpt in block"); define("_MB_NEWBB_POST_EXCERPT_DESC","Length of post text excerpt by mouse over on topic title in block. 0 for dont show post text."); + diff --git a/header.php b/header.php index bf7dbc33..5ec90430 100644 --- a/header.php +++ b/header.php @@ -22,6 +22,7 @@ $moduleDirName = basename(__DIR__); //include_once $GLOBALS['xoops']->path('header.php'); + if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { include_once __DIR__ . '/seo_url.php'; /* for seo */ diff --git a/include/search.inc.php b/include/search.inc.php index ef03659f..09439f67 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -69,9 +69,12 @@ function newbb_search( $criteriaUser->add(new Criteria('p.uid', '(' . implode(',', $userid) . ')', 'IN'), 'OR'); } - $count = count($queryarray); + $count = 0; + if (is_array($queryarray)) { + $count = count($queryarray); + } $highlightKey = ''; - if (is_array($queryarray) && $count > 0) { + if ($count > 0) { $criteriaKeywords = new CriteriaCompo(); foreach ($queryarray as $queryTerm) { $termCriteria = new CriteriaCompo(); diff --git a/index.php b/index.php index fd4b190b..e30b4924 100644 --- a/index.php +++ b/index.php @@ -196,7 +196,7 @@ } //$cat_image = $onecat['cat_image']; $cat_image = ''; - $cat_image = $onecat['cat_image']; + $cat_image = $onecat['cat_image']; if ('' !== $cat_image && 'blank.gif' !== $cat_image && $cat_image) { $cat_image = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/assets/images/category/' . $cat_image; } diff --git a/language/english/main.php b/language/english/main.php index 73c1c85c..178b8f46 100644 --- a/language/english/main.php +++ b/language/english/main.php @@ -544,4 +544,6 @@ define('_MD_NEWBB_AUTO_CREATE_EMAIL', 'Email'); define('_MD_NEWBB_AUTO_CREATE_AVATARS', 'Avatar'); define('_MD_NEWBB_AUTO_CREATE_ABOUT', ''); -define('_MD_NEWBB_NO_SELECTION', 'Selection required'); \ No newline at end of file +define('_MD_NEWBB_NO_SELECTION', 'Selection required'); + +define('_MD_NEWBB_FORUMDESCRIPTION', 'Forum Description:'); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 64532b19..ada02f9c 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -41,8 +41,10 @@ //define('_MI_NEWBB_THEMESET', 'Theme set'); //define('_MI_NEWBB_THEMESET_DESC', "Module-wide, select '' . _NONE . '' will use site-wide theme"); define('_MI_NEWBB_DIR_ATTACHMENT', 'Attachments physical path.'); -define('_MI_NEWBB_DIR_ATTACHMENT_DESC', - "Physical path only needs to be set from your xoops root and not before, for example you may have attachments uploaded to www.yoururl.com/uploads/newbb the path entered would then be '/uploads/newbb' never include a trailing slash '/' the thumbnails path becomes '/uploads/newbb/thumbs'"); +define( + '_MI_NEWBB_DIR_ATTACHMENT_DESC', + "Physical path only needs to be set from your xoops root and not before, for example you may have attachments uploaded to www.yoururl.com/uploads/newbb the path entered would then be '/uploads/newbb' never include a trailing slash '/' the thumbnails path becomes '/uploads/newbb/thumbs'" +); define('_MI_NEWBB_PATH_MAGICK', 'Path for ImageMagick'); define('_MI_NEWBB_PATH_MAGICK_DESC', "Usually it is '/usr/bin/X11'. Leave it BLANK if you do not have ImageMagicK installed or for autodetecting."); define('_MI_NEWBB_SUBFORUM_DISPLAY', 'Display Mode of subforums on index page'); @@ -78,8 +80,10 @@ define('_MI_NEWBB_TEXT', 'text'); define('_MI_NEWBB_GRAPHIC', 'graphic'); define('_MI_NEWBB_USERLEVEL', 'HP/MP/EXP Level Mode'); -define('_MI_NEWBB_USERLEVEL_DESC', - 'HP is determined by your average posts per day.
    MP is determined by your join date related to your post count.
    EXP goes up each time you post, and when you get to 100%, you gain a level and the EXP drops to 0 again.'); +define( + '_MI_NEWBB_USERLEVEL_DESC', + 'HP is determined by your average posts per day.
    MP is determined by your join date related to your post count.
    EXP goes up each time you post, and when you get to 100%, you gain a level and the EXP drops to 0 again.' +); define('_MI_NEWBB_RSS_ENABLE', 'Enable RSS Feed'); define('_MI_NEWBB_RSS_ENABLE_DESC', 'Enable RSS Feed, edit options below for maximum Items and Description length'); define('_MI_NEWBB_RSS_MAX_ITEMS', 'RSS Max. Items'); @@ -336,4 +340,4 @@ define('_MI_NEWBB_WELCOMEFORUM_MESSAGE_DESC', 'The message will be published in the first user message when the user first logs on to the Forum'); define('_MI_NEWBB_WELCOMEFORUM_DESC_MESSAGE', ' Since the forum works in real time, it is impossible to verify or confirm the accuracy of the information placed here. Remember that the forum administration does not actively monitor and is not responsible for the messages sent. Administration does not guarantee the accuracy, completeness and correctness of the content of any message. Any communication reflects the author\'s point of view, which does not necessarily coincide with the point of view of the administration of the forum or organization associated with this forum. Any user who finds a provocative message can inform the forum administration about this. In this case, the message will be reviewed and, if the administration deems it necessary, deleted. However, do not forget that this process takes time and treat it with understanding. -'); \ No newline at end of file +'); diff --git a/templates/newbb_viewforum.tpl b/templates/newbb_viewforum.tpl index 895a5563..93c00dc0 100644 --- a/templates/newbb_viewforum.tpl +++ b/templates/newbb_viewforum.tpl @@ -127,6 +127,7 @@ <{/if}> + <{$smarty.const._MD_NEWBB_FORUMDESCRIPTION}> <{$forumDescription}> <{foreach name=loop item=topic from=$topics}> diff --git a/viewforum.php b/viewforum.php index cbd17d7c..078399e1 100644 --- a/viewforum.php +++ b/viewforum.php @@ -88,6 +88,9 @@ ' . @$xoopsTpl->get_template_vars('xoops_module_header')); } +$forumDescription = $forumObject->getVar('forum_desc'); +$xoopsTpl->assign('forumDescription', $forumDescription); + //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); $xoopsTpl->assign('forum_id', $forum_id); $xoopsTpl->assign('version', $xoopsModule->getVar('version')); @@ -164,8 +167,7 @@ 't.rating' => _MD_NEWBB_RATINGS, 't.topic_last_post_id' => _MD_NEWBB_LASTPOSTTIME ]; -if (!Request::getString('sort', '', 'GET') - || !array_key_exists(Request::getString('sort', '', 'GET'), $sel_sort_array)) { +if (!Request::getString('sort', '', 'GET') || !array_key_exists(Request::getString('sort', '', 'GET'), $sel_sort_array)) { $sort = 't.topic_last_post_id'; } else { $sort = Request::getString('sort', '', 'GET'); diff --git a/xoops_version.php b/xoops_version.php index be4eeccd..953acded 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -805,4 +805,4 @@ 'description' => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYDSC, 'mail_template' => 'global_newfullpost_notify', 'mail_subject' => _MI_NEWBB_GLOBAL_NEWFULLPOST_NOTIFYSBJ, -]; \ No newline at end of file +]; From 836f9e391933186545c0930fa2f30710db8b940c Mon Sep 17 00:00:00 2001 From: geekwright Date: Fri, 29 Sep 2017 07:19:36 -0500 Subject: [PATCH 086/170] Fix object test Re: #56 --- class/topic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/topic.php b/class/topic.php index 466ff134..e258317b 100644 --- a/class/topic.php +++ b/class/topic.php @@ -665,7 +665,7 @@ public function synchronization($object = null, $force = true) if (!is_object($object)) { $object = $this->get((int)$object); } - if (null !== !$object && !$object->getVar('topic_id')) { + if (!is_object($object) || !$object->getVar('topic_id')) { return false; } From b1f23e6806f2d0d1c0fde94fbf795830273dca7d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 19 Nov 2017 14:46:36 -0500 Subject: [PATCH 087/170] fix forum description --- class/forum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/forum.php b/class/forum.php index b0238a30..c68f793d 100644 --- a/class/forum.php +++ b/class/forum.php @@ -28,7 +28,7 @@ public function __construct() parent::__construct(); $this->initVar('forum_id', XOBJ_DTYPE_INT); $this->initVar('forum_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('forum_desc', XOBJ_DTYPE_TXTBOX); + $this->initVar('forum_desc', XOBJ_DTYPE_TXTAREA); $this->initVar('forum_moderator', XOBJ_DTYPE_ARRAY, serialize([])); $this->initVar('forum_topics', XOBJ_DTYPE_INT); $this->initVar('forum_posts', XOBJ_DTYPE_INT); From 9767c0dc5bf7df515a78effe4e279ddcac1e0a78 Mon Sep 17 00:00:00 2001 From: Nikolay N Shmelev Date: Sun, 19 Nov 2017 22:39:05 +0300 Subject: [PATCH 088/170] Edit forum desc --- viewforum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viewforum.php b/viewforum.php index 078399e1..2202b837 100644 --- a/viewforum.php +++ b/viewforum.php @@ -88,7 +88,7 @@ ' . @$xoopsTpl->get_template_vars('xoops_module_header')); } -$forumDescription = $forumObject->getVar('forum_desc'); +$forumDescription = $myts->displayTarea($forumObject->getVar('forum_desc')); $xoopsTpl->assign('forumDescription', $forumDescription); //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); From 25a5bac69de1cbe664c8e35c5a219ea2a7d66798 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 20 Nov 2017 01:28:02 -0500 Subject: [PATCH 089/170] reverting change (conflict with displayTarea) --- class/forum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/forum.php b/class/forum.php index c68f793d..b0238a30 100644 --- a/class/forum.php +++ b/class/forum.php @@ -28,7 +28,7 @@ public function __construct() parent::__construct(); $this->initVar('forum_id', XOBJ_DTYPE_INT); $this->initVar('forum_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('forum_desc', XOBJ_DTYPE_TXTAREA); + $this->initVar('forum_desc', XOBJ_DTYPE_TXTBOX); $this->initVar('forum_moderator', XOBJ_DTYPE_ARRAY, serialize([])); $this->initVar('forum_topics', XOBJ_DTYPE_INT); $this->initVar('forum_posts', XOBJ_DTYPE_INT); From 56cdce02b9ff4a8669bbd7c6deb148a6a2675afc Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 20 Nov 2017 03:58:09 -0500 Subject: [PATCH 090/170] updates --- EXTRA/themes/xbootstrap/modules/newbb/newbb_index_menu.tpl | 2 +- admin/admin_cat_manager.php | 2 +- class/forum.php | 4 ++-- viewforum.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index_menu.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index_menu.tpl index 6e44c2e6..19a8a8fc 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index_menu.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index_menu.tpl @@ -1,4 +1,4 @@ - - <{foreachq item=act from=$admin_actions}> + <{foreach item=act from=$admin_actions}> <{/foreach}> - <{if count($adminpoll_actions) > 0 }> + <{if $adminpoll_actions|is_array && count($adminpoll_actions) > 0 }> - <{foreachq item=actpoll from=$adminpoll_actions}> + <{foreach item=actpoll from=$adminpoll_actions}> <{/foreach}> <{/if}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewtopic.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewtopic.tpl index 0a4da4ec..4711f8ed 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewtopic.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewtopic.tpl @@ -139,14 +139,14 @@ <{else}> <{if $topic_post.thread_buttons}> - <{foreachq item=btn from=$topic_post.thread_buttons}> + <{foreach item=btn from=$topic_post.thread_buttons}> <{$btn.image}> <{/foreach}> <{/if}> diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl index 14503ee7..c407ba3a 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl @@ -143,7 +143,7 @@
    - <{foreachq name=loop item=topic from=$topics}> + <{foreach name=loop item=topic from=$topics}>
    ">
    <{$topic.topic_folder}><{$topic.lock}>
    diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl index 19d47fda..92dc6383 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl @@ -6,7 +6,7 @@ » <{$category.title}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> » <{$forum.forum_name}> <{/foreach}> @@ -123,7 +123,7 @@
    - <{foreachq name=loop item=topic from=$topics}> + <{foreach name=loop item=topic from=$topics}> <{if $topic.stick AND $smarty.foreach.loop.iteration == $sticky+1}>
     
    @@ -233,7 +233,7 @@
    - <{foreachq item=perm from=$permission_table}> + <{foreach item=perm from=$permission_table}>
    <{$perm}>
    <{/foreach}>
    diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_menu.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_menu.tpl index 7d1d2b9e..0f53c84d 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_menu.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_menu.tpl @@ -20,7 +20,7 @@ onchange="if(this.options[this.selectedIndex].value.length >0 ) { window.location=this.options[this.selectedIndex].value;}" > - <{foreachq item=opt from=$typeOptions}> + <{foreach item=opt from=$typeOptions}> <{/foreach}> diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl index 4b491648..c5098486 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum_subforum.tpl @@ -7,7 +7,7 @@
    <{$smarty.const._MD_NEWBB_LASTPOST}>
    - <{foreachq item=sforum from=$subforum}> + <{foreach item=sforum from=$subforum}>
    <{$sforum.forum_folder}>
    diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewpost.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewpost.tpl index ecf567a5..cf6f0590 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewpost.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewpost.tpl @@ -8,7 +8,7 @@ <{$category.title}> <{/if}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> » <{$forum.forum_name}> <{/foreach}> @@ -67,7 +67,7 @@ @@ -79,7 +79,7 @@


    -<{foreachq item=post from=$posts}> +<{foreach item=post from=$posts}> <{includeq file="db:newbb_thread.tpl" topic_post=$post}>
    <{$smarty.const._MD_NEWBB_VIEWTOPIC}> diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewtopic.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewtopic.tpl index 631b0bee..476299e1 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewtopic.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewtopic.tpl @@ -6,7 +6,7 @@ » <{$category.title}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> » <{$forum.forum_name}> <{/foreach}> @@ -28,7 +28,7 @@ <{if $online}>
    <{$smarty.const._MD_NEWBB_BROWSING}>  - <{foreachq item=user from=$online.users}> + <{foreach item=user from=$online.users}> <{if $user.level eq 2}> <{$user.uname}> @@ -125,7 +125,7 @@ <{/if}> @@ -158,7 +158,7 @@
    <{$smarty.const._MD_NEWBB_TOPICLOCK}>

    <{/if}> -<{foreachq item=topic_post from=$topic_posts}> +<{foreach item=topic_post from=$topic_posts}> <{includeq file="db:newbb_thread.tpl" topic_post=$topic_post mode=$mode}>

    @@ -176,7 +176,7 @@ »
    <{$category.title}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> » <{$forum.forum_name}> <{/foreach}> @@ -226,7 +226,7 @@
    - <{foreachq item=perm from=$permission_table}> + <{foreach item=perm from=$permission_table}>
    <{$perm}>
    <{/foreach}>
    diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_edit_post.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_edit_post.tpl index 09c8f728..03933de0 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_edit_post.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_edit_post.tpl @@ -7,7 +7,7 @@ » <{$category.title}> <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}> »   <{$forum.forum_name}> @@ -52,7 +52,7 @@ > - <{foreachq item=element from=$form_post.elements}> + <{foreach item=element from=$form_post.elements}> <{if $element.hidden != true}>
    @@ -68,7 +68,7 @@ <{/if}> <{/foreach}>
    - <{foreachq item=element from=$form_post.elements}> + <{foreach item=element from=$form_post.elements}> <{if $element.hidden == true}> <{$element.body}> <{/if}> @@ -80,7 +80,7 @@ <{if $posts_context}> - <{foreachq item=post from=$posts_context}> + <{foreach item=post from=$posts_context}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl index 87300dde..339677c7 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl @@ -67,7 +67,7 @@
    - <{foreachq item=category from=$categories}> + <{foreach item=category from=$categories}>

    @@ -137,7 +137,7 @@
    <{$smarty.const._MD_NEWBB_LASTPOST}>

    <{/if}> - <{foreachq item=forum from=$category.forums}> + <{foreach item=forum from=$category.forums}>
    <{if $forum.subforum}> @@ -223,7 +223,7 @@ <{if $forum.subforum}> <{$smarty.const._MD_NEWBB_SUBFORUMS}><{$img_subforum}> - <{foreachq item=subforum from=$forum.subforum}> + <{foreach item=subforum from=$forum.subforum}> [ <{$subforum.forum_name}> ] diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_online.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_online.tpl index 5ed7205e..8936bd94 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_online.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_online.tpl @@ -10,7 +10,7 @@ <{if $online.num_user}>
    <{$online.num_user}> <{$smarty.const._MD_NEWBB_REGISTERED_USERS}> - <{foreachq item=user from=$online.users}> + <{foreach item=user from=$online.users}> <{if $user.level eq 2}> <{$user.uname}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl index c18754db..4d78284e 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl @@ -33,7 +33,7 @@ <{if $topic_post.poster.groups}>
  • <{$smarty.const._MD_NEWBB_GROUP}> - <{foreachq item=group from=$topic_post.poster.groups}> + <{foreach item=group from=$topic_post.poster.groups}> <{$group}> <{/foreach}>
  • <{/if}> @@ -120,7 +120,7 @@
    - <{foreachq name=loop item=topic from=$topics}> + <{foreach name=loop item=topic from=$topics}> "> '; echo ''; - $digests = []; -// /** @var \NewbbDigestHandler $digestHandler */ -// $digestHandler = xoops_getModuleHandler('digest', 'newbb'); - $digests = $digestHandler->getAllDigests($start, $limit); + $digests = []; + // /** @var Newbb\DigestHandler $digestHandler */ + // $digestHandler = Newbb\Helper::getInstance()->getHandler('Digest'); + $digests = $digestHandler->getAllDigests($start, $limit); foreach ($digests as $digest) { echo ""; echo ""; @@ -110,11 +110,11 @@ echo ''; echo ""; } - $submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); + $submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); echo "'; - $hidden = new XoopsFormHidden('op', 'delete'); + $hidden = new \XoopsFormHidden('op', 'delete'); echo $hidden->render(); - $hidden = new XoopsFormHidden('item', $item); + $hidden = new \XoopsFormHidden('item', $item); echo $hidden->render() . ''; echo '
    <{$post.subject}>
    diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl index d5dc03e7..6f7a56fd 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_viewforum.tpl @@ -8,7 +8,7 @@ <{if $parentforum}> - <{foreachq item=forum from=$parentforum}> + <{foreach item=forum from=$parentforum}>
  • <{$forum.forum_name}>
  • <{/foreach}> <{/if}> @@ -148,7 +148,7 @@ <{/if}> <{/if}> - <{foreachq name=loop item=topic from=$topics}> + <{foreach name=loop item=topic from=$topics}>
    ">
    " . _AM_NEWBB_DIGESTCONTENT . '
    " . $submit->render() . '
    '; @@ -123,7 +123,7 @@ echo ' ' . _AM_NEWBB_PREFERENCES . ' - ' . _MI_NEWBB_ADMENU_DIGEST . ' '; echo _AM_NEWBB_DIGEST_HELP_AUTO_DIGEST; echo ''; - $nav = new XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); + $nav = new \XoopsPageNav($digestHandler->getDigestCount(), $limit, $start, 'start'); echo $nav->renderNav(4); break; diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index d37cc575..be72982a 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -45,8 +45,8 @@ $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); $forum_id = Request::getInt('forum', Request::getInt('forum', 0, 'POST'), 'GET'); //(int)( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) ); -///** @var \NewbbForumHandler $forumHandler */ -//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var Newbb\ForumHandler $forumHandler */ +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); switch ($op) { case 'moveforum': //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); @@ -69,7 +69,7 @@ if ($forumHandler->insert($forumObject)) { if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { $forums = array_map('intval', array_values($subforums)); - $forumHandler->updateAll('cat_id', $cid, new Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); + $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); } //$cacheHelper->delete('forum'); @@ -111,10 +111,10 @@ $result_topic = $GLOBALS['xoopsDB']->queryF($sql); $forumObject = $forumHandler->get($forum_id); - $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new Criteria('parent_forum', $forum_id)); + $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id)); if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { $forums = array_map('intval', array_values($subforums)); - $forumHandler->updateAll('cat_id', $cid, new Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); + $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); } $forumHandler->delete($forumObject); @@ -151,10 +151,10 @@ if ($forum_id) { $forumObject = $forumHandler->get($forum_id); - $message = _AM_NEWBB_FORUMUPDATE; + $message = _AM_NEWBB_FORUMUPDATE; } else { $forumObject = $forumHandler->create(); - $message = _AM_NEWBB_FORUMCREATED; + $message = _AM_NEWBB_FORUMCREATED; } $forumObject->setVar('forum_name', Request::getString('forum_name', '', 'POST')); @@ -166,7 +166,7 @@ $forumObject->setVar('attach_ext', Request::getString('attach_ext', '', 'POST')); $forumObject->setVar('hot_threshold', Request::getInt('hot_threshold', 0, 'POST')); if (Request::getInt('parent_forum', 0, 'POST')) { - $parentObject = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']); + $parentObject = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']); $_POST['cat_id'] = $parentObject->getVar('cat_id'); } $forumObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); @@ -174,9 +174,9 @@ if ($forumHandler->insert($forumObject)) { //$cacheHelper->delete('forum'); if (Request::getInt('perm_template', 0, 'POST')) { -// /** @var \NewbbPermissionHandler $permHandler */ -// $permHandler = xoops_getModuleHandler('permission', 'newbb'); - $perm_template = $permHandler->getTemplate(); + // /** var Newbb\PermissionHandler $permHandler */ + // $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); + $perm_template = $permHandler->getTemplate(); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); @@ -232,9 +232,9 @@ default: -// /** @var \NewbbCategoryHandler $categoryHandler */ -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + // /** @var Newbb\CategoryHandler $categoryHandler */ + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (0 === count($categories)) { @@ -253,8 +253,8 @@ $echo .= "
    " . _AM_NEWBB_MERGE . '
    '; - echo '
    '; - echo ' ' . _MI_NEWBB_ADMENU_PRUNE . ' '; - echo _AM_NEWBB_HELP_PRUNE_TAB; - echo '
    '; +echo '
    '; +echo '
    '; +echo ' ' . _MI_NEWBB_ADMENU_PRUNE . ' '; +echo _AM_NEWBB_HELP_PRUNE_TAB; +echo '
    '; include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index fc8e2480..eba8249e 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -66,7 +66,7 @@ $adminObject->displayNavigation(basename(__FILE__)); echo "" . "
    "; - $tform = new XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); + $tform = new \XoopsThemeForm(_AM_NEWBB_SETFORUMORDER, '', ''); $tform->display(); echo "
    "; echo ""; @@ -75,11 +75,11 @@ echo "'; echo ''; -// /** @var \NewbbForumHandler $forumHandler */ -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); -// /** @var \NewbbCategoryHandler $categoryHandler */ -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + // /** @var Newbb\ForumHandler $forumHandler */ + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + // /** @var Newbb\CategoryHandler $categoryHandler */ + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index b6999d39..3739178a 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -37,8 +37,8 @@ $adminObject->displayNavigation(basename(__FILE__)); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); -///** @var \NewbbForumHandler $forumHandler */ -//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); +///** @var Newbb\ForumHandler $forumHandler */ +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); if (Request::getString('submit', '', 'POST')) { $fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : ''; $fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']); @@ -73,9 +73,9 @@ echo _AM_NEWBB_GROUPMOD_TITLEDESC; echo "

    " . _AM_NEWBB_REORDERWEIGHT . '
    " . "
    "; echo ""; -///** @var \NewbbCategoryHandler $categoryHandler */ -//$categoryHandler = xoops_getModuleHandler('category', 'newbb'); -$criteriaCategory = new CriteriaCompo(new criteria('1', 1)); +///** @var Newbb\CategoryHandler $categoryHandler */ +//$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); +$criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); diff --git a/admin/admin_header.php b/admin/admin_header.php index 79572018..e0153b35 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -53,11 +53,11 @@ if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { require_once $GLOBALS['xoops']->path('class/template.php'); - $xoopsTpl = new XoopsTpl(); + $xoopsTpl = new \XoopsTpl(); } -$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); -$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); // Local icons path diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index 5d1b22e5..fba9736a 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -104,9 +104,9 @@ public function render() $this->addElement($ele); unset($ele); } - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); + $tray = new \XoopsFormElementTray(''); + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); $this->addElement($tray); $ret = '
    ' . $this->getTitle() . '
    ' . $this->_permDesc . '
    '; $ret .= "getExtra() . ">\n\n"; @@ -206,8 +206,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; $action = strtolower(Request::getCmd('action', '')); $module_id = $xoopsModule->getVar('mid'); -/** @var \NewbbPermissionHandler $newbbpermHandler */ -$newbbpermHandler = xoops_getModuleHandler('permission', 'newbb'); +/** var Newbb\PermissionHandler $newbbpermHandler */ +$newbbpermHandler = Newbb\Helper::getInstance()->getHandler('Permission'); $perms = $newbbpermHandler->getValidForumPerms(); switch ($action) { @@ -215,8 +215,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT, 'actionform', 'admin_permissions.php', 'get'); - $op_select = new XoopsFormSelect('', 'action'); + $opform = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT, 'actionform', 'admin_permissions.php', 'get'); + $op_select = new \XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ 'no' => _SELECT, @@ -234,8 +234,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) foreach (array_keys($glist) as $i) { $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; $ret_ele = ''; - $ret_ele .= '
    ' . $glist[$i] . ''; - $ret_ele .= ''; } - while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) { + while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) { $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' '; $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); @@ -126,7 +126,7 @@ echo '
    '; + $ret_ele .= ''; echo ''; - $typesObject = $typeHandler->getAll(new Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); + $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); arsort($templates); foreach ($templates as $order => $key) { if (!isset($typesObject[$key])) { @@ -241,15 +241,15 @@ break; case 'forum': -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (empty($categories)) { redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $forums = $forumHandler->getTree(array_keys($categories)); + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + $forums = $forumHandler->getTree(array_keys($categories)); if (empty($forums)) { redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); } @@ -261,14 +261,14 @@ } } unset($forums, $categories); - $fmform = new XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); - $fm_select = new XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); + $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); $fm_select->addOptionArray($fm_options); $fmform->addElement($fm_select); - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormHidden('op', 'edit_forum')); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); + $tray = new \XoopsFormElementTray(''); + $tray->addElement(new \XoopsFormHidden('op', 'edit_forum')); + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); $fmform->addElement($tray); //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); @@ -285,7 +285,7 @@ redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); } -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); } @@ -392,7 +392,7 @@ echo ""; echo ""; if ($isColorpicker) { - $form_colorpicker = new XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); + $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); echo ''; } else { echo ""; @@ -409,7 +409,7 @@ echo ""; echo ""; if ($isColorpicker) { - $form_colorpicker = new XoopsFormColorPicker('', "type_color[{$i}]", ''); + $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); echo ''; } else { echo ""; diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index 98d0e8bb..64cb8413 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -84,7 +84,7 @@ xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); - + echo "
    \n
    " . _AM_NEWBB_VOTE_USERAVG . ": $useravgrating
    \n
    " . _AM_NEWBB_VOTE_TOTALRATE . ": $uservotes
    \n @@ -128,7 +128,7 @@ //Include page navigation include_once $GLOBALS['xoops']->path('class/pagenav.php'); $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; - $pagenav = new XoopsPageNav($page, 20, $start, 'start'); + $pagenav = new \XoopsPageNav($page, 20, $start, 'start'); echo '
    ' . $page . '' . $pagenav->renderImageNav(4) . '
    '; echo '
    '; echo ' ' . _MI_NEWBB_ADMENU_VOTE . ' '; diff --git a/admin/index.php b/admin/index.php index ed93445e..436812c9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -102,11 +102,11 @@ function newbb_getImageLibs() xoops_cp_header(); -$imageLibs = newbb_getImageLibs(); +$imageLibs = newbb_getImageLibs(); /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); -///** @var \NewbbReportHandler $reportHandler */ -//$reportHandler = xoops_getModuleHandler('report', 'newbb'); +///** @var Newbb\ReportHandler $reportHandler */ +//$reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); $isOK = false; // START irmtfan add a poll_module config @@ -119,7 +119,7 @@ function newbb_getImageLibs() $memlimit_iniphp = return_bytes(@ini_get('memory_limit')); $postmaxsize_iniphp = return_bytes(@ini_get('post_max_size')); -$uploadlimit = _AM_NEWBB_MEMLIMITTOLARGE; +$uploadlimit = _AM_NEWBB_MEMLIMITTOLARGE; if ($postmaxsize_iniphp < $memlimit_iniphp) { $uploadlimit = sprintf(_AM_NEWBB_MEMLIMITOK, return_bytes($postmaxsize_iniphp, true)); } @@ -149,8 +149,8 @@ function newbb_getImageLibs() $adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_TOTALVIEWS . ': %s', getTotalViews())); $adminObject->addInfoBox(_AM_NEWBB_REPORT); -$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PENDING . ': %s', $reportHandler->getCount(new Criteria('report_result', 0)))); -$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PROCESSED . ': %s', $reportHandler->getCount(new Criteria('report_result', 1)))); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PENDING . ': %s', $reportHandler->getCount(new \Criteria('report_result', 0)))); +$adminObject->addInfoBoxLine(sprintf(_AM_NEWBB_REPORT_PROCESSED . ': %s', $reportHandler->getCount(new \Criteria('report_result', 1)))); foreach (array_keys($GLOBALS['uploadFolders']) as $i) { Newbb\Utility::prepareFolder($uploadFolders[$i]); diff --git a/admin/menu.php b/admin/menu.php index e709e248..059918c8 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -35,7 +35,7 @@ //require_once __DIR__ . '/../include/common.php'; $helper = Newbb\Helper::getInstance(); -$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); +$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); $adminmenu[] = [ diff --git a/admin/migrate.php b/admin/migrate.php index 785fc057..1f1847e4 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -30,6 +30,7 @@ // ------------------------------------------------------------------------- // use Xmf\Request; +use XoopsModules\Newbb; include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); @@ -51,7 +52,7 @@ EOF; XoopsLoad::load('migrate', 'newbb'); -$newbbMigrate = new NewbbMigrate(); +$newbbMigrate = new Newbb\Migrate(); $op = Request::getCmd('op', 'default'); $opShow = Request::getCmd('show', null, 'POST'); diff --git a/blocks/list_topic.php b/blocks/list_topic.php index a21b10c6..a368ed4e 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -10,6 +10,8 @@ * @package module::newbb */ +use XoopsModules\Newbb; + // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); if (defined('LIST_TOPIC_DEFINED')) { @@ -18,7 +20,7 @@ define('LIST_TOPIC_DEFINED', true); //include_once dirname(__DIR__) . '/include/functions.ini.php'; -require_once dirname(__DIR__) . '/class/topic.renderer.php'; +require_once dirname(__DIR__) . '/class/TopicRenderer.php'; include_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function xoops_loadLanguage('main', 'newbb'); @@ -51,7 +53,7 @@ function newbb_list_topic_show($options) { $newbbConfig = newbbLoadConfig(); // load all newbb configs - $topicRenderer = new NewbbTopicRenderer(); + $topicRenderer = new Newbb\TopicRenderer(); $topicRenderer->userlevel = $GLOBALS['xoopsUserIsAdmin'] ? 2 : is_object($GLOBALS['xoopsUser']); // Vistitor's level: 0 - anonymous; 1 - user; 2 - moderator or admin $topicRenderer->force = true; // force against static vars for parse @@ -100,39 +102,39 @@ function newbb_list_topic_edit($options) { // include_once $GLOBALS['xoops']->path('class/blockform.php'); //reserve for 2.6 xoops_load('XoopsFormLoader'); - // $form = new XoopsBlockForm(); //reserve for 2.6 - $form = new XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC, 'list_topic', ''); + // $form = new \XoopsBlockForm(); //reserve for 2.6 + $form = new \XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC, 'list_topic', ''); - $topicRenderer = new NewbbTopicRenderer(); + $topicRenderer = new Newbb\TopicRenderer(); $topicRenderer->userlevel = 2; // 2 - moderator or admin // status element $optionsStatus = explode(',', $options[0]); - $statusEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA, 'options[0]', $optionsStatus, 5, true); + $statusEle = new \XoopsFormSelect(_MB_NEWBB_CRITERIA, 'options[0]', $optionsStatus, 5, true); $status = $topicRenderer->getStatus($topicRenderer->userlevel); // get all public status + admin status (admin mode, pending deleted) $statusEle->addOptionArray($status); $statusEle->setExtra("onchange = \"validate('options[0][]','select', true)\""); // if user dont select any option it select "all" $statusEle->setDescription(_MB_NEWBB_CRITERIA_DESC); // topic_poster element - $topicPosterRadioEle = new XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); + $topicPosterRadioEle = new \XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); $topicPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); $topicPosterRadioEle->addOption(($options[1] !== -1) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" - $topicPosterSelectEle = new XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; - $topicPosterEle = new XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); + $topicPosterSelectEle = new \XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; + $topicPosterEle = new \XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); // lastposter element - $lastPosterRadioEle = new XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); + $lastPosterRadioEle = new \XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); $lastPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); $lastPosterRadioEle->addOption(($options[2] !== -1) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" - $lastPosterSelectEle = new XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; - $lastPosterEle = new XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); + $lastPosterSelectEle = new \XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; + $lastPosterEle = new \XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); // type element $types = $topicRenderer->getTypes(); // get all available types in all forums - $typeEle = new XoopsFormSelect(_MD_NEWBB_TYPE, 'options[3]', $options[3]); + $typeEle = new \XoopsFormSelect(_MD_NEWBB_TYPE, 'options[3]', $options[3]); $typeEle->addOption(0, _NONE); if (!empty($types)) { foreach ($types as $type_id => $type) { @@ -141,46 +143,46 @@ function newbb_list_topic_edit($options) } // sort element - $sortEle = new XoopsFormSelect(_MD_NEWBB_SORTBY, 'options[4]', $options[4]); + $sortEle = new \XoopsFormSelect(_MD_NEWBB_SORTBY, 'options[4]', $options[4]); $sortEle->setDescription(_MB_NEWBB_CRITERIA_SORT_DESC); $sorts = $topicRenderer->getSort('', 'title'); $sortEle->addOptionArray($sorts); // order element - $orderEle = new XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[5]', $options[5]); + $orderEle = new \XoopsFormSelect(_MB_NEWBB_CRITERIA_ORDER, 'options[5]', $options[5]); $orderEle->addOption(0, _DESCENDING); $orderEle->addOption(1, _ASCENDING); // number of topics to display element - $numdispEle = new XoopsFormText(_MB_NEWBB_DISPLAY, 'options[6]', 10, 255, (int)$options[6]); + $numdispEle = new \XoopsFormText(_MB_NEWBB_DISPLAY, 'options[6]', 10, 255, (int)$options[6]); - $timeEle = new XoopsFormText(_MB_NEWBB_TIME, 'options[7]', 10, 255, $options[7]); + $timeEle = new \XoopsFormText(_MB_NEWBB_TIME, 'options[7]', 10, 255, $options[7]); $timeEle->setDescription(_MB_NEWBB_TIME_DESC); // mode disp element $options_headers = explode(',', $options[8]); - $modeEle = new XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[8][]', $options_headers); + $modeEle = new \XoopsFormCheckBox(_MB_NEWBB_DISPLAYMODE, 'options[8][]', $options_headers); $modeEle->setDescription(_MB_NEWBB_DISPLAYMODE_DESC); $modeEle->columns = 4; $disps = $topicRenderer->getHeader(); $modeEle->addOptionArray($disps); $modeEle->setExtra("onchange = \"validate('options[8][]','checkbox', true)\""); // prevent user select no option // Index navigation element - $navEle = new XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[9]', !empty($options[9])); + $navEle = new \XoopsFormRadioYN(_MB_NEWBB_INDEXNAV, 'options[9]', !empty($options[9])); // Topic title element - $lengthEle = new XoopsFormText(_MB_NEWBB_TITLE_LENGTH, 'options[10]', 10, 255, (int)$options[10]); + $lengthEle = new \XoopsFormText(_MB_NEWBB_TITLE_LENGTH, 'options[10]', 10, 255, (int)$options[10]); $lengthEle->setDescription(_MB_NEWBB_TITLE_LENGTH_DESC); // Post text element - $postExcerptEle = new XoopsFormText(_MB_NEWBB_POST_EXCERPT, 'options[11]', 10, 255, (int)$options[11]); + $postExcerptEle = new \XoopsFormText(_MB_NEWBB_POST_EXCERPT, 'options[11]', 10, 255, (int)$options[11]); $postExcerptEle->setDescription(_MB_NEWBB_POST_EXCERPT_DESC); // forum element $optionsForum = explode(',', $options[12]); include_once __DIR__ . '/../include/functions.forum.php'; - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var Newbb\ForumHandler $forumHandler */ + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums $accessForums = $forumHandler->getIdsByValues(array_map('intval', $optionsForum)); @@ -194,7 +196,7 @@ function newbb_list_topic_edit($options) $forumSel .= '>' . _ALL . ''; $forumSel .= newbbForumSelectBox($accessForums, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = false $forumSel .= ''; - $forumEle = new XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); + $forumEle = new \XoopsFormLabel(_MB_NEWBB_FORUMLIST, $forumSel); // add all elements to form $form->addElement($statusEle); diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index e72167d6..56db1f54 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -30,6 +30,9 @@ // ------------------------------------------------------------------------ // // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); // irmtfan use full path because block maybe used outside newbb + +use XoopsModules\Newbb; + include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); if (defined('NEWBB_BLOCK_DEFINED')) { @@ -83,8 +86,8 @@ function b_newbb_show($options) } if (!isset($accessForums)) { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); if (!$accessForums = $permHandler->getForums()) { return $block; } @@ -159,15 +162,15 @@ function b_newbb_show($options) $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); if (count($types) > 0) { - /** @var \NewbbTypeHandler $typeHandler */ - $typeHandler = xoops_getModuleHandler('type', 'newbb'); - $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); + /** @var Newbb\TypeHandler $typeHandler */ + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); } foreach ($rows as $arr) { // irmtfan add lastposticon - load main lang xoops_loadLanguage('main', 'newbb'); - $topic = []; + $topic = []; $topic_page_jump = newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST); $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . ']'; @@ -211,11 +214,11 @@ function b_newbb_show($options) } // START irmtfan remove hardcoded html in URLs $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; - $block['seo_top_allforums'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; - $block['seo_top_alltopics'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; - $block['seo_top_allposts'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; // END irmtfan remove hardcoded html in URLs $block['indexNav'] = (int)$options[4]; @@ -282,8 +285,8 @@ function b_newbb_topic_show($options) } if (!isset($accessForums)) { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); if (!$accessForums = $permHandler->getForums()) { return $block; } @@ -342,15 +345,15 @@ function b_newbb_topic_show($options) include_once __DIR__ . '/../include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); if (count($types) > 0) { - /** @var \NewbbTypeHandler $typeHandler */ - $typeHandler = xoops_getModuleHandler('type', 'newbb'); - $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); + /** @var Newbb\TypeHandler $typeHandler */ + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); } foreach ($rows as $arr) { // irmtfan remove $topic_page_jump because there is no last post //$topic_page_jump = ''; - $topic = []; + $topic = []; $topic['topic_subject'] = empty($type_list[$arr['type_id']]) ? '' : '[' . $type_list[$arr['type_id']] . '] '; $topic['forum_id'] = $arr['forum_id']; $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); @@ -389,11 +392,11 @@ function b_newbb_topic_show($options) } // START irmtfan remove hardcoded html in URLs $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; - $block['seo_top_allforums'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; - $block['seo_top_alltopics'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; - $block['seo_top_allposts'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; // END irmtfan remove hardcoded html in URLs $block['indexNav'] = (int)$options[4]; @@ -437,15 +440,15 @@ function b_newbb_post_show($options) if (!empty($newbbConfig['allow_require_reply'])) { $extraCriteria .= ' AND p.require_reply = 0'; } - // no break + // no break default: $order = 'p.post_id'; break; } if (!isset($accessForums)) { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); if (!$accessForums = $permHandler->getForums()) { return $block; } @@ -510,7 +513,7 @@ function b_newbb_post_show($options) $last_post_icon = ''; } //$topic['jump_post'] = "" . $last_post_icon . ''; - $topic = []; + $topic = []; $topic['forum_id'] = $arr['forum_id']; $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); //$topic['id'] = $arr['topic_id']; @@ -553,11 +556,11 @@ function b_newbb_post_show($options) } // START irmtfan remove hardcoded html in URLs $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME; - $block['seo_top_allforums'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_allforums'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/list.topic.php'; - $block['seo_top_alltopics'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_alltopics'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; $seo_top_allforums = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewpost.php'; - $block['seo_top_allposts'] = (!empty($newbbConfig['do_rewrite'])) ? seo_urls($seo_top_allforums) : $seo_top_allforums; + $block['seo_top_allposts'] = !empty($newbbConfig['do_rewrite']) ? seo_urls($seo_top_allforums) : $seo_top_allforums; // END irmtfan remove hardcoded html in URLs $block['indexNav'] = (int)$options[4]; @@ -615,8 +618,8 @@ function b_newbb_author_show($options) } if (!isset($accessForums)) { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); if (!$accessForums = $permHandler->getForums()) { return $block; } @@ -961,7 +964,7 @@ function b_newbb_custom($options) return false; } - $tpl = new XoopsTpl(); + $tpl = new \XoopsTpl(); $tpl->assign('block', $block); $tpl->display('db:newbb_block.tpl'); } @@ -986,7 +989,7 @@ function b_newbb_custom_topic($options) return false; } - $tpl = new XoopsTpl(); + $tpl = new \XoopsTpl(); $tpl->assign('block', $block); $tpl->display('db:newbb_block_topic.tpl'); } @@ -1011,7 +1014,7 @@ function b_newbb_custom_post($options) return false; } - $tpl = new XoopsTpl(); + $tpl = new \XoopsTpl(); $tpl->assign('block', $block); $tpl->display('db:newbb_block_post.tpl'); } @@ -1035,7 +1038,7 @@ function b_newbb_custom_author($options) return false; } - $tpl = new XoopsTpl(); + $tpl = new \XoopsTpl(); $tpl->assign('block', $block); $tpl->display('db:newbb_block_author.tpl'); } diff --git a/class/Category.php b/class/Category.php new file mode 100644 index 00000000..8ef83669 --- /dev/null +++ b/class/Category.php @@ -0,0 +1,29 @@ + + * @since 4.00 + * @package module::newbb + */ +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +class Category extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('cat_id', XOBJ_DTYPE_INT); + $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX); + $this->initVar('cat_image', XOBJ_DTYPE_SOURCE, 'blank.gif'); + $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA); + $this->initVar('cat_order', XOBJ_DTYPE_INT, 99); + $this->initVar('cat_url', XOBJ_DTYPE_URL); + } +} diff --git a/class/category.php b/class/CategoryHandler.php similarity index 56% rename from class/category.php rename to class/CategoryHandler.php index 79f96165..c7785099 100644 --- a/class/category.php +++ b/class/CategoryHandler.php @@ -1,4 +1,5 @@ -initVar('cat_id', XOBJ_DTYPE_INT); - $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX); - $this->initVar('cat_image', XOBJ_DTYPE_SOURCE, 'blank.gif'); - $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA); - $this->initVar('cat_order', XOBJ_DTYPE_INT, 99); - $this->initVar('cat_url', XOBJ_DTYPE_URL); - } -} +use XoopsModules\Newbb; + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); /** - * Class NewbbCategoryHandler + * Class CategoryHandler */ -class NewbbCategoryHandler extends XoopsPersistableObjectHandler +class CategoryHandler extends \XoopsPersistableObjectHandler { /** - * @param null|XoopsDatabase $db + * @param null|\XoopsDatabase $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_categories', 'NewbbCategory', 'cat_id', 'cat_title'); + parent::__construct($db, 'newbb_categories', Category::class, 'cat_id', 'cat_title'); } /** @@ -46,8 +33,8 @@ public function __construct(XoopsDatabase $db) */ public function getIdsByPermission($perm = 'access') { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->getCategories($perm); } @@ -63,7 +50,7 @@ public function &getByPermission($permission = 'access', $tags = null, $asObject if (!$valid_ids = $this->getIdsByPermission($permission)) { return $categories; } - $criteria = new Criteria('cat_id', '(' . implode(', ', $valid_ids) . ')', 'IN'); + $criteria = new \Criteria('cat_id', '(' . implode(', ', $valid_ids) . ')', 'IN'); $criteria->setSort('cat_order'); $categories = $this->getAll($criteria, $tags, $asObject); @@ -71,13 +58,13 @@ public function &getByPermission($permission = 'access', $tags = null, $asObject } /** - * @param XoopsObject $category + * @param \XoopsObject $category * @param bool $force * @return mixed */ - public function insert(XoopsObject $category, $force = true) + public function insert(\XoopsObject $category, $force = true) { - $className = 'NewbbCategory'; + $className = 'Category'; if (!($category instanceof $className)) { return false; } @@ -90,20 +77,20 @@ public function insert(XoopsObject $category, $force = true) } /** - * @param XoopsObject $category + * @param \XoopsObject $category * @param bool $force * @return bool|mixed * @internal param Category $category */ - public function delete(XoopsObject $category, $force = false)//delete(Category $category) + public function delete(\XoopsObject $category, $force = false)//delete(Category $category) { - $className = 'NewbbCategory'; + $className = 'Category'; if (!($category instanceof $className)) { return false; } - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $forumHandler->deleteAll(new Criteria('cat_id', $category->getVar('cat_id')), true, true); + /** @var Newbb\ForumHandler $forumHandler */ + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + $forumHandler->deleteAll(new \Criteria('cat_id', $category->getVar('cat_id')), true, true); if ($result = parent::delete($category)) { // Delete group permissions return $this->deletePermission($category); @@ -117,8 +104,8 @@ public function delete(XoopsObject $category, $force = false)//delete(Category $ /** * Check permission for a category * - * @param NewbbCategory|int $category object or id - * @param string $perm permission name + * @param Category|int $category object or id + * @param string $perm permission name * * @return bool */ @@ -129,30 +116,30 @@ public function getPermission($category, $perm = 'access') } $cat_id = is_object($category) ? $category->getVar('cat_id') : (int)$category; - /** @var NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** @var PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->getPermission('category', $perm, $cat_id); } /** - * @param NewbbCategory $category + * @param Category $category * @return mixed */ - public function deletePermission(NewbbCategory $category) + public function deletePermission(Category $category) { - /** @var NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** @var PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->deleteByCategory($category->getVar('cat_id')); } /** - * @param NewbbCategory $category + * @param Category $category * @return mixed */ - public function applyPermissionTemplate(NewbbCategory $category) + public function applyPermissionTemplate(Category $category) { - /** @var NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** @var PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->setCategoryPermission($category->getVar('cat_id')); } diff --git a/class/common/Breadcrumb.php b/class/Common/Breadcrumb.php similarity index 94% rename from class/common/Breadcrumb.php rename to class/Common/Breadcrumb.php index a4bd145d..772dd7fb 100644 --- a/class/common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -1,4 +1,5 @@ path('class/theme.php'); - $GLOBALS['xoTheme'] = new xos_opal_Theme(); + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); } require_once $GLOBALS['xoops']->path('class/template.php'); - $breadcrumbTpl = new XoopsTpl(); + $breadcrumbTpl = new \XoopsTpl(); $breadcrumbTpl->assign('breadcrumb', $this->bread); $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); unset($breadcrumbTpl); diff --git a/class/Configurator.php b/class/Common/Configurator.php similarity index 97% rename from class/Configurator.php rename to class/Common/Configurator.php index b765ca0d..b2082597 100644 --- a/class/Configurator.php +++ b/class/Common/Configurator.php @@ -1,4 +1,5 @@ -oldFiles = $config->oldFiles; $this->oldFolders = $config->oldFolders; $this->modCopyright = $config->modCopyright; - } } diff --git a/class/common/FilesManagement.php b/class/Common/FilesManagement.php similarity index 91% rename from class/common/FilesManagement.php rename to class/Common/FilesManagement.php index 13f13d60..e65606f3 100644 --- a/class/common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -35,7 +35,7 @@ public static function createFolder($folder) file_put_contents($folder . '/index.html', ''); } } - catch (Exception $e) { + catch (\Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
    '; } } @@ -86,18 +86,18 @@ public static function recurseCopy($src, $dst) public static function deleteDirectory($src) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } $success = true; // remove old files - $dirInfo = new SplFileInfo($src); + $dirInfo = new \SplFileInfo($src); // validate is a directory if ($dirInfo->isDir()) { $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); foreach ($fileList as $k => $v) { - $fileInfo = new SplFileInfo("{$src}/{$v}"); + $fileInfo = new \SplFileInfo("{$src}/{$v}"); if ($fileInfo->isDir()) { // recursively handle subdirectories if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { @@ -134,7 +134,7 @@ public static function deleteDirectory($src) public static function rrmdir($src) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } @@ -146,7 +146,7 @@ public static function rrmdir($src) $success = true; // Open the source directory to read in files - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { $filename = $fObj->getPathname(); @@ -174,7 +174,7 @@ public static function rrmdir($src) public static function rmove($src, $dest) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } @@ -189,7 +189,7 @@ public static function rmove($src, $dest) } // Open the source directory to read in files - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); @@ -217,7 +217,7 @@ public static function rmove($src, $dest) public static function rcopy($src, $dest) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } @@ -232,7 +232,7 @@ public static function rcopy($src, $dest) } // Open the source directory to read in files - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); diff --git a/class/common/ServerStats.php b/class/Common/ServerStats.php similarity index 100% rename from class/common/ServerStats.php rename to class/Common/ServerStats.php diff --git a/class/common/VersionChecks.php b/class/Common/VersionChecks.php similarity index 93% rename from class/common/VersionChecks.php rename to class/Common/VersionChecks.php index 204c03e6..35a0e3e6 100644 --- a/class/common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -23,7 +23,7 @@ trait VersionChecks * @static * @param \XoopsModule $module * - * @param null|string $requiredVer + * @param null|string $requiredVer * @return bool true if meets requirements, false if not */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) @@ -39,10 +39,10 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = if (null === $requiredVer) { $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string } - $success = true; + $success = true; - if (version_compare($currentVer, $requiredVer, '<')){ - $success = false; + if (version_compare($currentVer, $requiredVer, '<')) { + $success = false; $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } diff --git a/class/common/index.html b/class/Common/index.html similarity index 100% rename from class/common/index.html rename to class/Common/index.html diff --git a/class/Digest.php b/class/Digest.php new file mode 100644 index 00000000..a00c2ff6 --- /dev/null +++ b/class/Digest.php @@ -0,0 +1,106 @@ + + * @since 4.00 + * @package module::newbb + */ + +class Digest extends \XoopsObject +{ + public $digest_id; + public $digest_time; + public $digest_content; + + public $items; + public $isHtml = false; + public $isSummary = true; + + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('digest_id', XOBJ_DTYPE_INT); + $this->initVar('digest_time', XOBJ_DTYPE_INT); + $this->initVar('digest_content', XOBJ_DTYPE_TXTAREA); + $this->items = []; + } + + public function setHtml() + { + $this->isHtml = true; + } + + public function setSummary() + { + $this->isSummary = true; + } + + /** + * @param $title + * @param $link + * @param $author + * @param string $summary + */ + public function addItem($title, $link, $author, $summary = '') + { + $title = $this->cleanup($title); + $author = $this->cleanup($author); + if (!empty($summary)) { + $summary = $this->cleanup($summary); + } + $this->items[] = ['title' => $title, 'link' => $link, 'author' => $author, 'summary' => $summary]; + } + + /** + * @param $text + * @return mixed|string + */ + public function cleanup($text) + { + global $myts; + + $clean = stripslashes($text); + $clean =& $myts->displayTarea($clean, 1, 0, 1); + $clean = strip_tags($clean); + $clean = htmlspecialchars($clean, ENT_QUOTES); + + return $clean; + } + + /** + * @param bool $isSummary + * @param bool $isHtml + * @return bool + */ + public function buildContent($isSummary = true, $isHtml = false) + { + $digest_count = count($this->items); + $content = ''; + if ($digest_count > 0) { + $linebreak = $isHtml ? '
    ' : "\n"; + for ($i = 0; $i < $digest_count; ++$i) { + if ($isHtml) { + $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . ''; + } else { + $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . $linebreak . $this->items[$i]['link']; + } + + $content .= $linebreak . $this->items[$i]['author']; + if ($isSummary) { + $content .= $linebreak . $this->items[$i]['summary']; + } + $content .= $linebreak . $linebreak; + } + } + $this->setVar('digest_content', $content); + + return true; + } +} diff --git a/class/digest.php b/class/DigestHandler.php similarity index 69% rename from class/digest.php rename to class/DigestHandler.php index 8cc411a1..8286b828 100644 --- a/class/digest.php +++ b/class/DigestHandler.php @@ -1,4 +1,4 @@ -initVar('digest_id', XOBJ_DTYPE_INT); - $this->initVar('digest_time', XOBJ_DTYPE_INT); - $this->initVar('digest_content', XOBJ_DTYPE_TXTAREA); - $this->items = []; - } - - public function setHtml() - { - $this->isHtml = true; - } - - public function setSummary() - { - $this->isSummary = true; - } - - /** - * @param $title - * @param $link - * @param $author - * @param string $summary - */ - public function addItem($title, $link, $author, $summary = '') - { - $title = $this->cleanup($title); - $author = $this->cleanup($author); - if (!empty($summary)) { - $summary = $this->cleanup($summary); - } - $this->items[] = ['title' => $title, 'link' => $link, 'author' => $author, 'summary' => $summary]; - } - - /** - * @param $text - * @return mixed|string - */ - public function cleanup($text) - { - global $myts; - - $clean = stripslashes($text); - $clean =& $myts->displayTarea($clean, 1, 0, 1); - $clean = strip_tags($clean); - $clean = htmlspecialchars($clean, ENT_QUOTES); - - return $clean; - } - - /** - * @param bool $isSummary - * @param bool $isHtml - * @return bool - */ - public function buildContent($isSummary = true, $isHtml = false) - { - $digest_count = count($this->items); - $content = ''; - if ($digest_count > 0) { - $linebreak = $isHtml ? '
    ' : "\n"; - for ($i = 0; $i < $digest_count; ++$i) { - if ($isHtml) { - $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . ''; - } else { - $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . $linebreak . $this->items[$i]['link']; - } - - $content .= $linebreak . $this->items[$i]['author']; - if ($isSummary) { - $content .= $linebreak . $this->items[$i]['summary']; - } - $content .= $linebreak . $linebreak; - } - } - $this->setVar('digest_content', $content); - - return true; - } -} +use XoopsModules\Newbb; /** - * Class NewbbDigestHandler + * Class DigestHandler */ -class NewbbDigestHandler extends XoopsPersistableObjectHandler +class DigestHandler extends \XoopsPersistableObjectHandler { public $last_digest; /** * Constructor * - * @param null|XoopsDatabase $db database connection + * @param null|\XoopsDatabase $db database connection */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_digest', 'Digest', 'digest_id'); + parent::__construct($db, 'newbb_digest', Digest::class, 'digest_id'); } /** @@ -153,10 +60,10 @@ public function process($isForced = false) } /** - * @param XoopsObject $digest + * @param \XoopsObject $digest * @return bool */ - public function notify(XoopsObject $digest) + public function notify(\XoopsObject $digest) { //$content = $digest->getVar('digest_content'); /** @var \XoopsNotificationHandler $notificationHandler */ @@ -182,7 +89,7 @@ public function getAllDigests($start = 0, $perpage = 5) $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_digest') . ' ORDER BY digest_id DESC'; $result = $this->db->query($sql, $perpage, $start); $ret = []; - // $reportHandler = xoops_getModuleHandler('report', 'newbb'); + // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); while ($myrow = $this->db->fetchArray($result)) { $ret[] = $myrow; // return as array } @@ -234,11 +141,11 @@ public function checkStatus() } /** - * @param XoopsObject $digest - * @param bool $force flag to force the query execution despite security settings + * @param \XoopsObject $digest + * @param bool $force flag to force the query execution despite security settings * @return mixed object ID or false */ - public function insert(XoopsObject $digest, $force = true) + public function insert(\XoopsObject $digest, $force = true) { $digest->setVar('digest_time', time()); return parent::insert($digest, $force); @@ -262,11 +169,11 @@ public function insert(XoopsObject $digest, $force = true) } /** - * @param XoopsObject $digest + * @param \XoopsObject $digest * @param bool $force (ignored) * @return bool FALSE if failed. */ - public function delete(XoopsObject $digest, $force = false) + public function delete(\XoopsObject $digest, $force = false) { $digest_id = $digest->getVar('digest_id'); @@ -281,10 +188,10 @@ public function delete(XoopsObject $digest, $force = false) } /** - * @param XoopsObject|\Digest $digest + * @param \XoopsObject $digest * @return bool */ - public function buildDigest(XoopsObject $digest) + public function buildDigest(\XoopsObject $digest) { global $xoopsModule; @@ -292,8 +199,8 @@ public function buildDigest(XoopsObject $digest) define('SUMMARY_LENGTH', 100); } - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var Newbb\ForumHandler $forumHandler */ + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); $thisUser = $GLOBALS['xoopsUser']; $GLOBALS['xoopsUser'] = null; // To get posts accessible by anonymous $GLOBALS['xoopsUser'] = $thisUser; @@ -336,7 +243,7 @@ public function buildDigest(XoopsObject $digest) if (count($uids) > 0) { /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); - $user_criteria = new Criteria('uid', '(' . implode(',', $uids) . ')', 'IN'); + $user_criteria = new \Criteria('uid', '(' . implode(',', $uids) . ')', 'IN'); $users = $memberHandler->getUsers($user_criteria, true); } else { $users = []; diff --git a/class/Forum.php b/class/Forum.php new file mode 100644 index 00000000..b1f2df58 --- /dev/null +++ b/class/Forum.php @@ -0,0 +1,61 @@ + + */ + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +class Forum extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('forum_id', XOBJ_DTYPE_INT); + $this->initVar('forum_name', XOBJ_DTYPE_TXTBOX); + $this->initVar('forum_desc', XOBJ_DTYPE_TXTAREA); + $this->initVar('forum_moderator', XOBJ_DTYPE_ARRAY, serialize([])); + $this->initVar('forum_topics', XOBJ_DTYPE_INT); + $this->initVar('forum_posts', XOBJ_DTYPE_INT); + $this->initVar('forum_last_post_id', XOBJ_DTYPE_INT); + $this->initVar('cat_id', XOBJ_DTYPE_INT); + $this->initVar('parent_forum', XOBJ_DTYPE_INT); + $this->initVar('hot_threshold', XOBJ_DTYPE_INT, 20); + $this->initVar('attach_maxkb', XOBJ_DTYPE_INT, 500); + $this->initVar('attach_ext', XOBJ_DTYPE_SOURCE, 'zip|jpg|gif|png'); + $this->initVar('forum_order', XOBJ_DTYPE_INT, 99); + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); + } + + /** + * @return string + */ + public function dispForumModerators() + { + $ret = ''; + if (!$valid_moderators = $this->getVar('forum_moderator')) { + return $ret; + } + require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.user.php'); + $moderators = newbbGetUnameFromIds($valid_moderators, !empty($GLOBALS['xoopsModuleConfig']['show_realname']), true); + $ret = implode(', ', $moderators); + + return $ret; + } +} diff --git a/class/forum.php b/class/ForumHandler.php similarity index 90% rename from class/forum.php rename to class/ForumHandler.php index ea19310d..ceb33edd 100644 --- a/class/forum.php +++ b/class/ForumHandler.php @@ -1,4 +1,5 @@ - */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +use XoopsModules\Newbb; -class NewbbForum extends XoopsObject -{ - /** - * - */ - public function __construct() - { - parent::__construct(); - $this->initVar('forum_id', XOBJ_DTYPE_INT); - $this->initVar('forum_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('forum_desc', XOBJ_DTYPE_TXTAREA); - $this->initVar('forum_moderator', XOBJ_DTYPE_ARRAY, serialize([])); - $this->initVar('forum_topics', XOBJ_DTYPE_INT); - $this->initVar('forum_posts', XOBJ_DTYPE_INT); - $this->initVar('forum_last_post_id', XOBJ_DTYPE_INT); - $this->initVar('cat_id', XOBJ_DTYPE_INT); - $this->initVar('parent_forum', XOBJ_DTYPE_INT); - $this->initVar('hot_threshold', XOBJ_DTYPE_INT, 20); - $this->initVar('attach_maxkb', XOBJ_DTYPE_INT, 500); - $this->initVar('attach_ext', XOBJ_DTYPE_SOURCE, 'zip|jpg|gif|png'); - $this->initVar('forum_order', XOBJ_DTYPE_INT, 99); - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); - } - - /** - * @return string - */ - public function dispForumModerators() - { - $ret = ''; - if (!$valid_moderators = $this->getVar('forum_moderator')) { - return $ret; - } - require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.user.php'); - $moderators = newbbGetUnameFromIds($valid_moderators, !empty($GLOBALS['xoopsModuleConfig']['show_realname']), true); - $ret = implode(', ', $moderators); - - return $ret; - } -} +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); /** - * Class NewbbForumHandler + * Class ForumHandler */ -class NewbbForumHandler extends XoopsPersistableObjectHandler +class ForumHandler extends \XoopsPersistableObjectHandler { /** - * @param null|XoopsDatabase $db + * @param null|\XoopsDatabase $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_forums', 'NewbbForum', 'forum_id', 'forum_name'); + parent::__construct($db, 'newbb_forums', Forum::class, 'forum_id', 'forum_name'); } /** @@ -79,7 +41,7 @@ public function __construct(XoopsDatabase $db) * @internal param \XoopsObject $forum */ - public function insert(XoopsObject $object, $force = true) //insert($forum) + public function insert(\XoopsObject $object, $force = true) //insert($forum) { $forum = $object; if (!parent::insert($forum, true)) { @@ -94,20 +56,20 @@ public function insert(XoopsObject $object, $force = true) //insert($forum) } /** - * @param XoopsObject $forum + * @param \XoopsObject $forum * @param bool $force * @return bool */ - public function delete(XoopsObject $forum, $force = false) //delete(&$forum) + public function delete(\XoopsObject $forum, $force = false) //delete(&$forum) { global $xoopsModule; // RMV-NOTIFY xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'forum', $forum->getVar('forum_id')); // Get list of all topics in forum, to delete them too - /** @var \NewbbTopicHandler $topicHandler */ - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $topicHandler->deleteAll(new Criteria('forum_id', $forum->getVar('forum_id')), true, true); - $this->updateAll('parent_forum', $forum->getVar('parent_forum'), new Criteria('parent_forum', $forum->getVar('forum_id'))); + /** @var Newbb\TopicHandler $topicHandler */ + $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $topicHandler->deleteAll(new \Criteria('forum_id', $forum->getVar('forum_id')), true, true); + $this->updateAll('parent_forum', $forum->getVar('parent_forum'), new \Criteria('parent_forum', $forum->getVar('forum_id'))); $this->deletePermission($forum); return parent::delete($forum); @@ -119,8 +81,8 @@ public function delete(XoopsObject $forum, $force = false) //delete(&$forum) */ public function getIdsByPermission($perm = 'access') { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->getForums($perm); } @@ -138,11 +100,11 @@ public function &getByPermission($cat = 0, $permission = 'access', $tags = null, return $_cachedForums; } - $criteria = new CriteriaCompo(new Criteria('forum_id', '(' . implode(', ', $valid_ids) . ')', 'IN')); + $criteria = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $valid_ids) . ')', 'IN')); if (is_numeric($cat) && $cat > 0) { - $criteria->add(new Criteria('cat_id', (int)$cat)); + $criteria->add(new \Criteria('cat_id', (int)$cat)); } elseif (is_array($cat) && count($cat) > 0) { - $criteria->add(new Criteria('cat_id', '(' . implode(', ', $cat) . ')', 'IN')); + $criteria->add(new \Criteria('cat_id', '(' . implode(', ', $cat) . ')', 'IN')); } $criteria->setSort('forum_order'); $criteria->setOrder('ASC'); @@ -205,7 +167,6 @@ public function getAllTopics(&$forum, $criteria = null) global $myts, $viewAllForums; $startdate = ''; - require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.session.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.time.php'); @@ -330,8 +291,8 @@ public function getAllTopics(&$forum, $criteria = null) $reads = []; $types = []; - /** @var \NewbbTypeHandler $typeHandler */ - $typeHandler = xoops_getModuleHandler('type', 'newbb'); + /** @var Newbb\TypeHandler $typeHandler */ + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); $typen = $typeHandler->getByForum($forum->getVar('forum_id')); while ($myrow = $this->db->fetchArray($result)) { if ($myrow['topic_sticky']) { @@ -624,8 +585,8 @@ public function getPermission($forum, $type = 'access', $checkCategory = true) } if (!empty($checkCategory)) { - /** @var \NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + /** @var Newbb\CategoryHandler $categoryHandler */ + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); $categoryPerm = $categoryHandler->getPermission($forum->getVar('cat_id')); if (!$categoryPerm) { return false; @@ -639,8 +600,8 @@ public function getPermission($forum, $type = 'access', $checkCategory = true) //$permission = newbbIsModerator($forum); //} else { $forum_id = $forum->getVar('forum_id'); - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); $permission = $permHandler->getPermission('forum', $type, $forum_id); //} // END irmtfan commented and removed @@ -653,8 +614,8 @@ public function getPermission($forum, $type = 'access', $checkCategory = true) */ public function deletePermission(&$forum) { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->deleteByForum($forum->getVar('forum_id')); } @@ -665,8 +626,8 @@ public function deletePermission(&$forum) */ public function applyPermissionTemplate(&$forum) { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); return $permHandler->applyTemplate($forum->getVar('forum_id')); } @@ -711,21 +672,21 @@ public function cleanOrphan($table_link = '', $field_link = '', $field_object = " WHERE (parent_forum NOT IN ( ".$forum_ids."))". " OR parent_forum = forum_id"; */ - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('parent_forum', '(' . implode(', ', $forum_ids) . ')', 'NOT IN'), 'AND'); - $criteria->add(new Criteria('parent_forum', '`forum_id`', '='), 'OR'); + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('parent_forum', '(' . implode(', ', $forum_ids) . ')', 'NOT IN'), 'AND'); + $criteria->add(new \Criteria('parent_forum', '`forum_id`', '='), 'OR'); $b1 = $this->updateAll('parent_forum', 0, $criteria, true); // check cat_id orphan forums - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); $cat_ids = $categoryHandler->getIds(); if (empty($cat_ids)) { return false; } - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('cat_id', '(' . implode(', ', $cat_ids) . ')', 'NOT IN'), 'AND'); + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('cat_id', '(' . implode(', ', $cat_ids) . ')', 'NOT IN'), 'AND'); $b2 = $this->updateAll('cat_id', $cat_ids[0], $criteria, true); - return ($b1 && $b2) ? true : false; + return ($b1 && $b2); } // END irmtfan rewrite forum cleanOrphan function. add parent_forum and cat_id orphan check @@ -849,18 +810,18 @@ public function &display($forums, $length_title_index = 30, $count_subforum = 1) { global $myts; - $posts = []; + $posts = []; $postsObject = []; foreach (array_keys($forums) as $id) { $posts[] = $forums[$id]['forum_last_post_id']; } if (!empty($posts)) { - $postHandler = xoops_getModuleHandler('post', 'newbb'); + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); $tags_post = ['uid', 'topic_id', 'post_time', 'poster_name', 'icon']; if (!empty($length_title_index)) { $tags_post[] = 'subject'; } - $posts = $postHandler->getAll(new Criteria('post_id', '(' . implode(', ', $posts) . ')', 'IN'), $tags_post, false); + $posts = $postHandler->getAll(new \Criteria('post_id', '(' . implode(', ', $posts) . ')', 'IN'), $tags_post, false); } // Get topic/post stats per forum @@ -914,7 +875,7 @@ public function &display($forums, $length_title_index = 30, $count_subforum = 1) $_forum_data['forum_id'] = $id; $_forum_data['forum_cid'] = $forum['cat_id']; $_forum_data['forum_name'] = $forum['forum_name']; - $forumDescLength = $GLOBALS['xoopsModuleConfig']['forum_desc_length']; + $forumDescLength = $GLOBALS['xoopsModuleConfig']['forum_desc_length']; $_forum_data['forum_desc'] = mb_strimwidth($forum['forum_desc'], 0, $forumDescLength, '...'); $_forum_data['forum_topics'] = $forum['forum_topics'] + @$stats_forum[$id]['topics']; $_forum_data['forum_posts'] = $forum['forum_posts'] + @$stats_forum[$id]['posts']; @@ -993,7 +954,7 @@ public function &getTree($cat_id = 0, $pid = 0, $permission = 'access', $prefix } foreach (array_keys($forums_structured) as $cid) { - $tree = new NewbbObjectTree($forums_structured[$cid]); + $tree = new ObjectTree($forums_structured[$cid]); $forum_array[$cid] = $tree->makeTree($prefix, $pid, $tags); unset($tree); } @@ -1029,7 +990,7 @@ public function &getArrayTree($cat_id = 0, $pid = 0, $permission = 'access', $ta $forums_structured[$forumObject->getVar('cat_id')][$key] = $forumsObject[$key]; } foreach (array_keys($forums_structured) as $cid) { - $tree = new NewbbObjectTree($forums_structured[$cid]); + $tree = new ObjectTree($forums_structured[$cid]); $forum_array[$cid] = $tree->makeArrayTree($pid, $tags, $depth); unset($tree); } @@ -1052,7 +1013,7 @@ public function &getParents($object) if (!$parents = newbbGetParentForum($object->getVar('forum_id'))) { return $ret; } - $parents_list = $this->getList(new Criteria('forum_id', '(' . implode(', ', $parents) . ')', 'IN')); + $parents_list = $this->getList(new \Criteria('forum_id', '(' . implode(', ', $parents) . ')', 'IN')); foreach ($parents as $key => $id) { $ret[] = ['forum_id' => $id, 'forum_name' => $parents_list[$id]]; } diff --git a/class/Helper.php b/class/Helper.php index cedfed33..8d40ace7 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -41,7 +41,7 @@ protected function __construct($debug = false) /** * @param bool $debug * - * @return \Helper + * @return \XoopsModules\Newbb\Helper */ public static function getInstance($debug = false) { @@ -53,7 +53,6 @@ public static function getInstance($debug = false) return $instance; } - /** * @param null|string $name * @param null|string $value @@ -63,9 +62,9 @@ public static function getInstance($debug = false) public function setConfig($name = null, $value = null) { if (null === $this->configs) { - $this->initConfig(); + $this->initConfig(); } - $this->configs[$name] = $value; + $this->configs[$name] = $value; $this->addLog("Setting config '{$name}' : " . $this->configs[$name]); return $this->configs[$name]; @@ -78,4 +77,20 @@ public function getDirname() { return $this->dirname; } + + /** + * Get an Object Handler + * + * @param string $name name of handler to load + * + * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler + */ + public function getHandler($name) + { + $ret = false; + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; + $ret = new $class($db); + return $ret; + } } diff --git a/class/icon.php b/class/IconHandler.php similarity index 91% rename from class/icon.php rename to class/IconHandler.php index 35a86dbf..8d47d297 100644 --- a/class/icon.php +++ b/class/IconHandler.php @@ -1,4 +1,5 @@ -path("modules/{$dirname}/templates/{$endDir}/{$type}")); } else { - $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( - is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( - is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH - . "/default/{$rel_dir}/{$type}" : ( - is_dir(XOOPS_THEME_PATH + $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : (is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH + . "/default/{$rel_dir}/{$type}" : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH ) // XOOPS_THEME_PATH {$default} @@ -129,8 +127,8 @@ public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'ima */ public function init(/*$set = "default", */ $language = 'english', - $dirname = 'newbb' - ) { + $dirname = 'newbb') + { $this->forumImage = include $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); $this->forumImage['icon'] = XOOPS_URL . $this->getPath('icon', $dirname) . '/'; diff --git a/class/ipcheck.php b/class/IpCheck.php similarity index 98% rename from class/ipcheck.php rename to class/IpCheck.php index bd92a058..36fca84f 100644 --- a/class/ipcheck.php +++ b/class/IpCheck.php @@ -1,4 +1,4 @@ - * @copyright 2016 XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ -class NewbbMigrate extends Xmf\Database\Migrate +class Migrate extends \Xmf\Database\Migrate { private $renameTables = [ 'bb_archive' => 'newbb_archive', @@ -43,7 +44,7 @@ class NewbbMigrate extends Xmf\Database\Migrate ]; /** - * NewbbMigrate constructor. + * Migrate constructor. */ public function __construct() { diff --git a/class/Moderate.php b/class/Moderate.php new file mode 100644 index 00000000..dd0ec1f8 --- /dev/null +++ b/class/Moderate.php @@ -0,0 +1,41 @@ + + * @since 4.00 + * @package module::newbb + */ + +use Xmf\IPAddress; + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +/** + * A handler for User moderation management + * + * @package newbb + * + * @author D.J. (phppp, http://xoopsforge.com) + * @copyright copyright (c) 2005 XOOPS.org + */ +class Moderate extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('mod_id', XOBJ_DTYPE_INT); + $this->initVar('mod_start', XOBJ_DTYPE_INT); + $this->initVar('mod_end', XOBJ_DTYPE_INT); + $this->initVar('mod_desc', XOBJ_DTYPE_TXTBOX); + $this->initVar('uid', XOBJ_DTYPE_INT); + $this->initVar('ip', XOBJ_DTYPE_TXTBOX); + $this->initVar('forum_id', XOBJ_DTYPE_INT); + } +} diff --git a/class/moderate.php b/class/ModerateHandler.php similarity index 76% rename from class/moderate.php rename to class/ModerateHandler.php index c0d2fbfa..c4278c70 100644 --- a/class/moderate.php +++ b/class/ModerateHandler.php @@ -1,4 +1,5 @@ -initVar('mod_id', XOBJ_DTYPE_INT); - $this->initVar('mod_start', XOBJ_DTYPE_INT); - $this->initVar('mod_end', XOBJ_DTYPE_INT); - $this->initVar('mod_desc', XOBJ_DTYPE_TXTBOX); - $this->initVar('uid', XOBJ_DTYPE_INT); - $this->initVar('ip', XOBJ_DTYPE_TXTBOX); - $this->initVar('forum_id', XOBJ_DTYPE_INT); - } -} - -/** - * Class NewbbModerateHandler + * Class ModerateHandler */ -class NewbbModerateHandler extends XoopsPersistableObjectHandler +class ModerateHandler extends \XoopsPersistableObjectHandler { /** - * @param null|XoopsDatabase $db + * @param null|\XoopsDatabase $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_moderates', 'NewbbModerate', 'mod_id', 'uid'); + parent::__construct($db, 'newbb_moderates', Moderate::class, 'mod_id', 'uid'); } /** @@ -85,13 +60,13 @@ public function verifyUser($uid = -1, $ip = '', $forum = 0) $uid = ($uid < 0) ? (is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0) : (int)$uid; - $criteria = new CriteriaCompo(new Criteria('uid', (int)$uid)); - $forumCriteria = new CriteriaCompo(new Criteria('forum_id', 0), 'OR'); + $criteria = new \CriteriaCompo(new \Criteria('uid', (int)$uid)); + $forumCriteria = new \CriteriaCompo(new \Criteria('forum_id', 0), 'OR'); if (!empty($forum)) { - $forumCriteria->add(new Criteria('forum_id', (int)$forum), 'OR'); + $forumCriteria->add(new \Criteria('forum_id', (int)$forum), 'OR'); } $criteria->add($forumCriteria); - $criteria->add(new Criteria('mod_end', time(), '>')); + $criteria->add(new \Criteria('mod_end', time(), '>')); $matches = $this->getAll($criteria); @@ -129,7 +104,7 @@ public function verifyUser($uid = -1, $ip = '', $forum = 0) * Get latest expiration for a user moderation * * - * @param mix $item user id or ip + * @param mixed $item user id or ip * @param bool $isUid * @return int */ diff --git a/class/tree.php b/class/ObjectTree.php similarity index 92% rename from class/tree.php rename to class/ObjectTree.php index 095225b7..b0195bbc 100644 --- a/class/tree.php +++ b/class/ObjectTree.php @@ -1,4 +1,5 @@ -path('class/tree.php'); -if (!class_exists('NewbbObjectTree')) { +if (!class_exists('ObjectTree')) { /** - * Class NewbbObjectTree + * Class ObjectTree */ - class NewbbObjectTree extends XoopsObjectTree + class ObjectTree extends \XoopsObjectTree { /** * @param $objectArr @@ -46,13 +47,13 @@ public function __construct(&$objectArr, $rootId = null) /** * Make options for a select box from * - * @param int $key ID of the object to display as the root of select options - * @param string $ret (reference to a string when called from outside) Result from previous recursions - * @param string $prefix_orig String to indent items at deeper levels - * @param string $prefix_curr String to indent the current item - * @param null|array $tags + * @param int $key ID of the object to display as the root of select options + * @param string $ret (reference to a string when called from outside) Result from previous recursions + * @param string $prefix_orig String to indent items at deeper levels + * @param string $prefix_curr String to indent the current item + * @param null|array $tags * @internal param string $fieldName Name of the member variable from the - * node objects that should be used as the title for the options. + * node objects that should be used as the title for the options. * @internal param string $selected Value to display as selected * @access private */ @@ -101,7 +102,7 @@ public function &makeTree($prefix = '-', $key = 0, $tags = null) * Make a select box with options from the tree * * @param string $name Name of the select box - * @param string $fieldName Name of the member variable from the + * @param string $fieldName Name of the member variable from the * node objects that should be used as the title for the options. * @param string $prefix String to indent deeper levels * @param string $selected Value to display as selected @@ -119,8 +120,7 @@ public function makeSelBox( $selected = '', $addEmptyOption = false, $key = 0, - $extra = '' - ) //makeSelBox($name, $prefix = '-', $selected = '', $EmptyOption = false, $key = 0) + $extra = '') //makeSelBox($name, $prefix = '-', $selected = '', $EmptyOption = false, $key = 0) { $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},"); @@ -141,7 +141,7 @@ public function makeSelBox( * @param string $key top key of the tree * @param array $ret the tree * @param integer $depth level of subcategories - * @return array + * @return void * @internal param array $tags fields to be used */ public function getAllChildObject($key, &$ret, $depth = 0) @@ -186,8 +186,8 @@ public function &makeObjectTree($key = 0, $depth = 0) * @param array $ret the tree * @param array $tags fields to be used * @param integer $depth level of subcategories - * @return array - **/ + * @return void + */ public function getAllChildArray($key, &$ret, array $tags = [], $depth = 0) { if (0 == --$depth) { diff --git a/class/online.php b/class/OnlineHandler.php similarity index 91% rename from class/online.php rename to class/OnlineHandler.php index 9c336938..3d90d30c 100644 --- a/class/online.php +++ b/class/OnlineHandler.php @@ -1,4 +1,5 @@ -db = $db; } /** - * @param null|\NewbbForum $forum - * @param null|Topic $forumtopic + * @param null|Newbb\Forum $forum + * @param null|Topic $forumtopic */ public function init($forum = null, $forumtopic = null) { if (is_object($forum)) { - $this->forum_id = $forum->getVar('forum_id'); + $this->forum_id = $forum->getVar('forum_id'); $this->forumObject = $forum; } else { - $this->forum_id = (int)$forum; + $this->forum_id = (int)$forum; $this->forumObject = $forum; } if (is_object($forumtopic)) { @@ -76,7 +82,7 @@ public function update() } $xoops_onlineHandler = xoops_getHandler('online'); - $xoopsupdate = $xoops_onlineHandler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), Xmf\IPAddress::fromRequest()->asReadable()); + $xoopsupdate = $xoops_onlineHandler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), \Xmf\IPAddress::fromRequest()->asReadable()); if (!$xoopsupdate) { //xoops_error("newbb online upate error"); } @@ -88,15 +94,15 @@ public function update() /** * @param $xoopsTpl */ - public function render(Smarty $xoopsTpl) + public function render(\Smarty $xoopsTpl) { include_once __DIR__ . '/../include/functions.render.php'; include_once __DIR__ . '/../include/functions.user.php'; $criteria = null; if ($this->topic_id) { - $criteria = new Criteria('online_topic', $this->topic_id); + $criteria = new \Criteria('online_topic', $this->topic_id); } elseif ($this->forum_id) { - $criteria = new Criteria('online_forum', $this->forum_id); + $criteria = new \Criteria('online_forum', $this->forum_id); } $users = $this->getAll($criteria); $num_total = count($users); @@ -153,9 +159,9 @@ public function showOnline() include_once __DIR__ . '/../include/functions.user.php'; $criteria = null; if ($this->topic_id) { - $criteria = new Criteria('online_topic', $this->topic_id); + $criteria = new \Criteria('online_topic', $this->topic_id); } elseif ($this->forum_id) { - $criteria = new Criteria('online_forum', $this->forum_id); + $criteria = new \Criteria('online_forum', $this->forum_id); } $users = $this->getAll($criteria); $num_total = count($users); @@ -241,7 +247,7 @@ public function write($uid, $uname, $time, $forum_id, $ip, $topic_id) return false; } - /** @var XoopsOnlineHandler $xoops_onlineHandler */ + /** @var \XoopsOnlineHandler $xoops_onlineHandler */ $xoops_onlineHandler = xoops_getHandler('online'); $xoopsOnlineTable = $xoops_onlineHandler->table; @@ -287,10 +293,10 @@ public function gc($expire) /** * Get an array of online information * - * @param CriteriaElement $criteria {@link CriteriaElement} + * @param \CriteriaElement $criteria {@link \CriteriaElement} * @return array Array of associative arrays of online information */ - public function getAll(CriteriaElement $criteria = null) + public function getAll(\CriteriaElement $criteria = null) { $ret = []; $limit = $start = 0; @@ -352,10 +358,10 @@ public function checkStatus($uids) /** * Count the number of online users * - * @param CriteriaElement $criteria {@link CriteriaElement} + * @param \CriteriaElement $criteria {@link CriteriaElement} * @return bool */ - public function getCount(CriteriaElement $criteria = null) + public function getCount(\CriteriaElement $criteria = null) { $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online'); if (is_object($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { diff --git a/class/permission.category.php b/class/PermissionCategoryHandler.php similarity index 81% rename from class/permission.category.php rename to class/PermissionCategoryHandler.php index 217b33f8..99fcfb36 100644 --- a/class/permission.category.php +++ b/class/PermissionCategoryHandler.php @@ -1,4 +1,5 @@ -NewbbPermissionHandler($db); + // $this->PermissionHandler($db); parent::__construct($db); } @@ -54,9 +61,9 @@ public function deleteByCategory($cat_id) } /** @var \XoopsGroupPermHandler $gpermHandler */ $gpermHandler = xoops_getHandler('groupperm'); - $criteria = new CriteriaCompo(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'))); - $criteria->add(new Criteria('gperm_name', 'category_access')); - $criteria->add(new Criteria('gperm_itemid', $cat_id)); + $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'))); + $criteria->add(new \Criteria('gperm_name', 'category_access')); + $criteria->add(new \Criteria('gperm_itemid', $cat_id)); return $gpermHandler->deleteAll($criteria); } diff --git a/class/permission.forum.php b/class/PermissionForumHandler.php similarity index 85% rename from class/permission.forum.php rename to class/PermissionForumHandler.php index c8a356d3..b2952b7d 100644 --- a/class/permission.forum.php +++ b/class/PermissionForumHandler.php @@ -1,4 +1,5 @@ -NewbbPermissionHandler($db); + // $this->PermissionHandler($db); parent::__construct($db); $this->templateFilename = XOOPS_VAR_PATH . '/configs/newbb_permission_template.php'; } @@ -76,8 +79,8 @@ public function getValidItems($mid, $id = 0) $ip = \Xmf\IPAddress::fromRequest()->asReadable(); if (!empty($GLOBALS['xoopsModuleConfig']['enable_usermoderate']) && !isset($suspension[$uid][$id]) && !newbbIsAdmin($id)) { - /** @var \NewbbModerateHandler $moderateHandler */ - $moderateHandler = xoops_getModuleHandler('moderate', 'newbb'); + /** @var Newbb\ModerateHandler $moderateHandler */ + $moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); if (!$moderateHandler->verifyUser($uid, '', $id)) { $suspension[$uid][$ip][$id] = 1; } else { @@ -129,19 +132,19 @@ public function getPermissions($id = 0) return false; } // Create criteria for getting only the permissions regarding this module and this user's groups - $criteria = new CriteriaCompo(new Criteria('gperm_modid', $modid)); - $criteria->add(new Criteria('gperm_groupid', '(' . implode(',', $groups) . ')', 'IN')); + $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $modid)); + $criteria->add(new \Criteria('gperm_groupid', '(' . implode(',', $groups) . ')', 'IN')); if ($id) { if (is_array($id)) { - $criteria->add(new Criteria('gperm_itemid', '(' . implode(',', $id) . ')', 'IN')); + $criteria->add(new \Criteria('gperm_itemid', '(' . implode(',', $id) . ')', 'IN')); } else { - $criteria->add(new Criteria('gperm_itemid', (int)$id)); + $criteria->add(new \Criteria('gperm_itemid', (int)$id)); } } $gperm_names = implode(', ', $this->getValidItems($modid, $id)); // Add criteria for gpermnames - $criteria->add(new Criteria('gperm_name', '(' . $gperm_names . ')', 'IN')); + $criteria->add(new \Criteria('gperm_name', '(' . $gperm_names . ')', 'IN')); // Get all permission objects in this module and for this user's groups $userpermissions = $this->getObjects($criteria, true); @@ -157,9 +160,9 @@ public function getPermissions($id = 0) } /** - * @param NewbbForum|int $forum - * @param bool $topic_locked - * @param bool $isAdmin + * @param Forum|int $forum + * @param bool $topic_locked + * @param bool $isAdmin * @return array */ public function getPermissionTable($forum = 0, $topic_locked = false, $isAdmin = false) @@ -202,10 +205,10 @@ public function deleteByForum($forum_id) return false; } $gpermHandler = xoops_getHandler('groupperm'); - $criteria = new CriteriaCompo(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'))); + $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'))); $items = $this->getValidPerms(true); - $criteria->add(new Criteria('gperm_name', "('" . implode("', '", $items) . "')", 'IN')); - $criteria->add(new Criteria('gperm_itemid', $forum_id)); + $criteria->add(new \Criteria('gperm_name', "('" . implode("', '", $items) . "')", 'IN')); + $criteria->add(new \Criteria('gperm_itemid', $forum_id)); return $gpermHandler->deleteAll($criteria); } diff --git a/class/permission.php b/class/PermissionHandler.php similarity index 89% rename from class/permission.php rename to class/PermissionHandler.php index a9ee595a..066acb01 100644 --- a/class/permission.php +++ b/class/PermissionHandler.php @@ -1,4 +1,5 @@ -path('modules/newbb/include/functions.ini.php'); @@ -20,9 +23,9 @@ } /** - * Class NewbbPermissionHandler + * Class PermissionHandler */ -class NewbbPermissionHandler extends XoopsGroupPermHandler +class PermissionHandler extends \XoopsGroupPermHandler { public $_handler; /** @var \Xmf\Module\Helper\Cache */ @@ -31,7 +34,7 @@ class NewbbPermissionHandler extends XoopsGroupPermHandler /** * @param $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { $this->cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); @@ -46,8 +49,8 @@ public function __construct(XoopsDatabase $db) public function loadHandler($name) { if (!isset($this->_handler[$name])) { - require_once __DIR__ . "/permission.{$name}.php"; - $className = 'NewbbPermission' . ucfirst($name) . 'Handler'; +// require_once __DIR__ . "/permission.{$name}.php"; + $className = '\\XoopsModules\\Newbb\\Permission' . ucfirst($name) . 'Handler'; $this->_handler[$name] = new $className($this->db); } @@ -240,16 +243,16 @@ public function createPermData($perm_name = 'forum_all') $groups = array_keys($memberHandler->getGroupList()); $type = ('category_all' === $perm_name) ? 'category' : 'forum'; - $objectHandler = xoops_getModuleHandler($type, 'newbb'); + $objectHandler = Newbb\Helper::getInstance()->getHandler($type); $object_ids = $objectHandler->getIds(); foreach ($object_ids as $item_id) { $perms[$perm_name][$item_id] = $groups; } } else { $gpermHandler = xoops_getHandler('groupperm'); - $criteria = new CriteriaCompo(new Criteria('gperm_modid', $modid)); + $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $modid)); if (!empty($perm_name) && 'forum_all' !== $perm_name && 'category_all' !== $perm_name) { - $criteria->add(new Criteria('gperm_name', $perm_name)); + $criteria->add(new \Criteria('gperm_name', $perm_name)); } $permissions = $this->getObjects($criteria); @@ -324,20 +327,20 @@ public function validateRight($perm, $itemid, $groupid, $mid = null) public function myCheckRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1) { $ret = false; - $criteria = new CriteriaCompo(new Criteria('gperm_modid', $gperm_modid)); - $criteria->add(new Criteria('gperm_name', $gperm_name)); + $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $gperm_modid)); + $criteria->add(new \Criteria('gperm_name', $gperm_name)); $gperm_itemid = (int)$gperm_itemid; if ($gperm_itemid > 0) { - $criteria->add(new Criteria('gperm_itemid', $gperm_itemid)); + $criteria->add(new \Criteria('gperm_itemid', $gperm_itemid)); } if (is_array($gperm_groupid)) { - $criteria2 = new CriteriaCompo(); + $criteria2 = new \CriteriaCompo(); foreach ($gperm_groupid as $gid) { - $criteria2->add(new Criteria('gperm_groupid', $gid), 'OR'); + $criteria2->add(new \Criteria('gperm_groupid', $gid), 'OR'); } $criteria->add($criteria2); } else { - $criteria->add(new Criteria('gperm_groupid', $gperm_groupid)); + $criteria->add(new \Criteria('gperm_groupid', $gperm_groupid)); } if ($this->getCount($criteria) > 0) { $ret = true; @@ -370,10 +373,10 @@ public function deleteRight($perm, $itemid, $groupid, $mid = null) if (is_callable([&$this->XoopsGroupPermHandler, 'deleteRight'])) { return parent::deleteRight($perm, $itemid, $groupid, $mid); } else { - $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm)); - $criteria->add(new Criteria('gperm_groupid', $groupid)); - $criteria->add(new Criteria('gperm_itemid', $itemid)); - $criteria->add(new Criteria('gperm_modid', $mid)); + $criteria = new \CriteriaCompo(new \Criteria('gperm_name', $perm)); + $criteria->add(new \Criteria('gperm_groupid', $groupid)); + $criteria->add(new \Criteria('gperm_itemid', $itemid)); + $criteria->add(new \Criteria('gperm_modid', $mid)); $permsObject = $this->getObjects($criteria); if (!empty($permsObject)) { foreach ($permsObject as $permObject) { diff --git a/class/plugin/index.html b/class/Plugin/index.html similarity index 100% rename from class/plugin/index.html rename to class/Plugin/index.html diff --git a/class/plugin/userlog.php b/class/Plugin/userlog.php similarity index 84% rename from class/plugin/userlog.php rename to class/Plugin/userlog.php index 0e57442a..7fe0687d 100644 --- a/class/plugin/userlog.php +++ b/class/Plugin/userlog.php @@ -1,4 +1,5 @@ -getHandler('Topic'); $post_id = Request::getInt('post_id', 0);// !empty($_REQUEST["post_id"]) ? (int)($_REQUEST["post_id"]) : 0; $move = strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move'])? strtolower($_GET['move']) : ''; $topic_id = Request::getInt('topic_id', 0); // !empty($_REQUEST["topic_id"]) ? (int)($_REQUEST["topic_id"]) : 0; if (!empty($post_id)) { $topicObject = $topicHandler->getByPost($post_id); - $topic_id = $topicObject->getVar('topic_id'); + $topic_id = $topicObject->getVar('topic_id'); } elseif (!empty($move)) { - $forum_id = Request::getInt('forum_id', 0); //!empty($_REQUEST["forum_id"]) ? (int)($_REQUEST["forum_id"]) : 0; + $forum_id = Request::getInt('forum_id', 0); //!empty($_REQUEST["forum_id"]) ? (int)($_REQUEST["forum_id"]) : 0; $topicObject = $topicHandler->getByMove($topic_id, ('prev' === $move) ? -1 : 1, $forum_id); - $topic_id = $topicObject->getVar('topic_id'); + $topic_id = $topicObject->getVar('topic_id'); } return ['item_name' => 'topic_id', 'item_id' => $topic_id]; diff --git a/class/post.php b/class/Post.php similarity index 61% rename from class/post.php rename to class/Post.php index e58bd33c..32df613b 100644 --- a/class/post.php +++ b/class/Post.php @@ -1,4 +1,5 @@ -getVar('uid') : 0; - /** @var NewbbKarmaHandler $karmaHandler */ - $karmaHandler = xoops_getModuleHandler('karma', 'newbb'); + /** @var KarmaHandler $karmaHandler */ + $karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); $user_karma = $karmaHandler->getUserKarma(); $post = []; @@ -400,7 +402,7 @@ public function &getPostBody() } else { $post['text'] = $post_text . '
    ' . $this->displayAttachment(); } - /** @var XoopsMemberHandler $memberHandler */ + /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); $eachposter = $memberHandler->getUser($this->getVar('uid')); if (is_object($eachposter) && $eachposter->isActive()) { @@ -477,8 +479,8 @@ public function showPost($isAdmin) global $order, $start, $total_posts, $topic_status; static $post_NO = 0; static $name_anonymous; - /** @var NewbbTopicHandler $topicHandler */ - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); + /** @var TopicHandler $topicHandler */ + $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); if (!isset($name_anonymous)) { $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); } @@ -563,8 +565,8 @@ public function showPost($isAdmin) } if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) { -// /** @var NewbbTopicHandler $topicHandler */ -// $topicHandler = xoops_getModuleHandler('topic', 'newbb'); + // /** @var TopicHandler $topicHandler */ + // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); $topic_status = $topicObject->getVar('topic_status'); if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) { $edit_ok = ($isAdmin || ($this->checkIdentity() && $this->checkTimelimit('edit_timelimit'))); @@ -710,562 +712,3 @@ public function showPost($isAdmin) return $post; } } - -/** - * Class NewbbPostHandler - */ -class NewbbPostHandler extends XoopsPersistableObjectHandler -{ - /** - * @param XoopsDatabase|null $db - */ - public function __construct(XoopsDatabase $db) - { - parent::__construct($db, 'newbb_posts', 'NewbbPost', 'post_id', 'subject'); - } - - /** - * @param mixed $id - * @param null $var - * @return null|XoopsObject - */ - public function get($id = null, $var = null) //get($id) - { - $id = (int)$id; - $post = null; - $sql = 'SELECT p.*, t.* FROM ' . $this->db->prefix('newbb_posts') . ' p LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' t ON p.post_id=t.post_id WHERE p.post_id=' . $id; - if ($array = $this->db->fetchArray($this->db->query($sql))) { - $post = $this->create(false); - $post->assignVars($array); - } - - return $post; - } - - /** - * @param int $limit - * @param int $start - * @param CriteriaElement $criteria - * @param null $fields - * @param bool $asObject - * @param int $topic_id - * @param int $approved - * @return array - */ - // public function getByLimit($topic_id, $limit, $approved = 1) - public function &getByLimit( - $limit = 0, - $start = 0, - CriteriaElement $criteria = null, - $fields = null, - $asObject = true, - $topic_id = 0, - $approved = 1 - ) { - $sql = 'SELECT p.*, t.*, tp.topic_status FROM ' - . $this->db->prefix('newbb_posts') - . ' p LEFT JOIN ' - . $this->db->prefix('newbb_posts_text') - . ' t ON p.post_id=t.post_id LEFT JOIN ' - . $this->db->prefix('newbb_topics') - . ' tp ON tp.topic_id=p.topic_id WHERE p.topic_id=' - . $topic_id - . ' AND p.approved =' - . $approved - . ' ORDER BY p.post_time DESC'; - $result = $this->db->query($sql, $limit, 0); - $ret = []; - while ($myrow = $this->db->fetchArray($result)) { - $post = $this->create(false); - $post->assignVars($myrow); - - $ret[$myrow['post_id']] = $post; - unset($post); - } - - return $ret; - } - - /** - * @param NewbbPost $post - * @return mixed - */ - public function getPostForPDF(&$post) - { - return $post->getPostBody(true); - } - - /** - * @param NewbbPost $post - * @return mixed - */ - public function getPostForPrint(&$post) - { - return $post->getPostBody(); - } - - /** - * @param NewbbPost $post - * @param bool $force - * @return bool - */ - public function approve(&$post, $force = false) - { - if (empty($post)) { - return false; - } - if (is_numeric($post)) { - $post = $this->get($post); - } - $post_id = $post->getVar('post_id'); - - $wasApproved = $post->getVar('approved'); - // irmtfan approve post if the approved = 0 (pending) or -1 (deleted) - if (empty($force) && $wasApproved > 0) { - return true; - } - $post->setVar('approved', 1); - $this->insert($post, true); - - /** @var \NewbbTopicHandler $topicHandler */ - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $topicObject = $topicHandler->get($post->getVar('topic_id')); - if ($topicObject->getVar('topic_last_post_id') < $post->getVar('post_id')) { - $topicObject->setVar('topic_last_post_id', $post->getVar('post_id')); - } - if ($post->isTopic()) { - $topicObject->setVar('approved', 1); - } else { - $topicObject->setVar('topic_replies', $topicObject->getVar('topic_replies') + 1); - } - $topicHandler->insert($topicObject, true); - - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $forumObject = $forumHandler->get($post->getVar('forum_id')); - if ($forumObject->getVar('forum_last_post_id') < $post->getVar('post_id')) { - $forumObject->setVar('forum_last_post_id', $post->getVar('post_id')); - } - $forumObject->setVar('forum_posts', $forumObject->getVar('forum_posts') + 1); - if ($post->isTopic()) { - $forumObject->setVar('forum_topics', $forumObject->getVar('forum_topics') + 1); - } - $forumHandler->insert($forumObject, true); - - // Update user stats - if ($post->getVar('uid') > 0) { - /** @var XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); - $poster = $memberHandler->getUser($post->getVar('uid')); - if (is_object($poster) && $post->getVar('uid') == $poster->getVar('uid')) { - $poster->setVar('posts', $poster->getVar('posts') + 1); - $res = $memberHandler->insertUser($poster, true); - unset($poster); - } - } - - // Update forum stats - /** @var NewbbStatsHandler $statsHandler */ - $statsHandler = xoops_getModuleHandler('stats', 'newbb'); - $statsHandler->update($post->getVar('forum_id'), 'post'); - if ($post->isTopic()) { - $statsHandler->update($post->getVar('forum_id'), 'topic'); - } - - return true; - } - - /** - * @param XoopsObject $post - * @param bool $force - * @return bool - */ - public function insert(XoopsObject $post, $force = true) //insert(&$post, $force = true) - { - $topicObject = null; - // Set the post time - // The time should be "publish" time. To be adjusted later - if (!$post->getVar('post_time')) { - $post->setVar('post_time', time()); - } - - /** @var \NewbbTopicHandler $topicHandler */ - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - // Verify the topic ID - if ($topic_id = $post->getVar('topic_id')) { - $topicObject = $topicHandler->get($topic_id); - // Invalid topic OR the topic is no approved and the post is not top post - if (!$topicObject// || (!$post->isTopic() && $topicObject->getVar("approved") < 1) - ) { - return false; - } - } - if (empty($topic_id)) { - $post->setVar('topic_id', 0); - $post->setVar('pid', 0); - $post->setNew(); - $topicObject = $topicHandler->create(); - } - $textHandler = xoops_getModuleHandler('text', 'newbb'); - $post_text_vars = ['post_text', 'post_edit', 'dohtml', 'doxcode', 'dosmiley', 'doimage', 'dobr']; - if ($post->isNew()) { - if (!$topic_id = $post->getVar('topic_id')) { - $topicObject->setVar('topic_title', $post->getVar('subject', 'n')); - $topicObject->setVar('topic_poster', $post->getVar('uid')); - $topicObject->setVar('forum_id', $post->getVar('forum_id')); - $topicObject->setVar('topic_time', $post->getVar('post_time')); - $topicObject->setVar('poster_name', $post->getVar('poster_name')); - $topicObject->setVar('approved', $post->getVar('approved')); - - if (!$topic_id = $topicHandler->insert($topicObject, $force)) { - $post->deleteAttachment(); - $post->setErrors('insert topic error'); - - //xoops_error($topicObject->getErrors()); - return false; - } - $post->setVar('topic_id', $topic_id); - - $pid = 0; - $post->setVar('pid', 0); - } elseif (!$post->getVar('pid')) { - $pid = $topicHandler->getTopPostId($topic_id); - $post->setVar('pid', $pid); - } - - $textObject = $textHandler->create(); - foreach ($post_text_vars as $key) { - $textObject->vars[$key] = $post->vars[$key]; - } - $post->destroyVars($post_text_vars); - - // if (!$post_id = parent::insert($post, $force)) { - // return false; - // } - - if (!$post_id = parent::insert($post, $force)) { - return false; - } else { - $post->unsetNew(); - } - - $textObject->setVar('post_id', $post_id); - if (!$textHandler->insert($textObject, $force)) { - $this->delete($post); - $post->setErrors('post text insert error'); - - //xoops_error($textObject->getErrors()); - return false; - } - if ($post->getVar('approved') > 0) { - $this->approve($post, true); - } - $post->setVar('post_id', $post_id); - } else { - if ($post->isTopic()) { - if ($post->getVar('subject') !== $topicObject->getVar('topic_title')) { - $topicObject->setVar('topic_title', $post->getVar('subject', 'n')); - } - if ($post->getVar('approved') !== $topicObject->getVar('approved')) { - $topicObject->setVar('approved', $post->getVar('approved')); - } - $topicObject->setDirty(); - if (!$result = $topicHandler->insert($topicObject, $force)) { - $post->setErrors('update topic error'); - - //xoops_error($topicObject->getErrors()); - return false; - } - } - $textObject = $textHandler->get($post->getVar('post_id')); - $textObject->setDirty(); - foreach ($post_text_vars as $key) { - $textObject->vars[$key] = $post->vars[$key]; - } - $post->destroyVars($post_text_vars); - if (!$post_id = parent::insert($post, $force)) { - //xoops_error($post->getErrors()); - return false; - } else { - $post->unsetNew(); - } - if (!$textHandler->insert($textObject, $force)) { - $post->setErrors('update post text error'); - - //xoops_error($textObject->getErrors()); - return false; - } - } - - return $post->getVar('post_id'); - } - - /** - * @param XoopsObject|NewbbPost $post - * @param bool $isDeleteOne - * @param bool $force - * @return bool - */ - public function delete(XoopsObject $post, $isDeleteOne = true, $force = false) - { - if (!is_object($post) || 0 == $post->getVar('post_id')) { - return false; - } - - if ($isDeleteOne) { - if ($post->isTopic()) { - $criteria = new CriteriaCompo(new Criteria('topic_id', $post->getVar('topic_id'))); - $criteria->add(new Criteria('approved', 1)); - $criteria->add(new Criteria('pid', 0, '>')); - if ($this->getPostCount($criteria) > 0) { - return false; - } - } - - return $this->myDelete($post, $force); - } else { - require_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $mytree = new XoopsTree($this->db->prefix('newbb_posts'), 'post_id', 'pid'); - $arr = $mytree->getAllChild($post->getVar('post_id')); - // irmtfan - delete childs in a reverse order - for ($i = count($arr) - 1; $i >= 0; $i--) { - $childpost = $this->create(false); - $childpost->assignVars($arr[$i]); - $this->myDelete($childpost, $force); - unset($childpost); - } - $this->myDelete($post, $force); - } - - return true; - } - - /** - * @param NewbbPost $post - * @param bool $force - * @return bool - */ - public function myDelete(NewbbPost $post, $force = false) - { - global $xoopsModule; - - if (!is_object($post) || 0 == $post->getVar('post_id')) { - return false; - } - - /* Set active post as deleted */ - if ($post->getVar('approved') > 0 && empty($force)) { - $sql = 'UPDATE ' . $this->db->prefix('newbb_posts') . ' SET approved = -1 WHERE post_id = ' . $post->getVar('post_id'); - if (!$result = $this->db->queryF($sql)) { - } - /* delete pending post directly */ - } else { - $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts'), $post->getVar('post_id')); - if (!$result = $this->db->queryF($sql)) { - $post->setErrors('delete post error: ' . $sql); - - return false; - } - $post->deleteAttachment(); - - $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts_text'), $post->getVar('post_id')); - if (!$result = $this->db->queryF($sql)) { - $post->setErrors('Could not remove post text: ' . $sql); - - return false; - } - } - - if ($post->isTopic()) { - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - /** @var Topic $topicObject */ - $topicObject = $topicHandler->get($post->getVar('topic_id')); - if (is_object($topicObject) && $topicObject->getVar('approved') > 0 && empty($force)) { - $topiccount_toupdate = 1; - $topicObject->setVar('approved', -1); - $topicHandler->insert($topicObject); - xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $post->getVar('topic_id')); - } else { - if (is_object($topicObject)) { - if ($topicObject->getVar('approved') > 0) { - xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $post->getVar('topic_id')); - } - - $poll_id = $topicObject->getVar('poll_id'); - // START irmtfan poll_module - $topicObject->deletePoll($poll_id); - // END irmtfan poll_module - } - - $sql = sprintf('DELETE FROM %s WHERE topic_id = %u', $this->db->prefix('newbb_topics'), $post->getVar('topic_id')); - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); - } - $sql = sprintf('DELETE FROM %s WHERE topic_id = %u', $this->db->prefix('newbb_votedata'), $post->getVar('topic_id')); - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); - } - } - } else { - $sql = 'UPDATE ' . $this->db->prefix('newbb_topics') . ' t - LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.topic_id = t.topic_id - SET t.topic_last_post_id = p.post_id - WHERE t.topic_last_post_id = ' . $post->getVar('post_id') . ' - AND p.post_id = (SELECT MAX(post_id) FROM ' . $this->db->prefix('newbb_posts') . ' WHERE topic_id=t.topic_id)'; - if (!$result = $this->db->queryF($sql)) { - } - } - - $postcount_toupdate = $post->getVar('approved'); - - if ($postcount_toupdate > 0) { - - // Update user stats - if ($post->getVar('uid') > 0) { - /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); - $poster = $memberHandler->getUser($post->getVar('uid')); - if (is_object($poster) && $post->getVar('uid') == $poster->getVar('uid')) { - $poster->setVar('posts', $poster->getVar('posts') - 1); - $res = $memberHandler->insertUser($poster, true); - unset($poster); - } - } - // irmtfan - just update the pid for approved posts when the post is not topic (pid=0) - if (!$post->isTopic()) { - $sql = 'UPDATE ' . $this->db->prefix('newbb_posts') . ' SET pid = ' . $post->getVar('pid') . ' WHERE approved=1 AND pid=' . $post->getVar('post_id'); - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); - } - } - } - - return true; - } - - // START irmtfan enhance getPostCount when there is join (read_mode = 2) - - /** - * @param null $criteria - * @param null $join - * @return int|null - */ - public function getPostCount($criteria = null, $join = null) - { - // if not join get the count from XOOPS/class/model/stats as before - if (empty($join)) { - return parent::getCount($criteria); - } - - $sql = 'SELECT COUNT(*) as count' . ' FROM ' . $this->db->prefix('newbb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' AS t ON t.post_id = p.post_id'; - // LEFT JOIN - $sql .= $join; - // WHERE - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' ' . $criteria->renderWhere(); - } - if (!$result = $this->db->query($sql)) { - //xoops_error($this->db->error().'
    '.$sql); - return null; - } - $myrow = $this->db->fetchArray($result); - $count = $myrow['count']; - - return $count; - } - // END irmtfan enhance getPostCount when there is join (read_mode = 2) - /* - * TODO: combining viewtopic.php - */ - /** - * @param null $criteria - * @param int $limit - * @param int $start - * @param null $join - * @return array - */ - public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join = null) - { - $ret = []; - $sql = 'SELECT p.*, t.* ' . ' FROM ' . $this->db->prefix('newbb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' AS t ON t.post_id = p.post_id'; - if (!empty($join)) { - $sql .= $join; - } - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' ' . $criteria->renderWhere(); - if ('' !== $criteria->getSort()) { - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); - } - } - $result = $this->db->query($sql, (int)$limit, (int)$start); - if (!$result) { - //xoops_error($this->db->error()); - return $ret; - } - while ($myrow = $this->db->fetchArray($result)) { - $post = $this->create(false); - $post->assignVars($myrow); - $ret[$myrow['post_id']] = $post; - unset($post); - } - - return $ret; - } - - /** - * @return bool - */ - public function synchronization() - { - //$this->cleanOrphan(); - return true; - } - - /** - * clean orphan items from database - * - * @param string $table_link - * @param string $field_link - * @param string $field_object - * @return bool true on success - */ - public function cleanOrphan($table_link = '', $field_link = '', $field_object = '') //cleanOrphan() - { - $this->deleteAll(new Criteria('post_time', 0), true, true); - parent::cleanOrphan($this->db->prefix('newbb_topics'), 'topic_id'); - parent::cleanOrphan($this->db->prefix('newbb_posts_text'), 'post_id'); - - $sql = 'DELETE FROM ' . $this->db->prefix('newbb_posts_text') . ' WHERE (post_id NOT IN ( SELECT DISTINCT post_id FROM ' . $this->table . ') )'; - if (!$result = $this->db->queryF($sql)) { - //xoops_error($this->db->error()); - return false; - } - - return true; - } - - /** - * clean expired objects from database - * - * @param int $expire time limit for expiration - * @return bool true on success - */ - public function cleanExpires($expire = 0) - { - // irmtfan if 0 no cleanup look include/plugin.php - if (!func_num_args()) { - $newbbConfig = newbbLoadConfig(); - $expire = isset($newbbConfig['pending_expire']) ? (int)$newbbConfig['pending_expire'] : 7; - $expire = $expire * 24 * 3600; // days to seconds - } - if (empty($expire)) { - return false; - } - $crit_expire = new CriteriaCompo(new Criteria('approved', 0, '<=')); - //if (!empty($expire)) { - $crit_expire->add(new Criteria('post_time', time() - (int)$expire, '<')); - - //} - return $this->deleteAll($crit_expire, true/*, true*/); - } -} diff --git a/class/PostHandler.php b/class/PostHandler.php new file mode 100644 index 00000000..b4e8d273 --- /dev/null +++ b/class/PostHandler.php @@ -0,0 +1,596 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: phppp (D.J., infomax@gmail.com) // +// URL: https://xoops.org // +// Project: Article Project // +// ------------------------------------------------------------------------ // + +use XoopsModules\Newbb; + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); + +/** + * Class PostHandler + */ +class PostHandler extends \XoopsPersistableObjectHandler +{ + /** + * @param \XoopsDatabase $db + */ + public function __construct(\XoopsDatabase $db) + { + parent::__construct($db, 'newbb_posts', Post::class, 'post_id', 'subject'); + } + + /** + * @param mixed $id + * @param null $var + * @return null|\XoopsObject + */ + public function get($id = null, $var = null) //get($id) + { + $id = (int)$id; + $post = null; + $sql = 'SELECT p.*, t.* FROM ' . $this->db->prefix('newbb_posts') . ' p LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' t ON p.post_id=t.post_id WHERE p.post_id=' . $id; + if ($array = $this->db->fetchArray($this->db->query($sql))) { + $post = $this->create(false); + $post->assignVars($array); + } + + return $post; + } + + /** + * @param int $limit + * @param int $start + * @param \CriteriaElement $criteria + * @param null $fields + * @param bool $asObject + * @param int $topic_id + * @param int $approved + * @return array + */ + // public function getByLimit($topic_id, $limit, $approved = 1) + public function &getByLimit( + $limit = 0, + $start = 0, + \CriteriaElement $criteria = null, + $fields = null, + $asObject = true, + $topic_id = 0, + $approved = 1) + { + $sql = 'SELECT p.*, t.*, tp.topic_status FROM ' + . $this->db->prefix('newbb_posts') + . ' p LEFT JOIN ' + . $this->db->prefix('newbb_posts_text') + . ' t ON p.post_id=t.post_id LEFT JOIN ' + . $this->db->prefix('newbb_topics') + . ' tp ON tp.topic_id=p.topic_id WHERE p.topic_id=' + . $topic_id + . ' AND p.approved =' + . $approved + . ' ORDER BY p.post_time DESC'; + $result = $this->db->query($sql, $limit, 0); + $ret = []; + while ($myrow = $this->db->fetchArray($result)) { + $post = $this->create(false); + $post->assignVars($myrow); + + $ret[$myrow['post_id']] = $post; + unset($post); + } + + return $ret; + } + + /** + * @param Post $post + * @return mixed + */ + public function getPostForPDF(&$post) + { + return $post->getPostBody(true); + } + + /** + * @param Post $post + * @return mixed + */ + public function getPostForPrint(&$post) + { + return $post->getPostBody(); + } + + /** + * @param Post $post + * @param bool $force + * @return bool + */ + public function approve(&$post, $force = false) + { + if (empty($post)) { + return false; + } + if (is_numeric($post)) { + $post = $this->get($post); + } + $post_id = $post->getVar('post_id'); + + $wasApproved = $post->getVar('approved'); + // irmtfan approve post if the approved = 0 (pending) or -1 (deleted) + if (empty($force) && $wasApproved > 0) { + return true; + } + $post->setVar('approved', 1); + $this->insert($post, true); + + /** @var Newbb\TopicHandler $topicHandler */ + $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $topicObject = $topicHandler->get($post->getVar('topic_id')); + if ($topicObject->getVar('topic_last_post_id') < $post->getVar('post_id')) { + $topicObject->setVar('topic_last_post_id', $post->getVar('post_id')); + } + if ($post->isTopic()) { + $topicObject->setVar('approved', 1); + } else { + $topicObject->setVar('topic_replies', $topicObject->getVar('topic_replies') + 1); + } + $topicHandler->insert($topicObject, true); + + /** @var Newbb\ForumHandler $forumHandler */ + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + $forumObject = $forumHandler->get($post->getVar('forum_id')); + if ($forumObject->getVar('forum_last_post_id') < $post->getVar('post_id')) { + $forumObject->setVar('forum_last_post_id', $post->getVar('post_id')); + } + $forumObject->setVar('forum_posts', $forumObject->getVar('forum_posts') + 1); + if ($post->isTopic()) { + $forumObject->setVar('forum_topics', $forumObject->getVar('forum_topics') + 1); + } + $forumHandler->insert($forumObject, true); + + // Update user stats + if ($post->getVar('uid') > 0) { + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + $poster = $memberHandler->getUser($post->getVar('uid')); + if (is_object($poster) && $post->getVar('uid') == $poster->getVar('uid')) { + $poster->setVar('posts', $poster->getVar('posts') + 1); + $res = $memberHandler->insertUser($poster, true); + unset($poster); + } + } + + // Update forum stats + /** @var StatsHandler $statsHandler */ + $statsHandler = Newbb\Helper::getInstance()->getHandler('Stats'); + $statsHandler->update($post->getVar('forum_id'), 'post'); + if ($post->isTopic()) { + $statsHandler->update($post->getVar('forum_id'), 'topic'); + } + + return true; + } + + /** + * @param \XoopsObject $post + * @param bool $force + * @return bool + */ + public function insert(\XoopsObject $post, $force = true) //insert(&$post, $force = true) + { + $topicObject = null; + // Set the post time + // The time should be "publish" time. To be adjusted later + if (!$post->getVar('post_time')) { + $post->setVar('post_time', time()); + } + + /** @var Newbb\TopicHandler $topicHandler */ + $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + // Verify the topic ID + if ($topic_id = $post->getVar('topic_id')) { + $topicObject = $topicHandler->get($topic_id); + // Invalid topic OR the topic is no approved and the post is not top post + if (!$topicObject// || (!$post->isTopic() && $topicObject->getVar("approved") < 1) + ) { + return false; + } + } + if (empty($topic_id)) { + $post->setVar('topic_id', 0); + $post->setVar('pid', 0); + $post->setNew(); + $topicObject = $topicHandler->create(); + } + $textHandler = Newbb\Helper::getInstance()->getHandler('Text'); + $post_text_vars = ['post_text', 'post_edit', 'dohtml', 'doxcode', 'dosmiley', 'doimage', 'dobr']; + if ($post->isNew()) { + if (!$topic_id = $post->getVar('topic_id')) { + $topicObject->setVar('topic_title', $post->getVar('subject', 'n')); + $topicObject->setVar('topic_poster', $post->getVar('uid')); + $topicObject->setVar('forum_id', $post->getVar('forum_id')); + $topicObject->setVar('topic_time', $post->getVar('post_time')); + $topicObject->setVar('poster_name', $post->getVar('poster_name')); + $topicObject->setVar('approved', $post->getVar('approved')); + + if (!$topic_id = $topicHandler->insert($topicObject, $force)) { + $post->deleteAttachment(); + $post->setErrors('insert topic error'); + + //xoops_error($topicObject->getErrors()); + return false; + } + $post->setVar('topic_id', $topic_id); + + $pid = 0; + $post->setVar('pid', 0); + } elseif (!$post->getVar('pid')) { + $pid = $topicHandler->getTopPostId($topic_id); + $post->setVar('pid', $pid); + } + + $textObject = $textHandler->create(); + foreach ($post_text_vars as $key) { + $textObject->vars[$key] = $post->vars[$key]; + } + $post->destroyVars($post_text_vars); + + // if (!$post_id = parent::insert($post, $force)) { + // return false; + // } + + if (!$post_id = parent::insert($post, $force)) { + return false; + } else { + $post->unsetNew(); + } + + $textObject->setVar('post_id', $post_id); + if (!$textHandler->insert($textObject, $force)) { + $this->delete($post); + $post->setErrors('post text insert error'); + + //xoops_error($textObject->getErrors()); + return false; + } + if ($post->getVar('approved') > 0) { + $this->approve($post, true); + } + $post->setVar('post_id', $post_id); + } else { + if ($post->isTopic()) { + if ($post->getVar('subject') !== $topicObject->getVar('topic_title')) { + $topicObject->setVar('topic_title', $post->getVar('subject', 'n')); + } + if ($post->getVar('approved') !== $topicObject->getVar('approved')) { + $topicObject->setVar('approved', $post->getVar('approved')); + } + $topicObject->setDirty(); + if (!$result = $topicHandler->insert($topicObject, $force)) { + $post->setErrors('update topic error'); + + //xoops_error($topicObject->getErrors()); + return false; + } + } + $textObject = $textHandler->get($post->getVar('post_id')); + $textObject->setDirty(); + foreach ($post_text_vars as $key) { + $textObject->vars[$key] = $post->vars[$key]; + } + $post->destroyVars($post_text_vars); + if (!$post_id = parent::insert($post, $force)) { + //xoops_error($post->getErrors()); + return false; + } else { + $post->unsetNew(); + } + if (!$textHandler->insert($textObject, $force)) { + $post->setErrors('update post text error'); + + //xoops_error($textObject->getErrors()); + return false; + } + } + + return $post->getVar('post_id'); + } + + /** + * @param \XoopsObject $post + * @param bool $isDeleteOne + * @param bool $force + * @return bool + */ + public function delete(\XoopsObject $post, $isDeleteOne = true, $force = false) + { + if (!is_object($post) || 0 == $post->getVar('post_id')) { + return false; + } + + if ($isDeleteOne) { + if ($post->isTopic()) { + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $post->getVar('topic_id'))); + $criteria->add(new \Criteria('approved', 1)); + $criteria->add(new \Criteria('pid', 0, '>')); + if ($this->getPostCount($criteria) > 0) { + return false; + } + } + + return $this->myDelete($post, $force); + } else { + require_once $GLOBALS['xoops']->path('class/xoopstree.php'); + $mytree = new \XoopsTree($this->db->prefix('newbb_posts'), 'post_id', 'pid'); + $arr = $mytree->getAllChild($post->getVar('post_id')); + // irmtfan - delete childs in a reverse order + for ($i = count($arr) - 1; $i >= 0; $i--) { + $childpost = $this->create(false); + $childpost->assignVars($arr[$i]); + $this->myDelete($childpost, $force); + unset($childpost); + } + $this->myDelete($post, $force); + } + + return true; + } + + /** + * @param Post $post + * @param bool $force + * @return bool + */ + public function myDelete(Post $post, $force = false) + { + global $xoopsModule; + + if (!is_object($post) || 0 == $post->getVar('post_id')) { + return false; + } + + /* Set active post as deleted */ + if ($post->getVar('approved') > 0 && empty($force)) { + $sql = 'UPDATE ' . $this->db->prefix('newbb_posts') . ' SET approved = -1 WHERE post_id = ' . $post->getVar('post_id'); + if (!$result = $this->db->queryF($sql)) { + } + /* delete pending post directly */ + } else { + $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts'), $post->getVar('post_id')); + if (!$result = $this->db->queryF($sql)) { + $post->setErrors('delete post error: ' . $sql); + + return false; + } + $post->deleteAttachment(); + + $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts_text'), $post->getVar('post_id')); + if (!$result = $this->db->queryF($sql)) { + $post->setErrors('Could not remove post text: ' . $sql); + + return false; + } + } + + if ($post->isTopic()) { + $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + /** @var Topic $topicObject */ + $topicObject = $topicHandler->get($post->getVar('topic_id')); + if (is_object($topicObject) && $topicObject->getVar('approved') > 0 && empty($force)) { + $topiccount_toupdate = 1; + $topicObject->setVar('approved', -1); + $topicHandler->insert($topicObject); + xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $post->getVar('topic_id')); + } else { + if (is_object($topicObject)) { + if ($topicObject->getVar('approved') > 0) { + xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $post->getVar('topic_id')); + } + + $poll_id = $topicObject->getVar('poll_id'); + // START irmtfan poll_module + $topicObject->deletePoll($poll_id); + // END irmtfan poll_module + } + + $sql = sprintf('DELETE FROM %s WHERE topic_id = %u', $this->db->prefix('newbb_topics'), $post->getVar('topic_id')); + if (!$result = $this->db->queryF($sql)) { + //xoops_error($this->db->error()); + } + $sql = sprintf('DELETE FROM %s WHERE topic_id = %u', $this->db->prefix('newbb_votedata'), $post->getVar('topic_id')); + if (!$result = $this->db->queryF($sql)) { + //xoops_error($this->db->error()); + } + } + } else { + $sql = 'UPDATE ' . $this->db->prefix('newbb_topics') . ' t + LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.topic_id = t.topic_id + SET t.topic_last_post_id = p.post_id + WHERE t.topic_last_post_id = ' . $post->getVar('post_id') . ' + AND p.post_id = (SELECT MAX(post_id) FROM ' . $this->db->prefix('newbb_posts') . ' WHERE topic_id=t.topic_id)'; + if (!$result = $this->db->queryF($sql)) { + } + } + + $postcount_toupdate = $post->getVar('approved'); + + if ($postcount_toupdate > 0) { + + // Update user stats + if ($post->getVar('uid') > 0) { + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + $poster = $memberHandler->getUser($post->getVar('uid')); + if (is_object($poster) && $post->getVar('uid') == $poster->getVar('uid')) { + $poster->setVar('posts', $poster->getVar('posts') - 1); + $res = $memberHandler->insertUser($poster, true); + unset($poster); + } + } + // irmtfan - just update the pid for approved posts when the post is not topic (pid=0) + if (!$post->isTopic()) { + $sql = 'UPDATE ' . $this->db->prefix('newbb_posts') . ' SET pid = ' . $post->getVar('pid') . ' WHERE approved=1 AND pid=' . $post->getVar('post_id'); + if (!$result = $this->db->queryF($sql)) { + //xoops_error($this->db->error()); + } + } + } + + return true; + } + + // START irmtfan enhance getPostCount when there is join (read_mode = 2) + + /** + * @param null $criteria + * @param null $join + * @return int|null + */ + public function getPostCount($criteria = null, $join = null) + { + // if not join get the count from XOOPS/class/model/stats as before + if (empty($join)) { + return parent::getCount($criteria); + } + + $sql = 'SELECT COUNT(*) as count' . ' FROM ' . $this->db->prefix('newbb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' AS t ON t.post_id = p.post_id'; + // LEFT JOIN + $sql .= $join; + // WHERE + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + $sql .= ' ' . $criteria->renderWhere(); + } + if (!$result = $this->db->query($sql)) { + //xoops_error($this->db->error().'
    '.$sql); + return null; + } + $myrow = $this->db->fetchArray($result); + $count = $myrow['count']; + + return $count; + } + // END irmtfan enhance getPostCount when there is join (read_mode = 2) + /* + * TODO: combining viewtopic.php + */ + /** + * @param null $criteria + * @param int $limit + * @param int $start + * @param null $join + * @return array + */ + public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join = null) + { + $ret = []; + $sql = 'SELECT p.*, t.* ' . ' FROM ' . $this->db->prefix('newbb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' AS t ON t.post_id = p.post_id'; + if (!empty($join)) { + $sql .= $join; + } + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + $sql .= ' ' . $criteria->renderWhere(); + if ('' !== $criteria->getSort()) { + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); + } + } + $result = $this->db->query($sql, (int)$limit, (int)$start); + if (!$result) { + //xoops_error($this->db->error()); + return $ret; + } + while ($myrow = $this->db->fetchArray($result)) { + $post = $this->create(false); + $post->assignVars($myrow); + $ret[$myrow['post_id']] = $post; + unset($post); + } + + return $ret; + } + + /** + * @return bool + */ + public function synchronization() + { + //$this->cleanOrphan(); + return true; + } + + /** + * clean orphan items from database + * + * @param string $table_link + * @param string $field_link + * @param string $field_object + * @return bool true on success + */ + public function cleanOrphan($table_link = '', $field_link = '', $field_object = '') //cleanOrphan() + { + $this->deleteAll(new \Criteria('post_time', 0), true, true); + parent::cleanOrphan($this->db->prefix('newbb_topics'), 'topic_id'); + parent::cleanOrphan($this->db->prefix('newbb_posts_text'), 'post_id'); + + $sql = 'DELETE FROM ' . $this->db->prefix('newbb_posts_text') . ' WHERE (post_id NOT IN ( SELECT DISTINCT post_id FROM ' . $this->table . ') )'; + if (!$result = $this->db->queryF($sql)) { + //xoops_error($this->db->error()); + return false; + } + + return true; + } + + /** + * clean expired objects from database + * + * @param int $expire time limit for expiration + * @return bool true on success + */ + public function cleanExpires($expire = 0) + { + // irmtfan if 0 no cleanup look include/plugin.php + if (!func_num_args()) { + $newbbConfig = newbbLoadConfig(); + $expire = isset($newbbConfig['pending_expire']) ? (int)$newbbConfig['pending_expire'] : 7; + $expire = $expire * 24 * 3600; // days to seconds + } + if (empty($expire)) { + return false; + } + $crit_expire = new \CriteriaCompo(new \Criteria('approved', 0, '<=')); + //if (!empty($expire)) { + $crit_expire->add(new \Criteria('post_time', time() - (int)$expire, '<')); + + //} + return $this->deleteAll($crit_expire, true/*, true*/); + } +} diff --git a/class/Rate.php b/class/Rate.php new file mode 100644 index 00000000..d39bf04e --- /dev/null +++ b/class/Rate.php @@ -0,0 +1,55 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: phppp (D.J., infomax@gmail.com) // +// URL: https://xoops.org // +// Project: Article Project // +// ------------------------------------------------------------------------ // + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); + +/** + * Class Rate + */ +class Rate extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('ratingid', XOBJ_DTYPE_INT); + $this->initVar('topic_id', XOBJ_DTYPE_INT); + $this->initVar('ratinguser', XOBJ_DTYPE_INT); + $this->initVar('rating', XOBJ_DTYPE_INT); + $this->initVar('ratingtimestamp', XOBJ_DTYPE_INT); + $this->initVar('ratinghostname', XOBJ_DTYPE_TXTBOX); + } +} diff --git a/class/rate.php b/class/RateHandler.php similarity index 79% rename from class/rate.php rename to class/RateHandler.php index 9a7c1f21..0f4f1acb 100644 --- a/class/rate.php +++ b/class/RateHandler.php @@ -1,4 +1,5 @@ -path('modules/newbb/include/functions.ini.php'); /** - * Class Nrate - */ -class Nrate extends XoopsObject -{ - /** - * - */ - public function __construct() - { - parent::__construct(); - $this->initVar('ratingid', XOBJ_DTYPE_INT); - $this->initVar('topic_id', XOBJ_DTYPE_INT); - $this->initVar('ratinguser', XOBJ_DTYPE_INT); - $this->initVar('rating', XOBJ_DTYPE_INT); - $this->initVar('ratingtimestamp', XOBJ_DTYPE_INT); - $this->initVar('ratinghostname', XOBJ_DTYPE_TXTBOX); - } -} - -/** - * Class NewbbRateHandler + * Class RateHandler */ -class NewbbRateHandler extends XoopsPersistableObjectHandler +class RateHandler extends \XoopsPersistableObjectHandler { /** - * @param XoopsDatabase|null $db + * @param \XoopsDatabase $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_votedata', 'Nrate', 'ratingid', ''); + parent::__construct($db, 'newbb_votedata', Rate::class, 'ratingid', ''); } /** diff --git a/class/Read.php b/class/Read.php new file mode 100644 index 00000000..0c8d0ed8 --- /dev/null +++ b/class/Read.php @@ -0,0 +1,60 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: phppp (D.J., infomax@gmail.com) // +// URL: https://xoops.org // +// Project: Article Project // +// ------------------------------------------------------------------------ // + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); + +/** + * A handler for read/unread handling + * + * @package newbb + * + * @author D.J. (phppp, http://xoopsforge.com) + * @copyright copyright (c) 2005 XOOPS.org + */ +class Read extends \XoopsObject +{ + /** + * @internal param $type + */ + public function __construct() + { + // parent::__construct("newbb_reads_" . $type); + parent::__construct(); + $this->initVar('read_id', XOBJ_DTYPE_INT); + $this->initVar('uid', XOBJ_DTYPE_INT); + $this->initVar('read_item', XOBJ_DTYPE_INT); + $this->initVar('post_id', XOBJ_DTYPE_INT); + $this->initVar('read_time', XOBJ_DTYPE_INT); + } +} diff --git a/class/ReadForum.php b/class/ReadForum.php new file mode 100644 index 00000000..851c54ca --- /dev/null +++ b/class/ReadForum.php @@ -0,0 +1,51 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: phppp (D.J., infomax@gmail.com) // +// URL: https://xoops.org // +// Project: Article Project // +// ------------------------------------------------------------------------ // +include_once __DIR__ . '/read.php'; + +/** + * A handler for read/unread handling + * + * @package newbb + * + * @author D.J. (phppp, http://xoopsforge.com) + * @copyright copyright (c) 2005 XOOPS.org + */ +class ReadForum extends Read +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + } +} diff --git a/class/readforum.php b/class/ReadForumHandler.php similarity index 87% rename from class/readforum.php rename to class/ReadForumHandler.php index 0aeaac52..9d03a4f8 100644 --- a/class/readforum.php +++ b/class/ReadForumHandler.php @@ -1,4 +1,5 @@ -getHandler('Forum'); $items_id = $itemHandler->getIds(); foreach ($items_id as $key) { $items[$key] = time(); @@ -133,14 +126,14 @@ public function setReadItemsDb($status, $uid) } } if (empty($status)) { - $this->deleteAll(new Criteria('uid', $uid)); + $this->deleteAll(new \Criteria('uid', $uid)); return true; } - /** @var \NewbbForumHandler $itemHandler */ - $itemHandler = xoops_getModuleHandler('forum', 'newbb'); - $itemsObject = $itemHandler->getAll(null, ['forum_last_post_id']); + /** @var Newbb\ForumHandler $itemHandler */ + $itemHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + $itemsObject = $itemHandler->getAll(null, ['forum_last_post_id']); foreach (array_keys($itemsObject) as $key) { $this->setReadDb($key, $itemsObject[$key]->getVar('forum_last_post_id'), $uid); } diff --git a/class/read.php b/class/ReadHandler.php similarity index 92% rename from class/read.php rename to class/ReadHandler.php index f763e1c5..fb7fb42e 100644 --- a/class/read.php +++ b/class/ReadHandler.php @@ -1,4 +1,5 @@ -initVar('read_id', XOBJ_DTYPE_INT); - $this->initVar('uid', XOBJ_DTYPE_INT); - $this->initVar('read_item', XOBJ_DTYPE_INT); - $this->initVar('post_id', XOBJ_DTYPE_INT); - $this->initVar('read_time', XOBJ_DTYPE_INT); - } -} /** - * Class NewbbReadHandler + * Class ReadHandler */ -class NewbbReadHandler extends XoopsPersistableObjectHandler +class ReadHandler extends \XoopsPersistableObjectHandler { /** * Object type. @@ -101,13 +86,13 @@ class NewbbReadHandler extends XoopsPersistableObjectHandler public $mode; /** - * @param XoopsDatabase|null $db + * @param \XoopsDatabase $db * @param $type */ - public function __construct(XoopsDatabase $db, $type) + public function __construct(\XoopsDatabase $db, $type) { $type = ('forum' === $type) ? 'forum' : 'topic'; - parent::__construct($db, 'newbb_reads_' . $type, 'Read' . $type, 'read_id', 'post_id'); + parent::__construct($db, 'newbb_reads_' . $type, Read::class . $type, 'read_id', 'post_id'); $this->type = $type; $newbbConfig = newbbLoadConfig(); // irmtfan if read_expire = 0 dont clean @@ -321,8 +306,8 @@ public function isReadItemsDb(&$items, $uid) } } - $criteria = new CriteriaCompo(new Criteria('uid', $uid)); - $criteria->add(new Criteria('read_item', '(' . implode(', ', array_map('intval', array_keys($items))) . ')', 'IN')); + $criteria = new \CriteriaCompo(new \Criteria('uid', $uid)); + $criteria->add(new \Criteria('read_item', '(' . implode(', ', array_map('intval', array_keys($items))) . ')', 'IN')); $itemsObject = $this->getAll($criteria, ['read_item', 'post_id']); $items_list = []; diff --git a/class/Readtopic.php b/class/Readtopic.php new file mode 100644 index 00000000..faa14f23 --- /dev/null +++ b/class/Readtopic.php @@ -0,0 +1,52 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: phppp (D.J., infomax@gmail.com) // +// URL: https://xoops.org // +// Project: Article Project // +// ------------------------------------------------------------------------ // +include_once __DIR__ . '/read.php'; + +/** + * A handler for read/unread handling + * + * @package newbb + * + * @author D.J. (phppp, http://xoopsforge.com) + * @copyright copyright (c) 2005 XOOPS.org + */ +class Readtopic extends Read +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + //$this->initVar('forum_id', XOBJ_DTYPE_INT); + } +} diff --git a/class/readtopic.php b/class/ReadtopicHandler.php similarity index 85% rename from class/readtopic.php rename to class/ReadtopicHandler.php index 223e1823..0f497508 100644 --- a/class/readtopic.php +++ b/class/ReadtopicHandler.php @@ -1,4 +1,5 @@ -initVar('forum_id', XOBJ_DTYPE_INT); - } -} /** - * Class NewbbReadtopicHandler + * Class ReadtopicHandler */ -class NewbbReadtopicHandler extends NewbbReadHandler +class ReadtopicHandler extends ReadHandler { /** * maximum records per forum for one user. @@ -64,9 +57,9 @@ class NewbbReadtopicHandler extends NewbbReadHandler public $items_per_forum; /** - * @param XoopsDatabase|null $db + * @param \XoopsDatabase|null $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { parent::__construct($db, 'topic'); $newbbConfig = newbbLoadConfig(); @@ -130,9 +123,9 @@ public function setReadItemsCookie($status, $forum_id) $cookie_name = 'LT'; $cookie_vars = newbbGetCookie($cookie_name, true); - /** @var \NewbbTopicHandler $itemHandler */ - $itemHandler = xoops_getModuleHandler('topic', 'newbb'); - $criteria = new CriteriaCompo(new Criteria('forum_id', $forum_id)); + /** @var Newbb\TopicHandler $itemHandler */ + $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $criteria = new \CriteriaCompo(new \Criteria('forum_id', $forum_id)); $criteria->setSort('topic_last_post_id'); $criteria->setOrder('DESC'); $criteria->setLimit($this->items_per_forum); @@ -169,21 +162,21 @@ public function setReadItemsDb($status, $forum_id, $uid) } } - /** @var \NewbbTopicHandler $itemHandler */ - $itemHandler = xoops_getModuleHandler('topic', 'newbb'); - $criteria_topic = new CriteriaCompo(new Criteria('forum_id', $forum_id)); + /** @var Newbb\TopicHandler $itemHandler */ + $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $criteria_topic = new \CriteriaCompo(new \Criteria('forum_id', $forum_id)); $criteria_topic->setSort('topic_last_post_id'); $criteria_topic->setOrder('DESC'); $criteria_topic->setLimit($this->items_per_forum); - $criteria_sticky = new CriteriaCompo(new Criteria('forum_id', $forum_id)); - $criteria_sticky->add(new Criteria('topic_sticky', 1)); + $criteria_sticky = new \CriteriaCompo(new \Criteria('forum_id', $forum_id)); + $criteria_sticky->add(new \Criteria('topic_sticky', 1)); if (empty($status)) { $items_id = $itemHandler->getIds($criteria_topic); $sticky_id = $itemHandler->getIds($criteria_sticky); $items = $items_id + $sticky_id; - $criteria = new CriteriaCompo(new Criteria('uid', $uid)); - $criteria->add(new Criteria('read_item', '(' . implode(', ', $items) . ')', 'IN')); + $criteria = new \CriteriaCompo(new \Criteria('uid', $uid)); + $criteria->add(new \Criteria('read_item', '(' . implode(', ', $items) . ')', 'IN')); $this->deleteAll($criteria, true); return true; @@ -192,7 +185,7 @@ public function setReadItemsDb($status, $forum_id, $uid) $itemsObject = $itemHandler->getAll($criteria_topic, ['topic_last_post_id']); $stickyObject = $itemHandler->getAll($criteria_sticky, ['topic_last_post_id']); $itemsObject += $stickyObject; - $items = []; + $items = []; foreach (array_keys($itemsObject) as $key) { $items[$key] = $itemsObject[$key]->getVar('topic_last_post_id'); } diff --git a/class/Report.php b/class/Report.php new file mode 100644 index 00000000..944fc496 --- /dev/null +++ b/class/Report.php @@ -0,0 +1,37 @@ + + * @since 4.00 + * @package module::newbb + */ + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); + +/** + * Class Report + */ +class Report extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('report_id', XOBJ_DTYPE_INT); + $this->initVar('post_id', XOBJ_DTYPE_INT); + $this->initVar('reporter_uid', XOBJ_DTYPE_INT); + $this->initVar('reporter_ip', XOBJ_DTYPE_TXTBOX); + $this->initVar('report_time', XOBJ_DTYPE_INT); + $this->initVar('report_text', XOBJ_DTYPE_TXTBOX); + $this->initVar('report_result', XOBJ_DTYPE_INT); + $this->initVar('report_memo', XOBJ_DTYPE_TXTBOX); + } +} diff --git a/class/report.php b/class/ReportHandler.php similarity index 76% rename from class/report.php rename to class/ReportHandler.php index 247b2558..4c672bb4 100644 --- a/class/report.php +++ b/class/ReportHandler.php @@ -1,4 +1,5 @@ -path('modules/newbb/include/functions.ini.php'); /** - * Class NewbbReport - */ -class NewbbReport extends XoopsObject -{ - /** - * - */ - public function __construct() - { - parent::__construct(); - $this->initVar('report_id', XOBJ_DTYPE_INT); - $this->initVar('post_id', XOBJ_DTYPE_INT); - $this->initVar('reporter_uid', XOBJ_DTYPE_INT); - $this->initVar('reporter_ip', XOBJ_DTYPE_TXTBOX); - $this->initVar('report_time', XOBJ_DTYPE_INT); - $this->initVar('report_text', XOBJ_DTYPE_TXTBOX); - $this->initVar('report_result', XOBJ_DTYPE_INT); - $this->initVar('report_memo', XOBJ_DTYPE_TXTBOX); - } -} - -/** - * Class NewbbReportHandler + * Class ReportHandler */ -class NewbbReportHandler extends XoopsPersistableObjectHandler +class ReportHandler extends \XoopsPersistableObjectHandler { /** - * @param XoopsDatabase|null $db + * @param \XoopsDatabase $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_report', 'NewbbReport', 'report_id', ''); + parent::__construct($db, 'newbb_report', Report::class, 'report_id', ''); } /** @@ -61,7 +40,7 @@ public function getByPost($posts) if (!is_array($posts)) { $posts = [$posts]; } - $post_criteria = new Criteria('post_id', '(' . implode(', ', $posts) . ')', 'IN'); + $post_criteria = new \Criteria('post_id', '(' . implode(', ', $posts) . ')', 'IN'); $ret = $this->getAll($post_criteria); return $ret; @@ -82,10 +61,10 @@ public function getAllReports( $perpage = 0, &$start, $report_result = 0, - $report_id = 0 - ) { + $report_id = 0) + { $forumCriteria = ''; - $row = []; + $row = []; if ('DESC' === $order) { $operator_for_position = '>'; } else { @@ -122,7 +101,7 @@ public function getAllReports( $sql = 'SELECT r.*, p.subject, p.topic_id, p.forum_id' . $tables_criteria . $forumCriteria . $result_criteria . $order_criteria; $result = $this->db->query($sql, $perpage, $start); $ret = []; - //$reportHandler = xoops_getModuleHandler('report', 'newbb'); + //$reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); while ($myrow = $this->db->fetchArray($result)) { $ret[] = $myrow; // return as array } diff --git a/class/stats.php b/class/StatsHandler.php similarity index 97% rename from class/stats.php rename to class/StatsHandler.php index 56e7ae61..3a41ec33 100644 --- a/class/stats.php +++ b/class/StatsHandler.php @@ -1,4 +1,5 @@ -db = $db; //if (!$db || !($db instanceof XoopsDatabase)) { @@ -49,10 +50,10 @@ public function __construct(XoopsDatabase $db = null) } /** - * @param null|XoopsDatabase $db - * @return NewbbStatsHandler + * @param null|\XoopsDatabase $db + * @return StatsHandler */ - public static function getInstance(XoopsDatabase $db = null) + public static function getInstance(\XoopsDatabase $db = null) { static $instance; if (null === $instance) { diff --git a/class/Text.php b/class/Text.php new file mode 100644 index 00000000..b4accb6a --- /dev/null +++ b/class/Text.php @@ -0,0 +1,32 @@ + + * @since 4.00 + * @package module::newbb + */ + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); + +/** + * Class Text + */ +class Text extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('post_id', XOBJ_DTYPE_INT); + $this->initVar('post_text', XOBJ_DTYPE_TXTAREA); + $this->initVar('post_edit', XOBJ_DTYPE_SOURCE); + } +} diff --git a/class/text.php b/class/TextHandler.php similarity index 61% rename from class/text.php rename to class/TextHandler.php index 48e94724..53ee7e58 100644 --- a/class/text.php +++ b/class/TextHandler.php @@ -1,4 +1,5 @@ -path('modules/newbb/include/functions.ini.php'); /** - * Class Ntext - */ -class Ntext extends XoopsObject -{ - /** - * - */ - public function __construct() - { - parent::__construct(); - $this->initVar('post_id', XOBJ_DTYPE_INT); - $this->initVar('post_text', XOBJ_DTYPE_TXTAREA); - $this->initVar('post_edit', XOBJ_DTYPE_SOURCE); - } -} - -/** - * Class NewbbTextHandler + * Class TextHandler */ -class NewbbTextHandler extends XoopsPersistableObjectHandler +class TextHandler extends \XoopsPersistableObjectHandler { /** - * @param XoopsDatabase|null $db + * @param \XoopsDatabase $db */ - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { - parent::__construct($db, 'newbb_posts_text', 'Ntext', 'post_id', ''); + parent::__construct($db, 'newbb_posts_text', Text::class, 'post_id', ''); } /** diff --git a/class/Topic.php b/class/Topic.php new file mode 100644 index 00000000..ead6a1ed --- /dev/null +++ b/class/Topic.php @@ -0,0 +1,205 @@ + + * @since 4.00 + * @package module::newbb + */ + +use XoopsModules\Newbb; + +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); + +/** + * Class Topic + */ +class Topic extends \XoopsObject +{ + /** + * + */ + public function __construct() + { + parent::__construct(); + $this->initVar('topic_id', XOBJ_DTYPE_INT); + $this->initVar('topic_title', XOBJ_DTYPE_TXTBOX); + $this->initVar('topic_poster', XOBJ_DTYPE_INT); + $this->initVar('topic_time', XOBJ_DTYPE_INT); + $this->initVar('topic_views', XOBJ_DTYPE_INT); + $this->initVar('topic_replies', XOBJ_DTYPE_INT); + $this->initVar('topic_last_post_id', XOBJ_DTYPE_INT); + $this->initVar('forum_id', XOBJ_DTYPE_INT); + $this->initVar('topic_status', XOBJ_DTYPE_INT); + $this->initVar('type_id', XOBJ_DTYPE_INT); + $this->initVar('topic_sticky', XOBJ_DTYPE_INT); + $this->initVar('topic_digest', XOBJ_DTYPE_INT); + $this->initVar('digest_time', XOBJ_DTYPE_INT); + $this->initVar('approved', XOBJ_DTYPE_INT); + $this->initVar('poster_name', XOBJ_DTYPE_TXTBOX); + $this->initVar('rating', XOBJ_DTYPE_OTHER); + $this->initVar('votes', XOBJ_DTYPE_INT); + $this->initVar('topic_haspoll', XOBJ_DTYPE_INT); + $this->initVar('poll_id', XOBJ_DTYPE_INT); + $this->initVar('topic_tags', XOBJ_DTYPE_SOURCE); + } + + // irmtfan add LAST_INSERT_ID to enhance the mysql performances + public function incrementCounter() + { + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); + $GLOBALS['xoopsDB']->queryF($sql); + } + + /** + * Create full title of the topic + * + * the title is composed of [type_name] if type_id is greater than 0 plus topic_title + * + */ + public function getFullTitle() + { + $topic_title = $this->getVar('topic_title'); + if (!$this->getVar('type_id')) { + return $topic_title; + } + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); + if (!$typeObject = $typeHandler->get($this->getVar('type_id'))) { + return $topic_title; + } + + include_once __DIR__ . '/../include/functions.topic.php'; + + return getTopicTitle($topic_title, $typeObject->getVar('type_name'), $typeObject->getVar('type_color')); + } + // START irmtfan loadOldPoll function + + /** + * Load functions needed for old xoopspoll (older than version 1.4 by zyspec) and umfrage modules + * + * @access public + * @param string $pollModule dirname of the poll module + * @return string|false $classPoll = the name of the old poll class eg: "XoopsPoll" | "Umfrage" + */ + + public function loadOldPoll($pollModule = null) + { + static $classPoll = false; + if ($classPoll && empty($pollModule)) { + return $classPoll; + } + $newbbConfig = newbbLoadConfig(); + if (!empty($pollModule)) { + $newbbConfig['poll_module'] = $pollModule; + } + $relPath = $GLOBALS['xoops']->path('modules/' . $newbbConfig['poll_module'] . '/class/' . $newbbConfig['poll_module']); + include_once $relPath . '.php'; + include_once $relPath . 'option.php'; + include_once $relPath . 'log.php'; + include_once $relPath . 'renderer.php'; + $classes = get_declared_classes(); + foreach (array_reverse($classes) as $class) { + if (strtolower($class) == $newbbConfig['poll_module']) { + $classPoll = $class; + + return $classPoll; + } + } + + return false; + } + // END irmtfan loadOldPoll function + // START irmtfan add deletePoll function + /** + * delete a poll in database + * + * @access public + * @param int $poll_id + * @return bool + */ + public function deletePoll($poll_id) + { + if (empty($poll_id)) { + return false; + } + /** @var \XoopsModuleHandler $moduleHandler */ + $moduleHandler = xoops_getHandler('module'); + $newbbConfig = newbbLoadConfig(); + $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); + if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { + return false; + } + // new xoopspoll module + if ($pollModuleHandler->getVar('version') >= 140) { + /** @var \XoopsPollHandler $pollHandler */ + $pollHandler = xoops_getModuleHandler('poll', $newbbConfig['poll_module']); + if (false !== $pollHandler->deleteAll(new \Criteria('poll_id', $poll_id, '='))) { + /** @var \XoopspollOptionHandler $optionHandler */ + $optionHandler = xoops_getModuleHandler('option', $newbbConfig['poll_module']); + $optionHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); + /** @var \XoopspollLogHandler $logHandler */ + $logHandler = xoops_getModuleHandler('log', $newbbConfig['poll_module']); + $logHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); + xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll_id); + } + // old xoopspoll or umfrage or any clone from them + } else { + $classPoll = $this->loadOldPoll(); + /** @var \XoopsPoll $poll */ + $poll = new $classPoll($poll_id); + if (false !== $poll->delete()) { + $classOption = $classPoll . 'Option'; + $classOption::deleteByPollId($poll->getVar('poll_id')); + $classLog = $classPoll . 'Log'; + $classLog::deleteByPollId($poll->getVar('poll_id')); + xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll->getVar('poll_id')); + } + } // end poll_module new or old + + return true; + } + // END irmtfan add deletePoll function + + // START irmtfan add getPoll function + /** + * get a poll object from a poll module. + * note: can be used to find if a poll exist in a module + * @access public + * @param int $poll_id + * @param string $pollModule dirname of the poll module + * @return bool|\XoopsObject poll + */ + public function getPoll($poll_id, $pollModule = null) + { + if (empty($poll_id)) { + return false; + } + $moduleHandler = xoops_getHandler('module'); + $newbbConfig = newbbLoadConfig(); + if (!empty($pollModule)) { + $newbbConfig['poll_module'] = $pollModule; + } + + $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); + if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { + return false; + } + // new xoopspoll module + if ($pollModuleHandler->getVar('version') >= 140) { + $pollHandler = xoops_getModuleHandler('poll', $newbbConfig['poll_module']); + $pollObject = $pollHandler->get($poll_id); + // old xoopspoll or umfrage or any clone from them + } else { + $classPoll = $this->loadOldPoll($newbbConfig['poll_module']); + $pollObject = new $classPoll($poll_id); + } // end poll_module new or old + + return $pollObject; + } + // END irmtfan add getPoll function +} diff --git a/class/topic.php b/class/TopicHandler.php similarity index 64% rename from class/topic.php rename to class/TopicHandler.php index e258317b..668bebe9 100644 --- a/class/topic.php +++ b/class/TopicHandler.php @@ -1,4 +1,5 @@ -path('modules/newbb/include/functions.ini.php'); /** - * Class Topic + * Class TopicHandler */ -class Topic extends XoopsObject +class TopicHandler extends \XoopsPersistableObjectHandler { /** - * - */ - public function __construct() - { - parent::__construct(); - $this->initVar('topic_id', XOBJ_DTYPE_INT); - $this->initVar('topic_title', XOBJ_DTYPE_TXTBOX); - $this->initVar('topic_poster', XOBJ_DTYPE_INT); - $this->initVar('topic_time', XOBJ_DTYPE_INT); - $this->initVar('topic_views', XOBJ_DTYPE_INT); - $this->initVar('topic_replies', XOBJ_DTYPE_INT); - $this->initVar('topic_last_post_id', XOBJ_DTYPE_INT); - $this->initVar('forum_id', XOBJ_DTYPE_INT); - $this->initVar('topic_status', XOBJ_DTYPE_INT); - $this->initVar('type_id', XOBJ_DTYPE_INT); - $this->initVar('topic_sticky', XOBJ_DTYPE_INT); - $this->initVar('topic_digest', XOBJ_DTYPE_INT); - $this->initVar('digest_time', XOBJ_DTYPE_INT); - $this->initVar('approved', XOBJ_DTYPE_INT); - $this->initVar('poster_name', XOBJ_DTYPE_TXTBOX); - $this->initVar('rating', XOBJ_DTYPE_OTHER); - $this->initVar('votes', XOBJ_DTYPE_INT); - $this->initVar('topic_haspoll', XOBJ_DTYPE_INT); - $this->initVar('poll_id', XOBJ_DTYPE_INT); - $this->initVar('topic_tags', XOBJ_DTYPE_SOURCE); - } - - // irmtfan add LAST_INSERT_ID to enhance the mysql performances - public function incrementCounter() - { - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); - $GLOBALS['xoopsDB']->queryF($sql); - } - - /** - * Create full title of the topic - * - * the title is composed of [type_name] if type_id is greater than 0 plus topic_title - * + * @param \XoopsDatabase $db */ - public function getFullTitle() + public function __construct(\XoopsDatabase $db) { - $topic_title = $this->getVar('topic_title'); - if (!$this->getVar('type_id')) { - return $topic_title; - } - $typeHandler = xoops_getModuleHandler('type', 'newbb'); - if (!$typeObject = $typeHandler->get($this->getVar('type_id'))) { - return $topic_title; - } - - include_once __DIR__ . '/../include/functions.topic.php'; - - return getTopicTitle($topic_title, $typeObject->getVar('type_name'), $typeObject->getVar('type_color')); + parent::__construct($db, 'newbb_topics', Topic::class, 'topic_id', 'topic_title'); } - // START irmtfan loadOldPoll function - - /** - * Load functions needed for old xoopspoll (older than version 1.4 by zyspec) and umfrage modules - * - * @access public - * @param string $pollModule dirname of the poll module - * @return string|false $classPoll = the name of the old poll class eg: "XoopsPoll" | "Umfrage" - */ - - public function loadOldPoll($pollModule = null) - { - static $classPoll = false; - if ($classPoll && empty($pollModule)) { - return $classPoll; - } - $newbbConfig = newbbLoadConfig(); - if (!empty($pollModule)) { - $newbbConfig['poll_module'] = $pollModule; - } - $relPath = $GLOBALS['xoops']->path('modules/' . $newbbConfig['poll_module'] . '/class/' . $newbbConfig['poll_module']); - include_once $relPath . '.php'; - include_once $relPath . 'option.php'; - include_once $relPath . 'log.php'; - include_once $relPath . 'renderer.php'; - $classes = get_declared_classes(); - foreach (array_reverse($classes) as $class) { - if (strtolower($class) == $newbbConfig['poll_module']) { - $classPoll = $class; - - return $classPoll; - } - } - return false; - } - // END irmtfan loadOldPoll function - // START irmtfan add deletePoll function /** - * delete a poll in database - * - * @access public - * @param int $poll_id - * @return bool - */ - public function deletePoll($poll_id) - { - if (empty($poll_id)) { - return false; - } - /** @var \XoopsModuleHandler $moduleHandler */ - $moduleHandler = xoops_getHandler('module'); - $newbbConfig = newbbLoadConfig(); - $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); - if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { - return false; - } - // new xoopspoll module - if ($pollModuleHandler->getVar('version') >= 140) { - /** @var \XoopsPollHandler $pollHandler */ - $pollHandler = xoops_getModuleHandler('poll', $newbbConfig['poll_module']); - if (false !== $pollHandler->deleteAll(new Criteria('poll_id', $poll_id, '='))) { - /** @var \XoopspollOptionHandler $optionHandler */ - $optionHandler = xoops_getModuleHandler('option', $newbbConfig['poll_module']); - $optionHandler->deleteAll(new Criteria('poll_id', $poll_id, '=')); - /** @var \XoopspollLogHandler $logHandler */ - $logHandler = xoops_getModuleHandler('log', $newbbConfig['poll_module']); - $logHandler->deleteAll(new Criteria('poll_id', $poll_id, '=')); - xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll_id); - } - // old xoopspoll or umfrage or any clone from them - } else { - $classPoll = $this->loadOldPoll(); - /** @var \XoopsPoll $poll */ - $poll = new $classPoll($poll_id); - if (false !== $poll->delete()) { - $classOption = $classPoll . 'Option'; - $classOption::deleteByPollId($poll->getVar('poll_id')); - $classLog = $classPoll . 'Log'; - $classLog::deleteByPollId($poll->getVar('poll_id')); - xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll->getVar('poll_id')); - } - } // end poll_module new or old - - return true; - } - // END irmtfan add deletePoll function - - // START irmtfan add getPoll function - /** - * get a poll object from a poll module. - * note: can be used to find if a poll exist in a module - * @access public - * @param int $poll_id - * @param string $pollModule dirname of the poll module - * @return bool|XoopsObject poll - */ - public function getPoll($poll_id, $pollModule = null) - { - if (empty($poll_id)) { - return false; - } - $moduleHandler = xoops_getHandler('module'); - $newbbConfig = newbbLoadConfig(); - if (!empty($pollModule)) { - $newbbConfig['poll_module'] = $pollModule; - } - - $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); - if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { - return false; - } - // new xoopspoll module - if ($pollModuleHandler->getVar('version') >= 140) { - $pollHandler = xoops_getModuleHandler('poll', $newbbConfig['poll_module']); - $pollObject = $pollHandler->get($poll_id); - // old xoopspoll or umfrage or any clone from them - } else { - $classPoll = $this->loadOldPoll($newbbConfig['poll_module']); - $pollObject = new $classPoll($poll_id); - } // end poll_module new or old - - return $pollObject; - } - // END irmtfan add getPoll function -} - -/** - * Class NewbbTopicHandler - */ -class NewbbTopicHandler extends XoopsPersistableObjectHandler -{ - /** - * @param XoopsDatabase|null $db - */ - public function __construct(XoopsDatabase $db) - { - parent::__construct($db, 'newbb_topics', 'Topic', 'topic_id', 'topic_title'); - } - - /** - * @param mixed $id - * @param null|array $fields + * @param mixed $id + * @param null|array $fields * @return mixed|null */ public function get($id = null, $fields = null) //get($id, $var = null) { - $var = $fields; + $var = $fields; $ret = null; $tags = $var; if (!empty($var) && is_string($var)) { @@ -239,11 +54,11 @@ public function get($id = null, $fields = null) //get($id, $var = null) } /** - * @param XoopsObject $object + * @param \XoopsObject $object * @param bool $force * @return mixed */ - public function insert(XoopsObject $object, $force = true) + public function insert(\XoopsObject $object, $force = true) { if (!$object->getVar('topic_time')) { $object->setVar('topic_time', time()); @@ -280,13 +95,13 @@ public function approve($object, $force = false) //xoops_error($this->db->error()); return false; } - $postHandler = xoops_getModuleHandler('post', 'newbb'); - $postsObject = $postHandler->getAll(new Criteria('topic_id', $topic_id)); + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); + $postsObject = $postHandler->getAll(new \Criteria('topic_id', $topic_id)); foreach (array_keys($postsObject) as $post_id) { $postHandler->approve($postsObject[$post_id]); } unset($postsObject); - $statsHandler = xoops_getModuleHandler('stats', 'newbb'); + $statsHandler = Newbb\Helper::getInstance()->getHandler('Stats'); $statsHandler->update($object->getVar('forum_id'), 'topic'); return true; @@ -308,7 +123,7 @@ public function approve($object, $force = false) *
  • <= 0: global
  • * * @access public - * @return mixed|null|XoopsObject + * @return mixed|null|\XoopsObject */ public function &getByMove($topic_id, $action, $forum_id = 0) { @@ -331,7 +146,7 @@ public function &getByMove($topic_id, $action, $forum_id = 0) /** * @param $post_id - * @return null|XoopsObject + * @return null|\XoopsObject */ public function &getByPost($post_id) { @@ -368,10 +183,10 @@ public function getPostCount(&$topic, $type = '') $approved = 1; break; } - $criteria = new CriteriaCompo(new Criteria('topic_id', $topic->getVar('topic_id'))); - $criteria->add(new Criteria('approved', $approved)); - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic->getVar('topic_id'))); + $criteria->add(new \Criteria('approved', $approved)); + /** @var Newbb\PostHandler $postHandler */ + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); $count = $postHandler->getCount($criteria); return $count; @@ -379,7 +194,7 @@ public function getPostCount(&$topic, $type = '') /** * @param $topic_id - * @return null|\NewbbPost + * @return null|\Post */ public function &getTopPost($topic_id) { @@ -395,10 +210,10 @@ public function &getTopPost($topic_id) //xoops_error($this->db->error()); return $post; } - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); + /** @var Newbb\PostHandler $postHandler */ + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); $myrow = $this->db->fetchArray($result); - /** @var \NewbbPost $post */ + /** @var Newbb\Post $post */ $post = $postHandler->create(false); $post->assignVars($myrow); @@ -472,7 +287,7 @@ public function &getAllPosts(&$topic, $order = 'ASC', $perpage = 10, &$start, $p //xoops_error($this->db->error()); return $ret; } - $postHandler = xoops_getModuleHandler('post', 'newbb'); + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); while ($myrow = $this->db->fetchArray($result)) { $post = $postHandler->create(false); $post->assignVars($myrow); @@ -490,8 +305,8 @@ public function &getAllPosts(&$topic, $order = 'ASC', $perpage = 10, &$start, $p */ public function &getPostTree(&$postArray, $pid = 0) { - include_once $GLOBALS['xoops']->path('modules/newbb/class/newbbtree.php'); - $NewBBTree = new NewBBTree('newbb_posts'); + // include_once $GLOBALS['xoops']->path('modules/newbb/class/Tree.php'); + $NewBBTree = new Newbb\Tree('newbb_posts'); $NewBBTree->setPrefix('  '); $NewBBTree->setPostArray($postArray); $NewBBTree->getPostTree($postsArray, $pid); @@ -556,19 +371,19 @@ public function &getAllPosters(&$topic, $isApproved = true) } /** - * @param XoopsObject|Topic $topic - * @param bool $force + * @param \XoopsObject $topic + * @param bool $force * @return bool */ - public function delete(XoopsObject $topic, $force = true) + public function delete(\XoopsObject $topic, $force = true) { $topic_id = is_object($topic) ? $topic->getVar('topic_id') : (int)$topic; if (empty($topic_id)) { return false; } $postObject = $this->getTopPost($topic_id); - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); + /** @var Newbb\PostHandler $postHandler */ + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); $postHandler->delete($postObject, false, $force); $newbbConfig = newbbLoadConfig(); @@ -584,9 +399,9 @@ public function delete(XoopsObject $topic, $force = true) // parameter: $type: 'post', 'view', 'reply', 'edit', 'delete', 'addpoll', 'vote', 'attach' // $gperm_names = "'forum_can_post', 'forum_can_view', 'forum_can_reply', 'forum_can_edit', 'forum_can_delete', 'forum_can_addpoll', 'forum_can_vote', 'forum_can_attach', 'forum_can_noapprove'"; /** - * @param \NewbbForum $forum - * @param int $topic_locked - * @param string $type + * @param Newbb\Forum $forum + * @param int $topic_locked + * @param string $type * @return bool */ public function getPermission($forum, $topic_locked = 0, $type = 'view') @@ -605,8 +420,8 @@ public function getPermission($forum, $topic_locked = 0, $type = 'view') if ($topic_locked && 'view' !== $type) { $permission = false; } else { - /** @var \NewbbPermissionHandler $permHandler */ - $permHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permHandler */ + $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); $permission = $permHandler->getPermission('forum', $type, $forum_id); } @@ -623,7 +438,7 @@ public function getPermission($forum, $topic_locked = 0, $type = 'view') */ public function cleanOrphan($table_link = '', $field_link = '', $field_object = '') //cleanOrphan() { - $this->deleteAll(new Criteria('topic_time', 0), true, true); + $this->deleteAll(new \Criteria('topic_time', 0), true, true); parent::cleanOrphan($this->db->prefix('newbb_forums'), 'forum_id'); parent::cleanOrphan($this->db->prefix('newbb_posts'), 'topic_id'); @@ -647,8 +462,8 @@ public function cleanExpires($expire = 0) if (empty($expire)) { return false; } - $crit_expire = new CriteriaCompo(new Criteria('approved', 0, '<=')); - $crit_expire->add(new Criteria('topic_time', time() - (int)$expire, '<')); + $crit_expire = new \CriteriaCompo(new \Criteria('approved', 0, '<=')); + $crit_expire->add(new \Criteria('topic_time', time() - (int)$expire, '<')); return $this->deleteAll($crit_expire, true/*, true*/); } @@ -669,11 +484,11 @@ public function synchronization($object = null, $force = true) return false; } - /** @var \NewbbPostHandler $postHandler */ - $postHandler = xoops_getModuleHandler('post', 'newbb'); - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('topic_id', $object->getVar('topic_id')), 'AND'); - $criteria->add(new Criteria('approved', 1), 'AND'); + /** @var Newbb\PostHandler $postHandler */ + $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('topic_id', $object->getVar('topic_id')), 'AND'); + $criteria->add(new \Criteria('approved', 1), 'AND'); $post_ids = $postHandler->getIds($criteria); if (empty($post_ids)) { return false; @@ -688,14 +503,14 @@ public function synchronization($object = null, $force = true) $object->setVar('topic_replies', $topic_replies); } $b1 = $this->insert($object, $force); - $criteria->add(new Criteria('post_id', $top_post, '<>'), 'AND'); - $criteria->add(new Criteria('pid', '(' . implode(', ', $post_ids) . ')', 'NOT IN'), 'AND'); + $criteria->add(new \Criteria('post_id', $top_post, '<>'), 'AND'); + $criteria->add(new \Criteria('pid', '(' . implode(', ', $post_ids) . ')', 'NOT IN'), 'AND'); $b2 = $postHandler->updateAll('pid', $top_post, $criteria, $force); - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('post_id', $top_post, '='), 'AND'); + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('post_id', $top_post, '='), 'AND'); $b3 = $postHandler->updateAll('pid', 0, $criteria, $force); - return ($b1 && $b2 && $b3) ? true : false; + return ($b1 && $b2 && $b3); } // END irmtfan - rewrite topic synchronization function. add pid sync and remove hard-code db access // START irmtfan getActivePolls @@ -740,7 +555,7 @@ public function findPollModule(array $pollDirs = []) } // if only one active poll module still we need to check!!! //if(count($pollDirs) === 1) return end($pollDirs); - $topicPollObjs = $this->getAll(new Criteria('topic_haspoll', 1), ['topic_id', 'poll_id']); + $topicPollObjs = $this->getAll(new \Criteria('topic_haspoll', 1), ['topic_id', 'poll_id']); if (empty($topicPollObjs)) { return true; } // no poll or no topic!!! diff --git a/class/topic.renderer.php b/class/TopicRenderer.php similarity index 95% rename from class/topic.renderer.php rename to class/TopicRenderer.php index 6f64722a..390025e6 100644 --- a/class/topic.renderer.php +++ b/class/TopicRenderer.php @@ -1,4 +1,5 @@ -handler = xoops_getModuleHandler('topic', 'newbb'); + $this->handler = Newbb\Helper::getInstance()->getHandler('Topic'); } /** * Access the only instance of this class - * @return NewbbTopicRenderer + * @return TopicRenderer */ public static function getInstance() { @@ -336,8 +340,8 @@ public function parseVar($var, $val) { switch ($var) { case 'forum': - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var Newbb\ForumHandler $forumHandler */ + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); // START irmtfan - get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums $accessForums = $forumHandler->getIdsByValues(array_map('intval', @explode('|', $val))); @@ -624,10 +628,10 @@ public function getStatus($type = null, $status = null) } /** - * @param Smarty $xoopsTpl + * @param \Smarty $xoopsTpl * @throws \RuntimeException */ - public function buildSelection(Smarty $xoopsTpl) + public function buildSelection(\Smarty $xoopsTpl) { $selection = ['action' => $this->page]; $selection['vars'] = $this->vars; @@ -641,7 +645,7 @@ public function buildSelection(Smarty $xoopsTpl) $sort_selected = $this->vars['sort']; $sorts = $this->getSort('', 'title'); $selection['sort'] = "';// if user doesn't select, default is "0" all forums @@ -187,13 +187,13 @@ $forumSel .= '>' . _ALL . ''; $forumSel .= newbbForumSelectBox($forum_id, 'access', false); //$accessForums, $permission = "access", $delimitorCategory = true $forumSel .= ''; - $forumEle = new XoopsFormLabel(_MD_NEWBB_SELFORUM, $forumSel); + $forumEle = new \XoopsFormLabel(_MD_NEWBB_SELFORUM, $forumSel); $forumEle->customValidationCode[] = 'if (document.suspend.forum.value < 0) {return false;} '; $forum_form->addElement($forumEle); } else { - $forum_form->addElement(new XoopsFormHidden('forum', $forum_id)); + $forum_form->addElement(new \XoopsFormHidden('forum', $forum_id)); } -$forum_form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); +$forum_form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); $forum_form->assign($xoopsTpl); include_once __DIR__ . '/footer.php'; diff --git a/newtopic.php b/newtopic.php index 46248d4b..e98c2c9d 100644 --- a/newtopic.php +++ b/newtopic.php @@ -17,16 +17,16 @@ redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); } -///** @var \NewbbForumHandler $forumHandler */ -//$forumHandler = xoops_getModuleHandler('forum'); -$forumObject = $forumHandler->get($forum); +///** @var Newbb\ForumHandler $forumHandler */ +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); +$forumObject = $forumHandler->get($forum); if (!$forumHandler->getPermission($forumObject)) { redirect_header(XOOPS_URL . '/index.php', 2, _NOPERM); } -///** @var \NewbbTopicHandler $topicHandler */ -//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -$topicObject = $topicHandler->create(); +///** @var Newbb\TopicHandler $topicHandler */ +//$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); +$topicObject = $topicHandler->create(); $topicObject->setVar('forum_id', $forum); if (!$topicHandler->getPermission($forumObject, 0, 'post')) { /* @@ -45,8 +45,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { -// /** @var \NewbbOnlineHandler $onlineHandler */ -// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); + // /** @var Newbb\OnlineHandler $onlineHandler */ + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init($forumObject); } diff --git a/polls.php b/polls.php index dec8e277..c498a30d 100644 --- a/polls.php +++ b/polls.php @@ -17,6 +17,7 @@ */ use Xmf\Request; +use XoopsModules\Newbb; // rewrite by irmtfan and zyspec to accept xoopspoll 1.4 and all old xoopspoll and umfrage versions and all clones @@ -46,9 +47,9 @@ $topic_id = Request::getInt('topic_id', Request::getInt('topic_id', 0, 'GET'), 'POST'); // deal with permissions -/** @var \NewbbTopicHandler $topicHandler */ -$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -$topicObject = $topicHandler->get($topic_id); +/** @var Newbb\TopicHandler $topicHandler */ +$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); +$topicObject = $topicHandler->get($topic_id); // topic exist if (is_object($topicObject)) { $forum_id = $topicObject->getVar('forum_id'); @@ -56,9 +57,9 @@ redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_POLLMODULE_ERROR . ': ' . _MD_NEWBB_FORUMNOEXIST); } // forum access permission -/** @var \NewbbForumHandler $forumHandler */ -$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -$forumObject = $forumHandler->get($forum_id); +/** @var Newbb\ForumHandler $forumHandler */ +$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); +$forumObject = $forumHandler->get($forum_id); if (!$forumHandler->getPermission($forumObject)) { redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } @@ -82,8 +83,8 @@ // old xoopspoll or umfrage or any clone from them } else { include $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); - $classPoll = $topicObject->loadOldPoll(); - $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist + $classPoll = $topicObject->loadOldPoll(); + $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist } } else { // irmtfan - issue with javascript:history.go(-1) @@ -116,8 +117,8 @@ // old xoopspoll or umfrage or any clone from them } else { $classOption = $classPoll . 'Option'; - $poll_form = new XoopsThemeForm(_MD_NEWBB_POLL_CREATNEWPOLL, 'poll_form', 'polls.php', 'post', true); - $author_label = new XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, is_object($GLOBALS['xoopsUser']) ? ("getVar('uid') @@ -125,34 +126,34 @@ . newbbGetUnameFromId($GLOBALS['xoopsUser']->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']) . '') : $GLOBALS['xoopsConfig']['anonymous']); $poll_form->addElement($author_label); - $question_text = new XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); + $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255); $poll_form->addElement($question_text); - $desc_tarea = new XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description'); + $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description'); $poll_form->addElement($desc_tarea); $currenttime = formatTimestamp(time(), 'Y-m-d H:i:s'); $endtime = formatTimestamp(time() + 604800, 'Y-m-d H:i:s'); - $expire_text = new XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, $currenttime) . '
    ', 'end_time', 30, 19, $endtime); + $expire_text = new \XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, $currenttime) . '
    ', 'end_time', 30, 19, $endtime); $poll_form->addElement($expire_text); - $weight_text = new XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); + $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, 0); $poll_form->addElement($weight_text); - $multi_yn = new XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0); + $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', 0); $poll_form->addElement($multi_yn); - $notify_yn = new XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1); + $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1); $poll_form->addElement($notify_yn); - $option_tray = new XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); - $barcolor_array = XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); for ($i = 0; $i < 10; ++$i) { $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); - $option_text = new XoopsFormText('', 'option_text[]', 50, 255); + $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); $option_tray->addElement($option_text); - $color_select = new XoopsFormSelect('', "option_color[{$i}]", $current_bar); + $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); $color_select->addOptionArray($barcolor_array); $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); - $color_label = new XoopsFormLabel('', "addElement($option_tray); - $poll_form->addElement(new XoopsFormHidden('op', 'save')); - $poll_form->addElement(new XoopsFormHidden('topic_id', $topic_id)); - $poll_form->addElement(new XoopsFormHidden('poll_id', $poll_id)); - $poll_form->addElement(new XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); - $poll_form->addElement(new XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); + $poll_form->addElement(new \XoopsFormHidden('op', 'save')); + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); + $poll_form->addElement(new \XoopsFormHidden('user_id', is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0)); + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); echo '

    ' . _MD_NEWBB_POLL_POLLCONF . '

    '; $poll_form->display(); } @@ -186,47 +187,45 @@ // old xoopspoll or umfrage or any clone from them } else { $classOption = $classPoll . 'Option'; - $poll_form = new XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); - $author_label = new XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, "" . newbbGetUnameFromId($pollObject->getVar('user_id'), $GLOBALS['xoopsModuleConfig']['show_realname']) . ''); + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_EDITPOLL, 'poll_form', 'polls.php', 'post', true); + $author_label = new \XoopsFormLabel(_MD_NEWBB_POLL_AUTHOR, "" . newbbGetUnameFromId($pollObject->getVar('user_id'), $GLOBALS['xoopsModuleConfig']['show_realname']) . ''); $poll_form->addElement($author_label); - $question_text = new XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); + $question_text = new \XoopsFormText(_MD_NEWBB_POLL_POLLQUESTION, 'question', 50, 255, $pollObject->getVar('question', 'E')); $poll_form->addElement($question_text); - $desc_tarea = new XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E')); + $desc_tarea = new \XoopsFormTextarea(_MD_NEWBB_POLL_POLLDESC, 'description', $pollObject->getVar('description', 'E')); $poll_form->addElement($desc_tarea); $date = formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s'); // important "Y-m-d H:i:s" use in jdf function if (!$pollObject->hasExpired()) { - $expire_text = new XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '
    ', 'end_time', 20, 19, $date); + $expire_text = new \XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '
    ', 'end_time', 20, 19, $date); $poll_form->addElement($expire_text); } else { // irmtfan full URL - add topic_id - $restart_label = new XoopsFormLabel( - _MD_NEWBB_POLL_EXPIRATION, - sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "
    getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '' - ); + $restart_label = new \XoopsFormLabel(_MD_NEWBB_POLL_EXPIRATION, + sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "
    getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . ''); $poll_form->addElement($restart_label); } - $weight_text = new XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight')); + $weight_text = new \XoopsFormText(_MD_NEWBB_POLL_DISPLAYORDER, 'weight', 6, 5, $pollObject->getVar('weight')); $poll_form->addElement($weight_text); - $multi_yn = new XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); + $multi_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_ALLOWMULTI, 'multiple', $pollObject->getVar('multiple')); $poll_form->addElement($multi_yn); $options_arr =& $classOption::getAllByPollId($poll_id); $notify_value = 1; if (0 !== $pollObject->getVar('mail_status')) { $notify_value = 0; } - $notify_yn = new XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value); + $notify_yn = new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', $notify_value); $poll_form->addElement($notify_yn); - $option_tray = new XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); - $barcolor_array = XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/")); + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/")); $i = 0; foreach ($options_arr as $option) { /** @var \XoopsPoll $option */ - $option_tray->addElement(new XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text'))); - $option_tray->addElement(new XoopsFormHidden('option_id[]', $option->getVar('option_id'))); - $color_select = new XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); + $option_tray->addElement(new \XoopsFormText('', 'option_text[]', 50, 255, $option->getVar('option_text'))); + $option_tray->addElement(new \XoopsFormHidden('option_id[]', $option->getVar('option_id'))); + $color_select = new \XoopsFormSelect('', 'option_color[{$i}]', $option->getVar('option_color')); $color_select->addOptionArray($barcolor_array); $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[" . $i . "]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); - $color_label = new XoopsFormLabel('', "url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/" . $option->getVar('option_color', 'E')) . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' />
    "); $option_tray->addElement($color_select); @@ -235,13 +234,13 @@ ++$i; } // irmtfan full URL - $more_label = new XoopsFormLabel('', "
    getVar('dirname') . "/polls.php?op=addmore&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_ADDMORE . ''); + $more_label = new \XoopsFormLabel('', "
    getVar('dirname') . "/polls.php?op=addmore&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_ADDMORE . ''); $option_tray->addElement($more_label); $poll_form->addElement($option_tray); - $poll_form->addElement(new XoopsFormHidden('op', 'update')); - $poll_form->addElement(new XoopsFormHidden('topic_id', $topic_id)); - $poll_form->addElement(new XoopsFormHidden('poll_id', $poll_id)); - $poll_form->addElement(new XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); + $poll_form->addElement(new \XoopsFormHidden('op', 'update')); + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); echo '

    ' . _MD_NEWBB_POLL_POLLCONF . "

    \n"; $poll_form->display(); @@ -332,7 +331,7 @@ } break;// op: save } - // no break + // no break case 'update': // check security token if (!$GLOBALS['xoopsSecurity']->check()) { @@ -422,7 +421,7 @@ } } else { // new option object - $optionObject = $xpOptHandler->create(); + $optionObject = $xpOptHandler->create(); $optionTextArray[$key] = trim($optionTextArray[$key]); if ('' !== $optionTextArray[$key]) { // ignore if text is empty $optionObject->setVar('option_text', $optionTextArray[$key]); @@ -465,7 +464,7 @@ $classOption = $classPoll . 'Option'; $classLog = $classPoll . 'Log'; foreach ($option_id as $opid) { - $optionObject = new $classOption($opid); + $optionObject = new $classOption($opid); $option_text[$i] = trim($option_text[$i]); if ('' !== $option_text[$i]) { $optionObject->setVar('option_text', $option_text[$i]); @@ -499,24 +498,24 @@ case 'addmore': $question = $pollObject->getVar('question'); unset($pollObject); - $poll_form = new XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true); - $poll_form->addElement(new XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_ADDMORE, 'poll_form', 'polls.php', 'post', true); + $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); $option_tray = $xpOptHandler->renderOptionFormTray($poll_id); // old xoopspoll or umfrage or any clone from them } else { - $option_tray = new XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); - $barcolor_array = XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); + $option_tray = new \XoopsFormElementTray(_MD_NEWBB_POLL_POLLOPTIONS, ''); + $barcolor_array = \XoopsLists::getImgListAsArray($GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars/')); for ($i = 0; $i < 10; ++$i) { $current_bar = ('blank.gif' !== current($barcolor_array)) ? current($barcolor_array) : next($barcolor_array); - $option_text = new XoopsFormText('', 'option_text[]', 50, 255); + $option_text = new \XoopsFormText('', 'option_text[]', 50, 255); $option_tray->addElement($option_text); - $color_select = new XoopsFormSelect('', "option_color[{$i}]", $current_bar); + $color_select = new \XoopsFormSelect('', "option_color[{$i}]", $current_bar); $color_select->addOptionArray($barcolor_array); $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); - $color_label = new XoopsFormLabel('', "url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' />
    "); $option_tray->addElement($color_select); @@ -528,10 +527,10 @@ } } $poll_form->addElement($option_tray); - $poll_form->addElement(new XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); - $poll_form->addElement(new XoopsFormHidden('op', 'savemore')); - $poll_form->addElement(new XoopsFormHidden('topic_id', $topic_id)); - $poll_form->addElement(new XoopsFormHidden('poll_id', $poll_id)); + $poll_form->addElement(new \XoopsFormButtonTray('poll_submit', _SUBMIT, 'submit')); + $poll_form->addElement(new \XoopsFormHidden('op', 'savemore')); + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); echo '

    ' . _MD_NEWBB_POLL_POLLCONF . "

    \n"; $poll_form->display(); @@ -558,15 +557,15 @@ // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); - $optionObject = $xpOptHandler->create(); + $optionObject = $xpOptHandler->create(); $optionObject->setVar('option_text', $optxt); $optionObject->setVar('poll_id', $poll_id); $optionObject->setVar('option_color', $option_color[$i]); $xpOptHandler->insert($optionObject); // old xoopspoll or umfrage or any clone from them } else { - $classOption = $classPoll . 'Option'; - $optionObject = new $classOption(); + $classOption = $classPoll . 'Option'; + $optionObject = new $classOption(); $optionObject->setVar('option_text', $optxt); $optionObject->setVar('poll_id', $poll_id); $optionObject->setVar('option_color', $option_color[$i]); @@ -647,24 +646,17 @@ } else { $default_poll_duration = (86400 * 10); } - $poll_form = new XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); - $expire_text = new XoopsFormText( - _MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '
    ' . sprintf( - _MD_NEWBB_POLL_EXPIREDAT, - formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') - ) . '
    ', - 'end_time', - 20, - 19, - formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s') - ); + $poll_form = new \XoopsThemeForm(_MD_NEWBB_POLL_RESTARTPOLL, 'poll_form', 'polls.php', 'post', true); + $expire_text = new \XoopsFormText(_MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '
    ' . sprintf(_MD_NEWBB_POLL_EXPIREDAT, + formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s')) . '
    ', + 'end_time', 20, 19, formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s')); $poll_form->addElement($expire_text); - $poll_form->addElement(new XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1)); - $poll_form->addElement(new XoopsFormRadioYN(_MD_NEWBB_POLL_RESET, 'reset', 0)); - $poll_form->addElement(new XoopsFormHidden('op', 'restart_ok')); - $poll_form->addElement(new XoopsFormHidden('topic_id', $topic_id)); - $poll_form->addElement(new XoopsFormHidden('poll_id', $poll_id)); - $poll_form->addElement(new XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit')); + $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1)); + $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_RESET, 'reset', 0)); + $poll_form->addElement(new \XoopsFormHidden('op', 'restart_ok')); + $poll_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); + $poll_form->addElement(new \XoopsFormHidden('poll_id', $poll_id)); + $poll_form->addElement(new \XoopsFormButton('', 'poll_submit', _MD_NEWBB_POLL_RESTART, 'submit')); echo '

    ' . _MD_NEWBB_POLL_POLLCONF . "

    \n"; $poll_form->display(); diff --git a/post.php b/post.php index bcaf1f3f..91d477f0 100644 --- a/post.php +++ b/post.php @@ -17,6 +17,7 @@ */ use Xmf\Request; +use XoopsModules\Newbb; include_once __DIR__ . '/header.php'; @@ -39,30 +40,30 @@ redirect_header('index.php', 2, _MD_NEWBB_ERRORFORUM); } -///** @var \NewbbForumHandler $forumHandler */ -//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -///** @var \NewbbTopicHandler $topicHandler */ -//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -///** @var \NewbbPostHandler $postHandler */ -//$postHandler = xoops_getModuleHandler('post', 'newbb'); +///** @var Newbb\ForumHandler $forumHandler */ +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); +///** @var Newbb\TopicHandler $topicHandler */ +//$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); +///** @var Newbb\PostHandler $postHandler */ +//$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); if (!empty($isedit) && $post_id > 0) { - /** @var NewbbPost $postObject */ + /** @var Post $postObject */ $postObject = $postHandler->get($post_id); - $topic_id = $postObject->getVar('topic_id'); + $topic_id = $postObject->getVar('topic_id'); } else { $postObject = $postHandler->create(); } $topicObject = $topicHandler->get($topic_id); -$forum_id = $topic_id ? $topicObject->getVar('forum_id') : $forum; +$forum_id = $topic_id ? $topicObject->getVar('forum_id') : $forum; $forumObject = $forumHandler->get($forum_id); if (!$forumHandler->getPermission($forumObject)) { redirect_header('index.php', 2, _NOPERM); } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { -// /** @var \NewbbOnlineHandler $onlineHandler */ -// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); + // /** @var Newbb\OnlineHandler $onlineHandler */ + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init($forumObject); } @@ -101,7 +102,7 @@ } if (!is_object($GLOBALS['xoopsUser'])) { xoops_load('captcha'); - $xoopsCaptcha = XoopsCaptcha::getInstance(); + $xoopsCaptcha = \XoopsCaptcha::getInstance(); if (!$xoopsCaptcha->verify()) { $captcha_invalid = true; $error_message[] = $xoopsCaptcha->getMessage(); @@ -254,7 +255,7 @@ $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024; $uploaddir = XOOPS_CACHE_PATH; - $uploader = new NewbbUploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']); + $uploader = new Newbb\Uploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']); if ($_FILES['userfile']['error'] > 0) { switch ($_FILES['userfile']['error']) { @@ -298,7 +299,7 @@ } newbbSetSession('LP', time()); // Recording last post time $topicObject = $topicHandler->get($postObject->getVar('topic_id')); - $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; + $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; if (newbbIsAdmin($forumObject) || ($topicHandler->getPermission($forumObject, $topic_status, 'type') && (0 == $topic_id @@ -426,7 +427,7 @@ $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024; $uploaddir = XOOPS_CACHE_PATH; - $uploader = new NewbbUploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']); + $uploader = new Newbb\Uploader($uploaddir, $forumObject->getVar('attach_ext'), (int)$maxfilesize, (int)$GLOBALS['xoopsModuleConfig']['max_img_width'], (int)$GLOBALS['xoopsModuleConfig']['max_img_height']); if ($_FILES['userfile']['error'] > 0) { switch ($_FILES['userfile']['error']) { case 1: diff --git a/preloads/autoloader.php b/preloads/autoloader.php index ed936f92..f753e90c 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -11,7 +11,7 @@ $base_dir = __DIR__ . '/../class/'; // does the class use the namespace prefix? - $len = strlen($prefix); + $len = strlen($prefix); if (0 !== strncmp($prefix, $class, $len)) { return; @@ -23,7 +23,7 @@ // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; + $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; // if the file exists, require it if (file_exists($file)) { diff --git a/print.php b/print.php index 44b350d0..a9e88439 100644 --- a/print.php +++ b/print.php @@ -30,6 +30,7 @@ // ------------------------------------------------------------------------ // use Xmf\Request; +use XoopsModules\Newbb; /* * Print contents of a post or a topic @@ -54,9 +55,9 @@ } if (0 !== $post_id) { -// /** @var \NewbbPostHandler $postHandler */ -// $postHandler = xoops_getModuleHandler('post', 'newbb'); - /** @var \NewbbPost $post */ + // /** @var Newbb\PostHandler $postHandler */ + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); + /** @var Newbb\Post $post */ $post = $postHandler->get($post_id); if (!$approved = $post->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); @@ -72,11 +73,11 @@ } } -// /** @var \NewbbTopicHandler $topicHandler */ -// $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $topicObject = $topicHandler->get($topic_id); - $topic_id = $topicObject->getVar('topic_id'); - $forum = $topicObject->getVar('forum_id'); + // /** @var Newbb\TopicHandler $topicHandler */ + // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $topicObject = $topicHandler->get($topic_id); + $topic_id = $topicObject->getVar('topic_id'); + $forum = $topicObject->getVar('forum_id'); if (!$approved = $topicObject->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); } @@ -86,10 +87,10 @@ exit(_MD_NEWBB_NORIGHTTOVIEW); } -// /** @var \NewbbForumHandler $forumHandler */ -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $forum = $topicObject->getVar('forum_id'); - $forumObject = $forumHandler->get($forum); + // /** @var Newbb\ForumHandler $forumHandler */ + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + $forum = $topicObject->getVar('forum_id'); + $forumObject = $forumHandler->get($forum); if (!$forumHandler->getPermission($forumObject)) { exit(_MD_NEWBB_NORIGHTTOVIEW); } diff --git a/ratethread.php b/ratethread.php index 04f68175..e61b0fe4 100644 --- a/ratethread.php +++ b/ratethread.php @@ -41,9 +41,9 @@ ${$var} = Request::getInt($var, Request::getInt($var, 0, 'POST'), 'GET'); } -///** @var \NewbbTopicHandler $topicHandler */ -//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -$topicObject = $topicHandler->get($topic_id); +///** @var Newbb\TopicHandler $topicHandler */ +//$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); +$topicObject = $topicHandler->get($topic_id); if (!$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'post') && !$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'reply')) { // irmtfan - issue with javascript:history.go(-1) @@ -53,29 +53,29 @@ if (empty($rate)) { redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); } -///** @var \NewbbRateHandler $rateHandler */ -//$rateHandler = xoops_getModuleHandler('rate', 'newbb'); +///** @var Newbb\RateHandler $rateHandler */ +//$rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); if (0 !== $ratinguser) { // Check if Topic POSTER is voting (UNLESS Anonymous users allowed to post) - $crit_post = new CriteriaCompo(new Criteria('topic_id', $topic_id)); - $crit_post->add(new Criteria('uid', $ratinguser)); -// /** @var \NewbbPostHandler $postHandler */ -// $postHandler = xoops_getModuleHandler('post', 'newbb'); + $crit_post = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); + $crit_post->add(new \Criteria('uid', $ratinguser)); + // /** @var Newbb\PostHandler $postHandler */ + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); if ($postHandler->getCount($crit_post)) { redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); } // Check if REG user is trying to vote twice. - $crit_rate = new CriteriaCompo(new Criteria('topic_id', $topic_id)); - $crit_rate->add(new Criteria('ratinguser', $ratinguser)); + $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); + $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); if ($rateHandler->getCount($crit_rate)) { redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); } } else { // Check if ANONYMOUS user is trying to vote more than once per day. - $crit_rate = new CriteriaCompo(new Criteria('topic_id', $topic_id)); - $crit_rate->add(new Criteria('ratinguser', $ratinguser)); - $crit_rate->add(new Criteria('ratinghostname', $ip)); - $crit_rate->add(new Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); + $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); + $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); + $crit_rate->add(new \Criteria('ratinghostname', $ip)); + $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); if ($rateHandler->getCount($crit_rate)) { redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); } diff --git a/reply.php b/reply.php index 309546f4..322940f7 100644 --- a/reply.php +++ b/reply.php @@ -30,6 +30,7 @@ // ------------------------------------------------------------------------ // use Xmf\Request; +use XoopsModules\Newbb; include_once __DIR__ . '/header.php'; @@ -45,19 +46,19 @@ } ///** @var NewbbForumHandler $forumHandler */ -//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -///** @var NewbbTopicHandler $topicHandler */ -//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -///** @var NewbbPostHandler $postHandler */ -//$postHandler = xoops_getModuleHandler('post', 'newbb'); +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); +///** @var TopicHandler $topicHandler */ +//$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); +///** @var PostHandler $postHandler */ +//$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); if (!$pid = $post_id) { $pid = $topicHandler->getTopPostId($topic_id); } $postParentObject = $postHandler->get($pid); -$topic_id = $postParentObject->getVar('topic_id'); -$forum = $postParentObject->getVar('forum_id'); -$postObject = $postHandler->create(); +$topic_id = $postParentObject->getVar('topic_id'); +$forum = $postParentObject->getVar('forum_id'); +$postObject = $postHandler->create(); $postObject->setVar('pid', $pid); $postObject->setVar('topic_id', $topic_id); $postObject->setVar('forum_id', $forum); @@ -67,7 +68,7 @@ redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); } -$topicObject = $topicHandler->get($topic_id); +$topicObject = $topicHandler->get($topic_id); $topic_status = $topicObject->getVar('topic_status'); if (!$topicHandler->getPermission($forumObject, $topic_status, 'reply')) { /* @@ -87,8 +88,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { -// /** @var NewbbOnlineHandler $onlineHandler */ -// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); + // /** @var OnlineHandler $onlineHandler */ + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init($forumObject); } @@ -103,7 +104,7 @@ /* $xoopsTpl->assign('lang_forum_index', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); -$categoryHandler = xoops_getModuleHandler("category"); +$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); $categoryObject = $categoryHandler->get($forumObject->getVar("cat_id"), array("cat_title")); $xoopsTpl->assign('category', array("id" => $forumObject->getVar("cat_id"), "title" => $categoryObject->getVar('cat_title'))); @@ -168,14 +169,14 @@ include __DIR__ . '/include/form.post.php'; -///** @var \NewbbKarmaHandler $karmaHandler */ -//$karmaHandler = xoops_getModuleHandler('karma', 'newbb'); -$user_karma = $karmaHandler->getUserKarma(); +///** @var Newbb\KarmaHandler $karmaHandler */ +//$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); +$user_karma = $karmaHandler->getUserKarma(); $posts_context = []; //$posts_contextObject = $postHandler->getByLimit($topic_id, 5); //mb $posts_contextObject = $postHandler->getByLimit(5, 0, null, null, true, $topic_id, 1); -/** @var \NewbbPost $post_contextObject */ +/** @var Newbb\Post $post_contextObject */ foreach ($posts_contextObject as $post_contextObject) { // Sorry, in order to save queries, we have to hide the non-open post_text even if you have replied or have adequate karma, even an admin. if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { diff --git a/report.php b/report.php index acd1237b..02316b60 100644 --- a/report.php +++ b/report.php @@ -48,8 +48,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { -// /** @var \NewbbOnlineHandler $onlineHandler */ -// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); + // /** @var Newbb\OnlineHandler $onlineHandler */ + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init($forum); } @@ -63,7 +63,7 @@ $error_message = ''; if (!is_object($GLOBALS['xoopsUser'])) { xoops_load('xoopscaptcha'); - $xoopsCaptcha = XoopsCaptcha::getInstance(); + $xoopsCaptcha = \XoopsCaptcha::getInstance(); if (!$xoopsCaptcha->verify()) { $captcha_invalid = true; $error_message = $xoopsCaptcha->getMessage(); @@ -72,8 +72,8 @@ if ('' !== $error_message) { xoops_error($error_message); } else { -// $reportHandler = xoops_getModuleHandler('report', 'newbb'); - $report = $reportHandler->create(); + // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); + $report = $reportHandler->create(); $report->setVar('report_text', Request::getString('report_text', '', 'POST')); $report->setVar('post_id', Request::getInt('post_id', 0, 'POST')); $report->setVar('report_time', time()); @@ -83,7 +83,7 @@ $report->setVar('report_memo', ''); if ($report_id = $reportHandler->insert($report)) { -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); if (empty($forum)) { } $forumObject = $forumHandler->get($forum); @@ -118,26 +118,26 @@ } } -$report_form = new XoopsThemeForm('', 'reportform', 'report.php'); -$report_form->addElement(new XoopsFormText(_MD_NEWBB_REPORT_TEXT, 'report_text', 80, 255, Request::getString('report_text', '', 'POST')), true); +$report_form = new \XoopsThemeForm('', 'reportform', 'report.php'); +$report_form->addElement(new \XoopsFormText(_MD_NEWBB_REPORT_TEXT, 'report_text', 80, 255, Request::getString('report_text', '', 'POST')), true); if (!is_object($GLOBALS['xoopsUser'])) { - $report_form->addElement(new XoopsFormCaptcha()); + $report_form->addElement(new \XoopsFormCaptcha()); } -//$postHandler = xoops_getModuleHandler('post', 'newbb'); -$postObject = $postHandler->get($post_id); -$forum = $postObject->getVar('forum_id'); +//$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); +$postObject = $postHandler->get($post_id); +$forum = $postObject->getVar('forum_id'); -//$report_form->addElement(new XoopsFormHidden('pid', $pid)); -$report_form->addElement(new XoopsFormHidden('post_id', $post_id)); -$report_form->addElement(new XoopsFormHidden('topic_id', $topic_id)); -$report_form->addElement(new XoopsFormHidden('forum', $forum)); -$report_form->addElement(new XoopsFormHidden('viewmode', $viewmode)); -$report_form->addElement(new XoopsFormHidden('order', $order)); +//$report_form->addElement(new \XoopsFormHidden('pid', $pid)); +$report_form->addElement(new \XoopsFormHidden('post_id', $post_id)); +$report_form->addElement(new \XoopsFormHidden('topic_id', $topic_id)); +$report_form->addElement(new \XoopsFormHidden('forum', $forum)); +$report_form->addElement(new \XoopsFormHidden('viewmode', $viewmode)); +$report_form->addElement(new \XoopsFormHidden('order', $order)); -$button_tray = new XoopsFormElementTray(''); -$submit_button = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); -$cancel_button = new XoopsFormButton('', 'cancel', _MD_NEWBB_CANCELPOST, 'button'); +$button_tray = new \XoopsFormElementTray(''); +$submit_button = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); +$cancel_button = new \XoopsFormButton('', 'cancel', _MD_NEWBB_CANCELPOST, 'button'); $extra = "viewtopic.php?forum=$forum&topic_id=$topic_id&post_id=$post_id&order=$order&viewmode=$viewmode"; $cancel_button->setExtra("onclick='location=\"" . $extra . "\"'"); $button_tray->addElement($submit_button); diff --git a/rss.php b/rss.php index 2f7fae99..c85a9b32 100644 --- a/rss.php +++ b/rss.php @@ -50,16 +50,16 @@ $forums = array_map('intval', array_map('trim', explode('|', $forumSet))); } -///** @var \NewbbForumHandler $forumHandler */ -//$forumHandler = xoops_getModuleHandler('forum', 'newbb'); -//$topicHandler = xoops_getModuleHandler('topic', 'newbb'); -$validForums = $forumHandler->getIdsByPermission(); // get all accessible forums +///** @var Newbb\ForumHandler $forumHandler */ +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); +//$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); +$validForums = $forumHandler->getIdsByPermission(); // get all accessible forums if (is_array($forums) && count($forums) > 0) { $validForums = array_intersect($forums, $validForums); } elseif ($category > 0) { - $crit_top = new CriteriaCompo(new Criteria('cat_id', $category)); - $crit_top->add(new Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN')); + $crit_top = new \CriteriaCompo(new \Criteria('cat_id', $category)); + $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN')); $forums_top = $forumHandler->getIds($crit_top); $validForums = array_intersect($forums_top, $validForums); } @@ -73,7 +73,7 @@ $charset = 'UTF-8'; header('Content-Type:text/xml; charset=' . $charset); -$tpl = new XoopsTpl(); +$tpl = new \XoopsTpl(); $tpl->caching = 2; $tpl->cache_lifetime = $GLOBALS['xoopsModuleConfig']['rss_cachetime'] * 60; if (!empty($GLOBALS['xoopsConfig']['rewrite'])) { @@ -86,9 +86,9 @@ if (!$tpl->is_cached('db:newbb_rss.tpl', $xoopsCachedTemplateId, $compile_id)) { include_once __DIR__ . '/include/functions.time.php'; -// /** @var \NewbbXmlrssHandler $xmlrssHandler */ -// $xmlrssHandler = xoops_getModuleHandler('xmlrss', 'newbb'); - $rss = $xmlrssHandler->create(); + // /** @var Newbb\XmlrssHandler $xmlrssHandler */ + // $xmlrssHandler = Newbb\Helper::getInstance()->getHandler('Xmlrss'); + $rss = $xmlrssHandler->create(); $rss->setVarRss('channel_title', $GLOBALS['xoopsConfig']['sitename'] . ' :: ' . _MD_NEWBB_FORUM); $rss->channel_link = XOOPS_URL . '/'; @@ -167,9 +167,9 @@ } $users = newbbGetUnameFromIds(array_keys($users), $GLOBALS['xoopsModuleConfig']['show_realname']); if (count($types) > 0) { -// /** @var \NewbbTypeHandler $typeHandler */ -// $typeHandler = xoops_getModuleHandler('type', 'newbb'); - $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); + // /** @var Newbb\TypeHandler $typeHandler */ + // $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); } foreach ($rows as $topic) { diff --git a/search.php b/search.php index 897b0598..330ef1f4 100644 --- a/search.php +++ b/search.php @@ -60,7 +60,7 @@ $uid = 0; $forum = 0; $sortby = 'p.post_time'; // irmtfan remove DESC -$criteriaExtra = new CriteriaCompo(); // irmtfan new criteria +$criteriaExtra = new \CriteriaCompo(); // irmtfan new criteria $searchin = 'both'; $sort = ''; $since = Request::getInt('since', null); @@ -75,8 +75,8 @@ $search_username = trim($uname); if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { -// /** @var \NewbbOnlineHandler $onlineHandler */ -// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); + // /** @var Newbb\OnlineHandler $onlineHandler */ + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init(0); } @@ -165,10 +165,10 @@ $next_search['searchin'] = $searchin; // START irmtfan use criteria - add since and topic search if (!empty($since)) { - $criteriaExtra->add(new Criteria('p.post_time', time() - newbbGetSinceTime($since), '>='), 'OR'); + $criteriaExtra->add(new \Criteria('p.post_time', time() - newbbGetSinceTime($since), '>='), 'OR'); } if (is_numeric($topic) && !empty($topic)) { - $criteriaExtra->add(new Criteria('p.topic_id', $topic), 'OR'); + $criteriaExtra->add(new \Criteria('p.topic_id', $topic), 'OR'); } // END irmtfan use criteria - add since and topic search diff --git a/seo_url.php b/seo_url.php index 4236a830..012d8c7a 100644 --- a/seo_url.php +++ b/seo_url.php @@ -1,6 +1,8 @@ getHandler('Topic'); + $criteria = new \CriteriaCompo(new \Criteria('topic_id', $_cat_id, '=')); $fields = ['topic_title']; $ret0 = $topicsHandler->getAll($criteria, $fields, false); - return $ret; } diff --git a/topicmanager.php b/topicmanager.php index 9b7ed01c..f6acc2a7 100644 --- a/topicmanager.php +++ b/topicmanager.php @@ -1,6 +1,7 @@ getHandler('Topic'); +///** @var Newbb\ForumHandler $forumHandler */ +//$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); if (!$forum) { - /** @var \Topic $topicObject */ + /** @var Newbb\Topic $topicObject */ $topicObject = $topicHandler->get((int)$topic_id); if (is_object($topicObject)) { $forum = $topicObject->getVar('forum_id'); @@ -73,8 +74,8 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { -// /** @var \NewbbOnlineHandler $onlineHandler */ -// $onlineHandler = xoops_getModuleHandler('online', 'newbb'); + // /** @var Newbb\OnlineHandler $onlineHandler */ + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init($forum); } // irmtfan add restore to viewtopic @@ -127,9 +128,9 @@ // irmtfan full URL echo $action[$mode]['msg'] . "

    getVar('dirname') . "/viewforum.php?forum=$forum'>" . _MD_NEWBB_RETURNTOTHEFORUM . "

    " . _MD_NEWBB_RETURNFORUMINDEX . '

    '; } elseif ('restore' === $mode) { - //$topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $forums = []; - $topicsObject = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); + //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $forums = []; + $topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN')); foreach (array_keys($topicsObject) as $id) { $topicObject = $topicsObject[$id]; $topicHandler->approve($topicObject); @@ -137,8 +138,8 @@ $forums[$topicObject->getVar('forum_id')] = 1; } //irmtfan remove - no need to approve posts manually - see class/post.php approve function - $criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); - $forumsObject = $forumHandler->getAll($criteria_forum); + $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); + $forumsObject = $forumHandler->getAll($criteria_forum); foreach (array_keys($forumsObject) as $id) { $forumHandler->synchronization($forumsObject[$id]); } @@ -165,10 +166,10 @@ . _MD_NEWBB_RETURNFORUMINDEX . '

    '; } elseif ('merge' === $mode) { -// /** @var NewbbPostHandler $postHandler */ -// $postHandler = xoops_getModuleHandler('post', 'newbb'); -// /** @var \NewbbRateHandler $rateHandler */ -// $rateHandler = xoops_getModuleHandler('rate', 'newbb'); + // /** @var PostHandler $postHandler */ + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); + // /** @var Newbb\RateHandler $rateHandler */ + // $rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); foreach ($topic_id as $tid) { $topicObject = $topicHandler->get($tid); @@ -180,9 +181,9 @@ $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $tid; redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); } - $criteria_topic = new Criteria('topic_id', $tid); - $criteria = new CriteriaCompo($criteria_topic); - $criteria->add(new Criteria('pid', 0)); + $criteria_topic = new \Criteria('topic_id', $tid); + $criteria = new \CriteriaCompo($criteria_topic); + $criteria->add(new \Criteria('pid', 0)); // irmtfan OR change to this for less query?: // $postHandler->updateAll("pid", $newtopicObject->getVar("topic_last_post_id"), $criteria, true); $postHandler->updateAll('pid', $topicHandler->getTopPostId($newtopic), $criteria, true); @@ -192,7 +193,7 @@ $topic_views = $topicObject->getVar('topic_views') + $newtopicObject->getVar('topic_views'); // irmtfan better method to update topic_views in new topic - //$criteria_newtopic = new Criteria('topic_id', $newtopic); + //$criteria_newtopic = new \Criteria('topic_id', $newtopic); //$topicHandler->updateAll('topic_views', $topic_views, $criteria_newtopic, true); $newtopicObject->setVar('topic_views', $topic_views); // START irmtfan poll_module and rewrite the method @@ -245,7 +246,7 @@ . '

    '; } elseif ('move' === $mode) { if ($newforum > 0) { - $topic_id = $topic_id[0]; + $topic_id = $topic_id[0]; $topicObject = $topicHandler->get($topic_id); $topicObject->loadFilters('update'); $topicObject->setVar('forum_id', $newforum, true); @@ -259,7 +260,18 @@ $forumHandler->synchronization($forum); $forumHandler->synchronization($newforum); // irmtfan full URL - echo $action[$mode]['msg'] . "

    getVar('dirname') . "/viewtopic.php?topic_id=$topic_id&forum=$newforum'>" . _MD_NEWBB_GOTONEWFORUM . "

    " . _MD_NEWBB_RETURNFORUMINDEX . '

    '; + echo $action[$mode]['msg'] + . "

    getVar('dirname') + . "/viewtopic.php?topic_id=$topic_id&forum=$newforum'>" + . _MD_NEWBB_GOTONEWFORUM + . "

    " + . _MD_NEWBB_RETURNFORUMINDEX + . '

    '; } else { // irmtfan - issue with javascript:history.go(-1) redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_ERRORFORUM); @@ -287,11 +299,11 @@ } if ('digest' === $mode && $GLOBALS['xoopsDB']->getAffectedRows()) { $topicObject = $topicHandler->get($topic_id); -// /** @var \NewbbStatsHandler $statsHandler */ -// $statsHandler = xoops_getModuleHandler('stats', 'newbb'); + // /** @var Newbb\StatsHandler $statsHandler */ + // $statsHandler = Newbb\Helper::getInstance()->getHandler('Stats'); $statsHandler->update($topicObject->getVar('forum_id'), 'digest'); -// /** @var \NewbbUserstatsHandler $userstatsHandler */ -// $userstatsHandler = xoops_getModuleHandler('userstats', 'newbb'); + // /** @var Newbb\UserstatsHandler $userstatsHandler */ + // $userstatsHandler = Newbb\Helper::getInstance()->getHandler('Userstats'); if ($user_stat = $userstatsHandler->get($topicObject->getVar('topic_poster'))) { $z = $user_stat->getVar('user_digests') + 1; $user_stat->setVar('user_digests', (int)$z); @@ -325,14 +337,14 @@ echo '
    '; // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index eba8249e..680b19d9 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -79,7 +79,7 @@ // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); // /** @var Newbb\CategoryHandler $categoryHandler */ // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index 3739178a..d44a5639 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -75,7 +75,7 @@ echo ""; ///** @var Newbb\CategoryHandler $categoryHandler */ //$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); -$criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); +$criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all', '    '); diff --git a/admin/admin_header.php b/admin/admin_header.php index e0153b35..322193eb 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -43,7 +43,7 @@ include_once dirname(__DIR__) . '/include/config.php'; include_once dirname(__DIR__) . '/include/common.php'; -include_once dirname(__DIR__) . '/class/Helper.php'; +//include_once dirname(__DIR__) . '/class/Helper.php'; $helper = Newbb\Helper::getInstance(); //$helper = NewBB::getInstance(); /** @var Xmf\Module\Admin $adminObject */ diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index fba9736a..c710b007 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -301,7 +301,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) /** @var Newbb\CategoryHandler $categoryHandler */ $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -349,7 +349,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) xoops_cp_header(); $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -418,7 +418,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if ('category' === $op) { diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index 85ef1b2a..d24bb75c 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -170,7 +170,7 @@ } // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); @@ -242,7 +242,7 @@ case 'forum': // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); - $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if (empty($categories)) { diff --git a/admin/index.php b/admin/index.php index 436812c9..8ac1c002 100644 --- a/admin/index.php +++ b/admin/index.php @@ -32,7 +32,7 @@ use XoopsModules\Newbb; include_once __DIR__ . '/admin_header.php'; -include_once __DIR__ . '/../class/Utility.php'; +//include_once __DIR__ . '/../class/Utility.php'; include_once __DIR__ . '/../include/functions.stats.php'; $attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/'); diff --git a/admin/menu.php b/admin/menu.php index 059918c8..5acede10 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -31,7 +31,7 @@ use XoopsModules\Newbb; -require_once __DIR__ . '/../class/Helper.php'; +// require_once __DIR__ . '/../class/Helper.php'; //require_once __DIR__ . '/../include/common.php'; $helper = Newbb\Helper::getInstance(); diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index b2082597..94e27d39 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -45,7 +45,7 @@ public function __construct() $moduleDirName = basename(dirname(__DIR__)); $capsDirName = strtoupper($moduleDirName); - $config = include __DIR__ . '/../../include/config.php'; + include_once __DIR__ . '/../../include/config.php'; $config = getConfig(); $this->name = $config->name; $this->paths = $config->paths; diff --git a/class/Topic.php b/class/Topic.php index ead6a1ed..5d2864f8 100644 --- a/class/Topic.php +++ b/class/Topic.php @@ -11,6 +11,7 @@ */ use XoopsModules\Newbb; +use XoopsModules\Xoopspoll; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -97,11 +98,11 @@ public function loadOldPoll($pollModule = null) if (!empty($pollModule)) { $newbbConfig['poll_module'] = $pollModule; } - $relPath = $GLOBALS['xoops']->path('modules/' . $newbbConfig['poll_module'] . '/class/' . $newbbConfig['poll_module']); - include_once $relPath . '.php'; - include_once $relPath . 'option.php'; - include_once $relPath . 'log.php'; - include_once $relPath . 'renderer.php'; +// $relPath = $GLOBALS['xoops']->path('modules/' . $newbbConfig['poll_module'] . '/class/' . $newbbConfig['poll_module']); +// include_once $relPath . '.php'; +// include_once $relPath . 'option.php'; +// include_once $relPath . 'log.php'; +// include_once $relPath . 'renderer.php'; $classes = get_declared_classes(); foreach (array_reverse($classes) as $class) { if (strtolower($class) == $newbbConfig['poll_module']) { @@ -137,17 +138,17 @@ public function deletePoll($poll_id) // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { /** @var \XoopsPollHandler $pollHandler */ - $pollHandler = xoops_getModuleHandler('poll', $newbbConfig['poll_module']); + $pollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); if (false !== $pollHandler->deleteAll(new \Criteria('poll_id', $poll_id, '='))) { - /** @var \XoopspollOptionHandler $optionHandler */ - $optionHandler = xoops_getModuleHandler('option', $newbbConfig['poll_module']); + /** @var XoopsPoll\OptionHandler $optionHandler */ + $optionHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); $optionHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); - /** @var \XoopspollLogHandler $logHandler */ - $logHandler = xoops_getModuleHandler('log', $newbbConfig['poll_module']); + /** @var XoopsPoll\LogHandler $logHandler */ + $logHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); $logHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll_id); } - // old xoopspoll or umfrage or any clone from them + // old Xoopspoll or Umfrage or any clone from them } else { $classPoll = $this->loadOldPoll(); /** @var \XoopsPoll $poll */ @@ -191,7 +192,7 @@ public function getPoll($poll_id, $pollModule = null) } // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $pollHandler = xoops_getModuleHandler('poll', $newbbConfig['poll_module']); + $pollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); $pollObject = $pollHandler->get($poll_id); // old xoopspoll or umfrage or any clone from them } else { diff --git a/include/common.php b/include/common.php index 82b30ec0..3ace501d 100644 --- a/include/common.php +++ b/include/common.php @@ -26,8 +26,8 @@ $moduleDirName = basename(dirname(__DIR__)); -require_once __DIR__ . '/../class/Helper.php'; -require_once __DIR__ . '/../class/Utility.php'; +// require_once __DIR__ . '/../class/Helper.php'; +// require_once __DIR__ . '/../class/Utility.php'; $db = \XoopsDatabaseFactory::getDatabase(); $helper = \XoopsModules\Newbb\Helper::getInstance(); diff --git a/include/form.post.php b/include/form.post.php index e13a4dbb..fcaa988a 100644 --- a/include/form.post.php +++ b/include/form.post.php @@ -37,7 +37,7 @@ $moderateHandler = Newbb\Helper::getInstance()->getHandler('Moderate'); if (!$moderateHandler->verifyUser($moderated_id, '', $moderated_forum)) { $criteria = new \CriteriaCompo(); - $criteria->add(new criteria('uid', $moderated_id, '=')); + $criteria->add(new \Criteria('uid', $moderated_id, '=')); $criteria->setSort('mod_end'); $criteria->setOrder('DESC'); $mod = $moderateHandler->getObjects($criteria, false, false); diff --git a/include/oninstall.php b/include/oninstall.php index d322e1f4..71f5bee5 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -88,10 +88,10 @@ function xoops_module_install_newbb(\XoopsModule $module) } // --- COPY blank.png FILES --------------- - if (count($configurator->blankFiles) > 0) { + if (count($configurator->copyBlankFiles) > 0) { $file = __DIR__ . '/../assets/images/blank.png'; - foreach (array_keys($configurator->blankFiles) as $i) { - $dest = $configurator->blankFiles[$i] . '/blank.png'; + foreach (array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utilityClass::copyFile($file, $dest); } } diff --git a/include/onupdate.php b/include/onupdate.php index 9dc45c95..a0a5a51a 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -142,10 +142,10 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null } // --- COPY blank.png FILES --------------- - if (count($configurator->blankFiles) > 0) { + if (count($configurator->copyBlankFiles) > 0) { $file = __DIR__ . '/../assets/images/blank.png'; - foreach (array_keys($configurator->blankFiles) as $i) { - $dest = $configurator->blankFiles[$i] . '/blank.png'; + foreach (array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utilityClass::copyFile($file, $dest); } } diff --git a/polls.php b/polls.php index c498a30d..c206d5ec 100644 --- a/polls.php +++ b/polls.php @@ -77,7 +77,7 @@ xoops_load('request', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_loadLanguage('admin', $GLOBALS['xoopsModuleConfig']['poll_module']); /** @var \XoopspollPollHandler $xpPollHandler */ - $xpPollHandler = xoops_getModuleHandler('poll', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); /** @var \XoopsPoll $pollObject */ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist // old xoopspoll or umfrage or any clone from them @@ -348,9 +348,9 @@ // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { /** @var \XoopspollOptionHandler $xpOptHandler */ - $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); /** @var \XoopspollLogHandler $xpLogHandler */ - $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); @@ -502,7 +502,7 @@ $poll_form->addElement(new \XoopsFormLabel(_MD_NEWBB_POLL_POLLQUESTION, $question)); // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); $option_tray = $xpOptHandler->renderOptionFormTray($poll_id); // old xoopspoll or umfrage or any clone from them } else { @@ -556,7 +556,7 @@ if ('' !== $optxt) { // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); $optionObject = $xpOptHandler->create(); $optionObject->setVar('option_text', $optxt); $optionObject->setVar('poll_id', $poll_id); @@ -596,8 +596,8 @@ if ($pollModuleHandler->getVar('version') >= 140) { $status = $xpPollHandler->delete($pollObject); if (false !== $status) { - $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); - $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); $xpOptHandler->deleteByPollId($poll_id); $xpLogHandler->deleteByPollId($poll_id); } else { @@ -706,9 +706,9 @@ } if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters /** @var \XoopspollOptionHandler $xpOptHandler */ - $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); /** @var \XoopspollLogHandler $xpLogHandler */ - $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); $xpLogHandler->deleteByPollId($poll_id); $xpOptHandler->resetCountByPollId($poll_id); $xpPollHandler->updateCount($pollObject); diff --git a/search.php b/search.php index 330ef1f4..a4c69b3b 100644 --- a/search.php +++ b/search.php @@ -60,7 +60,7 @@ $uid = 0; $forum = 0; $sortby = 'p.post_time'; // irmtfan remove DESC -$criteriaExtra = new \CriteriaCompo(); // irmtfan new criteria +$criteriaExtra = new \CriteriaCompo(); // irmtfan new \Criteria $searchin = 'both'; $sort = ''; $since = Request::getInt('since', null); diff --git a/viewpost.php b/viewpost.php index 1e0ff2f4..d917f206 100644 --- a/viewpost.php +++ b/viewpost.php @@ -86,12 +86,12 @@ // START irmtfan solve the status issues and specially status = new issue switch ($status) { case 'pending': - $criteria_count->add(new \Criteria('approved', 0)); // irmtfan add new criteria - $criteria_post->add(new \Criteria('p.approved', 0)); // irmtfan add new criteria + $criteria_count->add(new \Criteria('approved', 0)); // irmtfan add new \Criteria + $criteria_post->add(new \Criteria('p.approved', 0)); // irmtfan add new \Criteria break; case 'deleted': - $criteria_count->add(new \Criteria('approved', -1)); // irmtfan add new criteria - $criteria_post->add(new \Criteria('p.approved', -1)); // irmtfan add new criteria + $criteria_count->add(new \Criteria('approved', -1)); // irmtfan add new \Criteria + $criteria_post->add(new \Criteria('p.approved', -1)); // irmtfan add new \Criteria break; case 'new': //$criteria_status_count = new \CriteriaCompo(new \Criteria("post_time", (int)($last_visit), ">"));// irmtfan commented and removed @@ -107,7 +107,7 @@ $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; if (!empty($read_uid)) { $join = ' LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('newbb_reads_topic') . ' AS r ON r.read_item = p.topic_id AND r.uid = ' . $read_uid . ' '; // irmtfan corrected add AS - $criteria_status_post = new \CriteriaCompo();// irmtfan new criteria + $criteria_status_post = new \CriteriaCompo();// irmtfan new \Criteria $criteria_status_post->add(new \Criteria('p.post_id', 'r.`post_id`', '>')); // irmtfan corrected - should use $value='r.``' to render in XOOPS/class/criteria.php $criteria_status_post->add(new \Criteria('r.read_id', null, 'IS NULL'), 'OR');// irmtfan corrected - should use "IS NULL" to render in XOOPS/class/criteria.php $criteria_post->add($criteria_status_post); // irmtfan add the status criteria to post criteria - move here @@ -118,8 +118,8 @@ //$criteria_status_post->add(new \Criteria("p.approved", 1)); // irmtfan commented and removed //$criteria_status_count =& $criteria_status_post; } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { - $criteria_count->add(new \Criteria('post_time', (int)$last_visit, '>')); // irmtfan add new criteria - $criteria_post->add(new \Criteria('p.post_time', (int)$last_visit, '>')); // irmtfan add new criteria + $criteria_count->add(new \Criteria('post_time', (int)$last_visit, '>')); // irmtfan add new \Criteria + $criteria_post->add(new \Criteria('p.post_time', (int)$last_visit, '>')); // irmtfan add new \Criteria // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) $topics = []; $topic_lastread = newbbGetCookie('LT', true); @@ -140,8 +140,8 @@ } break; default: - $criteria_count->add(new \Criteria('approved', 1)); // irmtfan add new criteria - $criteria_post->add(new \Criteria('p.approved', 1)); // irmtfan add new criteria + $criteria_count->add(new \Criteria('approved', 1)); // irmtfan add new \Criteria + $criteria_post->add(new \Criteria('p.approved', 1)); // irmtfan add new \Criteria break; } //$criteria_count->add($criteria_status_count); // irmtfan commented and removed @@ -242,7 +242,7 @@ $viewtopic_users = []; if (count($userid_array) > 0) { - require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); +// require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); $userHandler->users = $users; $userHandler->online = $online; diff --git a/viewtopic.php b/viewtopic.php index eb12b606..fabc19c9 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -32,6 +32,7 @@ use Xmf\Request; use XoopsModules\Newbb; +use XoopsModules\Xoopspoll; include_once __DIR__ . '/header.php'; $xoopsLogger->startTime('newBB_viewtopic'); @@ -498,7 +499,7 @@ $pollModuleHandler = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - xoops_load('renderer', $GLOBALS['xoopsModuleConfig']['poll_module']); +// xoops_load('renderer', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_loadLanguage('main', $GLOBALS['xoopsModuleConfig']['poll_module']); // old xoopspoll or umfrage or any clone from them } else { @@ -511,7 +512,7 @@ $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $xpollHandler = xoops_getModuleHandler('poll', $GLOBALS['xoopsModuleConfig']['poll_module']); + $xpollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); /** @var \XoopsPoll $pollObject */ $pollObject = $xpollHandler->get($poll_id); if (is_object($pollObject)) { @@ -535,12 +536,12 @@ 'back_link' => '' ]); $classRenderer = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Renderer'; - /** @var \XoopsPollRenderer $renderer */ + /** @var Xoopspoll\Renderer $renderer */ $renderer = new $classRenderer($pollObject); // check to see if user has voted, show form if not, otherwise get results for form - /** @var \XoopspollLogHandler $logHandler */ - $logHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); + /** @var Xoopspoll\LogHandler $logHandler */ + $logHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); if ($pollObject->isAllowedToVote() && (!$logHandler->hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $uid))) { $myTpl = new \XoopsTpl(); diff --git a/votepolls.php b/votepolls.php index 3a710416..a92047fc 100644 --- a/votepolls.php +++ b/votepolls.php @@ -26,6 +26,7 @@ // ------------------------------------------------------------------------ // use Xmf\Request; +use XoopsModules\Xoopspoll; include_once __DIR__ . '/header.php'; $poll_id = Request::getInt('poll_id', Request::getInt('poll_id', 0, 'POST'), 'GET'); @@ -51,10 +52,10 @@ xoops_load('constants', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_loadLanguage('main', $GLOBALS['xoopsModuleConfig']['poll_module']); - /** @var \XoopspollPollHandler $xpPollHandler */ - $xpPollHandler = xoops_getModuleHandler('poll', $GLOBALS['xoopsModuleConfig']['poll_module']); - /** @var \XoopspollLogHandler $xpLogHandler */ - $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); + /** @var Xoopspoll\PollHandler $xpPollHandler */ + $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); + /** @var Xoopspoll\LogHandler $xpLogHandler */ + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); /** @var \XoopsPoll $pollObject */ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist // old xoopspoll or umfrage or any clone from them @@ -70,7 +71,7 @@ $mail_author = false; // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; + $classConstants = Xoopspoll\Constants(); if (is_object($pollObject)) { if ($pollObject->getVar('multiple')) { $optionId = Request::getInt('option_id', 0, 'POST'); @@ -105,9 +106,9 @@ /* set anon user vote (and the time they voted) */ if (!is_object($GLOBALS['xoopsUser'])) { xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']); - /** @var XoopspollPollUtility $classPollUtility */ - $classPollUtility = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'PollUtility'; - $classPollUtility::setVoteCookie($poll_id, $voteTime, 0); + /** @var Xoopspoll\Utility $classPollUtility */ + $classPollUtility = new \Xoopspoll\Utility(); + $classXoopspoll\Utility::setVoteCookie($poll_id, $voteTime, 0); } } else { $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); From 0da534edcd5364432dbd160fd6266701b0f05998 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 15 Mar 2018 22:59:38 -0400 Subject: [PATCH 112/170] Updates --- .scrutinizer.yml | 7 +++++++ .../css/language/english/style.css | 10 +++++----- .../templates_fulldiv_opacity/newbb_index.tpl | 8 ++++---- .../themes/xbootstrap/modules/newbb/newbb_index.tpl | 2 +- admin/admin_cat_manager.php | 2 +- admin/admin_votedata.php | 8 ++++---- blocks/list_topic.php | 2 +- blocks/newbb_block.php | 2 +- blocks/newbb_block_tag.php | 2 +- class/Category.php | 2 +- class/CategoryHandler.php | 2 +- class/Common/Breadcrumb.php | 2 +- class/Common/FilesManagement.php | 6 +++--- class/Common/ServerStats.php | 2 +- class/DigestHandler.php | 2 +- class/Forum.php | 2 +- class/ForumHandler.php | 4 ++-- class/IconHandler.php | 13 +++++++------ class/Moderate.php | 2 +- class/ModerateHandler.php | 4 ++-- class/ObjectTree.php | 2 +- class/OnlineHandler.php | 6 +++--- class/PermissionCategoryHandler.php | 2 +- class/PermissionForumHandler.php | 4 ++-- class/PermissionHandler.php | 4 ++-- class/Plugin/userlog.php | 2 +- class/Post.php | 2 +- class/PostHandler.php | 8 ++++---- class/Rate.php | 2 +- class/RateHandler.php | 2 +- class/Read.php | 2 +- class/ReadHandler.php | 2 +- class/Report.php | 2 +- class/ReportHandler.php | 4 ++-- class/StatsHandler.php | 2 +- class/Text.php | 2 +- class/TextHandler.php | 2 +- class/Topic.php | 2 +- class/TopicHandler.php | 8 ++++---- class/TopicRenderer.php | 2 +- class/Tree.php | 2 +- class/Type.php | 2 +- class/TypeHandler.php | 4 ++-- class/Uploader.php | 2 +- class/User.php | 2 +- class/UserHandler.php | 2 +- class/Userstats.php | 2 +- class/UserstatsHandler.php | 2 +- class/Utility.php | 2 +- class/Xmlrss.php | 2 +- class/XmlrssHandler.php | 2 +- class/plugins/plugin.tag.php | 2 +- delete.php | 3 +-- footer.php | 2 +- header.php | 2 +- include/common.php | 8 ++++---- include/config.php | 2 +- include/form.forum.php | 2 +- include/form.post.php | 2 +- include/functions.config.php | 2 +- include/functions.forum.php | 2 +- include/functions.ini.php | 2 +- include/functions.language.php | 2 +- include/functions.php | 2 +- include/functions.read.php | 2 +- include/functions.recon.php | 2 +- include/functions.render.php | 2 +- include/functions.rpc.php | 2 +- include/functions.session.php | 2 +- include/functions.stats.php | 4 ++-- include/functions.time.php | 2 +- include/functions.topic.php | 2 +- include/functions.user.php | 2 +- include/functions.welcome.php | 2 +- include/module.php | 2 +- include/notification.inc.php | 2 +- include/onuninstall.php | 2 +- include/plugin.dist.php | 2 +- include/plugin.php | 2 +- include/search.inc.php | 2 +- include/vars.php | 2 +- index.php | 2 +- language/english/main.php | 2 +- preloads/core.php | 4 ++-- ratethread.php | 2 +- seo_url.php | 2 +- templates/css/language/english/style.css | 8 ++++---- templates/css/language/persian/style.css | 8 ++++---- templates/js/language/english/newbb_toggle.js | 3 +++ templates/newbb_index.tpl | 8 ++++---- topicmanager.php | 2 +- votepolls.php | 4 ++-- 92 files changed, 147 insertions(+), 137 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 2ece9394..c933b14f 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,3 +1,10 @@ +build: + nodes: + analysis: + project_setup: + override: true + tests: + override: [php-scrutinizer-run] checks: php: code_rating: true diff --git a/EXTRA/themes/templates_fulldiv_opacity/css/language/english/style.css b/EXTRA/themes/templates_fulldiv_opacity/css/language/english/style.css index 473d5d17..3395a9b4 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/css/language/english/style.css +++ b/EXTRA/themes/templates_fulldiv_opacity/css/language/english/style.css @@ -2,7 +2,7 @@ .even, .odd, .head { padding: 5px; - border: 1px solid black; + border: 1px solid #000000; } /* div{ @@ -574,10 +574,10 @@ span.forum_icon.forum_button { background-image: -ms-linear-gradient(top, #407DC7, #4279B8); background-image: -o-linear-gradient(top, #407DC7, #4279B8); border-width: 1px; - color: white; + color: #ffffff; padding: 4px 4px; - text-shadow: 0 1px 0 gray; - border-color: white #A1C1E6 #2B4763 #A1C1E6; + text-shadow: 0 1px 0 #808080; + border-color: #ffffff #A1C1E6 #2B4763 #A1C1E6; border-style: solid; border-radius: 5px; box-shadow: 0 1px 7px #080808; @@ -590,7 +590,7 @@ span.forum_icon.forum_button:hover { span.forum_icon.forum_button:active { box-shadow: inset 0 1px 7px #565656; - border-color: white #a1c1e6 black #a1c1e6; + border-color: #ffffff #a1c1e6 #000000 #a1c1e6; font-weight: normal; } diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl index 09857ad7..c917bd7d 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl @@ -15,18 +15,18 @@ <{$smarty.const._MD_NEWBB_TOPIC}>: <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> | <{if $wait_new_topic}>( - <{$wait_new_topic}> + <{$wait_new_topic}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_PENDING}> | <{if $delete_topic}>( - <{$delete_topic}> + <{$delete_topic}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_DELETED}>
    <{$smarty.const._MD_NEWBB_POST2}>: <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> | <{if $wait_new_post}>( - <{$wait_new_post}> + <{$wait_new_post}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_PENDING}> | <{if $delete_post}>( - <{$delete_post}> + <{$delete_post}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_DELETED}>
    diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl index 339677c7..e8be9dfa 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl @@ -38,7 +38,7 @@ - <{if $wait_new_post}>(<{$wait_new_post}>)<{/if}> <{$smarty.const._MD_NEWBB_TYPE_PENDING}> + <{if $wait_new_post}>(<{$wait_new_post}>)<{/if}> <{$smarty.const._MD_NEWBB_TYPE_PENDING}> diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index f6e3da29..48c9b2c0 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -61,7 +61,7 @@ function newCategory() function editCategory(\XoopsObject $categoryObject = null) { global $xoopsModule; - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); if (null === $categoryObject) { $categoryObject = $categoryHandler->create(); } diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index 64cb8413..05c5c573 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -42,7 +42,7 @@ $sql = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid"); $GLOBALS['xoopsDB']->query($sql); - $query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ''; + $query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; $voteresult = $GLOBALS['xoopsDB']->query($query); $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); $totalrating = 0; @@ -51,7 +51,7 @@ } $finalrating = $totalrating / $votesDB; $finalrating = number_format($finalrating, 4); - $sql = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); + $sql = sprintf('UPDATE `%s` SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); $GLOBALS['xoopsDB']->queryF($sql); redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED); @@ -67,7 +67,7 @@ $results = $GLOBALS['xoopsDB']->query($sql, 20, $start); $votes = $GLOBALS['xoopsDB']->getRowsNum($results); - $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ''; + $sql = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' '; $result2 = $GLOBALS['xoopsDB']->query($sql, 20, $start); $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); $useravgrating = 0; @@ -107,7 +107,7 @@ echo "
    '; } while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) { - $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ''; + $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' '; $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); diff --git a/blocks/list_topic.php b/blocks/list_topic.php index a368ed4e..e33d3141 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); if (defined('LIST_TOPIC_DEFINED')) { return; diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index 56db1f54..c1427a4e 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -28,7 +28,7 @@ // URL: https://xoops.org // // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); // irmtfan use full path because block maybe used outside newbb use XoopsModules\Newbb; diff --git a/blocks/newbb_block_tag.php b/blocks/newbb_block_tag.php index de6c4508..255cf319 100644 --- a/blocks/newbb_block_tag.php +++ b/blocks/newbb_block_tag.php @@ -9,7 +9,7 @@ * @package module::newbb/tag */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /**#@+ * Function to display tag cloud diff --git a/class/Category.php b/class/Category.php index 8ef83669..f70e1690 100644 --- a/class/Category.php +++ b/class/Category.php @@ -9,7 +9,7 @@ * @since 4.00 * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); class Category extends \XoopsObject { diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index c7785099..0f003b27 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class CategoryHandler diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 29d96c3d..4a062581 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -24,7 +24,7 @@ * $breadcrumb->addLink( 'bread 3', 'index3.php' ); * echo $breadcrumb->render(); */ -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); +defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined'); /** * Class Breadcrumb diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 495567b6..bc82798d 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -28,7 +28,7 @@ public static function createFolder($folder) { try { if (!file_exists($folder)) { - if (!mkdir($folder) && !is_dir($folder)) { + if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); } @@ -183,7 +183,7 @@ public static function rmove($src, $dest) } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest, 0755)) { + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { return false; } @@ -226,7 +226,7 @@ public static function rcopy($src, $dest) } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest, 0755)) { + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { return false; } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 996fbb66..78a7fbc4 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -45,7 +45,7 @@ public static function getServerStats() $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { - if ($gdlib = true === gd_info()) { + if(true === ($gdlib = gd_info())){ $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } diff --git a/class/DigestHandler.php b/class/DigestHandler.php index 8286b828..5643970d 100644 --- a/class/DigestHandler.php +++ b/class/DigestHandler.php @@ -90,7 +90,7 @@ public function getAllDigests($start = 0, $perpage = 5) $result = $this->db->query($sql, $perpage, $start); $ret = []; // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow; // return as array } diff --git a/class/Forum.php b/class/Forum.php index b1f2df58..a771f3b4 100644 --- a/class/Forum.php +++ b/class/Forum.php @@ -17,7 +17,7 @@ * @author Taiwen Jiang */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); class Forum extends \XoopsObject { diff --git a/class/ForumHandler.php b/class/ForumHandler.php index ceb33edd..ab357428 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -19,7 +19,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class ForumHandler @@ -294,7 +294,7 @@ public function getAllTopics(&$forum, $criteria = null) /** @var Newbb\TypeHandler $typeHandler */ $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); $typen = $typeHandler->getByForum($forum->getVar('forum_id')); - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { if ($myrow['topic_sticky']) { ++$sticky; } diff --git a/class/IconHandler.php b/class/IconHandler.php index 2cf78a34..c51febbf 100644 --- a/class/IconHandler.php +++ b/class/IconHandler.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Set forum image @@ -103,15 +103,16 @@ public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'ima $rel_dir = "modules/{$dirname}/{$endDir}"; // START irmtfan add default for all pathes if (empty($default)) { - $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}")); + $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" + : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" + : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}")); } else { $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH - . "/default/{$rel_dir}/{$type}" : ( - is_dir(XOOPS_THEME_PATH - . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH - . "/default/{$rel_dir}/{$default}" : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH + . "/default/{$rel_dir}/{$type}" : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" + : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") + : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH ) // XOOPS_THEME_PATH {$default} ) // XOOPS_THEME_PATH ); // $theme_path {$default} diff --git a/class/Moderate.php b/class/Moderate.php index dd0ec1f8..2c34e735 100644 --- a/class/Moderate.php +++ b/class/Moderate.php @@ -12,7 +12,7 @@ use Xmf\IPAddress; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * A handler for User moderation management diff --git a/class/ModerateHandler.php b/class/ModerateHandler.php index c4278c70..1ec78bed 100644 --- a/class/ModerateHandler.php +++ b/class/ModerateHandler.php @@ -12,7 +12,7 @@ use Xmf\IPAddress; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class ModerateHandler @@ -37,7 +37,7 @@ public function __construct(\XoopsDatabase $db) public function clearGarbage($expire = 0) { $expire = time() - (int)$expire; - $sql = sprintf('DELETE FROM %s WHERE mod_end < %u', $this->db->prefix('newbb_moderates'), $expire); + $sql = sprintf('DELETE FROM `%s` WHERE mod_end < %u', $this->db->prefix('newbb_moderates'), $expire); $this->db->queryF($sql); } diff --git a/class/ObjectTree.php b/class/ObjectTree.php index 3bf924db..42c6a418 100644 --- a/class/ObjectTree.php +++ b/class/ObjectTree.php @@ -26,7 +26,7 @@ // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); require_once $GLOBALS['xoops']->path('class/tree.php'); if (!class_exists('ObjectTree')) { diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index 3d90d30c..3f4ab029 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -13,7 +13,7 @@ use Xmf\IPAddress; use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once __DIR__ . '/../include/functions.config.php'; @@ -240,7 +240,7 @@ public function write($uid, $uname, $time, $forum_id, $ip, $topic_id) $sql .= " AND online_ip='" . $ip . "'"; } } else { - $sql = sprintf('INSERT INTO %s (online_uid, online_uname, online_updated, online_ip, online_forum, online_topic) VALUES (%u, %s, %u, %s, %u, %u)', $this->db->prefix('newbb_online'), $uid, $this->db->quote($uname), $time, $this->db->quote($ip), $forum_id, $topic_id); + $sql = sprintf('INSERT INTO `%s` (online_uid, online_uname, online_updated, online_ip, online_forum, online_topic) VALUES (%u, %s, %u, %s, %u, %u)', $this->db->prefix('newbb_online'), $uid, $this->db->quote($uname), $time, $this->db->quote($ip), $forum_id, $topic_id); } if (!$this->db->queryF($sql)) { //xoops_error($this->db->error()); @@ -310,7 +310,7 @@ public function getAll(\CriteriaElement $criteria = null) if (!$result) { return $ret; } - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow; if ($myrow['online_uid'] > 0) { $this->user_ids[] = $myrow['online_uid']; diff --git a/class/PermissionCategoryHandler.php b/class/PermissionCategoryHandler.php index 99fcfb36..06fee27d 100644 --- a/class/PermissionCategoryHandler.php +++ b/class/PermissionCategoryHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); //defined("NEWBB_HANDLER_PERMISSION") || include __DIR__.'/permission.php'; //define("NEWBB_HANDLER_PERMISSION_CATEGORY", 1); diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index b2952b7d..011aec94 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); //defined("NEWBB_HANDLER_PERMISSION") || include __DIR__.'/permission.php'; //define("NEWBB_HANDLER_PERMISSION_FORUM", 1); @@ -146,7 +146,7 @@ public function getPermissions($id = 0) // Add criteria for gpermnames $criteria->add(new \Criteria('gperm_name', '(' . $gperm_names . ')', 'IN')); // Get all permission objects in this module and for this user's groups - $userpermissions = $this->getObjects($criteria, true); + $userpermissions =& $this->getObjects($criteria, true); // Set the granted permissions to 1 foreach ($userpermissions as $gperm_id => $gperm) { diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 066acb01..568cd1dc 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); define('NEWBB_HANDLER_PERMISSION', 1); @@ -377,7 +377,7 @@ public function deleteRight($perm, $itemid, $groupid, $mid = null) $criteria->add(new \Criteria('gperm_groupid', $groupid)); $criteria->add(new \Criteria('gperm_itemid', $itemid)); $criteria->add(new \Criteria('gperm_modid', $mid)); - $permsObject = $this->getObjects($criteria); + $permsObject =& $this->getObjects($criteria); if (!empty($permsObject)) { foreach ($permsObject as $permObject) { $this->delete($permObject); diff --git a/class/Plugin/userlog.php b/class/Plugin/userlog.php index 7fe0687d..203620b6 100644 --- a/class/Plugin/userlog.php +++ b/class/Plugin/userlog.php @@ -24,7 +24,7 @@ * @author irmtfan (irmtfan@yahoo.com) * @author XOOPS Project */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); class Plugin extends Userlog\Plugin\PluginAbstract implements Userlog\Plugin\PluginInterface { diff --git a/class/Post.php b/class/Post.php index 32df613b..3ed9bd83 100644 --- a/class/Post.php +++ b/class/Post.php @@ -34,7 +34,7 @@ use Xmf\Request; use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/PostHandler.php b/class/PostHandler.php index 78ae791b..7e17ece5 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -32,7 +32,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); @@ -100,7 +100,7 @@ public function &getByLimit( . ' ORDER BY p.post_time DESC'; $result = $this->db->query($sql, $limit, 0); $ret = []; - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $post = $this->create(false); $post->assignVars($myrow); @@ -385,7 +385,7 @@ public function myDelete(Post $post, $force = false) } /* delete pending post directly */ } else { - $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts'), $post->getVar('post_id')); + $sql = sprintf('DELETE FROM `%s` WHERE post_id = %u', $this->db->prefix('newbb_posts'), $post->getVar('post_id')); if (!$result = $this->db->queryF($sql)) { $post->setErrors('delete post error: ' . $sql); @@ -527,7 +527,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join //xoops_error($this->db->error()); return $ret; } - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $post = $this->create(false); $post->assignVars($myrow); $ret[$myrow['post_id']] = $post; diff --git a/class/Rate.php b/class/Rate.php index d39bf04e..8af07b26 100644 --- a/class/Rate.php +++ b/class/Rate.php @@ -30,7 +30,7 @@ // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/RateHandler.php b/class/RateHandler.php index 0f4f1acb..580fcb30 100644 --- a/class/RateHandler.php +++ b/class/RateHandler.php @@ -30,7 +30,7 @@ // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/Read.php b/class/Read.php index 0c8d0ed8..b78ba93a 100644 --- a/class/Read.php +++ b/class/Read.php @@ -30,7 +30,7 @@ // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/ReadHandler.php b/class/ReadHandler.php index fb7fb42e..95486eca 100644 --- a/class/ReadHandler.php +++ b/class/ReadHandler.php @@ -30,7 +30,7 @@ // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/Report.php b/class/Report.php index 944fc496..3915a586 100644 --- a/class/Report.php +++ b/class/Report.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/ReportHandler.php b/class/ReportHandler.php index 8668ff0c..055bec44 100644 --- a/class/ReportHandler.php +++ b/class/ReportHandler.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); @@ -102,7 +102,7 @@ public function getAllReports( $result = $this->db->query($sql, $perpage, $start); $ret = []; //$reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow; // return as array } diff --git a/class/StatsHandler.php b/class/StatsHandler.php index 3a41ec33..df0eb635 100644 --- a/class/StatsHandler.php +++ b/class/StatsHandler.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; diff --git a/class/Text.php b/class/Text.php index b4accb6a..0a61580d 100644 --- a/class/Text.php +++ b/class/Text.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/TextHandler.php b/class/TextHandler.php index 53ee7e58..3356f048 100644 --- a/class/TextHandler.php +++ b/class/TextHandler.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/Topic.php b/class/Topic.php index 5d2864f8..44b47e4a 100644 --- a/class/Topic.php +++ b/class/Topic.php @@ -13,7 +13,7 @@ use XoopsModules\Newbb; use XoopsModules\Xoopspoll; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/TopicHandler.php b/class/TopicHandler.php index 668bebe9..955d893a 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); @@ -288,7 +288,7 @@ public function &getAllPosts(&$topic, $order = 'ASC', $perpage = 10, &$start, $p return $ret; } $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $post = $postHandler->create(false); $post->assignVars($myrow); $ret[$myrow['post_id']] = $post; @@ -363,7 +363,7 @@ public function &getAllPosters(&$topic, $isApproved = true) return []; } $ret = []; - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow['uid']; } @@ -387,7 +387,7 @@ public function delete(\XoopsObject $topic, $force = true) $postHandler->delete($postObject, false, $force); $newbbConfig = newbbLoadConfig(); - /** @var \TagTagHandler $tagHandler */ + /** @var \XoopsModules\Tag\Handler $tagHandler */ if (!empty($newbbConfig['do_tag']) && $tagHandler = @xoops_getModuleHandler('tag', 'tag', true)) { $tagHandler->updateByItem([], $topic_id, 'newbb'); } diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 390025e6..46e2b426 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -13,7 +13,7 @@ use Xmf\Request; use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Topic Renderer diff --git a/class/Tree.php b/class/Tree.php index 00d89571..534f5bcc 100644 --- a/class/Tree.php +++ b/class/Tree.php @@ -30,7 +30,7 @@ // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once $GLOBALS['xoops']->path('class/xoopstree.php'); /** diff --git a/class/Type.php b/class/Type.php index e8fa6c72..46758885 100644 --- a/class/Type.php +++ b/class/Type.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Type diff --git a/class/TypeHandler.php b/class/TypeHandler.php index cc7f31c4..b2e672fb 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Type object handler class. @@ -55,7 +55,7 @@ public function getByForum($forums = null) return $ret; } - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[$myrow[$this->keyName]] = [ 'type_id' => $myrow[$this->keyName], 'type_order' => $myrow['type_order'], diff --git a/class/Uploader.php b/class/Uploader.php index 7343d33a..e2c65de7 100644 --- a/class/Uploader.php +++ b/class/Uploader.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once $GLOBALS['xoops']->path('class/uploader.php'); diff --git a/class/User.php b/class/User.php index d944416e..1ed072f8 100644 --- a/class/User.php +++ b/class/User.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/UserHandler.php b/class/UserHandler.php index 256f7d2b..1047ca78 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/Userstats.php b/class/Userstats.php index 86171ace..5b677f8e 100644 --- a/class/Userstats.php +++ b/class/Userstats.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/UserstatsHandler.php b/class/UserstatsHandler.php index e1d8429d..3deefb2f 100644 --- a/class/UserstatsHandler.php +++ b/class/UserstatsHandler.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); diff --git a/class/Utility.php b/class/Utility.php index e0799efc..be71e0eb 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -65,7 +65,7 @@ public function fieldExists($fieldname, $table) public function addField($field, $table) { global $xoopsDB; - $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field;"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field"); return $result; } diff --git a/class/Xmlrss.php b/class/Xmlrss.php index c8a51a55..7933ed82 100644 --- a/class/Xmlrss.php +++ b/class/Xmlrss.php @@ -10,7 +10,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); //load_functions('locale'); diff --git a/class/XmlrssHandler.php b/class/XmlrssHandler.php index 13e3105d..7711861b 100644 --- a/class/XmlrssHandler.php +++ b/class/XmlrssHandler.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); //load_functions('locale'); diff --git a/class/plugins/plugin.tag.php b/class/plugins/plugin.tag.php index 17523583..4100ff73 100644 --- a/class/plugins/plugin.tag.php +++ b/class/plugins/plugin.tag.php @@ -13,7 +13,7 @@ use XoopsModules\Newbb; use XoopsModules\Tag; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Get item fields: diff --git a/delete.php b/delete.php index 09523a17..681aea5e 100644 --- a/delete.php +++ b/delete.php @@ -60,8 +60,7 @@ /** @var Post $postObject */ $postObject = $postHandler->get($post_id); $topic_status = $topic->getVar('topic_status'); -if (($postObject->checkIdentity() || $isAdmin) - && $topicHandler->getPermission($topic->getVar('forum_id'), $topic_status, 'delete')) { +if (($postObject->checkIdentity() || $isAdmin) && $topicHandler->getPermission($topic->getVar('forum_id'), $topic_status, 'delete')) { } else { redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=$topic_id&pid=$pid&forum=$forum", 2, _MD_NEWBB_DELNOTALLOWED); } diff --git a/footer.php b/footer.php index d427936f..48b1f61a 100644 --- a/footer.php +++ b/footer.php @@ -18,7 +18,7 @@ * @author The Persian Xoops Support Site */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); global $xoTheme; diff --git a/header.php b/header.php index f39845b3..ec9544ca 100644 --- a/header.php +++ b/header.php @@ -14,7 +14,7 @@ include dirname(dirname(__DIR__)) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** @var \XoopsLogger $xoopsLogger */ $xoopsLogger->startTime('newBB_Header'); // irmtfan assign newbb dirname then replace all. include xoops header.php (now commented and removed) diff --git a/include/common.php b/include/common.php index 3ace501d..fd3738d8 100644 --- a/include/common.php +++ b/include/common.php @@ -22,14 +22,14 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); $moduleDirName = basename(dirname(__DIR__)); // require_once __DIR__ . '/../class/Helper.php'; -// require_once __DIR__ . '/../class/Utility.php'; +require_once __DIR__ . '/../class/Utility.php'; -$db = \XoopsDatabaseFactory::getDatabase(); +$db = \XoopsDatabaseFactory::getDatabaseConnection(); $helper = \XoopsModules\Newbb\Helper::getInstance(); /** @var \XoopsModules\Newbb\Utility $utility */ @@ -66,7 +66,7 @@ $publisherIsAdmin = Newbb\Utility::userIsAdmin(); } -//$db = \XoopsDatabaseFactory::getDatabase(); +//$db = \XoopsDatabaseFactory::getDatabaseConnection(); /** @var Newbb\CategoryHandler $categoryHandler */ $categoryHandler = $helper->getHandler('category'); diff --git a/include/config.php b/include/config.php index f34ac6aa..963cb83f 100644 --- a/include/config.php +++ b/include/config.php @@ -19,7 +19,7 @@ * @author XOOPS Development Team - ( https://xoops.org ) */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once __DIR__ . '/common.php'; $moduleDirName = basename(dirname(__DIR__)); diff --git a/include/form.forum.php b/include/form.forum.php index 8f622020..6a002bc0 100644 --- a/include/form.forum.php +++ b/include/form.forum.php @@ -16,7 +16,7 @@ * @author Taiwen Jiang */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); if (!is_object($forumObject)) { xoops_error('forum object IS null'); diff --git a/include/form.post.php b/include/form.post.php index fcaa988a..75bbe79e 100644 --- a/include/form.post.php +++ b/include/form.post.php @@ -19,7 +19,7 @@ use Xmf\Request; use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); diff --git a/include/functions.config.php b/include/functions.config.php index c3db8220..23c98cec 100644 --- a/include/functions.config.php +++ b/include/functions.config.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); use XoopsModules\Newbb; diff --git a/include/functions.forum.php b/include/functions.forum.php index 876181bc..b461fac3 100644 --- a/include/functions.forum.php +++ b/include/functions.forum.php @@ -11,7 +11,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_FORUM_LOADED', true); diff --git a/include/functions.ini.php b/include/functions.ini.php index b62b6691..72f70e74 100644 --- a/include/functions.ini.php +++ b/include/functions.ini.php @@ -28,7 +28,7 @@ // URL: https://xoops.org // // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); if (defined('NEWBB_FUNCTIONS_INI')) { return; diff --git a/include/functions.language.php b/include/functions.language.php index b0dd37b6..c9f816a2 100644 --- a/include/functions.language.php +++ b/include/functions.language.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_LANGUAGE_LOADED', true); diff --git a/include/functions.php b/include/functions.php index 3724dde3..a42c2b49 100644 --- a/include/functions.php +++ b/include/functions.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_LOADED', true); diff --git a/include/functions.read.php b/include/functions.read.php index 553a2c9b..9ff595b5 100644 --- a/include/functions.read.php +++ b/include/functions.read.php @@ -11,7 +11,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_READ_LOADED', true); diff --git a/include/functions.recon.php b/include/functions.recon.php index ea222c78..dab529b2 100644 --- a/include/functions.recon.php +++ b/include/functions.recon.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RECON_LOADED', true); diff --git a/include/functions.render.php b/include/functions.render.php index 2d7ec1ea..90d041d1 100644 --- a/include/functions.render.php +++ b/include/functions.render.php @@ -11,7 +11,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RENDER_LOADED', true); diff --git a/include/functions.rpc.php b/include/functions.rpc.php index c71a9f51..018fd311 100644 --- a/include/functions.rpc.php +++ b/include/functions.rpc.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RPC_LOADED', true); diff --git a/include/functions.session.php b/include/functions.session.php index a3ddc2b7..1c26b14b 100644 --- a/include/functions.session.php +++ b/include/functions.session.php @@ -11,7 +11,7 @@ use Xmf\Request; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_SESSION_LOADED', true); diff --git a/include/functions.stats.php b/include/functions.stats.php index 1e2189dc..c9022bd0 100644 --- a/include/functions.stats.php +++ b/include/functions.stats.php @@ -11,7 +11,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_STATS_LOADED', true); @@ -102,7 +102,7 @@ function getTotalPosts($id = 0, $type = 'all') */ function getTotalViews() { - $sql = 'SELECT sum(topic_views) FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ''; + $sql = 'SELECT sum(topic_views) FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' '; if (!$result = $GLOBALS['xoopsDB']->query($sql)) { return null; } diff --git a/include/functions.time.php b/include/functions.time.php index 480108c1..ebe6fc09 100644 --- a/include/functions.time.php +++ b/include/functions.time.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_TIME_LOADED', true); diff --git a/include/functions.topic.php b/include/functions.topic.php index 291b93cf..0b9eda43 100644 --- a/include/functions.topic.php +++ b/include/functions.topic.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_TOPIC_LOADED', true); diff --git a/include/functions.user.php b/include/functions.user.php index c8b1ec22..907b4605 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -18,7 +18,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Function to a list of user names associated with their user IDs diff --git a/include/functions.welcome.php b/include/functions.welcome.php index dac502f9..eace4ef0 100644 --- a/include/functions.welcome.php +++ b/include/functions.welcome.php @@ -11,7 +11,7 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_WELCOME_LOADED', true); diff --git a/include/module.php b/include/module.php index 809ced72..9012976b 100644 --- a/include/module.php +++ b/include/module.php @@ -28,7 +28,7 @@ // URL: https://xoops.org // // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); use XoopsModules\Newbb; diff --git a/include/notification.inc.php b/include/notification.inc.php index 99abca7d..d1d16fef 100644 --- a/include/notification.inc.php +++ b/include/notification.inc.php @@ -28,7 +28,7 @@ // URL: https://xoops.org // // Project: Article Project // // ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.php'); if (!defined('NEWBB_NOTIFY_ITEMINFO')) { define('NEWBB_NOTIFY_ITEMINFO', 1); diff --git a/include/onuninstall.php b/include/onuninstall.php index 5f634c18..ba2c56f4 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -56,7 +56,7 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) if ($dirInfo->isDir()) { // The directory exists so delete it if (false === $utilityClass::rrmdir($old_dir)) { - $module->setErrors(sprintf(_AM_XXXXX_ERROR_BAD_DEL_PATH, $old_dir)); + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); $success = false; } } diff --git a/include/plugin.dist.php b/include/plugin.dist.php index 7ecb7227..d1853bd8 100644 --- a/include/plugin.dist.php +++ b/include/plugin.dist.php @@ -12,7 +12,7 @@ */ xoops_loadLanguage('main', 'newbb'); -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /* some static xoopsModuleConfig */ $customConfig = []; diff --git a/include/plugin.php b/include/plugin.php index e22a2303..92433fc0 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -11,7 +11,7 @@ xoops_loadLanguage('main', 'newbb'); -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); /* some static xoopsModuleConfig */ $customConfig = []; diff --git a/include/search.inc.php b/include/search.inc.php index d99f1306..b7be6c91 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -12,7 +12,7 @@ use XoopsModules\Newbb; // completely rewrite by irmtfan - remove hardcode database access, solve order issues, add post_text & topic_id, add highlight and reduce queries -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** diff --git a/include/vars.php b/include/vars.php index 4f152d0a..a8267b23 100644 --- a/include/vars.php +++ b/include/vars.php @@ -9,7 +9,7 @@ * @package module::newbb */ -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); include_once __DIR__ . '/functions.session.php'; diff --git a/index.php b/index.php index 683c2676..df925d5f 100644 --- a/index.php +++ b/index.php @@ -187,7 +187,7 @@ } $cat_sponsor = []; - @list($url, $title) = array_map('trim', explode(" ", $onecat['cat_url'], 2)); + @list($url, $title) = array_map('trim', explode(' ', $onecat['cat_url'], 2)); if ('' === $title) { $title = $url; } diff --git a/language/english/main.php b/language/english/main.php index 28872f34..52b29061 100644 --- a/language/english/main.php +++ b/language/english/main.php @@ -523,7 +523,7 @@ define('_MD_NEWBB_SHOWSEARCH', 'Show results:'); define('_MD_NEWBB_SEARCHPOSTTEXT', 'Posts text'); define('_MD_NEWBB_SELECT_STARTLAG', 'Start lag of selected text'); -define('_MD_NEWBB_SELECT_STARTLAG_DESC', 'SELECT text FROM X characters BEFORE the FIRST keyword'); +define('_MD_NEWBB_SELECT_STARTLAG_DESC', 'Select text from X characters before the first keyword'); define('_MD_NEWBB_SELECT_LENGTH', 'Length of selected text'); define('_MD_NEWBB_SELECT_HTML', 'Strip all html from result?'); define('_MD_NEWBB_SELECT_EXCLUDE', 'Exclude these tags:'); diff --git a/preloads/core.php b/preloads/core.php index d4cdaf28..f3637572 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -15,10 +15,10 @@ * @author XOOPS Project */ -defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** - * Class UserlogCorePreload + * Class NewbbCorePreload */ class NewbbCorePreload extends XoopsPreloadItem { diff --git a/ratethread.php b/ratethread.php index e61b0fe4..ace9b14e 100644 --- a/ratethread.php +++ b/ratethread.php @@ -89,7 +89,7 @@ $ratingid = $rateHandler->insert($rateObject); -$query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ''; +$query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; $voteresult = $GLOBALS['xoopsDB']->query($query); $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); $totalrating = 0; diff --git a/seo_url.php b/seo_url.php index 48bb4684..6970f7fa 100644 --- a/seo_url.php +++ b/seo_url.php @@ -1,5 +1,5 @@ : <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> | <{if $wait_new_topic}>( - <{$wait_new_topic}> + <{$wait_new_topic}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_PENDING}> | <{if $delete_topic}>( - <{$delete_topic}> + <{$delete_topic}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_DELETED}>
    <{$smarty.const._MD_NEWBB_POST2}>: <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> | <{if $wait_new_post}>( - <{$wait_new_post}> + <{$wait_new_post}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_PENDING}> | <{if $delete_post}>( - <{$delete_post}> + <{$delete_post}> ) <{/if}><{$smarty.const._MD_NEWBB_TYPE_DELETED}>
    diff --git a/topicmanager.php b/topicmanager.php index f6acc2a7..afc6ea3f 100644 --- a/topicmanager.php +++ b/topicmanager.php @@ -290,7 +290,7 @@ } if (!empty($action[$mode]['sql'])) { - $sql = sprintf('UPDATE %s SET ' . $action[$mode]['sql'] . ' WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $topic_id); + $sql = sprintf('UPDATE `%s` SET ' . $action[$mode]['sql'] . ' WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $topic_id); if (!$r = $GLOBALS['xoopsDB']->query($sql)) { redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&topic_id=$topic_id&order=$order&viewmode=$viewmode", 2, _MD_NEWBB_ERROR_BACK . '
    sql: ' . $sql); } diff --git a/votepolls.php b/votepolls.php index a92047fc..0e9258c0 100644 --- a/votepolls.php +++ b/votepolls.php @@ -107,8 +107,8 @@ if (!is_object($GLOBALS['xoopsUser'])) { xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']); /** @var Xoopspoll\Utility $classPollUtility */ - $classPollUtility = new \Xoopspoll\Utility(); - $classXoopspoll\Utility::setVoteCookie($poll_id, $voteTime, 0); + $classPollUtility = new Xoopspoll\Utility(); + $classPollUtility::setVoteCookie($poll_id, $voteTime, 0); } } else { $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); From 337061176c73dbd19e0d9f1742d6eaddebc3a8f2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 15 Mar 2018 22:59:57 -0400 Subject: [PATCH 113/170] Yoda --- admin/admin_groupmod.php | 2 +- blocks/list_topic.php | 4 ++-- class/TopicRenderer.php | 4 ++-- docs/changelog.txt | 5 +++++ include/functions.user.php | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index d44a5639..d1fc941c 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -55,7 +55,7 @@ } } } - if ($fforum == -1) { // alle Foren + if (-1 == $fforum) { // alle Foren $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "'"; } else { $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_forums') . " SET forum_moderator='" . serialize($fuser) . "' WHERE forum_id =" . $fforum; diff --git a/blocks/list_topic.php b/blocks/list_topic.php index e33d3141..3beb0be3 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -119,7 +119,7 @@ function newbb_list_topic_edit($options) // topic_poster element $topicPosterRadioEle = new \XoopsFormRadio(_MB_NEWBB_AUTHOR, 'options[1]', $options[1]); $topicPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); - $topicPosterRadioEle->addOption(($options[1] !== -1) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users + $topicPosterRadioEle->addOption((-1 !== $options[1]) ? $options[1] : 0, _SELECT); // if no user in selection box it select uid=0 anon users $topicPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[1]'); el.disabled=(this.id == 'options[1]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" $topicPosterSelectEle = new \XoopsFormSelectUser(_MB_NEWBB_AUTHOR, 'options[1]', true, explode(',', $options[1]), 5, true);// show $limit = 200 users when no user is selected; $topicPosterEle = new \XoopsFormLabel(_MB_NEWBB_AUTHOR, $topicPosterRadioEle->render() . $topicPosterSelectEle->render()); @@ -127,7 +127,7 @@ function newbb_list_topic_edit($options) // lastposter element $lastPosterRadioEle = new \XoopsFormRadio(_MD_NEWBB_POSTER, 'options[2]', $options[2]); $lastPosterRadioEle->addOption(-1, _MD_NEWBB_TOTALUSER); - $lastPosterRadioEle->addOption(($options[2] !== -1) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 + $lastPosterRadioEle->addOption((-1 !== $options[2]) ? $options[2] : 0, _SELECT); // if no user in selection box it select uid=1 $lastPosterRadioEle->setExtra("onchange=\"var el=document.getElementById('options[2]'); el.disabled=(this.id == 'options[2]1'); if (!el.value) {el.value= this.value}\""); // if user dont select any option it select "all" $lastPosterSelectEle = new \XoopsFormSelectUser(_MD_NEWBB_POSTER, 'options[2]', true, explode(',', $options[2]), 5, true);// show $limit = 200 users when no user is selected; $lastPosterEle = new \XoopsFormLabel(_MD_NEWBB_POSTER, $lastPosterRadioEle->render() . $lastPosterSelectEle->render()); diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 46e2b426..50297198 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -363,13 +363,13 @@ public function parseVar($var, $val) break; case 'uid': // irmtfan add multi topic poster - if ($val !== -1) { + if (-1 !== $val) { $val = implode(',', array_map('intval', explode(',', $val))); $this->query['where'][] = 't.topic_poster IN ( ' . $val . ' )'; } break; case 'lastposter': // irmtfan add multi lastposter - if ($val !== -1) { + if (-1 !== $val) { $val = implode(',', array_map('intval', explode(',', $val))); $this->query['where'][] = 'p.uid IN ( ' . $val . ' )'; } diff --git a/docs/changelog.txt b/docs/changelog.txt index 3c218d0b..065b8e0c 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -9,6 +9,11 @@ - Short syntax in array literals (mamba) - added forumDescription to viewforum.php (aerograf/mamba) - namespaces, autoload (mamba) +- RGB to HEX (mamba) +- changed exit() to die() (mamba) +- assignment in Condition (mamba) + + 4.33 RC 13 (XOOPS 2.5.8) (NOT RELEASED) =========================================== diff --git a/include/functions.user.php b/include/functions.user.php index 907b4605..fbfedfcd 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -59,7 +59,7 @@ function newbbIsAdministrator($user = -1, $mid = 0) { global $xoopsModule; - if (is_numeric($user) && $user == -1) { + if (is_numeric($user) && -1 == $user) { $user = $GLOBALS['xoopsUser']; } if (!is_object($user) && (int)$user < 1) { @@ -112,7 +112,7 @@ function newbbIsModerator(&$forum, $user = -1) $forum = $forumHandler->get($forum_id); } - if (is_numeric($user) && $user == -1) { + if (is_numeric($user) && -1 == $user) { $user = $GLOBALS['xoopsUser']; } if (!is_object($user) && (int)$user < 1) { From 893763086c19e73934874c0abf0b610dafe22c66 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 15 Mar 2018 23:21:10 -0400 Subject: [PATCH 114/170] assignment in Condition --- include/functions.user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/functions.user.php b/include/functions.user.php index fbfedfcd..dd72a682 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -224,7 +224,7 @@ function newbbIsForumModerators(array $uid = [], $mid = 0) $sql = 'SELECT forum_moderator FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_forums'); if ($result = $GLOBALS['xoopsDB']->query($sql)) { - while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { if (empty($myrow['forum_moderator'])) { continue; } From c046c548c73ffc9a36fc4b43a99d4339c41edd4a Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 16 Mar 2018 00:55:29 -0400 Subject: [PATCH 115/170] assignment in condition --- admin/admin_cat_manager.php | 2 +- admin/admin_forum_prune.php | 4 ++-- blocks/newbb_block.php | 8 ++++---- class/DigestHandler.php | 2 +- class/ForumHandler.php | 2 +- class/PermissionForumHandler.php | 2 +- class/StatsHandler.php | 2 +- class/TopicRenderer.php | 2 +- class/UserHandler.php | 2 +- class/UserstatsHandler.php | 2 +- include/functions.user.php | 2 +- rss.php | 2 +- search.php | 2 +- seo_url.php | 4 ++-- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index 48c9b2c0..c900f0e3 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -161,7 +161,7 @@ function editCategory(\XoopsObject $categoryObject = null) if (!$categoryHandler->insert($categoryObject)) { $message = _AM_NEWBB_DATABASEERROR; } - if ($cat_id = $categoryObject->getVar('cat_id') && $cat_isNew) { + if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) { $categoryHandler->applyPermissionTemplate($categoryObject); } redirect_header('admin_cat_manager.php', 2, $message); diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 7dabdadf..769740df 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -87,7 +87,7 @@ return _MD_NEWBB_ERROR; } // Dave_L code - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $topics[] = $row['topic_id']; } $topics_number = count($topics); @@ -102,7 +102,7 @@ return _MD_NEWBB_ERROR; } // Dave_L code - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $posts[] = $row['post_id']; } $posts_number = count($posts); diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index c1427a4e..71e67e85 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -146,7 +146,7 @@ function b_newbb_show($options) $author = []; $types = []; - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $rows[] = $row; $author[$row['uid']] = 1; if ($row['type_id'] > 0) { @@ -332,7 +332,7 @@ function b_newbb_topic_show($options) $rows = []; $author = []; $types = []; - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $rows[] = $row; $author[$row['topic_poster']] = 1; if ($row['type_id'] > 0) { @@ -495,7 +495,7 @@ function b_newbb_post_show($options) $block['disp_mode'] = ('text' === $options[0]) ? 3 : $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; $rows = []; $author = []; - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $rows[] = $row; $author[$row['uid']] = 1; } @@ -655,7 +655,7 @@ function b_newbb_author_show($options) return $block; } $author = []; - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $author[$row['author']]['count'] = $row['count']; } if (count($author) < 1) { diff --git a/class/DigestHandler.php b/class/DigestHandler.php index 5643970d..3c818359 100644 --- a/class/DigestHandler.php +++ b/class/DigestHandler.php @@ -232,7 +232,7 @@ public function buildDigest(\XoopsObject $digest) } $rows = []; $users = []; - while ($row = $this->db->fetchArray($result)) { + while (false !== ($row = $this->db->fetchArray($result))) { $users[$row['uid']] = 1; $rows[] = $row; } diff --git a/class/ForumHandler.php b/class/ForumHandler.php index ab357428..52558a1a 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -782,7 +782,7 @@ public function getSubforumStats($passedSubForums = null) } $forum_stats = []; - while ($row = $this->db->fetchArray($result)) { + while (false !== ($row = $this->db->fetchArray($result))) { $forum_stats[$row['id']] = ['topics' => $row['topics'], 'posts' => $row['posts']]; } diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index 011aec94..0c78eff6 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -146,7 +146,7 @@ public function getPermissions($id = 0) // Add criteria for gpermnames $criteria->add(new \Criteria('gperm_name', '(' . $gperm_names . ')', 'IN')); // Get all permission objects in this module and for this user's groups - $userpermissions =& $this->getObjects($criteria, true); + $userpermissions = $this->getObjects($criteria, true); // Set the granted permissions to 1 foreach ($userpermissions as $gperm_id => $gperm) { diff --git a/class/StatsHandler.php b/class/StatsHandler.php index df0eb635..9ecdc142 100644 --- a/class/StatsHandler.php +++ b/class/StatsHandler.php @@ -161,7 +161,7 @@ public function getStats(array $ids, array $types = [], array $periods = []) . (empty($_periods) ? '' : 'AND stats_period IN (' . implode(', ', $_periods) . ')'); $result = $this->db->query($sql); - while ($row = $this->db->fetchArray($result)) { + while (false !== ($row = $this->db->fetchArray($result))) { $ret[(string)$row['stats_id']][$this->param['type'][$row['stats_type']]][$this->param['period'][$row['stats_period']]] = $row['stats_value']; } diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 50297198..3e3fbbb5 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -933,7 +933,7 @@ public function renderTopics(\Smarty $xoopsTpl = null) $forums = []; $anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); - while ($myrow = $this->handler->db->fetchArray($result)) { + while (false !== ($myrow = $this->handler->db->fetchArray($result))) { if ($myrow['topic_sticky']) { ++$sticky; } diff --git a/class/UserHandler.php b/class/UserHandler.php index 1047ca78..84327660 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -83,7 +83,7 @@ public function loadUserDigest() $sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . ' WHERE uid IN( ' . implode(', ', array_keys($this->users)) . ')'; $result = $GLOBALS['xoopsDB']->query($sql); - while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { $this->userlist[$myrow['uid']]['digests'] = (int)$myrow['user_digests']; } } diff --git a/class/UserstatsHandler.php b/class/UserstatsHandler.php index 3deefb2f..4d52c343 100644 --- a/class/UserstatsHandler.php +++ b/class/UserstatsHandler.php @@ -65,7 +65,7 @@ public function get($id = null, $fields = null) //get($id) if (!$result = $this->db->query($sql)) { return $object; } - while ($row = $this->db->fetchArray($result)) { + while (false !== ($row = $this->db->fetchArray($result))) { $object->assignVars($row); } */ diff --git a/include/functions.user.php b/include/functions.user.php index dd72a682..16239918 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -198,7 +198,7 @@ function newbbIsModuleAdministrators(array $uid = []) . ' GROUP BY l.uid'; if ($result = $GLOBALS['xoopsDB']->query($sql)) { - while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { if (!empty($myrow['count'])) { $module_administrators[] = $myrow['uid']; } diff --git a/rss.php b/rss.php index c85a9b32..cd1b2fc7 100644 --- a/rss.php +++ b/rss.php @@ -153,7 +153,7 @@ } $rows = []; $types = []; - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $users[$row['uid']] = 1; if ($row['type_id'] > 0) { $types[$row['type_id']] = 1; diff --git a/search.php b/search.php index a4c69b3b..d3d102af 100644 --- a/search.php +++ b/search.php @@ -122,7 +122,7 @@ redirect_header(XOOPS_URL . '/search.php', 1, _MD_NEWBB_ERROROCCURED); } $uid = []; - while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { $uid[] = $row['uid']; } } else { diff --git a/seo_url.php b/seo_url.php index 6970f7fa..a0df6092 100644 --- a/seo_url.php +++ b/seo_url.php @@ -193,7 +193,7 @@ function forum_seo_cat($_cat_id) $query = 'SELECT cat_id, cat_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_categories'); $result = $GLOBALS['xoopsDB']->query($query); $_ret = []; - while ($res = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($res = $GLOBALS['xoopsDB']->fetchArray($result))) { $_ret[$res['cat_id']] = forum_seo_title($res['cat_title']); } XoopsCache::write($key, $_ret); @@ -221,7 +221,7 @@ function forum_seo_forum($_cat_id) $query = 'SELECT forum_id, forum_name FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_forums'); $result = $GLOBALS['xoopsDB']->query($query); $_ret = []; - while ($res = $GLOBALS['xoopsDB']->fetchArray($result)) { + while (false !== ($res = $GLOBALS['xoopsDB']->fetchArray($result))) { $_ret[$res['forum_id']] = forum_seo_title($res['forum_name']); } XoopsCache::write($key, $_ret); From 7cb2f35abc5fe6492e7afcc396078a6bd159e222 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 24 Jan 2018 23:37:42 -0500 Subject: [PATCH 116/170] fixes --- class/CategoryHandler.php | 4 +- class/Common/Configurator.php | 3 +- include/common.php | 113 +++++++++++++++++++++++++--------- include/config.php | 64 ++++++++++++++++++- language/english/admin.php | 4 +- language/english/modinfo.php | 2 + votepolls.php | 2 +- 7 files changed, 154 insertions(+), 38 deletions(-) diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index 0f003b27..0bc59b53 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -64,7 +64,7 @@ public function &getByPermission($permission = 'access', $tags = null, $asObject */ public function insert(\XoopsObject $category, $force = true) { - $className = 'Category'; + $className = Category::class; if (!($category instanceof $className)) { return false; } @@ -84,7 +84,7 @@ public function insert(\XoopsObject $category, $force = true) */ public function delete(\XoopsObject $category, $force = false)//delete(Category $category) { - $className = 'Category'; + $className = Category::class; if (!($category instanceof $className)) { return false; } diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 94e27d39..f85b68f8 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -45,7 +45,8 @@ public function __construct() $moduleDirName = basename(dirname(__DIR__)); $capsDirName = strtoupper($moduleDirName); - include_once __DIR__ . '/../../include/config.php'; $config = getConfig(); + include_once __DIR__ . '/../../include/config.php'; + $config = getConfig(); $this->name = $config->name; $this->paths = $config->paths; diff --git a/include/common.php b/include/common.php index fd3738d8..e7288221 100644 --- a/include/common.php +++ b/include/common.php @@ -22,51 +22,68 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || die('Restricted access'); +// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); +include __DIR__ . '/../preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); +$moduleDirNameUpper = strtoupper($moduleDirName); //$capsDirName -// require_once __DIR__ . '/../class/Helper.php'; -require_once __DIR__ . '/../class/Utility.php'; - -$db = \XoopsDatabaseFactory::getDatabaseConnection(); -$helper = \XoopsModules\Newbb\Helper::getInstance(); - -/** @var \XoopsModules\Newbb\Utility $utility */ +/** @var \XoopsDatabase $db */ +/** @var Newbb\Helper $helper */ +/** @var Newbb\Utility $utility */ +$db = \XoopsDatabaseFactory::getDatabaseConnection(); +$helper = Newbb\Helper::getInstance(); $utility = new Newbb\Utility(); +//$configurator = new Newbb\common\Configurator(); -define('NEWBB_DIRNAME', basename(dirname(__DIR__))); -define('NEWBB_URL', XOOPS_URL . '/modules/' . NEWBB_DIRNAME); -define('NEWBB_PATH', XOOPS_ROOT_PATH . '/modules/' . NEWBB_DIRNAME); -define('NEWBB_IMAGES_URL', NEWBB_URL . '/assets/images'); -define('NEWBB_ADMIN_URL', NEWBB_URL . '/admin'); -define('NEWBB_ADMIN_PATH', NEWBB_PATH . '/admin/index.php'); -define('NEWBB_ROOT_PATH', $GLOBALS['xoops']->path('modules/' . NEWBB_DIRNAME)); -define('NEWBB_AUTHOR_LOGOIMG', NEWBB_URL . '/assets/images/logo_module.png'); -define('NEWBB_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash -define('NEWBB_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash +$helper->loadLanguage('common'); -// module information -$mod_copyright = " - XOOPS Project"; +//define('NEWBB_DIRNAME', basename(dirname(__DIR__))); +//define('NEWBB_URL', XOOPS_URL . '/modules/' . NEWBB_DIRNAME); +//define('NEWBB_PATH', XOOPS_ROOT_PATH . '/modules/' . NEWBB_DIRNAME); +//define('NEWBB_IMAGES_URL', NEWBB_URL . '/assets/images'); +//define('NEWBB_ADMIN_URL', NEWBB_URL . '/admin'); +//define('NEWBB_ADMIN_PATH', NEWBB_PATH . '/admin/index.php'); +//define('NEWBB_ROOT_PATH', $GLOBALS['xoops']->path('modules/' . NEWBB_DIRNAME)); +//define('NEWBB_AUTHOR_LOGOIMG', NEWBB_URL . '/assets/images/logo_module.png'); +//define('NEWBB_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash +//define('NEWBB_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash + +if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { + define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); + define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); + define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); + define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); + define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); + define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); + define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); + define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash + define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash + define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); +} -$helper->loadLanguage('common'); -require_once NEWBB_ROOT_PATH . '/class/Helper.php'; +// module information +//$mod_copyright = " +// XOOPS Project"; +// //$debug = false; //$helper = Newbb\Helper::getInstance($debug); //This is needed or it will not work in blocks. -global $newbbIsAdmin; +//global $newbbIsAdmin; // Load only if module is installed -if (is_object($helper->getModule())) { - // Find if the user is admin of the module - $publisherIsAdmin = Newbb\Utility::userIsAdmin(); -} +//if (is_object($helper->getModule())) { +// // Find if the user is admin of the module +// $publisherIsAdmin = Newbb\Utility::userIsAdmin(); +//} -//$db = \XoopsDatabaseFactory::getDatabaseConnection(); +//$db = \XoopsDatabaseFactory::getDatabase(); /** @var Newbb\CategoryHandler $categoryHandler */ $categoryHandler = $helper->getHandler('category'); @@ -108,3 +125,41 @@ $userstatsHandler = $helper->getHandler('userstats'); /** @var Newbb\XmlrssHandler $xmlrssHandler */ $xmlrssHandler = $helper->getHandler('xmlrss'); + + +$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); +//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); + +$icons = [ + 'edit' => " . _EDIT . ", + 'delete' => "" . _DELETE . "", + 'clone' => "" . _CLONE . "", + 'preview' => "" . _PREVIEW . "", + 'print' => "" . _CLONE . "", + 'pdf' => "" . _CLONE . "", + 'add' => "" . _ADD . "", + '0' => "" . 0 . "", + '1' => "" . 1 . "", +]; + +$debug = false; + +// MyTextSanitizer object +$myts = \MyTextSanitizer::getInstance(); + +if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { + require_once $GLOBALS['xoops']->path('class/template.php'); + $GLOBALS['xoopsTpl'] = new \XoopsTpl(); +} + +$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); +// Local icons path +if (is_object($helper->getModule())) { + $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); + $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); + + $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); + $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); +} diff --git a/include/config.php b/include/config.php index 963cb83f..00aad5a0 100644 --- a/include/config.php +++ b/include/config.php @@ -28,6 +28,64 @@ NEWBB_UPLOAD_PATH . '/thumbs' ]; -//$copyFiles = array( -// NEWBB_UPLOAD_PATH, -// NEWBB_UPLOAD_PATH . '/thumbs'); +function getConfig() +{ + $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = strtoupper($moduleDirName); + return (object)[ + 'name' => strtoupper($moduleDirName) . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + constant($moduleDirNameUpper . '_UPLOAD_PATH'), + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs', + + //XOOPS_UPLOAD_PATH . '/flags' + ], + 'copyBlankFiles' => [ + constant($moduleDirNameUpper . '_UPLOAD_PATH'), + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs', + //XOOPS_UPLOAD_PATH . '/flags' + ], + + 'copyTestFolders' => [ + // constant($moduleDirNameUpper . '_UPLOAD_PATH'), + //[ + // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', + // constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images', + //] + ], + + 'templateFolders' => [ + '/templates/', + '/templates/blocks/', + '/templates/admin/' + + ], + 'oldFiles' => [ + '/class/request.php', + '/class/registry.php', + '/class/utilities.php', + '/class/util.php', + '/include/constants.php', + '/include/functions.php', + '/ajaxrating.txt', + ], + 'oldFolders' => [ + '/images', + '/css', + '/js', + '/tcpdf', + '/images', + ], + 'modCopyright' => " + \'XOOPS', + ]; +} + diff --git a/language/english/admin.php b/language/english/admin.php index a1e8f40d..0e72487e 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -340,8 +340,8 @@ 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.
    It is recommended to create separate groups of moderators, for more convenient management of moderators.
    You can also assign specific users to moderators when creating a forum.'); define('_AM_NEWBB_HELP_SYNC_TAB', 'If you notice a problem with the message dates, the appearance of blank messages, etc. Here you can synchronize and correct forum data and topics'); -define('_MI_NEWBB_FORUM_DESC_LENGTH', 'Forum Description Length'); -define('_MI_NEWBB_FORUM_DESC_LENGTH_DESC', 'The Forum description shown on the main page will be truncated to # of characters you set here. A full description will be shown on the forum page.'); +define('_AM_NEWBB_FORUM_DESC_LENGTH', 'Forum Description Length'); +define('_AM_NEWBB_FORUM_DESC_LENGTH_DESC', 'The Forum description shown on the main page will be truncated to # of characters you set here. A full description will be shown on the forum page.'); //PDF define('_AM_NEWBB_INDEX_PDF_PAGE', 'If you want to use the PDF creation function, use instruction.'); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 8b93defd..2c443e09 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -337,3 +337,5 @@ define('_MI_NEWBB_WELCOMEFORUM_DESC_MESSAGE', ' Since the forum works in real time, it is impossible to verify or confirm the accuracy of the information placed here. Remember that the forum administration does not actively monitor and is not responsible for the messages sent. Administration does not guarantee the accuracy, completeness and correctness of the content of any message. Any communication reflects the author\'s point of view, which does not necessarily coincide with the point of view of the administration of the forum or organization associated with this forum. Any user who finds a provocative message can inform the forum administration about this. In this case, the message will be reviewed and, if the administration deems it necessary, deleted. However, do not forget that this process takes time and treat it with understanding. '); +define('_MI_NEWBB_FORUM_DESC_LENGTH', 'Forum Description Length'); +define('_MI_NEWBB_FORUM_DESC_LENGTH_DESC', 'The Forum description shown on the main page will be truncated to # of characters you set here. A full description will be shown on the forum page.'); diff --git a/votepolls.php b/votepolls.php index 0e9258c0..223d2f77 100644 --- a/votepolls.php +++ b/votepolls.php @@ -56,7 +56,7 @@ $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); /** @var Xoopspoll\LogHandler $xpLogHandler */ $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); - /** @var \XoopsPoll $pollObject */ + /** @var Xoopspoll $pollObject */ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist // old xoopspoll or umfrage or any clone from them } else { From cca2c2569c32a50f9512f08fe57c159add08bb63 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 20 Mar 2018 03:04:04 -0400 Subject: [PATCH 117/170] updates --- action.post.php | 10 +++--- action.topic.php | 6 ++-- admin/about.php | 4 +-- admin/admin_cat_manager.php | 8 ++--- admin/admin_digest.php | 8 ++--- admin/admin_forum_manager.php | 10 +++--- admin/admin_forum_prune.php | 14 ++++---- admin/admin_forum_reorder.php | 6 ++-- admin/admin_groupmod.php | 6 ++-- admin/admin_header.php | 16 ++++----- admin/admin_permissions.php | 12 +++---- admin/admin_report.php | 10 +++--- admin/admin_synchronization.php | 8 ++--- admin/admin_type_manager.php | 6 ++-- admin/admin_votedata.php | 12 +++---- admin/index.php | 8 ++--- admin/migrate.php | 4 +-- blocks/list_topic.php | 18 +++++------ blocks/newbb_block.php | 54 +++++++++++++++---------------- blocks/newbb_block_tag.php | 8 ++--- class/Common/Configurator.php | 2 +- class/Common/ServerStats.php | 2 +- class/DigestHandler.php | 4 +-- class/ForumHandler.php | 6 ++-- class/Helper.php | 2 +- class/IconHandler.php | 3 +- class/OnlineHandler.php | 14 ++++---- class/PermissionForumHandler.php | 2 +- class/Post.php | 10 +++--- class/PostHandler.php | 4 +-- class/ReadForum.php | 2 +- class/ReadForumHandler.php | 2 +- class/Readtopic.php | 2 +- class/ReadtopicHandler.php | 2 +- class/ReportHandler.php | 2 +- class/StatsHandler.php | 4 +-- class/Topic.php | 12 +++---- class/TopicHandler.php | 15 +++++---- class/TopicRenderer.php | 18 +++++------ class/Tree.php | 2 +- class/TypeHandler.php | 2 +- class/Uploader.php | 2 +- class/User.php | 2 +- class/UserHandler.php | 6 ++-- class/Xmlrss.php | 2 +- delete.php | 2 +- digest.php | 2 +- dl_attachment.php | 2 +- edit.php | 6 ++-- footer.php | 2 +- header.php | 12 +++---- include/config.php | 3 +- include/form.forum.php | 2 +- include/form.post.php | 2 +- include/functions.config.php | 4 +-- include/functions.ini.php | 4 +-- include/functions.language.php | 6 ++-- include/functions.php | 12 +++---- include/functions.session.php | 2 +- include/functions.stats.php | 2 +- include/functions.time.php | 2 +- include/functions.welcome.inc.php | 2 +- include/functions.welcome.php | 2 +- include/module.php | 6 ++-- include/search.inc.php | 2 +- include/vars.php | 4 +-- index.php | 10 +++--- language/english/admin.php | 36 ++++++++++++++------- language/english/modinfo.php | 12 ++++--- list.topic.php | 12 +++---- makepdf.php | 4 +-- moderate.php | 8 ++--- newtopic.php | 6 ++-- polls.php | 53 +++++++++++++++++------------- post.php | 12 +++---- print.php | 2 +- ratethread.php | 4 +-- reply.php | 6 ++-- report.php | 2 +- rss.php | 10 +++--- search.php | 14 ++++---- seo.php | 2 +- topicmanager.php | 6 ++-- update_type.php | 2 +- view.tag.php | 2 +- viewforum.php | 18 +++++------ viewpost.php | 12 +++---- viewtopic.php | 16 ++++----- votepolls.php | 2 +- 89 files changed, 356 insertions(+), 328 deletions(-) diff --git a/action.post.php b/action.post.php index 57000eda..a805cf41 100644 --- a/action.post.php +++ b/action.post.php @@ -12,7 +12,7 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $topic_id = Request::getInt('topic_id', 0, 'POST'); $post_id = Request::getArray('post_id', Request::getArray('post_id', [], 'POST'), 'GET'); @@ -103,7 +103,7 @@ $criteria_forum = new \Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN'); $forum_list = $forumHandler->getList($criteria_forum); - include_once __DIR__ . '/include/notification.inc.php'; + require_once __DIR__ . '/include/notification.inc.php'; /** @var \XoopsNotificationHandler $notificationHandler */ $notificationHandler = xoops_getHandler('notification'); foreach ($post_id as $post) { @@ -174,9 +174,9 @@ $criteria = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); $criteria->add(new \Criteria('pid', $post_id)); $postHandler->updateAll('pid', $pid, $criteria, true); - /* split a post and its children posts */ + /* split a post and its children posts */ } elseif (2 === $mode) { - include_once $GLOBALS['xoops']->path('class/xoopstree.php'); + require_once $GLOBALS['xoops']->path('class/xoopstree.php'); $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix('newbb_posts'), 'post_id', 'pid'); $posts = $mytree->getAllChildId($post_id); if (count($posts) > 0) { @@ -228,5 +228,5 @@ redirect_header(XOOPS_URL . "/modules/newbb/viewpost.php?uid=$uid", 2, _MD_NEWBB_DBUPDATED); } // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/action.topic.php b/action.topic.php index f14e0a56..f6346b45 100644 --- a/action.topic.php +++ b/action.topic.php @@ -12,7 +12,7 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $forum_id = Request::getInt('forum_id', 0, 'POST'); $topic_id = Request::getArray('topic_id', null, 'POST'); @@ -75,7 +75,7 @@ break; } - include_once __DIR__ . '/include/notification.inc.php'; + require_once __DIR__ . '/include/notification.inc.php'; /** @var \XoopsNotificationHandler $notificationHandler */ $notificationHandler = xoops_getHandler('notification'); foreach (array_keys($topicsObject) as $id) { @@ -191,5 +191,5 @@ redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum={$forum_id}", 2, _MD_NEWBB_DBUPDATED); } // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/admin/about.php b/admin/about.php index 2f114c82..72189992 100644 --- a/admin/about.php +++ b/admin/about.php @@ -29,11 +29,11 @@ // Project: XOOPS Project // // ------------------------------------------------------------------------- // -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); \Xmf\Module\Admin::setPaypal('PBQZ7D6LT6UBC'); $adminObject->displayAbout(false); -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index c900f0e3..fb3f55db 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -32,8 +32,8 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/admin_header.php'; -include_once __DIR__ . '/../include/functions.render.php'; +require_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/../include/functions.render.php'; xoops_cp_header(); @@ -66,7 +66,7 @@ function editCategory(\XoopsObject $categoryObject = null) $categoryObject = $categoryHandler->create(); } $groups_cat_access = null; - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); if (!$categoryObject->isNew()) { $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); @@ -213,4 +213,4 @@ function editCategory(\XoopsObject $categoryObject = null) $cacheHelper = Newbb\Utility::cleanCache(); //$cacheHelper->delete('permission_category'); -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_digest.php b/admin/admin_digest.php index 69ac6865..557e4548 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -31,8 +31,8 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('class/pagenav.php'); +require_once __DIR__ . '/admin_header.php'; +require_once $GLOBALS['xoops']->path('class/pagenav.php'); $op = Request::getCmd('op', Request::getCmd('op', 'default', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"default"); $item = Request::getString('op', Request::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process"); @@ -77,7 +77,7 @@ break; default: - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $limit = 5; $adminObject->displayNavigation(basename(__FILE__)); @@ -128,4 +128,4 @@ break; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index d1ccd7ee..64aee416 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -32,11 +32,11 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; include $GLOBALS['xoops']->path('class/xoopstree.php'); -include_once $GLOBALS['xoops']->path('class/pagenav.php'); -include_once __DIR__ . '/../include/functions.forum.php'; -include_once __DIR__ . '/../include/functions.render.php'; +require_once $GLOBALS['xoops']->path('class/pagenav.php'); +require_once __DIR__ . '/../include/functions.forum.php'; +require_once __DIR__ . '/../include/functions.render.php'; $cacheHelper = Newbb\Utility::cleanCache(); @@ -313,4 +313,4 @@ echo ''; break; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 769740df..e920735a 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -27,8 +27,8 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once __DIR__ . '/admin_header.php'; +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); @@ -125,7 +125,7 @@ // ARCHIVING POSTS if (1 == $archive) { $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); - while (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result)) { + while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) { $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); } } @@ -179,8 +179,8 @@ ]); $sform->addElement($days); // START irmtfan remove hardcode db access - include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files - include_once __DIR__ . '/../include/functions.forum.php'; + require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files + require_once __DIR__ . '/../include/functions.forum.php'; $forumSelMulti = ""; // disable all categories $forumSelBox = ''; @@ -198,7 +198,7 @@ do { $checkbox->addOption($myrow['forum_id'], $myrow['forum_name']); $radiobox->addOption($myrow['forum_id'], $myrow['forum_name']); - } while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)); + } while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))); } else { echo "NO FORUMS"; } @@ -259,4 +259,4 @@ echo ' ' . _MI_NEWBB_ADMENU_PRUNE . ' '; echo _AM_NEWBB_HELP_PRUNE_TAB; echo ''; -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index 680b19d9..33eec6b7 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -31,7 +31,7 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $cat_orders = Request::getArray('cat_orders', null, 'POST'); $orders = Request::getArray('orders', null, 'POST'); @@ -55,7 +55,7 @@ } redirect_header('admin_forum_reorder.php', 1, _AM_NEWBB_BOARDREORDER); } else { - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $orders = []; $cat_orders = []; $forum = []; @@ -119,4 +119,4 @@ echo _AM_NEWBB_HELP_ORDER_TAB; echo ''; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index d1fc941c..db651e8a 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -31,9 +31,9 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $adminObject->displayNavigation(basename(__FILE__)); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); @@ -105,4 +105,4 @@ echo ' ' . _MI_NEWBB_ADMENU_GROUPMOD . ' '; echo _AM_NEWBB_HELP_GROUPMOD_TAB; echo ''; -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_header.php b/admin/admin_header.php index 322193eb..188f9bb6 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -34,16 +34,16 @@ //include $GLOBALS['xoops']->path('include/cp_header.php'); include __DIR__ . '/../../../include/cp_header.php'; -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'); -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php'); -include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php'); -//include_once $GLOBALS['xoops']->path('Frameworks/art/functions.php'); -//include_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php'); +require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'); +require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php'); +require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php'); +//require_once $GLOBALS['xoops']->path('Frameworks/art/functions.php'); +//require_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php'); -include_once dirname(__DIR__) . '/include/config.php'; -include_once dirname(__DIR__) . '/include/common.php'; +require_once dirname(__DIR__) . '/include/config.php'; +require_once dirname(__DIR__) . '/include/common.php'; -//include_once dirname(__DIR__) . '/class/Helper.php'; +//require_once dirname(__DIR__) . '/class/Helper.php'; $helper = Newbb\Helper::getInstance(); //$helper = NewBB::getInstance(); /** @var Xmf\Module\Admin $adminObject */ diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index c710b007..baf2ac09 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -32,10 +32,10 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once __DIR__ . '/admin_header.php'; +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); if (!class_exists('XoopsGroupPermForm')) { - include_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); + require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); } /** @@ -266,7 +266,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $ret .= ''; $ret .= '
  • '; + $ret_ele .= '
    '; $ii = 0; $option_ids = []; foreach ($perms as $perm) { @@ -254,10 +254,10 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $ret_ele .= ''; $elements[] = $ret_ele; } - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormHidden('action', 'template_save')); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); + $tray = new \XoopsFormElementTray(''); + $tray->addElement(new \XoopsFormHidden('action', 'template_save')); + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); $ret = '
    ' . _AM_NEWBB_PERM_TEMPLATE . '
    ' . _AM_NEWBB_PERM_TEMPLATE_DESC . '
    '; $ret .= "\n
    \n"; $ret .= implode("\n", $elements); @@ -288,8 +288,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_APPLY, 'actionform', 'admin_permissions.php', 'get'); - $op_select = new XoopsFormSelect('', 'action'); + $opform = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_APPLY, 'actionform', 'admin_permissions.php', 'get'); + $op_select = new \XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ 'no' => _SELECT, @@ -299,14 +299,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $opform->addElement($op_select); $opform->display(); - /** @var \NewbbCategoryHandler $categoryHandler */ - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + /** @var Newbb\CategoryHandler $categoryHandler */ + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); - /** @var \NewbbForumHandler $forumHandler */ - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var Newbb\ForumHandler $forumHandler */ + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c - 1000] = ' '; @@ -317,14 +317,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } unset($forums, $categories); - $fmform = new XoopsThemeForm(_AM_NEWBB_PERM_TEMPLATEAPP, 'fmform', 'admin_permissions.php', 'post', true); - $fm_select = new XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); + $fmform = new \XoopsThemeForm(_AM_NEWBB_PERM_TEMPLATEAPP, 'fmform', 'admin_permissions.php', 'post', true); + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); $fm_select->addOptionArray($fm_options); $fmform->addElement($fm_select); - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormHidden('action', 'apply_save')); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); + $tray = new \XoopsFormElementTray(''); + $tray->addElement(new \XoopsFormHidden('action', 'apply_save')); + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); $fmform->addElement($tray); $fmform->display(); include_once __DIR__ . '/admin_footer.php'; @@ -348,8 +348,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) default: xoops_cp_header(); - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -357,7 +357,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (0 === count($forums)) { @@ -366,8 +366,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP, 'actionform', 'admin_permissions.php', 'get'); - $op_select = new XoopsFormSelect('', 'action'); + $opform = new \XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP, 'actionform', 'admin_permissions.php', 'get'); + $op_select = new \XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ 'no' => _SELECT, @@ -406,8 +406,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) setcookie('op', isset($op_keys[$key + 1]) ? $op_keys[$key + 1] : ''); } - $opform = new XoopsSimpleForm('', 'opform', 'admin_permissions.php', 'get'); - $op_select = new XoopsFormSelect('', 'op', $op); + $opform = new \XoopsSimpleForm('', 'opform', 'admin_permissions.php', 'get'); + $op_select = new \XoopsFormSelect('', 'op', $op); $op_select->setExtra('onchange="document.forms.opform.submit()"'); $op_select->addOptionArray($op_options); $opform->addElement($op_select); @@ -417,8 +417,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); - $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); if ('category' === $op) { @@ -427,7 +427,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } unset($categories); } else { - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (count($forums) > 0) { foreach (array_keys($forums) as $c) { @@ -447,8 +447,8 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) echo _AM_NEWBB_HELP_PERMISSION_TAB; echo ''; // Since we can not control the permission update, a trick is used here - /** @var \NewbbPermissionHandler $permissionHandler */ - $permissionHandler = xoops_getModuleHandler('permission', 'newbb'); + /** var Newbb\PermissionHandler $permissionHandler */ + $permissionHandler = Newbb\Helper::getInstance()->getHandler('Permission'); $permissionHandler->createPermData(); $cacheHelper = Newbb\Utility::cleanCache(); //$cacheHelper->delete('permission'); diff --git a/admin/admin_report.php b/admin/admin_report.php index e8840b23..00ea8794 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -41,8 +41,8 @@ $op = Request::hasVar('submit', 'POST') ? 'save' : $op; $op = Request::hasVar('delete', 'POST') ? 'delete' : $op; -///** @var \NewbbReportHandler $reportHandler */ -//$reportHandler = xoops_getModuleHandler('report', 'newbb'); +///** @var Newbb\ReportHandler $reportHandler */ +//$reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); xoops_cp_header(); @@ -106,7 +106,7 @@ } $limit = 10; - + $adminObject->displayNavigation(basename(__FILE__)); //if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN); @@ -121,7 +121,7 @@ echo "'; echo "'; echo ''; - + $reports = $reportHandler->getAllReports('report_id', 'ASC', $limit, $start, $process_result); foreach ($reports as $report) { $post_link = '" . $reporter_name . '
    ' : ''; + $reporter = !empty($uid) ? "" . $reporter_name . '
    ' : ''; echo "'; echo ''; echo ""; @@ -162,22 +162,22 @@ } $buttons = ''; if ('processed' !== $item) { - $submit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); + $submit = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); $buttons .= $submit->render() . ' '; } - $delete = new XoopsFormButton('', 'delete', _DELETE, 'submit'); + $delete = new \XoopsFormButton('', 'delete', _DELETE, 'submit'); $buttons .= $delete->render() . ' '; - $cancel = new XoopsFormButton('', 'cancel', _CANCEL, 'reset'); + $cancel = new \XoopsFormButton('', 'cancel', _CANCEL, 'reset'); $buttons .= $cancel->render(); echo ""; - $hidden = new XoopsFormHidden('start', $start); + $hidden = new \XoopsFormHidden('start', $start); echo $hidden->render(); - $hidden = new XoopsFormHidden('item', $item); + $hidden = new \XoopsFormHidden('item', $item); echo $hidden->render() . ''; echo '
    " . _AM_NEWBB_REPORTTITLE . '" . $extra . '
    " . $reporter . $report['reporter_ip'] . '
    {$buttons}
    '; echo '
    '; - $nav = new XoopsPageNav($reportHandler->getCount(new Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); + $nav = new \XoopsPageNav($reportHandler->getCount(new \Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); echo $nav->renderNav(4); echo '
    '; echo ' ' . _MI_NEWBB_ADMENU_REPORT . ' '; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index 61eedf39..373c3932 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -32,9 +32,9 @@ // irmtfan rewrite topic sync case 'topic': $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); -// /** @var \NewbbTopicHandler $topicHandler */ -// $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $criteria = new Criteria('approved', 1); + // /** @var Newbb\TopicHandler $topicHandler */ + // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); + $criteria = new \Criteria('approved', 1); if ($start >= ($count = $topicHandler->getCount($criteria))) { break; } diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index edce7381..85ef1b2a 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -47,8 +47,8 @@ $op = ''; } -///** @var \NewbbTypeHandler $typeHandler */ -//$typeHandler = xoops_getModuleHandler('type', 'newbb'); +///** @var Newbb\TypeHandler $typeHandler */ +//$typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); switch ($op) { @@ -85,7 +85,7 @@ } } if (count($type_del) > 0) { - $type_list = $typeHandler->getList(new Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); } else { redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); @@ -169,12 +169,12 @@ redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); } -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); - $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); + $criteriaCategory = new \CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); - $categories = $categoryHandler->getList($criteriaCategory); -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); + $categories = $categoryHandler->getList($criteriaCategory); + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; foreach (array_keys($forums[$c]) as $f) { @@ -182,14 +182,14 @@ } } unset($forums, $categories); - $fmform = new XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); - $fm_select = new XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); + $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); $fm_select->addOptionArray($fm_options); $fmform->addElement($fm_select); - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormHidden('op', 'save_apply')); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); + $tray = new \XoopsFormElementTray(''); + $tray->addElement(new \XoopsFormHidden('op', 'save_apply')); + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); $fmform->addElement($tray); //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); @@ -207,7 +207,7 @@ echo "
    " . _AM_NEWBB_TYPE_DESCRIPTION . '
    ' . $form_colorpicker->render() . '
    ' . $form_colorpicker->render() . '
    ' . _MD_NEWBB_MOVETOPICTO . ''; $box = '
    " . _AM_NEWBB_VOTE_NOVOTES . '
    '; echo $ret; - include_once __DIR__ . '/admin_footer.php'; + require_once __DIR__ . '/admin_footer.php'; break; case 'template_save': @@ -327,7 +327,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); $fmform->addElement($tray); $fmform->display(); - include_once __DIR__ . '/admin_footer.php'; + require_once __DIR__ . '/admin_footer.php'; break; case 'apply_save': @@ -452,6 +452,6 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $permissionHandler->createPermData(); $cacheHelper = Newbb\Utility::cleanCache(); //$cacheHelper->delete('permission'); - include_once __DIR__ . '/admin_footer.php'; + require_once __DIR__ . '/admin_footer.php'; break; } diff --git a/admin/admin_report.php b/admin/admin_report.php index 00ea8794..48046347 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -31,8 +31,8 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('class/pagenav.php'); +require_once __DIR__ . '/admin_header.php'; +require_once $GLOBALS['xoops']->path('class/pagenav.php'); $op = Request::getCmd('op', 'default'); $item = Request::getString('item', 'process'); @@ -90,8 +90,8 @@ case 'default': default: - include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); - include_once __DIR__ . '/../include/functions.user.php'; + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + require_once __DIR__ . '/../include/functions.user.php'; if ('processed' !== $item) { $process_result = 0; @@ -185,4 +185,4 @@ echo ''; break; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index 373c3932..a27c3269 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -12,9 +12,9 @@ use Xmf\Request; // irmtfan - TODO - should be changed completly with Newbb new function newbbSynchronization -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -include_once __DIR__ . '/../include/functions.recon.php'; +require_once __DIR__ . '/../include/functions.recon.php'; $form = ''; $form .= $adminObject->displayNavigation(basename(__FILE__)); @@ -65,7 +65,7 @@ } $sql = ' SELECT uid' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('users'); $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start); - while (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result)) { + while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) { // irmtfan approved=1 AND $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}"; $ret = $GLOBALS['xoopsDB']->query($sql); @@ -172,4 +172,4 @@ echo ' ' . _MI_NEWBB_ADMENU_SYNC . ' '; echo _AM_NEWBB_HELP_SYNC_TAB; echo ''; -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index d24bb75c..e9123a0e 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -12,10 +12,10 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); echo '
    '; -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $adminObject->displayNavigation(basename(__FILE__)); /* @@ -433,4 +433,4 @@ break; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index 05c5c573..5366f2ca 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -31,7 +31,7 @@ use Xmf\Request; -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $op = $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:""); @@ -46,7 +46,7 @@ $voteresult = $GLOBALS['xoopsDB']->query($query); $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); $totalrating = 0; - while (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult)) { + while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) { $totalrating += $rating; } $finalrating = $totalrating / $votesDB; @@ -72,7 +72,7 @@ $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); $useravgrating = 0; - while (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2)) { + while (false !== (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2))) { // $useravgrating = $useravgrating + $rating2; $useravgrating += $rating2; } @@ -106,7 +106,7 @@ if (0 == $votes) { echo "
    " . _AM_NEWBB_VOTE_NOVOTES . '
    '; echo '
    '; //Include page navigation - include_once $GLOBALS['xoops']->path('class/pagenav.php'); + require_once $GLOBALS['xoops']->path('class/pagenav.php'); $page = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : ''; $pagenav = new \XoopsPageNav($page, 20, $start, 'start'); echo '
    ' . $page . '' . $pagenav->renderImageNav(4) . '
    '; @@ -136,4 +136,4 @@ echo ''; break; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/index.php b/admin/index.php index 8ac1c002..57c82689 100644 --- a/admin/index.php +++ b/admin/index.php @@ -31,9 +31,9 @@ use XoopsModules\Newbb; -include_once __DIR__ . '/admin_header.php'; -//include_once __DIR__ . '/../class/Utility.php'; -include_once __DIR__ . '/../include/functions.stats.php'; +require_once __DIR__ . '/admin_header.php'; +//require_once __DIR__ . '/../class/Utility.php'; +require_once __DIR__ . '/../include/functions.stats.php'; $attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/'); $thumb_path = $attach_path . 'thumbs/'; @@ -160,7 +160,7 @@ function newbb_getImageLibs() $adminObject->displayNavigation(basename(__FILE__)); $adminObject->displayIndex(); -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; $cacheHelper = Newbb\Utility::cleanCache(); //$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); diff --git a/admin/migrate.php b/admin/migrate.php index 1f1847e4..17aef801 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -32,7 +32,7 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); @@ -92,4 +92,4 @@ echo "
    $message
    "; -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/blocks/list_topic.php b/blocks/list_topic.php index 3beb0be3..1162cd64 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -19,17 +19,17 @@ } define('LIST_TOPIC_DEFINED', true); -//include_once dirname(__DIR__) . '/include/functions.ini.php'; +//require_once dirname(__DIR__) . '/include/functions.ini.php'; require_once dirname(__DIR__) . '/class/TopicRenderer.php'; -include_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function +require_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function xoops_loadLanguage('main', 'newbb'); -include_once __DIR__ . '/../include/functions.config.php'; -include_once __DIR__ . '/../include/functions.time.php'; -include_once __DIR__ . '/../include/functions.session.php'; -include_once __DIR__ . '/../include/functions.render.php'; -include_once __DIR__ . '/../include/functions.user.php'; +require_once __DIR__ . '/../include/functions.config.php'; +require_once __DIR__ . '/../include/functions.time.php'; +require_once __DIR__ . '/../include/functions.session.php'; +require_once __DIR__ . '/../include/functions.render.php'; +require_once __DIR__ . '/../include/functions.user.php'; // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) @@ -100,7 +100,7 @@ function newbb_list_topic_show($options) */ function newbb_list_topic_edit($options) { - // include_once $GLOBALS['xoops']->path('class/blockform.php'); //reserve for 2.6 + // require_once $GLOBALS['xoops']->path('class/blockform.php'); //reserve for 2.6 xoops_load('XoopsFormLoader'); // $form = new \XoopsBlockForm(); //reserve for 2.6 $form = new \XoopsThemeForm(_MB_NEWBB_DISPLAYMODE_DESC, 'list_topic', ''); @@ -180,7 +180,7 @@ function newbb_list_topic_edit($options) // forum element $optionsForum = explode(',', $options[12]); - include_once __DIR__ . '/../include/functions.forum.php'; + require_once __DIR__ . '/../include/functions.forum.php'; /** @var Newbb\ForumHandler $forumHandler */ $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index 71e67e85..69157567 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -33,7 +33,7 @@ use XoopsModules\Newbb; -include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); if (defined('NEWBB_BLOCK_DEFINED')) { return; @@ -66,8 +66,8 @@ function b_newbb_show($options) global $accessForums; global $xoopsLogger; - include_once __DIR__ . '/../include/functions.config.php'; - include_once __DIR__ . '/../include/functions.time.php'; + require_once __DIR__ . '/../include/functions.config.php'; + require_once __DIR__ . '/../include/functions.time.php'; $myts = \MyTextSanitizer::getInstance(); $block = []; @@ -75,7 +75,7 @@ function b_newbb_show($options) $order = ''; $extraCriteria = ''; if (!empty($options[2])) { - //include_once __DIR__ . '/../include/functions.time.php'; + //require_once __DIR__ . '/../include/functions.time.php'; $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); } switch ($options[0]) { @@ -107,7 +107,7 @@ function b_newbb_show($options) $newbbConfig = newbbLoadConfig(); if (!empty($newbbConfig['do_rewrite'])) { - include_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); + require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); } else { if (!defined('SEO_MODULE_NAME')) { define('SEO_MODULE_NAME', 'modules/newbb'); @@ -158,7 +158,7 @@ function b_newbb_show($options) return $block; } - include_once __DIR__ . '/../include/functions.user.php'; + require_once __DIR__ . '/../include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); if (count($types) > 0) { @@ -240,7 +240,7 @@ function b_newbb_show($options) function b_newbb_topic_show($options) { global $accessForums; - include_once __DIR__ . '/../include/functions.time.php'; + require_once __DIR__ . '/../include/functions.time.php'; $myts = \MyTextSanitizer::getInstance(); $block = []; $i = 0; @@ -277,7 +277,7 @@ function b_newbb_topic_show($options) $newbbConfig = newbbLoadConfig(); if (!empty($newbbConfig['do_rewrite'])) { - include_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); + require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); } else { if (!defined('SEO_MODULE_NAME')) { define('SEO_MODULE_NAME', 'modules/newbb'); @@ -342,7 +342,7 @@ function b_newbb_topic_show($options) if (count($rows) < 1) { return $block; } - include_once __DIR__ . '/../include/functions.user.php'; + require_once __DIR__ . '/../include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); if (count($types) > 0) { /** @var Newbb\TypeHandler $typeHandler */ @@ -420,7 +420,7 @@ function b_newbb_post_show($options) global $accessForums; global $newbbConfig; - include_once __DIR__ . '/../include/functions.time.php'; + require_once __DIR__ . '/../include/functions.time.php'; $myts = \MyTextSanitizer::getInstance(); $block = []; $i = 0; @@ -456,7 +456,7 @@ function b_newbb_post_show($options) $newbbConfig = newbbLoadConfig(); if (!empty($newbbConfig['do_rewrite'])) { - include_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); + require_once $GLOBALS['xoops']->path('modules/newbb/seo_url.php'); } else { if (!defined('SEO_MODULE_NAME')) { define('SEO_MODULE_NAME', 'modules/newbb'); @@ -502,7 +502,7 @@ function b_newbb_post_show($options) if (count($rows) < 1) { return $block; } - include_once __DIR__ . '/../include/functions.user.php'; + require_once __DIR__ . '/../include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); foreach ($rows as $arr) { @@ -592,7 +592,7 @@ function b_newbb_author_show($options) $extraCriteria = ''; $time_criteria = null; if (!empty($options[2])) { - include_once __DIR__ . '/../include/functions.time.php'; + require_once __DIR__ . '/../include/functions.time.php'; $time_criteria = time() - newbbGetSinceTime($options[2]); $extraCriteria = ' AND topic_time > ' . $time_criteria; } @@ -661,7 +661,7 @@ function b_newbb_author_show($options) if (count($author) < 1) { return $block; } - include_once __DIR__ . '/../include/functions.user.php'; + require_once __DIR__ . '/../include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); foreach (array_keys($author) as $uid) { $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); @@ -679,7 +679,7 @@ function b_newbb_author_show($options) */ function b_newbb_edit($options) { - include_once __DIR__ . '/../include/functions.forum.php'; + require_once __DIR__ . '/../include/functions.forum.php'; $form = _MB_NEWBB_CRITERIA . "'; $selection['forum'] .= ''; @@ -919,11 +919,11 @@ public function renderTopics(\Smarty $xoopsTpl = null) return $ret; } - include_once __DIR__ . '/../include/functions.render.php'; - include_once __DIR__ . '/../include/functions.session.php'; - include_once __DIR__ . '/../include/functions.time.php'; - include_once __DIR__ . '/../include/functions.read.php'; - include_once __DIR__ . '/../include/functions.topic.php'; + require_once __DIR__ . '/../include/functions.render.php'; + require_once __DIR__ . '/../include/functions.session.php'; + require_once __DIR__ . '/../include/functions.time.php'; + require_once __DIR__ . '/../include/functions.read.php'; + require_once __DIR__ . '/../include/functions.topic.php'; $sticky = 0; $topics = []; @@ -1118,7 +1118,7 @@ public function renderTopics(\Smarty $xoopsTpl = null) if (count($topics) > 0) { $sql = ' SELECT DISTINCT topic_id FROM ' . $this->handler->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')'; if ($result = $this->handler->db->query($sql)) { - while (list($topic_id) = $this->handler->db->fetchRow($result)) { + while (false !== (list($topic_id) = $this->handler->db->fetchRow($result))) { $topics[$topic_id]['attachment'] = ' ' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); } } diff --git a/class/Tree.php b/class/Tree.php index 534f5bcc..dba9d66e 100644 --- a/class/Tree.php +++ b/class/Tree.php @@ -31,7 +31,7 @@ // ------------------------------------------------------------------------ // // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include_once $GLOBALS['xoops']->path('class/xoopstree.php'); +require_once $GLOBALS['xoops']->path('class/xoopstree.php'); /** * Class Newbbtree diff --git a/class/TypeHandler.php b/class/TypeHandler.php index b2e672fb..4edaaaee 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -55,7 +55,7 @@ public function getByForum($forums = null) return $ret; } - while (false !== ($myrow = $this->db->fetchArray($result))) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[$myrow[$this->keyName]] = [ 'type_id' => $myrow[$this->keyName], 'type_order' => $myrow['type_order'], diff --git a/class/Uploader.php b/class/Uploader.php index e2c65de7..10d198f6 100644 --- a/class/Uploader.php +++ b/class/Uploader.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include_once $GLOBALS['xoops']->path('class/uploader.php'); +require_once $GLOBALS['xoops']->path('class/uploader.php'); /** * Class Uploader diff --git a/class/User.php b/class/User.php index 1ed072f8..f5c51ef3 100644 --- a/class/User.php +++ b/class/User.php @@ -254,7 +254,7 @@ public function getInfo(&$user) // END hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? $userinfo['from'] = $user->getVar('user_from'); - include_once __DIR__ . '/../include/functions.time.php'; + require_once __DIR__ . '/../include/functions.time.php'; $userinfo['regdate'] = newbbFormatTimestamp($user->getVar('user_regdate'), 'reg'); $userinfo['last_login'] = newbbFormatTimestamp($user->getVar('last_login')); // irmtfan add last_login diff --git a/class/UserHandler.php b/class/UserHandler.php index 84327660..e2499959 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -40,7 +40,9 @@ public function __construct($enableGroup = true, $enableOnline = true) public function loadUserInfo() { - @include_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php'); + $helper = Newbb\Helper::getInstance(); + $helper->loadLanguage('user'); +// @require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php'); if (class_exists('UserLanguage')) { $handler = new Newbb\UserLanguage(); } else { @@ -56,7 +58,7 @@ public function loadUserOnline() if (empty($this->users) || !$this->enableOnline) { return; } - include_once __DIR__ . '/../include/functions.render.php'; + require_once __DIR__ . '/../include/functions.render.php'; $image_online = newbbDisplayImage('online', _MD_NEWBB_ONLINE); $image_offline = newbbDisplayImage('offline', _MD_NEWBB_OFFLINE); diff --git a/class/Xmlrss.php b/class/Xmlrss.php index 7933ed82..e92fc822 100644 --- a/class/Xmlrss.php +++ b/class/Xmlrss.php @@ -89,7 +89,7 @@ public function addItem($title, $link, $description = '', $label = '', $pubdate } if (!empty($description)) { $description = $this->cleanup($description, $this->max_item_description); - //$description .= ' ' . $label; + //$description .= ' ' . $label; } else { //$description = $label; } diff --git a/delete.php b/delete.php index 681aea5e..e93a6419 100644 --- a/delete.php +++ b/delete.php @@ -11,7 +11,7 @@ use Xmf\Request; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $ok = Request::getInt('ok', 0, 'POST'); diff --git a/digest.php b/digest.php index a5a2df0a..3fa0335c 100644 --- a/digest.php +++ b/digest.php @@ -16,7 +16,7 @@ define('XOOPS_XMLRPC', 1); } ob_start(); -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; if (0 == $GLOBALS['xoopsModuleConfig']['email_digest']) { echo '
    Not set'; diff --git a/dl_attachment.php b/dl_attachment.php index 436ef522..8fd9bda2 100644 --- a/dl_attachment.php +++ b/dl_attachment.php @@ -13,7 +13,7 @@ use XoopsModules\Newbb; ob_start(); -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; include $GLOBALS['xoops']->path('header.php'); $attach_id = Request::getInt('attachid', 0, 'GET'); diff --git a/edit.php b/edit.php index 6695a4e5..b78b4b73 100644 --- a/edit.php +++ b/edit.php @@ -12,7 +12,7 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { ${$getint} = Request::getInt($getint, 0, 'GET'); @@ -80,7 +80,7 @@ $xoopsOption['template_main'] = 'newbb_edit_post.tpl'; $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; // irmtfan include header.php after defining $xoopsOption['template_main'] -include_once $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('header.php'); /* $xoopsTpl->assign('lang_forum_index', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); @@ -150,5 +150,5 @@ } $xoopsTpl->assign_by_ref('posts_context', $posts_context); // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/footer.php b/footer.php index 48b1f61a..c8b6c96f 100644 --- a/footer.php +++ b/footer.php @@ -22,7 +22,7 @@ global $xoTheme; -include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); +require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); $iconHandler = newbbGetIconHandler(); // get css rel path from setted language $css_rel_path = $iconHandler->getPath('language/' . $GLOBALS['xoopsConfig']['language'], 'newbb', 'language/english', 'css'); diff --git a/header.php b/header.php index ec9544ca..1b93c75c 100644 --- a/header.php +++ b/header.php @@ -20,10 +20,10 @@ // irmtfan assign newbb dirname then replace all. include xoops header.php (now commented and removed) //$dirname = $xoopsModule->getVar('dirname'); $moduleDirName = basename(__DIR__); -//include_once $GLOBALS['xoops']->path('header.php'); +//require_once $GLOBALS['xoops']->path('header.php'); if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { - include_once __DIR__ . '/seo_url.php'; + require_once __DIR__ . '/seo_url.php'; /* for seo */ $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; @@ -61,10 +61,10 @@ } } -include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/vars.php'); +require_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/vars.php'); -include_once __DIR__ . '/include/functions.user.php'; -include_once __DIR__ . '/include/functions.topic.php'; +require_once __DIR__ . '/include/functions.user.php'; +require_once __DIR__ . '/include/functions.topic.php'; require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); require_once $GLOBALS['xoops']->path('class/module.textsanitizer.php'); @@ -82,7 +82,7 @@ if (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['welcome_forum']) && !$GLOBALS['xoopsUser']->getVar('posts')) { - include_once __DIR__ . '/include/functions.welcome.php'; + require_once __DIR__ . '/include/functions.welcome.php'; } // irmtfan for backward compatibility $pollmodules = $GLOBALS['xoopsModuleConfig']['poll_module']; diff --git a/include/config.php b/include/config.php index 00aad5a0..1c7a77b4 100644 --- a/include/config.php +++ b/include/config.php @@ -20,7 +20,7 @@ */ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include_once __DIR__ . '/common.php'; +require_once __DIR__ . '/common.php'; $moduleDirName = basename(dirname(__DIR__)); $uploadFolders = [ @@ -88,4 +88,3 @@ function getConfig() \'XOOPS', ]; } - diff --git a/include/form.forum.php b/include/form.forum.php index 6a002bc0..d13dad9b 100644 --- a/include/form.forum.php +++ b/include/form.forum.php @@ -25,7 +25,7 @@ } require_once $GLOBALS['xoops']->path('class/xoopstree.php'); -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); // The forum instanciation $form_forum = new \XoopsThemeForm(_AM_NEWBB_EDITTHISFORUM . ' ' . $forumObject->getVar('forum_name'), 'form_forum', xoops_getenv('PHP_SELF')); diff --git a/include/form.post.php b/include/form.post.php index 75bbe79e..079260f1 100644 --- a/include/form.post.php +++ b/include/form.post.php @@ -21,7 +21,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $xoopsTpl->assign('lang_forum_index', sprintf(_MD_NEWBB_FORUMINDEX, htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES))); diff --git a/include/functions.config.php b/include/functions.config.php index 23c98cec..196d009d 100644 --- a/include/functions.config.php +++ b/include/functions.config.php @@ -13,7 +13,7 @@ use XoopsModules\Newbb; -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_CONFIG_LOADED', true); if (!defined('NEWBB_FUNCTIONS_CONFIG')) { @@ -26,7 +26,7 @@ */ function newbbLoadConfig() { - include_once dirname(__DIR__) . '/class/Helper.php'; + require_once dirname(__DIR__) . '/class/Helper.php'; //$helper = NewBB::getInstance(); $helper = Newbb\Helper::getInstance(); static $configs = null; diff --git a/include/functions.ini.php b/include/functions.ini.php index 72f70e74..9ffa4a54 100644 --- a/include/functions.ini.php +++ b/include/functions.ini.php @@ -38,5 +38,5 @@ /** * @return array */ -include_once __DIR__ . '/functions.config.php'; -include_once __DIR__ . '/functions.session.php'; +require_once __DIR__ . '/functions.config.php'; +require_once __DIR__ . '/functions.session.php'; diff --git a/include/functions.language.php b/include/functions.language.php index c9f816a2..3149545f 100644 --- a/include/functions.language.php +++ b/include/functions.language.php @@ -11,7 +11,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_LANGUAGE_LOADED', true); if (!defined('NEWBB_FUNCTIONS_LANGUAGE')) { @@ -25,8 +25,8 @@ function newbbLoadLanguage($page, $dirname = 'newbb') { $page = str_replace('..', '', $page); - if (!@include_once $GLOBALS['xoops']->path("modules/{$dirname}/{$GLOBALS['xoopsConfig']['language']}/{$language}.php")) { - if (!@include_once $GLOBALS['xoops']->path("modules/{$dirname}/language/{$language}.php")) { + if (!@require_once $GLOBALS['xoops']->path("modules/{$dirname}/{$GLOBALS['xoopsConfig']['language']}/{$language}.php")) { + if (!@require_once $GLOBALS['xoops']->path("modules/{$dirname}/language/{$language}.php")) { return false; } } diff --git a/include/functions.php b/include/functions.php index a42c2b49..ca647f55 100644 --- a/include/functions.php +++ b/include/functions.php @@ -17,10 +17,10 @@ if (!defined('NEWBB_FUNCTIONS')) { define('NEWBB_FUNCTIONS', 1); - include_once __DIR__ . '/functions.image.php'; - include_once __DIR__ . '/functions.user.php'; - include_once __DIR__ . '/functions.render.php'; - include_once __DIR__ . '/functions.forum.php'; - include_once __DIR__ . '/functions.session.php'; - include_once __DIR__ . '/functions.stats.php'; + require_once __DIR__ . '/functions.image.php'; + require_once __DIR__ . '/functions.user.php'; + require_once __DIR__ . '/functions.render.php'; + require_once __DIR__ . '/functions.forum.php'; + require_once __DIR__ . '/functions.session.php'; + require_once __DIR__ . '/functions.stats.php'; } diff --git a/include/functions.session.php b/include/functions.session.php index 1c26b14b..e69ea2f2 100644 --- a/include/functions.session.php +++ b/include/functions.session.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_SESSION_LOADED', true); xoops_load('XoopsRequest'); diff --git a/include/functions.stats.php b/include/functions.stats.php index c9022bd0..42727903 100644 --- a/include/functions.stats.php +++ b/include/functions.stats.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_STATS_LOADED', true); if (!defined('NEWBB_FUNCTIONS_STATS')) { diff --git a/include/functions.time.php b/include/functions.time.php index ebe6fc09..8f81d137 100644 --- a/include/functions.time.php +++ b/include/functions.time.php @@ -11,7 +11,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_TIME_LOADED', true); if (!defined('NEWBB_FUNCTIONS_TIME')) { diff --git a/include/functions.welcome.inc.php b/include/functions.welcome.inc.php index a0ae1d65..fe7d43f2 100644 --- a/include/functions.welcome.inc.php +++ b/include/functions.welcome.inc.php @@ -125,7 +125,7 @@ $tags['THREAD_NAME'] = $subject; $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $post_id . '&topic_id=' . $postObject->getVar('topic_id') . '&forum=' . $forum_id; $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_id; - include_once __DIR__ . '/notification.inc.php'; + require_once __DIR__ . '/notification.inc.php'; $forum_info = newbb_notify_iteminfo('forum', $forum_id); $tags['FORUM_NAME'] = $forum_info['name']; $tags['FORUM_URL'] = $forum_info['url']; diff --git a/include/functions.welcome.php b/include/functions.welcome.php index eace4ef0..eee7027e 100644 --- a/include/functions.welcome.php +++ b/include/functions.welcome.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_WELCOME_LOADED', true); if (!defined('NEWBB_FUNCTIONS_WELCOME')) { diff --git a/include/module.php b/include/module.php index 9012976b..0dbc588d 100644 --- a/include/module.php +++ b/include/module.php @@ -37,7 +37,7 @@ } define('XOOPS_MODULE_NEWBB_FUCTIONS', 1); -include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * @param XoopsModule $module @@ -81,7 +81,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $oldversion = null) array_map('unlink', glob(dirname(__DIR__) . '/docs/changelog-rev*.txt')); if (!empty($newbbConfig['syncOnUpdate'])) { - include_once __DIR__ . '/../include/functions.recon.php'; + require_once __DIR__ . '/../include/functions.recon.php'; newbbSynchronization(); } @@ -181,7 +181,7 @@ function xoops_module_install_newbb(\XoopsModule $module) } /* Create a test post */ - include_once __DIR__ . '/functions.user.php'; + require_once __DIR__ . '/functions.user.php'; /** @var Newbb\PostHandler $postHandler */ $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); /** @var $forumpost */ diff --git a/include/search.inc.php b/include/search.inc.php index b7be6c91..57fb8ca1 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -13,7 +13,7 @@ // completely rewrite by irmtfan - remove hardcode database access, solve order issues, add post_text & topic_id, add highlight and reduce queries // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * @param $queryarray diff --git a/include/vars.php b/include/vars.php index a8267b23..be2e6e01 100644 --- a/include/vars.php +++ b/include/vars.php @@ -10,8 +10,8 @@ */ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); -include_once __DIR__ . '/functions.session.php'; +require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +require_once __DIR__ . '/functions.session.php'; // NewBB cookie structure /* NewBB cookie storage diff --git a/index.php b/index.php index df925d5f..241e8c8a 100644 --- a/index.php +++ b/index.php @@ -12,7 +12,7 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; /* deal with marks */ if (Request::getInt('mark_read', 0)) { @@ -23,7 +23,7 @@ $markvalue = 0; $markresult = _MD_NEWBB_MARK_UNREAD; } - include_once __DIR__ . '/include/functions.read.php'; + require_once __DIR__ . '/include/functions.read.php'; newbbSetReadForum($markvalue); $url = XOOPS_URL . '/modules/newbb/index.php'; redirect_header($url, 2, _MD_NEWBB_ALL_FORUM_MARKED . ' ' . $markresult); @@ -56,8 +56,8 @@ // irmtfan remove and move to footer.php //$xoopsOption['xoops_module_header'] = $xoops_module_header; // irmtfan include header.php after defining $xoopsOption['template_main'] -include_once $GLOBALS['xoops']->path('header.php'); -include_once __DIR__ . '/include/functions.render.php'; +require_once $GLOBALS['xoops']->path('header.php'); +require_once __DIR__ . '/include/functions.render.php'; /* rss feed */ // irmtfan new method if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { @@ -286,5 +286,5 @@ ]); // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/language/english/admin.php b/language/english/admin.php index 0e72487e..cc293cdd 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -323,21 +323,33 @@ define('_AM_NEWBB_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); // Help tab -define('_AM_NEWBB_HELP_CATEGORY_TAB', - 'To create a category, use the button above and fill in all the fields on the form.
    By default, category images are located: /modules/newbb/assets/images/category/
    Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.'); -define('_AM_NEWBB_HELP_FORUM_TAB', - 'To create and manage the forums use the buttons with the right
    To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.
    To move the forum between categories, use the \'Move\' button. Follow the further instructions.
    To merge forums, use the \'Merge\' button. Follow the further instructions.
    If you have an access rights template, then you can apply it to the forum you are creating.'); -define('_AM_NEWBB_HELP_PERMISSION_TAB', - 'When setting permissions, be careful.
    After you install and apply the settings, you will automatically go to the next permissions tab.
    Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.'); +define( + '_AM_NEWBB_HELP_CATEGORY_TAB', + 'To create a category, use the button above and fill in all the fields on the form.
    By default, category images are located: /modules/newbb/assets/images/category/
    Sponsor link should be written in the following format: https://xoops.org/modules/newbb/ newBB Support. First the link, then the sponsor\'s name or other text.' +); +define( + '_AM_NEWBB_HELP_FORUM_TAB', + 'To create and manage the forums use the buttons with the right
    To create the forum, use the \'Create forum\' button. Then fill in all the fields of the form. You can also create a subforum.
    To move the forum between categories, use the \'Move\' button. Follow the further instructions.
    To merge forums, use the \'Merge\' button. Follow the further instructions.
    If you have an access rights template, then you can apply it to the forum you are creating.' +); +define( + '_AM_NEWBB_HELP_PERMISSION_TAB', + 'When setting permissions, be careful.
    After you install and apply the settings, you will automatically go to the next permissions tab.
    Also here it is possible to create a default access rights template and apply it either to one forum or to all forums.' +); define('_AM_NEWBB_HELP_ORDER_TAB', 'Allows you to set the order of categories and forums relative to each other.
    The order (Weight) is set to 0 - top, 99 (and further) - bottom.'); define('_AM_NEWBB_HELP_PRUNE_TAB', 'Allows you to clear forums from empty themes, obsolete themes, etc.
    Also you can not delete topics that you want to clear, but transfer them to a specially created category \'Archive\' or any other.'); -define('_AM_NEWBB_HELP_REPORT_TAB', - 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.
    You can review the report and take action in relation to the message, the author, etc.
    When a user sends a message, moderators and administrators are notified by e-mail.'); +define( + '_AM_NEWBB_HELP_REPORT_TAB', + 'Allows you to process reports that users send to you if they believe that the message on the forum does not comply with forum rules or ethical rules.
    You can review the report and take action in relation to the message, the author, etc.
    When a user sends a message, moderators and administrators are notified by e-mail.' +); define('_AM_NEWBB_HELP_VOTE_TAB', 'If you have the voting function enabled, here you can see the results of the voting.
    This vote is not associated with other XOOPS modules.'); -define('_AM_NEWBB_HELP_TYPE_TAB', - 'Allows you to create tags for highlighting themes. For example:
    [Important] Topic Title
    [ATTENTION] Topic Title
    You can set theme types when creating a theme on the user side.'); -define('_AM_NEWBB_HELP_GROUPMOD_TAB', - 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.
    It is recommended to create separate groups of moderators, for more convenient management of moderators.
    You can also assign specific users to moderators when creating a forum.'); +define( + '_AM_NEWBB_HELP_TYPE_TAB', + 'Allows you to create tags for highlighting themes. For example:
    [Important] Topic Title
    [ATTENTION] Topic Title
    You can set theme types when creating a theme on the user side.' +); +define( + '_AM_NEWBB_HELP_GROUPMOD_TAB', + 'Allows you to install users of certain groups as moderators for the entire module, and for individual categories and forums.
    It is recommended to create separate groups of moderators, for more convenient management of moderators.
    You can also assign specific users to moderators when creating a forum.' +); define('_AM_NEWBB_HELP_SYNC_TAB', 'If you notice a problem with the message dates, the appearance of blank messages, etc. Here you can synchronize and correct forum data and topics'); define('_AM_NEWBB_FORUM_DESC_LENGTH', 'Forum Description Length'); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 2c443e09..62c70d5e 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -41,8 +41,10 @@ //define('_MI_NEWBB_THEMESET', 'Theme set'); //define('_MI_NEWBB_THEMESET_DESC', "Module-wide, select '' . _NONE . '' will use site-wide theme"); define('_MI_NEWBB_DIR_ATTACHMENT', 'Attachments physical path.'); -define('_MI_NEWBB_DIR_ATTACHMENT_DESC', - "Physical path only needs to be set from your xoops root and not before, for example you may have attachments uploaded to www.yoururl.com/uploads/newbb the path entered would then be '/uploads/newbb' never include a trailing slash '/' the thumbnails path becomes '/uploads/newbb/thumbs'"); +define( + '_MI_NEWBB_DIR_ATTACHMENT_DESC', + "Physical path only needs to be set from your xoops root and not before, for example you may have attachments uploaded to www.yoururl.com/uploads/newbb the path entered would then be '/uploads/newbb' never include a trailing slash '/' the thumbnails path becomes '/uploads/newbb/thumbs'" +); define('_MI_NEWBB_PATH_MAGICK', 'Path for ImageMagick'); define('_MI_NEWBB_PATH_MAGICK_DESC', "Usually it is '/usr/bin/X11'. Leave it BLANK if you do not have ImageMagicK installed or for autodetecting."); define('_MI_NEWBB_SUBFORUM_DISPLAY', 'Display Mode of subforums on index page'); @@ -78,8 +80,10 @@ define('_MI_NEWBB_TEXT', 'text'); define('_MI_NEWBB_GRAPHIC', 'graphic'); define('_MI_NEWBB_USERLEVEL', 'HP/MP/EXP Level Mode'); -define('_MI_NEWBB_USERLEVEL_DESC', - 'HP is determined by your average posts per day.
    MP is determined by your join date related to your post count.
    EXP goes up each time you post, and when you get to 100%, you gain a level and the EXP drops to 0 again.'); +define( + '_MI_NEWBB_USERLEVEL_DESC', + 'HP is determined by your average posts per day.
    MP is determined by your join date related to your post count.
    EXP goes up each time you post, and when you get to 100%, you gain a level and the EXP drops to 0 again.' +); define('_MI_NEWBB_RSS_ENABLE', 'Enable RSS Feed'); define('_MI_NEWBB_RSS_ENABLE_DESC', 'Enable RSS Feed, edit options below for maximum Items and Description length'); define('_MI_NEWBB_RSS_MAX_ITEMS', 'RSS Max. Items'); diff --git a/list.topic.php b/list.topic.php index 9508893d..f3bb134d 100644 --- a/list.topic.php +++ b/list.topic.php @@ -12,12 +12,12 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; //$xoopsOption['xoops_module_header']= $xoops_module_header; $GLOBALS['xoopsOption']['template_main'] = 'newbb_viewall.tpl'; // irmtfan include header.php after defining $xoopsOption['template_main'] -include_once $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('header.php'); // irmtfan new method if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { $xoopsTpl->assign('xoops_module_header', ' @@ -26,8 +26,8 @@ } //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); -include_once __DIR__ . '/include/functions.time.php'; -include_once __DIR__ . '/include/functions.render.php'; +require_once __DIR__ . '/include/functions.time.php'; +require_once __DIR__ . '/include/functions.render.php'; // irmtfan use require_once because it will redeclared in newbb/blocks/list_topic.php require_once __DIR__ . '/./class/TopicRenderer.php'; @@ -87,7 +87,7 @@ $xoopsTpl->assign('newpost_link', 'viewpost.php?status=new'); if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { - include_once __DIR__ . '/include/functions.forum.php'; + require_once __DIR__ . '/include/functions.forum.php'; $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox()); } $xoopsTpl->assign('menumode', $menumode); @@ -102,5 +102,5 @@ $xoopsTpl->assign('xoops_pagetitle', $pagetitle); // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/makepdf.php b/makepdf.php index 7321a440..930c8752 100644 --- a/makepdf.php +++ b/makepdf.php @@ -23,7 +23,7 @@ // a complete rewrite by irmtfan to enhance: 1- RTL 2- Multilanguage (EMLH and Xlanguage) error_reporting(0); -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $attach_id = Request::getString('attachid', '', 'GET'); $forum = Request::getInt('forum', 0, 'GET'); @@ -99,7 +99,7 @@ // START irmtfan to implement EMLH by GIJ if (function_exists('easiestml')) { $pdf_data = easiestml($pdf_data); - // END irmtfan to implement EMLH by GIJ +// END irmtfan to implement EMLH by GIJ // START irmtfan to implement Xlanguage by phppp(DJ) } elseif (function_exists('xlanguage_ml')) { $pdf_data = xlanguage_ml($pdf_data); diff --git a/moderate.php b/moderate.php index 95a0078f..244b8816 100644 --- a/moderate.php +++ b/moderate.php @@ -11,7 +11,7 @@ use Xmf\Request; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; global $xoTheme, $xoopsTpl; $GLOBALS['xoopsOption']['template_main'] = 'newbb_moderate.tpl'; @@ -171,13 +171,13 @@ } } -include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); $forum_form = new \XoopsThemeForm(_ADD, 'suspend_form', 'moderate.php', 'post', true); $forum_form->addElement(new \XoopsFormSelectUser(_MD_NEWBB_SUSPEND_UID, 'uid', true, $forum_userid, 1, false)); $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_SUSPEND_IP, 'ip', 50, 50)); $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_SUSPEND_DURATION, 'expire', 20, 25, '5'), true); $forum_form->addElement(new \XoopsFormText(_MD_NEWBB_SUSPEND_DESC, 'desc', 50, 255)); -include_once __DIR__ . '/include/functions.forum.php'; +require_once __DIR__ . '/include/functions.forum.php'; if (newbbIsAdmin()) { $forumSel = '
    '; } // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/update_type.php b/update_type.php index 7f7d6fe1..cc52131d 100644 --- a/update_type.php +++ b/update_type.php @@ -8,7 +8,7 @@ * @since 4.00 * @package module::newbb */ -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; if (!is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin()) { exit(_NOPERM); diff --git a/view.tag.php b/view.tag.php index 03b61cdf..2ead4ea5 100644 --- a/view.tag.php +++ b/view.tag.php @@ -8,5 +8,5 @@ * @since 4.00 * @package module::newbb */ -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; include $GLOBALS['xoops']->path('modules/tag/view.tag.php'); diff --git a/viewforum.php b/viewforum.php index 17d33e07..0be3133f 100644 --- a/viewforum.php +++ b/viewforum.php @@ -11,12 +11,12 @@ use Xmf\Request; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; if (!Request::getInt('forum', 0, 'GET')) { redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); } -include_once __DIR__ . '/include/functions.read.php'; +require_once __DIR__ . '/include/functions.read.php'; /* * Build the page query @@ -80,8 +80,8 @@ $xoopsOption['template_main'] = 'newbb_viewforum.tpl'; $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; -include_once $GLOBALS['xoops']->path('header.php'); -include_once __DIR__ . '/include/functions.render.php'; +require_once $GLOBALS['xoops']->path('header.php'); +require_once __DIR__ . '/include/functions.render.php'; if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { $xoopsTpl->assign('xoops_module_header', ' @@ -191,7 +191,7 @@ $xoopsTpl->assign_by_ref('forum_selection_order', $forum_selection_order); $since = Request::getInt('since', $GLOBALS['xoopsModuleConfig']['since_default'], 'GET'); -include_once __DIR__ . '/include/functions.time.php'; +require_once __DIR__ . '/include/functions.time.php'; $forum_selection_since = newbbSinceSelectBox($since); $xoopsTpl->assign_by_ref('forum_selection_since', $forum_selection_since); @@ -261,7 +261,7 @@ } } if ($type > 0) { - include_once __DIR__ . '/include/functions.topic.php'; + require_once __DIR__ . '/include/functions.topic.php'; $xoopsTpl->assign('forum_topictype', getTopicTitle('', $types[$type]['type_name'], $types[$type]['type_color'])); } $xoopsTpl->assign_by_ref('typeOptions', $typeOptions); @@ -302,7 +302,7 @@ $all_topics = $forumHandler->getTopicCount($forumObject, $startdate, $status); if ($all_topics > $GLOBALS['xoopsModuleConfig']['topics_per_page']) { - include_once $GLOBALS['xoops']->path('class/pagenav.php'); + require_once $GLOBALS['xoops']->path('class/pagenav.php'); $query_nav = $query_array; unset($query_nav['start']); $page_query_nav = implode('&', array_values($query_nav)); @@ -322,7 +322,7 @@ } if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { - include_once __DIR__ . '/include/functions.forum.php'; + require_once __DIR__ . '/include/functions.forum.php'; $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); } @@ -338,5 +338,5 @@ $xoopsTpl->assign('rss_button', "'); } // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/viewpost.php b/viewpost.php index d917f206..5149f84d 100644 --- a/viewpost.php +++ b/viewpost.php @@ -32,7 +32,7 @@ use Xmf\Request; use XoopsModules\Newbb; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $start = Request::getInt('start', 0, 'GET'); $forum_id = Request::getInt('forum', 0, 'GET'); @@ -176,9 +176,9 @@ $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; $xoopsOption['template_main'] = 'newbb_viewpost.tpl'; -include_once $GLOBALS['xoops']->path('header.php'); -include_once __DIR__ . '/include/functions.time.php'; -include_once __DIR__ . '/include/functions.render.php'; +require_once $GLOBALS['xoops']->path('header.php'); +require_once __DIR__ . '/include/functions.time.php'; +require_once __DIR__ . '/include/functions.render.php'; //global $xoTheme; //$xoTheme->addScript('/Frameworks/textsanitizer/xoops.js'); @@ -361,7 +361,7 @@ unset($viewtopic_users, $forums); if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { - include_once __DIR__ . '/include/functions.forum.php'; + require_once __DIR__ . '/include/functions.forum.php'; $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); } @@ -448,5 +448,5 @@ $xoopsTpl->assign('mode', $mode); $xoopsTpl->assign('status', $status); // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); diff --git a/viewtopic.php b/viewtopic.php index fabc19c9..cb40bf34 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -34,10 +34,10 @@ use XoopsModules\Newbb; use XoopsModules\Xoopspoll; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $xoopsLogger->startTime('newBB_viewtopic'); -include_once __DIR__ . '/include/functions.read.php'; -include_once __DIR__ . '/include/functions.render.php'; +require_once __DIR__ . '/include/functions.read.php'; +require_once __DIR__ . '/include/functions.render.php'; xoops_loadLanguage('user'); /*Build the page query*/ @@ -162,7 +162,7 @@ // irmtfan remove and move to footer.php //$xoopsOption['xoops_module_header']= $xoops_module_header; // irmtfan include header.php after defining $xoopsOption['template_main'] -include_once $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('header.php'); //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); // irmtfan new method if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { @@ -501,7 +501,7 @@ if ($pollModuleHandler->getVar('version') >= 140) { // xoops_load('renderer', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_loadLanguage('main', $GLOBALS['xoopsModuleConfig']['poll_module']); - // old xoopspoll or umfrage or any clone from them + // old xoopspoll or umfrage or any clone from them } else { $classPoll = $topicObject->loadOldPoll(); } @@ -682,7 +682,7 @@ // create jump box if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { - include_once __DIR__ . '/include/functions.forum.php'; + require_once __DIR__ . '/include/functions.forum.php'; $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); } @@ -824,10 +824,10 @@ } if ($GLOBALS['xoopsModuleConfig']['do_tag'] - && @include_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php')) { + && @require_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php')) { $xoopsTpl->assign('tagbar', tagBar($topicObject->getVar('topic_tags', 'n'))); } // irmtfan move to footer.php -include_once __DIR__ . '/footer.php'; +require_once __DIR__ . '/footer.php'; include $GLOBALS['xoops']->path('footer.php'); $xoopsLogger->stopTime('newBB_viewtopic'); diff --git a/votepolls.php b/votepolls.php index 223d2f77..684020d5 100644 --- a/votepolls.php +++ b/votepolls.php @@ -28,7 +28,7 @@ use Xmf\Request; use XoopsModules\Xoopspoll; -include_once __DIR__ . '/header.php'; +require_once __DIR__ . '/header.php'; $poll_id = Request::getInt('poll_id', Request::getInt('poll_id', 0, 'POST'), 'GET'); $topic_id = Request::getInt('topic_id', Request::getInt('topic_id', 0, 'POST'), 'GET'); $forum = Request::getInt('forum', Request::getInt('forum', 0, 'POST'), 'GET'); From fa68e4aa9e841044818b8192993c5e504c8c7343 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 25 Mar 2018 00:40:41 -0400 Subject: [PATCH 118/170] updates --- .../xbootstrap/modules/newbb/newbb_index.tpl | 2 +- admin/admin_permissions.php | 153 +--------------- blocks/list_topic.php | 2 +- blocks/newbb_block.php | 54 +++--- blocks/newbb_block_tag.php | 2 + class/Digest.php | 1 + class/ForumHandler.php | 2 +- class/GroupFormCheckBox.php | 89 +++++++++ class/GroupPermForm.php | 88 +++++++++ class/IpCheck.php | 2 +- class/Migrate.php | 2 + class/PermissionForumHandler.php | 2 +- class/PermissionHandler.php | 2 +- class/Post.php | 2 +- class/PostHandler.php | 2 +- class/ReportHandler.php | 2 +- class/TopicHandler.php | 2 +- class/TopicRenderer.php | 2 +- class/TypeHandler.php | 4 +- delete.php | 8 +- docs/changelog.txt | 169 +++++++++--------- edit.php | 4 +- header.php | 2 +- include/config.php | 3 + include/form.post.php | 2 +- include/functions.config.php | 2 +- include/functions.forum.php | 4 +- include/functions.recon.php | 2 + include/functions.render.php | 2 +- include/functions.session.php | 4 +- include/functions.welcome.inc.php | 2 + include/onupdate.php | 2 +- list.topic.php | 2 +- newtopic.php | 2 +- polls.php | 32 ++-- post.php | 6 +- reply.php | 4 +- search.php | 4 +- viewforum.php | 2 +- viewpost.php | 2 +- viewtopic.php | 6 +- votepolls.php | 2 +- xoops_version.php | 4 +- 43 files changed, 362 insertions(+), 325 deletions(-) create mode 100644 class/GroupFormCheckBox.php create mode 100644 class/GroupPermForm.php diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl index e8be9dfa..ff8d357f 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl @@ -42,7 +42,7 @@ - <{if $delete_post}>(<{$delete_post}>)<{/if}> <{$smarty.const._MD_NEWBB_TYPE_DELETED}> + <{if $delete_post}>(<{$delete_post}>)<{/if}> <{$smarty.const._MD_NEWBB_TYPE_DELETED}> <{if $report_post}> diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index baf2ac09..cc77e727 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -51,157 +51,6 @@ * * Note: this is a __patchy__ solution. We should have a more extensible and flexible group permission management: not only for data architecture but also for management interface */ -class NewbbXoopsGroupPermForm extends XoopsGroupPermForm -{ - /** - * @param $title - * @param $modid - * @param $permname - * @param $permdesc - * @param string $url - */ - - public function __construct($title, $modid, $permname, $permdesc, $url = '') - { - parent::__construct($title, $modid, $permname, $permdesc, $url); - } - - /** - * @param $title - * @param $modid - * @param $permname - * @param $permdesc - * @param string $url - */ - - /* - public function newbb_XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url = "") - { -// $this->XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); - self::__construct($title, $modid, $permname, $permdesc, $url); - } -*/ - /** - * @return string - */ - public function render() - { - // load all child ids for javascript codes - foreach (array_keys($this->_itemTree) as $item_id) { - $this->_itemTree[$item_id]['allchild'] = []; - $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); - } - /** @var \XoopsGroupPermHandler $gpermHandler */ - $gpermHandler = xoops_getHandler('groupperm'); - /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); - $glist = $memberHandler->getGroupList(); - foreach (array_keys($glist) as $i) { - // get selected item id(s) for each group - $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); - $ele = new NewbbXoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); - $ele->setOptionTree($this->_itemTree); - $this->addElement($ele); - unset($ele); - } - $tray = new \XoopsFormElementTray(''); - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); - $this->addElement($tray); - $ret = '
    ' . $this->getTitle() . '
    ' . $this->_permDesc . '
    '; - $ret .= "
    getExtra() . ">\n\n"; - $elements = $this->getElements(); - $hidden = ''; - foreach (array_keys($elements) as $i) { - if (!is_object($elements[$i])) { - $ret .= $elements[$i]; - } elseif (!$elements[$i]->isHidden()) { - $ret .= "\n\n"; - } else { - $hidden .= $elements[$i]->render(); - } - } - $ret .= "
    " . $elements[$i]->getCaption(); - if ('' !== $elements[$i]->getDescription()) { - $ret .= '

    ' . $elements[$i]->getDescription() . ''; - } - $ret .= "
    \n" . $elements[$i]->render() . "\n
    $hidden
    "; - $ret .= $this->renderValidationJS(true); - - return $ret; - } -} - -/** - * Class NewbbXoopsGroupFormCheckBox - */ -class NewbbXoopsGroupFormCheckBox extends XoopsGroupFormCheckBox -{ - /** - * @param $caption - * @param $name - * @param $groupId - * @param null $values - */ - public function __construct($caption, $name, $groupId, $values = null) - { - parent::__construct($caption, $name, $groupId, $values); - } - - /** - * @param string $tree - * @param array $option - * @param string $prefix - * @param array $parentIds - */ - public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) - { - if ($option['id'] > 0) { - $tree .= $prefix . 'getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}"; - } - $tree .= '" value="1"'; - if (in_array($option['id'], $this->_value)) { - $tree .= ' checked'; - } - $tree .= ' />' - . $option['name'] - . '
    \n"; - } else { - $tree .= $prefix . $option['name'] . '
    \n"; - } - if (isset($option['children'])) { - foreach ($option['children'] as $child) { - if ($option['id'] > 0) { - // array_push($parentIds, $option['id']); - $parentIds[] = $option['id']; - } - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); - } - } - } -} //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; $action = strtolower(Request::getCmd('action', '')); @@ -415,7 +264,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $perm_desc = ''; - $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); + $form = new Newbb\GroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); diff --git a/blocks/list_topic.php b/blocks/list_topic.php index 1162cd64..cd60efd5 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -20,7 +20,7 @@ define('LIST_TOPIC_DEFINED', true); //require_once dirname(__DIR__) . '/include/functions.ini.php'; -require_once dirname(__DIR__) . '/class/TopicRenderer.php'; +//require_once dirname(__DIR__) . '/class/TopicRenderer.php'; require_once dirname(__DIR__) . '/footer.php'; // to include js/style files like validate function xoops_loadLanguage('main', 'newbb'); diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index 69157567..380a9afc 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -1,38 +1,28 @@ // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: phppp (D.J., infomax@gmail.com) // -// URL: https://xoops.org // -// Project: Article Project // -// ------------------------------------------------------------------------ // -// defined('XOOPS_ROOT_PATH') || die('Restricted access'); -// irmtfan use full path because block maybe used outside newbb + +/* + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package + * @since + * @author XOOPS Development Team + */ use XoopsModules\Newbb; +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); +// irmtfan use full path because block maybe used outside newbb + require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); if (defined('NEWBB_BLOCK_DEFINED')) { @@ -508,7 +498,7 @@ function b_newbb_post_show($options) foreach ($rows as $arr) { //if ($arr['icon'] && is_file($GLOBALS['xoops']->path('images/subject/' . $arr['icon']))) { if (!empty($arr['icon'])) { - $last_post_icon = ''; + $last_post_icon = ''; } else { $last_post_icon = ''; } diff --git a/blocks/newbb_block_tag.php b/blocks/newbb_block_tag.php index 5a55e23a..bb7251e8 100644 --- a/blocks/newbb_block_tag.php +++ b/blocks/newbb_block_tag.php @@ -9,6 +9,8 @@ * @package module::newbb/tag */ +use XoopsModules\Newbb; + // defined('XOOPS_ROOT_PATH') || die('Restricted access'); /**#@+ diff --git a/class/Digest.php b/class/Digest.php index a00c2ff6..ad65c974 100644 --- a/class/Digest.php +++ b/class/Digest.php @@ -71,6 +71,7 @@ public function cleanup($text) $clean = strip_tags($clean); $clean = htmlspecialchars($clean, ENT_QUOTES); + return $clean; } diff --git a/class/ForumHandler.php b/class/ForumHandler.php index 75dfc458..ae2676c9 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -311,7 +311,7 @@ public function getAllTopics(&$forum, $criteria = null) } elseif ($myrow['topic_sticky']) { $topic_icon = newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY); } elseif (!empty($myrow['icon'])) { - $topic_icon = ''; + $topic_icon = ''; } else { $topic_icon = ''; } diff --git a/class/GroupFormCheckBox.php b/class/GroupFormCheckBox.php new file mode 100644 index 00000000..7b421dfc --- /dev/null +++ b/class/GroupFormCheckBox.php @@ -0,0 +1,89 @@ +Special points: + *
  • Use negative values for category IDs to avoid conflict between category and forum + *
  • Disabled checkbox for categories to avoid unnecessary permission items for categories in forum permission table + * + * + * Note: this is a __patchy__ solution. We should have a more extensible and flexible group permission management: not only for data architecture but also for management interface + */ + +/** + * Class GroupFormCheckBox + * @package XoopsModules\Newbb + */ +class GroupFormCheckBox extends \XoopsGroupFormCheckBox +{ + /** + * @param $caption + * @param $name + * @param $groupId + * @param null $values + */ + public function __construct($caption, $name, $groupId, $values = null) + { + parent::__construct($caption, $name, $groupId, $values); + } + + /** + * @param string $tree + * @param array $option + * @param string $prefix + * @param array $parentIds + */ + public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) + { + if ($option['id'] > 0) { + $tree .= $prefix . 'getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; + $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}"; + } + $tree .= '" value="1"'; + if (in_array($option['id'], $this->_value)) { + $tree .= ' checked'; + } + $tree .= ' />' + . $option['name'] + . '
    \n"; + } else { + $tree .= $prefix . $option['name'] . '
    \n"; + } + if (isset($option['children'])) { + foreach ($option['children'] as $child) { + if ($option['id'] > 0) { + // array_push($parentIds, $option['id']); + $parentIds[] = $option['id']; + } + $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); + } + } + } +} diff --git a/class/GroupPermForm.php b/class/GroupPermForm.php new file mode 100644 index 00000000..faa6aed6 --- /dev/null +++ b/class/GroupPermForm.php @@ -0,0 +1,88 @@ +XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); + self::__construct($title, $modid, $permname, $permdesc, $url); + } +*/ + /** + * @return string + */ + public function render() + { + // load all child ids for javascript codes + foreach (array_keys($this->_itemTree) as $item_id) { + $this->_itemTree[$item_id]['allchild'] = []; + $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); + } + /** @var \XoopsGroupPermHandler $gpermHandler */ + $gpermHandler = xoops_getHandler('groupperm'); + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + $glist = $memberHandler->getGroupList(); + foreach (array_keys($glist) as $i) { + // get selected item id(s) for each group + $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); + $ele = new Newbb\GroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); + $ele->setOptionTree($this->_itemTree); + $this->addElement($ele); + unset($ele); + } + $tray = new \XoopsFormElementTray(''); + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); + $this->addElement($tray); + $ret = '
    ' . $this->getTitle() . '
    ' . $this->_permDesc . '
    '; + $ret .= "
    getExtra() . ">\n\n"; + $elements = $this->getElements(); + $hidden = ''; + foreach (array_keys($elements) as $i) { + if (!is_object($elements[$i])) { + $ret .= $elements[$i]; + } elseif (!$elements[$i]->isHidden()) { + $ret .= "\n\n"; + } else { + $hidden .= $elements[$i]->render(); + } + } + $ret .= "
    " . $elements[$i]->getCaption(); + if ('' !== $elements[$i]->getDescription()) { + $ret .= '

    ' . $elements[$i]->getDescription() . ''; + } + $ret .= "
    \n" . $elements[$i]->render() . "\n
    $hidden
    "; + $ret .= $this->renderValidationJS(true); + + return $ret; + } +} diff --git a/class/IpCheck.php b/class/IpCheck.php index 36fca84f..6c254381 100644 --- a/class/IpCheck.php +++ b/class/IpCheck.php @@ -31,7 +31,7 @@ public function addressType($ipValue) if (filter_var($this->ipin, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { // Look for embedded IPv4 in an embedded IPv6 address, where FFFF is appended. - if (0 === strpos($this->ipin, '::FFFF:')) { + if (0 === strncmp($this->ipin, '::FFFF:', 7)) { $ipv4addr = substr($this->ipin, 7); if (filter_var($ipv4addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $this->ipver = 4; diff --git a/class/Migrate.php b/class/Migrate.php index 138aea9d..2af35615 100644 --- a/class/Migrate.php +++ b/class/Migrate.php @@ -45,6 +45,8 @@ class Migrate extends \Xmf\Database\Migrate /** * Migrate constructor. + * @throws \RuntimeException + * @throws \InvalidArgumentException */ public function __construct() { diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index 8770b4c5..508dab15 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -109,7 +109,7 @@ public function getValidItems($mid, $id = 0) * @return array */ /** - * @param int $id + * @param int|array $id * @return bool|array */ public function getPermissions($id = 0) diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 568cd1dc..3f695444 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -370,7 +370,7 @@ public function deleteRight($perm, $itemid, $groupid, $mid = null) unset($mod); } } - if (is_callable([&$this->XoopsGroupPermHandler, 'deleteRight'])) { + if (is_callable('parent::deleteRight')) { return parent::deleteRight($perm, $itemid, $groupid, $mid); } else { $criteria = new \CriteriaCompo(new \Criteria('gperm_name', $perm)); diff --git a/class/Post.php b/class/Post.php index 7cb380da..ff8e54a0 100644 --- a/class/Post.php +++ b/class/Post.php @@ -500,7 +500,7 @@ public function showPost($isAdmin) $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); } } - $page_query = htmlspecialchars(implode('&', array_values($query_array))); + $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; diff --git a/class/PostHandler.php b/class/PostHandler.php index 06384408..a56969db 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -130,7 +130,7 @@ public function getPostForPrint(&$post) } /** - * @param Post $post + * @param int|Post $post * @param bool $force * @return bool */ diff --git a/class/ReportHandler.php b/class/ReportHandler.php index 33c444ce..41a0a348 100644 --- a/class/ReportHandler.php +++ b/class/ReportHandler.php @@ -47,7 +47,7 @@ public function getByPost($posts) } /** - * @param int $forums + * @param int|array $forums * @param string $order * @param int $perpage * @param $start diff --git a/class/TopicHandler.php b/class/TopicHandler.php index 14e073b2..bb5535dd 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -327,7 +327,7 @@ public function showTreeItem(&$topic, &$postArray) $postArray['post_time'] = newbbFormatTimestamp($postArray['post_time']); if (!empty($postArray['icon'])) { - $postArray['icon'] = ''; + $postArray['icon'] = ''; } else { $postArray['icon'] = ''; } diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 6717ed5d..6b42d67b 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -942,7 +942,7 @@ public function renderTopics(\Smarty $xoopsTpl = null) // START irmtfan remove topic_icon hardcode smarty // topic_icon: just regular topic_icon if (!empty($myrow['icon'])) { - $topic_icon = ''; + $topic_icon = ''; } else { $topic_icon = ''; } diff --git a/class/TypeHandler.php b/class/TypeHandler.php index 4edaaaee..a3ead36b 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -59,8 +59,8 @@ public function getByForum($forums = null) $ret[$myrow[$this->keyName]] = [ 'type_id' => $myrow[$this->keyName], 'type_order' => $myrow['type_order'], - 'type_name' => htmlspecialchars($myrow['type_name']), - 'type_color' => htmlspecialchars($myrow['type_color']) + 'type_name' => htmlspecialchars($myrow['type_name'], ENT_QUOTES | ENT_HTML5), + 'type_color' => htmlspecialchars($myrow['type_color'], ENT_QUOTES | ENT_HTML5) ]; } diff --git a/delete.php b/delete.php index e93a6419..36b95666 100644 --- a/delete.php +++ b/delete.php @@ -132,10 +132,10 @@
    '; echo _MD_NEWBB_DELEDEDMSG . '
    '; echo '
    '; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; echo $GLOBALS['xoopsSecurity']->getTokenHTML(); echo ' diff --git a/docs/changelog.txt b/docs/changelog.txt index 065b8e0c..550cb0bf 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,17 @@ -5.00 Alpha (XOOPS 2.5.8.1+) (NOT RELEASED) -=========================================== +
    5.00 Beta 1 [NOT RELEASED]
    Dev: Xoops 2.5.9, PHP 7.2.3 +
    +- RGB to HEX (mamba) +- changed exit() to die() (mamba) +- assignment in Condition (mamba) +- cosmetics (mamba) +- extracted classes GroupPermForm, GroupFormCheckBox (mamba) +- added ENT_QUOTES | ENT_HTML5 to htmlspecialchars() (mamba) + +WORK IN PROGRESS + + +
    5.00 Alpha (XOOPS 2.5.9) (NOT RELEASED)
    +
    - Remove use of Art framework (geekwright) - standardize names of classes, tables and constants to include "newbb" (geekwright) - Use XMF whenever practical (geekwright) @@ -9,32 +21,28 @@ - Short syntax in array literals (mamba) - added forumDescription to viewforum.php (aerograf/mamba) - namespaces, autoload (mamba) -- RGB to HEX (mamba) -- changed exit() to die() (mamba) -- assignment in Condition (mamba) - -4.33 RC 13 (XOOPS 2.5.8) (NOT RELEASED) -=========================================== +
    4.33 RC 13 (XOOPS 2.5.8) (NOT RELEASED)
    +
    - code cosmetics (mamba) - standardize br tags (mamba) -4.33 RC 12 (XOOPS 2.5.8) (2016-04-03) -=========================================== +
    4.33 RC 12 (XOOPS 2.5.8) (2016-04-03)
    +
    - removed @version (mamba) - added auto-creation of /upload folders (aitor/mamba) - added admin_footer.php (mamba) - removed code for manual admin tabs (mamba) -4.33 RC 11 (XOOPS 2.5.8) (2016-03-14) -=========================================== +
    4.33 RC 11 (XOOPS 2.5.8) (2016-03-14)
    +
    - issue 14: SEO images (slider84/montuy337513) - issue 18: Array to string (cesagonchu/mamba) - PHP7 and XOOPS 2.5.8 updates (mamba) -4.33 RC 10 (2015-11-15) -=========================================== +
    4.33 RC 10 (2015-11-15)
    +
    - moved all images, CSS, and JS files to /assets (mamba) - renamed .html Smarty templates to .tpl (mamba) - removed closing php tags (mamba) @@ -56,8 +64,8 @@ - fix notices in Search (slider84/mamba) - fix in toggle_script (footer.php) (slider84) -4.33 11/20/2012 (changes by Irmtfan) -=========================================== +
    4.33 11/20/2012 (changes by Irmtfan)
    +
    - fixed .htaccess (Trabis) - Changing TYPE to ENGINE (mamba) - bug fix: Prune function (mamba) @@ -125,8 +133,8 @@ - Notice: Undefined index: fct in file /modules/newbb/xoops_version.php line 767 (cesagonchu) - Updated the standard norms of the English folder (cesagonchu) -4.3 08/25/2012 -=========================================== +
    4.3 08/25/2012
    +
    1 Fix Cache Config for SEO 2 Fix Typos in templates 3 Fix Nav for SEO @@ -156,8 +164,8 @@ 27 Fix error in newbb/polls.php when the strtotime is not defined in XoopsLocal class (irmtfan) 28 Fix using header php command instead of redirect_header XOOPS function (deka87/irmtfan) in newbb/search.php -4.2 02/08/2012 -=========================================== +
    4.2 02/08/2012
    +
    1 Fix Smilies are not displayed 2 Fix View Avatars 3 Fix Page Numbers views @@ -168,8 +176,8 @@ 8 New Display page numbers adjusted -4.1 11/26/2011 -=========================================== +
    4.1 11/26/2011
    +
    1 Remove fpdf and add tcpdf in Framworks 2 Fix view avatar und rank 3 New cat resize @@ -188,8 +196,8 @@ 16 Fix many Icons 17 Fix advanced search -4.03 beta3 08/08/2010 -=========================================== +
    4.03 beta3 08/08/2010
    +
    1 Fix error and change templates 2 Fix BB-Code in description cat and forums 3 enabe/disable Toolbar in threads @@ -211,8 +219,8 @@ 19 fix cache permissions -4.02 beta2 02/01/2010 -=========================================== +
    4.02 beta2 02/01/2010
    +
    1 Bugfix width PHP5.3 is installed (dhcst) 2 Bugfix width cache (dhcst) 3 Bugfix add new categorie (dhcst) @@ -223,16 +231,16 @@ 8 Added seo-tools 9 Bugfix Block see no older Topic -4.01 alpha December 25th, 2009 -============================================ +
    4.01 alpha December 25th, 2009
    +
    1 Remove dependence Frameworks (dhcst) 2 delete xoopslogger views (dhcst) 3 Adding Groupmoderation (dhcst) 4 Bugfix stats when user post new topic (dhcst) 5 Code refactored, not finished yet (dhcst) -4.00 alpha November 18th, 2007 -========================================== +
    4.00 alpha November 18th, 2007
    +
    1 Code refactored, not finished yet (phppp) 2 Added forum-specific topic type (phppp) 3 Implemented tag functionality (phppp) @@ -244,28 +252,27 @@ 9 Implemented unlimited level of sub forums (phppp) -3.08 Jan 3rd, 2007 -========================================== +
    3.08 Jan 3rd, 2007
    +
    1 Bugfix for user stats (jorff, agl) 2 Bugfix for reading new posts -3.07 October 29th, 2006 -========================================== +
    3.07 October 29th, 2006
    +
    1 Bugfix for permission template (js related) 2 Added support for FCKeditor upload 3 Added support for extended xcode which allows flash/wmplayer/... 4 Fix for XSS reported by bubuche93 -3.06 -October 8th, 2006 -========================================== +
    3.06 October 8th, 2006
    +
    Bugfix version -3.05 July 22nd, 2006 -========================================== +
    3.05 July 22nd, 2006
    +
    1 Bugfix for notifying new replies for a specific topic 2 Bugfix for permission check when moving a post 3 Removed inherition of view mode and post order from system-wide preference @@ -275,36 +282,36 @@ Bugfix version 7 Bugfix for category name display in permission admin 8 Bugfix for view_level check in viewforum template (reported by topmuzik.com) -3.04 Final June 3rd, 2006 -========================================== +
    3.04 Final June 3rd, 2006
    +
    1 MySQL syntax for data synchronization for different versions 2 xhtml fixes 3 bugfix for group permission check form (reported by Aries) -3.04 RC4 May 27th, 2006 -========================================== +
    3.04 RC4 May 27th, 2006
    +
    1 Bugfix for topic title transfered from post subject 2 Added topic check before storing post (reported by marco) 3 Removed unnecessary forum option 'allow_attachments' 4 Other minor fixes -3.04 RC3 May 20th, 2006 -========================================== +
    3.04 RC3 May 20th, 2006
    +
    1 Fixed bugs in print.php (reported by ideiafacil) 2 Code correction for performance and cleaning up 3 Partial improvement on permission precision 4 Improvement on category/forum structured display for permission admin and block edit pages 5 Improvement on compliant xhtml -3.04 RC2 May 9th, 2006 -========================================== +
    3.04 RC2 May 9th, 2006
    +
    1 Fixed bugs reported on xoops.org 2 Created object handler for post_text 3 Changed fields in TABLE bb_forums 4 Changed testing post message in language file -3.04 RC May 8th, 2006 -========================================== +
    3.04 RC May 8th, 2006
    +
    1 category, forum, topic, post, report, rate refactoring 2 Added reading records options: cookie, database (inspired by Ajout Gizmhail) 3 Added data synchronization @@ -312,8 +319,8 @@ Bugfix version 5 Modified database structure for query optimization 6 Fixed bug in templates for file inclusion: for both update from file and from db modes -3.03 Apr 26th, 2006 -========================================== +
    3.03 Apr 26th, 2006
    +
    1 Fixed rss+xml rel link (by CeBepuH) 2 Fixed typo in "pm" path for "transfer" (by CeBepuH) 3 Fixed clear property in newbb.css (by CeBepuH) @@ -321,8 +328,8 @@ Bugfix version 5 Split functions.php -3.02 Apr 23rd, 2006 -========================================== +
    3.02 Apr 23rd, 2006
    +
    1 Fixed URL iteration for menumode (reported by genetailor) 2 Skip cache for edit pages 3 Charset completeness for PDF maker (reported by domecc) @@ -332,34 +339,34 @@ Bugfix version 7 Added time limit to "recent replied topic" block 8 Bugfix for signature setting (removed unnecessary user setting check) -3.01 Feb 22th, 2006 -========================================== +
    3.01 Feb 22th, 2006
    +
    Fixed bugs in permission management Fixed bugs in formloader -3.0 RC2 Feb 10th, 2006 -========================================== +
    3.0 RC2 Feb 10th, 2006
    +
    Fixed bugs in user select Fixed bugs in permission management -3.0 RC1 Jan 29th, 2006 -========================================== +
    3.0 RC1 Jan 29th, 2006
    +
    Compatible with XOOPS 2.0, 2.2, 2.3 -2.32 -========================================== +
    2.32
    +
    1 DB query optimization -2.31 -========================================== +
    2.31
    +
    1 bugfixes 2 speed improvement -2.3 -========================================== +
    2.3
    +
    1 moderator accessible distributed batch threads/posts management (approval, edit, move, delete, merge, split) 2 moderator accessible distributed user/IP suspension management 3 trashcan implemented @@ -367,8 +374,8 @@ Compatible with XOOPS 2.0, 2.2, 2.3 5 plugable module bridging handler implemented -2.2 -========================================== +
    2.2
    +
    1 block/profile/css/adminmenu/encoding related content upgraded to XOOPS 2.2 2 XOOPS editor framework implemented 3 permission management separated from forum/category and default permission set and management added @@ -381,21 +388,21 @@ Compatible with XOOPS 2.0, 2.2, 2.3 10 moderator management merged into forum admin form with xoopsuserselect form -1.15 -========================================== +
    1.15
    +
    1 fix for aged security problem (XSS) -1.14 -========================================== +
    1.14
    +
    1 bugfix for inactive user posting (Reported by Aries @ xoops.org.cn) 2 bugfix for deleting topic with poll (Reported by gropius @ xoops.org.cn) 3 change default value for displaying forum topic time duration (Reported by Zjerre @ xoops.org) 4 change formselectuser.php for XOOPS 2.2 -1.13 -========================================== +
    1.13
    +
    1 bugfix for IP recording (Reported by alitan @ xoops.org) 2 changing time display for "Today/yesterday ..." (Reported by alitan @ xoops.org) 3 adding post link (Preliminary solution by ackbarr && Suggested by Peekay @ xoops.org) @@ -412,8 +419,8 @@ Compatible with XOOPS 2.0, 2.2, 2.3 14 compatible with news 1.30+ for posttonews (reported by cosmodrum @ xoops.org) -1.12 -========================================== +
    1.12
    +
    1 login on-fly in "quick reply" (requested by Rou4 @ XOOPS CHINA) 2 sort order in viewpost.php (reported by kmac @ XOOPS CHINA) 3 bugfix for time display (reported by kmac @ XOOPS CHINA) @@ -424,8 +431,8 @@ Compatible with XOOPS 2.0, 2.2, 2.3 8 permission check for poll management (reported by karuna @ XOOPS CHINA) -1.11 -========================================== +
    1.11
    +
    1 re-write user info renderer 2 bugfix for poster display in thread mode (reported by iamtj @ XOOPS CHINA) 3 correction of deleting post message (reported by iamtj @ XOOPS CHINA) @@ -433,8 +440,8 @@ Compatible with XOOPS 2.0, 2.2, 2.3 5 correction of encoding problem in XOOPS function formatTimestamp($time, 'rss') (reported by chia @ XOOPS CHINA) -1.10 -========================================== +
    1.10
    +
    1 bugfix and layout improvement (suggested by iamtj @ XOOPS CHINA, fast reply in thread mode, anonymous button, register to post ...) 2 rolling back "RSS enable" (requested by Aries @ XOOPS CHINA, CeBepuH @ XOOPS) 3 bugfix for template dir in rss.php (reported by jodn007 @ XOOPS CHINA) @@ -450,8 +457,8 @@ Compatible with XOOPS 2.0, 2.2, 2.3 13 backward/forward compatible with XOOPS 2.0* -1.00 -========================================== +
    1.00
    +
    Changelog over NewBB 2.02: 1 CBB uses the same DB stucture/data with NewBB 2, it is convenient to switch between current CBB and current NewBB 2. 2 bugfixes for NewBB 2.02 diff --git a/edit.php b/edit.php index b78b4b73..e713c521 100644 --- a/edit.php +++ b/edit.php @@ -67,7 +67,7 @@ $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); } } - $page_query = htmlspecialchars(implode('&', array_values($query_array))); + $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); unset($query_array); redirect_header("viewtopic.php?{$page_query}", 2, $error_msg); } @@ -137,7 +137,7 @@ $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); } else { $poster_name = $post_contextObject->getVar('poster_name'); - $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous']) : $poster_name; + $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5) : $poster_name; } $p_date = formatTimestamp($post_contextObject->getVar('post_time')); $p_subject = $post_contextObject->getVar('subject'); diff --git a/header.php b/header.php index 1b93c75c..aab2008e 100644 --- a/header.php +++ b/header.php @@ -72,7 +72,7 @@ $menumode = 0; $menumode_other = []; -$menu_url = htmlspecialchars(preg_replace('/&menumode=[^&]/', '', Request::getString('REQUEST_URI', '', 'SERVER'))); +$menu_url = htmlspecialchars(preg_replace('/&menumode=[^&]/', '', Request::getString('REQUEST_URI', '', 'SERVER')), ENT_QUOTES | ENT_HTML5); $menu_url .= (false === strpos($menu_url, '?')) ? '?menumode=' : '&menumode='; //foreach ($GLOBALS['xoopsModuleConfig']['valid_menumodes'] as $key => $val) { // if ($key !== $menumode) { diff --git a/include/config.php b/include/config.php index 1c7a77b4..75b0dbc7 100644 --- a/include/config.php +++ b/include/config.php @@ -28,6 +28,9 @@ NEWBB_UPLOAD_PATH . '/thumbs' ]; +/** + * @return object + */ function getConfig() { $moduleDirName = basename(dirname(__DIR__)); diff --git a/include/form.post.php b/include/form.post.php index 079260f1..f19be030 100644 --- a/include/form.post.php +++ b/include/form.post.php @@ -101,7 +101,7 @@ //$filname = XOOPS_URL.$_SERVER['REQUEST_URI']; -$forum_form = new \XoopsThemeForm(htmlspecialchars(@$form_title), 'form_post', XOOPS_URL . '/modules/newbb/post.php', 'post', true); +$forum_form = new \XoopsThemeForm(htmlspecialchars(@$form_title, ENT_QUOTES | ENT_HTML5), 'form_post', XOOPS_URL . '/modules/newbb/post.php', 'post', true); $forum_form->setExtra('enctype="multipart/form-data"'); if ($editby) { diff --git a/include/functions.config.php b/include/functions.config.php index 196d009d..03112463 100644 --- a/include/functions.config.php +++ b/include/functions.config.php @@ -26,7 +26,7 @@ */ function newbbLoadConfig() { - require_once dirname(__DIR__) . '/class/Helper.php'; +// require_once dirname(__DIR__) . '/class/Helper.php'; //$helper = NewBB::getInstance(); $helper = Newbb\Helper::getInstance(); static $configs = null; diff --git a/include/functions.forum.php b/include/functions.forum.php index b461fac3..e4047285 100644 --- a/include/functions.forum.php +++ b/include/functions.forum.php @@ -138,7 +138,7 @@ function newbbCreateSubForumList() $criteria->setSort('cat_id ASC, parent_forum ASC, forum_order'); $criteria->setOrder('ASC'); $forumsObject = $forumHandler->getObjects($criteria); - require_once $GLOBALS['xoops']->path('modules/newbb/class/tree.php'); +// require_once $GLOBALS['xoops']->path('modules/newbb/class/tree.php'); $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); $forum_array = []; foreach (array_keys($forumsObject) as $key) { @@ -189,7 +189,7 @@ function newbbCreateParentForumList() $criteria->setSort('parent_forum'); $criteria->setOrder('ASC'); $forumsObject = $forumHandler->getObjects($criteria); - require_once $GLOBALS['xoops']->path('modules/newbb/class/tree.php'); +// require_once $GLOBALS['xoops']->path('modules/newbb/class/tree.php'); $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); $forum_array = []; foreach (array_keys($forumsObject) as $key) { diff --git a/include/functions.recon.php b/include/functions.recon.php index dab529b2..8c89377f 100644 --- a/include/functions.recon.php +++ b/include/functions.recon.php @@ -9,6 +9,8 @@ * @package module::newbb */ +use XoopsModules\Newbb; + // defined('XOOPS_ROOT_PATH') || die('Restricted access'); defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; diff --git a/include/functions.render.php b/include/functions.render.php index 90d041d1..6a1b0fd1 100644 --- a/include/functions.render.php +++ b/include/functions.render.php @@ -28,7 +28,7 @@ */ function newbbHtmlspecialchars(&$text) { - return preg_replace(['/&/i', '/ /i'], ['&', '&nbsp;'], htmlspecialchars($text)); + return preg_replace(['/&/i', '/ /i'], ['&', '&nbsp;'], htmlspecialchars($text, ENT_QUOTES | ENT_HTML5)); } /** diff --git a/include/functions.session.php b/include/functions.session.php index e69ea2f2..fa14f624 100644 --- a/include/functions.session.php +++ b/include/functions.session.php @@ -28,7 +28,7 @@ */ /** * @param $name - * @param string $string + * @param string|array $string */ function newbbSetSession($name, $string = '') { @@ -68,7 +68,7 @@ function newbbGetSession($name, $isArray = false) /** * @param $name - * @param string $string + * @param string|array $string * @param int $expire */ function newbbSetCookie($name, $string = '', $expire = 0) diff --git a/include/functions.welcome.inc.php b/include/functions.welcome.inc.php index fe7d43f2..006fc212 100644 --- a/include/functions.welcome.inc.php +++ b/include/functions.welcome.inc.php @@ -9,6 +9,8 @@ * @package module::newbb */ +use XoopsModules\Newbb; + global $xoopsModule, $myts, $xoopsUser, $forumObject; if (!defined('XOOPS_ROOT_PATH') || !is_object($forumObject) || !is_object($GLOBALS['xoopsUser']) diff --git a/include/onupdate.php b/include/onupdate.php index a0a5a51a..79123d27 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -88,7 +88,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null if ($tables->useTable($table)) { $tables->alterColumn($table, $column, $attributes, $newName); if (!$tables->executeQueue()) { - echo '
    ' . _AM_XXXXX_UPGRADEFAILED0 . ' ' . $migrate->getLastError(); + echo '
    ' . _AM_NEWBB_UPGRADEFAILED0 . ' ' . $migrate->getLastError(); } } diff --git a/list.topic.php b/list.topic.php index f3bb134d..28ea0f2c 100644 --- a/list.topic.php +++ b/list.topic.php @@ -30,7 +30,7 @@ require_once __DIR__ . '/include/functions.render.php'; // irmtfan use require_once because it will redeclared in newbb/blocks/list_topic.php -require_once __DIR__ . '/./class/TopicRenderer.php'; +//require_once __DIR__ . '/./class/TopicRenderer.php'; $topic_renderer = Newbb\TopicRenderer::getInstance(); $topic_renderer->userlevel = $GLOBALS['xoopsUserIsAdmin'] ? 2 : is_object($GLOBALS['xoopsUser']); // irmtfan if list topic block is in the page then force to parse diff --git a/newtopic.php b/newtopic.php index a3ba69ba..45e4699f 100644 --- a/newtopic.php +++ b/newtopic.php @@ -39,7 +39,7 @@ $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); } } - $page_query = htmlspecialchars(implode('&', array_values($query_array))); + $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); unset($query_array); redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query}", 2, _MD_NEWBB_NORIGHTTOPOST); } diff --git a/polls.php b/polls.php index cc199a1e..db83ec6f 100644 --- a/polls.php +++ b/polls.php @@ -18,6 +18,8 @@ use Xmf\Request; use XoopsModules\Newbb; +use XoopsModules\Xoopspoll; +//use XoopsModules\Xoopspoll\Constants; // rewrite by irmtfan and zyspec to accept xoopspoll 1.4 and all old xoopspoll and umfrage versions and all clones @@ -76,7 +78,7 @@ xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_load('request', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_loadLanguage('admin', $GLOBALS['xoopsModuleConfig']['poll_module']); - /** @var \XoopspollPollHandler $xpPollHandler */ + /** @var Xoopspoll\PollHandler $xpPollHandler */ $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); /** @var \XoopsPoll $pollObject */ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist @@ -292,10 +294,10 @@ $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { // if notify, set mail status to "not mailed" - $pollObject->setVar('mail_status', POLL_NOTMAILED); + $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_NOT_MAILED); } else { // if not notify, set mail status to already "mailed" - $pollObject->setVar('mail_status', POLL_MAILED); + $pollObject->setVar('mail_status', Xoopspoll\Constants::POLL_MAILED); } $new_poll_id = $pollObject->store(); if (empty($new_poll_id)) { @@ -307,7 +309,7 @@ $classOption = $classPoll . 'Option'; foreach ($option_text as $optxt) { $optxt = trim($optxt); - /** @var XoopspollOption $optionObject */ + /** @var Xoopspoll\Option $optionObject */ $optionObject = new $classOption(); if ('' !== $optxt) { $optionObject->setVar('option_text', $optxt); @@ -349,12 +351,12 @@ // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - /** @var \XoopspollOptionHandler $xpOptHandler */ + /** @var Xoopspoll\OptionHandler $xpOptHandler */ $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); - /** @var \XoopspollLogHandler $xpLogHandler */ + /** @var Xoopspoll\LogHandler $xpLogHandler */ $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; + $classConstants = new XoopsModules\Xoopspoll\Constants(); $notify = Request::getInt('notify', $classConstants::NOTIFICATION_ENABLED, 'POST'); $currentTimestamp = time(); //$xuEndTimestamp = method_exists('XoopsLocal', 'strtotime') ? XoopsLocal::strtotime(Request::getString('xu_end_time', null, 'POST')) @@ -450,10 +452,10 @@ $pollObject->setVar('user_id', Request::getInt('user_id', 0, 'POST')); if (Request::getInt('notify', 0, 'POST') && $end_time > time()) { // if notify, set mail status to "not mailed" - $pollObject->setVar('mail_status', POLL_NOTMAILED); + $pollObject->setVar('mail_status', $classConstants::POLL_NOT_MAILED); } else { // if not notify, set mail status to already "mailed" - $pollObject->setVar('mail_status', POLL_MAILED); + $pollObject->setVar('mail_status', $classConstants::POLL_MAILED); } if (!$pollObject->store()) { @@ -642,7 +644,7 @@ case 'restart': // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; + $classConstants = new XoopsModules\Xoopspoll\Constants(); $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; // old xoopspoll or umfrage or any clone from them } else { @@ -679,15 +681,15 @@ // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; + $classConstants = new XoopsModules\Xoopspoll\Constants(); $default_poll_duration = $classConstants::DEFAULT_POLL_DURATION; $poll_not_mailed = $classConstants::POLL_NOT_MAILED; $poll_mailed = $classConstants::POLL_MAILED; // old xoopspoll or umfrage or any clone from them } else { $default_poll_duration = (86400 * 10); - $poll_not_mailed = POLL_NOTMAILED; - $poll_mailed = POLL_MAILED; + $poll_not_mailed = Xoopspoll\Constants::POLL_NOT_MAILED; + $poll_mailed = Xoopspoll\Constants::POLL_MAILED; } $end_time = !Request::getInt('end_time', 0, 'POST'); @@ -714,9 +716,9 @@ exit(); } if (Request::getInt('reset', 0, 'POST')) { // reset all vote/voter counters - /** @var \XoopspollOptionHandler $xpOptHandler */ + /** @var Xoopspoll\OptionHandler $xpOptHandler */ $xpOptHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); - /** @var \XoopspollLogHandler $xpLogHandler */ + /** @var Xoopspoll\LogHandler $xpLogHandler */ $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); $xpLogHandler->deleteByPollId($poll_id); $xpOptHandler->resetCountByPollId($poll_id); diff --git a/post.php b/post.php index b9d50636..9701b21e 100644 --- a/post.php +++ b/post.php @@ -251,7 +251,7 @@ if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name'] && $topicHandler->getPermission($forumObject, $topic_status, 'attach')) { - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'); +// require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'); $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024; $uploaddir = XOOPS_CACHE_PATH; @@ -423,7 +423,7 @@ $error_upload = ''; if (isset($_FILES['userfile']['name']) && '' !== $_FILES['userfile']['name']) { - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'); +// require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'); $maxfilesize = $forumObject->getVar('attach_maxkb') * 1024; $uploaddir = XOOPS_CACHE_PATH; @@ -488,7 +488,7 @@ $p_name = newbbGetUnameFromId($postObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); } if (empty($p_name)) { - $p_name = Request::getString('poster_name', '', 'POST') ? htmlspecialchars(Request::getString('poster_name', '', 'POST')) : htmlspecialchars($GLOBALS['xoopsConfig']['anonymous']); + $p_name = Request::getString('poster_name', '', 'POST') ? htmlspecialchars(Request::getString('poster_name', '', 'POST'), ENT_QUOTES | ENT_HTML5) : htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5); } $post_preview = [ diff --git a/reply.php b/reply.php index 1a4e94f8..9edce244 100644 --- a/reply.php +++ b/reply.php @@ -81,7 +81,7 @@ $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); } } - $page_query = htmlspecialchars(implode('&', array_values($query_array))); + $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); unset($query_array); redirect_header("viewtopic.php?{$page_query}", 2, _MD_NEWBB_NORIGHTTOREPLY); @@ -191,7 +191,7 @@ $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); } else { $poster_name = $post_contextObject->getVar('poster_name'); - $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous']) : $poster_name; + $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5) : $poster_name; } $p_date = formatTimestamp($post_contextObject->getVar('post_time')); $p_subject = $post_contextObject->getVar('subject'); diff --git a/search.php b/search.php index 124e45b0..5838acc5 100644 --- a/search.php +++ b/search.php @@ -231,14 +231,14 @@ if ($num_results == $limit) { $next = $start + $limit; $queries = implode(',', $queries); - $search_url_next = htmlspecialchars($search_url . "&direction=next&start={$next}"); + $search_url_next = htmlspecialchars($search_url . "&direction=next&start={$next}", ENT_QUOTES | ENT_HTML5); $search_next = '' . _SR_NEXT . ''; $xoopsTpl->assign('search_next', $search_next); $xoopsTpl->assign('search_next_url', $search_url_next); } if ($start > 0) { $prev = $start - $limit; - $search_url_prev = htmlspecialchars($search_url . "&direction=previous&start={$prev}"); + $search_url_prev = htmlspecialchars($search_url . "&direction=previous&start={$prev}", ENT_QUOTES | ENT_HTML5); $search_prev = '' . _SR_PREVIOUS . ''; $xoopsTpl->assign('search_prev', $search_prev); $xoopsTpl->assign('search_prev_url', $search_url_prev); diff --git a/viewforum.php b/viewforum.php index 0be3133f..426b8d86 100644 --- a/viewforum.php +++ b/viewforum.php @@ -127,7 +127,7 @@ } else { $xoopsTpl->assign('viewer_level', 0); if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { - $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri)); + $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); $xoopsTpl->assign('forum_post_or_register', "" . _MD_NEWBB_REGTOPOST . ''); $xoopsTpl->assign('forum_addpoll', ''); } else { diff --git a/viewpost.php b/viewpost.php index 5149f84d..3706d345 100644 --- a/viewpost.php +++ b/viewpost.php @@ -260,7 +260,7 @@ $post_title = $post->getVar('subject'); if ($posticon = $post->getVar('icon')) { - $post_image = ''; + $post_image = ''; } else { $post_image = ''; } diff --git a/viewtopic.php b/viewtopic.php index cb40bf34..40e310d5 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -48,7 +48,7 @@ $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); } } -$page_query = htmlspecialchars(implode('&', array_values($query_array))); +$page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); unset($query_array); $forum_id = Request::getInt('forum', 0, 'GET'); @@ -237,7 +237,7 @@ $xoopsTpl->assign('topic_lock', _MD_NEWBB_TOPICLOCKED); } if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { - $xoopsTpl->assign('forum_register', '' . _MD_NEWBB_REGTOPOST . ''); + $xoopsTpl->assign('forum_register', '' . _MD_NEWBB_REGTOPOST . ''); } } // irmtfan for backward compatibility assign forum_post_or_register smarty again. @@ -273,7 +273,7 @@ $viewtopic_users = []; if (is_array($userid_array) && count($userid_array) > 0) { - require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); +// require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); $userHandler->users = $users; $userHandler->online = $online; diff --git a/votepolls.php b/votepolls.php index 684020d5..b6112903 100644 --- a/votepolls.php +++ b/votepolls.php @@ -56,7 +56,7 @@ $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); /** @var Xoopspoll\LogHandler $xpLogHandler */ $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); - /** @var Xoopspoll $pollObject */ + /** @var Xoopspoll\Poll $pollObject */ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist // old xoopspoll or umfrage or any clone from them } else { diff --git a/xoops_version.php b/xoops_version.php index bff1139c..510eaccb 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -14,8 +14,8 @@ $moduleDirName = basename(__DIR__); $modversion = [ 'version' => 5.00, - 'module_status' => 'Alpha 1', - 'release_date' => '2017/09/12', + 'module_status' => 'Beta 1', + 'release_date' => '2018/03/25', 'name' => _MI_NEWBB_NAME, 'description' => _MI_NEWBB_DESC, 'help' => 'page=help', From ce3623413bf71b848e39dfd528b826dc5b6061bd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 25 Mar 2018 02:42:58 -0400 Subject: [PATCH 119/170] 5.00 Beta 1 --- blocks/newbb_block.php | 2 +- docs/changelog.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index 380a9afc..7b546ab0 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -568,7 +568,7 @@ function b_newbb_post_show($options) /** * @param $options - * @return array + * @return array|bool */ function b_newbb_author_show($options) { diff --git a/docs/changelog.txt b/docs/changelog.txt index 550cb0bf..76a6285a 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,4 @@ -
    5.00 Beta 1 [NOT RELEASED]
    Dev: Xoops 2.5.9, PHP 7.2.3 +
    5.00 Beta 1 [2018-03-25]
    Dev: Xoops 2.5.9, PHP 7.2.3
    - RGB to HEX (mamba) - changed exit() to die() (mamba) From 0aafb2e4934c1c157fb38662054cb077c661ab8b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 29 Mar 2018 18:50:08 -0400 Subject: [PATCH 120/170] updates Signed-off-by: mambax7 --- class/ForumHandler.php | 4 ++-- class/Helper.php | 5 +++-- class/ReadForum.php | 8 ++++++-- class/ReadForumHandler.php | 4 ++-- class/Readtopic.php | 7 +++++-- class/ReadtopicHandler.php | 4 ++-- include/functions.config.php | 2 +- include/functions.forum.php | 4 ++-- language/english/help/helpheader.tpl | 2 +- language/english/modinfo.php | 1 + 10 files changed, 25 insertions(+), 16 deletions(-) diff --git a/class/ForumHandler.php b/class/ForumHandler.php index ae2676c9..b40e7467 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -947,7 +947,7 @@ public function &getTree($cat_id = 0, $pid = 0, $permission = 'access', $prefix } $forumsObject = $this->getByPermission($cat_id, $perm_string, $tags); - require_once __DIR__ . '/tree.php'; + require_once __DIR__ . '/Tree.php'; $forums_structured = []; foreach (array_keys($forumsObject) as $key) { $forums_structured[$forumsObject[$key]->getVar('cat_id')][$key] = $forumsObject[$key]; @@ -983,7 +983,7 @@ public function &getArrayTree($cat_id = 0, $pid = 0, $permission = 'access', $ta } $forumsObject = $this->getByPermission($cat_id, $perm_string, $tags); - require_once __DIR__ . '/tree.php'; + require_once __DIR__ . '/Tree.php'; $forums_structured = []; foreach (array_keys($forumsObject) as $key) { $forumObject =& $forumsObject[$key]; diff --git a/class/Helper.php b/class/Helper.php index 269434fd..19ce62b9 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -29,13 +29,14 @@ class Helper extends \Xmf\Module\Helper public $debug; /** - * @internal param $debug + * * @param bool $debug */ protected function __construct($debug = false) { $this->debug = $debug; - parent::__construct(basename(dirname(__DIR__))); + $moduleDirName = basename(dirname(__DIR__)); + parent::__construct($moduleDirName); } /** diff --git a/class/ReadForum.php b/class/ReadForum.php index 2dd4b1d7..015060c5 100644 --- a/class/ReadForum.php +++ b/class/ReadForum.php @@ -29,7 +29,11 @@ // URL: https://xoops.org // // Project: Article Project // // ------------------------------------------------------------------------ // -require_once __DIR__ . '/read.php'; + +use XoopsModules\Newbb; + + +require_once __DIR__ . '/Read.php'; /** * A handler for read/unread handling @@ -39,7 +43,7 @@ * @author D.J. (phppp, http://xoopsforge.com) * @copyright copyright (c) 2005 XOOPS.org */ -class ReadForum extends Read +class ReadForum extends Newbb\Read { /** * diff --git a/class/ReadForumHandler.php b/class/ReadForumHandler.php index 632bba8d..44f79c4a 100644 --- a/class/ReadForumHandler.php +++ b/class/ReadForumHandler.php @@ -32,7 +32,7 @@ use XoopsModules\Newbb; -require_once __DIR__ . '/read.php'; +require_once __DIR__ . '/Read.php'; /** * A handler for read/unread handling @@ -46,7 +46,7 @@ /** * Class ReadForumHandler */ -class ReadForumHandler extends ReadHandler +class ReadForumHandler extends Newbb\ReadHandler { /** * @param \XoopsDatabase|null $db diff --git a/class/Readtopic.php b/class/Readtopic.php index de9c171a..9ad8689d 100644 --- a/class/Readtopic.php +++ b/class/Readtopic.php @@ -29,7 +29,10 @@ // URL: https://xoops.org // // Project: Article Project // // ------------------------------------------------------------------------ // -require_once __DIR__ . '/read.php'; + +use XoopsModules\Newbb; + +require_once __DIR__ . '/Read.php'; /** * A handler for read/unread handling @@ -39,7 +42,7 @@ * @author D.J. (phppp, http://xoopsforge.com) * @copyright copyright (c) 2005 XOOPS.org */ -class Readtopic extends Read +class Readtopic extends Newbb\Read { /** * diff --git a/class/ReadtopicHandler.php b/class/ReadtopicHandler.php index 32e8bfd4..a4a48fab 100644 --- a/class/ReadtopicHandler.php +++ b/class/ReadtopicHandler.php @@ -32,7 +32,7 @@ use XoopsModules\Newbb; -require_once __DIR__ . '/read.php'; +require_once __DIR__ . '/Read.php'; /** * A handler for read/unread handling @@ -46,7 +46,7 @@ /** * Class ReadtopicHandler */ -class ReadtopicHandler extends ReadHandler +class ReadtopicHandler extends Newbb\ReadHandler { /** * maximum records per forum for one user. diff --git a/include/functions.config.php b/include/functions.config.php index 03112463..9e0a93e5 100644 --- a/include/functions.config.php +++ b/include/functions.config.php @@ -28,7 +28,7 @@ function newbbLoadConfig() { // require_once dirname(__DIR__) . '/class/Helper.php'; //$helper = NewBB::getInstance(); - $helper = Newbb\Helper::getInstance(); + $helper = \XoopsModules\Newbb\Helper::getInstance(); static $configs = null; if (null !== $configs) { diff --git a/include/functions.forum.php b/include/functions.forum.php index e4047285..3f599566 100644 --- a/include/functions.forum.php +++ b/include/functions.forum.php @@ -138,7 +138,7 @@ function newbbCreateSubForumList() $criteria->setSort('cat_id ASC, parent_forum ASC, forum_order'); $criteria->setOrder('ASC'); $forumsObject = $forumHandler->getObjects($criteria); -// require_once $GLOBALS['xoops']->path('modules/newbb/class/tree.php'); +// require_once $GLOBALS['xoops']->path('modules/newbb/class/Tree.php'); $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); $forum_array = []; foreach (array_keys($forumsObject) as $key) { @@ -189,7 +189,7 @@ function newbbCreateParentForumList() $criteria->setSort('parent_forum'); $criteria->setOrder('ASC'); $forumsObject = $forumHandler->getObjects($criteria); -// require_once $GLOBALS['xoops']->path('modules/newbb/class/tree.php'); +// require_once $GLOBALS['xoops']->path('modules/newbb/class/Tree.php'); $tree = new Newbb\ObjectTree($forumsObject, 'forum_id', 'parent_forum'); $forum_array = []; foreach (array_keys($forumsObject) as $key) { diff --git a/language/english/help/helpheader.tpl b/language/english/help/helpheader.tpl index 9b9de700..2f0e3205 100644 --- a/language/english/help/helpheader.tpl +++ b/language/english/help/helpheader.tpl @@ -1,4 +1,4 @@ -

    <{$smarty.const._AM_NEWBB_HELP}>:  +

    <{$smarty.const._MI_NEWBB_HELP}>:  <{$smarty.const._MI_NEWBB_NAME}>  <{$smarty.const._MI_NEWBB_BACK_2_ADMIN}> <{$smarty.const._MI_NEWBB_NAME}> diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 62c70d5e..21eb814b 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -323,6 +323,7 @@ define('_MI_NEWBB_POLL_MODULE_DESC', 'XoopsPoll or clone. Leave blank to disable.'); //Help +define('_MI_NEWBB_HELP', 'Help'); define('_MI_NEWBB_DIRNAME', basename(dirname(dirname(__DIR__)))); define('_MI_NEWBB_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); define('_MI_NEWBB_BACK_2_ADMIN', 'Back to Administration of '); From 799498265dcc0a7e7191ce49b78fd130d910c0c4 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 31 Mar 2018 04:07:28 -0400 Subject: [PATCH 121/170] Request:: Signed-off-by: mambax7 --- xoops_version.php | 1 + 1 file changed, 1 insertion(+) diff --git a/xoops_version.php b/xoops_version.php index 510eaccb..d0553d57 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -12,6 +12,7 @@ include __DIR__ . '/preloads/autoloader.php'; $moduleDirName = basename(__DIR__); + $modversion = [ 'version' => 5.00, 'module_status' => 'Beta 1', From 0143466a8ec3998cb215d7d8eb217445ffb1b885 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 4 Apr 2018 08:13:26 -0400 Subject: [PATCH 122/170] updates Signed-off-by: mambax7 --- admin/index.php | 2 +- class/GroupPermForm.php | 6 +++--- class/Helper.php | 2 +- class/PermissionCategoryHandler.php | 6 +++--- class/PermissionForumHandler.php | 4 ++-- class/PermissionHandler.php | 2 +- class/PostHandler.php | 6 +++--- class/User.php | 2 +- include/functions.welcome.inc.php | 2 +- include/module.php | 12 ++++++------ include/oninstall.php | 16 ++++++++-------- include/onuninstall.php | 10 +++++----- include/onupdate.php | 10 +++++----- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/admin/index.php b/admin/index.php index 57c82689..a97fd41b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -192,6 +192,6 @@ function return_bytes($sizeAsString, $b = false) $base = log($sizeAsString) / log(1024); $suffix = ['', 'KB', 'MB', 'GB', 'TB']; - return round(pow(1024, $base - floor($base))) . ' ' . $suffix[(int)floor($base)]; + return round(1024 ** ($base - floor($base))) . ' ' . $suffix[(int)floor($base)]; } } diff --git a/class/GroupPermForm.php b/class/GroupPermForm.php index faa6aed6..16543471 100644 --- a/class/GroupPermForm.php +++ b/class/GroupPermForm.php @@ -46,14 +46,14 @@ public function render() $this->_itemTree[$item_id]['allchild'] = []; $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); } - /** @var \XoopsGroupPermHandler $gpermHandler */ - $gpermHandler = xoops_getHandler('groupperm'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); foreach (array_keys($glist) as $i) { // get selected item id(s) for each group - $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); + $selected = $grouppermHandler->getItemIds($this->_permName, $i, $this->_modid); $ele = new Newbb\GroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); $ele->setOptionTree($this->_itemTree); $this->addElement($ele); diff --git a/class/Helper.php b/class/Helper.php index 19ce62b9..7afdbbb7 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -32,7 +32,7 @@ class Helper extends \Xmf\Module\Helper * * @param bool $debug */ - protected function __construct($debug = false) + public function __construct($debug = false) { $this->debug = $debug; $moduleDirName = basename(dirname(__DIR__)); diff --git a/class/PermissionCategoryHandler.php b/class/PermissionCategoryHandler.php index 06fee27d..74061598 100644 --- a/class/PermissionCategoryHandler.php +++ b/class/PermissionCategoryHandler.php @@ -59,13 +59,13 @@ public function deleteByCategory($cat_id) if (empty($cat_id)) { return false; } - /** @var \XoopsGroupPermHandler $gpermHandler */ - $gpermHandler = xoops_getHandler('groupperm'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'))); $criteria->add(new \Criteria('gperm_name', 'category_access')); $criteria->add(new \Criteria('gperm_itemid', $cat_id)); - return $gpermHandler->deleteAll($criteria); + return $grouppermHandler->deleteAll($criteria); } /** diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index 508dab15..7f07943d 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -204,13 +204,13 @@ public function deleteByForum($forum_id) if (empty($forum_id)) { return false; } - $gpermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'))); $items = $this->getValidPerms(true); $criteria->add(new \Criteria('gperm_name', "('" . implode("', '", $items) . "')", 'IN')); $criteria->add(new \Criteria('gperm_itemid', $forum_id)); - return $gpermHandler->deleteAll($criteria); + return $grouppermHandler->deleteAll($criteria); } /** diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 3f695444..2550cfec 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -249,7 +249,7 @@ public function createPermData($perm_name = 'forum_all') $perms[$perm_name][$item_id] = $groups; } } else { - $gpermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); $criteria = new \CriteriaCompo(new \Criteria('gperm_modid', $modid)); if (!empty($perm_name) && 'forum_all' !== $perm_name && 'category_all' !== $perm_name) { $criteria->add(new \Criteria('gperm_name', $perm_name)); diff --git a/class/PostHandler.php b/class/PostHandler.php index a56969db..994e2265 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -393,7 +393,7 @@ public function myDelete(Post $post, $force = false) } $post->deleteAttachment(); - $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts_text'), $post->getVar('post_id')); + $sql = sprintf('DELETE FROM `%s` WHERE post_id = %u', $this->db->prefix('newbb_posts_text'), $post->getVar('post_id')); if (!$result = $this->db->queryF($sql)) { $post->setErrors('Could not remove post text: ' . $sql); @@ -422,11 +422,11 @@ public function myDelete(Post $post, $force = false) // END irmtfan poll_module } - $sql = sprintf('DELETE FROM %s WHERE topic_id = %u', $this->db->prefix('newbb_topics'), $post->getVar('topic_id')); + $sql = sprintf('DELETE FROM `%s` WHERE topic_id = %u', $this->db->prefix('newbb_topics'), $post->getVar('topic_id')); if (!$result = $this->db->queryF($sql)) { //xoops_error($this->db->error()); } - $sql = sprintf('DELETE FROM %s WHERE topic_id = %u', $this->db->prefix('newbb_votedata'), $post->getVar('topic_id')); + $sql = sprintf('DELETE FROM `%s` WHERE topic_id = %u', $this->db->prefix('newbb_votedata'), $post->getVar('topic_id')); if (!$result = $this->db->queryF($sql)) { //xoops_error($this->db->error()); } diff --git a/class/User.php b/class/User.php index f5c51ef3..ab7129c2 100644 --- a/class/User.php +++ b/class/User.php @@ -32,7 +32,7 @@ function newbb_calculateLevel($RPG, $RPGDIFF) $exp = 1; } $ppd = round($RPG / $exp, 0); - $level = pow(log10($RPG), 3); + $level = log10($RPG) ** 3; $ep = floor(100 * ($level - floor($level))); $showlevel = floor($level + 1); $hpmulti = round($ppd / 6, 1); diff --git a/include/functions.welcome.inc.php b/include/functions.welcome.inc.php index 006fc212..280aed57 100644 --- a/include/functions.welcome.inc.php +++ b/include/functions.welcome.inc.php @@ -41,7 +41,7 @@ /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); if ($mod = @$moduleHandler->getByDirname('profile', true)) { - $gpermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); $groups = [XOOPS_GROUP_ANONYMOUS, XOOPS_GROUP_USERS]; if (!defined('_PROFILE_MA_ALLABOUT')) { diff --git a/include/module.php b/include/module.php index 0dbc588d..b876bfc5 100644 --- a/include/module.php +++ b/include/module.php @@ -149,8 +149,8 @@ function xoops_module_install_newbb(\XoopsModule $module) /* Set corresponding permissions for the category and the forum */ $module_id = $module->getVar('mid'); - /** @var XoopsGroupPermHandler $gpermHandler */ - $gpermHandler = xoops_getHandler('groupperm'); + /** @var XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); $groups_view = [XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS]; $groups_post = [XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS]; // irmtfan bug fix: html and signature permissions, add: pdf and print permissions @@ -170,13 +170,13 @@ function xoops_module_install_newbb(\XoopsModule $module) 'print' ]; foreach ($groups_view as $group_id) { - $gpermHandler->addRight('category_access', $cat_id, $group_id, $module_id); - $gpermHandler->addRight('forum_access', $forum_id, $group_id, $module_id); - $gpermHandler->addRight('forum_view', $forum_id, $group_id, $module_id); + $grouppermHandler->addRight('category_access', $cat_id, $group_id, $module_id); + $grouppermHandler->addRight('forum_access', $forum_id, $group_id, $module_id); + $grouppermHandler->addRight('forum_view', $forum_id, $group_id, $module_id); } foreach ($groups_post as $group_id) { foreach ($post_items as $item) { - $gpermHandler->addRight('forum_' . $item, $forum_id, $group_id, $module_id); + $grouppermHandler->addRight('forum_' . $item, $forum_id, $group_id, $module_id); } } diff --git a/include/oninstall.php b/include/oninstall.php index 71f5bee5..03728a60 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -71,19 +71,19 @@ function xoops_module_install_newbb(\XoopsModule $module) global $xoopsModule; $moduleId = $xoopsModule->getVar('mid'); $moduleId2 = $helper->getModule()->mid(); - $gpermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); // access rights ------------------------------------------ - $gpermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); - $gpermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); - $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); - $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); - $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); // --- CREATE FOLDERS --------------- if (count($configurator->uploadFolders) > 0) { // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->uploadFolders) as $i) { - $utilityClass::createFolder($configurator->uploadFolders[$i]); + $utility::createFolder($configurator->uploadFolders[$i]); } } @@ -92,7 +92,7 @@ function xoops_module_install_newbb(\XoopsModule $module) $file = __DIR__ . '/../assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; - $utilityClass::copyFile($file, $dest); + $utility::copyFile($file, $dest); } } //delete .html entries from the tpl table diff --git a/include/onuninstall.php b/include/onuninstall.php index ba2c56f4..d20d1485 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -37,14 +37,14 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) $moduleDirName = basename(dirname(__DIR__)); $xsitemapHelper = \Xmf\Module\Helper::getHelper($moduleDirName); - /** @var Newbb\Utility $utilityClass */ - $utilityClass = ucfirst($moduleDirName) . 'Utility'; - if (!class_exists($utilityClass)) { + /** @var Newbb\Utility $utility */ + $utility = ucfirst($moduleDirName) . 'Utility'; + if (!class_exists($utility)) { xoops_load('utility', $moduleDirName); } $success = true; - $xsitemapHelper->loadLanguage('admin'); + $helper->loadLanguage('admin'); //------------------------------------------------------------------ // Remove uploads folder (and all subfolders) if they exist @@ -55,7 +55,7 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) $dirInfo = new \SplFileInfo($old_dir); if ($dirInfo->isDir()) { // The directory exists so delete it - if (false === $utilityClass::rrmdir($old_dir)) { + if (false === $utility::rrmdir($old_dir)) { $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); $success = false; } diff --git a/include/onupdate.php b/include/onupdate.php index 79123d27..e05a2402 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -137,7 +137,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null if (count($configurator->uploadFolders) > 0) { // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->uploadFolders) as $i) { - $utilityClass::createFolder($configurator->uploadFolders[$i]); + $utility::createFolder($configurator->uploadFolders[$i]); } } @@ -146,7 +146,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null $file = __DIR__ . '/../assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; - $utilityClass::copyFile($file, $dest); + $utility::copyFile($file, $dest); } } @@ -154,9 +154,9 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; $GLOBALS['xoopsDB']->queryF($sql); - /** @var XoopsGroupPermHandler $gpermHandler */ - $gpermHandler = xoops_getHandler('groupperm'); - return $gpermHandler->deleteByModule($module->getVar('mid'), 'item_read'); + /** @var XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); + return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); } return true; } From a1eeebd90dc293e45be3fec1adf2efacae7daa3d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 6 Apr 2018 12:01:09 -0400 Subject: [PATCH 123/170] Request:: Signed-off-by: mambax7 --- class/PermissionHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 2550cfec..cb1b4e32 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -377,7 +377,7 @@ public function deleteRight($perm, $itemid, $groupid, $mid = null) $criteria->add(new \Criteria('gperm_groupid', $groupid)); $criteria->add(new \Criteria('gperm_itemid', $itemid)); $criteria->add(new \Criteria('gperm_modid', $mid)); - $permsObject =& $this->getObjects($criteria); + $permsObject = $this->getObjects($criteria); if (!empty($permsObject)) { foreach ($permsObject as $permObject) { $this->delete($permObject); From b99278f85c3c6dda849fafa20787fb927a5e15fd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 7 Apr 2018 19:04:05 -0400 Subject: [PATCH 124/170] updates Signed-off-by: mambax7 --- include/functions.session.php | 1 - 1 file changed, 1 deletion(-) diff --git a/include/functions.session.php b/include/functions.session.php index fa14f624..2e5d324a 100644 --- a/include/functions.session.php +++ b/include/functions.session.php @@ -15,7 +15,6 @@ defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_SESSION_LOADED', true); -xoops_load('XoopsRequest'); if (!defined('NEWBB_FUNCTIONS_SESSION')) { define('NEWBB_FUNCTIONS_SESSION', 1); From 4b04c44958f02c7878237c43b309e684862f3b99 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 7 Apr 2018 23:53:29 -0400 Subject: [PATCH 125/170] constants --- class/Constants.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 class/Constants.php diff --git a/class/Constants.php b/class/Constants.php new file mode 100644 index 00000000..36e3d9ce --- /dev/null +++ b/class/Constants.php @@ -0,0 +1,35 @@ + Date: Sat, 14 Apr 2018 23:05:52 -0400 Subject: [PATCH 126/170] Updates Signed-off-by: mambax7 --- .scrutinizer.yml | 62 +++++--------------------------- admin/admin_cat_manager.php | 2 +- admin/admin_forum_manager.php | 4 +-- admin/admin_forum_prune.php | 2 +- admin/admin_header.php | 2 +- admin/admin_report.php | 2 +- admin/admin_synchronization.php | 2 +- admin/index.php | 4 +-- admin/menu.php | 4 +-- blocks/list_topic.php | 12 +++---- blocks/newbb_block.php | 28 +++++++-------- class/Common/Configurator.php | 4 +-- class/ForumHandler.php | 2 +- class/OnlineHandler.php | 10 +++--- class/PermissionForumHandler.php | 2 +- class/Post.php | 8 ++--- class/Topic.php | 3 +- class/TopicHandler.php | 2 +- class/TopicRenderer.php | 12 +++---- class/User.php | 2 +- class/UserHandler.php | 2 +- include/common.php | 44 +++++++++++------------ include/config.php | 6 ++-- include/functions.user.php | 8 ++--- include/module.php | 2 +- include/oninstall.php | 29 +++------------ include/onuninstall.php | 7 ++-- include/onupdate.php | 2 +- preloads/autoloader.php | 2 +- preloads/core.php | 2 +- viewpost.php | 2 +- 31 files changed, 103 insertions(+), 172 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index c933b14f..5310fdfe 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,57 +1,13 @@ +# language: php +checks: + php: true build: nodes: + tests: true analysis: - project_setup: - override: true tests: - override: [php-scrutinizer-run] -checks: - php: - code_rating: true - variable_existence: true - useless_calls: true - use_statement_alias_conflict: true - unused_variables: true - unused_properties: true - unused_parameters: true - unused_methods: true - unreachable_code: true - sql_injection_vulnerabilities: true - security_vulnerabilities: true - precedence_mistakes: true - precedence_in_conditions: true - parameter_non_unique: true - no_property_on_interface: true - no_non_implemented_abstract_methods: true - deprecated_code_usage: true - closure_use_not_conflicting: true - closure_use_modifiable: true - avoid_useless_overridden_methods: true - avoid_conflicting_incrementers: true - assignment_of_null_return: true - verify_property_names: true - verify_argument_usable_as_reference: true - verify_access_scope_valid: true - use_self_instead_of_fqcn: true - too_many_arguments: true - single_namespace_per_use: true - return_doc_comment_if_not_inferrable: true - return_doc_comments: true - require_scope_for_methods: true - require_scope_for_properties: true - require_php_tag_first: true - require_braces_around_control_structures: true - psr2_control_structure_declaration: true - psr2_switch_declaration: true - psr2_class_declaration: true - no_eval: true - no_else_if_statements: true - avoid_corrupting_byteorder_marks: true - argument_type_checks: true - php5_style_constructor: true - parameter_doc_comments: true - no_duplicate_arguments: true - missing_arguments: true - instanceof_class_exists: true - foreach_traversable: true - no_unnecessary_function_call_in_for_loop: true + override: + - + command: phpcs-run + use_website_config: true + - php-scrutinizer-run diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index fb3f55db..33f0d7e9 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -33,7 +33,7 @@ use XoopsModules\Newbb; require_once __DIR__ . '/admin_header.php'; -require_once __DIR__ . '/../include/functions.render.php'; +require_once dirname(__DIR__) . '/include/functions.render.php'; xoops_cp_header(); diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index 64aee416..542f19d7 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -35,8 +35,8 @@ require_once __DIR__ . '/admin_header.php'; include $GLOBALS['xoops']->path('class/xoopstree.php'); require_once $GLOBALS['xoops']->path('class/pagenav.php'); -require_once __DIR__ . '/../include/functions.forum.php'; -require_once __DIR__ . '/../include/functions.render.php'; +require_once dirname(__DIR__) . '/include/functions.forum.php'; +require_once dirname(__DIR__) . '/include/functions.render.php'; $cacheHelper = Newbb\Utility::cleanCache(); diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index e920735a..0f838f8e 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -180,7 +180,7 @@ $sform->addElement($days); // START irmtfan remove hardcode db access require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files - require_once __DIR__ . '/../include/functions.forum.php'; + require_once dirname(__DIR__) . '/include/functions.forum.php'; $forumSelMulti = ""; // disable all categories $forumSelBox = ''; diff --git a/admin/admin_header.php b/admin/admin_header.php index 188f9bb6..1f136893 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -33,7 +33,7 @@ use XoopsModules\Newbb; //include $GLOBALS['xoops']->path('include/cp_header.php'); -include __DIR__ . '/../../../include/cp_header.php'; +include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'); require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php'); require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php'); diff --git a/admin/admin_report.php b/admin/admin_report.php index 48046347..0c3fcb59 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -91,7 +91,7 @@ case 'default': default: require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); - require_once __DIR__ . '/../include/functions.user.php'; + require_once dirname(__DIR__) . '/include/functions.user.php'; if ('processed' !== $item) { $process_result = 0; diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index a27c3269..0c0a889e 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -14,7 +14,7 @@ // irmtfan - TODO - should be changed completly with Newbb new function newbbSynchronization require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -require_once __DIR__ . '/../include/functions.recon.php'; +require_once dirname(__DIR__) . '/include/functions.recon.php'; $form = ''; $form .= $adminObject->displayNavigation(basename(__FILE__)); diff --git a/admin/index.php b/admin/index.php index a97fd41b..36a8650c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -32,8 +32,8 @@ use XoopsModules\Newbb; require_once __DIR__ . '/admin_header.php'; -//require_once __DIR__ . '/../class/Utility.php'; -require_once __DIR__ . '/../include/functions.stats.php'; +//require_once dirname(__DIR__) . '/class/Utility.php'; +require_once dirname(__DIR__) . '/include/functions.stats.php'; $attach_path = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/'); $thumb_path = $attach_path . 'thumbs/'; diff --git a/admin/menu.php b/admin/menu.php index 5acede10..9d64eeab 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -31,8 +31,8 @@ use XoopsModules\Newbb; -// require_once __DIR__ . '/../class/Helper.php'; -//require_once __DIR__ . '/../include/common.php'; +// require_once dirname(__DIR__) . '/class/Helper.php'; +//require_once dirname(__DIR__) . '/include/common.php'; $helper = Newbb\Helper::getInstance(); $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); diff --git a/blocks/list_topic.php b/blocks/list_topic.php index cd60efd5..4bdbfc62 100644 --- a/blocks/list_topic.php +++ b/blocks/list_topic.php @@ -25,11 +25,11 @@ xoops_loadLanguage('main', 'newbb'); -require_once __DIR__ . '/../include/functions.config.php'; -require_once __DIR__ . '/../include/functions.time.php'; -require_once __DIR__ . '/../include/functions.session.php'; -require_once __DIR__ . '/../include/functions.render.php'; -require_once __DIR__ . '/../include/functions.user.php'; +require_once dirname(__DIR__) . '/include/functions.config.php'; +require_once dirname(__DIR__) . '/include/functions.time.php'; +require_once dirname(__DIR__) . '/include/functions.session.php'; +require_once dirname(__DIR__) . '/include/functions.render.php'; +require_once dirname(__DIR__) . '/include/functions.user.php'; // options[0] - Status in WHERE claus: all(by default), sticky, digest,lock, poll, voted, viewed, replied, read, (UN_) , active, pending, deleted (admin) (It is multi-select) // options[1] - Uid in WHERE claus: uid of the topic poster : -1 - all users (by default) @@ -180,7 +180,7 @@ function newbb_list_topic_edit($options) // forum element $optionsForum = explode(',', $options[12]); - require_once __DIR__ . '/../include/functions.forum.php'; + require_once dirname(__DIR__) . '/include/functions.forum.php'; /** @var Newbb\ForumHandler $forumHandler */ $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); //get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index 7b546ab0..e628bd91 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -56,8 +56,8 @@ function b_newbb_show($options) global $accessForums; global $xoopsLogger; - require_once __DIR__ . '/../include/functions.config.php'; - require_once __DIR__ . '/../include/functions.time.php'; + require_once dirname(__DIR__) . '/include/functions.config.php'; + require_once dirname(__DIR__) . '/include/functions.time.php'; $myts = \MyTextSanitizer::getInstance(); $block = []; @@ -65,7 +65,7 @@ function b_newbb_show($options) $order = ''; $extraCriteria = ''; if (!empty($options[2])) { - //require_once __DIR__ . '/../include/functions.time.php'; + //require_once dirname(__DIR__) . '/include/functions.time.php'; $extraCriteria .= ' AND p.post_time>' . (time() - newbbGetSinceTime($options[2])); } switch ($options[0]) { @@ -148,7 +148,7 @@ function b_newbb_show($options) return $block; } - require_once __DIR__ . '/../include/functions.user.php'; + require_once dirname(__DIR__) . '/include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); if (count($types) > 0) { @@ -230,7 +230,7 @@ function b_newbb_show($options) function b_newbb_topic_show($options) { global $accessForums; - require_once __DIR__ . '/../include/functions.time.php'; + require_once dirname(__DIR__) . '/include/functions.time.php'; $myts = \MyTextSanitizer::getInstance(); $block = []; $i = 0; @@ -332,7 +332,7 @@ function b_newbb_topic_show($options) if (count($rows) < 1) { return $block; } - require_once __DIR__ . '/../include/functions.user.php'; + require_once dirname(__DIR__) . '/include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); if (count($types) > 0) { /** @var Newbb\TypeHandler $typeHandler */ @@ -410,7 +410,7 @@ function b_newbb_post_show($options) global $accessForums; global $newbbConfig; - require_once __DIR__ . '/../include/functions.time.php'; + require_once dirname(__DIR__) . '/include/functions.time.php'; $myts = \MyTextSanitizer::getInstance(); $block = []; $i = 0; @@ -492,7 +492,7 @@ function b_newbb_post_show($options) if (count($rows) < 1) { return $block; } - require_once __DIR__ . '/../include/functions.user.php'; + require_once dirname(__DIR__) . '/include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); foreach ($rows as $arr) { @@ -582,7 +582,7 @@ function b_newbb_author_show($options) $extraCriteria = ''; $time_criteria = null; if (!empty($options[2])) { - require_once __DIR__ . '/../include/functions.time.php'; + require_once dirname(__DIR__) . '/include/functions.time.php'; $time_criteria = time() - newbbGetSinceTime($options[2]); $extraCriteria = ' AND topic_time > ' . $time_criteria; } @@ -651,7 +651,7 @@ function b_newbb_author_show($options) if (count($author) < 1) { return $block; } - require_once __DIR__ . '/../include/functions.user.php'; + require_once dirname(__DIR__) . '/include/functions.user.php'; $author_name = newbbGetUnameFromIds(array_keys($author), $newbbConfig['show_realname']); foreach (array_keys($author) as $uid) { $author[$uid]['name'] = $myts->htmlSpecialChars($author_name[$uid]); @@ -669,7 +669,7 @@ function b_newbb_author_show($options) */ function b_newbb_edit($options) { - require_once __DIR__ . '/../include/functions.forum.php'; + require_once dirname(__DIR__) . '/include/functions.forum.php'; $form = _MB_NEWBB_CRITERIA . "'; $selection['forum'] .= ''; @@ -919,11 +919,11 @@ public function renderTopics(\Smarty $xoopsTpl = null) return $ret; } - require_once __DIR__ . '/../include/functions.render.php'; - require_once __DIR__ . '/../include/functions.session.php'; - require_once __DIR__ . '/../include/functions.time.php'; - require_once __DIR__ . '/../include/functions.read.php'; - require_once __DIR__ . '/../include/functions.topic.php'; + require_once dirname(__DIR__) . '/include/functions.render.php'; + require_once dirname(__DIR__) . '/include/functions.session.php'; + require_once dirname(__DIR__) . '/include/functions.time.php'; + require_once dirname(__DIR__) . '/include/functions.read.php'; + require_once dirname(__DIR__) . '/include/functions.topic.php'; $sticky = 0; $topics = []; diff --git a/class/User.php b/class/User.php index ab7129c2..492f11d3 100644 --- a/class/User.php +++ b/class/User.php @@ -254,7 +254,7 @@ public function getInfo(&$user) // END hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? $userinfo['from'] = $user->getVar('user_from'); - require_once __DIR__ . '/../include/functions.time.php'; + require_once dirname(__DIR__) . '/include/functions.time.php'; $userinfo['regdate'] = newbbFormatTimestamp($user->getVar('user_regdate'), 'reg'); $userinfo['last_login'] = newbbFormatTimestamp($user->getVar('last_login')); // irmtfan add last_login diff --git a/class/UserHandler.php b/class/UserHandler.php index e2499959..94b3fbff 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -58,7 +58,7 @@ public function loadUserOnline() if (empty($this->users) || !$this->enableOnline) { return; } - require_once __DIR__ . '/../include/functions.render.php'; + require_once dirname(__DIR__) . '/include/functions.render.php'; $image_online = newbbDisplayImage('online', _MD_NEWBB_ONLINE); $image_offline = newbbDisplayImage('offline', _MD_NEWBB_OFFLINE); diff --git a/include/common.php b/include/common.php index e7288221..ef69c4bb 100644 --- a/include/common.php +++ b/include/common.php @@ -22,8 +22,8 @@ use XoopsModules\Newbb; -// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); -include __DIR__ . '/../preloads/autoloader.php'; +// defined('XOOPS_ROOT_PATH') || die('Restricted access'); +include dirname(__DIR__) . '/preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = strtoupper($moduleDirName); //$capsDirName @@ -83,48 +83,48 @@ // $publisherIsAdmin = Newbb\Utility::userIsAdmin(); //} -//$db = \XoopsDatabaseFactory::getDatabase(); +//$db = \XoopsDatabaseFactory::getDatabaseConnection(); /** @var Newbb\CategoryHandler $categoryHandler */ -$categoryHandler = $helper->getHandler('category'); +$categoryHandler = $helper->getHandler('Category'); /** @var Newbb\DigestHandler $digestHandler */ -$digestHandler = $helper->getHandler('digest'); +$digestHandler = $helper->getHandler('Digest'); /** @var Newbb\ForumHandler $forumHandler */ -$forumHandler = $helper->getHandler('forum'); +$forumHandler = $helper->getHandler('Forum'); /** @var Newbb\IconHandler $iconHandler */ -$iconHandler = $helper->getHandler('icon'); +$iconHandler = $helper->getHandler('Icon'); /** @var Newbb\KarmaHandler $karmaHandler */ -$karmaHandler = $helper->getHandler('karma'); +$karmaHandler = $helper->getHandler('Karma'); /** @var Newbb\ModerateHandler $moderateHandler */ -$moderateHandler = $helper->getHandler('moderate'); +$moderateHandler = $helper->getHandler('Moderate'); /** @var Newbb\OnlineHandler $onlineHandler */ -$onlineHandler = $helper->getHandler('online'); +$onlineHandler = $helper->getHandler('Online'); /** var Newbb\PermissionHandler $permHandler */ -$permHandler = $helper->getHandler('permission'); +$permHandler = $helper->getHandler('Permission'); /** @var Newbb\PostHandler $postHandler */ -$postHandler = $helper->getHandler('post'); +$postHandler = $helper->getHandler('Post'); /** @var Newbb\RateHandler $rateHandler */ -$rateHandler = $helper->getHandler('rate'); +$rateHandler = $helper->getHandler('Rate'); /** @var Newbb\ReadHandler $readHandler */ //$readHandler = $helper->getHandler('read' . $type); /** @var Newbb\ReadForumHandler $readForumHandler */ -$readForumHandler = $helper->getHandler('readforum'); +$readForumHandler = $helper->getHandler('ReadForum'); /** @var Newbb\ReadtopicHandler $readTopicHandler */ -$readTopicHandler = $helper->getHandler('readtopic'); +$readTopicHandler = $helper->getHandler('Readtopic'); /** @var Newbb\ReportHandler $reportHandler */ -$reportHandler = $helper->getHandler('report'); +$reportHandler = $helper->getHandler('Report'); /** @var Newbb\StatsHandler $statsHandler */ -$statsHandler = $helper->getHandler('stats'); +$statsHandler = $helper->getHandler('Stats'); /** @var Newbb\TextHandler $textHandler */ -$textHandler = $helper->getHandler('text'); +$textHandler = $helper->getHandler('Text'); /** @var Newbb\TopicHandler $topicHandler */ -$topicHandler = $helper->getHandler('topic'); +$topicHandler = $helper->getHandler('Topic'); /** @var Newbb\TypeHandler $typeHandler */ -$typeHandler = $helper->getHandler('type'); +$typeHandler = $helper->getHandler('Type'); /** @var Newbb\UserstatsHandler $userstatsHandler */ -$userstatsHandler = $helper->getHandler('userstats'); +$userstatsHandler = $helper->getHandler('Userstats'); /** @var Newbb\XmlrssHandler $xmlrssHandler */ -$xmlrssHandler = $helper->getHandler('xmlrss'); +$xmlrssHandler = $helper->getHandler('Xmlrss'); $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); diff --git a/include/config.php b/include/config.php index 75b0dbc7..e8d235d4 100644 --- a/include/config.php +++ b/include/config.php @@ -19,8 +19,6 @@ * @author XOOPS Development Team - ( https://xoops.org ) */ -// defined('XOOPS_ROOT_PATH') || die('Restricted access'); -require_once __DIR__ . '/common.php'; $moduleDirName = basename(dirname(__DIR__)); $uploadFolders = [ @@ -76,8 +74,8 @@ function getConfig() '/class/registry.php', '/class/utilities.php', '/class/util.php', - '/include/constants.php', - '/include/functions.php', + // '/include/constants.php', + // '/include/functions.php', '/ajaxrating.txt', ], 'oldFolders' => [ diff --git a/include/functions.user.php b/include/functions.user.php index 16239918..bbc54b4a 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -45,7 +45,7 @@ function newbbGetUnameFromId($uid, $usereal = 0, $linked = false) { xoops_load('xoopsuserutility'); - return XoopsUserUtility::getUnameFromId($uid, $usereal, $linked); + return \XoopsUserUtility::getUnameFromId($uid, $usereal, $linked); } /** @@ -88,10 +88,10 @@ function newbbIsAdministrator($user = -1, $mid = 0) $memberHandler = xoops_getHandler('member'); $groups = $memberHandler->getGroupsByUser($uid); - /** @var \XoopsGroupPermHandler $modulepermHandler */ - $modulepermHandler = xoops_getHandler('groupperm'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); - return $modulepermHandler->checkRight('module_admin', $mid, $groups); + return $grouppermHandler->checkRight('module_admin', $mid, $groups); } /** diff --git a/include/module.php b/include/module.php index b876bfc5..1e88e1ca 100644 --- a/include/module.php +++ b/include/module.php @@ -81,7 +81,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $oldversion = null) array_map('unlink', glob(dirname(__DIR__) . '/docs/changelog-rev*.txt')); if (!empty($newbbConfig['syncOnUpdate'])) { - require_once __DIR__ . '/../include/functions.recon.php'; + require_once dirname(__DIR__) . '/include/functions.recon.php'; newbbSynchronization(); } diff --git a/include/oninstall.php b/include/oninstall.php index 03728a60..865fbf1e 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -30,7 +30,7 @@ */ function xoops_module_pre_install_newbb(\XoopsModule $module) { - include __DIR__ . '/../preloads/autoloader.php'; + include dirname(__DIR__) . '/preloads/autoloader.php'; /** @var Newbb\Utility $utility */ $utility = new \XoopsModules\Newbb\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); @@ -55,8 +55,8 @@ function xoops_module_pre_install_newbb(\XoopsModule $module) */ function xoops_module_install_newbb(\XoopsModule $module) { - require_once __DIR__ . '/../../../mainfile.php'; - require_once __DIR__ . '/../include/config.php'; + require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; + require_once dirname(__DIR__) . '/include/config.php'; $moduleDirName = basename(dirname(__DIR__)); @@ -89,7 +89,7 @@ function xoops_module_install_newbb(\XoopsModule $module) // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = __DIR__ . '/../assets/images/blank.png'; + $file = dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); @@ -101,24 +101,3 @@ function xoops_module_install_newbb(\XoopsModule $module) return true; } - -//====================================================== - -$indexFile = 'index.html'; -$blankFile = $GLOBALS['xoops']->path('modules/randomquote/assets/images/icons/blank.gif'); - -//Creation du dossier "uploads" pour le module à la racine du site -$module_uploads = $GLOBALS['xoops']->path('uploads/randomquote'); -if (!is_dir($module_uploads)) { - mkdir($module_uploads, 0777); -} -chmod($module_uploads, 0777); -copy($indexFile, $GLOBALS['xoops']->path('uploads/randomquote/index.html')); - -//Creation du fichier citas dans uploads -$module_uploads = $GLOBALS['xoops']->path('uploads/randomquote/citas'); -if (!is_dir($module_uploads)) { - mkdir($module_uploads, 0777); -} -chmod($module_uploads, 0777); -copy($indexFile, $GLOBALS['xoops']->path('uploads/randomquote/citas/index.html')); diff --git a/include/onuninstall.php b/include/onuninstall.php index d20d1485..fdeec533 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -35,13 +35,10 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) // return true; $moduleDirName = basename(dirname(__DIR__)); - $xsitemapHelper = \Xmf\Module\Helper::getHelper($moduleDirName); + $helper = \XoopsModules\Newbb\Helper::getInstance(); /** @var Newbb\Utility $utility */ - $utility = ucfirst($moduleDirName) . 'Utility'; - if (!class_exists($utility)) { - xoops_load('utility', $moduleDirName); - } + $utility = new \XoopsModules\Newbb\Utility(); $success = true; $helper->loadLanguage('admin'); diff --git a/include/onupdate.php b/include/onupdate.php index e05a2402..ecef66fc 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -143,7 +143,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = __DIR__ . '/../assets/images/blank.png'; + $file = dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); diff --git a/preloads/autoloader.php b/preloads/autoloader.php index f753e90c..56b45ca4 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -8,7 +8,7 @@ $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); // base directory for the namespace prefix - $base_dir = __DIR__ . '/../class/'; + $base_dir = dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? $len = strlen($prefix); diff --git a/preloads/core.php b/preloads/core.php index f3637572..e4d105cb 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -20,7 +20,7 @@ /** * Class NewbbCorePreload */ -class NewbbCorePreload extends XoopsPreloadItem +class NewbbCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader /** diff --git a/viewpost.php b/viewpost.php index 3706d345..8f157cd6 100644 --- a/viewpost.php +++ b/viewpost.php @@ -402,7 +402,7 @@ break; } if ($uid > 0) { - $lang_title .= ' (' . XoopsUser::getUnameFromId($uid) . ')'; + $lang_title .= ' (' . \XoopsUser::getUnameFromId($uid) . ')'; } $xoopsTpl->assign('lang_title', $lang_title); // irmtfan up to p_up From 32a58453ddab08901242fd4e5c75ba16b3ddb79a Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 2 Jul 2018 21:37:46 -0400 Subject: [PATCH 127/170] updates/cosmetics/require_once --- action.post.php | 2 +- action.topic.php | 6 +++--- admin/admin_forum_manager.php | 6 +++--- admin/admin_forum_prune.php | 4 ++-- admin/admin_header.php | 6 +++--- admin/menu.php | 2 +- class/Common/FilesManagement.php | 5 +++-- class/ForumHandler.php | 6 +++--- class/Helper.php | 2 +- class/IconHandler.php | 2 +- class/PermissionCategoryHandler.php | 2 +- class/PermissionForumHandler.php | 2 +- class/PermissionHandler.php | 2 +- class/Post.php | 2 +- class/PostHandler.php | 8 ++++---- class/Rate.php | 2 +- class/RateHandler.php | 2 +- class/Read.php | 2 +- class/ReadHandler.php | 2 +- class/Report.php | 2 +- class/ReportHandler.php | 2 +- class/Text.php | 2 +- class/TextHandler.php | 2 +- class/Topic.php | 2 +- class/TopicHandler.php | 4 ++-- class/TypeHandler.php | 2 +- class/Uploader.php | 2 +- class/User.php | 2 +- class/UserHandler.php | 3 ++- class/Userstats.php | 2 +- class/UserstatsHandler.php | 2 +- class/Utility.php | 1 + class/Xmlrss.php | 4 ++-- class/XmlrssHandler.php | 2 +- delete.php | 4 ++-- dl_attachment.php | 2 +- edit.php | 4 ++-- footer.php | 2 +- header.php | 2 +- include/common.php | 4 ++-- include/form.post.php | 2 +- include/functions.config.php | 5 +++-- include/functions.forum.php | 2 +- include/functions.php | 2 +- include/functions.read.php | 2 +- include/functions.recon.php | 2 +- include/functions.render.php | 2 +- include/functions.rpc.php | 2 +- include/functions.topic.php | 2 +- include/functions.user.php | 2 +- include/functions.welcome.php | 2 +- include/oninstall.php | 5 +++-- include/onuninstall.php | 1 + include/plugin.php | 2 +- include/search.inc.php | 2 +- index.php | 2 +- list.tag.php | 4 ++-- list.topic.php | 2 +- moderate.php | 6 +++--- newtopic.php | 4 ++-- notification_update.php | 4 ++-- polls.php | 6 +++--- post.php | 6 +++--- preloads/autoloader.php | 6 +++--- preloads/core.php | 2 +- ratethread.php | 2 +- reply.php | 4 ++-- report.php | 6 +++--- search.php | 2 +- seo.php | 4 ++-- topicmanager.php | 2 +- view.tag.php | 2 +- viewforum.php | 2 +- viewpost.php | 6 +++--- viewtopic.php | 6 +++--- votepolls.php | 2 +- xoops_version.php | 2 +- 77 files changed, 120 insertions(+), 114 deletions(-) diff --git a/action.post.php b/action.post.php index a805cf41..944d933f 100644 --- a/action.post.php +++ b/action.post.php @@ -229,4 +229,4 @@ } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/action.topic.php b/action.topic.php index f6346b45..12d470bc 100644 --- a/action.topic.php +++ b/action.topic.php @@ -133,7 +133,7 @@ $forumHandler->synchronization(Request::getInt('newforum', 0, 'POST')); $forumHandler->synchronization($forum_id); } else { - include $GLOBALS['xoops']->path('header.php'); + require_once $GLOBALS['xoops']->path('header.php'); // /** @var Newbb\CategoryHandler $categoryHandler */ // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); $categories = $categoryHandler->getByPermission('access'); @@ -177,7 +177,7 @@ echo ""; echo '

  • '; echo ''; - include $GLOBALS['xoops']->path('footer.php'); + require_once $GLOBALS['xoops']->path('footer.php'); exit(); } break; @@ -192,4 +192,4 @@ } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index 542f19d7..6aa43907 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -33,7 +33,7 @@ use XoopsModules\Newbb; require_once __DIR__ . '/admin_header.php'; -include $GLOBALS['xoops']->path('class/xoopstree.php'); +require_once $GLOBALS['xoops']->path('class/xoopstree.php'); require_once $GLOBALS['xoops']->path('class/pagenav.php'); require_once dirname(__DIR__) . '/include/functions.forum.php'; require_once dirname(__DIR__) . '/include/functions.render.php'; @@ -202,7 +202,7 @@ case 'mod': $forumObject = $forumHandler->get($forum_id); - include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); + require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); break; case 'del': @@ -227,7 +227,7 @@ $forumObject = $forumHandler->create(); $forumObject->setVar('parent_forum', $parent_forum); $forumObject->setVar('cat_id', $cat_id); - include $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); + require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); break; default: diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 0f838f8e..ba0794bf 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -38,7 +38,7 @@ echo "" . "
    "; -if (Request::getString('submit', '', 'POST')) { +if (Request::hasVar('submit', 'POST')) { $post_list = null; $topic_list = null; $topics_number = 0; @@ -180,7 +180,7 @@ $sform->addElement($days); // START irmtfan remove hardcode db access require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files - require_once dirname(__DIR__) . '/include/functions.forum.php'; + require_once dirname(__DIR__) . '/include/functions.forum.php'; $forumSelMulti = ""; // disable all categories $forumSelBox = ''; diff --git a/admin/admin_header.php b/admin/admin_header.php index 1f136893..3d24a199 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -32,8 +32,8 @@ use Xmf\Request; use XoopsModules\Newbb; -//include $GLOBALS['xoops']->path('include/cp_header.php'); -include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +//require_once $GLOBALS['xoops']->path('include/cp_header.php'); +require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'); require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php'); require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php'); @@ -43,7 +43,7 @@ require_once dirname(__DIR__) . '/include/config.php'; require_once dirname(__DIR__) . '/include/common.php'; -//require_once dirname(__DIR__) . '/class/Helper.php'; +/** @var Newbb\Helper $helper */ $helper = Newbb\Helper::getInstance(); //$helper = NewBB::getInstance(); /** @var Xmf\Module\Admin $adminObject */ diff --git a/admin/menu.php b/admin/menu.php index 9d64eeab..ff6d7b8b 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -31,8 +31,8 @@ use XoopsModules\Newbb; -// require_once dirname(__DIR__) . '/class/Helper.php'; //require_once dirname(__DIR__) . '/include/common.php'; +/** @var Newbb\Helper $helper */ $helper = Newbb\Helper::getInstance(); $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index bc82798d..44a5b0b3 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -57,7 +57,9 @@ public static function recurseCopy($src, $dst) { $dir = opendir($src); // @mkdir($dst); - if (!mkdir($dst) && !is_dir($dst)) { + if (!@mkdir($dst) && !is_dir($dst)) { + throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); + } while (false !== ($file = readdir($dir))) { if (('.' !== $file) && ('..' !== $file)) { if (is_dir($src . '/' . $file)) { @@ -67,7 +69,6 @@ public static function recurseCopy($src, $dst) } } } - } closedir($dir); } diff --git a/class/ForumHandler.php b/class/ForumHandler.php index 71f5e658..acccdbae 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -87,7 +87,7 @@ public function getIdsByPermission($perm = 'access') } /** - * @param int $cat + * @param int|array $cat * @param string $permission * @param null $tags * @param bool $asObject @@ -935,7 +935,7 @@ public function &display($forums, $length_title_index = 30, $count_subforum = 1) * @param int $pid Top forum ID * @param string $permission permission type * @param string $prefix prefix for display - * @param string $tags variables to fetch + * @param string|array|null $tags variables to fetch * @return array associative array of category IDs and sanitized titles */ public function &getTree($cat_id = 0, $pid = 0, $permission = 'access', $prefix = '--', $tags = null) @@ -970,7 +970,7 @@ public function &getTree($cat_id = 0, $pid = 0, $permission = 'access', $prefix * @param int $cat_id category ID * @param int $pid Top forum ID * @param string $permission permission type - * @param string $tags variables to fetch + * @param string|array|null $tags variables to fetch * @param integer $depth level of subcategories * @return array associative array of category IDs and sanitized titles */ diff --git a/class/Helper.php b/class/Helper.php index 7afdbbb7..065693ed 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -16,7 +16,7 @@ * @license GPL 2.0 or later * @package newbb * @since 5.0.0 - * @author XOOPS Development Team - + * @author XOOPS Development Team */ //defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/class/IconHandler.php b/class/IconHandler.php index a9809a74..58b93f78 100644 --- a/class/IconHandler.php +++ b/class/IconHandler.php @@ -134,7 +134,7 @@ public function init(/*$set = "default", */ $language = 'english', $dirname = 'newbb' ) { - $this->forumImage = include $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); + $this->forumImage = require_once $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); $this->forumImage['icon'] = XOOPS_URL . $this->getPath('icon', $dirname) . '/'; $this->forumImage['language'] = XOOPS_URL . $this->getPath("language/{$language}", $dirname, 'language/english') . '/'; diff --git a/class/PermissionCategoryHandler.php b/class/PermissionCategoryHandler.php index 74061598..b15fd6c0 100644 --- a/class/PermissionCategoryHandler.php +++ b/class/PermissionCategoryHandler.php @@ -14,7 +14,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -//defined("NEWBB_HANDLER_PERMISSION") || include __DIR__.'/permission.php'; +//defined("NEWBB_HANDLER_PERMISSION") || require_once __DIR__ .'/permission.php'; //define("NEWBB_HANDLER_PERMISSION_CATEGORY", 1); /** diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index 3d64f657..e7489acc 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -14,7 +14,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -//defined("NEWBB_HANDLER_PERMISSION") || include __DIR__.'/permission.php'; +//defined("NEWBB_HANDLER_PERMISSION") || require_once __DIR__ .'/permission.php'; //define("NEWBB_HANDLER_PERMISSION_FORUM", 1); if (defined('FORUM_PERM_ITEMS') && class_exists('ForumPermissionHandler')) { diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index cb1b4e32..3f435f2b 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -14,7 +14,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); define('NEWBB_HANDLER_PERMISSION', 1); // Initializing XoopsGroupPermHandler if not loaded yet diff --git a/class/Post.php b/class/Post.php index 32dfed7c..f3c5895f 100644 --- a/class/Post.php +++ b/class/Post.php @@ -36,7 +36,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class Post diff --git a/class/PostHandler.php b/class/PostHandler.php index 994e2265..2bb1606f 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -34,7 +34,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class PostHandler @@ -130,7 +130,7 @@ public function getPostForPrint(&$post) } /** - * @param int|Post $post + * @param int|Post|\XoopsObject $post * @param bool $force * @return bool */ @@ -326,7 +326,7 @@ public function insert(\XoopsObject $post, $force = true) //insert(&$post, $forc } /** - * @param \XoopsObject $post + * @param \XoopsObject|Post $post * @param bool $isDeleteOne * @param bool $force * @return bool @@ -366,7 +366,7 @@ public function delete(\XoopsObject $post, $isDeleteOne = true, $force = false) } /** - * @param Post $post + * @param Post|\XoopsObject $post * @param bool $force * @return bool */ diff --git a/class/Rate.php b/class/Rate.php index 8af07b26..9be224cc 100644 --- a/class/Rate.php +++ b/class/Rate.php @@ -32,7 +32,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class Rate diff --git a/class/RateHandler.php b/class/RateHandler.php index 580fcb30..00d88fad 100644 --- a/class/RateHandler.php +++ b/class/RateHandler.php @@ -32,7 +32,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class RateHandler diff --git a/class/Read.php b/class/Read.php index b78ba93a..f9c7b6db 100644 --- a/class/Read.php +++ b/class/Read.php @@ -32,7 +32,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * A handler for read/unread handling diff --git a/class/ReadHandler.php b/class/ReadHandler.php index 95486eca..b8a76313 100644 --- a/class/ReadHandler.php +++ b/class/ReadHandler.php @@ -32,7 +32,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * A handler for read/unread handling diff --git a/class/Report.php b/class/Report.php index 3915a586..59bf817d 100644 --- a/class/Report.php +++ b/class/Report.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class Report diff --git a/class/ReportHandler.php b/class/ReportHandler.php index 41a0a348..8d9e12ec 100644 --- a/class/ReportHandler.php +++ b/class/ReportHandler.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class ReportHandler diff --git a/class/Text.php b/class/Text.php index 0a61580d..b7862054 100644 --- a/class/Text.php +++ b/class/Text.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class Text diff --git a/class/TextHandler.php b/class/TextHandler.php index 3356f048..7959d225 100644 --- a/class/TextHandler.php +++ b/class/TextHandler.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class TextHandler diff --git a/class/Topic.php b/class/Topic.php index a4c0f7f3..ad9eae9e 100644 --- a/class/Topic.php +++ b/class/Topic.php @@ -15,7 +15,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class Topic diff --git a/class/TopicHandler.php b/class/TopicHandler.php index 67d744ac..48247247 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -15,7 +15,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class TopicHandler @@ -372,7 +372,7 @@ public function &getAllPosters(&$topic, $isApproved = true) } /** - * @param \XoopsObject $topic + * @param Topic|\XoopsObject $topic * @param bool $force * @return bool */ diff --git a/class/TypeHandler.php b/class/TypeHandler.php index a3ead36b..463e78bf 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -142,7 +142,7 @@ public function updateByForum($forum_id, $types) /** * delete an object as well as links relying on it * - * @param \XoopsObject $object {@link Type} + * @param Type|\XoopsObject $object {@link Type} * @param bool $force flag to force the query execution despite security settings * @return bool */ diff --git a/class/Uploader.php b/class/Uploader.php index 10d198f6..51692752 100644 --- a/class/Uploader.php +++ b/class/Uploader.php @@ -43,7 +43,7 @@ public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, } } $_allowedMimeTypes = []; - $extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php'); + $extensionToMime = require_once $GLOBALS['xoops']->path('include/mimetypes.inc.php'); foreach ($allowedMimeTypes as $type) { if (isset($extensionToMime[$type])) { $_allowedMimeTypes[] = $extensionToMime[$type]; diff --git a/class/User.php b/class/User.php index 492f11d3..31a96d17 100644 --- a/class/User.php +++ b/class/User.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * @param $RPG diff --git a/class/UserHandler.php b/class/UserHandler.php index 94b3fbff..7a69b8db 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -14,7 +14,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class UserHandler @@ -40,6 +40,7 @@ public function __construct($enableGroup = true, $enableOnline = true) public function loadUserInfo() { + /** @var Newbb\Helper $helper */ $helper = Newbb\Helper::getInstance(); $helper->loadLanguage('user'); // @require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php'); diff --git a/class/Userstats.php b/class/Userstats.php index 5b677f8e..1dacd851 100644 --- a/class/Userstats.php +++ b/class/Userstats.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * Class Userstats diff --git a/class/UserstatsHandler.php b/class/UserstatsHandler.php index 4d52c343..6de1f8e1 100644 --- a/class/UserstatsHandler.php +++ b/class/UserstatsHandler.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** * user stats diff --git a/class/Utility.php b/class/Utility.php index be71e0eb..08ed8d0f 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -114,6 +114,7 @@ public static function cleanCache() */ public static function userIsAdmin() { + /** @var Newbb\Helper $helper */ $helper = Newbb\Helper::getInstance(); static $newbbIsAdmin; diff --git a/class/Xmlrss.php b/class/Xmlrss.php index e92fc822..ae661525 100644 --- a/class/Xmlrss.php +++ b/class/Xmlrss.php @@ -12,7 +12,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); //load_functions('locale'); /** @@ -78,7 +78,7 @@ public function setVarRss($var, $val) * @param $link * @param string $description * @param string $label - * @param int $pubdate + * @param int|string $pubdate * @return bool */ public function addItem($title, $link, $description = '', $label = '', $pubdate = 0) diff --git a/class/XmlrssHandler.php b/class/XmlrssHandler.php index 7711861b..2d0c4f3a 100644 --- a/class/XmlrssHandler.php +++ b/class/XmlrssHandler.php @@ -14,7 +14,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); +defined('NEWBB_FUNCTIONS_INI') || require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); //load_functions('locale'); /** diff --git a/delete.php b/delete.php index 36b95666..79b15b6b 100644 --- a/delete.php +++ b/delete.php @@ -126,7 +126,7 @@ redirect_header(XOOPS_URL . "/modules/newbb/viewforum.php?forum=$forum", 2, _MD_NEWBB_POSTSDELETED); } } else { - include $GLOBALS['xoops']->path('header.php'); + require_once $GLOBALS['xoops']->path('header.php'); //xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => 1), 'delete.php', _MD_NEWBB_DEL_ONE); echo '
    ' . _MD_NEWBB_DEL_ONE . '
    '; @@ -152,5 +152,5 @@ 'ok' => 99 ], 'delete.php', _MD_NEWBB_DEL_RELATED); } - include $GLOBALS['xoops']->path('footer.php'); + require_once $GLOBALS['xoops']->path('footer.php'); } diff --git a/dl_attachment.php b/dl_attachment.php index 8fd9bda2..971c48b1 100644 --- a/dl_attachment.php +++ b/dl_attachment.php @@ -14,7 +14,7 @@ ob_start(); require_once __DIR__ . '/header.php'; -include $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('header.php'); $attach_id = Request::getInt('attachid', 0, 'GET'); $post_id = Request::getInt('post_id', 0, 'GET'); diff --git a/edit.php b/edit.php index e713c521..5489da21 100644 --- a/edit.php +++ b/edit.php @@ -116,7 +116,7 @@ $require_reply = $postObject->getVar('require_reply'); $xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); -include __DIR__ . '/include/form.post.php'; +require_once __DIR__ . '/include/form.post.php'; ///** @var Newbb\KarmaHandler $karmaHandler */ //$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); @@ -151,4 +151,4 @@ $xoopsTpl->assign_by_ref('posts_context', $posts_context); // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/footer.php b/footer.php index c8b6c96f..01780f37 100644 --- a/footer.php +++ b/footer.php @@ -40,7 +40,7 @@ $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } -global $forumCookie; // for $forumCookie["prefix"] revert last change - use global instead of include_once +global $forumCookie; // for $forumCookie["prefix"] revert last change - use global instead of include // add toggle script //$toggle_script = "var toggle_cookie=\"" . $forumCookie['prefix'] . 'G' . '\';'; $toggle_script = 'var toggle_cookie="' . $forumCookie['prefix'] . 'G";'; diff --git a/header.php b/header.php index aab2008e..c7418639 100644 --- a/header.php +++ b/header.php @@ -11,7 +11,7 @@ use Xmf\Request; -include dirname(dirname(__DIR__)) . '/mainfile.php'; +require_once dirname(dirname(__DIR__)) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; // defined('XOOPS_ROOT_PATH') || die('Restricted access'); diff --git a/include/common.php b/include/common.php index ef69c4bb..a12a24ac 100644 --- a/include/common.php +++ b/include/common.php @@ -23,7 +23,7 @@ use XoopsModules\Newbb; // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -include dirname(__DIR__) . '/preloads/autoloader.php'; +require_once dirname(__DIR__) . '/preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = strtoupper($moduleDirName); //$capsDirName @@ -34,7 +34,7 @@ $db = \XoopsDatabaseFactory::getDatabaseConnection(); $helper = Newbb\Helper::getInstance(); $utility = new Newbb\Utility(); -//$configurator = new Newbb\common\Configurator(); +//$configurator = new Newbb\Common\Configurator(); $helper->loadLanguage('common'); diff --git a/include/form.post.php b/include/form.post.php index f19be030..a99a04ce 100644 --- a/include/form.post.php +++ b/include/form.post.php @@ -44,7 +44,7 @@ $tage = ($mod[0]['mod_end'] - $mod[0]['mod_start']) / 60 / 60 / 24; $msg = $myts->displayTarea(sprintf(_MD_NEWBB_SUSPEND_TEXT, newbbGetUnameFromId($moderated_id), (int)$tage, $mod[0]['mod_desc'], formatTimestamp($mod[0]['mod_end'])), 1); xoops_error($msg, _MD_NEWBB_SUSPEND_NOACCESS); - include $GLOBALS['xoops']->path('footer.php'); + require_once $GLOBALS['xoops']->path('footer.php'); exit(); } diff --git a/include/functions.config.php b/include/functions.config.php index 9e0a93e5..eed14c03 100644 --- a/include/functions.config.php +++ b/include/functions.config.php @@ -28,7 +28,8 @@ function newbbLoadConfig() { // require_once dirname(__DIR__) . '/class/Helper.php'; //$helper = NewBB::getInstance(); - $helper = \XoopsModules\Newbb\Helper::getInstance(); + /** @var Newbb\Helper $helper */ + $helper = Newbb\Helper::getInstance(); static $configs = null; if (null !== $configs) { @@ -36,7 +37,7 @@ function newbbLoadConfig() } $configs = is_object($helper) ? $helper->getConfig() : []; - $plugins = include __DIR__ . '/plugin.php'; + $plugins = require_once __DIR__ . '/plugin.php'; if (is_array($configs) && is_array($plugins)) { $configs = array_merge($configs, $plugins); } diff --git a/include/functions.forum.php b/include/functions.forum.php index 3f599566..b5cfd88b 100644 --- a/include/functions.forum.php +++ b/include/functions.forum.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_FORUM_LOADED', true); if (!defined('NEWBB_FUNCTIONS_FORUM')) { diff --git a/include/functions.php b/include/functions.php index ca647f55..a51d6b12 100644 --- a/include/functions.php +++ b/include/functions.php @@ -11,7 +11,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_LOADED', true); if (!defined('NEWBB_FUNCTIONS')) { diff --git a/include/functions.read.php b/include/functions.read.php index 9ff595b5..affc5b88 100644 --- a/include/functions.read.php +++ b/include/functions.read.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_READ_LOADED', true); if (!defined('NEWBB_FUNCTIONS_READ')) { diff --git a/include/functions.recon.php b/include/functions.recon.php index 8c89377f..d2d2bde0 100644 --- a/include/functions.recon.php +++ b/include/functions.recon.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RECON_LOADED', true); if (!defined('NEWBB_FUNCTIONS_RECON')) { diff --git a/include/functions.render.php b/include/functions.render.php index 6a1b0fd1..301a0665 100644 --- a/include/functions.render.php +++ b/include/functions.render.php @@ -13,7 +13,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RENDER_LOADED', true); if (!defined('NEWBB_FUNCTIONS_RENDER')) { diff --git a/include/functions.rpc.php b/include/functions.rpc.php index 018fd311..c165273d 100644 --- a/include/functions.rpc.php +++ b/include/functions.rpc.php @@ -11,7 +11,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RPC_LOADED', true); if (!defined('NEWBB_FUNCTIONS_RPC')) { diff --git a/include/functions.topic.php b/include/functions.topic.php index 0b9eda43..8cf1947c 100644 --- a/include/functions.topic.php +++ b/include/functions.topic.php @@ -11,7 +11,7 @@ // defined('XOOPS_ROOT_PATH') || die('Restricted access'); -defined('NEWBB_FUNCTIONS_INI') || include __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_TOPIC_LOADED', true); if (!defined('NEWBB_FUNCTIONS_TOPIC')) { diff --git a/include/functions.user.php b/include/functions.user.php index bbc54b4a..2846e369 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -51,7 +51,7 @@ function newbbGetUnameFromId($uid, $usereal = 0, $linked = false) /** * Function to check if a user is an administrator of the module * - * @param int $user + * @param int|string $user * @param int $mid * @return bool */ diff --git a/include/functions.welcome.php b/include/functions.welcome.php index eee7027e..d71d8587 100644 --- a/include/functions.welcome.php +++ b/include/functions.welcome.php @@ -40,7 +40,7 @@ function newbbWelcome() return false; } - include __DIR__ . '/functions.welcome.inc.php'; + require_once __DIR__ . '/functions.welcome.inc.php'; unset($forumObject); return $ret; diff --git a/include/oninstall.php b/include/oninstall.php index 865fbf1e..b614c694 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -30,7 +30,7 @@ */ function xoops_module_pre_install_newbb(\XoopsModule $module) { - include dirname(__DIR__) . '/preloads/autoloader.php'; + require_once dirname(__DIR__) . '/preloads/autoloader.php'; /** @var Newbb\Utility $utility */ $utility = new \XoopsModules\Newbb\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); @@ -60,7 +60,8 @@ function xoops_module_install_newbb(\XoopsModule $module) $moduleDirName = basename(dirname(__DIR__)); - $helper = Newbb\Helper::getInstance(); + /** @var Newbb\Helper $helper */ + $helper = Newbb\Helper::getInstance(); $utility = new Newbb\Utility(); $configurator = new Newbb\Common\Configurator(); // Load language files diff --git a/include/onuninstall.php b/include/onuninstall.php index fdeec533..05349969 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -35,6 +35,7 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) // return true; $moduleDirName = basename(dirname(__DIR__)); + /** @var \XoopsModules\Newbb\Helper $helper */ $helper = \XoopsModules\Newbb\Helper::getInstance(); /** @var Newbb\Utility $utility */ diff --git a/include/plugin.php b/include/plugin.php index 92433fc0..af8fa173 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -92,7 +92,7 @@ // This is for each link. // It means you can overwrite the above $customConfig["display_text_links"] overall value for each link one by one. // go to /modules/newbb/include/display.php to set for each link -$customConfig['display_text_each_link'] = include $GLOBALS['xoops']->path('modules/newbb/include/display.php'); +$customConfig['display_text_each_link'] = require_once $GLOBALS['xoops']->path('modules/newbb/include/display.php'); // jump to last post read in the topic $customConfig['jump_to_topic_last_post_read_enabled'] = true; // highlight keywords in search diff --git a/include/search.inc.php b/include/search.inc.php index 57fb8ca1..d008e2da 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -22,7 +22,7 @@ * @param $offset * @param $userid * @param int $forums - * @param int $sortby + * @param int|string $sortby * @param string $searchin * @param CriteriaCompo $criteriaExtra * @return array diff --git a/index.php b/index.php index 241e8c8a..723a1fe3 100644 --- a/index.php +++ b/index.php @@ -287,4 +287,4 @@ // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/list.tag.php b/list.tag.php index c09e5acd..0324a046 100644 --- a/list.tag.php +++ b/list.tag.php @@ -8,5 +8,5 @@ * @since 4.00 * @package module::newbb */ -include __DIR__ . '/header.php'; -include $GLOBALS['xoops']->path('modules/tag/list.tag.php'); +require_once __DIR__ . '/header.php'; +require_once $GLOBALS['xoops']->path('modules/tag/list.tag.php'); diff --git a/list.topic.php b/list.topic.php index 28ea0f2c..5e53ba21 100644 --- a/list.topic.php +++ b/list.topic.php @@ -103,4 +103,4 @@ // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/moderate.php b/moderate.php index 244b8816..48f24181 100644 --- a/moderate.php +++ b/moderate.php @@ -15,7 +15,7 @@ global $xoTheme, $xoopsTpl; $GLOBALS['xoopsOption']['template_main'] = 'newbb_moderate.tpl'; -include $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('header.php'); $forum_userid = Request::getInt('uid', 0); $forum_id = Request::getInt('forum', 0); @@ -162,7 +162,7 @@ $xoopsTpl->assign('columnRows', $columnRows); if ($moderate_count > $GLOBALS['xoopsModuleConfig']['topics_per_page']) { - include $GLOBALS['xoops']->path('class/pagenav.php'); + require_once $GLOBALS['xoops']->path('class/pagenav.php'); $nav = new \XoopsPageNav($moderate_count, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', 'forum=' . $forum_id . '&sort=' . $sortname); //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { // $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . ' /' . $nav->url; @@ -197,4 +197,4 @@ $forum_form->assign($xoopsTpl); require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/newtopic.php b/newtopic.php index 45e4699f..4ce53864 100644 --- a/newtopic.php +++ b/newtopic.php @@ -70,7 +70,7 @@ $attachsig = (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->getVar('attachsig')) ? 1 : 0; $post_id = 0; $topic_id = 0; -include __DIR__ . '/include/form.post.php'; +require_once __DIR__ . '/include/form.post.php'; require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/notification_update.php b/notification_update.php index 711cc507..ad3eba93 100644 --- a/notification_update.php +++ b/notification_update.php @@ -28,5 +28,5 @@ // URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ // // Project: XOOPS Project // // ------------------------------------------------------------------------- // -include dirname(dirname(__DIR__)) . '/mainfile.php'; -include $GLOBALS['xoops']->path('include/notification_update.php'); +require_once dirname(dirname(__DIR__)) . '/mainfile.php'; +require_once $GLOBALS['xoops']->path('include/notification_update.php'); diff --git a/polls.php b/polls.php index db83ec6f..038f09a4 100644 --- a/polls.php +++ b/polls.php @@ -84,7 +84,7 @@ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist // old xoopspoll or umfrage or any clone from them } else { - include $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); + require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); $classPoll = $topicObject->loadOldPoll(); $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist } @@ -93,7 +93,7 @@ redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_POLLMODULE_ERROR); } // include header -include $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('header.php'); // no admin user permission if (is_object($GLOBALS['xoopsUser']) && !newbbIsAdmin($forumObject)) { @@ -757,4 +757,4 @@ // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/post.php b/post.php index 9701b21e..163fb530 100644 --- a/post.php +++ b/post.php @@ -70,7 +70,7 @@ $error_message = []; if (Request::getString('contents_submit', '', 'POST')) { - $token_valid = false; +// $token_valid = false; $token_valid = $GLOBALS['xoopsSecurity']->check(); $captcha_invalid = false; @@ -528,8 +528,8 @@ $attachments = $postObject->getAttachment(); $xoopsTpl->assign('error_message', implode('
    ', $error_message)); - include __DIR__ . '/include/form.post.php'; + require_once __DIR__ . '/include/form.post.php'; } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/preloads/autoloader.php b/preloads/autoloader.php index 56b45ca4..a92b0920 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -18,15 +18,15 @@ } // get the relative class name - $relative_class = substr($class, $len); + $relativeClass = substr($class, $len); // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; + $file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php'; // if the file exists, require it if (file_exists($file)) { - require $file; + require_once $file; } }); diff --git a/preloads/core.php b/preloads/core.php index e4d105cb..4bc4b5d1 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -28,6 +28,6 @@ class NewbbCorePreload extends \XoopsPreloadItem */ public static function eventCoreIncludeCommonEnd($args) { - include __DIR__ . '/autoloader.php'; + require_once __DIR__ . '/autoloader.php'; } } diff --git a/ratethread.php b/ratethread.php index 8c1cf71a..950add28 100644 --- a/ratethread.php +++ b/ratethread.php @@ -104,4 +104,4 @@ $ratemessage = _MD_NEWBB_VOTEAPPRE . '
    ' . sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 2, $ratemessage); // irmtfan enhance include footer.php -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/reply.php b/reply.php index 9edce244..d9161def 100644 --- a/reply.php +++ b/reply.php @@ -167,7 +167,7 @@ $post_karma = 0; $require_reply = 0; -include __DIR__ . '/include/form.post.php'; +require_once __DIR__ . '/include/form.post.php'; ///** @var Newbb\KarmaHandler $karmaHandler */ //$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); @@ -205,4 +205,4 @@ $xoopsTpl->assign_by_ref('posts_context', $posts_context); // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/report.php b/report.php index 4d661dce..fe7d159d 100644 --- a/report.php +++ b/report.php @@ -56,8 +56,8 @@ $myts = \MyTextSanitizer::getInstance(); // Disable cache $GLOBALS['xoopsConfig']['module_cache'][$xoopsModule->getVar('mid')] = 0; -include $GLOBALS['xoops']->path('header.php'); -include $GLOBALS['xoops']->path('class/xoopsformloader.php'); +require_once $GLOBALS['xoops']->path('header.php'); +require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); if (Request::hasVar('submit', 'POST')) { $error_message = ''; @@ -168,4 +168,4 @@ echo "
    '; echo '
    " . $r_subject . '

    ' . $r_content . '
    '; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/search.php b/search.php index 5838acc5..3b412fc5 100644 --- a/search.php +++ b/search.php @@ -355,4 +355,4 @@ } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/seo.php b/seo.php index f1af6fce..66be5b37 100644 --- a/seo.php +++ b/seo.php @@ -63,13 +63,13 @@ $_GET['topic_id'] = $seoArg; break; } - include $seoMap[$seoOp]; + require_once $seoMap[$seoOp]; } else { $last = $seoOp . '/' . $seoArg; if ('' !== $seoOther) { $last .= '/' . $seoOther; } - include $last; + require_once $last; } exit(); diff --git a/topicmanager.php b/topicmanager.php index 90cd81f5..665433ec 100644 --- a/topicmanager.php +++ b/topicmanager.php @@ -378,4 +378,4 @@ } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/view.tag.php b/view.tag.php index 2ead4ea5..25ab58d9 100644 --- a/view.tag.php +++ b/view.tag.php @@ -9,4 +9,4 @@ * @package module::newbb */ require_once __DIR__ . '/header.php'; -include $GLOBALS['xoops']->path('modules/tag/view.tag.php'); +require_once $GLOBALS['xoops']->path('modules/tag/view.tag.php'); diff --git a/viewforum.php b/viewforum.php index 426b8d86..88ebb580 100644 --- a/viewforum.php +++ b/viewforum.php @@ -339,4 +339,4 @@ } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/viewpost.php b/viewpost.php index 8f157cd6..18aebb25 100644 --- a/viewpost.php +++ b/viewpost.php @@ -242,7 +242,7 @@ $viewtopic_users = []; if (count($userid_array) > 0) { -// require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); +// require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); $userHandler->users = $users; $userHandler->online = $online; @@ -366,7 +366,7 @@ } if ($postCount > $post_perpage) { - include $GLOBALS['xoops']->path('class/pagenav.php'); + require_once $GLOBALS['xoops']->path('class/pagenav.php'); $nav = new \XoopsPageNav($postCount, $post_perpage, $start, 'start', 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . '&mode=' . $mode); //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . $nav->url; if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { @@ -449,4 +449,4 @@ $xoopsTpl->assign('status', $status); // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/viewtopic.php b/viewtopic.php index 40e310d5..20934b0c 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -273,7 +273,7 @@ $viewtopic_users = []; if (is_array($userid_array) && count($userid_array) > 0) { -// require $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); +// require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/user.php'); $userHandler = new Newbb\UserHandler($GLOBALS['xoopsModuleConfig']['groupbar_enabled'], $GLOBALS['xoopsModuleConfig']['wol_enabled']); $userHandler->users = $users; $userHandler->online = $online; @@ -337,7 +337,7 @@ } if ($total_posts > $GLOBALS['xoopsModuleConfig']['posts_per_page']) { - include $GLOBALS['xoops']->path('class/pagenav.php'); + require_once $GLOBALS['xoops']->path('class/pagenav.php'); $nav = new \XoopsPageNav($total_posts, $GLOBALS['xoopsModuleConfig']['posts_per_page'], $start, 'start', 'topic_id=' . $topic_id . '&order=' . $order . '&status=' . $status . '&mode=' . $mode); //if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite']) && $GLOBALS['xoopsModuleConfig']['do_rewrite'] === 1) $nav->url = XOOPS_URL . $nav->url; @@ -829,5 +829,5 @@ } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -include $GLOBALS['xoops']->path('footer.php'); +require_once $GLOBALS['xoops']->path('footer.php'); $xoopsLogger->stopTime('newBB_viewtopic'); diff --git a/votepolls.php b/votepolls.php index b6112903..d5f17e86 100644 --- a/votepolls.php +++ b/votepolls.php @@ -60,7 +60,7 @@ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist // old xoopspoll or umfrage or any clone from them } else { - include $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); + require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); $classPoll = $topicObject->loadOldPoll(); $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist } diff --git a/xoops_version.php b/xoops_version.php index d0553d57..b682b2cf 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -9,7 +9,7 @@ * @package module::newbb */ -include __DIR__ . '/preloads/autoloader.php'; +require_once __DIR__ . '/preloads/autoloader.php'; $moduleDirName = basename(__DIR__); From 7273c1705f00b492971d45d42c4173ac24c12b50 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Sun, 1 Jul 2018 23:31:10 +0200 Subject: [PATCH 128/170] Remove unused variables that is immediately overridden --- admin/admin_synchronization.php | 1 - post.php | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/admin/admin_synchronization.php b/admin/admin_synchronization.php index 0c0a889e..3c1f9b45 100644 --- a/admin/admin_synchronization.php +++ b/admin/admin_synchronization.php @@ -40,7 +40,6 @@ } $criteria->setStart($start); $criteria->setLimit($limit); - $topicObjs = []; $topicObjs = $topicHandler->getAll($criteria); foreach ($topicObjs as $tObj) { $topicHandler->synchronization($tObj); diff --git a/post.php b/post.php index 163fb530..187a2125 100644 --- a/post.php +++ b/post.php @@ -70,7 +70,6 @@ $error_message = []; if (Request::getString('contents_submit', '', 'POST')) { -// $token_valid = false; $token_valid = $GLOBALS['xoopsSecurity']->check(); $captcha_invalid = false; @@ -528,8 +527,8 @@ $attachments = $postObject->getAttachment(); $xoopsTpl->assign('error_message', implode('
    ', $error_message)); - require_once __DIR__ . '/include/form.post.php'; + include __DIR__ . '/include/form.post.php'; } // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; -require_once $GLOBALS['xoops']->path('footer.php'); +include $GLOBALS['xoops']->path('footer.php'); From 6ae0e1026c7520a788b59c4a86680bf1bfb01e66 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Sun, 1 Jul 2018 23:53:24 +0200 Subject: [PATCH 129/170] Remove unused $post_id var in PostHandler::approve() scope --- class/PostHandler.php | 1 - 1 file changed, 1 deletion(-) diff --git a/class/PostHandler.php b/class/PostHandler.php index 2bb1606f..20120a32 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -142,7 +142,6 @@ public function approve(&$post, $force = false) if (is_numeric($post)) { $post = $this->get($post); } - $post_id = $post->getVar('post_id'); $wasApproved = $post->getVar('approved'); // irmtfan approve post if the approved = 0 (pending) or -1 (deleted) From d719aafd9dd1141766ec20bb05d3d41d591ae487 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 00:22:51 +0200 Subject: [PATCH 130/170] [Guard Clauses] Remove redundant else{} block After return statement --- class/ReadHandler.php | 9 +++++---- seo_url.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/class/ReadHandler.php b/class/ReadHandler.php index b8a76313..ad65185d 100644 --- a/class/ReadHandler.php +++ b/class/ReadHandler.php @@ -147,9 +147,9 @@ public function getRead($read_item, $uid = null) } if (1 == $this->mode) { return $this->getReadCookie($read_item); - } else { - return $this->getReadDb($read_item, $uid); } + + return $this->getReadDb($read_item, $uid); } /** @@ -200,11 +200,12 @@ public function setRead($read_item, $post_id, $uid = null) if (empty($this->mode)) { return true; } + if (1 == $this->mode) { return $this->setReadCookie($read_item, $post_id); - } else { - return $this->setReadDb($read_item, $post_id, $uid); } + + return $this->setReadDb($read_item, $post_id, $uid); } /** diff --git a/seo_url.php b/seo_url.php index a0df6092..800048db 100644 --- a/seo_url.php +++ b/seo_url.php @@ -418,7 +418,7 @@ function forum_seo_title($title = '', $withExt = true) } return $title; - } else { - return ''; } + + return ''; } From 896417ced3e211bca889e7b9ecf1b0de39b0e717 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 09:39:34 +0200 Subject: [PATCH 131/170] [Cleanup] Add/Remove lines for consistency --- admin/admin_footer.php | 1 + admin/admin_report.php | 2 -- class/ReadtopicHandler.php | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/admin_footer.php b/admin/admin_footer.php index f8cef989..f3f2457c 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -18,6 +18,7 @@ */ global $pathIcon32; + if (!class_exists('\Xoops', false)) { echo "
    \n" . "
    \n" . " XOOPS\n" . "
    \n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . "
    \n"; } diff --git a/admin/admin_report.php b/admin/admin_report.php index 0c3fcb59..b1ebe107 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -66,7 +66,6 @@ } // irmtfan add message redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTSAVE); - break; case 'delete': @@ -85,7 +84,6 @@ } // irmtfan add message redirect_header("admin_report.php?item={$item}" . (empty($start) ? '' : "&start={$start}"), 1, _AM_NEWBB_REPORTDELETE); - break; case 'default': diff --git a/class/ReadtopicHandler.php b/class/ReadtopicHandler.php index a4a48fab..fe305952 100644 --- a/class/ReadtopicHandler.php +++ b/class/ReadtopicHandler.php @@ -190,6 +190,7 @@ public function setReadItemsDb($status, $forum_id, $uid) $items[$key] = $itemsObject[$key]->getVar('topic_last_post_id'); } unset($itemsObject, $stickyObject); + foreach (array_keys($items) as $key) { $this->setReadDb($key, $items[$key], $uid); } From e9c950c917291b2c266e1cfd44e032b2d8a62817 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 20:52:32 +0200 Subject: [PATCH 132/170] [Readability] Fix indentation --- admin/admin_report.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/admin/admin_report.php b/admin/admin_report.php index b1ebe107..44f636ad 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -175,7 +175,13 @@ echo '
    '; echo '
    '; - $nav = new \XoopsPageNav($reportHandler->getCount(new \Criteria('report_result', $process_result)), $limit, $start, 'start', 'item=' . $item); + $nav = new \XoopsPageNav( + $reportHandler->getCount(new \Criteria('report_result', $process_result)), + $limit, + $start, + 'start', + 'item=' . $item + ); echo $nav->renderNav(4); echo '
    '; echo ' ' . _MI_NEWBB_ADMENU_REPORT . ' '; From 60230700db152fd5187d06e8923aafcbeda372bf Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 21:08:10 +0200 Subject: [PATCH 133/170] Set Breadcrumb::$dirname to private, since only called by its own class --- class/Common/Breadcrumb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 4a062581..e074b621 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -31,7 +31,7 @@ */ class Breadcrumb { - public $dirname; + private $dirname; private $bread = []; /** From 234c1b41e2813245f908a920f9d6b4411989465c Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 21:10:15 +0200 Subject: [PATCH 134/170] Change access modifier to private, since only called by its own clas --- class/IconHandler.php | 9 ++++----- class/IpCheck.php | 11 ++++++++--- class/PermissionHandler.php | 4 +++- class/Post.php | 2 +- class/ReadtopicHandler.php | 2 +- class/TopicRenderer.php | 30 ++++++++++++++---------------- class/Tree.php | 13 +++++++++---- class/UserHandler.php | 15 ++++++++++----- 8 files changed, 50 insertions(+), 36 deletions(-) diff --git a/class/IconHandler.php b/class/IconHandler.php index 58b93f78..b78c77ca 100644 --- a/class/IconHandler.php +++ b/class/IconHandler.php @@ -44,23 +44,22 @@ class IconHandler /** * image set */ - public $forumImage = []; + private $forumImage = []; /** * prefix */ - public $prefix = ''; + private $prefix = ''; /** * postfix, including extension */ - //var $postfix = ".gif"; - public $postfix = '.png'; + private $postfix = '.png'; /** * images to be assigned to template */ - public $images = []; + private $images = []; /** * Constructor diff --git a/class/IpCheck.php b/class/IpCheck.php index 6c254381..279e3c1c 100644 --- a/class/IpCheck.php +++ b/class/IpCheck.php @@ -7,9 +7,14 @@ */ class IpCheck { - public $ipin; - public $ipout; - public $ipver; + /** @var string */ + private $ipin; + + /** @var string */ + private $ipout; + + /** @var int */ + private $ipver; // Return IP type. 4 for IPv4, 6 for IPv6, 0 for bad IP. diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 3f435f2b..4581fc67 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -27,10 +27,12 @@ */ class PermissionHandler extends \XoopsGroupPermHandler { - public $_handler; /** @var \Xmf\Module\Helper\Cache */ protected $cacheHelper; + /** @var array */ + private $_handler; + /** * @param $db */ diff --git a/class/Post.php b/class/Post.php index f3c5895f..7a974bf8 100644 --- a/class/Post.php +++ b/class/Post.php @@ -44,7 +44,7 @@ class Post extends \XoopsObject { //class Post extends \XoopsObject { - public $attachmentArray = []; + private $attachmentArray = []; /** * diff --git a/class/ReadtopicHandler.php b/class/ReadtopicHandler.php index fe305952..d7dfbb1b 100644 --- a/class/ReadtopicHandler.php +++ b/class/ReadtopicHandler.php @@ -54,7 +54,7 @@ class ReadtopicHandler extends Newbb\ReadHandler * * @var integer */ - public $items_per_forum; + private $items_per_forum; /** * @param \XoopsDatabase|null $db diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index fe429b1d..3fdb6b90 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -25,10 +25,7 @@ */ class TopicRenderer { - /** - * reference to an object handler - */ - public $handler; + public $vars = []; /** * reference to moduleConfig @@ -36,15 +33,9 @@ class TopicRenderer public $config; /** - * Requested page - */ - public $page = 'list.topic.php'; - - /** - * query variables + * Current user has no access to current page */ - public $args = ['forum', 'uid', 'lastposter', 'type', 'status', 'mode', 'sort', 'order', 'start', 'since']; - public $vars = []; + private $noperm = false; /** * For multiple forums @@ -61,15 +52,22 @@ class TopicRenderer */ public $userlevel = 0; + public $query = []; + /** - * Current user has no access to current page + * reference to an object handler + */ + private $handler; + + /** + * Requested page */ - public $noperm = false; + private $page = 'list.topic.php'; /** - * + * query variables */ - public $query = []; + private $args = ['forum', 'uid', 'lastposter', 'type', 'status', 'mode', 'sort', 'order', 'start', 'since']; /** * Constructor diff --git a/class/Tree.php b/class/Tree.php index dba9d66e..3654acde 100644 --- a/class/Tree.php +++ b/class/Tree.php @@ -38,12 +38,17 @@ */ class Tree extends \XoopsTree { - public $prefix = '  '; - public $increment = '  '; - public $postArray = []; + /** @var string */ + private $prefix = '  '; + + /** @var string */ + private $increment = '  '; + + /** @var array */ + private $postArray = []; /** - * @param $table_name + * @param string $table_name * @param string $id_name * @param string $pid_name */ diff --git a/class/UserHandler.php b/class/UserHandler.php index 7a69b8db..fee0864a 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -21,12 +21,17 @@ */ class UserHandler { - public $enableGroup; - public $enableOnline; - public $userlist = []; - public $users = []; + /** @var array */ + public $users = []; - //var $online = array(); + /** @var bool */ + private $enableGroup; + + /** @var bool */ + private $enableOnline; + + /** @var array */ + private $userlist = []; /** * @param bool $enableGroup From eae9a7b628d0ec422e8ac00ed475ecb0235ea9b2 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 21:23:32 +0200 Subject: [PATCH 135/170] [phpdoc] Add missing @return tag/doc blocks --- class/Common/Breadcrumb.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index e074b621..b1425b38 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -31,12 +31,12 @@ */ class Breadcrumb { + /** @var string */ private $dirname; + + /** @var array */ private $bread = []; - /** - * - */ public function __construct() { $this->dirname = basename(dirname(__DIR__)); @@ -59,6 +59,7 @@ public function addLink($title = '', $link = '') /** * Render Pedigree BreadCrumb * + * @return string */ public function render() { From 4eccb2f0638a5fd43bad8909d7346930e816ccfe Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 21:24:13 +0200 Subject: [PATCH 136/170] Remove extra variables which is immediately overridden --- class/Helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Helper.php b/class/Helper.php index 065693ed..9e2a5c95 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -88,10 +88,10 @@ public function getDirname() */ public function getHandler($name) { - $ret = false; $db = \XoopsDatabaseFactory::getDatabaseConnection(); $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; $ret = new $class($db); + return $ret; } } From e6351b38fe71b270de41d341e6857722bce7ec14 Mon Sep 17 00:00:00 2001 From: Pierre-Henry Soria Date: Mon, 2 Jul 2018 21:25:57 +0200 Subject: [PATCH 137/170] [KarmaHandler] Remove unused class attribute --- class/KarmaHandler.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/class/KarmaHandler.php b/class/KarmaHandler.php index 673698b7..3efb3f76 100644 --- a/class/KarmaHandler.php +++ b/class/KarmaHandler.php @@ -11,8 +11,6 @@ */ class KarmaHandler { - public $user; - /** * @param null $user * @return int From cb0f6abaee9ca107b46b02261ed529484a8b0c95 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 2 Jul 2018 22:13:09 -0400 Subject: [PATCH 138/170] use $helper to load languages cosmetics --- admin/admin_header.php | 1 - blocks/newbb_block.php | 26 +++++++++----------------- class/Common/VersionChecks.php | 3 +++ class/ForumHandler.php | 2 +- class/ModerateHandler.php | 2 +- class/TopicHandler.php | 2 +- dl_attachment.php | 16 ++++++++-------- include/functions.user.php | 4 ++-- include/oninstall.php | 2 +- include/onuninstall.php | 1 + include/onupdate.php | 15 +-------------- 11 files changed, 28 insertions(+), 46 deletions(-) diff --git a/admin/admin_header.php b/admin/admin_header.php index 3d24a199..c899febf 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -45,7 +45,6 @@ /** @var Newbb\Helper $helper */ $helper = Newbb\Helper::getInstance(); -//$helper = NewBB::getInstance(); /** @var Xmf\Module\Admin $adminObject */ $adminObject = Xmf\Module\Admin::getInstance(); diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index e628bd91..ff9129e2 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -965,13 +965,10 @@ function b_newbb_custom($options) */ function b_newbb_custom_topic($options) { - + /** @var \XoopsModules\Newbb\Helper $helper */ + $helper = \XoopsModules\Newbb\Helper::getInstance(); // if no newbb module block set, we have to include the language file - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); - } else { - require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); - } + $helper->loadLanguage('blocks'); $options = explode('|', $options); $block = b_newbb_topic_show($options); @@ -990,13 +987,10 @@ function b_newbb_custom_topic($options) */ function b_newbb_custom_post($options) { - + /** @var \XoopsModules\Newbb\Helper $helper */ + $helper = \XoopsModules\Newbb\Helper::getInstance(); // if no newbb module block set, we have to include the language file - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); - } else { - require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); - } + $helper->loadLanguage('blocks'); $options = explode('|', $options); $block = b_newbb_post_show($options); @@ -1015,12 +1009,10 @@ function b_newbb_custom_post($options) */ function b_newbb_custom_author($options) { + /** @var \XoopsModules\Newbb\Helper $helper */ + $helper = \XoopsModules\Newbb\Helper::getInstance(); // if no newbb module block set, we have to include the language file - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); - } else { - require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); - } + $helper->loadLanguage('blocks'); $options = explode('|', $options); $block = b_newbb_author_show($options); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 35a0e3e6..5952b1d7 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -29,6 +29,7 @@ trait VersionChecks public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } @@ -59,6 +60,8 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = */ public static function checkVerPhp(\XoopsModule $module) { + $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = strtoupper($moduleDirName); xoops_loadLanguage('admin', $module->dirname()); // check for minimum PHP version $success = true; diff --git a/class/ForumHandler.php b/class/ForumHandler.php index acccdbae..5989ef72 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -1027,7 +1027,7 @@ public function &getParents($object) /** * function for get forum Ids by positive and negative values * - * @param int|text $values : positive values = forums | negative values = cats | $values=0 = all valid forums, $permission , true/false $parse_cats + * @param int|text|array $values : positive values = forums | negative values = cats | $values=0 = all valid forums, $permission , true/false $parse_cats * @param string $permission * @param bool $parse_cats * @return array|mixed $validForums diff --git a/class/ModerateHandler.php b/class/ModerateHandler.php index 1ec78bed..d3ef79e9 100644 --- a/class/ModerateHandler.php +++ b/class/ModerateHandler.php @@ -46,7 +46,7 @@ public function clearGarbage($expire = 0) * * * @param int $uid user id - * @param string $ip user ip + * @param string|bool $ip user ip * @param int $forum * @return bool true if IP is banned */ diff --git a/class/TopicHandler.php b/class/TopicHandler.php index 48247247..ad2645ef 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -195,7 +195,7 @@ public function getPostCount(&$topic, $type = '') /** * @param $topic_id - * @return null|\Post + * @return null|Newbb\Post */ public function &getTopPost($topic_id) { diff --git a/dl_attachment.php b/dl_attachment.php index 971c48b1..a1ece1c3 100644 --- a/dl_attachment.php +++ b/dl_attachment.php @@ -16,24 +16,24 @@ require_once __DIR__ . '/header.php'; require_once $GLOBALS['xoops']->path('header.php'); -$attach_id = Request::getInt('attachid', 0, 'GET'); -$post_id = Request::getInt('post_id', 0, 'GET'); +$attachId = Request::getInt('attachid', 0, 'GET'); +$postId = Request::getInt('post_id', 0, 'GET'); -if (!$post_id || !$attach_id) { - exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $post_id . '; attachid' . $attachid); +if (!$postId || !$attachId) { + exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); } ///** @var Newbb\PostHandler $postHandler */ //$postHandler = Newbb\Helper::getInstance()->getHandler('Post'); /** @var Newbb\Post $forumpost */ -$forumpost = $postHandler->get($post_id); +$forumpost = $postHandler->get($postId); if (!$approved = $forumpost->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); } ///** @var TopicHandler $topicHandler */ //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); -$topicObject = $topicHandler->getByPost($post_id); +$topicObject = $topicHandler->getByPost($postId); $topic_id = $topicObject->getVar('topic_id'); if (!$approved = $topicObject->getVar('approved')) { exit(_MD_NEWBB_NORIGHTTOVIEW); @@ -49,7 +49,7 @@ } $attachments = $forumpost->getAttachment(); -$attach = $attachments[$attach_id]; +$attach = $attachments[$attachId]; if (!$attach) { exit(_MD_NEWBB_NO_SUCH_FILE); } @@ -57,7 +57,7 @@ if (!file_exists($file_saved)) { exit(_MD_NEWBB_NO_SUCH_FILE); } -if ($down = $forumpost->incrementDownload($attach_id)) { +if ($down = $forumpost->incrementDownload($attachId)) { $forumpost->saveAttachment(); } unset($forumpost); diff --git a/include/functions.user.php b/include/functions.user.php index 2846e369..064fb577 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -51,7 +51,7 @@ function newbbGetUnameFromId($uid, $usereal = 0, $linked = false) /** * Function to check if a user is an administrator of the module * - * @param int|string $user + * @param int|string|array|\XoopsUser $user * @param int $mid * @return bool */ @@ -98,7 +98,7 @@ function newbbIsAdministrator($user = -1, $mid = 0) * Function to check if a user is a moderator of a forum * * @param $forum - * @param int $user + * @param int|string|\XoopsUser $user * @return bool */ function newbbIsModerator(&$forum, $user = -1) diff --git a/include/oninstall.php b/include/oninstall.php index b614c694..9b86bdfa 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -69,7 +69,7 @@ function xoops_module_install_newbb(\XoopsModule $module) $helper->loadLanguage('modinfo'); // default Permission Settings ---------------------- - global $xoopsModule; + global $xoopsModule, $xoopsDB; $moduleId = $xoopsModule->getVar('mid'); $moduleId2 = $helper->getModule()->mid(); $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/include/onuninstall.php b/include/onuninstall.php index 05349969..9afe7f80 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -35,6 +35,7 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) // return true; $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = strtoupper($moduleDirName); /** @var \XoopsModules\Newbb\Helper $helper */ $helper = \XoopsModules\Newbb\Helper::getInstance(); diff --git a/include/onupdate.php b/include/onupdate.php index ecef66fc..64d663f3 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -77,20 +77,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null $utility = new Newbb\Utility(); $configurator = new Newbb\Common\Configurator(); - if ($previousVersion < 240) { - - //rename column EXAMPLE - $tables = new Xmf\Database\Tables(); - $table = 'newbbx_categories'; - $column = 'ordre'; - $newName = 'order'; - $attributes = "INT(5) NOT NULL DEFAULT '0'"; - if ($tables->useTable($table)) { - $tables->alterColumn($table, $column, $attributes, $newName); - if (!$tables->executeQueue()) { - echo '
    ' . _AM_NEWBB_UPGRADEFAILED0 . ' ' . $migrate->getLastError(); - } - } + if ($previousVersion < 510) { //delete old HTML templates if (count($configurator->templateFolders) > 0) { From 21cdfd8aaafe3d25a424a1ca3b14b0232b7c25f7 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 2 Jul 2018 22:17:52 -0400 Subject: [PATCH 139/170] scrutinizer --- .scrutinizer.yml | 71 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 5310fdfe..372fed55 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,13 +1,62 @@ -# language: php checks: - php: true + php: + simplify_boolean_return: true + return_doc_comments: true + return_doc_comment_if_not_inferrable: true + remove_extra_empty_lines: true + properties_in_camelcaps: true + phpunit_assertions: true + parameters_in_camelcaps: true + parameter_doc_comments: true + param_doc_comment_if_not_inferrable: true + overriding_parameter: true + no_short_variable_names: + minimum: '3' + no_short_method_names: + minimum: '3' + no_long_variable_names: + maximum: '20' + no_goto: true + naming_conventions: + local_variable: '^[a-z][a-zA-Z0-9]*$' + abstract_class_name: ^Abstract|Factory$ + utility_class_name: 'Utils?$' + constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$' + property_name: '^[a-z][a-zA-Z0-9]*$' + method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$' + parameter_name: '^[a-z][a-zA-Z0-9]*$' + interface_name: '^[A-Z][a-zA-Z0-9]*Interface$' + type_name: '^[A-Z][a-zA-Z0-9]*$' + exception_name: '^[A-Z][a-zA-Z0-9]*Exception$' + isser_method_name: '^(?:is|has|should|may|supports)' + more_specific_types_in_doc_comments: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: false + order_alphabetically: false + fix_line_ending: true + check_method_contracts: + verify_interface_like_constraints: true + verify_documented_constraints: true + verify_parent_constraints: true + +filter: { } +coding_style: + php: + indentation: + general: + use_tabs: true + spaces: + general: + linefeed_character: return-newline build: - nodes: - tests: true - analysis: - tests: - override: - - - command: phpcs-run - use_website_config: true - - php-scrutinizer-run + nodes: + tests: true + analysis: + tests: + override: + - + command: phpcs-run + use_website_config: true + - php-scrutinizer-run From ea006b28ce27799642a904674c69654097b585d0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 3 Jul 2018 10:21:48 -0400 Subject: [PATCH 140/170] migration, updates --- admin/menu.php | 5 +++++ admin/migrate.php | 6 ++++-- class/Common/Breadcrumb.php | 2 +- class/Common/Configurator.php | 2 +- class/{ => Common}/Migrate.php | 31 ++++++++----------------------- class/Common/VersionChecks.php | 2 +- include/config.php | 25 +++++++++++++++++++++++-- include/functions.config.php | 8 ++++---- include/module.php | 4 ++-- language/english/modinfo.php | 3 +++ sql/mysql.sql | 2 +- viewtopic.php | 8 ++++---- 12 files changed, 57 insertions(+), 41 deletions(-) rename class/{ => Common}/Migrate.php (81%) diff --git a/admin/menu.php b/admin/menu.php index ff6d7b8b..d1b0bb4a 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -110,6 +110,11 @@ 'icon' => $pathIcon32 . 'synchronized.png' ]; +$adminmenu[] = [ + 'title' => _MI_NEWBB_ADMENU_MIGRATE, + 'link' => 'admin/migrate.php', + 'icon' => $pathIcon32 . 'database_go.png' +]; $adminmenu[] = [ 'title' => _MI_NEWBB_ADMENU_ABOUT, 'link' => 'admin/about.php', diff --git a/admin/migrate.php b/admin/migrate.php index 17aef801..b72571ac 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -51,8 +51,10 @@ EOF; -XoopsLoad::load('migrate', 'newbb'); -$newbbMigrate = new Newbb\Migrate(); +//XoopsLoad::load('migrate', 'newbb'); + +/** @var \XoopsModules\Newbb\Common\Migrate $newbbMigrate */ +$newbbMigrate = new \XoopsModules\Newbb\Common\Migrate(); $op = Request::getCmd('op', 'default'); $opShow = Request::getCmd('show', null, 'POST'); diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index b1425b38..1004040f 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -39,7 +39,7 @@ class Breadcrumb public function __construct() { - $this->dirname = basename(dirname(__DIR__)); + $this->dirname = basename(dirname(dirname(__DIR__))); } /** diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index a731b4e8..e4dcc043 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -42,7 +42,7 @@ class Configurator */ public function __construct() { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = basename(dirname(dirname(__DIR__))); $capsDirName = strtoupper($moduleDirName); require_once dirname(dirname(__DIR__)) . '/include/config.php'; diff --git a/class/Migrate.php b/class/Common/Migrate.php similarity index 81% rename from class/Migrate.php rename to class/Common/Migrate.php index 2af35615..2a5aa687 100644 --- a/class/Migrate.php +++ b/class/Common/Migrate.php @@ -1,4 +1,4 @@ - 'newbb_archive', - 'bb_categories' => 'newbb_categories', - 'bb_votedata' => 'newbb_votedata', - 'bb_forums' => 'newbb_forums', - 'bb_posts' => 'newbb_posts', - 'bb_posts_text' => 'newbb_posts_text', - 'bb_topics' => 'newbb_topics', - 'bb_online' => 'newbb_online', - 'bb_digest' => 'newbb_digest', - 'bb_report' => 'newbb_report', - 'bb_attachments' => 'newbb_attachments', - 'bb_moderates' => 'newbb_moderates', - 'bb_reads_forum' => 'newbb_reads_forum', - 'bb_reads_topic' => 'newbb_reads_topic', - 'bb_type' => 'newbb_type', - 'bb_type_forum' => 'newbb_type_forum', - 'bb_stats' => 'newbb_stats', - 'bb_user_stats' => 'newbb_user_stats', - ]; + private $renameTables = []; /** * Migrate constructor. @@ -49,8 +30,12 @@ class Migrate extends \Xmf\Database\Migrate * @throws \InvalidArgumentException */ public function __construct() - { - parent::__construct('newbb'); + { require_once dirname(dirname(__DIR__)) . '/include/config.php'; + $config = getConfig(); + $this->renameTables = $config->renameTables; + + $moduleDirName = basename(dirname(dirname(__DIR__))); + parent::__construct($moduleDirName); } /** diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 5952b1d7..0b4a6050 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -60,7 +60,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = */ public static function checkVerPhp(\XoopsModule $module) { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = basename(dirname(dirname(__DIR__))); $moduleDirNameUpper = strtoupper($moduleDirName); xoops_loadLanguage('admin', $module->dirname()); // check for minimum PHP version diff --git a/include/config.php b/include/config.php index e8d235d4..fedff031 100644 --- a/include/config.php +++ b/include/config.php @@ -19,7 +19,6 @@ * @author XOOPS Development Team - ( https://xoops.org ) */ - $moduleDirName = basename(dirname(__DIR__)); $uploadFolders = [ NEWBB_UPLOAD_PATH, @@ -85,7 +84,29 @@ function getConfig() '/tcpdf', '/images', ], - 'modCopyright' => " + + 'renameTables' => [ + 'bb_archive' => 'newbb_archive', + 'bb_categories' => 'newbb_categories', + 'bb_votedata' => 'newbb_votedata', + 'bb_forums' => 'newbb_forums', + 'bb_posts' => 'newbb_posts', + 'bb_posts_text' => 'newbb_posts_text', + 'bb_topics' => 'newbb_topics', + 'bb_online' => 'newbb_online', + 'bb_digest' => 'newbb_digest', + 'bb_report' => 'newbb_report', + 'bb_attachments' => 'newbb_attachments', + 'bb_moderates' => 'newbb_moderates', + 'bb_reads_forum' => 'newbb_reads_forum', + 'bb_reads_topic' => 'newbb_reads_topic', + 'bb_type' => 'newbb_type', + 'bb_type_forum' => 'newbb_type_forum', + 'bb_stats' => 'newbb_stats', + 'bb_user_stats' => 'newbb_user_stats', + ], + + 'modCopyright' => " \'XOOPS', ]; } diff --git a/include/functions.config.php b/include/functions.config.php index eed14c03..f86f9353 100644 --- a/include/functions.config.php +++ b/include/functions.config.php @@ -13,7 +13,7 @@ use XoopsModules\Newbb; -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; +defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_CONFIG_LOADED', true); if (!defined('NEWBB_FUNCTIONS_CONFIG')) { @@ -28,8 +28,8 @@ function newbbLoadConfig() { // require_once dirname(__DIR__) . '/class/Helper.php'; //$helper = NewBB::getInstance(); - /** @var Newbb\Helper $helper */ - $helper = Newbb\Helper::getInstance(); + /** @var \XoopsModules\Newbb\Helper $helper */ + $helper = \XoopsModules\Newbb\Helper::getInstance(); static $configs = null; if (null !== $configs) { @@ -37,7 +37,7 @@ function newbbLoadConfig() } $configs = is_object($helper) ? $helper->getConfig() : []; - $plugins = require_once __DIR__ . '/plugin.php'; + $plugins = require __DIR__ . '/plugin.php'; if (is_array($configs) && is_array($plugins)) { $configs = array_merge($configs, $plugins); } diff --git a/include/module.php b/include/module.php index 1e88e1ca..34e44262 100644 --- a/include/module.php +++ b/include/module.php @@ -94,8 +94,8 @@ function xoops_module_update_newbb(\XoopsModule $module, $oldversion = null) */ function xoops_module_pre_update_newbb(\XoopsModule $module) { - XoopsLoad::load('migrate', 'newbb'); - $newbbMigrate = new Newbb\Migrate(); +// XoopsLoad::load('migrate', 'newbb'); + $newbbMigrate = new \XoopsModules\Newbb\Common\Migrate(); $newbbMigrate->synchronizeSchema(); return true; diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 21eb814b..b81a5bd9 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -344,3 +344,6 @@ '); define('_MI_NEWBB_FORUM_DESC_LENGTH', 'Forum Description Length'); define('_MI_NEWBB_FORUM_DESC_LENGTH_DESC', 'The Forum description shown on the main page will be truncated to # of characters you set here. A full description will be shown on the forum page.'); + + +define('_MI_NEWBB_ADMENU_MIGRATE', 'Migrate'); diff --git a/sql/mysql.sql b/sql/mysql.sql index 7bb4e2ca..610be402 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -75,7 +75,7 @@ CREATE TABLE `newbb_moderates` ( `mod_end` INT(10) UNSIGNED NOT NULL DEFAULT '0', `mod_desc` VARCHAR(255) NOT NULL DEFAULT '', `uid` INT(10) UNSIGNED NOT NULL DEFAULT '0', - `ip` VARCHAR(50) NOT NULL DEFAULT '', + `ip` VARCHAR(45) NOT NULL DEFAULT '', `forum_id` SMALLINT(4) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`mod_id`), diff --git a/viewtopic.php b/viewtopic.php index 20934b0c..5aa70d3a 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -512,7 +512,7 @@ $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 140) { - $xpollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); + $xpollHandler = \XoopsModules\Xoopspoll\Helper::getInstance()->getHandler('Poll'); /** @var \XoopsPoll $pollObject */ $pollObject = $xpollHandler->get($poll_id); if (is_object($pollObject)) { @@ -536,12 +536,12 @@ 'back_link' => '' ]); $classRenderer = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Renderer'; - /** @var Xoopspoll\Renderer $renderer */ + /** @var \XoopsModules\Xoopspoll\Renderer $renderer */ $renderer = new $classRenderer($pollObject); // check to see if user has voted, show form if not, otherwise get results for form - /** @var Xoopspoll\LogHandler $logHandler */ - $logHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); + /** @var \XoopsModules\Xoopspoll\LogHandler $logHandler */ + $logHandler = \XoopsModules\Xoopspoll\Helper::getInstance()->getHandler('Log'); if ($pollObject->isAllowedToVote() && (!$logHandler->hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $uid))) { $myTpl = new \XoopsTpl(); From fd0c2c683938ad5bf0a8a9d19a4f09583fe62999 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 3 Jul 2018 10:22:10 -0400 Subject: [PATCH 141/170] tpl comments --- templates/newbb_viewtopic.tpl | 59 +++++++++++++++++------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/templates/newbb_viewtopic.tpl b/templates/newbb_viewtopic.tpl index 1d11502e..05f3c19a 100644 --- a/templates/newbb_viewtopic.tpl +++ b/templates/newbb_viewtopic.tpl @@ -1,7 +1,7 @@

    <{$lang_forum_index}>

    - + <{* irmtfan hardcode removed align="left" *}>
    <{$smarty.const._MD_NEWBB_FORUMHOME}> » @@ -51,13 +51,13 @@ <{/if}> <{if $viewer_level gt 1}> - + <{*irmtfan hardcode removed style="float: right; text-align: right;" *}>
    <{if $mode gt 1}> - + <{*irmtfan mistype forum_posts_admin => form_posts_admin - action="topicmanager.php" => action="action.post.php" *}>
    <{$smarty.const._ALL}>: - + <{*irmtfan mistype mode => op *}> - + <{* irmtfan user should not see rating if he dont have permission *}> <{if $rating_enable && $forum_post && $forum_reply}> - + <{* START irmtfan add topic search *}> <{if $mode lte 1}>
    @@ -164,11 +164,11 @@
    <{/if}> - + <{* END irmtfan add topic search *}>
    - + <{* irmtfan hardcode removed style="float: right; text-align:right;" *}>
    - <{$forum_page_nav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> + <{$forum_page_nav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <{* irmtfan to solve nested forms and id="xo-pagenav" issue *}>
    @@ -179,9 +179,9 @@
    <{$smarty.const._MD_NEWBB_TOPICLOCK}>

    <{/if}> - + <{foreach item=topic_post from=$topic_posts}> <{include file="db:newbb_thread.tpl" topic_post=$topic_post mode=$mode}>
    @@ -217,14 +217,14 @@
    - + <{* irmtfan correct prev and next icons add up*}> <{$p_up}><{$smarty.const._MD_NEWBB_TOP}>  <{$previous}> <{$smarty.const._MD_NEWBB_PREVTOPIC}>  <{$next}>  <{$smarty.const._MD_NEWBB_NEXTTOPIC}>
    - + <{* irmtfan hardcode removed style="float: right; text-align:right;"" *}>
    - <{$forum_page_nav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> + <{$forum_page_nav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> <{* irmtfan to solve nested forms and id="xo-pagenav" issue *}>
    @@ -239,14 +239,13 @@ <{if $quickreply.show}>
    - + <{* irmtfan move semicolon *}>
    <{$quickreply.form}>
    @@ -255,13 +254,13 @@ <{/if}>
    - + <{* irmtfan hardcode removed style="float: left; text-align: left;" *}>
    <{foreach item=perm from=$permission_table}>
    <{$perm}>
    <{/foreach}>
    - + <{* irmtfan hardcode removed style="float: right; text-align: right;" *}>
    @@ -281,13 +280,13 @@
    <{include file='db:newbb_notification_select.tpl'}> - - +*}> + +<{* START irmtfan add scroll js function to scroll down to current post or top of the topic *}> - +<{* END irmtfan add scroll js function to scroll down to current post or top of the topic *}> From c8240cd455be8bd06830d7beb46cb7504ae7f363 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 8 Jul 2018 21:52:25 -0400 Subject: [PATCH 142/170] null comparison --- README.md | 4 ++-- admin/admin_type_manager.php | 3 ++- admin/index.php | 2 +- class/CategoryHandler.php | 2 +- class/Common/Configurator.php | 2 +- class/Common/Migrate.php | 2 +- class/DigestHandler.php | 2 +- class/ForumHandler.php | 2 +- class/ModerateHandler.php | 2 +- class/OnlineHandler.php | 2 +- class/PermissionCategoryHandler.php | 2 +- class/PermissionForumHandler.php | 2 +- class/PermissionHandler.php | 4 ++-- class/Post.php | 2 +- class/PostHandler.php | 6 +++--- class/RateHandler.php | 2 +- class/ReadForumHandler.php | 2 +- class/ReadtopicHandler.php | 2 +- class/ReportHandler.php | 2 +- class/TextHandler.php | 2 +- class/TopicHandler.php | 2 +- class/TopicRenderer.php | 2 +- class/TypeHandler.php | 2 +- class/User.php | 4 ++-- class/UserstatsHandler.php | 2 +- include/functions.forum.php | 4 ++-- include/functions.render.php | 2 +- include/functions.user.php | 2 +- include/search.inc.php | 2 +- language/english/help/help.tpl | 10 +++++----- 30 files changed, 41 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 3abe6069..03b64cb1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) -## NewBB 5.0 Alpha 1 module for [XOOPS CMS 2.5.8+](https://xoops.org) +## NewBB 5.0 Alpha 1 module for [XOOPS CMS 2.5.9+](https://xoops.org) [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) @@ -12,7 +12,7 @@ Forum module for [XOOPS CMS](https://xoops.org) for discussions -[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/newbb-tutorial/) Tutorial: see [here](https://www.gitbook.com/book/xoops/newbb-tutorial/). +[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://xoops.gitbook.io/newbb-tutorial/) Tutorial: see [here](https://xoops.gitbook.io/newbb-tutorial/). To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/newbb-tutorial) [![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index e9123a0e..02ee2be9 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -384,7 +384,8 @@ echo "" . _AM_NEWBB_TYPE_DESCRIPTION . ''; echo ''; - $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); +// $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); + xoops_load('XoopsFormColorPicker'); if ('add' !== $op) { foreach ($typesObject as $key => $typeObject) { diff --git a/admin/index.php b/admin/index.php index 36a8650c..11a13b6b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -52,7 +52,7 @@ function newbb_admin_mkdir($target, $mode = 0777) $target = str_replace('..', '', $target); // http://www.php.net/manual/en/function.mkdir.php - return is_dir($target) || (newbb_admin_mkdir(dirname($target), $mode) && mkdir($target, $mode)); + return is_dir($target) || (newbb_admin_mkdir(dirname($target), $mode) && (!mkdir($target, $mode) && !is_dir($target))); } /** diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index 0bc59b53..b17a1515 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -22,7 +22,7 @@ class CategoryHandler extends \XoopsPersistableObjectHandler /** * @param null|\XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_categories', Category::class, 'cat_id', 'cat_title'); } diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index e4dcc043..f627c166 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -20,7 +20,7 @@ * */ -require_once dirname(dirname(__DIR__)) . '/include/common.php'; +// require_once dirname(dirname(__DIR__)) . '/include/common.php'; /** * Class Configurator diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 2a5aa687..b70e6fca 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -22,7 +22,7 @@ */ class Migrate extends \Xmf\Database\Migrate { - private $renameTables = []; + private $renameTables; /** * Migrate constructor. diff --git a/class/DigestHandler.php b/class/DigestHandler.php index 1c120fd4..2ee91bb3 100644 --- a/class/DigestHandler.php +++ b/class/DigestHandler.php @@ -24,7 +24,7 @@ class DigestHandler extends \XoopsPersistableObjectHandler * * @param null|\XoopsDatabase $db database connection */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_digest', Digest::class, 'digest_id'); } diff --git a/class/ForumHandler.php b/class/ForumHandler.php index 5989ef72..843f29f6 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -29,7 +29,7 @@ class ForumHandler extends \XoopsPersistableObjectHandler /** * @param null|\XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_forums', Forum::class, 'forum_id', 'forum_name'); } diff --git a/class/ModerateHandler.php b/class/ModerateHandler.php index d3ef79e9..9ffbdf59 100644 --- a/class/ModerateHandler.php +++ b/class/ModerateHandler.php @@ -22,7 +22,7 @@ class ModerateHandler extends \XoopsPersistableObjectHandler /** * @param null|\XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_moderates', Moderate::class, 'mod_id', 'uid'); } diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index a3ac03dc..8929decf 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -32,7 +32,7 @@ class OnlineHandler * OnlineHandler constructor. * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { $this->db = $db; } diff --git a/class/PermissionCategoryHandler.php b/class/PermissionCategoryHandler.php index b15fd6c0..33881f8f 100644 --- a/class/PermissionCategoryHandler.php +++ b/class/PermissionCategoryHandler.php @@ -26,7 +26,7 @@ class PermissionCategoryHandler extends Newbb\PermissionHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { // $this->PermissionHandler($db); parent::__construct($db); diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index e7489acc..5a2a51f9 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -33,7 +33,7 @@ class PermissionForumHandler extends PermissionHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { // $this->PermissionHandler($db); parent::__construct($db); diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 4581fc67..5a239431 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -34,9 +34,9 @@ class PermissionHandler extends \XoopsGroupPermHandler private $_handler; /** - * @param $db + * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { $this->cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); diff --git a/class/Post.php b/class/Post.php index 7a974bf8..cebffd30 100644 --- a/class/Post.php +++ b/class/Post.php @@ -481,7 +481,7 @@ public function showPost($isAdmin) static $name_anonymous; /** @var TopicHandler $topicHandler */ $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); - if (!isset($name_anonymous)) { + if (null === $name_anonymous) { $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); } diff --git a/class/PostHandler.php b/class/PostHandler.php index 20120a32..95c6bbff 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -44,7 +44,7 @@ class PostHandler extends \XoopsPersistableObjectHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_posts', Post::class, 'post_id', 'subject'); } @@ -485,7 +485,7 @@ public function getPostCount($criteria = null, $join = null) // LEFT JOIN $sql .= $join; // WHERE - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { @@ -515,7 +515,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join if (!empty($join)) { $sql .= $join; } - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' ' . $criteria->renderWhere(); if ('' !== $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); diff --git a/class/RateHandler.php b/class/RateHandler.php index 00d88fad..3bdcc981 100644 --- a/class/RateHandler.php +++ b/class/RateHandler.php @@ -42,7 +42,7 @@ class RateHandler extends \XoopsPersistableObjectHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_votedata', Rate::class, 'ratingid', ''); } diff --git a/class/ReadForumHandler.php b/class/ReadForumHandler.php index 44f79c4a..f9fe34c2 100644 --- a/class/ReadForumHandler.php +++ b/class/ReadForumHandler.php @@ -51,7 +51,7 @@ class ReadForumHandler extends Newbb\ReadHandler /** * @param \XoopsDatabase|null $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'forum'); } diff --git a/class/ReadtopicHandler.php b/class/ReadtopicHandler.php index d7dfbb1b..b0cb9a9a 100644 --- a/class/ReadtopicHandler.php +++ b/class/ReadtopicHandler.php @@ -59,7 +59,7 @@ class ReadtopicHandler extends Newbb\ReadHandler /** * @param \XoopsDatabase|null $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'topic'); $newbbConfig = newbbLoadConfig(); diff --git a/class/ReportHandler.php b/class/ReportHandler.php index 8d9e12ec..8e2c0ac1 100644 --- a/class/ReportHandler.php +++ b/class/ReportHandler.php @@ -22,7 +22,7 @@ class ReportHandler extends \XoopsPersistableObjectHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_report', Report::class, 'report_id', ''); } diff --git a/class/TextHandler.php b/class/TextHandler.php index 7959d225..01347858 100644 --- a/class/TextHandler.php +++ b/class/TextHandler.php @@ -22,7 +22,7 @@ class TextHandler extends \XoopsPersistableObjectHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_posts_text', Text::class, 'post_id', ''); } diff --git a/class/TopicHandler.php b/class/TopicHandler.php index ad2645ef..ee9a88f2 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -25,7 +25,7 @@ class TopicHandler extends \XoopsPersistableObjectHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_topics', Topic::class, 'topic_id', 'topic_title'); } diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 3fdb6b90..a274121c 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -430,7 +430,7 @@ public function parseVars() { static $parsed; // irmtfan - force to parse vars (run against static vars) - if (isset($parsed) && !$this->force) { + if (null !== $parsed && !$this->force) { return true; } diff --git a/class/TypeHandler.php b/class/TypeHandler.php index 463e78bf..2ad80267 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -24,7 +24,7 @@ class TypeHandler extends \XoopsPersistableObjectHandler /** * @param null|\XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_type', Type::class, 'type_id', 'type_name'); } diff --git a/class/User.php b/class/User.php index 31a96d17..fb9f4073 100644 --- a/class/User.php +++ b/class/User.php @@ -178,7 +178,7 @@ public function getLevel() $info = ''; if (2 == $GLOBALS['xoopsModuleConfig']['user_level']) { static $rpg_images; - if (!isset($rpg_images)) { + if (null === $rpg_images) { $iconHandler = newbbGetIconHandler(); $rpg_path = $iconHandler->getPath('rpg'); foreach (['img_left', 'img_backing', 'img_right', 'blue', 'green', 'orange'] as $img) { @@ -217,7 +217,7 @@ public function getInfo(&$user) static $name_anonymous; if (!is_object($user) || !$user->isActive()) { - if (!isset($name_anonymous)) { + if (null === $name_anonymous) { $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); } diff --git a/class/UserstatsHandler.php b/class/UserstatsHandler.php index 6de1f8e1..3984d566 100644 --- a/class/UserstatsHandler.php +++ b/class/UserstatsHandler.php @@ -23,7 +23,7 @@ class UserstatsHandler extends \XoopsPersistableObjectHandler /** * @param \XoopsDatabase $db */ - public function __construct(\XoopsDatabase $db) + public function __construct(\XoopsDatabase $db = null) { parent::__construct($db, 'newbb_user_stats', Userstats::class, 'uid', ''); } diff --git a/include/functions.forum.php b/include/functions.forum.php index b5cfd88b..5464ff4b 100644 --- a/include/functions.forum.php +++ b/include/functions.forum.php @@ -111,7 +111,7 @@ function newbbMakeJumpbox($forum_id = 0) function newbbGetSubForum($pid = 0, $refresh = false) { static $list; - if (!isset($list)) { + if (null === $list) { $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); $list = $cacheHelper->read('forum_sub'); } @@ -164,7 +164,7 @@ function newbbGetParentForum($forum_id = 0, $refresh = false) { static $list = null; - if (!isset($list)) { + if (null === $list) { $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); $list = $cacheHelper->read('forum_parent'); } diff --git a/include/functions.render.php b/include/functions.render.php index 301a0665..db3e9aa4 100644 --- a/include/functions.render.php +++ b/include/functions.render.php @@ -145,7 +145,7 @@ function newbbGetIconHandler() global $xoTheme; static $iconHandler; - if (isset($iconHandler)) { + if (null !== $iconHandler) { return $iconHandler; } diff --git a/include/functions.user.php b/include/functions.user.php index 064fb577..8b0f44e8 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -98,7 +98,7 @@ function newbbIsAdministrator($user = -1, $mid = 0) * Function to check if a user is a moderator of a forum * * @param $forum - * @param int|string|\XoopsUser $user + * @param int|array |string|\XoopsUser $user * @return bool */ function newbbIsModerator(&$forum, $user = -1) diff --git a/include/search.inc.php b/include/search.inc.php index d008e2da..6c48a7b2 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -95,7 +95,7 @@ function newbb_search( } $criteria = new \CriteriaCompo(); $criteria->add($criteriaPost, 'AND'); - if (isset($criteriaPermissions)) { + if (null !== $criteriaPermissions) { $criteria->add($criteriaPermissions, 'AND'); } if (isset($criteriaUser)) { diff --git a/language/english/help/help.tpl b/language/english/help/help.tpl index 772b10c7..ee9c2aed 100644 --- a/language/english/help/help.tpl +++ b/language/english/help/help.tpl @@ -13,21 +13,21 @@ extract the module folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

    Detailed instructions on installing modules are available in the - Chapter 2.12 of our XOOPS Operations Manual

    + Chapter 2.12 of our XOOPS Operations Manual

    OPERATING INSTRUCTIONS


    This module and its operations are very simple.

    Detailed instructions on configuring the access rights for user groups are available in the - Chapter 2.8 of our XOOPS Operations Manual

    + Chapter 2.8 of our XOOPS Operations Manual

    TUTORIAL


    - Tutorial has been started, but we might need your help! Please check out the status of the tutorial here . -

    To contribute to this Tutorial, please fork it on GitHub. -
    This document describes our Documentation Process and it will help you to understand how to contribute. + Tutorial has been started, but we might need your help! Please check out the status of the tutorial here . +

    To contribute to this Tutorial, please fork it on GitHub. +
    This document describes our Documentation Process and it will help you to understand how to contribute.

    There are more XOOPS Tutorials, so check them out in our XOOPS Tutorial Repository on GitBook.

    From ccec974dd868b038f2a57bbcd3ee71ac573f099d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 4 Dec 2018 03:12:41 -0500 Subject: [PATCH 143/170] updates in progress --- .scrutinizer.yml | 76 +--- .../templates_fulldiv_opacity/newbb_index.tpl | 2 +- .../newbb_search.tpl | 48 +-- .../templates_fulldiv_opacity/readme.txt | 6 +- .../xbootstrap/modules/newbb/newbb_index.tpl | 2 +- .../newbb/newbb_notification_select.tpl | 2 +- .../modules/newbb/newbb_searchresults.tpl | 2 +- .../xbootstrap/modules/newbb/newbb_thread.tpl | 8 +- .../modules/newbb/newbb_viewall.tpl | 8 +- .../modules/newbb/newbb_viewforum.tpl | 14 +- .../modules/newbb/newbb_viewpost.tpl | 2 +- action.topic.php | 2 +- admin/admin_votedata.php | 2 +- admin/menu.php | 17 +- admin/migrate.php | 13 +- class/Common/Configurator.php | 4 +- class/Common/Migrate.php | 19 +- class/OnlineHandler.php | 2 +- class/PermissionCategoryHandler.php | 2 +- class/PermissionForumHandler.php | 2 +- class/PermissionHandler.php | 18 +- class/PostHandler.php | 2 +- class/RateHandler.php | 2 +- class/{ReadForum.php => Readforum.php} | 2 +- ...dForumHandler.php => ReadforumHandler.php} | 4 +- class/ReportHandler.php | 2 +- class/TextHandler.php | 2 +- class/TopicHandler.php | 2 +- class/UserstatsHandler.php | 2 +- docs/changelog.txt | 2 +- docs/gpl.txt | 14 +- include/common.php | 6 +- include/config.php | 53 ++- include/form.post.php | 2 +- include/functions.config.php | 2 + include/functions.forum.php | 2 +- include/functions.php | 2 +- include/functions.read.php | 8 +- include/functions.recon.php | 2 +- include/functions.render.php | 2 +- include/functions.rpc.php | 2 +- include/functions.topic.php | 2 +- include/functions.welcome.inc.php | 6 +- include/module.php | 7 +- include/onupdate.php | 32 +- index.php | 2 +- .../mail_template/forum_newpost_notify.tpl | 4 +- .../mail_template/forum_newthread_notify.tpl | 4 +- .../mail_template/global_digest_notify.tpl | 4 +- .../mail_template/global_newforum_notify.tpl | 2 +- .../global_newfullpost_notify.tpl | 4 +- .../mail_template/global_newpost_notify.tpl | 4 +- .../mail_template/thread_newpost_notify.tpl | 4 +- language/english/modinfo.php | 76 ++-- sql/2510debug1.sql | 327 +++++++++++++++++ sql/259pack2.sql | 332 ++++++++++++++++++ sql/xoops_mysql.sql | 1 + templates/newbb_index.tpl | 2 +- templates/newbb_index_menu.tpl | 2 +- xoops_version.php | 12 + 60 files changed, 928 insertions(+), 265 deletions(-) rename class/{ReadForum.php => Readforum.php} (98%) rename class/{ReadForumHandler.php => ReadforumHandler.php} (98%) create mode 100644 sql/2510debug1.sql create mode 100644 sql/259pack2.sql create mode 100644 sql/xoops_mysql.sql diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 372fed55..9e889cf2 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,62 +1,24 @@ -checks: - php: - simplify_boolean_return: true - return_doc_comments: true - return_doc_comment_if_not_inferrable: true - remove_extra_empty_lines: true - properties_in_camelcaps: true - phpunit_assertions: true - parameters_in_camelcaps: true - parameter_doc_comments: true - param_doc_comment_if_not_inferrable: true - overriding_parameter: true - no_short_variable_names: - minimum: '3' - no_short_method_names: - minimum: '3' - no_long_variable_names: - maximum: '20' - no_goto: true - naming_conventions: - local_variable: '^[a-z][a-zA-Z0-9]*$' - abstract_class_name: ^Abstract|Factory$ - utility_class_name: 'Utils?$' - constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$' - property_name: '^[a-z][a-zA-Z0-9]*$' - method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$' - parameter_name: '^[a-z][a-zA-Z0-9]*$' - interface_name: '^[A-Z][a-zA-Z0-9]*Interface$' - type_name: '^[A-Z][a-zA-Z0-9]*$' - exception_name: '^[A-Z][a-zA-Z0-9]*Exception$' - isser_method_name: '^(?:is|has|should|may|supports)' - more_specific_types_in_doc_comments: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: false - order_alphabetically: false - fix_line_ending: true - check_method_contracts: - verify_interface_like_constraints: true - verify_documented_constraints: true - verify_parent_constraints: true - -filter: { } -coding_style: - php: - indentation: - general: - use_tabs: true - spaces: - general: - linefeed_character: return-newline +# language: php build: nodes: - tests: true analysis: + project_setup: + override: true tests: override: - - - command: phpcs-run - use_website_config: true - - php-scrutinizer-run + - php-scrutinizer-run --enable-security-analysis +build: + nodes: + tests: true + analysis: + dependencies: + after: + # The following installs the most recent XOOPS CMS version, you might want + # to install a specific release tag or branch instead. + - git clone --depth=1 https://github.com/XOOPS/XoopsCore25 + - git clone --depth=1 https://github.com/mambax7/tag + project_setup: +filter: + dependency_paths: + - XoopsCore25/* + - tag/* diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl index c917bd7d..7c7bff99 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl @@ -9,7 +9,7 @@ <{if $viewer_level gt 1}>
    -  <{$smarty.const._MD_NEWBB_ADMINCP}>  +  <{$smarty.const._MD_NEWBB_ADMINCP}> 
    <{$smarty.const._MD_NEWBB_TOPIC}>: diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl index c26f1d6f..9247c8d2 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl @@ -1,56 +1,56 @@ <{if $search_info}> - <{includeq file="db:newbb_searchresults.tpl" results=$results}> + <{includeq file="db:newbb_searchresults.tpl" results=$results}> <{/if}>
    <{$smarty.const._SR_KEYWORDS}> 
    -
    -
    +
    +
    <{$smarty.const._SR_TYPE}> 
    <{$andor_selection_box}>
    -
    +
    <{$smarty.const._MD_NEWBB_FORUMC}> 
    <{$forum_selection_box}>
    -
    -
    <{$smarty.const._SR_SEARCHIN}> 
    +
    +
    <{$smarty.const._SR_SEARCHIN}> 
    <{$searchin_radio}>
    -
    +
    <{$smarty.const._MD_NEWBB_AUTHOR}> 
    -
    -
    <{$smarty.const._MD_NEWBB_SORTBY}> 
    +
    +
    <{$smarty.const._MD_NEWBB_SORTBY}> 
    <{$sortby_selection_box}>
    -
    -
    <{$smarty.const._MD_NEWBB_SINCE}> 
    +
    +
    <{$smarty.const._MD_NEWBB_SINCE}> 
    <{$since_selection_box}>
    -
    +
    <{$smarty.const._MD_SELECT_STARTLAG}> 
    -
    +
    <{$smarty.const._MD_NEWBB_SELECT_LENGTH}> 
    -
    +
    <{$smarty.const._MD_NEWBB_SELECT_HTML}> 
    <{$selecthtml_radio}>
    -
    +
    <{$smarty.const._MD_NEWBB_SELECT_EXCLUDE}> 
    <{$selectexclude_check_box}>
    -
    -
    <{$smarty.const._MD_NEWBB_SHOWSEARCH}> 
    +
    +
    <{$smarty.const._MD_NEWBB_SHOWSEARCH}> 
    <{$show_search_radio}>
    -
    +
    <{if $search_rule}> -
    <{$smarty.const._SR_SEARCHRULE}> 
    +
    <{$smarty.const._SR_SEARCHRULE}> 
    <{$search_rule}>
    -
    - <{/if}> +
    + <{/if}>
     
    -
    +
    diff --git a/EXTRA/themes/templates_fulldiv_opacity/readme.txt b/EXTRA/themes/templates_fulldiv_opacity/readme.txt index 44292569..bd9afc58 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/readme.txt +++ b/EXTRA/themes/templates_fulldiv_opacity/readme.txt @@ -4,6 +4,6 @@ Install: Copy All files to XOOPS_ROOT/themes/YOUR_THEME/modules/newbb * Priority for path per types: - * NEWBB_ROOT - IF EXISTS XOOPS_THEME/modules/newbb, TAKE IT; - * ELSEIF EXISTS XOOPS_THEME_DEFAULT/modules/newbb, TAKE IT; - * ELSE TAKE XOOPS_ROOT/modules/newbb/templates. + * NEWBB_ROOT - IF EXISTS XOOPS_THEME/modules/newbb, TAKE IT; + * ELSEIF EXISTS XOOPS_THEME_DEFAULT/modules/newbb, TAKE IT; + * ELSE TAKE XOOPS_ROOT/modules/newbb/templates. diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl index ff8d357f..fea354ff 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl @@ -322,7 +322,7 @@ <{includeq file="db:newbb_online.tpl"}> <{/if}> - NewBB Version <{$version/100}> + NewBB Version <{$version/100}> <{if $rss_button}>
    diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_notification_select.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_notification_select.tpl index 6a92036e..b45e4078 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_notification_select.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_notification_select.tpl @@ -37,7 +37,7 @@ -
    + diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_searchresults.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_searchresults.tpl index 4b91d25b..c6879351 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_searchresults.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_searchresults.tpl @@ -34,7 +34,7 @@ <{/section}> - + <{if $search_next or $search_prev}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl index 4d78284e..650aebdd 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl @@ -13,7 +13,7 @@ <{else}> <{$topic_post.poster.name}> <{/if}> - + <{if $topic_post.poster.rank.title !=""}>
    • <{$topic_post.poster.rank.title}>
    • @@ -81,7 +81,7 @@
    • <{$smarty.const._MD_NEWBB_POSTEDON}><{$topic_post.post_date}>
    • <{/if}>
    - +
    @@ -94,7 +94,7 @@ <{/if}>
    - + <{$topic_post.post_text}> <{if $topic_post.post_attachment}> @@ -116,7 +116,7 @@ <{/if}>
    - + <{if $category.cat_image}> - <{$category.cat_title}> + <{$category.cat_title}> <{/if}> @@ -327,16 +327,16 @@ <{$img_forum_new}> = <{$smarty.const._MD_NEWBB_NEWPOSTS}>
    <{$img_forum}> = <{$smarty.const._MD_NEWBB_NONEWPOSTS}>
    -
    +
    @@ -350,7 +350,7 @@
    <{/if}>
    -
    +
    <{if $currenttime}>
    @@ -390,9 +390,9 @@
    -
    +
    <{/if}> -
    +
    <{if $online}> <{include file="db:newbb_online.tpl"}> <{/if}> diff --git a/templates/newbb_moderate.tpl b/templates/newbb_moderate.tpl index 69c6567f..14f2db71 100644 --- a/templates/newbb_moderate.tpl +++ b/templates/newbb_moderate.tpl @@ -1,7 +1,7 @@

    <{$smarty.const._MD_NEWBB_SUSPEND_MANAGEMENT}>

    -
    +
    <{$smarty.const._MD_NEWBB_FORUMINDEX}> » <{$smarty.const._MD_NEWBB_SUSPEND_MANAGEMENT}> @@ -17,7 +17,7 @@ <{/if}>

    <{$smarty.const._MD_NEWBB_SUSPEND_LIST}>

    -
    +
    @@ -55,7 +55,7 @@

    <{$suspend_form.title}>

    -
    +
    >
    <{foreach item=element from=$suspend_form.elements}> diff --git a/templates/newbb_notification_select.tpl b/templates/newbb_notification_select.tpl index da444e2d..f57fd0df 100644 --- a/templates/newbb_notification_select.tpl +++ b/templates/newbb_notification_select.tpl @@ -2,7 +2,7 @@

    <{$lang_activenotifications}>

    - + <{securityToken}>
    @@ -10,7 +10,7 @@ - + <{foreach name=outer item=category from=$xoops_notification.categories}> @@ -21,15 +21,15 @@ <{/if}> <{/foreach}> <{/foreach}> - +
    <{$lang_category}> <{$lang_events}>
    <{counter assign=index}> - - checked="checked"<{/if}> /> + + checked="checked"<{/if}> > <{$event.caption}>
    diff --git a/templates/newbb_poll_view.tpl b/templates/newbb_poll_view.tpl index 1f7cb8ea..311f7085 100644 --- a/templates/newbb_poll_view.tpl +++ b/templates/newbb_poll_view.tpl @@ -2,11 +2,11 @@ <{$topic_pollform}> <{else}> - - + + - <{foreach item=option from=$poll.options}> @@ -17,7 +17,7 @@ <{/foreach}> - +
    + <{$poll.question}>
    diff --git a/templates/newbb_search.tpl b/templates/newbb_search.tpl index e574d35c..9bed0cca 100644 --- a/templates/newbb_search.tpl +++ b/templates/newbb_search.tpl @@ -16,7 +16,7 @@ <{$smarty.const._SR_KEYWORDS}>  - + @@ -36,7 +36,7 @@ <{$smarty.const._MD_NEWBB_AUTHOR}>  - + @@ -50,7 +50,7 @@ <{$smarty.const._MD_NEWBB_SELECT_LENGTH}>  - + <{$smarty.const._MD_NEWBB_SHOWSEARCH}>  @@ -68,7 +68,7 @@   - + diff --git a/templates/newbb_thread.tpl b/templates/newbb_thread.tpl index 81583d0b..a47f8520 100644 --- a/templates/newbb_thread.tpl +++ b/templates/newbb_thread.tpl @@ -35,12 +35,12 @@ <{if $topic_post.poster.uid != 0}> -
    <{if $topic_post.poster.rank.title !=""}> <{$topic_post.poster.rank.title}>
    <{$topic_post.poster.rank.title}><{/if}>
    +
    <{if $topic_post.poster.rank.title !=""}> <{$topic_post.poster.rank.title}>
    <{$topic_post.poster.rank.title}><{/if}>
    <{if $topic_post.poster.avatar != "blank.gif"}>
    - + <{else}>
    @@ -163,7 +163,7 @@ | <{$smarty.const._MD_NEWBB_SPLIT_ALL}> | - + <{else}> <{if $topic_post.thread_buttons}> <{foreach item=btn from=$topic_post.thread_buttons}> diff --git a/templates/newbb_viewall.tpl b/templates/newbb_viewall.tpl index 39b6c4c8..7ee6a8f4 100644 --- a/templates/newbb_viewall.tpl +++ b/templates/newbb_viewall.tpl @@ -2,7 +2,7 @@

    <{$forum_index_title}>

    -
    +
    <{$smarty.const._MD_NEWBB_FORUMHOME}> <{if $parent_forum}> » @@ -30,7 +30,7 @@
    <{/if}>

    @@ -266,7 +266,7 @@
    <{/if}> <{if $online}> - <{includeq file="db:newbb_online.tpl"}> + <{include file="db:newbb_online.tpl"}> <{/if}> -<{includeq file='db:newbb_notification_select.tpl'}> +<{include file='db:newbb_notification_select.tpl'}> diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl index 6f34709e..3a24053b 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_search.tpl @@ -4,7 +4,7 @@ <{$smarty.const._SR_SEARCH}>
    <{if $search_info}> - <{includeq file="db:newbb_searchresults.tpl" results=$results}> + <{include file="db:newbb_searchresults.tpl" results=$results}> <{/if}>
    diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl index 7eea00ca..d929a580 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewall.tpl @@ -251,6 +251,6 @@

    -<{if $online}><{includeq file="db:newbb_online.tpl"}><{/if}> -<{includeq file='db:newbb_notification_select.tpl'}> +<{if $online}><{include file="db:newbb_online.tpl"}><{/if}> +<{include file='db:newbb_notification_select.tpl'}> diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl index eefb3698..082f87b2 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl @@ -25,7 +25,7 @@
    <{if $subforum}> - <{includeq file="db:newbb_viewforum_subforum.tpl"}> + <{include file="db:newbb_viewforum_subforum.tpl"}>
    <{/if}> @@ -77,7 +77,7 @@