-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamutils.php
173 lines (158 loc) · 5.4 KB
/
streamutils.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$user->get_profile_fields( $user->data['user_id'] );
$user_fields = $user->profile_fields;
$full_name = (isset( $user_fields['REALNAME'] )) ? $user_fields['REALNAME'] : '';
$template->assign_vars(array(
'FULL_NAME' => $full_name
));
// END
//UserPage data
$streamon;
//UserPage data
// Get URL function
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
// END
function getdatatoseecustomuserpage($url) {
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
$userspage = parse_url($url);
$selecteduser = str_replace('u=', '', $userspage[query]);
$db->sql_escape($selecteduser);
$sql_array = array(
'username' => $selecteduser,
);
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_build_array('SELECT', $sql_array);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$selecteduserid = $row['user_id'];
$sql_arrayid = array(
'user_id' => $selecteduserid,
);
$sqlid = 'SELECT pf_acepage
FROM `phpbb_profile_fields_data`
WHERE ' . $db->sql_build_array('SELECT', $sql_arrayid);
$resultid = $db->sql_query($sqlid);
$rowid = $db->sql_fetchrow($resultid);
$db->sql_freeresult($resultid);
$foo = htmlspecialchars_decode($rowid['pf_acepage']);
return $foo;
}
function getdatatoseecustomuserbanner($url) {
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
$userspage = parse_url($url);
$selecteduser = str_replace('u=', '', $userspage[query]);
$sql_array = array(
'username' => $selecteduser,
);
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_build_array('SELECT', $sql_array);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$selecteduserid = $row['user_id'];
$sql_arrayid = array(
'user_id' => $selecteduserid,
);
$sqlid = 'SELECT pf_user_banner
FROM `phpbb_profile_fields_data`
WHERE ' . $db->sql_build_array('SELECT', $sql_arrayid);
$resultid = $db->sql_query($sqlid);
$rowid = $db->sql_fetchrow($resultid);
$db->sql_freeresult($resultid);
$foo = htmlspecialchars_decode($rowid['pf_user_banner']);
return $foo;
}
function getdatatoseecustomusercolor($url) {
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
$userspage = parse_url($url);
$selecteduser = str_replace('u=', '', $userspage[query]);
$sql_array = array(
'username' => $selecteduser,
);
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_build_array('SELECT', $sql_array);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$selecteduserid = $row['user_id'];
$sql_arrayid = array(
'user_id' => $selecteduserid,
);
$sqlid = 'SELECT pf_page_color
FROM `phpbb_profile_fields_data`
WHERE ' . $db->sql_build_array('SELECT', $sql_arrayid);
$resultid = $db->sql_query($sqlid);
$rowid = $db->sql_fetchrow($resultid);
$db->sql_freeresult($resultid);
$foo = htmlspecialchars_decode($rowid['pf_page_color']);
return $foo;
}
function getstreamgodsid () {
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
$whoisstreaming;
$sql = 'SELECT username
FROM phpbb_users
INNER JOIN phpbb_profile_fields_data
ON phpbb_users.user_id=phpbb_profile_fields_data.user_id
WHERE phpbb_profile_fields_data.pf_streamingnow = 1';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$whoisstreaming[] = $row['username'];
}
$db->sql_freeresult($result);
return $whoisstreaming;
}
function getstreamgodsname () {
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
$whoisstreaming;
$sql = 'SELECT user_id
FROM phpbb_profile_fields_data
WHERE pf_streamingnow = 1';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$whoisstreaming[] = $row['user_id'];
}
$db->sql_freeresult($result);
return $whoisstreaming;
}
function userpanel () {
global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
$userspage = parse_url($url);
if ( $user->profile_fields['pf_streamingnow'] == 2 ) {
$streamon = "off :(";}
else if ( $user->profile_fields['pf_streamingnow'] == 1 ) {
$streamon = "on!";}
if($user->data['is_registered']){
echo '<li id="aceuserpanel"><a href="forum/ucp.php?i=173">Hey ' . $user->data['username'] . ' your AcePage is ' .$streamon. ' </a></li>';
}
else{
echo '<li id="aceregisterpanel"><a href="forum/ucp.php?mode=register">or here to register</a></li>';
echo '<li id="aceloginpanel"><a href="forum/ucp.php?mode=login">Click here to login</a></li>';
}
}
?>