Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for Zend Encoder/SafeGuard & PhpExpress)
- *
- * @ Version : 1.1.3.0
- * @ Author : DeZender
- * @ Release on : 17.05.2011
- * @ Official site : http://DeZender.Net
- *
- */
- function deleteslashes() {
- global $_POST;
- if (isset( $_POST )) {
- while (list( $key, $value ) = each( $_POST )) {
- $_POST[$key] = str_replace( '|', '_', $_POST[$key] );
- $_POST[$key] = str_replace( '*', '_', $_POST[$key] );
- }
- return $_POST;
- }
- }
- function updatepack($arr) {
- global $scriptpath;
- if (( !is_array( $arr ) || count( $arr ) == 0 )) {
- return false;
- }
- if (file_exists( '' . $scriptpath . '/rotator/network/packs' )) {
- $packs = file( '' . $scriptpath . '/rotator/network/packs' );
- $cur_pack = (isset( $packs[0] ) ? trim( $packs[0] ) : 1);
- if (!file_exists( '' . $scriptpath . '/rotator/network/pack' . $cur_pack )) {
- return false;
- }
- $text = join( '
- ', $arr );
- $text .= '
- ';
- $f1 = fopen( '' . $scriptpath . '/rotator/network/pack' . $cur_pack, 'a' );
- fwrite( $f1, $text );
- fclose( $f1 );
- @chmod( '' . $scriptpath . '/rotator/network/pack' . $cur_pack, 511 );
- }
- }
- function deletefromgrablist($line, $where) {
- global $scriptpath;
- $new_file = array( );
- if ($where == 'waiting') {
- $list = '' . $scriptpath . '/rotator/data/grab.list';
- } else {
- $list = '' . $scriptpath . '/rotator/data/pred_grab.list';
- }
- if (file_exists( $list )) {
- $grab_list = file( $list );
- } else {
- $grab_list = array( );
- }
- while (list( $k, $v ) = each( $grab_list )) {
- if ($k != $line) {
- $new_file[] = rtrim( $v );
- continue;
- }
- }
- $text = join( '
- ', $new_file );
- $f1 = fopen( $list, 'w' );
- fwrite( $f1, $text );
- fclose( $f1 );
- @chmod( '' . $scriptpath . '/rotator/data/grab.list', 511 );
- }
- function get_text($url, $recursive = 1) {
- global $redirect_url;
- $url = trim( $url );
- $content = '';
- $ha = parse_url( $url );
- $host = $ha['host'];
- $port = 80;
- $fp = @fsockopen( $host, 80, $errno, $errstr, 5 );
- if (( $fp && $recursive < 10 )) {
- $uri = $ha['path'];
- if ($uri == '') {
- $uri = '/';
- }
- if (isset( $ha['query'] )) {
- $uri .= '?' . $ha['query'];
- }
- $last = substr( strrchr( $uri, '/' ), 1 );
- if (substr( $uri, -1 ) != '/') {
- }
- $query = '' . 'GET ' . $uri . ' HTTP/1.0
- Host: ' . $host . '
- Accept: */*
- Referer:
- User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
- Pragma: no-cache
- Cache-Control: no-cache
- Connection: close
- ';
- fputs( $fp, $query );
- $fgs = fgets( $fp, 256 );
- if (preg_match( '/HTTP\/1.(\d)\s(\d+)\s(.*)/i', $fgs, $parts )) {
- if (isset( $parts[2] )) {
- $parts[2] = substr( $parts[2], 0, 3 );
- } else {
- $parts[2] = '404';
- }
- if ($parts[2] == '200') {
- $fstatus = 'FOUND';
- } else {
- if ($parts[2] == '300') {
- $fstatus = 'MOVED';
- } else {
- if ($parts[2] == '301') {
- $fstatus = 'MOVED';
- } else {
- if ($parts[2] == '302') {
- $fstatus = 'MOVED';
- } else {
- if ($parts[2] == '403') {
- $fstatus = 'RESTRICTED';
- } else {
- if ($parts[2] == '404') {
- $fstatus = 'NOT FOUND';
- } else {
- $fstatus = 'ERR ' . $parts[2] . ' - ' . $parts[3];
- }
- }
- }
- }
- }
- }
- }
- if ($fstatus == 'MOVED') {
- $header = '';
- $k = 1;
- while (( $fgs = fgets( $fp, 256 ) != '
- ' && $k < 10 )) {
- ++$k;
- $header .= $fgs;
- }
- if (preg_match( '/Location:\s([^
- ].*)/i', $header, $parts )) {
- $new_url = (isset( $parts[1] ) ? $parts[1] : '');
- if (substr( $new_url, 0, 7 ) != 'http://') {
- if ($new_url[0] == '.') {
- $new_url = substr( $new_url, 2 );
- }
- $base = 'none';
- $new_url = convert_to_url( $url, $new_url, $base );
- }
- $redirect_url = $new_url;
- }
- $content = get_text( $new_url, $recursive + 1 );
- } else {
- while (!feof( $fp )) {
- $g = fgets( $fp, 128 );
- $content = $content . $g;
- }
- fclose( $fp );
- $content = str_replace( '
- ', '', $content );
- }
- }
- return $content;
- }
- function links_to_jpg($code) {
- preg_match_all( '/href[\s]*="?([\d\w\/.:-]*.(jpg|jpeg)(\s|>|"))/ix', $code, $matches );
- $pics = $matches[0];
- $kolvo = count( $pics );
- return $kolvo;
- }
- function links_to_movies($code) {
- preg_match_all( '/href[\s]*="?([\d\w\/.:-]*.(avi|mpg|mpeg|rm|wmv)(\s|>|"))/ix', $code, $matches );
- $movies = $matches[0];
- $kolvo = count( $movies );
- return $kolvo;
- }
- function is_base_href($code) {
- $base = 'none';
- if (preg_match( '/<base\s(.*?)>/i', $code, $matches )) {
- if (preg_match( '/href="?\'?([^\'"]*)/i', $matches[1], $matches2 )) {
- $base = $matches2[1];
- }
- }
- return $base;
- }
- function getcontent($content = '', $block) {
- global $collector_file;
- $header_length = 4;
- $start_pos = $header_length + ( $block - 1 ) * 1024 + 1;
- $next_block = 0;
- if (file_exists( $collector_file )) {
- $fp = @fopen( $collector_file, 'rb+' );
- fseek( $fp, $start_pos );
- $next_block = mybin2dec( fread( $fp, 2 ), 2 );
- $content .= fread( $fp, 1022 );
- fclose( $fp );
- }
- if ($next_block != 0) {
- $content .= getcontent( $content, $next_block );
- }
- $content = trim( $content );
- return $content;
- }
- function addgallery($url = '') {
- global $collector_file;
- if ($url == '') {
- $url = 'none';
- }
- $crc = crc32( $url );
- if ($crc < 0) {
- $crc *= -1;
- }
- $block = intval( $crc % 1000 ) + 1;
- $header_length = 4;
- $start_pos = $header_length + ( $block - 1 ) * 1024 + 1;
- if (!file_exists( $collector_file )) {
- createdb( $collector_file );
- }
- $fp = @fopen( $collector_file, 'rb+' );
- $true = 1;
- while ($true == 1) {
- fseek( $fp, $start_pos );
- $next_block = mybin2dec( fread( $fp, 2 ), 2 );
- if ($next_block == 0) {
- $next_block = $block;
- $true = -1;
- break;
- }
- $start_pos = $header_length + ( $next_block - 1 ) * 1024 + 1;
- }
- $content = fread( $fp, 1022 );
- $string = trim( $content ) . $crc . '*';
- if (1022 < strlen( $string )) {
- $string1 = substr( $string, 0, 1022 );
- $string2 = substr( $string, 1022 );
- } else {
- $string1 = $string;
- }
- $last_used_block = getlastusedblock( $fp );
- if (isset( $string2 )) {
- $last_used_block = getlastusedblock( $fp );
- $next_block_number = $last_used_block + 1;
- fseek( $fp, $start_pos );
- fwrite( $fp, mydec2bin( $next_block_number, 2 ) );
- } else {
- fseek( $fp, $start_pos + 2 );
- }
- fwrite( $fp, $string1 );
- if (isset( $string2 )) {
- $start_pos = $header_length + $last_used_block * 1024 + 1;
- fseek( $fp, $start_pos );
- fwrite( $fp, mydec2bin( 0, 2 ) );
- fwrite( $fp, $string2 );
- updatelastusedblock( $fp, $last_used_block + 1 );
- }
- fclose( $fp );
- }
- function getlastusedblock($fp) {
- $num = 0;
- fseek( $fp, 0 );
- $num = mybin2dec( fread( $fp, 1022 ), 4 );
- if ($num < 1001) {
- $num = 1001;
- }
- return $num;
- }
- function updatelastusedblock($fp, $block) {
- fseek( $fp, 0 );
- $num = mydec2bin( $block, 4 );
- fwrite( $fp, $num );
- }
- function createdb($file) {
- if (touch( $file )) {
- @chmod( $file, 511 );
- }
- }
- function mybin2dec($str, $len) {
- $shift = 0;
- $result = 0;
- for ($i = 0; $i < $len; ++$i) {
- $result |= @ord( $str[$i] ) << $shift;
- $shift += 8;
- }
- return $result;
- }
- function mydec2bin($num, $bytes) {
- $result = '';
- for ($i = 0; $i < $bytes; ++$i) {
- $result .= chr( $num & 255 );
- $num = $num >> 8;
- }
- return $result;
- }
- function indb($url = '') {
- $crc = crc32( $url );
- if ($crc < 0) {
- $crc *= -1;
- }
- $block = intval( $crc % 1000 ) + 1;
- $content = getcontent( '', $block );
- $urls = array( );
- $urls = explode( '*', $content );
- while (list( $k, $v ) = each( $urls )) {
- $crcs[$v] = '';
- }
- if (isset( $crcs[$crc] )) {
- return 1;
- } else {
- return 0;
- }
- }
- function make_crop_thumb($source_filename, $thumb_name, $thumb_w, $thumb_h, $add_text) {
- global $scriptpath;
- global $module;
- global $im_location_path;
- global $quality;
- global $brightness;
- global $saturation;
- global $hue;
- global $sharpen;
- global $blur;
- global $contrast;
- global $image_magick_line;
- global $align;
- global $img_label;
- global $opacity;
- $image_file_name = $source_filename;
- if ($module == 'gd') {
- $sharpen = $sharpen / 100;
- }
- if (file_exists( '' . $scriptpath . '/rotator/tmp/' . $image_file_name )) {
- if (check_jpeg( '' . $scriptpath . '/rotator/tmp/' . $image_file_name )) {
- $img_src = imagecreatefromjpeg( '' . $scriptpath . '/rotator/tmp/' . $image_file_name );
- if ($img_src != '') {
- $s_w = imagesx( $img_src );
- $s_h = imagesy( $img_src );
- if (( $s_w < 80 || $s_h < 80 )) {
- return null;
- }
- $k1 = $thumb_w / $thumb_h;
- $k2 = $s_w / $s_h;
- if ($k2 <= $k1) {
- $base = 'w';
- } else {
- $base = 'h';
- }
- if ($base == 'w') {
- $img_w = $s_w;
- $img_h = round( $s_w / $k1 );
- $img_x = 0;
- $img_y = round( ( $s_h - $img_h ) / 2 );
- }
- if ($base == 'h') {
- $img_h = $s_h;
- $img_w = round( $s_h * $k1 );
- $img_y = 0;
- $img_x = round( ( $s_w - $img_w ) / 2 );
- }
- if ($module == 'im') {
- $command_line = '';
- if (( ( $brightness != '--' || $saturation != '--' ) || $hue != '--' )) {
- $command_line .= '-modulate';
- if ($brightness != '--') {
- $command_line .= '' . ' ' . $brightness . ',';
- } else {
- $command_line .= ',';
- }
- if ($saturation != '--') {
- $command_line .= '' . $saturation . ',';
- } else {
- $command_line .= ',';
- }
- if ($hue != '--') {
- $command_line .= '' . $hue;
- }
- }
- if ($contrast == -2) {
- $command_line .= ' -contrast -contrast';
- }
- if ($contrast == -1) {
- $command_line .= ' -contrast';
- }
- if ($contrast == 1) {
- $command_line .= ' +contrast';
- }
- if ($contrast == 2) {
- $command_line .= ' +contrast +contrast';
- }
- if ($sharpen != 0) {
- $command_line .= '' . ' +sharpen 1.5x' . $sharpen;
- }
- $command_line .= '' . ' -quality ' . $quality;
- 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 );
- if ($add_text == 'on') {
- $gravity = 'South';
- if ($align == 1) {
- $gravity = 'NorthWest';
- }
- if ($align == 2) {
- $gravity = 'North';
- }
- if ($align == 3) {
- $gravity = 'NorthEast';
- }
- if ($align == 4) {
- $gravity = 'West';
- }
- if ($align == 5) {
- $gravity = 'Center';
- }
- if ($align == 6) {
- $gravity = 'East';
- }
- if ($align == 7) {
- $gravity = 'SouthWest';
- }
- if ($align == 8) {
- $gravity = 'South';
- }
- if ($align == 9) {
- $gravity = 'SouthEast';
- }
- if ($opacity == 100) {
- $opacity_text = '';
- } else {
- $opacity_text = '' . ' -dissolve ' . $opacity;
- }
- $label_file = '' . $scriptpath . '/rotator/data/' . $img_label;
- if (file_exists( $label_file )) {
- exec( '' . $im_location_path . 'composite -gravity ' . $gravity . $opacity_text . ' ' . $label_file . ' ' . $thumb_name . ' ' . $thumb_name );
- }
- }
- } else {
- $img_dst = imagecreatetruecolor( $thumb_w, $thumb_h );
- $img_tmp = imagecreatetruecolor( $img_w, $img_h );
- imagecopyresampled( $img_dst, $img_src, 0, 0, $img_x, $img_y, $thumb_w, $thumb_h, $img_w, $img_h );
- $pix = array( );
- $width = $thumb_w;
- $height = $thumb_h;
- for ($hc = 0; $hc < $height; ++$hc) {
- for ($wc = 0; $wc < $width; ++$wc) {
- $rgb = imagecolorat( $img_dst, $wc, $hc );
- $pix[$hc][$wc][0] = $rgb >> 16;
- $pix[$hc][$wc][1] = $rgb >> 8 & 255;
- $pix[$hc][$wc][2] = $rgb & 255;
- }
- }
- --$height;
- --$width;
- for ($hc = 1; $hc < $height; ++$hc) {
- $r5 = $pix[$hc][0][0];
- $g5 = $pix[$hc][0][1];
- $b5 = $pix[$hc][0][2];
- $hcc = $hc - 1;
- for ($wc = 1; $wc < $width; ++$wc) {
- $r = 0 - $pix[$hcc][$wc][0];
- $g = 0 - $pix[$hcc][$wc][1];
- $b = 0 - $pix[$hcc][$wc][2];
- $r -= $r5 + $r5;
- $g -= $g5 + $g5;
- $b -= $b5 + $b5;
- $r5 = $pix[$hc][$wc][0];
- $g5 = $pix[$hc][$wc][1];
- $b5 = $pix[$hc][$wc][2];
- $r += $r5 * 5;
- $g += $g5 * 5;
- $b += $b5 * 5;
- $r *= 0.5;
- $g *= 0.5;
- $b *= 0.5;
- $r = ( $r - $r5 ) * $sharpen + $r5;
- $g = ( $g - $g5 ) * $sharpen + $g5;
- $b = ( $b - $b5 ) * $sharpen + $b5;
- if ($r < 0) {
- $r = 0;
- } else {
- if (255 < $r) {
- $r = 255;
- }
- }
- if ($g < 0) {
- $g = 0;
- } else {
- if (255 < $g) {
- $g = 255;
- }
- }
- if ($b < 0) {
- $b = 0;
- } else {
- if (255 < $b) {
- $b = 255;
- }
- }
- imagesetpixel( $img_dst, $wc, $hc, $r << 16 | $g << 8 | $b );
- }
- }
- imageinterlace( $img_dst, 1 );
- imagejpeg( $img_dst, $thumb_name, $quality );
- imagedestroy( $img_src );
- imagedestroy( $img_tmp );
- imagedestroy( $img_dst );
- }
- }
- } else {
- return null;
- }
- }
- }
- function icrb($dimg, $simg, $dx, $dy, $sx, $sy, $dw, $dh, $sw, $sh) {
- imagepalettecopy( $dimg, $simg );
- $rX = $sw / $dw;
- $rY = $sh / $dh;
- $nY = 0;
- for ($y = $dy; $y < $dh; ++$y) {
- $oY = $nY;
- $nY = round( ( $y + 1 ) * $rY );
- $nX = 0;
- for ($x = $dx; $x < $dw; ++$x) {
- $oX = $nX;
- $nX = round( ( $x + 1 ) * $rX );
- $r = $g = $b = $a = 0;
- for ($i = $nY; $oY <= --$i; ) {
- for ($j = $nX; $oX <= --$j; ) {
- $c = imagecolorsforindex( $simg, imagecolorat( $simg, $j, $i ) );
- $r += $c['red'];
- $g += $c['green'];
- $b += $c['blue'];
- ++$a;
- continue;
- break;
- }
- }
- imagesetpixel( $dimg, $x, $y, imagecolorclosest( $dimg, $r / $a, $g / $a, $b / $a ) );
- }
- }
- }
- function check_jpeg($f, $fix = false) {
- if (false !== $fd = @fopen( $f, 'r+b' )) {
- if (fread( $fd, 2 ) == chr( 255 ) . chr( 216 )) {
- fseek( $fd, -2, SEEK_END );
- if (fread( $fd, 2 ) == chr( 255 ) . chr( 217 )) {
- fclose( $fd );
- return true;
- } else {
- if (( $fix && fwrite( $fd, chr( 255 ) . chr( 217 ) ) )) {
- return true;
- }
- fclose( $fd );
- return false;
- }
- } else {
- fclose( $fd );
- return false;
- }
- } else {
- return false;
- }
- }
- function get_image_semi($url, $referer, $content_url, $desc, $niche, $num, $group, $recursive = 1) {
- global $scriptpath;
- global $thumb_number;
- global $needed_thumb_width;
- global $needed_thumb_height;
- global $is_checked;
- global $output_tmp_thumb;
- global $add_text;
- global $inserted;
- global $total_inserted;
- $text_label_needed = $add_text;
- $image_file_name = md5( uniqid( rand( ), true ) ) . '.jpg';
- $output_tmp_thumb = md5( uniqid( rand( ), true ) );
- if (substr( strtolower( $content_url ), -4 ) == '.jpg') {
- $url = $content_url;
- $text_label_needed = 'off';
- }
- $ha = parse_url( trim( $url ) );
- $content = '';
- $host = $ha['host'];
- $port = 80;
- if (isset( $ha['port'] )) {
- $port = $ha['port'];
- }
- $fp = @fsockopen( $host, $port, $errno, $errstr, 30 );
- if (( $fp && $recursive < 10 )) {
- $fstatus = '';
- $uri = $ha['path'];
- if ($uri == '') {
- $uri = '/';
- }
- $last = substr( strrchr( $uri, '/' ), 1 );
- if (substr( $uri, -1 ) != '/') {
- if (strchr( $uri, '.' ) === false) {
- $uri = $uri . '/';
- }
- }
- $query = 'GET ' . $uri . ' HTTP/1.0
- Host: ' . $host . '
- Accept: */*
- Referer: ' . $referer . '
- User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
- Pragma: no-cache
- Cache-Control: no-cache
- Connection: close
- ';
- fputs( $fp, $query );
- $fgs = fgets( $fp, 256 );
- if (preg_match( '/HTTP\/1.(\d)\s(\d+)\s(.*)/i', $fgs, $parts )) {
- if ($parts[2] == '200') {
- $fstatus = 'FOUND';
- } else {
- if ($parts[2] == '300') {
- $fstatus = 'MOVED';
- } else {
- if ($parts[2] == '301') {
- $fstatus = 'MOVED';
- } else {
- if ($parts[2] == '302') {
- $fstatus = 'MOVED';
- } else {
- if ($parts[2] == '403') {
- $fstatus = 'RESTRICTED';
- } else {
- if ($parts[2] == '404') {
- $fstatus = 'NOT FOUND';
- } else {
- $fstatus = 'ERR ' . $parts[2] . ' - ' . $parts[3];
- }
- }
- }
- }
- }
- }
- }
- if ($fstatus == 'MOVED') {
- $header = '';
- $k = 1;
- while (( $fgs = fgets( $fp, 256 ) != '
- ' && $k < 10 )) {
- ++$k;
- $header .= $fgs;
- }
- if (preg_match( '/Location:\s([^
- ].*)/i', $header, $parts )) {
- $new_url = (isset( $parts[1] ) ? $parts[1] : '');
- if (substr( $new_url, 0, 7 ) != 'http://') {
- if ($new_url[0] == '.') {
- $new_url = substr( $new_url, 2 );
- }
- $base = 'none';
- $new_url = convert_to_url( $url, $new_url, $base );
- }
- }
- get_image_semi( $new_url, $referer, $new_url, $desc, $niche, $num, $group, $recursive + 1 );
- }
- if ($fstatus == 'FOUND') {
- $cont_len = 0;
- while ($fgs != '
- ') {
- $fgs = fgets( $fp, 256 );
- if (substr( $fgs, 0, 15 ) == 'Content-Length:') {
- $cont_len = trim( substr( $fgs, 15 ) );
- continue;
- }
- }
- if (!$cont_len) {
- $cont_len = 'none';
- }
- if (0 < $cont_len) {
- $bc = 0;
- $filep2 = fopen( '' . $scriptpath . '/rotator/tmp/' . $image_file_name, 'w' );
- while ($bc < $cont_len) {
- $bc += fwrite( $filep2, fread( $fp, $cont_len ) );
- }
- fclose( $filep2 );
- @chmod( '' . $scriptpath . '/rotator/tmp/' . $image_file_name, 511 );
- $source_filename = $image_file_name;
- $thumb_name = '' . $scriptpath . '/rotator/tmp/' . $output_tmp_thumb . '.jpg';
- make_crop_thumb( $source_filename, $thumb_name, $needed_thumb_width, $needed_thumb_height, $text_label_needed );
- if ($is_checked) {
- $checked = '';
- } else {
- $checked = '';
- }
- if (file_exists( '' . $scriptpath . '/rotator/tmp/' . $output_tmp_thumb . '.jpg' )) {
- $fsize = filesize( '' . $scriptpath . '/rotator/tmp/' . $output_tmp_thumb . '.jpg' );
- } else {
- $fsize = 0;
- }
- $fsize = round( $fsize / 1024, 2 );
- if (0 < $fsize) {
- 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>';
- ++$inserted;
- ++$total_inserted;
- }
- } else {
- while (!feof( $fp )) {
- $g = fgets( $fp, 128 );
- $content = $content . $g;
- }
- }
- fclose( $fp );
- }
- }
- }
- .......................
- ..............
- .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement