Done !
| Server IP : 46.105.57.169 / Your IP : 216.73.216.67 Web Server : Apache System : Linux webm002.cluster120.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaumee ( 152031) PHP Version : 8.5.7 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/verseaumee/ptitsanes/plugins/solidres/customfield/ |
Upload File : |
<?php
/*------------------------------------------------------------------------
Solidres - Hotel booking extension for Joomla
------------------------------------------------------------------------
@Author Solidres Team
@Website http://www.solidres.com
@Copyright Copyright (C) 2013 - 2017 Solidres. All Rights Reserved.
@License GNU General Public License version 3, or later
------------------------------------------------------------------------*/
defined('_JEXEC') or die;
class plgSolidresCustomfieldInstallerScript
{
public function postflight($type, $parent)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->update($db->qn('#__extensions'))
->set($db->qn('enabled') . ' = 1')
->where($db->qn('element') . ' = ' . $db->q('customfield'))
->where($db->qn('type') . ' = ' . $db->q('plugin'))
->where($db->qn('folder') . ' = ' . $db->q('solidres'));
$result = $db->setQuery($query)
->execute();
if ($result)
{
echo '<p>' . JText::_('Customfield - Solidres plugin is published successfully.') . '</p>';
}
else
{
JError::raiseWarning(-1, 'plgSolidresCustomfield: publishing failed');
}
$contentElementPath = JPATH_ADMINISTRATOR . '/components/com_falang/contentelements';
$pluginElementPath = $parent->getParent()->getPath('source') . '/administrator/components/com_solidres/falang';
if (JFolder::exists($contentElementPath) && JFolder::exists($pluginElementPath))
{
$files = JFolder::files($pluginElementPath, '(xml|php)$', false, true);
foreach ($files as $file)
{
JFile::copy($file, $contentElementPath . '/' . basename($file));
}
}
if (JFolder::exists(JPATH_PLUGINS . '/solidres/customfield/components/com_solidres/layouts/asset'))
{
@JFolder::delete(JPATH_PLUGINS . '/solidres/customfield/components/com_solidres/layouts/asset');
}
}
public function uninstall($adapter)
{
$contentElementPath = JPATH_ADMINISTRATOR . '/components/com_falang/contentelements';
$files = array(
$contentElementPath . '/sr_customfields.xml',
$contentElementPath . '/translationSr_customfields_contextFilter.php',
);
foreach ($files as $file)
{
if (file_exists($file))
{
@chmod($file, 0777);
@unlink($file);
}
}
}
public function update($adapter)
{
// Update add new confirm email field if not exists
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__sr_customfields'))
->where($db->quoteName('context') . ' = ' . $db->quote('com_solidres.customer'))
->order($db->quoteName('ordering') . ' ASC');
$db->setQuery($query);
$willUpdateFields = [];
$ordering = 0;
foreach ($db->loadObjectList() as $field)
{
if ($field->field_name === 'customer_email2')
{
$willUpdateFields = false;
break;
}
// Update ordering
$field->ordering = ++$ordering;
$willUpdateFields[] = $field;
if ($field->field_name === 'customer_email')
{
$confirmEmailField = clone $field;
$confirmEmailField->id = 0;
$confirmEmailField->title = 'Confirm Email';
$confirmEmailField->description = 'Confirm your email address.';
$confirmEmailField->field_name = 'customer_email2';
$confirmEmailField->ordering = ++$ordering;
$willUpdateFields[] = $confirmEmailField;
}
}
if (false !== $willUpdateFields)
{
foreach ($willUpdateFields as $willUpdateField)
{
if ($willUpdateField->id)
{
$db->updateObject('#__sr_customfields', $willUpdateField, 'id');
}
else
{
$db->insertObject('#__sr_customfields', $willUpdateField, 'id');
}
}
}
}
}