Exemplo n.º 1
0
 public function getFilesCount($path, $special = array())
 {
     $size = 0;
     if (!JFolder::exists($path)) {
         return $size;
     }
     $ignore = array('.', '..', 'cgi-bin', '.DS_Store', '.db', 'index.html', 'index.htm', 'menuList.php');
     $files = scandir($path);
     foreach ($files as $t) {
         $exclude = false;
         if (!empty($special)) {
             foreach ($special as $name) {
                 if (stripos($t, $name) !== FALSE) {
                     $exclude = true;
                 }
             }
         }
         if (in_array($t, $ignore) || $exclude) {
             continue;
         }
         if (is_dir(rtrim($path, '/') . '/' . $t)) {
             $size += $this->getFilesCount(rtrim($path, '/') . '/' . $t);
         } else {
             $size++;
         }
     }
     return $size;
 }
Exemplo n.º 2
0
 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     $plgTemplatesPath = version_compare(JVERSION, '1.6', 'ge') ? JPATH_SITE . '/plugins/content/jw_allvideos/jw_allvideos/tmpl' : JPATH_SITE . '/plugins/content/jw_allvideos/tmpl';
     $plgTemplatesFolders = JFolder::folders($plgTemplatesPath);
     $db = JFactory::getDBO();
     if (version_compare(JVERSION, '1.6', 'ge')) {
         $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";
     } else {
         $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
     }
     $db->setQuery($query);
     $template = $db->loadResult();
     $templatePath = JPATH_SITE . '/templates/' . $template . '/html/jw_allvideos';
     if (JFolder::exists($templatePath)) {
         $templateFolders = JFolder::folders($templatePath);
         $folders = @array_merge($templateFolders, $plgTemplatesFolders);
         $folders = @array_unique($folders);
     } else {
         $folders = $plgTemplatesFolders;
     }
     sort($folders);
     $options = array();
     foreach ($folders as $folder) {
         $options[] = JHTML::_('select.option', $folder, $folder);
     }
     $fieldName = version_compare(JVERSION, '1.6', 'ge') ? $name : $control_name . '[' . $name . ']';
     return JHTML::_('select.genericlist', $options, $fieldName, '', 'value', 'text', $value);
 }
Exemplo n.º 3
0
function checkFolderExist($folderLocation)
{
    if (JFolder::exists($folderLocation)) {
        return true;
    }
    return false;
}
Exemplo n.º 4
0
	public static function getExtensionVersion($c = 'phocadownload') {
		$folder = JPATH_ADMINISTRATOR .DS. 'components'.DS.'com_'.$c;
		if (JFolder::exists($folder)) {
			$xmlFilesInDir = JFolder::files($folder, '.xml$');
		} else {
			$folder = JPATH_SITE .DS. 'components'.DS.'com_'.$c;
			if (JFolder::exists($folder)) {
				$xmlFilesInDir = JFolder::files($folder, '.xml$');
			} else {
				$xmlFilesInDir = null;
			}
		}

		$xml_items = '';
		if (count($xmlFilesInDir))
		{
			foreach ($xmlFilesInDir as $xmlfile)
			{
				if ($data = JApplicationHelper::parseXMLInstallFile($folder.DS.$xmlfile)) {
					foreach($data as $key => $value) {
						$xml_items[$key] = $value;
					}
				}
			}
		}
		
		if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
			return $xml_items['version'];
		} else {
			return '';
		}
	}
Exemplo n.º 5
0
 function getStyles()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     wfimport('admin.helpers.extension');
     $view = JRequest::getCmd('view', 'cpanel');
     $component = WFExtensionHelper::getComponent();
     $params = new WFParameter($component->params);
     $theme = $params->get('preferences.theme', 'jce');
     $site_path = JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'libraries' . DS . 'css';
     $admin_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'media' . DS . 'css';
     // Load styles
     $styles = array();
     if (!JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) {
         $theme = 'jce';
     }
     if (JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) {
         $files = JFolder::files($site_path . DS . 'jquery' . DS . $theme, '\\.css');
         foreach ($files as $file) {
             $styles[] = 'components/com_jce/editor/libraries/css/jquery/' . $theme . '/' . $file;
         }
     }
     // admin global css
     $styles = array_merge($styles, array('administrator/components/com_jce/media/css/global.css'));
     if (JFile::exists($admin_path . DS . $view . '.css')) {
         $styles[] = 'administrator/components/com_jce/media/css/' . $view . '.css';
     }
     return $styles;
 }
