function cpgUserLastComment($uid) { global $CONFIG, $FORBIDDEN_SET; $result = cpg_db_query("SELECT COUNT(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE approval = 'YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}"); list($comment_count, $lastcom_id) = mysql_fetch_row($result); mysql_free_result($result); $lastComArray = array('count' => 0); if ($comment_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE msg_id = {$lastcom_id}"; $result = cpg_db_query($sql); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $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]; } $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />'; $lastComArray = array('thumb' => $lastcom, 'comment' => $row['msg_body'], 'msg_date' => $row['msg_date'], 'count' => $comment_count); } mysql_free_result($result); } return $lastComArray; }
function album_share_codes_main() { $superCage = Inspekt::makeSuperCage(); if ($superCage->get->testInt('album')) { global $CONFIG; $aid = $superCage->get->getInt('album'); $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$aid}'"); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $url = $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $row['pid']; $thumb = $CONFIG['ecards_more_pic_target'] . get_pic_url($row, 'thumb'); $content1 .= '[url=' . $url . '][img]' . $thumb . '[/img][/url]' . "\n"; $content2 .= '<a href="' . $url . '"><img src="' . $thumb . ' /></a>' . "\n"; } starttable(-1, 'Share codes for <i>all files</i> in this album'); echo <<<EOT <tr> <td class="tableb"> <tt>[url][img][/url]</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content1}</textarea> <br /> <tt><a><img></a></tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content2}</textarea> </td> </tr> EOT; endtable(); } } }
function cpgUserLastComment($uid) { global $CONFIG; $result = cpg_db_query("SELECT count(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid AND approval='YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}"); $nbEnr = mysql_fetch_array($result); $comment_count = $nbEnr[0]; $lastcom_id = $nbEnr[1]; mysql_free_result($result); $lastcom = ''; if ($comment_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body, approval " . "FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE msg_id='" . $lastcom_id . "' AND approval = 'YES' AND c.pid = p.pid"; $result = cpg_db_query($sql); if (mysql_num_rows($result)) { $row = mysql_fetch_array($result); mysql_free_result($result); $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]; } $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); $mime_content = cpg_get_type($row['filename']); $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />'; } } $lastComArray = array(); $lastComArray['thumb'] = $lastcom; $lastComArray['comment'] = $row['msg_body']; $lastComArray['msg_date'] = $row['msg_date']; $lastComArray['count'] = $comment_count; return $lastComArray; }
/** * Created by PhpStorm. * User: m_xuelu * Date: 2015/7/7 * Time: 20:33 */ function run() { header('Content-Type:text/html;charset=utf-8'); date_default_timezone_set('PRC'); //set time zone //图片保存目录 pic save path define('PATH_DOWNLOAD', './download/'); save_dir(PATH_DOWNLOAD); set_time_limit(0); $city_url = "http://wd.koudai.com/wd/cate/getList?param={%22userID%22:%22337474108%22}&callback=jsonpcallback_1436277342180_5235922697465867&ver=2015070700014"; //验证curl模块 if (!function_exists('curl_init')) { echo "执行失败!请先安装curl扩展!\n"; exit; } //获取城市目录 $city = get_mulu($city_url); echo "获取城市:" . $city['status'] . " 耗时:" . $city['time'] . "\n"; //解析目录jsonp数据 $city = get_items($city['res']); //开始循环城市 foreach ($city['result'] as $city) { $city_dir = PATH_DOWNLOAD . $city['cate_name'] . "/"; save_dir(get_gbk($city_dir)); echo "开始处理 " . $city['cate_name'] . " 城市ID:" . $city['cate_id'] . "\n"; $url = "http://wd.koudai.com/wd/cate/getItems?param={%22userID%22:%22337474108%22,%22cate_id%22:%22" . $city['cate_id'] . "%22,%22limitStart%22:0,%22limitNum%22:10}&callback=jsonpcallback_1436278044036_6557131321169436&ver=2015070700014"; $mulu = get_mulu($url); echo "--获取目录状态:" . $mulu['status'] . ",耗时:" . $mulu['time'] . "\n"; //解析目录jsonp数据 $items = get_items($mulu['res']); foreach ($items['result'] as $item) { //保存目录 $name = str_replace(" ", "", $item['itemName']); $name = str_replace("/", "", $name); $name = str_replace(".", "", $name); $name = str_replace("\r", "", $name); $name = str_replace("\n", "", $name); $girl_dir = $city_dir . $name . "/"; save_dir(get_gbk($girl_dir)); //解析二级页面 $second_url = "http://weidian.com/wd/item/getPubInfo?param={%22itemID%22:" . $item['itemID'] . ",%22page%22:1}&callback=jsonpcallback_1436279264909_6875134997535497&ver=2015070700014"; $senond_mulu = get_mulu($second_url); $s_items = get_items($senond_mulu['res']); echo "----二级目录:" . $item['itemName'] . " 图片数量:" . count($s_items['result']['Imgs']) . "\n"; echo "----开始下载...\n"; $index = 1; foreach ($s_items['result']['Imgs'] as $pic) { //对地址进行处理 $pic_url = get_pic_url($pic); //写入图片文件 save_file($pic_url, $girl_dir, $index++); } unset($url); } } }
function pixaco_add($pic_data) { global $CONFIG; //select the langfile, if! fallback if (!file_exists("plugins/pixaco/lang/{$CONFIG['lang']}.php")) { $CONFIG['lang'] = 'english'; } require "plugins/pixaco/lang/{$CONFIG['lang']}.php"; //get the fullsize pic URL $fullsize_url = get_pic_url($pic_data); $button_def = ''; $link_data = '<a href="javascript:;" onclick="MM_openBrWindow(\'http://www.pixaco.de/services/httpbridge.aspx?smm=cookie&cmd=addimage&url0=' . $CONFIG['ecards_more_pic_target'] . $fullsize_url . '\',\'popup\',\'width=310,height=250,menubar=no,status=no,scrollbars=no,resizable=yes,left=50,top=50\');">' . $lang_plugin_pixaco['add_item'] . '</a>'; //add that generated code to the html and return $pic_data['html'] = $pic_data['html'] . $link_data; return $pic_data; }
function bbcode_add_data($pic_data) { //$pic_data global $CONFIG; //here we define a var that holds the copy to clipboard javascript //unfortunately the Firefox security settings do not allow clipboard copy to work without modifying prefs... //therefore only a msg pops up if a user uses netscape/ firefox and presses the copy button $script_data = <<<EOT <script language="javascript" type="text/javascript"> <!-- function copy_clip(bb_text) { if (window.clipboardData) { \twindow.clipboardData.setData("Text", bb_text); } else if (window.netscape) { \talert("Due to Firefox secutrity settings it is not possible to use the copy button. Please manually copy the bb code with 3 fast left clicks into the textara. Then press ctrl+c"); } return false; } //--> </script> EOT; $fullsize_url = get_pic_url($pic_data); //here we grab the url to the fullsized pic $thumb_url = get_pic_url($pic_data, 'thumb'); //thumb url $pic_data['title'] ? $name = $pic_data['title'] : ($name = 'No Title'); //chcking if the pic has a title, if not we set it to 'No title' //here we define the actual bbcode coppermine path + the path to the pic $img_url is for the version that displays the thumb, $name_url is for a txt link with the ikmage title $img_url = '[url=' . $CONFIG['ecards_more_pic_target'] . $fullsize_url . '][IMG]' . $CONFIG['ecards_more_pic_target'] . $thumb_url . '[/IMG][/url]'; $name_url = '[url=' . $CONFIG['ecards_more_pic_target'] . $fullsize_url . ']' . $name . '[/url]'; //this just brings everything in form... we create a table etc. $bbcode_data = '<table align="center" width="' . $CONFIG['picture_width'] . '">' . $script_data . '<tr>'; $bbcode_data .= '<td>[url][img][/url]</td>'; $bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40" style="overflow:off;">' . $img_url . '</textarea><input type="button" value="Copy" onclick=\'copy_clip("' . $img_url . '")\'></td>'; $bbcode_data .= '</tr><tr>'; $bbcode_data .= '<td>[url]title[/url]</td>'; $bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">' . $name_url . '</textarea><input type="button" value="Copy" onclick=\'copy_clip("' . $name_url . '")\'></td>'; $bbcode_data .= '</tr></table>'; //finally we add the created stuff to the picture data and return it to coppermine $pic_data['html'] = $pic_data['html'] . $bbcode_data; return $pic_data; }
function embed_code_file_info($info) { global $CONFIG, $CURRENT_PIC_DATA; // The weird comparision is because only picture_width is stored $resize_method = $CONFIG['picture_use'] == "thumb" ? $CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use'] : $CONFIG['picture_use']; if ($resize_method == 'ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width']) { $use_intermediate = true; } elseif ($resize_method == 'wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']) { $use_intermediate = true; } elseif ($resize_method == 'any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) { $use_intermediate = true; } else { $use_intermediate = false; } $file['thumb'] = $CONFIG['ecards_more_pic_target'] . get_pic_url($CURRENT_PIC_DATA, 'thumb'); $file['fullsize'] = $CONFIG['ecards_more_pic_target'] . get_pic_url($CURRENT_PIC_DATA, 'fullsize'); if ($use_intermediate) { $file['normal'] = $CONFIG['ecards_more_pic_target'] . get_pic_url($CURRENT_PIC_DATA, 'normal'); if (strpos($normal, 'images/thumbs/thumb_nopic.png')) { $file['normal'] = $file['fullsize']; } } else { $file['normal'] = $file['fullsize']; } $url = $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $CURRENT_PIC_DATA['pid']; if ($CONFIG['plugin_embed_code_fullsized_view'] == 1) { $url .= "&fullsize=1"; } foreach (plugin_embed_code_config_options() as $option => $text) { if ($CONFIG[$option] == 1 && $option != 'plugin_embed_code_fullsized_view') { $option_parts = explode("_", $option); $textarea = '<textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">'; if ($option_parts[3] == 'bb') { $textarea .= '[url=' . $url . '][img]' . $file[$option_parts[4]] . '[/img][/url]</textarea>'; } elseif ($option_parts[3] == 'html') { $textarea .= '<a href="' . $url . '"><img src="' . $file[$option_parts[4]] . '" /></a></textarea>'; } $info[$text] = $textarea; } } return $info; }
$Revision$ **********************************************/ if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...'); } //////////////////// Variables ////////////////////////////// // used texts $txt['bigger'] = ">"; $txt['smaller'] = "<"; $txt['up'] = "^"; $txt['down'] = "v"; $txt['closewindow'] = "Close window"; $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = '{$pid}'"); $CURRENT_PIC = mysql_fetch_array($result); mysql_free_result($result); $pic_url = get_pic_url($CURRENT_PIC, 'fullsize'); echo <<<cropUIjs <script language="javascript" type="text/javascript" src="dhtmlLib.js"></script> <script language="javascript" type="text/javascript"> <!-- function libinit(){ obj=new lib_obj('cropDiv') obj.dragdrop() objImg =new lib_obj('imgDiv') //alert (objImg.x + "-" + objImg.y); obj.moveIt(objImg.x,objImg.y) } function cropCheck(crA){ //alert (obj.x + "-" + obj.y);
$pic_count = $nbEnr[0]; // if we have more than 1000 pictures, we limit the number of picture returned // by the SELECT statement as ORDER BY RAND() is time consuming if ($pic_count > 1000) { $result = $db->sql_query("SELECT COUNT(*) from " . $cpg_prefix . "pictures WHERE approved = 1"); $nbEnr = $db->sql_fetchrow($result); $total_count = $nbEnr[0]; $granularity = floor($total_count / 1000); $cor_gran = ceil($total_count / $pic_count); srand(time()); for ($i = 1; $i <= $cor_gran; $i++) { $random_num_set = rand(0, $granularity) . ', '; } $random_num_set = substr($random_num_set, 0, -2); $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM " . $cpg_prefix . "pictures AS p INNER JOIN " . $cpg_prefix . "albums AS a ON (p.aid = a.aid AND " . VIS_GROUPS . ") WHERE randpos IN ({$random_num_set}) AND approved=1 GROUP BY pid ORDER BY RAND() DESC LIMIT {$limit}"); } else { $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM " . $cpg_prefix . "pictures AS p INNER JOIN " . $cpg_prefix . "albums AS a ON (p.aid = a.aid AND " . VIS_GROUPS . ") WHERE approved=1 GROUP BY pid ORDER BY RAND() DESC LIMIT {$limit}"); } while ($row = $db->sql_fetchrow($result)) { if ($CONFIG['seo_alts'] == 0) { $thumb_title = $row['filename']; } else { if ($row['title'] != '') { $thumb_title = $row['title']; } else { $thumb_title = substr($row['filename'], 0, -4); } } $content .= '<td align="center" valign="baseline"><a href="' . URL::index($cpg_dir . '&file=displayimage&album=' . $row['aid'] . '&pid=' . $row["pid"]) . '"><img src="' . get_pic_url($row, 'thumb') . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . $thumb_title . '</a></td>'; } $content .= '</tr><tr align="center"><td colspan="' . $limit . '" valign="baseline"><a href="' . URL::index($cpg_dir) . '">' . _coppermineLANG . '</a></td></tr></table>';
$row['pheight'] = floor($CONFIG['thumb_width'] * 2 / 3); } $smilies = generate_smilies(); echo <<<EOT <form method="post" name="post" id="cpgform" action="{$CPG_PHP_SELF}?album={$album}&pid={$pid}"> EOT; starttable("100%", $icon_array['ecard'] . $lang_ecard_php['title'], 3); echo <<<EOT <tr> <td class="tableh2" colspan="2"> <strong>{$lang_ecard_php['from']}</strong> </td> <td rowspan="6" align="center" valign="top" class="tableb"> EOT; if (is_flash($row['filename'])) { $n_picname = get_pic_url($row, 'fullsize'); echo <<<EOT <object id="SWFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" type="application/x-shockwave-flash" width="{$thumb_size['width']}" height="{$thumb_size['height']}"> <param name="autostart" value="true" /> <param name="src" value="{$n_picname}" /> </object> EOT; } else { echo <<<EOT <a href="displayimage.php?pid={$pid}"> <img src="{$thumb_pic_url}" width="{$thumb_size['width']}" height="{$thumb_size['height']}" alt="" vspace="8" border="0" class="image" /> </a> EOT; } echo <<<EOT </td>
function theme_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $ALBUM_SET; global $lang_errors, $lang_fullsize_popup, $lang_charset; if (isset($_GET['picfile'])) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } $picfile = $_GET['picfile']; $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif (isset($_GET['pid'])) { $pid = (int) $_GET['pid']; $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; ?> " /> <title><?php echo $CONFIG['gallery_name']; ?> : <?php echo $lang_fullsize_popup['click_to_close']; ?> </title> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; width:<?php echo $row['pwidth']; ?> px; height:<?php echo $row['pheight']; ?> px; border-collapse:collapse} td { vertical-align: middle; text-align:center; } </style> <script type="text/javascript" src="scripts.js"></script> </head> <body style="margin:0px; padding:0px; background-color: gray;"> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <?php if ($CONFIG['transparent_overlay'] == 1) { ?> <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;"> <tr> <?php echo '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">'; echo '<div id="content">'; echo '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } else { ?> <table class="fullsize"> <tr> <td> <div id="content"> <?php echo '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . 'alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } ?> </body> </html> <?php }
$cpg_block = true; require "modules/" . $cpg_dir . "/include/load.inc"; $cpg_block = false; $limit = $CONFIG['thumbcols']; //number of thumbs // $limit = 5; //number of pictures $content = ''; // END USER DEFINEABLES $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, pic_rating, p.votes, p.title FROM " . $cpg_prefix . "pictures AS p INNER JOIN " . $cpg_prefix . "albums AS a ON (p.aid = a.aid AND " . VIS_GROUPS . ") WHERE approved=1 AND p.votes >= '{$CONFIG['min_votes_for_rating']}' GROUP BY pid ORDER BY ROUND((pic_rating+1)/2000) DESC, p.votes DESC LIMIT {$limit}"); $content .= '<br /><table width="100%" cols="' . $limit . '" border="0" cellpadding="0" cellspacing="0"><tr align="center">'; $pic = 0; while ($row = $db->sql_fetchrow($result)) { if (defined('THEME_HAS_RATING_GRAPHICS')) { $theme_prefix = $CONFIG['theme'] . '/'; } else { $theme_prefix = ''; } $caption = '<img src="' . $CPG_M_DIR . '/' . $theme_prefix . 'images/rating' . round($row["pic_rating"] / 2000) . '.gif" align="center" alt="" />' . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . '<br />'; if ($CONFIG['seo_alts'] == 0) { $thumb_title = $row['filename']; } else { if ($row['title'] != '') { $thumb_title = $row['title']; } else { $thumb_title = substr($row['filename'], 0, -4); } } $content .= '<td align="center" valign="baseline"><a href="' . URL::index($cpg_dir . '&file=displayimage&meta=toprated&cat=0&pos=' . $pic) . '"><img src="' . get_pic_url($row, 'thumb') . '" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . $caption . '</a></td>'; $pic++; } $content .= '</tr><tr><td colspan="' . $limit . '" valign="baseline" align="center"><a href = "' . URL::index($cpg_dir) . '">' . _coppermineLANG . '</a></td></tr></table>';
<a href="{$_SERVER['PHP_SELF']}?start={$start}&count={$count}&sort=comment_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['comment_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?start={$start}&count={$count}&sort=comment_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['comment_d']}" /></a> </td> <td class="tableh2" valign="top">{$lang_reviewcom_php['file']} <a href="{$_SERVER['PHP_SELF']}?start={$start}&count={$count}&sort=file_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['file_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?start={$start}&count={$count}&sort=file_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['file_d']}" /></a> </td> </tr> EOT; $sort_codes = array('name_a' => 'msg_author ASC', 'name_d' => 'msg_author DESC', 'date_a' => 'msg_id ASC', 'date_d' => 'msg_id DESC', 'comment_a' => 'msg_body ASC', 'comment_d' => 'msg_body DESC', 'file_a' => 'pid ASC', 'file_d' => 'pid DESC'); $sort = !isset($_GET['sort']) || !isset($sort_codes[$_GET['sort']]) ? 'date_d' : $_GET['sort']; $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, {$CONFIG['TABLE_COMMENTS']}.pid as pid, aid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_COMMENTS']}, {$CONFIG['TABLE_PICTURES']} WHERE {$CONFIG['TABLE_COMMENTS']}.pid = {$CONFIG['TABLE_PICTURES']}.pid ORDER BY {$sort_codes[$sort]} LIMIT {$start}, {$count}"); $rowcounter = 0; while ($row = mysql_fetch_array($result)) { $thumb_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = getimagesize($thumb_url); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1]; } $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['alb_list_thumb_size']); $thumb_link = 'displayimage.php?pos=' . -$row['pid']; $msg_date = localised_date($row['msg_date'], $comment_date_fmt); $msg_body = bb_decode(process_smilies($row['msg_body'])); $rowcounter++; if ($rowcounter >= 2) { //let the row colors alternate, for now they are the same $rowcounter = 0; $tableclass = 'tableb'; // change to "tableh2_compact" or similar for alternation
function html_picture() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $CPG_M_DIR; global $album, $template_display_picture; $pid = $CURRENT_PIC_DATA['pid']; // $ina is where the Registered Only picture is $ina = "{$CPG_M_DIR}/images/ina.jpg"; // Check for anon picture viewing - only for registered user, admin, or if admin allows anon access to full size images if (USER_ID > 1 or $CONFIG['allow_anon_fullsize'] or USER_IS_ADMIN) { // Add 1 to hit counter unless the user reloaded the page if (!isset($USER['liv']) || !is_array($USER['liv'])) { $USER['liv'] = array(); } // Add 1 to hit counter if ($album != "lasthits" && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) { add_hit($pid); if (count($USER['liv']) > 4) { array_shift($USER['liv']); } //pass by ref depreciated in 4.3.9 array_push($USER['liv'], $pid); $USER['liv'][] = $pid; } if ($CONFIG['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal'); } else { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize'); } $picture_menu = USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID || GALLERY_ADMIN_MODE || $CURRENT_PIC_DATA['owner_id'] == USER_ID ? html_picture_menu($pid) : ''; $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']); $pic_title = ''; if ($CURRENT_PIC_DATA['title'] != '') { $pic_title .= $CURRENT_PIC_DATA['title'] . "\n"; } if ($CURRENT_PIC_DATA['caption'] != '') { $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n"; } if ($CURRENT_PIC_DATA['keywords'] != '') { $pic_title .= KEYWORDS . ": " . $CURRENT_PIC_DATA['keywords']; } if (isset($image_size['reduced'])) { $CONFIG['justso'] = 0; if ($CONFIG['justso']) { //require_once('jspw.js'); $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16; $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16; $hug = 'hug image'; $hugwidth = '4'; $bgclr = '#000000'; $alt = CLICK_TO_CLOSE; // $lang_fullsize_popup[1]; $pic_html = '<a href="' . URL::index("&file=justsofullsize&pid={$pid}", false, true) . '" target="' . uniqid(rand()) . "\" onclick=\"JustSoPicWindow('" . URL::index("&file=justsofullsize&pid={$pid}", false, true) . "','{$winsizeX}','{$winsizeY}','{$alt}','{$bgclr}','{$hug}','{$hugwidth}');return false\">"; } else { $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16; $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16; $pic_html = '<a href="' . URL::index("&file=displayimagepopup&pid={$pid}&fullsize=1", true, true) . '" target="' . uniqid(rand()) . "\" onclick=\"imgpop('" . URL::index("&file=displayimagepopup&pid={$pid}&fullsize=1", true, true) . "','" . uniqid(rand()) . "','resizable=yes,scrollbars=yes,width={$winsizeX},height={$winsizeY},left=0,top=0');return false\">"; //toolbar=yes,status=yes, $pic_title = VIEW_FS . "\n ============== \n" . $pic_title; //added by gaugau } $pic_html .= "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{$pic_title}\" title=\"{$pic_title}\" /><br />"; $pic_html .= "</a>\n"; } else { $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} alt=\"{$pic_title}\" title=\"{$pic_title}\" class=\"image\" border=\"0\" /><br />\n"; } if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_picture, 'img_desc'); } else { if (!$CURRENT_PIC_DATA['title']) { template_extract_block($template_display_picture, 'title'); } if (!$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_picture, 'caption'); } } } else { $imagesize = getimagesize($ina); $image_size = compute_img_size($imagesize[0], $imagesize[1], $CONFIG['picture_width']); $pic_html = '<a href="' . NEWUSER_URL . '">'; $pic_html .= "<img src=\"" . $ina . "\" {$image_size['geom']} alt=\"Click to register\" title=\"Click to register\" class=\"image\" border=\"0\" /></a><br />"; $picture_menu = ""; $CURRENT_PIC_DATA['title'] = MEMBERS_ONLY; $CURRENT_PIC_DATA['caption'] = ''; } $params = array('{CELL_HEIGHT}' => '100', '{IMAGE}' => $pic_html, '{ADMIN_MENU}' => $picture_menu, '{TITLE}' => $CURRENT_PIC_DATA['title'], '{CAPTION}' => decode_bbcode($CURRENT_PIC_DATA['caption'])); return template_eval($template_display_picture, $params); }
/** * list_cat_albums() * * This has been added to list the albums in a category, used for showing first level albums, largely a repetition of code elsewhere * Redone for a cleaner approach * @param integer $cat Category id for which albums are needed */ function list_cat_albums($cat, $catdata) { global $CONFIG, $lang_date, $FORBIDDEN_SET_DATA; global $lang_list_albums; $PAGE = 1; if ($cat == 0) { return ''; } $cat_owner_id = $cat > 10000 ? 10000 - $cat : 10001; $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $cat_owner_id); $cpg_privatepic_data = cpg_get_system_thumb('private.jpg', $cat_owner_id); $alb_per_page = $CONFIG['albums_per_page']; //unused code {SaWey} /*$maxTab = $CONFIG['max_tabs']; $album_filter = ''; $pic_filter = ''; if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) { $album_filter = ' and ' . str_replace('p.', 'a.', $FORBIDDEN_SET); $pic_filter = ' and ' . $FORBIDDEN_SET; }*/ $nbAlb = $catdata['details']['alb_count']; if ($nbAlb == 0) { return; } $totalPages = ceil($nbAlb / $alb_per_page); $alb_list = array(); $approved = ' AND approved=\'YES\''; $forbidden_set_string = count($FORBIDDEN_SET_DATA) > 0 ? ' AND aid NOT IN (' . implode(', ', $FORBIDDEN_SET_DATA) . ')' : ''; $last_pids = array(); $last_pid_data = array(); foreach ($catdata['subalbums'] as $aid => $album) { if ($CONFIG['link_pic_count'] == 1 || $album['pic_count'] == 0) { if (!empty($album['keyword'])) { $keyword = $album['keyword'] ? "AND (keywords like '%" . addslashes($album['keyword']) . "%' {$forbidden_set_string})" : ''; $query = "SELECT count(pid) AS link_pic_count, max(pid) AS link_last_pid, max(ctime) AS link_last_upload " . " FROM {$CONFIG['TABLE_PICTURES']} " . " WHERE ((aid != '{$aid}' {$forbidden_set_string}) {$keyword}) {$approved}"; $result = cpg_db_query($query); $link_stat = $result->fetchAssoc(true); $catdata['subalbums'][$aid]['link_pic_count'] = $link_stat['link_pic_count']; $catdata['subalbums'][$aid]['last_pid'] = !empty($album['last_pid']) && $album['last_pid'] > $link_stat['link_last_pid'] ? $album['last_pid'] : $link_stat['link_last_pid']; if ($CONFIG['link_last_upload'] && $link_stat['link_pic_count'] > 0) { $catdata['subalbums'][$aid]['last_upload'] = $album['last_upload'] > $link_stat['link_last_upload'] ? $album['last_upload'] : $link_stat['link_last_upload']; } } } if ($catdata['subalbums'][$aid]['last_pid']) { $last_pids[] = $catdata['subalbums'][$aid]['last_pid']; } if ($album['thumb'] > 0) { $last_pids[] = $album['thumb']; } } if (count($last_pids)) { $result = cpg_db_query("SELECT pid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} WHERE pid IN (" . implode(',', $last_pids) . ")"); while ($row = $result->fetchAssoc()) { $last_pid_data[$row['pid']] = $row; unset($last_pid_data[$row['pid']]['pid']); } $result->free(); } unset($last_pids); foreach ($catdata['subalbums'] as $aid => $album) { // Inserts a thumbnail if the album contains 1 or more images //unused code {SaWey} //$visibility = $album['visibility']; $keyword = $album['keyword'] ? "OR (keywords like '%" . addslashes($album['keyword']) . "%' {$forbidden_set_string})" : ''; if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) { //test for visibility if ($album['pic_count'] > 0 || !empty($album['link_pic_count'])) { if (!empty($last_pid_data[$album['thumb']]['filename'])) { $picture = $last_pid_data[$album['thumb']]; } elseif ($album['thumb'] < 0) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} WHERE ((aid = '{$aid}' {$forbidden_set_string}) {$keyword}) {$approved} " . "ORDER BY RAND() LIMIT 0,1"; $result = cpg_db_query($sql); $picture = $result->fetchAssoc(true); } else { $picture = $last_pid_data[$album['last_pid']]; } $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 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'); } $alb_list[$aid]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image thumbnail\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\" />"; } else { // Inserts an empty thumbnail if the album contains 0 images // $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']); $alb_list[$aid]['thumb_pic'] = '<img src="' . $cpg_nopic_data['thumb'] . '" ' . $cpg_nopic_data['whole'] . ' class="image thumbnail" border="0" alt="" />'; } } elseif ($CONFIG['show_private']) { // $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']); $alb_list[$aid]['thumb_pic'] = '<img src="' . $cpg_privatepic_data['thumb'] . '" ' . $cpg_privatepic_data['whole'] . ' class="image thumbnail" border="0" alt="" />'; } // Prepare everything if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) { $link_pic_count = !empty($album['link_pic_count']) ? $album['link_pic_count'] : 0; $last_upload_date = $album['pic_count'] || $CONFIG['link_pic_count'] && $link_pic_count > 0 ? localised_date($album['last_upload'], $lang_date['lastup']) : ''; $alb_list[$aid]['aid'] = $aid; $alb_list[$aid]['album_title'] = $album['title']; $alb_list[$aid]['album_desc'] = bb_decode($album['description']); $alb_list[$aid]['pic_count'] = $album['pic_count']; $alb_list[$aid]['last_upl'] = $last_upload_date; $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']); $alb_list[$aid]['album_info'] = theme_album_info($album['pic_count'], $link_pic_count, $last_upload_date); $alb_list[$aid]['album_adm_menu'] = album_adm_menu($aid, $cat, $album['owner']); } elseif ($CONFIG['show_private']) { // show private album description $link_pic_count = !empty($album['link_pic_count']) ? $album['link_pic_count'] : 0; $last_upload_date = $album['pic_count'] || $CONFIG['link_pic_count'] && $link_pic_count > 0 ? localised_date($album['last_upload'], $lang_date['lastup']) : ''; $alb_list[$aid]['aid'] = $aid; $alb_list[$aid]['album_title'] = $album['title']; $alb_list[$aid]['album_desc'] = bb_decode($album['description']); $alb_list[$aid]['pic_count'] = $album['pic_count']; $alb_list[$aid]['last_upl'] = $last_upload_date; $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']); $alb_list[$aid]['album_info'] = theme_album_info($album['pic_count'], $link_pic_count, $last_upload_date); $alb_list[$aid]['album_adm_menu'] = album_adm_menu($aid, $cat, $album['owner']); } } ob_start(); theme_display_album_list_cat($alb_list, $nbAlb, $cat, $PAGE, $totalPages); $cat_albums = ob_get_contents(); ob_end_clean(); return $cat_albums; }
function display_film_strip($album, $cat, $pos) { global $CONFIG, $AUTHORIZED, $HTTP_GET_VARS; global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units; $max_item = $CONFIG['max_film_strip_items']; //$thumb_per_page = $pos+$CONFIG['max_film_strip_items']; $thumb_per_page = $max_item * 2; $l_limit = max(0, $pos - $CONFIG['max_film_strip_items']); $new_pos = max(0, $pos - $l_limit); $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page); if (count($pic_data) < $max_item) { $max_item = count($pic_data); } $lower_limit = 3; if (!isset($pic_data[$new_pos + 1])) { $lower_limit = $new_pos - $max_item + 1; } else { if (!isset($pic_data[$new_pos + 2])) { $lower_limit = $new_pos - $max_item + 2; } else { if (!isset($pic_data[$new_pos - 1])) { $lower_limit = $new_pos; } else { $hf = $max_item / 2; $ihf = (int) ($max_item / 2); if ($new_pos > $hf) { $lower_limit = $new_pos - $ihf; } elseif ($new_pos < $hf) { $lower_limit = 0; } } } } $pic_data = array_slice($pic_data, $lower_limit, $max_item); $i = $l_limit; if (count($pic_data) > 0) { foreach ($pic_data as $key => $row) { $hi = $pos == $i + $lower_limit ? '1' : ''; $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']); $p = $i - 1 + $lower_limit; $p = $p < 0 ? 0 : $p; $thumb_list[$i]['pos'] = $key < 0 ? $key : $p; $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'] = ''; } return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album)); } else { theme_no_img_to_display($album_name); } }
function theme_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $FORBIDDEN_SET, $LINEBREAK, $pid; global $lang_errors, $lang_fullsize_popup, $lang_charset; $superCage = Inspekt::makeSuperCage(); if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { printf($lang_errors['login_needed'], '', '', '', ''); die; } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) { printf($lang_errors['access_intermediate_only'], '', '', '', ''); die; } if ($superCage->get->keyExists('picfile')) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } //$picfile = $_GET['picfile']; //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities $matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~ \\/_.-]+$/'); $picfile = $matches[0]; $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif ($pid) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE pid='{$pid}' {$FORBIDDEN_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_assoc($result); if (is_image($row['filename'])) { $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } else { $pic_html = theme_html_picture(); if (is_movie($row['filename'])) { $mime_content = cpg_get_type($row['filename']); $ctrl_offset['mov'] = 15; $ctrl_offset['wmv'] = 45; $ctrl_offset['swf'] = 0; $ctrl_offset['rm'] = 0; $ctrl_offset_default = 45; $ctrl_height = isset($ctrl_offset[$mime_content['extension']]) ? $ctrl_offset[$mime_content['extension']] : $ctrl_offset_default; preg_match('/width="([0-9]+)".*height="([0-9]+)"/', $pic_html, $matches); $width = $matches[1] + $CONFIG['fullsize_padding_x']; $height = $matches[2] + $CONFIG['fullsize_padding_y'] + $ctrl_height; $resize_window = '<script type="text/javascript">window.resizeTo(' . $width . ', ' . $height . ')</script>'; } preg_match('/<td align="center" style="{SLIDESHOW_STYLE}">.*(.*)<\\/td>/Us', $pic_html, $matches); $pic_html = $matches[1] . $resize_window; } } if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2 || USER_ID && USER_ACCESS_LEVEL <= 2) { // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message $row['pwidth'] = 200; $row['pheight'] = 100; } $charset = $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; $fullsize_html = <<<EOT <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset={$charset}" /> <title>{$CONFIG['gallery_name']}: {$lang_fullsize_popup['click_to_close']}</title> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; width:{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse} td { vertical-align: middle; text-align:center; } </style> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script> <script type="text/javascript" src="js/displayimage.fullsize.js"></script> </head> <body style="margin:0px; padding:0px; background-color: gray;"> EOT; if ($pic_html) { $fullsize_html .= $pic_html; } else { if ($CONFIG['transparent_overlay'] == 1) { $fullsize_html .= <<<EOT <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;"> <tr> EOT; $fullsize_html .= '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">'; $fullsize_html .= '<div id="content">'; $fullsize_html .= '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . $LINEBREAK . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . $LINEBREAK; $fullsize_html .= <<<EOT </div> </td> </tr> </table> EOT; } else { $fullsize_html .= ' <div id="content">' . $LINEBREAK; $fullsize_html .= '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' id="fullsize_image" alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . $LINEBREAK . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . $LINEBREAK . ' </div>' . $LINEBREAK; } } $fullsize_html .= <<<EOT </body> </html> EOT; $fullsize_html = CPGPluginAPI::filter('fullsize_html', $fullsize_html); echo $fullsize_html; }
function theme_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $ALBUM_SET, $pid; global $lang_errors, $lang_fullsize_popup, $lang_charset; $superCage = Inspekt::makeSuperCage(); if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { printf($lang_errors['login_needed'], '', '', '', ''); die; } //if (isset($_GET['picfile'])){ if ($superCage->get->keyExists('picfile')) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } //$picfile = $_GET['picfile']; $picfile = $superCage->get->getPath('picfile'); $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif (pid) { //$pid = (int)$_GET['pid']; $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message $row['pwidth'] = 200; $row['pheight'] = 100; } $fullImageUrl = '<img src="' . htmlspecialchars($imagedata['path']) . '" />'; $fullTitle_caption = "<h3><strong>" . htmlspecialchars($row['title']) . "</strong></h3>"; $fullTitle_caption .= "<p>" . htmlspecialchars($row['caption']) . "</p>"; if ($superCage->get->keyExists('full_image_ajax')) { $fullImageData = array('url' => $fullImageUrl, 'title' => $fullTitle_caption); $full_jons = json_encode($fullImageData); echo $full_jons; exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; ?> " /> <title><?php echo $CONFIG['gallery_name']; ?> : <?php echo $lang_fullsize_popup['click_to_close']; ?> </title> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; width:<?php echo $row['pwidth']; ?> px; height:<?php echo $row['pheight']; ?> px; border-collapse:collapse} td { vertical-align: middle; text-align:center; } </style> <script type="text/javascript" src="scripts.js"></script> </head> <body style="margin:0px; padding:0px; background-color: gray;"> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <?php if ($CONFIG['transparent_overlay'] == 1) { ?> <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;"> <tr> <?php echo '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">'; echo '<div id="content">'; echo '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } else { ?> <table class="fullsize"> <tr> <td> <div id="content"> <?php echo '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . 'alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } ?> </body> </html> <?php }
/** * picrow() * * return the HTML code for a row to be displayed for an image * the row contains a checkbox, the image name, a thumbnail * * @param $picfile the full path of the file that contains the picture * @param $picid the name of the check box * @return the HTML code */ function picrow($picfile, $picid, $albid) { global $CONFIG, $expic_array, $picrowCounter; $encoded_picfile = urlencode(base64_encode($picfile)); $picname = $CONFIG['fullpath'] . $picfile; $pic_url = urlencode($picfile); $pic_fname = basename($picfile); $pic_dirname = dirname($picname); $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname; if ($CONFIG['display_thumbs_batch_add'] == 1) { if (file_exists($thumb_file)) { $thumb_info = cpg_getimagesize($picname); $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48); $img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />'; } elseif (is_image($picname)) { $img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0" alt="" />'; } else { $file['filepath'] = $pic_dirname . '/'; $file['filename'] = $pic_fname; $filepathname = get_pic_url($file, 'thumb'); $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" />'; } } else { $img = ''; } if (filesize($picname) && is_readable($picname)) { // for video support, maybe check: http://www.getid3.org/ // for now, hack in something that works (don't check !$fullimagesize) $fullimagesize = cpg_getimagesize($picname); $winsizeX = $fullimagesize[0] + 16; $winsizeY = $fullimagesize[1] + 16; // $checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked'; $picfile_replaced_forbidden = dirname($picfile) . '/' . replace_forbidden(basename($picfile)); if ($CONFIG['batch_add_hide_existing_files'] && isset($expic_array[$picfile_replaced_forbidden])) { return; } if ($picrowCounter++ % 2) { $rowStyle = 'tableb'; } else { $rowStyle = 'tableb tableb_alternate'; } $checked = isset($expic_array[$picfile_replaced_forbidden]) || !is_known_filetype($pic_fname) ? '' : 'checked="checked"'; $return = <<<EOT <tr> <td class="{$rowStyle}" valign="middle" width="30"> <input name="pics[]" id="checkbox_p_{$picid}" type="checkbox" value="{$picid}" {$checked} /> <input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" /> <input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" /> </td> EOT; // if $fullimagesize is not null, then assume it's an image if ($fullimagesize) { $return .= <<<EOT <td class="{$rowStyle}" valign="middle"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> </td> <td class="{$rowStyle}" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"> EOT; } else { // assume it's not an image so hope that browser can display/play it with a helper app $nonpic_url = rawurldecode($pic_url); $return .= <<<EOT <td class="{$rowStyle}" valign="middle"> <a href="javascript:;" onclick= "MM_openBrWindow('{$CONFIG['fullpath']}{$nonpic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> </td> <td class="{$rowStyle}" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('{$CONFIG['fullpath']}{$nonpic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"> EOT; } if ($CONFIG['display_thumbs_batch_add'] == 1) { $return .= <<<EOT <img src="images/spacer.gif" width="1" height="48" border="0" alt="" /> EOT; } $return .= <<<EOT {$img}</a><br /> </td> <td class="{$rowStyle}" valign="middle" width="100" height="40"> <p id="p_{$picid}" name="addpic.php?pic_file={$encoded_picfile}"></p> </td> </tr> EOT; return $return; } else { $winsizeX = 300; $winsizeY = 300; $return = <<<EOT <tr> <td class="{$rowStyle}" valign="middle"> </td> <td class="{$rowStyle}" valign="middle"> <i>{$pic_fname}</i> </td> <td class="{$rowStyle}" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"> EOT; if ($CONFIG['display_thumbs_batch_add'] == 1) { $return .= <<<EOT <img src="showthumb.php?picfile={$pic_url}&size=48" class="thumbnail" border="0" alt="" /> EOT; } $return .= <<<EOT </a> </td> </tr> EOT; return $return; } }
function form_alb_thumb($text, $name) { global $CONFIG, $ALBUM_DATA, $CLEAN, $lang_modifyalb_php, $USER_DATA, $LINEBREAK, $help, $icon_array; $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $USER_DATA['user_id']); $keyword = ''; if ($ALBUM_DATA['keyword']) { $keyword = "OR (keywords LIKE '%{$ALBUM_DATA['keyword']}%')"; } $query = "SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND (aid = '{$CLEAN['album']}' {$keyword} ) ORDER BY filename"; $results = cpg_db_query($query); if (mysql_num_rows($results) == 0) { echo <<<EOT <tr> <td valign="top"> {$text} </td> <td valign="top"> <em>{$lang_modifyalb_php['alb_empty']}</em> <input type="hidden" name="{$name}" value="0" /> </td> </tr> EOT; return; } $thumbs = array(0 => $cpg_nopic_data['thumb']); $img_list = array(0 => $lang_modifyalb_php['last_uploaded'], -1 => $lang_modifyalb_php['random_image']); while ($picture = mysql_fetch_assoc($results)) { $thumb_url = get_pic_url($picture, 'thumb'); $thumbs[$picture['pid']] = $thumb_url; if ($picture['pid'] == $ALBUM_DATA[$name]) { $thumbs[0] = $thumb_url; } $img_list[$picture['pid']] = htmlspecialchars($picture['filename']); } mysql_free_result($results); $thumbs_json = json_encode($thumbs); $thumb_cell_height = $CONFIG['thumb_width'] + 17; echo <<<EOT <tr> <td valign="top"> {$icon_array['album_thumbnail']}{$text}{$help['album_thumbnail']} </td> <td align="left"> <img src="{$thumbs[0]}" name="Thumb" class="image" alt="{$text}" /> <br /> EOT; echo <<<EOT <script language="JavaScript" type="text/JavaScript"> var Pic = {$thumbs_json}; </script> EOT; echo <<<EOT <select name="{$name}" class="listbox" onchange="if(this.options[this.selectedIndex].value) ChangeThumb(this.options[this.selectedIndex].value);" onkeyup="if(this.options[this.selectedIndex].value) ChangeThumb(this.options[this.selectedIndex].value);"> EOT; foreach ($img_list as $pid => $pic_name) { echo ' <option value="' . $pid . '"' . ($pid == $ALBUM_DATA[$name] ? ' selected="selected"' : '') . '>' . $pic_name . '</option>' . $LINEBREAK; } echo <<<EOT </select> </td> </tr> EOT; }
function form_alb_thumb($text, $name) { global $CONFIG, $ALBUM_DATA, $CLEAN, $lang_modifyalb_php, $USER_DATA; $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $USER_DATA['user_id']); if ($ALBUM_DATA['keyword']) { $keyword = "OR (keywords like '%{$ALBUM_DATA['keyword']}%')"; } $results = cpg_db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} WHERE aid='{$CLEAN['album']}' {$keyword} AND approved='YES' ORDER BY filename"); if (mysql_num_rows($results) == 0) { echo <<<EOT <tr> <td class="tableb" valign="top"> {$text} </td> <td class="tableb" valign="top"> <i>{$lang_modifyalb_php['alb_empty']}</i> <input type="hidden" name="{$name}" value="0" /> </td> </tr> EOT; return; } $initial_thumb_url = $cpg_nopic_data['thumb']; //'images/nopic.jpg'; echo <<<EOT <script language="JavaScript" type="text/JavaScript"> <!-- var Pic = new Array() Pic[0] = '{$initial_thumb_url}' EOT; $img_list = array(0 => $lang_modifyalb_php['last_uploaded'], -1 => $lang_modifyalb_php['random_image']); while ($picture = mysql_fetch_array($results)) { $thumb_url = get_pic_url($picture, 'thumb'); echo "Pic[{$picture['pid']}] = '" . $thumb_url . "'\n"; if ($picture['pid'] == $ALBUM_DATA[$name]) { $initial_thumb_url = $thumb_url; } $img_list[$picture['pid']] = htmlspecialchars($picture['filename']); } // while echo <<<EOT function ChangeThumb(index) { if (index == -1) index = 0; document.images.Thumb.src = Pic[index] } var checkobj function agreesubmit(el){ checkobj=el if (document.all||document.getElementById){ for (i=0;i<checkobj.form.length;i++){ //hunt down submit button var tempobj=checkobj.form.elements[i] if(tempobj.type.toLowerCase()=="submit") tempobj.disabled=!checkobj.checked } } } function defaultagree(el){ if (!document.all&&!document.getElementById){ if (window.checkobj&&checkobj.checked) return true else{ alert("{$lang_modifyalb_php['reset_views_confirm']}") return false } } } --> </script> EOT; $thumb_cell_height = $CONFIG['thumb_width'] + 17; echo <<<EOT <tr> <td class="tableb" valign="top"> {$text} </td> <td class="tableb" align="center"> <table cellspacing="0" cellpadding="5" border="0"> <tr> <td width="{$thumb_cell_height}" height="{$thumb_cell_height}" align="center"><img src="{$initial_thumb_url}" name='Thumb' class='image' /><br /></td> </tr> </table> <select name="{$name}" class="listbox" onChange="if(this.options[this.selectedIndex].value) ChangeThumb(this.options[this.selectedIndex].value);" onKeyUp="if(this.options[this.selectedIndex].value) ChangeThumb(this.options[this.selectedIndex].value);"> EOT; foreach ($img_list as $pid => $pic_name) { echo ' <option value="' . $pid . '"' . ($pid == $ALBUM_DATA[$name] ? ' selected' : '') . '>' . $pic_name . "</option>\n"; } echo <<<EOT </select> </td> </tr> EOT; }
/** * Function to return html required for displaying the flv palyer */ function video2flash_ffmpeg_file_data($pic_data) { global $CONFIG; $file = $CONFIG['fullpath'] . $pic_data['filepath'] . $pic_data['filename']; $picture_url = get_pic_url($pic_data, 'fullsize'); preg_match("/(.+)\\.(.*?)\\Z/", $pic_data['filename'], $matches); $flv = $CONFIG['fullpath'] . $pic_data['filepath'] . $matches[1] . '.flv'; // We will replace the file html only if it is a valid movie and we have the flv file if (is_movie($file) && file_exists($flv)) { $thumb = $CONFIG['fullpath'] . $pic_data['filepath'] . $CONFIG['thumb_pfx'] . $matches[1] . ".jpg"; $flashvars = ''; if (file_exists($thumb)) { $flashvars = '&image=' . $CONFIG['ecards_more_pic_target'] . $thumb; } if ($CONFIG['video2flash_ffmpeg_player_autostart'] == 'yes') { $flashvars = '&autostart=true'; } $pic_data['html'] = <<<EOT <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="{$CONFIG['video2flash_ffmpeg_player_width']}" height="{$CONFIG['video2flash_ffmpeg_player_height']}"> <param name="movie" value="plugins/video2flash_ffmpeg/player.swf?file={$CONFIG['ecards_more_pic_target']}{$flv}{$flashvars}" /> <param name="quality" value="high" /> <param name="wmode" value="transparent" /> <embed src="plugins/video2flash_ffmpeg/player.swf?file={$CONFIG['ecards_more_pic_target']}{$flv}{$flashvars}" quality="high" wmode="transparent" width="{$CONFIG['video2flash_ffmpeg_player_width']}" height="{$CONFIG['video2flash_ffmpeg_player_height']}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> EOT; } // print_r($pic_data); return $pic_data; }
} } if ($superCage->get->keyExists('category_title')) { $category_query = "SELECT cid, name FROM `{$CONFIG['TABLE_CATEGORIES']}` WHERE (`name` " . implode(" {$type} `name` ", $albcat_terms) . ')'; $result = cpg_db_query($category_query); if (mysql_num_rows($result) > 0) { starttable('100%', $lang_meta_album_names['category_search'], 2); while ($cat = mysql_fetch_array($result, MYSQL_ASSOC)) { $album_q = "SELECT aid, title FROM `{$CONFIG['TABLE_ALBUMS']}` AS p WHERE (`category` = '{$cat['cid']}') {$FORBIDDEN_SET} ORDER BY `aid` DESC LIMIT 1"; $album_r = cpg_db_query($album_q); $album = mysql_fetch_array($album_r); // TODO: This is weird. It seems to pull in the largest aid's thumb for the category image? $thumb_query = "SELECT filepath, filename, url_prefix, pwidth, pheight " . " FROM `{$CONFIG['TABLE_PICTURES']}` " . " WHERE (`aid` = '{$album['aid']}') " . " AND approved = 'YES' " . " ORDER BY `pid` DESC"; $thumb_result = cpg_db_query($thumb_query); $thumb = mysql_fetch_assoc($thumb_result); $thumb_url = get_pic_url($thumb, 'thumb'); $thumb_size = compute_img_size($thumb['pwidth'], $thumb['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb'); ?> <tr> <td colspan="3" height="1" valign="top" class="tableh2"> <span class="alblink"><a href="<?php printf("index.php?cat=%u", $cat['cid']); ?> "><?php echo $cat['name']; ?> </a></span> </td> </tr> <tr> <td colspan="3">
/** * picrow() * * return the HTML code for a row to be displayed for an image * the row contains a checkbox, the image name, a thumbnail * * @param $picfile the full path of the file that contains the picture * @param $picid the name of the check box * @return the HTML code */ function picrow($picfile, $picid, $albid) { global $CONFIG, $expic_array; $encoded_picfile = base64_encode($picfile); $picname = $CONFIG['fullpath'] . $picfile; $pic_url = urlencode($picfile); $pic_fname = basename($picfile); $pic_dirname = dirname($picname); $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname; if (file_exists($thumb_file)) { $thumb_info = getimagesize($picname); $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48); $img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />'; } elseif (is_image($picname)) { $img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0" alt="" />'; } else { $file['filepath'] = $pic_dirname . '/'; //substr($picname,0,strrpos($picname,'/')) $file['filename'] = $pic_fname; $filepathname = get_pic_url($file, 'thumb'); //$mime_content = cpg_get_type($picname); //$extension = file_exists("images/thumb_{$mime_content['extension']}.jpg") ? $mime_content['extension']:$mime_content['content']; //$img = '<img src="images/thumb_'.$extension.'.jpg" class="thumbnail" width="48" border="0" alt="" />'; $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" />'; } if (filesize($picname) && is_readable($picname)) { //$fullimagesize = getimagesize($picname); COMMENTED OUT FOR VIDEO SUPPORT $winsizeX = $fullimagesize[0] + 16; $winsizeY = $fullimagesize[1] + 16; //$checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked'; $checked = isset($expic_array[$picfile]) ? '' : 'checked'; return <<<EOT <tr> <td class="tableb" valign="middle"> <input name="pics[]" id="picselector" type="checkbox" value="{$picid}" {$checked} /> <input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" /> <input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" /> </td> <td class="tableb" valign="middle" width="100%"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> </td> <td class="tableb" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="images/spacer.gif" width="1" height="48" border="0" alt="" />{$img}<br /></a> </td> </tr> EOT; } else { $winsizeX = 300; $winsizeY = 300; return <<<EOT <tr> <td class="tableb" valign="middle"> </td> <td class="tableb" valign="middle" width="100%"> <i>{$pic_fname}</i> </td> <td class="tableb" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="showthumb.php?picfile={$pic_url}&size=48" class="thumbnail" border="0" alt="" /><br /></a> </td> </tr> EOT; } }
function imageflow_mainpage($matches) { global $CONFIG, $lang_plugin_imageflow, $FORBIDDEN_SET, $IMAGEFLOWSET, $lang_meta_album_names, $META_ALBUM_SET; if ($matches[1] != 'imageflow') { return $matches; } require './plugins/imageflow/include/init.inc.php'; echo "<!-- Start Imageflow PlugIn " . $lang_plugin_imageflow['version'] . " -->\n"; if ($IMAGEFLOWSET['imageflow_standardtable']) { starttable("100%", $lang_meta_album_names[$IMAGEFLOWSET['imageflow_album']]); echo "<tr><td>"; } if ($IMAGEFLOWSET['imageflow_align'] == "center") { echo "<center>\r\n "; } if ($IMAGEFLOWSET['imageflow_intable']) { echo "<div id=\"imgflowcontainer\" style=\"width:" . $IMAGEFLOWSET['imageflow_width'] . ";\">\r\n "; } ?> <div id="imageflow"> <div id="imgflowloading"> <b><?php echo $lang_plugin_imageflow['loading']; ?> </b><br/> <img src="plugins/imageflow/js/loading.gif" width="208" height="13" alt="loading" /> </div> <div id="imgflowimages"> <?php // maximum pics to show $imageflowlimit = $IMAGEFLOWSET['imageflow_numberofpics']; // request of your database $imageflow_pics = ''; $imageflow_FORBIDDEN_SET = ""; if ($FORBIDDEN_SET != "") { $imageflow_FORBIDDEN_SET = "AND {$FORBIDDEN_SET}"; } // request string for meta album toprated if ($IMAGEFLOWSET['imageflow_album'] == "toprated") { $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} AND votes >= '{$CONFIG['min_votes_for_rating']}' {$META_ALBUM_SET} ORDER BY pic_rating DESC, votes DESC, pid DESC LIMIT {$imageflowlimit}"; } else { if ($IMAGEFLOWSET['imageflow_album'] == "topn") { $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} AND hits > 0 {$META_ALBUM_SET} ORDER BY hits DESC, filename LIMIT {$imageflowlimit}"; } else { if ($IMAGEFLOWSET['imageflow_album'] == "lastup") { $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY pid DESC LIMIT {$imageflowlimit}"; } else { $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY RAND() LIMIT {$imageflowlimit}"; } } } // result of request $imageflow_result = cpg_db_query($imageflow_query); // For reading result $imageflow_rowset = array(); // Index of tab $i = 0; // for each pic build HTML code $imgflow_fixedsize = 0; if (strtolower(substr($IMAGEFLOWSET['imageflow_width'], -2)) == "px") { $imgflow_fixedsize = trim(substr($IMAGEFLOWSET['imageflow_width'], 0, strlen($IMAGEFLOWSET['imageflow_width']) - 2)); } while ($imageflow_row = mysql_fetch_array($imageflow_result)) { if (!$IMAGEFLOWSET['imageflow_skipportrait'] || $imageflow_row['pwidth'] > $imageflow_row['pheight']) { // reading pid of pic $imageflow_key = $imageflow_row['pid']; // path of pic, depending if intermediate image is there or not $imageflow_file = get_pic_url($imageflow_row, $IMAGEFLOWSET['imageflow_pictype']); if (!cpgif_my_is_file($imageflow_file)) { $imageflow_file = get_pic_url($imageflow_row, 'fullsize'); } $imageflow_reflfile = get_pic_url($imageflow_row, 'normal'); if (!cpgif_my_is_file($imageflow_reflfile)) { $imageflow_reflfile = get_pic_url($imageflow_row, 'fullsize'); } $imageflow_temppercent = $IMAGEFLOWSET['imageflow_procent']; if ($imageflow_row['pwidth'] < $CONFIG['picture_width'] && $imageflow_row['pheight'] < $CONFIG['picture_width']) { $imageflow_temppercent = 1; } // link of pic if ($IMAGEFLOWSET['imageflow_useenlarge']) { if ($imgflow_fixedsize == 0) { $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&procent=" . $imageflow_temppercent . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\" class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />"; } else { $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&fixed=" . $imgflow_fixedsize . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\" class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />"; } } else { if ($imgflow_fixedsize == 0) { $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&procent=" . $imageflow_temppercent . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\" alt=\"" . $imageflow_row['title'] . "\" />"; } else { $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&fixed=" . $imgflow_fixedsize . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\" alt=\"" . $imageflow_row['title'] . "\" />"; } } // building HTML code $imageflow_pics .= $imageflow_lien . "\n"; $i = $i + 1; } } // free memory mysql_free_result($imageflow_result); /* fill if not enough pictures in current category if 3 or 4, repeat once to get 6 or 8 pics; if 2, repeat four times to get 8 pics; if only 1, repeat 8 times to get 8 pics */ if ($i < 5) { $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow2pic", $imageflow_pics); } if ($i < 3) { $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow3pic", str_replace("iflow2pic", "iflow4pic", $imageflow_pics)); } if ($i < 2) { $imageflow_pics = $imageflow_pics . str_replace("iflow4pic", "iflow8pic", str_replace("iflow3pic", "iflow7pic", str_replace("iflowpic", "iflow5pic", str_replace("iflow2pic", "iflow6pic", $imageflow_pics)))); } // if no pictures found at all in current category, simply take random pictures from whole gallery if ($i < 1) { $imageflow_pics = ''; $imageflow_FORBIDDEN_SET = ""; if ($FORBIDDEN_SET != "") { $imageflow_FORBIDDEN_SET = "AND {$FORBIDDEN_SET}"; } $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} ORDER BY RAND() LIMIT {$imageflowlimit}"; // result of request $imageflow_result = cpg_db_query($imageflow_query); // For reading result $imageflow_rowset = array(); // Index of tab $i = 0; // For each pic.....building HTML in php $imgflow_fixedsize = 0; if (strtolower(substr($IMAGEFLOWSET['imageflow_width'], -2)) == "px") { $imgflow_fixedsize = trim(substr($IMAGEFLOWSET['imageflow_width'], 0, strlen($IMAGEFLOWSET['imageflow_width']) - 2)); } while ($imageflow_row = mysql_fetch_array($imageflow_result)) { if (!$IMAGEFLOWSET['imageflow_skipportrait'] || $imageflow_row['pwidth'] > $imageflow_row['pheight']) { // reading pid of pic $imageflow_key = $imageflow_row['pid']; // path of pic, depending if intermediate image is there or not $imageflow_file = get_pic_url($imageflow_row, $IMAGEFLOWSET['imageflow_pictype']); if (!cpgif_my_is_file($imageflow_file)) { $imageflow_file = get_pic_url($imageflow_row, 'fullsize'); } $imageflow_reflfile = get_pic_url($imageflow_row, 'normal'); if (!cpgif_my_is_file($imageflow_reflfile)) { $imageflow_reflfile = get_pic_url($imageflow_row, 'fullsize'); } $imageflow_temppercent = $IMAGEFLOWSET['imageflow_procent']; if ($imageflow_row['pwidth'] < $CONFIG['picture_width'] && $imageflow_row['pheight'] < $CONFIG['picture_width']) { $imageflow_temppercent = 1; } // link of pic if ($IMAGEFLOWSET['imageflow_useenlarge']) { if ($imgflow_fixedsize == 0) { $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&procent=" . $imageflow_temppercent . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\" class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />"; } else { $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&fixed=" . $imgflow_fixedsize . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\" class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />"; } } else { if ($imgflow_fixedsize == 0) { $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&procent=" . $imageflow_temppercent . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\" alt=\"" . $imageflow_row['title'] . "\" />"; } else { $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&fixed=" . $imgflow_fixedsize . "&cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\" alt=\"" . $imageflow_row['title'] . "\" />"; } } // building HTML code $imageflow_pics .= $imageflow_lien . "\n"; $i = $i + 1; } } // free memory mysql_free_result($imageflow_result); // if not a single pic in the whole gallery, use dummy pic from plugin folder if ($i < 1) { $imageflow_pics = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&procent=" . $IMAGEFLOWSET['imageflow_procent'] . "&cache=0&img=plugins/imageflow/nopicstoshow.jpg\" longdesc=\"\" alt=\"Add Some Pics!\" />"; } /* fill if not enough random pictures in whole gallery if 3 or 4, repeat once to get 6 or 8 pics; if 2, repeat four times to get 8 pics; if only 1, repeat 8 times to get 8 pics */ if ($i < 5) { $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow2pic", $imageflow_pics); } if ($i < 3) { $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow3pic", str_replace("iflow2pic", "iflow4pic", $imageflow_pics)); } if ($i < 2) { $imageflow_pics = $imageflow_pics . str_replace("iflow4pic", "iflow8pic", str_replace("iflow3pic", "iflow7pic", str_replace("iflowpic", "iflow5pic", str_replace("iflow2pic", "iflow6pic", $imageflow_pics)))); } } echo $imageflow_pics; ?> </div> <div id="imgflowcaptions"></div> <div id="imgflowscrollbar"> <div id="imgflowslider"></div> </div> </div> <?php if ($IMAGEFLOWSET['imageflow_intable']) { echo " </div>\r\n "; } if ($IMAGEFLOWSET['imageflow_align'] == "center") { echo "</center>\r\n"; } if ($IMAGEFLOWSET['imageflow_standardtable']) { echo "</td></tr>"; endtable(); } echo "<!-- End Imageflow PlugIn -->\n"; }
function process_post_data() { global $CONFIG, $mb_utf8_regex; global $lang_errors, $lang_editpics_php; $pid = (int) $_POST['id']; $aid = (int) $_POST['aid']; $pwidth = (int) $_POST['pwidth']; $pheight = (int) $_POST['pheight']; $title = $_POST['title']; $caption = $_POST['caption']; $keywords = $_POST['keywords']; $user1 = $_POST['user1']; $user2 = $_POST['user2']; $user3 = $_POST['user3']; $user4 = $_POST['user4']; $galleryicon = (int) $_POST['galleryicon']; $isgalleryicon = $galleryicon === $pid; // need to implement "Read EXIF info again" checkbox; comment out for now // $read_exif = isset($_POST['read_exif']); $reset_vcount = isset($_POST['reset_vcount']); $reset_votes = isset($_POST['reset_votes']); $del_comments = isset($_POST['del_comments']) || $delete; $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_ALBUMS']} AS a WHERE a.aid = p.aid AND pid = '{$pid}'"); if (!mysql_num_rows($result)) { cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $pic = mysql_fetch_array($result); mysql_free_result($result); if (!(GALLERY_ADMIN_MODE || $pic['category'] == FIRST_USER_CAT + USER_ID || $CONFIG['users_can_edit_pics'] && $pic['owner_id'] == USER_ID) || !USER_ID) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } $update = "aid = '" . $aid . "'"; if (is_movie($pic['filename'])) { $update .= ", pwidth = " . $pwidth; $update .= ", pheight = " . $pheight; } $update .= ", title = '" . addslashes($title) . "'"; $update .= ", caption = '" . addslashes($caption) . "'"; $update .= ", keywords = '" . addslashes($keywords) . "'"; $update .= ", user1 = '" . addslashes($user1) . "'"; $update .= ", user2 = '" . addslashes($user2) . "'"; $update .= ", user3 = '" . addslashes($user3) . "'"; $update .= ", user4 = '" . addslashes($user4) . "'"; if ($isgalleryicon && $pic['category'] > FIRST_USER_CAT) { $sql = 'update ' . $CONFIG['TABLE_PICTURES'] . ' set galleryicon=0 where owner_id=' . $pic['owner_id'] . ';'; cpg_db_query($sql); $update .= ", galleryicon = " . addslashes($galleryicon); } if ($reset_vcount) { $update .= ", hits = '0'"; resetDetailHits($pid); } if ($reset_votes) { $update .= ", pic_rating = '0', votes = '0'"; resetDetailVotes($pid); } if ($del_comments) { $query = "DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}'"; $result = cpg_db_query($query); } else { $query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET {$update} WHERE pid='{$pid}' LIMIT 1"; $result = cpg_db_query($query); } // rename a file if ($_POST['filename'] != $pic['filename']) { if ($CONFIG['thumb_use'] == 'ht' && $pic['pheight'] > $CONFIG['picture_width']) { $condition = true; } elseif ($CONFIG['thumb_use'] == 'wd' && $pic['pwidth'] > $CONFIG['picture_width']) { $condition = true; } elseif ($CONFIG['thumb_use'] == 'any' && max($pic['pwidth'], $pic['pheight']) > $CONFIG['picture_width']) { $condition = true; } else { $condition = false; } if ($CONFIG['make_intermediate'] && $condition) { $prefices = array('fullsize', 'normal', 'thumb'); } else { $prefices = array('fullsize', 'thumb'); } if (!is_image($pic['filename'])) { $prefices = array('fullsize'); } foreach ($prefices as $prefix) { $oldname = urldecode(get_pic_url($pic, $prefix)); $filename = replace_forbidden($_POST['filename']); $newname = str_replace($pic['filename'], $filename, $oldname); $old_mime = cpg_get_type($oldname); $new_mime = cpg_get_type($newname); if ($old_mime['mime'] != $new_mime['mime'] && isset($new_mime['mime'])) { cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['mime_conv'], $old_mime['mime'], $new_mime['mime']), __FILE__, __LINE__); } if (!is_known_filetype($newname)) { cpg_die(CRITICAL_ERROR, $lang_editpics_php['forb_ext'], __FILE__, __LINE__); } if (file_exists($newname)) { cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['file_exists'], $newname), __FILE__, __LINE__); } if (!file_exists($oldname)) { cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['src_file_missing'], $oldname), __FILE__, __LINE__); } if (rename($oldname, $newname)) { cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET filename = '{$filename}' WHERE pid = '{$pid}' LIMIT 1"); } else { cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['rename_failed'], $oldname, $newname), __FILE__, __LINE__); } } } }
function form_alb_thumb() { global $CONFIG, $lang_catmgr_php, $lang_modifyalb_php, $current_category, $cid, $USER_DATA, $LINEBREAK; function cpg_get_alb_keyword($sql) { $keyword = ''; $result = cpg_db_query($sql); if ($result->numRows()) { while ($row = $result->fetchAssoc()) { $keyword .= "OR (keywords LIKE '%{$row['keyword']}%') "; } } $result->free(); return $keyword; } if ($cid == USER_GAL_CAT) { $keyword = cpg_get_alb_keyword("SELECT DISTINCT keyword FROM {$CONFIG['TABLE_ALBUMS']} WHERE category > " . FIRST_USER_CAT . " AND keyword != ''"); $results = cpg_db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE (a.category > " . FIRST_USER_CAT . " {$keyword}) AND approved = 'YES' ORDER BY filename"); } else { $keyword = cpg_get_alb_keyword("SELECT DISTINCT keyword FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$cid} AND keyword != ''"); $results = cpg_db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE (a.category = {$cid} {$keyword}) AND approved = 'YES' ORDER BY filename"); } if ($results->numRows() == 0) { echo <<<EOT <tr> <td class="tableb" valign="top"> {$lang_modifyalb_php['alb_thumb']} </td> <td class="tableb" valign="top"> <i>{$lang_modifyalb_php['alb_empty']}</i> <input type="hidden" name="thumb" value="0" /> </td> </tr> EOT; return; } $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $USER_DATA['user_id']); $initial_thumb_url = $cpg_nopic_data['thumb']; //'images/nopic.jpg'; echo <<<EOT <script language="JavaScript" type="text/JavaScript"> var Pic = new Array() Pic[0] = '{$initial_thumb_url}' EOT; $img_list = array(0 => $lang_modifyalb_php['last_uploaded']); while ($picture = $results->fetchAssoc()) { $thumb_url = get_pic_url($picture, 'thumb'); echo "Pic[{$picture['pid']}] = '" . $thumb_url . "'\n"; if ($picture['pid'] == $current_category['thumb']) { $initial_thumb_url = $thumb_url; } $img_list[$picture['pid']] = htmlspecialchars($picture['filename']); } // while $results->free(); echo <<<EOT </script> EOT; $thumb_cell_height = $CONFIG['thumb_width'] + 17; echo <<<EOT <tr> <td class="tableb" valign="top"> {$lang_catmgr_php['cat_thumb']} </td> <td class="tableb" align="center"> <table cellspacing="0" cellpadding="5" border="0"> <tr> <td width="{$thumb_cell_height}" height="{$thumb_cell_height}" align="center"><img src="{$initial_thumb_url}" name='Thumb' class='image' /><br /></td> </tr> </table> <select name="thumb" class="listbox" onchange="if(this.options[this.selectedIndex].value) ChangeThumb(this.options[this.selectedIndex].value);" onKeyUp="if(this.options[this.selectedIndex].value) ChangeThumb(this.options[this.selectedIndex].value);"> EOT; foreach ($img_list as $pid => $pic_name) { echo ' <option value="' . $pid . '"' . (!empty($current_category['thumb']) && $pid == $current_category['thumb'] ? ' selected' : '') . '>' . $pic_name . '</option>' . $LINEBREAK; } echo <<<EOT </select> </td> </tr> EOT; }
return trigger_error($cpg_dir . ' module is inactive', E_USER_WARNING); } $cpg_block = true; require "modules/" . $cpg_dir . "/include/load.inc"; $cpg_block = false; // $length=$CONFIG['thumbcols']; //number of thumbs $length = 8; //number of thumbs $maxlength = 20; // maximum length of name in block // marquee info at http://www.faqs.org/docs/htmltut/_MARQUEE.html $content = '<p style="text-align:center;"><a name="scroller"></a><marquee loop="1" behavior="scroll" direction="left" height="135" width="80%" scrollamount="1" scrolldelay="1" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'; //END USER DEFINABLES $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM " . $cpg_prefix . "pictures AS p INNER JOIN " . $cpg_prefix . "albums AS a ON (p.aid = a.aid AND " . VIS_GROUPS . ") WHERE approved=1 GROUP BY pid ORDER BY pid DESC LIMIT {$length}"); $content .= '<table width="100%" cols="' . $length . '" border="0" cellpadding="0" cellspacing="7"><tr align="center">'; $pic = 0; $thumb_title = ''; while ($row = $db->sql_fetchrow($result)) { if ($CONFIG['seo_alts'] == 0) { $thumb_title = $row['filename']; } else { if ($row['title'] != '') { $thumb_title = $row['title']; } else { $thumb_title = substr($row['filename'], 0, -4); } } $content .= '<td align="center" valign="baseline"><a href="' . URL::index($cpg_dir . '&file=displayimage&meta=lastup&cat=0&pos=' . $pic) . '"><img src="' . get_pic_url($row, 'thumb') . '" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . truncate_stringblocks($thumb_title, $maxlength) . '</a> </td>'; $pic++; } $content .= '</tr></table></marquee></p><p style="text-align:center;"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr align="center"><td valign="baseline"><a href="' . URL::index($cpg_dir) . '">' . _coppermineLANG . '</a><br /></td></tr></table></p>';
// $limit=$CONFIG['thumbcols']; //number of thumbs $limit = 5; //number of pictures // END USER DEFINABLES $content = ''; $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, pic_rating, p.votes, p.title FROM " . $cpg_prefix . "pictures AS p INNER JOIN " . $cpg_prefix . "albums AS a ON (p.aid = a.aid AND " . VIS_GROUPS . ") WHERE approved=1 AND p.votes >= '{$CONFIG['min_votes_for_rating']}' GROUP BY pid ORDER BY ROUND((pic_rating+1)/2000) DESC, p.votes DESC LIMIT {$limit}"); $pic = 0; $theme_prefix = $caption = $thumb_title = ''; while ($row = $db->sql_fetchrow($result)) { if (defined('THEME_HAS_RATING_GRAPHICS')) { $theme_prefix = $CONFIG['theme'] . '/'; } else { $theme_prefix = ''; } // $caption = '<img src="' . $CPG_M_DIR . '/' . $theme_prefix . 'images/rating' . round($row["pic_rating"] / 2000) . '.gif" style=\"text-align:center;" alt=\"\" />' . '<br />' . sprintf(N_VOTES, $row[\'votes\']).'<br />'; $caption = "<img src=\"" . $CPG_M_DIR . "/" . $theme_prefix . "images/rating" . round($row['pic_rating'] / 2000) . ".gif\" style=\"text-align:center;\" alt=\"\" />" . "<br />" . round($row['pic_rating'] / 2000, 2) . "/5 "; $caption .= sprintf(N_VOTES, $row['votes']); $caption .= "<br />"; if ($CONFIG['seo_alts'] == 0) { $thumb_title = $row['filename']; } else { if ($row['title'] != '') { $thumb_title = $row['title']; } else { $thumb_title = substr($row['filename'], 0, -4); } } $content .= '<p style="text-align:center;"><a href="' . URL::index($cpg_dir . '&file=displayimage&meta=toprated&cat=0&pos=' . $pic) . '"><img src="' . get_pic_url($row, 'thumb') . '" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . $caption . '</a></p>'; $pic++; } $content .= '<p style="text-align:center;"><a href = "' . URL::index($cpg_dir) . '"> Go to gallery </a> </p>';
} $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']); $mime_content = get_type($row['filename']); $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="">'; $lastcom = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastcomby&uid=' . $uid . '">' . $lastcom . '</a><br />'; $lastcom .= "<span class=\"thumb_caption\"><b>" . $row['msg_author'] . '</b></span>' . "<span class=\"thumb_caption\">" . localised_date($row['msg_date'], $lastcom_date_fmt) . '</span>' . "<span class=\"thumb_caption\">" . $row['msg_body'] . '</span></td>'; } } $user_thumb = ''; if ($picture_count) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='" . $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['thumb_width']); $mime_content = get_type($picture['filename']); $user_thumb = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="">'; $user_thumb = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastupby&uid=' . $uid . '">' . $user_thumb . '</a></td>'; } } $quick_jump = $user_thumb . $lastcom ? '<table width="100%" border="0" cellspacing="5"><tr>' . $user_thumb . $lastcom . '</tr></table>' : ''; $form_data = array('username' => $user_data['user_name'], 'reg_date' => localised_date($user_data['user_regdate'], $register_date_fmt), 'group' => $user_data['group_name'], 'location' => $user_data['user_location'], 'interests' => $user_data['user_interests'], 'website' => make_clickable($user_data['user_website']), 'occupation' => $user_data['user_occupation'], 'user_thumb' => $quick_jump); $title = sprintf($lang_register_php['x_s_profile'], $user_data['user_name']); pageheader($title);