function href($url_link, $options = array()) { $confirm = ifSet($options['confirm'], ''); $new_window = ifSet($options['new_window'], false); if (!$new_window) { $hash = params2hash($url_link); $new_window = 1 == ifSet($hash['nw'], 0); } if ($new_window) { $width = ifSet($options['width'], '640'); $height = ifSet($options['height'], '480'); $target = ifSet($options['target'], '_blank'); $href = "window_open('{$url_link}',{$width},{$height},'{$target}')"; $result = $confirm ? "javascript:confirm('{$confirm}') ? {$href} : return false;" : "javascript:{$href};"; } else { $href = $url_link; $result = $confirm ? "javascript:confirm('{$confirm}') ? document.location.href='{$href}' : return false;" : $href; } return $result; }
function makeFree($href) { $free = str_replace('/download.php?', '/freeaccess.php?', $href); $freepath = get_freepath(); $tmp1 = params2hash($free); $file1 = $tmp1['path'] . '/' . $tmp1['file']; $new_file1 = $freepath . basename($file1); //echo "$file1 | $new_file1"; copy($file1, $new_file1); $freepath = preg_replace('@^' . CONFIG::get('FREEPATH') . '@', '', $freepath); $freepath = substr($freepath, 0, strlen($freepath) - 1); $free = merge_params($free, array('path' => $freepath)); $free_parsed = parse_url($free); if (!$free_parsed['host']) { $free = CONFIG::get('APPHOST') . $free; } return $free; }