mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	* Security fix: unauthorized access Affects nginx users: Moved php files outside of public html directory (Apache was protected by .htaccess) Affects all users: Some files did not check for authentication and could disclose some info. Better checks before including files from user input * git mv html/includes/ includes/html git mv html/pages/ includes/html/
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
foreach ($vars as $var => $value) {
 | 
						|
    if ($value != '') {
 | 
						|
        switch ($var) {
 | 
						|
            case 'name':
 | 
						|
                $where  .= " AND `$var` = ?";
 | 
						|
                $param[] = $value;
 | 
						|
                break;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
echo '<table cellspacing="0" cellpadding="5" width="100%">';
 | 
						|
 | 
						|
foreach (dbFetchRows("SELECT * FROM `packages` WHERE 1 $where GROUP BY `name`", $param) as $entry) {
 | 
						|
    echo '<tr class="list">';
 | 
						|
    echo '<td width=200><a href="'.generate_url($vars, array('name' => $entry['name'])).'">'.$entry['name'].'</a></td>';
 | 
						|
 | 
						|
    echo '<td>';
 | 
						|
    foreach (dbFetchRows('SELECT * FROM `packages` WHERE `name` = ? ORDER BY version, build', array($entry['name'])) as $entry_v) {
 | 
						|
        $entry['blah'][$entry_v['version']][$entry_v['build']][$entry_v['device_id']] = 1;
 | 
						|
    }
 | 
						|
 | 
						|
    foreach ($entry['blah'] as $version => $bleu) {
 | 
						|
        $content = '<div style="width: 800px;">';
 | 
						|
 | 
						|
        foreach ($bleu as $build => $bloo) {
 | 
						|
            if ($build) {
 | 
						|
                $dbuild = '-'.$build;
 | 
						|
            } else {
 | 
						|
                $dbuild = '';
 | 
						|
            }
 | 
						|
 | 
						|
            $content .= '<div style="background-color: #eeeeee; margin: 5px;"><span style="font-weight: bold; ">'.$version.$dbuild.'</span>';
 | 
						|
            foreach ($bloo as $device_id => $no) {
 | 
						|
                $this_device = device_by_id_cache($device_id);
 | 
						|
                $content    .= '<span style="background-color: #f5f5f5; margin: 5px;">'.$this_device['hostname'].'</span> ';
 | 
						|
            }
 | 
						|
 | 
						|
            $content .= '</div>';
 | 
						|
        }
 | 
						|
 | 
						|
        $content .= '</div>';
 | 
						|
        if (empty($vars['name'])) {
 | 
						|
            echo "<span style='margin:5px;'>".overlib_link('', $version, $content, null).'</span>';
 | 
						|
        } else {
 | 
						|
            echo "$version $content";
 | 
						|
        }
 | 
						|
    }//end foreach
 | 
						|
 | 
						|
    echo '<td>';
 | 
						|
    echo '</tr>';
 | 
						|
}//end foreach
 | 
						|
 | 
						|
echo '</table>';
 |