예제 #1
0
$ui_options['javascripts'][] = 'profile.js';
$ui_options['javascripts'][] = 'flags-customize.js';
ui_top($ui_options);
if (login_checklogin()) {
    if (is_privilegied('edit_presentation') && isset($_GET['admin_change']) && is_numeric($_GET['admin_change'])) {
        $user_id = $_GET['admin_change'];
    } else {
        $user_id = $_SESSION['login']['id'];
    }
    if ($_POST['action'] == 'profile_theme') {
        $query = 'UPDATE userinfo SET profile_theme = "' . $_POST['theme'] . '" WHERE userid = "' . $_SESSION['login']['id'] . '" LIMIT 1';
        mysql_query($query) or report_sql_error($query);
        $_SESSION['userinfo']['profile_theme'] = $_POST['theme'];
    }
    if (isset($_POST['presentation_text'])) {
        $output .= profile_presentation_save(array('user_id' => $user_id, 'presentation_text' => $_POST['presentation_text']));
    }
    $rounded_corners_tabs_options = array();
    if ($_GET['action'] == "theme_select") {
        $rounded_corners_tabs_options['tabs'][] = array('href' => $paths_prefix . '/installningar/profilesettings.php', 'label' => 'Ändra presentationen');
        $rounded_corners_tabs_options['tabs'][] = array('href' => $paths_prefix . '?action=theme_select', 'label' => 'Byt tema', 'current' => TRUE);
        $rounded_corners_tabs_options['tabs'][] = array('href' => $paths_prefix . '?action=flags_select', 'label' => 'Välj flaggor');
        $rounded_corners_tabs_options['tabs'][] = array('href' => $paths_prefix . '/traffa/profile.php', 'label' => 'Till min presentation');
        $output .= rounded_corners_tabs_top($rounded_corners_tabs_options);
        $query = 'SHOW COLUMNS FROM userinfo';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        while ($data = mysql_fetch_assoc($result)) {
            if ($data['Field'] == 'profile_theme' && substr($data['Type'], 0, 5) == 'enum(') {
                $types = substr($data['Type'], 6, -2);
                $profile_themes = explode("','", $types);
            }
예제 #2
0
function profile_presentation_load($options)
{
    $query = 'SELECT presentation_text FROM userinfo WHERE userid = "' . $options['user_id'] . '" LIMIT 1';
    $result = mysql_query($query) or report_sql_error($query);
    if (mysql_num_rows($result) > 0) {
        $data = mysql_fetch_assoc($result);
        $options['presentation_text'] = 'Hej';
        if (strlen($data['presentation_text']) > 0) {
            $options['presentation_text'] = $data['presentation_text'];
        } else {
            $query = 'SELECT freetext AS presentation_text FROM traffa_freetext WHERE userid = "' . $options['user_id'] . '" LIMIT 1';
            $result = mysql_query($query) or report_sql_error($query);
            if (mysql_num_rows($result) > 0) {
                $data = mysql_fetch_assoc($result);
                if (strlen($data['presentation_text']) > 0) {
                    // DO NOT FORGET TO MAKE SAFE AGAIN!
                    $options['presentation_text'] = mysql_real_escape_string(htmlentities($data['presentation_text']));
                    profile_presentation_save($options);
                } else {
                    $options['presentation_text'] = 'Användaren har inte skapat någon presentation ännu.';
                }
            } else {
                $options['presentation_text'] = 'Användaren har inte skapat någon presentation ännu.';
            }
        }
    } else {
        $options['presentation_text'] = 'Användaren hittades inte i databasen.';
    }
    return $options;
}