| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/saint-martin-lg/administrator/components/com_templateck/ |
Upload File : |
<?php
/**
* @name Template Creator CK
* @copyright Copyright (C) since 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Language\Text;
if (version_compare(JVERSION, 6, '>=')) {
return new class () implements InstallerScriptInterface {
// private string $minimumJoomla = '4.4.0';
// private string $minimumPhp = '7.4.0';
public function install(InstallerAdapter $adapter): bool
{
// not used
return true;
}
public function update(InstallerAdapter $adapter): bool
{
return CK_installer_update($adapter);
}
public function uninstall(InstallerAdapter $adapter): bool
{
// not used
return true;
}
public function preflight(string $type, InstallerAdapter $adapter): bool
{
return CK_installer_preflight($type, $adapter);
// if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) {
// Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_PHP'), $this->minimumPhp), 'error');
// return false;
// }
// if (version_compare(JVERSION, $this->minimumJoomla, '<')) {
// Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_JOOMLA'), $this->minimumJoomla), 'error');
// return false;
// }
// return true;
}
public function postflight(string $type, InstallerAdapter $adapter): bool
{
return CK_installer_postflight($type, $adapter);
}
};
} else {
class com_templateckInstallerScript {
function install($parent) {
// not used
return true;
}
function update($parent) {
return CK_installer_update($parent);
}
function uninstall($parent) {
// not used
return true;
}
function preflight($type, $parent) {
return CK_installer_preflight($type, $parent);
}
// run on install and update
function postflight($type, $parent) {
jimport('joomla.installer.installer');
return CK_installer_postflight($type, $parent);
}
}
}
function CK_installer_preflight() {
// disable the install on Joomla 3 since 3.2.0
if (version_compare(JVERSION, '4', '<')) {
throw new RuntimeException('This version of Template Creator CK can not be installed on Joomla 3. Please use the version 5.5.1.');
}
$db = \Joomla\CMS\Factory::getDbo();
$tablesList = $db->getTableList();
$tableExists = in_array($db->getPrefix() . 'templateck_templates', $tablesList);
if ($tableExists) {
CK_installer_updateTable350();
CK_installer_updateTable399();
CK_installer_updateTable400();
}
return true;
}
function CK_installer_postflight() {
?>
<style>
.aboutversion {
margin: 10px;
padding: 10px;
font-size: 20px;
font-color: #000;
}
.ckabout {
background: url("https://media.joomlack.fr/images/texture/texture_003.jpg") center center repeat;
background-size: auto auto;
color: #fff;
font-family: verdana;
font-size: 13px;
border-radius: 5px;
box-shadow: #111 0 0 5px;
background-size: cover;
position: relative;
overflow: hidden;
text-align: center;
}
.ckabout > .inner {
padding: 20px;
background: rgba(40,40,40,0.7);
}
.ckabout > .inner > *{
padding: 10px;
}
.ckabout > .inner br {
margin: 10px;
display: block;
}
.ckabout a {
color: orange;
}
</style>
<div class="ckabout">
<div class="inner">
<div class="ckcenter"><img src="/administrator/components/com_templateck/images/logo_templateck.png" /></div>
<p class="ckcenter"><a href="https://www.template-creator.com" target="_blank">https://www.template-creator.com</a></p>
<p class="ckcenter"><?php echo Text::_('CK_TEMPLATECK_DESC2'); ?></p>
</div>
</div>
<?php
return true;
}
function CK_installer_update( $parent ) {
// check the installed version
$oldversion = CK_installer_getParam('version');
if (version_compare($oldversion, '4.0.0') < 0) {
CK_installer_updateTable400();
}
if (version_compare($oldversion, '3.5.0') < 0) {
CK_installer_updateTable350();
}
if (version_compare($oldversion, '3.4.4') >= 0) {
//echo 'Update script loaded you have the last version';
return true;
}
// this is an old version, then update the table
CK_installer_updateTable();
return true;
}
/*
* get a variable from the manifest file (actually, from the manifest cache).
*/
function CK_installer_getParam( $name ) {
$db = \Joomla\CMS\Factory::getDbo();
$db->setQuery('SELECT manifest_cache FROM #__extensions WHERE element = "com_templateck"');
$manifest = json_decode( $db->loadResult(), true );
return $manifest[ $name ];
}
/*
* update the table
*/
function CK_installer_updateTable() {
$db = \Joomla\CMS\Factory::getDbo();
// test for order column title depending on virtuemart version
// test if the columns not exists
$query = "SHOW COLUMNS FROM #__templateck_fonts LIKE 'additional_fonts'";
$db->setQuery($query);
if ($db->execute()) {
if ( $db->loadResult()) {
//echo 'existe deja!';return;
} else {
// add the SQL field to the main table
$db->setQuery('ALTER TABLE `#__templateck_fonts` ADD `additional_fonts` text NOT NULL;');
if (!$db->execute()) {
echo '<p class="alert alert-danger">Error during table templateck update process !</p>';
} else {
echo '<p class="alert alert-success">Table templateck_fonts updated !</p>';
}
}
} else {
echo 'Erreur de données SQL - Test si champ responsive existe';
return false;
}
}
/*
* update the table
*/
function CK_installer_updateTable350() {
$db = \Joomla\CMS\Factory::getDbo();
// test if the columns not exists
$query = "SHOW COLUMNS FROM #__templateck_templates LIKE 'widgets'";
$db->setQuery($query);
if ($db->execute()) {
if ( $db->loadResult()) {
//echo 'existe deja!';return;
} else {
// add the SQL field to the main table
$db->setQuery('ALTER TABLE `#__templateck_templates` ADD `widgets` text NOT NULL;');
if (!$db->execute()) {
echo '<p class="alert alert-danger">Error during table widgets update process !</p>';
} else {
echo '<p class="alert alert-success">Table widgets updated !</p>';
}
}
} else {
echo 'SQL error - Check existing widgets column';
return false;
}
}
/*
* update the table
*/
function CK_installer_updateTable399() {
$db = \Joomla\CMS\Factory::getDbo();
// test if the columns not exists
$query = "SHOW COLUMNS FROM #__templateck_templates LIKE 'modules'";
$db->setQuery($query);
if ($db->execute()) {
if ( $db->loadResult()) {
//echo 'existe deja!';return;
} else {
// add the SQL field to the main table
$db->setQuery('ALTER TABLE `#__templateck_templates` ADD `modules` text NOT NULL;');
if (!$db->execute()) {
echo '<p class="alert alert-danger">Error during table modules update process !</p>';
} else {
echo '<p class="alert alert-success">Table modules updated !</p>';
}
}
} else {
echo 'SQL error - Check existing modules column';
return false;
}
}
function CK_installer_updateTable400() {
$db = \Joomla\CMS\Factory::getDbo();
// test if the columns not exists
$query = "SHOW COLUMNS FROM #__templateck_templates LIKE 'stylecode'";
$db->setQuery($query);
if ($db->execute()) {
if ( $db->loadResult()) {
//echo 'existe deja!';return;
} else {
// add the SQL field to the main table
$db->setQuery('ALTER TABLE `#__templateck_templates` ADD `stylecode` longtext NOT NULL;');
if (!$db->execute()) {
echo '<p class="alert alert-danger">Error during table stylecode update process !</p>';
} else {
echo '<p class="alert alert-success">Table stylecode updated !</p>';
}
}
} else {
// echo 'SQL error - Check existing stylecode column';
// return false;
}
$sql = "CREATE TABLE IF NOT EXISTS `#__templateck_layouts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`template_id` int(11) NOT NULL,
`type` text NOT NULL,
`htmlcode` longtext NOT NULL,
`styles` text NOT NULL,
`published` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
);";
$db->setQuery($query);
if ($db->execute()) {
echo '<p class="alert alert-success">Table layouts created !</p>';
} else {
echo '<p class="alert alert-danger">Error during table layouts creation process !</p>';
}
}