Release of v5.0.3-alpha4
Fix database default fields to allow NULL. #1169. Fix the power list field to allow search. #1167. Expanded the Demo component in JCB v4 to include more advance features.
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
<?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 VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Helper Class Create User Class for Joomla 5
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class CreateUser implements CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int User ID on success";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing.";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails.";
|
||||
$method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = [";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "], \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Create a user with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update the given component params.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name.";
|
||||
$method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated.";
|
||||
$method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = PHP_EOL . Indent::_(1)
|
||||
. "public static function setParams(\$option, \$target, \$value)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Sets a parameter value for the given target in the specified option's params";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " (Super---640b5352_fb09_425f_a26e_cd44eda03f15---Power)";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update user details";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int Updated user ID on success.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function updateUser(\$userDetails): int";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2)
|
||||
. "//" . Line::_(__Line__, __Class__)
|
||||
. " Update user details with the UserHelper class (Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power)";
|
||||
$method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
// return the help method
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface
|
||||
$counter = 0;
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
if ($method['access'] === 'public' && !$method['static'] && !$method['abstract'])
|
||||
if ($this->validEventName($method))
|
||||
{
|
||||
$events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'";
|
||||
|
||||
@@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if a method name is a valid event name for a Joomla plugin.
|
||||
*
|
||||
* The method must meet the following criteria:
|
||||
* - It must be public, not static, and not abstract.
|
||||
* - It must not be a magic method (i.e., should not start with '__').
|
||||
*
|
||||
* @param array $method The method details, including 'name', 'access', 'static', and 'abstract'.
|
||||
*
|
||||
* @return bool Returns true if the method is a valid event name, otherwise false.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function validEventName(array $method): bool
|
||||
{
|
||||
// Check if the method is public, static, and not abstract
|
||||
if ($method['access'] !== 'public' || $method['static'] || $method['abstract'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the method is a magic method (starts with '__')
|
||||
if (substr($method['name'], 0, 2) === '__')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If all checks pass, the method is a valid event name
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the getSubscribedEvents is set
|
||||
*
|
||||
|
@@ -0,0 +1,125 @@
|
||||
<?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 VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Helper Class Create User Class for Joomla 4
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class CreateUser implements CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Save user details by either creating a new user or updating an existing user.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials ['name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string]";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params ['useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int]";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int User ID on success";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \InvalidArgumentException If required credentials are missing.";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If the user update or creation fails.";
|
||||
$method[] = Indent::_(1) . " * @throws Super__"."_1c10a5f1_204d_4f17_ad9f_0e0684f2030d___Power If the user is not found.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = [";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "], \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Create a user with the UserHelper class";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::create(\$credentials, \$autologin, \$params, \$mode);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update the given component params.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param string|null \$option The optional extension element name.";
|
||||
$method[] = Indent::_(1) . " * @param string \$target The parameter name to be updated.";
|
||||
$method[] = Indent::_(1) . " * @param mixed \$value The value to set for the parameter.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = PHP_EOL . Indent::_(1)
|
||||
. "public static function setParams(\$option, \$target, \$value)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Sets a parameter value for the given target in the specified option's params";
|
||||
$method[] = Indent::_(2)
|
||||
. "return Super__"."_640b5352_fb09_425f_a26e_cd44eda03f15___Power::setParams(\$target, \$value, \$option);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update user details";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @param array \$userDetails Array containing user details to be updated";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @return int Updated user ID on success.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @throws \RuntimeException If user update fails.";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1) . " * @since 3.0.0";
|
||||
$method[] = Indent::_(1) . " * @deprecated 4.3 Use Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function updateUser(\$userDetails): int";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2)
|
||||
. "//" . Line::_(__Line__, __Class__)
|
||||
. " Update user details with the UserHelper class";
|
||||
$method[] = Indent::_(2) . "return Super__"."_7832a726_87b6_4e95_887e_7b725d3fab8f___Power::update(\$userDetails);";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
// return the help method
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@@ -155,7 +155,7 @@ final class Extension implements ExtensionInterface
|
||||
$counter = 0;
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
if ($method['access'] === 'public' && !$method['static'] && !$method['abstract'])
|
||||
if ($this->validEventName($method))
|
||||
{
|
||||
$events[$method['name']] = Indent::_(3) . "'{$method['name']}' => '{$method['name']}'";
|
||||
|
||||
@@ -191,6 +191,37 @@ final class Extension implements ExtensionInterface
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if a method name is a valid event name for a Joomla plugin.
|
||||
*
|
||||
* The method must meet the following criteria:
|
||||
* - It must be public, not static, and not abstract.
|
||||
* - It must not be a magic method (i.e., should not start with '__').
|
||||
*
|
||||
* @param array $method The method details, including 'name', 'access', 'static', and 'abstract'.
|
||||
*
|
||||
* @return bool Returns true if the method is a valid event name, otherwise false.
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function validEventName(array $method): bool
|
||||
{
|
||||
// Check if the method is public, static, and not abstract
|
||||
if ($method['access'] !== 'public' || $method['static'] || $method['abstract'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the method is a magic method (starts with '__')
|
||||
if (substr($method['name'], 0, 2) === '__')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If all checks pass, the method is a valid event name
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the getSubscribedEvents is set
|
||||
*
|
||||
|
@@ -0,0 +1,366 @@
|
||||
<?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 VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Helper Class Create User Class for Joomla 3
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
final class CreateUser implements CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Greate user and update given table";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @return int|Error User ID on success, or an error.";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = array(";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "), \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Override mode";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Update params";
|
||||
$method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Now Register User";
|
||||
$method[] = Indent::_(3)
|
||||
. "return self::registerUser(\$credentials, \$params);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "elseif (\$mode == 2)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Fallback to Site Registrations";
|
||||
$method[] = Indent::_(3) . "\$mode = 1;";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " load the user component language files if there is an error.";
|
||||
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
|
||||
$method[] = Indent::_(2) . "\$extension = 'com_users';";
|
||||
$method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;";
|
||||
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
|
||||
. "';";
|
||||
$method[] = Indent::_(2) . "\$reload = true;";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the correct user model.";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site Registrations";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the user site-registration model";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin Registration";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the backend-user model";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if we have params/config";
|
||||
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Make changes to user config";
|
||||
$method[] = Indent::_(3)
|
||||
. "foreach (\$params as \$param => \$set)";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " If you know of a better path, let me know";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$params[\$param] = self::setParams(\$extension, \$param, \$set);";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Set username to email if not set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['username'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Lineup new user data array";
|
||||
$method[] = Indent::_(2) . "\$data = array(";
|
||||
$method[] = Indent::_(3)
|
||||
. "'username' => \$credentials['username'],";
|
||||
$method[] = Indent::_(3) . "'name' => \$credentials['name'],";
|
||||
$method[] = Indent::_(3) . "'block' => 0 );";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Added details based on mode";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['email1'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['email'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['registerDate'] = Factory::getDate()->toSql();";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if password was set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Set random password when empty password was submitted,";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " when using the 1 = site-registration mode";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['password'] = self::randomkey(8);";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['password2'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Now Add password if set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$data['password1'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$data['password'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['password2'] = \$credentials['password2'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the group/s value if set, only for Admin Registration (\$mode == 0)";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 0 && isset(\$credentials['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$credentials['groups']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['groups'] = \$credentials['groups'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Create the new user";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$userId = \$model->register(\$data);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$model->save(\$data);";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$userId = \$model->getState('user.id', 0);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if we have params";
|
||||
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Change user params/config back";
|
||||
$method[] = Indent::_(3)
|
||||
. "foreach (\$params as \$param => \$set)";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " If you know of a better path, let me know";
|
||||
$method[] = Indent::_(4)
|
||||
. "self::setParams(\$extension, \$param, \$set);";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " if user is created";
|
||||
$method[] = Indent::_(2) . "if (\$userId > 0)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Auto Login if Needed";
|
||||
$method[] = Indent::_(3)
|
||||
. "if (\$autologin && isset(\$credentials['password']))";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Try to login";
|
||||
$method[] = Indent::_(4) . "try{";
|
||||
$method[] = Indent::_(5)
|
||||
. "Factory::getApplication()->login(\$credentials);";
|
||||
$method[] = Indent::_(4) . "} catch (\Exception \$exception){";
|
||||
$method[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Do noting for now, may want to set redirect.";
|
||||
$method[] = Indent::_(4) . "}";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Return ID";
|
||||
$method[] = Indent::_(3) . "return \$userId;";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "return \$model->getError();";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1)
|
||||
. "public static function setParams(\$component,\$target,\$value)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Get the params and set the new values";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$params = ComponentHelper::getParams(\$component);";
|
||||
$method[] = Indent::_(2) . "\$was = \$params->get(\$target, null);";
|
||||
$method[] = Indent::_(2) . "if (\$was != \$value)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$params->set(\$target, \$value);";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Get a new database query instance";
|
||||
$method[] = Indent::_(3) . "\$db = Factory::getDBO();";
|
||||
$method[] = Indent::_(3) . "\$query = \$db->getQuery(true);";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Build the query";
|
||||
$method[] = Indent::_(3) . "\$query->update('#__extensions AS a');";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$query->set('a.params = ' . \$db->quote((string)\$params));";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$query->where('a.element = ' . \$db->quote((string)\$component));";
|
||||
$method[] = Indent::_(3);
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Execute the query";
|
||||
$method[] = Indent::_(3) . "\$db->setQuery(\$query);";
|
||||
$method[] = Indent::_(3) . "\$db->execute();";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "return \$was;";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update user values";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function updateUser(\$new)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2)
|
||||
. "// load the user component language files if there is an error.";
|
||||
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
|
||||
$method[] = Indent::_(2) . "\$extension = 'com_users';";
|
||||
$method[] = Indent::_(2) . "\$base_dir = JPATH_ADMINISTRATOR;";
|
||||
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
|
||||
. "';";
|
||||
$method[] = Indent::_(2) . "\$reload = true;";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = Indent::_(2) . "// load the user model";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
|
||||
$method[] = Indent::_(2) . "// Check if password was set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$new['password']) && isset(\$new['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password2']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "// Use the users passwords";
|
||||
$method[] = Indent::_(3) . "\$password = \$new['password'];";
|
||||
$method[] = Indent::_(3) . "\$password2 = \$new['password2'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "// set username";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (!isset(\$new['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['username']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$new['username'] = \$new['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "// lineup update user data";
|
||||
$method[] = Indent::_(2) . "\$data = array(";
|
||||
$method[] = Indent::_(3) . "'id' => \$new['id'],";
|
||||
$method[] = Indent::_(3) . "'username' => \$new['username'],";
|
||||
$method[] = Indent::_(3) . "'name' => \$new['name'],";
|
||||
$method[] = Indent::_(3) . "'email' => \$new['email'],";
|
||||
$method[] = Indent::_(3)
|
||||
. "'password' => \$password, // First password field";
|
||||
$method[] = Indent::_(3)
|
||||
. "'password2' => \$password2, // Confirm password field";
|
||||
$method[] = Indent::_(3) . "'block' => 0 );";
|
||||
$method[] = Indent::_(2) . "// set groups if found";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$new['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$new['groups']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$data['groups'] = \$new['groups'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "// register the new user";
|
||||
$method[] = Indent::_(2) . "\$done = \$model->save(\$data);";
|
||||
$method[] = Indent::_(2) . "// if user is updated";
|
||||
$method[] = Indent::_(2) . "if (\$done)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "return \$new['id'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "return \$model->getError();";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
// return the help method
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@@ -543,14 +543,7 @@ class Config extends BaseConfig
|
||||
*/
|
||||
protected function getRemovelinebreaks(): bool
|
||||
{
|
||||
// get posted value
|
||||
$value = $this->input->post->get('remove_line_breaks', 2, 'INT');
|
||||
// get global
|
||||
if ($value > 1)
|
||||
{
|
||||
return (bool) GetHelper::var('joomla_component', $this->component_id, 'id', 'remove_line_breaks');
|
||||
}
|
||||
return (bool) $value;
|
||||
return (bool) true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -889,7 +882,26 @@ class Config extends BaseConfig
|
||||
*/
|
||||
protected function getApprovedjoomlapaths(): array
|
||||
{
|
||||
return array_values($this->joomla_powers_init_repos);
|
||||
// some defaults repos we need by JCB
|
||||
$approved = $this->joomla_powers_init_repos;
|
||||
|
||||
$paths = RepoHelper::get(2); // Joomla Power = 2
|
||||
|
||||
if ($paths !== null)
|
||||
{
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
$owner = $path->organisation ?? null;
|
||||
$repo = $path->repository ?? null;
|
||||
if ($owner !== null && $repo !== null)
|
||||
{
|
||||
// we make sure to get only the objects
|
||||
$approved = ["{$owner}.{$repo}" => $path] + $approved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_values($approved);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -992,7 +992,8 @@ final class Builders
|
||||
'code' => $name,
|
||||
'name' => $listLangName,
|
||||
'extension' => $_extension,
|
||||
'filter' => $field['filter']
|
||||
'filter' => $field['filter'],
|
||||
'add_icon' => StringHelper::check($view['settings']->icon_category)
|
||||
]);
|
||||
// also set code name for title alias fix
|
||||
$this->categorycode->set($nameSingleCode, [
|
||||
|
@@ -12,13 +12,12 @@
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Gui;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Hash;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\LockBase;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Customcode\DispenserInterface;
|
||||
|
||||
|
||||
@@ -33,7 +32,7 @@ class Dispenser implements DispenserInterface
|
||||
* Customcode Dispenser Hub
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public array $hub;
|
||||
|
||||
@@ -41,7 +40,7 @@ class Dispenser implements DispenserInterface
|
||||
* Compiler Placeholder
|
||||
*
|
||||
* @var Placeholder
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Placeholder $placeholder;
|
||||
|
||||
@@ -49,7 +48,7 @@ class Dispenser implements DispenserInterface
|
||||
* Compiler Customcode
|
||||
*
|
||||
* @var Customcode
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Customcode $customcode;
|
||||
|
||||
@@ -57,7 +56,7 @@ class Dispenser implements DispenserInterface
|
||||
* Compiler Customcode in Gui
|
||||
*
|
||||
* @var Gui
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Gui $gui;
|
||||
|
||||
@@ -65,7 +64,7 @@ class Dispenser implements DispenserInterface
|
||||
* Compiler Customcode to Hash
|
||||
*
|
||||
* @var Hash
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected Hash $hash;
|
||||
|
||||
@@ -73,29 +72,29 @@ class Dispenser implements DispenserInterface
|
||||
* Compiler Customcode to LockBase
|
||||
*
|
||||
* @var LockBase
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected LockBase $base64;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Placeholder|null $placeholder The compiler placeholder object.
|
||||
* @param Customcode|null $customcode The compiler customcode object.
|
||||
* @param Gui|null $gui The compiler customcode gui object.
|
||||
* @param Hash|null $hash The compiler customcode hash object.
|
||||
* @param LockBase|null $base64 The compiler customcode lock base64 object.
|
||||
* @param Placeholder $placeholder The Placeholder Class.
|
||||
* @param Customcode $customcode The Customcode Class.
|
||||
* @param Gui $gui The Gui Class.
|
||||
* @param Hash $hash The Hash Class.
|
||||
* @param LockBase $lockbase The LockBase Class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Placeholder $placeholder = null, ?Customcode $customcode = null,
|
||||
?Gui $gui = null, ?Hash $hash = null, ?LockBase $base64 = null)
|
||||
public function __construct(Placeholder $placeholder, Customcode $customcode, Gui $gui,
|
||||
Hash $hash, LockBase $lockbase)
|
||||
{
|
||||
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
|
||||
$this->customcode = $customcode ?: Compiler::_('Customcode');
|
||||
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
|
||||
$this->hash = $hash ?: Compiler::_('Customcode.Hash');
|
||||
$this->base64 = $base64 ?: Compiler::_('Customcode.LockBase');
|
||||
$this->placeholder = $placeholder;
|
||||
$this->customcode = $customcode;
|
||||
$this->gui = $gui;
|
||||
$this->hash = $hash;
|
||||
$this->base64 = $lockbase;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +113,7 @@ class Dispenser implements DispenserInterface
|
||||
* default: false
|
||||
*
|
||||
* @return bool true on success
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(&$script, string $first, ?string $second = null, ?string $third = null,
|
||||
array $config = [], bool $base64 = true, bool $dynamic = true, bool $add = false): bool
|
||||
@@ -177,7 +176,7 @@ class Dispenser implements DispenserInterface
|
||||
* @param string $suffix The suffix to add after the script if found
|
||||
*
|
||||
* @return mixed The string/script if found or the default value if not found
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $first, string $second, string $prefix = '', ?string $note = null,
|
||||
bool $unset = false, $default = null, string $suffix = '')
|
||||
@@ -224,7 +223,7 @@ class Dispenser implements DispenserInterface
|
||||
* default: false
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function initHub(string $first, ?string $second = null, ?string $third = null, bool $add = false)
|
||||
{
|
||||
@@ -255,7 +254,7 @@ class Dispenser implements DispenserInterface
|
||||
* default: false
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setHub(string $script, string $first, ?string $second = null, ?string $third = null, bool $add = false)
|
||||
{
|
||||
|
@@ -787,7 +787,7 @@ class Extractor implements ExtractorInterface
|
||||
$query->columns($this->db->quoteName($columns));
|
||||
foreach ($this->new as $values)
|
||||
{
|
||||
if (count((array) $values) == 15)
|
||||
if (count((array) $values) == 16)
|
||||
{
|
||||
$query->values(implode(',', $values));
|
||||
$continue = true;
|
||||
|
@@ -42,6 +42,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Service\Utilities;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\BuilderAJ;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\BuilderLZ;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Creator;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureComHelperClass;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureController;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitectureModel;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\ArchitecturePlugin;
|
||||
@@ -142,6 +143,7 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
|
||||
->registerServiceProvider(new BuilderAJ())
|
||||
->registerServiceProvider(new BuilderLZ())
|
||||
->registerServiceProvider(new Creator())
|
||||
->registerServiceProvider(new ArchitectureComHelperClass())
|
||||
->registerServiceProvider(new ArchitectureController())
|
||||
->registerServiceProvider(new ArchitectureModel())
|
||||
->registerServiceProvider(new ArchitecturePlugin())
|
||||
|
@@ -173,7 +173,7 @@ class Get
|
||||
* @var bool
|
||||
* @deprecated 3.3 Use CFactory::_('Config')->remove_line_breaks;
|
||||
*/
|
||||
public $removeLineBreaks = false;
|
||||
public $removeLineBreaks = true;
|
||||
|
||||
/**
|
||||
* The placeholders for custom code keys
|
||||
|
@@ -337,9 +337,10 @@ class Infusion extends Interpretation
|
||||
|
||||
// HELPER_CREATEUSER
|
||||
CFactory::_('Compiler.Builder.Content.One')->add('HELPER_CREATEUSER',
|
||||
$this->setCreateUserHelperMethod(
|
||||
CFactory::_('Component')->get('creatuserhelper')
|
||||
));
|
||||
CFactory::_('Architecture.ComHelperClass.CreateUser')->get(
|
||||
CFactory::_('Component')->get('creatuserhelper', 0)
|
||||
)
|
||||
);
|
||||
|
||||
// HELP
|
||||
CFactory::_('Compiler.Builder.Content.One')->set('HELP', $this->noHelp());
|
||||
|
@@ -1827,340 +1827,24 @@ class Interpretation extends Fields
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setCreateUserHelperMethod($add)
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param int $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*
|
||||
* @since 3.0
|
||||
* @deprecated 5.0.3 Use CFactory::_('Architecture.ComHelperClass.CreateUser')->get($add);
|
||||
*/
|
||||
public function setCreateUserHelperMethod($add): string
|
||||
{
|
||||
if ($add)
|
||||
{
|
||||
$method = [];
|
||||
$method[] = PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Greate user and update given table";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)";
|
||||
$method[] = Indent::_(1) . " * @param int \$autologin";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser";
|
||||
$method[] = Indent::_(1) . " *";
|
||||
$method[] = Indent::_(1)
|
||||
. " * @return int|Error User ID on success, or an error.";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function createUser(\$credentials, \$autologin = 0,";
|
||||
$method[] = Indent::_(2) . "\$params = array(";
|
||||
$method[] = Indent::_(3)
|
||||
. "'useractivation' => 0, 'sendpassword' => 1";
|
||||
$method[] = Indent::_(2) . "), \$mode = 1";
|
||||
$method[] = Indent::_(1) . ")";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Override mode";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Update params";
|
||||
$method[] = Indent::_(3) . "\$params['autologin'] = \$autologin;";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Now Register User";
|
||||
$method[] = Indent::_(3)
|
||||
. "return self::registerUser(\$credentials, \$params);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "elseif (\$mode == 2)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Fallback to Site Registrations";
|
||||
$method[] = Indent::_(3) . "\$mode = 1;";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " load the user component language files if there is an error.";
|
||||
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
|
||||
$method[] = Indent::_(2) . "\$extension = 'com_users';";
|
||||
$method[] = Indent::_(2) . "\$base_dir = JPATH_SITE;";
|
||||
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
|
||||
. "';";
|
||||
$method[] = Indent::_(2) . "\$reload = true;";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the correct user model.";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site Registrations";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the user site-registration model";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$model = self::getModel('registration', \$base_dir . '/components/' . \$extension, 'Users');";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin Registration";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the backend-user model";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/' . \$extension, 'Users');";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if we have params/config";
|
||||
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Make changes to user config";
|
||||
$method[] = Indent::_(3)
|
||||
. "foreach (\$params as \$param => \$set)";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " If you know of a better path, let me know";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$params[\$param] = self::setParams(\$extension, \$param, \$set);";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Set username to email if not set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (!isset(\$credentials['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['username']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['username'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Lineup new user data array";
|
||||
$method[] = Indent::_(2) . "\$data = array(";
|
||||
$method[] = Indent::_(3)
|
||||
. "'username' => \$credentials['username'],";
|
||||
$method[] = Indent::_(3) . "'name' => \$credentials['name'],";
|
||||
$method[] = Indent::_(3) . "'block' => 0 );";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Added details based on mode";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['email1'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['email'] = \$credentials['email'];";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['registerDate'] = Factory::getDate()->toSql();";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if password was set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2'])))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Set random password when empty password was submitted,";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " when using the 1 = site-registration mode";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['password'] = self::randomkey(8);";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$credentials['password2'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Now Add password if set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$credentials['password2']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$data['password1'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4)
|
||||
. "\$data['password'] = \$credentials['password'];";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['password2'] = \$credentials['password2'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Load the group/s value if set, only for Admin Registration (\$mode == 0)";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (\$mode == 0 && isset(\$credentials['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$credentials['groups']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$data['groups'] = \$credentials['groups'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Create the new user";
|
||||
$method[] = Indent::_(2) . "if (\$mode == 1) //" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
)
|
||||
. " 1 = Site-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$userId = \$model->register(\$data);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "else //" . Line::_(__Line__, __Class__)
|
||||
. " 0 = Admin-registration mode";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$model->save(\$data);";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$userId = \$model->getState('user.id', 0);";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Check if we have params";
|
||||
$method[] = Indent::_(2) . "if (Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$params))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Change user params/config back";
|
||||
$method[] = Indent::_(3)
|
||||
. "foreach (\$params as \$param => \$set)";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " If you know of a better path, let me know";
|
||||
$method[] = Indent::_(4)
|
||||
. "self::setParams(\$extension, \$param, \$set);";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " if user is created";
|
||||
$method[] = Indent::_(2) . "if (\$userId > 0)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Auto Login if Needed";
|
||||
$method[] = Indent::_(3)
|
||||
. "if (\$autologin && isset(\$credentials['password']))";
|
||||
$method[] = Indent::_(3) . "{";
|
||||
$method[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Try to login";
|
||||
$method[] = Indent::_(4) . "try{";
|
||||
$method[] = Indent::_(5)
|
||||
. "Factory::getApplication()->login(\$credentials);";
|
||||
$method[] = Indent::_(4) . "} catch (\Exception \$exception){";
|
||||
$method[] = Indent::_(5) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Do noting for now, may want to set redirect.";
|
||||
$method[] = Indent::_(4) . "}";
|
||||
$method[] = Indent::_(3) . "}";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Return ID";
|
||||
$method[] = Indent::_(3) . "return \$userId;";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "return \$model->getError();";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1)
|
||||
. "public static function setParams(\$component,\$target,\$value)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Get the params and set the new values";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$params = ComponentHelper::getParams(\$component);";
|
||||
$method[] = Indent::_(2) . "\$was = \$params->get(\$target, null);";
|
||||
$method[] = Indent::_(2) . "if (\$was != \$value)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$params->set(\$target, \$value);";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Get a new database query instance";
|
||||
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$method[] = Indent::_(3) . "\$db = Factory::getDBO();";
|
||||
}
|
||||
else
|
||||
{
|
||||
$method[] = Indent::_(3) . "\$db = Factory::getContainer()->get(DatabaseInterface::class);";
|
||||
}
|
||||
|
||||
$method[] = Indent::_(3) . "\$query = \$db->getQuery(true);";
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Build the query";
|
||||
$method[] = Indent::_(3) . "\$query->update('#__extensions AS a');";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$query->set('a.params = ' . \$db->quote((string)\$params));";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$query->where('a.element = ' . \$db->quote((string)\$component));";
|
||||
$method[] = Indent::_(3);
|
||||
$method[] = Indent::_(3) . "//" . Line::_(__Line__, __Class__)
|
||||
. " Execute the query";
|
||||
$method[] = Indent::_(3) . "\$db->setQuery(\$query);";
|
||||
$method[] = Indent::_(3) . "\$db->execute();";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "return \$was;";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
$method[] = PHP_EOL . Indent::_(1) . "/**";
|
||||
$method[] = Indent::_(1) . " * Update user values";
|
||||
$method[] = Indent::_(1) . " */";
|
||||
$method[] = Indent::_(1)
|
||||
. "public static function updateUser(\$new)";
|
||||
$method[] = Indent::_(1) . "{";
|
||||
$method[] = Indent::_(2)
|
||||
. "// load the user component language files if there is an error.";
|
||||
$method[] = Indent::_(2) . "\$lang = Factory::getLanguage();";
|
||||
$method[] = Indent::_(2) . "\$extension = 'com_users';";
|
||||
$method[] = Indent::_(2) . "\$base_dir = JPATH_ADMINISTRATOR;";
|
||||
$method[] = Indent::_(2) . "\$language_tag = '" . CFactory::_('Config')->get('lang_tag', 'en-GB')
|
||||
. "';";
|
||||
$method[] = Indent::_(2) . "\$reload = true;";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);";
|
||||
$method[] = Indent::_(2) . "// load the user model";
|
||||
$method[] = Indent::_(2)
|
||||
. "\$model = self::getModel('user', JPATH_ADMINISTRATOR . '/components/com_users', 'Users');";
|
||||
$method[] = Indent::_(2) . "// Check if password was set";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$new['password']) && isset(\$new['password2']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password']) && Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['password2']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "// Use the users passwords";
|
||||
$method[] = Indent::_(3) . "\$password = \$new['password'];";
|
||||
$method[] = Indent::_(3) . "\$password2 = \$new['password2'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "// set username";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (!isset(\$new['username']) || !Super_" . "__1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check(\$new['username']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3)
|
||||
. "\$new['username'] = \$new['email'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "// lineup update user data";
|
||||
$method[] = Indent::_(2) . "\$data = array(";
|
||||
$method[] = Indent::_(3) . "'id' => \$new['id'],";
|
||||
$method[] = Indent::_(3) . "'username' => \$new['username'],";
|
||||
$method[] = Indent::_(3) . "'name' => \$new['name'],";
|
||||
$method[] = Indent::_(3) . "'email' => \$new['email'],";
|
||||
$method[] = Indent::_(3)
|
||||
. "'password' => \$password, // First password field";
|
||||
$method[] = Indent::_(3)
|
||||
. "'password2' => \$password2, // Confirm password field";
|
||||
$method[] = Indent::_(3) . "'block' => 0 );";
|
||||
$method[] = Indent::_(2) . "// set groups if found";
|
||||
$method[] = Indent::_(2)
|
||||
. "if (isset(\$new['groups']) && Super_" . "__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$new['groups']))";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "\$data['groups'] = \$new['groups'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "// register the new user";
|
||||
$method[] = Indent::_(2) . "\$done = \$model->save(\$data);";
|
||||
$method[] = Indent::_(2) . "// if user is updated";
|
||||
$method[] = Indent::_(2) . "if (\$done)";
|
||||
$method[] = Indent::_(2) . "{";
|
||||
$method[] = Indent::_(3) . "return \$new['id'];";
|
||||
$method[] = Indent::_(2) . "}";
|
||||
$method[] = Indent::_(2) . "return \$model->getError();";
|
||||
$method[] = Indent::_(1) . "}";
|
||||
|
||||
// return the help method
|
||||
return implode(PHP_EOL, $method);
|
||||
}
|
||||
|
||||
return '';
|
||||
return CFactory::_('Architecture.ComHelperClass.CreateUser')->get($add);
|
||||
}
|
||||
|
||||
public function setAdminViewMenu(&$nameSingleCode, &$view)
|
||||
@@ -10251,7 +9935,7 @@ class Interpretation extends Fields
|
||||
. "`id` INT(11) NOT NULL AUTO_INCREMENT,";
|
||||
}
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',";
|
||||
. "`asset_id` INT(10) unsigned NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',";
|
||||
ksort($fields);
|
||||
$last_name = 'asset_id';
|
||||
foreach ($fields as $field => $data)
|
||||
@@ -10350,19 +10034,19 @@ class Interpretation extends Fields
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.published'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`published` TINYINT(3) NOT NULL DEFAULT 1,";
|
||||
. "`published` TINYINT(3) NULL DEFAULT 1,";
|
||||
}
|
||||
// check if default field was overwritten
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created_by'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`created_by` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
. "`created_by` INT(10) unsigned NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was overwritten
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.modified_by'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
. "`modified_by` INT(10) unsigned NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was overwritten
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.created'))
|
||||
@@ -10370,7 +10054,7 @@ class Interpretation extends Fields
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',";
|
||||
. "`created` DATETIME NULL DEFAULT '0000-00-00 00:00:00',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10384,7 +10068,7 @@ class Interpretation extends Fields
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',";
|
||||
. "`modified` DATETIME NULL DEFAULT '0000-00-00 00:00:00',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10396,7 +10080,7 @@ class Interpretation extends Fields
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`checked_out` int(11) unsigned NOT NULL DEFAULT 0,";
|
||||
. "`checked_out` int(11) unsigned NULL DEFAULT 0,";
|
||||
}
|
||||
// check if default field was overwritten
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.checked_out_time'))
|
||||
@@ -10404,7 +10088,7 @@ class Interpretation extends Fields
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',";
|
||||
. "`checked_out_time` DATETIME NULL DEFAULT '0000-00-00 00:00:00',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10416,20 +10100,20 @@ class Interpretation extends Fields
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.version'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`version` INT(10) unsigned NOT NULL DEFAULT 1,";
|
||||
. "`version` INT(10) unsigned NULL DEFAULT 1,";
|
||||
}
|
||||
// check if default field was overwritten
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.hits'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`hits` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
. "`hits` INT(10) unsigned NULL DEFAULT 0,";
|
||||
}
|
||||
// check if view has access
|
||||
if (CFactory::_('Compiler.Builder.Access.Switch')->exists($view)
|
||||
&& !CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.access'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`access` INT(10) unsigned NOT NULL DEFAULT 0,";
|
||||
. "`access` INT(10) unsigned NULL DEFAULT 0,";
|
||||
// add to component dynamic fields
|
||||
CFactory::_('Compiler.Builder.Component.Fields')->set($view . '.access',
|
||||
[
|
||||
@@ -10443,7 +10127,7 @@ class Interpretation extends Fields
|
||||
'type' => 'INT(10) unsigned',
|
||||
'default' => '0',
|
||||
'key' => true,
|
||||
'null_switch' => 'NOT NULL'
|
||||
'null_switch' => 'NULL'
|
||||
]
|
||||
]
|
||||
);
|
||||
@@ -10452,7 +10136,7 @@ class Interpretation extends Fields
|
||||
if (!CFactory::_('Compiler.Builder.Field.Names')->isString($view . '.ordering'))
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`ordering` INT(11) NOT NULL DEFAULT 0,";
|
||||
. "`ordering` INT(11) NULL DEFAULT 0,";
|
||||
}
|
||||
// check if metadata is added to this view
|
||||
if (CFactory::_('Compiler.Builder.Meta.Data')->isString($view))
|
||||
@@ -10463,7 +10147,7 @@ class Interpretation extends Fields
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`metakey` TEXT NOT NULL,";
|
||||
. "`metakey` TEXT NULL,";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10477,7 +10161,7 @@ class Interpretation extends Fields
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`metadesc` TEXT NOT NULL,";
|
||||
. "`metadesc` TEXT NULL,";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10491,7 +10175,7 @@ class Interpretation extends Fields
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$db_ .= PHP_EOL . Indent::_(1)
|
||||
. "`metadata` TEXT NOT NULL,";
|
||||
. "`metadata` TEXT NULL,";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10663,22 +10347,25 @@ class Interpretation extends Fields
|
||||
// add to main DB string
|
||||
$db .= $db_ . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
// add custom sql dump to the file
|
||||
if (isset(CFactory::_('Customcode.Dispenser')->hub['sql'])
|
||||
&& ArrayHelper::check(
|
||||
CFactory::_('Customcode.Dispenser')->hub['sql']
|
||||
))
|
||||
{
|
||||
foreach (
|
||||
CFactory::_('Customcode.Dispenser')->hub['sql'] as $for => $customSql
|
||||
)
|
||||
foreach (CFactory::_('Customcode.Dispenser')->hub['sql'] as $for => $customSql)
|
||||
{
|
||||
$placeholders = array(Placefix::_('component') => $component,
|
||||
Placefix::_('view') => $for);
|
||||
$db .= CFactory::_('Placeholder')->update(
|
||||
$customSql, $placeholders
|
||||
) . PHP_EOL . PHP_EOL;
|
||||
$placeholders = [
|
||||
Placefix::_('component') => $component,
|
||||
Placefix::_('view') => $for
|
||||
]; // dont change this just use ###view### or componentbuilder (took you a while to get here right :)
|
||||
|
||||
$db .= CFactory::_('Placeholder')->update(
|
||||
$customSql, $placeholders
|
||||
) . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
unset(CFactory::_('Customcode.Dispenser')->hub['sql']);
|
||||
}
|
||||
|
||||
@@ -13762,6 +13449,14 @@ class Interpretation extends Fields
|
||||
$headerscript .= PHP_EOL . '}';
|
||||
if ($addNewButon > 0)
|
||||
{
|
||||
if (CFactory::_('Config')->get('joomla_version', 3) == 3)
|
||||
{
|
||||
$add_key = 'edit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$add_key = 'add';
|
||||
}
|
||||
// add the link for new
|
||||
if ($addNewButon == 1 || $addNewButon == 2)
|
||||
{
|
||||
@@ -13770,7 +13465,7 @@ class Interpretation extends Fields
|
||||
$headerscript .= PHP_EOL . '$new = "index.php?option=com_'
|
||||
. CFactory::_('Config')->component_code_name . '&view=' . $name_list_code
|
||||
. '&task='
|
||||
. $name_single_code . '.edit" . $ref;';
|
||||
. $name_single_code . '.' . $add_key . '" . $ref;';
|
||||
}
|
||||
// and the link for close and new
|
||||
if ($addNewButon == 2 || $addNewButon == 3)
|
||||
@@ -13781,7 +13476,7 @@ class Interpretation extends Fields
|
||||
. '$close_new = "index.php?option=com_'
|
||||
. CFactory::_('Config')->component_code_name . '&view=' . $name_list_code
|
||||
. '&task='
|
||||
. $name_single_code . '.edit";';
|
||||
. $name_single_code . '.' . $add_key . '";';
|
||||
}
|
||||
$headerscript .= PHP_EOL . '//' . Line::_(__Line__, __Class__)
|
||||
. ' load the action object';
|
||||
@@ -21553,7 +21248,8 @@ class Interpretation extends Fields
|
||||
$counter++;
|
||||
}
|
||||
// dashboard link to category on dashboard is build here
|
||||
if (CFactory::_('Compiler.Builder.Category')->exists("{$name_list}.code"))
|
||||
if (CFactory::_('Compiler.Builder.Category')->exists("{$name_list}.code") &&
|
||||
CFactory::_('Compiler.Builder.Category')->get("{$name_list}.add_icon"))
|
||||
{
|
||||
$catCode = CFactory::_('Compiler.Builder.Category')->get("{$name_list}.code");
|
||||
|
||||
|
@@ -0,0 +1,36 @@
|
||||
<?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 VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass;
|
||||
|
||||
|
||||
/**
|
||||
* Component Helper Class Create User Interface
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
interface CreateUserInterface
|
||||
{
|
||||
/**
|
||||
* Generates the method definition for creating or updating a user based on the provided parameters.
|
||||
*
|
||||
* This method returns a string representation of a PHP function that includes various
|
||||
* steps for handling user creation and updates, depending on the mode (site registration or admin registration).
|
||||
*
|
||||
* @param $add Determines whether to generate the user creation method or not.
|
||||
* If true, the method will be generated and returned as a string.
|
||||
*
|
||||
* @return string The generated method code as a string if $add is true.
|
||||
* Returns an empty string if $add is false.
|
||||
*/
|
||||
public function get($add): string;
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@@ -12,7 +12,6 @@
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Customcode\Dispenser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Model\Sqldump;
|
||||
|
||||
@@ -43,15 +42,15 @@ class Sql
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Dispenser|null $dispenser The compiler customcode dispenser.
|
||||
* @param Sqldump|null $dump The compiler SQL dump.
|
||||
* @param Dispenser $dispenser The compiler customcode dispenser.
|
||||
* @param Sqldump $dump The compiler SQL dump.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Dispenser $dispenser = null, ?Sqldump $dump = null)
|
||||
public function __construct(Dispenser $dispenser, Sqldump $dump)
|
||||
{
|
||||
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
|
||||
$this->dump = $dump ?: Compiler::_('Model.Sqldump');
|
||||
$this->dispenser = $dispenser;
|
||||
$this->dump = $dump;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +90,6 @@ class Sql
|
||||
|
||||
unset($item->tables);
|
||||
unset($item->sql);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,6 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
|
||||
@@ -45,14 +44,13 @@ class Sqldump
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
* @param \JDatabaseDriver|null $db The database object.
|
||||
* @param Registry $registry The compiler registry object.
|
||||
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Registry $registry = null)
|
||||
public function __construct(Registry $registry)
|
||||
{
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->registry = $registry;
|
||||
$this->db = Factory::getDbo();
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,6 @@
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
@@ -37,13 +36,13 @@ class Sqltweaking
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
* @param Registry $registry The compiler registry object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Registry $registry = null)
|
||||
public function __construct(Registry $registry)
|
||||
{
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -12,7 +12,6 @@
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
@@ -45,13 +44,13 @@ class Updatesql
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
* @param Registry $registry The compiler registry object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Registry $registry = null)
|
||||
public function __construct(Registry $registry)
|
||||
{
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,118 @@
|
||||
<?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 VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Architecture\ComHelperClass\CreateUserInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFive\ComHelperClass\CreateUser as J5CreateUser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaFour\ComHelperClass\CreateUser as J4CreateUser;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Architecture\JoomlaThree\ComHelperClass\CreateUser as J3CreateUser;
|
||||
|
||||
|
||||
/**
|
||||
* Architecture Component Helper Class Service Provider
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
class ArchitectureComHelperClass implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Current Joomla Version Being Build
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected $targetVersion;
|
||||
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(CreateUserInterface::class, 'Architecture.ComHelperClass.CreateUser')
|
||||
->share('Architecture.ComHelperClass.CreateUser', [$this, 'getCreateUser'], true);
|
||||
|
||||
$container->alias(J5CreateUser::class, 'Architecture.ComHelperClass.J5.CreateUser')
|
||||
->share('Architecture.ComHelperClass.J5.CreateUser', [$this, 'getJ5CreateUser'], true);
|
||||
|
||||
$container->alias(J4CreateUser::class, 'Architecture.ComHelperClass.J4.CreateUser')
|
||||
->share('Architecture.ComHelperClass.J4.CreateUser', [$this, 'getJ4CreateUser'], true);
|
||||
|
||||
$container->alias(J3CreateUser::class, 'Architecture.ComHelperClass.J3.CreateUser')
|
||||
->share('Architecture.ComHelperClass.J3.CreateUser', [$this, 'getJ3CreateUser'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The CreateUserInterface Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return CreateUserInterface
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getCreateUser(Container $container): CreateUserInterface
|
||||
{
|
||||
if (empty($this->targetVersion))
|
||||
{
|
||||
$this->targetVersion = $container->get('Config')->joomla_version;
|
||||
}
|
||||
|
||||
return $container->get('Architecture.ComHelperClass.J' . $this->targetVersion . '.CreateUser');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The CreateUser Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return J5CreateUser
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getJ5CreateUser(Container $container): J5CreateUser
|
||||
{
|
||||
return new J5CreateUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The CreateUser Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return J4CreateUser
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getJ4CreateUser(Container $container): J4CreateUser
|
||||
{
|
||||
return new J4CreateUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The CreateUser Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return J3CreateUser
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getJ3CreateUser(Container $container): J3CreateUser
|
||||
{
|
||||
return new J3CreateUser();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user