Example #1
0
 protected function getInput()
 {
     $doc = JFactory::getDocument();
     JHtml::_('jquery.framework');
     $plg_path = JURI::root(true) . '/plugins/system/helix3';
     $doc->addScript($plg_path . '/assets/js/spimage.js');
     $doc->addStyleSheet($plg_path . '/assets/css/spimage.css');
     if ($this->value) {
         $class1 = ' hide';
         $class2 = '';
     } else {
         $class1 = '';
         $class2 = ' hide';
     }
     $output = '<div class="sp-image-field clearfix">';
     $output .= '<div class="sp-image-upload-wrapper">';
     if ($this->value) {
         $data_src = $this->value;
         $src = JURI::root(true) . '/' . $data_src;
         $basename = basename($data_src);
         $thumbnail = JPATH_ROOT . '/' . dirname($data_src) . '/' . JFile::stripExt($basename) . '_thumbnail.' . JFile::getExt($basename);
         if (file_exists($thumbnail)) {
             $src = JURI::root(true) . '/' . dirname($data_src) . '/' . JFile::stripExt($basename) . '_thumbnail.' . JFile::getExt($basename);
         }
         $output .= '<img src="' . $src . '" data-src="' . $data_src . '" alt="">';
     }
     $output .= '</div>';
     $output .= '<input type="file" class="sp-image-upload" accept="image/*" style="display:none;">';
     $output .= '<a class="btn btn-info btn-sp-image-upload' . $class1 . '" href="#"><i class="fa fa-plus"></i> Upload Image</a>';
     $output .= '<a class="btn btn-danger btn-sp-image-remove' . $class2 . '" href="#"><i class="fa fa-minus-circle"></i> Remove Image</a>';
     $output .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"  class="form-field-spimage">';
     $output .= '</div>';
     return $output;
 }
Example #2
0
	/**
	 * Method to get the field options.
	 *
	 * @return	array	The field option objects.
	 * @since	1.6
	 */
	protected function getOptions()
	{
		// Initialize variables.
		$lang = JFactory::getLanguage();
		$options = array();
		$type = $this->form instanceof JForm ? $this->form->getValue('db_type') : 'mysql';
		if ($type == 'mysqli') {
			$type='mysql';
		}
		// Get a list of files in the search path with the given filter.
		$files = JFolder::files(JPATH_INSTALLATION.'/sql/'.$type, '^sample.*\.sql$');

		// Build the options list from the list of files.
		if (is_array($files)) {
			foreach ($files as $file)
			{
				$options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_'.($file=JFile::stripExt($file)).'_SET')?JText::_($key):$file);
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
Example #3
0
    static function FileName2ClassName($prefix,$filename,$suffix) {

        jimport('joomla.filesystem.file');
        $class_name= $prefix.ucfirst(strtolower(preg_replace('/\s/','_', JFile::stripExt($filename)))).$suffix;

        return $class_name;
    }
Example #4
0
 /**
  * Load a manifest from an XML file
  *
  * @param	string	$xmlpath	Path to XML manifest file
  *
  * @return	boolean	Result of load
  * @since	1.6
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->packagename = (string) $xml->packagename;
         $this->update = (string) $xml->update;
         $this->authorurl = (string) $xml->authorUrl;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->description = (string) $xml->description;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->version = (string) $xml->version;
         if (isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 // NOTE: JExtension doesn't expect a string.
                 // DO NOT CAST $file
                 $this->filelist[] = new JExtension($file);
             }
         }
         return true;
     }
 }
Example #5
0
 /**
  * when in form or detailed view, do we want to show the full image or thumbnail/link?
  * @param object $params
  * @return bool
  */
 private function getThumbnail(&$model, &$params, $file)
 {
     if ($this->inTableView || $params->get('make_thumbnail') == '1' && $params->get('fu_show_image') == 1) {
         if (!$params->get('make_thumbnail', false)) {
             return false;
         } else {
             $thumb_url = $model->storage->_getThumb($file);
             $thumb_file = $model->storage->urlToPath($thumb_url);
             //$thumb_url_info = pathinfo($thumb_url);
             //$$$ rob php 5.1 doesnt have filename property in pathinfo so this wont work!
             /*if (strtolower($thumb_url_info['extension'] == 'pdf')) {
              		$thumb_url = $thumb_url_info['dirname'] . '/' . $thumb_url_info['filename'] . '.' . $this->pdf_thumb_type;
             		$thumb_file_info = pathinfo($thumb_file);
             		$thumb_file = $thumb_file_info['dirname'] . DS . $thumb_file_info['filename'] . '.' . $this->pdf_thumb_type;
              	}*/
             // all we need is to swap the file extension right? -Hugh?
             $ext = JFile::getExt($thumb_file);
             if (strtolower($ext) == 'pdf') {
                 $thumb_file = JFile::stripExt($thumb_file) . '.' . $this->pdf_thumb_type;
                 $thumb_url = JFile::stripExt($thumb_url) . '.' . $this->pdf_thumb_type;
             }
             if ($model->storage->exists($thumb_file)) {
                 return $thumb_url;
             } else {
                 $thumb_file = 'media/com_fabrik/images/pdf.png';
                 if (JFile::exists(COM_FABRIK_BASE . DS . $thumb_file)) {
                     return COM_FABRIK_LIVESITE . $thumb_file;
                 } else {
                     return false;
                 }
             }
         }
     }
     return false;
 }
Example #6
0
	function getExtensions($plugin){
		jimport('joomla.filesystem.folder');
		jimport('joomla.filesystem.file');
		
		$path 		= JCE_PLUGINS.DS.$plugin.DS.'extensions';
		$extensions = array();

		if (JFolder::exists($path)) {
			$types = JFolder::folders($path);
			
			foreach ($types as $type) {
				$files = JFolder::files($path.DS.$type, '\.xml$');
				foreach ($files as $file) {
					$object = new StdClass();
					$object->folder = $type;
					$name = JFile::stripExt($file);
					if (JFile::exists($path.DS.$type.DS.$name.'.php')) {
						$object->extension 	= $name;
						// Load xml file
						$xml =& JFactory::getXMLParser('Simple');
						if ($xml->loadFile($path.DS.$type.DS.$file)) {
							$root =& $xml->document;	
							$name = $root->getElementByPath('name');
							$object->name = $name->data();
						} else {
							$object->name = $name;
						}
						$extensions[] = $object;
					}
				}				
			}
		}
		return $extensions;
	}
Example #7
0
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = 'Failed to load XML File: ' . $xmlfile;
         return false;
     } else {
         $xml = $xml->document;
         $this->name = (string) $xml->name;
         $this->packagename = (string) $xml->packagename;
         $this->update = (string) $xml->update;
         $this->authorurl = (string) $xml->authorUrl;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->description = (string) $xml->description;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->version = (string) $xml->version;
         if (isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 $this->filelist[] = new JExtension((string) $file);
             }
         }
         return true;
     }
 }
