Example #1
0
 /**
  * Call all needed things to use YAML Joomla! Templates
  **/
 function onAfterRoute()
 {
     global $mainframe, $jyaml;
     $document =& JFactory::getDocument();
     $doctype = $document->getType();
     // Return document is not type of html
     if ($doctype != 'html') {
         return;
     }
     // backand
     if ($mainframe->isAdmin() || !is_dir(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'yaml')) {
         $option = JRequest::getVar('option', false);
         if ($option != 'com_jyaml') {
             $db =& JFactory::getDBO();
             // Get the current frontend default template
             $query = ' SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0';
             $db->setQuery($query);
             define('JYAML_FRONTEND_TEMPLATE', $db->loadResult());
             if (!is_dir(JPATH_SITE . DS . 'templates' . DS . JYAML_FRONTEND_TEMPLATE . DS . 'yaml')) {
                 return;
             }
             require_once JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.helper.php';
             // define template path
             define('JYAML_PATH_ABS', JPATH_SITE . DS . 'templates' . DS . JYAML_FRONTEND_TEMPLATE);
             // Reset object without set the configuration
             $jyaml = new JYAML(false);
             // Load Template Plugins prefix admin.
             $jyaml->getPlugins(false, true);
         }
         return;
     }
     // call jyaml object
     $jyaml = new JYAML($mainframe->getTemplate());
 }
Example #2
0
 /**
  * display method
  * @return void
  **/
 function display($tpl = null)
 {
     // make mainframe variable available
     global $mainframe, $option;
     // get design and template name
     $template_name = JRequest::getVar('template_name', 'hm_yaml', 'REQUEST');
     $this->assignRef('template_name', $template_name);
     $design = JRequest::getVar('design', 'default', 'REQUEST');
     $this->assignRef('design', $design);
     // Global XML for referenz view
     $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . '_global.xml';
     $config_global = JYAML::readConfig($template_name, $xmlfile);
     $this->assignRef('config_global', $config_global);
     // Design XML
     $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . $design . '.xml';
     $config_design = JYAML::readConfig($template_name, $xmlfile);
     $this->assignRef('config_design', $config_design);
     // Custom Config XML
     $filename = JRequest::getVar('file', NULL, 'REQUEST');
     $this->assignRef('filename', $filename);
     $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . $design . DS . $filename;
     $config = JYAML::readConfig($template_name, $xmlfile);
     $this->assignRef('config', $config);
     $html_list = JYAML::getHTMLList();
     $this->assignRef('html_list', $html_list);
     $designlist = JYAML::getDesignList();
     $this->assignRef('designlist', $designlist);
     $positions = JYAML::getPositions();
     $this->assignRef('positions', $positions);
     /*** Load Configuration ***/
     $conf_design = JYAML::parseConfigDesign($this->config_design, true);
     $conf_global = JYAML::parseConfigDesign($this->config_global);
     $conf = JYAML::parseConfigDesign($this->config);
     $this->assignRef('conf', $conf);
     $this->assignRef('conf_design', $conf_design);
     $this->assignRef('conf_global', $conf_global);
     /*** Buttons ***/
     // Explore Buttons for Stylesheets
     $explore_buttons[0][0]['label'] = 'YAML EXPLORE CSS';
     $explore_buttons[0][0]['link'] = 'index3.php?option=' . $option . '&controller=templateExplorer&task=view&ext=css&template_name=' . $this->template_name . '&design=' . $design;
     // Explore Buttons for Scripts
     $explore_buttons[1][0]['label'] = 'YAML EXPLORE SCRIPTS';
     $explore_buttons[1][0]['link'] = 'index3.php?option=' . $option . '&controller=templateExplorer&task=view&ext=js&template_name=' . $this->template_name . '&design=' . $design;
     $this->assignRef('explore_buttons', $explore_buttons);
     parent::display($tpl);
 }
