PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/yurivn/modcp/index.php

https://gitlab.com/trang1104/portable_project
PHP | 382 lines | 350 code | 11 blank | 21 comment | 8 complexity | 3dd775889818bb972a3dd62c85ac3603 MD5 | raw file
  1<?php
  2/*======================================================================*\
  3|| #################################################################### ||
  4|| # vBulletin 4.2.2 Alpha 1 - Licence Number VBFSA2W3VC
  5|| # ---------------------------------------------------------------- # ||
  6|| # Copyright �2000-2013 vBulletin Solutions Inc. All Rights Reserved. ||
  7|| # This file may not be redistributed in whole or significant part. # ||
  8|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
  9|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
 10|| #################################################################### ||
 11\*======================================================================*/
 12
 13// ######################## SET PHP ENVIRONMENT ###########################
 14error_reporting(E_ALL & ~E_NOTICE);
 15
 16// ##################### DEFINE IMPORTANT CONSTANTS #######################
 17define('CVS_REVISION', '$RCSfile$ - $Revision: 40911 $');
 18
 19// #################### PRE-CACHE TEMPLATES AND DATA ######################
 20$phrasegroups = array('cphome');
 21$specialtemplates = array();
 22
 23// ########################## REQUIRE BACK-END ############################
 24require_once('./global.php');
 25
 26// ############################# LOG ACTION ###############################
 27if (empty($_REQUEST['do']))
 28{
 29	log_admin_action();
 30}
 31
 32// ########################################################################
 33// ######################### START MAIN SCRIPT ############################
 34// ########################################################################
 35$vbulletin->input->clean_array_gpc('r', array('redirect' => TYPE_NOHTML)); # Not sure where this comes from
 36if (!empty($vbulletin->GPC['redirect']))
 37{
 38	define('CP_REDIRECT', $vbulletin->GPC['redirect']);
 39	print_stop_message('redirecting_please_wait');
 40}
 41
 42// #############################################################################
 43// ############################### LOG OUT OF CP ###############################
 44// #############################################################################
 45
 46if ($_REQUEST['do'] == 'cplogout')
 47{
 48	vbsetcookie('cpsession', '', false, true, true);
 49	$db->query_write("DELETE FROM " . TABLE_PREFIX . "cpsession WHERE userid = " . $vbulletin->userinfo['userid'] . " AND hash = '" . $db->escape_string($vbulletin->GPC[COOKIE_PREFIX . 'cpsession']) . "'");
 50	if (!empty($vbulletin->session->vars['sessionurl_js']))
 51	{
 52		exec_header_redirect('index.php?' . $vbulletin->session->vars['sessionurl_js']);
 53	}
 54	else
 55	{
 56		exec_header_redirect('index.php');
 57	}
 58}
 59
 60if (empty($_REQUEST['do']))
 61{
 62	$_REQUEST['do'] = 'frames';
 63}
 64
 65if ($_REQUEST['do'] == 'frames')
 66{
 67	$vbulletin->input->clean_array_gpc('r', array(
 68		'loc' => TYPE_NOHTML
 69	));
 70
 71	$navframe = '<frame src="index.php?' . $vbulletin->session->vars['sessionurl'] . "do=nav" . iif($cpnavjs, '&amp;cpnavjs=1') . "\" name=\"nav\" scrolling=\"yes\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" border=\"no\" />\n";
 72	$headframe = '<frame src="index.php?' . $vbulletin->session->vars['sessionurl'] . "do=head\" name=\"head\" scrolling=\"no\" noresize=\"noresize\" frameborder=\"0\" marginwidth=\"10\" marginheight=\"0\" border=\"no\" />\n";
 73	$mainframe = '<frame src="' . iif(!empty($vbulletin->GPC['loc']) AND !preg_match('#^[a-z]+:#i', $vbulletin->GPC['loc']), create_full_url($vbulletin->GPC['loc']), 'index.php?' . $vbulletin->session->vars['sessionurl'] . 'do=home') . "\" name=\"main\" scrolling=\"yes\" frameborder=\"0\" marginwidth=\"10\" marginheight=\"10\" border=\"no\" />\n";
 74
 75?>
 76<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
 77<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo vB_Template_Runtime::fetchStyleVar('textdirection'); ?>" lang="<?php echo vB_Template_Runtime::fetchStyleVar('languagecode'); ?>">
 78<head>
 79<script type="text/javascript">
 80<!-- // get out of any containing frameset
 81if (self.parent.frames.length != 0)
 82{
 83	document.write('<span style="font: bold 10pt verdana,sans-serif">Get me out of this frame set!</span>');
 84	self.parent.location.replace(document.location.href);
 85}
 86// -->
 87</script>
 88<title><?php echo $vbulletin->options['bbtitle']; ?> <?php echo $vbphrase['moderator_control_panel']; ?></title>
 89</head>
 90
 91<?php
 92
 93if (vB_Template_Runtime::fetchStyleVar('textdirection') == 'ltr')
 94{
 95// left-to-right frameset
 96?>
 97<frameset cols="195,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
 98	<?php echo $navframe; ?>
 99	<frameset rows="20,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
100		<?php echo $headframe; ?>
101		<?php echo $mainframe; ?>
102	</frameset>
103</frameset>
104<?php
105}
106else
107{
108// right-to-left frameset
109?>
110<frameset cols="*,195"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
111	<frameset rows="20,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
112		<?php echo $headframe; ?>
113		<?php echo $mainframe; ?>
114	</frameset>
115	<?php echo $navframe; ?>
116</frameset>
117<?php
118}
119
120?>
121
122<noframes>
123	<body>
124		<p><?php echo $vbphrase['no_frames_support']; ?></p>
125	</body>
126</noframes>
127
128</html>
129<?php
130}
131
132if ($_REQUEST['do'] == 'head')
133{
134	define('IS_NAV_PANEL', true);
135	print_cp_header();
136
137	$forumhomelink = fetch_seo_url('forumhome|bburl', array());
138?>
139<table border="0" width="100%" height="100%">
140<tr valign="middle">
141	<td><a href="http://www.vbulletin.com/" target="_blank"><b><?php echo $vbphrase['moderator_control_panel']; ?></b> (vBulletin <?php echo $vbulletin->versionnumber; ?>)</a></td>
142	<td style="white-space:nowrap; text-align:<?php echo vB_Template_Runtime::fetchStyleVar('right'); ?>; font-weight:bold">
143			<a href="<?php echo $forumhomelink; ?>" target="_blank"><?php echo $vbphrase['forum_home_page']; ?></a>
144			|
145			<a href="index.php?<?php echo $vbulletin->session->vars['sessionurl']; ?>do=cplogout" onclick="return confirm('<?php echo $vbphrase['sure_you_want_to_log_out_of_cp']; ?>');"  target="_top"><?php echo $vbphrase['log_out']; ?></a>
146</td>
147</tr>
148</table>
149<?php
150	print_cp_footer();
151}
152
153if ($_REQUEST['do'] == 'home')
154{
155
156print_cp_header($vbphrase['welcome_to_the_vbulletin_moderator_control_panel']);
157
158print_form_header('', '');
159print_table_header($vbphrase['welcome_to_the_vbulletin_moderator_control_panel']);
160print_table_footer();
161
162// *************************************
163// QUICK ADMIN LINKS
164
165//$reminders = fetch_reminders_array();
166
167print_table_start();
168print_table_header($vbphrase['quick_moderator_links']);
169
170$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
171$guestsarry = $db->query_first("SELECT COUNT(host) AS sessions FROM " . TABLE_PREFIX . "session WHERE userid = 0 AND lastactivity > $datecut");
172$membersarry = $db->query_read("SELECT DISTINCT userid FROM " . TABLE_PREFIX . "session WHERE userid <> 0 AND lastactivity > $datecut");
173$guests = intval($guestsarry['sessions']);
174$members = intval($db->num_rows($membersarry));
175
176$is_windows = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
177$loadavg = array();
178
179if (!$is_windows AND function_exists('exec') AND $stats = @exec('uptime 2>&1') AND trim($stats) != '' AND preg_match('#: ([\d.,]+),?\s+([\d.,]+),?\s+([\d.,]+)$#', $stats, $regs))
180{
181	$loadavg[0] = vb_number_format($regs[1], 2);
182	$loadavg[1] = vb_number_format($regs[2], 2);
183	$loadavg[2] = vb_number_format($regs[3], 2);
184}
185else if (!$is_windows AND @file_exists('/proc/loadavg') AND $stats = @file_get_contents('/proc/loadavg') AND trim($stats) != '')
186{
187	$loadavg = explode(' ', $stats);
188	$loadavg[0] = vb_number_format($loadavg[0], 2);
189	$loadavg[1] = vb_number_format($loadavg[1], 2);
190	$loadavg[2] = vb_number_format($loadavg[2], 2);
191}
192
193if (!empty($loadavg))
194{
195	print_label_row($vbphrase['server_load_averages'], "$loadavg[0]&nbsp;&nbsp;$loadavg[1]&nbsp;&nbsp;$loadavg[2] | " . construct_phrase($vbphrase['users_online_x_members_y_guests'], vb_number_format($guests + $members), vb_number_format($members), vb_number_format($guests)), '', 'top', NULL, false);
196}
197else
198{
199	print_label_row($vbphrase['users_online'], construct_phrase($vbphrase['x_y_members_z_guests'], vb_number_format($guests + $members), vb_number_format($members), vb_number_format($guests)), '', 'top', NULL, false);
200}
201
202($hook = vBulletinHook::fetch_hook('mod_index_main')) ? eval($hook) : false;
203
204print_label_row($vbphrase['quick_user_finder'], '
205	<form action="user.php?do=findnames" method="post" style="display:inline">
206		<input type="hidden" name="s" value="' . $vbulletin->session->vars['sessionhash'] . '" />
207		<input type="hidden" name="do" value="findnames" />
208	<input type="text" class="bginput" name="findname" size="30" tabindex="1" />
209	<input type="submit" class="button" value=" ' . $vbphrase['find'] . ' " tabindex="1" />
210	<input type="submit" class="button" value="' . $vbphrase['exact_match'] . '" tabindex="1" name="exact" />
211	</form>
212	', '', 'top', NULL, false
213);
214print_label_row($vbphrase['php_function_lookup'], '
215	<form action="http://www.ph' . 'p.net/manual-lookup.ph' . 'p" method="get" style="display:inline">
216	<input type="text" class="bginput" name="function" size="30" tabindex="1" />
217	<input type="submit" value=" ' . $vbphrase['find'] . ' " class="button" tabindex="1" />
218	</form>
219	', '', 'top', NULL, false
220);
221print_label_row($vbphrase['mysql_language_lookup'], '
222	<form action="http://www.mysql.com/search/" method="get" style="display:inline">
223	<input type="hidden" name="doc" value="1" />
224	<input type="hidden" name="m" value="o" />
225	<input type="text" class="bginput" name="q" size="30" tabindex="1" />
226	<input type="submit" value=" ' . $vbphrase['find'] . ' " class="button" tabindex="1" />
227	</form>
228	', '', 'top', NULL, false
229);
230print_label_row($vbphrase['useful_links'], '
231	<form style="display:inline">
232	<select onchange="if (this.options[this.selectedIndex].value != \'\') { window.open(this.options[this.selectedIndex].value); } return false;" tabindex="1" class="bginput">
233		<option value="">-- ' . $vbphrase['useful_links'] . ' --</option>' . construct_select_options(array(
234			'vBulletin' => array(
235				'http://www.vbulletin.com/' => $vbphrase['home_page'] . ' (vBulletin.com)',
236				'http://members.vbulletin.com/' => $vbphrase['members_area'],
237				'http://www.vbulletin.com/forum/' => $vbphrase['community_forums'],
238				'http://www.vbulletin.com/manual/' => $vbphrase['reference_manual']
239			),
240			'PHP' => array(
241				'http://www.ph' . 'p.net/' => $vbphrase['home_page'] . ' (PHP.net)',
242				'http://www.ph' . 'p.net/manual/' => $vbphrase['reference_manual'],
243				'http://www.ph' . 'p.net/downloads.ph' . 'p' => $vbphrase['download_latest_version']
244			),
245			'MySQL' => array(
246				'http://www.mysql.com/' => $vbphrase['home_page'] . ' (MySQL.com)',
247				'http://www.mysql.com/documentation/' => $vbphrase['reference_manual'],
248				'http://www.mysql.com/downloads/' => $vbphrase['download_latest_version'],
249			)
250	)) . '</select>
251	</form>
252	', '', 'top', NULL, false
253);
254print_table_footer(2, '', '', false);
255
256// *************************************
257// vBULLETIN CREDITS
258require_once(DIR . '/includes/vbulletin_credits.php');
259
260print_cp_footer();
261}
262
263if ($_REQUEST['do'] == 'nav')
264{
265	require_once(DIR . '/includes/adminfunctions_navpanel.php');
266	print_cp_header();
267	?>
268<div>
269<img src="../cpstyles/<?php echo $vbulletin->options['cpstylefolder']; ?>/cp_logo.gif" alt="" border="0" hspace="4" vspace="4" /><?php
270	echo "</div>\n\n<div style=\"width:168px; padding: 4px\">\n";
271
272	construct_nav_spacer();
273
274	// *************************************************
275	if (can_moderate(0, 'canannounce'))
276	{
277		construct_nav_option($vbphrase['post_new_announcement'], 'announcement.php?do=add');
278		construct_nav_option($vbphrase['forum_manager'], 'forum.php?do=modify');
279		construct_nav_group($vbphrase['announcements']);
280		construct_nav_spacer();
281	}
282	// *************************************************
283	$canmoderate = false;
284	if (can_moderate(0, 'canmoderateposts'))
285	{
286		$canmoderate = true;
287		construct_nav_option($vbphrase['moderate_threads'], 'moderate.php?do=posts');
288		construct_nav_option($vbphrase['moderate_posts'], 'moderate.php?do=posts#posts');
289	}
290	if (can_moderate(0, 'canmoderateattachments'))
291	{
292		$canmoderate = true;
293		construct_nav_option($vbphrase['moderate_attachments'], 'moderate.php?do=attachments');
294	}
295	if (can_moderate_calendar())
296	{
297		$canmoderate = true;
298		construct_nav_option($vbphrase['moderate_events'], 'moderate.php?do=events');
299	}
300	if (can_moderate(0, 'canmoderatevisitormessages'))
301	{
302		$canmoderate = true;
303		construct_nav_option($vbphrase['moderate_visitor_messages'], 'moderate.php?do=messages');
304	}
305	if ($canmoderate)
306	{
307		construct_nav_group($vbphrase['moderation']);
308		construct_nav_spacer();
309	}
310	// *************************************************
311	$canuser = false;
312	if (can_moderate(0, 'canunbanusers') OR can_moderate(0, 'canbanusers') OR can_moderate(0, 'canviewprofile') OR can_moderate(0, 'caneditsigs') OR can_moderate(0, 'caneditavatar'))
313	{
314		$canuser = true;
315		construct_nav_option($vbphrase['search_for_users'],'user.php?do=find');
316	}
317	if (can_moderate(0, 'canbanusers'))
318	{
319		$canuser = true;
320		construct_nav_option($vbphrase['ban_user'], 'banning.php?do=banuser');
321	}
322
323	if (can_moderate(0, 'canunbanusers') OR can_moderate(0, 'canbanusers'))
324	{
325		$canuser = true;
326		construct_nav_option($vbphrase['view_banned_users'], 'banning.php?do=modify');
327	}
328
329	if (can_moderate(0, 'canviewips'))
330	{
331		$canuser = true;
332		construct_nav_option($vbphrase['search_ip_addresses'], 'user.php?do=doips');
333	}
334	if ($canuser)
335	{
336		construct_nav_group($vbphrase['users']);
337		construct_nav_spacer();
338	}
339	// *************************************************
340	if ($groupleader = $db->query_first("SELECT userid FROM " . TABLE_PREFIX . "usergroupleader WHERE userid = " . $vbulletin->userinfo['userid']) OR ($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
341	{
342		construct_nav_option($vbphrase['join_requests'], 'user.php?do=viewjoinrequests');
343		construct_nav_group($vbphrase['usergroups']);
344		construct_nav_spacer();
345	}
346	// *************************************************
347	$canmass = false;
348	if (can_moderate(0, 'canmassmove'))
349	{
350		$canmass = true;
351		construct_nav_option($vbphrase['move'], 'thread.php?do=move');
352	}
353	if (can_moderate(0, 'canmassprune'))
354	{
355		$canmass = true;
356		construct_nav_option($vbphrase['prune'], 'thread.php?do=prune');
357	}
358	if ($canmass)
359	{
360		construct_nav_group($vbphrase['thread']);
361		construct_nav_spacer();
362	}
363
364	($hook = vBulletinHook::fetch_hook('mod_index_navigation')) ? eval($hook) : false;
365
366	print_nav_panel();
367
368	echo "</div>\n";
369	// *************************************************
370
371	define('NO_CP_COPYRIGHT', true);
372	unset($DEVDEBUG);
373	print_cp_footer();
374}
375
376/*======================================================================*\
377|| ####################################################################
378|| # Downloaded: 03:13, Sat Sep 7th 2013
379|| # CVS: $RCSfile$ - $Revision: 40911 $
380|| ####################################################################
381\*======================================================================*/
382?>