Пример #1
0
function check_for_configfile()
{
    if (!file_exists(absolute_path('config.xml'))) {
        if (file_exists(absolute_path('cofig.xml-dist'))) {
            writeLog('Vor der Nutzung »config.xml-dist« in »config.xml« umbennen und anpassen.', FAIL);
            die;
        } else {
            writeLog('Konfigurationsdatei »config.xml« nicht vorhanden.', FAIL);
            die;
        }
    }
}
Пример #2
0
function kick($path)
{
    // Empty output buffer to be able to send header after content
    // (buffered output will be discarded)
    ob_clean();
    if (preg_match('/^https?:\\/\\//', $path)) {
        header("Location: {$path}");
        die;
    }
    // Construct URL
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        $proto = 'https';
    } else {
        $proto = 'http';
    }
    $host = $_SERVER['HTTP_HOST'];
    $path = absolute_path($path, true);
    header("Location: {$proto}://{$host}{$path}");
    exit;
}
 public function get_file($modelID = '', $id = '', $filetype = '', $filename = '')
 {
     if ($id != '') {
         $fileinfo = $this->file_model->get_fileinfo($modelID, $id, $filetype);
         if ($fileinfo['Status']) {
             if (file_exists(absolute_path() . APPPATH . 'files/' . $fileinfo['LocalFileName'])) {
                 switch (strtolower($filetype)) {
                     case "thumbnails":
                         $size = explode('_', $filename);
                         if (!is_numeric($size[0]) or $size[0] <= 0) {
                             show_404();
                         }
                         if (!is_numeric($size[1]) or $size[0] <= 0) {
                             show_404();
                         }
                         $img = new SimpleImage();
                         $img->load(absolute_path() . APPPATH . 'files/' . $fileinfo['LocalFileName'])->best_fit($size[0], $size[1]);
                         $img->output('jpg');
                         break;
                     default:
                         $mm_type = mime_content_type($fileinfo['FileName']);
                         header('Content-Description: File Transfer');
                         header('Content-Type: ' . $mm_type);
                         header('Content-Disposition: ' . $fileinfo['DispositionType'] . '; filename=' . basename($fileinfo['FileName']));
                         header('Content-Transfer-Encoding: binary');
                         header('Expires: 0');
                         header('Cache-Control: must-revalidate');
                         header('Pragma: public');
                         header('Content-Length: ' . filesize(APPPATH . 'files/' . $fileinfo['LocalFileName']));
                         ob_clean();
                         flush();
                         readfile(APPPATH . 'files/' . $fileinfo['LocalFileName']);
                 }
             }
         } else {
             show_404();
         }
     } else {
         show_404();
     }
 }
Пример #4
0
 function build_defs($xml)
 {
     static $var_prefix = 'var';
     $var_index = 0;
     foreach ($xml->var as $rec) {
         $row = array();
         $var = (string) $rec->attributes()->id;
         $sy = new ShuntingYard((string) $rec);
         $token = $sy->first();
         while ($token !== FALSE) {
             if ($token->type === T_DEF) {
                 $var_key = $token->value;
                 if (isset($this->vars[$var_key])) {
                     $row[] = $this->vars[$var_key];
                 } elseif ($tmp = preg_split('/:/', $var_key) and array_shift($tmp) === 'rrd') {
                     if (!in_array(strtoupper(end($tmp)), array('AVERAGE', 'MIN', 'MAX', 'LAST'))) {
                         $cf = 'AVERAGE';
                     } else {
                         $cf = strtoupper(array_pop($tmp));
                     }
                     $ds = ds_encode(array_pop($tmp));
                     $filename = absolute_path($this->cfg->rrd->paths->db . DIRECTORY_SEPARATOR . join('.', $tmp) . '.rrd', @$this->opts['base_path']['db']);
                     $var_value = "{$filename}:{$ds}:{$cf}";
                     $var_name = $var_prefix . $var_index;
                     $var_index++;
                     $this->vars[$var_key] = $var_name;
                     $this->cmd[] = "DEF:{$var_name}={$var_value}";
                     $row[] = $var_name;
                 } else {
                     die("Undefined variable `{$var_key}`\n");
                 }
             } elseif ($token->type === T_UNARY_MINUS) {
                 // multiply by minus one in order to reverse the sign
                 $row[] = -1;
                 $row[] = '*';
             } elseif ($token->type === T_UNARY_PLUS) {
                 // simple skip it
             } else {
                 $row[] = $token->value;
             }
             $token = $sy->next();
         }
         $var_key = $var;
         if (isset($this->vars[$var_key])) {
             die("Duplicate variable definition for`{$var}`");
         } elseif (count($row) === 1 and strpos($row[0], $var_prefix) === 0) {
             // simple variable, duplicate key
             $this->vars[$var_key] = $row[0];
         } else {
             $var_name = $var_prefix . $var_index;
             $var_index++;
             $this->vars[$var_key] = $var_name;
             $cdef = 'CDEF:' . $var_name . '=' . join(',', $row);
             $this->cmd[] = $cdef;
         }
     }
 }
Пример #5
0
#!/usr/bin/php
<?php 
require_once 'inc.functions.php';
check_for_configfile();
require_once 'class.microbloging.php';
$config = simplexml_load_file(absolute_path('config.xml'));
$microbloging = new Microbloging($config->microbloging->service, $config->microbloging->username, $config->microbloging->password);
define("FEED", $config->watcher->feeds->feed[0]);
define("WATCHFOLDER", absolute_path($config->watcher->watchfolder));
define("IDFILE", absolute_path($config->watcher->idfile));
define("DEBUG", $config->watcher->debug->attributes()->active);
// @TODO: Code gibt es nur aus Kompatibilitätsgründen
$shows = array();
foreach ($config->watcher->shows->show as $thisShows) {
    $shows[] = (string) $thisShows->regexp[0];
}
if (count($argv) > 1) {
    if ($argv[1] == '-t') {
        $testStrings = array('Flashpoint - PREAiR 2x1 [PDTV - DINA]', 'Greys Anatomy 5x9 [720P - HDTV - CTU]', 'The Office 5x8 [HDTV - LOL]', '30 Rock 3x4 [HDTV - REPACK - LOL]', 'ER 15x8 [HDTV - XOR]', 'CSI 9x7 [720P - HDTV - DIMENSION]', 'My Name Is Earl 4x11 [HDTV - LOL]', 'Smallville 8x10 [720P - HDTV - CTU]', 'Greys Anatomy 5x9 [HDTV - 0TV]', '30 Rock 3x4 [HDTV - LOL]');
        writeLog("Testmodus (" . count($testStrings) . " Test-Strings) …\n");
        define('TEST', 1);
    } else {
        writeLog('Teste "' . $argv[1] . "\" …");
        foreach ($shows as $show) {
            if (preg_match($show, $argv[1], $foo)) {
                writeLog("MATCH \"" . $show . "\"");
            }
        }
        die;
    }
} else {
Пример #6
0
 /**
  * Initiates the backup procedure.
  *
  * @global string  $wp_version WordPress version
  */
 public function do_backup($id = '')
 {
     global $wp_version;
     $used_memory = memory_get_usage(true);
     // Get the memory usage before we do anything.
     if ($id) {
         $this->log_file = $this->options['backup_list'][$id]['log'];
     } else {
         $id = base_convert($this->time, 10, 36);
         $this->log_file = $this->local_folder . '/' . $id . '.log';
         file_put_contents($this->log_file, "#Fields:\tdate\ttime\ttype\tmessage\n");
         $this->options['backup_list'][$id] = array('timestamp' => $this->time, 'title' => $this->options['backup_title'] . ' (' . $id . ')', 'file_path' => '', 'drive_id' => '', 'log' => $this->log_file, 'attempt' => 0);
         // Save info about our new backup now, so we can have access to the log file even if MySQL connection is stolen.
         update_option('backup_options', $this->options);
         // Log environment information.
         if (!($z = phpversion('zip'))) {
             $z = 'false';
         }
         $c = '';
         if (in_array('curl', $this->options['enabled_transports']) && function_exists('curl_version')) {
             $c = curl_version();
             $c = '; CURL ' . $c['version'];
         }
         $env = "Environment: Backup " . $this->version . "; WordPress " . $wp_version . "; PHP " . phpversion() . "; SAPI " . php_sapi_name() . "; OS " . PHP_OS . "; ZIP " . $z . $c;
         if ((bool) ini_get('safe_mode')) {
             $env .= "; Safe mode ON";
         }
         $env .= "; Time limit " . ini_get('max_execution_time') . "s" . "; Memory limit " . ini_get('memory_limit');
         $this->log("NOTICE", $env);
     }
     // We can't hook to WP's shudown hook because we need to pass the $id.
     register_shutdown_function(array(&$this, 'handle_timeout'), $id);
     $file_name = sanitize_file_name($this->options['backup_list'][$id]['title']) . '.zip';
     $file_path = $this->local_folder . '/' . $file_name;
     if (@is_file($file_path)) {
         $this->options['backup_list'][$id]['file_path'] = $file_path;
     }
     if (empty($this->options['backup_list'][$id]['file_path'])) {
         // Check if the backup folder is writable
         if (!@is_dir($this->local_folder) && !$this->create_dir($this->local_folder) || !@is_writable($this->local_folder)) {
             $this->log('ERROR', sprintf(__("The directory '%s' does not exist or is not writable.", $this->text_domain), esc_html($this->local_folder)));
             $this->reschedule_backup($id);
         }
         // Create database dump sql file.
         if (in_array('database', $this->options['source_list'])) {
             $this->log('NOTICE', __('Attempting to dump database.', $this->text_domain));
             if (is_wp_error($dump_time = db_dump($this->dump_file))) {
                 $this->log_wp_error($dump_time);
                 $this->reschedule_backup($id);
             }
             $this->log('NOTICE', sprintf(__('The database dump was completed successfully in %s seconds.', $this->text_domain), number_format_i18n($dump_time, 3)));
         }
         // Merge the default exclude list with the user provided one and make them absolute paths.
         $exclude = array_merge($this->options['exclude_list'], $this->exclude);
         foreach ($exclude as $i => $path) {
             if (false !== strpos($path, '/') || false !== strpos($path, "\\")) {
                 $exclude[$i] = absolute_path($path, ABSPATH);
             }
         }
         // Create the source list from the user selected sources.
         $sources = array();
         foreach ($this->options['source_list'] as $source) {
             $sources[] = $this->sources[$source]['path'];
         }
         // Remove subdirectories from the sources.
         $count = count($sources);
         for ($i = 0; $i < $count; $i++) {
             for ($j = 0; $j < $count; $j++) {
                 if ($j != $i && isset($sources[$i]) && isset($sources[$j]) && is_subdir($sources[$j], $sources[$i]) && $this->sources['database']['path'] != $sources[$j]) {
                     unset($sources[$j]);
                 }
             }
         }
         // Transform include paths to absolute paths.
         $include = $this->options['include_list'];
         foreach ($include as $i => $path) {
             $include[$i] = absolute_path($path, ABSPATH);
         }
         // Merge the include list and the sources
         $sources = array_merge($sources, $include);
         // Create archive from the sources list.
         $this->log('NOTICE', sprintf(__("Attempting to create archive '%s'.", $this->text_domain), esc_html($file_name)));
         if (!phpversion('zip')) {
             define('PCLZIP_TEMPORARY_DIR', $this->local_folder);
         }
         if (is_wp_error($zip = zip($sources, $file_path, $exclude))) {
             $this->log_wp_error($zip);
             delete_path($this->dump_file);
             $this->reschedule_backup($id);
         }
         delete_path($this->dump_file);
         $this->log('NOTICE', sprintf(__('Successfully archived %1$s files in %2$s seconds. Archive file size is %3$s.', $this->text_domain), number_format_i18n($zip['count']), number_format_i18n($zip['time'], 3), size_format(filesize($file_path), 2)));
         $this->options['backup_list'][$id]['file_path'] = $file_path;
     }
     if ($this->options['drive_number'] > 0 && $this->goauth->is_authorized()) {
         if (is_wp_error($e = $this->need_gdocs())) {
             $this->log_wp_error($e);
             $this->reschedule_backup($id);
         }
         if (empty($this->options['backup_list'][$id]['location'])) {
             $this->log('NOTICE', __("Attempting to upload archive to Google Drive.", $this->text_domain));
             $location = $this->gdocs->prepare_upload($this->options['backup_list'][$id]['file_path'], $this->options['backup_list'][$id]['title'], $this->options['drive_folder']);
         } else {
             $this->log('NOTICE', __('Attempting to resume upload.', $this->text_domain));
             $location = $this->gdocs->resume_upload($this->options['backup_list'][$id]['file_path'], $this->options['backup_list'][$id]['location']);
         }
         if (is_wp_error($location)) {
             $this->log_wp_error($location);
             $this->reschedule_backup($id);
         }
         if (is_string($location)) {
             $res = $location;
             $this->log('NOTICE', sprintf(__("Uploading file with title '%s'.", $this->text_domain), esc_html($this->options['backup_list'][$id]['title'])));
             $d = 0;
             echo '<div id="progress">';
             do {
                 $this->options['backup_list'][$id]['location'] = $res;
                 $res = $this->gdocs->upload_chunk();
                 $p = $this->gdocs->get_upload_percentage();
                 if ($p - $d >= 1) {
                     $b = intval($p - $d);
                     echo '<span style="width:' . $b . '%"></span>';
                     $d += $b;
                 }
                 $this->options['backup_list'][$id]['percentage'] = $p;
                 $this->options['backup_list'][$id]['speed'] = $this->gdocs->get_upload_speed();
             } while (is_string($res));
             echo '</div>';
             if (is_wp_error($res)) {
                 $this->log_wp_error($res);
                 $this->reschedule_backup($id);
             }
             $this->log('NOTICE', sprintf(__('The file was successfully uploaded to Google Drive in %1$s seconds at an upload speed of %2$s/s.', $this->text_domain), number_format_i18n($this->gdocs->time_taken(), 3), size_format($this->gdocs->get_upload_speed())));
             unset($this->options['backup_list'][$id]['location'], $this->options['backup_list'][$id]['attempt']);
         } elseif (true === $location) {
             $this->log('WARNING', sprintf(__("The file '%s' is already uploaded.", $this->text_domain), esc_html($this->options['backup_list'][$id]['file_path'])));
         }
         $this->options['backup_list'][$id]['drive_id'] = $this->gdocs->get_file_id();
         unset($this->options['backup_list'][$id]['percentage'], $this->options['backup_list'][$id]['speed']);
         $this->update_quota();
         if (empty($this->options['user_info'])) {
             $this->set_user_info();
         }
     }
     $this->options['backup_list'][$id]['status'] = 1;
     $this->purge_backups();
     $this->log('NOTICE', sprintf(__('Backup process completed in %1$s seconds.' . ' Initial PHP memory usage was %2$s and the backup process used another %3$s of RAM.', $this->text_domain), number_format_i18n(microtime(true) - $this->time, 3), size_format($used_memory, 2), size_format(memory_get_peak_usage(true) - $used_memory, 2)));
 }
Пример #7
0
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title><?php 
echo $application['name'];
?>
</title>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<link type="text/css" rel="stylesheet" href="<?php 
echo absolute_path('style.css');
?>
" />
		<script type="text/javascript" src="<?php 
echo absolute_path('js/dom.js');
?>
"></script>
		<script type="text/javascript" src="/js/sort.js"></script>
		<script type="text/javascript">
		<!--
		function set_initial_focus() {
			var elem = document.getElementById('initial_focus');
			if(elem) {
				elem.focus();
			}
		}
		window.onload = set_initial_focus;
		-->
		</script>
	</head>
Пример #8
0
#!/usr/bin/php
<?php 
/**
 * Skript zum zusammensuchen von heruntergeladenen Serien. Weiterhin
 * werden die gefundenen Serien umbenannt und in eine Ordnerhierarchie
 * einsortiert. Ausserdem gibt es per Growl eine Benachrichtigung.
 *
 * @version 1.4 (2009-02-13)
 * @author Jens Kohl <*****@*****.**>
 */
require_once 'inc.functions.php';
check_for_configfile();
require_once 'class.microbloging.php';
$config = simplexml_load_file(absolute_path('config.xml'));
$microbloging = new Microbloging($config->microbloging->service, $config->microbloging->username, $config->microbloging->password);
define(LOGGING, $config->sorter->logging->attributes()->active);
define(RENAME_DIVX, $config->sorter->rename_divx->attributes()->active);
// Wenn das Skript auf der Kommandozeile mit dem Parameter now gestartet
// wird, dann gibt es keine Gracetime für neu hinzugefügte Dateien. Also
// aufpassen was ihr tut.
if ($argv[1] == 'now') {
    define(NOW, true);
} else {
    define(NOW, false);
}
/**
 * Funktion verschriebt Dateien in in eine geparste Ordnerhierarchie
 *
 * @author Jens Kohl <*****@*****.**>
 * @param string Dateiname
 * @param string Verzeichnisname
Пример #9
0
function link_to_user($username, $action)
{
    return absolute_path() . "users/{$username}/{$action}";
}
Пример #10
0
<?php

if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
// Load helper functions
require_once 'functions.php';
// Clear scheduled hook.
if (wp_next_scheduled('backup_schedule')) {
    wp_clear_scheduled_hook('backup_schedule');
}
// Delete all files created by the plugin.
if (defined('BACKUP_LOCAL_FOLDER')) {
    $folder = BACKUP_LOCAL_FOLDER;
} else {
    $options = get_option('backup_options');
    $folder = $options['local_folder'];
}
$folder = absolute_path($folder, ABSPATH);
if (@file_exists($folder . '/.backup')) {
    delete_path($folder, true);
}
// Delete options.
delete_option('backup_options');
 function rImage($image_path, $width = 0, $height = 0, $force_resize = TRUE, $force_rgb = TRUE)
 {
     // TODO: refactor
     //Get the Codeigniter object by reference
     $CI =& get_instance();
     // config
     $file_info = array();
     $is_remote = FALSE;
     $is_online = TRUE;
     $is_cached = FALSE;
     $origin_last_modified = NULL;
     $cache_dir = $CI->config->config['App']['assets_cache_path'];
     $login_handle = '';
     // if image_path is a full URL, check if this equals base_url()
     $path = str_ireplace(base_url(), '', $image_path, $count);
     if ($count == 1) {
         $image_path = $path;
     }
     $absolute_path = ".";
     if (absolute_path()) {
         $absolute_path = absolute_path();
     } else {
         $absolute_path = realpath(APPPATH . '../');
     }
     // cache path
     $cache_path = $absolute_path . $cache_dir;
     /* should be writable */
     // return $image_path, if cache dir is not writable
     if (!is_writable($cache_path)) {
         log_message('debug', 'rImage, cache dir [' . $cache_path . '] not writable');
         return $image_path;
     }
     // check file system and remote, if file exists
     if (!file_exists($image_path)) {
         log_message('debug', 'rImage, image [' . $image_path . '] not local');
         $file = fopen($login_handle . $image_path, "r");
         if (!$file) {
             $is_online = FALSE;
             // maybe we are offline, try to get locally cached version
         }
         $url_components = parse_url($login_handle . $image_path);
         $path_components = explode("/", $url_components['path']);
         $file_components = explode(".", end($path_components));
         $file_info['filename'] = $file_components[0];
         $file_info['extension'] = isset($file_components[1]) ? $file_components[1] : FALSE;
         if ($is_online) {
             $origin_last_modified = GetRemoteLastModified($login_handle . $image_path);
         }
         $is_remote = TRUE;
     } else {
         $path_components = pathinfo($image_path);
         $file_info['filename'] = $path_components['filename'];
         $file_info['extension'] = '';
         if (isset($path_components['extension'])) {
             $file_info['extension'] = $path_components['extension'];
         }
         $origin_last_modified = filemtime($image_path);
     }
     //The new generated filename we want
     $new_file_name = $file_info['filename'] . '_' . $width . 'x' . $height;
     if ($file_info['extension'] != '') {
         $new_file_name = $new_file_name . '.' . $file_info['extension'];
     }
     $new_image_path = $cache_path . $new_file_name;
     log_message('debug', 'rImage, new image path is: ' . $new_image_path);
     if (file_exists($new_image_path)) {
         $is_cached = TRUE;
     }
     // not cached, not online, return $image_path
     if (!$is_cached && !$is_online && $is_remote) {
         return $image_path;
     }
     //The first time the image is requested, or original image is newer than our cache image
     if (!$is_cached || filemtime($new_image_path) < $origin_last_modified || $is_cached && !$is_online && $is_remote) {
         $CI->load->library('image_lib');
         // copy, if remote
         if ($is_remote) {
             $tmp_file = time() . mt_rand();
             copy($image_path, $cache_path . $tmp_file);
             // needs PHP5 and the HTTP stream wrapper enabled
             $image_path = $cache_path . $tmp_file;
         }
         //The original sizes
         $image_info = @getimagesize($image_path);
         if (isset($image_info['channels'])) {
             $color_mode = $image_info['channels'];
         } else {
             $color_mode = 3;
         }
         $original_width = $image_info[0];
         $original_height = $image_info[1];
         log_message('debug', 'rImage, image path is: ' . $image_path);
         if ($original_width < 30 && $original_height < 30) {
             log_message('debug', 'rImage: image is too small (' . $original_width . "x" . $original_height . ')');
             return $image_path;
         }
         if ($original_width * $original_height > 1600 * 1200) {
             log_message('debug', 'rImage: this one is too big (' . $original_width . "x" . $original_height . ')');
             return $image_path;
         }
         $ratio = $original_width / $original_height;
         //The requested sizes
         $requested_width = $width;
         $requested_height = $height;
         if ($force_resize == FALSE && ($requested_width > $original_width || $requested_height > $original_height)) {
             if ($color_mode == 4 && $force_rgb == TRUE) {
                 log_message('debug', 'rImage, force RGB');
                 // force rgb by pseudo-resizing
                 $config = array();
                 $config['image_library'] = 'gd2';
                 $config['source_image'] = $image_path;
                 $config['new_image'] = $new_image_path;
                 $config['maintain_ratio'] = FALSE;
                 $config['height'] = $original_height;
                 $config['width'] = $original_width;
                 $CI->image_lib->initialize($config);
                 $CI->image_lib->resize();
                 $CI->image_lib->clear();
             } else {
                 // do nothing but copy
                 copy($image_path, $new_image_path);
             }
         } else {
             //Initialising
             $new_width = 0;
             $new_height = 0;
             //Calculations
             if ($requested_width > $requested_height) {
                 $new_width = $requested_width;
                 $new_height = $new_width / $ratio;
                 if ($requested_height == 0) {
                     $requested_height = $new_height;
                 }
                 if ($new_height < $requested_height) {
                     $new_height = $requested_height;
                     $new_width = $new_height * $ratio;
                 }
             } else {
                 $new_height = $requested_height;
                 $new_width = $new_height * $ratio;
                 if ($requested_width == 0) {
                     $requested_width = $new_width;
                 }
                 if ($new_width < $requested_width) {
                     $new_width = $requested_width;
                     $new_height = $new_width / $ratio;
                 }
             }
             $new_width = ceil($new_width);
             $new_height = ceil($new_height);
             log_message('debug', 'rImage, resizing');
             //Resizing
             $config = array();
             $config['image_library'] = 'gd2';
             $config['source_image'] = $image_path;
             $config['new_image'] = $new_image_path;
             $config['maintain_ratio'] = FALSE;
             $config['height'] = $new_height;
             $config['width'] = $new_width;
             $CI->image_lib->initialize($config);
             $CI->image_lib->resize();
             $CI->image_lib->clear();
             //Crop if both width and height are not zero
             if ($width != 0 && $height != 0) {
                 $x_axis = floor(($new_width - $width) / 2);
                 $y_axis = floor(($new_height - $height) / 2);
                 log_message('debug', 'rImage, cropping');
                 //Cropping
                 $config = array();
                 $config['source_image'] = $new_image_path;
                 $config['maintain_ratio'] = FALSE;
                 $config['new_image'] = $new_image_path;
                 $config['width'] = $width;
                 $config['height'] = $height;
                 $config['x_axis'] = $x_axis;
                 $config['y_axis'] = $y_axis;
                 $CI->image_lib->initialize($config);
                 $CI->image_lib->crop();
                 $CI->image_lib->clear();
             }
         }
         // delete local temp file (copied from remote to process)
         if ($is_remote) {
             unlink($cache_path . $tmp_file);
         }
     }
     return base_url($cache_dir . $new_file_name);
     // dirty hack
 }