Example #8
0
 function onPromoteList($uid)
 {
     if ($uid) {
         $user = JFactory::getUser($uid);
     } else {
         $user = JFactory::getUser();
     }
     jimport('joomla.filesystem.file');
     $db = JFactory::getDBO();
     $name = JFile::getName(__FILE__);
     $name = JFile::stripExt($name);
     //$name = $this->params->get('plugin_name');
     $sobichk = $this->_sobichk();
     if (!empty($sobichk)) {
         $query = "SELECT CONCAT_WS('|', '" . $name . "', s.itemid) as value, s.title as text FROM #__sobi2_item AS s\n\t\t\t\t\t\t\t\t LEFT JOIN #__users AS u ON  s.updating_user = u.id\n\t\t\t\t\t\t\t\t WHERE u.id=" . $user->id . "\n\t\t\t\t\t\t\t\t ORDER BY itemid";
         $db->setQuery($query);
         $itemlist = $db->loadObjectlist();
         if (empty($itemlist)) {
             $list[0]->value = $name . '|' . '0';
             $list[0]->text = JText::_("NO_SOBILIST");
             return $list;
         } else {
             return $itemlist;
         }
     }
 }
Example #9
0
 /**
  * Require the correct file from step
  *
  * @return  int	The total number
  *
  * @since   3.0.0
  */
 public static function requireClass($name, $xmlpath, $class)
 {
     if (!empty($name)) {
         // Loading the JFile class
         jimport('joomla.filesystem.file');
         $file_core = JPATH_COMPONENT_ADMINISTRATOR . "/includes/schemas/joomla15/{$name}.php";
         $file_checks = JPATH_COMPONENT_ADMINISTRATOR . "/includes/extensions/{$name}.php";
         // Require the file
         if (JFile::exists($file_core)) {
             JLoader::register($class, $file_core);
             // Checks
         } else {
             if (JFile::exists($file_checks)) {
                 JLoader::register($class, $file_checks);
                 // 3rd party extensions
             } else {
                 if (isset($xmlpath)) {
                     $phpfile_strip = JFile::stripExt(JPATH_PLUGINS . "/redmigrator/" . $xmlpath);
                     if (JFile::exists("{$phpfile_strip}.php")) {
                         JLoader::register($class, "{$phpfile_strip}.php");
                     }
                 }
             }
         }
     }
 }
