function routes($url) { $first = array_kshift($url); foreach ($first as $key => $value) { $url[$key] = $value; } run($url); }
function get_map_html($img_url) { global $previous_sizes, $sizes; require_once('PEAR.php'); pear::loadExtension('json'); $json = exec('curl "'. $img_url .'&chof=json"'); $map = json_decode($json)->chartshape; $map_html = "<map name=\"disk_usage_map\">\n"; foreach ($map as $area) { if (count($previous_sizes) > 0) { list($path, $size) = array_kshift($previous_sizes); } else { list($path, $size) = array_kshift($sizes); } $href_dir = $path; if (strrpos($path, '/.../') == strlen($path)-5) { $href_dir = substr($path, 0, strlen($path)-5); } else if (strrpos($path, '/*') == strlen($path)-2) { $href_dir = substr($path, 0, strlen($path)-2); } else if (strrpos($path, '/') == strlen($path)-1) { $href_dir = substr($path, 0, strlen($path)-1); } if (strrpos($path, '/**') != strlen($path)-3 && $href_dir != 'Legend') { $map_html .= " <area name=\"$area->name\" shape=\"$area->type\" coords=\"". implode(',', $area->coords) ."\" href=\"du.php?d=". urlencode($href_dir) ."\" title=\"". htmlentities(get_legend($path, $size, TRUE), ENT_COMPAT, 'UTF-8') ."\">\n"; } } $map_html .= "</map>\n"; return $map_html; }