Ajutor modificare top_five.php

Discuţii legate de instalarea şi funcţionarea unor MODificări vechi sau noi ale forumului phpBB 3.0.x.
Reguli forum
Aveti o problema si vreti sa primiti ajutor? Click aici ! Nu uitati si de regulamentul forumului !
Închis
Gorkem
Utilizator înregistrat
Mesaje: 38
Membru din: 05-Noi-2014, 19:41:03
Versiune: 3.0.13-PL1
Ext: Da
Server: Windows
Nivel phpBB: Mediu
Nivel php: Neexperimentat
Localitate: Bucuresti
Contact:

Ajutor modificare top_five.php

Mesaj de Gorkem »

URL forum: http://gerrax.ro/forum/
Versiunea phpbb 3: 3.0.14
Daca forumul a fost instalat recent sau reprezinta un update/upgrade/conversie? Nu
Ati folosit un wizard de instalare furnizat de firma de gazduire pentru instalare? Nu
MODurile instalate: Top Five, List subforums in columns, AJAX Chat, Very Simple Guest Hide BBCode MOD, Welcome PM on first Login (WPM), Activity Stats MOD.
De cand a aparut problema semnalata? Nu este o problemă.
Nivelul vostru de experienta in instalarea/utilizarea/administrarea phpbb (fiti sinceri, raspunsul ar putea fi formulat pe intelesul vostru daca sunteti la inceput). Începător/Mediu.

Salutare, vreau să modific în top_five.php porțiunea asta de aici:

Cod: Selectaţi tot

	$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 5);
	$is_row = false;
    while( $row = $db->sql_fetchrow($result) )
    {
		$is_row = true;
		$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
		$topic_title = censor_text($row['topic_title']);
		$is_guest = $row['user_id'] != ANONYMOUS ? false : true;
			
       	$template->assign_block_vars('top_five_topic',array(
       		'U_TOPIC' 		=> $view_topic_url,
       		'USERNAME_FULL'	=> $is_guest ? $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
			'LAST_TOPIC_TIME'	=> $user->format_date($row['topic_last_post_time']),
       		'TOPIC_TITLE' 	=> $user->lang['IN'] . ' ' . $topic_title));
    }
De ce vreau să modific?
- Mi-am făcut eu un TOP 5 STATS mai personalizat să zicem, și vreau să pun un mesaj gen "Subiectul X a fost postat de Y la ORA și DATA XY" și nu știu cum să fac asta.. mi-e îmi apare așa "Subiectul In Welcome to phpBB3 a fost postat de membrul by: localhost"
Avatar utilizator
Anișor
AdministratorAdministrator
Mesaje: 2987
Membru din: 08-Aug-2012, 20:46:05
Versiune: 4.0.0-a1
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Experimentat
Nivel php: Mediu
Localitate: Arbroath, Angus
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Anișor »

Lasa sablonul de la top five aici.
Nu ofer ajutor prin intermediul mesageriei private.
Vă rog să postați toate problemele în forumuri.
Gorkem
Utilizator înregistrat
Mesaje: 38
Membru din: 05-Noi-2014, 19:41:03
Versiune: 3.0.13-PL1
Ext: Da
Server: Windows
Nivel phpBB: Mediu
Nivel php: Neexperimentat
Localitate: Bucuresti
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Gorkem »

Cod: Selectaţi tot

<?php
/**
*
* @package phpBB3
* @version $Id:
* @copyright (c) 2010 Rich McGirr
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

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

/**
* Include only once.
*/
if (!defined('INCLUDES_TOP_FIVE_PHP'))
{
	define('INCLUDES_TOP_FIVE_PHP', true);
	
	global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template;

    $user->add_lang('mods/top_five');

	// grab auths that allow a user to read a forum
	$forum_array = array_unique(array_keys($auth->acl_getf('!f_read', true)));

	// we have auths, change the sql query below
	$sql_and = '';
	if (sizeof($forum_array))
	{
		$sql_and = ' AND ' . $db->sql_in_set('t.forum_id', $forum_array, true);
	}
	// grab all posts that meet criteria and auths
	$sql_ary = array(
		'SELECT'	=> 'u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name',
		'FROM'		=> array(TOPICS_TABLE => 't'),
		'LEFT_JOIN'	=> array(
			array(
				'FROM'	=> array(USERS_TABLE => 'u'),
				'ON'	=> 't.topic_last_poster_id = u.user_id',
   			),
		),
		'WHERE'		=> 't.topic_approved = 1 AND t.topic_status <> ' . ITEM_MOVED . ' ' . $sql_and,
		'ORDER_BY'	=> 't.topic_last_post_time DESC',
	);

	$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 5);
	$is_row = false;
    while( $row = $db->sql_fetchrow($result) )
    {
		$is_row = true;
		$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
		$topic_title = censor_text($row['topic_title']);
		$is_guest = $row['user_id'] != ANONYMOUS ? false : true;
			
       	$template->assign_block_vars('top_five_topic',array(
       		'U_TOPIC' 		=> $view_topic_url,
       		'USERNAME_FULL'	=> $is_guest ? $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
			'LAST_TOPIC_TIME'	=> $user->format_date($row['topic_last_post_time']),
       		'TOPIC_TITLE' 	=> $user->lang['IN'] . ' ' . $topic_title));
    }

    $db->sql_freeresult($result);

	// if user doesn't have permission to read any forums, show a message
	if (!$is_row)
	{
		$template->assign_block_vars('top_five_topic', array(
			'NO_TOPIC_TITLE'	=> $user->lang['NO_TOPIC_EXIST'],
		));
	}
	// top five posters
	// an array of user types we dont' bother with
	// could add board founder (USER_FOUNDER) if wanted
	$ignore_users = array(USER_IGNORE, USER_INACTIVE);
	
	if (($user_posts = $cache->get('_top_five_posters')) === false)
	{
	    $user_posts = array();

		// grab users with most posts
	    $sql = 'SELECT user_id, username, user_colour, user_posts
	       	FROM ' . USERS_TABLE . '
			WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
				AND user_posts <> 0
	       ORDER BY user_posts DESC';
		$result = $db->sql_query_limit($sql, 5);

		while ($row = $db->sql_fetchrow($result))
		{
			$user_posts[$row['user_id']] = array(
				'user_id'		=> $row['user_id'],
                'username'		=> $row['username'],
                'user_colour'	=> $row['user_colour'],
				'user_posts'    => $row['user_posts'],
			);
		}
        $db->sql_freeresult($result);

		// cache this data for five minutes, this improves performance
		$cache->put('_top_five_posters', $user_posts, 300);
	}

	foreach ($user_posts as $row)
	{
		$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		$template->assign_block_vars('top_five_active',array(
			'S_SEARCH_ACTION'	=> append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
			'POSTS' 			=> $row['user_posts'],
			'USERNAME_FULL'		=> $username_string)
		);
    }

    // newest registered users
	if (($newest_users = $cache->get('_top_five_newest_users')) === false)
	{
	    $newest_users = array();

	    // grab most recent registered users
		$sql = 'SELECT user_id, username, user_colour, user_regdate
			FROM ' . USERS_TABLE . '
			WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
				AND user_inactive_reason = 0
			ORDER BY user_regdate DESC';
		$result = $db->sql_query_limit($sql, 5);

		while ($row = $db->sql_fetchrow($result))
		{
			$newest_users[$row['user_id']] = array(
				'user_id'				=> $row['user_id'],
				'username'				=> $row['username'],
     			'user_colour'			=> $row['user_colour'],
                'user_regdate'			=> $row['user_regdate'],
			);
		}
	    $db->sql_freeresult($result);

		// cache this data for ever, cache is purged when adding or deleting users
		$cache->put('_top_five_newest_users', $newest_users);
	}

	foreach ($newest_users as $row)
	{
		$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		$template->assign_block_vars('top_five_newest',array(
			'REG_DATE'			=> $user->format_date($row['user_regdate']),
			'USERNAME_FULL'		=> $username_string)
		);
	}
}
?>
Avatar utilizator
Anișor
AdministratorAdministrator
Mesaje: 2987
Membru din: 08-Aug-2012, 20:46:05
Versiune: 4.0.0-a1
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Experimentat
Nivel php: Mediu
Localitate: Arbroath, Angus
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Anișor »

top_five_body.html
Nu ofer ajutor prin intermediul mesageriei private.
Vă rog să postați toate problemele în forumuri.
Gorkem
Utilizator înregistrat
Mesaje: 38
Membru din: 05-Noi-2014, 19:41:03
Versiune: 3.0.13-PL1
Ext: Da
Server: Windows
Nivel phpBB: Mediu
Nivel php: Neexperimentat
Localitate: Bucuresti
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Gorkem »

și mai e o problemă la el, apare așa: http://prntscr.com/7bquj9

Cod: Selectaţi tot

<br />
<table class="tablebg" width="100%" cellspacing="0">
<tr>
<td width="33%">{$CA_CAP2_START}Subiecte noi{$CA_CAP2_END}</td>
<td width="33%">{$CA_CAP2_START}Utilizatori activi{$CA_CAP2_END}</td>
<td width="33%">{$CA_CAP2_START}Utilizatori noi{$CA_CAP2_END}</td>
</tr>

<tr>
<td class="row1" valign="top"><!-- BEGIN top_five_topic --><span class="genmed">• Subiectul <a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a> a fost postat de membrul {top_five_topic.USERNAME_FULL}</span><br /><!-- END top_five_topic --></td>
<td class="row1" valign="top"><!-- BEGIN top_five_active --><span class="genmed">• Membrul {top_five_active.USERNAME_FULL} este în topul utilizatorilor activi cu <b><a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a></b> posturi.<br /><!-- END top_five_active --></td>
<td class="row1" valign="top"><!-- BEGIN top_five_newest --><span class="genmed">• Membrul {top_five_newest.USERNAME_FULL} s-a înregistrat pe data: {top_five_newest.REG_DATE}.</span><br /><!-- END top_five_newest --></td>
</tr>
</table>
Avatar utilizator
Anișor
AdministratorAdministrator
Mesaje: 2987
Membru din: 08-Aug-2012, 20:46:05
Versiune: 4.0.0-a1
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Experimentat
Nivel php: Mediu
Localitate: Arbroath, Angus
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Anișor »

Top_five_body.html

Cod: Selectaţi tot

    <br />
    <table class="tablebg" width="100%" cellspacing="0">
    <tr>
    <td width="33%">{$CA_CAP2_START}Subiecte noi{$CA_CAP2_END}</td>
    <td width="33%">{$CA_CAP2_START}Utilizatori activi{$CA_CAP2_END}</td>
    <td width="33%">{$CA_CAP2_START}Utilizatori noi{$CA_CAP2_END}</td>
    </tr>

    <tr>
    <td class="row1" valign="top"><!-- BEGIN top_five_topic --><span class="genmed">• Subiectul <a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a> a fost postat de membrul {top_five_topic.USERNAME_FULL} la ora {top_five_topic.ORA} in data de {top_five_topic.DATA}.</span><br /><!-- END top_five_topic --></td>
    <td class="row1" valign="top"><!-- BEGIN top_five_active --><span class="genmed">• Membrul {top_five_active.USERNAME_FULL} este în topul utilizatorilor activi cu <b><a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a></b> posturi.</span><br /><!-- END top_five_active --></td>
    <td class="row1" valign="top"><!-- BEGIN top_five_newest --><span class="genmed">• Membrul {top_five_newest.USERNAME_FULL} s-a înregistrat pe data: {top_five_newest.REG_DATE}.</span><br /><!-- END top_five_newest --></td>
    </tr>
    </table> 
includes/top_five.php

Cod: Selectaţi tot

