• Welcome to Simple Machines Community Forum. Please login or sign up.
October 27, 2021, 08:23:52 AM

News:

SMF 2.1 RC4 has been released! Try it out and help us test! :) Read more.


Add a switch to turn off the "Latest Packages"

Started by NanoSector, April 10, 2012, 10:32:36 AM

Previous topic - Next topic

Antechinus

K dudes and dudesses, here are the code edits for a simple disable/cleanup. It could get fancier, but this does the job. :)

Let's start with 1.1.x.

1.1.x Admin.template.php:

FIND:

echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-top: 1.5ex;"><tr>';

// Display the "live news" from simplemachines.org.
echo '
<td valign="top">
<table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor">
<tr>
<td class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt[119], '" align="top" /></a> ', $txt['smf217'], '
</td>
</tr><tr>
<td class="windowbg2" valign="top" style="height: 18ex; padding: 0;">
<div id="smfAnnouncements" style="height: 18ex; overflow: auto; padding-right: 1ex;"><div style="margin: 4px; font-size: 0.85em;">', $txt['lfyi'], '</div></div>
</td>
</tr>
</table>
</td>
<td style="width: 1ex;">&nbsp;</td>';

// Show the user version information from their server.
echo '
<td valign="top" style="width: 40%;">
<table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor" id="supportVersionsTable">
<tr>
<td class="catbg"><a href="', $scripturl, '?action=admin;credits">', $txt['support_title'], '</a></td>
</tr><tr>
<td class="windowbg2" valign="top" style="height: 18ex;">
<b>', $txt['support_versions'], ':</b><br />
', $txt['support_versions_forum'], ':
<i id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</i><br />
', $txt['support_versions_current'], ':
<i id="smfVersion" style="white-space: nowrap;">??</i><br />
', $context['can_admin'] ? '<a href="' . $scripturl . '?action=detailedversion">' . $txt['dvc_more'] . '</a>' : '', '<br />';

// Have they paid to remove copyright?
if (!empty($context['copyright_expires']))
{
echo '
<br />', sprintf($txt['copyright_ends_in'], $context['copyright_expires']);

if ($context['copyright_expires'] < 30)
echo '
<div style="color: red;">', sprintf($txt['copyright_click_renew'], $context['copyright_key']), '</div>';

echo '<br />';
}

// Display all the members who can administrate the forum.
echo '
<br />
<b>', $txt[684], ':</b>
', implode(', ', $context['administrators']);
// If we have lots of admins... don't show them all.
if (!empty($context['more_admins_link']))
echo '
(', $context['more_admins_link'], ')';
echo '
</td>
</tr>
</table>
</td>
</tr></table>';



REPLACE:

echo '
<table width="100%" cellpadding="5" cellspacing="1" border="0" id="supportVersionsTable" class="bordercolor" style="margin-top: 1.5ex;">
<tr>
<td class="catbg"><a href="', $scripturl, '?action=admin;credits">', $txt['support_title'], '</a></td>
</tr><tr>
<td class="windowbg2" valign="top" style="height: 18ex;">
<b>', $txt['support_versions'], ':</b><br />
', $txt['support_versions_forum'], ':
<i id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</i><br />
', $txt['support_versions_current'], ':
<i id="smfVersion" style="white-space: nowrap;">??</i><br />
', $context['can_admin'] ? '<a href="' . $scripturl . '?action=detailedversion">' . $txt['dvc_more'] . '</a>' : '', '<br />';

// Have they paid to remove copyright?
if (!empty($context['copyright_expires']))
{
echo '
<br />', sprintf($txt['copyright_ends_in'], $context['copyright_expires']);

if ($context['copyright_expires'] < 30)
echo '
<div style="color: red;">', sprintf($txt['copyright_click_renew'], $context['copyright_key']), '</div>';

echo ' <br />';
}

// Display all the members who can administrate the forum.
echo '
<br />
<b>', $txt[684], ':</b>
', implode(', ', $context['administrators']);
// If we have lots of admins... don't show them all.
if (!empty($context['more_admins_link']))
echo '
(', $context['more_admins_link'], ')';
echo '

</td>
</tr>
</table>';



1.1.x Packages.template.php

FIND AND REMOVE:

if (empty($modSettings['disable_smf_js']))
echo '
<script language="JavaScript" type="text/javascript" src="http://www.simplemachines.org/smf/latest-packages.js?language=', $context['user']['language'], '"></script>';

echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var tempOldOnload;