Exemplo n.º 6
0
 function preflight($type, $parent)
 {
     // Get the extension ID
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('extension_id')->from('#__extensions')->where($db->qn('element') . ' = ' . $db->q('com_eventgallery'));
     $db->setQuery($query);
     $eid = $db->loadResult();
     if ($eid != null) {
         // Get the schema version
         $query = $db->getQuery(true);
         $query->select('version_id')->from('#__schemas')->where('extension_id = ' . $eid);
         $db->setQuery($query);
         $version = $db->loadResult();
         if (version_compare($version, '3.3.2', 'gt')) {
             $msg = "<p>Downgrades are not supported. Please install the same or a newer version.</p>";
             JError::raiseWarning(100, $msg);
             return false;
         }
     }
     $folders = array(JPATH_ROOT . '/administrator/components/com_eventgallery/controllers', JPATH_ROOT . '/administrator/components/com_eventgallery/media', JPATH_ROOT . '/administrator/components/com_eventgallery/models', JPATH_ROOT . '/administrator/components/com_eventgallery/views', JPATH_ROOT . '/administrator/components/com_eventgallery/sql', JPATH_ROOT . '/components/com_eventgallery/controllers', JPATH_ROOT . '/components/com_eventgallery/helpers', JPATH_ROOT . '/components/com_eventgallery/language', JPATH_ROOT . '/components/com_eventgallery/library', JPATH_ROOT . '/components/com_eventgallery/media', JPATH_ROOT . '/components/com_eventgallery/models', JPATH_ROOT . '/components/com_eventgallery/tests', JPATH_ROOT . '/components/com_eventgallery/views');
     $files = array(JPATH_ROOT . '/language/en-GB/en-GB.com_eventgallery.ini', JPATH_ROOT . '/language/de-DE/de-DE.com_eventgallery.ini', JPATH_ROOT . '/administrator/language/en-GB/en-GB.com_eventgallery.ini', JPATH_ROOT . '/administrator/language/en-GB/en-GB.com_eventgallery.sys.ini');
     foreach ($folders as $folder) {
         if (JFolder::exists($folder)) {
             JFolder::delete($folder);
         }
     }
     foreach ($files as $file) {
         if (JFolder::exists($file)) {
             JFolder::delete($file);
         }
     }
     $this->_copyCliFiles($parent);
 }
function ja_sys_get_temp_dir()
{
    // Try to get from environment variable
    if (defined('JPATH_ROOT') && JFolder::exists(JPATH_ROOT . DS . 'tmp' . DS)) {
        return JPATH_ROOT . DS . 'tmp' . DS;
    } elseif (!empty($_ENV['TMPDIR'])) {
        return realpath($_ENV['TMPDIR']);
    } elseif (!empty($_ENV['TEMP'])) {
        return realpath($_ENV['TEMP']);
    } elseif (!empty($_ENV['TMP'])) {
        return realpath($_ENV['TMP']);
    } elseif (function_exists('sys_get_temp_dir')) {
        return sys_get_temp_dir();
    } else {
        // Try to use system's temporary directory
        // as random name shouldn't exist
        //thanhnv: dont use function jaTempnam
        //because it maybe a reason for endless loop call
        //if this function and jaTempnam return false too
        $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
        if ($temp_file) {
            $temp_dir = realpath(dirname($temp_file));
            JFile::delete($temp_file);
            return $temp_dir;
        } else {
            return null;
        }
    }
}
Exemplo n.º 8
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     $componentPath = JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates';
     $componentFolders = JFolder::folders($componentPath);
     $db =& JFactory::getDBO();
     $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
     $db->setQuery($query);
     $defaultemplate = $db->loadResult();
     if (JFolder::exists(JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'com_k2' . DS . 'templates')) {
         $templatePath = JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'com_k2' . DS . 'templates';
     } else {
         $templatePath = JPATH_SITE . DS . 'templates' . DS . $defaultemplate . DS . 'html' . DS . 'com_k2';
     }
     if (JFolder::exists($templatePath)) {
         $templateFolders = JFolder::folders($templatePath);
         $folders = @array_merge($templateFolders, $componentFolders);
         $folders = @array_unique($folders);
     } else {
         $folders = $componentFolders;
     }
     $exclude = 'default';
     $options = array();
     foreach ($folders as $folder) {
         if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
             continue;
         }
         $options[] = JHTML::_('select.option', $folder, $folder);
     }
     array_unshift($options, JHTML::_('select.option', '', '-- ' . JText::_('Use default') . ' --'));
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
Exemplo n.º 9
0
 public function getInput()
 {
     $this->_templates = JPATH_ROOT . DS . 'modules' . DS . 'mod_rokfeaturetable' . DS . 'templates';
     $this->_jtemplate = $this->_getCurrentTemplatePath();
     $output = "";
     jimport('joomla.filesystem.file');
     if (JFolder::exists($this->_templates)) {
         $files = JFolder::files($this->_templates, "\\.txt", true, true);
         if (JFolder::exists($this->_jtemplate)) {
             $jfiles = JFolder::files($this->_jtemplate, "\\.txt", true, true);
             if (count($jfiles)) {
                 $this->merge($files, $jfiles);
             }
         }
         if (count($files)) {
             $output = "<select id='templates'>\n";
             $output .= "<option value='_select_' class='disabled' selected='selected'>Select a Template</option>";
             foreach ($files as $file) {
                 $title = JFile::stripExt(JFile::getName($file));
                 $title = str_replace("-", " ", str_replace("_", " ", $title));
                 $title = ucwords($title);
                 $output .= "<option value='" . JFile::read($file) . "'>" . $title . "</option>";
             }
             $output .= "</select>\n";
             $output .= "<span id='import-button' class='action-import'><span>import</span></span>\n";
         }
     } else {
         $output = "Templates folder was not found.";
     }
     return $output;
 }
Exemplo n.º 10
0
 public function createInitialDirectories()
 {
     if (!JFolder::exists($this->gallery->getPhotosPath())) {
         // TODO error handling
         JFolder::create($this->gallery->getPhotosPath());
     }
 }
