Beispiel #1
0
         print $pgv_lang["media_file_not_moved"];
     }
     print "</b></span><br />";
     $finalResult = false;
 } else {
     if (!$isExternal) {
         $oldMainFile = $oldFolder . $oldFilename;
         $newMainFile = $folder . $filename;
         $oldThumFile = str_replace($MEDIA_DIRECTORY, $MEDIA_DIRECTORY . "thumbs/", $oldMainFile);
         $newThumFile = str_replace($MEDIA_DIRECTORY, $MEDIA_DIRECTORY . "thumbs/", $newMainFile);
         if (media_exists($oldMainFile) == 3) {
             // the file is in the media firewall directory
             $oldMainFile = get_media_firewall_path($oldMainFile);
             $newMainFile = get_media_firewall_path($newMainFile);
         }
         if (media_exists($oldThumFile) == 3) {
             $oldThumFile = get_media_firewall_path($oldThumFile);
             $newThumFile = get_media_firewall_path($newThumFile);
         }
         $isMain = file_exists(filename_decode($oldMainFile));
         $okMain = !file_exists(filename_decode($newMainFile));
         $isThum = file_exists(filename_decode($oldThumFile));
         $okThum = !file_exists(filename_decode($newThumFile));
         if ($okMain && $okThum) {
             // make sure the directories exist before moving the files
             mkdirs(dirname($newMainFile) . "/");
             mkdirs(dirname($newThumFile) . "/");
             if ($isMain) {
                 $okMain = @rename(filename_decode($oldMainFile), filename_decode($newMainFile));
             }
             if ($isThum) {
Beispiel #2
0
    private function create_media($url)
    {
        global $user;
        global $db;
        if ($mid = media_exists($url)) {
            return $mid;
        } else {
            $provider = rmpl_parse_url($url);
            $request = $provider . "?url=" . $url . "&format=json";
            $response = oembed_request($request);
            $db->query('INSERT INTO media (title,
			url, 
			provider_name, 
			provider_url, 
			html, 
			added, 
			added_by, 
			deleted
			)VALUES (
			"' . $response->title . '", 
			"' . $url . '", 
			"' . $response->provider_name . '",
			"' . $response->provider_url . '",
			"' . mysql_real_escape_string($response->html) . '",
			' . time() . ',
			' . $user->uid . ',
			0)');
            return media_exists($url);
        }
    }