Changeset 1432337
- Timestamp:
- 06/07/2016 11:42:07 AM (10 years ago)
- Location:
- ezflippr/trunk
- Files:
-
- 3 edited
-
ezflippr.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
resources/install.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ezflippr/trunk/ezflippr.php
r1418876 r1432337 4 4 * Plugin URI: http://www.nuagelab.com/wordpress-plugins/ezflippr 5 5 * Description: Adds rich flipbooks made from PDF through ezFlippr.com 6 * Version: 1.1.3 16 * Version: 1.1.32 7 7 * Author: NuageLab <wordpress-plugins@nuagelab.com> 8 8 * Author URI: http://www.nuagelab.com/wordpress-plugins … … 1035 1035 if (!$result) { 1036 1036 list( $http, $result ) = self::callAPI( 1037 'get_flipbook/' . $uuid, 1037 'get_flipbook/' . $uuid . '?md5=1', 1038 //'get_flipbook/' . $uuid, 1038 1039 array( 1039 1040 'accesskey' => $accesskey, … … 1082 1083 1083 1084 // Check if file is already installed with the same md5 1085 $no_download = false; 1084 1086 if (file_exists($dir . DIRECTORY_SEPARATOR . $name)) { 1085 1087 $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 } 1086 1091 } 1087 1092 1088 1093 @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__ ) ); 1104 1131 } 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__));1124 1132 } 1125 1133 1126 if ( $ajax) {1134 if (($ajax) && ($no_download == false)) { 1127 1135 return array( 1128 1136 'continue'=>add_query_arg('skip_to', $name), 1129 1137 'skip_to'=>$name, 1130 1138 'progress'=>sprintf('%.01f', $cnt*100/count($result->files)), 1139 'downloaded'=>!$no_download, 1131 1140 ); 1132 1141 } -
ezflippr/trunk/readme.txt
r1418876 r1432337 89 89 90 90 == Changelog == 91 = 1.1.32 = 92 * Incompatibility with cURL and PHP's safe mode + open_basedir restriction. 93 91 94 = 1.1.31 = 92 95 * Fixed bug with JSON install. -
ezflippr/trunk/resources/install.php
r1418876 r1432337 26 26 'skip_to'=>$res['skip_to'], 27 27 'progress'=>$res['progress'], 28 )29 ) ;28 'downloaded'=>$res['downloaded'], 29 )); 30 30 } else { 31 31 echo json_encode( array( 'result' => ( $res === null ), 'error' => $res ) );
Note: See TracChangeset
for help on using the changeset viewer.