summaryrefslogtreecommitdiffstats
path: root/live_update
blob: 0778b4ae83585a9bdf9a026ada92013cbb9edb72 (plain)
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
#!/bin/sh

message=/usr/X11R6/bin/gmessage
[ -x $message ] || message=/usr/X11R6/bin/xmessage
[ -x $message ] || unset message

if [ "$UID" -ne 0 ]; then
    if [ -x "$message" ]; then
	case "$LANG" in
	    fr*) buttons="Arrêter:0"
		 msg="Mise à jour en direct de Mandrake Linux.

Vous devez être l'utilisateur root pour lancer cette application." ;;
	    *) buttons="Abort:0"
	       msg="Mandrake Linux live upgrade.

You need to be root to start this program." ;;
	esac
	$message -buttons "$buttons" -print "$msg"
    else
	echo >&2 "You need to be root to start this program."
    fi
    exit 3
fi

distrib=`pwd`;
if [ ! -x "$distrib/Mandrake/mdkinst/usr/bin/perl-install/live_install" ]; then
    distrib="/mnt/cdrom"
fi
if [ ! -x "$distrib/Mandrake/mdkinst/usr/bin/perl-install/live_install" ]; then
    if [ -x "$message" ]; then
	case "$LANG" in
	    fr*) buttons="Arrêter:0"
		 msg="Mise à jour en direct de Mandrake Linux.

Impossible de trouver le Cédérom d'installation de Mandrake Linux dans le premier lecteur." ;;
	    *) buttons="Abort:0"
	       msg="Mandrake Linux live upgrade.

Unable to find Mandrake Linux Installation Cd-Rom in the first drive." ;;
	esac
	$message -buttons "$buttons" -print "$msg"
    else
	echo >&2 "Unable to find Mandrake Linux Installation Cd-Rom in the first drive."
    fi
    exit 2
fi

if [ -x "$message" ]; then
    case "$LANG" in
	fr*) buttons="Mise à jour:0,Annuler:1"
	     msg="Mise à jour en direct de Mandrake Linux.

Appuyez sur \"Mise à jour\" pour lancer la mise à jour de votre système,
cela prendra quelques minutes avant que l'écran de DrakX apparaisse.

Appuyez sur \"Annuler\" pour ne pas mettre à jour votre système de cette manière." ;;
	*) buttons="Upgrade:0,Cancel:1"
	   msg="Mandrake Linux live upgrade.

Press \"Upgrade\" to start live upgrade on your system, note this will
take some time to prepare the system before DrakX screen appears.

Press \"Cancel\" to avoid upgrading your system this way." ;;
    esac
    default=`echo $buttons | cut -d: -f1`
    $message -buttons "$buttons" -default "$default" -print "$msg"
    [ $? -ne 0 ] && exit 1
else
    echo >&2 "Press ENTER to start live upgrade on your system, note this will
take some time to prepare the system before DrakX screen appears.

Press CTRL-C to avoid upgrading your system this way."
fi

cd "$distrib/Mandrake/mdkinst/usr/bin/perl-install" && exec ./live_install
exit 2
id='n249' href='#n249'>249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* MCP Front Panel
*/
function mcp_front_view($id, $mode, $action)
{
	global $phpEx, $phpbb_root_path, $config;
	global $template, $db, $user, $auth, $module;
	global $phpbb_dispatcher;

	// Latest 5 unapproved
	if ($module->loaded('queue'))
	{
		$forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_approve')));
		$post_list = array();
		$forum_names = array();

		$forum_id = request_var('f', 0);

		$template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);

		if (!empty($forum_list))
		{
			$sql = 'SELECT COUNT(post_id) AS total
				FROM ' . POSTS_TABLE . '
				WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
					AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE));
			$result = $db->sql_query($sql);
			$total = (int) $db->sql_fetchfield('total');
			$db->sql_freeresult($result);

			if ($total)
			{
				$sql = 'SELECT forum_id, forum_name
					FROM ' . FORUMS_TABLE . '
					WHERE ' . $db->sql_in_set('forum_id', $forum_list);
				$result = $db->sql_query($sql);

				while ($row = $db->sql_fetchrow($result))
				{
					$forum_names[$row['forum_id']] = $row['forum_name'];
				}
				$db->sql_freeresult($result);

				$sql = 'SELECT post_id
					FROM ' . POSTS_TABLE . '
					WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
						AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . '
					ORDER BY post_time DESC, post_id DESC';
				$result = $db->sql_query_limit($sql, 5);

				while ($row = $db->sql_fetchrow($result))
				{
					$post_list[] = $row['post_id'];
				}
				$db->sql_freeresult($result);

				if (empty($post_list))
				{
					$total = 0;
				}
			}

			/**
			* Alter list of posts and total as required
			*
			* @event core.mcp_front_view_queue_postid_list_after
			* @var	int		total						Number of unapproved posts
			* @var	array	post_list					List of unapproved posts
			* @var	array	forum_list					List of forums that contain the posts
			* @var	array	forum_names					Associative array with forum_id as key and it's corresponding forum_name as value
			* @since 3.1.0-RC3
			*/
			$vars = array('total', 'post_list', 'forum_list', 'forum_names');
			extract($phpbb_dispatcher->trigger_event('core.mcp_front_view_queue_postid_list_after', compact($vars)));

			if ($total)
			{
				$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
					FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
					WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
						AND t.topic_id = p.topic_id
						AND p.poster_id = u.user_id
					ORDER BY p.post_time DESC, p.post_id DESC';
				$result = $db->sql_query($sql);

				while ($row = $db->sql_fetchrow($result))
				{
					$template->assign_block_vars('unapproved', array(
						'U_POST_DETAILS'	=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']),
						'U_MCP_FORUM'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']),
						'U_MCP_TOPIC'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
						'U_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
						'U_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),

						'AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']),
						'AUTHOR'			=> get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour']),
						'AUTHOR_COLOUR'		=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']),
						'U_AUTHOR'			=> get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']),

						'FORUM_NAME'	=> $forum_names[$row['forum_id']],
						'POST_ID'		=> $row['post_id'],
						'TOPIC_TITLE'	=> $row['topic_title'],
						'SUBJECT'		=> ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
						'POST_TIME'		=> $user->format_date($row['post_time']),
						'ATTACH_ICON_IMG'	=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
					));
				}
				$db->sql_freeresult($result);
			}

			$s_hidden_fields = build_hidden_fields(array(
				'redirect'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main' . (($forum_id) ? '&amp;f=' . $forum_id : ''))
			));

			$template->assign_vars(array(
				'S_HIDDEN_FIELDS'		=> $s_hidden_fields,
				'S_MCP_QUEUE_ACTION'	=> append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"),
				'L_UNAPPROVED_TOTAL'	=> $user->lang('UNAPPROVED_POSTS_TOTAL', (int) $total),
				'S_HAS_UNAPPROVED_POSTS'=> ($total != 0),
			));
		}
	}

	// Latest 5 reported
	if ($module->loaded('reports'))
	{
		$forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_report')));

		$template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);

		if (!empty($forum_list))
		{
			$sql = 'SELECT COUNT(r.report_id) AS total
				FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
				WHERE r.post_id = p.post_id
					AND r.pm_id = 0
					AND r.report_closed = 0
					AND ' . $db->sql_in_set('p.forum_id', $forum_list);
			$result = $db->sql_query($sql);
			$total = (int) $db->sql_fetchfield('total');
			$db->sql_freeresult($result);

			if ($total)
			{
				$sql_ary = array(
					'SELECT'	=> 'r.report_time, p.post_id, p.post_subject, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',

					'FROM'		=> array(
						REPORTS_TABLE			=> 'r',
						REPORTS_REASONS_TABLE	=> 'rr',
						TOPICS_TABLE			=> 't',
						USERS_TABLE				=> array('u', 'u2'),
						POSTS_TABLE				=> 'p',
					),

					'LEFT_JOIN'	=> array(
						array(
							'FROM'	=> array(FORUMS_TABLE => 'f'),
							'ON'	=> 'f.forum_id = p.forum_id',
						),
					),

					'WHERE'		=> 'r.post_id = p.post_id
						AND r.pm_id = 0
						AND r.report_closed = 0
						AND r.reason_id = rr.reason_id
						AND p.topic_id = t.topic_id
						AND r.user_id = u.user_id
						AND p.poster_id = u2.user_id
						AND ' . $db->sql_in_set('p.forum_id', $forum_list),

					'ORDER_BY'	=> 'p.post_time DESC, p.post_id DESC',
				);

				/**
				* Alter sql query to get latest reported posts
				*
				* @event core.mcp_front_reports_listing_query_before
				* @var	int		sql_ary						Associative array with the query to be executed
				* @var	array	forum_list					List of forums that contain the posts
				* @since 3.1.0-RC3
				*/
				$vars = array('sql_ary', 'forum_list');
				extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_listing_query_before', compact($vars)));

				$sql = $db->sql_build_query('SELECT', $sql_ary);
				$result = $db->sql_query_limit($sql, 5);

				while ($row = $db->sql_fetchrow($result))
				{
					$template->assign_block_vars('report', array(
						'U_POST_DETAILS'	=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . "&amp;i=reports&amp;mode=report_details"),
						'U_MCP_FORUM'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view"),
						'U_MCP_TOPIC'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'] . "&amp;i=$id&amp;mode=topic_view"),
						'U_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
						'U_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),

						'REPORTER_FULL'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
						'REPORTER'			=> get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
						'REPORTER_COLOUR'	=> get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
						'U_REPORTER'		=> get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),