Example #10
0
 function addAutoLoadFolder($folder, $type, $prefix = 'Xipt')
 {
     foreach (JFolder::files($folder, '.php$') as $file) {
         $className = JString::ucfirst($prefix) . JString::ucfirst($type) . JString::ucfirst(JFile::stripExt($file));
         JLoader::register($className, $folder . DS . $file);
     }
 }
Example #11
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.6
  */
 protected function getOptions()
 {
     $lang = JFactory::getLanguage();
     $options = array();
     $type = $this->form->getValue('db_type');
     // Some database drivers share DDLs; point these drivers to the correct parent
     if ($type == 'mysqli' || $type == 'pdomysql') {
         $type = 'mysql';
     } elseif ($type == 'sqlsrv') {
         $type = 'sqlazure';
     }
     // Get a list of files in the search path with the given filter.
     $files = JFolder::files(JPATH_INSTALLATION . '/sql/' . $type, '^sample.*\\.sql$');
     $currentLang = $lang->getTag();
     // BOF VIRTUEMART
     defined('DS') or define('DS', DIRECTORY_SEPARATOR);
     if (!class_exists('VmVirtueMart')) {
         require JPATH_INSTALLATION . DS . 'helper' . DS . 'virtuemart.php';
     }
     VmVirtueMart::loadVMLanguage($currentLang);
     $sampleNoneText = JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE') . '<br/><strong>' . JText::_('COM_VIRTUEMART_INSTL_SITE_INSTALL_SAMPLE_NONE') . '</strong>';
     // Add option to not install sample data.
     $options[] = JHtml::_('select.option', '', JHtml::_('tooltip', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE_DESC'), '', '', $sampleNoneText));
     // EOF VIRTUEMART
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             $options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_' . ($file = JFile::stripExt($file)) . '_SET') ? JHtml::_('tooltip', JText::_('INSTL_' . strtoupper($file = JFile::stripExt($file)) . '_SET_DESC'), '', '', JText::_('INSTL_' . ($file = JFile::stripExt($file)) . '_SET')) : $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Example #12
0
 public static function thumb($image, $width, $height, $ratio = false, $uniqid)
 {
     // remove any / that begins the path
     if (substr($image, 0, 1) == '/') {
         $image = substr($image, 1);
     }
     // create a thumb filename
     $file_dir = dirname($image);
     $thumb_dir = $file_dir . DS . "tzslider_thumbs";
     if (!JFolder::exists($thumb_dir)) {
         JFolder::create($thumb_dir);
     }
     $file_name = JFile::stripExt(basename($image));
     $file_ext = JFile::getExt($image);
     $thumb_path = $thumb_dir . DS . $file_name . '_' . $uniqid . "_thumb." . $file_ext;
     // check to see if this file exists, if so we don't need to create it
     if (function_exists("gd_info")) {
         //Check existing thumbnails dimensions
         if (file_exists($thumb_path)) {
             $size = GetImageSize($thumb_path);
             $currentWidth = $size[0];
             $currentHeight = $size[1];
         }
         //Creating thumbnails
         if (!file_exists($thumb_path) || $currentWidth != $width || $currentHeight != $height) {
             modTzContentSliderCommonHelper::crop($image, $width, $height, $ratio, $thumb_path);
         }
     }
     return str_replace("\\", "/", $thumb_path);
 }
Example #13
0
 function _displayPopulate($tpl)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $document = JFactory::getDocument();
     $uri = JFactory::getURI();
     $url = $uri->toString();
     $model = $this->getModel();
     $projectws = $this->get('Data', 'project');
     $document->setTitle(JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TITLE'));
     $lists = array();
     $iScheduleType = 0;
     $options = array();
     $options[] = JHtml::_('select.option', $iScheduleType++, JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_SINGLE_ROUND_ROBIN'));
     $options[] = JHtml::_('select.option', $iScheduleType++, JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_DOUBLE_ROUND_ROBIN'));
     $path = JPath::clean(JPATH_ROOT . '/images/com_joomleague/database/round_populate_templates');
     $files = JFolder::files($path, '.', false);
     foreach ($files as $file) {
         $filename = strtoupper(JFile::stripExt($file));
         $options[] = JHtml::_('select.option', $file, JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_' . $filename));
     }
     // 		$lists['scheduling'] = JHtml::_('select.genericlist', $options, 'scheduling', 'onchange="handleOnChange_scheduling(this)"', 'value', 'text');
     $lists['scheduling'] = JHtml::_('select.genericlist', $options, 'scheduling', '', 'value', 'text');
     // 		$teams = $this->get('projectteams');
     // 		$options = array();
     // 		foreach ($teams as $t) {
     // 			$options[] = JHtml::_('select.option', $t->projectteam_id, $t->text);
     // 		}
     // 		$lists['teamsorder'] = JHtml::_('select.genericlist', $options, 'teamsorder[]', 'multiple="multiple" size="20"');
     $this->projectws = $projectws;
     $this->request_url = $url;
     $this->lists = $lists;
     $this->addToolbar_Populate();
     parent::display($tpl);
 }
Example #14
0
 /**
  * Fetch a filelist element
  *
  * @param   string       $name          Element name
  * @param   string       $value         Element value
  * @param   JXMLElement  &$node         JXMLElement node object containing the settings for the element
  * @param   string       $control_name  Control name
  *
  * @return  string
  */
 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // path to images directory
     $path = JPATH_ROOT . '/' . (string) $node->attributes()->directory;
     $filter = (string) $node->attributes()->filter;
     $exclude = (string) $node->attributes()->exclude;
     $stripExt = (string) $node->attributes()->stripext;
     $files = JFolder::files($path, $filter);
     $options = array();
     if (!(string) $node->attributes()->hide_none) {
         $options[] = JHtml::_('select.option', '-1', JText::_('JOPTION_DO_NOT_USE'));
     }
     if (!(string) $node->attributes()->hide_default) {
         $options[] = JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             if ($stripExt) {
                 $file = JFile::stripExt($file);
             }
             $options[] = JHtml::_('select.option', $file, $file);
         }
     }
     return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => 'param' . $name, 'list.attr' => 'class="inputbox"', 'list.select' => (string) $value));
 }
Example #15
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // path to images directory
     $path = JPATH_ROOT . DS . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     $stripExt = $node->attributes('stripext');
     $files = JFolder::files($path, $filter);
     $options = array();
     if (!$node->attributes('hide_none')) {
         $options[] = JHTML::_('select.option', '-1', '- ' . JText::_('Do not use') . ' -');
     }
     if (!$node->attributes('hide_default')) {
         $options[] = JHTML::_('select.option', '', '- ' . JText::_('Use default') . ' -');
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             if ($stripExt) {
                 $file = JFile::stripExt($file);
             }
             $options[] = JHTML::_('select.option', $file, $file);
         }
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
Example #16
0
 /**
  * Fetch a filelist element
  *
  * @param   string       $name          Element name
  * @param   string       $value         Element value
  * @param   JXMLElement  &$node         JXMLElement node object containing the settings for the element
  * @param   string       $control_name  Control name
  *
  * @return  string
  *
  * @deprecated    12.1   Use JFormFieldFileList::getOptions instead
  * @since   11.1
  */
 public function fetchElement($name, $value, &$node, $control_name)
 {
     // Deprecation warning.
     JLog::add('JElementFileList::fetchElement() is deprecated.', JLog::WARNING, 'deprecated');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // path to images directory
     $path = JPATH_ROOT . '/' . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     $stripExt = $node->attributes('stripext');
     $files = JFolder::files($path, $filter);
     $options = array();
     if (!$node->attributes('hide_none')) {
         $options[] = JHtml::_('select.option', '-1', JText::_('JOPTION_DO_NOT_USE'));
     }
     if (!$node->attributes('hide_default')) {
         $options[] = JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             if ($stripExt) {
                 $file = JFile::stripExt($file);
             }
             $options[] = JHtml::_('select.option', $file, $file);
         }
     }
     return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => 'param' . $name, 'list.attr' => 'class="inputbox"', 'list.select' => $value));
 }
 function isFileOK($file, $checkPatterns = false)
 {
     $fOK = true;
     $file = JFile::stripExt($file) . '.' . strtolower(JFile::getExt($file));
     if ($checkPatterns) {
         $fOK = false;
         foreach ($this->permittedFilePatterns as $p) {
             if (fnmatch($p, $file)) {
                 $fOK = true;
                 break;
             }
         }
     }
     if ($fOK) {
         foreach ($this->excludedDirs as $dir => $flag) {
             if (!$flag) {
                 continue;
             }
             if ($this->_inDir($file, $dir)) {
                 $fOK = false;
                 break;
             }
         }
     }
     if ($fOK) {
         // if the file was excluded
         if (isset($this->excludedFiles[$file]) && $this->excludedFiles[$file]) {
             $fOK = false;
         }
     }
     return $fOK;
 }
