• Rejestracja
vBHELP.pl - polskie wsparcie vBulletin
  1. #1
    grgr jest nieaktywny Początkujący
    Dołączył
    mar 2009
    Posty
    13

    Domyślnie przeróbka - Cyb - Top posters in X month

    Witam, potrzebuję pomocy w przerobieniu zapytania mysql, który ten skrypt wykonuje.
    Chce przerobić po prostu, aby skrypt nie zliczał ilości postów, a ilość utworzonych tematów, czyli tematów rozpoczętych przez osobę.

    tak wygląda część skryptu z tym zapytaniem
    Kod:
    			$cyb_tpim_get = $vbulletin->db->query_read("
    				SELECT COUNT(post.dateline) AS cybpcount, post.userid, user.username, user.usergroupid, post.visible, user.posts, user.joindate, thread.forumid
    				FROM " . TABLE_PREFIX . "post AS post
    				LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
    				LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
    				WHERE user.username != '' AND post.visible = '1' AND post.userid > 0 AND post.dateline > $fromtime AND post.dateline < $totime $cybtpimx_exclgroups $cybtpimx_exclusers $cybtpimx_exclforums 
    				GROUP BY userid
    				ORDER BY cybpcount DESC
    				LIMIT " . ($limitlower - 1) . ", $perpage
    			");
    a tu całość tego skryptu (jeśli okaże się przydatna)

    Kod:
    		if (($_REQUEST['do'] == 'cybtpimx') AND $vbulletin->options['cybtpimx_enable_product'] AND is_member_of($vbulletin->userinfo, split(',', $vbulletin->options['cybtpimx_allowed_groups'])))
    		{
    			$db->hide_errors();
    			global $vbulletin;
    			if ($vbulletin->options['cybtpimx_excl_groups']!='')
    			{
    				$cybtpimx_exclgids = ','.$vbulletin->options['cybtpimx_excl_groups'];
    			}			
    			$cybtpimx_exclgids = substr($cybtpimx_exclgids, 1);
    			if ($cybtpimx_exclgids!='')
    			{
    				$cybtpimx_exclgroups = "AND user.usergroupid NOT IN ($cybtpimx_exclgids)";
    			}	
    
    			if ($vbulletin->options['cybtpimx_excl_users']!='')
    			{
    				$cybtpimx_excluids = ','.$vbulletin->options['cybtpimx_excl_users'];
    			}			
    			$cybtpimx_excluids = substr($cybtpimx_excluids, 1);
    			if ($cybtpimx_excluids!='')
    			{
    				$cybtpimx_exclusers = "AND post.userid NOT IN ($cybtpimx_excluids)";
    			}	
    
    			if ($vbulletin->options['cybtpimx_excl_forums']!='')
    			{
    				$cybtpimx_exclfids = ','.$vbulletin->options['cybtpimx_excl_forums'];
    			}			
    			$cybtpimx_exclfids = substr($cybtpimx_exclfids, 1);
    			if ($cybtpimx_exclfids!='')
    			{
    				$cybtpimx_exclforums = "AND thread.forumid NOT IN ($cybtpimx_exclfids)";
    			}	
    
    			$reqmonth = $vbulletin->input->clean_gpc('r', 'm', TYPE_UINT);
    			$reqyear = $vbulletin->input->clean_gpc('r', 'y', TYPE_UINT);
    
    			if (!$reqmonth OR !$reqyear)
    			{
    				$reqmonth = $vbulletin->input->clean_gpc('p', 'm', TYPE_UINT);
    				$reqyear = $vbulletin->input->clean_gpc('p', 'y', TYPE_UINT);
    			}
    
    			if (!$reqmonth OR !$reqyear)
    			{
    				$reqmonth = ltrim(date('m'), '0');
    				$reqyear = ltrim(date('Y'), '0');
    			}
    
    			foreach (range($vbulletin->options['cybtpimx_start_year'], date('Y')) AS $cyb_year_option)
    			{
    				eval('$cyb_year_opts .= " <option value=\"'.$cyb_year_option.'\" " . iif($reqyear==$cyb_year_option," selected=\"selected\"","").">'.$cyb_year_option.'</option> ";');
    			}
    			$cyb_month_options = explode(',', '1,2,3,4,5,6,7,8,9,10,11,12,13');
    			foreach ($cyb_month_options AS $cyb_month_option)
    			{
    				if ($cyb_month_option=='13')
    				{
    					eval('$cyb_month_opts .= " <option value=\"'.$cyb_month_option.'\" " . iif($reqmonth==13," selected=\"selected\"","").">'.$vbphrase['cybtpimx_all'].'</option> ";');
    				}
    				else
    				{
    					eval('$cyb_month_opts .= " <option value=\"'.$cyb_month_option.'\" " . iif($reqmonth==$cyb_month_option," selected=\"selected\"","").">'.$cyb_month_option.'</option> ";');
    				}
    			}
    
    			$perpage = $vbulletin->options['cybtpimx_perpage'];
    			$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
    
    			if ($reqmonth=='13')
    			{
    				$fromtime = gmmktime(0,0,0,1,1,$reqyear);
    				$totime = gmmktime(0,0,0,1,1,$reqyear+1);
    				$cybtpimx_monthinfo = '';
    			}
    			else
    			{
    				$fromtime = gmmktime(0,0,0,$reqmonth,1,$reqyear);
    				$totime = gmmktime(0,0,0,$reqmonth+1,1,$reqyear);
    				$cybtpimx_monthinfo = $reqmonth.'-';
    			}
    
    			$cyb_tpim_totres = $vbulletin->db->query_read("
    				SELECT COUNT(post.dateline) AS cybpcount, post.userid, post.visible, post.dateline, thread.forumid, user.usergroupid, thread.forumid
    				FROM " . TABLE_PREFIX . "post AS post
    				LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
    				LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
    				WHERE user.username != '' AND post.visible = '1' AND post.userid > 0 AND post.dateline > $fromtime AND post.dateline < $totime $cybtpimx_exclgroups $cybtpimx_exclusers $cybtpimx_exclforums
    				GROUP BY userid
    			");
    			$cybtpimx_totres = $db->num_rows($cyb_tpim_totres);
    			sanitize_pageresults($cybtpimx_totres, $pagenumber, $perpage, 100, 25);
    			$limitlower = ($pagenumber - 1) * $perpage + 1;
    			$limitupper = $pagenumber * $perpage;
    			if ($limitupper > $cybtpimx_totres)
    			{
    				$limitupper = $cybtpimx_totres;
    				if ($limitlower > $cybtpimx_totres)
    				{
    					$limitlower = $cybtpimx_totres - $perpage;
    				}
    			}
    			if ($limitlower <= 0)
    			{
    				$limitlower = 1;
    			}
    
    			$cyb_tpim_get = $vbulletin->db->query_read("
    				SELECT COUNT(post.dateline) AS cybpcount, post.userid, user.username, user.usergroupid, post.visible, user.posts, user.joindate, thread.forumid
    				FROM " . TABLE_PREFIX . "post AS post
    				LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
    				LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
    				WHERE user.username != '' AND post.visible = '1' AND post.userid > 0 AND post.dateline > $fromtime AND post.dateline < $totime $cybtpimx_exclgroups $cybtpimx_exclusers $cybtpimx_exclforums 
    				GROUP BY userid
    				ORDER BY cybpcount DESC
    				LIMIT " . ($limitlower - 1) . ", $perpage
    			");
    			$nr = $limitlower-1;
    			while ($cyb_tpim = $db->fetch_array($cyb_tpim_get))
    			{
    				$nr += 1;
    				exec_switch_bg();
    				$cyb_tpim[musername] = fetch_musername($cyb_tpim);
    				$cyb_tpim_joindate = vbdate($vbulletin->options[dateformat], $cyb_tpim['joindate']);
    				eval('$cybtpimx_posters .= "' . $vbulletin->templatecache['cyb_top_posters_in_monthx_bit'] . '";');
    			}
    
    			$pagenav = construct_page_nav($pagenumber, $perpage, $cybtpimx_totres, 'misc.php?' . $vbulletin->session->vars['sessionurl'] . 'do=cybtpimx&m='.$reqmonth.'&y='.$reqyear, "");
    
    			eval('$cybtpimx .= "' . $vbulletin->templatecache['cyb_top_posters_in_monthx'] . '";');	
    
    			require_once('./global.php');
    			construct_forum_jump();
    			$navbits = construct_navbits(array('' => $vbphrase['cyb_topposters_stats']));
    			eval('$navbar = "' . fetch_template('navbar') . '";');	
    			eval('print_output("' . fetch_template('cyb_top_posters_in_monthx') . '");');
    			$db->show_errors();
    		}
    Proszę o pomoc.
    Ostatnio edytowane przez grgr ; 04.05.2009 o 14:48



Podobne wątki

  1. Top Posters of the Month
    By QusQ in forum Pytania i problemy
    Odpowiedzi: 1
    Ostatni post / autor: 01.09.2010, 09:57
  2. Top 5 Stats
    By day-dreamer in forum Pytania i problemy
    Odpowiedzi: 1
    Ostatni post / autor: 22.11.2009, 12:52
  3. Top Posters
    By Yaa in forum Pytania i problemy
    Odpowiedzi: 1
    Ostatni post / autor: 13.09.2009, 15:38
  4. problem z TOP 5
    By marmak29 in forum Pytania i problemy
    Odpowiedzi: 3
    Ostatni post / autor: 28.06.2009, 13:58
  5. Statystyki Top 5
    By mordziakx in forum Pytania i problemy
    Odpowiedzi: 12
    Ostatni post / autor: 17.04.2008, 21:01
Chmurka.pl

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