<?php
/**
 * $Source: /home/cvs/nukescripts/modules/Your_Account/public/chngtheme.php,v $
 * $Revision: 3.3.1-1 $
 * $Author: cyril $
 * $Date: 2006/08/01 12:47:36 $
 * Fix 'changement de theme' ( Bug 108 ) frenatus & piermin
 */
/********************************************************/
/* NSN Your Account                                     */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.fr                            */
/* Original Script www.nukescripst.net                  */
/* Copyright © 2000-2005 by NukeScripts Network         */
/* ==================================================== */
/* Based from:                                          */
/* PHP-NUKE: Web Portal System                          */
/********************************************************/
defined('IN_YA') OR die ('Access denied chngtheme MAXIMUS directly...');
defined('MAXIMUS') OR header("Location: index.php");

if ($ya_config['allowusertheme']==1) {
    getusrinfo($user);
    if (($userinfo['username'] == $cookie[1]) AND ($userinfo['user_password'] == $cookie[2])) {
        incoh();
        title(_THEMESELECTION);
        Max_OpenTable();
        nav();
        Max_CloseTable();
        br('1');
        Max_OpenTable();
        echo "<center>";
        echo "<form action=\"modules.php?name=$module_name\" method=\"post\">";
        echo "<b>"._SELECTTHEME."</b><br />";
        echo "<select name='theme'>";
        $handle=opendir('themes');
        while ($file = readdir($handle)) {
            if ( (!ereg("[.]",$file) AND file_exists("themes/$file/theme.php")) ) { $themelist .= "$file "; }
        }
        closedir($handle);
        $themelist = explode(" ", $themelist);
        sort($themelist);
        for ($i=0; $i < sizeof($themelist); $i++) {
            if($themelist[$i]!="") {
                echo "<option value=\"$themelist[$i]\" ";
                if((($userinfo['theme']=="") && ($themelist[$i]=="$Default_Theme")) || ($userinfo['theme']==$themelist[$i])) echo "selected";
                echo ">$themelist[$i]\n";
            }
        }
        if($userinfo['theme']=="") $userinfo['theme'] = "$Default_Theme";
        echo "</select><br />";
        echo ""._THEMETEXT1."<br />";
        echo ""._THEMETEXT2."<br />";
        echo ""._THEMETEXT3."<br /><br />";
        echo "<input type=\"hidden\" name=\"user_id\" value=\"$userinfo[user_id]\" />";
        echo "<input type=\"hidden\" name=\"op\" value=\"savetheme\" />";
        echo "<input type=\"submit\" value=\""._SAVECHANGES."\" onclick=\"this.form.submit();this.disabled=true;this.value='"._WAITING."'\" />";
        echo "</form>";
        Max_CloseTable();
        incof();
    } else {
        mmain($user);
    }
} else {
	disabled();
}