3.0.10 New post

Máte problémy s instalaci phpBB3 nebo s konverzi z phpBB2 na phpBB3? Zde naleznete pomoc.
Pravidla fóra
Čim více informací poskytnete ve vašem dotazu, tim vyšší je šance, že se vám dřív dostane přesné odpovědi. Uveďte odkaz na vaše fórum, používané MODy a styly a zkuste sepsat úpravy na fóru za poslední týdny. Nezapomeňte uvést výstižný titulek tématu.
Zamčeno
Uživatelský avatar
Morgalt
Příspěvky: 26
Registrován: čtv 17. lis 2011 17:08:53

3.0.10 New post

Příspěvek od Morgalt » ned 08. led 2012 0:09:08

Jsem zde se svou pravidelnou dávkou dotazů, doufám, že mě nikdo nepostrádal... :))
Po upgradu na potvornou desítku mi hapruje posílání nových příspěvků nebo nových topiců:
Fatal error: Cannot redeclare phpbb_bump_topic() (previously declared in .....includes/functions_posting.php:2637) in .....includes/functions_posting.php on line 2825

Dotyčné řádky mám tady, vím že je tam něco zdvojené, ale nevím, CO z toho ubrat.

Kód: Vybrat vše

function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
{
	global $config, $db, $user, $phpEx, $phpbb_root_path;

	if ($bump_time === false)
	{
		$bump_time = time();
	}

	// Begin bumping
	$db->sql_transaction('begin');

	// Update the topic's last post post_time
	$sql = 'UPDATE ' . POSTS_TABLE . "
		SET post_time = $bump_time
		WHERE post_id = {$post_data['topic_last_post_id']}
			AND topic_id = $topic_id";
	$db->sql_query($sql);

	// Sync the topic's last post time, the rest of the topic's last post data isn't changed
	$sql = 'UPDATE ' . TOPICS_TABLE . "
		SET topic_last_post_time = $bump_time,
			topic_bumped = 1,
			topic_bumper = " . $user->data['user_id'] . "
		WHERE topic_id = $topic_id";
	$db->sql_query($sql);

	// Update the forum's last post info
	$sql = 'UPDATE ' . FORUMS_TABLE . "
		SET forum_last_post_id = " . $post_data['topic_last_post_id'] . ",
			forum_last_poster_id = " . $post_data['topic_last_poster_id'] . ",
			forum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "',
			forum_last_post_time = $bump_time,
			forum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "',
			forum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "'
		WHERE forum_id = $forum_id";
	$db->sql_query($sql);

	// Update bumper's time of the last posting to prevent flood
	$sql = 'UPDATE ' . USERS_TABLE . "
		SET user_lastpost_time = $bump_time
		WHERE user_id = " . $user->data['user_id'];
	$db->sql_query($sql);

	$db->sql_transaction('commit');

	// Mark this topic as posted to
	markread('post', $forum_id, $topic_id, $bump_time);

	// Mark this topic as read
	markread('topic', $forum_id, $topic_id, $bump_time);

	// Update forum tracking info
	if ($config['load_db_lastread'] && $user->data['is_registered'])
	{
		$sql = 'SELECT mark_time
			FROM ' . FORUMS_TRACK_TABLE . '
			WHERE user_id = ' . $user->data['user_id'] . '
				AND forum_id = ' . $forum_id;
		$result = $db->sql_query($sql);
		$f_mark_time = (int) $db->sql_fetchfield('mark_time');
		$db->sql_freeresult($result);
	}
	else if ($config['load_anon_lastread'] || $user->data['is_registered'])
	{
		$f_mark_time = false;
	}

	if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered'])
	{
		// Update forum info
		$sql = 'SELECT forum_last_post_time
			FROM ' . FORUMS_TABLE . '
			WHERE forum_id = ' . $forum_id;
		$result = $db->sql_query($sql);
		$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
		$db->sql_freeresult($result);

		update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false);
	}

	add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);

	$url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";

	return $url;
}

