tiki-my_tiki.php 4.54 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
4 5
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6
// $Id$
changi67's avatar
changi67 committed
7

8
$section = 'mytiki';
9
require_once ('tiki-setup.php');
10
include_once ('lib/wiki/wikilib.php');
11
include_once ('lib/tasks/tasklib.php');
12
//get_strings tra('MyTiki Home');
13
$access->check_user($user);
14 15 16 17 18 19
$userwatch = $user;
if (isset($_REQUEST["view_user"])) {
	if ($_REQUEST["view_user"] <> $user) {
		if ($tiki_p_admin == 'y') {
			$userwatch = $_REQUEST["view_user"];
		} else {
20
			$smarty->assign('msg', tra("You do not have permission to view other users data"));
21
			$smarty->display("error.tpl");
22 23 24 25 26
			die;
		}
	} else {
		$userwatch = $user;
	}
27
}
28
$smarty->assign('userwatch', $userwatch);
29 30 31 32
if (!isset($_REQUEST["sort_mode"])) {
	$sort_mode = 'pageName_asc';
} else {
	$sort_mode = $_REQUEST["sort_mode"];
33
}
34
$smarty->assign('sort_mode', $sort_mode);
35
if ($prefs['feature_wiki'] == 'y') {
36 37 38 39 40 41
	$mytiki_pages = $tikilib->get_user_preference($user, 'mytiki_pages', 'y');
	if ($mytiki_pages == 'y') {
		$user_pages = $wikilib->get_user_all_pages($userwatch, $sort_mode);
		$smarty->assign_by_ref('user_pages', $user_pages);
		$smarty->assign('mytiki_pages', 'y');
	}
42
}
43
if ($prefs['feature_blogs'] == 'y') {
44 45
	$mytiki_blogs = $tikilib->get_user_preference($user, 'mytiki_blogs', 'y');
	if ($mytiki_blogs == 'y') {
46 47
		require_once('lib/blogs/bloglib.php');
		$user_blogs = $bloglib->list_user_blogs($userwatch, false);
48 49 50
		$smarty->assign_by_ref('user_blogs', $user_blogs);
		$smarty->assign('mytiki_blogs', 'y');
	}
51
}
52
if ($prefs['feature_galleries'] == 'y') {
53 54 55 56 57 58
	$mytiki_gals = $tikilib->get_user_preference($user, 'mytiki_gals', 'y');
	if ($mytiki_gals == 'y') {
		$user_galleries = $tikilib->get_user_galleries($userwatch, -1);
		$smarty->assign_by_ref('user_galleries', $user_galleries);
		$smarty->assign('mytiki_gals', 'y');
	}
59
}
60
if ($prefs['feature_trackers'] == 'y') {
61 62
	$mytiki_user_items = $tikilib->get_user_preference($user, 'mytiki_items', 'y');
	if ($mytiki_user_items == 'y') {
63 64
		$trklib = TikiLib::lib('trk');
		$user_items = $trklib->get_user_items($userwatch);
65 66
		$smarty->assign_by_ref('user_items', $user_items);
		$smarty->assign('mytiki_user_items', 'y');
67 68
		$nb_item_comments = $trklib->nbComments($user);
		$smarty->assign_by_ref('nb_item_comments', $nb_item_comments);
69
	}
70
}
71
if ($prefs['feature_forums'] == 'y') {
72 73
	$mytiki_forum_replies = $tikilib->get_user_preference($user, 'mytiki_forum_replies', 'y');
	if ($mytiki_forum_replies == 'y') {
74
		include_once ("lib/comments/commentslib.php");
changi67's avatar
changi67 committed
75
		$commentslib = new Comments($dbTiki);
76
		$user_forum_replies = $commentslib->get_user_forum_comments($userwatch, -1, 'replies');
changi67's avatar
changi67 committed
77
		$smarty->assign_by_ref('user_forum_replies', $user_forum_replies);
78 79 80 81
		$smarty->assign('mytiki_forum_replies', 'y');
	}
	$mytiki_forum_topics = $tikilib->get_user_preference($user, 'mytiki_forum_topics', 'y');
	if ($mytiki_forum_topics == 'y') {
82
		include_once ("lib/comments/commentslib.php");
changi67's avatar
changi67 committed
83
		$commentslib = new Comments($dbTiki);
84 85 86 87
		$user_forum_topics = $commentslib->get_user_forum_comments($userwatch, -1, 'topics');
		$smarty->assign_by_ref('user_forum_topics', $user_forum_topics);
		$smarty->assign('mytiki_forum_topics', 'y');
	}
88
}
89
if ($prefs['feature_tasks'] == 'y') {
changi67's avatar
changi67 committed
90
	$mytiki_tasks = $tikilib->get_user_preference($user, 'mytiki_tasks', 'y');
91
	if ($mytiki_tasks == 'y') {
changi67's avatar
changi67 committed
92
		$tasks = $tasklib->list_tasks($user, 0, 20, NULL, 'priority_asc', true, false, true);
93 94 95
		$smarty->assign_by_ref('tasks', $tasks['data']);
		$smarty->assign('mytiki_tasks', 'y');
	}
96
}
97
if ($prefs['feature_messages'] == 'y' && $tiki_p_messages == 'y') {
98 99 100 101 102 103 104 105 106
	$mytiki_msgs = $tikilib->get_user_preference($user, 'mytiki_msgs', 'y');
	if ($mytiki_msgs == 'y') {
		include_once ('lib/messu/messulib.php');
		$unread = $tikilib->user_unread_messages($userwatch);
		$smarty->assign_by_ref('unread', $unread);
		$msgs = $messulib->list_user_messages($user, 0, -1, 'date_desc', '', 'isRead', 'n', '', 'messages');
		$smarty->assign_by_ref('msgs', $msgs['data']);
		$smarty->assign('mytiki_msgs', 'y');
	}
107
}
sylvieg's avatar
sylvieg committed
108 109 110 111 112 113 114 115 116
if ($prefs['feature_articles'] == 'y') {
	$mytiki_articles = $tikilib->get_user_preference($user, 'mytiki_articles', 'y');
	if ($mytiki_articles == 'y') {
		include_once ('lib/articles/artlib.php');
		$user_articles = $artlib->get_user_articles($userwatch, -1);
		$smarty->assign_by_ref('user_articles', $user_articles);
		$smarty->assign('mytiki_articles', 'y');
	}
}
117 118
include_once ('tiki-section_options.php');
$smarty->assign('mid', 'tiki-my_tiki.tpl');
119
$smarty->display("tiki.tpl");