/;
$table =~ s/ href="#"/ poundlink/g;
$table =~ s/.*?||si;
if (($SECTION{'DisplayDescriptionAboveOrderForm'} eq "yes") && ($SECTION{'OrderFormOnRight'} ne "yes")) {
$table =~ s|(.*?)||i;
$thisproddescription = $1;
$table =~ s|
$thisproddescription
.*?
||i;
}
if ($SECTION{'DummyStoreID'} ne "") {
$table =~ s|
|
|ig;
}
$table =~ s|
]+type="image" src=".*?"|
||gi;
$table =~ s|Value="Add to Cart"|Value="$LANG{'Add to Cart'}"|gi;
if ($SECTION{'PopUpShoppingCart'} eq "yes") {
$table =~ s|/cp/addtocart.aspx"|/cp/addtocart.aspx" target="cartWin"|i;
$table =~ s|
)|$1
|;
} elsif ($SECTION{'PopUpShoppingCart'} eq "newwindow") {
$table =~ s|/cp/addtocart.aspx"|/cp/addtocart.aspx" target="_blank"|i;
$table =~ s|(addtocart.aspx\".*?>)|$1
|;
} elsif ($SECTION{'PopUpShoppingCart'} eq "frametop") {
$table =~ s|/cp/addtocart.aspx"|/cp/addtocart.aspx" target="_top"|i;
$table =~ s|(addtocart.aspx\".*?>)|$1
|;
} else {
$table =~ s|(addtocart.aspx\".*?>)|$1
|;
}
$table =~ s|
||;
$table =~ s|color:\#000000\;text\-decoration:underline\;|color:\#000000\;|;
$table =~ s|
.*?||;
if ($SECTION{'ShowZoomLink'} eq "no") {
$table =~ s|
]+moredetails\.aspx.+?||g;
} else {
$table =~ s|>View Larger|>$LANG{'View Larger Image'}|;
}
if ($SECTION{'ShowEmailFriendLink'} eq "no") {
$table =~ s|
]+efriend.+?||i;
} else {
$table =~ s|>Tell [^<]+ product!<|>$LANG{'Tell a friend'}<|;
$table =~ s|»|
»|;
}
$table =~ s|\)
(.*?)
$fontstart$1$fontend
(.*?)<|;
$producttype = $2;
$table =~ s|| | | |;
if ($SECTION{'ShowFrontAndBack'} eq "yes") {
if ($table =~ m|Back[_-\w]*\.jpg\" height="240"|) {
$table =~ s|]*>| ]*>click to view.*?name="img1" src="(.*?)".*? | | |;
} else {
$table =~ s|]*>| ]*>click to view.*?name="img2" src="(.*?)".*? | | |;
}
} else {
$table =~ s| | click to view| | click to view|;
}
$table =~ s|class="head"|class="cpshopbig"|g;
$table =~ s|class=\"smallprint(\" style=\")?|class=\"cpshopsmaller\"|g;
$table =~ s|>Qty:<|>$fontstart$LANG{'Quantity'}:$fontend<|;
$table =~ s|>Size:|>$fontstart$LANG{'Size'}:$fontend|;
$table =~ s|>Color:<|>$fontstart$LANG{'Color'}:$fontend<|;
$table =~ s| Original Price \$(.*?) Sale Price \$(.*?) |$LANG{'Original Price'} \$$1 $LANG{'Sale Price'} \$$2 |;
$table =~ s|>View size chart<|>$LANG{'View size chart'}<|i;
$table =~ s|>Kids Small|>$LANG{'Kids Small'}|;
$table =~ s|>Kids Medium|>$LANG{'Kids Medium'}|;
$table =~ s|>Kids Large|>$LANG{'Kids Large'}|;
$table =~ s|>Small|>$LANG{'Small'}|;
$table =~ s|>Medium|>$LANG{'Medium'}|;
$table =~ s|>Large|>$LANG{'Large'}|;
$table =~ s|>X-Large|>$LANG{'X-Large'}|;
$table =~ s|>2X-Large \(|>$LANG{'2X-Large'} \(|;
$table =~ s|>3X-Large \(|>$LANG{'3X-Large'} \(|;
$table =~ s|>4X-Large \(|>$LANG{'4X-Large'} \(|;
$table =~ s|([^A-Za-z\/])img/|${1}http://www.cafepress.com/cp/img/|g;
$table =~ s|(Product Number): (\d+)|$LANG{'Product Number'}: $2|;
$table =~ s|Provided by Store Owner -->(.*?) $fontstart$1$fontend ||i;
$table =~ s|||i;
$table =~ s|||i;
$table =~ s|||i;
$table =~ s|||i;
$table =~ s|||;
if ($SECTION{'ShowProductInformation'} eq "no") {
$table =~ s|Detailed product information below\.||;
$table =~ s|.*?||i;
} else {
$table =~ s|href="#|href="$scripturl$cleanurl$STORE_CRC{$storeid}$cleanurl2$ENV{'QUERY_STRING'}#|g;
$table =~ s///g;
$table =~ s|(.*?) | |$fontstart$1$fontend
|;
}
if ($SECTION{'ShowAdditionalPhotos'} eq "no") {
$table =~ s|.*?||;
} elsif ($SECTION{'ShowAdditionalPhotos'} eq "split") {
$table =~ s|(_2.jpg.*?).*?|$1 |
|;
}
$table =~ s|Additional Photos:|
$fontstart$LANG{'Additional Photos'}:$fontend|;
$table =~ s|>click to view
front / back:<|>$LANG{'click to view'}
$LANG{'front back'}:<|i;
$table =~ s/(storeid\=\Q$storeid\E)\&(storeid\=\Q$storeid\E)/storeid=$storeid/g;
$table =~ s/(storecrc\=$STORE_CRC{$storeid})\&(storecrc\=$STORE_CRC{$storeid})/storecrc=$STORE_CRC{$storeid}/g;
if ($SECTION{'ShowConverter'} eq "yes") {
$table =~ s|(.*?)(\d+\.\d+)(.*?)||;
#$table =~ s|Price -->
(.*?)(\d+\.\d+)()?()?|Price -->$1$2$3$4
$SECTION{'ShowConverterText'}|;
}
$table =~ s|(.*?)|$1|;
# Inventory Status
$table =~ s|In Stock: Will ship in 2-3 business days\.|$LANG{'In Stock: Will ship in 2-3 business days.'}|;
#$table =~ s|>Front Image:<|>$LANG{'Front Image'}:<|;
#$table =~ s|>Back Image:<|>$LANG{'Back Image'}:<|;
$table =~ s|Image (\d+):\s*|$LANG{'Image'} $1: |g;
$table =~ s|
()
|$1|;
$table =~ s|'media_player.aspx\?|'http://www.cafepress.com/cp/media_player.aspx\?pid=[<[pid]>]&cjpid=[<[cjpid]>]&xid=[<[xid]>]&tid=[<[tid]>]\&|g;
#$table = qq($table);
$table =~ s/ poundlink/ href="javascript:void(returnFalse())"/g;
$table =~ s/style="padding:5px;background-color:#006699;"/id="orderingbox"/;
$table =~ s|.*?||gi;
if ($SECTION{'ShowCarousel'} eq "no") {
$table =~ s|| |;
$table =~ s| | |;
}
# Skim international pricing content
if ($prepagejs =~ m|var sellPrice = parseFloat\('([\d\.]+)'\)\;|) {
$pageSellPrice = $1;
if ($pageSellPrice =~ /\.$/) {
$pageSellPrice .= "0";
}
if ($pageSellPrice =~ /\.\d$/) {
$pageSellPrice .= "0";
}
if ($prepagejs =~ m|var curRate = ([\d\.]+)\;|) {
$pageCurRate = $1;
$pageCurSign = '$';
$prepagejs =~ s| [^<]+| $pageCurSign$pageSellPrice|g;
$table =~ s| [^<]+| $pageCurSign$pageSellPrice|g;
$prepagejs =~ s|var sellPriceId = document.getElementById\('sellPriceId'\)\;|curRate="1";curSign='$pageCurSign';curCode='';var sellPriceId = document.getElementById('sellPriceId');|;
while ($table =~ m|\(\+[\\$]([\d\.]+) \([A-Z]{3}\)|) {
$pageCurPriceCounter++;
$pageCurExtraPrice = $1;
$pageNewExtraPrice = int(($1 / $pageCurRate) + .5) . ".00";
$table =~ s|\(\+[\\$]([\d\.]+) \([A-Z]{3}\)\)|(\+\$$pageNewExtraPrice)|;
last if $pageCurPriceCounter > 20;
}
}
}
$productAreaWidthDiv = " ";
$content .= qq($prepagejs\n$scripts\n\n$productjs\n$productAreaWidthDiv\n$table);
$content =~ s|||i;
$content =~ s|\.aspx\?|\.aspx\?pid=[<[pid]>]&cjpid=[<[cjpid]>]&xid=[<[xid]>]&tid=[<[tid]>]\&|g;
$content =~ s|\.aspx([\"\'\#])|\.aspx?pid=[<[pid]>]&cjpid=[<[cjpid]>]&xid=[<[xid]>]&tid=[<[tid]>]$1|g;
$content =~ s|addtocart\.aspx\?pid=\[<\[pid\]>\]\&cjpid=\[<\[cjpid\]>\]\&xid=\[<\[xid\]>\]\&tid\=\[<\[tid\]>\]|addtocart.aspx|g;
$content =~ s|"http://www.$cpdomain/cp/addtocart.aspx"|"$realurl"|;
$jsi = 0;
for($jsi=1;$jsi<=$jscounter;$jsi++) {
$content =~ s/~~~jsreplacehere$jsi~~~/$INPAGEJS{$jsi}/;
}
$content =~ s|/cp/bin/http_request\.js|http://www.cafepress.com/cp/bin/http_request.js|gi;
$content =~ s|addthis:url="http://www.cafepress.com/|addthis:url="$scripturl$cleanurl$STORE_CRC{$storeid}/|g;
$content =~ s|fb:like href="http://www.cafepress.com/|fb:like href="$scripturl$cleanurl$STORE_CRC{$storeid}/|g;
} else {
&commonscripts;
$scripts = $commonscripts;
$content .= qq($scripts);
foreach $thumb(sort { $THUMBDATA{$a}{'sort_priority'} <=> $THUMBDATA{$b}{'sort_priority'} } keys %THUMBDATA) {
if ($THUMBDATA{$thumb}{'type'} eq "p") {
#found something!
$foundaproduct = 1;
$storeprefix = $THUMBDATA{$thumb}{'store_id'};
$productdigits = $THUMBDATA{$thumb}{'product_no'};
$productnumber = "$storeprefix.$productdigits";
$producttypeno = $THUMBDATA{$thumb}{'product_type_no'};
#$afterproductnumber = $3;
push @products, $productnumber;
if ($THUMBDATA{$thumb}{'img_url'}) {
$THUMB{$productnumber} = $THUMBDATA{$thumb}{'img_url'};
} else {
if ($THUMBDATA{$thumb}{'img'} eq "B") {
$THUMB{$productnumber} = "http://images.cafepress.com/product/${productdigits}v99_150x150_Back.jpg";
} else {
$THUMB{$productnumber} = "http://images.cafepress.com/product/${productdigits}v99_150x150_Front.jpg";
}
}
$TYPE{$productnumber} = $THUMBDATA{$thumb}{'caption'};
$ALTTYPE{$productnumber} = $THUMBDATA{$thumb}{'caption'};
$ALTTYPE{$productnumber} =~ s|\"|\"\;|g;
$PRICE{$productnumber} = sprintf("%1.2f",$THUMBDATA{$thumb}{'sell_price'});
#$SALECODE{$productnumber} = $8;
#$content .= qq(\n\n\n\n);
if ($page > 1) {
$prodlinkpageadd = "/-/$page";
} else {
#$prodlinkpageadd = "/-/-";
}
$LINE{'linksrc'} = qq($scripturl$cleanurl) . urlcommify(qq($STORE_CRC{$storeid}/$productnumber$prodlinkpageadd) . urlify($TYPE{$productnumber},"/-/-"));
$LINE{'linkstarts'} = qq( );
$LINE{'thumbnail'} = qq( );
$LINE{'thumbsrc'} = $THUMB{$productnumber};
$LINE{'productname'} = $TYPE{$productnumber};
$LINE{'productcost'} = qq(\$$PRICE{$productnumber});
$LINE{'costconvert'} = qq[$SECTION{'ShowConverterText'}];
$LINE{'producttext'} = $THUMBDATA{$thumb}{'product_description'};
$LINE{'producttypeno'} = $THUMBDATA{$thumb}{'product_type_no'};
$LINE{'linkends'} = qq();
$LINE{'storeid'} = $storeid;
$LINE{'productnumber'} = $productnumber;
$LINE{'productno'} = $THUMBDATA{$thumb}{'product_no'};
$LINE{'productstoreid'} = $THUMBDATA{$thumb}{'store_id'};
$LINE{'parentsectionno'} = $THUMBDATA{$thumb}{'parent_section_no'};
$LINE{'alias'} = $STORE_CRC{$storeid};
&getmorecolordata;
if (($THUMBDATA{$thumb}{'multiple_colors'} eq "true") && (!$NOCOLORS{$productdigits})) {
$LINE{'morecolors'} = qq( );
} else {
$LINE{'morecolors'} = qq( );
}
#$LINE{'salecode'} = $SALECODE{$productnumber};
my $cell = $SECTION{'productcelltemplate'};
if ($SECTION{'GetHooks'} eq "yes") {
$buildinggrid = 1;
$cell = gethooks($cell);
$buildinggrid = 0;
} else {
$cell =~ s/<\[hook:\w+\]>//g;
}
$cell =~ s/<\[(.*?)\]>/$LINE{$1}/g;
my $dimensions = qq(height="$SECTION{'thumbheight'}" oldwidth="$SECTION{'thumbwidth'}");
$cell =~ s/height="120" oldwidth="120"/$dimensions/;
#if ($SECTION{'ShowConverter'} eq "yes") {
#$cell =~ s| | \s*$|$LINE{'costconvert'}|i;
#}
$line = $cell;
$line =~ s|"/cp/img/|"http://www.cafepress.com/cp/img/|g;
$line =~ s|"/content/|"http://www.cafepress.com/content/|g;
$line_counter++;
$CELLS{$line_counter} = $line;
$SORT_PRODUCTNAME{$line_counter} = $TYPE{$productnumber};
$SORT_PRODUCTCOST{$line_counter} = $PRICE{$productnumber};
$SORT_PRODUCTNUMBER{$line_counter} = $productdigits;
$SORT_PRODUCTTYPENO{$line_counter} = $LINE{'producttypeno'};
$SORT_STOREID{$line_counter} = $storeprefix;
$SORT_CELLTYPE{$line_counter} = 1;
$SORT_SORTPRIORITY{$line_counter} = $THUMBDATA{$thumb}{'sort_priority'};
$SORT_RANDOM{$line_counter} = substr(substr($productnumber, -4, 4) * substr(time, 0, -4) * 7, -4, 4);
$CONTAINSPTD{$LINE{'producttypeno'}} = 1;
push @cells, $line_counter;
} elsif ($THUMBDATA{$thumb}{'type'} eq "s") {
if ($FILTER{'name'} && !exists($FILTER{'inherit'})) { next; }
if ($FILTER{'cost'} && !exists($FILTER{'inherit'})) { next; }
if ($FILTER{'type'} && !exists($FILTER{'inherit'})) { next; }
next if $KILLSECTIONS{$THUMBDATA{$thumb}{'section_no'}};
$storeprefix = $THUMBDATA{$thumb}{'store_id'};
$sectionnumber = $THUMBDATA{$thumb}{'section_no'};
$storetitle = $THUMBDATA{$thumb}{'caption'};
if ($THUMBDATA{$thumb}{'img_type'} =~ /^\w+$/) {
$extension = $THUMBDATA{$thumb}{'img_type'};
} else {
$extension = "jpg";
}
if ($THUMBDATA{$thumb}{'img'}) {
$storethumb = "http://logo.cafepress.com/" . substr($THUMBDATA{$thumb}{'img'},length($THUMBDATA{$thumb}{'img'}) - 1,1) . "/" . $THUMBDATA{$thumb}{'img'} . "." . $extension;
} else {
$storethumb = "";
}
$teaser = $THUMBDATA{$thumb}{'teaser'};
$storetitle_encoded = $storetitle;
$storetitle_encoded =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$LINE{'linksrc'} = qq($scripturl$cleanurl) . urlcommify(qq($STORE_CRC{$storeid}/$storeprefix/$sectionnumber) . urlify($storetitle,"/-"));
$LINE{'linkstarts'} = qq();
if ($storethumb) {
$LINE{'thumbnail'} = qq(
);
$LINE{'thumbsrc'} = $storethumb;
} else {
$LINE{'thumbnail'} = qq();
$LINE{'thumbsrc'} = "http://content.cafepress.com/global/img/spacer.gif";
}
$LINE{'storename'} = $storetitle;
$LINE{'linkends'} = qq();
$LINE{'storeid'} = $storeid;
$LINE{'teaser'} = $teaser;
$LINE{'parentsectionno'} = $THUMBDATA{$thumb}{'parent_section_no'};
$LINE{'alias'} = $STORE_CRC{$storeid};
$LINE{'sectionstoreid'} = $THUMBDATA{$thumb}{'store_id'};
my $cell = $SECTION{'storecelltemplate'};
if ($SECTION{'GetHooks'} eq "yes") {
$buildinggrid = 1;
$cell = gethooks($cell);
$buildinggrid = 0;
} else {
$cell =~ s/<\[hook:\w+\]>//g;
}
$cell =~ s/<\[(.*?)\]>/$LINE{$1}/g;
my $dimensions = qq(height="$SECTION{'thumbheight'}" width="$SECTION{'thumbwidth'}");
$cell =~ s/height="150" width="150"/$dimensions/;
$line = $cell;
$line_counter++;
$CELLS{$line_counter} = $line;
$SORT_PRODUCTNAME{$line_counter} = $storetitle;
$SORT_PRODUCTCOST{$line_counter} = 999999999999;
$SORT_PRODUCTNUMBER{$line_counter} = 0;
$SORT_PRODUCTTYPENO{$line_counter} = 0;
$SORT_STOREID{$line_counter} = "$storeprefix.$sectionnumber";
$SORT_CELLTYPE{$line_counter} = 0;
$SORT_SORTPRIORITY{$line_counter} = 10000 - $THUMBDATA{$thumb}{'sort_priority'};
$SORT_RANDOM{$line_counter} = 0;
push @cells, $line_counter;
}
if (!$foundaproduct) {
if ((-e "${script_dir}$cpcache/$crc.txt") && (-M "${script_dir}$cpcache/$crc.txt" > 0.04)) {
unlink("${script_dir}$cpcache/$crc.txt");
}
}
}
}
}
sub get_filters {
my $get = $_[0];
while ($get =~ /(\,)?cpfilter_(name|cost|newest|sort|keywords|description|template|prodtemplate|columns|rowsperpage|inherit|type|literal|killsection)/) {
# cpfilter_name:mug (with "mug" in the name)
# cpfilter_name:-mug (without "mug" in the name)
# cpfilter_cost:17.99 (with a price of 17.99)
# cpfilter_cost:~17.99 (priced 17.99 and under)
# cpfilter_cost:17.99~ (priced 17.99 and up)
# cpfilter_newest:10 (newest 10 items)
# cpfilter_sort:productname,productcostup,productcostdown,storeid,storeidrev,old2new,new2old
$get =~ s/(\,)?cpfilter_([^\#\&\,]*)//;
my $code = $2;
my($code,$code_content) = split(/\:/,$code,2);
$code_content =~ s/\++/ /g;
$code_content =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($FILTER{$code}) {
$FILTER{$code} .= "\0";
}
$FILTER{$code} .= $code_content;
if ($code eq "killsection") {
$KILLSECTIONS{$code_content} = $code_content;
}
}
if (($storeid =~ /cpfilter_inherit/) && !$processed_inheritance && $prodstore) {
$processed_inheritance = 1;
$inherited_get = &get_filters($storeid);
} else {
foreach my $piece(split(/\s*\,\s*/,$storeid)) {
if ($piece =~ /cpfilter_template:/) {
$piece =~ s/^cpfilter_template://;
$inherited_template = $piece;
}
if ($piece =~ /cpfilter_prodtemplate:/) {
$piece =~ s/^cpfilter_prodtemplate://;
$inherited_prodtemplate = $piece;
}
}
}
return $get;
}
sub getmorecolordata {
unless ($gotnocolors) {
$gotnocolors = 1;
if (-e "${script_dir}$main_script.nocolors") {
my $nc;
open(NC,"<${script_dir}$main_script.nocolors");
{ local $/; $nc = ; }
close(NC);
$nc =~ s/[^0-9 ]/ /g;
$nc =~ s/\s+/ /g;
$nc =~ s/ $//;
$nc =~ s/^ //;
foreach $line(split(/ /,$nc)) {
$NOCOLORS{$line} = 1;
}
}
}
}
sub crc32_calc #-- Calculate 32-bit CRC checksum -----------------------------------------------------------------
{
# 32 BIT ANSI X3.66 CRC checksum
# Based on C source: http://www.snippets.org/snippets/portable/CRC_32+C.php3, Copyright (C) 1986 Gary S. Brown
# Converted to Perl by: Cusimano.Com Corporation, http://www.cusimano.com
local($s) = @_;
local($n, $crc, $i) = (length($s), 0xFFFFFFFF, 0);
&crc32_init if (!defined(@crc32_table));
for ($i = 0; $i < $n; $i++)
{ $crc = $crc32_table[($crc ^ ord(substr($s, $i, 1))) & 0xff] ^ ($crc >> 8) }
$crc = ~$crc;
if ($crc == 0) {
return 999;
} else {
return $crc;
}
}
sub crc32_init #-- Initialize 32-bit CRC checksum polynomial table -----------------------------------------------
{
# CRC polynomial 0xedb88320
# Polynomial: X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
@crc32_table =
(
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
);
}
sub gencdat {
local $s = shift;
local $o = shift;
$sids = join ",",@_;
#if (length($s) > 13000) {
# $s = "";
#}
$rdm = int(rand(38))+1;
$S = qq(\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x63\x61\x66\x65\x70\x72\x65\x73\x73\x2e\x63\x6f\x6d\x2f\x63\x70\x2f\x73\x74\x6f\x72\x65\x74\x73\x76\x2e\x61\x73\x70\x78\x3f\x69\x70\x3d);
local $d2 = qq($S&id=$sids).&genxdat.qq($o§ions=$s&pw=).(237*$rdm).'.'.ksprintf($rdm,jsprintf(2));
local $d = usprintf($d2);
#&textplain;
#print "$d2\n";
#print "$d\n\n\n\n";
$cdatdebug = 1;
if ($cdatdebug) {
$cdatdebugger++;
open(DEBUG,">${script_dir}$cpcache/$main_script.cdat.txt");
print DEBUG localtime(time);
#print DEBUG "$d2\n\n";
#print DEBUG "$d";
close(DEBUG);
}
return $d;
}
sub genndat {
local $t = shift;
local $n = shift;
local $S = qq(\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x63\x61\x66\x65\x70\x72\x65\x73\x73\x2e\x63\x6f\x6d\x2f\x63\x70\x2f\x73\x74\x6f\x72\x65\x74\x73\x76\x2e\x61\x73\x70\x78\x3f\x69\x70\x3d);
local $d = usprintf(qq($S&$t=$n));
return $d;
}
sub genxdat {
if (-e "${script_dir}cpdata.lib") {
return "&freepass=yes";
}
}
sub pad { if (length($_[0]) < 2) { return "0$_[0]"; } else { return $_[0]; } }
sub let { @ab=(A..Z);return $ab[int(rand(@ab))]; }
sub usprintf {
my $e;
my $g = $_[0];
my $h = $_[1];
my $f = $g;
$f =~ s|.*?//||;
$f =~ s|^[^/]+||;
pp(99,qq(usprintf request));
pp(99,qq(\$h is $h));
pp(99,qq(\$g is $g));
pp(99,qq(\$f is $f));
unless ($h) {
$h = "www.$cpdomain";
}
if (-e "${script_dir}forcelwp.txt") {
BEGIN {
eval "use LWP::Simple";
}
$e = get($g);
} elsif (-e "${script_dir}lwp_alt.lib") {
$lwp_alt_g = $g;
require "${script_dir}lwp_alt.lib";
&lwp_alt;
$e = $lwp_alt_e;
} else {
BEGIN {
eval "use LWP::Simple";
if ($@ || $nolwp) {
$ERROR{'LWP'} = $@;
$nolwp = 1;
}
}
if (!$nolwp) {
$e = get($g);
}
if (!$e) {
use IO::Socket;
my $socket = new IO::Socket::INET (PeerAddr => $h, PeerPort => 80, Proto => 'tcp') or &noconnection($!,$h,5);
$socket->autoflush (1);
my @text;
print $socket "GET $f HTTP/1.1\015\012",
"Host: www.$cpdomain\015\012",
"Connection: close\015\012",
"User-Agent: cpshop\015\012\015\012";
while (<$socket>) {
push @text, $_;
}
$socket->close;
$htmlfile = join '', @text;
($headers,$e) = split(/\r?\n\r?\n/,$htmlfile,2);
$e =~ s/^0[0-9ABCDEF]{7}\r?\n//;
$e =~ s/\r?\n0[0-9ABCDEF]{7}\r?\n//g;
}
}
if (($e =~ />CafePress.com : Error) || ($e =~ /^\s*$/)) {
&noconnection("CafePress is undergoing maintenance.","",6);
}
return $e;
}
sub jsprintf {
if ($ip) {
return $ip . "_" . getdt(1);
} elsif (-e "${script_dir}cpcache/local.ip") {
open(IP,"${script_dir}cpcache/local.ip");
{ local $/; $ip = ; }
close(IP);
$ip =~ s/_.*//;
$ip =~ s/[^\d\.]//g;
return $ip . "_" . getdt(1);
} else {
$ip = usprintf("${S}1");
open(IP,">${script_dir}cpcache/local.ip");
print IP $ip;
close(IP);
$ip =~ s/_.*//;
$ip =~ s/[^\d\.]//g;
return $ip . "_" . getdt(1);
}
}
sub ksprintf {
local($rdm,$str) = @_;$i=0;
local $c; local @n;
local @s = split(//,$str);
foreach $c(@s) {
$i++;push @n, int((ord($c)*$rdm)+$i) . let(1);
}
return join '', @n;
}
sub getdt {
$date = localtime;
($second, $minute, $hour, $day, $month, $year, $weekday, $dayofyear, $isdst) = localtime(time);
$year += 1900; $month = pad($month + 1); $day = pad($day); $hour = pad($hour); $minute = pad($minute); $second = pad($second);
return "$year-$month-$day $hour:$minute:$second";
}
sub urlcommify {
my $bit = $_[0];
if ($SECTION{'UseSEOLinks'} eq "yes") {
#$bit =~ s|/|,|g;
#$bit =~ s|,-,-,|,|;
$bit =~ s|\.|\-|;
$bit =~ s|/|\.|g;
$bit =~ s|\.\-\.-\+|\+|;
$bit =~ s|\.-\+|\+|;
#$bit =~ s|\.|/|;
#$bit =~ s|,-,|_|;
$bit .= $SECTION{'SEOLinksYesExtension'};
}
return $bit;
}
sub urlify {
if ($SECTION{'UseSEOLinks'} eq "custom") {
return $SECTION{'SEOLinksCustomText'};
} elsif ($SECTION{'UseSEOLinks'} eq "yes") {
$toencode = $_[0];
$toencode =~ tr/A-Z/a-z/;
$toencode =~ s/ \& / and /g;
$toencode =~ s/^\s+//;
$toencode =~ s/\s+$//;
$toencode =~ s/\s/\-/g;
$toencode =~ s/[^a-z0-9\-_\.]//g;
return $_[1] . "+" . $toencode;
} else {
return "";
}
}
sub commonscripts {
unless ($SECTION{'HideCommonCSS'} eq "yes") {
$commonscripts = <<"ENDHTML";
ENDHTML
}
$geturllink = qq($scripturl$cleanurl) . urlcommify(qq($STORE_CRC{$storeid}/$realstoreid/) . $THUMBDATA{"$realstoreid.$productno"}{'parent_section_no'});
$commonscripts .= <<"ENDHTML";
ENDHTML
unless ($SECTION{'HideCommonJS'} eq "yes") {
$commonscripts .= <<"ENDHTML";
ENDHTML
}
$commonscripts .= <<"ENDHTML";
$SECTION{'StyleOverride'}
ENDHTML
}
sub loadingscreen {
$lstype = $_[0];
if ($SECTION{'DisplayNowLoading'} eq "yes") {
if ($lstype eq "on") {
unless ($loadingscreen) {
&texthtml;
print qq($SECTION{'NowLoadingHTML'});
$loadingscreen = 1;
}
} elsif ($lstype eq "off") {
if ($loadingscreen) {
print qq(\n);
}
}
}
}
sub texthtml {
if (!$headersprinted) {
unless (@ARGV && ($ARGV[0] !~ /^conv\:/)) {
print "Content-Type: text/html\n\n";
$headersprinted = 1;
push @ARGV, "noheader";
}
}
}
sub textplain {
if (!$headersprinted) {
print "Content-Type: text/plain\n\n";
$headersprinted = 1;
}
}
sub pp {
$gopp = 0;
if ($gopp == $_[0]) {
if (!$pp) {
$pp = 1;
&textplain;
}
if ($_[1] eq "end") {
exit;
} else {
print "$_[1]\n";
}
}
}
#end cppage.lib
1;