Example #3
0
 /**
  * display method
  * @return void
  **/
 function display($tpl = null)
 {
     // make mainframe variable available
     global $mainframe, $option;
     // get template name
     $template_name = JRequest::getVar('template_name', 'hm_yaml', 'REQUEST');
     $this->assignRef('template_name', $template_name);
     $design = JRequest::getVar('design', 'default', 'REQUEST');
     $this->assignRef('design', $design);
     $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . '_global.xml';
     $config = JYAML::readConfig($template_name, $xmlfile);
     $this->assignRef('config', $config);
     $designlist = JYAML::getDesignList(true);
     $this->assignRef('designlist', $designlist);
     $positions = JYAML::getPositions();
     $this->assignRef('positions', $positions);
     /*** Load Configuration ***/
     $conf = JYAML::parseConfigDesign($this->config);
     $this->assignRef('conf', $conf);
     parent::display($tpl);
 }
Example #4
0
 function save()
 {
     global $option, $mainframe;
     $plugin_name = JRequest::getVar('plugin_name', false);
     $template_name = JRequest::getVar('template_name', false);
     $plugins = JRequest::getVar('plugins', false);
     $paramString = '';
     if ($plugin_name && $template_name) {
         $plugin = JYAML::getPlugins($template_name, $plugin_name);
         //$plugin->configfile
         foreach ($plugins[$plugin_name] as $name => $data) {
             $paramString .= $name . "=" . $data . "\n";
         }
         if (JFile::write($plugin->configfile, $paramString)) {
             $mainframe->enqueueMessage(JText::_('YAML SAVED SUCCESS'));
             $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=hmyaml&task=wait');
         } else {
             $mainframe->enqueueMessage(JText::_('YAML SAVED FAILED'), 'error');
             $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=plugins&task=&template_name=' . $template_name . '&plugin=' . $plugin_name);
         }
     }
 }
Example #5
0
    function processUpdate()
    {
        global $option, $mainframe;
        $allow_url_fopen = ini_get('allow_url_fopen');
        if (!$allow_url_fopen) {
            echo '<p class="yaml_msg">allow_url_fopen on PHP is disabled on your host. Please make a manual Update.</p>';
            $mainframe->close();
        } else {
            $data = JYAML::getVersionInfo(true);
            $version = $data['i-j-version'] . '-' . $data['i-j-build'];
            /* Update URL */
            $url = JYAML::getDownloadURL('updater') . '?version=' . rawurlencode($version) . '&full=1';
            $updateFiles = file_get_contents($url);
            $files = $this->getUpdateFiles($updateFiles);
        }
        $config =& JFactory::getConfig();
        $tmp_path = $config->getValue('config.tmp_path');
        jimport('joomla.filesystem.archive');
        $dataold = JYAML::getVersionInfo(true);
        /* Full Update */
        if (isset($files['full'])) {
            $extractPath = $tmp_path . DS . 'jyaml_update';
            $filename = basename($files['full']);
            /* Delete temp folder and create empty */
            if (JFolder::exists($extractPath)) {
                JFolder::delete($extractPath);
                JFolder::create($extractPath);
            }
            if (JFile::exists($tmp_path . DS . $filename)) {
                JFile::delete($tmp_path . DS . $filename);
            }
            $content = file_get_contents($files['full']);
            if (JFile::exists($tmp_path . DS . $filename)) {
                JFile::delete($tmp_path . DS . $filename);
            }
            if (!JFile::write($tmp_path . DS . $filename, $content)) {
                echo '<p class="off">' . JText::_('YAML CANT EXTRACT SAVE UPDATE FILE IN TMP') . '</p>';
            }
            if (!JArchive::extract($tmp_path . DS . $filename, $extractPath)) {
                echo '<p class="off">' . JText::_('YAML CANT EXTRACT UPDATE FILE') . '</p>';
            }
            // Call update script if available
            $update_script = $extractPath . DS . 'jyaml_update_script.php';
            if (JFile::exists($update_script)) {
                include_once $update_script;
                $update_result = new jyamlUpdateScript();
                // Delete update script
                JFile::delete($update_script);
                if (!$update_result) {
                    echo '<p class="off">' . JText::_('YAML RUN UPDATE SCRIPT FAIL') . '</p>';
                }
            }
            $files = array();
            $files = JFolder::files($extractPath, '.', true, true);
            $error_folders = array();
            $error_files = array();
            foreach ($files as $file) {
                $file_relative = str_replace($extractPath . DS, '', $file);
                $dest = JPATH_ROOT . DS . $file_relative;
                if (!JFolder::exists(dirname($dest))) {
                    if (!JFolder::create(dirname($dest))) {
                        $error_folders[] = dirname($dest);
                    }
                }
                if (!JFile::copy($file, $dest)) {
                    $error_files[] = DS . $file_relative;
                }
            }
            if ($error_folders) {
                echo '<p class="off">' . JText::_('YAML CANT CREATE DIRECTORY') . '</p>';
                echo '<ul>';
                foreach ($error_folders as $ef) {
                    echo '<li>' . $ef . '</li>';
                }
                echo '</ul>';
            }
            if ($error_files) {
                echo '<p class="off">' . JText::_('YAML CANT UPDATE-CREATE FILE') . '</p>';
                echo '<ul>';
                foreach ($error_files as $ef) {
                    echo '<li>' . $ef . '</li>';
                }
                echo '</ul>';
            }
            if (!$error_folders && !$error_files) {
                echo '<h2 class="on" style="text-align:center;">' . JText::_('YAML UPDATE SUCCESSFULLY') . '</h2>';
            }
            /* Delete temp file and folder */
            if (JFolder::exists($extractPath)) {
                JFolder::delete($extractPath);
            }
            if (JFile::exists($tmp_path . DS . $filename)) {
                JFile::delete($tmp_path . DS . $filename);
            }
            $data = JYAML::getVersionInfo(true);
            echo '<hr />';
            echo '<p class="off" style="font-weight:normal;">' . JText::_('YAML UPDATE OLD VERSION') . ': ' . $dataold['i-j-version'] . ' Build: ' . $dataold['i-j-build'] . '<p>';
            echo '<p class="on" style="font-weight:bold;">' . JText::_('YAML UPDATE NEW VERSION') . ': ' . $data['i-j-version'] . ' Build: ' . $data['i-j-build'] . '<p>';
            echo '<hr />';
            ?>
      <fieldset>
          <div align="center">
            <button onclick="window.parent.location.replace('index.php?option=<?php 
            echo $option;
            ?>
');" type="button"><?php 
            echo JText::_('YAML CLOSE UPDATE WINDOW');
            ?>
</button>
          </div>
      </fieldset>
      <?php 
        }
        $mainframe->close();
    }
Example #6
0
 /**
  * save a record (and redirect to main page)
  * @return void
  */
 function save($apply = false)
 {
     global $option, $mainframe;
     $template_name = JRequest::getVar('template_name', 'hm_yaml', 'POST');
     $design = JRequest::getVar('design', false, 'POST');
     $now = JHTML::_('date', 'now', JText::_('DATE_FORMAT_LC2'));
     $now = str_replace('&bull;', '', $now);
     /* XML File */
     $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<yaml>\n" . "  <name>" . $design . ".xml</name>\n" . "  <description>Design Template Settings</description>\n\n" . "  <lastModification>" . $now . "</lastModification>\n\n" . "  <config>\n";
     // HTML File
     $html_file = JRequest::getVar('html_file', false, 'POST');
     if ($html_file) {
         $xml .= "    <html_file>" . $html_file . "</html_file>\n\n";
     }
     // Layout filenames
     if ($layout_value = JRequest::getVar('layout_1col')) {
         $xml .= "    <layout_1col>" . $layout_value . "</layout_1col>\n";
     }
     if ($layout_value = JRequest::getVar('layout_2col_1')) {
         $xml .= "    <layout_2col_1>" . $layout_value . "</layout_2col_1>\n";
     }
     if ($layout_value = JRequest::getVar('layout_2col_2')) {
         $xml .= "    <layout_2col_2>" . $layout_value . "</layout_2col_2>\n";
     }
     if ($layout_value = JRequest::getVar('layout_3col')) {
         $xml .= "    <layout_3col>" . $layout_value . "</layout_3col>\n";
     }
     if ($layout_value) {
         $xml .= "\n";
     }
     // Content Column Configuration
     $col1 = JYAML::validateCol('col1');
     $col2 = JYAML::validateCol('col2');
     $col3 = JYAML::validateCol('col3');
     // col1_content
     for ($i = 0; $i < count($col1['content_type']); $i++) {
         $style = $col1['content_style'][$i] == '(empty_value)' ? '' : ' style="' . $col1['content_style'][$i] . '"';
         $pos = $col1['content_pos'][$i] == '(empty_value)' ? '' : $col1['content_pos'][$i];
         $advanced = $col1['content_advanced'][$i] ? " advanced='" . $col1['content_advanced'][$i] . "'" : '';
         if ($pos) {
             $xml .= "    <col1_content type=\"" . $col1['content_type'][$i] . "\"" . $style . $advanced . ">" . $col1['content_pos'][$i] . "</col1_content>\n";
         } else {
             $xml .= "    <col1_content type=\"" . $col1['content_type'][$i] . "\"" . $style . " />\n";
         }
     }
     if (count($col1['content_type'])) {
         $xml .= "\n";
     }
     // col2_content
     for ($i = 0; $i < count($col2['content_type']); $i++) {
         $style = $col2['content_style'][$i] == '(empty_value)' ? '' : ' style="' . $col2['content_style'][$i] . '"';
         $pos = $col2['content_pos'][$i] == '(empty_value)' ? '' : $col2['content_pos'][$i];
         $advanced = $col2['content_advanced'][$i] ? " advanced='" . $col2['content_advanced'][$i] . "'" : '';
         if ($pos) {
             $xml .= "    <col2_content type=\"" . $col2['content_type'][$i] . "\"" . $style . $advanced . ">" . $col2['content_pos'][$i] . "</col2_content>\n";
         } else {
             $xml .= "    <col2_content type=\"" . $col2['content_type'][$i] . "\"" . $style . " />\n";
         }
     }
     if (count($col2['content_type'])) {
         $xml .= "\n";
     }
     // col3_content
     for ($i = 0; $i < count($col3['content_type']); $i++) {
         $style = $col3['content_style'][$i] == '(empty_value)' ? '' : ' style="' . $col3['content_style'][$i] . '"';
         $pos = $col3['content_pos'][$i] == '(empty_value)' ? '' : $col3['content_pos'][$i];
         $advanced = $col3['content_advanced'][$i] ? " advanced='" . $col3['content_advanced'][$i] . "'" : '';
         if ($pos) {
             $xml .= "    <col3_content type=\"" . $col3['content_type'][$i] . "\"" . $style . $advanced . ">" . $col3['content_pos'][$i] . "</col3_content>\n";
         } else {
             $xml .= "    <col3_content type=\"" . $col3['content_type'][$i] . "\"" . $style . " />\n";
         }
     }
     if (count($col3['content_type'])) {
         $xml .= "\n";
     }
     // Stylesheets
     $stylesheets = JYAML::validateStylesheets();
     foreach ($stylesheets as $stylesheet) {
         $source = false;
         $browser = false;
         $type = false;
         $media = false;
         if (isset($stylesheet['file']) && $stylesheet['file']) {
             if ($stylesheet['source']) {
                 $source = ' source="' . $stylesheet['source'] . '"';
             }
             if ($stylesheet['browser']) {
                 $browser = ' browser="' . $stylesheet['browser'] . '"';
             }
             if ($stylesheet['type']) {
                 $type = ' type="' . $stylesheet['type'] . '"';
             }
             if ($stylesheet['media']) {
                 $media = ' media="' . $stylesheet['media'] . '"';
             }
             $xml .= "    <addStylesheet" . $source . "" . $browser . "" . $type . "" . $media . ">" . $stylesheet['file'] . "</addStylesheet>\n";
         }
     }
     if ($stylesheets) {
         $xml .= "\n";
     }
     // Scripts
     $scripts = JYAML::validateScripts();
     foreach ($scripts as $script) {
         $source = false;
         $browser = false;
         $type = false;
         if (isset($script['file']) && $script['file']) {
             if ($script['source']) {
                 $source = ' source="' . $script['source'] . '"';
             }
             if ($script['browser']) {
                 $browser = ' browser="' . $script['browser'] . '"';
             }
             if ($script['type']) {
                 $type = ' type="' . $script['type'] . '"';
             }
             $xml .= "    <addScript" . $source . "" . $browser . "" . $type . ">" . $script['file'] . "</addScript>\n";
         }
     }
     if ($scripts) {
         $xml .= "\n";
     }
     // Add Head
     $addhead = JRequest::getVar('addhead', false, 'POST', '', JREQUEST_ALLOWRAW);
     if ($addhead) {
         $xml .= "    <addHead><![CDATA[" . $addhead . "]]></addHead>\n\n";
     }
     // Own Vars
     $ownVars = JRequest::getVar('ownVars', array(), 'POST');
     $i = 0;
     $vars = array();
     foreach ($ownVars as $var) {
         if (isset($var['name'])) {
             $vars[$i]['name'] = $var['name'];
         }
         if (isset($var['value'])) {
             $vars[$i - 1]['value'] = $var['value'];
         }
         $i++;
     }
     if ($vars) {
         foreach ($vars as $var) {
             if ($var['name'] && isset($var['value'])) {
                 $xml .= "    <" . $var['name'] . ">" . $var['value'] . "</" . $var['name'] . ">\n";
             }
         }
         $xml .= "\n";
     }
     // Others
     $debug = JRequest::getVar('debug', false, 'POST');
     if (is_numeric($debug)) {
         $xml .= "    <debug>" . $debug . "</debug>\n";
     }
     // Plugins
     $plugins = JRequest::getVar('plugins', array(), 'POST');
     if ($plugins) {
         $xml .= "    <plugins>\n";
         foreach ($plugins as $plugin => $params) {
             $xml .= "      <" . $plugin . ">\n";
             foreach ($params as $name => $data) {
                 $xml .= "        <" . $name . ">" . $data . "</" . $name . ">\n";
             }
             $xml .= "      </" . $plugin . ">\n";
         }
         $xml .= "    </plugins>\n\n";
     }
     // Custom site configuation
     $customs = JYAML::validateCustoms();
     if ($customs) {
         $xml .= "    <custom>\n";
         foreach ($customs as $custom) {
             $xml .= "      <xmlconfig parts=\"" . $custom['parts'] . "\" desc=\"" . $custom['desc'] . "\" subitems=\"" . $custom['subitems'] . "\" force=\"" . $custom['force'] . "\">" . $custom['file'] . "</xmlconfig>\n";
         }
         $xml .= "    </custom>\n";
     }
     // Close xml Tags
     $xml .= "  </config>\n" . "</yaml>";
     // Write file ([designname].xml)
     $file = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . $design . '.xml';
     if (JFile::write($file, $xml)) {
         $mainframe->enqueueMessage(JText::_('YAML SAVED SUCCESS'));
         if ($apply) {
             $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=designConfig&task=edit&template_name=' . $template_name . '&design=' . $design);
         } else {
             $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=hmyaml&task=wait');
         }
     } else {
         $mainframe->enqueueMessage(JText::_('YAML SAVED FAILED'), 'error');
         $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=designConfig&task=edit&template_name=' . $template_name . '&design=' . $design);
     }
 }
Example #7
0
 function do_rename_template()
 {
     global $option, $mainframe;
     $template_name = JRequest::getVar('template', '');
     $new_template_name = JRequest::getVar('new_template_name', '');
     if ($template_name && $new_template_name) {
         $tpl_path_old = JPATH_SITE . DS . 'templates' . DS . $template_name;
         $tpl_path_new = JPATH_SITE . DS . 'templates' . DS . $new_template_name;
         $tpl_xml = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'templateDetails.xml';
         if (JFolder::exists($tpl_path_new)) {
             $mainframe->enqueueMessage(JText::_('YAML TEMPLATE EXITS'), 'error');
             $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=hmyaml&task=wait');
         } else {
             // Rename name in template xml
             $xmlcontent = JFile::read($tpl_xml);
             $xmlcontent = str_replace('<name>' . $template_name . '</name>', '<name>' . $new_template_name . '</name>', $xmlcontent);
             // Rename Language files
             $xmlcontent = str_replace('tpl_' . $template_name . '.ini', 'tpl_' . $new_template_name . '.ini', $xmlcontent);
             // Write new content in xml
             JFile::write($tpl_xml, $xmlcontent);
             // Rename template folder
             JFolder::move($tpl_path_old, $tpl_path_new);
             // Rename language files
             $langfiles = JFolder::files(JPATH_SITE . DS . 'language', 'tpl_' . $template_name . '.ini$', true, true);
             foreach ($langfiles as $langfile) {
                 $langfile_new = str_replace('tpl_' . $template_name . '.ini', 'tpl_' . $new_template_name . '.ini', $langfile);
                 JFile::move($langfile, $langfile_new);
             }
             // Activate renamed template in database
             JYAML::activateTemplate($new_template_name, false);
             $mainframe->enqueueMessage(JText::_('YAML RENAME TEMPLATE SUCCESS'));
             $mainframe->redirect(JURI::base() . 'index3.php?option=' . $option . '&controller=hmyaml&task=wait');
         }
     }
 }
Example #8
0
 /**
  * display method
  * @return void
  **/
 function display($tpl = null)
 {
     global $option, $mainframe;
     $html = '';
     $selected_template = NULL;
     $templates = JYAML::getTemplates();
     $db =& JFactory::getDBO();
     // Get the current default template
     $query = ' SELECT template ' . ' FROM #__templates_menu ' . ' WHERE client_id = 0' . ' AND menuid = 0 ';
     $db->setQuery($query);
     $defaultemplate = $db->loadResult();
     $switch_template = JRequest::getVar('switch_template', false, 'POST');
     if ($switch_template) {
         setcookie('switch_template', $switch_template, time() + 600);
         $selected_template = $switch_template;
         $mainframe->enqueueMessage(JText::_('YAML SWITCH TEMPLATE MSG') . ': ' . $selected_template);
         $mainframe->redirect(JURI::base() . 'index.php?option=' . $option);
     } elseif (isset($_COOKIE['switch_template'])) {
         $selected_template = $_COOKIE['switch_template'];
     }
     if (!$selected_template) {
         $first = true;
         foreach ($templates as $template) {
             if ($first) {
                 $selected_template = $template->name;
             }
             if ($defaultemplate == $template->name) {
                 $selected_template = $defaultemplate;
             }
             $first = false;
         }
     }
     /* Mask default template in list */
     $i = 0;
     $no_tpl_activ = true;
     foreach ($templates as $template) {
         if ($defaultemplate == $template->name) {
             $templates[$i]->text = $template->name . ' (default)';
             $no_tpl_activ = false;
         }
         $i++;
     }
     $this->assignRef('no_tpl_activ', $no_tpl_activ);
     if (!$selected_template) {
         echo '<p class="yaml_msg">' . JText::_('YAML NO TEMPLATES FOUND') . '</p>';
         $html .= '<form id="install_tpl_pgl" enctype="multipart/form-data" action="index.php" method="post" name="adminForm_tpl_install">';
         $html .= '<input type="hidden" id="install_url" name="install_url" class="input_box" size="70" value="' . JYAML::getDownloadURL('template') . '" />';
         $html .= '<p style="text-align:center;"><input type="submit" class="button" value="' . JText::_('YAML TEMPLATE INSTALL ACTIVATE DEFAULT') . '" /></p>';
         $html .= '<input type="hidden" name="type" value="" />';
         $html .= '<input type="hidden" name="installtype" value="url" />';
         $html .= '<input type="hidden" name="task" value="installDefaultTemplate" />';
         $html .= '<input type="hidden" name="option" value="' . $option . '" />';
         $html .= JHTML::_('form.token');
         $html .= '</form>';
         $html .= '<div id="installresult"></div>';
         echo $html;
         return false;
     }
     JToolBarHelper::title(JText::_('YAML COMPONENT TITLE') . ': <small>[' . $selected_template . ']</small>', 'yamlconfig');
     $this->assignRef('selected_template', $selected_template);
     $this->assignRef('template_name', $selected_template);
     $lists['switch_template'] = JHTML::_('select.genericlist', $templates, 'switch_template', '', 'name', 'text', $selected_template);
     // Global XML for referenz view
     $xmlfile = JPATH_SITE . DS . 'templates' . DS . $selected_template . DS . 'config' . DS . '_global.xml';
     $config_global = JYAML::readConfig($selected_template, $xmlfile);
     $conf_global = JYAML::parseConfigDesign($config_global);
     $this->assignRef('conf_global', $conf_global);
     $designlist = JYAML::getDesignList();
     $this->assignRef('designlist', $designlist);
     $this->assignRef('lists', $lists);
     $bar =& JToolBar::getInstance('toolbar');
     $bar->appendButton('Popup', 'upload', 'YAML IMPORT DESIGN', 'index3.php?option=' . $option . '&controller=fileControl&task=importDesign&template=' . $selected_template);
     $bar->appendButton('Popup', 'config', 'YAML DEFAULT CONF TXT', 'index3.php?option=' . $option . '&controller=defaultConfig&task=edit&template_name=' . $selected_template);
     $template_plugins = JYAML::getPlugins($selected_template);
     $this->assignRef('template_plugins', $template_plugins);
     JYAML::getPluginStatus();
     // FTP-Mode
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->assignRef('require_ftp_login', $ftp);
     parent::display($tpl);
 }
Example #9
0
    $pgl_global = ' | <label for="pgl_' . $plugin->name . '">' . JText::_('YAML DEFAULT CONFIG') . '</label>: ';
    $pgl_global .= '<input' . $pgl_checked . ' type="checkbox" name="pgl_' . $plugin->name . '" class="pgl_global" value="1" />';
    echo '<div class="slide-title-sub">' . $plugin->name . $pgl_global . '</div>';
    echo '<div class="ycontent-sub">' . $plugin->paramOutput . '</div>';
    echo '</div>';
}
?>
      </div> 
    </div> 
    <!-- Plugins: end -->
  
    <!-- Misc config: start -->  
    <div class="yslider">   
      <div class="slide-title">
        <?php 
echo JYAML::docLink('config:misc');
?>
        <?php 
echo JText::_('YAML CONF MISC TITLE');
?>
      </div>
      
      <div class="ycontent">
        <?php 
$radiolist[] = new JYAMLmakeSelect('1', JText::_('YAML ON TXT'));
$radiolist[] = new JYAMLmakeSelect('0', JText::_('YAML OFF TXT'));
$radiolist[] = new JYAMLmakeSelect('', JText::_('YAML DEFAULT CONFIG'));
?>
        <label class="yaml_label_def" for="debug"><?php 
echo JText::_('YAML CONF DEBUG LABEL');
?>
Example #10
0
?>
</span>
      </div>
      <div class="content"><?php 
echo JYAML::viewExtHTMLFiles();
?>
</div>
    </div>
    
    <div class="designbox">         
      <div class="legend"><?php 
echo JText::_('YAML VERSION TITLE');
?>
</div>
      <div class="content"><?php 
echo JYAML::getVersionInfo();
?>
</div>
    </div>
    
    <div class="designbox">         
      <div class="legend"><?php 
echo JText::_('YAML TITLE SUPPORT');
?>
</div>
      <div class="content">  
        <ul>
          <li><a href="http://www.jyaml.de" target="_blank">YAML Joomla! Template</a></li>
          <li><a href="http://forum.yaml.de/index.php?board=11.0" target="_blank">Support Forum</a></li>
        </ul>
        <ul>
Example #11
0
 function activateTemplate()
 {
     JYAML::activateTemplate(JRequest::getVar('switch_template', false, 'POST'), true);
 }
