Is it the same HTML as the dropdown I made on the admin area? If yes we might wanna consider putting it into a sub function...
<?php
if (!defined('WEDGE'))
die('Hacking attempt...');
function themeSelector()
{
global $txt, $user_info, $language, $modSettings, $context, $scripturl;
// Will need this whatever.
loadSource('Themes');
$temp = cache_get_data('arantor_theme_listing', 180);
if ($temp === null)
{
// Get all the themes...
$request = wesql::query('
SELECT id_theme AS id, value AS name
FROM {db_prefix}themes
WHERE variable = {string:name}',
array(
'name' => 'name',
)
);
$temp = array();
while ($row = wesql::fetch_assoc($request))
$temp[$row['id']] = $row;
wesql::free_result($request);
// Get theme dir for all themes
$request = wesql::query('
SELECT id_theme AS id, value AS dir
FROM {db_prefix}themes
WHERE variable = {string:dir}',
array(
'dir' => 'theme_dir',
)
);
while ($row = wesql::fetch_assoc($request))
$temp[$row['id']]['skins'] = wedge_get_skin_list($row['dir'] . '/skins');
wesql::free_result($request);
cache_put_data('arantor_theme_listing', $temp, 180);
}
// So, now we have a list of all the themes.
$context['themes'] = $temp;
loadBlock('header_theme_selector', 'header', 'add');
}
function template_header_theme_selector()
{
global $context, $settings, $txt;
echo '
Select a skin: <select name="boardtheme" id="boardtheme" onchange="changeTheme(this);" style="font-family: \'dejavu sans mono\',\'monaco\',\'lucida console\',\'courier new\',monospace">';
foreach ($context['themes'] as $theme)
{
echo '<option value="', $theme['id'], '"', $settings['theme_id'] == $theme['id'] && (empty($context['skin']) || $context['skin'] == 'skins') ? ' selected' : '', '>', $theme['name'], '</option>';
if (!empty($theme['skins']))
wedge_show_skins($theme, $theme['skins'], 1, $settings['theme_id'], $context['skin']);
}
echo '
</select>';
add_js('
function changeTheme (obj)
{
var sUrl = new String(window.location);
sUrl = sUrl.replace(/theme=([0-9]+\_[A-Z0-9\+\/\=]+);?/i, "");
var sAnchor = "";
var search = sUrl.search("#");
if(search != -1)
{
sAnchor = sUrl.substr(search);
sUrl = sUrl.substr(0, search);
}
var len = sUrl.length;
var lastchr = sUrl.charAt(len-1);
while ((lastchr == "?" || lastchr == ";") && len > 1)
{
len--;
lastchr = sUrl.charAt(len-1);
}
sUrl = sUrl.substr(0, len);
len = sUrl.length;
var themelink = "theme=" + obj.value + sAnchor;
var indexsearch = sUrl.search("/index.php");
if (indexsearch < len && indexsearch != -1)
window.location = sUrl + ((indexsearch == (len - 10)) ? "?" : ";") + themelink;
else
window.location = sUrl + ((sUrl.charAt(len-1) != "/") ? "/" : "") + "index.php?" + themelink;
return false;
}');
}
?>| 1. | If you're wondering what I'm talking about, look at Admin > Configuration > Security and Moderation > Anti-Spam in 2.0 final or 2.0.1 and compare the difference. If you're still not clear what I'm getting at, post your questions/concerns here and I'll answer them. ;) |
Now, if only we had an awards plugin... maybe that should be my next target, heheh...
Did you peek into my plugin repo? :P lolQuote from Arantor on October 9th, 2011, 11:31 PM Now, if only we had an awards plugin... maybe that should be my next target, heheh...
| 1. | I'm a programmer, what of it? Of course, this wasn't because I forgot to do it originally but wanted to have this one first... ;) |
| 2. | And in one case I'm still not clear whether it's a bug or not, but whatever, it's good for testing these crazy things out. |
One or more features required by this plugin are not available. (verify_user, register)
<hooks>
<function point="verify_user" function="integrate_verify_user" filename="$plugindir/authenticate" />
<function point="reset_pass" function="integrate_reset_password" filename="$plugindir/authenticate" />
<function point="verify_password" function="integrate_verify_password" filename="$plugindir/authenticate" />
<function point="register" function="integrate_register" filename="$plugindir/authenticate" />
<function point="validate_login" function="integrate_validate_login" filename="$plugindir/authenticate" />
</hooks>just add those two to the list and it'll allow you to use them.
The rights granted by the initial author include: 1. to use, reproduce, modify, display, perform, sublicense, and distribute the source, and modified version of the source. 2. patent rights to use and make available the original code 3. to distribute works which contain the code in combination with new code, and to license the new code in any way the distributor wishes
The rights granted by subsequent users include: 1. to use, reproduce, modify, display, perform, sublicense and distribute the source of their modifications 2. patent rights to use and make available both the modifications and the entire work 3. to distribute works which contain the code in combination with new code, and to license the new code in any way the distributor wishes
The way in which the Mozilla Public License is drafted basically requires subsequent users to license the original code under MPL and all additional code under any kind of license. Therefore, a company can create a proprietary product from code licensed under MPL by licensing the added components in a closed source manner. The stipulation that core files stay under the MPL provides incentive for developers to improve and develop aspects of the core functionality. The MPL is GPL-incompatible because the GPL module cannot be legally linked with an MPL module.
| 1. | By which I mean any other licence, technically. Even GPL comes into that category. |
| 1. | Yes, I know I could use the equivalent of Modification Settings, but I far rather don't pollute things that aren't mine, so to speak, and it's not like it's actually that much work to integrate anyway. |
Wedge will have asynchronous friend lists like here.
When I get to it.