Advertisement
Guest User

Untitled

a guest
Feb 9th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.09 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for Zend Encoder/SafeGuard & PhpExpress)
  6. *
  7. * @ Version : 1.1.3.0
  8. * @ Author : DeZender
  9. * @ Release on : 17.05.2011
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function deleteslashes() {
  15. global $_POST;
  16.  
  17. if (isset( $_POST )) {
  18. while (list( $key, $value ) = each( $_POST )) {
  19. $_POST[$key] = str_replace( '|', '_', $_POST[$key] );
  20. $_POST[$key] = str_replace( '*', '_', $_POST[$key] );
  21. }
  22.  
  23. return $_POST;
  24. }
  25.  
  26. }
  27.  
  28. function updatepack($arr) {
  29. global $scriptpath;
  30.  
  31. if (( !is_array( $arr ) || count( $arr ) == 0 )) {
  32. return false;
  33. }
  34.  
  35. if (file_exists( '' . $scriptpath . '/rotator/network/packs' )) {
  36. $packs = file( '' . $scriptpath . '/rotator/network/packs' );
  37. $cur_pack = (isset( $packs[0] ) ? trim( $packs[0] ) : 1);
  38.  
  39. if (!file_exists( '' . $scriptpath . '/rotator/network/pack' . $cur_pack )) {
  40. return false;
  41. }
  42.  
  43. $text = join( '
  44. ', $arr );
  45. $text .= '
  46. ';
  47. $f1 = fopen( '' . $scriptpath . '/rotator/network/pack' . $cur_pack, 'a' );
  48. fwrite( $f1, $text );
  49. fclose( $f1 );
  50. @chmod( '' . $scriptpath . '/rotator/network/pack' . $cur_pack, 511 );
  51. }
  52.  
  53. }
  54.  
  55. function deletefromgrablist($line, $where) {
  56. global $scriptpath;
  57.  
  58. $new_file = array( );
  59.  
  60. if ($where == 'waiting') {
  61. $list = '' . $scriptpath . '/rotator/data/grab.list';
  62. } else {
  63. $list = '' . $scriptpath . '/rotator/data/pred_grab.list';
  64. }
  65.  
  66.  
  67. if (file_exists( $list )) {
  68. $grab_list = file( $list );
  69. } else {
  70. $grab_list = array( );
  71. }
  72.  
  73.  
  74. while (list( $k, $v ) = each( $grab_list )) {
  75. if ($k != $line) {
  76. $new_file[] = rtrim( $v );
  77. continue;
  78. }
  79. }
  80.  
  81. $text = join( '
  82. ', $new_file );
  83. $f1 = fopen( $list, 'w' );
  84. fwrite( $f1, $text );
  85. fclose( $f1 );
  86. @chmod( '' . $scriptpath . '/rotator/data/grab.list', 511 );
  87. }
  88.  
  89. function get_text($url, $recursive = 1) {
  90. global $redirect_url;
  91.  
  92. $url = trim( $url );
  93. $content = '';
  94. $ha = parse_url( $url );
  95. $host = $ha['host'];
  96. $port = 80;
  97. $fp = @fsockopen( $host, 80, $errno, $errstr, 5 );
  98.  
  99. if (( $fp && $recursive < 10 )) {
  100. $uri = $ha['path'];
  101.  
  102. if ($uri == '') {
  103. $uri = '/';
  104. }
  105.  
  106. if (isset( $ha['query'] )) {
  107. $uri .= '?' . $ha['query'];
  108. }
  109.  
  110. $last = substr( strrchr( $uri, '/' ), 1 );
  111.  
  112. if (substr( $uri, -1 ) != '/') {
  113. }
  114.  
  115. $query = '' . 'GET ' . $uri . ' HTTP/1.0
  116. Host: ' . $host . '
  117. Accept: */*
  118. Referer:
  119. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
  120. Pragma: no-cache
  121. Cache-Control: no-cache
  122. Connection: close
  123.  
  124. ';
  125. fputs( $fp, $query );
  126. $fgs = fgets( $fp, 256 );
  127.  
  128. if (preg_match( '/HTTP\/1.(\d)\s(\d+)\s(.*)/i', $fgs, $parts )) {
  129. if (isset( $parts[2] )) {
  130. $parts[2] = substr( $parts[2], 0, 3 );
  131. } else {
  132. $parts[2] = '404';
  133. }
  134.  
  135.  
  136. if ($parts[2] == '200') {
  137. $fstatus = 'FOUND';
  138. } else {
  139. if ($parts[2] == '300') {
  140. $fstatus = 'MOVED';
  141. } else {
  142. if ($parts[2] == '301') {
  143. $fstatus = 'MOVED';
  144. } else {
  145. if ($parts[2] == '302') {
  146. $fstatus = 'MOVED';
  147. } else {
  148. if ($parts[2] == '403') {
  149. $fstatus = 'RESTRICTED';
  150. } else {
  151. if ($parts[2] == '404') {
  152. $fstatus = 'NOT FOUND';
  153. } else {
  154. $fstatus = 'ERR ' . $parts[2] . ' - ' . $parts[3];
  155. }
  156. }
  157. }
  158. }
  159. }
  160. }
  161. }
  162.  
  163. if ($fstatus == 'MOVED') {
  164. $header = '';
  165. $k = 1;
  166.  
  167. while (( $fgs = fgets( $fp, 256 ) != '
  168. ' && $k < 10 )) {
  169. ++$k;
  170. $header .= $fgs;
  171. }
  172.  
  173.  
  174. if (preg_match( '/Location:\s([^
  175. ].*)/i', $header, $parts )) {
  176. $new_url = (isset( $parts[1] ) ? $parts[1] : '');
  177.  
  178. if (substr( $new_url, 0, 7 ) != 'http://') {
  179. if ($new_url[0] == '.') {
  180. $new_url = substr( $new_url, 2 );
  181. }
  182.  
  183. $base = 'none';
  184. $new_url = convert_to_url( $url, $new_url, $base );
  185. }
  186.  
  187. $redirect_url = $new_url;
  188. }
  189.  
  190. $content = get_text( $new_url, $recursive + 1 );
  191. } else {
  192. while (!feof( $fp )) {
  193. $g = fgets( $fp, 128 );
  194. $content = $content . $g;
  195. }
  196.  
  197. fclose( $fp );
  198. $content = str_replace( '
  199. ', '', $content );
  200. }
  201. }
  202.  
  203. return $content;
  204. }
  205.  
  206. function links_to_jpg($code) {
  207. preg_match_all( '/href[\s]*="?([\d\w\/.:-]*.(jpg|jpeg)(\s|>|"))/ix', $code, $matches );
  208. $pics = $matches[0];
  209. $kolvo = count( $pics );
  210. return $kolvo;
  211. }
  212.  
  213. function links_to_movies($code) {
  214. preg_match_all( '/href[\s]*="?([\d\w\/.:-]*.(avi|mpg|mpeg|rm|wmv)(\s|>|"))/ix', $code, $matches );
  215. $movies = $matches[0];
  216. $kolvo = count( $movies );
  217. return $kolvo;
  218. }
  219.  
  220. function is_base_href($code) {
  221. $base = 'none';
  222.  
  223. if (preg_match( '/<base\s(.*?)>/i', $code, $matches )) {
  224. if (preg_match( '/href="?\'?([^\'"]*)/i', $matches[1], $matches2 )) {
  225. $base = $matches2[1];
  226. }
  227. }
  228.  
  229. return $base;
  230. }
  231.  
  232. function getcontent($content = '', $block) {
  233. global $collector_file;
  234.  
  235. $header_length = 4;
  236. $start_pos = $header_length + ( $block - 1 ) * 1024 + 1;
  237. $next_block = 0;
  238.  
  239. if (file_exists( $collector_file )) {
  240. $fp = @fopen( $collector_file, 'rb+' );
  241. fseek( $fp, $start_pos );
  242. $next_block = mybin2dec( fread( $fp, 2 ), 2 );
  243. $content .= fread( $fp, 1022 );
  244. fclose( $fp );
  245. }
  246.  
  247. if ($next_block != 0) {
  248. $content .= getcontent( $content, $next_block );
  249. }
  250.  
  251. $content = trim( $content );
  252. return $content;
  253. }
  254.  
  255. function addgallery($url = '') {
  256. global $collector_file;
  257.  
  258. if ($url == '') {
  259. $url = 'none';
  260. }
  261.  
  262. $crc = crc32( $url );
  263.  
  264. if ($crc < 0) {
  265. $crc *= -1;
  266. }
  267.  
  268. $block = intval( $crc % 1000 ) + 1;
  269. $header_length = 4;
  270. $start_pos = $header_length + ( $block - 1 ) * 1024 + 1;
  271.  
  272. if (!file_exists( $collector_file )) {
  273. createdb( $collector_file );
  274. }
  275.  
  276. $fp = @fopen( $collector_file, 'rb+' );
  277. $true = 1;
  278.  
  279. while ($true == 1) {
  280. fseek( $fp, $start_pos );
  281. $next_block = mybin2dec( fread( $fp, 2 ), 2 );
  282.  
  283. if ($next_block == 0) {
  284. $next_block = $block;
  285. $true = -1;
  286. break;
  287. }
  288.  
  289. $start_pos = $header_length + ( $next_block - 1 ) * 1024 + 1;
  290. }
  291.  
  292. $content = fread( $fp, 1022 );
  293. $string = trim( $content ) . $crc . '*';
  294.  
  295. if (1022 < strlen( $string )) {
  296. $string1 = substr( $string, 0, 1022 );
  297. $string2 = substr( $string, 1022 );
  298. } else {
  299. $string1 = $string;
  300. }
  301.  
  302. $last_used_block = getlastusedblock( $fp );
  303.  
  304. if (isset( $string2 )) {
  305. $last_used_block = getlastusedblock( $fp );
  306. $next_block_number = $last_used_block + 1;
  307. fseek( $fp, $start_pos );
  308. fwrite( $fp, mydec2bin( $next_block_number, 2 ) );
  309. } else {
  310. fseek( $fp, $start_pos + 2 );
  311. }
  312.  
  313. fwrite( $fp, $string1 );
  314.  
  315. if (isset( $string2 )) {
  316. $start_pos = $header_length + $last_used_block * 1024 + 1;
  317. fseek( $fp, $start_pos );
  318. fwrite( $fp, mydec2bin( 0, 2 ) );
  319. fwrite( $fp, $string2 );
  320. updatelastusedblock( $fp, $last_used_block + 1 );
  321. }
  322.  
  323. fclose( $fp );
  324. }
  325.  
  326. function getlastusedblock($fp) {
  327. $num = 0;
  328. fseek( $fp, 0 );
  329. $num = mybin2dec( fread( $fp, 1022 ), 4 );
  330.  
  331. if ($num < 1001) {
  332. $num = 1001;
  333. }
  334.  
  335. return $num;
  336. }
  337.  
  338. function updatelastusedblock($fp, $block) {
  339. fseek( $fp, 0 );
  340. $num = mydec2bin( $block, 4 );
  341. fwrite( $fp, $num );
  342. }
  343.  
  344. function createdb($file) {
  345. if (touch( $file )) {
  346. @chmod( $file, 511 );
  347. }
  348.  
  349. }
  350.  
  351. function mybin2dec($str, $len) {
  352. $shift = 0;
  353. $result = 0;
  354.  
  355. for ($i = 0; $i < $len; ++$i) {
  356. $result |= @ord( $str[$i] ) << $shift;
  357. $shift += 8;
  358. }
  359.  
  360. return $result;
  361. }
  362.  
  363. function mydec2bin($num, $bytes) {
  364. $result = '';
  365.  
  366. for ($i = 0; $i < $bytes; ++$i) {
  367. $result .= chr( $num & 255 );
  368. $num = $num >> 8;
  369. }
  370.  
  371. return $result;
  372. }
  373.  
  374. function indb($url = '') {
  375. $crc = crc32( $url );
  376.  
  377. if ($crc < 0) {
  378. $crc *= -1;
  379. }
  380.  
  381. $block = intval( $crc % 1000 ) + 1;
  382. $content = getcontent( '', $block );
  383. $urls = array( );
  384. $urls = explode( '*', $content );
  385.  
  386. while (list( $k, $v ) = each( $urls )) {
  387. $crcs[$v] = '';
  388. }
  389.  
  390.  
  391. if (isset( $crcs[$crc] )) {
  392. return 1;
  393. } else {
  394. return 0;
  395. }
  396.  
  397. }
  398.  
  399. function make_crop_thumb($source_filename, $thumb_name, $thumb_w, $thumb_h, $add_text) {
  400. global $scriptpath;
  401. global $module;
  402. global $im_location_path;
  403. global $quality;
  404. global $brightness;
  405. global $saturation;
  406. global $hue;
  407. global $sharpen;
  408. global $blur;
  409. global $contrast;
  410. global $image_magick_line;
  411. global $align;
  412. global $img_label;
  413. global $opacity;
  414.  
  415. $image_file_name = $source_filename;
  416.  
  417. if ($module == 'gd') {
  418. $sharpen = $sharpen / 100;
  419. }
  420.  
  421. if (file_exists( '' . $scriptpath . '/rotator/tmp/' . $image_file_name )) {
  422. if (check_jpeg( '' . $scriptpath . '/rotator/tmp/' . $image_file_name )) {
  423. $img_src = imagecreatefromjpeg( '' . $scriptpath . '/rotator/tmp/' . $image_file_name );
  424.  
  425. if ($img_src != '') {
  426. $s_w = imagesx( $img_src );
  427. $s_h = imagesy( $img_src );
  428.  
  429. if (( $s_w < 80 || $s_h < 80 )) {
  430. return null;
  431. }
  432.  
  433. $k1 = $thumb_w / $thumb_h;
  434. $k2 = $s_w / $s_h;
  435.  
  436. if ($k2 <= $k1) {
  437. $base = 'w';
  438. } else {
  439. $base = 'h';
  440. }
  441.  
  442.  
  443. if ($base == 'w') {
  444. $img_w = $s_w;
  445. $img_h = round( $s_w / $k1 );
  446. $img_x = 0;
  447. $img_y = round( ( $s_h - $img_h ) / 2 );
  448. }
  449.  
  450. if ($base == 'h') {
  451. $img_h = $s_h;
  452. $img_w = round( $s_h * $k1 );
  453. $img_y = 0;
  454. $img_x = round( ( $s_w - $img_w ) / 2 );
  455. }
  456.  
  457. if ($module == 'im') {
  458. $command_line = '';
  459.  
  460. if (( ( $brightness != '--' || $saturation != '--' ) || $hue != '--' )) {
  461. $command_line .= '-modulate';
  462.  
  463. if ($brightness != '--') {
  464. $command_line .= '' . ' ' . $brightness . ',';
  465. } else {
  466. $command_line .= ',';
  467. }
  468.  
  469.  
  470. if ($saturation != '--') {
  471. $command_line .= '' . $saturation . ',';
  472. } else {
  473. $command_line .= ',';
  474. }
  475.  
  476.  
  477. if ($hue != '--') {
  478. $command_line .= '' . $hue;
  479. }
  480. }
  481.  
  482. if ($contrast == -2) {
  483. $command_line .= ' -contrast -contrast';
  484. }
  485.  
  486. if ($contrast == -1) {
  487. $command_line .= ' -contrast';
  488. }
  489.  
  490. if ($contrast == 1) {
  491. $command_line .= ' +contrast';
  492. }
  493.  
  494. if ($contrast == 2) {
  495. $command_line .= ' +contrast +contrast';
  496. }
  497.  
  498. if ($sharpen != 0) {
  499. $command_line .= '' . ' +sharpen 1.5x' . $sharpen;
  500. }
  501.  
  502. $command_line .= '' . ' -quality ' . $quality;
  503. exec( '' . $im_location_path . 'convert ' . $scriptpath . '/rotator/tmp/' . $image_file_name . ' -crop ' . $img_w . 'x' . $img_h . '+' . $img_x . '+' . $img_y . ' -resize ' . $thumb_w . 'x' . $thumb_h . '! ' . $image_magick_line . ' ' . $command_line . ' ' . $thumb_name );
  504.  
  505. if ($add_text == 'on') {
  506. $gravity = 'South';
  507.  
  508. if ($align == 1) {
  509. $gravity = 'NorthWest';
  510. }
  511.  
  512. if ($align == 2) {
  513. $gravity = 'North';
  514. }
  515.  
  516. if ($align == 3) {
  517. $gravity = 'NorthEast';
  518. }
  519.  
  520. if ($align == 4) {
  521. $gravity = 'West';
  522. }
  523.  
  524. if ($align == 5) {
  525. $gravity = 'Center';
  526. }
  527.  
  528. if ($align == 6) {
  529. $gravity = 'East';
  530. }
  531.  
  532. if ($align == 7) {
  533. $gravity = 'SouthWest';
  534. }
  535.  
  536. if ($align == 8) {
  537. $gravity = 'South';
  538. }
  539.  
  540. if ($align == 9) {
  541. $gravity = 'SouthEast';
  542. }
  543.  
  544. if ($opacity == 100) {
  545. $opacity_text = '';
  546. } else {
  547. $opacity_text = '' . ' -dissolve ' . $opacity;
  548. }
  549.  
  550. $label_file = '' . $scriptpath . '/rotator/data/' . $img_label;
  551.  
  552. if (file_exists( $label_file )) {
  553. exec( '' . $im_location_path . 'composite -gravity ' . $gravity . $opacity_text . ' ' . $label_file . ' ' . $thumb_name . ' ' . $thumb_name );
  554. }
  555. }
  556. } else {
  557. $img_dst = imagecreatetruecolor( $thumb_w, $thumb_h );
  558. $img_tmp = imagecreatetruecolor( $img_w, $img_h );
  559. imagecopyresampled( $img_dst, $img_src, 0, 0, $img_x, $img_y, $thumb_w, $thumb_h, $img_w, $img_h );
  560. $pix = array( );
  561. $width = $thumb_w;
  562. $height = $thumb_h;
  563.  
  564. for ($hc = 0; $hc < $height; ++$hc) {
  565. for ($wc = 0; $wc < $width; ++$wc) {
  566. $rgb = imagecolorat( $img_dst, $wc, $hc );
  567. $pix[$hc][$wc][0] = $rgb >> 16;
  568. $pix[$hc][$wc][1] = $rgb >> 8 & 255;
  569. $pix[$hc][$wc][2] = $rgb & 255;
  570. }
  571. }
  572.  
  573. --$height;
  574. --$width;
  575.  
  576. for ($hc = 1; $hc < $height; ++$hc) {
  577. $r5 = $pix[$hc][0][0];
  578. $g5 = $pix[$hc][0][1];
  579. $b5 = $pix[$hc][0][2];
  580. $hcc = $hc - 1;
  581.  
  582. for ($wc = 1; $wc < $width; ++$wc) {
  583. $r = 0 - $pix[$hcc][$wc][0];
  584. $g = 0 - $pix[$hcc][$wc][1];
  585. $b = 0 - $pix[$hcc][$wc][2];
  586. $r -= $r5 + $r5;
  587. $g -= $g5 + $g5;
  588. $b -= $b5 + $b5;
  589. $r5 = $pix[$hc][$wc][0];
  590. $g5 = $pix[$hc][$wc][1];
  591. $b5 = $pix[$hc][$wc][2];
  592. $r += $r5 * 5;
  593. $g += $g5 * 5;
  594. $b += $b5 * 5;
  595. $r *= 0.5;
  596. $g *= 0.5;
  597. $b *= 0.5;
  598. $r = ( $r - $r5 ) * $sharpen + $r5;
  599. $g = ( $g - $g5 ) * $sharpen + $g5;
  600. $b = ( $b - $b5 ) * $sharpen + $b5;
  601.  
  602. if ($r < 0) {
  603. $r = 0;
  604. } else {
  605. if (255 < $r) {
  606. $r = 255;
  607. }
  608. }
  609.  
  610.  
  611. if ($g < 0) {
  612. $g = 0;
  613. } else {
  614. if (255 < $g) {
  615. $g = 255;
  616. }
  617. }
  618.  
  619.  
  620. if ($b < 0) {
  621. $b = 0;
  622. } else {
  623. if (255 < $b) {
  624. $b = 255;
  625. }
  626. }
  627.  
  628. imagesetpixel( $img_dst, $wc, $hc, $r << 16 | $g << 8 | $b );
  629. }
  630. }
  631.  
  632. imageinterlace( $img_dst, 1 );
  633. imagejpeg( $img_dst, $thumb_name, $quality );
  634. imagedestroy( $img_src );
  635. imagedestroy( $img_tmp );
  636. imagedestroy( $img_dst );
  637. }
  638. }
  639. } else {
  640. return null;
  641. }
  642. }
  643.  
  644. }
  645.  
  646. function icrb($dimg, $simg, $dx, $dy, $sx, $sy, $dw, $dh, $sw, $sh) {
  647. imagepalettecopy( $dimg, $simg );
  648. $rX = $sw / $dw;
  649. $rY = $sh / $dh;
  650. $nY = 0;
  651.  
  652. for ($y = $dy; $y < $dh; ++$y) {
  653. $oY = $nY;
  654. $nY = round( ( $y + 1 ) * $rY );
  655. $nX = 0;
  656.  
  657. for ($x = $dx; $x < $dw; ++$x) {
  658. $oX = $nX;
  659. $nX = round( ( $x + 1 ) * $rX );
  660. $r = $g = $b = $a = 0;
  661.  
  662. for ($i = $nY; $oY <= --$i; ) {
  663. for ($j = $nX; $oX <= --$j; ) {
  664. $c = imagecolorsforindex( $simg, imagecolorat( $simg, $j, $i ) );
  665. $r += $c['red'];
  666. $g += $c['green'];
  667. $b += $c['blue'];
  668. ++$a;
  669. continue;
  670. break;
  671. }
  672. }
  673.  
  674. imagesetpixel( $dimg, $x, $y, imagecolorclosest( $dimg, $r / $a, $g / $a, $b / $a ) );
  675. }
  676. }
  677. }
  678.  
  679. function check_jpeg($f, $fix = false) {
  680. if (false !== $fd = @fopen( $f, 'r+b' )) {
  681. if (fread( $fd, 2 ) == chr( 255 ) . chr( 216 )) {
  682. fseek( $fd, -2, SEEK_END );
  683.  
  684. if (fread( $fd, 2 ) == chr( 255 ) . chr( 217 )) {
  685. fclose( $fd );
  686. return true;
  687. } else {
  688. if (( $fix && fwrite( $fd, chr( 255 ) . chr( 217 ) ) )) {
  689. return true;
  690. }
  691.  
  692. fclose( $fd );
  693. return false;
  694. }
  695. } else {
  696. fclose( $fd );
  697. return false;
  698. }
  699. } else {
  700. return false;
  701. }
  702.  
  703. }
  704.  
  705. function get_image_semi($url, $referer, $content_url, $desc, $niche, $num, $group, $recursive = 1) {
  706. global $scriptpath;
  707. global $thumb_number;
  708. global $needed_thumb_width;
  709. global $needed_thumb_height;
  710. global $is_checked;
  711. global $output_tmp_thumb;
  712. global $add_text;
  713. global $inserted;
  714. global $total_inserted;
  715.  
  716. $text_label_needed = $add_text;
  717. $image_file_name = md5( uniqid( rand( ), true ) ) . '.jpg';
  718. $output_tmp_thumb = md5( uniqid( rand( ), true ) );
  719.  
  720. if (substr( strtolower( $content_url ), -4 ) == '.jpg') {
  721. $url = $content_url;
  722. $text_label_needed = 'off';
  723. }
  724.  
  725. $ha = parse_url( trim( $url ) );
  726. $content = '';
  727. $host = $ha['host'];
  728. $port = 80;
  729.  
  730. if (isset( $ha['port'] )) {
  731. $port = $ha['port'];
  732. }
  733.  
  734. $fp = @fsockopen( $host, $port, $errno, $errstr, 30 );
  735.  
  736. if (( $fp && $recursive < 10 )) {
  737. $fstatus = '';
  738. $uri = $ha['path'];
  739.  
  740. if ($uri == '') {
  741. $uri = '/';
  742. }
  743.  
  744. $last = substr( strrchr( $uri, '/' ), 1 );
  745.  
  746. if (substr( $uri, -1 ) != '/') {
  747. if (strchr( $uri, '.' ) === false) {
  748. $uri = $uri . '/';
  749. }
  750. }
  751.  
  752. $query = 'GET ' . $uri . ' HTTP/1.0
  753. Host: ' . $host . '
  754. Accept: */*
  755. Referer: ' . $referer . '
  756. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
  757. Pragma: no-cache
  758. Cache-Control: no-cache
  759. Connection: close
  760.  
  761. ';
  762. fputs( $fp, $query );
  763. $fgs = fgets( $fp, 256 );
  764.  
  765. if (preg_match( '/HTTP\/1.(\d)\s(\d+)\s(.*)/i', $fgs, $parts )) {
  766. if ($parts[2] == '200') {
  767. $fstatus = 'FOUND';
  768. } else {
  769. if ($parts[2] == '300') {
  770. $fstatus = 'MOVED';
  771. } else {
  772. if ($parts[2] == '301') {
  773. $fstatus = 'MOVED';
  774. } else {
  775. if ($parts[2] == '302') {
  776. $fstatus = 'MOVED';
  777. } else {
  778. if ($parts[2] == '403') {
  779. $fstatus = 'RESTRICTED';
  780. } else {
  781. if ($parts[2] == '404') {
  782. $fstatus = 'NOT FOUND';
  783. } else {
  784. $fstatus = 'ERR ' . $parts[2] . ' - ' . $parts[3];
  785. }
  786. }
  787. }
  788. }
  789. }
  790. }
  791. }
  792.  
  793. if ($fstatus == 'MOVED') {
  794. $header = '';
  795. $k = 1;
  796.  
  797. while (( $fgs = fgets( $fp, 256 ) != '
  798. ' && $k < 10 )) {
  799. ++$k;
  800. $header .= $fgs;
  801. }
  802.  
  803.  
  804. if (preg_match( '/Location:\s([^
  805. ].*)/i', $header, $parts )) {
  806. $new_url = (isset( $parts[1] ) ? $parts[1] : '');
  807.  
  808. if (substr( $new_url, 0, 7 ) != 'http://') {
  809. if ($new_url[0] == '.') {
  810. $new_url = substr( $new_url, 2 );
  811. }
  812.  
  813. $base = 'none';
  814. $new_url = convert_to_url( $url, $new_url, $base );
  815. }
  816. }
  817.  
  818. get_image_semi( $new_url, $referer, $new_url, $desc, $niche, $num, $group, $recursive + 1 );
  819. }
  820.  
  821. if ($fstatus == 'FOUND') {
  822. $cont_len = 0;
  823.  
  824. while ($fgs != '
  825. ') {
  826. $fgs = fgets( $fp, 256 );
  827.  
  828. if (substr( $fgs, 0, 15 ) == 'Content-Length:') {
  829. $cont_len = trim( substr( $fgs, 15 ) );
  830. continue;
  831. }
  832. }
  833.  
  834. if (!$cont_len) {
  835. $cont_len = 'none';
  836. }
  837.  
  838. if (0 < $cont_len) {
  839. $bc = 0;
  840. $filep2 = fopen( '' . $scriptpath . '/rotator/tmp/' . $image_file_name, 'w' );
  841.  
  842. while ($bc < $cont_len) {
  843. $bc += fwrite( $filep2, fread( $fp, $cont_len ) );
  844. }
  845.  
  846. fclose( $filep2 );
  847. @chmod( '' . $scriptpath . '/rotator/tmp/' . $image_file_name, 511 );
  848. $source_filename = $image_file_name;
  849. $thumb_name = '' . $scriptpath . '/rotator/tmp/' . $output_tmp_thumb . '.jpg';
  850. make_crop_thumb( $source_filename, $thumb_name, $needed_thumb_width, $needed_thumb_height, $text_label_needed );
  851.  
  852. if ($is_checked) {
  853. $checked = '';
  854. } else {
  855. $checked = '';
  856. }
  857.  
  858.  
  859. if (file_exists( '' . $scriptpath . '/rotator/tmp/' . $output_tmp_thumb . '.jpg' )) {
  860. $fsize = filesize( '' . $scriptpath . '/rotator/tmp/' . $output_tmp_thumb . '.jpg' );
  861. } else {
  862. $fsize = 0;
  863. }
  864.  
  865. $fsize = round( $fsize / 1024, 2 );
  866.  
  867. if (0 < $fsize) {
  868. echo '' . ' <td valign=top align=center><img src="rotator/tmp/' . $output_tmp_thumb . '.jpg" width="' . $needed_thumb_width . '" height="' . $needed_thumb_height . '" border=1 style="cursor : hand;" onClick="CS(' . $total_inserted . ')"><br><label for="id_' . $total_inserted . '"><b>' . $fsize . ' Kb</b></label> <input id="id_' . $total_inserted . '" type=checkbox' . $checked . ' name="thumbs[]" value="' . $output_tmp_thumb . '|' . $referer . '|' . $desc . '|' . $niche . '|' . $num . '|' . $group . '|' . $needed_thumb_width . '|' . $needed_thumb_height . '"></td>';
  869. ++$inserted;
  870. ++$total_inserted;
  871. }
  872. } else {
  873. while (!feof( $fp )) {
  874. $g = fgets( $fp, 128 );
  875. $content = $content . $g;
  876. }
  877. }
  878.  
  879. fclose( $fp );
  880. }
  881. }
  882.  
  883. }
  884. .......................
  885. ..............
  886. .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement