CrazyCoder
Member
arffffff morning guys )))))
nooooooooooooooooooo not HIM !!!!!!! not again !!!!!!! you must think, ouuuuchhhhhh )))
well, heuuuuuu may i continue to post ? oops, i hope i do not reach your patiente and kindness limits
so, i redone another time my skinchanger, why ? lol, because dealing with the admin skin,
is not so easy, along to the others 'standards' skins.
so heres the way i did it :
1) i added a new hook to index.php , just here after this require :
2) i better wroten my plugin, at least i think so :: so here the set_skin.php :
conclusion : still a big bug, grrr grrrrrr
To Browse the site, throught skins its OK.
IF i go to admin, its ok $TMPL['skin_name'] is well seted to "admin",
BUT once logged into admin, pafffffffffff the admin skin is lost, booooooo, and the skin select option frozens.
should i give up ?
nooooooooooooooooooo not HIM !!!!!!! not again !!!!!!! you must think, ouuuuchhhhhh )))
well, heuuuuuu may i continue to post ? oops, i hope i do not reach your patiente and kindness limits
so, i redone another time my skinchanger, why ? lol, because dealing with the admin skin,
is not so easy, along to the others 'standards' skins.
so heres the way i did it :
1) i added a new hook to index.php , just here after this require :
PHP:
require_once("{$CONF['path']}/sources/misc/skin.php");
//Hook Location 4 SetSkin
eval (PluginManager::getPluginManager ()->pluginHooks ('set_skin'));
PHP:
//######## NEW CODE Plugin SET_SKIN ########//
/* to find the right vars to use : print_r($_SERVER); */
$guest_skin = $_POST['stylesheet'];
$test_qstring = substr($_SERVER['QUERY_STRING'],0,7);
$test_ruri = substr($_SERVER['REQUEST_URI'],0,18);
/* for debug
echo '<h3>';
echo $test_qstring;
echo "<br /><br />";
echo $test_ruri;
echo "<br /><br />";
echo '</h3>';
*/
if($test_ruri!='/pureones/admin/' && $test_qstring!='a=admin') {
// form var is there - set up cookie and refresh
if(isset($guest_skin)) {
setcookie("guest_skin", $guest_skin, time()+360000);
$TMPL['skin_name'] = $_COOKIE["guest_skin"];
unset($guest_skin);
header("Location: {$CONF['path']}");
}
// form var is not there
else {
// cookie is there
if($_COOKIE['guest_skin'])
$TMPL['skin_name'] = $_COOKIE['guest_skin'];
// cookie is not there
else
$TMPL['skin_name'] = $CONF['default_skin'];
}
}//
else {
if($test_ruri == '/pureones/admin/') {
setcookie("admin_skin", 'admin', time()+360000);
$TMPL['skin_name'] = "admin";
//setcookie("guest_skin", 'admin', time()+360000);
}
elseif($test_qstring == 'a=admin') {
setcookie("admin_skin", 'admin', time()+360000);
$TMPL['skin_name'] = "admin";
}
else { }
}
// THE FORM
$TMPL['visitor_skin_list'] = "
<div style=\"display: block;list-style: none;text-align: center;width: 250px;height: auto;\">
<ul>
<li><b>{$LNG['setskin_header_text']}</b><br />
<form method=\"post\" action=\"index.php\">
<select class=\"blackonwhite\" name=\"stylesheet\" size=\"1\"
onchange=\"this.form.submit();\">";
//define the path
$path = "skins";
$dir_handle = @opendir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle)) {
if($file!="." && $file!=".." && $file!="admin") {
if($file == $TMPL['skin_name']) {
$TMPL['visitor_skin_list'] .= "<option value=\"$file\" selected=\"selected\">$file</option>";
}
else {
$TMPL['visitor_skin_list'] .= "<option value=\"$file\">$file</option>";
}
}
}
//closing the directory
closedir($dir_handle);
$TMPL['visitor_skin_list'] .= "</select>
<input type=\"hidden\">
</form>
</li>
</ul>
</div>";
$TMPL['mycustom_field'] .= $TMPL['visitor_skin_list'];
$TMPL['show_mycustom_field'] .= base::do_plugin_skin('./plugins/SetSkin','setskin_selector_html');
conclusion : still a big bug, grrr grrrrrr
To Browse the site, throught skins its OK.
IF i go to admin, its ok $TMPL['skin_name'] is well seted to "admin",
BUT once logged into admin, pafffffffffff the admin skin is lost, booooooo, and the skin select option frozens.
should i give up ?