Example #1
0
if (isset($_SERVER["QUERY_STRING"])) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"])) {
    header("Location: index.php" . (isset($queries) ? "?{$queries}" : ""));
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
$user = new User($_SESSION["user"]);
/* Setting language session if the user is logged in or if the
 * language is passed. */
$language_array = array("en", "vi");
$_SESSION["language"] = $user->language;
if (isset($_GET["language"]) and in_array($_GET["language"], $language_array)) {
    $_SESSION["language"] = $_GET["language"];
    $user->set_language($_GET["language"]);
}
// setting default user options if they're not set
mysql_add_column("users_prefs", $user->username, "VARCHAR( 32 ) NOT NULL");
if (mysql_num_rows(mysql_query("SELECT * FROM `users_prefs` WHERE `option` = 'comments_sort' AND `{$user->username}` = ''")) > 0) {
    mysql_query("UPDATE `users_prefs` SET `{$user->username}` = 'ASC' WHERE `option` = 'comments_sort'");
}
mysql_add_column("quick_discussions_read_status", $user->username, "DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'");
$global_errors = array();
// this array holds any arrays that should be outputted to the current user
$max_width = isMobile() ? "98%" : "90%";
// the maximum width of the content (in px)
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<?php 
echo $_SESSION["language"];
Example #2
0
            $user->set_last_seen("change_user_info:phone_cell");
        }
        die("done");
    case "edit_address":
        $user->set_address($_POST["address"]);
        if (!isset($_REQUEST["inactive_user"])) {
            $user->set_last_seen("change_user_info:address");
        }
        die("done");
    case "edit_color":
        $user->set_color($_POST["color"]);
        if (!isset($_REQUEST["inactive_user"])) {
            $user->set_last_seen("change_user_info:color");
        }
        die("done");
    case "change_language":
        $user->set_language($_REQUEST["language"]);
        if (!isset($_REQUEST["inactive_user"])) {
            $user->set_last_seen("change_user_info:language");
        }
        die("done");
    case "change_comment_sort":
        $i = mysql_fetch_object(mysql_query("SELECT * FROM `users_prefs` WHERE `option` = 'comments_sort'"));
        if ($i->{$user->username} != $_REQUEST["sort"]) {
            mysql_query("UPDATE `users_prefs` SET `{$user->username}` = '{$_REQUEST["sort"]}' WHERE `option` = 'comments_sort'");
        }
        if (!isset($_REQUEST["inactive_user"])) {
            $user->set_last_seen("change_user_info:comment_sort");
        }
        die("done");
}