Compare commits

...

21 Commits

Author SHA1 Message Date
Robot 60e9e3b32d
Release of v5.0.0-beta2
First release of Sermon Distributor towards Joomla 5. Add PHP check to install/update class. Add Database check and fix to install/update class.
2024-05-03 07:46:28 +02:00
Robot 27a7c03ed8
Update on v5.0.0-beta1 (beta for next version)
Here's an update on the current version, which includes changes towards the next release still in beta.
2024-03-07 20:43:57 +02:00
Robot 4f0bb9ed7b
Update on v5.0.0-beta1 (beta for next version)
Here's an update on the current version, which includes changes towards the next release still in beta.
2024-03-07 20:32:33 +02:00
Robot 907e9b8d8f
Update on v5.0.0-beta1 (beta for next version)
Here's an update on the current version, which includes changes towards the next release still in beta.
2024-03-07 19:23:52 +02:00
Llewellyn van der Merwe 806fedaee2
Update octojpack config for J5. 2024-03-07 18:51:38 +02:00
Malachi van der Merwe 996ba96c78 Changes joomla_sermon_distributor_version to sermon_distributor_version in h-test.yml 2024-03-05 20:30:17 +00:00
Malachi van der Merwe 7673d14857 Fixes the ids names in h-test.yml 2024-03-05 20:30:17 +00:00
Malachi van der Merwe 3045f98ceb Fixes the ids names in h-test.yml 2024-03-05 20:30:17 +00:00
Malachi van der Merwe 502860ebfb Adds Joomla Sermon Distributor version, PHP version, and Apache version 2024-03-05 20:30:17 +00:00
Lemuel van der Merwe 721b25733c
Fixes the dropdown ids in g-security.yml 2024-03-05 16:01:59 +02:00
Lemuel van der Merwe 9d2cbb0f7a
Fixes the dropdown ids in a-bug.yml 2024-03-05 16:00:27 +02:00
Lemuel van der Merwe dd9b9aa30e
Adds Sermon Distributor version choice to g-security.yml 2024-03-05 15:02:22 +02:00
Lemuel van der Merwe 168636882d
Adds Sermon Distributor version, php version, and apache version choices to a-bug.yml 2024-03-05 14:52:39 +02:00
Llewellyn van der Merwe ab9db903ed
Update octojpack config for J5. 2024-03-05 12:26:51 +02:00
Llewellyn van der Merwe 1069746432
Moved the issue templates to the correct folder. 2024-03-05 12:04:36 +02:00
Malachi van der Merwe d7292ab43d Fixes indentation and text 2024-03-05 10:02:18 +00:00
Malachi van der Merwe 6923086cbb Fixes indentation and text 2024-03-05 10:02:18 +00:00
Malachi van der Merwe c983430461 Fixes indentation and text 2024-03-05 10:02:18 +00:00
Malachi van der Merwe 24a860fef6 Adds issue 2024-03-05 10:02:18 +00:00
Lemuel van der Merwe 961b1d0b8c
Fixes indentation and syntax in a-bug.yml 2024-03-05 11:36:26 +02:00
Lemuel van der Merwe 26ae45a46f
Adds ISSUE_TEMPLATE 2024-03-05 08:41:34 +02:00
154 changed files with 4401 additions and 508 deletions

View File

