function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs) { global $CONFIG, $AUTHORIZED, $HTTP_GET_VARS; global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units; $thumb_per_page = $thumbcols * $thumbrows; $lower_limit = ($page - 1) * $thumb_per_page; $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page); $total_pages = ceil($thumb_count / $thumb_per_page); $i = 0; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $i++; $pic_title = $lang_display_thumbnails['filename'] . $row['filename'] . "\n" . $lang_display_thumbnails['filesize'] . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt); $pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = getimagesize($pic_url); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit; $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\">"; $thumb_list[$i]['caption'] = $row['caption_text']; $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['aid'] = $row['aid']; } theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs); } else { theme_no_img_to_display($album_name); } }
/** * list_users() * * Get a list of users galleries */ function list_users() { global $CONFIG, $PAGE; global $lang_list_users, $template_user_list_info_box, $cpg_udb; $user_count = 0; $rowset = $cpg_udb->list_users_query($user_count); if (!$rowset) { msg_box($lang_list_users['user_list'], $lang_list_users['no_user_gal'], '', '', 'info'); return; } $user_per_page = $CONFIG['thumbcols'] * $CONFIG['thumbrows']; $totalPages = ceil($user_count / $user_per_page); $user_list = array(); foreach ($rowset as $user) { $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $user['user_id']); $user_thumb = '<img src="' . $cpg_nopic_data['thumb'] . '" ' . $cpg_nopic_data['whole'] . ' class="image thumbnail" border="0" alt="" />'; $user_pic_count = $user['pic_count']; $user_thumb_pid = $user['gallery_pid'] ? $user['gallery_pid'] : $user['thumb_pid']; $user_album_count = $user['alb_count']; if ($user_pic_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$user_thumb_pid}' AND approved='YES'"; $result = cpg_db_query($sql); if ($result->numRows()) { $picture = $result->fetchAssoc(true); $pic_url = get_pic_url($picture, 'thumb'); if (!is_image($picture['filename'])) { $image_info = cpg_getimagesize(urldecode($pic_url)); $picture['pwidth'] = $image_info[0]; $picture['pheight'] = $image_info[1]; } //thumb cropping //$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']); if (array_key_exists('system_icon', $picture) && $picture['system_icon'] == true) { $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb'); } else { $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb'); } $user_thumb = "<img src=\"" . $pic_url . "\" class=\"image thumbnail\" {$image_size['geom']} border=\"0\" alt=\"\" />"; } } $albums_txt = sprintf($lang_list_users['n_albums'], $user_album_count); $pictures_txt = sprintf($lang_list_users['n_pics'], $user_pic_count); $params = CPGPluginAPI::filter('user_caption_params', array('{USER_NAME}' => $user['user_name'], '{USER_ID}' => $user['user_id'], '{ALBUMS}' => $albums_txt, '{PICTURES}' => $pictures_txt)); $caption = template_eval($template_user_list_info_box, $params); $user_list[] = array('cat' => FIRST_USER_CAT + $user['user_id'], 'image' => $user_thumb, 'caption' => $caption); } theme_display_thumbnails($user_list, $user_count, '', '', 1, $PAGE, $totalPages, false, true, 'user'); }
/** * display_thumbnails() * * Generates data to display thumbnails of pictures in an album * * @param mixed $album Either the album ID or the meta album name * @param integer $cat Either the category ID or album ID if negative * @param integer $page Page number to display * @param integer $thumbcols * @param integer $thumbrows * @param boolean $display_tabs **/ function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs) { global $CONFIG, $USER, $LINEBREAK; global $lang_date, $lang_display_thumbnails, $lang_byte_units, $lang_common, $valid_meta_albums; $superCage = Inspekt::makeSuperCage(); $thumb_per_page = $thumbcols * $thumbrows; $lower_limit = ($page - 1) * $thumb_per_page; $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page); $total_pages = ceil($thumb_count / $thumb_per_page); $i = 0; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $i++; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . $LINEBREAK . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . $LINEBREAK . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . $LINEBREAK . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $lang_date['album']); list($pic_title) = CPGPluginAPI::filter('thumb_html_title', array($pic_title, $row)); $pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = cpg_getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } // thumb cropping - if we display a system thumb we calculate the dimension by any and not ex if (array_key_exists('system_icon', $row) && $row['system_icon'] == true) { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); } $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit; $thumb_list[$i]['pid'] = $row['pid']; $thumb_list[$i]['image'] = '<img src="' . $pic_url . '" class="image thumbnail" ' . $image_size['geom'] . ' border="0" alt="' . $row['filename'] . '" title="' . $pic_title . '" />'; $thumb_list[$i]['caption'] = bb_decode($row['caption_text']); $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['aid'] = $row['aid']; $thumb_list[$i]['pwidth'] = $row['pwidth']; $thumb_list[$i]['pheight'] = $row['pheight']; // cpg1.5: new thumb fields below $thumb_list[$i]['title'] = $row['title']; $thumb_list[$i]['description'] = $row['caption']; $thumb_list[$i]['filepath'] = $row['filepath']; $thumb_list[$i]['filename'] = $row['filename']; $thumb_list[$i]['filesize'] = $row['filesize']; $thumb_list[$i]['msg_id'] = isset($row['msg_id']) ? $row['msg_id'] : ''; // needed for get_pic_pos() } // Add a hit to album counter if it is a numeric album if (is_numeric($album)) { // Create an array to hold the album id for hits (if not created) if (!isset($USER['liv_a']) || !is_array($USER['liv_a'])) { $USER['liv_a'] = array(); } // Add 1 to album hit counter if ((!USER_IS_ADMIN && $CONFIG['count_admin_hits'] == 0 || $CONFIG['count_admin_hits'] == 1) && !in_array($album, $USER['liv_a']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) { add_album_hit($album); if (count($USER['liv_a']) > 4) { array_shift($USER['liv_a']); } array_push($USER['liv_a'], $album); user_save_profile(); } } //Using getRaw(). The date is sanitized in the called function. $date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null; theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs, 'thumb', $date); } elseif (is_numeric($album) || in_array($album, $valid_meta_albums)) { theme_no_img_to_display($album_name); } }
/** * display_thumbnails() * * Generates data to display thumbnails of pictures in an album * * @param mixed $album Either the album ID or the meta album name * @param integer $cat Either the category ID or album ID if negative * @param integer $page Page number to display * @param integer $thumbcols * @param integer $thumbrows * @param boolean $display_tabs **/ function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs) { global $CONFIG, $AUTHORIZED, $USER; global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common; $thumb_per_page = $thumbcols * $thumbrows; $lower_limit = ($page - 1) * $thumb_per_page; $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page); $total_pages = ceil($thumb_count / $thumb_per_page); $i = 0; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $i++; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt); $pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex if ($row['system_icon'] == 'true') { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); } $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit; $thumb_list[$i]['pid'] = $row['pid']; $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\"/>"; $thumb_list[$i]['caption'] = bb_decode($row['caption_text']); $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['aid'] = $row['aid']; $thumb_list[$i]['pwidth'] = $row['pwidth']; $thumb_list[$i]['pheight'] = $row['pheight']; } // Add a hit to album counter if it is a numeric album if (is_numeric($album)) { // Create an array to hold the album id for hits (if not created) if (!isset($USER['liv_a']) || !is_array($USER['liv_a'])) { $USER['liv_a'] = array(); } // Add 1 to album hit counter if (!USER_IS_ADMIN && !in_array($album, $USER['liv_a']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) { add_album_hit($album); if (count($USER['liv_a']) > 4) { array_shift($USER['liv_a']); } array_push($USER['liv_a'], $album); user_save_profile(); } } $date = isset($_GET['date']) ? cpgValidateDate($_GET['date']) : null; theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs, 'thumb', $date); } else { theme_no_img_to_display($album_name); } }
function list_users() { global $xoopsModuleConfig, $PAGE, $FORBIDDEN_SET, $xoopsDB, $myts; $sql = "SELECT category, COUNT(DISTINCT a.aid) as alb_count," . " COUNT(DISTINCT pid) as pic_count," . " MAX(pid) as thumb_pid " . "FROM " . $xoopsDB->prefix("xcgal_albums") . " AS a, " . "" . $xoopsDB->prefix("xcgal_pictures") . " AS p WHERE category > " . FIRST_USER_CAT . " AND p.aid = a.aid " . "AND approved = 'YES' " . "{$FORBIDDEN_SET} " . "GROUP BY category " . "ORDER BY category "; $result = $xoopsDB->query($sql); $user_count = $xoopsDB->getRowsNum($result); if (!$user_count) { redirect_header('index.php', 2, _MD_INDEX_NO_UGAL); return; } $rowset = db_fetch_rowset($result); $xoopsDB->freeRecordSet($result); $user_per_page = $xoopsModuleConfig['thumbcols'] * $xoopsModuleConfig['thumbrows']; $totalPages = ceil($user_count / $user_per_page); if ($PAGE > $totalPages) { $PAGE = 1; } $lower_limit = ($PAGE - 1) * $user_per_page; $upper_limit = min($user_count, $PAGE * $user_per_page); $limit = "LIMIT " . $lower_limit . "," . ($upper_limit - $lower_limit); $user_list = array(); for ($i = $lower_limit; $i < $upper_limit; $i++) { $user =& $rowset[$i]; $user_thumb = '<img src="images/nopic.jpg" class="image" border="0" alt=""/>'; $user_pic_count = $user['pic_count']; $user_thumb_pid = $user['thumb_pid']; $user_album_count = $user['alb_count']; if ($user_pic_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM " . $xoopsDB->prefix("xcgal_pictures") . " " . "WHERE pid='{$user_thumb_pid}'"; $result = $xoopsDB->query($sql); if ($xoopsDB->getRowsNum($result)) { $picture = $xoopsDB->fetchArray($result); $xoopsDB->freeRecordSet($result); $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $xoopsModuleConfig['thumb_width']); $user_thumb = "<img src=\"" . get_pic_url($picture, 'thumb') . "\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />"; } } $albums_txt = sprintf(_MD_INDEX_NALBS, $user_album_count); $pictures_txt = sprintf(_MD_NPICS, $user_pic_count); $user_handler =& xoops_gethandler('member'); $alb_owner =& $user_handler->getUser($user['category'] - FIRST_USER_CAT); if (is_object($alb_owner)) { $caption['u_name'] = $alb_owner->uname(); $caption['u_id'] = $alb_owner->uid(); $caption['albums'] = $albums_txt; $caption['pictures'] = $pictures_txt; $user_list[] = array('cat' => $user['category'], 'image' => $user_thumb, 'caption' => $caption); } } theme_display_thumbnails($user_list, $user_count, '', '', 1, $PAGE, $totalPages, false, true, 'user'); }
function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs) { global $xoopsModuleConfig, $xoopsTpl; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object $thumb_per_page = $thumbcols * $thumbrows; $lower_limit = ($page - 1) * $thumb_per_page; $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page); $total_pages = ceil($thumb_count / $thumb_per_page); $i = 0; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $i++; $image_size = compute_img_size($row['pwidth'], $row['pheight'], $xoopsModuleConfig['thumb_width']); $pic_title = _MD_FUNC_FNAME . $myts->makeTBoxData4Show($row['filename']) . "\n" . _MD_FUNC_FSIZE . ($row['filesize'] >> 10) . _MD_KB . "\n" . _MD_FUNC_DIM . $row['pwidth'] . "x" . $row['pheight'] . "\n" . _MD_FUNC_DATE . formatTimestamp($row['ctime'], 'm'); $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit; $thumb_list[$i]['image'] = "<img src=\"" . get_pic_url($row, 'thumb') . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\" />"; # deleted </a> at end mcleines $thumb_list[$i]['caption'] = $row['caption_text']; $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['pid'] = $row['pid']; } $xoopsTpl->assign('no_img', 0); theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs); } else { $xoopsTpl->assign('no_img', 1); $xoopsTpl->assign('lang_no_img', _MD_NO_IMG_TO_DISPLAY); $xoopsTpl->assign('album_name', $myts->makeTBoxData4Show($album_name)); } }
function list_users() { global $db, $CONFIG, $PAGE, $CPG_M_DIR, $CPG_M_URL; global $template_user_list_info_box; $sql = "SELECT user_id, username, user_avatar as avatar, user_avatar_type, a.title, " . "COUNT(DISTINCT a.aid) as alb_count, " . "COUNT(DISTINCT pid) as pic_count, " . "MAX(pid) as thumb_pid " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON (category = " . FIRST_USER_CAT . " + user_id " . " AND " . VIS_GROUPS . ")" . "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON (p.aid = a.aid AND approved = '1') " . "GROUP BY user_id, username, user_avatar, user_avatar_type, a.title ORDER BY username"; $result = $db->sql_query($sql); $user_count = $db->sql_numrows($result); if (!$user_count) { msg_box(USER_LIST, NO_USER_GAL, '', '', '100%'); $db->sql_freeresult($result); return; } $user_per_page = $CONFIG['thumbcols'] * $CONFIG['thumbrows']; $totalPages = ceil($user_count / $user_per_page); if ($PAGE > $totalPages) { $PAGE = $totalPages; } $lower_limit = ($PAGE - 1) * $user_per_page; $upper_limit = min($user_count, $PAGE * $user_per_page); $row_count = $upper_limit - $lower_limit; $rowset = array(); $i = 0; $db->sql_rowseek($lower_limit, $result); while (($row = $db->sql_fetchrow($result)) && $i++ < $row_count) { $rowset[] = $row; } $db->sql_freeresult($result); $user_list = array(); for ($i = 0; $i < count($rowset); $i++) { $user =& $rowset[$i]; $user_thumb = '<img src="' . $CPG_M_DIR . '/images/nopic.jpg" alt="' . NO_IMG_TO_DISPLAY . '" title="' . NO_IMG_TO_DISPLAY . '" class="image" border="0" />'; $user_pic_count = $user['pic_count']; $user_thumb_pid = $user['thumb_pid']; $user_album_count = $user['alb_count']; // User avatar as config opt if (false === stripos($user['avatar'], 'blank.gif') && strlen($user['avatar']) > 3 && $CONFIG['avatar_private_album']) { global $MAIN_CFG; if ($user['user_avatar_type'] == 1) { $avatar = $MAIN_CFG['avatar']['path'] . '/'; } else { if ($user['user_avatar_type'] == 2) { $avatar = ''; } else { if ($user['user_avatar_type'] == 3) { $avatar = $MAIN_CFG['avatar']['gallery_path'] . '/'; } } } if (isset($avatar)) { $user_thumb = '<img src="' . $avatar . $user['avatar'] . '" alt="" class="image" border="0" />'; } } else { if ($user_pic_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$user_thumb_pid}'"; $result = $db->sql_query($sql, false, __FILE__, __LINE__); if ($db->sql_numrows($result)) { $picture = $db->sql_fetchrow($result); $db->sql_freeresult($result); $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']); $user_thumb = "<img src=\"" . get_pic_url($picture, 'thumb') . "\" {$image_size['geom']} title=\"" . $user['username'] . "\" alt=\"" . $user['username'] . "\" border=\"0\" class=\"image\" />"; // $user['username'] } } } $albums_txt = sprintf(N_ALBUMS, $user_album_count); $pictures_txt = sprintf(N_PICS, $user_pic_count); $params = array('{username}' => $user['username'], '{USER_PROFILE_LINK}' => URL::index("Your_Account&profile=" . $user['user_id']), '{ALBUMS}' => $albums_txt, '{PICTURES}' => $pictures_txt); $caption = template_eval($template_user_list_info_box, $params); $user_list[] = array('cat' => FIRST_USER_CAT + $user['user_id'], 'image' => $user_thumb, 'caption' => $caption, 'url' => URL::index("&cat=" . (FIRST_USER_CAT + $user['user_id']))); } $page_link = URL::index("&cat=1&page=%d"); theme_display_thumbnails($user_list, $user_count, '', $page_link, $PAGE, $totalPages, false, true, 'user'); }
function list_users() { global $CONFIG, $PAGE, $FORBIDDEN_SET; global $lang_list_users, $lang_errors, $template_user_list_info_box, $cpg_show_private_album; if (defined('UDB_INTEGRATION')) { $result = udb_list_users_query($user_count); } else { // $sql = "SELECT user_id," . " user_name," . " COUNT(DISTINCT a.aid) as alb_count," . " COUNT(DISTINCT pid) as pic_count," . " MAX(pid) as thumb_pid " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON category = " . FIRST_USER_CAT . " + user_id " . "INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid " . "WHERE approved = 'YES' " . "$FORBIDDEN_SET " . "GROUP BY user_id " . "ORDER BY user_name "; // Fixed correct album count DJMaze $sql = "SELECT user_id, " . "user_name, " . "COUNT(DISTINCT a.aid) as alb_count, " . "COUNT(DISTINCT pid) as pic_count, " . "MAX(pid) as thumb_pid " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON category = " . FIRST_USER_CAT . " + user_id " . "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON (p.aid = a.aid AND approved = 'YES') "; if ($FORBIDDEN_SET != "" && !$cpg_show_private_album) { $sql .= "WHERE {$FORBIDDEN_SET} "; } $sql .= "GROUP BY user_id " . "ORDER BY user_name"; $result = db_query($sql); $user_count = mysql_num_rows($result); } if (!$user_count) { msg_box($lang_list_users['user_list'], $lang_list_users['no_user_gal'], '', '', '100%'); mysql_free_result($result); return; } $user_per_page = $CONFIG['thumbcols'] * $CONFIG['thumbrows']; $totalPages = ceil($user_count / $user_per_page); if ($PAGE > $totalPages) { $PAGE = 1; } $lower_limit = ($PAGE - 1) * $user_per_page; $upper_limit = min($user_count, $PAGE * $user_per_page); $row_count = $upper_limit - $lower_limit; if (defined('UDB_INTEGRATION')) { $rowset = udb_list_users_retrieve_data($result, $lower_limit, $row_count); } else { $rowset = array(); $i = 0; mysql_data_seek($result, $lower_limit); while (($row = mysql_fetch_array($result)) && $i++ < $row_count) { $rowset[] = $row; } mysql_free_result($result); } $user_list = array(); foreach ($rowset as $user) { $user_thumb = '<img src="images/nopic.jpg" class="image" border="0" />'; $user_pic_count = $user['pic_count']; $user_thumb_pid = $user['thumb_pid']; $user_album_count = $user['alb_count']; if ($user_pic_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$user_thumb_pid}'"; $result = db_query($sql); if (mysql_num_rows($result)) { $picture = mysql_fetch_array($result); mysql_free_result($result); $pic_url = get_pic_url($picture, 'thumb'); if (!is_image($picture['filename'])) { $image_info = getimagesize($pic_url); $picture['pwidth'] = $image_info[0]; $picture['pheight'] = $image_info[1]; } $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']); $user_thumb = "<img src=\"" . get_pic_url($picture, 'thumb') . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"\">"; } } $albums_txt = sprintf($lang_list_users['n_albums'], $user_album_count); $pictures_txt = sprintf($lang_list_users['n_pics'], $user_pic_count); $params = array('{USER_NAME}' => $user['user_name'], '{USER_ID}' => $user['user_id'], '{ALBUMS}' => $albums_txt, '{PICTURES}' => $pictures_txt); $caption = template_eval($template_user_list_info_box, $params); $user_list[] = array('cat' => FIRST_USER_CAT + $user['user_id'], 'image' => $user_thumb, 'caption' => $caption); } theme_display_thumbnails($user_list, $user_count, '', '', 1, $PAGE, $totalPages, false, true, 'user'); }
/** * display_thumbnails() * * Generates data to display thumbnails of pictures in an album * * @param mixed $album Either the album ID or the meta album name * @param integer $cat Either the category ID or album ID if negative * @param integer $page Page number to display * @param integer $thumbcols * @param integer $thumbrows * @param boolean $display_tabs **/ function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs) { global $CONFIG, $AUTHORIZED, $USER; global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common; $superCage = Inspekt::makeSuperCage(); $thumb_per_page = $thumbcols * $thumbrows; $lower_limit = ($page - 1) * $thumb_per_page; $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page); $total_pages = ceil($thumb_count / $thumb_per_page); $i = 0; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $i++; $pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt); $pic_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = cpg_getimagesize(urldecode($pic_url)); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex if ($row['system_icon'] == 'true') { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true); } else { $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); } $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit; $thumb_list[$i]['pid'] = $row['pid']; $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\"/>"; $thumb_list[$i]['caption'] = bb_decode($row['caption_text']); $thumb_list[$i]['admin_menu'] = ''; $thumb_list[$i]['aid'] = $row['aid']; $thumb_list[$i]['pwidth'] = $row['pwidth']; $thumb_list[$i]['pheight'] = $row['pheight']; if (defined('API_CALL')) { $thumb_list[$i]['title'] = $row['title']; $thumb_list[$i]['filename'] = get_pic_url($row); } } // Print out XML photo list and exit if (defined('API_CALL')) { echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo $superCage->post->getAlpha('album') ? "<" . $superCage->post->getAlpha('album') . ">\n" : "<api_search>\n"; foreach ($thumb_list as $pic) { $file = preg_replace('/%7E/', '~', $pic['filename']); echo " <picture id=\"{$pic['pid']}\">\n"; echo " <title>{$pic['title']}</title>\n"; echo " <file>{$file}</file>\n"; echo " <width>{$pic['pwidth']}</width>\n"; echo " <height>{$pic['pheight']}</height>\n"; echo " </picture>\n"; } echo $superCage->post->getAlpha('album') ? "</" . $superCage->post->getAlpha('album') . ">" : "</api_search>"; exit; } // Add a hit to album counter if it is a numeric album if (is_numeric($album)) { // Create an array to hold the album id for hits (if not created) if (!isset($USER['liv_a']) || !is_array($USER['liv_a'])) { $USER['liv_a'] = array(); } // Add 1 to album hit counter if (!USER_IS_ADMIN && !in_array($album, $USER['liv_a']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) { add_album_hit($album); if (count($USER['liv_a']) > 4) { array_shift($USER['liv_a']); } array_push($USER['liv_a'], $album); user_save_profile(); } } //Using getRaw(). The date is sanitized in the called function. $date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null; theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs, 'thumb', $date); } else { if (defined('API_CALL')) { new OAuthException('No pictures found'); } else { theme_no_img_to_display($album_name); } } }