Example #12
0
 /**
  * Set Custom configuration
  * @param template current template
  * @return overwritten configuration
  **/
 function setCustomConfig($template)
 {
     $xmlfile = JPATH_BASE . DS . 'templates' . DS . $template . DS . 'config' . DS . $this->design . DS . $this->custom_xml . '.xml';
     if (!JFile::exists($xmlfile)) {
         JYAML::setError('XML File', 'Not Found: ' . DS . 'config' . DS . $this->design . DS . $this->custom_xml . '.xml');
     }
     $xmldoc =& JFactory::getXMLParser('Simple');
     $xmldoc->loadfile($xmlfile);
     $xmlconfig = $xmldoc->document->config[0];
     if ($xmlconfig) {
         foreach ($xmlconfig->children() as $child) {
             $this->readXML($template, $child, false);
         }
     }
 }
Example #13
0
 /**
  * Delete design
  **/
 function deleteDesign($ignore = false)
 {
     // Check Design is default
     $xmlfile = JPATH_SITE . DS . 'templates' . DS . $this->template_name . DS . 'config' . DS . '_global.xml';
     $config = JYAML::readConfig($this->template_name, $xmlfile);
     if ($config[0]['design'] == $this->design_name && !$ignore) {
         return 'isdefault';
     } else {
         JFile::delete($this->main_config_file);
         JFolder::delete($this->css_folder);
         JFolder::delete($this->image_folder);
         JFolder::delete($this->script_folder);
         JFolder::delete($this->config_folder);
         JFolder::delete($this->index_folder);
         return true;
     }
     return false;
 }
Example #14
0
    /**
     * display the edit form
     * @return void
     */
    function view()
    {
        $template = JRequest::getVar('template_name', 'hm_yaml');
        $design = JRequest::getVar('design', 'default');
        $ext = JRequest::getVar('ext', 'none');
        $returnid = JRequest::getVar('returnid', '');
        if (!$template && !$ext) {
            return;
        }
        $this->template_name = $template;
        ?>
    
    <fieldset>
        <div class="configuration"><?php 
        echo JText::_('YAML EXPLORER TITLE');
        ?>
</div>
    </fieldset>
    <p><?php 
        echo JText::_('YAML EXPLORER PATH');
        ?>
: <?php 
        echo '/templates/' . $template;
        ?>
</p>  

    <?php 
        if ($ext == 'css') {
            ?>
    <fieldset>
      <legend><?php 
            echo JText::_('YAML EXPLORER DESIGN FOLDER TITLE');
            ?>
      <?php 
            echo JYAML::viewCSSFiles($design, true);
            ?>
    </fieldset>
    
    <fieldset>
      <legend><?php 
            echo JText::_('YAML EXPLORER DESIGN CORE TITLE');
            ?>
      <?php 
            echo JYAML::viewCSSFiles($design, true, $source = 'yaml');
            ?>
    </fieldset>
    <?php 
        }
        ?>
    
    <?php 
        if ($ext == 'js') {
            ?>
    <fieldset>
      <legend><?php 
            echo JText::_('YAML EXPLORER SCRIPT FOLDER TITLE');
            ?>
      <?php 
            echo JYAML::viewScriptFiles($design, true);
            ?>
    </fieldset>
    <?php 
        }
        ?>

    <script type="text/javascript">
      jQuery.noConflict();                            
      (function($) { 
        $(function() {       
          $(document).ready(function(){            
            $(".chooseFile").click(function(){
              var file   = $(this).attr("file");
              var folder = $(this).attr("folder");
              
              var sf  = $("#<?php 
        echo $returnid;
        ?>
:eq(0)", parent.document);
              var sp  = $("#path_<?php 
        echo $returnid;
        ?>
:eq(0)", parent.document);              
              var spm = $("#source_<?php 
        echo $returnid;
        ?>
:eq(0)", parent.document);
              
              $(sf).removeClass("off");
              $(sf).val(file);
              if(folder){
                $(sp).text(folder);
                
                if (folder.indexOf('/yaml/') == '-1') {
                  $(spm).val("design");  
                } else {
                  $(spm).val("");  
                }  
              }
                        
              sf.focus();              
              window.parent.document.getElementById('sbox-window').close();              
            });
          
          });
        });
      })(jQuery);
    </script>
  <?php 
    }