Beispiel #1
1
 function _generateTree()
 {
     $path = JPATH_SITE . '/templates/' . $this->item->name;
     $folders = JFolder::listFolderTree($path, '.', 5);
     $i = 0;
     $path = array();
     $prev = 0;
     $tree = '';
     foreach ($folders as $k => $f) {
         $p = $f['parent'];
         if ($p > $prev) {
             $tree .= '<ul><li id="phtml_' . $f['id'] . '">' . '<a href="#">' . $f['name'] . '</a>';
             $path[$i++] = $prev;
         } else {
             if ($p < $prev) {
                 for ($j = $i - 1; $j >= 0; $j--) {
                     $tree .= '</li></ul>';
                     $last = $path[$j];
                     unset($path[$j]);
                     $i--;
                     if ($p == $last) {
                         break;
                     }
                 }
             }
             $tree .= '</li><li id="phtml_' . $f['id'] . '">' . '<a href="#">' . $f['name'] . '</a>';
         }
         $prev = $p;
         //$folders[$k]['files']	=	JFolder::files( $f['fullname'], '.', false, true );
     }
     $tree = '<ul><li id="phtml_0" class="jstree-open jstree-last">' . '<a href="#" class="jstree-clicked">' . './' . '</a><ul>' . substr($tree, 5) . '</li></ul></li></ul>';
     return $tree;
 }
 protected function getOptions()
 {
     $options = array();
     $filter = (string) $this->element['filter'];
     $exclude = (string) $this->element['exclude'];
     $options[] = JHtml::_('select.option', '-1', JText::_('SELECT_FOLDER'));
     $params = JComponentHelper::getParams('com_igallery');
     $path = (string) $params->get('import_server_base', 'images/');
     if (!is_dir($path)) {
         $path = JPATH_ROOT . '/' . $path;
     }
     $folders = JFolder::listFolderTree($path, $filter, 9);
     if (is_array($folders)) {
         foreach ($folders as $folder) {
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                     continue;
                 }
             }
             $options[] = JHtml::_('select.option', $folder['relname'], $folder['relname']);
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #3
0
 public function getItems()
 {
     $searchpath = JPATH_ROOT . DIRECTORY_SEPARATOR . "components/com_content";
     $items[] = JFolder::files($searchpath);
     $items[] = JFolder::listFolderTree($searchpath, '');
     return $items;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.0
  */
 protected function getOptions()
 {
     $options = array();
     $path = $this->directory;
     if (!is_dir($path)) {
         $path = JPATH_ROOT . '/' . $path;
     }
     // Prepend some default options based on field attributes.
     if (!$this->hideNone) {
         $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     if (!$this->hideDefault) {
         $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     // Get a list of folders in the search path with the given filter.
     $folders = JFolder::listFolderTree($path, $this->filter);
     // Build the options list from the list of folders.
     if (is_array($folders)) {
         foreach ($folders as $folder) {
             // Check to see if the file is in the exclude mask.
             if ($this->exclude) {
                 if (preg_match(chr(1) . $this->exclude . chr(1), $folder['relname'])) {
                     continue;
                 }
             }
             // Add the folder
             $options[] = JHtml::_('select.option', $folder['relname'], $folder['relname']);
         }
     }
     return $options;
 }
 protected function getInput()
 {
     $options = array();
     // path to images directory
     $path = JPATH_ROOT . '/' . $this->element['directory'];
     $filter = $this->element['filter'];
     $folders = JFolder::listFolderTree($path, $filter);
     foreach ($folders as $folder) {
         $options[] = JHtml::_('select.option', str_replace("\\", "/", $folder['relname']), str_replace("\\", "/", substr($folder['relname'], 1)));
     }
     return JHtml::_('select.genericlist', $options, $this->name, '', 'value', 'text', $this->value);
 }
Beispiel #6
0
 protected function getOptions()
 {
     //Pega os diretórios modelos
     $modelos_dir = JFolder::listFolderTree(JPATH_SITE . '/modules/mod_chamadas/modelos/', '', 1);
     //Busca diretórios na pasta "mod_chamadas/modelos" e cria opções de seleção para configuração do módulo
     foreach ($modelos_dir as $modelo) {
         $options[] = JHtml::_('select.option', $modelo['name'], ucwords(str_replace('_', ' ', $modelo['name'])));
     }
     //Lista que será incorporada nos fields do módulo
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 protected function getInput()
 {
     // output for options
     $output_options = '';
     $output_configs = '';
     // prefix for the language files
     $pre = 'MOD_NEWS_PRO_GK5_';
     // get folders with data sources
     $folders = JFolder::listFolderTree(JPATH_SITE . '/modules/mod_news_pro_gk5/data_sources/', '', 1);
     //
     $json_data = null;
     // iterate through data source folders
     foreach ($folders as $folder) {
         // check if the data source contains the configuration.json file
         if (JFile::exists($folder['fullname'] . '/configuration.json')) {
             // read JSON from this data source
             $file_content = JFile::read($folder['fullname'] . '/configuration.json');
             // parse JSON
             $json_data = json_decode($file_content);
             // if the JSON file is correct
             if (json_last_error() === JSON_ERROR_NONE) {
                 // generate the header option
                 $output_options .= '<optgroup label="' . JText::_($pre . $json_data->data_source) . '">';
                 // generate the options
                 foreach ($json_data->sources as $source) {
                     // option
                     $output_options .= '<option data-source="' . $json_data->source . '" value="' . $source->value . '"' . ($this->value == $source->value ? ' selected="selected"' : '') . '>' . JText::_($pre . $source->name) . '</option>';
                 }
                 // close header option
                 $output_options .= '</optgroup>';
                 // parse file content and put translations
                 $json_matches = array();
                 preg_match_all('@\\"MOD_NEWS_PRO_GK5_.*?\\"@mis', $file_content, $json_matches);
                 //
                 if (isset($json_matches[0]) && count($json_matches[0]) > 0 && strlen($json_matches[0][0]) > 0) {
                     foreach ($json_matches[0] as $translations) {
                         $phrase = str_replace('"', '', $translations);
                         $file_content = str_replace($phrase, '\'.JText::_("' . $phrase . '").\'', $file_content);
                     }
                 }
                 //
                 $file_content = "'" . $file_content . "'";
                 $out_fn = create_function('', 'return ' . $file_content . ';');
                 // output the config
                 $output_configs .= '<div class="gk-json-config" id="gk-json-config-' . $json_data->source . '">' . $out_fn() . '</div>';
             }
         }
     }
     // output the select
     echo '<select id="' . $this->id . '" name="' . $this->name . '">' . $output_options . '</select>';
     echo $output_configs;
 }
Beispiel #8
0
 protected function getOptions()
 {
     $options = array();
     $template_names = array();
     $t_names = JFolder::listFolderTree(JPATH_ROOT . DS . "media" . DS . "com_jvrelatives" . DS . "styles", ".", 1);
     foreach ($t_names as $t) {
         $row = new StdClass();
         $row->text = $t['name'];
         $row->value = $t['name'];
         $options[] = $row;
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Beispiel #9
0
 protected function getInput()
 {
     global $expose;
     $html = '';
     $fonts = '';
     $options = array();
     $url = JURI::getInstance();
     $id = $url->getVar('id');
     // Initialize some field attributes.
     $class = $this->element['class'];
     $selectClass = 'class="gfonts"';
     $pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : '';
     $posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : '';
     $wrapstart = '<div class="field-wrap fonts-list clearfix ' . $class . '">';
     $wrapend = '</div>';
     //create a google font list file on admin folder to avoid api call and slow down the admin panel
     $fileName = 'gfonts.txt';
     $template = $this->form->getValue('template');
     $path = JPATH_ROOT . '/templates/' . $template . '/asset/' . $fileName;
     if (!JFile::exists($path) or JFile::read($path) == NULL) {
         $this->createFontList($path);
     }
     $fontsPath = JPATH_ROOT . '/templates/' . $template . '/fonts/';
     //var_dump( $path);die();
     if (JFolder::exists($fontsPath)) {
         $fontFolders = JFolder::listFolderTree($fontsPath, $filter = '', $maxLevel = 1, $level = 0, $parent = 0);
     }
     $data = JFile::read($path);
     $data = explode(';', $data);
     //add none
     $options[] = JHtml::_('select.option', '0', JText::alt('JOPTION_DO_NOT_USE', 'language'));
     $options[] = JHtml::_('select.option', '-1', JText::alt('---------- General fonts ----------', 'language'));
     $options[] = JHtml::_('select.option', '\'Arial\', Helvetica, sans-serif', JText::alt('"Arial", Helvetica, sans-serif', 'language'));
     $options[] = JHtml::_('select.option', '\'Times New Roman\', Times, serif', JText::alt('"Times New Roman", Times, serif', 'language'));
     $options[] = JHtml::_('select.option', '\'Courier New\', Courier, monospace', JText::alt('"Courier New", Courier, monospace', 'language'));
     $options[] = JHtml::_('select.option', '\'Georgia\',Times New Roman, Times, serif', JText::alt('"Georgia",Times New Roman, Times, serif', 'language'));
     $options[] = JHtml::_('select.option', '\'Verdana\', Arial, Helvetica, sans-serif', JText::alt('"Verdana", Arial, Helvetica, sans-serif', 'language'));
     $options[] = JHtml::_('select.option', '-1', JText::alt('---------- Google fonts ----------', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     foreach ($data as $val) {
         //var_dump($val);
         list($fontVal, $fontName) = explode('=', "{$val}=");
         $fontVal = str_replace(' ', '+', $fontVal);
         $options[] = JHtml::_('select.option', $fontVal, $fontName);
     }
     //pop the last empty array
     array_pop($options);
     $html .= '<a class="link-gfont" href="http://www.google.com/webfonts" target="_blank">' . JText::_('GOOGLE_FONT_LINK_LABLE') . '</a>';
     $html .= JHtml::_('select.genericlist', $options, $this->name, $selectClass, 'value', 'text', $this->value, $this->id);
     return $wrapstart . $pretext . $html . $posttext . $wrapend;
 }
Beispiel #10
0
 protected function getInput()
 {
     $attr = '';
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $themes = JFolder::listFolderTree(JPATH_SITE . DS . 'components' . DS . 'com_djreviews' . DS . 'themes', '', 1);
     $default = $this->element['default'];
     $options = array();
     if ($default == '') {
         $options[] = JHTML::_('select.option', '', JText::_('JGLOBAL_USE_GLOBAL'));
     }
     foreach ($themes as $theme) {
         $options[] = JHTML::_('select.option', $theme['name'], $theme['name']);
     }
     $out = JHTML::_('select.genericlist', $options, $this->name, null, 'value', 'text', $this->value);
     return $out;
 }
Beispiel #11
0
 /**
  * Lists folder in format suitable for tree display.
  *
  * @access	public
  * @param	string	The path of the folder to read.
  * @param	string	A filter for folder names.
  * @param	integer	The maximum number of levels to recursively read,
  * defaults to three.
  * @param	integer	The current level, optional.
  * @param	integer	Unique identifier of the parent folder, if any.
  * @return	array	Folders in the given folder.
  * @since	1.5
  */
 function listFolderTree($path, $filter, $maxLevel = 3, $level = 0, $parent = 0)
 {
     $dirs = array();
     if ($level == 0) {
         $GLOBALS['_JFolder_folder_tree_index'] = 0;
     }
     if ($level < $maxLevel) {
         $folders = JFolder::folders($path, $filter);
         // first path, index foldernames
         foreach ($folders as $name) {
             $id = ++$GLOBALS['_JFolder_folder_tree_index'];
             $fullName = JPath::clean($path . DS . $name);
             $dirs[] = array('id' => $id, 'parent' => $parent, 'name' => $name, 'fullname' => $fullName, 'relname' => str_replace(JPATH_ROOT, '', $fullName));
             $dirs2 = JFolder::listFolderTree($fullName, $filter, $maxLevel, $level + 1, $id);
             $dirs = array_merge($dirs, $dirs2);
         }
     }
     return $dirs;
 }
Beispiel #12
0
 protected function getInput()
 {
     global $expose;
     $html = '';
     $fonts = '';
     $options = array();
     //get template id
     $url = JURI::getInstance();
     $id = $url->getVar('id');
     // Initialize some field attributes.
     $class = $this->element['class'];
     $selectClass = 'class="gfonts"';
     $pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : '';
     $posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : '';
     $wrapstart = '<div class="field-wrap fonts-list clearfix ' . $class . '">';
     $wrapend = '</div>';
     //create a google font list file on admin folder to avoid api call and slow down the admin panel
     $fileName = 'gfonts.txt';
     $path = JPATH_ROOT . '/templates/' . getTemplate($id) . '/' . $fileName;
     //$path = realpath(dirname(dirname(__FILE__))) .'/'.$fileName;
     if (!JFile::exists($path) or JFile::read($path) == NULL) {
         $this->createFontList($path);
     }
     $fontsPath = JPATH_ROOT . '/templates/' . getTemplate($id) . '/fonts/';
     if (JFolder::exists($fontsPath)) {
         $fontFolders = JFolder::listFolderTree($fontsPath, $filter = '', $maxLevel = 1, $level = 0, $parent = 0);
     }
     $data = JFile::read($path);
     $data = explode(',', $data);
     //add none
     $options[] = JHtml::_('select.option', '0', JText::alt('JOPTION_DO_NOT_USE', 'language'));
     $options[] = JHtml::_('select.option', '-1', JText::alt('---------- General fonts ----------', 'language'));
     $options[] = JHtml::_('select.option', 'Arial, Helvetica, sans-serif', JText::alt('Arial, Helvetica, sans-serif', 'language'));
     $options[] = JHtml::_('select.option', '\'Times New Roman\', Times, serif', JText::alt('"Times New Roman", Times, serif', 'language'));
     $options[] = JHtml::_('select.option', '"Courier New", Courier, monospace', JText::alt('"Courier New", Courier, monospace', 'language'));
     $options[] = JHtml::_('select.option', 'Georgia,"Times New Roman", Times, serif', JText::alt('Georgia,"Times New Roman", Times, serif', 'language'));
     $options[] = JHtml::_('select.option', 'Verdana, Arial, Helvetica, sans-serif', JText::alt('Verdana, Arial, Helvetica, sans-serif', 'language'));
     // Add custom fonts in font folder as options
     /*if ( JFolder::exists($fontsPath) )
             {
                 foreach($fontFolders as $fontFolder){
                     $customFontName = ucwords( str_replace( "-", " ", $fontFolder['name'] ) );
                     $options[] = JHtml::_('select.option', $fontFolder['name'] . '-webfont', JText::alt($customFontName,'language'));
     
                     // Add @font-face for font preview in admin
                     $templatePath = JURI::root(true) . '/templates/' . getTemplate($id);
                     $fontFilename = $fontFolder['name'] . '-webfont';
                     $fontFamily = $fontFolder['name'];
                     $fontFamily = ucwords( str_replace( "-", " ", $fontFamily ) );
                     $fonts .= "
                         @font-face {
                             font-family: {$fontFamily};
                             src: url('{$templatePath}/fonts/{$fontFolder['name']}/{$fontFilename}.eot');
                             src: local({$fontFamily}),
                             url('{$templatePath}/fonts/{$fontFolder['name']}/{$fontFilename}.woff') format('woff'),
                             url('{$templatePath}/fonts/{$fontFolder['name']}/{$fontFilename}.ttf') format('truetype'),
                             url('{$templatePath}/fonts/{$fontFolder['name']}/{$fontFilename}.svg#font')
                         }
                     ";
                 }
             }*/
     //$expose->document->addStyleDeclaration($fonts);
     // Load set parameter values to make fonts show on load
     //$expose->document->addStyleSheet('http://fonts.googleapis.com/css?family=Abril+Fatface');
     $options[] = JHtml::_('select.option', '-1', JText::alt('---------- Google fonts ----------', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     foreach ($data as $val) {
         list($fontVal, $fontName) = explode('=', "{$val}=");
         $fontVal = str_replace(' ', '+', $fontVal);
         $options[] = JHtml::_('select.option', $fontVal, $fontName);
     }
     //pop the last empty array
     array_pop($options);
     $html .= '<a href="http://www.google.com/webfonts" target="_blank">' . JText::_('GOOGLE_FONT_LINK_LABLE') . '</a>';
     $html .= "<br/>";
     $html .= JHtml::_('select.genericlist', $options, $this->name, $selectClass, 'value', 'text', $this->value, $this->id);
     return $wrapstart . $pretext . $html . $posttext . $wrapend;
 }
Beispiel #13
0
 private function _generateArborescence($folders)
 {
     $folderList = array();
     foreach ($folders as $folder) {
         $folderPath = JPath::clean(ACYMAILING_ROOT . trim(str_replace('/', DS, trim($folder)), DS));
         if (!file_exists($folderPath)) {
             acymailing_createDir($folderPath);
         }
         $subFolders = JFolder::listFolderTree($folderPath, '', 15);
         $folderList[] = trim($folder, '/ ');
         foreach ($subFolders as $oneFolder) {
             $subFolder = str_replace(ACYMAILING_ROOT, '', $oneFolder['relname']);
             $subFolder = str_replace(DS, '/', $subFolder);
             $folderList[] = ltrim($subFolder, '/');
         }
     }
     return array_unique($folderList);
 }
 public function media_bank()
 {
     $uri = JURI::getInstance();
     $url = $uri->root();
     $folder_path = JRequest::getVar('path', '');
     $dirpath = JRequest::getVar('dirpath', '');
     if (!$folder_path) {
         $path = REDSHOP_FRONT_IMAGES_RELPATH;
         $dir_path = "components/com_redshop/assets/images";
     } else {
         $path = $folder_path;
         $dir_path = $dirpath;
     }
     $files = JFolder::listFolderTree($path, '.', 1);
     $tbl = '';
     $tbl .= "<table cellspacing='7' cellpadding='2' width='100%' border='0'>";
     $tbl .= "<tr>";
     if ($folder_path) {
         $t = preg_split('/', $folder_path);
         $na = count($t) - 1;
         $n = count($t) - 2;
         if ($t[$n] != 'assets') {
             if ($t[$n] == 'images') {
                 $path_bk = REDSHOP_FRONT_IMAGES_RELPATH;
                 $dir_path = 'components/com_redshop/assets/images/' . $t[$na];
             } else {
                 $path_bk = REDSHOP_FRONT_IMAGES_RELPATH . '/' . $t[$n];
                 $dir_path = 'components/com_redshop/assets/images/' . $t[$n] . '/' . $t[$na];
             }
             $folder_img_bk = "components/com_redshop/assets/images/folderup_32.png";
             $info = @getimagesize($folder_img_bk);
             $width = @$info[0];
             $height = @$info[1];
             if ($info[0] > 50 || $info[1] > 50) {
                 $dimensions = $this->_imageResize($info[0], $info[1], 50);
                 $width_60 = $dimensions[0];
                 $height_60 = $dimensions[1];
             } else {
                 $width_60 = $width;
                 $height_60 = $height;
             }
             $link_bk = "index.php?tmpl=component&option=com_redshop&view=product_detail&task=media_bank&path=" . $path_bk . "&dirpath=" . $dir_path;
             $tbl .= "<td width='25%'><table width='120' height='70' style='background-color:#C0C0C0;' cellspacing='1'\n\t\t\t\tcellpadding='1'><tr><td align='center' style='background-color:#FFFFFF;'>\n\t\t\t\t<a href='" . $link_bk . "'><img src='" . $folder_img_bk . "' width='" . $width_60 . "' height='" . $height_60 . "'></a></td></tr>\n\t\t\t\t<tr height='15'><td style='background-color:#F7F7F7;' align='center'><label>Up</label></td></tr></table></td></tr><tr>";
         } else {
             $dir_path = "components/com_redshop/assets/images";
         }
     }
     if ($handle = opendir($path)) {
         $folder_img = "components/com_redshop/assets/images/folder.png";
         $info = @getimagesize($folder_img);
         $width = @$info[0];
         $height = @$info[1];
         if ($info[0] > 50 || $info[1] > 50) {
             $dimensions = $this->_imageResize($info[0], $info[1], 50);
             $width_60 = $dimensions[0];
             $height_60 = $dimensions[1];
         } else {
             $width_60 = $width;
             $height_60 = $height;
         }
         $j = 1;
         for ($f = 0; $f < count($files); $f++) {
             $link = "index.php?tmpl=component&option=com_redshop&view=product_detail&task=media_bank&folder=1&path=" . $files[$f]['fullname'] . "&dirpath=" . $files[$f]['relname'];
             $tbl .= "<td width='25%'><table width='120' height='70' style='background-color:#C0C0C0;' cellspacing='1' cellpdding='1'>\n\t\t\t\t<tr><td align='center' style='background-color:#FFFFFF;'><a href='" . $link . "'>\n\t\t\t\t<img src='" . $folder_img . "' width='" . $width_60 . "' height='" . $height_60 . "'></a></tr><tr height='15'>\n\t\t\t\t<td style='background-color:#F7F7F7;' align='center'><label>" . $files[$f]['name'] . "</label></td></tr></table></td>";
             if ($j % 4 == 0) {
                 $tbl .= "</tr><tr>";
             }
             $j++;
         }
         $i = $j;
         while (false !== ($filename = readdir($handle))) {
             if (preg_match("/.jpg/", $filename) || preg_match("/.gif/", $filename) || preg_match("/.png/", $filename)) {
                 $live_path = $url . $dir_path . '/' . $filename;
                 $info = @getimagesize($live_path);
                 $width = @$info[0];
                 $height = @$info[1];
                 if ($info[0] > 50 || $info[1] > 50) {
                     $dimensions = $this->_imageResize($info[0], $info[1], 50);
                     $width_60 = $dimensions[0];
                     $height_60 = $dimensions[1];
                 } else {
                     $width_60 = $width;
                     $height_60 = $height;
                 }
                 $tbl .= "<td width='25%'><table width='120' height='70' style='background-color:#C0C0C0;' cellspacing='1' cellpdding='1'>\n\t\t\t\t\t<tr><td align='center' style='background-color:#FFFFFF;'>\n\t\t\t\t\t<a href=\"javascript:window.parent.jimage_insert('" . $dir_path . '/' . $filename . "');window.parent.SqueezeBox.close();\">\n\t\t\t\t\t<img width='" . $width_60 . "' height='" . $height_60 . "' alt='" . $filename . "' src='" . $live_path . "'></a>\n\t\t\t\t\t</td></tr><tr height='15'><td style='background-color:#F7F7F7;' align='center'><label>" . substr($filename, 0, 10) . "</label>\n\t\t\t\t\t</td></tr></table></td>";
                 if ($i % 4 == 0) {
                     $tbl .= "</tr><tr>";
                 }
                 $i++;
             }
         }
         $tbl .= '</tr></table>';
         echo $tbl;
         closedir($handle);
     }
 }
Beispiel #15
0
 function loadAllFolder($path)
 {
     $folders = JFolder::listFolderTree($path, '');
     return $folders;
 }
    function fileManagerInterface($report)
    {
        ?>
<script language="JavaScript" type="text/javascript">
function addFile(what) {
	if(document.getElementById) {
		tr = what;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		tr = tr.previousSibling;
		var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		checkForLast();
		checkForMax();
	}
}
function show (what) {
	what.style.display = "block";
}

function hide (what) {
	what.style.display = "none";
}

function checkForMax(){
	btnsminus_f = document.getElementsByName('minus_f');
	document.getElementsByName('plus_f')[0].disabled = (btnsminus_f.length > 4) ? true : false;
}

function checkForLast(){
	btnsminus_f = document.getElementsByName('minus_f');
	for (i = 0; i < btnsminus_f.length; i++){
		btnsminus_f[i].className = "addfile";
		if (btnsminus_f.length > 1){
			btnsminus_f[i].disabled = false;
			show(btnsminus_f[i]);
		}
		else{
			btnsminus_f[i].disabled = true;
			hide(btnsminus_f[i]);
		}
	}
	btnsminus_l = document.getElementsByName('minus_l');
	for (i = 0; i < btnsminus_l.length; i++){
		btnsminus_l[i].className = "addfile";
		if (btnsminus_l.length > 1){
			btnsminus_l[i].disabled = false;
			show(btnsminus_l[i]);
		}
		else{
			btnsminus_l[i].disabled = true;
			hide(btnsminus_l[i]);
		}
	}
}

function dropFile(what){
	tr = what;
	while (tr.tagName != 'TR') tr = tr.parentNode;
	tr.parentNode.removeChild(tr);
	checkForLast();
	checkForMax();
}

</script>
<form action="index.php?option=com_flippingbook&task=file_manager" method="post" name="adminForm" enctype="multipart/form-data">
<?php 
        echo $report;
        ?>
<fieldset class="adminform">
	<legend><?php 
        echo JText::_('Upload Files');
        ?>
</legend>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td width="30%" valign="top">
				<table border="0" cellpadding="0" cellspacing="0" class="middle_form">
					<tr height="30">
						<td valign="top">
							<input type="hidden" name="MAX_FILE_SIZE" value="16777216">
							<input type="file" name="upload[]" size="50">
						</td>
						<td width="50" align="center" valign="top">
							<input type="button" name="minus_f" value="&#8212;" onClick="dropFile(this);" class="addfile" style="display: none;">
						</td>
					</tr><tr height="30">
						<td colspan="2" valign="top">
							<input type="button"  name="plus_f" value="<?php 
        echo JText::_('add field');
        ?>
" onClick="addFile(this);" class="addfile">
						</td>
					</tr>
				</table>
			</td>
			<td valign="top">&nbsp;&nbsp;&nbsp;
				<input name="submit" type="submit" value="<?php 
        echo JText::_('Upload');
        ?>
" />
			</td>
		</tr>
	</table>
	<?php 
        echo JText::_('To ensure full compatibility, we recommend that you only use Latin characters and numerals in files and folders names.');
        ?>
</fieldset>
<?php 
        if (JRequest::getVar('folder', '', '', 'string')) {
            $folder = JRequest::getVar('folder', '', '', 'string');
        } else {
            $folder = DS . 'images' . DS . 'flippingbook';
        }
        if (substr($folder, 0, 20) != DS . 'images' . DS . 'fli' . 'pping' . 'book') {
            $folder = DS . 'images' . DS . 'flippingbook';
        }
        $path = JPATH_SITE . $folder;
        $allFiles = array(null);
        $filter = '.';
        $recurse = false;
        $fullpath = false;
        // Get the files and folders
        jimport('joomla.filesystem.folder');
        $files = JFolder::files($path, $filter, $recurse, $fullpath);
        $folders = JFolder::folders($path, $filter, $recurse, $fullpath);
        ?>
<fieldset class="adminform">
	<legend><?php 
        echo JText::_('Current folder');
        ?>
: <?php 
        echo $folder;
        ?>
</legend>
	<table width="100%" class="adminlist">
	
		<tr>
			<td nowrap="nowrap" style="font-size:120%" colspan="4">
<?php 
        if (JRequest::getVar('folder', '', '', 'string')) {
            ?>
				<a href="index.php?option=com_flippingbook&task=file_manager"><?php 
            echo JText::_('Go To the Root Folder');
            ?>
</a>&nbsp;&nbsp;&nbsp;
<?php 
        }
        ?>
				<a href="index.php?option=com_flippingbook&task=create_folder&folder=<?php 
        echo $folder;
        ?>
"><?php 
        echo JText::_('Create a new folder');
        ?>
</a>
			</td>
		</tr>

		<tr>
			<th width="150" align="left"><?php 
        echo JText::_('Name');
        ?>
</th>
			<th width="90" align="left"><?php 
        echo JText::_('Size');
        ?>
</th>
			<th width="100" align="center" colspan="2"><?php 
        echo JText::_('Action');
        ?>
</th>
		</tr>
<?php 
        $folders = JFolder::listFolderTree(JPATH_ROOT . DS . $folder, '', 10);
        if (count($folders) > 0) {
            foreach ($folders as $folders_) {
                $relname = str_replace(DS . 'images' . DS . 'flippingbook' . DS, '', $folders_["relname"]);
                ?>
	<tr>
		<td nowrap="nowrap" style="font-size:120%"><a href="index.php?option=com_flippingbook&task=file_manager&folder=<?php 
                echo $folders_["relname"];
                ?>
"><?php 
                echo $folders_["relname"];
                ?>
</a></td>
		<td align="left">&mdash;</td>
		<td width="100"><a href="index.php?option=com_flippingbook&task=rename_folder&folder_to_rename=<?php 
                echo $relname;
                ?>
&folder=<?php 
                echo $folder;
                ?>
"><?php 
                echo JText::_('Rename');
                ?>
</a></td>
		<td width="100"><a href="index.php?option=com_flippingbook&task=delete_folder&folder_to_delete=<?php 
                echo $relname;
                ?>
&folder=<?php 
                echo $folder;
                ?>
"><?php 
                echo JText::_('Delete');
                ?>
</a></td>
	</tr>
<?php 
            }
        }
        $i = 0;
        foreach ($files as $file) {
            ?>
		<tr>
			<td nowrap="nowrap"><?php 
            echo $file;
            ?>
</td>
			<td align="left"><?php 
            $fb_filesize = filesize($path . DS . $file);
            echo number_format($fb_filesize, 0, ' ', ' ');
            ?>
</td>
			<td width="100"><a href="index2.php?option=com_flippingbook&task=rename_file&file_to_rename=<?php 
            echo $file;
            ?>
&folder=<?php 
            echo $folder;
            ?>
"><?php 
            echo JText::_('Rename');
            ?>
</a></td>
			<td width="100"><a href="index2.php?option=com_flippingbook&task=delete_file&file_to_delete=<?php 
            echo $file;
            ?>
&folder=<?php 
            echo $folder;
            ?>
"><?php 
            echo JText::_('Delete');
            ?>
</a></td>
		</tr>
<?php 
            $i++;
        }
        ?>
	</table>
</fieldset>
<input type="hidden" name="option" value="com_flippingbook" />
<input type="hidden" name="task" value="upload_file" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="folder" value="<?php 
        echo JRequest::getVar('folder', '', '', 'string');
        ?>
" />
</form>
<?php 
    }
Beispiel #17
0
 public function getItem($pk = null)
 {
     $searchpath = JPATH_ROOT . DIRECTORY_SEPARATOR . "media" . DIRECTORY_SEPARATOR . "jui";
     $item = JFolder::listFolderTree($searchpath, "", 3, 0, 0);
     return $item;
 }
Beispiel #18
0
 public function getTemplateFolders()
 {
     jimport('joomla.filesystem.folder');
     return JFolder::listFolderTree('../administrator/components/com_joomailermailchimpintegration/templates/', '', 1);
 }
 function getFilesSelectBox($field_name, $current_value, $add_blank_field, $filter, $custom_param)
 {
     //Folders list
     if ($add_blank_field == 1) {
         $files[] = JHTML::_('select.option', '', '- ' . JText::_('Select Image') . ' -');
     }
     $files[] = JHTML::_('select.option', '<OPTGROUP>', DS . 'images' . DS . 'flippingbook' . DS);
     $image_files_root = JFolder::files(JPATH_SITE . DS . 'images' . DS . 'flippingbook' . DS, '.(' . $filter . ')$');
     if (count($image_files_root) > 0) {
         foreach ($image_files_root as $file) {
             $path_for_db = strtr($file, "\\", "/");
             $path_for_db = preg_replace('/^\\/images\\/flippingbook\\//', '', $path_for_db);
             $files[] = JHTML::_('select.option', $path_for_db, $file);
         }
     }
     $files[] = JHTML::_('select.option', '</OPTGROUP>');
     $folders = JFolder::listFolderTree(JPATH_ROOT . DS . 'images' . DS . 'flippingbook', '', 10);
     if (count($folders) > 0) {
         foreach ($folders as $folder) {
             $files[] = JHTML::_('select.option', '<OPTGROUP>', $folder["relname"] . DS);
             $image_files = JFolder::files(JPATH_SITE . $folder["relname"], '.(jpg|jpeg|swf)$');
             if (count($image_files) > 0) {
                 foreach ($image_files as $file) {
                     $path_for_db = strtr($folder["relname"] . DS . $file, "\\", "/");
                     $path_for_db = preg_replace('/^\\/images\\/flippingbook\\//', '', $path_for_db);
                     $files[] = JHTML::_('select.option', $path_for_db, $file);
                 }
             }
             $files[] = JHTML::_('select.option', '</OPTGROUP>');
         }
     }
     return JHTML::_('select.genericlist', $files, $field_name, 'class="inputbox" size="1" ' . $custom_param . ' ', 'value', 'text', $current_value);
 }
Beispiel #20
0
    public function execute($task)
    {
        $rootfolder = JPATH_ROOT . '/administrator/components/com_adsmanager/doc/';
        $folderstmp = JFolder::listFolderTree($rootfolder, ".*", 50);
        //var_dump(JFolder::files($rootfolder,".*\.html"));exit();
        $folders = array();
        $files = array();
        foreach ($folderstmp as $f) {
            if ($f['name'] == "images") {
                continue;
            }
            if (!isset($folders[$f['parent']])) {
                $folders[$f['parent']] = array();
            }
            $files[$f['id']] = JFolder::files($f['fullname'], ".*\\.html");
            foreach ($files[$f['id']] as $key => $file) {
                $ff = array();
                $ff['name'] = $file;
                $ff['filepath'] = $f['fullname'] . "/" . $file;
                $files[$f['id']][$key] = $ff;
            }
            $folders[$f['parent']][] = $f;
        }
        $files[0] = JFolder::files($rootfolder, ".*\\.html");
        //echo "<ul>";
        $this->urlbuilder(0, 0, $files, $folders, "", $links, false);
        ?>
		<div class="row-fluid">
			<div class="span3">
			<?php 
        $this->displayTOC($links);
        ?>
			</div>
			<div class="span9">
			<?php 
        $page = JRequest::getVar('page', '');
        $found = false;
        $currentlevel = null;
        $mode = null;
        $pagelinks = array();
        foreach ($links as $key => $link) {
            if ($found == false) {
                if ($link['page'] == $page) {
                    $found = true;
                    //var_dump($link);
                    if ($link['type'] == 'file') {
                        echo $this->renderFile($link, 1);
                        break;
                    } else {
                        if ($link['type'] == 'folder') {
                            $mode = 'list';
                        } else {
                            $mode = 'flat';
                        }
                    }
                    $currentlevel = $link['level'];
                    $pagelinks[] = $link;
                } else {
                    continue;
                }
            } else {
                if ($link['level'] > $currentlevel) {
                    $pagelinks[] = $link;
                } else {
                    break;
                }
            }
        }
        if ($mode == 'list') {
            $this->displayTOC($pagelinks);
        } else {
            if ($mode == 'flat') {
                $currentlevel = $pagelinks[0]['level'];
                foreach ($pagelinks as $link) {
                    if ($link['type'] == 'file') {
                        echo $this->renderFile($link, $link['level'] - $currentlevel + 1);
                    } else {
                        echo $this->renderFolder($link, $link['level'] - $currentlevel + 1);
                    }
                }
            }
        }
        ?>
			</div>
		</div>
		<?php 
    }
Beispiel #21
0
?>
</button>
</div>
<br style="clear:both;"/>
<hr />
<h2><?php 
echo JText::_("AG_FOLDERS");
?>
</h2>
<?php 
echo JText::_('Select Folder:');
?>
&nbsp;
<select name="AG_form_folderName">
<?php 
$ag_folders = JFolder::listFolderTree(JPATH_SITE . $ag_init_itemURL, "");
$ag_init_itemURL_strlen = strlen($ag_init_itemURL);
if (!empty($ag_folders)) {
    foreach ($ag_folders as $ag_folders_key => $ag_folders_value) {
        $ag_folderName = substr($ag_folders_value['relname'], $ag_init_itemURL_strlen);
        echo '<option value="' . $ag_folderName . '" />' . $ag_folderName;
    }
}
?>
</select>
<br />

<p> </p>
<hr />
<h2><input type="CHECKBOX" id="AG_form_insertParams" name="AG_form_insertParams" /> <?php 
echo JText::_("AG_PARAMETERS");
	<div class="AG_border_color AG_border_width AG_item_controls_wrapper">	
	    <input type="text" value="' . JFile::stripExt(basename($value)) . '" name="AG_rename[' . $ag_itemURL . $value . ']" class="AG_input" style="width:95%" /><hr /> 
	    ' . JText::_($ag_XML_visible) . '<hr />
        <img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $AG_templateID . '/images/operations.png" style="float:left;" /><input type="checkbox" value="' . $ag_itemURL . $value . '" name="AG_cbox_selectItem[]" class="AG_cbox_selectItem"><hr />
	    ' . JText::_('PRIORITY') . ':&nbsp;<input type="text" size="3" value="' . $ag_XML_priority . '" name="AG_cbox_priority[' . $ag_itemURL . $value . ']" class="AG_input" /><hr />
        <input type="radio" value="' . $value . '" name="AG_folder_thumb" class="AG_folder_thumb" class="AG_input"' . $AG_thumb_checked . ' />&nbsp;' . JText::_('FOLDER THUMB') . ' 
	</div>
     </div>
     ';
    }
}
if (empty($ag_folders) && empty($ag_images)) {
    $ag_preview_content .= JText::_('No folders or images found in current folder ...');
}
$AG_folderDroplist = "<select id='AG_operations_targetFolder' name='AG_operations_targetFolder'>";
$AG_folders = JFolder::listFolderTree(JPATH_SITE . $ag_rootFolder, "");
$AG_rootFolder_strlen = strlen($ag_rootFolder);
$AG_folderDroplist .= "<option value='" . $ag_rootFolder . "' >" . JText::_('IMAGES ROOT FOLDER') . "</option>";
if (!empty($AG_folders)) {
    foreach ($AG_folders as $AG_folders_key => $AG_folders_value) {
        $AG_folderName = substr($AG_folders_value['relname'], $AG_rootFolder_strlen);
        $AG_folderDroplist .= "<option value='" . $ag_rootFolder . $AG_folderName . "' >" . $AG_folderName . "</option>";
    }
}
$AG_folderDroplist .= "</select>";
$ag_preview_content .= '

<script type="text/javascript">
AG_jQuery("#AG_operations").change(function() {
        switch(AG_jQuery(this).val())
        {
Beispiel #23
0
 /**
  * Helper wrapper method for listFolderTree
  *
  * @param   string   $path      The path of the folder to read.
  * @param   string   $filter    A filter for folder names.
  * @param   integer  $maxLevel  The maximum number of levels to recursively read, defaults to three.
  * @param   integer  $level     The current level, optional.
  * @param   integer  $parent    Unique identifier of the parent folder, if any.
  *
  * @return  array  Folders in the given folder.
  *
  * @see     JFolder::listFolderTree()
  * @since   3.4
  */
 public function listFolderTree($path, $filter, $maxLevel = 3, $level = 0, $parent = 0)
 {
     return JFolder::listFolderTree($path, $filter, $maxLevel, $level, $parent);
 }
Beispiel #24
0
 /**
  * get Tree of CSS files
  * @param  designs
  * @return $filetree
  **/
 function getCSSTree($design, $source = false)
 {
     if ($source) {
         $rel_path = DS . 'templates' . DS . $this->template_name . DS . 'yaml';
     } else {
         $rel_path = DS . 'templates' . DS . $this->template_name . DS . 'css' . DS . ($design ? $design : $this->design);
     }
     $path = JPATH_SITE . $rel_path;
     $folders = JFolder::listFolderTree($path . '/', '.', 1);
     // Basic CSS Layout Files
     $filetree['basicfiles'] = JFolder::files($path, 'css$');
     // Child CSS Files
     foreach ($folders as $folder) {
         $folder_name = $folder['name'];
         $filetree['folderfiles'][$folder_name . '/'] = JFolder::files($folder['fullname'], 'css$');
     }
     return $filetree;
 }