File manager - Edit - /home/jardides/www/Jardi-design/administrator/components/com_templateck/views/template/tmpl/ajaxarchive.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 to this file defined('_JEXEC') or die('Restricted access'); jimport('joomla.filesystem.file'); $app = JFactory::getApplication(); $input = $app->input; $templatename = $input->get('templatename'); $saveintemplate = $input->get('saveintemplate') == 'copy' ? true : false; $path = JPATH_ROOT . '/components/com_templateck/projects/' . $templatename; if ($saveintemplate == true) { $defaulttemplatesrc = JPATH_ROOT . '/components/com_templateck/projects/' . $templatename; $defaulttemplatedest = JPATH_ROOT . '/templates/' . $templatename; // check if template aldready intalled if (!JFolder::exists($defaulttemplatedest)) { $msg = '<p class="errorck">' . JText::_('CK_ERROR_TEMPLATECOPY_TEMPLATENOTINSTALLED') . '</p>'; echo $msg; } else { /*if (!JFolder::delete($defaulttemplatedest)) { $msg = '<p class="errorck">' . JText::_('CK_ERROR_DELETING_TEMPLATE_FOLDER') . '</p>'; } else { $msg = '<p class="successck">' . JText::_('CK_SUCCESS_DELETING_TEMPLATE_FOLDER') . '</p>'; } echo $msg;*/ // make that the path are written the same $defaulttemplatesrc = str_replace('\\', '/', $defaulttemplatesrc); // crée les dossiers manquants $folderstocopy = JFolder::folders($defaulttemplatesrc, '.', true, true); foreach ($folderstocopy as $foldertocopy) { $foldertocopy = str_replace('\\', '/', $foldertocopy); $foldername = str_replace($defaulttemplatesrc, '', $foldertocopy); $folderdest = $defaulttemplatedest . $foldername; if (!JFolder::exists($folderdest)) { JFolder::create($folderdest); } } // copie tous les fichiers $filestocopy = JFolder::files($defaulttemplatesrc, '.', true, true); $success_copy = true; foreach ($filestocopy as $filetocopy) { // make that the path are written the same // $defaulttemplatesrc = str_replace('\\', '/', $defaulttemplatesrc); $filetocopy = str_replace('\\', '/', $filetocopy); $filename = str_replace($defaulttemplatesrc, '', $filetocopy); $filedest = $defaulttemplatedest . $filename; if (!JFile::copy($filetocopy, $filedest)) { $msg2 = '<p class="errorck">' . JText::_('CK_ERROR_CREATING_TEMPLATECOPY') . ' : ' . $filename . '</p>'; clearstatcache(null, $filedest); // check if the file permissions can be read if (file_exists($filedest) && @fileperms($filedest)) { $fileperms = fileperms($filedest); $filerights = decoct( $fileperms & 0777 ); if ((int)$filerights < 644) { // change the file permissions if (chmod($filedest,0644)) { $msg2 .= '<p class="errorck" style="font-weight:bold;color: orange;">' . JText::_('CK_FILE_RIGHTS_CHANGED_TO') . ' : 0644</p>'; if (JFile::copy($filetocopy, $filedest)) { $msg2 .= '<p class="successck" style="font-weight:bold;">Second try : ' . JText::_('CK_SUCCESS_CREATING_TEMPLATECOPY') . ' : ' . $filename . '</p>'; } else { $msg2 .= '<p class="errorck">Second try : ' . JText::_('CK_ERROR_CREATING_TEMPLATECOPY') . ' : ' . $filename . '</p>'; $success_copy = false; } } else { $msg2 .= '<p class="errorck">Second try : ' . JText::_('CK_ERROR_CHMODING_FILE') . ' : ' . $filename . '</p>'; $success_copy = false; } } } else { $msg2 .= '<p class="errorck">Second try : ' . JText::_('CK_ERROR_CHECKING_FILEPERMS') . ' : ' . $filename . '</p>'; $success_copy = false; } echo $msg2; } //else { // $msg = '<p class="successck" style="Font-size:14px;font-weight:bold;">' . JText::_('CK_SUCCESS_CREATING_TEMPLATECOPY') . '</p>'; // } } // echo $msg; if ($success_copy) { echo '<p styles="padding:15px"><a class="ckpreview ckbuttonstyle" href="' . JUri::root(true) . '/" target="_blank">' . JText::_('CK_VIEW_WEBSITE') . '</a></p>'; echo '<p class="badgeck successck" style="">' . JText::_('CK_SUCCESS_CREATING_TEMPLATECOPY') . '</p>'; } else { echo '<p class="badgeck errorck" style="">' . JText::_('CK_ERROR_CREATING_TEMPLATECOPY') . '</p>'; } // save the logo settings } } else { $files = JFolder::files($path, false, true, true); $exporter = new ZipArchiver(); $isSuccess = $exporter->create($files, '.zip', $path, true); // return message after creating the zip archive if (!$isSuccess && $exporter->getError()) { $msg = '<p class="errorck">' . JText::_('CK_ERROR_CREATING_ARCHIVE') . '</p>'; } else { $msg = '<p class="successck">' . JText::_('CK_SUCCESS_CREATING_ARCHIVE') . '</p>'; } echo $msg; // create button to download the package echo '<p style="padding: 15px;"><a class="ckdownload ckbuttonstyle" href="' . JURI::root() . 'components/com_templateck/projects/' . $templatename . '.zip">' . JText::_('CK_DOWNLOAD_TEMPLATE') . '</a></p>'; }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings