/administrator/components/com_jfusion/views/extensions/tmpl/default.php
PHP | 432 lines | 340 code | 60 blank | 32 comment | 38 complexity | f2a9ab720f0023b5fe7cdeefd2c8b4cd MD5 | raw file
Possible License(s): Apache-2.0
- <?php
- /**
- * @package JFusion
- * @subpackage Views
- * @author JFusion development team
- * @copyright Copyright (C) 2008 JFusion. All rights reserved.
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
- */
-
- // no direct access
- defined('_JEXEC') or die('Restricted access');
-
- // load debug library
- require_once(JPATH_ADMINISTRATOR .DS.'components'.DS.'com_jfusion'.DS.'models'.DS.'model.debug.php');
-
- /**
- * This function allows the version number to be retrieved for JFusion plugins
- */
- function getVersionNumber($plugin_type, $plugin, &$row_count){
- //append path
- $localfile = JPATH_SITE . $plugin->localfile[0]->data();
- $installed = false;
-
- if($plugin_type=='jfusion') {
- static $installed_plugins;
- if(!is_array($installed_plugins)) {
- $db = & JFactory::getDBO();
- $query = 'SELECT name from #__jfusion WHERE name != "joomla_int"';
- $db->setQuery($query);
- $installed_plugins = $db->loadObjectList('name');
- }
- if(array_key_exists($plugin->name(), $installed_plugins)) {
- $installed = true;
- }
- } elseif($plugin_type=='joomla') {
- $db =& JFactory::getDBO();
- if($plugin->type[0]->data()=='plugin') {
- $query = "SELECT id FROM #__plugins WHERE element = '{$plugin->element[0]->data()}' AND folder = '{$plugin->folder[0]->data()}'";
- $db->setQuery($query);
- $result = $db->loadResult();
- if(!empty($result)) {
- $installed = true;
- }
- } else {
- $query = "SELECT id FROM #__modules WHERE module = '{$plugin->element[0]->data()}' LIMIT 0,1";
- $db->setQuery($query);
- $result = $db->loadResult();
- if(!empty($result)) {
- $installed = true;
- }
- }
- } elseif($plugin_type=='language') {
- //if $localfile exists, then language is installed
- if(file_exists($localfile)) {
- $installed = true;
- }
- }
-
- if (file_exists($localfile) && is_readable($localfile) && $installed) {
- //get the version number
- $parser = JFactory::getXMLParser('Simple');
- $parser->loadFile($localfile);
-
- if (version_compare($parser->document->version[0]->data(), $plugin->version[0]->data(), '>=')){
- $status = 'up2date';
- echo '<tr class = "good'.$row_count.' row">';
- $version = $parser->document->version[0]->data();
- } else {
- echo '<tr class = "bad'.$row_count.' row">';
- $status = 'outdated';
- $version = $parser->document->version[0]->data();
- }
- } else {
- $status = 'not_installed';
- echo '<tr class="row">';
- $version = JText::_('NOT') .' ' . JText::_('INSTALLED');
- }
-
- //output the standard info
- echo '<td>' . JText::_('JFUSION') . ' ' .$plugin->name[0]->data(). ' </td>';
- echo '<td>' . $version . '</td>';
- echo '<td>' . $plugin->version[0]->data() . '</td><td>';
-
-
- //create the URL
- $url = 'index.php?option=com_jfusion&mode=' . $plugin_type .'&name=' . $plugin->name();
- if(!empty($plugin->type[0])){
- $url .= '&type=' . $plugin->type[0]->data();
- }
- if(!empty($plugin->element[0])){
- $url .= '&element=' . $plugin->element[0]->data();
- }
- if(!empty($plugin->folder[0])){
- $url .= '&folder=' . $plugin->folder[0]->data();
- }
-
-
- if($status == 'outdated') {
- //provide upgrade option
- echo '<a href="' . $url . '&task=install">'.JText::_('UPGRADE').'</a>';
- //provide uninstall option
- echo ' / <a href="javascript:void(0);" onclick="if(confirm(\''.JText::sprintf('CONFIRM_UNINSTALL',$plugin->name[0]->data()).'\')) { window.location=\''.$url.'&task=uninstall\'; }">'.JText::_('UNINSTALL').'</a>';
- } elseif ($status == 'up2date') {
- //provide uninstall option
- echo '<a href="javascript:void(0);" onclick="if(confirm(\''.JText::sprintf('CONFIRM_UNINSTALL',$plugin->name[0]->data()).'\')) { window.location=\''.$url.'&task=uninstall\'; }">'.JText::_('UNINSTALL').'</a>';
- } else {
- //provide install option
- echo '<a href="'.$url.'&task=install"">'.JText::_('INSTALL').'</a>';
- }
-
- echo ' / <a href="' . $plugin->remotefile[0]->data() . '">'.JText::_('DOWNLOAD').'</a>';
-
-
- //close the table
- echo '</td></tr>';
-
- //cleanup for the next function call
- unset($parser);
- if ($row_count == 1){
- $row_count = 0;
- } else {
- $row_count = 1;
- }
- }
-
- /**
- * Sort the results by name
- */
- function sortByName($a, $b) {
- return (strcasecmp ($a->name[0]->data(),$b->name[0]->data()));
- }
-
-
- //check the jFusion component version
- ?>
- <table class="adminform" style="border-spacing:1px;">
- <thead>
- <tr>
- <th class="title" align="left"><?php echo JText::_('STATUS'); ?></th>
- <th class="title" align="center"><?php echo JText::_('YOUR_VERSION'); ?></th>
- <th class="title" align="center"><?php echo JText::_('CURRENT_VERSION'); ?></th>
- <th class="title" align="center"></th>
- </tr>
- </thead>
- <tbody>
- <?php
-
- if(version_compare($this->VersionCurrent, $this->VersionLatest , '>=')){
- //output the good news
- ?>
- <tr class="good0">
- <td><img src="components/com_jfusion/images/check_good.png"
- height="30px" width="30px"></td>
- <td><?php echo $this->VersionCurrent . ' (Rev ' . $this->RevisionCurrent . ')';?></td>
- <td><?php echo $this->VersionLatest;?></td>
- <td>
- <h2><?php echo JText::_('JFUSION_UP2DATE'); ?></h2>
- </td>
- </tr>
-
- <?php } else { //output the bad news and automatic upgrade option ?>
- <tr class="bad0">
- <td><img src="components/com_jfusion/images/check_bad.png"
- height="30px" width="30px"></td>
- <td><?php echo $this->VersionCurrent;?></td>
- <td><?php echo $this->VersionLatest;?></td>
- <td>
- <h2><?php echo JText::_('JFUSION_OUTDATED'); ?></h2>
- <a
- href="index.php?option=com_jfusion&task=install&file=<?php base64_encode($this->VersionData->latest[0]->remotefile[0]->data());?>"><?JText::_('UPGRADE');?></a>
- </td>
- </tr>
- <?php }
- ?></table><?php
-
- //check to see if we have version data
- if(empty($this->VersionData)){
- echo '<h2>' . JText::_('NO_VERSION_DATA') . '</h2>';
- return;
- }
-
- //do a server compatibility check
- ?>
- <table class="adminform" style="border-spacing:1px;">
- <thead>
- <tr>
- <th class="title" align="left"><?php echo JText::_('SERVER_SOFTWARE'); ?></th>
- <th class="title" align="center"><?php echo JText::_('YOUR_VERSION'); ?></th>
- <th class="title" align="center"><?php echo JText::_('MINIMUM_VERSION'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php
- $server_compatible = true;
- if (version_compare(phpversion(), $this->VersionData->requirements[0]->php[0]->data()) == -1){
- ?><tr class = "bad0"><?php
- $server_compatible = false;
- } else {
- ?><tr class = "good0"><?php
- }
-
- ?>
- <td>PHP</td>
- <td><?php echo phpversion();?></td>
- <td><?php echo $this->VersionData->requirements[0]->php[0]->data();?></td>
- </tr>
-
- <?php
- $version =& new JVersion;
- $joomla_version = $version->getShortVersion();
- //remove any letters from the version
- $joomla_versionclean = preg_replace("[A-Za-z !]","", $joomla_version);
-
- if (version_compare($joomla_versionclean, $this->VersionData->requirements[0]->joomla[0]->data()) == -1){
- ?><tr class = "bad1"><?php
- $server_compatible = false;
- } else {
- ?><tr class = "good1"><?php
- }
-
- ?>
- <td>Joomla</td>
- <td><?php echo $joomla_version;?></td>
- <td><?php echo $this->VersionData->requirements[0]->joomla[0]->data();?></td>
- </tr>
- <?php
-
- $db = & JFactory::getDBO();
- $mysql_version = $db->getVersion();
-
- if (version_compare($mysql_version, $this->VersionData->requirements[0]->mysql[0]->data()) == -1){
- ?><tr class = "bad0"><?php
- $server_compatible = false;
- } else {
- ?><tr class = "good0"><?php
- }
-
- ?>
- <td>MySQL</td>
- <td><?php echo $mysql_version;?></td>
- <td><?php echo $this->VersionData->requirements[0]->mysql[0]->data();?></td>
- </tr>
-
- <?php
- if($server_compatible){
- //output the good news
- ?>
- <tr class="good1">
- <td><img src="components/com_jfusion/images/check_good.png"
- height="30px" width="30px">
-
-
- <td colspan="2">
- <h2><?php echo JText::_('SERVER_UP2DATE'); ?></h2>
- </td>
- </tr>
-
- <?php } else { //output the bad news and automatic upgrade option ?>
- <tr class="bad1">
- <td><img src="components/com_jfusion/images/check_bad.png"
- height="30px" width="30px">
-
-
- <td colspan="2">
- <h2><?php echo JText::_('SERVER_OUTDATED'); ?></h2>
- </td>
- </tr>
-
- <?php } ?>
- </table>
-
- <br />
- <table class="adminform" style="border-spacing:1px;">
- <thead>
- <tr>
- <th class="title" align="left"><?php echo JText::_('JOOMLA') . ' ' . JText::_('EXTENSIONS'); ?></th>
- <th class="title" width="120px" align="center"><?php echo JText::_('YOUR_VERSION'); ?></th>
- <th class="title" width="120px" align="center"><?php echo JText::_('CURRENT_VERSION'); ?></th>
- <th class="title" width="200px" align="center"><?php echo JText::_('OPTIONS'); ?></th>
- </tr>
- </thead>
- <tbody>
-
- <?php
- $row_count = 0;
- $joomla_extensions = $this->VersionData->joomla[0]->children();
- usort($joomla_extensions, "sortByName");
-
- foreach ($joomla_extensions as $plugin){
- getVersionNumber('joomla', $plugin, $row_count);
- }
-
-
- ?>
-
- </table>
- <br />
- <table class="adminform" style="border-spacing:1px;">
- <thead>
- <tr>
- <th class="title" align="left"><?php echo JText::_('JFUSION') . ' ' . JText::_('PLUGINS'); ?></th>
- <th class="title" width="120px" align="center"><?php echo JText::_('YOUR_VERSION'); ?></th>
- <th class="title" width="120px" align="center"><?php echo JText::_('CURRENT_VERSION'); ?></th>
- <th class="title" width="200px" align="center"><?php echo JText::_('OPTIONS'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php
-
- $row_count = 0;
- $jfusion_plugins = $this->VersionData->jfusion[0]->children();
- usort($jfusion_plugins, "sortByName");
-
- foreach ($jfusion_plugins as $plugin){
- getVersionNumber('jfusion', $plugin, $row_count);
- }
-
- ?>
-
- </table>
- <br />
- <table class="adminform" style="border-spacing:1px;">
- <thead>
- <tr>
- <th class="title" align="left"><?php echo JText::_('JFUSION') . ' ' . JText::_('LANGUAGES'); ?></th>
- <th class="title" width="120px" align="center"><?php echo JText::_('YOUR_VERSION'); ?></th>
- <th class="title" width="120px" align="center"><?php echo JText::_('CURRENT_VERSION'); ?></th>
- <th class="title" width="200px" align="center"><?php echo JText::_('OPTIONS'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php
-
- $row_count = 0;
- $jfusion_languages = $this->VersionData->language[0]->children();
- usort($jfusion_languages, "sortByName");
-
- foreach ($jfusion_languages as $plugin){
- getVersionNumber('language', $plugin, $row_count);
- }
-
-
- ?>
-
- </table>
- <br />
-
- <form method="post" action="index2.php" name="adminForm"
- enctype="multipart/form-data"><input type="hidden" name="option"
- value="com_jfusion" /> <input type="hidden" name="task"
- value="install_plugin" /> <input type="hidden" name="new_jname"
- value="" />
-
- <table class="adminform">
- <tr>
- <td width="50px"><img src="templates/khepri/images/header/icon-48-install.png"
- height="48px" width="48px"></td>
-
- <td>
- <h1><font color=0b55c4><?php echo JText::_('PLUGIN_INSTALL'); ?></font></h1>
- </td>
- </tr>
- </table>
- <?php echo JText::_('PLUGIN_INSTALL_INSTR'); ?><br /><br />
-
- <table class="adminform">
- <tr>
-
- <td>
- <table>
- <tr>
- <th colspan="2"><?php echo JText::_( 'UPLOAD_PACKAGE' ); ?></th>
- </tr>
- <tr>
- <td width="120"><label for="install_package"> <?php echo JText::_( 'PACKAGE_FILE' ); ?>
- :</label></td>
- <td><input class="input_box" id="install_package"
- name="install_package" type="file" size="57" /> <input
- class="button" type="button"
- value="<?php echo JText::_( 'UPLOAD_FILE' ); ?> & <?php echo JText::_( 'INSTALL' ); ?>"
- onclick="submitbutton()" /></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
- <table class="adminform">
- <tr>
- <td>
- <table>
- <tr>
- <th colspan="2"><?php echo JText::_( 'INSTALL_FROM_DIRECTORY' ); ?>
- </th>
- </tr>
- <tr>
- <td width="120"><label for="install_directory"> <?php echo JText::_( 'INSTALL_DIRECTORY' ); ?>
- :</label></td>
- <td><input type="text" id="install_directory"
- name="install_directory" class="input_box" size="70" value="" /> <input
- type="button" class="button"
- value="<?php echo JText::_( 'INSTALL' ); ?>"
- onclick="submitbutton3()" /></td>
- </tr>
- </table>
- </td>
-
- </tr>
- </table>
-
- <table class="adminform">
- <tr>
- <td>
- <table>
- <tr>
- <th colspan="2"><?php echo JText::_( 'INSTALL_FROM_URL' ); ?></th>
- </tr>
- <tr>
- <td width="120"><label for="install_url"> <?php echo JText::_( 'INSTALL_URL' ); ?>
- :</label></td>
- <td><input type="text" id="install_url" name="install_url"
- class="input_box" size="70" value="http://" /> <input type="button"
- class="button" value="<?php echo JText::_( 'INSTALL' ); ?>"
- onclick="submitbutton4()" /></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
- <input type="hidden" name="type" value="" /> <input type="hidden"
- name="installtype" value="upload" /></form>