Exemplo n.º 11
0
 public function emptyFolder($dir, $removeDir = false)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     if (JFolder::exists($dir)) {
         $it = new RecursiveDirectoryIterator($dir);
         $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($it as $file) {
             if ('.' === $file->getBasename() || '..' === $file->getBasename()) {
                 continue;
             }
             if ($file->isDir()) {
                 JFolder::delete($file->getPathname());
             } else {
                 if ($file->getBasename() !== 'index.html') {
                     JFile::delete($file->getPathname());
                 }
             }
         }
         if ($removeDir) {
             if (JFolder::delete($dir)) {
                 return true;
             }
         } else {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 12
0
 public function loadFromUrl($url, $overwrite = false, $tempFolder = null)
 {
     if (is_null($tempFolder)) {
         $tempFolder = JPATH_ROOT . '/tmp/crex/media';
     }
     if (!JFolder::exists($tempFolder)) {
         JFolder::create($tempFolder);
     }
     $fileExtension = JFile::getExt($url);
     $filePath = $tempFolder . '/' . md5($url) . '.' . $fileExtension;
     if (!JFile::exists($filePath) || $overwrite == true) {
         $fileHandeler = fopen($filePath, 'w+');
         $curlHandeler = curl_init(str_replace(" ", "%20", $url));
         curl_setopt($curlHandeler, CURLOPT_TIMEOUT, 50);
         curl_setopt($curlHandeler, CURLOPT_FILE, $fileHandeler);
         curl_setopt($curlHandeler, CURLOPT_FOLLOWLOCATION, true);
         curl_exec($curlHandeler);
         curl_close($curlHandeler);
         fclose($fileHandeler);
     }
     if (JFile::exists($filePath)) {
         $this->loadFile($filePath);
     } else {
         $this->setError(JText::_('CREX_ERROR_FILE_NOT_FOUND'));
     }
     return $this;
 }
Exemplo n.º 13
0
 public static function recreateCacheFolder($joomla_caching = 0, $params)
 {
     if (!class_exists('JFile')) {
         jimport('joomla.filesystem.file');
     }
     if (!class_exists('JFolder')) {
         jimport('joomla.filesystem.folder');
     }
     if (!is_object($params)) {
         return false;
     }
     $app = JFactory::getApplication();
     $cache_folder = self::getCacheFolder($params);
     if (!JFolder::exists($cache_folder)) {
         JFolder::create($cache_folder);
     }
     if ($joomla_caching) {
         return $cache_folder;
     }
     //else
     $cached_time = intval($params->get('script_default_cached_time', 0));
     $time = time();
     $cached_time_limit = intval($time) + intval($params->get('cache_time', 0));
     if ($cached_time == 0 || $time > $cached_time) {
         $nome_barrajs = self::getCacheFileName($params);
         @unlink($cache_folder . '/' . $nome_barrajs);
         self::setCachedTime($cached_time_limit, $cached_time);
     }
     return $cache_folder;
 }
Exemplo n.º 14
0
 function update($parent)
 {
     //echo '<p>' . JText::sprintf('COM_PHOCAGALLERY_UPDATE_TEXT', $parent->get('manifest')->version) . '</p>';
     $folder[0][0] = 'images' . DS . 'phocagallery' . DS;
     $folder[0][1] = JPATH_ROOT . DS . $folder[0][0];
     $folder[1][0] = 'images' . DS . 'phocagallery' . DS . 'avatars' . DS;
     $folder[1][1] = JPATH_ROOT . DS . $folder[1][0];
     $message = '';
     $error = array();
     foreach ($folder as $key => $value) {
         if (!JFolder::exists($value[1])) {
             if (JFolder::create($value[1], 0755)) {
                 $data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
                 JFile::write($value[1] . DS . "index.html", $data);
                 $message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0] . ' <span style="color:#009933">created!</span></b></div>';
                 $error[] = 0;
             } else {
                 $message .= '<div><b><span style="color:#CC0033">Folder</span> ' . $value[0] . ' <span style="color:#CC0033">creation failed!</span></b> Please create it manually.</div>';
                 $error[] = 1;
             }
         } else {
             $message .= '<div><b><span style="color:#009933">Folder</span> ' . $value[0] . ' <span style="color:#009933">exists!</span></b></div>';
             $error[] = 0;
         }
     }
     $msg = JText::_('COM_PHOCAGALLERY_UPDATE_TEXT');
     $msg .= ' (' . JText::_('COM_PHOCAGALLERY_VERSION') . ': ' . $parent->get('manifest')->version . ')';
     $msg .= '<br />' . $message;
     $app = JFactory::getApplication();
     $app->enqueueMessage($msg);
     $app->redirect(JRoute::_('index.php?option=com_phocagallery'));
 }
 /**
  * @param string                     $type
  * @param JInstallerAdapterComponent $parent
  *
  * @return bool
  */
 public function preFlight($type, $parent)
 {
     parent::preFlight($type, $parent);
     /* Uninstall the depracated plugin OSCARootCertificates.
      * The parent method can't be used because the old plugin
      * has a bug that doesn't allow to use the native uninstall method.
      */
     jimport('joomla.filesystem.folder');
     $success = false;
     // Remove the files
     $path = JPATH_SITE . '/plugins/system/oscarootcertificates';
     if (JFolder::exists($path)) {
         $success = JFolder::delete($path);
     }
     // Remove the database row
     $db = JFactory::getDbo();
     $queryWhere = array($db->qn('type') . ' = ' . $db->q('plugin'), $db->qn('element') . ' = ' . $db->q('oscarootcertificates'), $db->qn('folder') . ' = ' . $db->q('system'));
     $query = $db->getQuery(true)->select('COUNT(*)')->from('#__extensions')->where($queryWhere);
     $db->setQuery($query);
     if ((int) $db->loadResult() > 0) {
         $query = $db->getQuery(true)->delete('#__extensions')->where($queryWhere);
         $db->setQuery($query);
         $success = $db->execute();
     }
     // Displays the success message
     if ((bool) $success) {
         $this->setMessage('Uninstalling system plugin OSCARootCertificates was successful');
     }
     return true;
 }
Exemplo n.º 16
0
 /**
  * unzip the file
  * @return bool
  */
 public function unzip()
 {
     JRequest::checkToken() or die('Invalid Token');
     $appl = JFactory::getApplication();
     // if folder doesn't exist - create it!
     if (!JFolder::exists($this->pathUnzipped)) {
         JFolder::create($this->pathUnzipped);
     } else {
         // let us remove all previous unzipped files
         $folders = JFolder::folders($this->pathUnzipped);
         foreach ($folders as $folder) {
             JFolder::delete($this->pathUnzipped . '/' . $folder);
         }
     }
     $file = JFolder::files($this->pathArchive);
     $result = JArchive::extract($this->pathArchive . '/' . $file[0], $this->pathUnzipped . '/' . $file[0]);
     if ($result) {
         // scan unzipped folders if we find zip file -> unzip them as well
         $this->unzipAll($this->pathUnzipped . '/' . $file[0]);
         $message = 'COM_JEDCHECKER_UNZIP_SUCCESS';
     } else {
         $message = 'COM_JEDCHECKER_UNZIP_FAILED';
     }
     $appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message));
     return $result;
 }
Exemplo n.º 17
0
function com_install()
{
    $mainframe = JFactory::getApplication();
    jimport('joomla.filesystem.folder');
    // Initialize variables
    jimport('joomla.client.helper');
    $FTPOptions = JClientHelper::getCredentials('ftp');
    $language = JFactory::getLanguage();
    $language->load('com_jce_imgmanager_ext', JPATH_SITE);
    $cache = $mainframe->getCfg('tmp_path');
    // Check for tmp folder
    if (!JFolder::exists($cache)) {
        // Create if does not exist
        if (!JFolder::create($cache)) {
            $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error');
        }
    }
    // Check if folder exists and is writable or the FTP layer is enabled
    if (JFolder::exists($cache) && (is_writable($cache) || $FTPOptions['enabled'] == 1)) {
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_CACHE_DESC'));
    } else {
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error');
    }
    // Check for GD
    if (!function_exists('gd_info')) {
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_GD_DESC'), 'error');
    } else {
        $info = gd_info();
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_GD_DESC') . ' - ' . $info['GD Version']);
    }
    // remove wideimage folder
    if (JFolder::exists(dirname(__FILE) . '/classes/wideimage')) {
        @JFolder::delete(dirname(__FILE) . '/classes/wideimage');
    }
}
Exemplo n.º 18
0
 function __construct($options = array())
 {
     static $expiredCacheCleaned;
     $this->profile_db = JFactory::getDBO();
     $this->db = clone $this->profile_db;
     $this->_language = isset($options['language']) ? $options['language'] : 'en-GB';
     $this->_lifetime = isset($options['lifetime']) ? $options['lifetime'] : 60;
     $this->_now = isset($options['now']) ? $options['now'] : time();
     $config = JFactory::getConfig();
     $this->_hash = $config->get('config.secret');
     // if its not the first instance of the joomfish db cache then check if it should be cleaned and otherwise garbage collect
     if (!isset($expiredCacheCleaned)) {
         // check a file in the 'file' cache to check if we should remove all our db cache entries since cache manage doesn't handle anything other than file caches
         $conf = JFactory::getConfig();
         $cachebase = $conf->get('cache_path', JPATH_ROOT . DS . 'cache');
         $cachepath = $cachebase . DS . "falang-cache";
         if (!JFolder::exists($cachepath)) {
             JFolder::create($cachepath);
         }
         $cachefile = $cachepath . DS . "cachetest.txt";
         jimport("joomla.filesystem.file");
         if (!JFile::exists($cachefile) || JFile::read($cachefile) != "valid") {
             // clean out the whole cache
             $this->cleanCache();
             //sbou TODO uncomment write and solve problem
             JFile::write($cachefile, "valid");
         }
         $this->gc();
     }
     $expiredCacheCleaned = true;
 }
Exemplo n.º 19
0
 /**
  * Get Page JavaScript from either session or cached .js file
  *
  * @return string
  */
 public static function js()
 {
     $config = JFactory::getConfig();
     if ($config->get('caching') == 0) {
         $script = self::buildJs();
     } else {
         $uri = JURI::getInstance();
         $session = JFactory::getSession();
         $uri = $uri->toString(array('path', 'query'));
         $file = md5($uri) . '.js';
         $folder = JPATH_SITE . '/cache/com_fabrik/js/';
         if (!JFolder::exists($folder)) {
             JFolder::create($folder);
         }
         $cacheFile = $folder . $file;
         // Check for cached version
         if (!JFile::exists($cacheFile)) {
             $script = self::buildJs();
             file_put_contents($cacheFile, $script);
         } else {
             $script = JFile::read($cacheFile);
         }
     }
     self::clearJs();
     return $script;
 }