@ -0,0 +1,139 @@
name: Bug Report
about: Draft a report to aid in our Debugging efforts.
title: "[BUG]: "
labels:
- bug
body:
- type: markdown
attributes:
value: |
We value your effort in reporting an bug! Your feedback is essential for us to address and fix the problem.
- type: textarea
id: what-happened
attributes:
label: What Happened?
description: Please provide a detailed description of the issue and explain what outcome you anticipate.
placeholder: Describe the issue you experienced.
value: ""
validations:
required: true
- type: markdown
attributes:
value: |
# Environment Details
- type: dropdown
id: joomla_version
attributes:
label: Which Joomla version are you using?
multiple: true
options:
- Latest
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: sermon_distributor_version
attributes:
label: Which Joomla Sermon Distributor version are you using?
multiple: true
options:
- Latest
- v5.0
- v3.0
- v2.1
- v2.0
- Other
validations:
required: true
- type: dropdown
id: php_version
attributes:
label: Which PHP version are you using?
multiple: true
options:
- Latest
- PHP 8.3
- PHP 8.2
- PHP 8.1
- PHP 8.0
- PHP 7.4
- Other
validations:
required: true
- type: dropdown
id: apache_version
attributes:
label: Which Apache version are you using?
multiple: true
options:
- Latest
- Apache 2.4
- Apache 2.2
- Apache 2.0
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Where did this issue occur?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermon Categories(admin_views)
- Series List(admin_views)
- Series(admin_view)
- Statistics(admin_view)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preachers(site_views)
- Preacher(site_view)
- Series(site_view)
- Series List(site_views)
- Other
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: On which browsers did you encounter the issue?
multiple: true
options:
- Chrome
- Firefox
- Microsoft Edge
- Safari
- Opera
- Brave
- Vivaldi
validations:
required: true
- type: dropdown
id: os
attributes:
label: What operating system are you currently using?
multiple: true
options:
- Windows (Desktop)
- macOS (Desktop)
- Linux (Desktop)
- Other
validations:
required: true
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,83 @@
name: Enhancement Request
about: Suggest an idea for Joomla-Sermon-Distributor
title: "[ENHANCEMENT]: "
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
Thank you for suggesting an enhancement! Your input is crucial for our innovation and progress. To assist us better, please share detailed information about your idea.
- type: textarea
id: enhancement-details
attributes:
label: Enhancement Details
description: Could you detail the enhancement you're suggesting? Explain the issue it addresses or the new feature it introduces.
placeholder: Please give an in-depth explanation of your proposed enhancement.
validations:
required: true
- type: markdown
attributes:
value: |
# Context and Priority
- type: dropdown
id: system
attributes:
label: On which Joomla version will this enhancement have an impact?
multiple: true
options:
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Which part of the extension will be affected by this enhancement?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermons Categories(admin_views)
- Series List(admin_view)
- Series(admin_views)
- Statistics(admin_views)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preacher(site_view)
- Preachers(site_views)
- Series(site_view)
- Series List(site_views)
- Other
validations:
required: true
- type: textarea
id: benefits
attributes:
label: Expected Benefits
description: What advantages can be anticipated from this enhancement? How does it contribute to the improvement of the system?
placeholder: Detail the advantages that this enhancement will provide.
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Supply additional context or screenshots related to the enhancement request in this space.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,83 @@
name: Task
about: Create a task for project management
title: "[TASK]: "
labels:
- task
body:
- type: markdown
attributes:
value: |
Thanks for setting up the task! Tasks assist us in arranging and ranking our work. Kindly provide comprehensive details about the task for clarity and efficient tracking.
- type: textarea
id: task-details
attributes:
label: Task Details
description: Please describe the task. What are the specific actions required?
placeholder: Provide a detailed description of the task.
validations:
required: true
- type: markdown
attributes:
value: |
# Task Context and Priority
- type: dropdown
id: system
attributes:
label: Which Joomla version is this task related to?
multiple: true
options:
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Which area of the extension does this task impact?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermon Categories(admin_views)
- Series List(admin_views)
- Series(admin_view)
- Statistics(admin_view)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preachers(site_views)
- Preacher(site_view)
- Series(site_view)
- Series List(site_views)
- Other
validations:
required: true
- type: textarea
id: task-objective
attributes:
label: Task Objective
description: What's the aim or purpose of this task? How will it contribute to the project or system's success?
placeholder: Describe the goal and anticipated result of the task.
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Please share any extra context, files, or screenshots that could aid in comprehending or carrying out the task.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,83 @@
name: Documentation
about: Propose improvements to the documentation or highlight any issues found within it.
title: "[DOCUMENTATION]: "
labels:
- documentation
body:
- type: markdown
attributes:
value: |
We appreciate your input on our documentation! Clear and comprehensive documentation plays a vital role in enabling users to effectively interact with our systems. To assist us in making improvements, kindly offer thorough details regarding your suggestion or the specific problem you've encountered.
- type: textarea
id: documentation-details
attributes:
label: Documentation Details
description: Please explain the specific problem with the documentation or the improvements you recommend. Is it a missing topic, unclear instructions, outdated content, or something else?
placeholder: Detail the issue with the documentation or suggest improvements..
validations:
required: true
- type: markdown
attributes:
value: |
# Specific Context
- type: dropdown
id: system
attributes:
label: Which Joomla version does this documentation relate to?
multiple: true
options:
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Which area of the extension does this documentation concern?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermon Categories(admin_views)
- Series List(admin_views)
- Series(admin_view)
- Statistics(admin_view)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preachers(site_views)
- Preacher(site_view)
- Series(site_view)
- Series List(site_views)
- Other
validations:
required: true
- type: textarea
id: expected-outcome
attributes:
label: Expected Outcome
description: What outcomes do you anticipate from this change in documentation? How will it benifit the users or enhance the project?
placeholder: Explain the expected result of this change in the documentation.
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Share any extra details, files, or screenshots that could help in understanding or applying the documentation change.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,126 @@
name: Performance Issue
about: Recommend or propose performance improvements
title: "[PERFORMANCE]: "
labels:
- performance
body:
- type: markdown
attributes:
value: |
Appreciation for tackling performance challenges! Optimizing performance is vital for our system's efficiency and the user experience. Could you offer more comprehensive details to aid in identifying and resolving the suggested performance issue or improvement?
- type: textarea
id: performance-details
attributes:
label: Performance Details
description: Please outline the performance problem or the enhancements you propose. Is it related to speed, resource usage, responsiveness, or something else?
placeholder: Offer an in-depth explanation of the performance challenge or improvement.
validations:
required: true
- type: markdown
attributes:
value: |
# Affected Systems and Context
- type: dropdown
id: system
attributes:
label: Which Joomla version is affected by this performance issue?
multiple: true
options:
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Which part of the extension will be affected by this performance issue?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermons Categories(admin_views)
- Series List(admin_view)
- Series(admin_views)
- Statistics(admin_views)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preacher(site_view)
- Preachers(site_views)
- Series(site_view)
- Series List(site_views)
- Other
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: Which browsers did you experience the performance problem on?
multiple: true
options:
- Chrome
- Firefox
- Microsoft Edge
- Safari
- Opera
- Brave
- Vivaldi
validations:
required: true
- type: dropdown
id: os
attributes:
label: Which operating system are you using?
multiple: true
options:
- Windows (Desktop)
- macOS (Desktop)
- Linux (Desktop)
- Other
validations:
required: true
- type: textarea
id: replication-steps
attributes:
label: Steps to Replicate
description: If possible, share a step-by-step guide to replicate the performance problem.
placeholder: Explain how to replicate the problem.
validations:
required: false
- type: textarea
id: impact-assessment
attributes:
label: Impact Assessment
description: How does the performance problem impact the system or its users? How severe is its effect?
placeholder: Explain the impact of the performance problem.
validations:
required: true
- type: textarea
id: proposed-solutions
attributes:
label: Proposed Solutions or Ideas
description: If you have any suggestions or ideas for resolving the performance problem, please share them here.
placeholder: Share any potential solutions or improvement problem.
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Provide any additional context, benchmarks, logs, or screenshots that might help in understanding or addressing the performance problem.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,86 @@
name: Refactoring Task
about: Recommend or identify the necessity for code refactoring.
title: "[REFACTOR]: "
labels:
- refactor
body:
- type: markdown
attributes:
value: |
We appreciate your commitment to enhancing the maintainability and quality of our codebase! Code refactoring plays a crucial role in ensuring our system remains efficient and easy to manage. To assist us effectively, please share comprehensive details about the refactoring task you are suggesting or identifying.
- type: textarea
id: refactoring-details
attributes:
label: Refactoring Details
description: Outline the refactoring task, specifying which code segment requires attention and the reasons behind this need. What improvements are expected from this refactoring?
placeholder: Provide an in-depth explanation of the refactoring task?
validations:
required: true
- type: markdown
attributes:
value: |
# Affected Components and Context
- type: dropdown
id: system
attributes:
label: Which Joomla version does this refactoring task relate to?
multiple: true
options:
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Which area of the extension will be impacted by this refactoring?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermon Categories(admin_views)
- Series List(admin_views)
- Series(admin_view)
- Statistics(admin_view)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preachers(site_views)
- Preacher(site_view)
- Series(site_view)
- Series List(site_views)
- Back-end (Just Code)
- Front-end (Just GUI)
- All
- Other
validations:
required: true
- type: textarea
id: expected-outcome
attributes:
label: Expected Outcome
description: What benefits do you anticipate from this refactoring? How will it enhance the codebase or overall system?
placeholder: Explain the expected results of this refactoring.
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Share any further details or information, like code snippets, that could aid in comprehending or executing the refactoring task.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,64 @@
name: Security Issue
about: Identify a possible security risk.
title: "[SECURITY]: "
labels:
- security
body:
- type: markdown
attributes:
value: |
**⚠️ CRITICAL: Avoid sharing any sensitive or confidential details in this message.** Should you suspect a security flaw, please contact us directly at [joomla@vdm.io].
- type: textarea
id: security-general-description
attributes:
label: General Description
description: Offer a broad overview of the security concern, ensuring not to disclose any sensitive information.
placeholder: Provide a general description of the security problem.
validations:
required: true
- type: markdown
attributes:
value: |
# Affected Systems
- type: dropdown
id: joomla_version
attributes:
label: Which Joomla version could potentially be affected?
multiple: true
options:
- Latest
- Joomla 5
- Joomla 4
- Joomla 3
- All
- Other
validations:
required: true
- type: dropdown
id: sermon_distributor_version
attributes:
label: Which Joomla Sermon Distributor version could potentially be affected?
multiple: true
options:
- Latest
- v5.0
- v3.0
- v2.1
- v2.0
- All
- Other
validations:
required: true
- type: textarea
id: non-sensitive-details
attributes:
label: Non-Sensitive Details
description: If applicable, please offer further non-sensitive information or general observations regarding the security concern.
placeholder: Provide any relevant non-sensitive details or observations.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -0,0 +1,127 @@
name: Test Issue
about: Recommend additional assessments or identify any problems with current tests.
title: "[TEST]: "
labels:
- test
body:
- type: markdown
attributes:
value: |
Thank you for your involvement in the testing phase of our initiative! Thorough testing is essential to uphold the integrity and dependability of our systems. Please provide detailed information to aid us in comprehending the testing activity or problem you're proposing or highlighting.
- type: textarea
id: testing-details
attributes:
label: Testing Details
description: Could you specify the testing task or concern? Are you proposing a new test, pointing out a defect in current tests, or identifying untested areas?
placeholder: Please offer an detailed description of the testing task or issue.
validations:
required: true
- type: markdown
attributes:
value: |
# Affected Components and Context
- type: dropdown
id: joomla_version
attributes:
label: Which Joomla version is this testing issue related to?
multiple: true
options:
- Latest
- Joomla 5
- Joomla 4
- Joomla 3
- Other
validations:
required: true
- type: dropdown
id: sermon_distributor_version
attributes:
label: Which Joomla Sermon Distributor version is this testing issue related to?
multiple: true
options:
- Latest
- v5.0
- v3.0
- v2.1
- v2.0
- Other
validations:
required: true
- type: dropdown
id: php_version
attributes:
label: Which PHP version is this testing issue related to?
multiple: true
options:
- Latest
- PHP 8.3
- PHP 8.2
- PHP 8.1
- PHP 8.0
- PHP 7.4
- Other
validations:
required: true
- type: dropdown
id: apache_version
attributes:
label: Which Apache version is this testing issue related to?
multiple: true
options:
- Latest
- Apache 2.4
- Apache 2.2
- Apache 2.0
- Other
validations:
required: true
- type: dropdown
id: area
attributes:
label: Which area of the extension does this testing task impact?
multiple: true
options:
- Dashboard(admin_view)
- Preachers(admin_views)
- Preacher(admin_view)
- Sermons(admin_views)
- Sermon(admin_view)
- Sermons Categories(admin_views)
- Series List(admin_view)
- Series(admin_views)
- Statistics(admin_views)
- External Sources(admin_views)
- External Source(admin_view)
- Manual Updater(admin_view)
- Local Listings(admin_views)
- Help Documents(admin_views)
- Categories(site_views)
- Category(site_view)
- Preacher(site_view)
- Preachers(site_views)
- Series(site_view)
- Series List(site_views)
- Other
validations:
required: true
- type: textarea
id: expected-outcome
attributes:
label: Expected Outcome
description: What do you expect to achieve with this testing task? How will it improve the system or its reliability?
placeholder: Describe the expected outcome of this testing task.
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Provide any additional context, testing scenarios, or information that might help in understanding or implementing the testing task.
validations:
required: false
- type: textarea
id: comments
attributes:
label: Additional Comments
description: Feel free to include any further comments or pertinent details that might assist us.

View File

