File manager - Edit - /home/jardides/www/Jardi-design/old/administrator/components/com_pagebuilderck/pro/includes/importelement.php
Back
<?php /** * @name Page Builder CK * @package com_pagebuilderck * @copyright Copyright (C) 2015. 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; use Pagebuilderck\CKFof; jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); class PagebuilderckParamsImportelement { private $_doc; private $_app; private $_input; public function __construct() { $this->_doc = JFactory::getDocument(); $this->_app = JFactory::getApplication(); $this->_input = $this->_app->input; PagebuilderckHelper::loadCkbox(); } /** * Load the html code for the */ public function loadImportForm() { // modal popup for import ?> <div id="ckImportModal" class="" style="position:relative;display:none;"> <div style="padding: 10px;"> <div class="ckImportModalContent"> <div class="" id=""> <div class=""><h1><?php echo JText::_('CK_IMPORT'); ?></h1></div> <form id="importPage" method="post" enctype="multipart/form-data"> <div> <fieldset> <table class="table table-striped"> <tr> <td width="110" class="key"> <label for="title"> <?php echo JText::_('CK_CHOOSE_FILE_PBCK'); ?>: </label> </td> <td> <input class="inputbox" type="file" name="file" id="file" size="60" /> <input type="submit" name="submitfile" class="inputbox btn btn-primary" value="<?php echo JText::_('CK_INSTALL'); ?>" /> </td> </tr> </table> </fieldset> </div> <?php echo JHtml::_('form.token'); ?> <input type="hidden" name="task" value="elements.import" /> </form> </div> </div> </div> </div> <?php } /** * Import the file .pbck into the database */ public function importFile() { $file = $this->_input->files->get('file', '', 'array'); if (!is_array($file)) return false; $filename = JFile::makeSafe($file['name']); // check if the file exists if (JFile::getExt($filename) != 'pbck') { $msg = JText::_('CK_NOT_PBCK_FILE'); $this->_app->redirect('index.php?option=com_pagebuilderck&view=elements', $msg, 'error'); return false; } //Set up the source and destination of the file $src = $file['tmp_name']; // check if the file exists if (!$src || !file_exists($src)) { $msg = JText::_('CK_FILE_NOT_EXISTS'); $app->redirect('index.php?option=com_pagebuilderck&view=elements', $msg, 'error'); return false; } // read the file if (!$filecontent = file_get_contents($src)) { $msg = JText::_('CK_UNABLE_READ_FILE'); $app->redirect('index.php?option=com_pagebuilderck&view=elements', $msg, 'error'); return false; } // replace vars to allow data to be moved from another server $filecontent = str_replace("|URIROOT|", JUri::root(true), $filecontent); $filecontent = str_replace("|PBCK_COMPONENT|", "components/com_pagebuilderck", $filecontent); $filecontent = str_replace("|PBCK_ADMIN_COMPONENT|", "administrator/components/com_pagebuilderck", $filecontent); $gabarit = json_decode($filecontent); if ($gabarit === null) return false; $gabarit->id = '0'; // set id to 0 to automatically increment value in database $gabarit->htmlcode = str_replace("|IMPORTFOLDER|", "images/" . $gabarit->title, $gabarit->htmlcode); $gabarit->htmlcode = stripslashes($gabarit->htmlcode); $gabarit->params = json_encode($gabarit->params); $pageid = CKFof::dbStore('#__pagebuilderck_elements', $gabarit); $msg = JText::_('CK_IMPORT_SUCCESS'); $this->_app->redirect('index.php?option=com_pagebuilderck&view=elements', $msg, 'message'); return true; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings