Example #1
1
 /**
  * Display the view.
  *
  * @param	string	$tpl	The subtemplate to display.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     JToolbarHelper::title(JText::_('jUpgradePro'), 'jupgrade');
     JToolbarHelper::custom('cpanel', 'back.png', 'back_f2.png', 'Back', false, false);
     JToolbarHelper::preferences('com_jupgradepro', '500');
     JToolbarHelper::spacer();
     JToolbarHelper::custom('help', 'help.png', 'help_f2.png', 'Help', false, false);
     JToolbarHelper::spacer();
     // get params
     $params = JComponentHelper::getParams('com_jupgradepro');
     //
     // Joomla bug: JInstaller not save the defaults params reading config.xml
     //
     $db = JFactory::getDBO();
     if (!$params->get('method')) {
         $default_params = '{"method":"rest","rest_hostname":"http:\\/\\/www.example.org\\/","rest_username":"","rest_password":"","rest_key":"","path":"","driver":"mysql","hostname":"localhost","username":"","password":"","database":"","prefix":"jos_","skip_checks":"0","skip_files":"1","skip_templates":"1","skip_extensions":"1","skip_core_users":"0","skip_core_categories":"0","skip_core_sections":"0","skip_core_contents":"0","skip_core_contents_frontpage":"0","skip_core_menus":"0","skip_core_menus_types":"0","skip_core_modules":"0","skip_core_modules_menu":"0","skip_core_banners":"0","skip_core_banners_clients":"0","skip_core_banners_tracks":"0","skip_core_contacts":"0","skip_core_newsfeeds":"0","skip_core_weblinks":"0","positions":"0","debug":"0"}';
         $query = "UPDATE #__extensions SET `params` = '{$default_params}' WHERE `element` = 'com_jupgradepro'";
         $db->setQuery($query);
         $db->query();
         // get params.. again
         $params = JComponentHelper::getParams('com_jupgradepro');
     }
     // Load mooTools
     //JHTML::_('behavior.mootools'); // 2.5
     JHtml::_('behavior.framework', true);
     $xmlfile = JPATH_COMPONENT_ADMINISTRATOR . '/jupgradepro.xml';
     $xml = JFactory::getXML($xmlfile);
     $this->params = $params;
     $this->version = $xml->version[0];
     parent::display($tpl);
 }
Example #2
0
 /**
  * fieldsattachs view display method
  * @return void
  */
 function display($tpl = null)
 {
     // Get data from the model
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Assign data to the view
     $this->items = $items;
     $this->pagination = $pagination;
     //Version
     $this->version = "";
     $xml = JFactory::getXML(JPATH_COMPONENT . DS . 'fieldsattach.xml');
     $this->version = (string) $xml->version;
     // Set the toolbar
     $this->addToolBar();
     //Add script
     $this->jqueryscript();
     // Display the template
     parent::display($tpl);
     // Set the document
     //$this->setDocument();
 }
Example #3
0
 /**
  * Reads a file and searches for the license
  *
  * @param   string  $file  - The path to the file
  *
  * @return boolean True if the license was found, otherwise False.
  */
 protected function find($file)
 {
     $xml = JFactory::getXML($file);
     // Failed to parse the xml file.
     // Assume that this is not a extension manifest
     if (!$xml) {
         return true;
     }
     // Check if this is an extension manifest
     // 1.5 uses 'install', 1.6 uses 'extension'
     if ($xml->getName() != 'install' && $xml->getName() != 'extension') {
         return true;
     }
     // Check if there's a license tag
     if (!isset($xml->license)) {
         $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_FOUND'));
         return false;
     }
     // Check if the license is gpl
     if (stripos($xml->license, 'gpl') === false && stripos($xml->license, 'general public license') === false) {
         $this->report->addCompat($file, JText::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_GPL'));
         return false;
     }
     // All checks passed. Return true
     return true;
 }
Example #4
0
 public static function importYtb($ytbLink, $folder, &$errorMsg = '')
 {
     $ytbCode = str_replace("&feature=related", "", PhocaGalleryYoutube::getCode(strip_tags($ytbLink)));
     $ytb = array();
     $ytb['title'] = '';
     $ytb['desc'] = '';
     $ytb['filename'] = '';
     $ytb['link'] = strip_tags($ytbLink);
     if (!function_exists("curl_init")) {
         $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_NOT_LOADED_CURL');
         return false;
     } else {
         if ($ytbCode == '') {
             $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_URL_NOT_CORRECT');
             return false;
         } else {
             // Data
             $cUrl = curl_init("http://gdata.youtube.com/feeds/api/videos/" . strip_tags($ytbCode));
             curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
             $xml = curl_exec($cUrl);
             curl_close($cUrl);
             $xml = str_replace('<media:', '<phcmedia', $xml);
             $xml = str_replace('</media:', '</phcmedia', $xml);
             $data = JFactory::getXML($xml, false);
             //Title
             if (isset($data->title)) {
                 $ytb['title'] = (string) $data->title;
             }
             if ($ytb['title'] == '' && isset($data->phcmediagroup->phcmediatitle)) {
                 $ytb['title'] = (string) $data->phcmediagroup->phcmediatitle;
             }
             if (isset($data->phcmediagroup->phcmediadescription)) {
                 $ytb['desc'] = (string) $data->phcmediagroup->phcmediadescription;
             }
             // Thumbnail
             if (isset($data->phcmediagroup->phcmediathumbnail[0]['url'])) {
                 $cUrl = curl_init(strip_tags((string) $data->phcmediagroup->phcmediathumbnail[0]['url']));
                 curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
                 $img = curl_exec($cUrl);
                 curl_close($cUrl);
             }
             if ($img != '') {
                 $cUrl = curl_init("http://img.youtube.com/vi/" . strip_tags($ytbCode) . "/0.jpg");
                 curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
                 $img = curl_exec($cUrl);
                 curl_close($cUrl);
             }
             $ytb['filename'] = $folder . strip_tags($ytbCode) . '.jpg';
             if (JFile::exists(JPATH_ROOT . DS . 'images' . DS . 'phocagallery' . DS . $ytb['filename'], $img)) {
                 $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_ERROR_VIDEO_EXISTS');
                 return false;
             }
             if (!JFile::write(JPATH_ROOT . DS . 'images' . DS . 'phocagallery' . DS . $ytb['filename'], $img)) {
                 $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_ERROR_WRITE_IMAGE');
                 return false;
             }
         }
     }
     return $ytb;
 }
Example #5
0
 protected function getInput()
 {
     JHtml::_('behavior.modal', 'a.modal');
     $catalog_path = JPATH_SITE . DS . 'modules' . DS . 'mod_image_show_gk4' . DS . 'styles';
     $folders = JFolder::folders($catalog_path);
     $options = array();
     $final_output = '';
     if (count($folders) > 0) {
         foreach ($folders as $folder) {
             $output = '';
             // read XML file
             $xml = JFactory::getXML($catalog_path . DS . $folder . DS . 'info.xml');
             //
             foreach ($xml->config[0]->field as $field) {
                 $type = $field->attributes()->type;
                 $output .= '<li>' . $this->generateField($type, $field, $folder) . '</li>';
             }
             //
             $final_output .= '<div id="module_style_' . $folder . '" class="module_style"><ul class="adminformlist">' . $output . '</ul></div>';
         }
     } else {
         $final_output = 'Module have no styles. Please install some style package.';
     }
     $final_output .= '<textarea name="' . $this->name . '" id="' . $this->id . '" rows="20" cols="50">' . $this->value . '</textarea>';
     return $final_output;
 }
Example #6
0
 /**
  * Display the view.
  *
  * @param	string	$tpl	The subtemplate to display.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     // Get params
     JLoader::import('helpers.redmigrator', JPATH_COMPONENT_ADMINISTRATOR);
     $params = redMigratorHelper::getParams();
     //
     // Joomla bug: JInstaller not save the defaults params reading config.xml
     //
     $db = JFactory::getDBO();
     if (!$params->method) {
         $default_params = '{"method":"rest","rest_hostname":"http:\\/\\/www.example.org\\/","rest_username":"","rest_password":"","rest_key":"","path":"","driver":"mysql","hostname":"localhost","username":"","password":"","database":"","prefix":"jos_","skip_checks":"0","skip_files":"1","skip_templates":"1","skip_extensions":"1","skip_core_users":"0","skip_core_categories":"0","skip_core_sections":"0","skip_core_contents":"0","skip_core_contents_frontpage":"0","skip_core_menus":"0","skip_core_menus_types":"0","skip_core_modules":"0","skip_core_modules_menu":"0","skip_core_banners":"0","skip_core_banners_clients":"0","skip_core_banners_tracks":"0","skip_core_contacts":"0","skip_core_newsfeeds":"0","skip_core_weblinks":"0","positions":"0","debug":"0"}';
         $query = "UPDATE #__extensions SET `params` = '{$default_params}' WHERE `element` = 'com_redmigrator'";
         $db->setQuery($query);
         $db->query();
         // Get params.. again
         $params = redMigratorHelper::getParams();
     }
     // Load mooTools
     JHtml::_('behavior.framework', true);
     $xmlfile = JPATH_COMPONENT_ADMINISTRATOR . '/redmigrator.xml';
     $xml = JFactory::getXML($xmlfile);
     $this->params = $params;
     $this->version = $xml->version[0];
     parent::display($tpl);
 }
Example #7
0
 /**
  * Load a manifest from an XML file
  *
  * @param	string	$xmlpath	Path to XML manifest file
  *
  * @return	boolean	Result of load
  * @since	1.6
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->packagename = (string) $xml->packagename;
         $this->update = (string) $xml->update;
         $this->authorurl = (string) $xml->authorUrl;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->description = (string) $xml->description;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->version = (string) $xml->version;
         if (isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 // NOTE: JExtension doesn't expect a string.
                 // DO NOT CAST $file
                 $this->filelist[] = new JExtension($file);
             }
         }
         return true;
     }
 }
Example #8
0
 function uninstall($parent)
 {
     // Post Install Log
     self::_postInstallMessage('uninstall', $parent);
     $db = JFactory::getDbo();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "package" AND element = "pkg_cck"');
     $eid = $db->loadResult();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "plugin" AND element = "cck" AND folder="system"');
     $cck = $db->loadResult();
     // Uninstall FULL PACKAGE only if package exists && system plugin exists..
     if ($eid && $cck) {
         $manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml';
         if (JFile::exists($manifest)) {
             $xml = JFactory::getXML($manifest);
             // Keep it this way until platform 13.x
         }
         if (isset($xml->files)) {
             unset($xml->files->file[3]);
             $xml->asXML($manifest);
         }
         jimport('joomla.installer.installer');
         $installer = JInstaller::getInstance();
         $installer->uninstall('package', $eid);
     }
 }
 /**
  * Overrides the parent doExecute method to run the web application.
  *
  * This method should include your custom code that runs the application.
  *
  * @return  void
  *
  * @since   11.3
  */
 protected function doExecute()
 {
     // Create a stream context.
     $context = stream_context_create(array('http' => array('method' => 'GET')));
     // Open Flickr Feed as a Stream.
     $feed = @file_get_contents('http://api.flickr.com/services/feeds/photos_public.gne', false, $context);
     // Check if the feed could be opened.
     if (!$feed) {
         // Push the output into the document buffer.
         $this->document->setBuffer('Error: Failed to open stream.', array('type' => 'component', 'name' => 'main'));
         return false;
     }
     // Parse the XML feed.
     $reader = JFactory::getXML($feed, false);
     // Start an output buffer.
     ob_start();
     // Iterate through the elements in the stream.
     foreach ($reader->entry as $entry) {
         echo '<div class="cell">';
         echo $entry->content->data();
         echo '</div>';
     }
     // Get the buffer output.
     $output = ob_get_clean();
     // Push the output into the document buffer.
     $this->document->setBuffer($output, array('type' => 'component', 'name' => 'main'));
 }
Example #10
0
 function installPricingPack($sourcepath)
 {
     if (!self::isPackXML($sourcepath . DS . "manifest.xml")) {
         JError::raiseWarning(500, JText::_("FACTORY_FILE_IS_NOT_A_VALID_PRICING_MANIFEST") . $sourcepath . DS . "manifest.xml");
         return null;
     }
     $xml = JFactory::getXML($sourcepath . DS . "manifest.xml");
     $destfolder = (string) $xml->attributes()->folder;
     $destination = JPATH_COMPONENT_ADMINISTRATOR . DS . 'pricing' . DS . $destfolder;
     jimport("joomla.filesystem.folder");
     JFolder::copy($sourcepath, $destination);
     $db = JFactory::getDbo();
     $db->setQuery("select max(`ordering`)+1 from #__" . APP_PREFIX . "_pricing");
     $maxordering = $db->loadResult();
     $paytable = JTable::getInstance('PricingTable', 'JTheFactory');
     $paytable->itemname = (string) $xml->attributes()->folder;
     $paytable->pricetype = (string) $xml->pricetype;
     $paytable->name = (string) $xml->name;
     $paytable->price = (string) $xml->price;
     $paytable->currency = (string) $xml->currency;
     $paytable->enabled = 0;
     $paytable->params = null;
     $paytable->ordering = $maxordering;
     $paytable->store();
     self::parseQueries($xml->queries);
 }
Example #11
0
 /**
  * Load the manifest file
  *
  * @param   string  $xmlFile  XML File path
  *
  * @return   bool              True if successful, or False otherwise.
  */
 private function loadManifestFromXML($xmlFile = '')
 {
     $xml = null;
     if (version_compare(JVERSION, '1.6', '<')) {
         $xml = simplexml_load_file($xmlFile);
     } else {
         $xml = JFactory::getXML($xmlFile);
     }
     if (!$xml) {
         $this->_errors[] = JText::sprintf('File not found: %s', $xmlFile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->template = (string) $xml->template;
         $this->creationDate = (string) $xml->creationDate;
         $this->author = (string) $xml->author;
         $this->copyright = (string) $xml->copyright;
         $this->authorEmail = (string) $xml->authorEmail;
         $this->authorUrl = (string) $xml->authorUrl;
         $this->version = (string) $xml->version;
         $this->description = (string) $xml->description;
         // It is not just an Array, for compatibility with current extensions version,
         // that expect $manifest->positions->position as the array.
         $this->positions = new stdClass();
         $this->positions->position = array();
         foreach ($xml->positions->position as $position) {
             $this->positions->position[] = (string) $position;
         }
         return true;
     }
 }
Example #12
0
 public function load($path)
 {
     // Locate for the manifest file in the folder.
     $files = FD::get('Folders')->files($path, '.xml', self::RECURSIVE_SEARCH, self::RETRIEVE_FULL_PATH);
     $this->source = $path;
     if (!count($files)) {
         // Throw errors
         FD::get('Errors')->set('installer.xml', self::XML_NOT_FOUND);
         return false;
     }
     // Load through the list of manifest files to perform the installation.
     foreach ($files as $file) {
         $xml = JFactory::getXML($file);
         if (!$xml) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($xml);
             continue;
         }
         $this->type = (string) $xml->attributes()->type;
         if ($xml->getName() != 'social' || !in_array($this->type, $this->allowed)) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($parser);
             continue;
         }
         $this->parser = JFactory::getXMLParser('Simple');
         $this->parser->loadFile($file);
         // Set the path of the current xml file.
         $this->path = $file;
         // Retrieves the element
         $this->element = $this->parser->document->getElementByPath('element')->data();
         unset($xml);
         return true;
     }
     return false;
 }
Example #13
0
 public function _validateEasyDiscussVersion()
 {
     $valid = true;
     $parser = null;
     $version = '';
     $xmlFile = JPATH_ROOT . '/administrator/components/com_easydiscuss/easydiscuss.xml';
     if (JFile::exists($xmlFile)) {
         $jVerArr = explode('.', JVERSION);
         $joomlaVersion = $jVerArr[0] . '.' . $jVerArr[1];
         $contents = JFile::read($xmlFile);
         if ($joomlaVersion >= '3.0') {
             $parser = JFactory::getXML($contents, false);
             $version = $parser->xpath('version');
         } else {
             $parser = JFactory::getXMLParser('Simple');
             $parser->loadString($contents);
             $element = $parser->document->getElementByPath('version');
             $version = $element->data();
         }
         if ($version < '3.0.0') {
             $valid = false;
         }
         // If the current installed version is lower than attachment bug patch 3.0.8598
         if ($version < '3.0.8597') {
             $valid = 'warning';
         }
     }
     return $valid;
 }
 /**
  * Load a manifest from a file
  * @param string $xmlfile Path to file to load
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->libraryname = (string) $xml->libraryname;
         $this->version = (string) $xml->version;
         $this->description = (string) $xml->description;
         $this->creationdate = (string) $xml->creationdate;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->authorurl = (string) $xml->authorUrl;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->update = (string) $xml->update;
         if (isset($xml->files) && isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 $this->filelist[] = (string) $file;
             }
         }
         return true;
     }
 }
Example #15
0
 public static function helpsite($value)
 {
     if (empty($value)) {
         return self::value($value);
     } else {
         $version = new JVersion();
         $jver = explode('.', $version->getShortVersion());
         $pathToXml = JPATH_ADMINISTRATOR . '/help/helpsites.xml';
         $text = $value;
         if (!empty($pathToXml) && ($xml = JFactory::getXML($pathToXml))) {
             foreach ($xml->sites->site as $site) {
                 if ((string) $site->attributes()->url == $value) {
                     $text = (string) $site;
                     break;
                 }
             }
         }
         $value = htmlspecialchars($value);
         if (substr($value, 0, 4) == "http") {
             return '<a href="' . $value . '">' . $text . '</a>';
         } else {
             return '<a href="http://' . $value . '">' . $text . '</a>';
         }
     }
 }
Example #16
0
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = 'Failed to load XML File: ' . $xmlfile;
         return false;
     } else {
         $xml = $xml->document;
         $this->name = (string) $xml->name;
         $this->packagename = (string) $xml->packagename;
         $this->update = (string) $xml->update;
         $this->authorurl = (string) $xml->authorUrl;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->description = (string) $xml->description;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->version = (string) $xml->version;
         if (isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 $this->filelist[] = new JExtension((string) $file);
             }
         }
         return true;
     }
 }
Example #17
0
 function doclone()
 {
     $themename = JRequest::getVar('themename');
     $newname = JRequest::getString('name');
     $newfolder = JRequest::getString('themefolder');
     $newdescription = JRequest::getString('description');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     if (is_array($themename)) {
         $themename = $themename[0];
     }
     $themedir = JTheFactoryThemesHelper::getThemeDir();
     if (!JTheFactoryThemesHelper::isThemeFile($themedir . DS . $themename . DS . "theme.xml")) {
         JError::raiseWarning(420, JText::_("FACTORY_THEME_IS_NOT_VALID"));
         $this->setRedirect("index.php?option=" . APP_EXTENSION . "&task=themes.listthemes");
         return true;
     }
     if (JFolder::exists($themedir . DS . $newfolder)) {
         JError::raiseWarning(420, JText::_("FACTORY_FOLDER_ALREADY_EXISTS") . " " . $newfolder);
         $this->setRedirect("index.php?option=" . APP_EXTENSION . "&task=themes.listthemes");
         return true;
     }
     JFolder::copy($themedir . DS . $themename, $themedir . DS . $newfolder);
     $manifest_file = $themedir . DS . $newfolder . DS . "theme.xml";
     $xml = JFactory::getXML($manifest_file);
     unset($xml['priority']);
     $xml['folder'] = $newfolder;
     $xml->name = $newname;
     $xml->description = $newdescription;
     $xml->creationDate = date('Y-m-d');
     $xmlcontent = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . $xml->asFormattedXML();
     JFile::write($manifest_file, $xmlcontent);
     $this->setRedirect("index.php?option=" . APP_EXTENSION . "&task=themes.listthemes", JText::_("FACTORY_THEME_SAVED"));
 }
Example #18
0
 function metamodProInfo()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select("enabled");
     $query->from("#__extensions");
     $query->where("type = 'plugin'");
     $query->where("element = 'metamodpro'");
     $query->where("folder = 'system'");
     $db->setQuery($query);
     $result = $db->loadResult();
     // $result will be "" or "0" or "1"
     switch ($result) {
         case '':
             return '<div>' . JText::_('MM_INFO_PRO_NOT_INSTALLED') . '</div>';
         case '0':
             $message = JText::_('MM_INFO_PRO_NOT_ENABLED');
             break;
         case '1':
             $message = JText::_('MM_INFO_PRO_ENABLED');
             break;
     }
     // define the path to the XML file
     $pathToXML_File = JPATH_SITE . '/plugins/system/metamodpro/metamodpro.xml';
     // parse the XML
     $xml = JFactory::getXML($pathToXML_File);
     // get the version tag
     $version = (string) $xml->version[0];
     $date = (string) $xml->creationDate[0];
     $r = '<div>';
     $r .= JText::sprintf($message, $version, $date);
     $r .= '</div>';
     return $r;
 }
Example #19
0
 function installGatewayPack($sourcepath)
 {
     if (!self::isPackXML($sourcepath . DS . "manifest.xml")) {
         JError::raiseWarning(500, JText::_("FACTORY_FILE_IS_NOT_A_VALID_GATEWAY_MANIFEST") . $sourcepath . DS . "manifest.xml");
         return null;
     }
     $xml = JFactory::getXML($sourcepath . DS . "manifest.xml");
     $destfolder = (string) $xml->attributes()->folder;
     $MyApp = JTheFactoryApplication::getInstance();
     $destination = $MyApp->app_path_admin . 'payments' . DS . 'plugins' . DS . 'gateways' . DS . strtolower($destfolder);
     jimport("joomla.filesystem.folder");
     JFolder::copy($sourcepath, $destination);
     $db = JFactory::getDbo();
     $db->setQuery("select max(`ordering`)+1 from #__" . APP_PREFIX . "_paysystems");
     $maxordering = $db->loadResult();
     $gw = JTable::getInstance('GatewaysTable', 'JTheFactory');
     $gw->paysystem = (string) $xml->name;
     $gw->classname = (string) $xml->attributes()->folder;
     $gw->enabled = 0;
     $gw->params = null;
     $gw->ordering = $maxordering;
     $gw->isdefault = 0;
     $gw->store();
     self::parseQueries($xml->queries);
 }
Example #20
0
 /**
  * Get version of JEA
  * @return string
  */
 protected function getVersion()
 {
     if (is_file(JPATH_COMPONENT . '/jea.xml')) {
         $xml = JFactory::getXML(JPATH_COMPONENT . '/jea.xml');
         return $xml->version;
     }
     return '';
 }
Example #21
0
 function parseXmlFile($filePath)
 {
     $result = array();
     /* JFactory::getXML() is the recommended method of Joomla 2.5 */
     if (!($xml = JFactory::getXML($filePath))) {
         return false;
     } else {
         return $xml;
     }
 }
Example #22
0
 function load()
 {
     $this->params = JComponentHelper::getParams($this->component_name);
     foreach ($this->params->toArray() as $key => $val) {
         $this->{$key} = $val;
     }
     //Load the version number from the install XML file.
     $xml = JFactory::getXML(JPATH_ADMINISTRATOR . '/components/' . $this->component_name . '/' . $this->component_name . '.xml');
     $this->version = (string) $xml->version;
     $this->versioncat = (string) $xml->custom->versioncheckercat;
 }
Example #23
0
 function _install($file)
 {
     $AG_resourceType = JRequest::getVar('AG_resourceType');
     // Current resource type
     $config = JFactory::getConfig();
     $tmp_dest = $config->get('tmp_path');
     $resourceType = substr($AG_resourceType, 0, strlen($AG_resourceType) - 1);
     $file_type = "zip";
     if (isset($file) && !empty($file['name'])) {
         //Clean up filename to get rid of strange characters like spaces etc
         $filename = JFile::makeSafe($file['name']);
         $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
         $src = $file['tmp_name'];
         $dest = $tmp_dest . DIRECTORY_SEPARATOR . $filename;
         //First check if the file has the right extension
         if ($ext == $file_type) {
             if (JFile::upload($src, $dest)) {
                 if (JArchive::extract($tmp_dest . DIRECTORY_SEPARATOR . $filename, $tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType)) {
                     JFile::delete($tmp_dest . DIRECTORY_SEPARATOR . $filename);
                 }
                 // TEMPLATE DETAILS PARSING
                 if (JFIle::exists($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename) . DIRECTORY_SEPARATOR . 'details.xml')) {
                     $ag_resourceManager_xml =& JFactory::getXML($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename) . DIRECTORY_SEPARATOR . 'details.xml');
                     if (isset($ag_resourceManager_xml->type)) {
                         $ag_resourceManager_type = $ag_resourceManager_xml->type;
                     } else {
                         JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                         JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                         return;
                     }
                 } else {
                     JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                     JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                     return;
                 }
                 if ($ag_resourceManager_type && $ag_resourceManager_type == $resourceType) {
                     $result = JFolder::move($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename), JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . $AG_resourceType . DIRECTORY_SEPARATOR . JFile::stripExt($filename));
                     if ($result) {
                         JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_INSTALLED') . "&nbsp;" . $filename, 'message');
                     } else {
                         JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_MOVED_ITEM') . "&nbsp;" . $result, 'message');
                     }
                 } else {
                     JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType);
                     JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . "&nbsp;" . $filename, 'error');
                 }
             } else {
                 JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_UPLOAD_FILE_TO_TEMP_FOLDER_PLEASE_CHECK_PERMISSIONS'), 'error');
             }
         } else {
             JFactory::getApplication()->enqueueMessage(JText::_('AG_ONLY_ZIP_ARCHIVES_CAN_BE_INSTALLED'), 'error');
         }
     }
 }