@ -9,8 +9,8 @@
"name": "PKG_SERMONDISTRIBUTOR",
"code_name": "sermondistributor",
"package_name": "pkg_sermondistributor",
"min_joomla_version": "3.8",
"max_joomla_version": "3.10",
"min_joomla_version": "5.0",
"max_joomla_version": "5.1",
"copyright": "Copyright (C) 2015 Llewellyn van der Merwe. All rights reserved.",
"copyright_year": "2015",
"license": "GNU General Public License version 2; see LICENSE",
@ -20,11 +20,12 @@
"author_url": "https://io.vdm.dev/",
"description": "The Sermon Distributor.",
"version_id": "com_sermondistributor",
"update_servers": "https://git.vdm.dev/christian/Joomla-Sermon-Distributor/raw/branch/master/sermondistributor_update_server.xml"
"update_servers": "https://git.vdm.dev/christian/Joomla-Sermon-Distributor/raw/branch/5.x/sermondistributor_update_server.xml"
},
"repository": {
"owner": "christian",
"repo": "pkg-sermondistributor"
"repo": "pkg-sermondistributor",
"branch": "5.x"
},
"files": [
{
@ -32,19 +33,19 @@
"repo": "Joomla-Sermon-Distributor",
"id": "com_sermondistributor",
"type": "component",
"mode": "master"
"mode": "5.x"
},
{
"owner": "christian",
"repo": "mod_dailylight",
"owner": "getBible",
"repo": "daily-light-module",
"id": "mod_dailylight",
"type": "module",
"client": "site",
"mode": "master"
},
{
"owner": "christian",
"repo": "mod_dailyscripture",
"owner": "getBible",
"repo": "daily-scripture-module",
"id": "mod_dailyscripture",
"type": "module",
"client": "site",
@ -66,4 +67,3 @@
}
]
}

View File

@ -1,11 +1,16 @@
# v5.0.0-beta1
# v5.0.0-beta2
- First release of [[[Component]]] towards Joomla 5
- First release of Sermon Distributor towards Joomla 5
- Add PHP check to install/update class
- Add Database check and fix to install/update class
# v3.0.3
# v4.0.0-beta2
- Removed the not_required field from the sermon model. #36
- First release of Sermon Distributor towards Joomla 4
- Add PHP check to install/update class
- Add Database check and fix to install/update class
# v3.0.2
# v3.0.5
- Add the HTML class to the site default layout.
- Add PHP check to install/update class
- Add Database check and fix to install/update class

View File

@ -24,38 +24,38 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015
+ *Last Build*: 2nd March, 2024
+ *Last Build*: 3rd May, 2024
+ *Version*: 5.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time :hourglass:
**245 Hours** or **31 Eight Hour Days** (actual time the author saved -
**263 Hours** or **33 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **87679**
+ *File count*: **575**
+ *Folder count*: **120**
+ *Line count*: **94142**
+ *File count*: **602**
+ *Folder count*: **124**
**161 Hours** or **20 Eight Hour Days** (the actual time the author spent)
**173 Hours** or **22 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @61hours** = codingtime / 4;
> **planning @35hours** = codingtime / 7;
> **mapping @24hours** = codingtime / 10;
> **office @41hours** = codingtime / 6;)
> **debugging @66hours** = codingtime / 4;
> **planning @38hours** = codingtime / 7;
> **mapping @26hours** = codingtime / 10;
> **office @44hours** = codingtime / 6;)
**406 Hours** or **51 Eight Hour Days**
**436 Hours** or **55 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **10.2 weeks** or **2.1 months**
Project duration: **11 weeks** or **2.3 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -33,6 +33,7 @@ use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\Filesystem\Folder;
use Joomla\Database\DatabaseInterface;
use TrueChristianChurch\Joomla\SermonDistributor\Table\Schema;
// No direct access to this file
defined('_JEXEC') or die;
@ -300,11 +301,17 @@ class Com_SermondistributorInstallerScript implements InstallerScriptInterface
// do any updates needed
if ($type === 'update')
{
// Check that the required configuration are set for PHP
$this->phpConfigurationCheck($this->app);
}
// do any install needed
if ($type === 'install')
{
// Check that the required configuration are set for PHP
$this->phpConfigurationCheck($this->app);
}
return true;
@ -480,6 +487,10 @@ class Com_SermondistributorInstallerScript implements InstallerScriptInterface
);
// Check that the database is up-to date
$this->databaseSchemaCheck($this->app);
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://www.vdm.io/" title="Sermon Distributor">
<img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/>
</a></div>';
@ -743,10 +754,14 @@ class Com_SermondistributorInstallerScript implements InstallerScriptInterface
// Check that the database is up-to date
$this->databaseSchemaCheck($this->app);
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://www.vdm.io/" title="Sermon Distributor">
<img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 5.0.0-beta1 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 5.0.0-beta2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions();
@ -1691,6 +1706,174 @@ class Com_SermondistributorInstallerScript implements InstallerScriptInterface
}
}
/**
* Define the required limits with specific messages for success and warning scenarios
*
* @var array
* @since 3.0.5
*/
protected array $requiredPHPConfigs = [
'upload_max_filesize' => [
'value' => '64M',
'success' => 'The upload_max_filesize is appropriately set to handle large files, which is essential for uploading substantial components and media.',
'warning' => 'The current upload_max_filesize may not support large file uploads effectively, potentially causing failures during component installation.'
],
'post_max_size' => [
'value' => '128M',
'success' => 'The post_max_size setting is sufficient to manage large data submissions, ensuring smooth data processing within forms and uploads.',
'warning' => 'An insufficient post_max_size can lead to truncated data submissions, affecting form functionality and data integrity.'
],
'max_execution_time' => [
'value' => 60,
'success' => 'Max execution time is set high enough to execute complex operations without premature termination, which is crucial for lengthy operations.',
'warning' => 'A low max execution time could lead to script timeouts, especially during intensive operations, which might interrupt execution and cause failures during the compiling of a large extension.'
],
'max_input_vars' => [
'value' => 5000,
'success' => 'The max_input_vars setting supports a high number of input variables, facilitating complex forms and detailed component configurations.',
'warning' => 'Too few max_input_vars may result in lost data during processing complex forms, which can lead to incomplete configurations and operational issues.'
],
'max_input_time' => [
'value' => 60,
'success' => 'Max input time is adequate for processing inputs efficiently during high-load operations, ensuring no premature timeouts.',
'warning' => 'An insufficient max input time could result in incomplete data processing during input-heavy operations, potentially leading to errors and data loss.'
],
'memory_limit' => [
'value' => '256M',
'success' => 'The memory limit is set high to accommodate extensive operations and data processing, which enhances overall performance and stability.',
'warning' => 'A low memory limit can lead to frequent crashes and performance issues, particularly when processing large amounts of data or complex calculations.'
]
];
/**
* Helper function to convert PHP INI memory values to bytes
*
* @param string $value The value to convert
*
* @return int The bytes value
* @since 3.0.5
*/
protected function convertToBytes(string $value): int
{
$value = trim($value);
$lastChar = strtolower($value[strlen($value) - 1]);
$numValue = substr($value, 0, -1);
switch ($lastChar)
{
case 'g':
return $numValue * 1024 * 1024 * 1024;
case 'm':
return $numValue * 1024 * 1024;
case 'k':
return $numValue * 1024;
default:
return (int) $value;
}
}
/**
* Check that the required configurations are set for PHP
*
* @param $app The application
*
* @return void
* @since 3.0.5
*/
protected function phpConfigurationCheck($app): void
{
$showHelp = false;
// Check each configuration and provide detailed feedback
foreach ($this->requiredPHPConfigs as $configName => $configDetails)
{
$currentValue = ini_get($configName);
if ($currentValue === false)
{
$app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error');
continue;
}
$isMemoryValue = strpbrk($configDetails['value'], 'KMG') !== false;
$requiredValueBytes = $isMemoryValue ? $this->convertToBytes($configDetails['value']) : (int) $configDetails['value'];
$currentValueBytes = $isMemoryValue ? $this->convertToBytes($currentValue) : (int) $currentValue;
$conditionMet = $currentValueBytes >= $requiredValueBytes;
$messageType = $conditionMet ? 'message' : 'warning';
$messageText = $conditionMet ?
"Success: {$configName} is set to {$currentValue}. " . $configDetails['success'] :
"Warning: {$configName} configuration should be at least {$configDetails['value']} but is currently {$currentValue}. " . $configDetails['warning'];
$showHelp = ($showHelp || $messageType === 'warning') ? true : false;
$app->enqueueMessage($messageText, $messageType);
}
if ($showHelp)
{
$app->enqueueMessage('To optimize your Sermon Distributor environment, specific PHP settings must be enhanced.<br>These settings are crucial for ensuring the successful installation and stable functionality of the extension.<br>We\'ve identified that certain configurations currently do not meet the recommended standards.<br>To adjust these settings and prevent potential issues, please consult our detailed guide available at <a href="https://git.vdm.dev/christian/Joomla-Sermon-Distributor/wiki/PHP-Settings" target="_blank">Sermon Distributor PHP Settings Wiki</a>.
', 'notice');
}
}
/**
* Make sure that the sermondistributor database schema is up to date.
*
* @return void
* @since 3.0.5
*/
protected function databaseSchemaCheck($app): void
{
// try to load the schema class
try
{
// make sure the class is loaded
$this->ensureClassExists(
Schema::class
);
// instantiate the schema class and check/update the database
$messages = (new Schema())->update();
}
catch (\Exception $e)
{
$app->enqueueMessage($e->getMessage(), 'warning');
return;
}
foreach ($messages as $message)
{
$app->enqueueMessage($message, 'message');
}
}
/**
* Ensures that a class in the namespace is available.
* If the class is not already loaded, it attempts to load it via the power autoloader.
*
* @param mixed $nameClass The name::class we are looking for.
*
* @return void
* @since 3.0.5
* @throws \Exception If the class could not be loaded.
*/
protected function ensureClassExists($nameClass): void
{
if (!class_exists($nameClass, true))
{
// The power autoloader for this project admin area.
$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/src/Helper/PowerloaderHelper.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
// Check again if the class now exists after requiring it
if (!class_exists($nameClass, true))
{
throw new \Exception("We failed to find/load the $nameClass");
}
}
}
/**
* Method to move folders into place.
*

View File

@ -24,38 +24,38 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015
+ *Last Build*: 2nd March, 2024
+ *Last Build*: 3rd May, 2024
+ *Version*: 5.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time :hourglass:
**245 Hours** or **31 Eight Hour Days** (actual time the author saved -
**263 Hours** or **33 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **87679**
+ *File count*: **575**
+ *Folder count*: **120**
+ *Line count*: **94142**
+ *File count*: **602**
+ *Folder count*: **124**
**161 Hours** or **20 Eight Hour Days** (the actual time the author spent)
**173 Hours** or **22 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @61hours** = codingtime / 4;
> **planning @35hours** = codingtime / 7;
> **mapping @24hours** = codingtime / 10;
> **office @41hours** = codingtime / 6;)
> **debugging @66hours** = codingtime / 4;
> **planning @38hours** = codingtime / 7;
> **mapping @26hours** = codingtime / 10;
> **office @44hours** = codingtime / 6;)
**406 Hours** or **51 Eight Hour Days**
**436 Hours** or **55 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **10.2 weeks** or **2.1 months**
Project duration: **11 weeks** or **2.3 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -174,6 +174,7 @@
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL"
description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default=""
required="true"
@ -186,6 +187,7 @@
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL"
description="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
button="false"
@ -221,6 +223,7 @@
name="article"
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ARTICLE_LABEL"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="0"
required="true"

View File

@ -26,8 +26,8 @@ use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// No direct access to this file
defined('_JEXEC') or die;

View File

@ -26,8 +26,8 @@ use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// No direct access to this file
defined('_JEXEC') or die;

View File

@ -26,8 +26,8 @@ use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// No direct access to this file
defined('_JEXEC') or die;

View File

@ -22,51 +22,12 @@
/----------------------------------------------------------------------------------------------------------------------------------*/
// register additional namespace
\spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});
// The power autoloader for this project (JPATH_ADMINISTRATOR) area.
$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/src/Helper/PowerloaderHelper.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
// (soon) use Joomla\CMS\Association\AssociationExtensionInterface;
use Joomla\CMS\Categories\CategoryFactoryInterface;

