All pastes #912063 Raw Edit

Someone

public text v1 · immutable
·published 2008-02-21 02:45 UTC
rendered paste body
function user_gallery(){
		global $UDATA, $CONFIG, $DB;
			$data = $UDATA;
		$DB->query("SELECT * FROM `".SQL_USERS_TABLE."` WHERE `user_name` = '{$_GET['gal']}'");
		$user_data = (($_GET['gal'] != '') ? $DB->fetch_row() : $UDATA);
		if($DB->get_num_rows() < 1 && $_GET['gal'] != ''){
			message("The gallery for user <b>{$_GET['gal']}</b> does not exists.");
		}elseif($user_data['album_private'] == 1 && $_GET['gal'] != ''){
			message("This gallery for user <b>{$user_data['user_name']}</b> has been set to private.", false);
		}elseif(!$CONFIG['is_user'] && empty($_GET['gal'])){
			message("You must log in first to see your gallery.");
		}else{
			$sql = $DB->query("SELECT * FROM `".SQL_FILE_STORAGE_TABLE."` WHERE `user_id` = '{$user_data['user_id']}' ORDER BY `file_id` DESC LIMIT {$CONFIG['query_limit_build']}");
			echo "<h3>Member Gallery</h3>";
			echo build_pagelinks(($_GET['gal'] != '') ? "users.php?act=user_gallery&gal={$user_data['user_name']}" : "users.php?act=user_gallery", $DB->get_num_rows($DB->query("SELECT * FROM `".SQL_FILE_STORAGE_TABLE."` WHERE `user_id` = '{$user_data['user_id']}'")))."<br><br>";
			if($DB->get_num_rows($sql) < 1){
				message("The selected gallery is empty.", false);
			}else{
				while($row = $DB->fetch_row($sql)) {
					$file      = $row['file_name'];
					$path      = ROOT_PATH.$CONFIG['file_path'];
					$size      = convert_numbers(convert_size(filesize($path.$file)));
					$date      = date($CONFIG['date_format'], filemtime($path.$file));
					$extension = file_type($file);
					$class     = (($class == 'row1') ? 'row2' : 'row1');
					$thumb     = ((!file_exists($path.thumbnail_name($file))) ? 'css/nothumb.jpg' : $path.thumbnail_name($file));
					$rating    = get_rating($file);	
					$link      = (($_GET['gal'] != '') ? "<a href='download.php?file={$file}'><b>Start Download</b></a>" : "<a href='users.php?act=delete_file&file={$file}&referer=".base64_encode($CONFIG['page_url'])."' onClick=\"return confirm('Are you sure you want to delete this image permanently?');\"><b>Delete File</b></a>");
					if($count == 4){
						echo '<br style="clear:both" /><br />';
						$count = 0;
					}
					$count++;	
					echo "
					<div class=\"gallery-thumbs\">
						<div style=\"height:140px\"><a href='viewer.php?file={$file}'><img src='{$thumb}' alt='{$file}' /></a></p></div>
						<p style=\"height:30px\">{$link}</p>
					</div>";
				}
			}
		}
	}