Exemplo n.º 20
0
 /**
  * Method is responsible to create a folder in the site.
  *
  * @access	public
  * @param	null
  */
 public function createFolder()
 {
     $ajax = EasyBlogHelper::getHelper('Ajax');
     // This is the relative path to the items that needs to be deleted.
     $path = JRequest::getVar('path');
     // This let's us know the type of folder we should lookup to
     $place = JRequest::getString('place');
     // @task: Create the media object.
     $media = new EasyBlogMediaManager();
     $absolutePath = EasyBlogMediaManager::getAbsolutePath($path, $place);
     if (JFolder::exists($absolutePath)) {
         return $ajax->fail(JText::_('COM_EASYBLOG_FOLDER_EXISTS'));
     }
     // @task: Let's create the folder
     JFolder::create($absolutePath);
     // @task: Let's copy a standard index.html to prevent any directory browsing here.
     $source = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'index.html';
     $destination = $absolutePath . DIRECTORY_SEPARATOR . 'index.html';
     JFile::copy($source, $destination);
     // @task: Get the absolute URI to the destination item.
     $uri = EasyBlogMediaManager::getAbsoluteURI($path, $place);
     // @task: Try to get the relative path of the "path" . Since the last fragment is always the folder that we're trying to create.
     $relative = dirname($path);
     $obj = $media->getItem($absolutePath, $uri, $relative, false, $place)->toArray();
     $ajax->success($obj);
 }
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     $mainframe =& JFactory::getApplication();
     $fieldName = version_compare(JVERSION, '1.6.0', 'ge') ? $name : $control_name . '[' . $name . ']';
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $pluginTemplatesPath = JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jw_ts' . DS . 'jw_ts' . DS . 'tmpl';
     } else {
         $pluginTemplatesPath = JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'jw_ts' . DS . 'tmpl';
     }
     $pluginTemplatesFolders = JFolder::folders($pluginTemplatesPath);
     $db =& JFactory::getDBO();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";
     } else {
         $query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
     }
     $db->setQuery($query);
     $template = $db->loadResult();
     $templatePath = JPATH_SITE . DS . 'templates' . DS . $template . DS . 'html' . DS . 'jw_ts';
     if (JFolder::exists($templatePath)) {
         $templateFolders = JFolder::folders($templatePath);
         $folders = @array_merge($templateFolders, $pluginTemplatesFolders);
         $folders = @array_unique($folders);
     } else {
         $folders = $pluginTemplatesFolders;
     }
     sort($folders);
     $options = array();
     foreach ($folders as $folder) {
         $options[] = JHTML::_('select.option', $folder, $folder);
     }
     return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value);
 }
Exemplo n.º 22
0
 function _getXMLInfos($info)
 {
     $folder = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jinc';
     if (JFolder::exists($folder)) {
         $xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
     } else {
         $folder = JPATH_SITE . DS . 'components' . DS . 'com_jinc';
         if (JFolder::exists($folder)) {
             $xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
         } else {
             $xmlFilesInDir = null;
         }
     }
     $xml_items = '';
     if (count($xmlFilesInDir)) {
         foreach ($xmlFilesInDir as $xmlfile) {
             if ($data = JApplicationHelper::parseXMLInstallFile($folder . DS . $xmlfile)) {
                 foreach ($data as $key => $value) {
                     $xml_items[$key] = $value;
                 }
             }
         }
     }
     if (isset($xml_items[$info]) && $xml_items[$info] != '') {
         return $xml_items[$info];
     } else {
         return '';
     }
 }
