PHoto Album Next/Previous mod1520

Jeśli masz problem z nie autoryzowaną modyfikacją, nie możesz jej zainstalować lub występują błędy po jej instalacji to pisz w tym dziale.
buras
Posty: 8
Rejestracja: 23 maja 2005, 00:24

PHoto Album Next/Previous mod1520

Post autor: buras » 30 października 2008, 22:09

wszystko dziala pieknie w fotogalerii, gdzie rozrozniane sa categorie.
problem zaczyna sie w galeriach osobistych. tu galeria uzytkownika nie jest rozpoznawalna; czas upload'u jest decydujacy i wszystko znajduje sie w jednym koszu galerii osobisych.
jak temu zaradzic?

jedyna wzmianka to:

Kod: Zaznacz cały

$sql .= ($row['pic_cat_id'] == PERSONAL_GALLERY) ? " AND new.pic_user_id = cur.pic_user_id" : ""; 
ponizej:

Kod: Zaznacz cały

                $sql = "SELECT min(pic_id), max(pic_id)
                                FROM ". ALBUM_TABLE ."
								WHERE pic_cat_id = $cur_pic_cat"; 

                if( !($result = $db->sql_query($sql)) ) 
                { 
                        message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql); 
                } 

                $next = $db->sql_fetchrow($result);
				
				$first_pic = $next['min(pic_id)'];
				$last_pic = $next['max(pic_id)'];
				
				if( empty($row) AND ($HTTP_GET_VARS['mode'] == 'next')) 
                { 						  
				        redirect(append_sid("album_page.$phpEx?pic_id=$first_pic"));
			    } 
                if( empty($row) AND ($HTTP_GET_VARS['mode'] == 'previous')) 
                { 
                        redirect(append_sid("album_page.$phpEx?pic_id=$last_pic"));
                } 
						
                $pic_id = $row['pic_id']; // NEW pic_id 
	}
nie widze zadnego odnosnika do osobistych galerii.
co trzeba zrobic, zeby ten mod dzialal poprawnie w galeriach osobistych? czyli zeby 'next' lub 'previous' odnosilo sie do zdjecia (galerii) tego samego uzytkownika, a nie kolejnego...

calosc modifikacji:

Kod: Zaznacz cały

######################################################################################## 
## MOD Title: Smartor Album Add-On: Next/Previous Fix
## MOD Author: PenP
## MOD Description: 	This mod fixes the "next pic does not exsist" when you 
##			click "next" on the last picture in the current category.
##			With this mod you will be redirected to the "first" picture 
##			of the current category, when you click "next" on the 
##			last picture in the current category.
##			It will also redirected you to the "last" pic when you 
##			click previous on the first picture.
##              
## MOD Version: 1.0.0
##      
##          * NOTE: This mod only works for Smartor's excellent "Photo Album Addon v2" 
##            Download here - http://smartor.is-root.com/viewtopic.php?t=2473
##
##	Installation Level: easy 
## 	Installation Time: 3 Minutes
##	Files To Edit: 1
##	Included Files: album_page.php
##        
######################################################################################### 




# 
#-----[ OPEN ]------------------------------------------ 
# 

album_page.php

# 
#-----[ FIND ]------------------------------------------ 
# 

// ------------------------------------
// PREVIOUS & NEXT
// ------------------------------------

if( isset($HTTP_GET_VARS['mode']) )
{
	if( ($HTTP_GET_VARS['mode'] == 'next') or ($HTTP_GET_VARS['mode'] == 'previous') )
	{
		$sql = "SELECT pic_id, pic_cat_id, pic_user_id
				FROM ". ALBUM_TABLE ."
				WHERE pic_id = $pic_id";

		if( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql);
		}

		$row = $db->sql_fetchrow($result);

		if( empty($row) )
		{
			message_die(GENERAL_ERROR, 'Bad pic_id');
		}

		$sql = "SELECT new.pic_id, new.pic_time
				FROM ". ALBUM_TABLE ." AS new, ". ALBUM_TABLE ." AS cur
				WHERE cur.pic_id = $pic_id
					AND new.pic_id <> cur.pic_id
					AND new.pic_cat_id = cur.pic_cat_id";

		$sql .= ($HTTP_GET_VARS['mode'] == 'next') ? " AND new.pic_time >= cur.pic_time" : " AND new.pic_time <= cur.pic_time";

		$sql .= ($row['pic_cat_id'] == PERSONAL_GALLERY) ? " AND new.pic_user_id = cur.pic_user_id" : "";

		$sql .= ($HTTP_GET_VARS['mode'] == 'next') ? " ORDER BY pic_time ASC LIMIT 1" : " ORDER BY pic_time DESC LIMIT 1";

		if( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql);
		}

		$row = $db->sql_fetchrow($result);

		if( empty($row) )
		{
			message_die(GENERAL_ERROR, $lang['Pic_not_exist']);
		}

		$pic_id = $row['pic_id']; // NEW pic_id
	}
}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

// ------------------------------------ 
// PREVIOUS & NEXT 
// ------------------------------------ 

if( isset($HTTP_GET_VARS['mode']) ) 
{ 
        if( ($HTTP_GET_VARS['mode'] == 'next') or ($HTTP_GET_VARS['mode'] == 'previous') ) 
        { 
                $sql = "SELECT pic_id, pic_cat_id, pic_user_id 
                                FROM ". ALBUM_TABLE ." 
                                WHERE pic_id = $pic_id"; 

                if( !($result = $db->sql_query($sql)) ) 
                { 
                        message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql); 
                } 
		  
		        $row = $db->sql_fetchrow($result); 
				$cur_pic_cat = $row['pic_cat_id'];

                if( empty($row) ) 
                { 
                        message_die(GENERAL_ERROR, 'Bad pic_id'); 
                } 

                $sql = "SELECT new.pic_id, new.pic_time 
                                FROM ". ALBUM_TABLE ." AS new, ". ALBUM_TABLE ." AS cur 
                                WHERE cur.pic_id = $pic_id 
                                        AND new.pic_id <> cur.pic_id 
                                        AND new.pic_cat_id = cur.pic_cat_id"; 

                $sql .= ($HTTP_GET_VARS['mode'] == 'next') ? " AND new.pic_time >= cur.pic_time" : " AND new.pic_time <= cur.pic_time"; 

                $sql .= ($row['pic_cat_id'] == PERSONAL_GALLERY) ? " AND new.pic_user_id = cur.pic_user_id" : ""; 

                $sql .= ($HTTP_GET_VARS['mode'] == 'next') ? " ORDER BY pic_time ASC LIMIT 1" : " ORDER BY pic_time DESC LIMIT 1"; 

                if( !($result = $db->sql_query($sql)) ) 
                { 
                        message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql); 
                } 

                $row = $db->sql_fetchrow($result); 

                $sql = "SELECT min(pic_id), max(pic_id)
                                FROM ". ALBUM_TABLE ."
								WHERE pic_cat_id = $cur_pic_cat"; 

                if( !($result = $db->sql_query($sql)) ) 
                { 
                        message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql); 
                } 

                $next = $db->sql_fetchrow($result);
				
				$first_pic = $next['min(pic_id)'];
				$last_pic = $next['max(pic_id)'];
				
				if( empty($row) AND ($HTTP_GET_VARS['mode'] == 'next')) 
                { 						  
				        redirect(append_sid("album_page.$phpEx?pic_id=$first_pic"));
			    } 
                if( empty($row) AND ($HTTP_GET_VARS['mode'] == 'previous')) 
                { 
                        redirect(append_sid("album_page.$phpEx?pic_id=$last_pic"));
                } 
						
                $pic_id = $row['pic_id']; // NEW pic_id 
        } 
}


# 
#-----[ SAVE/CLOSE THE FILE ]------------------------------------------ 
# 
# End

Zablokowany

Wróć do „Pomoc”