コード例 #1
0
ファイル: offlajntab.php プロジェクト: pguilford/vcomcc
 function universalFetchElement($name, $value, &$node)
 {
     $n = new JSimpleXML();
     $n->loadString(method_exists($node, 'toString') ? $node->toString() : $node->asXML());
     $params = new OfflajnJParameter('');
     $params->setXML($n->document);
     $attr = $node->attributes();
     if (!isset($attr['position']) || $attr['position'] != 'first') {
         $attr['position'] = 'last';
     }
     if (!version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla 1.5 <
         preg_match('/(.*)\\[([a-zA-Z0-9]*)\\]$/', $name, $out);
         $control = $out[1];
         $name = $out[2];
         $params->bind($this->_parent->_raw);
         $params->_raw =& $this->_parent->_raw;
     } else {
         // Joomla 1.7 >
         $control = $name;
         if ($value != '') {
             $params->bind($value);
         }
     }
     plgSystemOfflajnParams::addNewTab($this->generateId($name), parent::getLabel(), $params->render($control), (string) $attr['position']);
     return '';
 }
コード例 #2
0
ファイル: helper.php プロジェクト: Roma48/abazherka_old
 public function __construct($module, $params)
 {
     // put the module params to the $config variable
     $this->config = $params->toArray();
     // if the user set engine mode to Mootools
     if ($this->config['engine_mode'] == 'mootools') {
         // load the MooTools framework to use with the module
         JHtml::_('behavior.framework', true);
     } else {
         if ($this->config['include_jquery'] == 1) {
             // if the user specify to include the jQuery framework - load newest jQuery 1.7.*
             $doc = JFactory::getDocument();
             $doc->addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js');
         }
     }
     // set the active tab
     $this->active_tab = 1;
     // initializing the tabs array
     $this->tabs = array("content" => array(), "title" => array(), "type" => array(), "id" => array(), "animation" => array());
     // getting module ID
     $this->config['module_id'] = $this->config['automatic_module_id'] == 1 ? 'gk-tabs-' . $module->id : $params->get('module_id', 'gk-tabs-1');
     // check the data source type
     if ($this->config['module_data_source'] == 'tabsmanager') {
         // parse JSON data if it comes from the tabs manager
         $this->config['tabs_data'] = json_decode($this->config['tabs_data']);
     } else {
         // check the type of the source file
         if ($this->config['external_source'] == -1) {
             // if there is no selected files - set the tabs_data to blank array
             $this->config['tabs_data'] = array();
         } else {
             // if it is a JSON file
             if (stripos($this->config['external_source'], '.json') !== FALSE) {
                 // read the file content
                 $json_content = file_get_contents(JPATH_ROOT . DS . 'modules' . DS . 'mod_tabs_gk5' . DS . 'external_data' . DS . $this->config['external_source']);
                 // and parse it
                 $this->config['tabs_data'] = json_decode($json_content);
             } else {
                 if (stripos($this->config['external_source'], '.xml') !== FALSE) {
                     // Load Simple XML parser
                     jimport('joomla.utilities.simplexml');
                     // create a new instance of the JSimpleXML parser
                     $xml = new JSimpleXML();
                     // loading file
                     $xml->loadFile(JPATH_ROOT . DS . 'modules' . DS . 'mod_tabs_gk5' . DS . 'external_data' . DS . $this->config['external_source']);
                     // creating empty array
                     $this->config['tabs_data'] = array();
                     // parsing tabs
                     foreach ($xml->document->tab as $tab) {
                         array_push($this->config['tabs_data'], new GKTabObject($tab->getElementByPath('name')->data(), $tab->getElementByPath('type')->data(), $tab->getElementByPath('content')->data(), $tab->getElementByPath('published')->data(), $tab->getElementByPath('access')->data(), $tab->getElementByPath('id')->data(), $tab->getElementByPath('animation')->data()));
                     }
                 } else {
                     // if there is file in other format - set the tabs_data to blank array
                     $this->config['tabs_data'] = array();
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: jea.class.php プロジェクト: omarmm/MangLuoiBDS
 function version()
 {
     if (is_file(JPATH_COMPONENT_ADMINISTRATOR . DS . 'jea.xml')) {
         jimport('joomla.utilities.simplexml');
         $xml = new JSimpleXML();
         $xml->loadFile(JPATH_COMPONENT_ADMINISTRATOR . DS . 'jea.xml');
         return $xml->document->version[0]->data();
     }
     return '';
 }
コード例 #4
0
 function _loadMenu()
 {
     $xmlfile = dirname(__FILE__) . DS . 'menu.xml';
     $xml = new JSimpleXML();
     $xml->loadFile($xmlfile);
     if (!$xml->document) {
         echo "Cannot load menu xml: {$xmlfile}";
         return;
     }
     $this->_menu = $xml->document;
     //include the dynamic menu
     //include (dirname(__FILE__).DS.'dynamic_menu.php');
 }
コード例 #5
0
ファイル: menu.class.php プロジェクト: jomsocial/JSVoice
 /**
  * Load menu from XML file
  * 
  * @return void
  */
 function _loadMenu()
 {
     if (version_compare(JVERSION, '3.0', '<')) {
         jimport('joomla.utilities.simplexml');
     }
     $xmlfile = dirname(__FILE__) . '/menu.xml';
     $xml = new JSimpleXML();
     $xml->loadFile($xmlfile);
     if (!$xml->document) {
         echo "Cannot load menu xml: {$xmlfile}";
         return;
     }
     $this->_menu = $xml->document;
     //include the dynamic menu
     include dirname(__FILE__) . '/dynamic_menu.php';
 }
コード例 #6
0
 function _loadMenu()
 {
     jimport('joomla.utilities.simplexml');
     $xmlfile = dirname(__FILE__) . '/menu.xml';
     $xml = new JSimpleXML();
     $xml->loadFile($xmlfile);
     //$xml = JFactory::getXML($xmlfile);
     //print_r($xml);
     if (!$xml->document) {
         echo "Cannot load menu xml: {$xmlfile}";
         return;
     }
     $this->_menu = $xml->document;
     //include the dynamic menu
     //include (dirname(__FILE__).'/dynamic_menu.php');
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: sangkasi/joomla
 /**
  * Display the view.
  *
  * @param	string	$tpl	The subtemplate to display.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('jUpgrade'), 'jupgrade');
     JToolBarHelper::custom('cpanel', 'back.png', 'back_f2.png', 'Back', false, false);
     JToolBarHelper::preferences('com_jupgrade', '500');
     JToolBarHelper::spacer();
     JToolBarHelper::custom('help', 'help.png', 'help_f2.png', 'Help', false, false);
     JToolBarHelper::spacer();
     $xmlfile = JPATH_COMPONENT . '/jupgrade.xml';
     $xml = new JSimpleXML();
     $xml->loadFile($xmlfile);
     $attrib = $xml->document->version[0];
     // get params
     $params = JComponentHelper::getParams('com_jupgrade');
     $this->assignRef('version', $attrib->data());
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
コード例 #8
0
ファイル: JSimpleXMLTest.php プロジェクト: realityking/JAJAX
	/**
	 * Testing testSetParser().
	 *
	 * @return void
	 */
	public function testSetParser()
	{
		$parser = xml_parser_create('');
		$this->object->setParser($parser);
		$this->assertThat(
			$this->object->getparser(),
			$this->equalTo($parser)
		);
	}
コード例 #9
0
ファイル: default.php プロジェクト: q0821/esportshop
 require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'includes' . DS . 'simplexml.php';
 $aup_rule_file = 'alphauserpoints_rule.xml';
 jimport('joomla.filesystem.file');
 jimport('joomla.filesystem.folder');
 $pathToScan = array(0 => 'components', 1 => 'modules', 2 => 'plugins');
 foreach ($pathToScan as $scan) {
     $scan_path = JPATH_ROOT . DS . $scan;
     if (!JFolder::exists($scan_path)) {
         continue;
     }
     $scan_folders = JFolder::folders($scan_path, '.', true, true);
     $count = 0;
     foreach ($scan_folders as $folder) {
         $xmlRuleFile = $folder . DS . $aup_rule_file;
         if (JFile::exists($xmlRuleFile)) {
             $parser = new JSimpleXML();
             $parser->loadFile($xmlRuleFile);
             $elementCom = $parser->document->getElementByPath('component');
             $component = empty($elementCom) ? '' : $elementCom->data();
             $elementRoot = $parser->document->getElementByPath('rules');
             if (!empty($elementRoot)) {
                 foreach ($elementRoot->children() as $rule) {
                     $element = $rule->getElementByPath('name');
                     $nameRule = empty($element) ? '' : addslashes($element->data());
                     $element = $rule->getElementByPath('description');
                     $descriptionRule = empty($element) ? '' : addslashes($element->data());
                     $element = $rule->getElementByPath('plugin_function');
                     $pluginRule = empty($element) ? '' : $element->data();
                     $element = $rule->getElementByPath('fixed_points');
                     $fixed_points = empty($element) ? 'true' : $element->data();
                     $fixed_points = trim(strtolower($fixed_points));
コード例 #10
0
ファイル: offlajndashboard.php プロジェクト: pguilford/vcomcc
 function universalfetchElement($name, $value, &$node)
 {
     define("OFFLAJNADMIN", "1");
     $this->loadFiles();
     $this->loadFiles('legacy', 'offlajndashboard');
     $j17 = 0;
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $j17 = 1;
     }
     $style = "";
     $opened_ids = json_decode(stripslashes(@$_COOKIE[$this->_moduleName . "lastState"]));
     if ($opened_ids) {
         foreach ($opened_ids as $id) {
             $style .= '#content-box #' . $id . ' div.content{' . 'opacity: 1;' . 'height: 100%;' . '}';
         }
     }
     $document =& JFactory::getDocument();
     $document->addStyleDeclaration($style);
     DojoLoader::r('dojo.uacss');
     DojoLoader::addScript('
   var offlajnParams = new OfflajnParams({
     joomla17 : ' . $j17 . ',
     moduleName : "' . $this->_moduleName . '"
   });
 ');
     $lang =& JFactory::getLanguage();
     $lang->load($this->_moduleName, dirname(__FILE__) . DS . '..' . DS . '..');
     $xml = dirname(__FILE__) . DS . '../../' . $this->_moduleName . '.xml';
     if (!file_exists($xml)) {
         $xml = dirname(__FILE__) . DS . '../../install.xml';
         if (!file_exists($xml)) {
             return;
         }
     }
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $xmlo = JFactory::getXML($xml);
         $xmld = $xmlo;
     } else {
         jimport('joomla.utilities.simplexml');
         $xmlo = JFactory::getXMLParser('Simple');
         $xmlo->loadFile($xml);
         $xmld = $xmlo->document;
     }
     if (isset($xmld->hash) && (string) $xmld->hash) {
         if (version_compare(JVERSION, '3.0', 'ge')) {
             $hash = (string) $xmld->hash[0];
         } else {
             $hash = (string) $xmld->hash[0]->data();
         }
     }
     $this->attr = $node->attributes();
     if (!isset($hash)) {
         $this->generalInfo = '<iframe src="http://offlajn.com/index2.php?option=com_offlajn_update_info&amp;v=' . (version_compare(JVERSION, '3.0', 'ge') ? (string) $xmld->version : $xmld->version[0]->data()) . '" frameborder="no" style="border: 0;" width="100%"></iframe>';
         $this->relatedNews = '<iframe id="related-news-iframe" src="http://offlajn.com/index2.php?option=com_offlajn_related_news&amp;tag=' . @$this->attr['blogtags'] . '" frameborder="no" style="border: 0;" width="100%" ></iframe>';
     } else {
         $this->generalInfo = '<iframe src="http://offlajn.com/index2.php?option=com_offlajn_update_info&amp;hash=' . base64_url_encode($hash) . '&amp;v=' . (version_compare(JVERSION, '3.0', 'ge') ? (string) $xmld->version : $xmld->version[0]->data()) . '&amp;u=' . JURI::root() . '" frameborder="no" style="border: 0;" width="100%"></iframe>';
         $this->relatedNews = '<iframe id="related-news-iframe" src="http://offlajn.com/index2.php?option=com_offlajn_related_news&amp;tag=' . @$this->attr['blogtags'] . '" frameborder="no" style="border: 0;" width="100%" ></iframe>';
     }
     $this->loadDashboard();
     if (!version_compare(JVERSION, '1.6.0', 'ge')) {
         preg_match('/(.*)\\[([a-zA-Z0-9]*)\\]$/', $name, $out);
         @($control = $out[1]);
         $x = file_get_contents($xml);
         preg_match('/<fieldset.*?>(.*)<\\/fieldset>/ms', $x, $out);
         $params = str_replace(array('<field', '</field'), array('<param', '</param'), $out[0]);
         $n = new JSimpleXML();
         $n->loadString($params);
         $attrs = $n->document->attributes();
         if ($_REQUEST['option'] == 'com_modules' || $_REQUEST['option'] == 'com_advancedmodules') {
             $n->document->removeChild($n->document->param[0]);
             $params = new OfflajnJParameter('');
             $params->setXML($n->document);
             $params->_raw =& $this->_parent->_raw;
             $params->bind($this->_parent->_raw);
             echo $params->render($control);
         }
     }
     if (!isset($hash) || $hash == '') {
         return;
     }
     return "";
 }
コード例 #11
0
 /**
  * Method to import Joomla! com_content datas and structure
  * this is UNUSED in J2.5+, it may be used in the future
  * 
  * @return boolean true on success
  * @since 1.5
  */
 function import()
 {
     jimport('joomla.utilities.simplexml');
     // Deprecated J2.5, removed J3.x
     // Get the site default language
     $lang = flexicontent_html::getSiteDefaultLang();
     if (!FLEXI_J16GE) {
         // Get all Joomla sections
         $query = 'SELECT * FROM #__sections';
         $this->_db->setQuery($query);
         $sections = $this->_db->loadObjectList();
     }
     $logs = new stdClass();
     if (!FLEXI_J16GE) {
         $logs->sec = 0;
     }
     $logs->cat = 0;
     $logs->art = 0;
     //$logs->err = new stdClass();
     // Create the new category for the flexicontent items
     $topcat = JTable::getInstance('flexicontent_categories', '');
     $topcat->parent_id = 1;
     $topcat->level = 0;
     $topcat->extension = "com_content";
     $topcat->title = 'FLEXIcontent';
     $topcat->alias = 'flexicontent';
     $topcat->lft = null;
     $topcat->rgt = null;
     $topcat->level = 0;
     $topcat->published = 1;
     $topcat->access = 1;
     $topcat->language = "*";
     $topcat->setLocation(0, 'last-child');
     $topcat->check();
     $topcat->store();
     $topcat->rebuildPath($topcat->id);
     // Get the category default parameters in a string
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'category.xml');
     $catparams = new JRegistry();
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if (!$param->attributes('name')) {
                 continue;
             }
             // FIX for empty name e.g. seperator fields
             $catparams->set($param->attributes('name'), $param->attributes('default'));
         }
     }
     $catparams_str = $catparams->toString();
     // Loop through the top category object and create cat -> subcat -> items -> fields
     $k = 0;
     if ($topcat->id) {
         // Get the sub-categories of the root category that belong to com_content
         $query = "SELECT * FROM #__categories as c WHERE c.extension='com_content' ";
         $this->_db->setQuery($query);
         $categories = $this->_db->loadObjectList();
         /*//get children
         		$children = array();
         		foreach ($categories as $child) {
         			$parent = $child->parent_id;
         			$list = @$children[$parent] ? $children[$parent] : array();
         			array_push($list, $child);
         			$children[$parent] = $list;
         		}
         		$categories = $children;
         		//unset($children);
         		*/
         $map_old_new = array();
         $map_old_new[1] = $topcat->id;
         // Loop throught the categories of the created section
         foreach ($categories as $category) {
             $subcat = JTable::getInstance('flexicontent_categories', '');
             $subcat->load($category->id);
             $subcat->id = 0;
             $subcat->lft = null;
             $subcat->rgt = null;
             $subcat->level = null;
             $subcat->parent_id = isset($map_old_new[$category->parent_id]) ? $map_old_new[$category->parent_id] : $topcat->id;
             $subcat->setLocation($subcat->parent_id, 'last-child');
             $subcat->params = $category->params;
             $k++;
             $subcat->check();
             if ($subcat->store()) {
                 $logs->cat++;
             } else {
                 $logs->err->{$k}->type = JText::_('FLEXI_IMPORT_CATEGORY') . ' id';
                 $logs->err->{$k}->id = $category->id;
                 $logs->err->{$k}->title = $category->title;
             }
             $subcat->rebuildPath($subcat->id);
             $map_old_new[$category->id] = $subcat->id;
             // Get the articles of the created category
             $query = 'SELECT * FROM #__content WHERE catid = ' . $category->id;
             $this->_db->setQuery($query);
             $articles = $this->_db->loadObjectList();
             // Loop throught the articles of the created category
             foreach ($articles as $article) {
                 $item = JTable::getInstance('content');
                 $item->load($article->id);
                 $item->id = 0;
                 $item->catid = $subcat->id;
                 $k++;
                 $item->check();
                 if ($item->store()) {
                     $logs->art++;
                 } else {
                     $logs->err->{$k}->type = JText::_('FLEXI_IMPORT_ARTICLE') . ' id';
                     $logs->err->{$k}->id = $article->id;
                     $logs->err->{$k}->title = $article->title;
                 }
             }
             // end articles loop
         }
         // end categories loop
     }
     // end if
     foreach ($categories as $category) {
         $subcat = JTable::getInstance('flexicontent_categories', '');
         $subcat->load($map_old_new[$category->id]);
         $subcat->lft = null;
         $subcat->rgt = null;
         $subcat->level = null;
         $subcat->parent_id = isset($map_old_new[$category->parent_id]) ? $map_old_new[$category->parent_id] : $topcat->id;
         $subcat->setLocation($subcat->parent_id, 'last-child');
         $subcat->check();
         $subcat->store();
     }
     unset($map_old_new);
     // Save the created top category as the flexi_top_category for the component
     $this->cparams->set('flexi_top_category', $topcat->id);
     $cparams_str = $this->cparams->toString();
     $flexi = JComponentHelper::getComponent('com_flexicontent');
     $query = 'UPDATE ' . (FLEXI_J16GE ? '#__extensions' : '#__components') . ' SET params = ' . $this->_db->Quote($cparams_str) . ' WHERE ' . (FLEXI_J16GE ? 'extension_id' : 'id') . '=' . $flexi->id;
     $this->_db->setQuery($query);
     $this->_db->execute();
     return $logs;
 }
コード例 #12
0
ファイル: template.php プロジェクト: Rikisha/proj
 /**
  * Method to get the template by it's id.
  * Can fetch both types standard and custom.
  * For standard type use the filename of template
  *
  * @param String - template id or filename
  *
  * @return JObject
  * @since  1.0
  * @deprecated
  */
 public function getTemplateBy($id, $preserve = false)
 {
     //TODO: Check. If this method is not used anywhere then remove it.
     jimport('joomla.utilities.simplexml');
     if (empty($id)) {
         return false;
     }
     $isCustom = false;
     // Make sure that result will be the same type in both cases
     if (strval(intval($id)) == strval($id)) {
         $isCustom = true;
         $item = $this->getItem($id);
         if (empty($item)) {
             return false;
         }
         $filename = $item->template;
     } else {
         $item = new JObject($this->getTable()->getProperties(1));
         if (empty($item)) {
             return false;
         }
         $filename = $id;
     }
     $fullfile = JPATH_COMPONENT_ADMINISTRATOR . DS . 'extensions' . DS . 'templates' . DS . $filename;
     if (JFile::exists($fullfile) === false) {
         $this->setError("File {$fullfile} not found");
         return false;
     }
     try {
         $xml = new JSimpleXML();
         $xml->loadFile($fullfile);
         $str = trim($xml->document->template[0]->_data);
         if (!$preserve) {
             $str = str_replace('<position', '<div class="drop container-draggables"', $str);
         }
         $item->filename = $filename;
         $item->content = $str;
         $item->information = array('name' => $xml->document->information[0]->name[0]->_data, 'author' => $xml->document->information[0]->author[0]->_data, 'creationDate' => $xml->document->information[0]->creationDate[0]->_data, 'copyright' => $xml->document->information[0]->copyright[0]->_data, 'license' => $xml->document->information[0]->license[0]->_data, 'authorEmail' => $xml->document->information[0]->authorEmail[0]->_data, 'authorUrl' => $xml->document->information[0]->authorUrl[0]->_data, 'version' => $xml->document->information[0]->version[0]->_data, 'description' => $xml->document->information[0]->description[0]->_data);
         unset($xml);
     } catch (Exception $e) {
         $this->setError($e->__toString());
         return false;
     }
     return $item;
 }
コード例 #13
0
ファイル: lms.xml.php プロジェクト: parkmi/dolschool14
 function __construct($options = null)
 {
     parent::__construct($options);
 }
コード例 #14
0
ファイル: items.php プロジェクト: grchis/Site-Auto
 function import()
 {
     $mainframe = JFactory::getApplication();
     jimport('joomla.filesystem.file');
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__sections";
     $db->setQuery($query);
     $sections = $db->loadObjectList();
     $query = "SELECT COUNT(*) FROM #__k2_items";
     $db->setQuery($query);
     $result = $db->loadResult();
     if ($result) {
         $preserveItemIDs = false;
     } else {
         $preserveItemIDs = true;
     }
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'category.xml');
     $categoryParams = class_exists('JParameter') ? new JParameter('') : new JRegistry('');
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if ($param->attributes('type') != 'spacer' && $param->attributes('name')) {
                 $categoryParams->set($param->attributes('name'), $param->attributes('default'));
             }
         }
     }
     $categoryParams = $categoryParams->toString();
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'item.xml');
     $itemParams = class_exists('JParameter') ? new JParameter('') : new JRegistry('');
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if ($param->attributes('type') != 'spacer' && $param->attributes('name')) {
                 $itemParams->set($param->attributes('name'), $param->attributes('default'));
             }
         }
     }
     $itemParams = $itemParams->toString();
     $query = "SELECT id, name FROM #__k2_tags";
     $db->setQuery($query);
     $tags = $db->loadObjectList();
     if (is_null($tags)) {
         $tags = array();
     }
     foreach ($sections as $section) {
         $K2Category = JTable::getInstance('K2Category', 'Table');
         $K2Category->name = $section->title;
         $K2Category->alias = $section->title;
         $K2Category->description = $section->description;
         $K2Category->parent = 0;
         $K2Category->published = $section->published;
         $K2Category->access = $section->access;
         $K2Category->ordering = $section->ordering;
         $K2Category->image = $section->image;
         $K2Category->trash = 0;
         $K2Category->params = $categoryParams;
         $K2Category->check();
         $K2Category->store();
         if (JFile::exists(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $section->image)) {
             JFile::copy(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $section->image, JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $K2Category->image);
         }
         $query = "SELECT * FROM #__categories WHERE section = " . (int) $section->id;
         $db->setQuery($query);
         $categories = $db->loadObjectList();
         foreach ($categories as $category) {
             $K2Subcategory = JTable::getInstance('K2Category', 'Table');
             $K2Subcategory->name = $category->title;
             $K2Subcategory->alias = $category->title;
             $K2Subcategory->description = $category->description;
             $K2Subcategory->parent = $K2Category->id;
             $K2Subcategory->published = $category->published;
             $K2Subcategory->access = $category->access;
             $K2Subcategory->ordering = $category->ordering;
             $K2Subcategory->image = $category->image;
             $K2Subcategory->trash = 0;
             $K2Subcategory->params = $categoryParams;
             $K2Subcategory->check();
             $K2Subcategory->store();
             if (JFile::exists(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $category->image)) {
                 JFile::copy(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $category->image, JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $K2Subcategory->image);
             }
             $query = "SELECT article.*, xref.content_id\n\t\t\t\tFROM #__content AS article \n\t\t\t\tLEFT JOIN #__content_frontpage AS xref ON article.id = xref.content_id \n\t\t\t\tWHERE catid = " . (int) $category->id;
             $db->setQuery($query);
             $items = $db->loadObjectList();
             foreach ($items as $item) {
                 $K2Item = JTable::getInstance('K2Item', 'Table');
                 $K2Item->title = $item->title;
                 $K2Item->alias = $item->title;
                 $K2Item->catid = $K2Subcategory->id;
                 if ($item->state < 0) {
                     $K2Item->trash = 1;
                 } else {
                     $K2Item->trash = 0;
                     $K2Item->published = $item->state;
                 }
                 $K2Item->featured = $item->content_id ? 1 : 0;
                 $K2Item->introtext = $item->introtext;
                 $K2Item->fulltext = $item->fulltext;
                 $K2Item->created = $item->created;
                 $K2Item->created_by = $item->created_by;
                 $K2Item->created_by_alias = $item->created_by_alias;
                 $K2Item->modified = $item->modified;
                 $K2Item->modified_by = $item->modified_by;
                 $K2Item->publish_up = $item->publish_up;
                 $K2Item->publish_down = $item->publish_down;
                 $K2Item->access = $item->access;
                 $K2Item->ordering = $item->ordering;
                 $K2Item->hits = $item->hits;
                 $K2Item->metadesc = $item->metadesc;
                 $K2Item->metadata = $item->metadata;
                 $K2Item->metakey = $item->metakey;
                 $K2Item->params = $itemParams;
                 $K2Item->check();
                 if ($preserveItemIDs) {
                     $K2Item->id = $item->id;
                     $db->insertObject('#__k2_items', $K2Item);
                 } else {
                     $K2Item->store();
                 }
                 if (!empty($item->metakey)) {
                     $itemTags = explode(',', $item->metakey);
                     foreach ($itemTags as $itemTag) {
                         $itemTag = JString::trim($itemTag);
                         if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) {
                             $query = "SELECT id FROM #__k2_tags WHERE name=" . $db->Quote($itemTag);
                             $db->setQuery($query);
                             $id = $db->loadResult();
                             $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})";
                             $db->setQuery($query);
                             $db->query();
                         } else {
                             $K2Tag = JTable::getInstance('K2Tag', 'Table');
                             $K2Tag->name = $itemTag;
                             $K2Tag->published = 1;
                             $K2Tag->store();
                             $tags[] = $K2Tag;
                             $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})";
                             $db->setQuery($query);
                             $db->query();
                         }
                     }
                 }
             }
         }
     }
     // Handle uncategorized articles
     $query = "SELECT * FROM #__content WHERE sectionid = 0";
     $db->setQuery($query);
     $items = $db->loadObjectList();
     if ($items) {
         $K2Uncategorised = JTable::getInstance('K2Category', 'Table');
         $K2Uncategorised->name = 'Uncategorized';
         $K2Uncategorised->alias = 'Uncategorized';
         $K2Uncategorised->parent = 0;
         $K2Uncategorised->published = 1;
         $K2Uncategorised->access = 0;
         $K2Uncategorised->ordering = 0;
         $K2Uncategorised->trash = 0;
         $K2Uncategorised->params = $categoryParams;
         $K2Uncategorised->check();
         $K2Uncategorised->store();
         foreach ($items as $item) {
             $K2Item = JTable::getInstance('K2Item', 'Table');
             $K2Item->title = $item->title;
             $K2Item->alias = $item->title;
             $K2Item->catid = $K2Uncategorised->id;
             if ($item->state < 0) {
                 $K2Item->trash = 1;
             } else {
                 $K2Item->trash = 0;
                 $K2Item->published = $item->state;
             }
             $K2Item->introtext = $item->introtext;
             $K2Item->fulltext = $item->fulltext;
             $K2Item->created = $item->created;
             $K2Item->created_by = $item->created_by;
             $K2Item->created_by_alias = $item->created_by_alias;
             $K2Item->modified = $item->modified;
             $K2Item->modified_by = $item->modified_by;
             $K2Item->publish_up = $item->publish_up;
             $K2Item->publish_down = $item->publish_down;
             $K2Item->access = $item->access;
             $K2Item->ordering = $item->ordering;
             $K2Item->hits = $item->hits;
             $K2Item->metadesc = $item->metadesc;
             $K2Item->metadata = $item->metadata;
             $K2Item->metakey = $item->metakey;
             $K2Item->params = $itemParams;
             $K2Item->check();
             if ($preserveItemIDs) {
                 $K2Item->id = $item->id;
                 $db->insertObject('#__k2_items', $K2Item);
             } else {
                 $K2Item->store();
             }
             if (!empty($item->metakey)) {
                 $itemTags = explode(',', $item->metakey);
                 foreach ($itemTags as $itemTag) {
                     $itemTag = JString::trim($itemTag);
                     if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) {
                         $query = "SELECT id FROM #__k2_tags WHERE name=" . $db->Quote($itemTag);
                         $db->setQuery($query);
                         $id = $db->loadResult();
                         $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})";
                         $db->setQuery($query);
                         $db->query();
                     } else {
                         $K2Tag = JTable::getInstance('K2Tag', 'Table');
                         $K2Tag->name = $itemTag;
                         $K2Tag->published = 1;
                         $K2Tag->store();
                         $tags[] = $K2Tag;
                         $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})";
                         $db->setQuery($query);
                         $db->query();
                     }
                 }
             }
         }
     }
     $mainframe->enqueueMessage(JText::_('K2_IMPORT_COMPLETED'));
     $mainframe->redirect('index.php?option=com_k2&view=items');
 }
コード例 #15
0
 function &getXML($type, &$params, $decorator)
 {
     static $xmls;
     if (!isset($xmls[$type])) {
         $cache =& JFactory::getCache('mod_icemegamenu');
         $string = $cache->call(array('modIceMegamenuHelper', 'buildXML'), $params);
         $xmls[$type] = $string;
     }
     // Get document
     require_once JPATH_BASE . DS . "modules" . DS . "mod_icemegamenu" . DS . "libs" . DS . "simplexml.php";
     $xml = new JSimpleXML();
     $xml->loadString($xmls[$type]);
     $doc =& $xml->document;
     $menu =& JSite::getMenu();
     $active = $menu->getActive();
     $start = $params->get('startLevel');
     $end = $params->get('endLevel');
     $sChild = $params->get('showAllChildren');
     $path = array();
     // Get subtree
     if ($doc && is_callable($decorator)) {
         $doc->map($decorator, array('end' => $end, 'children' => $sChild));
     }
     return $doc;
 }
コード例 #16
0
ファイル: common.php プロジェクト: ashanrupasinghe/slbcv2
 /**
  * Get and parse file content to xml element
  *
  * @param string $xmlfile   Xml file path
  * @param bool   $array     Convert to array or not
  *
  * @return mixed NULL if load or parse file fail, Array if array is true, otherwise JSimpleXML
  */
 public static function getXML($xmlfile, $array = true)
 {
     /*
             $xml = JFactory::getXMLParser('Simple');
             if ($xml->loadFile($xmlfile)) {
                 if ($array)
                     return T3Common::xmltoarray($xml->document);
                 return $xml->document;
             }
             return null;
     */
     //$xml = JFactory::getXML ($xmlfile);
     if (!class_exists('JSimpleXML')) {
         t3import('core.joomla.simplexml');
     }
     $xml = new JSimpleXML();
     if ($xml->loadFile($xmlfile)) {
         if ($array) {
             return T3Common::xmltoarray($xml->document);
         }
         return $xml->document;
     }
     return null;
 }
コード例 #17
0
ファイル: account.php プロジェクト: ErickLopez76/offiria
 public function getUpdate()
 {
     // This can also be overwritten using config file
     $serverXML = 'http://www.offiria.com/releases.xml';
     $app = JFactory::getApplication();
     $defaultFile = JPATH_ROOT . DS . 'offiria.xml';
     $objXml = new JSimpleXML();
     $objXml->loadFile($defaultFile);
     $children = $objXml->document->children();
     $localversion = $children[0]->attributes('number');
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $serverXML);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     $result = curl_exec($curl);
     curl_close($curl);
     $objXml2 = new JSimpleXML();
     $objXml2->loadString($result);
     $renderData = new stdClass();
     $renderData->data = array();
     $renderData->current_version = $localversion;
     if (isset($objXml2->document) && isset($objXml2->document->releases)) {
         $releases = $objXml2->document->releases[0];
         try {
             // Always assume the first child is the latest
             $latestversion = $releases->version[0]->attributes('number');
             if (trim($localversion) == trim($latestversion)) {
                 $renderData->msg = 'No new updates available.';
             } else {
                 $renderData->msg = 'New updates available.';
                 $notMet = true;
                 foreach ($releases->version as $version) {
                     if (trim($localversion) == trim($version->attributes('number'))) {
                         // found
                         break;
                     } else {
                         $index = count($renderData->data);
                         $renderData->data[$index] = new stdClass();
                         $renderData->data[$index]->version = $version->attributes('number');
                         $renderData->data[$index]->package_url = $version->package[0]->attributes('url');
                         $renderData->data[$index]->change_log = $version->changelog[0]->data();
                     }
                 }
             }
         } catch (Exception $ex) {
             $renderData->msg = 'Unable to retrieve update logs.';
         }
     } else {
         $renderData->msg = 'Unable to retrieve update logs.';
     }
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_account' . DS . 'views' . DS . 'update' . DS . 'view.html.php';
     $view = new AccountViewUpdate($renderData);
     $view->display($renderData);
 }
コード例 #18
0
 function _getJoomlaInstalledVersion($extensionName)
 {
     $xmlFiles = NULL;
     $version = "Undetermined";
     if (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . $extensionName)) {
         $dir = JPATH_ADMINISTRATOR . DS . 'components' . DS . $extensionName;
     } else {
         if (JFolder::exists(JPATH_SITE . DS . 'components' . DS . $extensionName)) {
             $dir = JPATH_SITE . DS . 'components' . DS . $extensionName;
         } else {
             if (JFolder::exists(JPATH_SITE . DS . 'modules' . DS . $extensionName)) {
                 $dir = JPATH_SITE . DS . 'modules' . DS . $extensionName;
             } else {
                 if (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'modules' . DS . $extensionName)) {
                     $dir = JPATH_ADMINISTRATOR . DS . 'modules' . DS . $extensionName;
                 } else {
                     if (JFolder::exists(JPATH_SITE . DS . 'templates' . DS . $extensionName)) {
                         $dir = JPATH_SITE . DS . 'templates' . DS . $extensionName;
                     } else {
                         if (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'templates' . DS . $extensionName)) {
                             $dir = JPATH_ADMINISTRATOR . DS . 'templates' . DS . $extensionName;
                         } else {
                             if (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'templates' . DS . $extensionName)) {
                                 $dir = JPATH_ADMINISTRATOR . DS . 'templates' . DS . $extensionName;
                             } else {
                                 if (count($xmlFiles = JFolder::files(JPATH_SITE . DS . 'plugins', '^' . $extensionName . '.xml$', true, true)) > 0) {
                                     $dir = JPATH_SITE . DS . 'plugins';
                                 } else {
                                     return $version;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$xmlFiles) {
         $xmlFiles = JFolder::files($dir, '.xml$', false, true);
     }
     if (count($xmlFiles) > 0) {
         foreach ($xmlFiles as $xmlFile) {
             $xmlParser = new JSimpleXML();
             if ($xmlParser->loadFile($xmlFile)) {
                 if (is_object($xmlParser->document)) {
                     if ($xmlParser->document->name() == 'install') {
                         $versionElement =& $xmlParser->document->version[0];
                         if ($versionElement != null) {
                             $version = $versionElement->_data;
                         }
                     }
                 }
             }
         }
     }
     return $version;
 }
コード例 #19
0
 function _getInitialParams()
 {
     jimport('joomla.utilities.simplexml');
     $xml = new JSimpleXML();
     if (substr($this->jversion, 0, 3) == "1.5") {
         $filename = JPATH_SITE . DS . "/plugins/system/plugin_googlemap2.xml";
     } else {
         $filename = JPATH_SITE . DS . "/plugins/system/plugin_googlemap2/plugin_googlemap2.xml";
     }
     if ($xml->loadFile($filename)) {
         if (substr($this->jversion, 0, 3) == "1.5") {
             $root =& $xml->document;
         } else {
             $root = $xml->document->config[0]->fields[0];
         }
         foreach ($root->children() as $params) {
             foreach ($params->children() as $param) {
                 if ($param->attributes('export') == '1') {
                     $name = $param->attributes('name');
                     if ($name == 'lat') {
                         $this->initparams->deflatitude = $this->params->get($name, $param->attributes('default'));
                     } elseif ($name == 'lon') {
                         $this->initparams->deflongitude = $this->params->get($name, $param->attributes('default'));
                     } elseif (substr($name, 0, 3) == 'txt') {
                         $nm = strtolower($name);
                         $this->initparams->{$nm} = $this->params->get($name, '');
                     } else {
                         $nm = strtolower($name);
                         $this->initparams->{$nm} = $this->params->get($name, $param->attributes('default'));
                     }
                 }
             }
         }
     }
     // Clean up generated variables
     unset($filename, $xml, $root, $params, $param, $name, $nm);
 }
コード例 #20
0
ファイル: view.html.php プロジェクト: jomsocial/JSVoice
    function menu()
    {
        global $JVVERSION;
        $latest_version = '';
        $version_link = JAVoiceHelpers::get_Version_Link();
        $layout = JRequest::getVar('layout', 'statistic');
        $cid = JRequest::getVar('cid');
        if (is_array($cid)) {
            JArrayHelper::toInteger($cid);
            $cid = $cid[0];
        }
        $latest_version = $this->get('LatestVersion');
        if ($latest_version) {
            $version_link['latest_version']['info'] = 'http://wiki.joomlart.com/wiki/JA_Voice/Overview';
            $version_link['latest_version']['upgrade'] = 'http://www.joomlart.com/forums/downloads.php?do=cat&id=139';
            $iLatest_version = str_replace('.', '', $latest_version);
            $iLatest_version = trim($iLatest_version);
            $iLatest_version = intval($iLatest_version);
        } else {
            $version_link['latest_version']['info'] = '';
            $version_link['latest_version']['upgrade'] = '';
        }
        //$xml = JFactory::getXMLParser( 'simple' );
        $xml = new JSimpleXML();
        $file = JPATH_COMPONENT . '/javoice.xml';
        $xml->loadFile($file);
        $out = $xml->document;
        if ($out == false) {
            $current_version = $JVVERSION;
        } else {
            $allComments = $out->children();
            foreach ($allComments as $blogpost) {
                if ($blogpost->name() == "version") {
                    $current_version = $blogpost->data();
                    break;
                }
            }
        }
        $iCurrent_version = str_replace('.', '', $current_version);
        $iCurrent_version = trim($iCurrent_version);
        $iCurrent_version = intval($iCurrent_version);
        ?>
		<fieldset class="adminform">
					<div class="submenu-box">
						<div class="submenu-pad">
		<ul id="submenu" class="configuration">
			<li><a href="index.php?option=com_javoice&layout=statistic"
				class="<?php 
        if ($layout == null || $layout == 'statistic') {
            echo 'active';
        }
        ?>
">
										<?php 
        echo JText::_('STATISTICS');
        ?>
									</a></li>
			<li><a href="index.php?option=com_javoice&layout=supportandlicense"
				class="<?php 
        if ($layout == 'supportandlicense' || $layout == 'verify') {
            echo 'active';
        }
        ?>
">
										<?php 
        echo JText::_('DOCUMENTATION_AND_SUPPORT');
        ?>
									</a></li>			
			<li style="float: right;line-height:30px;">
				<?php 
        if (empty($iLatest_version)) {
            echo JText::_('VERSION') . ' <b>' . $current_version . '</b>';
        } elseif (!empty($iLatest_version) && $iLatest_version <= $iCurrent_version) {
            echo JText::_('YOUR_VERSION') . ': <b><a href="' . $version_link['current_version']['info'] . '" target="_blank">' . $current_version . '</a></b>&nbsp;&nbsp;' . JText::_('LATEST_VERSION') . ': <b><a href="' . $version_link['latest_version']['info'] . '" target="_blank">' . $latest_version . '</a></b>&nbsp;&nbsp;<font color="Blue"> <i>(' . JText::_('SYSTEM_RUNNING_THE_LATEST_VERSION') . ')</i></font>';
        } elseif (!empty($iLatest_version) && $iLatest_version > $iCurrent_version) {
            echo JText::_('YOUR_VERSION') . ': <b><a href="' . $version_link['current_version']['info'] . '" target="_blank">' . $current_version . '</a></b>&nbsp;&nbsp;' . JText::_('LATEST_VERSION') . ': <b>';
            echo isset($version_link['latest_version']) ? '<a href="' . $version_link['latest_version']['info'] . '" target="_blank">' . $latest_version . '</a>' : $latest_version;
            echo '</b>&nbsp;&nbsp;<span style="background-color:rgb(255,255,0);color:Red;font-weight:bold;">' . JText::_('NEW_VERSION_AVAILABLE') . '</span>';
            if (isset($version_link['latest_version'])) {
                echo '<a target="_blank" href="' . $version_link['latest_version']['upgrade'] . '" title="' . JText::_('CLICK_HERE_TO_DOWNLOAD_LATEST_VERSION') . '">' . JText::_('UPGRADE_NOW') . '</a>';
            }
        }
        ?>
					
			</li>
		</ul>
		<div class="clr"></div>
						</div>
					</div>
					<div class="clr"></div>
				</fieldset>
<?php 
    }
コード例 #21
0
ファイル: users.php プロジェクト: educakanchay/educa
 function import()
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     if (K2_JVERSION != '15') {
         $db->setQuery("SELECT id, title AS name FROM #__usergroups");
         $usergroups = $db->loadObjectList();
         $xml = new JXMLElement(JFile::read(JPATH_COMPONENT . DS . 'models' . DS . 'usergroup.xml'));
         $permissions = class_exists('JParameter') ? new JParameter('') : new JRegistry('');
         foreach ($xml->params as $paramGroup) {
             foreach ($paramGroup->param as $param) {
                 $attribute = K2_JVERSION == '30' ? $param->attributes()->type : $param->getAttribute('type');
                 if ($attribute != 'spacer') {
                     if (K2_JVERSION == '30') {
                         $permissions->set((string) $param->attributes()->name, (string) $param->attributes()->default);
                     } else {
                         $permissions->set($param->getAttribute('name'), $param->getAttribute('default'));
                     }
                 }
             }
         }
     } else {
         $acl = JFactory::getACL();
         $frontEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Frontend', false);
         $backEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Backend', false);
         $usergroups = array_merge($frontEndGroups, $backEndGroups);
         $xml = new JSimpleXML();
         $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'usergroup.xml');
         $permissions = class_exists('JParameter') ? new JParameter('') : new JRegistry('');
         foreach ($xml->document->params as $paramGroup) {
             foreach ($paramGroup->param as $param) {
                 if ($param->attributes('type') != 'spacer') {
                     $permissions->set($param->attributes('name'), $param->attributes('default'));
                 }
             }
         }
     }
     $permissions->set('inheritance', 0);
     $permissions->set('categories', 'all');
     $permissions = $permissions->toString();
     foreach ($usergroups as $usergroup) {
         $K2UserGroup = JTable::getInstance('K2UserGroup', 'Table');
         $K2UserGroup->name = JString::trim($usergroup->name) . " (Imported from Joomla!)";
         $K2UserGroup->permissions = $permissions;
         $K2UserGroup->store();
         if (K2_JVERSION != '15') {
             $query = "SELECT * FROM #__users AS user JOIN #__user_usergroup_map AS map ON user.id = map.user_id\n\t\t\t\tWHERE map.group_id = " . $usergroup->id;
         } else {
             $query = "SELECT * FROM #__users WHERE gid={$usergroup->id}";
         }
         $db->setQuery($query);
         $users = $db->loadObjectList();
         foreach ($users as $user) {
             $query = "SELECT COUNT(*) FROM #__k2_users WHERE userID={$user->id}";
             $db->setQuery($query);
             $result = $db->loadResult();
             if (!$result) {
                 $K2User = JTable::getInstance('K2User', 'Table');
                 $K2User->userID = $user->id;
                 $K2User->group = $K2UserGroup->id;
                 $K2User->store();
             }
         }
     }
     $mainframe->enqueueMessage(JText::_('K2_IMPORT_COMPLETED'));
     $mainframe->redirect('index.php?option=com_k2&view=users');
 }
コード例 #22
0
ファイル: parameter.php プロジェクト: knigherrant/decopatio
 /**
  * Loads an XML setup file and parses it.
  *
  * @param   string  $path  A path to the XML setup file.
  *
  * @return  object
  *
  * @deprecated  12.1
  * @since   11.1
  */
 public function loadSetupFile($path)
 {
     $result = false;
     if ($path) {
         $xml = new JSimpleXML();
         if ($xml->loadFile($path)) {
             if ($params = $xml->document->params) {
                 foreach ($params as $param) {
                     $this->setXML($param);
                     $result = true;
                 }
             }
         }
     } else {
         $result = true;
     }
     return $result;
 }
コード例 #23
0
ファイル: view.html.php プロジェクト: Rikisha/proj
 /**
  * Displays the view.
  *
  * @param  string $tpl the template name
  *
  * @return void
  * @since  1.0
  */
 public function display($tpl = null)
 {
     $isNew = !JRequest::getInt('newsletter_id', false);
     if ($isNew && !AclHelper::actionIsAllowed('newsletter.add') || !$isNew && !AclHelper::actionIsAllowed('newsletter.edit')) {
         $msg = $isNew ? 'JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED' : 'JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED';
         JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_newsletter&view=newsletters', false), JText::_($msg), 'error');
         return;
     }
     //TODO: Need to move css/js to SetDocument
     JHTML::stylesheet('media/com_newsletter/css/admin.css');
     JHTML::stylesheet('media/com_newsletter/css/newsletter.css');
     JHTML::script('media/com_newsletter/js/migur/js/core.js');
     JHTML::script('media/com_newsletter/js/migur/js/ajax.js');
     JHTML::script('media/com_newsletter/js/migur/js/widgets.js');
     JHTML::script('media/com_newsletter/js/migur/js/moodialog/MooDialog.js');
     JHTML::script('media/com_newsletter/js/migur/js/moodialog/MooDialog.Request.js');
     JHTML::script('media/com_newsletter/js/migur/js/moodialog/MooDialog.IFrame.js');
     JHTML::stylesheet('media/com_newsletter/js/migur/js/moodialog/css/MooDialog.css');
     JHTML::script('media/com_newsletter/js/migur/js/autocompleter/Observer.js');
     JHTML::script('media/com_newsletter/js/migur/js/autocompleter/Autocompleter.js');
     JHTML::script('media/com_newsletter/js/migur/js/autocompleter/Autocompleter.Local.js');
     JHTML::stylesheet('media/com_newsletter/js/migur/js/autocompleter/css/Autocompleter.css');
     JHTML::script('media/com_newsletter/js/migur/js/guide.js');
     JHTML::stylesheet('media/com_newsletter/css/guide.css');
     //TODO: Bulk-code. Need to refactor.
     JavascriptHelper::addObject('comParams', JComponentHelper::getParams('com_newsletter')->toArray());
     $nId = JRequest::getInt('newsletter_id');
     $script = $this->get('Script');
     $this->script = $script;
     // Get main form and data for newsletter
     $this->form = $this->get('Form', 'newsletter');
     $this->newsletter = $this->get('Item');
     $smtpModel = JModel::getInstance('SMtpProfile', 'NewsletterModelEntity');
     // Let's add J! profile
     $smtpp = $smtpModel->loadJoomla();
     JavascriptHelper::addObject('joomlaDe', JComponentHelper::getParams('com_newsletter')->toArray());
     // get the SmtpProfiles data
     $smtpprofilesManager = JModel::getInstance('smtpprofiles', 'NewsletterModel');
     $this->assignRef('smtpprofiles', $smtpprofilesManager->getAllItems('withDefault'));
     // get all the Extensions
     $this->modules = MigurModuleHelper::getSupported(array('withoutInfo' => true));
     $this->plugins = MigurPluginHelper::getSupported(array('withoutInfo' => true), 'com_newsletter.newsletter');
     // get the Extensions used in this newsletter
     $model = JModel::getInstance('newsletterext', 'NewsletterModel');
     $this->usedExts = $model->getExtensionsBy($nId);
     // Get a list of all templates
     $this->setModel(JModel::getInstance('templates', 'NewsletterModel'));
     $model = $this->getModel('templates');
     $templs = $model->getItems();
     $path = JPATH_COMPONENT . '/extensions/templates/';
     $filenames = JFolder::files($path, '^.*\\.xml$');
     if ($filenames === false) {
         JError::raiseError(500, implode("\n", array("Path {$path} not found")));
     }
     $this->templates = (object) array('items' => array(), 'path' => $path);
     $this->htmlTemplateId = null;
     foreach ($templs as $item) {
         $xml = new JSimpleXML();
         $xml->loadFile($path . $item->template);
         $str = trim($xml->document->template[0]->_data);
         $str = preg_replace('/<style.*>.*<\\/style>/s', '', $str);
         $str = str_replace('<position', '<div class="drop container-draggables"', $str);
         $id = strtolower(str_replace('.', '-', $item->template) . '-' . $item->t_style_id);
         $item->id = $id;
         $item->filename = $item->template;
         $item->template = $str;
         $this->templates->items[] = $item;
         if ($this->newsletter->t_style_id == $item->t_style_id) {
             $this->htmlTemplateId = $id;
             $this->t_style_id = $item->t_style_id;
         }
         unset($xml);
     }
     //attachments
     $this->attItems = array();
     $this->dynamicData = array('Name' => '[username]', 'Email' => '[useremail]', 'Site name' => '[sitename]', 'Subscription key' => '[subscription key]', 'Unsubscription link' => '[unsubscription link]', 'Confirmation link' => '[confirmation link]');
     $this->attItemslistDirn = "a.filename";
     $this->attItemslistOrder = "asc";
     // getting of an xml from
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         $this->addToolbar();
     }
     $this->downloads = (array) DownloadHelper::getByNewsletterId($nId);
     JavascriptHelper::addObject('dataStorage', (object) array('htmlTemplate' => (object) array('template' => (object) array('id' => $this->htmlTemplateId), 'extensions' => (array) $this->usedExts), 'templates' => (array) $this->templates->items, 'modules' => (array) $this->modules, 'plugins' => (array) $this->plugins, 'newsletter' => NewsletterHelper::get($nId)));
     // Set the document
     $this->setDocument();
     parent::display($tpl);
 }
コード例 #24
0
ファイル: ilink.php プロジェクト: jomsocial/JSVoice
 function _getXML($path, $xpath = 'control')
 {
     // Initialize variables
     $result = null;
     // load the xml metadata
     if (file_exists($path)) {
         //$xml = JFactory::getXMLParser('Simple');
         $xml = new JSimpleXML();
         if ($xml->loadFile($path)) {
             if (isset($xml->document)) {
                 $result = $xml->document->getElementByPath($xpath);
             }
         }
         return $result;
     }
     return $result;
 }
コード例 #25
0
ファイル: offlajnfont.php プロジェクト: pguilford/vcomcc
    function universalfetchElement($name, $value, &$node)
    {
        $this->_node =& $node;
        $this->_googlefonts = array();
        $this->_google = array();
        $this->_googleName = array();
        $this->init();
        $html = "";
        $attrs = $node->attributes();
        $alpha = isset($attrs['alpha']) ? $attrs['alpha'] : 0;
        $tabs = explode('|', $attrs['tabs']);
        $s = json_decode($value);
        if (isset($attrs['tabs']) && $attrs['tabs'] != "") {
            @($def = (array) $s->{$tabs[0]});
        }
        $elements = array();
        $stack =& JsStack::getInstance();
        $stack->startStack();
        // TABS
        $elements['tab']['name'] = $name . 'tab';
        $elements['tab']['id'] = $this->generateId($elements['tab']['name']);
        $tabxml = new JSimpleXML();
        $tabxml->loadString('<param/>');
        $tabxml = $tabxml->document;
        $tabxml->addAttribute('name', $elements['tab']['name']);
        $tabxml->addAttribute('type', 'offlajnradio');
        $tabxml->addAttribute('mode', 'button');
        foreach ($tabs as $t) {
            $tabxml->addChild('option', array('value' => $t))->setData($t);
        }
        $tab = new JElementOfflajnRadio();
        $tab->id = $elements['tab']['id'];
        $elements['tab']['html'] = $tab->universalfetchElement($elements['tab']['name'], $tabs[0], $tabxml);
        // END TABS
        // TYPE
        $elements['type']['name'] = $name . 'type';
        $elements['type']['id'] = $this->generateId($elements['type']['name']);
        $typexml = new JSimpleXML();
        $typexml->loadString('<param/>');
        $typexml = $typexml->document;
        $typexml->addAttribute('name', $elements['type']['name']);
        $typexml->addAttribute('type', 'offlajnlist');
        $typexml->addChild('option', array('value' => '0'))->setData('Alternative fonts');
        foreach ($this->_google as $t) {
            $typexml->addChild('option', array('value' => $t))->setData($t);
            $stack->startStack();
            // FAMILY
            $elements['type'][$t]['name'] = $name . 'family';
            $elements['type'][$t]['id'] = $this->generateId($elements['type'][$t]['name']);
            $familyxml = new JSimpleXML();
            $familyxml->loadString('<param/>');
            $familyxml = $familyxml->document;
            $familyxml->addAttribute('name', $elements['type'][$t]['name']);
            $familyxml->addAttribute('type', 'offlajnlist');
            $familyxml->addAttribute('height', '10');
            $familyxml->addAttribute('fireshow', '1');
            foreach ($this->_googlefonts[$t] as $f) {
                if (strlen($f) > 0) {
                    $familyxml->addChild('option', array('value' => $f))->setData($f);
                }
            }
            $family = new JElementOfflajnList();
            $family->id = $elements['type'][$t]['id'];
            $elements['type'][$t]['html'] = $family->universalfetchElement($elements['type'][$t]['name'], isset($def['family']) ? $def['family'] : 'Open Sans', $familyxml);
            $elements['type'][$t]['script'] = $stack->endStack(true);
            //      print_r($elements['type'][$t]['script']);
            //      print_r($elements['type'][$t]['html']);exit;
            // END FAMILY
        }
        $type = new JElementOfflajnList();
        $type->id = $elements['type']['id'];
        $elements['type']['html'] = $type->universalfetchElement($elements['type']['name'], isset($def['type']) ? $def['type'] : '0', $typexml);
        // END TYPE
        // SIZE
        $elements['size']['name'] = $name . 'size';
        $elements['size']['id'] = $this->generateId($elements['size']['name']);
        $sizexml = new JSimpleXML();
        $sizexml->loadString('<param size="1" validation="int" mode="increment" scale="1" allowminus="0"><unit value="px" imsrc="">px</unit><unit value="em" imsrc="">em</unit></param>');
        $sizexml = $sizexml->document;
        $sizexml->addAttribute('name', $elements['size']['name']);
        $sizexml->addAttribute('type', 'offlajntext');
        $size = new JElementOfflajnText();
        $size->id = $elements['size']['id'];
        $elements['size']['html'] = $size->universalfetchElement($elements['size']['name'], isset($def['size']) ? $def['size'] : '14||px', $sizexml);
        // END SIZE
        // COLOR
        $elements['color']['name'] = $name . 'color';
        $elements['color']['id'] = $this->generateId($elements['color']['name']);
        $colorxml = new JSimpleXML();
        $colorxml->loadString('<param/>');
        $colorxml = $colorxml->document;
        $colorxml->addAttribute('name', $elements['color']['name']);
        $colorxml->addAttribute('type', 'offlajncolor');
        //$colorxml->addAttribute('alpha', $alpha);
        $color = new JElementOfflajnColor();
        $color->id = $elements['color']['id'];
        $elements['color']['html'] = $color->universalfetchElement($elements['color']['name'], isset($def['color']) ? $def['color'] : '000000', $colorxml);
        // END COLOR
        // TEXT-DECORATION
        //    $stack->startStack();
        $elements['textdecor']['name'] = $name . 'textdecor';
        $elements['textdecor']['id'] = $this->generateId($elements['textdecor']['name']);
        $textdecorxml = new JSimpleXML();
        $textdecorxml->loadString('<param/>');
        $textdecorxml = $textdecorxml->document;
        $textdecorxml->addAttribute('name', $elements['textdecor']['name']);
        $textdecorxml->addAttribute('type', 'offlajnlist');
        $textdecorxml->addAttribute('height', '4');
        $textdecorxml->addAttribute('fireshow', '0');
        $textdecorxml->addChild('option', array('value' => '200'))->setData('extralight');
        $textdecorxml->addChild('option', array('value' => '300'))->setData('lighter');
        $textdecorxml->addChild('option', array('value' => '400'))->setData('normal');
        $textdecorxml->addChild('option', array('value' => '600'))->setData('bold');
        $textdecorxml->addChild('option', array('value' => '700'))->setData('bolder');
        $textdecorxml->addChild('option', array('value' => '800'))->setData('extrabold');
        $textd = new JElementOfflajnList();
        $textd->id = $elements['textdecor']['id'];
        $elements['textdecor']['html'] = $textd->universalfetchElement($elements['textdecor']['name'], isset($def['textdecor']) ? $def['textdecor'] : 'Normal', $textdecorxml);
        //    $elements['textdecor']['script'] = $stack->endStack(true);
        // END TEXT-DECORATION
        /*  // bold
            $elements['bold']['name'] = $name.'bold';
            $elements['bold']['id'] = $this->generateId($elements['bold']['name']);
            
            $boldxml = new JSimpleXML();
            $boldxml->loadString('<param mode="button" imsrc="bold.png" actsrc="bold_act.png" description=""/>');
            $boldxml = $boldxml->document;
            $boldxml->addAttribute('name', $elements['bold']['name']);
            $bold = new JElementofflajnonoff();
            $bold->id = $elements['bold']['id'];
            $elements['bold']['html'] = $bold->universalfetchElement($elements['bold']['name'], isset($def['bold'])?$def['bold']:0, $boldxml);*/
        // END bold
        // italic
        $elements['italic']['name'] = $name . 'italic';
        $elements['italic']['id'] = $this->generateId($elements['italic']['name']);
        $italicxml = new JSimpleXML();
        $italicxml->loadString('<param mode="button" imsrc="italic.png" actsrc="italic_act.png" description=""/>');
        $italicxml = $italicxml->document;
        $italicxml->addAttribute('name', $elements['italic']['name']);
        $italic = new JElementofflajnonoff();
        $italic->id = $elements['italic']['id'];
        $elements['italic']['html'] = $italic->universalfetchElement($elements['italic']['name'], isset($def['italic']) ? $def['italic'] : 0, $italicxml);
        // END italic
        // underline
        $elements['underline']['name'] = $name . 'underline';
        $elements['underline']['id'] = $this->generateId($elements['underline']['name']);
        $underlinexml = new JSimpleXML();
        $underlinexml->loadString('<param mode="button" imsrc="underline.png" actsrc="underline_act.png" description=""/>');
        $underlinexml = $underlinexml->document;
        $underlinexml->addAttribute('name', $elements['underline']['name']);
        $underline = new JElementofflajnonoff();
        $underline->id = $elements['underline']['id'];
        $elements['underline']['html'] = $underline->universalfetchElement($elements['underline']['name'], isset($def['underline']) ? $def['underline'] : 0, $underlinexml);
        // END underline
        // ALIGN
        $elements['align']['name'] = $name . 'align';
        $elements['align']['id'] = $this->generateId($elements['align']['name']);
        $alignxml = new JSimpleXML();
        $tsxml = <<<EOD
<param type="offlajnradio" mode="image">
  <option value="left" imsrc="left_align.png"></option>
  <option value="center" imsrc="center_align.png"></option>
  <option value="right" imsrc="right_align.png"></option>
</param>
EOD;
        $alignxml->loadString($tsxml);
        $alignxml = $alignxml->document;
        $alignxml->addAttribute('name', $elements['align']['name']);
        $align = new JElementOfflajnRadio();
        $align->id = $elements['align']['id'];
        $elements['align']['html'] = $align->universalfetchElement($elements['align']['name'], isset($def['align']) ? $def['align'] : 'left', $alignxml);
        // ALIGN
        // Alternative font
        $elements['afont']['name'] = $name . 'afont';
        $elements['afont']['id'] = $this->generateId($elements['afont']['name']);
        $afontxml = new JSimpleXML();
        $afontxml->loadString('<param onoff="1"><unit value="1" imsrc="">ON</unit><unit value="0" imsrc="">OFF</unit></param>');
        $afontxml = $afontxml->document;
        $afontxml->addAttribute('name', $elements['afont']['name']);
        $afontxml->addAttribute('type', 'offlajntext');
        $afontxml->addAttribute('size', '10');
        $afont = new JElementOfflajnText();
        $afont->id = $elements['afont']['id'];
        $elements['afont']['html'] = $afont->universalfetchElement($elements['afont']['name'], isset($def['afont']) ? $def['afont'] : 'Arial||1', $afontxml);
        // END Alternative font
        // TEXT SHADOW
        $elements['tshadow']['name'] = $name . 'tshadow';
        $elements['tshadow']['id'] = $this->generateId($elements['tshadow']['name']);
        $tshadowxml = new JSimpleXML();
        $tsxml = <<<EOD
<param>
  <param size="1" validation="float" type="offlajntext"><unit value="px" imsrc="">px</unit></param>
  <param size="1" validation="float" type="offlajntext"><unit value="px" imsrc="">px</unit></param>
  <param size="1" validation="float" type="offlajntext"><unit value="px" imsrc="">px</unit></param>
  <param type="offlajncolor" alpha="{$alpha}"/>
  <param type="offlajnswitcher" onoff="1"><unit value="1" imsrc="">ON</unit><unit value="0" imsrc="">OFF</unit></param>
</param>
EOD;
        $tshadowxml->loadString($tsxml);
        $tshadowxml = $tshadowxml->document;
        $tshadowxml->addAttribute('name', $elements['tshadow']['name']);
        $tshadowxml->addAttribute('type', 'offlajncombine');
        $tshadow = new JElementOfflajnCombine();
        $tshadow->id = $elements['tshadow']['id'];
        $elements['tshadow']['html'] = $tshadow->universalfetchElement($elements['tshadow']['name'], isset($def['tshadow']) ? $def['tshadow'] : '0|*|0|*|0|*|000000|*|0', $tshadowxml);
        // TEXT SHADOW
        // LINE HEIGHT
        $elements['lineheight']['name'] = $name . 'lineheight';
        $elements['lineheight']['id'] = $this->generateId($elements['lineheight']['name']);
        $lineheightxml = new JSimpleXML();
        $lineheightxml->loadString('<param></param>');
        $lineheightxml = $lineheightxml->document;
        $lineheightxml->addAttribute('name', $elements['lineheight']['name']);
        $lineheightxml->addAttribute('type', 'offlajntext');
        $lineheightxml->addAttribute('size', '5');
        $lineheight = new JElementOfflajnText();
        $lineheight->id = $elements['lineheight']['id'];
        $elements['lineheight']['html'] = $lineheight->universalfetchElement($elements['lineheight']['name'], isset($def['lineheight']) ? $def['lineheight'] : 'normal', $lineheightxml);
        // END LINE HEIGHT
        $this->loadFiles();
        $id = $this->generateId($name);
        $script = $stack->endStack(true);
        $settings = array();
        if ($value == '' || $value[0] != '{') {
            foreach ($tabs as $t) {
                $settings[$t] = new StdClass();
            }
            $settings = json_encode($settings);
        } else {
            $settings = $value;
        }
        $document = JFactory::getDocument();
        DojoLoader::addScript('
        new FontConfigurator({
          id: "' . $this->id . '",
          defaultTab: "' . $tabs[0] . '",
          origsettings: ' . $settings . ',
          elements: ' . json_encode($elements) . ',
          script: ' . json_encode($script) . '
        });
    ');
        $html .= "<a style='float: left;' id='" . $id . "change' href='#' class='font_select'></a>&nbsp;&nbsp;";
        if ($this->_parent->get('admindebug', 0) == 1) {
            $html .= '<span>Raw font data: </span><input type="text" name="' . $name . '" id="' . $id . '" value="' . str_replace('"', "'", $value) . '" />';
        } else {
            if ($value != "") {
                if ($value[0] != '{') {
                    $value = $settings;
                }
            }
            $html .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value=\'' . str_replace("'", '"', $value) . '\' />';
        }
        return $html;
    }
コード例 #26
0
ファイル: avrxml.php プロジェクト: BackupTheBerlios/kmit-svn
 /**
  * Handler function for the start of a tag
  *
  * @access protected
  * @param resource $parser
  * @param string $name
  * @param array $attrs
  */
 function _startElement($parser, $name, $attrs = array())
 {
     parent::_startElement($parser, str_replace(':', '_0x3a', $name), $attrs);
 }
コード例 #27
0
ファイル: users.php プロジェクト: rlee1962/diylegalcenter
 function import()
 {
     $mainframe =& JFactory::getApplication();
     $db =& JFactory::getDBO();
     $acl =& JFactory::getACL();
     $frontEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Frontend', false);
     $backEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Backend', false);
     $usergroups = array_merge($frontEndGroups, $backEndGroups);
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'userGroup.xml');
     $permissions = new JParameter('');
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if ($param->attributes('type') != 'spacer') {
                 $permissions->set($param->attributes('name'), $param->attributes('default'));
             }
         }
     }
     $permissions->set('inheritance', 0);
     $permissions->set('categories', 'all');
     $permissions = $permissions->toString();
     foreach ($usergroups as $usergroup) {
         $K2UserGroup =& JTable::getInstance('K2UserGroup', 'Table');
         $K2UserGroup->name = JString::trim($usergroup->name) . " (Imported from Joomla!)";
         $K2UserGroup->permissions = $permissions;
         $K2UserGroup->store();
         $query = "SELECT * FROM #__users WHERE gid={$usergroup->id}";
         $db->setQuery($query);
         $users = $db->loadObjectList();
         foreach ($users as $user) {
             $query = "SELECT COUNT(*) FROM #__k2_users WHERE userID={$user->id}";
             $db->setQuery($query);
             $result = $db->loadResult();
             if (!$result) {
                 $K2User =& JTable::getInstance('K2User', 'Table');
                 $K2User->userID = $user->id;
                 $K2User->group = $K2UserGroup->id;
                 $K2User->store();
             }
         }
     }
     $mainframe->redirect('index.php?option=com_k2&view=users', JText::_('Import Completed'));
 }
コード例 #28
0
 function _parseRequest()
 {
     $folder = $this->getFolder();
     $type = JRequest::getVar('type', false, 'post');
     if ($type) {
         $query = JRequest::getVar('query', false, 'post', 'BASE64');
         $start = JRequest::getInt('start', 0);
         $num = count(JFolder::files($folder, '.xml$', 1, false));
         switch ($type) {
             case 'clear':
                 $this->_db->setQuery("TRUNCATE TABLE `#__rsseo_pages`");
                 $this->_db->query();
                 $this->_db->setQuery("TRUNCATE TABLE `#__rsseo_redirects`");
                 $this->_db->query();
                 break;
             case 'backup':
                 $buffer = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
                 $buffer .= '<query>' . "\n";
                 $query = $this->decode($query);
                 if (preg_match('# (\\#__.*?) #is', $query['query'], $matches)) {
                     $table = trim($matches[1]);
                 }
                 $buffer .= $this->addTag('table', $table);
                 $this->_db->setQuery($query['query']);
                 $results = $this->_db->loadObjectList();
                 $buffer .= '<rows>' . "\n";
                 foreach ($results as $result) {
                     $buffer .= '<row>' . "\n";
                     foreach ($result as $key => $value) {
                         if (isset($query['primary']) && $key == $query['primary']) {
                             continue;
                         }
                         $buffer .= $this->addTag('column', $value, $key);
                     }
                     $buffer .= '</row>' . "\n";
                 }
                 $buffer .= '</rows>';
                 $buffer .= '</query>';
                 JFile::write($folder . DS . 'package' . $num . '.xml', $buffer);
                 break;
             case 'restore':
                 jimport('joomla.utilities.simplexml');
                 $file = urldecode(JRequest::getVar('file', false, 'post', ''));
                 $xml = new JSimpleXML();
                 $xml->loadFile($file);
                 $root = $xml->document;
                 $table = $root->getElementByPath('table')->data();
                 $rows = $root->getElementByPath('rows')->children();
                 $table_fields = $name = $data = array();
                 $fields = $this->_db->getTableFields($table);
                 foreach ($fields[$table] as $field => $type) {
                     $table_fields[] = $this->_db->NameQuote($field);
                 }
                 foreach ($rows as $row) {
                     $sql = array();
                     $columns = $row->children();
                     foreach ($columns as $column) {
                         $properties = $column->children();
                         foreach ($properties as $prop) {
                             if ($prop->name() == 'name') {
                                 $name[] = $this->_db->NameQuote($prop->data());
                             }
                             if ($prop->name() == 'value') {
                                 $data[] = $this->_db->Quote($prop->data());
                             }
                         }
                     }
                     foreach ($name as $i => $val) {
                         if (!in_array($val, $table_fields)) {
                             unset($name[$i]);
                             unset($data[$i]);
                         }
                     }
                     if (!empty($name) && !empty($data)) {
                         $this->_db->setQuery("INSERT INTO `" . $table . "` (" . implode(',', $name) . ") VALUES (" . implode(',', $data) . "); ");
                         $this->_db->query();
                         unset($name);
                         unset($data);
                     }
                 }
                 break;
         }
     }
     $pack = JRequest::getInt('pack', 0, 'post');
     if ($pack) {
         if (rsseoHelper::is16()) {
             $adapter = JArchive::getAdapter('zip');
             $archivefiles = array();
             $xmlfiles = JFolder::files($folder, '.xml$', 1, true);
             foreach ($xmlfiles as $xmlfile) {
                 $data = JFile::read($xmlfile);
                 $archivefiles[] = array('name' => JFile::getName($xmlfile), 'data' => $data);
             }
             $adapter->create($folder . DS . 'package.zip', $archivefiles);
         } else {
             JArchive::create($folder . DS . 'package.tar', JFolder::files($folder, '.xml$', 1, true), 'gz', '', $folder, true, true);
         }
     }
     die;
 }
コード例 #29
0
ファイル: items.php プロジェクト: navinpai/GEC-Tandav
 function import()
 {
     $mainframe =& JFactory::getApplication();
     jimport('joomla.filesystem.file');
     $db =& JFactory::getDBO();
     $query = "SELECT * FROM #__sections";
     $db->setQuery($query);
     $sections = $db->loadObjectList();
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'category.xml');
     $categoryParams = new JParameter('');
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if ($param->attributes('type') != 'spacer') {
                 $categoryParams->set($param->attributes('name'), $param->attributes('default'));
             }
         }
     }
     $categoryParams = $categoryParams->toString();
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'item.xml');
     $itemParams = new JParameter('');
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if ($param->attributes('type') != 'spacer') {
                 $itemParams->set($param->attributes('name'), $param->attributes('default'));
             }
         }
     }
     $itemParams = $itemParams->toString();
     $query = "SELECT id, name FROM #__k2_tags";
     $db->setQuery($query);
     $tags = $db->loadObjectList();
     if (is_null($tags)) {
         $tags = array();
     }
     foreach ($sections as $section) {
         $K2Category =& JTable::getInstance('K2Category', 'Table');
         $K2Category->name = $section->title;
         $K2Category->alias = $section->title;
         $K2Category->description = $section->description;
         $K2Category->parent = 0;
         $K2Category->published = $section->published;
         $K2Category->access = $section->access;
         $K2Category->ordering = $section->ordering;
         $K2Category->image = $section->image;
         $K2Category->trash = 0;
         $K2Category->params = $categoryParams;
         $K2Category->check();
         $K2Category->store();
         if (JFile::exists(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $section->image)) {
             JFile::copy(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $section->image, JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $K2Category->image);
         }
         $query = "SELECT * FROM #__categories WHERE section = {$section->id}";
         $db->setQuery($query);
         $categories = $db->loadObjectList();
         foreach ($categories as $category) {
             $K2Subcategory =& JTable::getInstance('K2Category', 'Table');
             $K2Subcategory->name = $category->title;
             $K2Subcategory->alias = $category->title;
             $K2Subcategory->description = $category->description;
             $K2Subcategory->parent = $K2Category->id;
             $K2Subcategory->published = $category->published;
             $K2Subcategory->access = $category->access;
             $K2Subcategory->ordering = $category->ordering;
             $K2Subcategory->image = $category->image;
             $K2Subcategory->trash = 0;
             $K2Subcategory->params = $categoryParams;
             $K2Subcategory->check();
             $K2Subcategory->store();
             if (JFile::exists(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $category->image)) {
                 JFile::copy(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $category->image, JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $K2Subcategory->image);
             }
             $query = "SELECT * FROM #__content WHERE catid = {$category->id}";
             $db->setQuery($query);
             $items = $db->loadObjectList();
             foreach ($items as $item) {
                 $K2Item =& JTable::getInstance('K2Item', 'Table');
                 $K2Item->title = $item->title;
                 $K2Item->alias = $item->title;
                 $K2Item->catid = $K2Subcategory->id;
                 if ($item->state == -1) {
                     $K2Item->trash = 1;
                 } else {
                     $K2Item->trash = 0;
                     $K2Item->published = $item->state;
                 }
                 $K2Item->introtext = $item->introtext;
                 $K2Item->fulltext = $item->fulltext;
                 $K2Item->created = $item->created;
                 $K2Item->created_by = $item->created_by;
                 $K2Item->created_by_alias = $item->created_by_alias;
                 $K2Item->modified = $item->modified;
                 $K2Item->modified_by = $item->modified_by;
                 $K2Item->publish_up = $item->publish_up;
                 $K2Item->publish_down = $item->publish_down;
                 $K2Item->access = $item->access;
                 $K2Item->ordering = $item->ordering;
                 $K2Item->hits = $item->hits;
                 $K2Item->metadesc = $item->metadesc;
                 $K2Item->metadata = $item->metadata;
                 $K2Item->metakey = $item->metakey;
                 $K2Item->params = $itemParams;
                 $K2Item->check();
                 $K2Item->store();
                 if (!empty($item->metakey)) {
                     $itemTags = explode(',', $item->metakey);
                     foreach ($itemTags as $itemTag) {
                         $itemTag = JString::trim($itemTag);
                         if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) {
                             $query = "SELECT id FROM #__k2_tags WHERE name=" . $db->Quote($itemTag);
                             $db->setQuery($query);
                             $id = $db->loadResult();
                             $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})";
                             $db->setQuery($query);
                             $db->query();
                         } else {
                             $K2Tag =& JTable::getInstance('K2Tag', 'Table');
                             $K2Tag->name = $itemTag;
                             $K2Tag->published = 1;
                             $K2Tag->store();
                             $tags[] = $K2Tag;
                             $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})";
                             $db->setQuery($query);
                             $db->query();
                         }
                     }
                 }
             }
         }
     }
     $mainframe->redirect('index.php?option=com_k2&view=items', JText::_('Import Completed'));
 }