Exemplo n.º 23
0
 protected function getOptions()
 {
     // if VM is not installed
     if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_virtuemart') or !class_exists('ShopFunctions')) {
         // add the root item
         $option = new stdClass();
         $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_NOTFOUND');
         $option->value = '0';
         $options[] = $option;
         // Merge any additional options in the XML definition.
         $options = array_merge(parent::getOptions(), $options);
         return $options;
     }
     VmConfig::loadConfig();
     $categorylist = ShopFunctions::categoryListTree();
     // $categorylist = 'testced';
     $categorylist = trim($categorylist, '</option>');
     $categorylist = explode("</option><option", $categorylist);
     // add the root item
     $option = new stdClass();
     $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_ROOTNODE');
     $option->value = '0';
     $options[] = $option;
     foreach ($categorylist as $cat) {
         $option = new stdClass();
         $text = explode(">", $cat);
         $option->text = trim($text[1]);
         $option->value = strval(trim(trim(trim($text[0]), '"'), 'value="'));
         $options[] = $option;
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemplo n.º 24
0
 protected function getOptions()
 {
     // if the component is not installed
     if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_k2') or !JFile::exists(JPATH_ROOT . '/modules/mod_maximenuck/helper_k2.php')) {
         // add the root item
         $option = new stdClass();
         $option->text = JText::_('MOD_MAXIMENUCK_K2_NOTFOUND');
         $option->value = '0';
         $options[] = $option;
         // Merge any additional options in the XML definition.
         $options = array_merge(parent::getOptions(), $options);
         return $options;
     }
     // get the categories form the helper
     $params = new JRegistry();
     require_once JPATH_ROOT . '/modules/mod_maximenuck/helper_k2.php';
     $cats = modMaximenuckk2Helper::getItems($params);
     // add the root item
     $option = new stdClass();
     $option->text = JText::_('MOD_MAXIMENUCK_K2_ROOTNODE');
     $option->value = '0';
     $options[] = $option;
     foreach ($cats as $cat) {
         $option = new stdClass();
         $option->text = str_repeat(" - ", $cat->level - 1) . $cat->name;
         $option->value = $cat->id;
         $options[] = $option;
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemplo n.º 25
0
 public function getTemplates()
 {
     $items = array();
     $tpl_path = COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'templates';
     if (!JFolder::exists($tpl_path)) {
         return false;
     }
     if ($folders = JFolder::folders($tpl_path)) {
         if (count($folders)) {
             foreach ($folders as $i => $folder) {
                 $xmlFile = $tpl_path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . 'template.xml';
                 if (JFile::exists($xmlFile)) {
                     $installer = JInstaller::getInstance($tpl_path . DIRECTORY_SEPARATOR . $folder);
                     if ($manifest = $installer->isManifest($xmlFile)) {
                         $lang = JFactory::getLanguage();
                         $lang->load('tpl_' . (string) $manifest->name, $tpl_path . DIRECTORY_SEPARATOR . $folder);
                         $item = new stdClass();
                         $item->id = $i;
                         $item->name = (string) $manifest->name;
                         $item->type = (string) $manifest->type;
                         $item->version = (string) $manifest->version;
                         $item->creationDate = (string) $manifest->creationDate;
                         $item->author = (string) $manifest->author;
                         $item->authorEmail = (string) $manifest->authorEmail;
                         $item->description = JText::_((string) $manifest->description);
                         $items[] = $item;
                     }
                 }
             }
         }
     }
     return $items;
     //        var_dump(JFolder::folders($tpl_path)); die();
 }
Exemplo n.º 26
0
 private function createFolders()
 {
     $thumbFolder = JPATH_ROOT . '/images/ariimageslider';
     if (!JFolder::exists($thumbFolder)) {
         JFolder::create($thumbFolder);
     }
 }
Exemplo n.º 27
0
 /**
  * Load properties from a given file properties
  * 
  * @param $file string The filename to scan
  * @param $contents boolean Load the contents
  * @param $loadId boolean Load id from database
  * @return boolean result
  */
 function loadFromFile($file, $contents = false, $loadId = false)
 {
     if (!JFile::exists($file) && !JFolder::exists($file . DS)) {
         return false;
     }
     $info = @stat($file);
     $this->scandate = $this->_db->getNullDate();
     $this->filename = basename($file);
     $this->fullpath = $file;
     $this->permission = fileperms($file) & 0777;
     $this->size = filesize($file);
     $ctime =& JFactory::getDate($info['ctime']);
     $mtime =& JFactory::getDate($info['mtime']);
     $this->ctime = $ctime->toMySQL();
     $this->mtime = $mtime->toMySQL();
     $this->uid = $info['uid'];
     $this->gid = $info['gid'];
     $this->type = '';
     if (is_file($file)) {
         $this->type = 'file';
         $this->hash_md = md5_file($file);
         if ($contents) {
             $f = new JD_File($file);
             $this->contents = $f->read();
         }
     } elseif (is_dir($file)) {
         $this->type = 'dir';
     }
     if ($loadId) {
         $this->_db->setQuery('SELECT id FROM #__jdefender_filesystem WHERE fullpath = ' . $this->fullpath . ' LIMIT 1');
         $this->id = $this->_db->loadResult();
     }
     return true;
 }
Exemplo n.º 28
0
 function getComponents($frontend = 1, $admin = 1)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $query = $this->db->getQuery(true)->select('e.name, e.element')->from('#__extensions AS e')->where('e.type = ' . $this->db->quote('component'))->where('e.name != ""')->where('e.element != ""')->group('e.element')->order('e.element, e.name');
     $this->db->setQuery($query);
     $components = $this->db->loadObjectList();
     $comps = array();
     $lang = JFactory::getLanguage();
     foreach ($components as $i => $component) {
         // return if there is no main component folder
         if (!($frontend && JFolder::exists(JPATH_SITE . '/components/' . $component->element)) && !($admin && JFolder::exists(JPATH_ADMINISTRATOR . '/components/' . $component->element))) {
             continue;
         }
         // return if there is no views folder
         if (!($frontend && JFolder::exists(JPATH_SITE . '/components/' . $component->element . '/views')) && !($admin && JFolder::exists(JPATH_ADMINISTRATOR . '/components/' . $component->element . '/views'))) {
             continue;
         }
         if (!empty($component->element)) {
             // Load the core file then
             // Load extension-local file.
             $lang->load($component->element . '.sys', JPATH_BASE, null, false, false) || $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, null, false, false) || $lang->load($component->element . '.sys', JPATH_BASE, $lang->getDefault(), false, false) || $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, $lang->getDefault(), false, false);
         }
         $component->name = JText::_(strtoupper($component->name));
         $comps[preg_replace('#[^a-z0-9_]#i', '', $component->name . '_' . $component->element)] = $component;
     }
     ksort($comps);
     return $comps;
 }