function smfSetLatestPackages()
{
if (typeof(window.smfLatestPackages) != "undefined")
setInnerHTML(document.getElementById("packagesLatest"), window.smfLatestPackages);

if (tempOldOnload)
tempOldOnload();
}
// ]]></script>';

// Gotta love IE4, and its hatefulness...
if ($context['browser']['is_ie4'])
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
tempOldOnload = window.onload;
window.onload = smfSetLatestPackages;
// ]]></script>';
else
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
smfSetLatestPackages();
// ]]></script>';



1.1.x default/Packages.english.php

FIND:

$txt['packages_latest_fetch'] = 'Attempting to fetch the most popular and recent packages from www.simplemachines.org...';



REPLACE:

$txt['packages_latest_fetch'] = 'Popular and recent packages from Simple Machines Forum are available <a href="http://custom.simplemachines.org/mods/">on this link</a>.';

====================

End 1.1.x stuff. Now for the 2.0.x stuff.

====================

2.0.x Admin.template.php:

FIND:

// Display the "live news" from simplemachines.org.
echo '
<div id="live_news" class="floatleft">
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a> ', $txt['live'], '</span>
</h3>
</div>
<div class="windowbg nopadding">
<span class="topslice"><span></span></span>
<div class="content">
<div id="smfAnnouncements">', $txt['lfyi'], '</div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>';

// Show the user version information from their server.
echo '
<div id="supportVersionsTable" class="floatright">



REPLACE:

// Show the user version information from their server.
echo '
<div id="supportVersionsTable">



2.0.x css/admin.css:

FIND AND REMOVE:

#supportVersionsTable
{
width: 34%;
}



2.0.x Packages.template.php

FIND AND REMOVE:

if (empty($modSettings['disable_smf_js']))
echo '
<script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-packages.js"></script>';

echo '
<script type="text/javascript"><!-- // --><![CDATA[
var tempOldOnload;

function smfSetLatestPackages()
{
if (typeof(window.smfLatestPackages) != "undefined")
setInnerHTML(document.getElementById("packagesLatest"), window.smfLatestPackages);

if (tempOldOnload)
tempOldOnload();
}
// ]]></script>';

echo '
<script type="text/javascript"><!-- // --><![CDATA[
smfSetLatestPackages();
// ]]></script>';



2.0.x default/Packages.english.php

FIND:

$txt['packages_latest_fetch'] = 'Attempting to fetch the most popular and recent packages from www.simplemachines.org...';


REPLACE:

$txt['packages_latest_fetch'] = 'Popular and recent packages from Simple Machines Forum are available <a href="http://custom.simplemachines.org/mods/">on this link</a>.';


That's all, folks. :)

Adish - (F.L.A.M.E.R)

Ant, you might want to submit this as a mod? It may be nicer that way. :)

Matthew K.

He just wrote the code, he wanted someone else to package and submit it.

Antechinus

Actually I should do the themes one too. Forgot about that the other day. I'll look at it tonight.

kat

1.1.x default/Packages.english.php

Should, of course, be:

1.1.x default/languages/Packages.english.php

Works like a charm with v1.1.6, Ant!



Gonna go for the v2, now.

kat



kat

My point being that, if I can do the edits, almost anyone can! :)

Antechinus

ROFL. Well anyone can if they take care to do them exactly as quoted. I've been a bit busy, but will get on to the themes page over the weekend.

Antechinus

1.1.x Themes.template.php:

Find:
</form>';

// And lastly, link to simplemachines.org for latest themes and info!
echo '
<table width="80%" cellpadding="4" cellspacing="0" border="0" align="center" class="tborder" style="margin-bottom: 2ex; margin-top: 2ex;">
<tr class="titlebg">
<td><a href="', $scripturl, '?action=helpadmin;help=latest_themes" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt[119], '" align="top" /></a> ', $txt['theme_latest'], '</td>
</tr>
<tr>
<td class="windowbg2" id="themeLatest">', $txt['theme_latest_fetch'], '</td>
</tr>
</table>';



Replace:
</form><br />';


Find:
echo '
<tr class="windowbg2">
<td align="right"><input type="submit" name="submit" value="', $txt['theme_install_go'], '" /></td>



Replace:
echo '
<tr class="windowbg2">
<td align="right"><input type="submit" name="submit" value="', $txt['theme_install_go'], '" />
<hr /><span style="float: left;">', $txt['theme_latest_fetch'], '</span></td>



Find and remove:
if (empty($modSettings['disable_smf_js']))
echo '
<script language="JavaScript" type="text/javascript" src="http://www.simplemachines.org/smf/latest-themes.js?language=', $context['user']['language'], '"></script>';
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var tempOldOnload;

function smfSetLatestThemes()
{
if (typeof(window.smfLatestThemes) != "undefined")
setInnerHTML(document.getElementById("themeLatest"), window.smfLatestThemes);

if (tempOldOnload)
tempOldOnload();
}
// ]]></script>';

// Gotta love IE4, and its hatefulness...
if ($context['browser']['is_ie4'])
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
tempOldOnload = window.onload;
window.onload = smfSetLatestThemes;
// ]]></script>';
else
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
smfSetLatestThemes();
// ]]></script>';



languages/Themes.english.php:

Find:
$txt['theme_latest_fetch'] = 'Fetching latest themes from www.simplemachines.org...';


Replace:
$txt['theme_latest_fetch'] = 'More themes from Simple Machines Forum are available <a href="http://custom.simplemachines.org/themes/">on this link</a>.';

Matthew K.

I wish I had about 3 days per one day then I could do a lot more. I have wayy too much on my schedule :( I'd love to do it though if I could.

Antechinus

2.0.x Themes.template.php:

Find:
</form>';

// Link to simplemachines.org for latest themes and info!
echo '
<br />
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=latest_themes" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a> ', $txt['theme_latest'], '</span>
</h3>
</div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="content">
<div id="themeLatest">
', $txt['theme_latest_fetch'], '
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<br />';


Replace:
</form><br />';

Find:
<div class="righttext">
<input type="submit" name="submit" value="', $txt['theme_install_go'], '" class="button_submit" />
</div>


Replace:
<div class="righttext">
<input type="submit" name="submit" value="', $txt['theme_install_go'], '" class="button_submit" />
</div>
<hr />', $txt['theme_latest_fetch'], '


Find and remove:
if (empty($modSettings['disable_smf_js']))
echo '
<script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-themes.js"></script>';

echo '
<script type="text/javascript"><!-- // --><![CDATA[
var tempOldOnload;

function smfSetLatestThemes()
{
if (typeof(window.smfLatestThemes) != "undefined")
setInnerHTML(document.getElementById("themeLatest"), window.smfLatestThemes);

if (tempOldOnload)
tempOldOnload();
}
// ]]></script>';

// Gotta love IE4, and its hatefulness...
if ($context['browser']['is_ie4'])
echo '
<script type="text/javascript"><!-- // --><![CDATA[
addLoadEvent(smfSetLatestThemes);
// ]]></script>';
else
echo '
<script type="text/javascript"><!-- // --><![CDATA[
smfSetLatestThemes();
// ]]></script>';


languages/Themes.english.php:

Find:
$txt['theme_latest_fetch'] = 'Fetching latest themes from www.simplemachines.org...';

Replace:
$txt['theme_latest_fetch'] = 'More themes from Simple Machines Forum are available <a href="http://custom.simplemachines.org/themes/">on this link</a>.';




It really is much cleaner like this. I'd be inclined to make it default, or at least include it in custom themes.

Arantor

I've removed the latest packages list thus far - but it's tricky because that also handles displaying a warning to users about an out of date version which needed some reworking, but that's done.

I'll tackle the others in due course.
No good deed goes unpunished
All helpful urges should be circumvented

Oldiesmann

Since we're still including latest-news.js there we can probably transfer the stuff from latest-packages to latest-news instead. I'll take a look at it soon and see what I can come up with.
Michael Eshom
Cincy Space - now open!

Arantor

I'd prefer not to do that. I'd prefer to leave it as is and not include the list of packages.

I just looked on one of my forums.

QuoteNew Packages:
(package)
Final Fantasy IX Avatars 1
Prevent Topic View Increase by Author 1.0
Word Censor List 1.0

Package of the Moment:
Word Count Limits 1.3b

The 'package of the moment' is a 4 year old mod for 2.0 RC1.2, the other three would fail the version check for that particular forum, as that particular forum is a 2.0 RC5 forum with a lot of modifications (it's been patched for all the security issues but I didn't go through and fix all the version numbers or anything, so it would definitely fail)

It's not even bothering to verify the version number being supplied, which makes it less and less useful as time goes on.
No good deed goes unpunished
All helpful urges should be circumvented

Oldiesmann

I meant the stuff relating to warning about upgrades, not the stuff related to displaying the latest packages.
Michael Eshom
Cincy Space - now open!

Arantor

That's the entire reason I included latest-news there so it could actually display if there was an upgrade... (I even tested to check it worked properly)
No good deed goes unpunished
All helpful urges should be circumvented

Advertisement: