File manager - Edit - /home/ferretapmx/public_html/contactcreator.zip
Back
PK � �\X��� � src/Extension/ContactCreator.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage User.contactcreator * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\User\ContactCreator\Extension; use Joomla\CMS\Event\User\AfterSaveEvent; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Contact\Administrator\Table\ContactTable; use Joomla\Event\SubscriberInterface; use Joomla\String\StringHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Class for Contact Creator * * A tool to automatically create and synchronise contacts with a user * * @since 1.6 */ final class ContactCreator extends CMSPlugin implements SubscriberInterface { /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.3.0 */ public static function getSubscribedEvents(): array { return [ 'onUserAfterSave' => 'onUserAfterSave', ]; } /** * Utility method to act on a user after it has been saved. * * This method creates a contact for the saved user * * @param AfterSaveEvent $event The event instance. * * @return void * * @since 1.6 */ public function onUserAfterSave(AfterSaveEvent $event): void { $user = $event->getUser(); $isnew = $event->getIsNew(); $success = $event->getSavingResult(); // If the user wasn't stored we don't resync if (!$success) { return; } // If the user isn't new we don't sync if (!$isnew) { return; } // Ensure the user id is really an int $user_id = (int) $user['id']; // If the user id appears invalid then bail out just in case if (empty($user_id)) { return; } // Load plugin language files $this->loadLanguage(); $categoryId = $this->params->get('category', 0); if (empty($categoryId)) { $this->getApplication()->enqueueMessage($this->getApplication()->getLanguage()->_('PLG_CONTACTCREATOR_ERR_NO_CATEGORY'), 'error'); return; } if ($contact = $this->getContactTable()) { /** * Try to pre-load a contact for this user. Apparently only possible if other plugin creates it * Note: $user_id is cleaned above */ if (!$contact->load(['user_id' => (int) $user_id])) { $contact->published = $this->params->get('autopublish', 0); } $contact->name = $user['name']; $contact->user_id = $user_id; $contact->email_to = $user['email']; $contact->catid = $categoryId; $contact->access = (int) $this->getApplication()->get('access'); $contact->language = '*'; $contact->generateAlias(); // Check if the contact already exists to generate new name & alias if required if ($contact->id == 0) { [$name, $alias] = $this->generateAliasAndName($contact->alias, $contact->name, $categoryId); $contact->name = $name; $contact->alias = $alias; } $autowebpage = $this->params->get('autowebpage', ''); if (!empty($autowebpage)) { // Search terms $search_array = ['[name]', '[username]', '[userid]', '[email]']; // Replacement terms, urlencoded $replace_array = array_map('urlencode', [$user['name'], $user['username'], $user['id'], $user['email']]); // Now replace it in together $contact->webpage = str_replace($search_array, $replace_array, $autowebpage); } if ($contact->check() && $contact->store()) { return; } } $this->getApplication()->enqueueMessage($this->getApplication()->getLanguage()->_('PLG_CONTACTCREATOR_ERR_FAILED_CREATING_CONTACT'), 'error'); } /** * Method to change the name & alias if alias is already in use * * @param string $alias The alias. * @param string $name The name. * @param integer $categoryId Category identifier * * @return array Contains the modified title and alias. * * @since 3.2.3 */ private function generateAliasAndName($alias, $name, $categoryId) { $table = $this->getContactTable(); while ($table->load(['alias' => $alias, 'catid' => $categoryId])) { if ($name === $table->name) { $name = StringHelper::increment($name); } $alias = StringHelper::increment($alias, 'dash'); } return [$name, $alias]; } /** * Get an instance of the contact table * * @return ContactTable|null * * @since 3.2.3 */ private function getContactTable() { return $this->getApplication()->bootComponent('com_contact')->getMVCFactory()->createTable('Contact', 'Administrator'); } } PK � �\�Sʉ� � src/Extension/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\�Sʉ� � src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\���� � services/provider.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage User.contactcreator * * @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ \defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Plugin\User\ContactCreator\Extension\ContactCreator; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.4.0 */ public function register(Container $container): void { $container->set( PluginInterface::class, function (Container $container) { $plugin = new ContactCreator( (array) PluginHelper::getPlugin('user', 'contactcreator') ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; PK � �\�Sʉ� � services/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\\`��; ; contactcreator.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="user" method="upgrade"> <name>plg_user_contactcreator</name> <author>Joomla! Project</author> <creationDate>2009-08</creationDate> <copyright>(C) 2009 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.0.0</version> <description>PLG_CONTACTCREATOR_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\User\ContactCreator</namespace> <files> <folder plugin="contactcreator">services</folder> <folder>src</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_user_contactcreator.ini</language> <language tag="en-GB">language/en-GB/plg_user_contactcreator.sys.ini</language> </languages> <config> <fields name="params"> <fieldset name="basic"> <field name="autowebpage" type="text" label="PLG_CONTACTCREATOR_FIELD_AUTOMATIC_WEBPAGE_LABEL" description="PLG_CONTACTCREATOR_FIELD_AUTOMATIC_WEBPAGE_DESC" /> <field name="category" type="category" label="JCATEGORY" extension="com_contact" filter="integer" /> <field name="autopublish" type="radio" layout="joomla.form.field.radio.switcher" label="PLG_CONTACTCREATOR_FIELD_AUTOPUBLISH_LABEL" default="0" filter="integer" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> </fields> </config> </extension> PK � �\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK � �\X��� � src/Extension/ContactCreator.phpnu �[��� PK � �\�Sʉ� � � src/Extension/.htaccessnu �7��m PK � �\�Sʉ� � 2 src/.htaccessnu �7��m PK � �\���� � \ services/provider.phpnu �[��� PK � �\�Sʉ� � W services/.htaccessnu �7��m PK � �\\`��; ; � contactcreator.xmlnu �[��� PK � �\�Sʉ� � $ .htaccessnu �7��m PK F )%
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings