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') . " " . $filename, 'error'); return; } } else { JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType); JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . " " . $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') . " " . $filename, 'message'); } else { JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_MOVED_ITEM') . " " . $result, 'message'); } } else { JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . $AG_resourceType); JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_NOT_VALID_RESOURCE_TYPE') . " " . $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'); } } }
function _install($file) { $AG_resourceType = JRequest::getVar('AG_resourceType'); // Current resource type $config =& JFactory::getConfig(); $tmp_dest = $config->getValue('config.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 . DS . $filename; //First check if the file has the right extension if ($ext == $file_type) { if (JFile::upload($src, $dest)) { if (JArchive::extract($tmp_dest . DS . $filename, JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'AdmirorGallery' . DS . $AG_resourceType)) { JFile::delete($tmp_dest . DS . $filename); } // TEMPLATE DETAILS PARSING if (JFIle::exists(JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'AdmirorGallery' . DS . $AG_resourceType . DS . JFile::stripExt($filename) . DS . 'details.xml')) { $ag_resourceManager_xml =& JFactory::getXMLParser('simple'); $ag_resourceManager_xml->loadFile(JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'AdmirorGallery' . DS . $AG_resourceType . DS . JFile::stripExt($filename) . DS . 'details.xml'); if (isset($ag_resourceManager_xml->document->type[0])) { $ag_resourceManager_type = $ag_resourceManager_xml->document->type[0]->data(); } } if ($ag_resourceManager_type == $resourceType) { JFactory::getApplication()->enqueueMessage(JText::_('ZIP PACKAGE IS INSTALLED:') . " " . $filename, 'message'); } else { JFolder::delete(JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'AdmirorGallery' . DS . $AG_resourceType . DS . JFile::stripExt($filename)); JFactory::getApplication()->enqueueMessage(JText::_('ZIP PACKAGE IS NOT VALID RESOURCE TYPE:') . " " . $filename, 'error'); } } else { JFactory::getApplication()->enqueueMessage(JText::_('CANNOT UPLOAD FILE TO TEMP FOLDER. PLEASE CHECK PERMISSIONS.'), 'error'); } } else { JFactory::getApplication()->enqueueMessage(JText::_('ONLY ZIP ARCHIVES CAN BE INSTALLED.'), 'error'); } } }
$ag_itemURL = $this->ag_init_itemURL; $ag_folderName = dirname($ag_itemURL); $ag_fileName = basename($ag_itemURL); $AG_imgInfo = agHelper::ag_imageInfo(JPATH_SITE . $ag_itemURL); require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'content' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'admirorgallery' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'agHelper.php'; $thumbsFolderPhysicalPath = JPATH_SITE . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_admirorgallery' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'thumbs'; agHelper::ag_sureRemoveDir($thumbsFolderPhysicalPath, true); if (!JFolder::create($thumbsFolderPhysicalPath, 0755)) { JFactory::getApplication()->enqueueMessage(JText::_("AG_CANNOT_CREATE_FOLDER") . " " . $newFolderName, 'error'); } $ag_hasXML = ""; $ag_hasThumb = ""; // Set Possible Description File Apsolute Path // Instant patch for upper and lower case... $ag_pathWithStripExt = JPATH_SITE . $ag_folderName . '/' . JFile::stripExt(basename($ag_itemURL)); $ag_imgXML_path = $ag_pathWithStripExt . ".XML"; if (JFIle::exists($ag_pathWithStripExt . ".xml")) { $ag_imgXML_path = $ag_pathWithStripExt . ".xml"; } if (file_exists(JPATH_SITE . "/plugins/content/admirorgallery/admirorgallery/thumbs/" . basename($ag_folderName) . "/" . basename($ag_fileName))) { $ag_hasThumb = '<img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $this->ag_template_id . '/images/icon-hasThumb.png" class="ag_hasThumb" />'; } if (file_exists($ag_imgXML_path)) { $ag_hasXML = '<img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $this->ag_template_id . '/images/icon-hasXML.png" class="ag_hasXML" />'; $ag_imgXML_xml = simplexml_load_file($ag_imgXML_path); $ag_imgXML_captions = $ag_imgXML_xml->captions; } else { $ag_imgXML_captions = null; } $ag_preview_content = ''; // GET IMAGES FOR NEXT AND PREV IMAGES FUNCTIONS $ag_files = JFolder::files(JPATH_SITE . $ag_folderName);
$total = count($ag_resourceManager_installed); $pageNav = new JPagination($total, $limitstart, $limit); if ($limit == "all") { $limit = $total; } if (!empty($ag_resourceManager_installed)) { foreach ($ag_resourceManager_installed as $ag_resourceManager_Key => $ag_resourceManager_Value) { if ($ag_resourceManager_Key >= $limitstart && $ag_resourceManager_Key < $limitstart + $limit) { // TEMPLATE DETAILS PARSING $ag_resourceManager_id = $ag_resourceManager_Value; $ag_resourceManager_name = $ag_resourceManager_id; $ag_resourceManager_creationDate = JText::_("UNDATED"); $ag_resourceManager_author = JText::_("UNKNOWN AUTHOR"); $ag_resourceManager_version = JText::_("UNKNOWN VERSION"); $ag_resourceManager_description = JText::_("NO DESCRITION"); if (JFIle::exists(JPATH_SITE . '/plugins/content/AdmirorGallery/' . $AG_resourceType . '/' . $ag_resourceManager_id . '/details.xml')) { // N U $ag_resourceManager_xml =& JFactory::getXMLParser('simple'); $ag_resourceManager_xml->loadFile(JPATH_SITE . '/plugins/content/AdmirorGallery/' . $AG_resourceType . '/' . $ag_resourceManager_id . '/details.xml'); // N U $ag_resourceManager_name = $ag_resourceManager_xml->document->name[0]->data(); $ag_resourceManager_creationDate = $ag_resourceManager_xml->document->creationDate[0]->data(); $ag_resourceManager_author = $ag_resourceManager_xml->document->author[0]->data(); $ag_resourceManager_version = $ag_resourceManager_xml->document->version[0]->data(); $ag_resourceManager_description = $ag_resourceManager_xml->document->description[0]->data(); } echo ' <tr> <td align="right"> ' . ($ag_resourceManager_Key + 1) . '. </td>
function _desc_content($ag_itemURL, $AG_desc_content, $AG_desc_tags) { $ag_folderName = dirname($ag_itemURL); // Set Possible Description File Apsolute Path // Instant patch for upper and lower case... $ag_pathWithStripExt = JPATH_SITE . $ag_folderName . DS . JFile::stripExt(basename($ag_itemURL)); $ag_XML_path = $ag_pathWithStripExt . ".xml"; if (JFIle::exists($ag_pathWithStripExt . ".XML")) { $ag_XML_path = $ag_pathWithStripExt . ".XML"; } $ag_captions_new = ""; $ag_captions_new .= "<captions>" . "\n"; if (!empty($AG_desc_content)) { foreach ($AG_desc_content as $key => $value) { if (!empty($value)) { $ag_captions_new .= "\t" . '<caption lang="' . strtolower($AG_desc_tags[$key]) . '">' . htmlspecialchars($value, ENT_QUOTES, "UTF-8") . '</caption>' . "\n"; } } } $ag_captions_new .= "</captions>"; $ag_XML_content = ""; if (file_exists($ag_XML_path)) { $file = fopen($ag_XML_path, "r"); while (!feof($file)) { $ag_XML_content .= fgetc($file); } fclose($file); $ag_XML_content = preg_replace("#<captions[^}]*>(.*?)</captions>#s", $ag_captions_new, $ag_XML_content); } else { $ag_XML_content = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<image>' . "\n" . '<visible>true</visible>' . "\n" . '<priority></priority>' . "\n" . $ag_captions_new . "\n" . '</image>'; } // Save XML $this->_saveXML($ag_itemURL, $ag_XML_path, $ag_XML_content); }
$tmp_dest = $config->getValue('config.tmp_path'); $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 . '/' . $filename; //First check if the file has the right extension if ($ext == $file_type) { if (JFile::upload($src, $dest)) { if (JArchive::extract($tmp_dest . '/' . $filename, JPATH_SITE . '/plugins/content/AdmirorGallery/' . JFile::makeSafe($task))) { JFile::delete($tmp_dest . '/' . $filename); } // TEMPLATE DETAILS PARSING if (JFIle::exists(JPATH_SITE . '/plugins/content/AdmirorGallery/' . JFile::makeSafe($task) . '/' . JFile::stripExt($filename) . '/details.xml')) { $ag_resourceManager_xml =& JFactory::getXMLParser('simple'); $ag_resourceManager_xml->loadFile(JPATH_SITE . '/plugins/content/AdmirorGallery/' . JFile::makeSafe($task) . '/' . JFile::stripExt($filename) . '/details.xml'); $ag_resourceManager_type = $ag_resourceManager_xml->document->type[0]->data(); } if ($ag_resourceManager_type == $resourceType) { $ag_notice[] = array('ZIP package is installed.', $filename); } else { JFolder::delete(JPATH_SITE . '/plugins/content/AdmirorGallery/' . JFile::makeSafe($task) . '/' . JFile::stripExt($filename)); $ag_notice[] = array('ZIP package is not valid resource type.', $filename); } } else { $ag_error[] = array('Cannot upload file to temp folder. Please check permissions.'); } } else { $ag_error[] = array('Only zip archives can be installed.');
$total = count($this->ag_resourceManager_installed); $pageNav = new JPagination($total, $this->limitstart, $this->limit); if ($this->limit == "all") { $this->limit = $total; } if ($total > 0) { foreach ($this->ag_resourceManager_installed as $ag_resourceManager_Key => $ag_resourceManager_Value) { if ($ag_resourceManager_Key >= $this->limitstart && $ag_resourceManager_Key < $this->limitstart + $this->limit) { // TEMPLATE DETAILS PARSING $ag_resourceManager_id = $ag_resourceManager_Value; $ag_resourceManager_name = $ag_resourceManager_id; $ag_resourceManager_creationDate = JText::_("AG_UNDATED"); $ag_resourceManager_author = JText::_("AG_UNKNOWN_AUTHOR"); $ag_resourceManager_version = JText::_("AG_UNKNOWN_VERSION"); $ag_resourceManager_description = JText::_("AG_NO_DESCRITION"); if (JFIle::exists(JPATH_SITE . '/plugins/content/admirorgallery/admirorgallery/' . $this->ag_resource_type . '/' . $ag_resourceManager_id . '/details.xml')) { // N U $ag_resourceManager_xml = JFactory::getXML(JPATH_SITE . '/plugins/content/admirorgallery/admirorgallery/' . $this->ag_resource_type . '/' . $ag_resourceManager_id . '/details.xml'); $ag_resourceManager_name = $ag_resourceManager_xml->name; $ag_resourceManager_creationDate = $ag_resourceManager_xml->creationDate; $ag_resourceManager_author = $ag_resourceManager_xml->author; $ag_resourceManager_version = $ag_resourceManager_xml->version; $ag_resourceManager_description = $ag_resourceManager_xml->description; } ?> <tr> <td class="order nowrap center"> <?php echo $ag_resourceManager_Key + 1; ?>
// $db->setQuery($query); // $row = $db->loadAssocList('uniqueName'); // echo $row['sample_row']['greeting']; // Reading database // $db =& JFactory::getDBO(); // $query = "SELECT * FROM #__components"; // $db->setQuery($query); // $row = $db->loadAssocList('name'); // echo $row['Admiror Gallery']['params']; echo ' <input type="hidden" name="pressbutton" value="" id="pressbutton" /> </form> </div> <br style="clear:both" /> '; if (JFIle::exists(JPATH_COMPONENT_ADMINISTRATOR . '/admirorgallery.xml')) { $ag_admirorgallery_xml =& JFactory::getXMLParser('simple'); $ag_admirorgallery_xml->loadFile(JPATH_COMPONENT_ADMINISTRATOR . '/admirorgallery.xml'); $ag_admirorgallery_version_component = $ag_admirorgallery_xml->document->version[0]->data(); $ag_admirorgallery_version_plugin = $ag_admirorgallery_xml->document->plugin_version[0]->data(); $ag_admirorgallery_version_button = $ag_admirorgallery_xml->document->button_version[0]->data(); echo JText::_('COMPONENT VERSION:') . ' ' . $ag_admirorgallery_version_component . "<br />"; echo JText::_('PLUGIN VERSION:') . ' ' . $ag_admirorgallery_version_plugin . "<br />"; echo JText::_('BUTTON VERSION:') . ' ' . $ag_admirorgallery_version_button . "<br />"; } echo ' </td> <td style="vertical-align:text-top; width:50%" class="AG_descriptionWrapper"> ' . "\n"; echo JText::_('ADMIRORDESCRIPTION'); echo '