Example #18
0
	protected function getOptions()
	{
		$options = array();

		$path = $this->get('folder');

		if (!is_dir($path))
		{
			$path = JPATH_ROOT . '/' . $path;
		}

		// Prepend some default options based on field attributes.
		if (!$this->get('hidenone', 0))
		{
			$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		if (!$this->get('hidedefault', 0))
		{
			$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		// Get a list of files in the search path with the given filter.
		$files = JFolder::files($path, $this->get('filter'));

		// Build the options list from the list of files.
		if (is_array($files))
		{
			foreach ($files as $file)
			{
				// Check to see if the file is in the exclude mask.
				if ($this->get('exclude'))
				{
					if (preg_match(chr(1) . $this->get('exclude') . chr(1), $file))
					{
						continue;
					}
				}

				// If the extension is to be stripped, do it.
				if ($this->get('stripext', 1))
				{
					$file = JFile::stripExt($file);
				}

				$label = $file;
				if ($this->get('language_prefix'))
				{
					$label = JText::_($this->get('language_prefix') . strtoupper($label));
				}

				$options[] = JHtml::_('select.option', $file, $label);
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
Example #19
0
 /**
  * Constructor.
  *
  * @param string $element Element name
  * @param string $scope Scope name
  * @param string $basePath The base path
  */
 public function __construct($element, $scope, $basePath = '')
 {
     $this->_element = $element;
     $this->_scope = $scope;
     $this->basePath = $basePath;
     parent::__construct($this->group, $this->name, $element, $scope);
     //-- Read the files in /options folder
     $options = JFolder::files($this->basePath . DS . 'tmpl' . DS . 'options');
     foreach ($options as $fName) {
         $fContents = JFile::read($this->basePath . DS . 'tmpl' . DS . 'options' . DS . $fName);
         $key = JFile::stripExt($fName);
         $this->fieldsOptions[$key] = $fContents;
     }
     //foreach
     $this->keys['##ECR_OPTIONS##'] = '__ECR_KEY__';
     /*
     //#        $this->keys['##ECR_VIEW1_TMPL1_TDS##'] = '##ECR_KEY##';
     //        $this->patterns['##ECR_VIEW1_TMPL1_THS##'] = '    <th>'.NL
     //           ."        <?php echo JHTML::_('grid.sort', '##ECR_KEY##',
     // *  '##ECR_KEY##', \$this->lists['order_Dir'], \$this->lists['order']);?>".NL
     //           .'    </th>'.NL;
     //        $this->patterns['##ECR_VIEW1_TMPL1_TDS##'] = '    <td>'.NL
     //            .'        <php echo $row->##ECR_KEY##; ?>'.NL
     //            .'    </td>'.NL;
      * */
 }
 /**
  * Load a manifest from a file
  * @param string $xmlfile Path to file to load
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->libraryname = (string) $xml->libraryname;
         $this->version = (string) $xml->version;
         $this->description = (string) $xml->description;
         $this->creationdate = (string) $xml->creationdate;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->authorurl = (string) $xml->authorUrl;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->update = (string) $xml->update;
         if (isset($xml->files) && isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 $this->filelist[] = (string) $file;
             }
         }
         return true;
     }
 }
Example #21
0
 /**
  * Read content files
  *
  * @return void
  *
  * @throws Exception
  */
 public function readContentElementFile()
 {
     NenoLog::log('Method readContentElementFile of NenoControllerGroupsElements called', 3);
     jimport('joomla.filesystem.file');
     NenoLog::log('Trying to move content element files', 3);
     $input = JFactory::getApplication()->input;
     $fileData = $input->files->get('content_element');
     $destFile = JFactory::getConfig()->get('tmp_path') . '/' . $fileData['name'];
     $extractPath = JFactory::getConfig()->get('tmp_path') . '/' . JFile::stripExt($fileData['name']);
     // If the file has been moved successfully, let's work with it.
     if (JFile::move($fileData['tmp_name'], $destFile) === true) {
         NenoLog::log('Content element files moved successfully', 2);
         // If the file is a zip file, let's extract it
         if ($fileData['type'] == 'application/zip') {
             NenoLog::log('Extracting zip content element files', 3);
             $adapter = JArchive::getAdapter('zip');
             $adapter->extract($destFile, $extractPath);
             $contentElementFiles = JFolder::files($extractPath);
         } else {
             $contentElementFiles = array($destFile);
         }
         // Add to each content file the path of the extraction location.
         NenoHelper::concatenateStringToStringArray($extractPath . '/', $contentElementFiles);
         NenoLog::log('Parsing element files for readContentElementFile', 3);
         // Parse element file(s)
         NenoHelperBackend::parseContentElementFile(JFile::stripExt($fileData['name']), $contentElementFiles);
         NenoLog::log('Cleaning temporal folder for readContentElementFile', 3);
         // Clean temporal folder
         NenoHelperBackend::cleanFolder(JFactory::getConfig()->get('tmp_path'));
     }
     NenoLog::log('Redirecting to groupselements view', 3);
     $this->setRedirect('index.php?option=com_neno&view=groupselements')->redirect();
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.6
  */
 protected function getOptions()
 {
     $lang = JFactory::getLanguage();
     $options = array();
     $type = $this->form->getValue('db_type');
     // Some database drivers share DDLs; point these drivers to the correct parent
     if ($type == 'mysqli') {
         $type = 'mysql';
     } elseif ($type == 'sqlsrv') {
         $type = 'sqlazure';
     }
     // Get a list of files in the search path with the given filter.
     $files = JFolder::files(JPATH_INSTALLATION . '/sql/' . $type, '^sample.*\\.sql$');
     // Add option to not install sample data.
     $options[] = JHtml::_('select.option', '', JHtml::_('tooltip', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE_DESC'), '', '', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE')));
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             $options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_' . ($file = JFile::stripExt($file)) . '_SET') ? JHtml::_('tooltip', JText::_('INSTL_' . strtoupper($file = JFile::stripExt($file)) . '_SET_DESC'), '', '', JText::_('INSTL_' . ($file = JFile::stripExt($file)) . '_SET')) : $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Example #23
0
 function onPromoteList($uid)
 {
     jimport('joomla.filesystem.file');
     $db = JFactory::getDBO();
     if ($uid) {
         $user = JFactory::getUser($uid);
     } else {
         $user = JFactory::getUser();
     }
     $name = JFile::getName(__FILE__);
     $name = JFile::stripExt($name);
     $jschk = $this->_chkextension();
     if (!empty($jschk)) {
         $query = "SELECT CONCAT_WS('|', '" . $name . "', e.id) as value, e.title AS text FROM #__community_events AS e\n\t\t\t\t\t\t\t\tLEFT JOIN #__users AS u ON e.creator = u.id\n\t\t\t\t\t\t\t\tWHERE u.id =" . $user->id;
         $db->setQuery($query);
         $itemlist = $db->loadObjectlist();
         if (empty($itemlist)) {
             $list = array();
             //$list[0]->value=$name.'|'.'0';
             //	$list[0]->text=JText::_("NO_EVENTS");
             return $list;
         } else {
             return $itemlist;
         }
     }
 }
Example #24
0
	function getCleanArray($array) {
		jimport('joomla.filesystem.file');
		$newArray = array();

		foreach($array as $value) array_push($newArray, JFile::stripExt(JFile::getName($value)));
		
		return $newArray;
	}
Example #25
0
 /**
  * @param $array
  * @return array
  */
 function getCleanArray($array)
 {
     $newArray = array();
     foreach ($array as $value) {
         array_push($newArray, JFile::stripExt(JFile::getName($value)));
     }
     return $newArray;
 }
 public function download()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     $type = $this->input->get->getCmd('type');
     $model = $this->getModel();
     try {
         switch ($type) {
             case 'locations':
                 $output = $model->getLocations();
                 $fileName = 'locations.xml';
                 break;
             case 'countries':
                 $output = $model->getCountries();
                 $fileName = 'countries.xml';
                 break;
             case 'states':
                 $output = $model->getStates();
                 $fileName = 'states.xml';
                 break;
             default:
                 // Error
                 $output = '';
                 $fileName = 'error.xml';
                 break;
         }
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.path');
     jimport('joomla.filesystem.archive');
     $tmpFolder = JPath::clean($app->get('tmp_path'));
     $date = new JDate();
     $date = $date->format('d_m_Y_H_i_s');
     $archiveName = JFile::stripExt(basename($fileName)) . '_' . $date;
     $archiveFile = $archiveName . '.zip';
     $destination = $tmpFolder . DIRECTORY_SEPARATOR . $archiveFile;
     // compression type
     $zipAdapter = JArchive::getAdapter('zip');
     $filesToZip[] = array('name' => $fileName, 'data' => $output);
     $zipAdapter->create($destination, $filesToZip, array());
     $filesize = filesize($destination);
     JFactory::getApplication()->setHeader('Content-Type', 'application/octet-stream', true);
     JFactory::getApplication()->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
     JFactory::getApplication()->setHeader('Content-Transfer-Encoding', 'binary', true);
     JFactory::getApplication()->setHeader('Pragma', 'no-cache', true);
     JFactory::getApplication()->setHeader('Expires', '0', true);
     JFactory::getApplication()->setHeader('Content-Disposition', 'attachment; filename=' . $archiveFile, true);
     JFactory::getApplication()->setHeader('Content-Length', $filesize, true);
     $doc = JFactory::getDocument();
     $doc->setMimeEncoding('application/octet-stream');
     $app->sendHeaders();
     echo file_get_contents($destination);
     $app->close();
 }
	function getInput( $name, $id, $value, $params, $children, $j15 = 0 )
	{
		$this->params = $params;

		jimport( 'joomla.filesystem.folder' );
		jimport( 'joomla.filesystem.file' );

		// path to images directory
		$path = JPATH_ROOT.'/'.$this->def( 'directory' );
		$filter = $this->def( 'filter' );
		$exclude = $this->def( 'exclude' );
		$stripExt = $this->def( 'stripext' );
		$files = JFolder::files( $path, $filter );
		$rowcount = $this->def( 'rowcount' );

		$options = array();

		if ( !$this->def( 'hide_none' ) ) {
			$options[] = JHtml::_( 'select.option', '-1', JText::_( 'Do not use' ).'<br />' );
		}

		if ( !$this->def( 'hide_default' ) ) {
			$options[] = JHtml::_( 'select.option', '', JText::_( 'Use default' ).'<br />' );
		}

		if ( is_array( $files ) ) {
			$count = 0;
			foreach ( $files as $file ) {
				if ( $exclude ) {
					if ( preg_match( chr( 1 ).$exclude.chr( 1 ), $file ) ) {
						continue;
					}
				}
				$count++;
				if ( $stripExt ) {
					$file = JFile::stripExt( $file );
				}
				$image = '<img src="../'.$this->def( 'directory' ).'/'.$file.'" style="padding-right: 10px;" title="'.$file.'" alt="'.$file.'" />';
				if ( $rowcount && $count >= $rowcount ) {
					$image .= '<br />';
					$count = 0;
				}
				$options[] = JHtml::_( 'select.option', $file, $image );
			}
		}

		$list = JHtml::_( 'select.radiolist', $options, ''.$name.'', '', 'value', 'text', $value, $id );

		$list = '<div style="float:left;">'.str_replace( '<input type="radio"', '</div><div style="float:left;margin:2px 0;"><input type="radio" style="float:left;"', $list ).'</div>';
		$list = str_replace( array( '<label', '</label>' ), array( '<span style="float: left;"', '</span>' ), $list );
		$list = preg_replace( '#</span>(\s*)</div>#', '</span></div>\1', $list );
		$list = str_replace( '<br /></span></div>', '<br /></span></div><div style="clear:both;"></div>', $list );

		if ( !$j15 ) {
			$list = '<div style="clear:both;"></div>'.$list;
		}
		return $list;
	}
Example #28
0
 function getData($number)
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_igallery/defines.php';
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('ignitegallerysourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'con.id, ';
     $query .= 'con.filename, ';
     $query .= 'con.description, ';
     $query .= 'con.alt_text, ';
     $query .= 'con.link, ';
     $query .= 'con.hits, ';
     $query .= 'con.rotation, ';
     $query .= 'con.gallery_id, ';
     $query .= 'cat.name AS cat_title, ';
     $query .= 'cat.alias AS cat_alias ';
     $query .= 'FROM #__igallery_img AS con ';
     $query .= 'LEFT JOIN #__igallery AS cat ON cat.id = con.gallery_id ';
     $where = array();
     if (count($category) > 0 && !in_array('0', $category)) {
         $where[] = 'con.gallery_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('ignitegallerysourcepublished', 1)) {
         $where[] = 'con.published = 1 ';
     }
     if (count($where)) {
         $query .= ' WHERE ' . implode(' AND ', $where);
     }
     $order = NextendParse::parse($this->_data->get('ignitegalleryorder1', 'con.ordering|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('ignitegalleryorder2', 'con.ordering|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     for ($i = 0; $i < count($result); $i++) {
         $fileHashNoExt = JFile::stripExt($result[$i]['filename']);
         $fileHashNoRef = substr($fileHashNoExt, 0, strrpos($fileHashNoExt, '-'));
         $result[$i]['url'] = 'index.php?option=com_igallery&view=category&igid=' . $result[$i]['gallery_id'] . '#!' . $fileHashNoRef;
         $result[$i]['categoryurl'] = 'index.php?option=com_igallery&view=category&igid=' . $result[$i]['gallery_id'];
         $increment = igFileHelper::getIncrementFromFilename($result[$i]['filename']);
         $folderName = igFileHelper::getFolderName($increment);
         $sourceFile = IG_ORIG_PATH . '/' . $folderName . '/' . $result[$i]['filename'];
         $size = getimagesize($sourceFile);
         $fileArray = igFileHelper::originalToResized($result[$i]['filename'], $size[0], $size[1], 100, 0, $result[$i]['rotation'], 0, 0);
         $result[$i]['thumbnail'] = $result[$i]['image'] = IG_IMAGE_HTML_RESIZE . $fileArray['folderName'] . '/' . $fileArray['fullFileName'];
         $result[$i]['title'] = $result[$i]['alt_text'];
         $result[$i]['author_name'] = '';
         $result[$i]['author_url'] = '#';
     }
     return $result;
 }
Example #29
0
 function _process(&$module, &$xmlobj, $level = 0)
 {
     $lis = $xmlobj->children("li");
     $menu =& JSite::getMenu();
     $images = strpos($module->parameter->get('class_sfx'), "images-off") === false;
     $parent = null;
     for ($i = 0, $imax = count($lis); $i < $imax; $i++) {
         foreach (explode(' ', $lis[$i]->_attributes['class']) as $cls) {
             if (strpos($cls, "item") !== false) {
                 $id = str_replace("item", "", $cls);
             }
         }
         $isActive = 0;
         if ($lis[$i]->hasClass('active')) {
             $isActive = isset($lis[$i]->_attributes['id']) && $lis[$i]->_attributes['id'] === 'current' ? 2 : 1;
         }
         $lis[$i]->_attributes = array();
         $item = $menu->getItem($id);
         $item_params = new JParameter($item->params);
         // get class suffix params
         $page_params = array();
         $parts = preg_split('/[\\s]+/', $item_params->get('pageclass_sfx'));
         foreach ($parts as $part) {
             if (strpos($part, '-') !== false) {
                 list($name, $value) = explode('-', $part, 2);
                 $page_params[$name] = $value;
             }
         }
         $columns = isset($page_params['columns']) ? (int) $page_params['columns'] : 1;
         $columnwidth = isset($page_params['columnwidth']) ? (int) $page_params['columnwidth'] : -1;
         $lis[$i]->addAttribute('data-menu-active', (int) $isActive);
         $lis[$i]->addAttribute('data-menu-columns', $columns);
         $lis[$i]->addAttribute('data-menu-columnwidth', $columnwidth);
         // add item background image
         if ($item_params->get('menu_image') && $item_params->get('menu_image') != -1) {
             if (isset($lis[$i]->_children[0])) {
                 if ($lis[$i]->_children[0]->_children[0]->name() == 'img') {
                     $lis[$i]->_children[0]->_children[0]->dispose();
                 }
                 if ($images && $lis[$i]->_children[0]->_children[0]->name() == 'span') {
                     $img = 'images/stories/' . $item_params->get('menu_image');
                     if (mb_strpos($module->parameter->get('class_sfx', ''), 'dropdown') === false) {
                         $alt = dirname($img) . '/' . JFile::stripExt(basename($img)) . '_alt.' . JFile::getExt($img);
                         // check for alternate image
                         if (JFile::exists(JPATH_ROOT . DS . $alt)) {
                             $img = $alt;
                         }
                     }
                     $lis[$i]->_children[0]->_children[0]->addAttribute('data-menu-image', JURI::base() . $img);
                 }
             }
         }
         $childList =& $lis[$i]->child("ul");
         if ($childList) {
             $this->_process($module, $childList, $level + 1);
         }
     }
 }
	/**
	 * Get the options for the list.
	 * @since   11.1
	 *
	 * @deprecated    12.1   Use JFormFieldModuleLayouts::getInput instead.
	 */
	protected function _getOptions(&$node)
	{
		// Deprecation warning.
		JLog::add('JElementModuleLayouts::_getOptions() is deprecated.', JLog::WARNING, 'deprecated');

		$clientId = ($v = $node->attributes('client_id')) ? $v : 0;

		$options = array();
		$path1 = null;
		$path2 = null;

		// Load template entries for each menuid
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select('template');
		$query->from('#__template_styles');
		$query->where('client_id = ' . (int) $clientId);
		$query->where('home = 1');
		$db->setQuery($query);
		$template = $db->loadResult();

		if ($module = $node->attributes('module'))
		{
			$base = ($clientId == 1) ? JPATH_ADMINISTRATOR : JPATH_SITE;
			$module = preg_replace('#\W#', '', $module);
			$path1 = $base . '/modules/' . $module . '/tmpl';
			$path2 = $base . '/templates/' . $template . '/html/' . $module;
			$options[] = JHTML::_('select.option', '', '');
		}

		if ($path1 && $path2)
		{
			jimport('joomla.filesystem.file');
			$path1 = JPath::clean($path1);
			$path2 = JPath::clean($path2);

			$files = JFolder::files($path1, '^[^_]*\.php$');
			foreach ($files as $file)
			{
				$options[] = JHTML::_('select.option', JFile::stripExt($file));
			}

			if (is_dir($path2) && $files = JFolder::files($path2, '^[^_]*\.php$'))
			{
				$options[] = JHTML::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT'));
				foreach ($files as $file)
				{
					$options[] = JHTML::_('select.option', JFile::stripExt($file));
				}
				$options[] = JHTML::_('select.optgroup', JText::_('JOPTION_FROM_DEFAULT'));
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::_getOptions($node), $options);

		return $options;
	}