Example #24
0
 protected function onProcessList(&$resultArray)
 {
     foreach ($resultArray as &$res) {
         $res->view = JText::_('J2STORE_VIEW');
         $xmlfile = JPATH_SITE . '/plugins/j2store/' . $res->element . '/' . $res->element . '.xml';
         $version = '';
         if (JFile::exists($xmlfile)) {
             $xml = JFactory::getXML($xmlfile);
             $res->version = (string) $xml->version;
         }
     }
 }
Example #25
0
 function getFieldsets($filename, $group)
 {
     $xml = JFactory::getXML($filename);
     $elements = $xml->xpath('//groups[@name="' . (string) $group . '"]');
     $sets = array();
     foreach ($elements as $element) {
         if ($tmp = $element->xpath('descendant::fieldset[@name] | descendant::field[@fieldset]/@fieldset')) {
             $sets = array_merge($sets, (array) $tmp);
         }
     }
     return $sets;
 }
Example #26
0
File: xml.php Project: Tommar/vino2
 /**
  * Creates a new instance of the Joomla parser.
  *
  * @since	1.0
  * @access	public
  */
 public function __construct($contents = '', $isFile = false)
 {
     $this->version = EasyBlogHelper::getJoomlaVersion();
     if ($this->version >= '3.0') {
         $parser = JFactory::getXML($contents, $isFile);
     } else {
         $parser = JFactory::getXMLParser('Simple');
         $parser->loadString($contents);
     }
     $this->parser = $parser;
     return $this;
 }
