示例#1
0
function user_display_profile($user_id)
{
    echo '<h1>' . user_get_name($user_id) . '</h1>';
    $user_description = user_get_description($user_id);
    $user_image = user_get_avatar_path($user_id, 180);
    if (login_check_logged_in_mini() > 0 && isset($_POST['profile_edit']) && $user_id === $_SESSION[PREFIX . 'user_id']) {
        //Show edit form
        //TODO: Image
        echo '<form method="post">
			<div class="form-group">
				<label for="description_text">' . _("Profile text") . '</label>
				<textarea class="form-control" id="description_text" name="description">' . $user_description . '</textarea>
			</div>
			<div class="form-group">
				<label for="avatar_change_div">' . _("Profile image (avatar)") . '</label>
				<div id="avatar_change_div">
					<p>To change your avatar, <a href="http://gravatar.com">go to Gravatar</a>, log in and upload desired picture!</p>
					<p>Current picture being used for ' . user_get_email($user_id) . ' is:</p>
					<img class="avatar" src="' . $user_image . '">
				</div>
			</div>
			<input type="submit" class="btn btn-success" name="profile_save" value="' . _("Save") . '">
		</form>';
    } else {
        echo '
		<div class="row profile">
			<div class="col-md-2">
				<img class="avatar" src="' . $user_image . '">
			</div>
			<div class="col-md-10">
				<p>' . $user_description . '</p>
			</div>
		</div>';
        if (login_check_logged_in_mini() > 0 && $user_id == $_SESSION[PREFIX . 'user_id']) {
            //edit button
            echo '
			<div class="row">
				<div class="center">
					<form method="post">
						<input type="submit" class="btn btn-default" name="profile_edit" value="' . _("Edit profile") . '">
					</form>
				</div>
			</div>
			';
        }
        if (function_exists('user_profile_custom_content')) {
            user_profile_custom_content($user_id);
        }
        echo '<div class="col-lg-12">';
        comments_show_comments_and_replies($user_id, "user");
        echo "</div>";
    }
}
示例#2
0
function meta_get_description()
{
    // meta_description
    if (defined('CUSTOM_PAGES_ARRAY')) {
        $custom_pages = unserialize(CUSTOM_PAGES_ARRAY);
    }
    if (isset($_GET['p'])) {
        $this_page = array();
        foreach ($custom_pages as $name => $arr) {
            if (!strcmp($arr['slug'], $_GET['p'])) {
                $this_page = $arr;
            }
        }
    }
    if (isset($_GET['s'])) {
        $this_side = array();
        foreach ($this_page as $name => $arr) {
            if (!strcmp($arr['slug'], $_GET['s'])) {
                $this_side = $arr;
            }
        }
    } else {
        if (isset($this_page)) {
            $this_side = $this_page;
        }
    }
    if (isset($this_side['meta_description'])) {
        return $this_side['meta_description'];
    } else {
        if (isset($_GET['p'])) {
            if (!strcmp($_GET['p'], "feedback")) {
                return sprintf(_("Page on %s where you can leave feedback"), SITE_NAME);
            } else {
                if (!strcmp($_GET['p'], "news")) {
                    return sprintf(_("News on site %s"), SITE_NAME);
                } else {
                    if (!strcmp($_GET['p'], "user") && isset($_GET['s']) && !strcmp($_GET['s'], "profile")) {
                        if (isset($_GET['user'])) {
                            $user = $_GET['user'];
                        } else {
                            if (isset($_SESSION[PREFIX . 'user_id'])) {
                                $user = $_SESSION[PREFIX . 'user_id'];
                            }
                        }
                        if (isset($_user)) {
                            return sprintf(_("User %s on site %s. %s"), user_get_name($user), SITE_NAME, user_get_description($user));
                        }
                    } else {
                        if (!strcmp($_GET['p'], "user") && isset($_GET['s']) && !strcmp($_GET['s'], "privmess")) {
                            return sprintf(_("Private messages on site %s"), SITE_NAME);
                        } else {
                            if (!strcmp($_GET['p'], "user") && isset($_GET['s']) && !strcmp($_GET['s'], "settings")) {
                                return sprintf(_("User settings on site %s"), SITE_NAME);
                            } else {
                                if (!strcmp($_GET['p'], "admin")) {
                                    return sprintf(_("Admin tools on site %s"), SITE_NAME);
                                } else {
                                    if (!strcmp($_GET['p'], "changelog")) {
                                        return sprintf(_("Change log on site %s"), SITE_NAME);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return SELLING_TEXT;
}