Exemplo n.º 29
0
 public function install($path)
 {
     if ($path && JFolder::exists($path)) {
         $this->installer->setPath('source', $path);
     } else {
         $this->installer->abort(JText::_('JLIB_INSTALLER_ABORT_NOINSTALLPATH'));
         return false;
     }
     if (!$this->setupInstall()) {
         $this->installer->abort(JText::_('JLIB_INSTALLER_ABORT_DETECTMANIFEST'));
         return false;
     }
     // Load the adapter(s) for the install manifest
     $type = (string) $this->installer->manifest->attributes()->type;
     if ($type == 'extension') {
         $type = 'plugin';
     }
     if (is_object($this->_adapters[$type])) {
         // Add the languages from the package itself
         if (method_exists($this->_adapters[$type], 'loadLanguage')) {
             $this->_adapters[$type]->loadLanguage($path);
         }
         // Run the install
         $ret = $this->_adapters[$type]->install();
         $this->set('name', $this->installer->get('name'));
         $this->set('version', $this->installer->get('version'));
         $this->set('message', $this->installer->get('description'));
         $this->set('extension.message', $this->installer->get('extension.message'));
         return $ret;
     }
 }
Exemplo n.º 30
0
 public static function getAvailableSources($sourcedir)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $paths = self::getFrontsideTemplates();
     $paths[] = $sourcedir;
     foreach ($paths as $path) {
         RokMiniEvents::addSourcesPath($path);
     }
     $results = array();
     foreach ($paths as $source_path) {
         if (JFolder::exists($source_path)) {
             $source_files = JFolder::files($source_path);
             foreach ($source_files as $entry) {
                 $source_name = basename($entry, ".php");
                 $path = $source_path . DS . $source_name . '.php';
                 if (JFile::exists($path) && !array_key_exists($source_name, $results)) {
                     $sourceClass = self::CLASS_NAME_PREFIX . ucfirst($source_name);
                     $source = new $sourceClass();
                     if ($source->available()) {
                         $source_info = new stdClass();
                         $source_info->name = $source_name;
                         $source_info->source = $source;
                         $source_info->paramspath = $source_path . DS . $source_name . '.xml';
                         $results[$source_name] = $source_info;
                     }
                 }
             }
         }
     }
     return $results;
 }