function get_smilies_table2() { global $lang_smilies_inc_php; $smilies_display = array(array(':lol:', 'lol.gif', $lang_smilies_inc_php['Laughing']), array(':-P', 'razz.gif', $lang_smilies_inc_php['Razz']), array(':-D', 'biggrin.gif', $lang_smilies_inc_php['Very Happy']), array(':-)', 'smile.gif', $lang_smilies_inc_php['Smile']), array(':-|', 'neutral.gif', $lang_smilies_inc_php['Neutral']), array(':-(', 'sad.gif', $lang_smilies_inc_php['Sad']), array(':cry:', 'cry.gif', $lang_smilies_inc_php['Crying or Very sad']), array('8-)', 'cool.gif', $lang_smilies_inc_php['Cool']), array(':-o', 'surprised.gif', $lang_smilies_inc_php['Surprised']), array(':-?', 'confused.gif', $lang_smilies_inc_php['Confused']), array(':oops:', 'redface.gif', $lang_smilies_inc_php['Embarrassed']), array(':shock:', 'eek.gif', $lang_smilies_inc_php['Shocked']), array(':-x', 'mad.gif', $lang_smilies_inc_php['Mad']), array(':roll:', 'rolleyes.gif', $lang_smilies_inc_php['Rolling Eyes']), array(';-)', 'wink.gif', $lang_smilies_inc_php['Wink']), array(':idea:', 'idea.gif', $lang_smilies_inc_php['Idea']), array(':!:', 'exclaim.gif', $lang_smilies_inc_php['Exclamation']), array(':?:', 'question.gif', $lang_smilies_inc_php['Question'])); $smilies_display = CPGPluginAPI::filter('smilies_display', $smilies_display); return $smilies_display; }
/** * create_banlist() * * @return **/ function create_banlist() { global $CONFIG, $lang_banning_php, $lang_usermgr_php, $lang_common, $lang_date, $CPG_PHP_SELF, $icon_array, $sort, $limit, $header_output, $help_array; //$PHP_SELF, $result = cpg_db_query("SELECT *, UNIX_TIMESTAMP(expiry) AS expiry FROM {$CONFIG['TABLE_BANNED']} WHERE brute_force = 0 ORDER BY {$sort} {$limit}"); $count = $result->numRows(); echo <<<EOT <tr> <th align="center" class="tableh2"> {$lang_banning_php['ban_id']} {$header_output['ban_a']} {$header_output['ban_d']} </th> <th align="center" class="tableh2"> {$lang_common['delete']} </th> <th align="center" class="tableh2"> {$lang_banning_php['user_name']} {$help_array['user_name']} {$header_output['user_name_a']} {$header_output['user_name_d']} </th> <th align="center" class="tableh2"> {$lang_banning_php['email_address']} {$help_array['email_address']} {$header_output['email_a']} {$header_output['email_d']} </th> <th align="center" class="tableh2"> {$lang_banning_php['ip_address']} {$help_array['ip_address']} {$header_output['ip_a']} {$header_output['ip_d']} </th> <th align="center" class="tableh2"> {$lang_banning_php['expires']} {$help_array['expiration']} {$header_output['expiry_a']} {$header_output['expiry_d']} </th> </tr> EOT; if ($count > 0) { $row_counter = 0; while ($row = $result->fetchAssoc()) { if ($row['user_id']) { $username = get_username($row['user_id']); $view_profile = '<a href="profile.php?uid=' . $row['user_id'] . '">' . cpg_fetch_icon('my_profile', 0, $lang_usermgr_php['view_profile']) . '</a>'; } elseif ($row['user_name']) { $username = $row['user_name']; $view_profile = ''; } else { $username = ''; $view_profile = ''; } list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['ip_addr'])); $expired = ''; if ($row['expiry']) { $expiry = date('Y-m-d', $row['expiry']); if (date('Y-m-d H:i:s', $row['expiry']) < date('Y-m-d H:i:s')) { $expired = $lang_banning_php['expired']; } } else { $expiry = ''; } echo <<<EOT <tr> <td class="{$row_style_class}" align="center" valign="top"> <input type="hidden" name="ban_id[]" id="ban_id_{$row['ban_id']}" value="{$row['ban_id']}" /> {$row['ban_id']} </td> <td class="{$row_style_class}" align="right" valign="top"> {$expired} <input type="checkbox" class="checkbox" name="select_{$row['ban_id']}" id="select_{$row['ban_id']}" value="1" /> </td> <td class="{$row_style_class}" valign="top"> <input type="text" class="textinput" style="width: 100%" name="user_name_{$row['ban_id']}" id="user_name_{$row['ban_id']}" value="{$username}" /> {$view_profile} <input type="hidden" name="user_id_{$row['ban_id']}" id="user_id_{$row['ban_id']}" value="{$row['user_id']}" /> </td> <td class="{$row_style_class}" valign="top"> <input type="text" class="textinput email_field" style="width: 100%" name="email_{$row['ban_id']}" id="email_{$row['ban_id']}" value="{$row['email']}" /> <div id="email_{$row['ban_id']}_warning" class="cpg_message_validation formFieldWarning" style="display:none;">{$lang_banning_php['email_field_invalid']}</div> </td> <td class="{$row_style_class}" valign="top"> <input type="text" class="textinput ip_field" style="width: 80%" size="15" maxlength="15" name="ip_addr_{$row['ban_id']}" id="ip_addr_{$row['ban_id']}" value="{$row['ip_addr']}" />{$row['ip_detail']} <div id="ip_addr_{$row['ban_id']}_warning" class="cpg_message_validation formFieldWarning" style="display:none;">{$lang_banning_php['ip_address_field_invalid']}</div> </td> <td class="{$row_style_class}" valign="top"> <input type="text" class="textinput date-pick" style="width:80%" size="10" maxlength="10" name="expiration_{$row['ban_id']}" id="expiration_{$row['ban_id']}" value="{$expiry}" title="{$lang_banning_php['select_date']}" /> <div id="expiration_{$row['ban_id']}_warning" class="cpg_message_validation formFieldWarning" style="display:none;">{$lang_banning_php['expiry_field_invalid']}</div> </td> </tr> EOT; $row_counter++; } } $result->free(); }
/** * resize_image() * * Create a file containing a resized image * * @param $src_file the source file * @param $dest_file the destination file * @param $new_size the size of the square within which the new image must fit * @param $method the method used for image resizing * @return 'true' in case of success */ function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark = "false", $sharpen = 0, $media_type = "false") { global $CONFIG, $ERROR; global $lang_errors; list($sharpen) = CPGPluginAPI::filter('image_sharpen', array($sharpen, $new_size)); //Make Cage $superCage = Inspekt::makeSuperCage(); $imginfo = cpg_getimagesize($src_file); if ($imginfo == null) { return false; } // GD can only handle JPG & PNG images if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && $CONFIG['GIF_support'] == 0) { $ERROR = $lang_errors['gd_file_type_err']; //return false; return array('error' => $ERROR); } // height/width $srcWidth = $imginfo[0]; $srcHeight = $imginfo[1]; $crop = 0; // initialize // if cropping is enabled calculate cropping parameters if ($thumb_use == 'ex') { $thb_width = $CONFIG['thumb_width']; $thb_height = $CONFIG['thumb_height']; if ($new_size == $thb_width) { $crop = 1; switch ($CONFIG['thumb_method']) { //cropping parameters for ImageMagick case "im": $resize_commands = ""; if ($srcWidth / $srcHeight > $thb_width / $thb_height) { $resize_commands .= "-resize x" . $thb_height; $resized_w = $thb_height / $srcHeight * $srcWidth; $resize_commands .= " -crop " . $thb_width . "x" . $thb_height . "+" . round(($resized_w - $thb_width) / 2) . "+0"; } else { $resize_commands .= "-resize " . $thb_width; $resized_h = $thb_width / $srcWidth * $srcHeight; $resize_commands .= " -crop " . $thb_width . "x" . $thb_height . "+0+" . round(($resized_h - $thb_height) / 2); } break; // cropping parameters for GD2 // cropping parameters for GD2 default: if ($srcHeight < $srcWidth) { $ratio = (double) ($srcHeight / $thb_height); $cpyWidth = round($thb_width * $ratio); if ($cpyWidth > $srcWidth) { $ratio = (double) ($srcWidth / $thb_width); $cpyWidth = $srcWidth; $cpyHeight = round($thb_height * $ratio); $xOffset = 0; $yOffset = round(($srcHeight - $cpyHeight) / 2); } else { $cpyHeight = $srcHeight; $xOffset = round(($srcWidth - $cpyWidth) / 2); $yOffset = 0; } } else { $ratio = (double) ($srcWidth / $thb_width); $cpyHeight = round($thb_height * $ratio); if ($cpyHeight > $srcHeight) { $ratio = (double) ($srcHeight / $thb_height); $cpyHeight = $srcHeight; $cpyWidth = round($thb_width * $ratio); $xOffset = round(($srcWidth - $cpyWidth) / 2); $yOffset = 0; } else { $cpyWidth = $srcWidth; $xOffset = 0; $yOffset = round(($srcHeight - $cpyHeight) / 2); } } $destWidth = $thb_width; $destHeight = $thb_height; $srcWidth = $cpyWidth; $srcHeight = $cpyHeight; break; } } else { $ratio = max($srcWidth, $srcHeight) / $new_size; } } elseif ($thumb_use == 'wd') { // resize method width $ratio = $srcWidth / $new_size; } elseif ($thumb_use == 'ht') { // resize method height $ratio = $srcHeight / $new_size; } else { // resize method any $ratio = max($srcWidth, $srcHeight) / $new_size; } $ratio = max($ratio, 1.0); if ($thumb_use == 'orig') { $ratio = 1.0; } if ($crop != 1) { $destWidth = (int) ($srcWidth / $ratio); $destHeight = (int) ($srcHeight / $ratio); $resize_commands = "-geometry " . $destWidth . "x" . $destHeight; $xOffset = 0; $yOffset = 0; } // Method for thumbnails creation switch ($method) { case "im": if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) { // get the basedir, remove '/include' $cur_dir = substr(dirname(__FILE__), 0, -8); $src_file = '"' . $cur_dir . '\\' . strtr($src_file, '/', '\\') . '"'; $im_dest_file = str_replace('%', '%%', '"' . $cur_dir . '\\' . strtr($dest_file, '/', '\\') . '"'); } else { $src_file = escapeshellarg($src_file); $im_dest_file = str_replace('%', '%%', escapeshellarg($dest_file)); } $output = array(); /* * Hack for working with ImageMagick on Windows even if IM is installed in C:\Program Files. * By Aditya Mooley <*****@*****.**> */ if ($sharpen == 1 && $CONFIG['enable_unsharp'] == 1) { $unsharp_mask = " -unsharp " . $CONFIG['unsharp_radius'] . "x" . sqrt($CONFIG['unsharp_radius']) . "+" . $CONFIG['unsharp_amount'] / 100 . "+" . $CONFIG['unsharp_threshold'] / 100 . " "; } else { $unsharp_mask = ""; } if ($superCage->env->getMatched('OS', '/win/i')) { $cmd = "\"" . str_replace("\\", "/", $CONFIG['impath']) . "convert\" -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} " . $resize_commands . " " . $unsharp_mask . " " . str_replace("\\", "/", $src_file) . " " . str_replace("\\", "/", $im_dest_file); exec("\"{$cmd}\"", $output, $retval); } else { $cmd = "{$CONFIG['impath']}convert -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} " . $resize_commands . " " . $unsharp_mask . " {$src_file} {$im_dest_file}"; exec($cmd, $output, $retval); } if ($media_type != "false") { //if a manual thumb gets generated we watermark the thumb with the media type //we now need to get the absolute path to the thumb watermark files $path_parts = pathinfo($CONFIG['watermark_file']); $CONFIG['watermark_file'] = $path_parts["dirname"] . "/wm_" . $media_type . ".png"; } if ($watermark == "true" || $media_type != "false") { //do we need to resize the watermark to fit onto the intermediate? $wm_normal = (int) $CONFIG['reduce_watermark']; if ($wm_normal > $destWidth) { $wm_resize = (int) ($destWidth / $wm_normal * 100); //we have to create a temporary, downsized watermark file in the edit folder //temp path for small wm $path_to_tmp_wm = './' . $CONFIG['fullpath'] . 'edit/temp_wm.png'; if ($superCage->env->getMatched('OS', '/win/i')) { $cmd = "\"" . str_replace("\\", "/", $CONFIG['impath']) . "convert\" -resize " . $wm_resize . "% " . str_replace("\\", "/", $CONFIG['watermark_file']) . " " . str_replace("\\", "/", $path_to_tmp_wm); exec("\"{$cmd}\"", $output, $retval); } else { $cmd = "{$CONFIG['impath']}convert -resize {$wm_resize}% {$CONFIG['watermark_file']} {$path_to_tmp_wm}"; exec($cmd, $output, $retval); } $wm_file = $path_to_tmp_wm; //set the path to the wm file to the temp one } else { $wm_file = $CONFIG['watermark_file']; //if no downsize... we take the orig watermark } // now we apply the watermark if ($superCage->env->getMatched('OS', '/win/i')) { $cmd = "\"" . str_replace("\\", "/", $CONFIG['impath']) . "composite\" -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} \"{$wm_file}\" " . str_replace("\\", "/", $im_dest_file) . " " . str_replace("\\", "/", $im_dest_file); exec("\"{$cmd}\"", $output, $retval); } else { $cmd = "{$CONFIG['impath']}composite -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} {$wm_file} {$im_dest_file} {$im_dest_file}"; exec($cmd, $output, $retval); } } if ($retval) { $ERROR = "Error executing ImageMagick - Return value: {$retval}"; if ($CONFIG['debug_mode']) { // Re-execute the command with the backtick operator in order to get all outputs // will not work is safe mode is enabled $output = `{$cmd} 2>&1`; $ERROR .= "<br /><br /><div align=\"left\">Cmd line : <br /><span style=\"font-size:120%\">" . nl2br(htmlspecialchars($cmd)) . "</span></div>"; $ERROR .= "<br /><br /><div align=\"left\">The convert program said:<br /><span style=\"font-size:120%\">"; $ERROR .= nl2br(htmlspecialchars($output)); $ERROR .= "</span></div>"; } @unlink($dest_file); return array('error' => $ERROR); } break; case "gd1": if (!function_exists('imagecreatefromjpeg')) { return array('error' => 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', 'halt_upload' => 1); } if ($imginfo[2] == GIS_JPG) { $src_img = imagecreatefromjpeg($src_file); } else { $src_img = imagecreatefrompng($src_file); } if (!$src_img) { $ERROR = $lang_errors['invalid_image']; return array('error' => $ERROR); } $dst_img = imagecreate($destWidth, $destHeight); imagecopyresized($dst_img, $src_img, 0, 0, $xOffset, $yOffset, (int) $destWidth, (int) $destHeight, $srcWidth, $srcHeight); touch($dest_file); $fh = fopen($dest_file, 'w'); fclose($fh); imagejpeg($dst_img, $dest_file, $CONFIG['jpeg_qual']); imagedestroy($src_img); imagedestroy($dst_img); break; case "gd2": if (!function_exists('imagecreatefromjpeg')) { return array('error' => 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', 'halt_upload' => 1); } if (!function_exists('imagecreatetruecolor')) { return array('error' => 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the admin page', 'halt_upload' => 1); } if ($imginfo[2] == GIS_GIF && $CONFIG['GIF_support'] == 1) { $src_img = imagecreatefromgif($src_file); } elseif ($imginfo[2] == GIS_JPG) { $src_img = imagecreatefromjpeg($src_file); } else { $src_img = imagecreatefrompng($src_file); } if (!$src_img) { $ERROR = $lang_errors['invalid_image']; //return false; return array('error' => $ERROR); } if ($imginfo[2] == GIS_GIF) { $dst_img = imagecreate($destWidth, $destHeight); } else { $dst_img = imagecreatetruecolor($destWidth, $destHeight); if ($imginfo[2] == GIS_PNG) { imagealphablending($dst_img, false); } } imagecopyresampled($dst_img, $src_img, 0, 0, $xOffset, $yOffset, (int) $destWidth, (int) $destHeight, $srcWidth, $srcHeight); touch($dest_file); $fh = fopen($dest_file, 'w'); fclose($fh); //sharpen the thumb if ($sharpen == 1 && $CONFIG['enable_unsharp'] == 1) { UnsharpMask($dst_img, $CONFIG['unsharp_amount'], $CONFIG['unsharp_radius'], $CONFIG['unsharp_threshold']); } if ($media_type != "false") { //if a manual thumb gets generated we watermark the thumb with the media type //we now need to get the absolute path to the thumb watermark files $path_parts = pathinfo($CONFIG['watermark_file']); $CONFIG['watermark_file'] = $path_parts["dirname"] . "/wm_" . $media_type . ".png"; } if ($watermark == "true" || $media_type != "false") { //shrink watermark on intermediate images -> If I had known that this is that �%&# with the transparency preserve... grrr $wm_normal = (int) $CONFIG['reduce_watermark']; if ($wm_normal > $destWidth) { $wm_resize = $destWidth / $wm_normal; //load the original, huge sized logo (the one we want to size down) $temp_logoImage = ImageCreateFromPNG($CONFIG['watermark_file']); //get it's size $temp_logoW = ImageSX($temp_logoImage); $temp_logoH = ImageSY($temp_logoImage); //calculate new size $logoW = (int) ($temp_logoW * $wm_resize); $logoH = (int) ($temp_logoH * $wm_resize); //we create a new, resized logo $logoImage = imagecreatetruecolor($logoW, $logoH); //just to be sure that transparency gets preserved imagealphablending($logoImage, FALSE); imagealphablending($temp_logoImage, TRUE); //now copy and resize the big one into the temp resized img imagecopyresampled($logoImage, $temp_logoImage, 0, 0, 0, 0, (int) $logoW, (int) $logoH, $temp_logoW, $temp_logoH); //we do not need the temp (huge) watermark anymore imagedestroy($temp_logoImage); } else { // shrink not enabled or no intermediate... $logoImage = ImageCreateFromPNG($CONFIG['watermark_file']); $logoW = ImageSX($logoImage); $logoH = ImageSY($logoImage); } //where is the watermark displayed... $pos = $CONFIG['where_put_watermark']; if ($pos == "northwest") { $src_x = 5; $src_y = 5; } else { if ($pos == "northeast") { $src_x = $destWidth - ($logoW + 5); $src_y = 5; } else { if ($pos == "southwest") { $src_x = 5; $src_y = $destHeight - ($logoH + 5); } else { if ($pos == "southeast") { $src_x = $destWidth - ($logoW + 5); $src_y = $destHeight - ($logoH + 5); } else { if ($pos == "center") { $src_x = $destWidth / 2 - $logoW / 2; $src_y = $destHeight / 2 - $logoH / 2; } } } } } imagealphablending($dst_img, TRUE); imagecolortransparent($logoImage, imagecolorat($logoImage, $CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery'])); ImageCopy($dst_img, $logoImage, $src_x, $src_y, 0, 0, $logoW, $logoH); } if ($imginfo[2] == GIS_PNG) { imagesavealpha($dst_img, true); imagepng($dst_img, $dest_file, round((100 - $CONFIG['jpeg_qual']) / 10)); } else { imagejpeg($dst_img, $dest_file, $CONFIG['jpeg_qual']); } imagedestroy($src_img); imagedestroy($dst_img); break; } // Set mode of uploaded picture @chmod($dest_file, octdec($CONFIG['default_file_mode'])); //silence the output in case chmod is disabled // We check that the image is valid $imginfo = cpg_getimagesize($dest_file); if ($imginfo == null) { $ERROR = $lang_errors['resize_failed']; @unlink($dest_file); //return false; return array('error' => $ERROR); } else { return true; } }
/** * cpg_filter_page_html() * * Executes page_html filter on all plugins * * @param string HTML * @return string HTML **/ function &cpg_filter_page_html(&$html) { return CPGPluginAPI::filter('page_html', $html); }
function theme_html_picture() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER; global $album, $comment_date_fmt, $template_display_media; global $lang_display_image_php, $lang_picinfo; $pid = $CURRENT_PIC_DATA['pid']; $pic_title = ''; if (!isset($USER['liv']) || !is_array($USER['liv'])) { $USER['liv'] = array(); } // Add 1 to hit counter if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) { add_hit($pid); if (count($USER['liv']) > 4) { array_shift($USER['liv']); } array_push($USER['liv'], $pid); } if ($CONFIG['thumb_use'] == 'ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width']) { // The wierd comparision is because only picture_width is stored $condition = true; } elseif ($CONFIG['thumb_use'] == 'wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']) { $condition = true; } elseif ($CONFIG['thumb_use'] == 'any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) { $condition = true; //thumb cropping } elseif ($CONFIG['thumb_use'] == 'ex' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) { $condition = true; } else { $condition = false; } 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 .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords']; } if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_media, 'img_desc'); } else { if (!$CURRENT_PIC_DATA['title']) { template_extract_block($template_display_media, 'title'); } if (!$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_media, 'caption'); } } $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : ''; if ($CONFIG['make_intermediate'] && $condition) { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal'); } else { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize'); } //thumb cropping $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width'], 'normal'); $pic_title = ''; $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']); if ($mime_content['content'] == 'movie' || $mime_content['content'] == 'audio') { if ($CURRENT_PIC_DATA['pwidth'] == 0 || $CURRENT_PIC_DATA['pheight'] == 0) { $CURRENT_PIC_DATA['pwidth'] = 320; // Default width // Set default height; if file is a movie if ($mime_content['content'] == 'movie') { $CURRENT_PIC_DATA['pheight'] = 240; // Default height } } $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; $image_size['whole'] = 'width="' . $CURRENT_PIC_DATA['pwidth'] . '" height="' . ($CURRENT_PIC_DATA['pheight'] + $ctrl_height) . '"'; } if ($mime_content['content'] == 'image') { if (isset($image_size['reduced'])) { $imginfo = getimagesize($picture_url); $winsizeX = $CURRENT_PIC_DATA['pwidth'] + $CONFIG['fullsize_padding_x']; //the +'s are the mysterious FF and IE paddings $winsizeY = $CURRENT_PIC_DATA['pheight'] + $CONFIG['fullsize_padding_y']; //the +'s are the mysterious FF and IE paddings if ($CONFIG['transparent_overlay'] == 1) { $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$imginfo[0]}\" height=\"{$imginfo[1]}\" class=\"image\">"; $pic_html .= "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid={$pid}&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width={$winsizeX},height={$winsizeY}')\">"; $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title; $pic_html .= "<img src=\"images/image.gif?id=" . floor(rand() * 1000 + rand()) . "\" width={$imginfo[0]} height={$imginfo[1]} border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />"; $pic_html .= "</a>\n </td></tr></table>"; } else { $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid={$pid}&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width={$winsizeX},height={$winsizeY}')\">"; $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title; $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />"; $pic_html .= "</a>\n"; } } else { if ($CONFIG['transparent_overlay'] == 1) { $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$CURRENT_PIC_DATA['pwidth']}\" height=\"{$CURRENT_PIC_DATA['pheight']}\" class=\"image\">"; $pic_html .= "<img src=\"images/image.gif?id=" . floor(rand() * 1000 + rand()) . "\" width={$CURRENT_PIC_DATA['pwidth']} height={$CURRENT_PIC_DATA['pheight']} border=\"0\" alt=\"\" /><br />\n"; $pic_html .= "</td></tr></table>"; } else { $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n"; } } } elseif ($mime_content['content'] == 'document') { $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb'); $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"" . $pic_thumb_url . "\" border=\"0\" class=\"image\" /></a>\n<br />"; } else { $autostart = $CONFIG['media_autostart'] ? 'true' : 'false'; $players['WMP'] = array('id' => 'MediaPlayer', 'clsid' => 'classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" ', 'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ', 'mime' => 'type="application/x-mplayer2" '); $players['RMP'] = array('id' => 'RealPlayer', 'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ', 'codebase' => '', 'mime' => 'type="audio/x-pn-realaudio-plugin" '); $players['QT'] = array('id' => 'QuickTime', 'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ', 'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ', 'mime' => 'type="video/x-quicktime" '); $players['SWF'] = array('id' => 'SWFlash', 'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ', 'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ', 'mime' => 'type="application/x-shockwave-flash" '); $players['UNK'] = array('id' => 'DefaultPlayer', 'clsid' => '', 'codebase' => '', 'mime' => ''); if (isset($_COOKIE[$CONFIG['cookie_name'] . '_' . $mime_content['extension'] . 'player'])) { $user_player = $_COOKIE[$CONFIG['cookie_name'] . '_' . $mime_content['extension'] . 'player']; } else { $user_player = $mime_content['player']; } // There isn't a player selected or user wants client-side control if (!$user_player) { $user_player = 'UNK'; } $player = $players[$user_player]; $pic_html = '<object id="' . $player['id'] . '" ' . $player['classid'] . $player['codebase'] . $player['mime'] . $image_size['whole'] . '>'; $pic_html .= "<param name=\"autostart\" value=\"{$autostart}\" /><param name=\"src\" value=\"" . $picture_url . "\" />"; $pic_html .= '<embed ' . $image_size['whole'] . ' src="' . $picture_url . '" autostart="' . $autostart . '" ' . $player['mime'] . '></embed>'; $pic_html .= "</object><br />\n"; } $CURRENT_PIC_DATA['html'] = $pic_html; $CURRENT_PIC_DATA['header'] = ''; $CURRENT_PIC_DATA['footer'] = ''; $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data', $CURRENT_PIC_DATA); $params = array('{CELL_HEIGHT}' => '100', '{IMAGE}' => $CURRENT_PIC_DATA['header'] . $CURRENT_PIC_DATA['html'] . $CURRENT_PIC_DATA['footer'], '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'], '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']), '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption'])); return template_eval($template_display_media, $params); }
if (mysql_num_rows($result)) { // This album has a password. // Check whether the cookie is set for the current albums password if (!empty($_COOKIE[$CONFIG['cookie_name'] . '_albpw'])) { $alb_pw = unserialize($_COOKIE[$CONFIG['cookie_name'] . '_albpw']); // Check whether the alubm id in the cookie is same as that of the album id send by get if (isset($alb_pw[$album]) && ctype_alnum($alb_pw[$album])) { $sql = "SELECT aid FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE MD5(alb_password)='{$alb_pw[$album]}' AND aid='{$album}'"; $result = cpg_db_query($sql); if (mysql_num_rows($result)) { $valid = true; //The album password is correct. Show the album details. get_private_album_set(); } } } } else { // Album with no password. Might be a private or normal album. Just set valid as true. $valid = true; } } $META_ALBUM_SET = $ALBUM_SET; //temporary assignment until we are sure we are keeping the $META_ALBUM_SET functionality. CPGPluginAPI::filter('post_breadcrumb', null); if (!$valid) { form_albpw(); } else { display_thumbnails($album, isset($cat) ? $cat : 0, $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true); } pagefooter(); ob_end_flush();
<tr> <td class="tableh2">{$lang_search_php['albcatfields']}:</td> <td class="tableh2"> </td> </tr> <tr> <td><input type="checkbox" name="album_title" id="album_title" class="checkbox" /><label for="album_title" class="clickable_option">{$lang_search_php['album_title']}</label></td> <td> </td> </tr> <tr> <td><input type="checkbox" name="category_title" id="category_title" class="checkbox" /><label for="category_title" class="clickable_option">{$lang_search_php['category_title']}</label></td> <td> </td> </tr> </table> </td> </tr> EOT; $text .= endtable(true); $text .= '</form>'; $text = CPGPluginAPI::filter('search_form', $text); echo $text; if ($CONFIG['clickable_keyword_search'] != 0) { include 'include/keyword.inc.php'; } echo <<<EOT <script language="javascript" type="text/javascript"> <!-- document.searchcpg.search.focus(); --> </script> EOT; pagefooter();
EOT; // captcha code if ($CONFIG['ecard_captcha'] == 1 || $CONFIG['ecard_captcha'] == 2 && !USER_ID) { $help = cpg_display_help('f=empty.htm&h=lang_common[captcha_help_title]&t=lang_common[captcha_help]', 470, 245); $captcha_print = <<<EOT <tr> <td class="tableb"> {$lang_common['confirm']} {$help} </td> <td class="tableb" colspan="2"> <input type="text" name="confirmCode" id="confirmCode" size="5" maxlength="5" class="textinput" /> <img src="captcha.php" align="middle" border="0" alt="" /> </td> </tr> EOT; $captcha_print = CPGPluginAPI::filter('captcha_ecard_print', $captcha_print); echo $captcha_print; } echo <<<EOT <tr> <td colspan="3" align="center" class="tablef"> <button type="submit" class="button" name="preview" id="preview" value="{$lang_ecard_php['preview_button']}">{$icon_array['preview']}{$lang_ecard_php['preview_button']}</button> <button type="submit" class="button" name="submit" id="submit" value="{$lang_ecard_php['submit_button']}">{$icon_array['ok']}{$lang_ecard_php['submit_button']}</button> </td> </tr> EOT; endtable(); list($timestamp, $form_token) = getFormToken(); echo <<<EOT <input type="hidden" name="form_token" value="{$form_token}" />
foreach ($db_fields as $value) { print ' <td class="' . $row_style_class . '">' . $LINEBREAK; if (${$value} == 1) { if ($value == 'browser' && array_key_exists($row[$value], $browserArray)) { print ' <img src="images/browser/' . $browserArray[$row[$value]] . '" border="0" title="' . $row[$value] . '" alt="" />' . $LINEBREAK; } elseif ($value == 'os' && array_key_exists($row[$value], $osArray)) { print ' <img src="images/os/' . $osArray[$row[$value]] . '" border="0" title="' . $row[$value] . '" alt="" />' . $LINEBREAK; } elseif ($value == 'uid') { if ($row[$value] != 0) { $user_data = $cpg_udb->get_user_infos($row[$value]); print ' <a href="profile.php?uid=' . $row[$value] . '">' . $user_data['user_name'] . '</a>' . $LINEBREAK; } else { print ' <span title="' . $lang_stat_details_php['guest'] . '">-</span>' . $LINEBREAK; } } elseif ($value == 'ip') { list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row[$value])); print ' ' . $row[$value] . $row['ip_detail'] . $LINEBREAK; } else { print ' ' . $row[$value] . $LINEBREAK; } } print ' </td>' . $LINEBREAK; } if ($pid == '') { print ' <td class="' . $row_style_class . '">' . $LINEBREAK; if ($file == 1) { $thumb_url = get_pic_url($row, 'thumb'); if (!is_image($row['filename'])) { $image_info = cpg_getimagesize($thumb_url); $row['pwidth'] = $image_info[0]; $row['pheight'] = $image_info[1];
function html_picinfo() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $FAVPICS, $REFERER; global $album, $lang_picinfo, $lang_display_image_php, $lang_byte_units, $lastup_date_fmt; if ($CURRENT_PIC_DATA['owner_id'] && $CURRENT_PIC_DATA['owner_name']) { $owner_link = '<a href ="profile.php?uid=' . $CURRENT_PIC_DATA['owner_id'] . '">' . $CURRENT_PIC_DATA['owner_name'] . '</a> '; } else { $owner_link = ''; } if (GALLERY_ADMIN_MODE && $CURRENT_PIC_DATA['pic_raw_ip']) { if ($CURRENT_PIC_DATA['pic_hdr_ip']) { $ipinfo = ' (' . $CURRENT_PIC_DATA['pic_hdr_ip'] . '[' . $CURRENT_PIC_DATA['pic_raw_ip'] . ']) / '; } else { $ipinfo = ' (' . $CURRENT_PIC_DATA['pic_raw_ip'] . ') / '; } } else { if ($owner_link) { $ipinfo = '/ '; } else { $ipinfo = ''; } } $info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']); $info[$lang_picinfo['Album name']] = '<span class="alblink">' . $owner_link . '/ <a href="thumbnails.php?album=' . $CURRENT_PIC_DATA['aid'] . '">' . $CURRENT_ALBUM_DATA['title'] . '</a></span>'; if ($CURRENT_PIC_DATA['votes'] > 0) { if (defined('THEME_HAS_RATING_GRAPHICS')) { $prefix = $THEME_DIR; } else { $prefix = ''; } if (GALLERY_ADMIN_MODE) { $width = 800; $height = 500; } else { $width = 400; $height = 250; } $detailsLink = $CONFIG['vote_details'] ? ' (<a href="#" onclick="MM_openBrWindow(\'stat_details.php?type=vote&pid=' . $CURRENT_PIC_DATA['pid'] . '&sort=sdate&dir=&sdate=1&ip=1&rating=1&referer=1&browser=1&os=1\',\'\',\'resizable=yes,width=' . $width . ',height=' . $height . ',top=50,left=50,scrollbars=yes\'); return false;">' . $lang_picinfo['details'] . '</a>)' : ''; $info[sprintf($lang_picinfo['Rating'], $CURRENT_PIC_DATA['votes'])] = '<img width="65" height="14" src="plugins/enlargeit/rating/rating' . round($CURRENT_PIC_DATA['pic_rating'] / 2000) . '.gif" align="middle" alt="" />' . $detailsLink; } if ($CURRENT_PIC_DATA['keywords'] != "") { $info[$lang_picinfo['Keywords']] = '<span class="alblink">' . preg_replace("/(\\S+)/", "<a href=\"thumbnails.php?album=search&search=\\1\">\\1</a>", $CURRENT_PIC_DATA['keywords']) . '</span>'; } for ($i = 1; $i <= 4; $i++) { if ($CONFIG['user_field' . $i . '_name']) { if ($CURRENT_PIC_DATA['user' . $i] != "") { $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]); } } } $info[$lang_picinfo['File Size']] = $CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . ' ' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . ' ' . $lang_byte_units[0]; $info[$lang_picinfo['File Size']] = '<span dir="ltr">' . $info[$lang_picinfo['File Size']] . '</span>'; $info[$lang_picinfo['Date Added']] = localised_date($CURRENT_PIC_DATA['ctime'], $lastup_date_fmt); $info[$lang_picinfo['Dimensions']] = sprintf($lang_display_image_php['size'], $CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']); $detailsLink = $CURRENT_PIC_DATA['hits'] && $CONFIG['hit_details'] && GALLERY_ADMIN_MODE ? ' (<a href="#" onclick="MM_openBrWindow(\'stat_details.php?type=hits&pid=' . $CURRENT_PIC_DATA['pid'] . '&sort=sdate&dir=&sdate=1&ip=1&search_phrase=1&referer=1&browser=1&os=1\',\'\',\'resizable=yes,width=800,height=500,top=50,left=50,scrollbars=yes\'); return false;">' . $lang_picinfo['details'] . '</a>)' : ''; $info[$lang_picinfo['Displayed']] = sprintf($lang_display_image_php['views'], $CURRENT_PIC_DATA['hits']); $info[$lang_picinfo['Displayed']] .= $detailsLink; $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename']; if ($CONFIG['read_exif_data']) { $exif = exif_parse_file($path_to_pic); } if (isset($exif) && is_array($exif)) { array_walk($exif, 'sanitize_data'); $info = array_merge($info, $exif); } if ($CONFIG['read_iptc_data']) { $iptc = get_IPTC($path_to_pic); } if (isset($iptc) && is_array($iptc)) { array_walk($iptc, 'sanitize_data'); if (!empty($iptc['Title'])) { $info[$lang_picinfo['iptcTitle']] = $iptc['Title']; } if (!empty($iptc['Copyright'])) { $info[$lang_picinfo['iptcCopyright']] = $iptc['Copyright']; } if (!empty($iptc['Keywords'])) { $info[$lang_picinfo['iptcKeywords']] = implode(' ', $iptc['Keywords']); } if (!empty($iptc['Category'])) { $info[$lang_picinfo['iptcCategory']] = $iptc['Category']; } if (!empty($iptc['SubCategories'])) { $info[$lang_picinfo['iptcSubCategories']] = implode(' ', $iptc['SubCategories']); } } /** * Filter file information */ $info = CPGPluginAPI::filter('file_info', $info); return theme_html_picinfo($info); }
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0) { global $CONFIG, $ERROR, $USER_DATA, $PIC_NEED_APPROVAL; global $lang_errors; $image = $CONFIG['fullpath'] . $filepath . $filename; $normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename; $thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename; if (!is_known_filetype($image)) { return false; } elseif (is_image($filename)) { $imagesize = getimagesize($image); if ($CONFIG['read_iptc_data']) { $iptc = get_IPTC($image); if (is_array($iptc) && !$title && !$caption && !$keywords) { //if any of those 3 are filled out we don't want to override them, they may be blank on purpose. $title = isset($iptc['Title']) ? $iptc['Title'] : $title; $caption = isset($iptc['Caption']) ? $iptc['Caption'] : $caption; $keywords = isset($iptc['Keywords']) ? implode(' ', $iptc['Keywords']) : $keywords; } } if ((USER_IS_ADMIN && $CONFIG['auto_resize'] == 1 || !USER_IS_ADMIN && $CONFIG['auto_resize'] > 0) && max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) { //resize_image($image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $imagesize[0] > $CONFIG['max_upl_width_height'] ? 'wd' : 'ht'); resize_image($image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $CONFIG['thumb_use']); $imagesize = getimagesize($image); } if (!file_exists($thumb)) { if (!resize_image($image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'])) { return false; } } if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal)) { if (!resize_image($image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'])) { return false; } } } else { $imagesize[0] = $iwidth; $imagesize[1] = $iheight; } $image_filesize = filesize($image); $total_filesize = is_image($filename) ? $image_filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumb) : $image_filesize; // Test if disk quota exceeded if (!GALLERY_ADMIN_MODE && $USER_DATA['group_quota'] && $category == FIRST_USER_CAT + USER_ID) { $result = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT + USER_ID) . "'"); $record = mysql_fetch_array($result); $total_space_used = $record[0]; mysql_free_result($result); if ($total_space_used + $total_filesize >> 10 > $USER_DATA['group_quota']) { @unlink($image); if (is_image($image)) { @unlink($normal); @unlink($thumb); } $msg = strtr($lang_errors['quota_exceeded'], array('[quota]' => $USER_DATA['group_quota'], '[space]' => $total_space_used >> 10)); cpg_die(ERROR, $msg, __FILE__, __LINE__); } } // Test if picture requires approval if (GALLERY_ADMIN_MODE) { $approved = 'YES'; } elseif (!$USER_DATA['priv_upl_need_approval'] && $category == FIRST_USER_CAT + USER_ID) { $approved = 'YES'; } elseif (!$USER_DATA['pub_upl_need_approval'] && $category < FIRST_USER_CAT) { $approved = 'YES'; } else { $approved = 'NO'; } $PIC_NEED_APPROVAL = $approved == 'NO'; // User ID is now recorded when in admin mode (casper) $user_id = USER_ID; $username = USER_NAME; // Populate Array to pass to plugins, then to SQL. $CURRENT_PIC_DATA['aid'] = $aid; $CURRENT_PIC_DATA['filepath'] = $filepath; $CURRENT_PIC_DATA['filename'] = $filename; $CURRENT_PIC_DATA['filesize'] = $image_filesize; $CURRENT_PIC_DATA['total_filesize'] = $total_filesize; $CURRENT_PIC_DATA['pwidth'] = $imagesize[0]; $CURRENT_PIC_DATA['pheight'] = $imagesize[1]; $CURRENT_PIC_DATA['owner_id'] = $user_id; $CURRENT_PIC_DATA['owner_name'] = $username; $CURRENT_PIC_DATA['title'] = $title; $CURRENT_PIC_DATA['caption'] = $caption; $CURRENT_PIC_DATA['keywords'] = $keywords; $CURRENT_PIC_DATA['approved'] = $approved; $CURRENT_PIC_DATA['user1'] = $user1; $CURRENT_PIC_DATA['user2'] = $user2; $CURRENT_PIC_DATA['user3'] = $user3; $CURRENT_PIC_DATA['user4'] = $user4; $CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip; $CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip; $CURRENT_PIC_DATA['position'] = $position; $CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data', $CURRENT_PIC_DATA); $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')"; $result = cpg_db_query($query); return $result; }
function check_user_info(&$error) { global $CONFIG; global $lang_register_php, $lang_common, $lang_register_approve_email; global $lang_register_user_login, $lang_errors; $superCage = Inspekt::makeSuperCage(); $user_name = trim(get_post_var('username')); $password = trim(get_post_var('password')); $password_again = trim(get_post_var('password_verification')); $email = trim(get_post_var('email')); $profile1 = $superCage->post->getEscaped('user_profile1'); $profile2 = $superCage->post->getEscaped('user_profile2'); $profile3 = $superCage->post->getEscaped('user_profile3'); $profile4 = $superCage->post->getEscaped('user_profile4'); $profile5 = $superCage->post->getEscaped('user_profile5'); $profile6 = $superCage->post->getEscaped('user_profile6'); $agree_disclaimer = $superCage->post->getEscaped('agree'); $captcha_confirmation = $superCage->post->getEscaped('confirmCode'); $sql = "SELECT null FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '{$user_name}'"; $result = cpg_db_query($sql); if (mysql_num_rows($result)) { $error = '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_user_exists'] . '</li>'; return false; } mysql_free_result($result); if (utf_strlen($user_name) < 2) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['username_warning2'] . '</li>'; } if (!empty($CONFIG['global_registration_pw'])) { $global_registration_pw = get_post_var('global_registration_pw'); if ($global_registration_pw != $CONFIG['global_registration_pw']) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_global_pw'] . '</li>'; } elseif ($password == $CONFIG['global_registration_pw']) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_global_pass_same'] . '</li>'; } } if (utf_strlen($password) < 2) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_warning1'] . '</li>'; } if ($password == $user_name) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_warning2'] . '</li>'; } if ($password != $password_again) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_verification_warning1'] . '</li>'; } if (!Inspekt::isEmail($email)) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['email_warning2'] . '</li>'; } if ($CONFIG['user_registration_disclaimer'] == 2 && $agree_disclaimer != 1) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_disclaimer'] . '</li>'; } // Perform the ban check against email address and username $result = cpg_db_query("SELECT null FROM {$CONFIG['TABLE_BANNED']} WHERE user_name = '{$user_name}' AND brute_force = 0 LIMIT 1"); if (mysql_num_rows($result)) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['user_name_banned'] . '</li>'; } mysql_free_result($result); $result = cpg_db_query("SELECT null FROM {$CONFIG['TABLE_BANNED']} WHERE email = '{$email}' AND brute_force = 0 LIMIT 1"); if (mysql_num_rows($result)) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['email_address_banned'] . '</li>'; } mysql_free_result($result); // check captcha if ($CONFIG['registration_captcha'] != 0) { if (!captcha_plugin_enabled('register')) { require "include/captcha.inc.php"; if (!PhpCaptcha::Validate($captcha_confirmation)) { $error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_errors['captcha_error'] . '</li>'; } } else { $error = CPGPluginAPI::filter('captcha_register_validate', $error); } } if (!$CONFIG['allow_duplicate_emails_addr']) { $sql = "SELECT null FROM {$CONFIG['TABLE_USERS']} WHERE user_email = '{$email}'"; $result = cpg_db_query($sql); if (mysql_num_rows($result)) { $error = '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_duplicate_email'] . '</li>'; } mysql_free_result($result); } $error = CPGPluginAPI::filter('register_form_validate', $error); if ($error != '') { return false; } if ($CONFIG['reg_requires_valid_email'] || $CONFIG['admin_activation']) { $active = 'NO'; list($usec, $sec) = explode(' ', microtime()); $seed = (double) $sec + (double) $usec * 100000; srand($seed); $act_key = md5(uniqid(rand(), 1)); } else { $active = 'YES'; $act_key = ''; } $encpassword = md5($password); $user_language = $CONFIG['lang']; $sql = "INSERT INTO {$CONFIG['TABLE_USERS']} (user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6, user_language) VALUES (NOW(), '{$active}', '{$act_key}', '{$user_name}', '{$encpassword}', '{$email}', '{$profile1}', '{$profile2}', '{$profile3}', '{$profile4}', '{$profile5}', '{$profile6}', '{$user_language}')"; $result = cpg_db_query($sql); $user_array = array(); $user_array['user_id'] = mysql_insert_id(); $user_array['user_name'] = $user_name; $user_array['user_email'] = $email; $user_array['user_active'] = $active; CPGPluginAPI::action('register_form_submit', $user_array); if ($CONFIG['log_mode']) { log_write('New user "' . $user_name . '" registered', CPG_ACCESS_LOG); } // Create a personal album if corresponding option is enabled if ($CONFIG['personal_album_on_registration'] == 1) { $user_id = mysql_insert_id(); $catid = $user_id + FIRST_USER_CAT; cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`, `owner`) VALUES ('{$user_name}', {$catid}, {$user_id})"); } // Registrations must be activated/verified by the user clicking a link in an email if ($CONFIG['reg_requires_valid_email']) { // Mail the user the activation/verification link $act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key; $template_vars = array('{SITE_NAME}' => $CONFIG['gallery_name'], '{USER_NAME}' => $user_name, '{ACT_LINK}' => $act_link); if (!cpg_mail($email, sprintf($lang_register_php['confirm_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_php['confirm_email'], $template_vars)))) { cpg_die(CRITICAL_ERROR, $lang_register_php['failed_sending_email'], __FILE__, __LINE__); } msg_box($lang_register_php['information'], $lang_register_php['thank_you'], $lang_common['continue'], 'index.php'); } else { if ($CONFIG['admin_activation']) { // We need admin activation only msg_box($lang_register_php['information'], $lang_register_php['thank_you_admin_activation'], $lang_common['continue'], 'index.php'); } else { // No activation required, account is ready for login msg_box($lang_register_php['information'], $lang_register_php['acct_active'], $lang_common['continue'], 'index.php'); } } // email notification or actication link to admin if ($CONFIG['reg_notify_admin_email'] || $CONFIG['admin_activation'] && !$CONFIG['reg_requires_valid_email']) { if (UDB_INTEGRATION == 'coppermine') { // get default language in which to inform the admins $result = cpg_db_query("SELECT user_id, user_email, user_language FROM {$CONFIG['TABLE_USERS']} WHERE user_group = 1"); while ($row = mysql_fetch_assoc($result)) { if (!empty($row['user_email'])) { $admins[$row['user_id']] = array('email' => $row['user_email'], 'lang' => $row['user_language']); } } } else { //@todo: is it possible to get the language from bridged installs? $admins[] = array('email' => $CONFIG['gallery_admin_email'], 'lang' => 'english'); } foreach ($admins as $admin) { //check if the admin language is available if (file_exists("lang/{$admin['lang']}.php")) { $lang_register_php_def = cpg_get_default_lang_var('lang_register_php', $admin['lang']); $lang_register_approve_email_def = cpg_get_default_lang_var('lang_register_approve_email', $admin['lang']); } else { $lang_register_php_def = cpg_get_default_lang_var('lang_register_php'); $lang_register_approve_email_def = cpg_get_default_lang_var('lang_register_approve_email'); } // if the admin has to activate the login, give them the link to do so; but only if users don't have to verify their email address if ($CONFIG['admin_activation'] && !$CONFIG['reg_requires_valid_email']) { $act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key; $template_vars = array('{SITE_NAME}' => $CONFIG['gallery_name'], '{USER_NAME}' => $user_name, '{ACT_LINK}' => $act_link); cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_request_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_approve_email_def, $template_vars))); } elseif ($CONFIG['reg_notify_admin_email']) { // otherwise, email is for information only cpg_mail($admin['email'], sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name)); } } } return true; }
/** * Get the form token and timestamp for the current user * this is calculated * * @return array ($timestamp, $token) */ function getFormToken($timestamp = null) { global $raw_ip, $CONFIG; $superCage = Inspekt::makeSuperCage(); if ($timestamp == null) { $timestamp = time(); } $token_criteria_array = array('user_id' => USER_ID, 'site_tkn' => $CONFIG['site_token'], 'timestamp' => $timestamp); $token_criteria_array = CPGPluginAPI::filter('token_criteria', $token_criteria_array); $token_string = ''; foreach ($token_criteria_array as $value) { $token_string .= $value; } $token = md5($token_string); return array($timestamp, $token); }
} else { $tableclass = 'tableb tableb_alternate'; } // build a link to the author's profile if applicable if ($row['author_id'] != 0) { $profile_link_start = '<a href="profile.php?uid=' . $row['author_id'] . '">'; $profile_link_end = '</a>'; } else { $profile_link_start = ''; $profile_link_end = ''; } // Create the output of the IP address list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['msg_raw_ip'])); $ip_address_output = $row['msg_raw_ip'] . $row['ip_detail']; if ($row['msg_raw_ip'] != $row['msg_hdr_ip']) { list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['msg_hdr_ip'])); $ip_address_output .= '<br />' . $row['msg_hdr_ip'] . $row['ip_detail']; } // output the table rows echo <<<EOT <tr> <td class="{$tableclass}" valign="top" align="center"> {$loopCounter} </td> <td class="{$tableclass}" valign="top" align="center"> <input name="cid_array[]" id="check{$row['msg_id']}" type="checkbox" value="{$row['msg_id']}" {$checkbox_status} /> </td> <td class="{$tableclass}" valign="top" align="left"> {$comment_approval_status} </td> <td class="{$tableclass}" valign="top" align="center">
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '') { global $CONFIG; global $template_thumb_view_title_row, $template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors, $lang_main_menu; global $REFERER, $lightbox; // plugin addition $superCage = Inspekt::makeSuperCage(); static $header = ''; static $thumb_cell = ''; static $empty_cell = ''; static $row_separator = ''; static $footer = ''; static $tabs = ''; static $spacer = ''; if ($header == '') { $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell'); $tabs = template_extract_block($template_thumbnail_view, 'tabs'); $header = template_extract_block($template_thumbnail_view, 'header'); $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell'); $row_separator = template_extract_block($template_thumbnail_view, 'row_separator'); $footer = template_extract_block($template_thumbnail_view, 'footer'); $spacer = template_extract_block($template_thumbnail_view, 'spacer'); } $cat_link = is_numeric($aid) ? '' : '&cat=' . $cat; $date_link = $date == '' ? '' : '&date=' . $date; if ($superCage->get->getInt('uid')) { $uid_link = '&uid=' . $superCage->get->getInt('uid'); } else { $uid_link = ''; } $theme_thumb_tab_tmpl = $template_tab_display; if ($mode == 'thumb') { $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page'])); $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&page=%d')); } else { $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page'])); $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d')); } $thumbcols = $CONFIG['thumbcols']; $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%'; $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : ''; if (!GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) { template_extract_block($template_thumb_view_title_row, 'admin_buttons'); } // The sort order options are not available for meta albums if ($sort_options) { if (GALLERY_ADMIN_MODE) { $param = array('{ALBUM_ID}' => $aid, '{CAT_ID}' => $cat > 0 ? $cat : $cat, '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_common['album_properties'], '{PARENT_CAT}' => cpg_fetch_icon('category', 1) . $lang_common['parent_category'], '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_common['edit_files'], '{ALBUM_MGR}' => cpg_fetch_icon('alb_mgr', 1) . $lang_common['album_manager']); } else { $param = array(); } $param['{ALBUM_NAME}'] = $album_name; $title = template_eval($template_thumb_view_title_row, $param); } elseif ($aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) { //Lots of stuff can be added here later $param = array('{ALBUM_NAME}' => $album_name, '{DOWNLOAD_ZIP}' => cpg_fetch_icon('zip', 2) . $lang_thumb_view['download_zip']); $title = template_eval($template_fav_thumb_view_title_row, $param); } else { $title = $album_name; } // plugin addition $lightbox['data']['referrer'] = urldecode($REFERER); if ($superCage->post->keyExists('search') && !$superCage->get->keyExists('album')) { $lightbox['data']['referrer'] .= "?album=search"; } if (isset($lightbox['data']['activate_favsel'])) { echo '<form action="' . $lightbox['data']['referrer'] . '" method="post">'; } if ($mode == 'thumb') { starttable('100%', $title, $thumbcols); } else { starttable('100%'); } echo $header; $i = 0; global $thumb; // make $thumb accessible to plugins foreach ($thumb_list as $thumb) { $i++; if ($mode == 'thumb') { if ($aid == 'lastalb') { $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']); } elseif ($aid == 'random') { // determine if thumbnail link targets should open in a pop-up if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');'; } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) { $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');'; } else { $target = 'javascript:;" onClick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');'; } } else { $target = "displayimage.php?pid={$thumb['pid']}{$uid_link}"; } $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']); } else { // determine if thumbnail link targets should open in a pop-up if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');'; } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) { $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');'; } else { $target = 'javascript:;" onClick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');'; } } else { $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&pid={$thumb['pid']}{$uid_link}"; } $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']); } } else { // mode != 'thumb' // Used for mode = 'user' from list_users() in index.php $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => ''); } // Plugin Filter: allow plugin to modify or add tags to process $params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params); echo template_eval($thumb_cell, $params); if ($i % $thumbcols == 0 && $i < count($thumb_list)) { echo $row_separator; } } // foreach $thumb unset($thumb); // unset $thumb to avoid conflicting with global for (; $i % $thumbcols; $i++) { echo $empty_cell; } echo $footer; // plugin addition if ($lightbox['message'] != '') { echo <<<EOT \t\t<tr> \t\t\t<td class="tableb" colspan="{$thumbcols}"> \t\t\t\t<div class="cpg_message_info"> \t\t\t\t\t{$lightbox['message']} \t\t\t\t</div> \t\t\t</td> \t\t</tr> EOT; } if (isset($lightbox['data']['activate_favkill'])) { $confirm = addslashes($lightbox['lang']['Confirm']); echo <<<EOT \t\t<tr> \t\t\t<td class="tablef" align="center" colspan="{$thumbcols}"> \t\t\t\t<button type="submit" class="button" value="{$lightbox['lang']['Remove selected']}">{$lightbox['icon']['delete']}{$lightbox['lang']['Remove selected']}</button> \t\t\t\t<button type="submit" class="button" name="clear_favs" value="{$lightbox['lang']['Remove all']}" onclick="return confirm('{$confirm}');">{$lightbox['icon']['delete_all']}{$lightbox['lang']['Remove all']}</button> \t\t\t</td> \t\t</tr> EOT; } elseif (isset($lightbox['data']['activate_favsel'])) { echo <<<EOT \t\t<tr> \t\t\t<td class="tablef" align="center" colspan="{$thumbcols}"> \t\t\t\t<button type="submit" class="button" value="{$lightbox['lang']['Add selected']}" title="{$lightbox['lang']['Add selected files to favorites']}">{$lightbox['icon']['add']}{$lightbox['lang']['Add selected']}</button> \t\t\t\t<a href="thumbnails.php?album=favpics" title="{$lang_main_menu['fav_title']}" class="admin_menu">{$lightbox['icon']['favorites']}{$lang_main_menu['fav_lnk']}</a> \t\t\t</td> \t\t</tr> EOT; } if ($display_tabs) { $params = array('{THUMB_COLS}' => $thumbcols, '{TABS}' => $tabs_html); echo template_eval($tabs, $params); } endtable(); // plugin addition if (isset($lightbox['data']['activate_favsel'])) { echo '</form>'; } echo $spacer; }
/** * get_pic_url() * * Return the url for a picture * * @param array $pic_row * @param string $mode * @param boolean $system_pic * @return string **/ function &get_pic_url(&$pic_row, $mode, $system_pic = false) { global $CONFIG, $THEME_DIR; static $pic_prefix = array(); static $url_prefix = array(); if (!count($pic_prefix)) { $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'orig' => $CONFIG['orig_pfx'], 'fullsize' => ''); $url_prefix = array(0 => $CONFIG['fullpath']); } $mime_content = cpg_get_type($pic_row['filename']); $pic_row = array_merge($pic_row, $mime_content); $filepathname = null; // Code to handle custom thumbnails // If fullsize or normal mode use regular file if ($mime_content['content'] != 'image' && $mode == 'normal') { $mode = 'fullsize'; } elseif ($mime_content['content'] != 'image' && $mode == 'thumb' || $system_pic) { $thumb_extensions = array('.gif', '.png', '.jpg'); // Check for user-level custom thumbnails // Create custom thumb path and erase extension using filename; Erase filename's extension $custom_thumb_path = $url_prefix[$pic_row['url_prefix']] . $pic_row['filepath'] . $pic_prefix[$mode]; $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($pic_row['filename'])); // Check for file-specific thumbs foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $file_base_name . $extension)) { $filepathname = $custom_thumb_path . $file_base_name . $extension; break; } } if (!$system_pic) { // Check for extension-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension; break; } } } // Check for content-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['content'] . $extension; break; } } } } // Use default thumbs if (is_null($filepathname)) { // Check for default theme- and global-level thumbs $thumb_paths[] = $THEME_DIR . 'images/'; // Used for custom theme thumbs $thumb_paths[] = 'images/'; // Default Coppermine thumbs foreach ($thumb_paths as $default_thumb_path) { if (is_dir($default_thumb_path)) { if (!$system_pic) { foreach ($thumb_extensions as $extension) { // Check for extension-specific thumbs if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension; //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex $pic_row['system_icon'] = true; break 2; } } foreach ($thumb_extensions as $extension) { // Check for media-specific thumbs (movie,document,audio) if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension; //thumb cropping $pic_row['system_icon'] = true; break 2; } } } else { // Check for file-specific thumbs for system files foreach ($thumb_extensions as $extension) { if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension; //thumb cropping $pic_row['system_icon'] = true; break 2; } } } } } } $filepathname = path2url($filepathname); } if (is_null($filepathname)) { $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']); } // Added hack: "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image if ($mode == 'thumb' && !isset($pic_row['mode'])) { $pic_row['url'] = $filepathname; $pic_row['mode'] = $mode; $pic_row = CPGPluginAPI::filter('thumb_data', $pic_row); } elseif ($mode != 'thumb') { $pic_row['url'] = $filepathname; $pic_row['mode'] = $mode; } else { $pic_row['url'] = $filepathname; } return $pic_row['url']; }
<img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_db_ecard_php['ecard_ascending']}" /> </a> <a href="{$urlWithoutSort}sort=red"> <img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_db_ecard_php['ecard_descending']}" /> </a> </th> </tr> EOT; $tempClass = 'tableb'; $ecard_review_icon = cpg_fetch_icon('ecard_review', 0, $lang_db_ecard_php['ecard_display']); $result = cpg_db_query("SELECT eid, sender_name, sender_email, recipient_name, recipient_email, link, date, sender_ip FROM {$CONFIG['TABLE_ECARDS']} ORDER BY {$sortBy} {$sortDirection} LIMIT {$startFrom}, {$countTo}"); while ($line = mysql_fetch_assoc($result)) { $date = strftime($lang_date['lastcom'], $line['date']); list($line['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $line['sender_ip'])); echo <<<EOT <tr> <td class="{$tempClass}" align="center"> <input type="checkbox" name="eid[]" value="{$line['eid']}" id="eidselector" class="checkbox" /> </td> <td class="{$tempClass}"> <span class="thumb_caption">{$line['sender_name']}</span> </td> <td class="{$tempClass}"> <span class="thumb_caption"> <a href="mailto:{$line['sender_email']}">{$line['sender_email']}</a> </span> </td> <td class="{$tempClass}"> <span class="thumb_caption">
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '') { global $CONFIG, $CURRENT_ALBUM_DATA; global $template_thumb_view_title_row, $template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors; $superCage = Inspekt::makeSuperCage(); static $header = ''; static $thumb_cell = ''; static $empty_cell = ''; static $row_separator = ''; static $footer = ''; static $tabs = ''; static $spacer = ''; if ($header == '') { $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell'); $tabs = template_extract_block($template_thumbnail_view, 'tabs'); $header = template_extract_block($template_thumbnail_view, 'header'); $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell'); $row_separator = template_extract_block($template_thumbnail_view, 'row_separator'); $footer = template_extract_block($template_thumbnail_view, 'footer'); $spacer = template_extract_block($template_thumbnail_view, 'spacer'); } $cat_link = is_numeric($aid) ? '' : '&cat=' . $cat; $date_link = $date == '' ? '' : '&date=' . $date; if ($superCage->get->getInt('uid')) { $uid_link = '&uid=' . $superCage->get->getInt('uid'); } else { $uid_link = ''; } $theme_thumb_tab_tmpl = $template_tab_display; if ($mode == 'thumb') { $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page'])); $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&page=%d')); } else { $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page'])); $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d')); } $thumbcols = $CONFIG['thumbcols']; $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%'; $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : ''; if (!GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) { template_extract_block($template_thumb_view_title_row, 'admin_buttons'); } // The sort order options are not available for meta albums if ($sort_options) { if (GALLERY_ADMIN_MODE) { $param = array('{ALBUM_ID}' => $aid, '{CAT_ID}' => $cat > 0 ? $cat : $CURRENT_ALBUM_DATA['category'], '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_common['album_properties'], '{PARENT_CAT}' => cpg_fetch_icon('category', 1) . $lang_common['parent_category'], '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_common['edit_files'], '{ALBUM_MGR}' => cpg_fetch_icon('alb_mgr', 1) . $lang_common['album_manager']); } else { $param = array(); } $param['{ALBUM_NAME}'] = $album_name; $title = template_eval($template_thumb_view_title_row, $param); } elseif ($aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) { //Lots of stuff can be added here later $param = array('{ALBUM_NAME}' => $album_name, '{DOWNLOAD_ZIP}' => cpg_fetch_icon('zip', 2) . $lang_thumb_view['download_zip']); $title = template_eval($template_fav_thumb_view_title_row, $param); } else { $title = $album_name; } if ($mode == 'thumb') { starttable('100%', $title, $thumbcols); } else { starttable('100%'); } echo $header; $i = 0; global $thumb; // make $thumb accessible to plugins foreach ($thumb_list as $thumb) { $i++; if ($mode == 'thumb') { if ($aid == 'lastalb') { $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => $thumb['admin_menu']); } else { // determine if thumbnail link targets should open in a pop-up if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');'; } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) { $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');'; } else { $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');'; } } elseif ($aid == 'random') { $target = "displayimage.php?pid={$thumb['pid']}{$uid_link}#top_display_media"; } elseif ($aid == 'lastcom' || $aid == 'lastcomby') { $page = cpg_get_comment_page_number($thumb['msg_id']); $page = is_numeric($page) ? "&page={$page}" : ''; $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&pid={$thumb['pid']}{$uid_link}&msg_id={$thumb['msg_id']}{$page}#comment{$thumb['msg_id']}"; } else { $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&pid={$thumb['pid']}{$uid_link}#top_display_media"; } $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => $thumb['admin_menu']); } } else { // mode != 'thumb' // Used for mode = 'user' from list_users() in index.php $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => ''); } // Plugin Filter: allow plugin to modify or add tags to process $params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params); echo template_eval($thumb_cell, $params); if ($i % $thumbcols == 0 && $i < count($thumb_list)) { echo $row_separator; } } // foreach $thumb unset($thumb); // unset $thumb to avoid conflicting with global for (; $i % $thumbcols; $i++) { echo $empty_cell; } echo $footer; if ($display_tabs) { $params = array('{THUMB_COLS}' => $thumbcols, '{TABS}' => $tabs_html); echo template_eval($tabs, $params); } endtable(); echo $spacer; }
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 cpg_mail($to, $subject, $msg_body = '', $type = 'text/plain', $sender_name = '', $sender_email = '', $msg_body_plaintext = '') { global $CONFIG, $lang_charset, $HTML_SUBST; // makeshift plaintext if not set if (!$msg_body_plaintext) { $msg_body_plaintext = strip_tags($msg_body); } // convert possible special HTML entities to characters $subject = htmlspecialchars_decode($subject, ENT_QUOTES); // send mails to ALL admins - not bridged only if ($to == 'admin') { if (UDB_INTEGRATION == 'coppermine') { $to = array($CONFIG['gallery_admin_email']); $result = cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_group = 1"); while ($row = mysql_fetch_assoc($result)) { if (!empty($row['user_email'])) { $to[] = $row['user_email']; } } $to = array_unique($to); } else { $to = array($CONFIG['gallery_admin_email']); } } else { $to = array($to); } $to = CPGPluginAPI::filter('cpg_mail_to_email', $to); if ($sender_name == '') { $sender_name = $CONFIG['gallery_name']; } if ($sender_email == '') { $sender_email = $CONFIG['gallery_admin_email']; } $sender_email = CPGPluginAPI::filter('cpg_mail_sender_email', $sender_email); $sender_name = strtr($sender_name, array_flip($HTML_SUBST)); $charset = $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; $mail = new cpg_PHPmailer(); if ($CONFIG['smtp_host']) { $mail->IsSMTP(); $mail->Host = $CONFIG['smtp_host']; if ($CONFIG['smtp_username']) { $mail->SMTPAuth = true; $mail->Username = $CONFIG['smtp_username']; $mail->Password = $CONFIG['smtp_password']; } else { $mail->SMTPAuth = false; } } else { $mail->IsMail(); } $mail->IsHTML(true); foreach ($to as $email) { $mail->AddAddress($email); } $mail->From = $sender_email; $mail->FromName = $sender_name; $mail->Subject = $subject; $mail->Body = $msg_body; $mail->AltBody = $msg_body_plaintext; $mail->CharSet = $charset; $mail->Sender = $CONFIG['gallery_admin_email']; if ($CONFIG['smtp_host'] && $CONFIG['log_mode'] == CPG_LOG_ALL) { $mail->SMTPDebug = 2; ob_start(); } $result = $mail->Send(); if ($CONFIG['smtp_host'] && $CONFIG['log_mode'] == CPG_LOG_ALL) { $log = ob_get_clean(); log_write($log, CPG_MAIL_LOG); } return $result; }
function theme_javascript_head() { global $CONFIG, $JS, $LINEBREAK; $return = ''; // Check if we have any variables being set using set_js_vars function $JS['vars']['not_default_theme'] = true; if (isset($JS['vars']) && count($JS['vars'])) { // Convert the $JS['vars'] array to json object string $json_vars = json_encode($JS['vars']); // Output the json object $return = <<<EOT <script type="text/javascript"> /* <![CDATA[ */ var js_vars = {$json_vars}; /* ]]> */ </script> EOT; } // Check if we have any js includes if (isset($JS['includes']) && count($JS['includes'])) { // Bring the jquery core library to the very top of the list if (in_array('js/jquery-1.3.2.js', $JS['includes']) == TRUE) { $key = array_search('js/jquery-1.3.2.js', $JS['includes']); unset($JS['includes'][$key]); array_unshift($JS['includes'], 'js/jquery-1.3.2.js'); } $JS['includes'] = CPGPluginAPI::filter('javascript_includes', $JS['includes']); // Include all the file which were set using js_include() function foreach ($JS['includes'] as $js_file) { $return .= '<script type="text/javascript" src="' . $js_file . '"></script>' . $LINEBREAK; } } $return .= <<<EOT <script language="JavaScript" type="text/javascript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_showHideLayers() { //v6.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; } obj.visibility=v; } } //--> </script> EOT; return $return; }
$filepath .= '/'; } else { $filepath = $CONFIG['userpics']; $dest_dir = $CONFIG['fullpath'] . $filepath; } // Check that target dir is writable if (!is_writable($dest_dir)) { cpg_die(CRITICAL_ERROR, sprintf($lang_db_input_php['dest_dir_ro'], $dest_dir), __FILE__, __LINE__, true); } if (get_magic_quotes_gpc()) { //Using getRaw() as we have custom sanitization code below $picture_name = stripslashes($superCage->files->getRaw("/userpicture/name")); } else { $picture_name = $superCage->files->getRaw("/userpicture/name"); } $picture_name = CPGPluginAPI::filter('upload_file_name', $picture_name); // Replace forbidden chars (including white spaces and special chars) with underscores $picture_name = replace_forbidden($picture_name); // Check that the file uploaded has a valid extension if (!preg_match("/(.+)\\.(.*?)\\Z/", $picture_name, $matches)) { $matches[1] = 'invalid_fname'; $matches[2] = 'xxx'; } if ($matches[2] == '' || !is_known_filetype($matches)) { cpg_die(ERROR, $lang_db_input_php['err_invalid_fext'] . ' ' . $CONFIG['allowed_file_extensions'], __FILE__, __LINE__); } // Create a unique name for the uploaded file $nr = 0; $picture_name = $matches[1] . '.' . $matches[2]; while (file_exists($dest_dir . $picture_name)) { $picture_name = $matches[1] . '~' . $nr++ . '.' . $matches[2];
// define some vars that need to exist in JS set_js_var('lang_warning_dont_submit', $lang_admin_php['warning_dont_submit']); set_js_var('lang_reset_to_default', $lang_admin_php['reset_to_default']); set_js_var('lang_no_change_needed', $lang_admin_php['no_change_needed']); set_js_var('display_reset_boxes', $CONFIG['display_reset_boxes_in_config']); // Include the JS for admin.php js_include('js/jquery.spinbutton.js'); js_include('js/admin.js'); $admin_data_array = $CONFIG; $optionLoopCounter = 0; $submit_icon = cpg_fetch_icon('ok', 1); $factory_icon = cpg_fetch_icon('delete', 1); require_once 'include/admin.inc.php'; // populate the array for the admin data (could later be done using an XML file) // Filter upload choices to allow plugins to add upload methods $config_data['user_settings']['upload_mechanism']['options'] = CPGPluginAPI::filter('upload_options', $config_data['user_settings']['upload_mechanism']['options']); // loop through the config sections and populate the array that determines what sections to expand/collapse $collapseSections_array = array(); // By default, all sections should be hidden. Let's populate the array first with all existing sections and then later remove the ones that are supposed to be expanded by default foreach ($config_data as $key => $value) { $collapseSections_array[] = $key; } $userMessage = ''; //The message that the will be displayed if something went wrong or to tell the user that we had success $problemFields_array = array(); // we'll add field-wrapper-IDs to this array to visualize that something went wrong. Onload we'll assign the class "important" to the boxes that correspond to the array data if ($superCage->post->keyExists('restore_config')) { // user has chosen to factory-reset the config --- start // first we check if the form token is valid if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
function list_users($search = '') { global $CONFIG, $cpg_udb; //, $PHP_SELF; global $lang_usermgr_php, $lang_byte_units, $register_date_fmt, $lang_common; global $lim_user, $number_of_columns; global $USER_DATA; $number_of_columns_minus_one = $number_of_columns - 1; $sort_codes = array('name_a' => 'user_name ASC', 'name_d' => 'user_name DESC', 'group_a' => 'group_name ASC', 'group_d' => 'group_name DESC', 'reg_a' => 'user_regdate ASC', 'reg_d' => 'user_regdate DESC', 'pic_a' => 'pic_count ASC', 'pic_d' => 'pic_count DESC', 'disku_a' => 'disk_usage ASC', 'disku_d' => 'disk_usage DESC', 'lv_a' => 'user_lastvisit ASC', 'lv_d' => 'user_lastvisit DESC'); $sort = !isset($_GET['sort']) || !isset($sort_codes[$_GET['sort']]) ? 'reg_d' : $_GET['sort']; $tab_tmpl = array('left_text' => '<td width="100%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>' . $lang_usermgr_php['u_user_on_p_pages'] . '</b></td>' . "\n", 'tab_header' => '', 'tab_trailer' => '', 'active_tab' => '<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="tableb_compact"><b>%d</b></td>', 'inactive_tab' => '<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="' . $_SERVER['PHP_SELF'] . '?page=%d&sort=' . $sort . '"<b>%d</b></a></td>' . "\n"); $makereadonly = $CONFIG['bridge_enable'] ? 'style="display:none;" disabled="disabled" ' : ''; $user_count = $cpg_udb->get_user_count(); if (!$user_count) { cpg_die(CRITICAL_ERROR, $lang_usermgr_php['err_no_users'], __FILE__, __LINE__); } $user_per_page = 25; $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $lower_limit = ($page - 1) * $user_per_page; $total_pages = ceil($user_count / $user_per_page); /* * Commented out to support bridge files -Omni * $sql = "SELECT user_id, user_name, user_email, UNIX_TIMESTAMP(user_regdate) as user_regdate, UNIX_TIMESTAMP(user_lastvisit) as user_lastvisit, user_active, ". "COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_name, group_quota ". "FROM {$CONFIG['TABLE_USERS']} AS u ". "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group = group_id ". "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.owner_id = u.user_id ". $search. "GROUP BY user_id " . "ORDER BY " . $sort_codes[$sort] . " ". "LIMIT $lower_limit, $user_per_page"; */ $users = $cpg_udb->get_users(array('users_per_page' => $user_per_page, 'lower_limit' => $lower_limit, 'search' => $search, 'sort' => $sort)); /* * Commented out to support bridge files -Omni * */ //$result = cpg_db_query($sql); $tabs = create_tabs($user_count, $page, $total_pages, $tab_tmpl); $lb = "<select name=\"album_listbox\" class=\"listbox\" onChange=\"if(this.options[this.selectedIndex].value) window.location.href='{$_SERVER['PHP_SELF']}?page={$page}&sort='+this.options[this.selectedIndex].value;\">\n"; foreach ($sort_codes as $key => $value) { $selected = $key == $sort ? "SELECTED" : ""; $lb .= " <option value=\"" . $key . "\" {$selected}>" . $lang_usermgr_php[$key] . "</option>\n"; } $lb .= "</select>\n"; echo <<<EOT <script type="text/javascript" language="javascript"> <!-- function selectAll(d,box) { var f = document.editForm; for (i = 0; i < f.length; i++) { //alert (f[i].name.indexOf(box)); if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) { if (d.checked) { f[i].checked = true; } else { f[i].checked = false; } } } if (d.name == "checkAll") { document.getElementsByName('checkAll2')[0].checked = document.getElementsByName('checkAll')[0].checked; } else { document.getElementsByName('checkAll')[0].checked = document.getElementsByName('checkAll2')[0].checked; } } function selectaction(d,box) { // check if an action has been selected var action = document.editForm.action.value; if (action == '') { return false; } // check if at least one user has been selected var checked_counter = 0; var checked_string = ''; var f = document.editForm; for (i = 0; i < f.length; i++) { if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) { if (f[i].checked) { checked_counter = checked_counter + 1; if (checked_string == '') { checked_string = f[i].name; } else { checked_string = checked_string + ',' + f[i].name; } } } } if (checked_counter == 0) { document.editForm.action.value = ''; alert('{$lang_usermgr_php['alert_no_selection']}'); return false; } document.editForm.id.value = checked_string; document.editForm.new_password.style.display = "none"; document.editForm.group.style.display = "none"; document.editForm.go.style.display = "none"; document.editForm.delete_files.style.display = "none"; document.editForm.delete_comments.style.display = "none"; switch(document.editForm.action.value) { case "delete": document.editForm.delete_files.style.display = "inline"; document.editForm.delete_comments.style.display = "inline"; document.editForm.go.style.display = "inline"; break; case "reset_password": document.editForm.new_password.style.display = "inline"; document.editForm.go.style.display = "inline"; break; case "change_group": document.editForm.new_password.value = ''; document.editForm.group.style.display = "inline"; if (document.editForm.group.value != '') { document.editForm.submit(); } break; case "add_group": document.editForm.new_password.value = ''; document.editForm.group.style.display = "inline"; if (document.editForm.group.value != '') { document.editForm.submit(); } break; default: document.editForm.new_password.value = ''; document.editForm.submit(); break; } } --> </script> EOT; starttable('100%'); if (isset($_POST['username'])) { $search_filter = '<td class="tableh1" align="center">' . $lang_usermgr_php['search_result'] . '«' . $_POST['username'] . '»</td>'; } else { $search_filter = ''; } $help = ' ' . cpg_display_help('f=users.htm&as=user_cp&ae=user_cp_end&top=1', '650', '500'); echo <<<EOT <tr> <td colspan="{$number_of_columns}" class="tableh1"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td class="tableh1"> EOT; if (!$lim_user) { echo '<h2>' . $lang_usermgr_php['user_manager'] . $help . '</h2>'; } else { echo '<h2>' . $lang_usermgr_php['memberlist'] . '</h2>'; } echo <<<EOT </td> {$search_filter} <td class="tableh1" align="right"><b>{$lang_usermgr_php['sort_by']}</b>: {$lb}</td> </tr> </table> </td> </tr> EOT; // Accept header addons echo CPGPluginAPI::filter('usermgr_header', ''); print '<form method="get" action="delete.php" name="editForm" id="cpgform">' . "\n"; print '<input type="hidden" name="id" value="" />'; if (!$lim_user) { echo <<<EOT <tr> <td class="tableh1" align="center"><input type="checkbox" {$makereadonly}name="checkAll" onClick="selectAll(this,'u');" class="checkbox" title="{$lang_common['check_uncheck_all']}" /></td> <td class="tableh1" colspan="2"><b><span class="statlink">{$lang_usermgr_php['name']}</span></b> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=name_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=name_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a> </td> <td class="tableh1"><b><a href="groupmgr.php" class="statlink">{$lang_usermgr_php['group']}</a></b> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=group_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=group_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a> </td> <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['registered_on']}</span></b> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=reg_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=reg_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a> </td> <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['last_visit']}</span></b> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=lv_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=lv_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a> </td> <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['pictures']}</span></b> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=pic_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=pic_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_d']}" /></a> </td> <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_used']}</span></b> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=disku_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_a']}" /></a> <a href="{$_SERVER['PHP_SELF']}?page={$page}&sort=disku_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_d']}" /></a> </td> <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_quota']}</span></b> </td> </tr> EOT; } else { echo <<<EOT <tr> <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['name']}</span></b></td> <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['group']}</span></b></td> <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['registered_on']}</span></b></td> <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['last_visit']}</span></b></td> <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['pictures']}</span></b></td> <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_used']}</span></b></td> <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_quota']}</span></b></td> </tr> EOT; } $loop_counter = 0; foreach ($users as $user) { if ($loop_counter == 0) { $row_style_class = 'tableb'; } else { $row_style_class = 'tableb tableb_alternate'; } $loop_counter++; if ($loop_counter > 1) { $loop_counter = 0; } if ($user['disk_usage'] == '') { $user['disk_usage'] = 0; } if ($user['user_active'] == 'NO') { $user['group_name'] = '<i>' . $lang_usermgr_php['inactive'] . '</i>'; } $user['user_regdate'] = localised_date($user['user_regdate'], $register_date_fmt); if ($user['user_lastvisit']) { $user['user_lastvisit'] = localised_date($user['user_lastvisit'], $register_date_fmt); } else { $user['user_lastvisit'] = $lang_usermgr_php['never']; } $usr_link = '<a href="profile.php?uid=' . $user['user_id'] . '">' . $user['user_name']; if ($user['pic_count']) { $usr_link .= '</a> (<a href="thumbnails.php?album=lastupby&uid=' . $user['user_id'] . '">' . $lang_usermgr_php['latest_upload'] . '</a>)'; } else { $usr_link .= '</a>'; } if (!$lim_user) { if ($user['user_id'] == $USER_DATA['user_id']) { $profile_link = 'profile.php?op=edit_profile'; $checkbox_html = ''; } else { $profile_link = $_SERVER['PHP_SELF'] . '?op=edit&user_id=' . $user['user_id']; $checkbox_html = '<input name="u' . $user['user_id'] . '" ' . $makereadonly . 'type="checkbox" value="" class="checkbox" />'; } echo <<<EOT <tr> <td class="{$row_style_class}" align="center">{$checkbox_html}</td> <td class="{$row_style_class}">{$usr_link}</td> <td class="{$row_style_class}" align="center"> <button type="button" class="button" {$makereadonly}onclick="window.location.href ='{$profile_link}';"> <img src="images/edit.gif" width="16" height="16" border="0" alt="" title="{$lang_usermgr_php['edit']}" /> </button> </td> <td class="{$row_style_class}">{$user['group_name']}</td> <td class="{$row_style_class}">{$user['user_regdate']}</td> <td class="{$row_style_class}">{$user['user_lastvisit']}</td> <td class="{$row_style_class}" align="right">{$user['pic_count']}</td> <td class="{$row_style_class}" align="right">{$user['disk_usage']} {$lang_byte_units[1]}</td> <td class="{$row_style_class}" align="right">{$user['group_quota']} {$lang_byte_units[1]}</td> </tr> EOT; } else { echo <<<EOT <tr> <td class="{$row_style_class}">{$usr_link}</td> <td class="{$row_style_class}">{$user['group_name']}</td> <td class="{$row_style_class}">{$user['user_regdate']}</td> <td class="{$row_style_class}">{$user['user_lastvisit']}</td> <td class="{$row_style_class}" align="right">{$user['pic_count']}</td> <td class="{$row_style_class}" align="right">{$user['disk_usage']} {$lang_byte_units[1]}</td> <td class="{$row_style_class}" align="right">{$user['group_quota']} {$lang_byte_units[1]}</td> </tr> EOT; } } // while //mysql_free_result($result); if (!$lim_user) { if (isset($_POST['username'])) { $search_string_default = 'value="' . $_POST['username'] . '"'; } else { $search_string_default = 'value="' . $lang_usermgr_php['search'] . '" onfocus="this.value=\'\'"'; } $help = cpg_display_help('f=users.htm&as=user_cp_search&ae=user_cp_search_end&top=1', '400', '150'); echo <<<EOT <tr> <td class="tablef" align="center"><input type="checkbox" name="checkAll2" {$makereadonly}onClick="selectAll(this,'u');" class="checkbox" title="{$lang_common['check_uncheck_all']}" /></td> <td colspan="{$number_of_columns_minus_one}" class="tablef"> <table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td align="left"> <select name="action" size="1" class="listbox" {$makereadonly}onchange="return selectaction(this,'u');"> <option value="" checked="checked">{$lang_usermgr_php['with_selected']}</option> <option value="delete">{$lang_usermgr_php['delete']}</option> <option value="activate">{$lang_usermgr_php['activate']}</option> <option value="deactivate">{$lang_usermgr_php['deactivate']}</option> <option value="reset_password">{$lang_usermgr_php['reset_password']}</option> <option value="change_group">{$lang_usermgr_php['change_primary_membergroup']}</option> <option value="add_group">{$lang_usermgr_php['add_secondary_membergroup']}</option> </select> <input type="hidden" name="what" value="user"/> <input type="text" name="new_password" value="{$lang_usermgr_php['password']}" size="8" maxlength="8" class="textinput" onfocus="this.value='';" style="display:none" /> <select name="group" size="1" class="listbox" style="display:none" onchange="return selectaction(this,'u');"> <option value="">{$lang_usermgr_php['select_group']}</option> EOT; $sql = "SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_name"; $result = cpg_db_query($sql); $group_list = cpg_db_fetch_rowset($result); mysql_free_result($result); if (isset($element[1])) { $sel_group = $user_data[$element[1]]; } else { $sel_group = ''; } $user_group_list = $user_data['user_group_list'] == '' ? ',' . $sel_group . ',' : ',' . $user_data['user_group_list'] . ',' . $sel_group . ','; foreach ($group_list as $group) { print ' <option value="' . $group['group_id'] . '"' . ($group['group_id'] == $sel_group ? ' selected' : '') . '>' . $group['group_name'] . "</option>\n"; } $help_create = ' ' . cpg_display_help('f=users.htm&as=user_cp_new&ae=user_cp_new_end', '600', '250'); echo <<<EOT </select> <select name="delete_files" size="1" class="listbox" style="display:none"> <option value="no">{$lang_usermgr_php['delete_files_no']}</option> <option value="yes">{$lang_usermgr_php['delete_files_yes']}</option> </select> <select name="delete_comments" size="1" class="listbox" style="display:none"> <option value="no">{$lang_usermgr_php['delete_comments_no']}</option> <option value="yes">{$lang_usermgr_php['delete_comments_yes']}</option> </select> <input type="submit" name="go" value="{$lang_usermgr_php['submit']}" class="button" style="display:none" /> </td> <td align="center"> <a href="{$_SERVER['PHP_SELF']}?op=new_user" {$makereadonly}class="admin_menu">{$lang_usermgr_php['create_new_user']}</a> {$help_create} </td> </form> </tr> </table> </td> </tr> <tr> <td colspan="{$number_of_columns}" class="tablef" align="center" valign="middle"> <form method="post" action="{$_SERVER['PHP_SELF']}" name="searchUser" id="cpgform2"> <input type="text" name="username" class="textinput" {$search_string_default} /> <input type="submit" name="user_search" value="{$lang_usermgr_php['search_submit']}" class="button" /> {$help} </form> </td> </tr> EOT; } // Accept footer addons for the user manager echo CPGPluginAPI::filter('usermgr_footer', ''); echo <<<EOT <tr> <td colspan="{$number_of_columns}" style="padding: 0px;"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> {$tabs} </tr> </table> </td> </tr> EOT; endtable(); }
<!-- END {BLOCK_ID} -->\t EOT; // HTML template for template sub_menu buttons // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}{HREF_ATTRIBUTES}{HREF_CLASS} addbutton($sub_menu_buttons, '{CUSTOM_LNK_LNK}', '{CUSTOM_LNK_TITLE}', '{CUSTOM_LNK_TGT}', 'custom_link', $template_sub_menu_spacer, '', "Custom_Lnk"); addbutton($sub_menu_buttons, '{ALB_LIST_LNK}', '{ALB_LIST_TITLE}', '{ALB_LIST_TGT}', 'album_list', $template_sub_menu_spacer, '', "Alb_List"); addbutton($sub_menu_buttons, '{LASTUP_LNK}', '{LASTUP_TITLE}', '{LASTUP_TGT}', 'lastup', $template_sub_menu_spacer, 'rel="nofollow"', "LastUpload"); addbutton($sub_menu_buttons, '{LASTCOM_LNK}', '{LASTCOM_TITLE}', '{LASTCOM_TGT}', 'lastcom', $template_sub_menu_spacer, 'rel="nofollow"', "LastComment"); addbutton($sub_menu_buttons, '{TOPN_LNK}', '{TOPN_TITLE}', '{TOPN_TGT}', 'topn', $template_sub_menu_spacer, 'rel="nofollow"', "TopN_Lnk"); addbutton($sub_menu_buttons, '{FAV_LNK}', '{FAV_TITLE}', '{FAV_TGT}', 'favpics', $template_sub_menu_spacer, 'rel="nofollow"', "Favorite"); addbutton($sub_menu_buttons, '{TOPRATED_LNK}', '{TOPRATED_TITLE}', '{TOPRATED_TGT}', 'toprated', $template_sub_menu_spacer, 'rel="nofollow"', "TopRated"); addbutton($sub_menu_buttons, '{SEARCH_LNK}', '{SEARCH_TITLE}', '{SEARCH_TGT}', 'search', $template_sub_menu_spacer, '', "Search"); if ($CONFIG['browse_by_date'] != 0) { addbutton($sub_menu_buttons, '{BROWSEBYDATE_LNK}', '{BROWSEBYDATE_TITLE}', '{BROWSEBYDATE_TGT}', 'browse_by_date', $template_sub_menu_spacer, 'rel="nofollow" class="greybox"', "Browse"); } $sub_menu_buttons = CPGPluginAPI::filter('sub_menu', $sub_menu_buttons); $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button, $sub_menu_buttons)); $template_sub_menu = template_eval($template_sub_menu, $params); } /****************************************************************************** ** Section <<<THEME_HAS_NO_SUB_MENU_BUTTONS>>> - END ******************************************************************************/ /****************************************************************************** ** Section <<<$template_gallery_admin_menu>>> - START ******************************************************************************/ // // Modified by GFY to add drop down/hover buttoms to admin_menu // $template_gallery_admin_menu = <<<EOT <ul class="menu"> <!-- First button without submenus -->\t
<tr> <td class="tableb" valign="top" align="right"> {$lang_contact_php['confirmation']} {$captcha_help} </td> <td class="tableb" valign="top"> <span id="captcha_wrapper" class="{$highlightFieldCSS}"> <input type="text" class="textinput" name="captcha" size="5" maxlength="5" value="" /> </span> <img src="captcha.php" align="middle" border="0" alt="" /> </td> <td class="tableb"> <span id="captcha_remark" style="display:{$captcha_remark_visibility}">{$captcha_remark}</span> </td> </tr> EOT; $captcha_print = CPGPluginAPI::filter('captcha_contact_print', $captcha_print); print $captcha_print; } list($timestamp, $form_token) = getFormToken(); // submit button print <<<EOT <tr> <td class="tableb" valign="top" align="right"> <input type="hidden" name="form_token" value="{$form_token}" /> <input type="hidden" name="timestamp" value="{$timestamp}" /> </td> <td class="tableb" valign="top" colspan="2"> <button type="submit" class="button" name="submit" id="submit" value="{$lang_common['go']}">{$icon_array['ok']}{$lang_common['go']}</button> </td> </tr> EOT;
/** * 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'); }
} else { $user_status = ''; } if ($user_thumb != '') { $user_thumb = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastupby&uid=' . $uid . '">' . '<span class="thumb_title">' . $lang_register_php['last_uploads'] . '<br />' . sprintf($lang_register_php['last_uploads_detail'], $user_data['user_name']) . '<br /></span>' . $user_thumb . '</a></td>'; } $lastComArray = cpgUserLastComment($uid); if ($lastComArray['count'] != 0) { $lastcom = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastcomby&uid=' . $uid . '">' . '<span class="thumb_title">' . $lang_register_php['last_comments'] . '<br />' . sprintf($lang_register_php['last_comments_detail'], $user_data['user_name']) . '<br /></span>' . $lastComArray['thumb'] . '</a><br />'; $lastcom .= "<span class=\"thumb_caption\">" . localised_date($lastComArray['msg_date'], $lang_date['lastcom']) . '</span>' . "<span class=\"thumb_caption\">" . bb_decode(process_smilies($lastComArray['comment'])) . '</span></td>'; } $quick_jump = $user_thumb . $lastcom ? '<table width="100%" border="0" cellspacing="5"><tr>' . $user_thumb . $lastcom . '</tr></table>' : ''; list($timestamp, $form_token) = getFormToken(); if ($uid == USER_ID) { $adminLink = '<a href="profile.php?op=edit_profile" class="admin_menu">' . $lang_register_php['edit_my_profile'] . '</a>'; } elseif (GALLERY_ADMIN_MODE) { $adminLink = '<a href="usermgr.php?op=edit&user_id=' . $uid . '&form_token=' . $form_token . '×tamp=' . $timestamp . '" class="admin_menu">' . $icon_array['edit'] . sprintf($lang_register_php['edit_xs_profile'], $user_data['user_name']) . '</a>'; } else { $adminLink = ''; } $form_data = array('username' => $user_data['user_name'], 'status' => $user_status, 'reg_date' => localised_date($user_data['user_regdate'], $lang_date['register']), 'group' => $user_data['group_name'], 'user_profile1' => $user_data['user_profile1'], 'user_profile2' => $user_data['user_profile2'], 'user_profile3' => $user_data['user_profile3'], 'user_profile4' => $user_data['user_profile4'], 'user_profile5' => $user_data['user_profile5'], 'user_profile6' => bb_decode($user_data['user_profile6']), 'user_thumb' => $quick_jump, 'pic_count' => cpgUserPicCount($uid), 'admin_link' => $adminLink); $title = sprintf($lang_register_php['x_s_profile'], $user_data['user_name']); pageheader($title); // Displays the profile of any user starttable(-1, cpg_fetch_icon('my_profile', 2) . $title, 2); $profile_data = CPGPluginAPI::filter('profile_add_data', array(0 => $display_profile_form_param, 1 => $form_data)); make_form($display_profile_form_param, $form_data); endtable(); pagefooter(); break; }
function list_users($search = '') { global $CONFIG, $cpg_udb, $CPG_PHP_SELF, $LINEBREAK; //, $PHP_SELF; global $lang_usermgr_php, $lang_byte_units, $lang_date, $lang_common, $icon_array; global $lim_user, $number_of_columns, $template_tab_display; global $USER_DATA; $superCage = Inspekt::makeSuperCage(); list($timestamp, $form_token) = getFormToken(); $number_of_columns_minus_one = $number_of_columns - 1; $number_of_columns_minus_three = $number_of_columns - 3; $number_of_columns_minus_four = $number_of_columns - 4; $sort_codes = array('name_a' => 'user_name ASC', 'name_d' => 'user_name DESC', 'group_a' => 'group_name ASC', 'group_d' => 'group_name DESC', 'reg_a' => 'user_regdate ASC', 'reg_d' => 'user_regdate DESC', 'pic_a' => 'pic_count ASC', 'pic_d' => 'pic_count DESC', 'disku_a' => 'disk_usage ASC', 'disku_d' => 'disk_usage DESC', 'lv_a' => 'user_lastvisit ASC', 'lv_d' => 'user_lastvisit DESC'); $sort = 'reg_d'; if ($superCage->get->keyExists('sort') && ($matches = $superCage->get->getMatched('sort', '/^[a-z_]+$/'))) { if ($sort_codes[$matches[0]]) { $sort = $matches[0]; } } $makereadonly = $CONFIG['bridge_enable'] ? 'style="display:none;" disabled="disabled" ' : ''; $user_count = $cpg_udb->get_user_count(); if (!$user_count) { cpg_die(CRITICAL_ERROR, $lang_usermgr_php['err_no_users'], __FILE__, __LINE__); } $user_per_page = 25; $page = $superCage->get->testInt('page') ? $superCage->get->getInt('page') : 1; $lower_limit = ($page - 1) * $user_per_page; $lower_limit = ($page - 1) * $user_per_page; $username = ''; if ($search) { $username = '******' . $search; $users_search = $cpg_udb->get_users(array('users_per_page' => $user_count, 'lower_limit' => 0, 'search' => $search, 'sort' => $sort)); $user_count = count($users_search); } $tab_tmpl = $template_tab_display; $tab_tmpl['page_link'] = strtr($tab_tmpl['page_link'], array('{LINK}' => 'usermgr.php?sort=' . $sort . '&page=%d' . $username)); $tab_tmpl['left_text'] = strtr($tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_usermgr_php['u_user_on_p_pages'])); $users = $cpg_udb->get_users(array('users_per_page' => $user_per_page, 'lower_limit' => $lower_limit, 'search' => $search, 'sort' => $sort)); $total_pages = ceil($user_count / $user_per_page); $tabs = create_tabs($user_count, $page, $total_pages, $tab_tmpl); $lb = '<span id="album_listbox_wrapper" style="display:none">'; $lb .= $lang_usermgr_php['sort_by'] . ': '; $lb .= "<select name=\"album_listbox\" id=\"album_listbox\" class=\"listbox\" onchange=\"if(this.options[this.selectedIndex].value) window.location.href='{$CPG_PHP_SELF}?page={$page}&sort='+this.options[this.selectedIndex].value;\">" . $LINEBREAK; foreach ($sort_codes as $key => $value) { $selected = $key == $sort ? 'selected="selected"' : ""; $lb .= ' <option value="' . $key . '" ' . $selected . '>' . $lang_usermgr_php[$key] . '</option>' . $LINEBREAK; } $lb .= '</select>' . $LINEBREAK; $lb .= '</span>' . $LINEBREAK; echo <<<EOT <script type="text/javascript" language="javascript"> <!-- function selectaction(d,box) { // check if an action has been selected var action = document.editForm.action.value; if (action == '') { return false; } // check if at least one user has been selected var checked_counter = 0; var checked_string = ''; var f = document.editForm; for (i = 0; i < f.length; i++) { if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) { if (f[i].checked) { checked_counter = checked_counter + 1; if (checked_string == '') { checked_string = f[i].name; } else { checked_string = checked_string + ',' + f[i].name; } } } } if (checked_counter == 0) { document.editForm.action.value = ''; alert('{$lang_usermgr_php['alert_no_selection']}'); return false; } document.editForm.id.value = checked_string; document.editForm.new_password.style.display = "none"; document.editForm.group.style.display = "none"; document.editForm.go.style.display = "none"; document.editForm.delete_files.style.display = "none"; document.editForm.delete_comments.style.display = "none"; switch(document.editForm.action.value) { case "delete": document.editForm.delete_files.style.display = "inline"; document.editForm.delete_comments.style.display = "inline"; document.editForm.go.style.display = "inline"; break; case "reset_password": document.editForm.new_password.style.display = "inline"; document.editForm.go.style.display = "inline"; break; case "change_group": document.editForm.new_password.value = ''; document.editForm.group.style.display = "inline"; if (document.editForm.group.value != '') { document.editForm.submit(); } break; case "add_group": document.editForm.new_password.value = ''; document.editForm.group.style.display = "inline"; if (document.editForm.group.value != '') { document.editForm.submit(); } break; default: document.editForm.new_password.value = ''; document.editForm.submit(); break; } } addonload("show_section('album_listbox_wrapper')"); addonload("show_section('checkAll')"); addonload("show_section('checkAll2')"); addonload("show_section('action')"); --> </script> EOT; echo '<form method="get" action="delete.php" name="editForm" id="cpgform">'; if ($superCage->post->keyExists('username')) { $search_filter = '<td align="center">' . $lang_usermgr_php['search_result'] . $superCage->post->getEscaped('username') . '</td>'; } else { $search_filter = ''; } $help = ' ' . cpg_display_help('f=users.htm&as=user_cp&ae=user_cp_end&top=1', '650', '500'); $usermgr_table_header = <<<EOT <input type="hidden" name="id" value="" /> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> EOT; if (!$lim_user) { $usermgr_table_header .= cpg_fetch_icon('user_mgr', 2) . $lang_usermgr_php['user_manager'] . $help; } else { $usermgr_table_header .= cpg_fetch_icon('user_mgr', 2) . $lang_usermgr_php['memberlist']; } $usermgr_table_header .= <<<EOT </td> {$search_filter} <td class="sortorder_options" align="right"> {$lb} </td> </tr> </table> EOT; starttable('100%', $usermgr_table_header, $number_of_columns); // Accept header addons echo CPGPluginAPI::filter('usermgr_header', ''); if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_header = ''; } else { $pictures_quota_header = <<<EOT <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['pictures']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=pic_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=pic_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['disk_space_used']}/{$lang_usermgr_php['disk_space_quota']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=disku_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=disku_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_d']}" /></a> </td> EOT; } if (!$lim_user) { echo <<<EOT <tr> <td class="tableh1" align="center"> <input type="checkbox" {$makereadonly}name="checkAll" id="checkAll" onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" style="display:none" /> </td> <td class="tableh1" colspan="2"> <span class="statlink">{$lang_usermgr_php['name']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['status']}</span> </td> <td class="tableh1"> <span class="statlink"><a href="groupmgr.php" class="statlink">{$lang_usermgr_php['group']}</a></span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['registered_on']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['last_visit']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['comments']}</span> </td> {$pictures_quota_header} </tr> EOT; } else { echo <<<EOT <tr> <td class="tableh1" colspan="2"> <span class="statlink">{$lang_usermgr_php['name']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['status']}</span> </td> <td class="tableh1"><span class="statlink">{$lang_usermgr_php['group']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['registered_on']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['last_visit']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['comments']}</span> </td> {$pictures_quota_header} </tr> EOT; } $loop_counter = 0; // query total number of files uploaded $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} LIMIT 1"); $tempPicCount = mysql_fetch_array($result); $totalPictureCount = $tempPicCount[0]; $totalPictureCount_fmt = cpg_float2decimal($totalPictureCount); mysql_free_result($result); unset($tempPicCount); // query total space used $result = cpg_db_query("SELECT SUM(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} LIMIT 1"); $tempSpaceCount = mysql_fetch_array($result); $totalSpaceCount = $tempSpaceCount[0]; $totalSpaceCount_fmt = cpg_format_bytes($totalSpaceCount); mysql_free_result($result); unset($tempSpaceCount); // query total number of comments posted $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} LIMIT 1"); $tempCommentCount = mysql_fetch_array($result); $totalCommentCount = $tempCommentCount[0]; $totalCommentCount_fmt = cpg_float2decimal($totalCommentCount); mysql_free_result($result); unset($tempCommentCount); foreach ($users as $user) { if ($loop_counter == 0) { $row_style_class = 'tableb'; } else { $row_style_class = 'tableb tableb_alternate'; } $loop_counter++; if ($loop_counter > 1) { $loop_counter = 0; } if ($user['disk_usage'] == '') { $user['disk_usage'] = 0; } $group_quota_separator = '/'; // Determine actual quota if user belongs to more than one user group if ($user_groups = cpg_get_groups($user['user_id'])) { $quota = mysql_fetch_assoc(cpg_db_query("SELECT MAX(group_quota) AS disk_max, MIN(group_quota) AS disk_min FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_quota >= 0 AND group_id IN (" . implode(", ", $user_groups) . ")")); $user['group_quota'] = $quota["disk_min"] ? $quota["disk_max"] : 0; } if ($user['group_quota']) { $disk_usage_output = theme_display_bar($user['disk_usage'], $user['group_quota'], 150, '', '', $group_quota_separator . $user['group_quota'] . ' ' . $lang_byte_units[1], 'red', 'green'); } else { $disk_usage_output = theme_display_bar($user['disk_usage'], $user['group_quota'], 150, '', '', ' ' . $lang_byte_units[1], 'green', 'green'); } if ($user['user_active'] == 'NO') { //$user['group_name'] = '<i>' . $lang_usermgr_php['inactive'] . '</i>'; $user['status'] = cpg_fetch_icon('offline', 0, $lang_usermgr_php['status_inactive']); $action = 'activate'; } else { $user['status'] = cpg_fetch_icon('online', 0, $lang_usermgr_php['status_active']); $action = 'deactivate'; } if (!$lim_user) { $user['status'] = '<a href="delete.php?id=u' . $user['user_id'] . '&album_listbox=' . $sort . '&action=' . $action . '&what=user&form_token=' . $form_token . '&timestamp=' . $timestamp . '" title="">' . $user['status'] . '</a>'; } $user['user_regdate'] = localised_date($user['user_regdate'], $lang_date['register']); if ($user['user_lastvisit']) { $user['user_lastvisit'] = localised_date($user['user_lastvisit'], $lang_date['register']); } else { $user['user_lastvisit'] = $lang_usermgr_php['never']; } $view_profile = '<a href="profile.php?uid=' . $user['user_id'] . '">' . cpg_fetch_icon('my_profile', 0, $lang_usermgr_php['view_profile']) . '</a>'; if ($user['pic_count']) { $last_uploads = '<a href="thumbnails.php?album=lastupby&uid=' . $user['user_id'] . '">' . cpg_fetch_icon('last_uploads', 0, $lang_usermgr_php['latest_upload']) . '</a>'; } else { if ($lim_user == 0) { $last_uploads = cpg_fetch_icon('last_uploads_disabled', 0, $lang_usermgr_php['no_latest_upload']); } else { $last_uploads = cpg_fetch_icon('blank', 0); } } // fetch number of comments and add link to comments if applicable if ($lim_user == 0) { $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = {$user['user_id']}"); // display all comments for the admin } else { $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = {$user['user_id']} AND approval = 'YES' "); // only display approved comments for non-admin } $commentCount = mysql_fetch_array($result); $user['comment_num'] = $commentCount[0]; mysql_free_result($result); if ($user['comment_num'] > 0) { $user_comment_link = '<a href="thumbnails.php?album=lastcomby&uid=' . $user['user_id'] . '">' . cpg_fetch_icon('comment', 0, $lang_usermgr_php['last_comments'] . '(' . $user['comment_num'] . ')') . '</a>'; } else { $user_comment_link = cpg_fetch_icon('blank', 0, $lang_usermgr_php['no_last_comments']); } // create comments bar $comment_quota_output = theme_display_bar($user['comment_num'], $totalCommentCount, 60, '', '', '', 'red', ''); // create files bar $file_quota_output = theme_display_bar($user['pic_count'], $totalPictureCount, 60, '', '', '', 'red', ''); // Look up banned table if (mysql_num_rows(cpg_db_query("SELECT user_name FROM {$CONFIG['TABLE_BANNED']} WHERE user_name = '" . addslashes($user['user_name']) . "' AND brute_force=0 LIMIT 1"))) { $ban_user_link = '<a href="banning.php">' . cpg_fetch_icon('ban_user_disabled', 0, $lang_usermgr_php['user_is_banned']) . '</a>'; $ban_memberlist = cpg_fetch_icon('ban_user_disabled', 0, $lang_usermgr_php['user_is_banned']); } else { $ban_user_link = '<a href="banning.php?ban_user='******'user_id'] . '">' . cpg_fetch_icon('ban_user', 0, $lang_usermgr_php['ban_user']) . '</a>'; $ban_memberlist = ''; } if (!$lim_user) { if ($user['user_id'] == $USER_DATA['user_id']) { $profile_link = 'profile.php?op=edit_profile'; $checkbox_html = ''; $ban_user_link = cpg_fetch_icon('blank', 0); } else { $profile_link = $CPG_PHP_SELF . '?op=edit&user_id=' . $user['user_id'] . '&form_token=' . $form_token . '&timestamp=' . $timestamp; $checkbox_html = '<input name="u' . $user['user_id'] . '" ' . $makereadonly . 'type="checkbox" value="" class="checkbox" />'; } $profile_link = '<a href="' . $profile_link . '">' . cpg_fetch_icon('edit', 0, $lang_usermgr_php['edit_profile']) . '</a>'; if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_data = ''; } else { $pictures_quota_data = <<<EOT <td class="{$row_style_class}" align="right">{$file_quota_output}</td> <td class="{$row_style_class}" align="center">{$disk_usage_output}</td> EOT; } echo <<<EOT <tr> <td class="{$row_style_class}" align="center">{$checkbox_html}</td> <td class="{$row_style_class}">{$user['user_name']}</td> <td class="{$row_style_class}" align="left"> {$view_profile} {$profile_link} {$last_uploads} {$ban_user_link} {$user_comment_link} </td> <td class="{$row_style_class}">{$user['status']}</td> <td class="{$row_style_class}">{$user['group_name']}</td> <td class="{$row_style_class}">{$user['user_regdate']}</td> <td class="{$row_style_class}">{$user['user_lastvisit']}</td> <td class="{$row_style_class}" align="right">{$comment_quota_output}</td> {$pictures_quota_data} </tr> EOT; } else { if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_data = ''; } else { $pictures_quota_data = <<<EOT <td class="{$row_style_class}" align="right">{$user['pic_count']}</td> <td class="{$row_style_class}" align="center">{$disk_usage_output}</td> EOT; } echo <<<EOT <tr> <td class="{$row_style_class}">{$user['user_name']}</td> <td class="{$row_style_class}">{$view_profile}{$last_uploads}{$user_comment_link}</td> <td class="{$row_style_class}">{$user['status']}{$ban_memberlist}</td> <td class="{$row_style_class}">{$user['group_name']}</td> <td class="{$row_style_class}">{$user['user_regdate']}</td> <td class="{$row_style_class}">{$user['user_lastvisit']}</td> <td class="{$row_style_class}" align="right">{$user['comment_num']}</td> {$pictures_quota_data} </tr> EOT; } } // while //mysql_free_result($result); if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_footer = ''; } else { $pictures_quota_footer = <<<EOT <td align="right" class="tablef">{$totalPictureCount_fmt}</td> <td align="right" class="tablef">{$totalSpaceCount_fmt}</td> EOT; } if (!$lim_user) { if ($search) { $search_string_default = 'value="' . $search . '"'; } else { $search_string_default = 'value="' . $lang_usermgr_php['search'] . '" onfocus="this.value=\'\'"'; } $help = cpg_display_help('f=users.htm&as=user_cp_search&ae=user_cp_search_end&top=1', '400', '150'); echo <<<EOT <tr> <td class="tablef" align="center"><input type="checkbox" name="checkAll2" id="checkAll2" {$makereadonly}onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" style="display:none" /></td> <td colspan="{$number_of_columns_minus_four}" class="tablef"> <table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td align="left"> <select name="action" id="action" size="1" class="listbox" {$makereadonly}onchange="return selectaction(this,'u');" style="display:none"> <option value="" selected="selected">{$lang_usermgr_php['with_selected']}</option> <option value="delete">{$lang_common['delete']}</option> <option value="activate">{$lang_usermgr_php['activate']}</option> <option value="deactivate">{$lang_usermgr_php['deactivate']}</option> <option value="reset_password">{$lang_usermgr_php['reset_password']}</option> <option value="change_group">{$lang_usermgr_php['change_primary_membergroup']}</option> <option value="add_group">{$lang_usermgr_php['add_secondary_membergroup']}</option> </select> <input type="hidden" name="what" value="user"/> <input type="text" name="new_password" value="{$lang_usermgr_php['password']}" size="8" maxlength="25" class="textinput" onfocus="this.value='';" style="display:none" /> <select name="group" size="1" class="listbox" style="display:none" onchange="return selectaction(this,'u');"> <option value="">{$lang_usermgr_php['select_group']}</option> EOT; $sql = "SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_name"; $result = cpg_db_query($sql); $group_list = cpg_db_fetch_rowset($result); mysql_free_result($result); if (isset($element[1])) { $sel_group = $user_data[$element[1]]; } else { $sel_group = ''; } foreach ($group_list as $group) { if ($group['group_id'] != 3) { print ' <option value="' . $group['group_id'] . '"' . ($group['group_id'] == $sel_group ? ' selected' : '') . '>' . $group['group_name'] . '</option>' . $LINEBREAK; } } $help_create = ' ' . cpg_display_help('f=users.htm&as=user_cp_new&ae=user_cp_new_end', '600', '250'); $create_new_user_icon = cpg_fetch_icon('add_user', 2); list($timestamp, $form_token) = getFormToken(); echo <<<EOT </select> <select name="delete_files" size="1" class="listbox" style="display:none"> <option value="no">{$lang_usermgr_php['delete_files_no']}</option> <option value="yes">{$lang_usermgr_php['delete_files_yes']}</option> </select> <select name="delete_comments" size="1" class="listbox" style="display:none"> <option value="no">{$lang_usermgr_php['delete_comments_no']}</option> <option value="yes">{$lang_usermgr_php['delete_comments_yes']}</option> </select> <button type="submit" class="button" name="go" value="{$lang_usermgr_php['submit']}" style="display:none">{$icon_array['ok']}{$lang_usermgr_php['submit']}</button> </td> </tr> </table> <input type="hidden" name="form_token" value="{$form_token}" /> <input type="hidden" name="timestamp" value="{$timestamp}" /> </td> <td align="right" class="tablef">{$totalCommentCount_fmt}</td> {$pictures_quota_footer} </tr> EOT; endtable(); echo '</form>'; starttable('100%'); echo <<<EOT <tr> <td colspan="{$number_of_columns}" class="tablef" align="center" valign="middle"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td class="tablef" align="center" valign="middle"> <form method="post" action="{$CPG_PHP_SELF}" name="searchUser" id="cpgform2"> <input type="text" name="username" class="textinput" {$search_string_default} /> <button type="submit" class="button" name="user_search" value="{$lang_usermgr_php['search_submit']}">{$icon_array['search']}{$lang_usermgr_php['search_submit']}</button> {$help} </form> </td> <td class="tablef" align="center" valign="middle"> <a href="{$CPG_PHP_SELF}?op=new_user&form_token={$form_token}&timestamp={$timestamp}" {$makereadonly}class="admin_menu">{$create_new_user_icon}{$lang_usermgr_php['create_new_user']}</a> {$help_create} </td> </tr> </table> </td> </tr> EOT; } else { echo <<<EOT <tr> <td colspan="{$number_of_columns_minus_three}" class="tablef" align="left" valign="middle"> {$lang_usermgr_php['total']} </td> <td class="tablef" align="right" valign="middle"> {$totalCommentCount_fmt} </td> {$pictures_quota_footer} </tr> EOT; } // Accept footer addons for the user manager echo CPGPluginAPI::filter('usermgr_footer', ''); if ($tabs) { echo <<<EOT <tr> <td colspan="{$number_of_columns}" style="padding: 0px;"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> {$tabs} </tr> </table> </td> </tr> EOT; } endtable(); }
function html_picinfo() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $FAVPICS, $REFERER; global $album, $lang_picinfo, $lang_display_image_php, $lang_byte_units, $lang_common, $lastup_date_fmt; if ($CURRENT_PIC_DATA['owner_id'] && $CURRENT_PIC_DATA['owner_name']) { $owner_link = '<a href ="profile.php?uid=' . $CURRENT_PIC_DATA['owner_id'] . '">' . $CURRENT_PIC_DATA['owner_name'] . '</a> '; } else { $owner_link = ''; } if (GALLERY_ADMIN_MODE && $CURRENT_PIC_DATA['pic_raw_ip']) { if ($CURRENT_PIC_DATA['pic_hdr_ip']) { $ipinfo = ' (' . $CURRENT_PIC_DATA['pic_hdr_ip'] . '[' . $CURRENT_PIC_DATA['pic_raw_ip'] . ']) / '; } else { $ipinfo = ' (' . $CURRENT_PIC_DATA['pic_raw_ip'] . ') / '; } } else { if ($owner_link) { $ipinfo = '/ '; } else { $ipinfo = ''; } } $info[$lang_common['filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']); $info[$lang_picinfo['Album name']] = '<span class="alblink">' . $owner_link . $ipinfo . '<a href="thumbnails.php?album=' . $CURRENT_PIC_DATA['aid'] . '">' . $CURRENT_ALBUM_DATA['title'] . '</a></span>'; if ($CURRENT_PIC_DATA['votes'] > 0) { if (defined('THEME_HAS_RATING_GRAPHICS')) { $prefix = $THEME_DIR; } else { $prefix = ''; } if (GALLERY_ADMIN_MODE) { $width = 800; $height = 700; } else { $width = 400; $height = 250; } if ($CONFIG['vote_details'] == 1) { $detailsLink = <<<EOT <div id="votedetailsunhidetoggle" style="display:none"> (<a href="javascript:;" onclick="voteDetailsDisplay();">{$lang_picinfo['show_details']}</a>)</div> <div id="votedetailshidetoggle" style="display:none"> (<a href="javascript:;" onclick="voteDetailsDisplay();">{$lang_picinfo['hide_details']}</a>)</div> <iframe src="stat_details.?type=blank" width="100%" height="0" name="votedetails" id="votedetails" frameborder="0" style="display:none;border;none;"></iframe> <script type="text/javascript"> addonload("show_section('votedetailsunhidetoggle')"); function voteDetailsDisplay() { show_section('votedetailsunhidetoggle'); show_section('votedetailshidetoggle'); show_section('votedetails'); document.getElementById('votedetails').height = 800; top.frames.votedetails.document.location.href = "stat_details.php?type=vote&pid={$CURRENT_PIC_DATA['pid']}&sort=sdate&dir=&sdate=1&ip=1&rating=1&referer=0&browser=0&os=0&uid=1"; } </script> EOT; } $info[sprintf($lang_picinfo['Rating'], $CURRENT_PIC_DATA['votes'])] = '<img src="' . $prefix . 'images/rating' . round($CURRENT_PIC_DATA['pic_rating'] / 2000) . '.gif" align="left" alt="" />' . $detailsLink; } if ($CURRENT_PIC_DATA['keywords'] != "") { $info[$lang_common['keywords']] = '<span class="alblink">' . preg_replace("/(\\S+)/", "<a href=\"thumbnails.php?album=search&search=\\1\">\\1</a>", $CURRENT_PIC_DATA['keywords']) . '</span>'; } for ($i = 1; $i <= 4; $i++) { if ($CONFIG['user_field' . $i . '_name']) { if ($CURRENT_PIC_DATA['user' . $i] != "") { $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]); } } } $info[$lang_common['filesize']] = $CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . ' ' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . ' ' . $lang_byte_units[0]; $info[$lang_common['filesize']] = '<span dir="ltr">' . $info[$lang_common['filesize']] . '</span>'; $info[$lang_picinfo['Date Added']] = localised_date($CURRENT_PIC_DATA['ctime'], $lastup_date_fmt); $info[$lang_picinfo['Dimensions']] = sprintf($lang_display_image_php['size'], $CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']); if ($CURRENT_PIC_DATA['hits'] && $CONFIG['hit_details'] && GALLERY_ADMIN_MODE) { $detailsLink = <<<EOT <div id="hitdetailsunhidetoggle" style="display:none"> (<a href="javascript:;" onclick="hitDetailsDisplay();">{$lang_picinfo['show_details']}</a>)</div> <div id="hitdetailshidetoggle" style="display:none"> (<a href="javascript:;" onclick="hitDetailsDisplay();">{$lang_picinfo['hide_details']}</a>)</div> <iframe src="stat_details.?type=blank" width="100%" height="0" name="hitdetails" id="hitdetails" frameborder="0" style="display:none;border;none;"></iframe> <script type="text/javascript"> addonload("show_section('hitdetailsunhidetoggle')"); function hitDetailsDisplay() { show_section('hitdetailsunhidetoggle'); show_section('hitdetailshidetoggle'); show_section('hitdetails'); document.getElementById('hitdetails').height = 800; top.frames.hitdetails.document.location.href = "stat_details.php?type=hits&pid={$CURRENT_PIC_DATA['pid']}&sort=sdate&dir=&sdate=1&ip=1&search_phrase=0&referer=0&browser=1&os=1"; } </script> EOT; } $info[$lang_picinfo['Displayed']] = sprintf($lang_display_image_php['views'], $CURRENT_PIC_DATA['hits']); $info[$lang_picinfo['Displayed']] .= $detailsLink; $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename']; $path_to_orig_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['orig_pfx'] . $CURRENT_PIC_DATA['filename']; if ($CONFIG['read_exif_data']) { $exif = exif_parse_file($path_to_pic); } if (isset($exif) && is_array($exif)) { array_walk($exif, 'sanitize_data'); $info = array_merge($info, $exif); } // Read the iptc data if ($CONFIG['read_iptc_data']) { // Read the iptc data from original pic (if watermarked) $iptc = file_exists($path_to_orig_pic) ? get_IPTC($path_to_orig_pic) : get_IPTC($path_to_pic); } if (isset($iptc) && is_array($iptc)) { array_walk($iptc, 'sanitize_data'); if (isset($iptc['Title'])) { $info[$lang_picinfo['iptcTitle']] = $iptc['Title']; } if (isset($iptc['Copyright'])) { $info[$lang_picinfo['iptcCopyright']] = $iptc['Copyright']; } if (!empty($iptc['Keywords'])) { $info[$lang_picinfo['iptcKeywords']] = implode(' ', $iptc['Keywords']); } if (isset($iptc['Category'])) { $info[$lang_picinfo['iptcCategory']] = $iptc['Category']; } if (!empty($iptc['SubCategories'])) { $info[$lang_picinfo['iptcSubCategories']] = implode(' ', $iptc['SubCategories']); } } // Create the absolute URL for display in info $info[$lang_picinfo['URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pid={$CURRENT_PIC_DATA['pid']}" . '" >' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pid={$CURRENT_PIC_DATA['pid']}" . '</a>'; // with subdomains the variable is $_SERVER["SERVER_NAME"] does not return the right value instead of using a new config variable I reused $CONFIG["ecards_more_pic_target"] no trailing slash in the configure // Create the add to fav link $ref = $REFERER ? "&ref={$REFERER}" : ''; if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) { $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['addFav'] . '</a>'; } else { $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['remFav'] . '</a>'; } /** * Filter file information */ $info = CPGPluginAPI::filter('file_info', $info); return theme_html_picinfo($info); }