Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/11/2006, 21:52
Avatar de AJVEvoluzione
AJVEvoluzione
 
Fecha de Ingreso: agosto-2004
Ubicación: Buenos Aires
Mensajes: 195
Antigüedad: 19 años, 8 meses
Puntos: 1
Y sigue aca:

Código PHP:
   // Create the absolute URL for display in info

    
$info[$lang_picinfo['URL']] = '<a href="' $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' '' '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" '" >' $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' '' '/') . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" '</a>';

    
// with subdomains the variable is $_SERVER["SERVER_NAME"] does not return the right value instead of using a new config variable I reused $CONFIG["ecards_more_pic_target"] no trailing slash in the configure

    // Create the add to fav link

    
$ref $REFERER "&amp;ref=$REFERER" '';

    if (!
in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {

        
$info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" $CURRENT_PIC_DATA['pid'] . $ref "\" >" $lang_picinfo['addFav'] . '</a>';

    } else {

        
$info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" $CURRENT_PIC_DATA['pid']  . $ref "\" >" $lang_picinfo['remFav'] . '</a>';

    }



    
/**

     * Filter file information

     */

    
$info CPGPluginAPI::filter('file_info',$info);



    return 
theme_html_picinfo($info);

}



function 
get_subcat_data($parent$level)

{

    global 
$CONFIG$ALBUM_SET_ARRAY;



    
$result cpg_db_query("SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '$parent'");

    if (
mysql_num_rows($result) > 0) {

        
$rowset cpg_db_fetch_rowset($result);

        foreach (
$rowset as $subcat) {

            
$result cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$subcat['cid']}");

            
$album_count mysql_num_rows($result);

            while (
$row mysql_fetch_array($result)) {

                
$ALBUM_SET_ARRAY[] = $row['aid'];

            } 
// while

        
}

        if (
$level 1get_subcat_data($subcat['cid'], $level -1);

    }

}



/**

 * Main code

 */



$pos = isset($_GET['pos']) ? (int)$_GET['pos'] : 0;



/**

 * Hack added by tarique to prevent incorrect picture being seen on last view or last uploaded

 */



$pid = isset($_GET['pid']) ? (int)$_GET['pid'] : 0;



$cat = isset($_GET['cat']) ? (int)$_GET['cat'] : 0;

$album = isset($_GET['album']) ? $_GET['album'] : '';

// Build the album set if required

/*

//disabled by donnoman

if (!is_numeric($album) && $cat) { // Meta albums, we need to restrict the albums to the current category

    if ($cat < 0) {

        $ALBUM_SET .= 'AND aid IN (' . (- $cat) . ') ';

    } else {

        $ALBUM_SET_ARRAY = array();

        if ($cat == USER_GAL_CAT)

            $where = 'category > ' . FIRST_USER_CAT;

        else

            $where = "category = '$cat'";



        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE $where");

        while ($row = mysql_fetch_array($result)) {

            $ALBUM_SET_ARRAY[] = $row['aid'];

        } // while

        get_subcat_data($cat, $CONFIG['subcat_level']);

        // Treat the album set

        if (count($ALBUM_SET_ARRAY)) {

            $set = '';

            foreach ($ALBUM_SET_ARRAY as $album_id) $set .= ($set == '') ? $album_id : ',' . $album_id;

            $ALBUM_SET .= "AND aid IN ($set) ";

        }

    }

}

//disabled by donnoman

*/

//get_meta_album_set in functions.inc.php will populate the $ALBUM_SET instead; matches $META_ALBUM_SET.

get_meta_album_set($cat,$ALBUM_SET);

$META_ALBUM_SET $ALBUM_SET//displayimage uses $ALBUM_SET but get_pic_data in functions now uses $META_ALBUM_SET



//attempt to fix topn images for keyworded albums

if ($cat 0) {

    
$result cpg_db_query("SELECT category, title, aid, keyword, description, alb_password_hint FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='" . (- $cat) . "'");

    if (
mysql_num_rows($result) > 0) {

        
$CURRENT_ALBUM_DATA mysql_fetch_array($result);

        
$CURRENT_ALBUM_KEYWORD $CURRENT_ALBUM_DATA['keyword'];

    }

}

// Retrieve data for the current picture

if ($pos || $pid 0) {

    
$pid = ($pos 0) ? -$pos $pid;

    
$result cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1");

    if (
mysql_num_rows($result) == 0cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);

    
$row mysql_fetch_array($result);

    
$album $row['aid'];

    
$pic_data get_pic_data($album$pic_count$album_name, -1, -1false);

    for(
$pos 0$pic_data[$pos]['pid'] != $pid && $pos $pic_count$pos++);

    
$pic_data get_pic_data($album$pic_count$album_name$pos1false);

    
$CURRENT_PIC_DATA $pic_data[0];



} elseif (isset(
$_GET['pos'])) {

    
$pic_data get_pic_data($album$pic_count$album_name$pos1false);

    if (
$pic_count == 0) {

        
cpg_die(INFORMATION$lang_errors['no_img_to_display'], __FILE____LINE__);

    } elseif (
count($pic_data) == && $pos >= $pic_count) {

        
$pos $pic_count 1;

        
$human_pos $pos 1;

        
$pic_data get_pic_data($album$pic_count$album_name$pos1false);

    }

    
$CURRENT_PIC_DATA $pic_data[0];

}



// Retrieve data for the current album

if (isset($CURRENT_PIC_DATA)) {

    
$result cpg_db_query("SELECT title, comments, votes, category, aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='{$CURRENT_PIC_DATA['aid']}' LIMIT 1");

    if (!
mysql_num_rows($result)) cpg_die(CRITICAL_ERRORsprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE____LINE__);

    
$CURRENT_ALBUM_DATA mysql_fetch_array($result);



    if (
is_numeric($album)) {

        
$cat = - $album;

        
$actual_cat $CURRENT_ALBUM_DATA['category'];

        
breadcrumb($actual_cat$breadcrumb$breadcrumb_text);

        
$cat = - $album;

    } else {

        
$actual_cat $CURRENT_ALBUM_DATA['category'];

        
breadcrumb($actual_cat$breadcrumb$breadcrumb_text);

    }

}



if (isset(
$_GET['fullsize'])) {

    
theme_display_fullsize_pic();

    
ob_end_flush();

} elseif (isset(
$_GET['slideshow'])) {

    
theme_slideshow();

    
ob_end_flush();

} else {

    if (!isset(
$_GET['pos'])) cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);

    
$picture_title $CURRENT_PIC_DATA['title'] ? $CURRENT_PIC_DATA['title'] : strtr(preg_replace("/(.+)\..*?\Z/""\\1"htmlspecialchars($CURRENT_PIC_DATA['filename'])), "_"" ");



    
$nav_menu theme_html_img_nav_menu();

    
$picture theme_html_picture();

    
$votes theme_html_rating_box();

    
$pic_info html_picinfo();

    
$comments theme_html_comments($CURRENT_PIC_DATA['pid']);

    if (
$CURRENT_PIC_DATA['keywords']) { $meta_keywords "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }

        
//$meta_nav .= "<link rel=\"alternate\" type=\"text/xml\" title=\"RSS feed\" href=\"rss.php\" />

       // ";

        
$meta_keywords .= $meta_nav;

    
pageheader($album_name '/' $picture_title$meta_keywordsfalse);

    
// Display Breadcrumbs

    
if ($breadcrumb && !(strpos($CONFIG['main_page_layout'],"breadcrumb")===false)) {

        
theme_display_breadcrumb($breadcrumb$cat_data);

    }

    
// Display Filmstrip if the album is not search

    
if ($album != 'search') {

        
$film_strip display_film_strip($album, (isset($cat) ? $cat 0), $postrue);

    }

    
CPGPluginAPI::filter('post_breadcrumb',null);

    
theme_display_image($nav_menu$picture$votes$pic_info$comments$film_strip);

    
pagefooter();

    
ob_end_flush();

}

?>