File manager - Edit - /home/jardides/www/Jardi-design/old/administrator/components/com_templateck/install.templateck.php
Back
<?php /** * @name Template Creator CK 3 * @package com_templateck * @copyright Copyright (C) 2013. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr */ // no direct access defined('_JEXEC') or die('Restricted access'); class com_templateckInstallerScript { function update( $parent ) { // check the installed version $oldversion = $this->getParam('version'); if (version_compare($oldversion, '3.5.0') < 0) { $this->updateTable350(); } if (version_compare($oldversion, '3.4.4') >= 0) { //echo 'Update script loaded you have the last version'; return; } // this is an old version, then update the table $this->updateTable(); } /* * get a variable from the manifest file (actually, from the manifest cache). */ function getParam( $name ) { $db = JFactory::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 updateTable() { $db = JFactory::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->query()) { 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->query()) { 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 updateTable350() { $db = JFactory::getDbo(); // test if the columns not exists $query = "SHOW COLUMNS FROM #__templateck_templates LIKE 'widgets'"; $db->setQuery($query); if ($db->query()) { 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->query()) { 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; } // $db->setQuery('CREATE TABLE IF NOT EXISTS `#__templateck_mobile` ( // `id` int(11) NOT NULL AUTO_INCREMENT, // `resolution1` longtext NOT NULL, // `resolution2` longtext NOT NULL, // `resolution3` longtext NOT NULL, // `resolution4` longtext NOT NULL, // `templateid` int(11) NOT NULL, // PRIMARY KEY (`id`) // ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); // if (!$db->query()) { // echo '<p>Error during table templateck_mobile creation process !</p>'; // } else { // echo '<p>Table templateck_mobile created !</p>'; // } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings