Top5 in topten

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
L3uTzu
Utilizator înregistrat
Mesaje: 80
Membru din: 26-Dec-2009, 16:57:28
Versiune: 3.0.6
Ext: Nu
Server: Windows
Nivel phpBB: Puţin experimentat
Contact:

Top5 in topten

Mesaj de L3uTzu »

Am facut in sfarsit modul top5 ...dar vreau sa il transform in topten si numai reusesc...ma puteti ajuta ? :)
Am nevoie de cativa oameni pentru staff care sa se ocupe de comunitatea FatalCS !

Ma puteti contacta la adresa de Y!M: fatal_leutzu@yahoo.it
Avatar utilizator
Gotyc
Utilizator înregistrat
Mesaje: 518
Membru din: 20-Iun-2009, 02:10:00
Versiune: 3.1.x
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: iasi
Contact:

Re: Top5 in topten

Mesaj de Gotyc »

posteaza aici top_five din includes
L3uTzu
Utilizator înregistrat
Mesaje: 80
Membru din: 26-Dec-2009, 16:57:28
Versiune: 3.0.6
Ext: Nu
Server: Windows
Nivel phpBB: Puţin experimentat
Contact:

Re: Top5 in topten

Mesaj de L3uTzu »

Cod: Selectaţi tot

<?php
/**
*
* @package phpBB3
* @version $Id: top_five.php,v 1.0.5 2009/08/17 06:20:00 EST rmcgirr83 Exp $
* @copyright (c) 2009 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, $config, $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('p.forum_id', $forum_array, true);
	}

	// grab all posts that meet criteria and auths
	$sql_ary = array(
		'SELECT'	=> 'MAX(p.post_time) as post_time, u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id',
		'FROM'		=> array(TOPICS_TABLE => 't', POSTS_TABLE => 'p'),
		'LEFT_JOIN'	=> array(
			array(
				'FROM'	=> array(USERS_TABLE => 'u'),
				'ON'	=> 'p.poster_id = u.user_id',
   			),
		),
		'WHERE'		=> 'p.topic_id = t.topic_id
			   AND p.post_approved = 1
			   AND t.topic_moved_id = 0' . $sql_and,
		'GROUP_BY'	=> 't.topic_id',
		'ORDER_BY'	=> 'post_time DESC',
	);

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

    while( $row = $db->sql_fetchrow($result) )
    {
   
		$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']);

       	$template->assign_block_vars('top_five_topic',array(
       		'U_TOPIC' 		=> $view_topic_url,
       		'USERNAME_FULL'	=> $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
       		'TOPIC_TITLE' 	=> $user->lang['IN'] . ' ' . $topic_title));
    }

    $db->sql_freeresult($result);

	// an array of user types we dont' bother with
	// could add board founder (USER_FOUNDER) if wanted
	$ignore_users = array(USER_IGNORE, USER_INACTIVE);
	
	// top five posters
	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 5 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 5 minutes, this improves performance
		$cache->put('_top_five_newest_users', $newest_users, 300);
	 }

	 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)
	   );
    }
}
?>
Am nevoie de cativa oameni pentru staff care sa se ocupe de comunitatea FatalCS !

Ma puteti contacta la adresa de Y!M: fatal_leutzu@yahoo.it
Avatar utilizator
bogdan
AdministratorAdministrator
Mesaje: 10888
Membru din: 18-Oct-2002, 13:14:27
Versiune: 3.0.11
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Experimentat
Nivel php: Mediu
Localitate: Bucuresti
Contact:

Re: Top5 in topten

Mesaj de bogdan »

Parca l-ai facut... ai uitat asa repede cum trebuie procedat?

viewtopic.php?f=47&t=16184&p=114696#p114696
L3uTzu
Utilizator înregistrat
Mesaje: 80
Membru din: 26-Dec-2009, 16:57:28
Versiune: 3.0.6
Ext: Nu
Server: Windows
Nivel phpBB: Puţin experimentat
Contact:

Re: Top5 in topten

Mesaj de L3uTzu »

bogdan scrie:Parca l-ai facut... ai uitat asa repede cum trebuie procedat?

viewtopic.php?f=47&t=16184&p=114696#p114696
Am facut dar :-?? vad ca nu merge :) astept raspunsul lu Gotyc
Am nevoie de cativa oameni pentru staff care sa se ocupe de comunitatea FatalCS !

Ma puteti contacta la adresa de Y!M: fatal_leutzu@yahoo.it
Avatar utilizator
Gotyc
Utilizator înregistrat
Mesaje: 518
Membru din: 20-Iun-2009, 02:10:00
Versiune: 3.1.x
Ext: Da
Server: UNIX/Linux
Nivel phpBB: Mediu
Nivel php: Mediu
Localitate: iasi
Contact:

Re: Top5 in topten

Mesaj de Gotyc »

Poftim .

Cod: Selectaţi tot

     <?php
    /**
    *
    * @package phpBB3
    * @version $Id: top_five.php,v 1.0.5 2009/08/17 06:20:00 EST rmcgirr83 Exp $
    * @copyright (c) 2009 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, $config, $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('p.forum_id', $forum_array, true);
       }

       // grab all posts that meet criteria and auths
       $sql_ary = array(
          'SELECT'   => 'MAX(p.post_time) as post_time, u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id',
          'FROM'      => array(TOPICS_TABLE => 't', POSTS_TABLE => 'p'),
          'LEFT_JOIN'   => array(
             array(
                'FROM'   => array(USERS_TABLE => 'u'),
                'ON'   => 'p.poster_id = u.user_id',
                ),
          ),
          'WHERE'      => 'p.topic_id = t.topic_id
                AND p.post_approved = 1
                AND t.topic_moved_id = 0' . $sql_and,
          'GROUP_BY'   => 't.topic_id',
          'ORDER_BY'   => 'post_time DESC',
       );

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

        while( $row = $db->sql_fetchrow($result) )
        {
       
          $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']);

              $template->assign_block_vars('top_five_topic',array(
                 'U_TOPIC'       => $view_topic_url,
                 'USERNAME_FULL'   => $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
                 'TOPIC_TITLE'    => $user->lang['IN'] . ' ' . $topic_title));
        }

        $db->sql_freeresult($result);

       // an array of user types we dont' bother with
       // could add board founder (USER_FOUNDER) if wanted
       $ignore_users = array(USER_IGNORE, USER_INACTIVE);
       
       // top five posters
       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, 10);

          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 5 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, 10);

          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 5 minutes, this improves performance
          $cache->put('_top_five_newest_users', $newest_users, 300);
        }

        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)
          );
        }
    }
    ?>
L3uTzu
Utilizator înregistrat
Mesaje: 80
Membru din: 26-Dec-2009, 16:57:28
Versiune: 3.0.6
Ext: Nu
Server: Windows
Nivel phpBB: Puţin experimentat
Contact:

Re: Top5 in topten

Mesaj de L3uTzu »

Am pus dar acum imi da altfel tip de eroare iaute :( ...2 erori

Imagine

Imagine
Am nevoie de cativa oameni pentru staff care sa se ocupe de comunitatea FatalCS !

Ma puteti contacta la adresa de Y!M: fatal_leutzu@yahoo.it
Închis

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

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 1 vizitator