/**
* Handle topic bumping
* @param int $forum_id The ID of the forum the topic is being bumped belongs to
* @param int $topic_id The ID of the topic is being bumping
* @param array $post_data Passes some topic parameters:
*				- 'topic_title'
*				- 'topic_last_post_id'
*				- 'topic_last_poster_id'
*				- 'topic_last_post_subject'
*				- 'topic_last_poster_name'
*				- 'topic_last_poster_colour'
* @param int $bump_time The time at which topic was bumped, usually it is a current time as obtained via time(). 
* @return string An URL to the bumped topic, example: ./viewtopic.php?forum_id=1&amptopic_id=2&ampp=3#p3
*/
function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
{
	global $config, $db, $user, $phpEx, $phpbb_root_path;

	if ($bump_time === false)
	{
		$bump_time = time();
	}

	// Begin bumping
	$db->sql_transaction('begin');

	// Update the topic's last post post_time
	$sql = 'UPDATE ' . POSTS_TABLE . "
		SET post_time = $bump_time
		WHERE post_id = {$post_data['topic_last_post_id']}
			AND topic_id = $topic_id";
	$db->sql_query($sql);

	// Sync the topic's last post time, the rest of the topic's last post data isn't changed
	$sql = 'UPDATE ' . TOPICS_TABLE . "
		SET topic_last_post_time = $bump_time,
			topic_bumped = 1,
			topic_bumper = " . $user->data['user_id'] . "
		WHERE topic_id = $topic_id";
	$db->sql_query($sql);

	// Update the forum's last post info
	$sql = 'UPDATE ' . FORUMS_TABLE . "
		SET forum_last_post_id = " . $post_data['topic_last_post_id'] . ",
			forum_last_poster_id = " . $post_data['topic_last_poster_id'] . ",
			forum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "',
			forum_last_post_time = $bump_time,
			forum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "',
			forum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "'
		WHERE forum_id = $forum_id";
	$db->sql_query($sql);

	// Update bumper's time of the last posting to prevent flood
	$sql = 'UPDATE ' . USERS_TABLE . "
		SET user_lastpost_time = $bump_time
		WHERE user_id = " . $user->data['user_id'];
	$db->sql_query($sql);

	$db->sql_transaction('commit');

	// Mark this topic as posted to
	markread('post', $forum_id, $topic_id, $bump_time);

	// Mark this topic as read
	markread('topic', $forum_id, $topic_id, $bump_time);

	// Update forum tracking info
	if ($config['load_db_lastread'] && $user->data['is_registered'])
	{
		$sql = 'SELECT mark_time
			FROM ' . FORUMS_TRACK_TABLE . '
			WHERE user_id = ' . $user->data['user_id'] . '
				AND forum_id = ' . $forum_id;
		$result = $db->sql_query($sql);
		$f_mark_time = (int) $db->sql_fetchfield('mark_time');
		$db->sql_freeresult($result);
	}
	else if ($config['load_anon_lastread'] || $user->data['is_registered'])
	{
		$f_mark_time = false;
	}

	if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered'])
	{
		// Update forum info
		$sql = 'SELECT forum_last_post_time
			FROM ' . FORUMS_TABLE . '
			WHERE forum_id = ' . $forum_id;
		$result = $db->sql_query($sql);
		$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
		$db->sql_freeresult($result);

		update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false);
	}

	add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);

	$url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";

	return $url;
}
Moc moc prosím, jestli mi by nějaký zkušenější uživatel neposlal přímo citaci toho, co z toho má v functions_posting zůstat..=3
Rok pruzení a tisíce otázek. Díky podpoře za neutuchající ochotu!

danti
Příspěvky: 2618
Registrován: pon 12. led 2009 20:57:21

Re: 3.0.10 New post

Příspěvek od danti » ned 08. led 2012 0:26:44

Mas duplicitne riadky http://www.phpbb.com/community/viewtopi ... #p13023981


najdi

Kód: Vybrat vše

    /**
    * Handle topic bumping
a vsetko co je pred vymaz subor si zalohuj
toto vymazes

Kód: Vybrat vše

    function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false)
    {
       global $config, $db, $user, $phpEx, $phpbb_root_path;

       if ($bump_time === false)
       {
          $bump_time = time();
       }

       // Begin bumping
       $db->sql_transaction('begin');

       // Update the topic's last post post_time
       $sql = 'UPDATE ' . POSTS_TABLE . "
          SET post_time = $bump_time
          WHERE post_id = {$post_data['topic_last_post_id']}
             AND topic_id = $topic_id";
       $db->sql_query($sql);

       // Sync the topic's last post time, the rest of the topic's last post data isn't changed
       $sql = 'UPDATE ' . TOPICS_TABLE . "
          SET topic_last_post_time = $bump_time,
             topic_bumped = 1,
             topic_bumper = " . $user->data['user_id'] . "
          WHERE topic_id = $topic_id";
       $db->sql_query($sql);

       // Update the forum's last post info
       $sql = 'UPDATE ' . FORUMS_TABLE . "
          SET forum_last_post_id = " . $post_data['topic_last_post_id'] . ",
             forum_last_poster_id = " . $post_data['topic_last_poster_id'] . ",
             forum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "',
             forum_last_post_time = $bump_time,
             forum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "',
             forum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "'
          WHERE forum_id = $forum_id";
       $db->sql_query($sql);

       // Update bumper's time of the last posting to prevent flood
       $sql = 'UPDATE ' . USERS_TABLE . "
          SET user_lastpost_time = $bump_time
          WHERE user_id = " . $user->data['user_id'];
       $db->sql_query($sql);

       $db->sql_transaction('commit');

       // Mark this topic as posted to
       markread('post', $forum_id, $topic_id, $bump_time);

       // Mark this topic as read
       markread('topic', $forum_id, $topic_id, $bump_time);

       // Update forum tracking info
       if ($config['load_db_lastread'] && $user->data['is_registered'])
       {
          $sql = 'SELECT mark_time
             FROM ' . FORUMS_TRACK_TABLE . '
             WHERE user_id = ' . $user->data['user_id'] . '
                AND forum_id = ' . $forum_id;
          $result = $db->sql_query($sql);
          $f_mark_time = (int) $db->sql_fetchfield('mark_time');
          $db->sql_freeresult($result);
       }
       else if ($config['load_anon_lastread'] || $user->data['is_registered'])
       {
          $f_mark_time = false;
       }

       if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered'])
       {
          // Update forum info
          $sql = 'SELECT forum_last_post_time
             FROM ' . FORUMS_TABLE . '
             WHERE forum_id = ' . $forum_id;
          $result = $db->sql_query($sql);
          $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
          $db->sql_freeresult($result);

          update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false);
       }

       add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);

       $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";

       return $url;
    }

Uživatelský avatar
Morgalt
Příspěvky: 26
Registrován: čtv 17. lis 2011 17:08:53

Re: 3.0.10 New post

Příspěvek od Morgalt » ned 08. led 2012 13:39:55

Děkuji, vyřešeno, funkční. :-)
Rok pruzení a tisíce otázek. Díky podpoře za neutuchající ochotu!

Zamčeno