Example #27
0
File: xml.php Project: elkuku/g11n
 /**
  * Parse a file.
  *
  * @param string $fileName File to parse
  *
  * @return object g11nFileInfo
  */
 public function parse($fileName)
 {
     $fileName = JPath::clean($fileName);
     $this->fileInfo = new g11nFileInfo();
     $this->fileInfo->fileName = $fileName;
     //--Search XML files
     if (!($xml = JFactory::getXML($fileName))) {
         return $this->fileInfo;
     }
     $this->parseXML($xml);
     return $this->fileInfo;
 }
 protected function doExecute()
 {
     $context = stream_context_create(array('https' => array('method' => 'GET')));
     //get auth from google
     $auth = $this->getAuth();
     // Open Picasa photo list. through curl
     $ch = curl_init("http://picasaweb.google.com/data/feed/base/user/118179057367064112898/album/MquemeFotografia?imgmax=200");
     $header[] = 'Authorization: GoogleLogin ' . $auth;
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     $feed = curl_exec($ch);
     curl_close($ch);
     //Check if the feed could be opened.
     if (!$feed) {
         // Push the output into the document buffer.
         $this->document->setBuffer('Error: Failed to open stream.', array('type' => 'component', 'name' => 'main'));
         return false;
     }
     // Parse the XML feed.
     $reader = JFactory::getXML($feed, false);
     // Start an output buffer.
     $result = array();
     foreach ($reader->entry as $photo) {
         $temp = array();
         // get the photo and thumbnail information
         $media = $photo->children('http://search.yahoo.com/mrss/');
         // full image information
         $group_content = $media->group->content;
         $temp['full_url'] = $group_content->attributes()->{'url'};
         $temp['full_width'] = $group_content->attributes()->{'width'};
         $temp['full_height'] = $group_content->attributes()->{'height'};
         // thumbnail information, get the 3rd (=biggest) thumbnail version
         // change the [2] to [0] or [1] to get smaller thumbnails
         $group_thumbnail = $media->group->thumbnail[2];
         $temp['thumbnail_url'] = $group_thumbnail->attributes()->{'url'};
         $temp['thumbnail_width'] = $group_thumbnail->attributes()->{'width'};
         $temp['thumbnail_height'] = $group_thumbnail->attributes()->{'height'};
         $temp['title'] = $media->group_title[0];
         $result[] = $temp;
     }
     ob_start();
     // Iterate through the elements in the stream.
     foreach ($result as $r) {
         echo '<a href="' . $r['full_url'] . '" title="' . $r['title'] . '">
               <img src="' . $r['thumbnail_url'] . '" width="' . $r['thumbnail_width'] . '" height="' . $r['thumbnail_height'] . '" alt="' . $r['title'] . '" />
               </a>';
     }
     // Get the buffer output.
     $output = ob_get_clean();
     // Push the output into the document buffer.
     $this->document->setBuffer($output, array('type' => 'component', 'name' => 'main'));
 }
 function preflight($type, $parent)
 {
     $xmlfile = JPATH_ADMINISTRATOR . '/components/com_j2store/manifest.xml';
     $xml = JFactory::getXML($xmlfile);
     $version = (string) $xml->version;
     //check for minimum requirement
     // abort if the current J2Store release is older
     if (version_compare($version, '2.6.7', 'lt')) {
         Jerror::raiseWarning(null, 'You are using an old version of J2Store. Please upgrade to the latest version');
         return false;
     }
 }