<?php
/**
*
* @package phpBB3
* @version $Id:
* @copyright (c) 2010 Rich McGirr
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

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

/**
* Include only once.
*/
if (!defined('INCLUDES_TOP_FIVE_PHP'))
{
   define('INCLUDES_TOP_FIVE_PHP', true);
   
   global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template;

    $user->add_lang('mods/top_five');

   // grab auths that allow a user to read a forum
   $forum_array = array_unique(array_keys($auth->acl_getf('!f_read', true)));

   // we have auths, change the sql query below
   $sql_and = '';
   if (sizeof($forum_array))
   {
      $sql_and = ' AND ' . $db->sql_in_set('t.forum_id', $forum_array, true);
   }
   // grab all posts that meet criteria and auths
   $sql_ary = array(
      'SELECT'   => 'u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name',
      'FROM'      => array(TOPICS_TABLE => 't'),
      'LEFT_JOIN'   => array(
         array(
            'FROM'   => array(USERS_TABLE => 'u'),
            'ON'   => 't.topic_last_poster_id = u.user_id',
            ),
      ),
      'WHERE'      => 't.topic_approved = 1 AND t.topic_status <> ' . ITEM_MOVED . ' ' . $sql_and,
      'ORDER_BY'   => 't.topic_last_post_time DESC',
   );

   $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 5);
   $is_row = false;
    while( $row = $db->sql_fetchrow($result) )
    {
      $is_row = true;
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
      $topic_title = censor_text($row['topic_title']);
      $is_guest = $row['user_id'] != ANONYMOUS ? false : true;
         
          $template->assign_block_vars('top_five_topic',array(
             'U_TOPIC'       => $view_topic_url,
             'USERNAME_FULL'   => $is_guest ? $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
			 'DATA'   => $user->format_date($row['topic_last_post_time'], 'd M Y'),
			 'ORA'   => $user->format_date($row['topic_last_post_time'], 'H:i'),
             'TOPIC_TITLE'    => $user->lang['IN'] . ' ' . $topic_title));
    }

    $db->sql_freeresult($result);

   // if user doesn't have permission to read any forums, show a message
   if (!$is_row)
   {
      $template->assign_block_vars('top_five_topic', array(
         'NO_TOPIC_TITLE'   => $user->lang['NO_TOPIC_EXIST'],
      ));
   }
   // top five posters
   // an array of user types we dont' bother with
   // could add board founder (USER_FOUNDER) if wanted
   $ignore_users = array(USER_IGNORE, USER_INACTIVE);
   
   if (($user_posts = $cache->get('_top_five_posters')) === false)
   {
       $user_posts = array();

      // grab users with most posts
       $sql = 'SELECT user_id, username, user_colour, user_posts
             FROM ' . USERS_TABLE . '
         WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
            AND user_posts <> 0
          ORDER BY user_posts DESC';
      $result = $db->sql_query_limit($sql, 5);

      while ($row = $db->sql_fetchrow($result))
      {
         $user_posts[$row['user_id']] = array(
            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_posts'    => $row['user_posts'],
         );
      }
        $db->sql_freeresult($result);

      // cache this data for five minutes, this improves performance
      $cache->put('_top_five_posters', $user_posts, 300);
   }

   foreach ($user_posts as $row)
   {
      $username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      $template->assign_block_vars('top_five_active',array(
         'S_SEARCH_ACTION'   => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
         'POSTS'          => $row['user_posts'],
         'USERNAME_FULL'      => $username_string)
      );
    }

    // newest registered users
   if (($newest_users = $cache->get('_top_five_newest_users')) === false)
   {
       $newest_users = array();

       // grab most recent registered users
      $sql = 'SELECT user_id, username, user_colour, user_regdate
         FROM ' . USERS_TABLE . '
         WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
            AND user_inactive_reason = 0
         ORDER BY user_regdate DESC';
      $result = $db->sql_query_limit($sql, 5);

      while ($row = $db->sql_fetchrow($result))
      {
         $newest_users[$row['user_id']] = array(
            'user_id'            => $row['user_id'],
            'username'            => $row['username'],
              'user_colour'         => $row['user_colour'],
                'user_regdate'         => $row['user_regdate'],
         );
      }
       $db->sql_freeresult($result);

      // cache this data for ever, cache is purged when adding or deleting users
      $cache->put('_top_five_newest_users', $newest_users);
   }

   foreach ($newest_users as $row)
   {
      $username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

      $template->assign_block_vars('top_five_newest',array(
         'REG_DATE'         => $user->format_date($row['user_regdate']),
         'USERNAME_FULL'      => $username_string)
      );
   }
}
?>
Nu ofer ajutor prin intermediul mesageriei private.
Vă rog să postați toate problemele în forumuri.
Gorkem
Utilizator înregistrat
Mesaje: 38
Membru din: 05-Noi-2014, 19:41:03
Versiune: 3.0.13-PL1
Ext: Da
Server: Windows
Nivel phpBB: Mediu
Nivel php: Neexperimentat
Localitate: Bucuresti
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Gorkem »

Salut, mersi de răspuns Ragnar Lodbrok!

- Dar eu am vrut să elimin "IN" de la "In [prezentare] wtf kenzor" și "BY" de la "de membrul by: ๖ۣۣۜGorkem"

Și celelalte sunt bune așa cu ora etc.. mersi.

Te-aș ruga după să ștergi, după ce mă ajuți pentru a nu lua alții... mersi.
Gorkem
Utilizator înregistrat
Mesaje: 38
Membru din: 05-Noi-2014, 19:41:03
Versiune: 3.0.13-PL1
Ext: Da
Server: Windows
Nivel phpBB: Mediu
Nivel php: Neexperimentat
Localitate: Bucuresti
Contact:

Re: Ajutor modificare top_five.php

Mesaj de Gorkem »

UP?
Închis

Înapoi la “3.0.x Suport pentru MODificări”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 9 vizitatori