Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/NS-Your_Account/user/modules/changetheme.php
<?php // $Id: changetheme.php,v 1.4 2001/12/04 13:07:49 jgm Exp $

global $dbconn;

modules_get_language();

function chgtheme()
{
    global $user, $userinfo, $Default_Theme;
    include ("header.php");
    getusrinfo($user);
    OpenTable();
    echo "<center><font class=\"pn-title\">"._THEMESELECTION."</center></font>";
    CloseTable();
    echo "<br>";
    echo "<br>";
    OpenTable();
    echo "<center>"
        ."<form action=\"user.php\" method=\"post\">"
        ."<font class=\"pn-title\">"._SELECTTHEME."</font><br>"
        ."<select name=\"theme\">";
    $handle=opendir('themes');
    while ($file = readdir($handle)) {
        if ((!ereg("[.]",$file)) ) {
            if($file != "CVS") {
           $themelist .= "$file ";
            }
        }
    }
    closedir($handle);
// modif sebastien multi sites
    $cWhereIsPerso = WHERE_IS_PERSO;
    if ( !(empty($cWhereIsPerso)) )
        { 
        include("modules/NS-Multisites/chgtheme.inc.php"); 
        }
// fin modif sebastien multi sites
    $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>"
        ."<font class=\"pn-normal\">"._THEMETEXT1."<br>"
        .""._THEMETEXT2."<br>"
        .""._THEMETEXT3."<br><br></font>"

/* SF BUG [ #468490 ] Bad HTML When Changing Theme */
//        ."<input type=\"hidden\" name=\"storynum\" value=\"$userinfo[storynum]\">"
//        ."<input type=\"hidden\" name=\"ublockon\" value=\"$userinfo[ublockon]\">"
//        ."<input type=\"hidden\" name=\"ublock\" value=\"$userinfo[ublock]\">"
/* End Bug Fix */

        ."<input type=\"hidden\" name=\"uname\" value=\"$userinfo[uname]\">"
        ."<input type=\"hidden\" name=\"uid\" value=\"$userinfo[uid]\">"
        ."<input type=\"hidden\" name=\"op\" value=\"savetheme\">"
        ."<input type=\"submit\" value=\""._SAVECHANGES."\">"
        ."</form>";
    CloseTable();
    include ("footer.php");
}

function savetheme($uid, $theme)
{
    global $user, $cookie, $userinfo, $pntable, $dbconn;

    csrfcheck();

    cookiedecode($user);
    $check = $cookie[1];
    $check2 = $cookie[2];
    $column = &$pntable['users_column'];
    $result = $dbconn->Execute("SELECT $column[uid], $column[pass] FROM $pntable[users] WHERE $column[uname]='$check'");
    list($vuid, $ccpass) = $result->fields;
    if (($uid == $vuid) AND ($check2 == $ccpass)) {
        $dbconn->Execute("UPDATE $pntable[users] SET $column[theme]='$theme' WHERE $column[uid]=$uid");
        getusrinfo($user);
        docookie($userinfo[uid],$userinfo[uname],$userinfo[pass],$userinfo[storynum],$userinfo[umode],$userinfo[uorder],$userinfo[thold],$userinfo[noscore],$userinfo[ublockon],$userinfo[theme],$userinfo[commentmax]);
        pnRedirect('user.php?theme='.$theme);
    }
}


switch ($op) {
        case "chgtheme":
                chgtheme();
                break;
        case "savetheme":
        savetheme($uid, $theme);
                break;

}



?>
Return current item: ProNuke. Postnuke To Oracle