Example #30
0
 function uninstall($parent)
 {
     // Post Install Log
     self::_postInstallMessage('uninstall', $parent);
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "package" AND element = "pkg_cck"');
     $eid = $db->loadResult();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "plugin" AND element = "cck" AND folder="system"');
     $cck = $db->loadResult();
     // Backup or Drop SQL Tables
     $prefix = $db->getPrefix();
     $tables = $db->getTableList();
     $tables = array_flip($tables);
     $uninstall_sql = (int) JCck::getConfig_Param('uninstall_sql', '');
     if (count($tables)) {
         $length = strlen($prefix);
         $app->cck_nosql = true;
         foreach ($tables as $k => $v) {
             $pos = strpos($k, $prefix . 'cck_');
             if ($pos !== false && $pos == 0) {
                 $k2 = $prefix . '_' . substr($k, $length);
                 if (isset($tables[$k2])) {
                     $db->setQuery('DROP TABLE ' . $k2);
                     $db->execute();
                 }
                 if ($uninstall_sql == 1) {
                     $db->setQuery('DROP TABLE ' . $k);
                     $db->execute();
                 } else {
                     $db->setQuery('RENAME TABLE ' . $k . ' TO ' . $k2);
                     $db->execute();
                 }
             }
         }
     }
     // Uninstall FULL PACKAGE only if package exists && system plugin exists..
     if ($eid && $cck) {
         $manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml';
         if (JFile::exists($manifest)) {
             $xml = JFactory::getXML($manifest);
             // Keep it this way until platform 13.x
         }
         if (isset($xml->files)) {
             unset($xml->files->file[3]);
             $xml->asXML($manifest);
         }
         jimport('joomla.installer.installer');
         $installer = JInstaller::getInstance();
         $installer->uninstall('package', $eid);
     }
 }