View File

@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_preacher` (
`icon` CHAR(64) NOT NULL DEFAULT '',
`name` VARCHAR(255) NOT NULL DEFAULT '',
`website` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -55,7 +55,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_sermon` (
`source` TINYINT(1) NOT NULL DEFAULT 0,
`tags` CHAR(11) NOT NULL DEFAULT 0,
`url` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -93,7 +93,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_series` (
`icon` CHAR(64) NOT NULL DEFAULT '',
`name` VARCHAR(255) NOT NULL DEFAULT '',
`scripture` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -126,7 +126,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_statistic` (
`preacher` INT(11) NOT NULL DEFAULT 0,
`series` INT(11) NOT NULL DEFAULT 0,
`sermon` INT(11) NOT NULL DEFAULT 0,
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -168,7 +168,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_external_source` (
`sharedurl` TEXT NOT NULL,
`update_method` TINYINT NOT NULL DEFAULT 0,
`update_timer` INT(1) NOT NULL DEFAULT 0,
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -201,7 +201,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_local_listing` (
`name` VARCHAR(255) NOT NULL DEFAULT '',
`size` INT(50) NOT NULL DEFAULT 0,
`url` TEXT NOT NULL,
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
@ -236,7 +236,7 @@ CREATE TABLE IF NOT EXISTS `#__sermondistributor_help_document` (
`title` CHAR(64) NOT NULL DEFAULT '',
`type` TINYINT(1) NOT NULL DEFAULT 0,
`url` VARCHAR(255) NOT NULL DEFAULT '',
`params` text NULL,
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,

View File

@ -1 +0,0 @@

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -30,8 +30,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -29,7 +29,7 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Component\ComponentHelper;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -55,23 +55,24 @@ class ArticlesField extends ListField
*/
protected function getOptions()
{
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
$query->from($db->quoteName('#__content', 'a'));
$query->where($db->quoteName('a.state') . ' = 1');
$query->order('a.title ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = Html::_('select.option', '', 'Select an Article');
foreach($items as $item)
{
$options[] = Html::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
}
}
return $options;
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
$query->from($db->quoteName('#__content', 'a'));
$query->where($db->quoteName('a.state') . ' = 1');
$query->order('a.title ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = Html::_('select.option', '', 'Select an Article');
foreach($items as $item)
{
$options[] = Html::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
}
}
return $options;
}
}

View File

@ -109,7 +109,7 @@ class ExternalsourceField extends ListField
if ($user->authorise('external_source.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -109,7 +109,7 @@ class PreachersField extends ListField
if ($user->authorise('preacher.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -109,7 +109,7 @@ class SeriesField extends ListField
if ($user->authorise('series.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -109,7 +109,7 @@ class SermonField extends ListField
if ($user->authorise('sermon.edit', 'com_sermondistributor') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@ -29,7 +29,7 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Component\ComponentHelper;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -0,0 +1,70 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 5.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage PowerloaderHelper.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die;
// register additional namespace
spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/vendor_sermondistributor/TrueChristianChurch.Joomla.FOF' => 'TrueChristianChurch\\Joomla\\FOF',
'libraries/vendor_sermondistributor/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});

View File

@ -23,51 +23,12 @@
/----------------------------------------------------------------------------------------------------------------------------------*/
namespace TrueChristianChurch\Component\Sermondistributor\Administrator\Helper;
// register additional namespace
\spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});
// The power autoloader for this project (JPATH_ADMINISTRATOR) area.
$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_sermondistributor/src/Helper/PowerloaderHelper.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
@ -90,15 +51,15 @@ use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use Joomla\CMS\Filesystem\Folder;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\MimeHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\FormHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\FileHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\MimeHelper;
use TrueChristianChurch\Joomla\Utilities\GetHelper;
use TrueChristianChurch\Joomla\Utilities\FormHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -40,12 +40,12 @@ use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GetHelper;
use TrueChristianChurch\Joomla\Utilities\FileHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\GetHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -282,11 +282,11 @@ class AjaxModel extends ListModel
$result['error'] = '<span style="color: red;">' . Text::sprintf('COM_SERMONDISTRIBUTOR_NO_CRONJOB_PATH_FOUND_FOR_S', $type) . '</span>';
if ($this->hasCurl())
{
$path = '*/15 * * * * curl -s "' .JURI::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
$path = '*/15 * * * * curl -s "' .Uri::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
}
else
{
$path = '*/15 * * * * wget "' .JURI::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
$path = '*/15 * * * * wget "' .Uri::root() . 'index.php?option=com_sermondistributor&task=api.externalUpdate" >/dev/null 2>&1';
}
$result['path'] = '<code>' . $path . '</code>';
}

View File

@ -42,10 +42,10 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\FileHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -36,10 +36,10 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -42,8 +42,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -36,10 +36,10 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -35,7 +35,7 @@ use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -42,9 +42,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -36,10 +36,10 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -35,9 +35,9 @@ use Joomla\CMS\User\User;
use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\JsonHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -42,9 +42,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -36,9 +36,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -42,9 +42,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -36,9 +36,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -42,9 +42,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -38,8 +38,8 @@ use Joomla\CMS\User\User;
use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -51,6 +51,27 @@ use VDM\Joomla\Utilities\StringHelper;
*/
class SermondistributorModel extends ListModel
{
/**
* The styles array.
*
* @var array
* @since 4.3
*/
protected array $styles = [
'administrator/components/com_sermondistributor/assets/css/admin.css',
'administrator/components/com_sermondistributor/assets/css/dashboard.css'
];
/**
* The scripts array.
*
* @var array
* @since 4.3
*/
protected array $scripts = [
'administrator/components/com_sermondistributor/assets/js/admin.js'
];
public function getIcons()
{
// load user for access menus
@ -292,6 +313,50 @@ class SermondistributorModel extends ListModel
return $icons;
}
/**
* Method to get the styles that have to be included on the view
*
* @return array styles files
* @since 4.3
*/
public function getStyles(): array
{
return $this->styles;
}
/**
* Method to set the styles that have to be included on the view
*
* @return void
* @since 4.3
*/
public function setStyles(string $path): void
{
$this->styles[] = $path;
}
/**
* Method to get the script that have to be included on the view
*
* @return array script files
* @since 4.3
*/
public function getScripts(): array
{
return $this->scripts;
}
/**
* Method to set the script that have to be included on the view
*
* @return void
* @since 4.3
*/
public function setScript(string $path): void
{
$this->scripts[] = $path;
}
public function getWiki()
{

View File

@ -36,9 +36,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -42,8 +42,8 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -36,9 +36,9 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ObjectHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -235,6 +236,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_NEW' : 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EDIT'));
// add styles

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES'));
// add styles
foreach ($this->styles as $style)

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -225,6 +226,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_NEW' : 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_EDIT'));
// add styles

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS'));
// add styles
foreach ($this->styles as $style)

View File

@ -28,7 +28,7 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -225,6 +226,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NEW' : 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EDIT'));
// add styles

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS'));
// add styles
foreach ($this->styles as $style)

View File

@ -34,7 +34,7 @@ use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\HeaderCheck;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -228,6 +229,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_PREACHER_NEW' : 'COM_SERMONDISTRIBUTOR_PREACHER_EDIT'));
// add styles

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_PREACHERS'));
// add styles
foreach ($this->styles as $style)

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -228,6 +229,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_SERIES_NEW' : 'COM_SERMONDISTRIBUTOR_SERIES_EDIT'));
// add styles

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_SERIES_LIST'));
// add styles
foreach ($this->styles as $style)

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -228,6 +229,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_SERMON_NEW' : 'COM_SERMONDISTRIBUTOR_SERMON_EDIT'));
// add styles

View File

@ -30,7 +30,7 @@ use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -50,6 +50,8 @@ class HtmlView extends BaseHtmlView
{
// Assign data to the view
$this->icons = $this->get('Icons');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->contributors = SermondistributorHelper::getContributors();
// get the manifest details of the component
@ -108,11 +110,17 @@ class HtmlView extends BaseHtmlView
{
// set page title
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_DASHBOARD'));
// add manifest to page JavaScript
$this->getDocument()->addScriptDeclaration("var manifest = JSON.parse('" . json_encode($this->manifest) . "');", "text/javascript");
// add dashboard style sheets
Html::_('stylesheet', "administrator/components/com_sermondistributor/assets/css/dashboard.css", ['version' => 'auto']);
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_SERMONS'));
// add styles
foreach ($this->styles as $style)

View File

@ -37,7 +37,7 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -61,6 +61,7 @@ class HtmlView extends BaseHtmlView
{
// set params
$this->params = ComponentHelper::getParams('com_sermondistributor');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -225,6 +226,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_SERMONDISTRIBUTOR_STATISTIC_NEW' : 'COM_SERMONDISTRIBUTOR_STATISTIC_EDIT'));
// add styles

View File

@ -37,8 +37,8 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@ -177,6 +177,8 @@ class HtmlView extends BaseHtmlView
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_SERMONDISTRIBUTOR_STATISTICS'));
// add styles
foreach ($this->styles as $style)

View File

@ -25,8 +25,8 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
// No direct access to this file
defined('_JEXEC') or die;

View File

@ -28,8 +28,9 @@ use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use TrueChristianChurch\Component\Sermondistributor\Administrator\Helper\SermondistributorHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\StringHelper;
use Joomla\CMS\Session\Session;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
@ -130,7 +131,7 @@ jQuery(document).ready(function($) {
</div>
<script>
// token
var token = '<?php echo JSession::getFormToken(); ?>';
var token = '<?php echo Session::getFormToken(); ?>';
// nice little dot trick :)
jQuery(document).ready( function($) {
var x=0;

View File

@ -23,7 +23,7 @@
/----------------------------------------------------------------------------------------------------------------------------------*/
use Joomla\CMS\Language\Text;
use VDM\Joomla\Utilities\ArrayHelper;
use TrueChristianChurch\Joomla\Utilities\ArrayHelper;
// No direct access to this file
defined('_JEXEC') or die;

View File

@ -13,13 +13,13 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt;
namespace TrueChristianChurch\Joomla\FOF\Encrypt;
use VDM\Joomla\FOF\Encrypt\AES\AesInterface;
use VDM\Joomla\FOF\Encrypt\AES\Mcrypt;
use VDM\Joomla\FOF\Encrypt\AES\Openssl;
use VDM\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\AesInterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Mcrypt;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Openssl;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
/**

View File

@ -13,7 +13,7 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
/**

View File

@ -13,10 +13,10 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
/**

View File

@ -13,13 +13,13 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\FOF\Encrypt\Randval;
use VDM\Joomla\FOF\Utils\Phpfunc;
use VDM\Joomla\FOF\Encrypt\AES\AesInterface;
use VDM\Joomla\FOF\Encrypt\AES\Abstraction;
use TrueChristianChurch\Joomla\FOF\Encrypt\Randval;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\AesInterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Abstraction;
/**

View File

@ -13,13 +13,13 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt\AES;
namespace TrueChristianChurch\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\FOF\Encrypt\Randval;
use VDM\Joomla\FOF\Utils\Phpfunc;
use VDM\Joomla\FOF\Encrypt\AES\AesInterface;
use VDM\Joomla\FOF\Encrypt\AES\Abstraction;
use TrueChristianChurch\Joomla\FOF\Encrypt\Randval;
use TrueChristianChurch\Joomla\FOF\Utils\Phpfunc;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\AesInterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\AES\Abstraction;
/**

View File

@ -13,10 +13,10 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt;
namespace TrueChristianChurch\Joomla\FOF\Encrypt;
use VDM\Joomla\FOF\Encrypt\Randvalinterface;
use TrueChristianChurch\Joomla\FOF\Encrypt\Randvalinterface;
/**

View File

@ -13,7 +13,7 @@
* - Use phpseclib/phpseclib version 3 Instead.
* - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>
*/
namespace VDM\Joomla\FOF\Encrypt;
namespace TrueChristianChurch\Joomla\FOF\Encrypt;
/**

View File

@ -7,7 +7,7 @@
* @note This file has been modified by the Joomla! Project (and VDM) and no longer reflects the original work of its author.
* @depreciation This was ported for the sake of those who have stuff encrypted with the FOF encryption suite.
*/
namespace VDM\Joomla\FOF\Utils;
namespace TrueChristianChurch\Joomla\FOF\Utils;
/**

View File

@ -0,0 +1,65 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 5.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage Schema.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
namespace TrueChristianChurch\Joomla\SermonDistributor\Table;
use TrueChristianChurch\Joomla\SermonDistributor\Table;
use TrueChristianChurch\Joomla\Interfaces\SchemaInterface;
use TrueChristianChurch\Joomla\Abstraction\Schema as ExtendingSchema;
/**
* SermonDistributor Tables Schema
*
* @since 3.0.8
*/
final class Schema extends ExtendingSchema implements SchemaInterface
{
/**
* Constructor.
*
* @param Table $table The Table Class.
*
* @since 3.0.8
*/
public function __construct(?Table $table = null)
{
$table ??= new Table;
parent::__construct($table);
}
/**
* Get the targeted component code
*
* @return string
* @since 3.0.8
*/
protected function getCode(): string
{
return 'sermondistributor';
}
}

View File

@ -0,0 +1,502 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Abstraction;
use TrueChristianChurch\Joomla\Interfaces\Tableinterface;
/**
* Base Table
*
* @since 3.2.0
*/
abstract class BaseTable implements Tableinterface
{
/**
* All areas/views/tables with their field details
*
* @var array
* @since 3.2.0
**/
protected array $tables;
/**
* All default fields
*
* @var array
* @since 3.2.1
**/
protected array $defaults = [
'id' => [
'order' => -1,
'name' => 'id',
'label' => 'ID',
'type' => 'text',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(11)',
'default' => 'EMPTY',
'auto_increment' => true,
'primary_key' => true,
'null_switch' => 'NOT NULL'
]
],
'asset_id' => [
'name' => 'asset_id',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'comment' => 'FK to the #__assets table.'
]
],
'ordering' => [
'name' => 'ordering',
'label' => 'Ordering',
'type' => 'number',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(11)',
'default' => '0',
'null_switch' => 'NOT NULL'
]
],
'published' => [
'name' => 'published',
'label' => 'Status',
'type' => 'list',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'TINYINT(3)',
'default' => '1',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'state'
]
],
'modified_by' => [
'name' => 'modified_by',
'label' => 'Modified by',
'type' => 'user',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'modifiedby'
]
],
'modified' => [
'name' => 'modified',
'label' => 'Modified',
'type' => 'calendar',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
]
],
'created_by' => [
'name' => 'created_by',
'label' => 'Created by',
'type' => 'user',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'createdby'
]
],
'created' => [
'name' => 'created',
'label' => 'Created',
'type' => 'calendar',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
]
],
'checked_out' => [
'name' => 'checked_out',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL',
'key' => true,
'key_name' => 'checkout'
]
],
'checked_out_time' => [
'name' => 'checked_out_time',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'DATETIME',
'default' => '0000-00-00 00:00:00',
'null_switch' => 'NOT NULL'
]
],
'hits' => [
'name' => 'hits',
'label' => 'Hits',
'type' => 'number',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '0',
'null_switch' => 'NOT NULL'
]
],
'version' => [
'name' => 'version',
'label' => 'Version',
'type' => 'text',
'title' => false,
'list' => NULL,
'store' => NULL,
'tab_name' => NULL,
'db' => [
'type' => 'INT(10) unsigned',
'default' => '1',
'null_switch' => 'NOT NULL'
]
],
'params' => [
'name' => 'params',
'label' => NULL,
'type' => NULL,
'title' => false,
'list' => NULL,
'store' => 'json',
'tab_name' => NULL,
'db' => [
'type' => 'TEXT',
'default' => 'EMPTY',
'null_switch' => 'NULL'
]
]
];
/**
* Get any value from a item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name', 'value_key');
* Get an item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name');
* Get all items/fields/columns of an area/view/table
* Example: $this->get('table_name');
* Get all areas/views/tables with all their item/field/column details
* Example: $this->get('All');
* Example: $this->get();
*
* @param string|null $table The table
* @param string|null $field The field
* @param string|null $key The value key
*
* @return mixed
* @since 3.2.1
*/
public function get(?string $table = null, ?string $field = null, ?string $key = null)
{
// Return specific value
if ($table && $field && $key)
{
return $this->tables[$table][$field][$key] ?? $this->getDefaultKey($field, $key);
}
// Return field within table
if ($table && $field)
{
return $this->tables[$table][$field] ?? $this->getDefault($field);
}
// Return all fields in a table or all tables if 'All' is passed
if ($table)
{
if (strtoupper($table) === 'ALL')
{
return $this->tables;
}
return $this->tables[$table] ?? null;
}
// Return all tables
return $this->tables;
}
/**
* Get title field from an area/view/table
*
* @param string $table The area
*
* @return ?array
* @since 3.2.0
*/
public function title(string $table): ?array
{
// return the title item/field/column of an area/view/table
if (($table = $this->get($table)) !== null)
{
foreach ($table as $item)
{
if ($item['title'])
{
return $item;
}
}
}
// none found
return null;
}
/**
* Get title field name
*
* @param string $table The area
*
* @return string
* @since 3.2.0
*/
public function titleName(string $table): string
{
// return the title name of an area/view/table
if (($field = $this->title($table)) !== null)
{
return $field['name'];
}
// none found default to ID
return 'id';
}
/**
* Get all tables
*
* @return array
* @since 3.2.0
*/
public function tables(): array
{
// return all areas/views/tables
return array_keys($this->tables);
}
/**
* Check if a table (and field) exist
*
* @param string $table The area
* @param string|null $field The area
*
* @return bool
* @since 3.2.0
*/
public function exist(string $table, ?string $field = null): bool
{
if (isset($this->tables[$table]))
{
// if we have a field
if (is_string($field))
{
if (isset($this->tables[$table][$field]))
{
return true;
}
}
else
{
return true;
}
}
return $this->isDefault($field);
}
/**
* Get all fields of an area/view/table
*
* @param string $table The area
* @param bool $default Add the default fields
* @param bool $details Add/Leave fields the details
*
* @return array|null On success an array of fields
* @since 3.2.0
*/
public function fields(string $table, bool $default = false, bool $details = false): ?array
{
// Retrieve fields from the specified table
$fields = $this->get($table);
if ($fields === null)
{
return null;
}
// Determine the fields output based on the $default and $details flags
if ($details)
{
return $default ? $this->addDefaultDetails($fields) : $fields;
}
$fieldKeys = array_keys($fields);
return $default ? $this->addDefault($fieldKeys) : $fieldKeys;
}
/**
* Add the default fields
*
* @param array $fields The table dynamic fields
*
* @return array Fields (with defaults added)
* @since 3.2.0
*/
protected function addDefault(array $fields): array
{
// add default fields
foreach ($this->defaults as $default)
{
if (in_array($default['name'], $fields))
{
continue;
}
// used just for loading the fields
$order = $default['order'] ?? 1;
unset($default['order']);
if ($order < 0)
{
array_unshift($fields, $default['name']);
}
else
{
$fields[] = $default['name'];
}
}
return $fields;
}
/**
* Add the default fields
*
* @param array $fields The table dynamic fields
*
* @return array Fields (with defaults details added)
* @since 3.2.0
*/
protected function addDefaultDetails(array $fields): array
{
// add default fields
foreach ($this->defaults as $default)
{
// remove ordering for now
unset($default['order']);
if (!isset($fields[$default['name']]))
{
$fields[$default['name']] = $default;
}
}
return $fields;
}
/**
* Check if the field is a default field
*
* @param string $field The field to check
*
* @return bool True if a default field
* @since 3.2.0
*/
protected function isDefault(string $field): bool
{
return isset($this->defaults[$field]);
}
/**
* Get a default field
*
* @param string $field The field to check
*
* @return array|null True if a default field
* @since 3.2.0
*/
protected function getDefault(string $field): ?array
{
return $this->defaults[$field] ?? null;
}
/**
* Get a default field property
*
* @param string $field The field to check
* @param string $key The field key/property to check
*
* @return mixed String value if a default field property exist
* @since 3.2.0
*/
protected function getDefaultKey(string $field, string $key)
{
return $this->defaults[$field][$key] ?? null;
}
}

