コード例 #1
0
ファイル: license.php プロジェクト: kidaa30/lojinha
    function update_list()
    {
        $app = JFactory::getApplication();
        $ext_name = 'djclassifieds';
        $ext_name2 = 'djcf';
        $db = JFactory::getDBO();
        $query = "SELECT name, type, element, manifest_cache " . "FROM #__extensions WHERE (element LIKE '%" . $ext_name . "%' AND folder!='djmediatools' AND folder!='djreviews') OR element LIKE '%" . $ext_name2 . "%' OR folder='djclassifieds' " . "ORDER BY type ";
        $db->setQuery($query);
        $ext_list = $db->loadObjectList();
        JHTML::_('behavior.framework');
        $config = JFactory::getConfig();
        $secret_file = JFile::makeSafe('license_' . $config->get('secret') . '.txt');
        $license_file = JPATH_BASE . DS . "components" . DS . $app->input->get('option') . DS . $secret_file;
        $fh = fopen($license_file, 'r');
        $license = fgets($fh);
        fclose($fh);
        $ext_versions = explode(';', DJLicense::checktVersions());
        jimport('joomla.utilities.utility');
        $js = "\r\n\t\tfunction make_update3(ext,license,version){\r\n\r\n\r\n\t\t\t\$('update_link_'+ext+'').set('html','" . JText::_('COM_DJCLASSIFIEDS_DJLIC_PLEASE_WAIT') . " <img src=\"" . JURI::base() . "components/" . $app->input->get('option', null, 'cmd') . "/images/loading.gif\" />');\r\n\r\n\t\t\t// The elements used.\r\n\t\t\tvar myForm = document.id('frm_'+ext+'');\r\n\t\t\tvar myElement = document.id('myResult2');\r\n\r\n\t\t\tvar req_url='http://dj-extensions.com/index.php?option=com_djsubscriptions&view=getUpdate&license='+license+'&ext='+ext+'&v='+version;\r\n\t\t\tvar myRequest = new Request({\r\n\t\t\t\turl: 'index.php',\r\n\t\t\t\tmethod: 'post',\r\n\t\t\t\tdata: {\r\n\t\t\t\t\t'option': 'com_installer',\r\n\t\t\t\t\t'view': 'install',\r\n\t\t\t\t\t'task': 'install.install',\r\n\t\t\t\t\t'installtype': 'url',\r\n\t\t\t\t\t'" . JSession::getFormToken() . "': 1,\r\n\t\t\t\t\t'install_url': req_url\r\n\t\t\t\t},\r\n\t\t\t\tonRequest: function(){\r\n\t\t\t\t\tmyElement.set('html', '<div style=\"text-align:center;\"><img style=\"margin-top:10px;\" src=\"" . JURI::base() . "components/" . $app->input->get('option', null, 'cmd') . "/images/long_loader.gif\" /><br />" . JText::_('COM_DJCLASSIFIEDS_DJLIC_LOADING') . "</div>');\r\n\t\t\t\t},\r\n\t\t\t\tonSuccess: function(responseText){\r\n\t\t\t\t\tmyElement.set('html', '');\r\n\t\t\t\r\n\t\t\t\t\tif (/\\bMSIE\\b/.test(navigator.appVersion)) { window.location.reload(); }\r\n\t\t\t\r\n\t\t\t\t\tvar response = new Element('div');\r\n\t\t\t\t\tresponse.set('html',responseText);\r\n\t\t\t\t\tvar res = response.getElement('#system-message, .alert').getParent();\r\n\t\t\t\t\tif(res.getElement('.error, .alert-error')){\r\n\t\t\t\t\t\t\$('update_link_'+ext+'').set('html','" . JText::_('COM_DJCLASSIFIEDS_DJLIC_FAILED') . "');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\$('update_link_'+ext+'').set('html','" . JText::_('COM_DJCLASSIFIEDS_DJLIC_DONE') . " <img src=\"" . JURI::base() . "templates/hathor/images/admin/tick.png\" />');\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tmyElement.set('html', res.get('html'));\r\n\t\t\t\t},\r\n\t\t\t\tonFailure: function(){\r\n\t\t\t\t\tmyElement.set('html', 'Sorry, your request failed, please contact to contact@design-joomla.eu');\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tmyRequest.send();\r\n\t\t}\r\n\t\t";
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        ?>
		
		<div class="lic_extensions_box">	
			<div id="toolbar-box">
				<div class="pagetitle icon-32-export"
					style="height: 30px; padding-left: 50px; width: auto;">
					<h3 style="margin: 5px 0px;"><?php 
        echo JText::_('COM_DJCLASSIFIEDS_DJLIC_EXT_LIST');
        ?>
</h3>
				</div>
			</div>
			<table class="adminlist table table-striped">
				<thead>
					<tr>
						<th><?php 
        echo JText::_('COM_DJCLASSIFIEDS_DJLIC_NAME');
        ?>
</th>
						<th><?php 
        echo JText::_('COM_DJCLASSIFIEDS_DJLIC_TYPE');
        ?>
</th>
						<th><?php 
        echo JText::_('COM_DJCLASSIFIEDS_DJLIC_ELEMENT');
        ?>
</th>
						<th><?php 
        echo JText::_('COM_DJCLASSIFIEDS_DJLIC_CURRENT_VERSION');
        ?>
</th>
						<th><?php 
        echo JText::_('COM_DJCLASSIFIEDS_DJLIC_LATEST_VERSION');
        ?>
</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
				<?php 
        $style = '';
        $version = new JVersion();
        if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
            $style = ' style="cursor:pointer; background: none repeat scroll 0 0 #F0F0F0;border: 1px solid silver;color: #000000;font-size: 10px;padding: 1px 5px;" ';
        }
        foreach ($ext_versions as $r) {
            $e = explode(',', $r);
            $exist = '';
            foreach ($ext_list as $ext) {
                //if($ext->element==$e[0]){
                if (strtolower($ext->element) == strtolower($e[0]) || $ext->type == 'plugin' && strtolower($ext->name) == strtolower($e[0])) {
                    $l_version = $e[1];
                    echo '<tr><td>' . JText::_($ext->name) . '</td>';
                    echo '<td>' . $ext->type . '</td>';
                    echo '<td>' . $ext->element . '</td>';
                    $mc = json_decode($ext->manifest_cache);
                    $c_version = $mc->version;
                    echo '<td>' . $c_version . '</td>';
                    echo '<td>' . $l_version . '</td>';
                    echo '<td width="100px">';
                    if ($e[2]) {
                        if (version_compare($c_version, $l_version, '<')) {
                            echo '<div id="update_link_' . $e[0] . '" style="width:100px;"><span class="btn btn-mini btn-danger" ' . $style . ' onclick="make_update3(\'' . $e[0] . '\',\'' . $license . '\',\'' . $c_version . '\');">' . JText::_('COM_DJCLASSIFIEDS_DJLIC_UPDATE') . '</span></div>';
                        } else {
                            echo '<span>' . JText::_('COM_DJCLASSIFIEDS_DJLIC_LATEST') . ' <img src="' . JURI::base() . 'templates/hathor/images/admin/tick.png" style="vertical-align: middle;" /></span>';
                        }
                    } else {
                        if ($e[3]) {
                            echo $e[3] . JText::_('COM_DJCLASSIFIEDS_DJLIC_RENEW') . '</a>';
                        } else {
                            echo '<a href="http://www.dj-extensions.com" target="_blank">' . JText::_('COM_DJCLASSIFIEDS_DJLIC_RENEW') . '</a>';
                        }
                    }
                    echo '</td>';
                    echo '</tr>';
                    $exist = 1;
                    break;
                }
            }
            if (!$exist) {
                echo '<tr><td>' . $e[0] . '</td>';
                echo '<td>';
                if (strstr($e[0], 'com_')) {
                    echo 'component';
                } else {
                    if (strstr($e[0], 'mod_')) {
                        echo 'module';
                    } else {
                        if (strstr($e[0], 'plg_')) {
                            echo 'plugin';
                        }
                    }
                }
                echo '</td>';
                echo '<td>' . $e[0] . '</td><td>---</td><td>' . $e[1] . '</td><td>';
                if ($e[2]) {
                    echo '<div id="update_link_' . $e[0] . '" style="width:100px;"><span class="btn btn-mini btn-success" ' . $style . ' onclick="make_update3(\'' . $e[0] . '\',\'' . $license . '\',\'0\');">' . JText::_('COM_DJCLASSIFIEDS_DJLIC_INSTALL') . '</span></div>';
                } else {
                    if ($e[4]) {
                        echo $e[4] . JText::_('COM_DJCLASSIFIEDS_DJLIC_BUY') . '</a>';
                    } else {
                        echo '<a href="http://www.dj-extensions.com" target="_blank">' . JText::_('COM_DJCLASSIFIEDS_DJLIC_BUY') . '</a>';
                    }
                }
                echo '</td></tr>';
            }
        }
        ?>
				</tbody>
			</table>
			
			<div id="myResult2"></div>
		</div>
	<?php 
    }
コード例 #2
0
ファイル: default.php プロジェクト: kidaa30/lojinha
?>
components/com_djclassifieds/assets/images/icon-48-cpanel.png" />
											<span><?php 
echo JText::_('JOPTIONS');
?>
</span>
										</a>
									</div>
								</div>
							</div>					
						</div>	
						<div class="cpanel-right">
							<div class="cpanel">
								<div style="float:right;">
									<?php 
echo DJLicense::getSubscription();
?>
								</div>
								<div style="clear: both;" ></div>
							</div>
						</div>
					</div>
				</td>
			</tr>
		</table>
</div>
<input type="hidden" name="option" value="com_djclassifieds" />
<input type="hidden" name="c" value="cpanel" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="view" value="cpanel" />
<input type="hidden" name="boxchecked" value="0" />