Plugin Directory

Changeset 1432337


Ignore:
Timestamp:
06/07/2016 11:42:07 AM (10 years ago)
Author:
nuagelab
Message:

Version 1.1.32:

  • Incompatibility with cURL and PHP's safe mode + open_basedir restriction.
Location:
ezflippr/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ezflippr/trunk/ezflippr.php

    r1418876 r1432337  
    44* Plugin URI: http://www.nuagelab.com/wordpress-plugins/ezflippr
    55* Description: Adds rich flipbooks made from PDF through ezFlippr.com
    6 * Version: 1.1.31
     6* Version: 1.1.32
    77* Author: NuageLab <wordpress-plugins@nuagelab.com>
    88* Author URI: http://www.nuagelab.com/wordpress-plugins
     
    10351035            if (!$result) {
    10361036                list( $http, $result ) = self::callAPI(
    1037                     'get_flipbook/' . $uuid,
     1037                    'get_flipbook/' . $uuid . '?md5=1',
     1038                    //'get_flipbook/' . $uuid,
    10381039                    array(
    10391040                        'accesskey' => $accesskey,
     
    10821083
    10831084                        // Check if file is already installed with the same md5
     1085                        $no_download = false;
    10841086                        if (file_exists($dir . DIRECTORY_SEPARATOR . $name)) {
    10851087                            $hash = md5(file_get_contents($dir . DIRECTORY_SEPARATOR . $name));
     1088                            if ((property_exists($result->md5, $name)) && ($result->md5->{$name} == $hash)) {
     1089                                $no_download = true;
     1090                            }
    10861091                        }
    10871092
    10881093                        @mkdir(dirname($dir . DIRECTORY_SEPARATOR . $name), 0755, true);
    1089                         if (self::supportsCurl()) {
    1090                             $fp = fopen($dir . DIRECTORY_SEPARATOR . $name, 'w+');
    1091                             $ch = curl_init(str_replace(" ","%20",$file));
    1092                             curl_setopt($ch, CURLOPT_TIMEOUT, 50);
    1093                             curl_setopt($ch, CURLOPT_FILE, $fp); // write curl response to file
    1094                             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    1095                             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    1096                             curl_setopt($ch, CURLOPT_TIMEOUT, self::API_TIMEOUT);
    1097                             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
    1098                             curl_setopt($ch, CURLOPT_USERAGENT, 'ezflippr-wp ('.self::getVersion().'+'.self::getPHPVersion().')');
    1099                             try{
    1100                                 curl_exec($ch);
    1101                                 $error = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    1102                             }catch(Exception $e) {
    1103                                 return("Couldn't install: ".$e->getMessage());
     1094                        if (!$no_download) {
     1095                            if ( self::supportsCurl() ) {
     1096                                $fp = fopen( $dir . DIRECTORY_SEPARATOR . $name, 'w+' );
     1097                                $ch = curl_init( str_replace( " ", "%20", $file ) );
     1098                                curl_setopt( $ch, CURLOPT_TIMEOUT, 50 );
     1099                                curl_setopt( $ch, CURLOPT_FILE, $fp ); // write curl response to file
     1100                                @curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
     1101                                curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
     1102                                curl_setopt( $ch, CURLOPT_TIMEOUT, self::API_TIMEOUT );
     1103                                curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 0 );
     1104                                curl_setopt( $ch, CURLOPT_USERAGENT, 'ezflippr-wp (' . self::getVersion() . '+' . self::getPHPVersion() . ')' );
     1105                                try {
     1106                                    curl_exec( $ch );
     1107                                    $error = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
     1108                                } catch ( Exception $e ) {
     1109                                    return ( "Couldn't install: " . $e->getMessage() );
     1110                                }
     1111                                if ( $error >= 400 ) {
     1112                                    return ( "Couldn't install: " . $error . ' on ' . $file );
     1113                                }
     1114                                if ( curl_errno( $ch ) ) {
     1115                                    self::writeDebug( "curl_errno " . curl_error( $ch ) );
     1116
     1117                                    return ( "Couldn't install: " . curl_error( $ch ) . ' on ' . $file );
     1118                                }
     1119                                curl_close( $ch );
     1120                                fclose( $fp );
     1121                            } else if ( self::supportsStreamCopy() ) {
     1122                                $fp = fopen( $dir . DIRECTORY_SEPARATOR . $name, 'w+' );
     1123                                $ht = fopen( $file, 'r', false, $context );
     1124                                stream_copy_to_stream( $ht, $fp );
     1125                                fclose( $fp );
     1126                                fclose( $ht );
     1127                            } else if ( self::supportsHttpHandler() ) {
     1128                                file_put_contents( $dir . DIRECTORY_SEPARATOR . $name, file_get_contents( $file, false, $context ) );
     1129                            } else {
     1130                                return ( __( 'No communication methods supported by your PHP installation. Please install the php_curl extension, or enable allow_url_fopen and enable the php_openssl extension.', __EZFLIPPR_PLUGIN_SLUG__ ) );
    11041131                            }
    1105                             if ($error >= 400) {
    1106                                 return("Couldn't install: ".$error.' on '.$file);
    1107                             }
    1108                             if (curl_errno($ch)) {
    1109                                 self::writeDebug("curl_errno ".curl_error($ch));
    1110                                 return("Couldn't install: ".curl_error($ch).' on '.$file);
    1111                             }
    1112                             curl_close($ch);
    1113                             fclose($fp);
    1114                         } else if (self::supportsStreamCopy()) {
    1115                             $fp = fopen($dir . DIRECTORY_SEPARATOR . $name, 'w+');
    1116                             $ht = fopen($file, 'r', false, $context);
    1117                             stream_copy_to_stream($ht , $fp);
    1118                             fclose($fp);
    1119                             fclose($ht);
    1120                         } else if (self::supportsHttpHandler()) {
    1121                             file_put_contents($dir . DIRECTORY_SEPARATOR . $name, file_get_contents($file, false, $context));
    1122                         } else {
    1123                             return(__('No communication methods supported by your PHP installation. Please install the php_curl extension, or enable allow_url_fopen and enable the php_openssl extension.', __EZFLIPPR_PLUGIN_SLUG__));
    11241132                        }
    11251133
    1126                         if ($ajax) {
     1134                        if (($ajax) && ($no_download == false)) {
    11271135                            return array(
    11281136                                'continue'=>add_query_arg('skip_to', $name),
    11291137                                'skip_to'=>$name,
    11301138                                'progress'=>sprintf('%.01f', $cnt*100/count($result->files)),
     1139                                'downloaded'=>!$no_download,
    11311140                            );
    11321141                        }
  • ezflippr/trunk/readme.txt

    r1418876 r1432337  
    8989
    9090== Changelog ==
     91= 1.1.32 =
     92* Incompatibility with cURL and PHP's safe mode + open_basedir restriction.
     93
    9194= 1.1.31 =
    9295* Fixed bug with JSON install.
  • ezflippr/trunk/resources/install.php

    r1418876 r1432337  
    2626            'skip_to'=>$res['skip_to'],
    2727            'progress'=>$res['progress'],
    28             )
    29         );
     28            'downloaded'=>$res['downloaded'],
     29        ));
    3030    } else {
    3131        echo json_encode( array( 'result' => ( $res === null ), 'error' => $res ) );
Note: See TracChangeset for help on using the changeset viewer.