View File

@ -0,0 +1,754 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Abstraction;
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use TrueChristianChurch\Joomla\Interfaces\Tableinterface as Table;
use TrueChristianChurch\Joomla\Interfaces\SchemaInterface;
/**
* Schema Checking
*
* @since 3.2.1
*/
abstract class Schema implements SchemaInterface
{
/**
* The Table Class.
*
* @var Table
* @since 3.2.1
*/
protected Table $table;
/**
* The Database Class
*
* @since 3.2.1
*/
protected $db;
/**
* The local tables
*
* @var array
* @since 3.2.1
*/
private array $tables;
/**
* The component table prefix
*
* @var string
* @since 3.2.1
*/
private string $prefix;
/**
* The field unique keys
*
* @var array
* @since 3.2.1
*/
private array $uniqueKeys;
/**
* The field keys
*
* @var array
* @since 3.2.1
*/
private array $keys;
/**
* The current table columns
*
* @var array
* @since 3.2.1
*/
private array $columns;
/**
* The success messages of the action
*
* @var array
* @since 3.2.1
*/
private array $success;
/**
* Current Joomla Version We are IN
*
* @var int
* @since 3.2.1
**/
protected $currentVersion;
/**
* Constructor.
*
* @param Table $table The Table Class.
*
* @since 3.2.1
* @throws \Exception If the database fails
*/
public function __construct(Table $table)
{
$this->table = $table;
try {
// set the database object
$this->db = Factory::getDbo();
// get current component tables
$this->tables = $this->db->getTableList();
// set the component table
$this->prefix = $this->db->getPrefix() . $this->getCode();
// set the current version
$this->currentVersion = Version::MAJOR_VERSION;
} catch (\Exception $e) {
throw new \Exception("Error: failed to initialize schema class due to a database error.");
}
}
/**
* Check and update database schema for missing fields or tables.
*
* @return array The array of successful updates/actions, if empty no update/action was taken.
* @since 3.2.1
* @throws \Exception If there is an error during the update process.
*/
public function update(): array
{
try {
$this->success = [
"Success: scan of the component tables started."
];
foreach ($this->table->tables() as $table)
{
$this->uniqueKeys = [];
$this->keys = [];
if ($this->tableExists($table))
{
$this->updateSchema($table);
}
else
{
$this->createTable($table);
}
}
} catch (\Exception $e) {
throw new \Exception("Error: updating database schema. " . $e->getMessage());
}
if (count($this->success) == 1)
{
$this->success[] = "Success: scan of the component tables completed with no update needed.";
}
else
{
$this->success[] = "Success: scan of the component tables completed.";
}
return $this->success;
}
/**
* Get the targeted component code
*
* @return string
* @since 3.2.1
*/
abstract protected function getCode(): string;
/**
* Check if a table exists in the database.
*
* @param string $table The name of the table to check.
*
* @return bool True if table exists, False otherwise.
* @since 3.2.1
*/
protected function tableExists(string $table): bool
{
return in_array($this->getTable($table), $this->tables);
}
/**
* Update the schema of an existing table.
*
* @param string $table The table to update.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error while updating the schema.
*/
public function updateSchema(string $table): void
{
try {
$existingColumns = $this->getExistingColumns($table);
$expectedColumns = $this->table->fields($table, true);
$missingColumns = array_diff($expectedColumns, $existingColumns);
if (!empty($missingColumns))
{
$this->addMissingColumns($table, $missingColumns);
}
$this->checkColumnsDataType($table, $expectedColumns);
} catch (\Exception $e) {
throw new \Exception("Error: updating schema for $table table. " . $e->getMessage());
}
if (!empty($missingColumns))
{
$column_s = (count($missingColumns) == 1) ? 'column' : 'columns';
$missingColumns = implode(', ', $missingColumns);
$this->success[] = "Success: added missing ($missingColumns) $column_s to $table table.";
}
}
/**
* Create a table with all necessary fields.
*
* @param string $table The name of the table to create.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error creating the table.
*/
public function createTable(string $table): void
{
try {
$columns = [];
$fields = $this->table->fields($table, true);
$createTable = 'CREATE TABLE IF NOT EXISTS ' . $this->db->quoteName($this->getTable($table));
foreach ($fields as $field)
{
if (($def = $this->getColumnDefinition($table, $field)) !== null)
{
$columns[] = $def;
}
}
$columnDefinitions = implode(', ', $columns);
$keys = $this->getTableKeys();
$createTableSql = "$createTable ($columnDefinitions, $keys)";
$this->db->setQuery($createTableSql);
$this->db->execute();
} catch (\Exception $e) {
throw new \Exception("Error: failed to create missing $table table. " . $e->getMessage());
}
$this->success[] = "Success: created missing $table table.";
}
/**
* Fetch existing columns from a database table.
*
* @param string $table The name of the table.
*
* @return array An array of column names.
* @since 3.2.1
*/
protected function getExistingColumns(string $table): array
{
$this->columns = $this->db->getTableColumns($this->getTable($table), false);
return array_keys($this->columns);
}
/**
* Add missing columns to a table.
*
* @param string $table The table to update.
* @param array $columns List of missing columns/fields.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error adding columns.
*/
protected function addMissingColumns(string $table, array $columns): void
{
try {
$query = $this->db->getQuery(true);
$alterTable = 'ALTER TABLE ' . $this->db->quoteName($this->getTable($table)) . ' ';
// Start an ALTER TABLE query
$alterQueries = [];
foreach ($columns as $column)
{
if (($def = $this->getColumnDefinition($table, $column)) !== null)
{
$alterQueries[] = " ADD " . $def;
}
}
$this->db->setQuery($alterTable . implode(', ', $alterQueries));
$this->db->execute();
} catch (\Exception $e) {
$column_s = (count($columns) == 1) ? 'column' : 'columns';
$columns = implode(', ', $columns);
throw new \Exception("Error: failed to add ($columns) $column_s to $table table. " . $e->getMessage());
}
}
/**
* Validate and update the data type of existing fields/columns
*
* @param string $table The table to update.
* @param array $columns List of columns/fields to check.
*
* @return void
* @since 3.2.1
*/
protected function checkColumnsDataType(string $table, array $columns): void
{
$requireUpdate = [];
foreach ($columns as $column)
{
$current = $this->columns[$column] ?? null;
if ($current === null || ($expected = $this->table->get($table, $column, 'db')) === null)
{
continue;
}
// check if the data type and size match
if ($this->isDataTypeChangeSignificant($current->Type, $expected['type']))
{
$requireUpdate[$column] = [
'column' => $column,
'current' => $current->Type,
'expected' => $expected['type']
];
}
// check if update of default values is needed
if ($this->checkDefault($table, $column) && !isset($requireUpdate[$column]))
{
$requireUpdate[$column] = [
'column' => $column,
'current' => $current->Type,
'expected' => $expected['type']
];
}
}
if (!empty($requireUpdate))
{
$this->updateColumnsDataType($table, $requireUpdate);
}
}
/**
* Generates a SQL snippet for defining a table column, incorporating column type,
* default value, nullability, and auto-increment properties.
*
* @param string $table The table name to be used.
* @param string $field The field name in the table to generate SQL for.
*
* @return string|null The SQL snippet for the column definition.
* @since 3.2.1
* @throws \Exception If the schema details cannot be retrieved or the SQL statement cannot be constructed properly.
*/
protected function getColumnDefinition(string $table, string $field): ?string
{
try {
// Retrieve the database schema details for the specified table and field
if (($db = $this->table->get($table, $field, 'db')) === null)
{
return null;
}
// Prepare the column name
$column_name = $this->db->quoteName($field);
$db['name'] = $field;
// Prepare the type and default value SQL statement
$type = $db['type'] ?? 'TEXT';
$db_default = isset($db['default']) ? $db['default'] : null;
$default = $this->getDefaultValue($type, $db_default);
// Prepare the null switch, and auto increment statement
$null_switch = !empty($db['null_switch']) ? " " . $db['null_switch'] : '';
$auto_increment = !empty($db['auto_increment']) ? " AUTO_INCREMENT" : '';
$this->setKeys($db);
// Assemble the SQL snippet for the column definition
return "{$column_name} {$type}{$null_switch}{$default}{$auto_increment}";
} catch (\Exception $e) {
throw new \Exception("Error: failed to generate column definition for ($table.$field). " . $e->getMessage());
}
}
/**
* Check and Update the default values if needed, including existing data adjustments
*
* @param string $table The table to update.
* @param string $column The column/field to check.
*
* @return bool
* @since 3.2.1
*/
protected function checkDefault(string $table, string $column): bool
{
// Retrieve the expected column configuration
$expected = $this->table->get($table, $column, 'db');
// Skip updates if the column is auto_increment
if (isset($expected['auto_increment']) && $expected['auto_increment'] === true)
{
return false;
}
// Retrieve the current column configuration
$current = $this->columns[$column];
// Determine the new default value based on the expected settings
$type = $expected['type'] ?? 'TEXT';
$db_default = isset($expected['default']) ? $expected['default'] : null;
$newDefault = $this->getDefaultValue($type, $db_default, true);
// First, adjust existing rows to conform to the new default if necessary
if (is_numeric($newDefault) && $this->adjustExistingDefaults($table, $column, $current->Default, $newDefault))
{
$this->success[] = "Success: updated the ($column) defaults in $table table.";
return true;
}
if (is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' &&
is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false)
{
return true; // little fix
}
return false;
}
/**
* Update the data type of the given fields.
*
* @param string $table The table to update.
* @param array $columns List of columns/fields that must be updated.
*
* @return void
* @since 3.2.1
*/
protected function updateColumnsDataType(string $table, array $columns): void
{
$alterTable = 'ALTER TABLE ' . $this->db->quoteName($this->getTable($table));
foreach ($columns as $column => $types)
{
if (($def = $this->getColumnDefinition($table, $column)) === null)
{
continue;
}
$dbField = $this->db->quoteName($column);
$alterQuery = "$alterTable CHANGE $dbField ". $def;
if ($this->updateColumnDataType($alterQuery, $table, $column))
{
$current = $types['current'] ?? 'error';
$expected = $types['expected'] ?? 'error';
$this->success[] = "Success: updated ($column) column datatype $current to $expected in $table table.";
}
}
}
/**
* Add the component name to get the full table name.
*
* @param string $table The table name.
*
* @return void
* @since 3.2.1
*/
protected function getTable(string $table): string
{
return $this->prefix . '_' . $table;
}
/**
* Determines if the change in data type between two definitions is significant.
*
* This function checks if there's a significant difference between the current
* data type and the expected data type that would require updating the database schema.
* It ignores display width for numeric types where MySQL considers these attributes
* irrelevant for storage but considers size and other modifiers for types like VARCHAR.
*
* @param string $currentType The current data type from the database schema.
* @param string $expectedType The expected data type to validate against.
*
* @return bool Returns true if the data type change is significant, otherwise false.
* @since 3.2.1
*/
protected function isDataTypeChangeSignificant(string $currentType, string $expectedType): bool
{
// Normalize both input types to lowercase for case-insensitive comparison
$currentType = strtolower($currentType);
$expectedType = strtolower($expectedType);
// Regex to extract the base data type and numeric parameters with named groups
$typePattern = '/^(?<datatype>\w+)(\((?<params>\d+(,\d+)?)\))?/';
// Match types and parameters
preg_match($typePattern, $currentType, $currentMatches);
preg_match($typePattern, $expectedType, $expectedMatches);
// Compare base types
if ($currentMatches['datatype'] !== $expectedMatches['datatype'])
{
return true; // Base types differ
}
// Define types where size and other modifiers are irrelevant
$sizeIrrelevantTypes = [
'int', 'tinyint', 'smallint', 'mediumint', 'bigint',
'float', 'double', 'decimal', 'numeric' // Numeric types where display width is irrelevant
];
// If the type is not in the size irrelevant list, compare full definitions
if (!in_array($currentMatches['datatype'], $sizeIrrelevantTypes))
{
return $currentType !== $expectedType; // Use full definition for types where size matters
}
// For size irrelevant types, only compare base type, ignoring size and unsigned
$currentBaseType = preg_replace('/\(\d+(,\d+)?\)|unsigned/', '', $currentType);
$expectedBaseType = preg_replace('/\(\d+(,\d+)?\)|unsigned/', '', $expectedType);
// Perform a final comparison for numeric types ignoring size
return $currentBaseType !== $expectedBaseType;
}
/**
* Updates existing rows in a column to a new default value
*
* @param string $table The table to update.
* @param string $column The column to update.
* @param mixed $currentDefault Current default value.
* @param mixed $newDefault The new default value to be set.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error updating column defaults.
*/
protected function adjustExistingDefaults(string $table, string $column, $currentDefault, $newDefault): bool
{
// Determine if adjustment is needed based on new and current defaults
if ($newDefault !== $currentDefault)
{
try {
// Format the new default for SQL use
$sqlDefault = $this->db->quote($newDefault);
$updateTable = 'UPDATE ' . $this->db->quoteName($this->getTable($table));
$dbField = $this->db->quoteName($column);
// Update SQL to set new default on existing rows where the default is currently the old default
$sql = $updateTable . " SET $dbField = $sqlDefault WHERE $dbField IS NULL OR $dbField = ''";
// Execute the update
$this->db->setQuery($sql);
return $this->db->execute();
} catch (\Exception $e) {
throw new \Exception("Error: failed to update ($column) column defaults in $table table. " . $e->getMessage());
}
}
return false;
}
/**
* Update the data type of the given field.
*
* @param string $updateString The SQL command to update the column data type
* @param string $table The table to update.
* @param string $field Column/field that must be updated.
*
* @return bool true on succes
* @since 3.2.1
* @throws \Exception If there is an error adding columns.
*/
protected function updateColumnDataType(string $updateString, string $table, string $field): bool
{
try {
$this->db->setQuery($updateString);
return $this->db->execute();
} catch (\Exception $e) {
throw new \Exception("Error: failed to update the datatype of ($field) column in $table table. " . $e->getMessage());
}
}
/**
* Key all needed keys for this table
*
* @return string of keys
* @since 3.2.1
*/
protected function getTableKeys(): string
{
$keys = [];
$keys[] = 'PRIMARY KEY (`id`)'; // TODO (we may want this to be dynamicly set)
if (!empty($this->uniqueKeys))
{
$keys[] = implode(', ', $this->uniqueKeys);
}
if (!empty($this->keys))
{
$keys[] = implode(', ', $this->keys);
}
return implode(', ', $keys);
}
/**
* Function to set the view keys
*
* @param string $column The field column database array values
*
* @return void
* @since 3.2.1
*/
protected function setKeys(array $column): void
{
$this->setUniqueKey($column);
$this->setKey($column);
}
/**
* Function to set the unique key
*
* @param string $column The field column database array values
*
* @return void
* @since 3.2.1
*/
protected function setUniqueKey(array $column): void
{
if (isset($column['unique_key']) && $column['unique_key'])
{
$key = $column['unique_key_name'] ?? $column['name'];
$this->uniqueKeys[] = "UNIQUE KEY `idx_" . $key . "` (`" . $column['name'] . "`)";
}
}
/**
* Function to set the key
*
* @param string $column The field column database array values
*
* @return void
* @since 3.2.1
*/
protected function setKey(array $column): void
{
if (isset($column['key']) && $column['key'])
{
$key = $column['key_name'] ?? $column['name'];
$this->keys[] = "KEY `idx_" . $key . "` (`" . $column['name'] . "`)";
}
}
/**
* Adjusts the default value SQL fragment for a database field based on its type and specific rules.
*
* If the field is of type DATETIME and the Joomla version is not 3, it sets the default to CURRENT_TIMESTAMP
* if not explicitly specified otherwise. For all other types, or when a 'EMPTY' default is specified, it handles
* defaults by either leaving them unset or applying the provided default, properly quoted for SQL safety.
*
* @param string $type The type of the database field (e.g., 'DATETIME').
* @param string|null $defaultValue Optional default value for the field, null if not provided.
* @param bool $pure Optional to add the 'DEFAULT' string or not.
*
* @return string The SQL fragment to set the default value for a field.
* @since 3.2.1
*/
protected function getDefaultValue(string $type, ?string $defaultValue, bool $pure = false): string
{
if ($defaultValue === null)
{
return '';
}
// Set default for DATETIME fields in Joomla versions above 3
if (strtoupper($type) === 'DATETIME' && $this->currentVersion != 3)
{
return $pure ? "CURRENT_TIMESTAMP" : " DEFAULT CURRENT_TIMESTAMP";
}
// Apply and quote the default value
$sql_default = $this->quote($defaultValue);
return $pure ? $defaultValue : " DEFAULT $sql_default";
}
/**
* Set a value based on data type
*
* @param mixed $value The value to set
*
* @return mixed
* @since 3.2.0
**/
protected function quote($value)
{
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
{
return 'NULL';
}
if (is_string($value) && strtoupper($value) === 'EMPTY')
{
return "''";
}
elseif (is_numeric($value))
{
if (filter_var($value, FILTER_VALIDATE_INT))
{
return (int) $value;
}
elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
{
return (float) $value;
}
}
elseif (is_bool($value)) // not sure if this will work well (but its correct)
{
return $value ? 'TRUE' : 'FALSE';
}
// For date and datetime values
elseif ($value instanceof \DateTime)
{
return $this->db->quote($value->format('Y-m-d H:i:s'));
}
// For other data types, just escape it
return $this->db->quote($value);
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Interfaces;
/**
* Schema Checking Interface
*
* @since 3.2.1
*/
interface SchemaInterface
{
/**
* Check and update database schema for missing fields or tables.
*
* @return array The array of successful updates/actions, if empty no update/action was taken.
* @since 3.2.1
* @throws \Exception If there is an error during the update process.
*/
public function update(): array;
/**
* Create a table with all necessary fields.
*
* @param string $table The name of the table to create.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error creating the table.
*/
public function createTable(string $table): void;
/**
* Update the schema of an existing table.
*
* @param string $table The table to update.
*
* @return void
* @since 3.2.1
* @throws \Exception If there is an error while updating the schema.
*/
public function updateSchema(string $table): void;
}

View File

@ -0,0 +1,91 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace TrueChristianChurch\Joomla\Interfaces;
/**
* The VDM Core Table Interface
*/
interface Tableinterface
{
/**
* Get any value from a item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name', 'value_key');
* Get an item/field/column of an area/view/table
* Example: $this->get('table_name', 'field_name');
* Get all items/fields/columns of an area/view/table
* Example: $this->get('table_name');
* Get all areas/views/tables with all their item/field/column details
* Example: $this->get('All');
* Example: $this->get();
*
* @param string|null $table The table
* @param string|null $field The field
* @param string|null $key The value key
*
* @return mixed
* @since 3.2.0
*/
public function get(?string $table = null, ?string $field = null, ?string $key = null);
/**
* Get title field from an area/view/table
*
* @param string $table The area
*
* @return ?array
* @since 3.2.0
*/
public function title(string $table): ?array;
/**
* Get title field name
*
* @param string $table The area
*
* @return string
* @since 3.2.0
*/
public function titleName(string $table): string;
/**
* Get all tables
*
* @return array
* @since 3.2.0
*/
public function tables(): array;
/**
* Check if a table (and field) exist
*
* @param string $table The area
* @param string|null $field The area
*
* @return bool
* @since 3.2.0
*/
public function exist(string $table, ?string $field = null): bool;
/**
* Get all fields of an area/view/table
*
* @param string $table The area
* @param bool $default Add the default fields
* @param bool $details Add/Leave fields the details
*
* @return array|null On success an array of fields
* @since 3.2.0
*/
public function fields(string $table, bool $default = false, bool $details = false): ?array;
}

Some files were not shown because too many files have changed in this diff Show More