コード例 #30
0
ファイル: plugins.php プロジェクト: q0821/esportshop
 function _loadPluginElements($xmlFile)
 {
     if (substr(strtolower($xmlFile), -4) != ".xml") {
         return;
     }
     $app = JFactory::getApplication();
     $error = "";
     // XML library
     //jimport('joomla.utilities.simplexml');
     // Import file dependencies
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'includes' . DS . 'simplexml.php';
     //$xmlDoc =  JFactory::getXMLParser('Simple');
     $xmlDoc = new JSimpleXML();
     $_xmlFile = JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'plugins' . DS . $xmlFile;
     $pos = strrpos($_xmlFile, DS);
     if ($pos) {
         $_installPath = substr($_xmlFile, 0, $pos);
     }
     if ($xmlDoc->loadFile($_xmlFile)) {
         $root =& $xmlDoc->document;
         if ($root->name() == 'alphauserpoints') {
             $element = $root->rule;
             $nameRule = $element ? $element[0]->data() : '';
             $element = $root->description;
             $descriptionRule = $element ? $element[0]->data() : '';
             $element = $root->component;
             $componentRule = $element ? $element[0]->data() : '';
             $element = $root->plugin_function;
             $pluginRule = $element ? $element[0]->data() : '';
             $element = $root->fixed_points;
             $fixedpointsRule = $element ? $element[0]->data() : '';
             $fixedpointsRule = trim(strtolower($fixedpointsRule));
             $fixedpointsRule = $fixedpointsRule == 'true' ? 1 : 0;
             $element = @$root->category;
             $categoryRule = @$element ? @$element[0]->data() : '';
             $element = @$root->display_message;
             $displayMessage = @$element ? @$element[0]->data() : '';
             $displayMessage = trim(strtolower($displayMessage));
             $displayMessage = $displayMessage == 'true' ? 1 : 0;
             $element = @$root->email_notification;
             $emailNotification = @$element ? @$element[0]->data() : '';
             $emailNotification = trim(strtolower($emailNotification));
             $emailNotification = $emailNotification == 'true' ? 1 : 0;
             // insert in table
             if ($nameRule != '' && $descriptionRule != '' && $componentRule != '' && $pluginRule != '') {
                 $db = JFactory::getDBO();
                 // check if already exist...
                 $query = "SELECT COUNT(*) FROM #__alpha_userpoints_rules WHERE `plugin_function`='{$pluginRule}'";
                 $db->setQuery($query);
                 $resultCount = $db->loadResult();
                 if (!$resultCount) {
                     $query = "INSERT INTO #__alpha_userpoints_rules VALUES ('', '" . $nameRule . "', '" . $descriptionRule . "', '" . $componentRule . "', '" . $pluginRule . "', '1', '" . $componentRule . "', '', '', '0', '0', 0, '0000-00-00 00:00:00', '', '', '', '', '0', '0', '0', '0', '1', '" . $fixedpointsRule . "', '" . $categoryRule . "', '" . $displayMessage . "', '', '0', '" . $emailNotification . "', '', '', '0', '0', '0', '0', '0', '1')";
                     $db->setQuery($query);
                     if ($db->query()) {
                         $msg = JText::_('AUP_NEW_RULE_INSTALLED_SUCCESSFULLY') . ' : <b>' . $nameRule . '</b>';
                         $app->enqueueMessage($msg);
                     } else {
                         $error = JText::_('This rule is not installed properly');
                         JError::raiseNotice(0, $error);
                     }
                 } else {
                     $error = JText::_('AUP_THISRULEALREADYEXIST');
                     JError::raiseNotice(0, $error);
                 }
             } else {
                 $error = JText::_('AUP_XML_FILE_INVALID');
                 JError::raiseWarning(0, $error);
             }
         } elseif ($root->name() == 'extension') {
             // Install standard plugins for Joomla!
             jimport('joomla.installer.installer');
             jimport('joomla.filesystem.folder');
             jimport('joomla.filesystem.file');
             $plugin_installer = new JInstaller();
             $installStandard = $plugin_installer->install($_installPath);
             JFolder::delete($_installPath);
             $redirecturl = "index.php?option=com_plugins";
             JControllerLegacy::setRedirect($redirecturl);
             JControllerLegacy::redirect();
         } else {
             unset($xmlDoc);
             $error = JText::_('AUP_XML_FILE_INVALID');
             JError::raiseWarning(0, $error);
         }
     } else {
         unset($xmlDoc);
         $error = JText::_('AUP_XML_FILE_INVALID');
         JError::raiseWarning(0, $error);
     }
 }